summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorRahul Lakkireddy <rahul.lakkireddy@chelsio.com>2018-10-06 21:15:34 +0530
committerFerruh Yigit <ferruh.yigit@intel.com>2018-10-11 18:53:49 +0200
commit8287597059ad374925a21349302ed1b1e71dd194 (patch)
treeaef6861ca08e8ed9c0d27d1ec1cf8d237c342489 /app
parent48f523f62563cbc9c4916fdfe1b6ec3a283fbf68 (diff)
downloaddpdk-8287597059ad374925a21349302ed1b1e71dd194.zip
dpdk-8287597059ad374925a21349302ed1b1e71dd194.tar.gz
dpdk-8287597059ad374925a21349302ed1b1e71dd194.tar.xz
ethdev: add flow action to swap MAC addresses
This action is useful for offloading loopback mode, where the hardware will swap source and destination MAC addresses in the outermost Ethernet header before looping back the packet. This action can be used in conjunction with other rewrite actions to achieve MAC layer transparent NAT where the MAC addresses are swapped before either the source or destination MAC address is rewritten and NAT is performed. Must be used with a valid RTE_FLOW_ITEM_TYPE_ETH flow pattern item. Otherwise, RTE_FLOW_ERROR_TYPE_ACTION error should be returned by the PMDs. Original work by Shagun Agrawal Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com> Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
Diffstat (limited to 'app')
-rw-r--r--app/test-pmd/cmdline_flow.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index a9888ca..4a27642 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -255,6 +255,7 @@ enum index {
ACTION_SET_TP_SRC_TP_SRC,
ACTION_SET_TP_DST,
ACTION_SET_TP_DST_TP_DST,
+ ACTION_MAC_SWAP,
};
/** Maximum size for pattern in struct rte_flow_item_raw. */
@@ -834,6 +835,7 @@ static const enum index next_action[] = {
ACTION_SET_IPV6_DST,
ACTION_SET_TP_SRC,
ACTION_SET_TP_DST,
+ ACTION_MAC_SWAP,
ZERO,
};
@@ -2626,6 +2628,14 @@ static const struct token token_list[] = {
(struct rte_flow_action_set_tp, port)),
.call = parse_vc_conf,
},
+ [ACTION_MAC_SWAP] = {
+ .name = "mac_swap",
+ .help = "Swap the source and destination MAC addresses"
+ " in the outermost Ethernet header",
+ .priv = PRIV_ACTION(MAC_SWAP, 0),
+ .next = NEXT(NEXT_ENTRY(ACTION_NEXT)),
+ .call = parse_vc,
+ },
};
/** Remove and return last entry from argument stack. */