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 49B7743AB6; Fri, 9 Feb 2024 02:18:50 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 19DC040697; Fri, 9 Feb 2024 02:18:50 +0100 (CET) Received: from BYAPR05CU005.outbound.protection.outlook.com (mail-westusazon11021007.outbound.protection.outlook.com [52.101.85.7]) by mails.dpdk.org (Postfix) with ESMTP id D005F402AF for ; Fri, 9 Feb 2024 02:18:48 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nFnenUkRSznMyxynWk7ClklTOvJo3UcFYVy+s0NMlYp6E1RAE/ALPGNn9ktjIxuJ/EEUJUXG9izLlR4x/7BHoVBWDgIzzgvy7JcX9u08d72NJ0Kb6pRCnGWgWa0nwOrFkTscASwgKkATnNZchKdQQVPDXk3vcF4b0649aXJegaus6nP3ANKKUFuDSyavkqv6xhS0QUq5cbGNtLSoL76y0dSvayvnazPpfp5sOx/78RLXqG+hmBZkswgLH0b/3be1EP0sIWXX001w1Km+4hHhM4XCKtKfgCobUVMafbPVBVwJvK0SD462G7GeeTGsR/15Qagh8icequWQkcMR3uP6JQ== 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=yymtK6DIU9rQ/zZdhYKrZ/QTIen0mMRPrg/wxVLBORc=; b=ZVJbuPvY9/hmTRS+HfGqcMn2xJLZf3+uuMJSkmS4l4J05CeXujPRMTO+isqfGjQujMDTD3qu6cuasE01xPk90DKXp0ogXTPGKNn8+TGsTJtFS5MEZk7XglSjM1Lasu8zVqC9c26FcFiNq6sfy8SVZPHc2o4sFXhi9WRbYIxltcc++8YiabVxzfLAGgip598xCNlcHlM33p94O70Zm7+wVpjYWyny7sgfFGDCY0ETT1OujFIdfc1RmFbKqP1xuDjS0hd12mkYrnuqFGxwCjZ4a57Tm4NcIc+ANEFrU9Qcc/a2TqvYArCcI22VKdykCEhsIBdWruj0UoAYymwgfhl3ew== 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=yymtK6DIU9rQ/zZdhYKrZ/QTIen0mMRPrg/wxVLBORc=; b=ZHP+jYVDr+ratZ7NEUFZPsHoirGQkiOMJ/5NSoq/WUW6RiATEUNUfZ/AQJlkh56xnhhi6cUwI0qopGGLFual4ThwOEWXZTaTSAr5f9O4KHLld0W9LfvQiZNh+94nJQtMbUa9LihetoNW72FzLu/JuWp+uu/PR19yLrDMYvRVrkk= Received: from PH7PR21MB3263.namprd21.prod.outlook.com (2603:10b6:510:1db::16) by SJ1PR21MB3762.namprd21.prod.outlook.com (2603:10b6:a03:451::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.4; Fri, 9 Feb 2024 01:18:42 +0000 Received: from PH7PR21MB3263.namprd21.prod.outlook.com ([fe80::38ce:7072:976c:bb15]) by PH7PR21MB3263.namprd21.prod.outlook.com ([fe80::38ce:7072:976c:bb15%3]) with mapi id 15.20.7292.001; Fri, 9 Feb 2024 01:18:41 +0000 From: Long Li To: Alan Elder , Ferruh Yigit , Andrew Rybchenko CC: "dev@dpdk.org" , stephen Subject: RE: [PATCH v3] net/netvsc: fix parsing of VLAN metadata Thread-Topic: [PATCH v3] net/netvsc: fix parsing of VLAN metadata Thread-Index: AdpaoGUQ/GGHCYC5Qr2VuZTigqp7GwAVOWGQ Date: Fri, 9 Feb 2024 01:18:41 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ActionId=56178cb2-c070-454c-9d7f-d5fa4a8e41c0; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ContentBits=0; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=true; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Method=Standard; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Name=Internal; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2024-02-08T14:59:43Z; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47; authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=microsoft.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PH7PR21MB3263:EE_|SJ1PR21MB3762:EE_ x-ms-office365-filtering-correlation-id: 8a158afa-6469-4b76-85ab-08dc290d0d7f x-ld-processed: 72f988bf-86f1-41af-91ab-2d7cd011db47,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Uu3McR8wTkIsnjRUl3steOfXoxS3uG+yclVqJVLKjKtGOiRGtqyMtELwTy1B0nQ25kkeyJRIy+vkYReRAQCID6/y5E7LT2UY3N40biMb9xFc3J12NMg2MR6nFkgCtPDhUwkqq0I0iSvYjQynhcuG/EhDB2AoL0EJ83MHRGHPBRKI9jLCRIGcu6Cvb3ohK4m1/f5RKQAsoQvT56kCE7ROX5ooQg4WjaFlyFNk0C+uD/vmYKSpbgdtz8LrZkB4Tv0JtTQFOBP5Lj9BLYiijhEqUcLhtiHH84tD2fC5dDxnCULajj/l/oozC6sIiyztvp3mOHFDMK2vM9vQGJK/WKktY5MaYvfRNZ8WyqNziBR9zTIuZMPiOeWDr3oLsKSlqTt2smJD5E81j6uUEAVQ9ZoTkJLzpbeG6uHmg+y/rcZO5kZWDp01b5rXnplwARxwmgx3BF3O214GRisdfWW++9GVXWlQ+QrxLFhRzD7y5+tijiAzzzTSsh/ghJd70ZXiHiAjyqhaVeRywjwUMPhzPdU3CCxxbKJuDbRjemdJdNkHDRgWsYTYnkRlpp7EwpAJ28nKAjXGYCfPlsIrRtCyBrSV4HC+maeqjmzQO8Jb4wz+ywoB2C3d2YUZHRiiK9JZOGL8 x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH7PR21MB3263.namprd21.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(39860400002)(366004)(396003)(376002)(346002)(136003)(230922051799003)(64100799003)(451199024)(1800799012)(186009)(55016003)(41300700001)(38070700009)(8990500004)(26005)(38100700002)(122000001)(66556008)(82950400001)(82960400001)(9686003)(52536014)(5660300002)(8936002)(8676002)(2906002)(316002)(86362001)(6506007)(478600001)(53546011)(10290500003)(110136005)(64756008)(7696005)(4326008)(66946007)(83380400001)(71200400001)(66476007)(54906003)(33656002)(76116006)(66446008); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?MWfSAcqOxQ/KSL8n6JmgnEiwSakQHnXFXkOQ6OTFt3dxvfZ3BKE30gaoBFLW?= =?us-ascii?Q?JTCsSUti4H1yMsw8lYnK+IpgJ2sf7dTKqyxSvEo/DYKOjTXv/Q4OIuq3YpCk?= =?us-ascii?Q?BSILcw936hNxCOOMx6zFKZt9Pw9MRC1ORMV28JYc8Qd+KpP7iOh75jXNK8Ef?= =?us-ascii?Q?ZUcPAoX5kOsRb0U/RVxHMapkjyupxWHOacXt0b5Uylnb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/cQ4b4bf1V/4WcR5ei35a8Mp8CvimSt4g+2jp1tnA?= =?us-ascii?Q?JhmPlOL98IQI1dZuDrTl5i2Y0XR+H45GzP9fYusG1Akb5UJ6w02ztPeJgoXe?= =?us-ascii?Q?jU6ikatFJjwRL4MEW8uHXn4SEvTlmdnyaxMKV34Mpw2IduhxrJXQmLVo1evH?= =?us-ascii?Q?O0OHL7SpY20lm15Mf6e1rOIl9wsIrNMPOGp6eaKLAX8cAztkVVQ237jxY/AP?= =?us-ascii?Q?H8pv1RrKQs4okx8N1YvEquYBJlzHjKq4gMIKCVcNeFAhzJ1163l6KR2ayQGC?= =?us-ascii?Q?K19Wf2679eBFUkcGt1rNyIg4o1IVI2k+eU/C2NLlrgQR/xUYi11aq/acmeLb?= =?us-ascii?Q?yfc2dLJy96R6MIsudGijYbup2QGx/Ji1KMcDKaV4uFC4M85osr9YC0pBqiCy?= =?us-ascii?Q?pIzOGrrHYdNPNvNmnRl5oWt4IuI3lFWJuOQUTTwDyjIUe7roel3lgfyGpknm?= =?us-ascii?Q?u0JCfl506af+qa3qxPLyy2dzoCitTZNbZ32Xk9rq?= 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: PH7PR21MB3263.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8a158afa-6469-4b76-85ab-08dc290d0d7f X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Feb 2024 01:18:41.7180 (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: L5bS7FdSptDDpYe4fX7NcQvs0qdrP7uwTNujqYFyMHoWT9rgLOfTG8Ns8zQZrV0R1ifA3zXeRNKsp2a6IWIVdA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ1PR21MB3762 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 > -----Original Message----- > From: Alan Elder > Sent: Thursday, February 8, 2024 7:09 AM > To: Long Li > Cc: dev@dpdk.org > Subject: [PATCH v3] net/netvsc: fix parsing of VLAN metadata >=20 > The previous code incorrectly parsed the VLAN ID and priority. > If the 16-bits of VLAN ID and priority/CFI on the wire was 0123456789ABCD= EF > the code parsed it as 456789ABCDEF3012. There were macros defined to han= dle > this conversion but they were not used. >=20 > This fix takes an approach similar to the Linux netvsc driver and defines= an > explicit structure to use for parsing. >=20 > Fixes: 4e9c73e96e83 ("net/netvsc: add Hyper-V network device") > Cc: sthemmin@microsoft.com > Cc: stable@dpdk.org >=20 > Signed-off-by: Alan Elder > --- > .mailmap | 1 + > drivers/net/netvsc/hn_rxtx.c | 23 +++++++++++++++++------ > drivers/net/netvsc/ndis.h | 23 +++++++++++++---------- > 3 files changed, 31 insertions(+), 16 deletions(-) >=20 > diff --git a/.mailmap b/.mailmap > index a0756974e2..eca02318d6 100644 > --- a/.mailmap > +++ b/.mailmap > @@ -33,6 +33,7 @@ Alain Leon Alan Brady > Alan Carew Alan Dewar > > +Alan Elder > Alan Liu > Alan Winkowski > Alejandro Lucero diff --git > a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c index > e4f5015aa3..e3b9899f1e 100644 > --- a/drivers/net/netvsc/hn_rxtx.c > +++ b/drivers/net/netvsc/hn_rxtx.c > @@ -42,8 +42,13 @@ > #define HN_TXD_CACHE_SIZE 32 /* per cpu tx_descriptor pool cache */ > #define HN_RXQ_EVENT_DEFAULT 2048 >=20 > +#define HN_VLAN_PRIO_MASK 0xe000 /* Priority Code Point */ > +#define HN_VLAN_PRIO_SHIFT 13 > +#define HN_VLAN_CFI_MASK 0x1000 /* Canonical Format Indicator / Drop > Eligible Indicator */ > +#define HN_VLAN_VID_MASK 0x0fff /* VLAN Identifier */ > + > struct hn_rxinfo { > - uint32_t vlan_info; > + struct ndis_pkt_vlan_info vlan_info; > uint32_t csum_info; > uint32_t hash_info; > uint32_t hash_value; > @@ -477,7 +482,7 @@ hn_rndis_rxinfo(const void *info_data, unsigned int > info_dlen, > case NDIS_PKTINFO_TYPE_VLAN: > if (unlikely(dlen < NDIS_VLAN_INFO_SIZE)) > return -EINVAL; > - info->vlan_info =3D *((const uint32_t *)data); > + info->vlan_info =3D *((const struct ndis_pkt_vlan_info > *)data); > mask |=3D HN_RXINFO_VLAN; > break; >=20 > @@ -611,8 +616,10 @@ static void hn_rxpkt(struct hn_rx_queue *rxq, struct > hn_rx_bufinfo *rxb, > RTE_PTYPE_L3_MASK | > RTE_PTYPE_L4_MASK); >=20 > - if (info->vlan_info !=3D HN_NDIS_VLAN_INFO_INVALID) { > - m->vlan_tci =3D info->vlan_info; > + if (info->vlan_info.value !=3D HN_NDIS_VLAN_INFO_INVALID) { > + m->vlan_tci =3D info->vlan_info.vlanid | > + (info->vlan_info.pri << HN_VLAN_PRIO_SHIFT) | > + (info->vlan_info.cfi ? HN_VLAN_CFI_MASK : 0); > m->ol_flags |=3D RTE_MBUF_F_RX_VLAN_STRIPPED | > RTE_MBUF_F_RX_VLAN; >=20 > /* NDIS always strips tag, put it back if necessary */ @@ -669,7 > +676,7 @@ static void hn_rndis_rx_data(struct hn_rx_queue *rxq, > unsigned int pktinfo_off, pktinfo_len; > const struct rndis_packet_msg *pkt =3D data; > struct hn_rxinfo info =3D { > - .vlan_info =3D HN_NDIS_VLAN_INFO_INVALID, > + .vlan_info.value =3D HN_NDIS_VLAN_INFO_INVALID, > .csum_info =3D HN_NDIS_RXCSUM_INFO_INVALID, > .hash_info =3D HN_NDIS_HASH_INFO_INVALID, > }; > @@ -1332,7 +1339,11 @@ static void hn_encap(struct rndis_packet_msg *pkt, > if (m->ol_flags & RTE_MBUF_F_TX_VLAN) { > pi_data =3D hn_rndis_pktinfo_append(pkt, NDIS_VLAN_INFO_SIZE, > NDIS_PKTINFO_TYPE_VLAN); > - *pi_data =3D m->vlan_tci; > + struct ndis_pkt_vlan_info *vlan =3D (struct ndis_pkt_vlan_info > *)pi_data; > + vlan->value =3D 0; > + vlan->vlanid =3D (m->vlan_tci & HN_VLAN_VID_MASK); > + vlan->cfi =3D (!!(m->vlan_tci & HN_VLAN_CFI_MASK)); > + vlan->pri =3D ((m->vlan_tci & HN_VLAN_PRIO_MASK) >> > +HN_VLAN_PRIO_SHIFT); Thanks Alan. Can you remove the extra "()" as suggested by Stephen? The rest of the patc= h looks good. Please include maintainers of of dpdk-next-net tree: (from "MAINTAINERS") Next-net Tree M: Ferruh Yigit M: Andrew Rybchenko Long