From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60056.outbound.protection.outlook.com [40.107.6.56]) by dpdk.org (Postfix) with ESMTP id 1032C1B2AE for ; Wed, 3 Oct 2018 22:09:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wbxkeScZgm9bGBf/f6B4ZNL7fuZtOG+tcpL0Kc3q47Y=; b=NDu0dOgNaliWUalml2Ta7b4rah7MHkx+iAg9BNyzyEb/X01gLGNsghvC4dt0ZcW+FspJDS7Qsb7kbxnV6iJioHtTUad1IrVoGadVKUXCDZYONvATSK1muY9bfLIbj7hsGskrTgTuIU3ePpgFTJmkuqxpmfamyLyBcwybifgctgk= Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com (52.134.72.27) by DB3PR0502MB4076.eurprd05.prod.outlook.com (52.134.66.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1164.22; Wed, 3 Oct 2018 20:09:14 +0000 Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::1cb0:661b:ecab:6045]) by DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::1cb0:661b:ecab:6045%2]) with mapi id 15.20.1185.024; Wed, 3 Oct 2018 20:09:14 +0000 From: Yongseok Koh To: Jack Min CC: "ferruh.yigit@intel.com" , Adrien Mazarguil , Wenzhuo Lu , Jingjing Wu , Bernard Iremonger , John McNamara , Marko Kovacevic , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH 2/3] app/testpmd: add commands of modify MAC address Thread-Index: AQHUW1T0nqKonKFOUUepCxD9arXLyA== Date: Wed, 3 Oct 2018 20:09:13 +0000 Message-ID: <20181003200903.GE26206@mtidpdk.mti.labs.mlnx> References: <20180925150340.25378-1-jackmin@mellanox.com> <20180925150340.25378-3-jackmin@mellanox.com> In-Reply-To: <20180925150340.25378-3-jackmin@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MWHPR15CA0060.namprd15.prod.outlook.com (2603:10b6:301:4c::22) To DB3PR0502MB3980.eurprd05.prod.outlook.com (2603:10a6:8:10::27) authentication-results: spf=none (sender IP is ) smtp.mailfrom=yskoh@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [209.116.155.178] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB3PR0502MB4076; 6:MC3fx+wt21G+oZ0om3WMk/CYX50Hs98/N+R59eiR3ntkho8x9jHkChaPB1wO+KNscyiPRmZmVsg/hlZ4xQqpw1eLNWaiuGyX/JnKEcXg/6FuCSVKiWT665zms5+Dfg9vYyhYOnYj+fTAUY8vNvLbkcnE14FCD2vdBuJlhJfrL6Q0E7D9KVJnU1MhhinFRdW2jNEEtdT9JAkY9eTmTKWkdCI2/99lUxkGw5IRADPK5FSodmCt+OfOxkAwIttaxuN1Cuz6KoryZSNLVhd8ZxDp3ANo0v0FJjAPQN4T0qVKc6I/V2YrnvIAMYnLPqLJ+8OVBXNjBJCha5FvoVoj8ys8KREXM8GU5vQUx+lm3aa5kRmaTb4KlK9NRSps0gY9wNVi7ogl5iud5r4UUaD6cb8wS/dsTW2RInAxL8FwpIt22qM6HKFY7ICq54axNNpOYvbI4SwKIny9JcvI1vvMv0i1Lw==; 5:ul+veFe49CrA3C/0EbyfZ1TKi/HAvu1SiNI2lmU33Iiht9VAnTHJf+8yz7p7JmXBxMKVVlYrQ1XWl1tO2LdOjsw2DKy1eEbCPSWsRMYcGoURHYOOk5wdCKwy01QB3vgyZVuuC1Kq9NjN4dAcOu/A09q/RWkVC2iguQQQ8XtxE9M=; 7:gRBb/qYOcQoneTBegvk8MUOK4BGc+FW+q6EuBLeaeESf5Nbmvrp/NFYHsCukk7UhdB67LwVnBToDZzRk2xR24m0NSJf/4S55sWZ14NdyZ99Q+etGmQFWiX5WZY3OQNIh9jcQsOAS99pxWQIn3Kzud7kanzak79+t4W841pEsb6wrN/V+30zk1cU/Oig8LGZGSEPKNJ4PfA2AghcagwEycP7y4swYR3SPMhHypEacUH57APwsy5XGEK3L+j8scgpD x-ms-office365-filtering-correlation-id: 9e9f2387-5812-42a8-a05d-08d6296c16d4 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB3PR0502MB4076; x-ms-traffictypediagnostic: DB3PR0502MB4076: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(10201501046)(3231355)(944501410)(52105095)(93006095)(93001095)(6055026)(149066)(150057)(6041310)(20161123560045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(201708071742011)(7699051); SRVR:DB3PR0502MB4076; BCL:0; PCL:0; RULEID:; SRVR:DB3PR0502MB4076; x-forefront-prvs: 0814A2C7A3 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(366004)(346002)(376002)(396003)(39860400002)(199004)(189003)(26005)(71200400001)(33896004)(71190400001)(386003)(99286004)(25786009)(6506007)(106356001)(6246003)(54906003)(4326008)(2900100001)(186003)(316002)(6862004)(7736002)(33656002)(86362001)(1076002)(105586002)(9686003)(486006)(229853002)(256004)(11346002)(476003)(446003)(81156014)(53936002)(6486002)(305945005)(6512007)(66066001)(14444005)(6116002)(6636002)(8936002)(81166006)(5660300001)(14454004)(3846002)(2906002)(102836004)(97736004)(8676002)(478600001)(68736007)(52116002)(6436002)(5250100002)(76176011); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB4076; H:DB3PR0502MB3980.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: CJgFE+lhZQ1WRWp8NsweEHaj9qgMs4W3qxkoqxTKvxqA2rMloWujJJBHwnMJirqxZx++f4Jw47Pq7e/EhOq8qg6ucQ21+9w3AuJRXUZonA2Q5uWYjaXWNxdnpK3Ce4YHFqMaNohLpGB5+dtGeinGWJsQ2igKDNN5Myto36fY9jmasbd8NVOi3nsIW9+EdAJmf0aRANZJ62QWVnrnQxz8YrjugHA+yNu1ZJ85sQvThbzizz2jaHzzlwezSfE75Pi3RjqYy1BqN42geuCFHNtLsrORrrF9D36JxLEKpbiNNfROSOfxjSvH+Q17PgksgjFOdEPNYcfiT3RffilLapmPewgQrM+owoaclefCHm3waWA= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-ID: <7B3F4C33A0081E44A03CD7273AFC05A6@eurprd05.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9e9f2387-5812-42a8-a05d-08d6296c16d4 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Oct 2018 20:09:13.9736 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0502MB4076 Subject: Re: [dpdk-dev] [PATCH 2/3] app/testpmd: add commands of modify MAC address X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Oct 2018 20:09:15 -0000 On Tue, Sep 25, 2018 at 11:03:39PM +0800, Xiaoyu Min wrote: > add commands to support following actions: >=20 > - RTE_FLOW_ACTION_TYPE_SET_MAC_SRC > - RTE_FLOW_ACTION_TYPE_SET_MAC_DST >=20 > Signed-off-by: Xiaoyu Min > --- Acked-by: Yongseok Koh Thanks > app/test-pmd/cmdline_flow.c | 50 +++++++++++++++++++++ > app/test-pmd/config.c | 4 ++ > doc/guides/testpmd_app_ug/testpmd_funcs.rst | 8 ++++ > 3 files changed, 62 insertions(+) >=20 > diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c > index fae825462..d06e75799 100644 > --- a/app/test-pmd/cmdline_flow.c > +++ b/app/test-pmd/cmdline_flow.c > @@ -258,6 +258,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. */ > @@ -839,6 +843,8 @@ static const enum index next_action[] =3D { > ACTION_SET_TP_DST, > ACTION_DEC_TTL, > ACTION_SET_TTL, > + ACTION_SET_MAC_SRC, > + ACTION_SET_MAC_DST, > ZERO, > }; > =20 > @@ -947,6 +953,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, > @@ -989,6 +1001,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); > @@ -2654,6 +2672,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/app/test-pmd/config.c b/app/test-pmd/config.c > index d28b6ed14..c2cbf5ce8 100644 > --- a/app/test-pmd/config.c > +++ b/app/test-pmd/config.c > @@ -1177,6 +1177,10 @@ static const struct { > MK_FLOW_ACTION(DEC_TTL, 0), > 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)), > }; > =20 > /** Compute storage space needed by action configuration and copy it. */ > diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/tes= tpmd_app_ug/testpmd_funcs.rst > index db68c4346..0a8cc73a3 100644 > --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst > +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst > @@ -3726,6 +3726,14 @@ This section lists supported actions and their att= ributes, 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 >=20