From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5AAEF43CA1; Wed, 13 Mar 2024 18:57:52 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 48D22406BC; Wed, 13 Mar 2024 18:57:52 +0100 (CET) Received: from BL2PR02CU003.outbound.protection.outlook.com (mail-eastusazon11022011.outbound.protection.outlook.com [52.101.51.11]) by mails.dpdk.org (Postfix) with ESMTP id 753984025E for ; Wed, 13 Mar 2024 18:57:50 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CDLETbTTugUI2VTcLpIECGU/CYsE2BFfT+htOB2iR/wWp8bpLeZmBtolFcLMmuk6CZ8Lqx4giaCoJqc7hS9q+ELCwYX0j9FeFdXjUjLs/TGts+2iBRk7CKfxINikK8kc53dRICRK1Oufb72PKPg/CfNk3L4bYoh6GYGWd6lfopj17vKPjzTSYQYGs8KOhA+QUaGRv5vGbY9F5UeCwf0ExBho3GGYmomzSkS6rWYn5L+Vavnj+a6zi65ZLYH+Byz/Lg4/Gbcru2q2Swu3AjA9C01PpQiJJMbQ/shJCJjqvEyoTmHhSauK/9IthwNz5d+BKg3jm444tvMAjQoQesSUBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=gFB0sFJ9SxYnH8ZlOrjFbVxLDFI1Ig0iUY11LPNPLMo=; b=Jd/xumX3swqCAmZSB+J+c2XwYI6l5G4LKP86x6aY417uJhbAU7XfL5VZaiXFmrSPmrdyTe+P4tr7T9xS7OYq2cGKoZKdK/Gn5JoWqwg1SY8wwkj7+1ZuDmCmgNWG/TgZdj8Lxs+QskXaDkKs/fD8+4HrBSGlMHOGulFrIuhK3bh5FNn20XpFEgksfe9m/i2YqCfnMU8pxSDs8ZBPNGss/UxJMNUnzhcl0UZ3uCSgFPRomppqX50SLDVHZ5i6cQpn59/5ISx0pMCyFzROIPYnmr7xRW6APno5O79QeUeg0+NT8Dbbv+KIp2Dl7BXvviq5GFXmNZN45acmLZ8suz5Tjw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gFB0sFJ9SxYnH8ZlOrjFbVxLDFI1Ig0iUY11LPNPLMo=; b=dJdlTaokXeqIA/L3UHMA+h7P0sowKR+LBQwdI1sblH6K9NdihCwT1uzCHemuA6Sw1yhWrhlmxi+G8dJ12on3ka7lrxmWrb18TdE49JnCg/IgNJy4cw01kJC5aZd35z8tADa0reyBxC1/5nMVtcJX36kVbEoKsPc5FPGbXskp22o= Received: from SJ1PR21MB3457.namprd21.prod.outlook.com (2603:10b6:a03:453::5) by SJ1PR21MB3531.namprd21.prod.outlook.com (2603:10b6:a03:451::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.3; Wed, 13 Mar 2024 17:57:47 +0000 Received: from SJ1PR21MB3457.namprd21.prod.outlook.com ([fe80::70f:687e:92e6:45b7]) by SJ1PR21MB3457.namprd21.prod.outlook.com ([fe80::70f:687e:92e6:45b7%4]) with mapi id 15.20.7409.004; Wed, 13 Mar 2024 17:57:47 +0000 From: Long Li To: Wei Hu , "ferruh.yigit@amd.com" , "andrew.rybchenko@oktetlabs.ru" , "thomas@monjalon.net" CC: "dev@dpdk.org" , Wei Hu Subject: RE: [PATCH v3 1/1] net/mana: add vlan tagging support Thread-Topic: [PATCH v3 1/1] net/mana: add vlan tagging support Thread-Index: AQHadSVnLCq+Galhr02Vk+lObEQCdrE19YLw Date: Wed, 13 Mar 2024 17:57:46 +0000 Message-ID: References: <20240313090341.373037-1-weh@linux.microsoft.com> In-Reply-To: <20240313090341.373037-1-weh@linux.microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: SJ1PR21MB3457:EE_|SJ1PR21MB3531:EE_ x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 8+L+eRm1rySAwBLlfTivg5gjUUfjl4dtiey/GQsXRBYsBF0VKN2SV7+TK0tBrSn4Jew0s1ZKKN7YmyCqKt5n8xx+Br9eLK4YyVBrXHB+JFnNlucX99MX8G7/pM0YqudldySmEWBoOAuLGQZ2JUt52wz5p/eS0e+ywlgl2Z74J23daVc0j5wF145nNKtA2zccelAwJvNRYhW5U4HyNsLJFRQkbDFhFptr/JlnxZWmFOym9yh9/5EQxxSscGbLZS26KqOfbJDc+Gshn/PLKJDE9WYW1d6NCLanLywoPnYsVUXdnuKNgacfSrq4aXSagtdmDsEwVqRUUHOuad1nxDXAzsGJiq0PLXa8jbqgIoi17/fgf5aQa02Iwy4Dvi1BXMod7mjtt+eYXElq3lMnF5/RstOFgTh9+MeyiMPKySakWbSPawXACJViWOGTVVzQ/CG1Cp/Ld+1L0CKOxjf4OnxD0gRniAIUGQBU3C5t1nnsGLYS1l/A3eOcDBkD4XnvRu3XF1IJtttAmV3++E/AKVekspynUSQmQOD7fGzeub9RouIQmVQfXQhiDrugRWPioY+/i1HYoDSpNMD9p90NDRWYYXoE12WjtymAVvFrgeLeJf32vDfFpQ+wjig/dBqesey8UNfobEJ6dgezOPXYoVbDox0/S3wIkrqyv5TIYRhBjHM= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ1PR21MB3457.namprd21.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376005)(1800799015); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?g6+uY6qoAFUx8hKshykNjcuh1gbdKF2FLN5EZOqd31vXfRDOgc/QzGiDgBgz?= =?us-ascii?Q?ctKzPLnHyMA++xbv2otj2CteP4VqJ9bfdBDqDWx/IRNQ3zuWnAuqu9GsMUqw?= =?us-ascii?Q?gKB7nj4JBmrXuO2KeS86H9qV/Q0SocpHKJ76ziV4EYXjVDX43yHas2Yc+B7m?= =?us-ascii?Q?thRie5N4yMmV2uBfmpfxBxccI2sGZK7DvEOQjwmemEjKRtt+z5nlhnog9Uz5?= =?us-ascii?Q?6KTRkBM9ahT561ln5+LP//6nRyg3HEeqN85e6jl7aTr0w74SsMCI3ShmH1En?= =?us-ascii?Q?Y/9wM9VHyl5xeeGmJtIiGaX2BjlkFwx7P/40MceRuFqfrInsLPCgBAqYrNHs?= =?us-ascii?Q?VD/e/fKpAUQg5zabashdX/kfqoPkV/8p0TI/0x9k44dN/flrvBXmSjBFVtdu?= =?us-ascii?Q?Q+sar2oZqnrqpPsYFyEp6g6gvm2J/dEjg7CJG98vHg8xSZkZApuHSVm5phyO?= =?us-ascii?Q?nHLH7gq1PvE1zJCuTYXHRvIPNsy12ayn5BWaaRchMwHxprzFcyd7Ad5kFUoR?= =?us-ascii?Q?lRmEoWooUJhAHXn9qPVPE20fYe0I64SwLYNEu8trXFZ+7WwNsN0Wafso+EYU?= =?us-ascii?Q?3rebm24S4NnrQEIF43WwzhPWU2SH2J7BJxTyNyMLGhTMDah3jLCZ9/b9pe6Q?= =?us-ascii?Q?/WH8fWarrVlX3CNi7lefMWzhiIAwUERWlJwxq7lIML0kRV7VB+FpPMVbHjfQ?= =?us-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ZQ6LA5Su4dvHmPD3Gl?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SJ1PR21MB3457.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0809b4b7-49e5-4053-4a31-08dc43871752 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Mar 2024 17:57:47.0185 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: lIXcfFes8q2wjLFz9olAKmFJUFTtwcHq0Rn2FjC7rQFg9QobxJwSAnyiZ8tyhR5+3XtbeMzYNDkQHqk4ttQ7gQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ1PR21MB3531 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org > Subject: [PATCH v3 1/1] net/mana: add vlan tagging support >=20 > For tx path, use LONG_PACKET_FORMAT if vlan tag is present. For rx, extra= ct vlan > id from oob, put into mbuf and set the vlan flags in mbuf. >=20 > Signed-off-by: Wei Hu Acked-by: Long Li > --- >=20 > v3: > - Adjust the pkt_idx position in the code so it will be executed even whe= n adding > vlan header fails. >=20 > v2: > - Use existing vlan tag processing macros. > - Add vlan header back if vlan_strip flag is not set on the receiving pat= h. >=20 > drivers/net/mana/mana.c | 3 +++ > drivers/net/mana/mana.h | 4 ++++ > drivers/net/mana/rx.c | 22 ++++++++++++++++++---- > drivers/net/mana/tx.c | 21 ++++++++++++++++++--- > 4 files changed, 43 insertions(+), 7 deletions(-) >=20 > diff --git a/drivers/net/mana/mana.c b/drivers/net/mana/mana.c index > 2df2461d2f..68c625258e 100644 > --- a/drivers/net/mana/mana.c > +++ b/drivers/net/mana/mana.c > @@ -94,6 +94,9 @@ mana_dev_configure(struct rte_eth_dev *dev) > return -EINVAL; > } >=20 > + priv->vlan_strip =3D !!(dev_conf->rxmode.offloads & > + RTE_ETH_RX_OFFLOAD_VLAN_STRIP); > + > priv->num_queues =3D dev->data->nb_rx_queues; >=20 > manadv_set_context_attr(priv->ib_ctx, > MANADV_CTX_ATTR_BUF_ALLOCATORS, diff --git a/drivers/net/mana/mana.h > b/drivers/net/mana/mana.h index 3626925871..37f654f0e6 100644 > --- a/drivers/net/mana/mana.h > +++ b/drivers/net/mana/mana.h > @@ -21,10 +21,12 @@ struct mana_shared_data { #define > MANA_MAX_MAC_ADDR 1 >=20 > #define MANA_DEV_RX_OFFLOAD_SUPPORT ( \ > + RTE_ETH_RX_OFFLOAD_VLAN_STRIP | \ > RTE_ETH_RX_OFFLOAD_CHECKSUM | \ > RTE_ETH_RX_OFFLOAD_RSS_HASH) >=20 > #define MANA_DEV_TX_OFFLOAD_SUPPORT ( \ > + RTE_ETH_TX_OFFLOAD_VLAN_INSERT | \ > RTE_ETH_TX_OFFLOAD_MULTI_SEGS | \ > RTE_ETH_TX_OFFLOAD_IPV4_CKSUM | \ > RTE_ETH_TX_OFFLOAD_TCP_CKSUM | \ > @@ -345,6 +347,8 @@ struct mana_priv { > /* IB device port */ > uint8_t dev_port; >=20 > + uint8_t vlan_strip; > + > struct ibv_context *ib_ctx; > struct ibv_pd *ib_pd; > struct ibv_pd *ib_parent_pd; > diff --git a/drivers/net/mana/rx.c b/drivers/net/mana/rx.c index > 16e647baf5..0c26702b73 100644 > --- a/drivers/net/mana/rx.c > +++ b/drivers/net/mana/rx.c > @@ -532,10 +532,6 @@ mana_rx_burst(void *dpdk_rxq, struct rte_mbuf **pkts= , > uint16_t pkts_n) > mbuf->hash.rss =3D oob- > >packet_info[pkt_idx].packet_hash; > } >=20 > - pkts[pkt_received++] =3D mbuf; > - rxq->stats.packets++; > - rxq->stats.bytes +=3D mbuf->data_len; > - > pkt_idx++; > /* Move on the next completion if all packets are processed */ > if (pkt_idx >=3D RX_COM_OOB_NUM_PACKETINFO_SEGMENTS) > { @@ -543,6 +539,24 @@ mana_rx_burst(void *dpdk_rxq, struct rte_mbuf > **pkts, uint16_t pkts_n) > i++; > } >=20 > + if (oob->rx_vlan_tag_present) { > + mbuf->ol_flags |=3D > + RTE_MBUF_F_RX_VLAN | > RTE_MBUF_F_RX_VLAN_STRIPPED; > + mbuf->vlan_tci =3D oob->rx_vlan_id; > + > + if (!priv->vlan_strip && rte_vlan_insert(&mbuf)) { > + DRV_LOG(ERR, "vlan insert failed"); > + rxq->stats.errors++; > + rte_pktmbuf_free(mbuf); > + > + goto drop; > + } > + } > + > + pkts[pkt_received++] =3D mbuf; > + rxq->stats.packets++; > + rxq->stats.bytes +=3D mbuf->data_len; > + > drop: > rxq->desc_ring_tail++; > if (rxq->desc_ring_tail >=3D rxq->num_desc) diff --git > a/drivers/net/mana/tx.c b/drivers/net/mana/tx.c index > 58c4a1d976..272a28bcba 100644 > --- a/drivers/net/mana/tx.c > +++ b/drivers/net/mana/tx.c > @@ -254,7 +254,18 @@ mana_tx_burst(void *dpdk_txq, struct rte_mbuf > **tx_pkts, uint16_t nb_pkts) > } >=20 > /* Fill in the oob */ > - tx_oob.short_oob.packet_format =3D SHORT_PACKET_FORMAT; > + if (m_pkt->ol_flags & RTE_MBUF_F_TX_VLAN) { > + tx_oob.short_oob.packet_format =3D > LONG_PACKET_FORMAT; > + tx_oob.long_oob.inject_vlan_prior_tag =3D 1; > + tx_oob.long_oob.priority_code_point =3D > + RTE_VLAN_TCI_PRI(m_pkt->vlan_tci); > + tx_oob.long_oob.drop_eligible_indicator =3D > + RTE_VLAN_TCI_DEI(m_pkt->vlan_tci); > + tx_oob.long_oob.vlan_identifier =3D > + RTE_VLAN_TCI_ID(m_pkt->vlan_tci); > + } else { > + tx_oob.short_oob.packet_format =3D > SHORT_PACKET_FORMAT; > + } > tx_oob.short_oob.tx_is_outer_ipv4 =3D > m_pkt->ol_flags & RTE_MBUF_F_TX_IPV4 ? 1 : 0; > tx_oob.short_oob.tx_is_outer_ipv6 =3D > @@ -409,8 +420,12 @@ mana_tx_burst(void *dpdk_txq, struct rte_mbuf > **tx_pkts, uint16_t nb_pkts) >=20 > work_req.sgl =3D sgl.gdma_sgl; > work_req.num_sgl_elements =3D m_pkt->nb_segs; > - work_req.inline_oob_size_in_bytes =3D > - sizeof(struct transmit_short_oob_v2); > + if (tx_oob.short_oob.packet_format =3D=3D > SHORT_PACKET_FORMAT) > + work_req.inline_oob_size_in_bytes =3D > + sizeof(struct transmit_short_oob_v2); > + else > + work_req.inline_oob_size_in_bytes =3D > + sizeof(struct transmit_oob_v2); > work_req.inline_oob_data =3D &tx_oob; > work_req.flags =3D 0; > work_req.client_data_unit =3D NOT_USING_CLIENT_DATA_UNIT; > -- > 2.34.1