From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20089.outbound.protection.outlook.com [40.107.2.89]) by dpdk.org (Postfix) with ESMTP id 3B5FB1B113 for ; Wed, 24 Oct 2018 12:49:52 +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=UMqlZnov+yQxCp8l+ZLNxXMy2JgfE9prIgmnKwWCh0I=; b=OBYeoUBivpo+pfk1v2MbuDdlrfM2WYTvSqEskNYyVXGegME3wX/QBgrKPMADislbZ9IXzxeuhBAHe7EgaPGoTsCvT/xLq8ZuD0WHG0uXWhEckWHr1U+fnBj0+d01ToZzjtRsZMCg9f73LliMSTTwCtboWpFxZLts1YFP+gSC3q8= Received: from VI1PR05MB3440.eurprd05.prod.outlook.com (10.170.239.18) by VI1PR05MB5455.eurprd05.prod.outlook.com (20.177.201.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1250.30; Wed, 24 Oct 2018 10:49:49 +0000 Received: from VI1PR05MB3440.eurprd05.prod.outlook.com ([fe80::fcd0:7d8f:ee3e:3a8d]) by VI1PR05MB3440.eurprd05.prod.outlook.com ([fe80::fcd0:7d8f:ee3e:3a8d%4]) with mapi id 15.20.1250.028; Wed, 24 Oct 2018 10:49:49 +0000 From: Ori Kam To: Dekel Peled , "wenzhuo.lu@intel.com" , "jingjing.wu@intel.com" , "bernard.iremonger@intel.com" , "olivier.matz@6wind.com" , Adrien Mazarguil , Thomas Monjalon , "ferruh.yigit@intel.com" , "arybchenko@solarflare.com" CC: Shahaf Shuler , "dev@dpdk.org" , Dekel Peled Thread-Topic: [dpdk-dev] [PATCH v2 1/2] app/testpmd: fix metadata API and Tx insertion Thread-Index: AQHUa2IEPi1C1SjThkqBIiOk8JFgVKUuN7UA Date: Wed, 24 Oct 2018 10:49:49 +0000 Message-ID: References: <1540301331-51065-1-git-send-email-dekelp@mellanox.com> <1540362120-14570-1-git-send-email-dekelp@mellanox.com> In-Reply-To: <1540362120-14570-1-git-send-email-dekelp@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=orika@mellanox.com; x-originating-ip: [193.47.165.251] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; VI1PR05MB5455; 6:njN+unm53V22dbHG+5EPALxwVDbmzY8usMcodRYLDgOwaGu2elUy5gbkZkYTVtFu5exMB7u26GM+TxHtVefUQEJD4c54XbiyWynUpizYAgwZ++j5jXjzPLaAWw+0pyXGSvWU1Ja0ZR6+z/nFWfNhEy6/TKPAVAbMjRa4HKch4t0H2sL1txfslFiW4kVxDufdfJYROMSFFF4g2zAFo3z40GaPpsi7M/DApMtutw8hhdAvZ0CrVPiokxvtFYwesWUUtsVi7q/2hNaNNeqXtp/hp3Oh0mN0UYpOs42namuofEWj4pK8F8sWjpVtAWbFH5nfSjbESWbYKZ/nmhq2UVHTh7eKBeT9q6IDBCCV4sKFXMHJ47/ccNYIAGDK0g41ESWIe2ANAlBdTTIvv6DzmBaozV4U4t5EdOiJPmwU6F09DVX5ic4s2f5SAZ/cijKUAYR4nkfPl77jsOmv3x5FXmJMfA==; 5:dCaEkXKahKXdq5/Xha+Z3k6tA1DLrXym3CWpm0Bs2+Q//i/ECinpkZddGz9g0Y8GWtxH/raSDk5s3r3ydeBBnNj2FLrVU4uSmc4ebdb69CNBiFIXXhC4svvHV6bWSxDkaSnL5ZhIfLqX+WtKHewEJvcqABRpZq4fEjN0lDawCR8=; 7:RRTABjpp9MnoOa6s3vsCu2rHjeDHFboO/R/PdwYt6gNRoKgIh9ZF8wFJga6pN7Bcr8z9P0pYfsoI3Awk82lrvrq6eCgOK4ZOrX0B17vED/ERO9K8V02RdmUOxJRHoVIn/Y8jTnh/kguCe4P0vA3x09Gg9ih1jtc41PLoMX/pWQ+mgGr4GZs3z9nwWoQ0PE9+2hW5VRKdzgonb5RZeKgU+7wMGiaXeOyV366SKKDXt7run7BwGxUn5HgyH9KvhU2y x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: 64df6b06-c802-4d4d-5eb6-08d6399e6ba3 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:VI1PR05MB5455; x-ms-traffictypediagnostic: VI1PR05MB5455: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(228905959029699); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(3231355)(944501410)(52105095)(10201501046)(93006095)(93001095)(6055026)(148016)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201708071742011)(7699051)(76991095); SRVR:VI1PR05MB5455; BCL:0; PCL:0; RULEID:; SRVR:VI1PR05MB5455; x-forefront-prvs: 083526BF8A x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(376002)(346002)(136003)(39860400002)(396003)(13464003)(189003)(199004)(4326008)(7736002)(575784001)(33656002)(486006)(2201001)(86362001)(476003)(478600001)(2900100001)(9686003)(14454004)(74316002)(53936002)(2906002)(316002)(55016002)(305945005)(6246003)(5250100002)(97736004)(99286004)(229853002)(106356001)(68736007)(71190400001)(6436002)(66066001)(256004)(2501003)(76176011)(71200400001)(3846002)(26005)(6116002)(110136005)(105586002)(54906003)(81166006)(81156014)(102836004)(5660300001)(8936002)(11346002)(446003)(25786009)(6506007)(7696005)(186003)(53546011)(107886003); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR05MB5455; H:VI1PR05MB3440.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: /Zs6RUoQLnxtYNU5jCkQV+1CF4LD8WS+RrMSLwl/SFj9rjQhM/hctbNWtJ3RH3VmnaEHogQ7suvhXcHYvSkASOAZgGwOx7xmCqfAT4uSqlM7uswah8FSxClrhban9ruUtWV0tHaqWNva1wVP/A/TYT7RHNvcGjlvMicL45i9ugPpF3I8nyxTnEVJdGn4+qak03gKuy3Sl1G+Dw1BMtk0p2a4ey8AfusmTwAWN+TmYCCd32paaYWmnpmz4q6VLkRmngET3P/tLij5pFyo9sSu+G3NdU6Dv2Ng+gznWZdPHFyC6D9pDydFCwpSajBgvAmH1YD3Ua+sz+T/1WVA34k96zfcMPejzeg9G9TA7qt5jn8= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 64df6b06-c802-4d4d-5eb6-08d6399e6ba3 X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Oct 2018 10:49:49.2519 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB5455 Subject: Re: [dpdk-dev] [PATCH v2 1/2] app/testpmd: fix metadata API and Tx insertion 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, 24 Oct 2018 10:49:52 -0000 > -----Original Message----- > From: dev On Behalf Of Dekel Peled > Sent: Wednesday, October 24, 2018 9:22 AM > To: wenzhuo.lu@intel.com; jingjing.wu@intel.com; > bernard.iremonger@intel.com; olivier.matz@6wind.com; Adrien Mazarguil > ; Thomas Monjalon ; > ferruh.yigit@intel.com; arybchenko@solarflare.com > Cc: Shahaf Shuler ; dev@dpdk.org; Ori Kam > ; Dekel Peled > Subject: [dpdk-dev] [PATCH v2 1/2] app/testpmd: fix metadata API and Tx > insertion >=20 > Previous patch introduces the Tx metadata feature, with unnecessary > restrictions on data entry. > It also used the metadata in txonly fwd engine only. >=20 > This fix removes the data entry restrictions on metadata item. > It also implements callback function to add the metadata in every > Tx packet, sent by any fwd engine. >=20 > Fixes: 32eef22f0b79 ("app/testpmd: support metadata as flow rule item") > Cc: dekelp@mellanox.com >=20 > --- > v2: > No change in this patch. > Modified other patch in series. > --- >=20 > Signed-off-by: Dekel Peled > --- > app/test-pmd/cmdline.c | 5 +++++ > app/test-pmd/cmdline_flow.c | 7 +------ > app/test-pmd/testpmd.h | 7 +++++++ > app/test-pmd/txonly.c | 9 -------- > app/test-pmd/util.c | 51 > +++++++++++++++++++++++++++++++++++++++++++++ > 5 files changed, 64 insertions(+), 15 deletions(-) >=20 > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c > index fc74b95..27264eb 100644 > --- a/app/test-pmd/cmdline.c > +++ b/app/test-pmd/cmdline.c > @@ -17718,6 +17718,11 @@ struct cmd_config_tx_metadata_specific_result { > if (port_id_is_invalid(res->port_id, ENABLED_WARN)) > return; > ports[res->port_id].tx_metadata =3D rte_cpu_to_be_32(res->value); > + /* Add/remove callback to insert valid metadata in every Tx packet. */ > + if (ports[res->port_id].tx_metadata) > + add_tx_md_callback(res->port_id); > + else > + remove_tx_md_callback(res->port_id); > } >=20 > cmdline_parse_token_string_t cmd_config_tx_metadata_specific_port =3D > diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c > index 7932b54..dfb7c147 100644 > --- a/app/test-pmd/cmdline_flow.c > +++ b/app/test-pmd/cmdline_flow.c > @@ -548,11 +548,6 @@ struct parse_action_priv { > ZERO, > }; >=20 > -static const enum index item_param_is[] =3D { > - ITEM_PARAM_IS, > - ZERO, > -}; > - > static const enum index next_item[] =3D { > ITEM_END, > ITEM_VOID, > @@ -2094,7 +2089,7 @@ static int comp_vc_action_rss_queue(struct context > *, const struct token *, > [ITEM_META_DATA] =3D { > .name =3D "data", > .help =3D "metadata value", > - .next =3D NEXT(item_meta, NEXT_ENTRY(UNSIGNED), > item_param_is), > + .next =3D NEXT(item_meta, NEXT_ENTRY(UNSIGNED), > item_param), > .args =3D ARGS(ARGS_ENTRY_MASK_HTON(struct > rte_flow_item_meta, > data, "\xff\xff\xff\xff")), > }, > diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h > index c07548e..102f2f4 100644 > --- a/app/test-pmd/testpmd.h > +++ b/app/test-pmd/testpmd.h > @@ -198,6 +198,7 @@ struct rte_port { > #endif > /**< metadata value to insert in Tx packets. */ > rte_be32_t tx_metadata; > + const struct rte_eth_rxtx_callback *tx_set_md_cb[MAX_QUEUE_ID+1]; > }; >=20 > /** > @@ -781,6 +782,12 @@ uint16_t dump_tx_pkts(uint16_t port_id, uint16_t > queue, struct rte_mbuf *pkts[], > void remove_tx_dump_callbacks(portid_t portid); > void configure_rxtx_dump_callbacks(uint16_t verbose); >=20 > +uint16_t tx_pkt_set_md(uint16_t port_id, __rte_unused uint16_t queue, > + struct rte_mbuf *pkts[], uint16_t nb_pkts, > + __rte_unused void *user_param); > +void add_tx_md_callback(portid_t portid); > +void remove_tx_md_callback(portid_t portid); > + > /* > * Work-around of a compilation error with ICC on invocations of the > * rte_be_to_cpu_16() function. > diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c > index fae84ca..1f08b6e 100644 > --- a/app/test-pmd/txonly.c > +++ b/app/test-pmd/txonly.c > @@ -253,15 +253,6 @@ > pkt->l2_len =3D sizeof(struct ether_hdr); > pkt->l3_len =3D sizeof(struct ipv4_hdr); > pkts_burst[nb_pkt] =3D pkt; > - > - /* > - * If user configured metadata value add it to packet > - * and set ol_flags accordingly > - */ > - if (ports[fs->tx_port].tx_metadata) { > - pkt->tx_metadata =3D ports[fs->tx_port].tx_metadata; > - pkt->ol_flags |=3D PKT_TX_METADATA; > - } > } > nb_tx =3D rte_eth_tx_burst(fs->tx_port, fs->tx_queue, pkts_burst, nb_pk= t); > /* > diff --git a/app/test-pmd/util.c b/app/test-pmd/util.c > index f4125df..687bfa4 100644 > --- a/app/test-pmd/util.c > +++ b/app/test-pmd/util.c > @@ -166,3 +166,54 @@ > dump_pkt_burst(port_id, queue, pkts, nb_pkts, 0); > return nb_pkts; > } > + > +uint16_t > +tx_pkt_set_md(uint16_t port_id, __rte_unused uint16_t queue, > + struct rte_mbuf *pkts[], uint16_t nb_pkts, > + __rte_unused void *user_param) > +{ > + uint16_t i =3D 0; > + > + /* > + * Add metadata value to every Tx packet, > + * and set ol_flags accordingly. > + */ > + for (i =3D 0; i < nb_pkts; i++) { > + pkts[i]->tx_metadata =3D ports[port_id].tx_metadata; > + pkts[i]->ol_flags |=3D PKT_TX_METADATA; > + } > + return nb_pkts; > +} > + > +void > +add_tx_md_callback(portid_t portid) > +{ > + struct rte_eth_dev_info dev_info; > + uint16_t queue; > + > + if (port_id_is_invalid(portid, ENABLED_WARN)) > + return; > + rte_eth_dev_info_get(portid, &dev_info); > + for (queue =3D 0; queue < dev_info.nb_tx_queues; queue++) > + if (!ports[portid].tx_set_md_cb[queue]) > + ports[portid].tx_set_md_cb[queue] =3D > + rte_eth_add_tx_callback(portid, queue, > + tx_pkt_set_md, NULL); > +} > + > +void > +remove_tx_md_callback(portid_t portid) > +{ > + struct rte_eth_dev_info dev_info; > + uint16_t queue; > + > + if (port_id_is_invalid(portid, ENABLED_WARN)) > + return; > + rte_eth_dev_info_get(portid, &dev_info); > + for (queue =3D 0; queue < dev_info.nb_tx_queues; queue++) > + if (ports[portid].tx_set_md_cb[queue]) { > + rte_eth_remove_tx_callback(portid, queue, > + ports[portid].tx_set_md_cb[queue]); > + ports[portid].tx_set_md_cb[queue] =3D NULL; > + } > +} > -- > 1.8.3.1 Acked-by: Ori Kam Thanks, Ori