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 00F07A054A; Tue, 6 Sep 2022 05:33:04 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E2DBD400D6; Tue, 6 Sep 2022 05:33:03 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id 78D9940041 for ; Tue, 6 Sep 2022 05:33:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662435181; x=1693971181; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=DTsZEsjVYHOKIrKBkMjYgkotP1RvjiVXppdP2liTAjw=; b=mJQM9rfUYvm/yMbHytoH0tCogp6v/JHtRIay0ByZtuaB4xfMOs3BdZUj fDHn+8zIZYqDtGKUDmNKSP5LXaT2p9hVE4Zr61BFd0Q8dieZ7He6WoAAY +f0k+SJOhi6uO51WFCx9g1y45aDvE4zveJoA3sGWEw5wlexLLFmtx3uIZ KDoKpeFYA+HDK/wqeLSWetPYhI9YA9iWt54LZQFoJs0q8lzJQGoWmU6CP dijEdGLpelcZC3V3Ka2Dk0IzqZyqfgSwiqAkL01UKa8ZqV0nmNyiSvhtl uwse7+ifmJlLFa0wLeGWnpCTqZ1GBOLrd/o0RQsRA0btlzDiTkL5OYbCZ w==; X-IronPort-AV: E=McAfee;i="6500,9779,10461"; a="360442936" X-IronPort-AV: E=Sophos;i="5.93,293,1654585200"; d="scan'208";a="360442936" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Sep 2022 20:33:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,293,1654585200"; d="scan'208";a="591102528" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orsmga006.jf.intel.com with ESMTP; 05 Sep 2022 20:33:00 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Mon, 5 Sep 2022 20:33:00 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31 via Frontend Transport; Mon, 5 Sep 2022 20:33:00 -0700 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.174) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.31; Mon, 5 Sep 2022 20:32:59 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MBWEgpw6Ow5QjwYzEnl29tHdHCMxFbBgd8Z1mZty0rE3I6qo/yrV3d+ItY8ka5uEgUkKvIKEai9YK7Dv9i8qkTUi3emKfeE7zhhx0JDzY9EtqtyEZ7817qKl8O1svlAKJa2vZAFqirOMvzEh08MNwUm2qPdeIMEmICezqTucDrKxsKx/CxKWI9XBdOQxAsGDB3zrbOsyScpZxKd4NAn4VaEq/EqncjG5HcyTU4y4OIqWxzYZEea5s7whcItZLN45HSUwUZMEgu4nkZNveuv+SnPMgnXZt/3q9LfsCwxXP5RSIBOO2Ij6lUQNesMplsEtYRkZxGzGFsAYtpwOrcDxHA== 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=ulsMSK0yjJ9b1+RYwXXO8EilHk9zhwt8yNXs/D+6YIw=; b=Ml0LXSoM5wFFkhdeUjxROqJ+b/+fbAp8FQD1J0EA9Q3c2iHjZV5tTn6dwGHI4A0/48V1edC/aWVFCJdlqpgnClMD+yX7h2gWYimJOPJ/qZTKM2Y5sHAHT4YXbcaYDIiTyclCk/dGGBK+JMzoQk/UH7bIcyR7slnoLyrR/9mMn07OEhd7QRWawTYOcf8LWVbyw5gcJkPJ2ehHOHro+gOGqF8KYDKBtzYwdHaMzDe3XmyYnX7dhcyTeFPbyMCVrcn1vMGwfurYGEDJd9i4A4Iml0cwwotlBTi4sAPyaLHuu5bOJyjuey/OwUq95ZEcV5z5doKk+AN3IjjHOvpw+ossBg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from DM6PR11MB3673.namprd11.prod.outlook.com (2603:10b6:5:145::26) by CO1PR11MB4802.namprd11.prod.outlook.com (2603:10b6:303:94::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.10; Tue, 6 Sep 2022 03:32:58 +0000 Received: from DM6PR11MB3673.namprd11.prod.outlook.com ([fe80::e127:9ac6:8710:841a]) by DM6PR11MB3673.namprd11.prod.outlook.com ([fe80::e127:9ac6:8710:841a%6]) with mapi id 15.20.5588.018; Tue, 6 Sep 2022 03:32:58 +0000 From: "Liu, KevinX" To: "Zhang, Yuying" , "dev@dpdk.org" CC: "Xing, Beilei" , "Yang, SteveX" Subject: RE: [PATCH] net/i40e: fix single VLAN cannot work normal Thread-Topic: [PATCH] net/i40e: fix single VLAN cannot work normal Thread-Index: AQHYstkh6+7xqqqE1k+uLOxGbgu8r63Rx3EAgAAVPLA= Date: Tue, 6 Sep 2022 03:32:58 +0000 Message-ID: References: <20220818160351.1353003-1-kevinx.liu@intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.6.500.17 dlp-reaction: no-action authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 5d2f5a09-009e-496c-7ead-08da8fb87e53 x-ms-traffictypediagnostic: CO1PR11MB4802:EE_ x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: yxGULdr23y0hX8BI4HWZ3l15DYPNS3rDNWLErRa7kWTiPi72L0g4OLwIdSl/44Hjn2PjTjW1LYP3rXyfo78D7QmK46w2MwXLC1c12ck68/MiZn6puA3F9q6Gz+xkkMc57w28ODzdKSFrnm2VOX0UhjHT4HOXiZnIn7aRjbtmK0a8Ps37Jt6TKoMmGyngNYWQAXYUPWVQJsxDi+XjXIWA6ycYdp17JImf/zIfkHto/7UPvYOn8MRTvc+k1AIeFn1iaIrTLoQ7erlSPQZ4vgmL5njH+DVcVZzW1KqWYVE6FUxG8ApeQczkD6sdzTQxT4DFrNdEUD/GaqpHx1aBeuWK6kHAtGca+JTn4X/vmGKUlbt15/eBNe6Fmp47bGMsTlYcgB8CopGGnKccR60J5+HcOIIXIUTDKhJmb1pVvG1i/3l/7AJ/h9JqUAUbcridj6LOS6Ipqyq8c/wH+zPmRo5/WNnRih1V/a2t+dFKk4bSx9QH3PbjZiYubTX8mOuTNMoCsQgbWuFAgBXiuDJwWAK3vmk7ims8npr2vOcAMz+dIEjOroKe1UdSLnhwdTaNAcCqAGSFs8fSU5C9+TzDzDuP5z/RhkiuxMcK1uOnU1GIbN2jzoyFoUripMP0QLS6F72bcuM2r/noHPTr3g+LqEIST6a162p4YdiGYqx6O6fAPae33QIf9N+TGyqE6XzIoinCCirstQ1m69wzpv/2M1uQ7pnnJFNS7zx0gWfjFksDuDbX2ietjD14LqUkuwUQiRz3iPuVtPH87mWtsvs9rhgDZg== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR11MB3673.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(136003)(396003)(39860400002)(346002)(376002)(366004)(110136005)(26005)(33656002)(54906003)(83380400001)(55016003)(186003)(107886003)(41300700001)(86362001)(71200400001)(9686003)(53546011)(52536014)(478600001)(2906002)(8936002)(38070700005)(82960400001)(5660300002)(30864003)(316002)(122000001)(8676002)(7696005)(4326008)(38100700002)(6506007)(66946007)(76116006)(66556008)(66476007)(66446008)(64756008); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?tTCXhrV30M4VB7baagjgDQdKzRAvPSEQ1ph1BzPMP9qaN/i+gRaLrVH4p5VI?= =?us-ascii?Q?YpmM75TEc0SHxE3JuZyPL9GpYS0F7Ci3DP7p5HeJSqNgmwvnkhV3lXyVMbDZ?= =?us-ascii?Q?d4O7eWdLObCnAFSOcI9sXNBomwT6QJ0RVaSbuAF3l9Zwn8hHk1Z6eVNKwSv5?= =?us-ascii?Q?Ttqkt614DhYH8UJWv/+JrIZiqlhb2B5nUDP6zBO3eRVlnU2LxtxvFvw+00el?= =?us-ascii?Q?6ZZ8C5GDpkVAfFGq9e2BRamf8nFBdpsTiQIZ9tmfLLH52aJe0wxxeSfxw2Cd?= =?us-ascii?Q?vBClbc6IIERW0y6R9QH/LFryWJSga9IRJhf9Njc9pYumgNl55e+/2zc7ZZbn?= =?us-ascii?Q?LiXmTLK+giCpTAoXa/p5OJriaVkml/4MJyDr4yDmHt+/G6vIPAYQOb6bETq8?= =?us-ascii?Q?F1d4dS29v397cTJ3gntIGNKcrZvtNC40q4MFKeMbFovVw2+yOp31b+18bCos?= =?us-ascii?Q?MG7EFYElDfOAykeAmBWu0ecuHuLHlRTPWFW2rNoYNJyOCaFuNSxQV5fqjEk1?= =?us-ascii?Q?CpSrGJOm5RN0nnLdhh7PWGtmu8thZwEtTv5q9gPyv9AWaFr6qkYGXin7xlwK?= =?us-ascii?Q?ZXRffxB4JXr6RDIygjuA/BU22clNDDYGbWOb3D2dDsFLTHBfxf0YhFqC5d0D?= =?us-ascii?Q?vs12WdNuU/iRABJmmI6XviBGdX7yRNxpTZ5WqWgsyCYoqIaXUOx3gUbsoG6y?= =?us-ascii?Q?wp1IdjlHj3MlkymVC+Q8Ju+rSv8stnSk5MoBrPHZPWcsTWu3FsG9InTujDWM?= =?us-ascii?Q?CkHQ3SwIEa2EpKknLK5MSI/cxlSnoO/yxYOwVm9hjZ8L68FZFxqsjIPuJMdP?= =?us-ascii?Q?cQQ1qHlFFFiJg12SL0V54JRUBGem8a1WPK24PaEbyn800HEaQEMIod60QU6P?= =?us-ascii?Q?1OCqGQYYBnyI8WIfoPvhYmf77FLaXXOw5OExCa36SRYizKx51VWYFn8oGvtY?= =?us-ascii?Q?oUsHHKOEPKdpO3R4H8ApFaNHR6YGyKu19va4JNSgK7pWprWLZ0GCNz5dq+pO?= =?us-ascii?Q?VGYzMn3Tq/OyJ8ebQgsZK1DLcA87JrVfETeJZHQ7Q8EiE7OdLWlSFbYaPin0?= =?us-ascii?Q?QMe0vX8dHEX+KXokE+ucVwjRBXEIhKNCqgb/HdpFli4+UBM0H2uEod9tGDEA?= =?us-ascii?Q?+rkhYzlY3N+J7X2LG8bUKYJ0Q8/7z3GlAv/6BGLwf+DOjHxHBknGRurhCTR7?= =?us-ascii?Q?zvVpR42K4RdZ5RqmQCV0k9zydwDTUIhVDFAZzWAUNj2qID7TuqB/CUiVzuYp?= =?us-ascii?Q?Mec3MxyLRRWiVwGimMf8aQOBRi2/IxnKR3OBAtr9UTEKQTVBSBZWaG+aQN9B?= =?us-ascii?Q?eVbnyWLghLRx1r+6V0/AyEyTb3Qjm4omm+5SCMPw3hAoxZuELSVZTA2w9wmN?= =?us-ascii?Q?VfC+Qhu95EFNJ0K1oD6yrnGdldMEFkzJOLIjraEhcA0XMxeVwzfKhys8MPWa?= =?us-ascii?Q?Uwn3AL9Jhl9qVdNhW1r12Cm0cuI6pokQIZQRtE4y71A/wc4YFUg35X82EOCa?= =?us-ascii?Q?XeOpFrbgF7ejn+EiH+2n5m5M694hSyK6IYyO3erGVQU0Q7INAov8x29it+z4?= =?us-ascii?Q?AYHwFaWCu0I5+hX8i1n3WdQ7fO4ACiuf0bPDaQlW?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR11MB3673.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5d2f5a09-009e-496c-7ead-08da8fb87e53 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Sep 2022 03:32:58.2189 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 0SGvtkIY6zkOoWhQmy8/0s89jEdgVQFKTTTd5ylTxTcSXgG+7dfTZCvFsf8yJVfm6gPzDsAceZsufdc/4aqbKg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR11MB4802 X-OriginatorOrg: intel.com 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: Zhang, Yuying > Sent: Tuesday, September 6, 2022 10:16 AM > To: Liu, KevinX ; dev@dpdk.org > Cc: Xing, Beilei ; Yang, SteveX > Subject: RE: [PATCH] net/i40e: fix single VLAN cannot work normal >=20 > Hi, >=20 > > -----Original Message----- > > From: Liu, KevinX > > Sent: Friday, August 19, 2022 12:04 AM > > To: dev@dpdk.org > > Cc: Zhang, Yuying ; Xing, Beilei > > ; Yang, SteveX ; Liu, > > KevinX > > Subject: [PATCH] net/i40e: fix single VLAN cannot work normal > > > > After disable QinQ, single VLAN can not work normal. > > The reason is that QinQ is not disabled correctly. > > > > Before configuring QinQ, need to back up and clean MAC/VLAN filters of > > all ports. After configuring QinQ, restore MAC/VLAN filters of all > > ports. When disable QinQ, need to set valid_flags to 0x0008 and set fir= st_tag > to 0x88a8. > > > > Signed-off-by: Kevin Liu > > --- > > doc/guides/nics/i40e.rst | 1 - > > drivers/net/i40e/i40e_ethdev.c | 159 > > +++++++++++++++++++++++---------- > > 2 files changed, 111 insertions(+), 49 deletions(-) > > > > diff --git a/doc/guides/nics/i40e.rst b/doc/guides/nics/i40e.rst index > > abb99406b3..15b796e67a 100644 > > --- a/doc/guides/nics/i40e.rst > > +++ b/doc/guides/nics/i40e.rst > > @@ -983,7 +983,6 @@ If FW version >=3D 8.4, there'll be some Vlan relat= ed > issues: > > > > #. TCI input set for QinQ is invalid. > > #. Fail to configure TPID for QinQ. > > -#. Need to enable QinQ before enabling Vlan filter. > > #. Fail to strip outer Vlan. > > > > Example of getting best performance with l3fwd example diff --git > > a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c > > index > > 67d79de08d..27cfda6ff8 100644 > > --- a/drivers/net/i40e/i40e_ethdev.c > > +++ b/drivers/net/i40e/i40e_ethdev.c > > @@ -325,6 +325,7 @@ static int i40e_veb_release(struct i40e_veb *veb); > > static struct i40e_veb *i40e_veb_setup(struct i40e_pf *pf, > > struct i40e_vsi *vsi); > > static int i40e_vsi_config_double_vlan(struct i40e_vsi *vsi, int on); > > +static int i40e_vsi_config_qinq(struct i40e_vsi *vsi, int on); > > static inline int i40e_find_all_mac_for_vlan(struct i40e_vsi *vsi, > > struct i40e_macvlan_filter *mv_f, > > int num, > > @@ -3909,7 +3910,6 @@ i40e_vlan_tpid_set(struct rte_eth_dev *dev, > > struct i40e_pf *pf =3D I40E_DEV_PRIVATE_TO_PF(dev->data- > > >dev_private); > > int qinq =3D dev->data->dev_conf.rxmode.offloads & > > RTE_ETH_RX_OFFLOAD_VLAN_EXTEND; > > - u16 sw_flags =3D 0, valid_flags =3D 0; > > int ret =3D 0; > > > > if ((vlan_type !=3D RTE_ETH_VLAN_TYPE_INNER && @@ -3928,10 > > +3928,6 @@ i40e_vlan_tpid_set(struct rte_eth_dev *dev, > > /* 802.1ad frames ability is added in NVM API 1.7*/ > > if (hw->flags & I40E_HW_FLAG_802_1AD_CAPABLE) { > > if (qinq) { > > - if (pf->fw8_3gt) { > > - sw_flags =3D > > I40E_AQ_SET_SWITCH_CFG_OUTER_VLAN; > > - valid_flags =3D > > I40E_AQ_SET_SWITCH_CFG_OUTER_VLAN; > > - } > > if (vlan_type =3D=3D RTE_ETH_VLAN_TYPE_OUTER) > > hw->first_tag =3D rte_cpu_to_le_16(tpid); > > else if (vlan_type =3D=3D RTE_ETH_VLAN_TYPE_INNER) @@ > > -3940,8 +3936,8 @@ i40e_vlan_tpid_set(struct rte_eth_dev *dev, > > if (vlan_type =3D=3D RTE_ETH_VLAN_TYPE_OUTER) > > hw->second_tag =3D rte_cpu_to_le_16(tpid); > > } > > - ret =3D i40e_aq_set_switch_config(hw, sw_flags, > > - valid_flags, 0, NULL); > > + ret =3D i40e_aq_set_switch_config(hw, 0, > > + 0, 0, NULL); > > if (ret !=3D I40E_SUCCESS) { > > PMD_DRV_LOG(ERR, > > "Set switch config failed aq_err: %d", @@ - > > 3993,11 +3989,15 @@ static int i40e_vlan_offload_set(struct > > rte_eth_dev *dev, int mask) { > > struct i40e_pf *pf =3D I40E_DEV_PRIVATE_TO_PF(dev->data- > > >dev_private); > > + struct i40e_mac_filter_info *vmac_filter[RTE_MAX_ETHPORTS]; > > + struct i40e_vsi *vvsi[RTE_MAX_ETHPORTS]; > > struct i40e_mac_filter_info *mac_filter; > > struct i40e_vsi *vsi =3D pf->main_vsi; > > struct rte_eth_rxmode *rxmode; > > + int vnum[RTE_MAX_ETHPORTS]; > > struct i40e_mac_filter *f; > > - int i, num; > > + int port_num =3D 0; > > + int i, num, j; > > void *temp; > > int ret; > > > > @@ -4018,50 +4018,80 @@ i40e_vlan_offload_set(struct rte_eth_dev *dev, > > int > > mask) > > } > > > > if (mask & RTE_ETH_VLAN_EXTEND_MASK) { > > - i =3D 0; > > - num =3D vsi->mac_num; > > - mac_filter =3D rte_zmalloc("mac_filter_info_data", > > - num * sizeof(*mac_filter), 0); > > - if (mac_filter =3D=3D NULL) { > > - PMD_DRV_LOG(ERR, "failed to allocate memory"); > > - return I40E_ERR_NO_MEMORY; > > - } > > - > > - /* > > - * Outer VLAN processing is supported after firmware v8.4, > > kernel driver > > - * also change the default behavior to support this feature. To > > align with > > - * kernel driver, set switch config in 'i40e_vlan_tpie_set' to > > support for > > - * outer VLAN processing. But it is forbidden for firmware to > > change the > > - * Inner/Outer VLAN configuration while there are MAC/VLAN > > filters in the > > - * switch table. Therefore, we need to clear the MAC table > > before setting > > - * config, and then restore the MAC table after setting. This > > feature is > > - * recommended to be used in firmware v8.6. > > - */ > > - /* Remove all existing mac */ > > - RTE_TAILQ_FOREACH_SAFE(f, &vsi->mac_list, next, temp) { > > - mac_filter[i] =3D f->mac_info; > > - ret =3D i40e_vsi_delete_mac(vsi, &f- > > >mac_info.mac_addr); > > - if (ret) > > - PMD_DRV_LOG(ERR, "i40e vsi delete mac fail."); > > - i++; > > + /*back up and clean mac/vlan filters of all ports*/ > > + for (j =3D 0; j < RTE_MAX_ETHPORTS; j++) { > > + /* > > + * It is impossible to confirm whether the port is pf > > + * only through the state field, so it is also necessary > > + * to verify the intr_handle field. > > + */ > > + if (rte_eth_devices[j].state !=3D RTE_ETH_DEV_UNUSED > > && > > + > > rte_eth_devices[j].intr_handle) { > > + struct rte_eth_dev *tmp_dev =3D > > &rte_eth_devices[j]; > > + struct i40e_pf *tmp_pf =3D > > + I40E_DEV_PRIVATE_TO_PF(tmp_dev- > > >data->dev_private); > > + struct i40e_vsi *tmp_vsi =3D tmp_pf->main_vsi; > > + i =3D 0; > > + num =3D tmp_vsi->mac_num; > > + mac_filter =3D > > rte_zmalloc("mac_filter_info_data", > > + num * sizeof(*mac_filter), 0); > > + if (mac_filter =3D=3D NULL) { > > + PMD_DRV_LOG(ERR, "failed to > > allocate memory"); > > + return I40E_ERR_NO_MEMORY; > > + } > > + /* > > + * Outer VLAN processing is supported after > > firmware v8.4, > > + * kernel driver also change the default > > behavior to support > > + * this feature. To align with kernel driver, set > > switch > > + * config in 'i40e_vlan_tpid_set' to support for > > outer VLAN > > + * processing. But it is forbidden for firmware > > to change the > > + * Inner/Outer VLAN configuration while there > > are MAC/VLAN > > + * filters in the switch table. Therefore, we > > need to clean > > + * MAC/VLAN filters of all ports before setting > > config, and > > + * then restore the MAC table after setting. This > > feature is > > + * recommended to be used in firmware v8.6. > > + */ > > + /* Remove all existing mac */ > > + RTE_TAILQ_FOREACH_SAFE(f, &tmp_vsi- > > >mac_list, next, temp) { > > + mac_filter[i] =3D f->mac_info; > > + ret =3D i40e_vsi_delete_mac(tmp_vsi, &f- > > >mac_info.mac_addr); > > + if (ret) > > + PMD_DRV_LOG(ERR, "i40e vsi > > delete mac fail."); > > + i++; > > + } > > + vmac_filter[j] =3D mac_filter; > > + vvsi[j] =3D tmp_vsi; > > + vnum[j] =3D num; > > + port_num++; > > + } > > } > > if (rxmode->offloads & RTE_ETH_RX_OFFLOAD_VLAN_EXTEND) > { > > - i40e_vsi_config_double_vlan(vsi, TRUE); > > - /* Set global registers with default ethertype. */ > > - i40e_vlan_tpid_set(dev, RTE_ETH_VLAN_TYPE_OUTER, > > - RTE_ETHER_TYPE_VLAN); > > - i40e_vlan_tpid_set(dev, RTE_ETH_VLAN_TYPE_INNER, > > - RTE_ETHER_TYPE_VLAN); > > + if (pf->fw8_3gt) { > > + i40e_vsi_config_qinq(vsi, TRUE); > > + } else { > > + i40e_vsi_config_double_vlan(vsi, TRUE); > > + /* Set global registers with default ethertype. > > */ > > + i40e_vlan_tpid_set(dev, > > RTE_ETH_VLAN_TYPE_OUTER, > > + > > RTE_ETHER_TYPE_VLAN); > > + i40e_vlan_tpid_set(dev, > > RTE_ETH_VLAN_TYPE_INNER, > > + > > RTE_ETHER_TYPE_VLAN); > > + } > > } else { > > - i40e_vsi_config_double_vlan(vsi, FALSE); > > - } > > - /* Restore all mac */ > > - for (i =3D 0; i < num; i++) { > > - ret =3D i40e_vsi_add_mac(vsi, &mac_filter[i]); > > - if (ret) > > - PMD_DRV_LOG(ERR, "i40e vsi add mac fail."); > > + if (pf->fw8_3gt) > > + i40e_vsi_config_qinq(vsi, FALSE); > > + else > > + i40e_vsi_config_double_vlan(vsi, FALSE); > > + } > > + /*restore mac/vlan filters of all ports*/ > > + for (j =3D 0; j < port_num; j++) { >=20 > The index here is incorrect. Thanks, I will send v2. >=20 > > + mac_filter =3D vmac_filter[j]; > > + for (i =3D 0; i < vnum[j]; i++) { > > + ret =3D i40e_vsi_add_mac(vvsi[j], &mac_filter[i]); > > + if (ret) > > + PMD_DRV_LOG(ERR, "i40e vsi add mac > > fail."); > > + } > > + rte_free(mac_filter); > > } > > - rte_free(mac_filter); > > } > > > > if (mask & RTE_ETH_QINQ_STRIP_MASK) { @@ -6181,6 +6211,39 @@ > > i40e_vsi_config_double_vlan(struct i40e_vsi *vsi, int > > on) > > return i40e_aq_set_port_parameters(hw, vsi->seid, 0, 1, on, NULL); > > } > > > > +static int > > +i40e_vsi_config_qinq(struct i40e_vsi *vsi, int on) { > > + struct i40e_hw *hw =3D I40E_VSI_TO_HW(vsi); > > + u16 sw_flags =3D 0, valid_flags =3D 0; > > + int ret =3D 0; > > + > > + ret =3D i40e_aq_set_port_parameters(hw, vsi->seid, 0, 1, on, NULL); > > + if (ret !=3D I40E_SUCCESS) { > > + PMD_DRV_LOG(ERR, "Failed to set port params"); > > + return -1; > > + } > > + > > + if (on) { > > + sw_flags =3D I40E_AQ_SET_SWITCH_CFG_OUTER_VLAN; > > + valid_flags =3D I40E_AQ_SET_SWITCH_CFG_OUTER_VLAN; > > + hw->first_tag =3D rte_cpu_to_le_16(RTE_ETHER_TYPE_VLAN); > > + } else { > > + valid_flags =3D I40E_AQ_SET_SWITCH_CFG_OUTER_VLAN; > > + hw->first_tag =3D rte_cpu_to_le_16(RTE_ETHER_TYPE_QINQ); > > + } > > + > > + ret =3D i40e_aq_set_switch_config(hw, sw_flags, valid_flags, 0, NULL)= ; > > + if (ret) { > > + PMD_DRV_LOG(ERR, > > + "Set switch config failed aq_err: %d", > > + hw->aq.asq_last_status); > > + return -1; > > + } > > + > > + return 0; > > +} >=20 > Qinq is double vlan, please use i40e_vsi_config_double_vlan() function fo= r bug > fixing. Ok, I will fix it. >=20 > > + > > static int > > i40e_update_flow_control(struct i40e_hw *hw) { > > -- > > 2.34.1