From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jack Min Subject: [PATCH v3 2/3] app/testpmd: add commands of modify MAC address Date: Thu, 11 Oct 2018 13:31:43 +0000 Message-ID: <20181011133109.1520-3-jackmin@mellanox.com> References: <20181010131108.24167-1-jackmin@mellanox.com> <20181011133109.1520-1-jackmin@mellanox.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Cc: "dev@dpdk.org" To: Adrien Mazarguil , Wenzhuo Lu , Jingjing Wu , Bernard Iremonger , John McNamara , Marko Kovacevic Return-path: Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00073.outbound.protection.outlook.com [40.107.0.73]) by dpdk.org (Postfix) with ESMTP id 6E8E81B5B3 for ; Thu, 11 Oct 2018 15:31:45 +0200 (CEST) In-Reply-To: <20181011133109.1520-1-jackmin@mellanox.com> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 Acked-by: Yongseok Koh --- app/test-pmd/cmdline_flow.c | 50 +++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 8 ++++ 2 files changed, 58 insertions(+) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 3efc2d86e..a527b6bb4 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, }; =20 /** Maximum size for pattern in struct rte_flow_item_raw. */ @@ -841,6 +845,8 @@ static const enum index next_action[] =3D { ACTION_MAC_SWAP, ACTION_DEC_TTL, ACTION_SET_TTL, + ACTION_SET_MAC_SRC, + ACTION_SET_MAC_DST, ZERO, }; =20 @@ -949,6 +955,12 @@ static const enum index action_set_ipv4_src[] =3D { ZERO, }; =20 +static const enum index action_set_mac_src[] =3D { + ACTION_SET_MAC_SRC_MAC_SRC, + ACTION_NEXT, + ZERO, +}; + static const enum index action_set_ipv4_dst[] =3D { ACTION_SET_IPV4_DST_IPV4_DST, ACTION_NEXT, @@ -991,6 +1003,12 @@ static const enum index action_jump[] =3D { ZERO, }; =20 +static const enum index action_set_mac_dst[] =3D { + 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[] =3D { (struct rte_flow_action_set_ttl, ttl_value)), .call =3D parse_vc_conf, }, + [ACTION_SET_MAC_SRC] =3D { + .name =3D "set_mac_src", + .help =3D "set source mac address", + .priv =3D PRIV_ACTION(SET_MAC_SRC, + sizeof(struct rte_flow_action_set_mac)), + .next =3D NEXT(action_set_mac_src), + .call =3D parse_vc, + }, + [ACTION_SET_MAC_SRC_MAC_SRC] =3D { + .name =3D "mac_addr", + .help =3D "new source mac address", + .next =3D NEXT(action_set_mac_src, NEXT_ENTRY(MAC_ADDR)), + .args =3D ARGS(ARGS_ENTRY_HTON + (struct rte_flow_action_set_mac, mac_addr)), + .call =3D parse_vc_conf, + }, + [ACTION_SET_MAC_DST] =3D { + .name =3D "set_mac_dst", + .help =3D "set destination mac address", + .priv =3D PRIV_ACTION(SET_MAC_DST, + sizeof(struct rte_flow_action_set_mac)), + .next =3D NEXT(action_set_mac_dst), + .call =3D parse_vc, + }, + [ACTION_SET_MAC_DST_MAC_DST] =3D { + .name =3D "mac_addr", + .help =3D "new destination mac address to set", + .next =3D NEXT(action_set_mac_dst, NEXT_ENTRY(MAC_ADDR)), + .args =3D ARGS(ARGS_ENTRY_HTON + (struct rte_flow_action_set_mac, mac_addr)), + .call =3D parse_vc_conf, + }, }; =20 /** Remove and return last entry from argument stack. */ diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testp= md_app_ug/testpmd_funcs.rst index 77233987b..1ca3e8c20 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -3744,6 +3744,14 @@ This section lists supported actions and their attri= butes, if any. - ``set_ttl``: Set TTL value with specificed value - ``ttl_value {unsigned}``: The new TTL value to be set =20 +- ``set_mac_src``: set source MAC address + + - ``mac_addr {MAC-48}``: new source MAC address + +- ``set_mac_dst``: set destination MAC address + + - ``mac_addr {MAC-48}``: new destination MAC address + Destroying flow rules ~~~~~~~~~~~~~~~~~~~~~ =20 --=20 2.17.1