ethdev: add generic MAC address rewrite actions
rte_flow actions: - RTE_FLOW_ACTION_TYPE_SET_MAC_SRC - RTE_FLOW_ACTION_TYPE_SET_MAC_DST added in order to offload to NIC The rte_flow_itme_eth must be present in rte_flow pattern Signed-off-by: Xiaoyu Min <jackmin@mellanox.com> Acked-by: Yongseok Koh <yskoh@mellanox.com> Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
This commit is contained in:
parent
a7cb5bcd28
commit
15dbcdaada
@ -2239,6 +2239,36 @@ in pattern, Some PMDs will reject rule because behaviour will be undefined.
|
|||||||
| ``ttl_value`` | new TTL value |
|
| ``ttl_value`` | new TTL value |
|
||||||
+---------------+--------------------+
|
+---------------+--------------------+
|
||||||
|
|
||||||
|
Action: ``SET_MAC_SRC``
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
Set source MAC address
|
||||||
|
|
||||||
|
.. _table_rte_flow_action_set_mac_src:
|
||||||
|
|
||||||
|
.. table:: SET_MAC_SRC
|
||||||
|
|
||||||
|
+--------------+---------------+
|
||||||
|
| Field | Value |
|
||||||
|
+==============+===============+
|
||||||
|
| ``mac_addr`` | MAC address |
|
||||||
|
+--------------+---------------+
|
||||||
|
|
||||||
|
Action: ``SET_MAC_DST``
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
Set source MAC address
|
||||||
|
|
||||||
|
.. _table_rte_flow_action_set_mac_dst:
|
||||||
|
|
||||||
|
.. table:: SET_MAC_DST
|
||||||
|
|
||||||
|
+--------------+---------------+
|
||||||
|
| Field | Value |
|
||||||
|
+==============+===============+
|
||||||
|
| ``mac_addr`` | MAC address |
|
||||||
|
+--------------+---------------+
|
||||||
|
|
||||||
Negative types
|
Negative types
|
||||||
~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
@ -138,6 +138,8 @@ static const struct rte_flow_desc_data rte_flow_desc_action[] = {
|
|||||||
MK_FLOW_ACTION(MAC_SWAP, 0),
|
MK_FLOW_ACTION(MAC_SWAP, 0),
|
||||||
MK_FLOW_ACTION(DEC_TTL, 0),
|
MK_FLOW_ACTION(DEC_TTL, 0),
|
||||||
MK_FLOW_ACTION(SET_TTL, sizeof(struct rte_flow_action_set_ttl)),
|
MK_FLOW_ACTION(SET_TTL, sizeof(struct rte_flow_action_set_ttl)),
|
||||||
|
MK_FLOW_ACTION(SET_MAC_SRC, sizeof(struct rte_flow_action_set_mac)),
|
||||||
|
MK_FLOW_ACTION(SET_MAC_DST, sizeof(struct rte_flow_action_set_mac)),
|
||||||
};
|
};
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -1593,6 +1593,26 @@ enum rte_flow_action_type {
|
|||||||
* See struct rte_flow_action_set_ttl
|
* See struct rte_flow_action_set_ttl
|
||||||
*/
|
*/
|
||||||
RTE_FLOW_ACTION_TYPE_SET_TTL,
|
RTE_FLOW_ACTION_TYPE_SET_TTL,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set source MAC address from matched flow.
|
||||||
|
*
|
||||||
|
* If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_ETH,
|
||||||
|
* the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
|
||||||
|
*
|
||||||
|
* See struct rte_flow_action_set_mac.
|
||||||
|
*/
|
||||||
|
RTE_FLOW_ACTION_TYPE_SET_MAC_SRC,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set destination MAC address from matched flow.
|
||||||
|
*
|
||||||
|
* If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_ETH,
|
||||||
|
* the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
|
||||||
|
*
|
||||||
|
* See struct rte_flow_action_set_mac.
|
||||||
|
*/
|
||||||
|
RTE_FLOW_ACTION_TYPE_SET_MAC_DST,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2010,6 +2030,15 @@ struct rte_flow_action_set_ttl {
|
|||||||
uint8_t ttl_value;
|
uint8_t ttl_value;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RTE_FLOW_ACTION_TYPE_SET_MAC
|
||||||
|
*
|
||||||
|
* Set MAC address from the matched flow
|
||||||
|
*/
|
||||||
|
struct rte_flow_action_set_mac {
|
||||||
|
uint8_t mac_addr[ETHER_ADDR_LEN];
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Definition of a single action.
|
* Definition of a single action.
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user