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 4BD74A054A; Wed, 7 Sep 2022 08:45:21 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DBBC3400D6; Wed, 7 Sep 2022 08:45:20 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id CBB1440042 for ; Wed, 7 Sep 2022 08:45:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662533118; x=1694069118; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=JNlrq3n6BcIw44SpRLSBIKMH+7AAuk7cybwQZYJTSe0=; b=jOkZhf8oq9nRPSOVYmGQ5xcqrYw0aGO+E77Qng1MxnAeW4GLbUp01+X+ 7mExBLuxCFJPWkdNtvne7B0E92Ld98mZBTOlr82f0qj0wzPm5jnyvWSRf MHbiXuYJvK6WG0yUuV6xj72W+5yeg3ZlVNJ7IFRFPhGEhefPV9sOZPum+ 5PS0ubnTaeLsgLDItCF44B/dszixnjHUNLW4G1Lrp2dg6g9roAfSXJ1yw VQ8bWdjqSnG4I09GqrAy+gZHCmyopEJR7GDmDh2XNi9m17q6CTtAs9gym AemF8gW+rz6f4l2r85DXRS0cDzcZJDp0zeoAjmzzdDrQXTs51NYVTaNmH Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10462"; a="296795560" X-IronPort-AV: E=Sophos;i="5.93,296,1654585200"; d="scan'208";a="296795560" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Sep 2022 23:45:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,295,1654585200"; d="scan'208";a="676044542" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by fmsmga008.fm.intel.com with ESMTP; 06 Sep 2022 23:45:16 -0700 Received: from orsmsx607.amr.corp.intel.com (10.22.229.20) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 6 Sep 2022 23:45:16 -0700 Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) by ORSMSX607.amr.corp.intel.com (10.22.229.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 6 Sep 2022 23:45:15 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31 via Frontend Transport; Tue, 6 Sep 2022 23:45:15 -0700 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (104.47.51.40) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.31; Tue, 6 Sep 2022 23:45:15 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MbiAk1gdDK/h8CAMmK41OznLvQdLy0vV+1OTTF1iK4GetLBil8yhNTKAs7QYaEavR+RuvPtvKd8EOCfCi7TIfNNOhUyP1HJt7ir/RnKqp995n4TzbP9fPoNorfV30JHU+ayItCbYMRUHCGVLZ1KbvKMX/LoM6n373oFLLVipCmcSGfmk1fRrEjwVsxzZSRFIrWXlZwo9y5POYa2iURNpmGbNVW5ZDijcjAC1WpsehvmyjYQRlISbdAofyFXASVrfVKnTw+04V5XWct1gKzpIv9VsbxLW/eKUMzVfU+373I+y3r1HEoIyAg3ycrfY3L9yQOwW6r7onrbcosuJPojhBg== 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=zdsORMrwAeVNAtbK3acIDuq3HSu9PuIW/xG3YWvxzmw=; b=QJ0P+fxSkSuYITMtE8+8rjLrBP4yR14uD3goSAESa/funVkeRBDv7dKOh3vZl25unYWm2FN2KxYuDwLWF5XjnZSw+YaZ7nIqyP3WOga6cJ+xImd1E2F9zC4WFb/WQZ02KZOmVCYieF+0EtAgxOpet5ogQAg88rn+V5EjIW4I5Lkdf+OGy7mbbSlgwhbrvDOAxtHnpUR/xfnvfPa/NdaVuYNlOYtYoCeKvuKlKRqz9Ztbh0dOeOPZnY1GWBuv55O09ipyznZelkwUViIewy0Pn60gScJe1WNyYS2GIDlfasFbfeR+Lcyz/GQkjfYbkMLdWjuCQw+XJ6rLe288T+wENw== 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 DM4PR11MB6043.namprd11.prod.outlook.com (2603:10b6:8:62::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.17; Wed, 7 Sep 2022 06:44:59 +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; Wed, 7 Sep 2022 06:44:59 +0000 From: "Zhang, Yuying" To: "Liu, KevinX" , "dev@dpdk.org" CC: "Xing, Beilei" , "Yang, SteveX" , "Jiale, SongX" Subject: RE: [PATCH v3] net/i40e: fix single VLAN cannot work normal Thread-Topic: [PATCH v3] net/i40e: fix single VLAN cannot work normal Thread-Index: AQHYwckYPKSjo4m6IUWaaqSsQFpI2a3ThcxQ Date: Wed, 7 Sep 2022 06:44:59 +0000 Message-ID: References: <20220818160351.1353003-1-kevinx.liu@intel.com> <20220906161508.8194-1-kevinx.liu@intel.com> In-Reply-To: <20220906161508.8194-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: 5f322242-5933-4451-81b2-08da909c7bad x-ms-traffictypediagnostic: DM4PR11MB6043:EE_ x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: PeHgQ5VuthUctS+NOwiOIl1wzGeh01BiMPEv4AuvXrECpGVxP80SFTXkxAvWOfKY5nPiBiouiMnQTq2ZVfS2IrCZvlDBMKn7pxzoilc/DQ6PB8o3J7M+jylAp7ntjAnwJA9+pnaPRMNEz5t9ymCjTb8idl/aM7+68JusY1uIGaNXpC1klN4V953tziXZMWrSIvb3wfeMzI58Aw4WjIMVxHfdPxak2IzoNTsCg8cgX709j4cPnnPiq77EzjuHjhsPR3snK87A70qNaerqf9sVYfdZgXIYGOvjw+O38w7NbLZ1QnDX2TzJD5bu+xwyKwTKFgXqC7WFl0gxSuYiyWkNbPx9Zp7TtUPcoHQV1ZjQZKvg2icZiJsKurXt+elNq6PC7rPJ8661pIUTejXMjXbCu9bT2eXjDotAGLT2khwXh1Zf9xMnaVLRTwgD/R9BzKHJkcvhVWMROozGJq1cmt0FdXuatPzrRWlwD1r8fR8n5Z6Dk2A2BlPQmgmH4LgltPpT1Z9QSFlnjeai0CaTrLmymBIN/4Qv526boCiG+zxALpuF0zsSysCrx3nRUQ9AV4mdjc6LnYF1M4NF07etaA8o9WzkYmQqBC6KpvJMS1+GiSrdfvHVE8lykwLgUIGJq5gmFfKncf++E4nzYY+CP96CoeoxcIxTXCxDTO4SggNvXqQEkHvn8PZOqSDR/OltxDxCVbsfcBYz/ejDDjetODZZ2YyVfXMG18oo9WO49FObnO3lj2KaV+HThoW1Kmq+a+Q69plpKcugVHFmUrAp/XBh0g== 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)(39860400002)(136003)(346002)(396003)(376002)(366004)(38100700002)(2906002)(52536014)(26005)(53546011)(9686003)(5660300002)(186003)(8936002)(33656002)(107886003)(41300700001)(86362001)(478600001)(6506007)(7696005)(71200400001)(110136005)(82960400001)(38070700005)(76116006)(316002)(66946007)(64756008)(8676002)(54906003)(66556008)(66446008)(4326008)(83380400001)(55016003)(66476007)(122000001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?hGUmpB/B1YIB30HMElw6TFuaUh4zIIA25D2orYBuo81qVPufMevHSQwyxCMx?= =?us-ascii?Q?W/7NLR9JKXkckYJYpBWbH4G4dnG9YJG5xPcJAJjEP2oybzffjUW6BdkUIntP?= =?us-ascii?Q?JJMXVk4JUbmOcRrkZ3Aic3hZLo2eC4xQ6SNJdEAZ4B6AeaIQSQ/5fcDbeQ4j?= =?us-ascii?Q?r/hHDZr2IdNRJtmLJXcl1+mL0JU46uYIzVGUmr1RAqO4sRlNrvbToxJUj3el?= =?us-ascii?Q?+kcG5H1VNLWJAv2zDLACGE+b4M57TeumSxuTpBUr5cnwrHbojpOZF6k3Fn54?= =?us-ascii?Q?+HTTIsuW33a7UJ4HfzxcinKbMqnaCZcourrEbxsj5hcMA2s89oSJZSFLFn13?= =?us-ascii?Q?bxqeGNso0EwJZMvKDToHD97q7ACUDkhSh/PkMfGs3WG1dnxTOAD662Fj2xQP?= =?us-ascii?Q?rkZxFtaI50xj0In2zr7IeI+944DJOGCvVbVeIizt/j9iyZRCYQ1Ru4kCOXjO?= =?us-ascii?Q?xtjkW3JNlaTTXww/57S8V8A/lTSdFj01JYWYk1Sh2f7lgupFSWrdhdzwoEjd?= =?us-ascii?Q?LTUrApZJCoCNAioR3XR1vonQm1QaCcwl/IP8s82YZgsMGvRYyCYLHFQq9yBQ?= =?us-ascii?Q?tgKlaXNPvRv0aES0wEDC14tmTWR8NzSMU+1u2rIdp1FHPwFJo5QVQQgJFcGf?= =?us-ascii?Q?fl32OwvmrxOCdjXkmMMz1dTy/TBeuoAaXtHVRopjPWO+j9wvBWedcciGhgfi?= =?us-ascii?Q?KlTgkbc1b8M/Q2+1pdks+gDYwyZK7j1YRJvvh9MSMHqvS/JIiMnVWKDb4tyl?= =?us-ascii?Q?Ue7qidFncbk5w3dztvPfkwlAbL4I6tnDYLSLIGvyVUBSv+H2qY5lrMXU26p3?= =?us-ascii?Q?nlpuBvY+FB8dSdRjoj8WzMnnSRm5TPiEoZYC2+Ay06gLUGPPyU50IV57BvLR?= =?us-ascii?Q?6aCVzsRCkEdIQlZOQACVSrBDgSYJ7QhlEwn+WEr8/9jbfPgBKJmWMCmOd+BZ?= =?us-ascii?Q?8jaC71D3OeTqRuSzITC+/jWgB4PYolqztkjDonQB+kDvib8y46bfTiiKJ1wP?= =?us-ascii?Q?cxrguEvDHBHNxXqBLvdp+sG2+jzBr9KSztIG9lkXia30GSqD40/aag5wX/c3?= =?us-ascii?Q?mS3VD/YdY3pvPAODHLv3NSC6jjrUTHAI/5D9QWZ7Rkz1ePM1lFdIa133LwND?= =?us-ascii?Q?FpOII5pqe8JiKO/CT8LkSrpw+8LOxMIkBo5fdzX9fKEKzOqV2mVxcZ/g7SU7?= =?us-ascii?Q?Gv0t8m3KqwWH+H1LOWNjmrUKZI+V3zArDYGpy8w21DJoReg1vU2oZEOhONMQ?= =?us-ascii?Q?H5jyulwKT+RKzGU17GWPmLbhfAP2d8kpNMrfmzMEj/qxKdxstQ7Vx2UI2+KG?= =?us-ascii?Q?djzXk6FbFQJa2CWTFn6G9YkP1kMZW6Py/fmESnIop4m83kzadGuax3AZBPna?= =?us-ascii?Q?TPM7npu1qi+u1XREubpgWcHav0Uuof2foygV+U/5xmS4dqBRR/jKwqKie206?= =?us-ascii?Q?AioqNxeAaNOJffQhIVQ7lEhDfnWeIW8VEY6+5OAlrqD6OHoFrPbfoPWiMShH?= =?us-ascii?Q?fyamh00u68e2I9hTbvQxRdgWW2uNvLm+cTLF5vwh9sQFF3qeDkEKq/z197hA?= =?us-ascii?Q?xHT8C8eHOPexGs3fNVA0lQY8LvsdwJ+6sxTnnoxZ?= 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: 5f322242-5933-4451-81b2-08da909c7bad X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Sep 2022 06:44:59.0456 (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: pCTOccm6BA/6G5Lj4V6Mby6AmNDwJkNnsgyj4NCtjgWSCoH2gKuD/ME0LdqOIq5E4XUA4GeowB2vtl7nKaIcWw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR11MB6043 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: Wednesday, September 7, 2022 12:15 AM > To: dev@dpdk.org > Cc: Zhang, Yuying ; Xing, Beilei > ; Yang, SteveX ; Liu, Kevin= X > ; Jiale, SongX > Subject: [PATCH v3] 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. Please correct grammar error of commit log and change numbers to macro defi= nition for readability. >=20 > Fixes: 38e9762be16a ("net/i40e: add outer VLAN processing") > Signed-off-by: Kevin Liu > Tested-by: Jiale Song Make sure new version has been validated before adding "tested-by". > --- > v2: refine code > --- > v3: refine code > --- > doc/guides/nics/i40e.rst | 1 - > drivers/net/i40e/i40e_ethdev.c | 147 ++++++++++++++++++++++----------- > 2 files changed, 100 insertions(+), 48 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..cf327ed576 100644 > --- a/drivers/net/i40e/i40e_ethdev.c > +++ b/drivers/net/i40e/i40e_ethdev.c > @@ -1650,7 +1650,8 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void > *init_params __rte_unused) > vsi =3D pf->main_vsi; >=20 > /* Disable double vlan by default */ > - i40e_vsi_config_double_vlan(vsi, FALSE); > + if (!pf->fw8_3gt) > + i40e_vsi_config_double_vlan(vsi, FALSE); Disable double vlan by default no matter the firmware is. >=20 > /* Disable S-TAG identification when floating_veb is disabled */ > if (!pf->floating_veb) { > @@ -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,75 @@ 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[port_num] =3D mac_filter; > + vvsi[port_num] =3D tmp_vsi; > + vnum[port_num] =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) { > + /* 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."); > + /*restore mac/vlan filters of all ports*/ > + for (j =3D 0; j < port_num; j++) { > + 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) { > @@ -6177,8 +6202,36 @@ static int > i40e_vsi_config_double_vlan(struct i40e_vsi *vsi, int on) { > struct i40e_hw *hw =3D I40E_VSI_TO_HW(vsi); > + struct i40e_pf *pf =3D I40E_VSI_TO_PF(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; > + } >=20 > - return i40e_aq_set_port_parameters(hw, vsi->seid, 0, 1, on, NULL); > + if (pf->fw8_3gt) { > + 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 ret; > } >=20 > static int > -- > 2.34.1