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 8341BA054A; Tue, 6 Sep 2022 04:15:50 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 34603400D6; Tue, 6 Sep 2022 04:15:50 +0200 (CEST) Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 3378D40041 for ; Tue, 6 Sep 2022 04:15:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662430549; x=1693966549; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=9ZMJDvn320f9pHpb72SsFe7rnCjK6/93u5abzlMoho0=; b=TCMqCLeCw2XS73WGu80ZHDAh1bjWfy2+n6iZ9NuJwmvY+0Mryx0S5bGa /kvs1Q8tmCWK9cEHrnGetpK6nd1nXA3/gW6KELpztauaLxg2YWKzn0cxb TelH42ha6WXZQZ44IqRPN6DqWZ1Prmoonbe4hvGnFuhVaBHkl1WZ6X4SB mBRaacvaM3cX2GOlPAZWQyJ4/7tm/lfK0/7siFIREUOrFfDpfkaHORYuP AU6dbRnaD2b2HffZagY/5/9+H+dtcQlW9kIVUoo/PzZr8NpSvI1EzSN01 RAmo3RvpFRjKwxqfXCtGGD13xebRnpHhEq6A2Ha33cW/23scKcY93fPII A==; X-IronPort-AV: E=McAfee;i="6500,9779,10461"; a="358198214" X-IronPort-AV: E=Sophos;i="5.93,292,1654585200"; d="scan'208";a="358198214" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Sep 2022 19:15:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,292,1654585200"; d="scan'208";a="675476440" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmsmga008.fm.intel.com with ESMTP; 05 Sep 2022 19:15:47 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx601.amr.corp.intel.com (10.18.126.81) 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 19:15:47 -0700 Received: from fmsmsx602.amr.corp.intel.com (10.18.126.82) by fmsmsx611.amr.corp.intel.com (10.18.126.91) 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 19:15:47 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) 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 via Frontend Transport; Mon, 5 Sep 2022 19:15:47 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.169) 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 19:15:46 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PBTQYO2VE2mTBOk+9fOK3cpifP7xsO7I9oI5X4RgkcyKOhPzoIRN9fqX4LIldqz+hIDlP1nL+XewfmB5qBvX3EGpawjxcqCG5I6eou4efBcJ+t6+rgI3clB+eq46t0CW2GFzstYE2C3gZu9OFyz6Wo4nFJbZDowQ9fLs9LDE8QFCT0vVTzTolP1oLduu6n36e9jVERpNiHz01SJxjQ9aDtIOrAFldP+gMyubCvzRFsZj3w7vVVawMFFjOW+bbDjqQGALxxysoeLUyvBhi1O5eaMQdwEil3arqEWdGKRG2L4XQnH2Oo8PD6wjl1lrQGwWEPtBvPEJ+DF8Dpp3gsYxgQ== 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=1oWa+0RSr8TyqmdfjhAzv+OjZGlQkaLIqSklNlJGnfg=; b=oLBbpL5GD0YtkfVlThqMMiZyRBM1L+y5+/pv4TTS2Xd0OSWsU1gGa5e7nITYJtgGb/qR5xi5Qfm14c5r+Z80gsAIqxIL4q6o/Inu8t9ggEDFxHsXqHPqg5qBKc7bn5mHljBn8G3lmt+ss2AQYlTVFHDf03rbFakMhfYCA3DiFkrGLbmZhTD4WWuvnsHA0kU1Xxd2Et7Pig60yU5i6z8Agz8V9XH8p93NtTeV9GsMxqlv4c46BbX2kSTeVRd4+quQ30Z010KBF6c9ezCfoF0F72NxfOTp5Fm43vMafevIJIonCTZ1VyD2OFsDjrBun/fYwg++WVfZb2VEcpvuXuLwMw== 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 DM6PR11MB3516.namprd11.prod.outlook.com (2603:10b6:5:72::13) by SJ0PR11MB5070.namprd11.prod.outlook.com (2603:10b6:a03:2d5::13) 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 02:15:44 +0000 Received: from DM6PR11MB3516.namprd11.prod.outlook.com ([fe80::4416:c910:4c93:1e60]) by DM6PR11MB3516.namprd11.prod.outlook.com ([fe80::4416:c910:4c93:1e60%5]) with mapi id 15.20.5588.018; Tue, 6 Sep 2022 02:15:44 +0000 From: "Zhang, Yuying" To: "Liu, KevinX" , "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: AQHYstkhdD8qJSHyCUKwYhUpYof/963Rxikg Date: Tue, 6 Sep 2022 02:15:44 +0000 Message-ID: References: <20220818160351.1353003-1-kevinx.liu@intel.com> In-Reply-To: <20220818160351.1353003-1-kevinx.liu@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: 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: 34664e40-fb77-47b2-0b6d-08da8fadb478 x-ms-traffictypediagnostic: SJ0PR11MB5070:EE_ x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: eouJtmM9QuPqu3GmRCInLl4MngouIUN7P0696/SR1Qok2+WF4HzfTcxqo9lWWPk3y+fNihJG5I3B/FWyJ8I1OAxkrDdiwGxPy8bzH4S3/4OIOOiweOlHynfrBEU/Voop3QQksJS7eJl99Qwsvr0TnsCdq2+6rbn/1/usbKXnNhPyxNhSoZPsFbhXM/xHHBxz6tykwGGjFJMSsxcgXXuy9VoLSRZDbd0CJXSiB7IS86Zj6D4NvLmJxcsxjwrxUSzif4bj95kN9+gqffafIXa/L/gwxhP6wLd15bQ0oaVzYItcq8Aa6OAR3KScmfd5TTI1xuGViAH0JCmubVfPM9b7jZ3Y5Dw+65IiTrYW9gew+ZYCsdswD4yZWxNIPFCerdo0mD0dUEWN1am9+YfpMxf1MM6WmPm3ZCLiUir5HZXO1ZlqcceTImcA4KqeRqPi1vrKEsO4T3uU8XJSbt+Loh834uQshL8tvwFddQ4PZaWSwNI0v2g8FvhDtGAkjKtO/XIAtXXf2nj7YVgBJ0wbx7uH+vPrw+343X/y8TJdT6doxyCVkESG+l6uhpjY7yKguYzX5BjX3ibPDsuSkBchslv5vh8XtSQBfIzcsLt1tfXA48lGKZngesWCFxtp7Mg5gJQzraQsseRVc6AEIZqAhdOr5TthNb4TkfpvY6yYB2HbmmiZP3dw/1zsJjRHQ9Y/yrIXeoSZvuvkGz3J5+SowJOQVykiLy4TiLFt2/xVw5qnZHZ6GyohahTr0Yl7jLBxyP+wEW2/g0UhR9eUWJvOvQEn6w== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR11MB3516.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(366004)(39860400002)(346002)(136003)(376002)(396003)(83380400001)(64756008)(76116006)(66446008)(4326008)(8676002)(66946007)(66476007)(41300700001)(110136005)(66556008)(107886003)(316002)(54906003)(33656002)(86362001)(9686003)(186003)(26005)(8936002)(38070700005)(82960400001)(55016003)(5660300002)(2906002)(7696005)(6506007)(478600001)(71200400001)(53546011)(38100700002)(122000001)(52536014); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?k0b0K4dDa629MbNcKJ0WASUyhwcj7jRM3757riXmcyhmhs3ux+KD6CPkjoU7?= =?us-ascii?Q?pR6h5K1WkMKkce51jRQm/9tX1RziQ95RVisFbYi8Er7rjlGTbl3OZLJf8EZz?= =?us-ascii?Q?/gqNzRdlxXSIfuluAp38htxx1Y7n6fLku6jRisvMd1m+gHcwewDGWujFCEM2?= =?us-ascii?Q?U73DCvnnF1eU8yXduA7AUuDa1YrdBvvmA8LdErvmPC7uAuweq98r7HR7Romu?= =?us-ascii?Q?C4id7yZArzfQl6e/b58ltqhcdDsBUYYSpV1wQ4qNBnlC/TIKQ58Ui4T/8SYN?= =?us-ascii?Q?ALCEeForqly32q3GWTnkMLAKfMuNh19NQRk8DhaKiKwA0adbcCQigv5nbgmu?= =?us-ascii?Q?YA56347fcg/hed8mYgGxHZGf2CEYy86dbM03GvgCnlF1/euisJ6dbNUZ0gX6?= =?us-ascii?Q?1Byoj3mDhcXgfHC4q3xUOmpS8cGA6K1NysNnAq7cjDSvdvrtlKXqEwshDU4L?= =?us-ascii?Q?xtmvkenkYFWI/prdIBMXCc4527byzmGXRqt1fuIV+oRcvVc/1V5l4WN0Azew?= =?us-ascii?Q?deI2cATRqocJjibKLhb3Iy1Kbuj1tMGR/qz7TTYlbIcUlsmSiaMA+V242yzC?= =?us-ascii?Q?x4GZbStuJuqUruKGtl27OQscFut6THEc/9CiaxIitW6p5HnCHfLNYVE0SzIe?= =?us-ascii?Q?CvnpFSL/kx34Y7V1FyBHV6J/ZTDanhpuePeE/ffG6XPoB9uO2Q0CjBfRGQyg?= =?us-ascii?Q?I+/XHIEanuJ2CCIu32GfHdMIv3tPT8M82nMhZ4V5dwGqdfJKONnzFZkyF+Ft?= =?us-ascii?Q?KL9uS8jbwctmbJJFmRwCb8n8uqdp8NvTV0my37rDN9IPIF3PSHrh+Vq8VVoE?= =?us-ascii?Q?CchSPtxdqZ4D0jxSHDKx4MZVFb5UTwcIlGvCPxljxp3JQA5UsLDdokVjQRdm?= =?us-ascii?Q?6sWxEvF5CiwcF89IGPE8AiWXXF6+T87ad8QwxGkm/Blosi4qsbutr3R14GXc?= =?us-ascii?Q?KEQljIZ+11CEXPbPGXm6pqWwsFiASUoabN8NjtPPRggbdZ3RTz9oJPNMbzZE?= =?us-ascii?Q?uRRLFULIRYC0fIjJtEH8nai2ZtwBpQnIaIbfzYCMKgl+k4USxTGSW2yJe3mc?= =?us-ascii?Q?te7SAkAWs2KxmIIID2K9Y/mvYjwUFsOxTlGBJO7N9vJJ5ib93VDeYeIkUrdg?= =?us-ascii?Q?iEm9lnj5yxtViaISsHXNvbYYuWrN4U8KgUhiKr+INGAoMNIebBBAN01vkTpF?= =?us-ascii?Q?mXdjgSjOcOz1PdGQ70uh57cpRaRJ9HVV4m1DdnxBAa7+kgXYmz4JX+iJhvGJ?= =?us-ascii?Q?23NEazIQi3ySWJfqvWNYyT1pa6GGNCV/QXgckGm5/Rhj6r/KGO+FZ73WxKoP?= =?us-ascii?Q?zJ6Rtsh/ZD/VbyFgSfmJRh8/6GLZqSd9oe0IKTpwiA2wIwwqJww1GGHWaZa4?= =?us-ascii?Q?v8KBcILnYcqrrutj+/fyvd09fJrjJl+2cR1l+GStJSG2CeF57rMenDYYQh6N?= =?us-ascii?Q?gM9HHWO1X4B5DOCgyl7shvbWYHjfoojkmqOsvSUFfnNEhzRnDpxHPLubtLgX?= =?us-ascii?Q?VjZX8bhWr2Yfk96/uB1rOWFkylZR4nmlMrPVMNredjapcy5L9KDZ8lEBJtaN?= =?us-ascii?Q?ENzzHkx2wqfy9zdzZ1j8mKyTIsFNBUh1A5gtYfLW?= 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: DM6PR11MB3516.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 34664e40-fb77-47b2-0b6d-08da8fadb478 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Sep 2022 02:15:44.6070 (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: OwwCUVGIGciaJhcJ1wzQRy8PKDGDTekqukspsG7R595aTr4zJsD0JvjdNfGgTN1N98QBSZejOgFQWDdCfEc5jA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB5070 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 Hi, > -----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, Kevin= X > > Subject: [PATCH] net/i40e: fix single VLAN cannot work normal >=20 > After disable QinQ, single VLAN can not work normal. > The reason is that QinQ is not disabled correctly. >=20 > Before configuring QinQ, need to back up and clean MAC/VLAN filters of al= l > ports. After configuring QinQ, restore MAC/VLAN filters of all ports. Whe= n > disable QinQ, need to set valid_flags to 0x0008 and set first_tag to 0x88= a8. >=20 > 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(-) >=20 > 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 related= issues: >=20 > #. 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. >=20 > 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); s= tatic > 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; >=20 > 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; >=20 > @@ -4018,50 +4018,80 @@ i40e_vlan_offload_set(struct rte_eth_dev *dev, in= t > mask) > } >=20 > 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++) { The index here is incorrect. > + 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); > } >=20 > 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); } >=20 > +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; > +} Qinq is double vlan, please use i40e_vsi_config_double_vlan() function for = bug fixing. > + > static int > i40e_update_flow_control(struct i40e_hw *hw) { > -- > 2.34.1