summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorXiaoyu Min <jackmin@mellanox.com>2018-10-11 13:31:43 +0000
committerFerruh Yigit <ferruh.yigit@intel.com>2018-10-18 10:24:39 +0200
commit4dff9e297606b7a1ac13b822f970692d663d88a3 (patch)
treed6850ff7f55a7b5aa6113d96fc5800efa93889a0 /app
parent15dbcdaada77e55f2faf7bdcc8575c74934539e3 (diff)
downloaddpdk-4dff9e297606b7a1ac13b822f970692d663d88a3.zip
dpdk-4dff9e297606b7a1ac13b822f970692d663d88a3.tar.gz
dpdk-4dff9e297606b7a1ac13b822f970692d663d88a3.tar.xz
app/testpmd: add commands to modify MAC address
add commands to support following actions: - RTE_FLOW_ACTION_TYPE_SET_MAC_SRC - RTE_FLOW_ACTION_TYPE_SET_MAC_DST Signed-off-by: Xiaoyu Min <jackmin@mellanox.com> Acked-by: Yongseok Koh <yskoh@mellanox.com>
Diffstat (limited to 'app')
-rw-r--r--app/test-pmd/cmdline_flow.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 3efc2d8..a527b6b 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -259,6 +259,10 @@ enum index {
ACTION_DEC_TTL,
ACTION_SET_TTL,
ACTION_SET_TTL_TTL,
+ ACTION_SET_MAC_SRC,
+ ACTION_SET_MAC_SRC_MAC_SRC,
+ ACTION_SET_MAC_DST,
+ ACTION_SET_MAC_DST_MAC_DST,
};
/** Maximum size for pattern in struct rte_flow_item_raw. */
@@ -841,6 +845,8 @@ static const enum index next_action[] = {
ACTION_MAC_SWAP,
ACTION_DEC_TTL,
ACTION_SET_TTL,
+ ACTION_SET_MAC_SRC,
+ ACTION_SET_MAC_DST,
ZERO,
};
@@ -949,6 +955,12 @@ static const enum index action_set_ipv4_src[] = {
ZERO,
};
+static const enum index action_set_mac_src[] = {
+ ACTION_SET_MAC_SRC_MAC_SRC,
+ ACTION_NEXT,
+ ZERO,
+};
+
static const enum index action_set_ipv4_dst[] = {
ACTION_SET_IPV4_DST_IPV4_DST,
ACTION_NEXT,
@@ -991,6 +1003,12 @@ static const enum index action_jump[] = {
ZERO,
};
+static const enum index action_set_mac_dst[] = {
+ ACTION_SET_MAC_DST_MAC_DST,
+ ACTION_NEXT,
+ ZERO,
+};
+
static int parse_init(struct context *, const struct token *,
const char *, unsigned int,
void *, unsigned int);
@@ -2670,6 +2688,38 @@ static const struct token token_list[] = {
(struct rte_flow_action_set_ttl, ttl_value)),
.call = parse_vc_conf,
},
+ [ACTION_SET_MAC_SRC] = {
+ .name = "set_mac_src",
+ .help = "set source mac address",
+ .priv = PRIV_ACTION(SET_MAC_SRC,
+ sizeof(struct rte_flow_action_set_mac)),
+ .next = NEXT(action_set_mac_src),
+ .call = parse_vc,
+ },
+ [ACTION_SET_MAC_SRC_MAC_SRC] = {
+ .name = "mac_addr",
+ .help = "new source mac address",
+ .next = NEXT(action_set_mac_src, NEXT_ENTRY(MAC_ADDR)),
+ .args = ARGS(ARGS_ENTRY_HTON
+ (struct rte_flow_action_set_mac, mac_addr)),
+ .call = parse_vc_conf,
+ },
+ [ACTION_SET_MAC_DST] = {
+ .name = "set_mac_dst",
+ .help = "set destination mac address",
+ .priv = PRIV_ACTION(SET_MAC_DST,
+ sizeof(struct rte_flow_action_set_mac)),
+ .next = NEXT(action_set_mac_dst),
+ .call = parse_vc,
+ },
+ [ACTION_SET_MAC_DST_MAC_DST] = {
+ .name = "mac_addr",
+ .help = "new destination mac address to set",
+ .next = NEXT(action_set_mac_dst, NEXT_ENTRY(MAC_ADDR)),
+ .args = ARGS(ARGS_ENTRY_HTON
+ (struct rte_flow_action_set_mac, mac_addr)),
+ .call = parse_vc_conf,
+ },
};
/** Remove and return last entry from argument stack. */