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 AE08943ADF; Thu, 8 Feb 2024 15:15:34 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3C31B4028B; Thu, 8 Feb 2024 15:15:34 +0100 (CET) Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02on2105.outbound.protection.outlook.com [40.107.241.105]) by mails.dpdk.org (Postfix) with ESMTP id 18D2A40278 for ; Thu, 8 Feb 2024 15:12:42 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ROeH3Edb/nKCY1s92EPoTjAHXYl+TUMp40DU9+/ZzpR+r7krylPlDYKFZiVJcTENwviapL9+/hcU45tncQnWqnBmkYYtvF/21M3voEa0kpdZtzNWqlHkrEOcvjre2dg2sep2BbeLO/NrW3+GwCGmlkuIXd0xBcY3f1cJAB+Xn0UoMJCP0JKEIjCikQi5MPvnN+jn7kfxxB6HrLnZC7qduMrwQLPV8ykYtuurFLW7qMexw3GJP4nkWmgQYI+uO4DxApKQuzUyoQrPPo7QsdHUkJ7+eM9gJlhgEVGs/A2SGwLckV346M1unldOyP9eb2gJKhFyCatC7/O/ZN47p8NMDg== 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=uj7QJP6xHkeh9SDMCefaAR1JTzBoT/IyCd9i9y8bUiY=; b=deU2EebXElA4ZN/b8Qt7gBGqmDI8HNT6XbAxaTP/UpHXdDal5NyBDiOVQDnppc+/rOhcDoqbux5NIvYJ1hw2Gfka48SJRdm4+khK341oZV30qPR/SydCZSk7xCjM+TzNTO8qOZkotUGoTfo4FHpavCy25cCuluPpLErDzfC446ZktG3lOVFKrxPIs+c/3o2VREhCdrrImk7QQ688eYMmDjKfTIdRKaptlNcJ2DnpAWypdKyYyoae4kddf8L1sNKQlZbq+XYp8MQn0MfK3ecqOYQM4UMtA0g8kiB2w1Tet90CwHPWsKGXAx9boBc0kHRFBEMN7MsjShfDkcIBP2bZ0Q== 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=uj7QJP6xHkeh9SDMCefaAR1JTzBoT/IyCd9i9y8bUiY=; b=TMG4WZQZ5PNkZZ8Wi5IyxOFLiP1xKY27T33j+BCuv6JeMzwZavBDM95BbY9iWMgx1r4RERbxQV+hyGuyjlRohQ7vcmuTrSeOgjqgR9OQP3ivlih/2ucCLImV61d0OW7o/FL7UBkxsNvwcvezAQAfvhhEk+ZmMg/jITIBiEcGRmw= Received: from PA4PR83MB0526.EURPRD83.prod.outlook.com (2603:10a6:102:26b::17) by AS1PR83MB0513.EURPRD83.prod.outlook.com (2603:10a6:20b:480::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.8; Thu, 8 Feb 2024 14:12:38 +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.009; Thu, 8 Feb 2024 14:12:38 +0000 From: Alan Elder To: Long Li CC: "dev@dpdk.org" Subject: [PATCH] net/netvsc: fix parsing of VLAN metadata Thread-Topic: [PATCH] net/netvsc: fix parsing of VLAN metadata Thread-Index: Adpal+z56Y2peScmQ0G2ljcsz/E8Dg== Date: Thu, 8 Feb 2024 14:12:38 +0000 Message-ID: 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=eac44bd7-4986-4a28-b743-886125979211; 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-08T13:54:50Z; 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_|AS1PR83MB0513:EE_ x-ms-office365-filtering-correlation-id: 08a60452-3966-40b9-9366-08dc28b00188 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: TcZ2uoB8Wp0UH5uXI3KrxpLeo09R/9uKt6//Z3X9nPF55atd6M3imwYdM1tWrsy0rAMHIWuKB0kQZ6+ow596ePl2uj2HRcnWUuJlrfk9t8AGMzcKKy+YxxS56YZpoY5kBrseg97sQLzG6OvVG6qX08nC2XL/LACuCyfxecNCMURKcAsnrocHHDfGPU2dUCzDrlj+MRDnMdSAIJGVMydh+tDCFflpUqcIEoxejIZMQS6LpMtQ3GrhozkULsg8VL3tNqyNdGDjXKQsPBWBH6bZfw5whr23NbfyY047tyU9cSWANgPjimCZK7GZ/yFhRmID/uaLTH9oOdnI0341pCTOyxCvCrQNCaBxYPVXIAQ8eSFlR+Tz1kYen+lurdWTyi5BNfKGQy5s6l1mcF5DMq+YWEhAT50rFdFbwd9NiFtHpdcep8O8DGmRj49KENuxMZEf9+GAkHhD7pPtRjbAy6KyvlLhs/sE0zj+wqmRHIiRw+TWWXAh4HnAmuvdg0YdFpW7kccenDLwFbIJMtRBibce74GB2iEbLjnvmdQxW6zGpujU149EZ0KAz/UEJNFCDFOtEZgUKdln4aDkbj2ntJWJglGWQolvYku7kNWfY3DQL7CiPm1b+G/v9XScv56j4pNm 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)(376002)(366004)(396003)(346002)(136003)(39860400002)(230922051799003)(64100799003)(1800799012)(451199024)(186009)(5660300002)(2906002)(44832011)(52536014)(55016003)(83380400001)(41300700001)(86362001)(122000001)(38100700002)(26005)(8990500004)(9686003)(82960400001)(7696005)(64756008)(6506007)(6862004)(10290500003)(71200400001)(66446008)(8936002)(478600001)(8676002)(66946007)(76116006)(33656002)(66476007)(66556008)(82950400001)(38070700009)(6636002)(4326008)(316002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?t8NVzgtZCNnwN+C6xk0nDXTAfMbJ+NtTTvOzPfec2cObEJuJLmS7VXKzRLvP?= =?us-ascii?Q?un54VxdSeDLFpfUXLx8X+fCSybXqlPmvFx5Imx9rR71fwl+xDVuNnZRRBapi?= =?us-ascii?Q?IeLl6nLJyCd2qbKFaXZVKVzF/l2Mb+Z9/7GjPGOfWMISiE2eCZQjX1QcevrX?= =?us-ascii?Q?cEM++41F3YT7QFToJ3sipTSok5jPd092AIzgIbgfvUhPV3y5fQmd/dB/O3d0?= =?us-ascii?Q?12S61qILWpOamICPSS6y2UWtxa6RT0X4e1EJaw8TxY7vFBNORjsHsjSOQTZC?= =?us-ascii?Q?SDP8hIjxAP3JZsH9NVo8Pw1Ue0uqlaDAB6wHKNHiZ5hWiCplMszilSYKdOwX?= =?us-ascii?Q?2DdDWMQis9NKuph3zILc6ir9yPVQp7eHrlxDVTuBnVUSEYV3eYyQvjnZ37xg?= =?us-ascii?Q?xmsGmAFv8gIwoOXkkEcPTBg8/tfzUUf5Xun+j0YDPhXxUvaFcaxM9r53mU7G?= =?us-ascii?Q?sCWAHcis4fuPYScKLZizpOfICeQtWv+eRKdozKG39rAmNxQ6UBrb1d5ktcCa?= =?us-ascii?Q?V+O0AyDEfjaLE0qFhVoh5l5TyUn6v5QFaLie6RdOvh0/g5sbLUDdE9pg3Fj+?= =?us-ascii?Q?qRo4oWelYDQTT2McTLPS1lFmXLdS6qo34FkR0k8G5HvZ24jmzojihnkLle6/?= =?us-ascii?Q?W9GCdScfnMj6bL8AG5szGbPlp5EkldWHnRU8YRQhb7k24cak67YkJr+9mY9K?= =?us-ascii?Q?IK6U2zrS6cjhh5gwo/UM27QOBrnWHuRKC43hEo0jzOjgNTkGp4RXVevJvzip?= =?us-ascii?Q?8LIib0Y4IftWJVMSljwTurtoGF0Zgb4pFaYtVBLTqOu15ucHA+45TscOjQaD?= =?us-ascii?Q?eAlytWaU/8rsu2pEclgsL+OBLu3BfLNrA60ekruFKKGn0yVyCAd6E2mmRqQG?= =?us-ascii?Q?b/2gR7Su2Ubnn3Fm8mIzqmWbSKBTM2yV50LqptVp04xTlz4tApln35Wsf62r?= =?us-ascii?Q?nB9Uj77NtU0r+Y/qc27AQeyvjjz82ptUKku1/lWlDtKN8cpHML3nAu7+EU31?= =?us-ascii?Q?4ga978OvVOxI/ukdFc3cqndSHOmAGwo5/CIyuAG4WeYekKK1gGZDuQmyNosO?= =?us-ascii?Q?oyfGDxqvsr25lP7mRPECAkq2KjSlqPuTYyUsrX8NEdS2C1LxcqiYwjpb/P7Y?= =?us-ascii?Q?zsjsL19vo5igr/Vg5l1DNLYQYkPeZoan1AV04w8cXyqbqb58A5vby/A2REOn?= =?us-ascii?Q?IqIB3d2dNYDJof2ecT2VQ1KyPIIEKbK4mtWVnGpmUFuCFkGv6zlRnKjQ2+Mn?= =?us-ascii?Q?zWCxgpvBmrSLgmjcxxPLxqL1552GeRkx9LcetdrRT7CA5XA418wNvAhvAp/t?= =?us-ascii?Q?w/x6AV2UCAuF0gy2dQyOJ4NT/tqXbkOT7Da9PBn5QgLmepZcHwqBCUekrDOk?= =?us-ascii?Q?FTP2Rkc9txshuRyiEIkQEupwfWQuE/Ry+NlNj8uALevGFE3DNH9nAe1V6oAD?= =?us-ascii?Q?cosGEhYO+JnF6bi/Elapb2QsQjNikWYs6WuUgpwUS4FKU9aWXXsBtUFBkIZ+?= =?us-ascii?Q?pVESgcZNfei9d6IwuK3+zNlmXjKjmoY8Iy+S?= Content-Type: multipart/alternative; boundary="_000_PA4PR83MB0526398D23186AB50C38D0EF97442PA4PR83MB0526EURP_" 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: 08a60452-3966-40b9-9366-08dc28b00188 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Feb 2024 14:12:38.4543 (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: BAtRxsl48pjBxYyMXLAqkIEg/oJML4q0u7K+xu+sP9xH9O9Sr4DM9iwRYxw3hg4ds8h2MKBhsvpSd6q/LSjzaQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR83MB0513 X-Mailman-Approved-At: Thu, 08 Feb 2024 15:15:32 +0100 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 --_000_PA4PR83MB0526398D23186AB50C38D0EF97442PA4PR83MB0526EURP_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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. This fix takes an approach similar to the Linux netvsc driver and defines an explicit structure to use for parsing. Fixes: 4e9c73e96e83 ("net/netvsc: add Hyper-V network device") Cc: sthemmin@microsoft.com Cc: stable@dpdk.org Signed-off-by: Alan Elder alan.elder@microsoft.com --- .mailmap | 1 + drivers/net/netvsc/hn_rxtx.c | 23 +++++++++++++++++------ drivers/net/netvsc/ndis.h | 23 +++++++++++++---------- 3 files changed, 31 insertions(+), 16 deletions(-) diff --git a/.mailmap b/.mailmap index 864d33ee46..0fde0fa509 100644 --- a/.mailmap +++ b/.mailmap @@ -32,6 +32,7 @@ Akihiko Odaki akihiko.odaki@daynix.com Alain Leon xerebz@gmail.com Alan Carew alan.carew@intel.com Alan Dewar alan.dewar@att.com adewar@brocade.co= m +Alan Elder alan.elder@microsoft.com Alan Liu zaoxingliu@gmail.com Alan Winkowski walan@marvell.com Alejandro Lucero alejandro.lucero@netronome.com diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c index bc6f60c64a..949780abd5 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 +#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 Eli= gible 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 inf= o_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; @@ -611,8 +616,10 @@ static void hn_rxpkt(struct hn_rx_queue *rxq, struct h= n_rx_bufinfo *rxb, RTE_PTYPE_L3_MASK | RTE_PTYPE_L4_MASK); - 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; /* 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_SH= IFT); } if (m->ol_flags & RTE_MBUF_F_TX_TCP_SEG) { diff --git a/drivers/net/netvsc/ndis.h b/drivers/net/netvsc/ndis.h index d97a397a86..a1e587c738 100644 --- a/drivers/net/netvsc/ndis.h +++ b/drivers/net/netvsc/ndis.h @@ -316,16 +316,19 @@ struct ndis_offload { */ /* VLAN */ -#define NDIS_VLAN_INFO_SIZE sizeof(uint32_t) -#define NDIS_VLAN_INFO_PRI_MASK 0x0007 -#define NDIS_VLAN_INFO_CFI_MASK 0x0008 -#define NDIS_VLAN_INFO_ID_MASK 0xfff0 -#define NDIS_VLAN_INFO_MAKE(id, pri, cfi) \ - (((pri) & NDIS_VLAN_INFO_PRI_MASK) | \ - (((cfi) & 0x1) << 3) | (((id) & 0xfff) << 4)) -#define NDIS_VLAN_INFO_ID(inf) (((inf) & NDIS_VLAN_INFO_ID_MASK) >= > 4) -#define NDIS_VLAN_INFO_CFI(inf) (((inf) & NDIS_VLAN_INFO_CFI_MASK) = >> 3) -#define NDIS_VLAN_INFO_PRI(inf) ((inf) & NDIS_VLAN_INFO_PRI_MASK) +struct ndis_pkt_vlan_info { + union { + struct { + uint32_t pri:3; /* User Priority */ + uint32_t cfi:1; /* Canonical Format ID / DEI */ + uint32_t vlanid:12; /* VLAN ID */ + uint32_t reserved:16; + }; + uint32_t value; + }; +}; + +#define NDIS_VLAN_INFO_SIZE sizeof(struct ndis_pkt_vlan_info) /* Reception checksum */ #define NDIS_RXCSUM_INFO_SIZE sizeof(uint32_t) -- 2.25.1 --_000_PA4PR83MB0526398D23186AB50C38D0EF97442PA4PR83MB0526EURP_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

The previ= ous code incorrectly parsed the VLAN ID and priority.

If the 16= -bits of VLAN ID and priority/CFI on the wire was

012345678= 9ABCDEF the code parsed it as 456789ABCDEF3012.  There

were macr= os defined to handle this conversion but they were not

used.

&nbs= p;

This fix = takes an approach similar to the Linux netvsc driver and<= /p>

defines a= n explicit structure to use for parsing.

&nbs= p;

Fixes: 4e= 9c73e96e83 ("net/netvsc: add Hyper-V network device")<= /span>

Cc: sthemmin@microsoft.com

Cc: stable@dpdk.org<= o:p>

&nbs= p;

Signed-of= f-by: Alan Elder alan.elder@microsoft.com

---<= /o:p>

 .ma= ilmap                    = |  1 +

 dri= vers/net/netvsc/hn_rxtx.c | 23 +++++++++++++++++------

 dri= vers/net/netvsc/ndis.h    | 23 +++++++++++++----------=

 3 f= iles changed, 31 insertions(+), 16 deletions(-)

&nbs= p;

diff --gi= t a/.mailmap b/.mailmap

index 864= d33ee46..0fde0fa509 100644

--- a/.ma= ilmap

+++ b/.ma= ilmap

@@ -32,6 = +32,7 @@ Akihiko Odaki akihiko.odaki@daynix.com

 Ala= in Leon xerebz@gmail.com<= o:p>

 Ala= n Carew alan.carew@intel.com

 Ala= n Dewar alan.dewar@att.com adewar@brocade.com

+Alan Eld= er alan.elder@microsoft.com

 Ala= n Liu zaoxingliu@gmail.com

 Ala= n Winkowski walan@marvell.com

 Ale= jandro Lucero alejandro.lucero@netronome.com

diff --gi= t a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c<= /span>

index bc6= f60c64a..949780abd5 100644

--- a/dri= vers/net/netvsc/hn_rxtx.c

+++ b/dri= vers/net/netvsc/hn_rxtx.c

@@ -42,8 = +42,13 @@

 #de= fine HN_TXD_CACHE_SIZE  32 /* per cpu tx_descriptor pool cache */=

 #de= fine HN_RXQ_EVENT_DEFAULT   2048

 

+#define = HN_VLAN_PRIO_MASK  0xe000 /* Priority Code Point */<= /p>

+#define = HN_VLAN_PRIO_SHIFT 13

+#define = HN_VLAN_CFI_MASK   0x1000 /* Canonical Format Indicator / Drop Eligibl= e Indicator */

+#define = HN_VLAN_VID_MASK   0x0fff /* VLAN Identifier */

+

 str= uct hn_rxinfo {

-   = uint32_t    vlan_info;

+   = struct ndis_pkt_vlan_info vlan_info;

  &n= bsp; uint32_t    csum_info;

  &n= bsp; uint32_t    hash_info;

  &n= bsp; uint32_t    hash_value;

@@ -477,7= +482,7 @@ hn_rndis_rxinfo(const void *info_data, unsigned int info_dlen,

  &n= bsp;     case NDIS_PKTINFO_TYPE_VLAN:

  &n= bsp;         if (unlikely(dlen < NDIS_VLAN_INFO_SIZE= ))

  &n= bsp;             return -EINVAL;

-   =         info->vlan_info =3D *((const uint32_t *)data= );

+   =         info->vlan_info =3D *((const struct ndis_pkt= _vlan_info *)data);

  &n= bsp;         mask |=3D HN_RXINFO_VLAN;

  &n= bsp;         break;

 

@@ -611,8= +616,10 @@ static void hn_rxpkt(struct hn_rx_queue *rxq, struct hn_rx_bufi= nfo *rxb,

  &n= bsp;                    R= TE_PTYPE_L3_MASK |

  &n= bsp;                    R= TE_PTYPE_L4_MASK);

 

-   = if (info->vlan_info !=3D HN_NDIS_VLAN_INFO_INVALID) {<= /p>

-   =     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);

  &n= bsp;     m->ol_flags |=3D RTE_MBUF_F_RX_VLAN_STRIPPED | RTE_MB= UF_F_RX_VLAN;

 

  &n= bsp;     /* NDIS always strips tag, put it back if necessary */

@@ -669,7= +676,7 @@ static void hn_rndis_rx_data(struct hn_rx_queue *rxq,=

  &n= bsp; unsigned int pktinfo_off, pktinfo_len;

  &n= bsp; const struct rndis_packet_msg *pkt =3D data;

  &n= bsp; struct hn_rxinfo info =3D {

-   =     .vlan_info =3D HN_NDIS_VLAN_INFO_INVALID,

+   =     .vlan_info.value =3D HN_NDIS_VLAN_INFO_INVALID,

  &n= bsp;     .csum_info =3D HN_NDIS_RXCSUM_INFO_INVALID,

  &n= bsp;     .hash_info =3D HN_NDIS_HASH_INFO_INVALID,

  &n= bsp; };

@@ -1332,= 7 +1339,11 @@ static void hn_encap(struct rndis_packet_msg *pkt,=

  &n= bsp; if (m->ol_flags & RTE_MBUF_F_TX_VLAN) {

  &n= bsp;     pi_data =3D hn_rndis_pktinfo_append(pkt, NDIS_VLAN_INFO_= SIZE,

  &n= bsp;                     =   NDIS_PKTINFO_TYPE_VLAN);

-   =     *pi_data =3D m->vlan_tci;

+   =     struct ndis_pkt_vlan_info *vlan =3D (struct ndis_pkt_vlan_inf= o *)pi_data;

+   =     vlan->value =3D 0;

+   =     vlan->vlanid =3D (m->vlan_tci & HN_VLAN_VID_MASK);<= o:p>

+   =     vlan->cfi =3D (!!(m->vlan_tci & HN_VLAN_CFI_MASK));=

+   =     vlan->pri =3D ((m->vlan_tci & HN_VLAN_PRIO_MASK) &g= t;> HN_VLAN_PRIO_SHIFT);

  &n= bsp; }

 

  &n= bsp; if (m->ol_flags & RTE_MBUF_F_TX_TCP_SEG) {

diff --gi= t a/drivers/net/netvsc/ndis.h b/drivers/net/netvsc/ndis.h=

index d97= a397a86..a1e587c738 100644

--- a/dri= vers/net/netvsc/ndis.h

+++ b/dri= vers/net/netvsc/ndis.h

@@ -316,1= 6 +316,19 @@ struct ndis_offload {

  */=

 

 /* = VLAN */

-#define =    NDIS_VLAN_INFO_SIZE     sizeof(uint32_t)<= /span>

-#define =    NDIS_VLAN_INFO_PRI_MASK     0x0007=

-#define =    NDIS_VLAN_INFO_CFI_MASK     0x0008=

-#define =    NDIS_VLAN_INFO_ID_MASK      0xfff0

-#define =    NDIS_VLAN_INFO_MAKE(id, pri, cfi)   \

-   = (((pri) & NDIS_VLAN_INFO_PRI_MASK) |    \

-   =  (((cfi) & 0x1) << 3) | (((id) & 0xfff) << 4))

-#define =    NDIS_VLAN_INFO_ID(inf)      (((inf) & NDIS_= VLAN_INFO_ID_MASK) >> 4)

-#define =    NDIS_VLAN_INFO_CFI(inf)     (((inf) & NDIS_VLAN_= INFO_CFI_MASK) >> 3)

-#define =    NDIS_VLAN_INFO_PRI(inf)     ((inf) & NDIS_VLAN_I= NFO_PRI_MASK)

+struct n= dis_pkt_vlan_info {

+   = union {

+   =     struct {

+   =         uint32_t pri:3; /* User Priority */<= /span>

+   =         uint32_t cfi:1; /* Canonical Format ID / DEI */=

+   =         uint32_t vlanid:12; /* VLAN ID */

+   =         uint32_t reserved:16;

+   =     };

+   =     uint32_t value;

+   = };

+};<= /o:p>

+

+#define =    NDIS_VLAN_INFO_SIZE     sizeof(struct ndis_pkt_vlan_= info)

 

 /* = Reception checksum */

 #de= fine    NDIS_RXCSUM_INFO_SIZE       sizeof(uint32_= t)

-- <= /o:p>

2.25.1

&nbs= p;

 

--_000_PA4PR83MB0526398D23186AB50C38D0EF97442PA4PR83MB0526EURP_--