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 91333A0A0E; Thu, 4 Feb 2021 04:23:33 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1BC6D240511; Thu, 4 Feb 2021 04:23:33 +0100 (CET) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id B056D240503 for ; Thu, 4 Feb 2021 04:23:31 +0100 (CET) IronPort-SDR: bKMIygNdYmQFv/QsqyNrXjloArmI+GLPlrQgRcuG2/13x7vMO0stG0albWLWVJA6Zx4ML/VR3x LzXa2YBsnw3A== X-IronPort-AV: E=McAfee;i="6000,8403,9884"; a="168845132" X-IronPort-AV: E=Sophos;i="5.79,400,1602572400"; d="scan'208";a="168845132" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2021 19:23:29 -0800 IronPort-SDR: /3Xhwd6O+CnOxVz//9x8MxOFLvmvGS2DnImggiiaU/30YOweABrvvgOXNh38NVLWulvI7K1Iot oJHnkH6USZnQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,400,1602572400"; d="scan'208";a="371815690" Received: from fmsmsx606.amr.corp.intel.com ([10.18.126.86]) by fmsmga008.fm.intel.com with ESMTP; 03 Feb 2021 19:23:28 -0800 Received: from fmsmsx603.amr.corp.intel.com (10.18.126.83) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Wed, 3 Feb 2021 19:23:28 -0800 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2 via Frontend Transport; Wed, 3 Feb 2021 19:23:28 -0800 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.177) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.1713.5; Wed, 3 Feb 2021 19:23:27 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BoLhWDGuSqveGTY1xcLS2AfScAe7fR5yDx4MjfFvFrdeLRMYx7NfZJWSuLKiQaDabc4t1jNuy0KWKeozsGYzkBIxycHHA55uPLraQYpMkt3kFs7eD5Y7D5cXDsHl6TZ5KkZ4ohFrdz2HLlY7sJqUz83MRXTLhsj7pVOCLhtEiGQx2R0G89z03kmCY9rzwlD58iFwkDQbx8R2xXfi6MApBAautOzOYJL0O3J/SbYojdwPTOvoQKL1R52hHNAnE70ECWrFMRg5mXfTqB+INrYDfI19h1hFvsvv0i4pw2sjoV8sUAyhEcIUjZF2mf9mmVXPcHzbhlxOG2jqEPa0pp2DaQ== 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-SenderADCheck; bh=HVvKR3C/Nwk3vUKlq1OypuQobzwVSLq0VezLRF4ZK2w=; b=c3ZWtlbdZYx8a6KEkt0DWy9VL6Tc6c1BDuk0E0slooXGzHxncwYpBYiOOb79iAtohhzOG26GlXBPhPB8H32pwONX+gdPgoi5jpkeo1SZ69/J89GBBPd6sR09Wwbms/F1gKDgc7cls+BZR74yR4JgmnPYLRSQgLL2lwuh/pQD4bV4tp2UfYm51zkDI5KqZJhZNvXKpne7jIycpAENW1Rn5eD6BEjEjOEHxSN86MNEhtaXZT0dWXUTx+fIjNb4ISIGdcwJRIQH5dv5UYaG0aKsU31JHC1OuRfRdo6UV/3D1CQSBnAw7ZicVvWluRV/1yT5pOXwSm/e3hzSTvpwhLQVtQ== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HVvKR3C/Nwk3vUKlq1OypuQobzwVSLq0VezLRF4ZK2w=; b=Zy2EhV1+39GIAFAbHvt++wD5CnlXWbOKArn9ndUq1vhmsfabfVN/iY4uYhc8gFbhGgSUPFBQB53PiALb/exW4SF6gyzVPZgQisfoO7jfAqlJ9mBnnbKxXtHgY/d4OC1xZ461P4urTjh9kTkH338a4bXvjArEEJY6GIBLk5I4NSM= Received: from BN6PR11MB0017.namprd11.prod.outlook.com (2603:10b6:405:6c::34) by BN6PR11MB1396.namprd11.prod.outlook.com (2603:10b6:404:4a::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3805.17; Thu, 4 Feb 2021 03:23:02 +0000 Received: from BN6PR11MB0017.namprd11.prod.outlook.com ([fe80::f14e:a742:165b:1a84]) by BN6PR11MB0017.namprd11.prod.outlook.com ([fe80::f14e:a742:165b:1a84%4]) with mapi id 15.20.3805.027; Thu, 4 Feb 2021 03:23:02 +0000 From: "Yang, Qiming" To: "Wang, Haiyue" , "dev@dpdk.org" CC: "Zhang, Qi Z" , "Creeley, Brett" Thread-Topic: [PATCH v2] net/ice: fix VLAN strip show in double VLAN mode Thread-Index: AQHW+pxJrAECYSXffEm+OkILgx9MG6pHVL4g Date: Thu, 4 Feb 2021 03:23:01 +0000 Message-ID: References: <20210203140303.65761-1-haiyue.wang@intel.com> <20210204020333.6432-1-haiyue.wang@intel.com> In-Reply-To: <20210204020333.6432-1-haiyue.wang@intel.com> Accept-Language: en-US, zh-CN Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.55.46.36] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: b76cc984-8cbe-49f4-5b00-08d8c8bc2e29 x-ms-traffictypediagnostic: BN6PR11MB1396: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:19; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: fxtu7VU+IPh5fZRp1dThJaIq4e8se6YEcePaDBae0ddvYMNCrrjdQYOpE+p/p6mdavqgyvBOT6hrc5FHyhTMAXRTWU4y7np/1jRmvX+eJn6LfQqcudtMy9bQ9AxzA3C4e+0Q1LBKvmCpjXWfpZE9v31+Ju3LVb6JLSC7ULTGj4CmRUSz8SeSJCMpcB09M+RVFGs+vNJFrjkzWBrdot6T299S57nSCoG3+78wRe2Hrnug0dz//emWuGjL7CohSZptGSyNcwhmVK64YzlHBHnaSIcCfHYecJZ4WIF7THbutscQhuflBmkWM7Wq39lw1uOsZCpvDbpdHkB/Drw5teiMQlD3XpVLDRlYC/4hm4nlQg/n3rfeD24UN/DkFokgXfZafDyRk1f0Kgvo3/0mdJRXNQDE4o0oPOD3I09TKhpOmni1shr07YAc+eduOcioSYNFioqI3qcOVhMLejRXIEG3YLHg8o4Ac2umZKP+SOtnoQJPqT7qxAQkZM3rSpBRAORGqpp19HmYRVlTUTdXTBssjA== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN6PR11MB0017.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(376002)(346002)(39860400002)(396003)(136003)(366004)(6506007)(53546011)(52536014)(2906002)(71200400001)(83380400001)(7696005)(55016002)(9686003)(186003)(30864003)(86362001)(478600001)(54906003)(33656002)(5660300002)(4326008)(8676002)(66446008)(66556008)(107886003)(110136005)(64756008)(66476007)(8936002)(316002)(66946007)(26005)(76116006); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?kqb0j2BiUb09P48TWMhcVPa8y/ML3VwOcbA/BNxX3+Hj2p+Bp50sESA87Qa1?= =?us-ascii?Q?3P6M0KMQNbjewUGsSLL56x9v7PWU4z/oIjgWvFCKJNT9nPaSmlphK49AH3CP?= =?us-ascii?Q?2xOepbxKcWMq7KJ9sCLv3rI2LubLnn0KlZHJvfoKj7CbjNXkXk1LoMqC4HbQ?= =?us-ascii?Q?WIV0jl2urrui5Hbs3e7Y0RaJuhMsV6ytqaI/mIEBoRBL4955ZenivDEYEtIj?= =?us-ascii?Q?y6nBxhT0i41s0qdFH6ByALGqFzb6Tk/83Vh27ZRKn24TeT7rJ3kc90lQCMc2?= =?us-ascii?Q?wZMPDfPWXMii4qu8dACPdKMPo4dfvs6PNAnUeFnEk6QsqTzJ1bpMNnQTQP5F?= =?us-ascii?Q?0B2W7Zscb8H8a+06VFJdP26AZ699k+CYrL7XM2hJNTZxd/8xgIGlOl+MUBXT?= =?us-ascii?Q?Jp+KobH+TUcv/epDpDQq9w4JqeRu+/Wh658vPZs4kkub3eGgLFwiyjZo9kat?= =?us-ascii?Q?ev6R5LHIMLyuuHyoPF++J06tHBaMGVj9qaE4Whm6H0sQNF+ElSJ4JlOCgQMr?= =?us-ascii?Q?QmOV30/HzRPs5Lnzi8GAI5iAns6QZ9E44MikYDwDiKv46ffMBj0arfj3cNi+?= =?us-ascii?Q?njYxhNBaYh4lCYpakM0PrlbqKcr8O7sMERmB2vFnYbVtKtWR6RGW1lruJAO9?= =?us-ascii?Q?w2g5oF9i814EI5IwKJ2JWGT6B8T4bPe3DFtlXctFZf+qwaY8r9XsJp7yEXZB?= =?us-ascii?Q?vSGucsThpMmF6Ccl1X7020LHR5u4EavTEsx/IbqeRuiWfqG6mMqkTmzKG6tc?= =?us-ascii?Q?IyftcB4N/FI+UimPZ1XQpTlRjwVWBfh6qVUSfHoMYjgbVWyWRuIP8DWghqVR?= =?us-ascii?Q?UDzrZ6pe0FUQ0YiYDf1+ChtO5P+enHZZO2c7io1g2yiIHdxDDLVT4p+b8bYC?= =?us-ascii?Q?M07VQ9N4DQoHuMJYRNZAehPB47NVKxXRLKgEbq4FpvXofczNpZN0F36SB9VM?= =?us-ascii?Q?dNia9767D6+AkhIeCygeuGqKDzU1LA9BpW9s5/PAtYNAootTBsfd0fkVE6Kx?= =?us-ascii?Q?pQ2XMwFUyEAZL6560jI4Q9WdwieEXVLd49cmA18l7tFY1/z7x5LKzXdeEBaG?= =?us-ascii?Q?mozmI1Ko?= 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: BN6PR11MB0017.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b76cc984-8cbe-49f4-5b00-08d8c8bc2e29 X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Feb 2021 03:23:01.2062 (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: FKBRIRFj5Rv1iqyh4guZ+QUYjJhqmrPsjYUOKNm5kjA3/Lq0Ica660f/Hwr4WzVNnDi9RxHvzjukvFFZc1ol4g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR11MB1396 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v2] net/ice: fix VLAN strip show in double VLAN mode 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 Sender: "dev" Acked-by: Qiming Yang > -----Original Message----- > From: Wang, Haiyue > Sent: Thursday, February 4, 2021 10:04 > To: dev@dpdk.org > Cc: Yang, Qiming ; Zhang, Qi Z > ; Wang, Haiyue ; Creeley, > Brett > Subject: [PATCH v2] net/ice: fix VLAN strip show in double VLAN mode >=20 > In double VLAN mode, the VLAN strip is applied on outer, since the VLAN f= ilter > is outer; in single VLAN mode, the VLAN strip is applied on inner for the= VLAN > filter is inner. >=20 > So it needs to adjust the strip setting according to current VLAN mode. >=20 > Fixes: 14e7a4b37b4f ("net/ice/base: support configuring device in double = VLAN > mode") >=20 > Signed-off-by: Haiyue Wang > --- > v2: Add the missed fix tag, and update the commit message. > --- > drivers/net/ice/ice_ethdev.c | 297 +++++++++++++++-------------------- > 1 file changed, 131 insertions(+), 166 deletions(-) >=20 > diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c = index > 02a25e8d2a..cb2c0cf449 100644 > --- a/drivers/net/ice/ice_ethdev.c > +++ b/drivers/net/ice/ice_ethdev.c > @@ -68,8 +68,6 @@ static struct proto_xtr_ol_flag > ice_proto_xtr_ol_flag_params[] =3D { > .ol_flag =3D &rte_net_ice_dynflag_proto_xtr_ip_offset_mask }, }; >=20 > -#define ICE_DFLT_OUTER_TAG_TYPE ICE_AQ_VSI_OUTER_TAG_VLAN_9100 > - > #define ICE_OS_DEFAULT_PKG_NAME "ICE OS Default Package" > #define ICE_COMMS_PKG_NAME "ICE COMMS > Package" > #define ICE_MAX_RES_DESC_NUM 1024 > @@ -1122,127 +1120,6 @@ ice_remove_all_mac_vlan_filters(struct ice_vsi > *vsi) > return ret; > } >=20 > -static int > -ice_vsi_config_qinq_insertion(struct ice_vsi *vsi, bool on) -{ > - struct ice_hw *hw =3D ICE_VSI_TO_HW(vsi); > - struct ice_vsi_ctx ctxt; > - uint8_t qinq_flags; > - int ret =3D 0; > - > - /* Check if it has been already on or off */ > - if (vsi->info.valid_sections & > - rte_cpu_to_le_16(ICE_AQ_VSI_PROP_OUTER_TAG_VALID)) { > - if (on) { > - if ((vsi->info.outer_vlan_flags & > - > ICE_AQ_VSI_OUTER_VLAN_PORT_BASED_ACCEPT_HOST) =3D=3D > - > ICE_AQ_VSI_OUTER_VLAN_PORT_BASED_ACCEPT_HOST) > - return 0; /* already on */ > - } else { > - if (!(vsi->info.outer_vlan_flags & > - > ICE_AQ_VSI_OUTER_VLAN_PORT_BASED_ACCEPT_HOST)) > - return 0; /* already off */ > - } > - } > - > - if (on) > - qinq_flags =3D > ICE_AQ_VSI_OUTER_VLAN_PORT_BASED_ACCEPT_HOST; > - else > - qinq_flags =3D 0; > - /* clear global insertion and use per packet insertion */ > - vsi->info.outer_vlan_flags &=3D > ~(ICE_AQ_VSI_OUTER_VLAN_PORT_BASED_INSERT); > - vsi->info.outer_vlan_flags &=3D > ~(ICE_AQ_VSI_OUTER_VLAN_PORT_BASED_ACCEPT_HOST); > - vsi->info.outer_vlan_flags |=3D qinq_flags; > - /* use default vlan type 0x8100 */ > - vsi->info.outer_vlan_flags &=3D ~(ICE_AQ_VSI_OUTER_TAG_TYPE_M); > - vsi->info.outer_vlan_flags |=3D ICE_DFLT_OUTER_TAG_TYPE << > - ICE_AQ_VSI_OUTER_TAG_TYPE_S; > - (void)rte_memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info)); > - ctxt.info.valid_sections =3D > - > rte_cpu_to_le_16(ICE_AQ_VSI_PROP_OUTER_TAG_VALID); > - ctxt.vsi_num =3D vsi->vsi_id; > - ret =3D ice_update_vsi(hw, vsi->idx, &ctxt, NULL); > - if (ret) { > - PMD_DRV_LOG(INFO, > - "Update VSI failed to %s qinq stripping", > - on ? "enable" : "disable"); > - return -EINVAL; > - } > - > - vsi->info.valid_sections |=3D > - rte_cpu_to_le_16(ICE_AQ_VSI_PROP_OUTER_TAG_VALID); > - > - return ret; > -} > - > -static int > -ice_vsi_config_qinq_stripping(struct ice_vsi *vsi, bool on) -{ > - struct ice_hw *hw =3D ICE_VSI_TO_HW(vsi); > - struct ice_vsi_ctx ctxt; > - uint8_t qinq_flags; > - int ret =3D 0; > - > - /* Check if it has been already on or off */ > - if (vsi->info.valid_sections & > - rte_cpu_to_le_16(ICE_AQ_VSI_PROP_OUTER_TAG_VALID)) { > - if (on) { > - if ((vsi->info.outer_vlan_flags & > - ICE_AQ_VSI_OUTER_VLAN_EMODE_M) =3D=3D > - ICE_AQ_VSI_OUTER_VLAN_EMODE_SHOW) > - return 0; /* already on */ > - } else { > - if ((vsi->info.outer_vlan_flags & > - ICE_AQ_VSI_OUTER_VLAN_EMODE_M) =3D=3D > - ICE_AQ_VSI_OUTER_VLAN_EMODE_SHOW_BOTH) > - return 0; /* already off */ > - } > - } > - > - if (on) > - qinq_flags =3D ICE_AQ_VSI_OUTER_VLAN_EMODE_SHOW; > - else > - qinq_flags =3D > ICE_AQ_VSI_OUTER_VLAN_EMODE_SHOW_BOTH; > - vsi->info.outer_vlan_flags &=3D > ~(ICE_AQ_VSI_OUTER_VLAN_EMODE_M); > - vsi->info.outer_vlan_flags |=3D qinq_flags; > - /* use default vlan type 0x8100 */ > - vsi->info.outer_vlan_flags &=3D ~(ICE_AQ_VSI_OUTER_TAG_TYPE_M); > - vsi->info.outer_vlan_flags |=3D ICE_DFLT_OUTER_TAG_TYPE << > - ICE_AQ_VSI_OUTER_TAG_TYPE_S; > - (void)rte_memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info)); > - ctxt.info.valid_sections =3D > - > rte_cpu_to_le_16(ICE_AQ_VSI_PROP_OUTER_TAG_VALID); > - ctxt.vsi_num =3D vsi->vsi_id; > - ret =3D ice_update_vsi(hw, vsi->idx, &ctxt, NULL); > - if (ret) { > - PMD_DRV_LOG(INFO, > - "Update VSI failed to %s qinq stripping", > - on ? "enable" : "disable"); > - return -EINVAL; > - } > - > - vsi->info.valid_sections |=3D > - rte_cpu_to_le_16(ICE_AQ_VSI_PROP_OUTER_TAG_VALID); > - > - return ret; > -} > - > -static int > -ice_vsi_config_double_vlan(struct ice_vsi *vsi, int on) -{ > - int ret; > - > - ret =3D ice_vsi_config_qinq_stripping(vsi, on); > - if (ret) > - PMD_DRV_LOG(ERR, "Fail to set qinq stripping - %d", ret); > - > - ret =3D ice_vsi_config_qinq_insertion(vsi, on); > - if (ret) > - PMD_DRV_LOG(ERR, "Fail to set qinq insertion - %d", ret); > - > - return ret; > -} > - > /* Enable IRQ0 */ > static void > ice_pf_enable_irq0(struct ice_hw *hw) > @@ -2220,9 +2097,6 @@ ice_dev_init(struct rte_eth_dev *dev) >=20 > vsi =3D pf->main_vsi; >=20 > - /* Disable double vlan by default */ > - ice_vsi_config_double_vlan(vsi, false); > - > ret =3D ice_aq_stop_lldp(hw, true, false, NULL); > if (ret !=3D ICE_SUCCESS) > PMD_INIT_LOG(DEBUG, "lldp has already stopped\n"); @@ - > 4086,49 +3960,147 @@ ice_vsi_config_vlan_filter(struct ice_vsi *vsi, bool= on) > return 0; > } >=20 > +/* Manage VLAN stripping for the VSI for Rx */ > static int > -ice_vsi_config_vlan_stripping(struct ice_vsi *vsi, bool on) > +ice_vsi_manage_vlan_stripping(struct ice_vsi *vsi, bool ena) > { > struct ice_hw *hw =3D ICE_VSI_TO_HW(vsi); > struct ice_vsi_ctx ctxt; > - uint8_t vlan_flags; > - int ret =3D 0; > + enum ice_status status; > + int err =3D 0; >=20 > - /* Check if it has been already on or off */ > - if (vsi->info.valid_sections & > - rte_cpu_to_le_16(ICE_AQ_VSI_PROP_VLAN_VALID)) { > - if (on) { > - if ((vsi->info.inner_vlan_flags & > - ICE_AQ_VSI_INNER_VLAN_EMODE_M) =3D=3D > - ICE_AQ_VSI_INNER_VLAN_EMODE_STR_BOTH) > - return 0; /* already on */ > - } else { > - if ((vsi->info.inner_vlan_flags & > - ICE_AQ_VSI_INNER_VLAN_EMODE_M) =3D=3D > - ICE_AQ_VSI_INNER_VLAN_EMODE_NOTHING) > - return 0; /* already off */ > - } > - } > + /* do not allow modifying VLAN stripping when a port VLAN is > configured > + * on this VSI > + */ > + if (vsi->info.port_based_inner_vlan) > + return 0; >=20 > - if (on) > - vlan_flags =3D ICE_AQ_VSI_INNER_VLAN_EMODE_STR_BOTH; > + memset(&ctxt, 0, sizeof(ctxt)); > + > + if (ena) > + /* Strip VLAN tag from Rx packet and put it in the desc */ > + ctxt.info.inner_vlan_flags =3D > + > ICE_AQ_VSI_INNER_VLAN_EMODE_STR_BOTH; > else > - vlan_flags =3D ICE_AQ_VSI_INNER_VLAN_EMODE_NOTHING; > - vsi->info.inner_vlan_flags &=3D ~(ICE_AQ_VSI_INNER_VLAN_EMODE_M); > - vsi->info.inner_vlan_flags |=3D vlan_flags; > - (void)rte_memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info)); > + /* Disable stripping. Leave tag in packet */ > + ctxt.info.inner_vlan_flags =3D > + > ICE_AQ_VSI_INNER_VLAN_EMODE_NOTHING; > + > + /* Allow all packets untagged/tagged */ > + ctxt.info.inner_vlan_flags |=3D > ICE_AQ_VSI_INNER_VLAN_TX_MODE_ALL; > + > + ctxt.info.valid_sections =3D > +rte_cpu_to_le_16(ICE_AQ_VSI_PROP_VLAN_VALID); > + > + status =3D ice_update_vsi(hw, vsi->idx, &ctxt, NULL); > + if (status) { > + PMD_DRV_LOG(ERR, "Update VSI failed to %s vlan stripping", > + ena ? "enable" : "disable"); > + err =3D -EIO; > + } else { > + vsi->info.inner_vlan_flags =3D ctxt.info.inner_vlan_flags; > + } > + > + return err; > +} > + > +static int > +ice_vsi_ena_inner_stripping(struct ice_vsi *vsi) { > + return ice_vsi_manage_vlan_stripping(vsi, true); } > + > +static int > +ice_vsi_dis_inner_stripping(struct ice_vsi *vsi) { > + return ice_vsi_manage_vlan_stripping(vsi, false); } > + > +static int ice_vsi_ena_outer_stripping(struct ice_vsi *vsi) { > + struct ice_hw *hw =3D ICE_VSI_TO_HW(vsi); > + struct ice_vsi_ctx ctxt; > + enum ice_status status; > + int err =3D 0; > + > + /* do not allow modifying VLAN stripping when a port VLAN is > configured > + * on this VSI > + */ > + if (vsi->info.port_based_outer_vlan) > + return 0; > + > + memset(&ctxt, 0, sizeof(ctxt)); > + > ctxt.info.valid_sections =3D > - rte_cpu_to_le_16(ICE_AQ_VSI_PROP_VLAN_VALID); > - ctxt.vsi_num =3D vsi->vsi_id; > - ret =3D ice_update_vsi(hw, vsi->idx, &ctxt, NULL); > - if (ret) { > - PMD_DRV_LOG(INFO, "Update VSI failed to %s vlan stripping", > - on ? "enable" : "disable"); > - return -EINVAL; > + rte_cpu_to_le_16(ICE_AQ_VSI_PROP_OUTER_TAG_VALID); > + /* clear current outer VLAN strip settings */ > + ctxt.info.outer_vlan_flags =3D vsi->info.outer_vlan_flags & > + ~(ICE_AQ_VSI_OUTER_VLAN_EMODE_M | > ICE_AQ_VSI_OUTER_TAG_TYPE_M); > + ctxt.info.outer_vlan_flags |=3D > + (ICE_AQ_VSI_OUTER_VLAN_EMODE_SHOW_BOTH << > + ICE_AQ_VSI_OUTER_VLAN_EMODE_S) | > + (ICE_AQ_VSI_OUTER_TAG_VLAN_8100 << > + ICE_AQ_VSI_OUTER_TAG_TYPE_S); > + > + status =3D ice_update_vsi(hw, vsi->idx, &ctxt, NULL); > + if (status) { > + PMD_DRV_LOG(ERR, "Update VSI failed to enable outer VLAN > stripping"); > + err =3D -EIO; > + } else { > + vsi->info.outer_vlan_flags =3D ctxt.info.outer_vlan_flags; > } >=20 > - vsi->info.valid_sections |=3D > - rte_cpu_to_le_16(ICE_AQ_VSI_PROP_VLAN_VALID); > + return err; > +} > + > +static int > +ice_vsi_dis_outer_stripping(struct ice_vsi *vsi) { > + struct ice_hw *hw =3D ICE_VSI_TO_HW(vsi); > + struct ice_vsi_ctx ctxt; > + enum ice_status status; > + int err =3D 0; > + > + if (vsi->info.port_based_outer_vlan) > + return 0; > + > + memset(&ctxt, 0, sizeof(ctxt)); > + > + ctxt.info.valid_sections =3D > + rte_cpu_to_le_16(ICE_AQ_VSI_PROP_OUTER_TAG_VALID); > + /* clear current outer VLAN strip settings */ > + ctxt.info.outer_vlan_flags =3D vsi->info.outer_vlan_flags & > + ~ICE_AQ_VSI_OUTER_VLAN_EMODE_M; > + ctxt.info.outer_vlan_flags |=3D > ICE_AQ_VSI_OUTER_VLAN_EMODE_NOTHING << > + ICE_AQ_VSI_OUTER_VLAN_EMODE_S; > + > + status =3D ice_update_vsi(hw, vsi->idx, &ctxt, NULL); > + if (status) { > + PMD_DRV_LOG(ERR, "Update VSI failed to disable outer VLAN > stripping"); > + err =3D -EIO; > + } else { > + vsi->info.outer_vlan_flags =3D ctxt.info.outer_vlan_flags; > + } > + > + return err; > +} > + > +static int > +ice_vsi_config_vlan_stripping(struct ice_vsi *vsi, bool ena) { > + struct ice_hw *hw =3D ICE_VSI_TO_HW(vsi); > + int ret; > + > + if (ice_is_dvm_ena(hw)) { > + if (ena) > + ret =3D ice_vsi_ena_outer_stripping(vsi); > + else > + ret =3D ice_vsi_dis_outer_stripping(vsi); > + } else { > + if (ena) > + ret =3D ice_vsi_ena_inner_stripping(vsi); > + else > + ret =3D ice_vsi_dis_inner_stripping(vsi); > + } >=20 > return ret; > } > @@ -4155,13 +4127,6 @@ ice_vlan_offload_set(struct rte_eth_dev *dev, int > mask) > ice_vsi_config_vlan_stripping(vsi, false); > } >=20 > - if (mask & ETH_VLAN_EXTEND_MASK) { > - if (rxmode->offloads & DEV_RX_OFFLOAD_VLAN_EXTEND) > - ice_vsi_config_double_vlan(vsi, true); > - else > - ice_vsi_config_double_vlan(vsi, false); > - } > - > return 0; > } >=20 > -- > 2.30.0