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 5B9C443ABD; Fri, 9 Feb 2024 16:50:56 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 23F9242E64; Fri, 9 Feb 2024 16:50:55 +0100 (CET) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on2095.outbound.protection.outlook.com [40.107.8.95]) by mails.dpdk.org (Postfix) with ESMTP id 4FD8040697 for ; Fri, 9 Feb 2024 16:50:54 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nGVkclrrffNU9WRCnLbFRjCKuVg0qRGQzdEH/quBh/JBoHR3aLeLPg+/Cinb1Bt7fPQhTULex7/FtodqtyRz63pTetCZ1Rg/uaDBZI4Gj95x5wrtxECuLqxfbkm6dT4wshbBWNX+gMq3RwOs/SeGY3EuxGFKxeC3+rbHcpEkxhZgFKaFwKWR+MvQg6q/I+UBr7sZbBKwP1ikeb4xFPpZjbraoiv5LSb97QqTl2SQFeMeB+pGee77OXTGPfl/YfzBSAR7tkqSUIjFUUH8N/yDYfB3G2p+0toNLNS1mCpOk6O3O1Lo4Wh4BU775JJLP/HXk0VYkWsyFxHLIAqfFumPBg== 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=XSpRsL15qIj2IGnaCcy2RH0VVGPR7APap7bCCsVZReA=; b=Eo82eE8nvwccqfYz7XPcTxsa421bSXHGhyQgMylVBX58SJIJtSIi6gKujZ5vUP25317KTVqP5Lbf52sNZaaE2d1lr+ZCCLEyJUob/edM00l+8dwqU1crqhvXF5CMuMXBe3tXlU2VlFn7cHEUVRO1oAsb72jXZY4J6Vx9y6xGMVyR5IWZKz7RjjUU72lpnRhdE7DRACmNnjN1TNRIw25sSt7vFvpZ8oncD076tKO9M4+/V+zXRX+Nk5lnuhoQ0oSC870cKZmZJaP3cpVFDrlVX5VKxY7cHMWybmuQ4JEWb7SXgueCpMde4P9iNzBRqQy07r//XD3r2luFrHkU8mPt8g== 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=XSpRsL15qIj2IGnaCcy2RH0VVGPR7APap7bCCsVZReA=; b=NrxvgKwnFGMSXgPbdqeVb+kAAh67iMpxMMHOQPSqP9wO5mChZt1CKk2tRq6SPOqswusyH2ZpoRCji2Mx2lkFV8yVj+ixhT7kKKWUwS2vhWwabj9fhuFg4guZ95UdHAbg1Uvpx7GzHTjBA6bXzUqfMYuFow3VszXJ7jFtzE1m8QI= Received: from PA4PR83MB0526.EURPRD83.prod.outlook.com (2603:10a6:102:26b::17) by PR3PR83MB0394.EURPRD83.prod.outlook.com (2603:10a6:102:7c::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.8; Fri, 9 Feb 2024 15:50:51 +0000 Received: from PA4PR83MB0526.EURPRD83.prod.outlook.com ([fe80::b55f:3890:59e4:b623]) by PA4PR83MB0526.EURPRD83.prod.outlook.com ([fe80::b55f:3890:59e4:b623%7]) with mapi id 15.20.7292.012; Fri, 9 Feb 2024 15:50:51 +0000 From: Alan Elder To: Long Li , Ferruh Yigit , Andrew Rybchenko CC: "dev@dpdk.org" , stephen Subject: [PATCH v4] net/netvsc: fix parsing of VLAN metadata Thread-Topic: [PATCH v4] net/netvsc: fix parsing of VLAN metadata Thread-Index: AQHaW2/BkMZtI9MwdEG6Mrvm6lxkhA== Date: Fri, 9 Feb 2024 15:50:51 +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: PA4PR83MB0526:EE_|PR3PR83MB0394:EE_ x-ms-office365-filtering-correlation-id: 85129fb1-9124-4526-f9dd-08dc2986e434 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: bjZhv+gNIgxzoYkcNdL+mCV/6CZZ0XUPcLix1KOyaMulBxqcKbHTqhpwOcRSCLgtzJsc7jVrsV3Ks9yDF2D2oE1m2BbEp2k2XsEMuTRk5ypXYMTHPb3kjDTXu2fHicIkxODM7KpThwUdkprg+/PFQLvaHwd4KEMmS2we41jVI0rWdhQUl0+7sbTgzt5RQuolQgR5XttQ0YoBf2PXSWdQwKgj046Kchdr3PqOWmVTzP970GyG3JLf7/EGarTBsz5tS0vTY2T2cz8kqPNCIRtJYO+GzP2BgXoVow9we5a75oYE7f7kDxtH8XQ1u4xAjcjUjDcoACY2OMvrlhtbOl9GGrwNAr8aRacdVXgZpYrs1O68I/gvqWzQ7W/cimCTzW9aXV6rqEkwRjDL5BPOqWJEg3qzl7Q9sYue0kHJjkC+dJhE6dw3qml4c1W7Y4UxenJjqK6UiwZ5TmMc/dFs53Zw71NiwiK2XzKqkRRT7bo1dBl0zS63Nk63v4L4vGwrRzrZU9uJKZ78RIlToEHA/fjEcC4y13JZddwMsKYRTE9dajQVpDjzuQAIE0Gd/DnKPX1BA557e73+Lrcza0oIS5VimOoc592eeFtni9hzjnIZ1hlNVl43vYh8Gi89nHEwyL2P x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PA4PR83MB0526.EURPRD83.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(346002)(39860400002)(136003)(376002)(396003)(366004)(230922051799003)(1800799012)(451199024)(186009)(64100799003)(52536014)(4326008)(5660300002)(2906002)(44832011)(8990500004)(83380400001)(33656002)(38100700002)(122000001)(86362001)(82950400001)(82960400001)(8676002)(66946007)(76116006)(66476007)(54906003)(38070700009)(110136005)(66556008)(66446008)(64756008)(8936002)(316002)(71200400001)(6506007)(9686003)(10290500003)(478600001)(55016003)(7696005)(41300700001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?Okb4BaZQIvc+Ho96baRVsjFyEVM2g754l8ye+Rmrmr5bhH3OPY0xqj4h2I4s?= =?us-ascii?Q?Qz7BmQDnq/OD5MePnUmJkCZB/l2Vmap5WgZDhc7gvbk4lCa+/1RTwHC5lpk0?= =?us-ascii?Q?DRts1vlHmOlTl5fxY3ZHS692YQMoli+tOYPHGUCpr3w5OqBOn+pav4ofDRx2?= =?us-ascii?Q?FxVNaytfJZnkfP0huYN67XeVPEoxvaPByDp1RJpNk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imRNYVaicRBsH70ZZPOh/NT0iaLQJVFbesF5KmjV7b?= =?us-ascii?Q?g+nls2BGnGpOJDZNNAgHlcSACO9RNtDWPeYVp52K8jfWKrtMynrRq/Tx7iJD?= =?us-ascii?Q?DsWgerL1w+/WAcMuR8GKvhy9b9Favn+duxz4mdnF66ADCkc2Uiy/6olW2Esp?= =?us-ascii?Q?e4f8k9E0u4t7ug6tPVpNTi4kwELW5WUSoZIv5d5eIU6dETT2slvvNJl2GmOj?= =?us-ascii?Q?EYe8e3/BnWUcUCe567LuI39jtxl1Zh1utJ5r8/1qygR9feuJTmw5qzU8jUsx?= =?us-ascii?Q?8Esb5wPuMbQLLWUtuPLYy5liEGzbTz8QPcwaBzYd7U1fh14EX0KCOm2B5cBN?= =?us-ascii?Q?9O6RTbJ9lZesr/QikeUP4IPRZwJ+GHOoRU/IQo8ZZUrYW46YLaIcLg4JQ4Hv?= =?us-ascii?Q?CKsJYo8GtT+hYHqkAaaMKwd6aYdyhczA5XQO6rQ87ixeS5HcbhhETya5bjof?= =?us-ascii?Q?nIGy3pl/rS52yZG7l30Q9vU958cn7cKVwfu1rVom?= 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: PA4PR83MB0526.EURPRD83.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 85129fb1-9124-4526-f9dd-08dc2986e434 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Feb 2024 15:50:51.0724 (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: NIOcede+g2RLjkvCWyQqL8OXYMw9P996OBybljgrsu8uO8FWnp8kFK9tYG6A9/a3prL2y1gMzdR0Q7OQX9gu3g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR83MB0394 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 The previous code incorrectly parsed the VLAN ID and priority. If the 16-bits of VLAN ID and priority/CFI on the wire was 0123456789ABCDEF the code parsed it as 456789ABCDEF3012. There were macros defined to handle this conversion but they were not used. Fixes: 4e9c73e96e83 ("net/netvsc: add Hyper-V network device") Cc: sthemmin@microsoft.com Cc: stable@dpdk.org Signed-off-by: Alan Elder --- v4: * Make consistent with FreeBSD code .mailmap | 1 + drivers/net/netvsc/hn_rxtx.c | 21 +++++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) 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..1cbb8df03f 100644 --- a/drivers/net/netvsc/hn_rxtx.c +++ b/drivers/net/netvsc/hn_rxtx.c @@ -42,6 +42,19 @@ #define HN_TXD_CACHE_SIZE 32 /* per cpu tx_descriptor pool cache */ #define HN_RXQ_EVENT_DEFAULT 2048 =20 +#define HN_VLAN_CFI_SHIFT 12 +#define HN_VLAN_PRI_SHIFT 13 +#define HN_VLAN_PRI_MASK 0xe000 /* Priority Code Point */ +#define HN_VLAN_CFI_MASK 0x1000 /* Canonical Format Indicator / Drop Eligi= ble Indicator */ +#define HN_VLAN_VID_MASK 0x0fff /* VLAN Identifier */ + +#define HN_VLAN_TCI_ID(vlan_tci) ((vlan_tci) & HN_VLAN_VID_MASK) +#define HN_VLAN_TCI_PRI(vlan_tci) (((vlan_tci) & HN_VLAN_PRI_MASK) >> HN_V= LAN_PRI_SHIFT) +#define HN_VLAN_TCI_CFI(vlan_tci) (((vlan_tci) & HN_VLAN_CFI_MASK) >> HN_V= LAN_CFI_SHIFT) +#define HN_VLAN_TCI_MAKE(id, pri, cfi) ((id) | \ + ((pri) << HN_VLAN_PRI_SHIFT) | \ + ((cfi) << HN_VLAN_CFI_SHIFT)) + struct hn_rxinfo { uint32_t vlan_info; uint32_t csum_info; @@ -612,7 +625,9 @@ static void hn_rxpkt(struct hn_rx_queue *rxq, struct hn= _rx_bufinfo *rxb, RTE_PTYPE_L4_MASK); =20 if (info->vlan_info !=3D HN_NDIS_VLAN_INFO_INVALID) { - m->vlan_tci =3D info->vlan_info; + m->vlan_tci =3D HN_VLAN_TCI_MAKE(NDIS_VLAN_INFO_ID(info->vlan_info), + NDIS_VLAN_INFO_PRI(info->vlan_info), + NDIS_VLAN_INFO_CFI(info->vlan_info)); 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 */ @@ -1332,7 +1347,9 @@ 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; + *pi_data =3D NDIS_VLAN_INFO_MAKE(HN_VLAN_TCI_ID(m->vlan_tci), + HN_VLAN_TCI_PRI(m->vlan_tci), + HN_VLAN_TCI_CFI(m->vlan_tci)); } =20 if (m->ol_flags & RTE_MBUF_F_TX_TCP_SEG) { --=20 2.25.1