From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0076.outbound.protection.outlook.com [104.47.34.76]) by dpdk.org (Postfix) with ESMTP id 59788108F for ; Fri, 1 Sep 2017 09:41:31 +0200 (CEST) Received: from BN3PR03CA0096.namprd03.prod.outlook.com (10.174.66.14) by CY1PR03MB2265.namprd03.prod.outlook.com (10.166.207.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.13.10; Fri, 1 Sep 2017 07:41:29 +0000 Received: from BN1BFFO11FD002.protection.gbl (2a01:111:f400:7c10::1:173) by BN3PR03CA0096.outlook.office365.com (2603:10b6:400:4::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.13.10 via Frontend Transport; Fri, 1 Sep 2017 07:41:28 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; cisco.com; dkim=none (message not signed) header.d=none;cisco.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1BFFO11FD002.mail.protection.outlook.com (10.58.144.65) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1385.11 via Frontend Transport; Fri, 1 Sep 2017 07:41:28 +0000 Received: from [10.232.133.65] ([10.232.133.65]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v817fJCO005454; Fri, 1 Sep 2017 00:41:20 -0700 To: David Harton , , , , , , , , , , , , , , , , , References: <20170825134717.18376-1-dharton@cisco.com> <20170901023628.21308-1-dharton@cisco.com> CC: From: Hemant Agrawal Message-ID: Date: Fri, 1 Sep 2017 13:11:19 +0530 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20170901023628.21308-1-dharton@cisco.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 X-Matching-Connectors: 131487252887852323; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(336005)(39380400002)(39860400002)(2980300002)(1109001)(1110001)(339900001)(199003)(377454003)(24454002)(189002)(104016004)(4001350100001)(97736004)(36756003)(2950100002)(68736007)(53946003)(229853002)(23746002)(53936002)(64126003)(5660300001)(6246003)(65806001)(65826007)(31696002)(39060400002)(65956001)(4326008)(47776003)(31686004)(7416002)(2201001)(86362001)(85426001)(575784001)(83506001)(305945005)(33646002)(105606002)(106466001)(189998001)(356003)(626005)(50466002)(498600001)(54356999)(50986999)(2906002)(81166006)(81156014)(77096006)(8936002)(8676002)(53546010)(76176999)(230700001)(118844002)(921003)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR03MB2265; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD002; 1:FS3xddgHWsd/RC2DDG+WB3+fWuFgOemCIqkIYf5kbEXVj1KdVz1uA+CYe7ekHbD35hk9b59+6SUzD7SumI2Dj4dGos0OXTyocdetyvtRHiYOyUM4yzZpDoCkeGZTWdG8 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0470013d-0636-44de-f3c3-08d4f10cdb53 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(300000503095)(300135400095)(2017052603199)(201703131430075)(201703131517081)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:CY1PR03MB2265; X-Microsoft-Exchange-Diagnostics: 1; CY1PR03MB2265; 3:ytVRXxAvdJYPduj8FF71QT0OyvletkufcZQMDCL4Ome6ujkn8bb6j7OKsvn57Wj5rfIX0woOCXaAKpc/8DG77KJvx5c6o9IFXYrTeTXfCcdgkw8dsIIsVSb2W9mFLWLD9J3a6JBanUdTqGEcsn6IbfpPKStBLnsKTbzaaCncplgj0BJREqTti0sDespCCiveT0phdPiIhcUF3nqwrWh86/G49VqDYbZDA2oRa2XXUi6b2lY/ko7LmDBB2a22X+eLBPHFiUtFS94sBBoupq+ylfECBJRuiyP9aSPn4qozrc1bVsnXQEgeNqiB0ybNO5ZyQQQ0RQhwNtVJPpzHeGjt0e3iy04Imu6OiudNCeX8Co4=; 25:dsSEtoyK3rTcLkyWQu4p5l3lvr7IZS86DY556X9yiA1EhIX/ANAxsQ/syk051JA5czKGrgsjP5e2tZdBIhHHa2H8QRFe5/VdzzZj6wyGxCIuXGui33NS8W+VvVniLcXnWnNKTSaWqiY8mKrJcCPfhxN9aQi71bp4zUGKMKBv136lunF5XPxGeB3kqL4HPX1cWkUcc5TtUPxoIeNUIrbl3VylJOtv1vek7HMVBtkGMUODZDFy1aMfxDZYrIMNl6kZGko2ncojSZNe+TYIkpgjNmfj2iZ1/RN1PU658cvGv71JyUKOSzdpWaauhBrtyr7G51pBXusGcTjTYzeTUtbYbg== X-MS-TrafficTypeDiagnostic: CY1PR03MB2265: X-Microsoft-Exchange-Diagnostics: 1; CY1PR03MB2265; 31:wwJR6GOiM2L1YQP47h/v6XvOLt9D+gsT66AYtLwpqC1TyghCiMm26dAFTUgUo51ujmnK/ceI9kA/jlFBfXrR2e+yufv9FoSs2aS3yG3VgEOhHZD+aDh+AYTMvDeLG5z/w4i9BeczvY/E3wAxmfNWei4vfTksqzc3/0lLJFVJ2/cgqsOuXuzf1b68ZQDhQaXb+eAbhOAxFqCHrT+qDBwAhc8331wxT1SMpIMgZmTLazw=; 4:2hLIkeyUkPGwkoC6PFuT+6MNASzk25Y/9xHWtAypKb0UHRq9tXTRXz6Wo9BIHMza41d/ks/79GlTNZQxv7f2Bbb+R6uOk7KzjRn+Gs5Ac2WjzDNl68D2HDDeMa/a98X+RZkPXgc63mQcglnLFzabw6/uwYwPHeHD7khX5mibCmq4JS/V31rDV+3rVXCdUUwwk1XrNSJHxuKARkv2rvKkUr7M9dDY1UR27dabVhCXIlWsSFIATbFHQrnI9Xn0aAqSPjuz+nwbtFatOurWXx9x+ZZhWeU8KXfcsUzpXjcZlto= X-Exchange-Antispam-Report-Test: UriScan:(95692535739014); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6095135)(601004)(2401047)(13018025)(13016025)(8121501046)(5005006)(100000703101)(100105400095)(10201501046)(3002001)(93006095)(93001095)(6055026)(6096035)(20161123561025)(20161123556025)(20161123559100)(201703131430075)(201703131441075)(201703131448075)(201703131433075)(201703161259150)(20161123565025)(20161123563025)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CY1PR03MB2265; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CY1PR03MB2265; X-Forefront-PRVS: 0417A3FFD2 X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1; CY1PR03MB2265; 23:MtgCGx1gaNJ02yvDZY8P46ZLfpI5lyEO3+P7t?= =?Windows-1252?Q?+SZdcKjRQvcJqiFJm04a0aLDgt2L1N57JRshdEAduJ/9tIOJFsoig3UL?= =?Windows-1252?Q?Zzb+zOBYikcoZcd0oITY/dB4tu5bkDafRBq4aLxfogGxFCTq45ubHCbH?= =?Windows-1252?Q?260ASZZybctbx79P5PIdrW+Dt7gWPswjaCwLZ5bwxWgS20pEePqEI5A+?= =?Windows-1252?Q?6/OYPhaZsm0aaPUeq9z1HG1qHsLbVHsfqgG0fLrxbH1FpDenlxIITgBZ?= =?Windows-1252?Q?gpFalQu1Kzm+6r3D5lEuGVQQZ2oa6rCAfxVdgvNSORBnqPp9rb39Hjlg?= =?Windows-1252?Q?c8Q6ZfHH0Uxv1K8jkuXII0R2Wj+r//Yq7Gy2sAJRlBl2g3aODYfCkANd?= =?Windows-1252?Q?yjTd12T8m249M71b3FLvTP8nA9JfrW3/z6r97qdTeZgjKz0+I+EJdEDe?= =?Windows-1252?Q?ePKP4jRa1fFg1owHukeYXDJHbdd9kPVWg+InyDN91lMXJoV1Gd+Oa1yH?= =?Windows-1252?Q?BrK26vmRS4MukUe6iwayQAS9bxq5316BE32JX1oAnbqSriO6GT9XSMyk?= =?Windows-1252?Q?6LWDSSMKCgPr0wV7Zf9G4BaEAp6wnaUwgU6Lo/17eY/s87GDJTxIkWo0?= =?Windows-1252?Q?ZpjPGfTt/c4h4jFsmrKXjP+EM5KXCezEFF2WqXaNoo8/UlHfhUBh4ayL?= =?Windows-1252?Q?3GEKIgtgObk/RU+XqhgXF4IJPypeAlmL18mh4f3DBbgY3Di2soSqZ4bx?= =?Windows-1252?Q?2n6vY202uswkXMzOgvTNeKBID2VVFXnDOLyWyfioLqxp/yz57rSmwRbt?= =?Windows-1252?Q?3x4mHUcvwERIsIBCtcdMv5rPAQuAXM4txgrXRLAjObuDvfVXFBrq5i7O?= =?Windows-1252?Q?E03/F9O1BDVbwzZ+03pLGeb9hmOIXW3rv1+wRgggZsyyreeSMVf5WaxP?= =?Windows-1252?Q?mo/HjF4wvsB5ZxLFbYohwlQUfNFMetJLLOKCZVjUAn5HxrZ9U+nI/IJ9?= =?Windows-1252?Q?H0k2U5IFO/fjwjqfzPs3DbC1WpcGvv7iU4SR02b+WUKGFJqHmgAoeJ36?= =?Windows-1252?Q?3ZL3dWVcnds3S9+XQwVvfEVVENzBMitr4YVsk0wnVkw6WIlTumqMtfH8?= =?Windows-1252?Q?rx1U8s+T+Mcdi3UH2V7zu9S5evbZAzBlCPcoJHa+67Dzx2MjXIKIYgtE?= =?Windows-1252?Q?yW6ZQ7NXQRiQoVNKSjq+zZNzEPVCUFBLESlXOpmnuzgH8Fdp2LrocwqQ?= =?Windows-1252?Q?oThOlshrLX2G1KXTE8J5yLHylgCg3O/SGBvMQk8s3/cFMBSssSGMR+zu?= =?Windows-1252?Q?hO+ifTpVQRVN4rm4NEY03C3p5z9TFvsoIhgyOahhK1MSak+ljOCECzqw?= =?Windows-1252?Q?doFtDdCAzOKZTKiMwZbvs4RUv39VWcxbKPi5FyyCEvExIp67MK59L46Y?= =?Windows-1252?Q?2w+mjlvLv+waTcQRFlrKj129cIk3/9i12sX8oamdqVhcuP66FGrmHAhd?= =?Windows-1252?Q?EZKc9wfCTJ0reNSVnHg5gtEqJFdiNlZtttSMc1Eu/iZWAMFusgC0tkkh?= =?Windows-1252?Q?lvFCFXwL8+Jajnmx/KqXZZsUVs32mKKsL/K?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR03MB2265; 6:nVSzYUhxCI+435PcxKvGW2L7v+neFdiTAKDXqO5HHpT2zzxf28x9LHI69LzmGYqNaIPF12AcwSfne8w/5SpublxfF/1wMzn0+cgyDg9+1n/NY0e1fF9bA+jmAjnrZFMRcKBgx4YomPyhnHsARmbi9aVdW9wzth2Fr+Ur0ddk1IPDPAGgrQuqz+NycXdocDDVr8NGdBaPXwLlLAZ0rRRJ5d5Fanb4hhj3keEMmPMMJNWpeq6dTjXr4lzdam8qEqT299B9oz9N8a9KJV6+/ojazwU0iKjTQKI09LdFMjsCI4SD8dSBB4n3+NTQ9AYUyiA1e72SY50Rt2+AlkVyP3K80g==; 5:0CkGkgST0tqwnojad0aLw1kxQJTkNKQEvQGF23lK0SEnmCTXeJIR/VdJSmZx08FUwbZ/lkRF+GmclM2S6wrVzrnbNkhFjZZx+f5U7EBJZbaRrNs8333rAq1c5aZtXCVjX00gzEt2qX/cipNwNFccWQ==; 24:V4ZyC3AMI8TmWpyO7IzSYhj0W5jPV7ztGjJ1uf+EFwmSDFqjP/GW/0llAkZ4dVg3B8hwOu4AcgaBi6s4Sd3GqsRZLm3jLOQuCm4HcyBaWbY=; 7:wsV7d0tRniSFnQFaBZ9+FPVrYnkxSPN0e8f1sNgSOcdAnLDQdIqI4FbGZZaL+etNP8/eBDeVGKx+vbkErNv0dRzmBcKWS3xg44ud7SnO6ZlawoC+lSW378ngBaEkel2Di6YLRHD4agX16jMvWmoJfkQcK7Olz+Y5swqr10fqCGcqlzmXx7sFVzLAuavBv+Kaz5H0EGt/r5SMBBpgYYBCebHxnDbsstTLSfIbbBwGwQg= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Sep 2017 07:41:28.3328 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR03MB2265 Subject: Re: [dpdk-dev] [PATCH v4] ethdev: allow returning error on VLAN offload configuration X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Sep 2017 07:41:32 -0000 On 9/1/2017 8:06 AM, David Harton wrote: > Some devices may not support or fail setting VLAN offload > configuration based on dynamic circurmstances so the > vlan_offload_set_t vector is modified to return an int so > the caller can determine success or not. > > rte_eth_dev_set_vlan_offload is updated to return the > value provided by the vector when called along with restoring > the original offload configs on failure. > > Existing vlan_offload_set_t vectors are modified to return > an int. Majority of cases return 0 but a few that actually > can fail now return their failure codes. > > Finally, a vlan_offload_set_t vector is added to virtio > to facilitate dynamically turning VLAN strip on or off. > > Signed-off-by: David Harton > --- > > v4 > * Modified commit message heading > * Moved rel_note comments from ABI to API section > * Renamed locals of rte_eth_dev_set_vlan_offload from 'org*' to 'orig*' > > v3 > * Fixed a format error. > * Apologies...need to figure out why checkpatches.pl keeps saying > valid patch when I've got soft tabs. > > v2 > * Fixed a missed format error. > * Removed vlan offload vector call casts and replaced with checks > for return values. > > v1 > * This is an ABI breakage that has been previously negotiated > with Thomas and the proposed rel note change is included as well. > > doc/guides/rel_notes/release_17_11.rst | 8 +++++++- > drivers/net/avp/avp_ethdev.c | 12 +++++++++--- > drivers/net/bnxt/bnxt_ethdev.c | 9 ++++++--- > drivers/net/dpaa2/dpaa2_ethdev.c | 13 ++++++++++--- > drivers/net/e1000/em_ethdev.c | 12 +++++++++--- > drivers/net/e1000/igb_ethdev.c | 12 +++++++++--- > drivers/net/enic/enic_ethdev.c | 8 +++++--- > drivers/net/fm10k/fm10k_ethdev.c | 3 ++- > drivers/net/i40e/i40e_ethdev.c | 11 ++++++++--- > drivers/net/i40e/i40e_ethdev_vf.c | 9 ++++++--- > drivers/net/ixgbe/ixgbe_ethdev.c | 25 ++++++++++++++++++------- > drivers/net/mlx5/mlx5.h | 2 +- > drivers/net/mlx5/mlx5_vlan.c | 3 ++- > drivers/net/nfp/nfp_net.c | 13 +++++++------ > drivers/net/qede/qede_ethdev.c | 9 +++++++-- > drivers/net/virtio/virtio_ethdev.c | 21 +++++++++++++++++++++ > drivers/net/vmxnet3/vmxnet3_ethdev.c | 10 +++++++--- > lib/librte_ether/rte_ethdev.c | 28 ++++++++++++++++++++-------- > lib/librte_ether/rte_ethdev.h | 2 +- > 19 files changed, 155 insertions(+), 55 deletions(-) > > diff --git a/doc/guides/rel_notes/release_17_11.rst b/doc/guides/rel_notes/release_17_11.rst > index 170f4f9..22df4fd 100644 > --- a/doc/guides/rel_notes/release_17_11.rst > +++ b/doc/guides/rel_notes/release_17_11.rst > @@ -110,6 +110,13 @@ API Changes > Also, make sure to start the actual text at the margin. > ========================================================= > > +* **Modified the vlan_offload_set_t function prototype in the ethdev library.** > + > + Changed the function prototype of ``vlan_offload_set_t``. The return value > + has been changed from ``void`` to ``int`` so the caller to knows whether > + the backing device supports the operation or if the operation was > + successfully performed. > + > > ABI Changes > ----------- > @@ -125,7 +132,6 @@ ABI Changes > ========================================================= > > > - > Shared Library Versions > ----------------------- > > diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c > index c746a0e..4011dfa 100644 > --- a/drivers/net/avp/avp_ethdev.c > +++ b/drivers/net/avp/avp_ethdev.c > @@ -70,7 +70,7 @@ static int avp_dev_create(struct rte_pci_device *pci_dev, > static void avp_dev_close(struct rte_eth_dev *dev); > static void avp_dev_info_get(struct rte_eth_dev *dev, > struct rte_eth_dev_info *dev_info); > -static void avp_vlan_offload_set(struct rte_eth_dev *dev, int mask); > +static int avp_vlan_offload_set(struct rte_eth_dev *dev, int mask); > static int avp_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete); > static void avp_dev_promiscuous_enable(struct rte_eth_dev *dev); > static void avp_dev_promiscuous_disable(struct rte_eth_dev *dev); > @@ -2031,7 +2031,12 @@ struct avp_queue { > mask = (ETH_VLAN_STRIP_MASK | > ETH_VLAN_FILTER_MASK | > ETH_VLAN_EXTEND_MASK); > - avp_vlan_offload_set(eth_dev, mask); > + ret = avp_vlan_offload_set(eth_dev, mask); > + if (ret < 0) { > + PMD_DRV_LOG(ERR, "VLAN offload set failed by host, ret=%d\n", > + ret); > + goto unlock; > + } > > /* update device config */ > memset(&config, 0, sizeof(config)); > @@ -2214,7 +2219,7 @@ struct avp_queue { > } > } > > -static void > +static int > avp_vlan_offload_set(struct rte_eth_dev *eth_dev, int mask) > { > struct avp_dev *avp = AVP_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); > @@ -2239,6 +2244,7 @@ struct avp_queue { > if (eth_dev->data->dev_conf.rxmode.hw_vlan_extend) > PMD_DRV_LOG(ERR, "VLAN extend offload not supported\n"); > } > + return 0; > } > > static void > diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c > index c9d1122..547bd55 100644 > --- a/drivers/net/bnxt/bnxt_ethdev.c > +++ b/drivers/net/bnxt/bnxt_ethdev.c > @@ -144,7 +144,7 @@ > ETH_RSS_NONFRAG_IPV6_TCP | \ > ETH_RSS_NONFRAG_IPV6_UDP) > > -static void bnxt_vlan_offload_set_op(struct rte_eth_dev *dev, int mask); > +static int bnxt_vlan_offload_set_op(struct rte_eth_dev *dev, int mask); > > /***********************/ > > @@ -522,7 +522,9 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev) > vlan_mask |= ETH_VLAN_FILTER_MASK; > if (eth_dev->data->dev_conf.rxmode.hw_vlan_strip) > vlan_mask |= ETH_VLAN_STRIP_MASK; > - bnxt_vlan_offload_set_op(eth_dev, vlan_mask); > + rc = bnxt_vlan_offload_set_op(eth_dev, vlan_mask); > + if (rc) > + goto error; > > return 0; > > @@ -1275,7 +1277,7 @@ static int bnxt_vlan_filter_set_op(struct rte_eth_dev *eth_dev, > return bnxt_del_vlan_filter(bp, vlan_id); > } > > -static void > +static int > bnxt_vlan_offload_set_op(struct rte_eth_dev *dev, int mask) > { > struct bnxt *bp = (struct bnxt *)dev->data->dev_private; > @@ -1307,6 +1309,7 @@ static int bnxt_vlan_filter_set_op(struct rte_eth_dev *eth_dev, > > if (mask & ETH_VLAN_EXTEND_MASK) > RTE_LOG(ERR, PMD, "Extend VLAN Not supported\n"); > + return 0; > } > > static void > diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c > index 429b3a0..3390cb3 100644 > --- a/drivers/net/dpaa2/dpaa2_ethdev.c > +++ b/drivers/net/dpaa2/dpaa2_ethdev.c > @@ -138,7 +138,7 @@ > return ret; > } > > -static void > +static int > dpaa2_vlan_offload_set(struct rte_eth_dev *dev, int mask) > { > struct dpaa2_dev_priv *priv = dev->data->dev_private; > @@ -158,6 +158,7 @@ > RTE_LOG(ERR, PMD, "Unable to set vlan filter = %d\n", > ret); > } > + return 0; > } > > static int > @@ -643,8 +644,14 @@ > return ret; > } > /* VLAN Offload Settings */ > - if (priv->max_vlan_filters) > - dpaa2_vlan_offload_set(dev, ETH_VLAN_FILTER_MASK); > + if (priv->max_vlan_filters) { > + ret = dpaa2_vlan_offload_set(dev, ETH_VLAN_FILTER_MASK); > + if (ret) { > + PMD_INIT_LOG(ERR, "Error to dpaa2_vlan_offload_set:" > + "code = %d\n", ret); > + return ret; > + } > + } > > return 0; > } > diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c > index 3d4ab93..51f49d8 100644 > --- a/drivers/net/e1000/em_ethdev.c > +++ b/drivers/net/e1000/em_ethdev.c > @@ -99,7 +99,7 @@ static int eth_em_interrupt_action(struct rte_eth_dev *dev, > > static int eth_em_vlan_filter_set(struct rte_eth_dev *dev, > uint16_t vlan_id, int on); > -static void eth_em_vlan_offload_set(struct rte_eth_dev *dev, int mask); > +static int eth_em_vlan_offload_set(struct rte_eth_dev *dev, int mask); > static void em_vlan_hw_filter_enable(struct rte_eth_dev *dev); > static void em_vlan_hw_filter_disable(struct rte_eth_dev *dev); > static void em_vlan_hw_strip_enable(struct rte_eth_dev *dev); > @@ -668,7 +668,12 @@ static int eth_em_pci_remove(struct rte_pci_device *pci_dev) > > mask = ETH_VLAN_STRIP_MASK | ETH_VLAN_FILTER_MASK | \ > ETH_VLAN_EXTEND_MASK; > - eth_em_vlan_offload_set(dev, mask); > + ret = eth_em_vlan_offload_set(dev, mask); > + if (ret) { > + PMD_INIT_LOG(ERR, "Unable to update vlan offload"); > + em_dev_clear_queues(dev); > + return ret; > + } > > /* Set Interrupt Throttling Rate to maximum allowed value. */ > E1000_WRITE_REG(hw, E1000_ITR, UINT16_MAX); > @@ -1447,7 +1452,7 @@ static int eth_em_pci_remove(struct rte_pci_device *pci_dev) > E1000_WRITE_REG(hw, E1000_CTRL, reg); > } > > -static void > +static int > eth_em_vlan_offload_set(struct rte_eth_dev *dev, int mask) > { > if(mask & ETH_VLAN_STRIP_MASK){ > @@ -1463,6 +1468,7 @@ static int eth_em_pci_remove(struct rte_pci_device *pci_dev) > else > em_vlan_hw_filter_disable(dev); > } > + return 0; > } > > /* > diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c > index e4f7a9f..fa15ee9 100644 > --- a/drivers/net/e1000/igb_ethdev.c > +++ b/drivers/net/e1000/igb_ethdev.c > @@ -157,7 +157,7 @@ static int eth_igb_vlan_filter_set(struct rte_eth_dev *dev, > static int eth_igb_vlan_tpid_set(struct rte_eth_dev *dev, > enum rte_vlan_type vlan_type, > uint16_t tpid_id); > -static void eth_igb_vlan_offload_set(struct rte_eth_dev *dev, int mask); > +static int eth_igb_vlan_offload_set(struct rte_eth_dev *dev, int mask); > > static void igb_vlan_hw_filter_enable(struct rte_eth_dev *dev); > static void igb_vlan_hw_filter_disable(struct rte_eth_dev *dev); > @@ -1400,7 +1400,12 @@ static int eth_igbvf_pci_remove(struct rte_pci_device *pci_dev) > */ > mask = ETH_VLAN_STRIP_MASK | ETH_VLAN_FILTER_MASK | \ > ETH_VLAN_EXTEND_MASK; > - eth_igb_vlan_offload_set(dev, mask); > + ret = eth_igb_vlan_offload_set(dev, mask); > + if (ret) { > + PMD_INIT_LOG(ERR, "Unable to set vlan offload"); > + igb_dev_clear_queues(dev); > + return ret; > + } > > if (dev->data->dev_conf.rxmode.mq_mode == ETH_MQ_RX_VMDQ_ONLY) { > /* Enable VLAN filter since VMDq always use VLAN filter */ > @@ -2715,7 +2720,7 @@ static int eth_igbvf_xstats_get_names(__rte_unused struct rte_eth_dev *dev, > 2 * VLAN_TAG_SIZE); > } > > -static void > +static int > eth_igb_vlan_offload_set(struct rte_eth_dev *dev, int mask) > { > if(mask & ETH_VLAN_STRIP_MASK){ > @@ -2738,6 +2743,7 @@ static int eth_igbvf_xstats_get_names(__rte_unused struct rte_eth_dev *dev, > else > igb_vlan_hw_extend_disable(dev); > } > + return 0; > } > > > diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c > index da8fec2..fc1eac2 100644 > --- a/drivers/net/enic/enic_ethdev.c > +++ b/drivers/net/enic/enic_ethdev.c > @@ -347,7 +347,7 @@ static int enicpmd_vlan_filter_set(struct rte_eth_dev *eth_dev, > return err; > } > > -static void enicpmd_vlan_offload_set(struct rte_eth_dev *eth_dev, int mask) > +static int enicpmd_vlan_offload_set(struct rte_eth_dev *eth_dev, int mask) > { > struct enic *enic = pmd_priv(eth_dev); > > @@ -371,6 +371,8 @@ static void enicpmd_vlan_offload_set(struct rte_eth_dev *eth_dev, int mask) > dev_warning(enic, > "Configuration of extended VLAN is not supported\n"); > } > + > + return 0; > } > > static int enicpmd_dev_configure(struct rte_eth_dev *eth_dev) > @@ -392,9 +394,9 @@ static int enicpmd_dev_configure(struct rte_eth_dev *eth_dev) > eth_dev->data->dev_conf.rxmode.split_hdr_size); > } > > - enicpmd_vlan_offload_set(eth_dev, ETH_VLAN_STRIP_MASK); > + ret = enicpmd_vlan_offload_set(eth_dev, ETH_VLAN_STRIP_MASK); > enic->hw_ip_checksum = eth_dev->data->dev_conf.rxmode.hw_ip_checksum; > - return 0; > + return ret; > } > > /* Start the device. > diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c > index e60d3a3..f4626f7 100644 > --- a/drivers/net/fm10k/fm10k_ethdev.c > +++ b/drivers/net/fm10k/fm10k_ethdev.c > @@ -1590,7 +1590,7 @@ static int fm10k_xstats_get_names(__rte_unused struct rte_eth_dev *dev, > return 0; > } > > -static void > +static int > fm10k_vlan_offload_set(struct rte_eth_dev *dev, int mask) > { > if (mask & ETH_VLAN_STRIP_MASK) { > @@ -1609,6 +1609,7 @@ static int fm10k_xstats_get_names(__rte_unused struct rte_eth_dev *dev, > if (!dev->data->dev_conf.rxmode.hw_vlan_filter) > PMD_INIT_LOG(ERR, "VLAN filter is always on in fm10k"); > } > + return 0; > } > > /* Add/Remove a MAC address, and update filters to main VSI */ > diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c > index 00b6082..d03a44b 100644 > --- a/drivers/net/i40e/i40e_ethdev.c > +++ b/drivers/net/i40e/i40e_ethdev.c > @@ -278,7 +278,7 @@ static int i40e_vlan_filter_set(struct rte_eth_dev *dev, > static int i40e_vlan_tpid_set(struct rte_eth_dev *dev, > enum rte_vlan_type vlan_type, > uint16_t tpid); > -static void i40e_vlan_offload_set(struct rte_eth_dev *dev, int mask); > +static int i40e_vlan_offload_set(struct rte_eth_dev *dev, int mask); > static void i40e_vlan_strip_queue_set(struct rte_eth_dev *dev, > uint16_t queue, > int on); > @@ -3130,7 +3130,7 @@ static int i40e_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev, > return ret; > } > > -static void > +static int > i40e_vlan_offload_set(struct rte_eth_dev *dev, int mask) > { > struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); > @@ -3163,6 +3163,7 @@ static int i40e_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev, > else > i40e_vsi_config_double_vlan(vsi, FALSE); > } > + return 0; > } > > static void > @@ -5216,7 +5217,11 @@ struct i40e_vsi * > > /* Apply vlan offload setting */ > mask = ETH_VLAN_STRIP_MASK | ETH_VLAN_FILTER_MASK; > - i40e_vlan_offload_set(dev, mask); > + ret = i40e_vlan_offload_set(dev, mask); > + if (ret) { > + PMD_DRV_LOG(INFO, "Failed to update vlan offload"); > + return ret; > + } > > /* Apply double-vlan setting, not implemented yet */ > > diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c > index f6d8293..f7fffc2 100644 > --- a/drivers/net/i40e/i40e_ethdev_vf.c > +++ b/drivers/net/i40e/i40e_ethdev_vf.c > @@ -118,7 +118,7 @@ static int i40evf_dev_xstats_get_names(struct rte_eth_dev *dev, > static void i40evf_dev_xstats_reset(struct rte_eth_dev *dev); > static int i40evf_vlan_filter_set(struct rte_eth_dev *dev, > uint16_t vlan_id, int on); > -static void i40evf_vlan_offload_set(struct rte_eth_dev *dev, int mask); > +static int i40evf_vlan_offload_set(struct rte_eth_dev *dev, int mask); > static int i40evf_vlan_pvid_set(struct rte_eth_dev *dev, uint16_t pvid, > int on); > static void i40evf_dev_close(struct rte_eth_dev *dev); > @@ -1634,7 +1634,9 @@ static int eth_i40evf_pci_remove(struct rte_pci_device *pci_dev) > int ret; > > /* Apply vlan offload setting */ > - i40evf_vlan_offload_set(dev, ETH_VLAN_STRIP_MASK); > + ret = i40evf_vlan_offload_set(dev, ETH_VLAN_STRIP_MASK); > + if (ret) > + return ret; > > /* Apply pvid setting */ > ret = i40evf_vlan_pvid_set(dev, data->dev_conf.txmode.pvid, > @@ -1642,7 +1644,7 @@ static int eth_i40evf_pci_remove(struct rte_pci_device *pci_dev) > return ret; > } > > -static void > +static int > i40evf_vlan_offload_set(struct rte_eth_dev *dev, int mask) > { > struct rte_eth_conf *dev_conf = &dev->data->dev_conf; > @@ -1655,6 +1657,7 @@ static int eth_i40evf_pci_remove(struct rte_pci_device *pci_dev) > else > i40evf_disable_vlan_strip(dev); > } > + return 0; > } > > static int > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c > index 22171d8..1ec5aaf 100644 > --- a/drivers/net/ixgbe/ixgbe_ethdev.c > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c > @@ -218,7 +218,7 @@ static void ixgbe_vlan_hw_strip_bitmap_set(struct rte_eth_dev *dev, > uint16_t queue, bool on); > static void ixgbe_vlan_strip_queue_set(struct rte_eth_dev *dev, uint16_t queue, > int on); > -static void ixgbe_vlan_offload_set(struct rte_eth_dev *dev, int mask); > +static int ixgbe_vlan_offload_set(struct rte_eth_dev *dev, int mask); > static void ixgbe_vlan_hw_strip_enable(struct rte_eth_dev *dev, uint16_t queue); > static void ixgbe_vlan_hw_strip_disable(struct rte_eth_dev *dev, uint16_t queue); > static void ixgbe_vlan_hw_extend_enable(struct rte_eth_dev *dev); > @@ -274,7 +274,7 @@ static int ixgbevf_vlan_filter_set(struct rte_eth_dev *dev, > uint16_t vlan_id, int on); > static void ixgbevf_vlan_strip_queue_set(struct rte_eth_dev *dev, > uint16_t queue, int on); > -static void ixgbevf_vlan_offload_set(struct rte_eth_dev *dev, int mask); > +static int ixgbevf_vlan_offload_set(struct rte_eth_dev *dev, int mask); > static void ixgbevf_set_vfta_all(struct rte_eth_dev *dev, bool on); > static int ixgbevf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, > uint16_t queue_id); > @@ -2125,7 +2125,7 @@ static int eth_ixgbevf_pci_remove(struct rte_pci_device *pci_dev) > */ > } > > -static void > +static int > ixgbe_vlan_offload_set(struct rte_eth_dev *dev, int mask) > { > if (mask & ETH_VLAN_STRIP_MASK) { > @@ -2148,6 +2148,7 @@ static int eth_ixgbevf_pci_remove(struct rte_pci_device *pci_dev) > else > ixgbe_vlan_hw_extend_disable(dev); > } > + return 0; > } > > static void > @@ -2568,9 +2569,13 @@ static int eth_ixgbevf_pci_remove(struct rte_pci_device *pci_dev) > goto error; > } > > - mask = ETH_VLAN_STRIP_MASK | ETH_VLAN_FILTER_MASK | > + mask = ETH_VLAN_STRIP_MASK | ETH_VLAN_FILTER_MASK | > ETH_VLAN_EXTEND_MASK; > - ixgbe_vlan_offload_set(dev, mask); > + err = ixgbe_vlan_offload_set(dev, mask); > + if (err) { > + PMD_INIT_LOG(ERR, "Unable to set VLAN offload"); > + goto error; > + } > > if (dev->data->dev_conf.rxmode.mq_mode == ETH_MQ_RX_VMDQ_ONLY) { > /* Enable vlan filtering for VMDq */ > @@ -4993,7 +4998,12 @@ static int ixgbevf_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev, > /* Set HW strip */ > mask = ETH_VLAN_STRIP_MASK | ETH_VLAN_FILTER_MASK | > ETH_VLAN_EXTEND_MASK; > - ixgbevf_vlan_offload_set(dev, mask); > + err = ixgbevf_vlan_offload_set(dev, mask); > + if (err) { > + PMD_INIT_LOG(ERR, "Unable to set VLAN offload (%d)", err); > + ixgbe_dev_clear_queues(dev); > + return err; > + } > > ixgbevf_dev_rxtx_start(dev); > > @@ -5153,7 +5163,7 @@ static void ixgbevf_set_vfta_all(struct rte_eth_dev *dev, bool on) > ixgbe_vlan_hw_strip_bitmap_set(dev, queue, on); > } > > -static void > +static int > ixgbevf_vlan_offload_set(struct rte_eth_dev *dev, int mask) > { > struct ixgbe_hw *hw = > @@ -5168,6 +5178,7 @@ static void ixgbevf_set_vfta_all(struct rte_eth_dev *dev, bool on) > for (i = 0; i < hw->mac.max_rx_queues; i++) > ixgbevf_vlan_strip_queue_set(dev, i, on); > } > + return 0; > } > > int > diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h > index 43c5384..93e71be 100644 > --- a/drivers/net/mlx5/mlx5.h > +++ b/drivers/net/mlx5/mlx5.h > @@ -283,7 +283,7 @@ int mlx5_xstats_get_names(struct rte_eth_dev *, > /* mlx5_vlan.c */ > > int mlx5_vlan_filter_set(struct rte_eth_dev *, uint16_t, int); > -void mlx5_vlan_offload_set(struct rte_eth_dev *, int); > +int mlx5_vlan_offload_set(struct rte_eth_dev *, int); > void mlx5_vlan_strip_queue_set(struct rte_eth_dev *, uint16_t, int); > > /* mlx5_trigger.c */ > diff --git a/drivers/net/mlx5/mlx5_vlan.c b/drivers/net/mlx5/mlx5_vlan.c > index 1b0fa40..7215909 100644 > --- a/drivers/net/mlx5/mlx5_vlan.c > +++ b/drivers/net/mlx5/mlx5_vlan.c > @@ -210,7 +210,7 @@ > * @param mask > * VLAN offload bit mask. > */ > -void > +int > mlx5_vlan_offload_set(struct rte_eth_dev *dev, int mask) > { > struct priv *priv = dev->data->dev_private; > @@ -230,4 +230,5 @@ > priv_vlan_strip_queue_set(priv, i, hw_vlan_strip); > priv_unlock(priv); > } > + return 0; > } > diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c > index 92b03c4..6473edc 100644 > --- a/drivers/net/nfp/nfp_net.c > +++ b/drivers/net/nfp/nfp_net.c > @@ -2149,11 +2149,12 @@ uint32_t nfp_net_txq_full(struct nfp_net_txq *txq) > return i; > } > > -static void > +static int > nfp_net_vlan_offload_set(struct rte_eth_dev *dev, int mask) > { > uint32_t new_ctrl, update; > struct nfp_net_hw *hw; > + int ret; > > hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private); > new_ctrl = 0; > @@ -2174,14 +2175,14 @@ uint32_t nfp_net_txq_full(struct nfp_net_txq *txq) > new_ctrl = hw->ctrl & ~NFP_NET_CFG_CTRL_RXVLAN; > > if (new_ctrl == 0) > - return; > + return 0; > > update = NFP_NET_CFG_UPDATE_GEN; > > - if (nfp_net_reconfig(hw, new_ctrl, update) < 0) > - return; > - > - hw->ctrl = new_ctrl; > + ret = nfp_net_reconfig(hw, new_ctrl, update); > + if (!ret) > + hw->ctrl = new_ctrl; > + return ret; > } > > /* Update Redirection Table(RETA) of Receive Side Scaling of Ethernet device */ > diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c > index 0e05989..644f69d 100644 > --- a/drivers/net/qede/qede_ethdev.c > +++ b/drivers/net/qede/qede_ethdev.c > @@ -975,7 +975,7 @@ static int qede_vlan_filter_set(struct rte_eth_dev *eth_dev, > return rc; > } > > -static void qede_vlan_offload_set(struct rte_eth_dev *eth_dev, int mask) > +static int qede_vlan_offload_set(struct rte_eth_dev *eth_dev, int mask) > { > struct qede_dev *qdev = QEDE_INIT_QDEV(eth_dev); > struct ecore_dev *edev = QEDE_INIT_EDEV(qdev); > @@ -1013,6 +1013,8 @@ static void qede_vlan_offload_set(struct rte_eth_dev *eth_dev, int mask) > > DP_INFO(edev, "vlan offload mask %d vlan-strip %d vlan-filter %d\n", > mask, rxmode->hw_vlan_strip, rxmode->hw_vlan_filter); > + > + return 0; > } > > static void qede_prandom_bytes(uint32_t *buff) > @@ -1157,6 +1159,7 @@ static int qede_dev_configure(struct rte_eth_dev *eth_dev) > struct qede_dev *qdev = QEDE_INIT_QDEV(eth_dev); > struct ecore_dev *edev = QEDE_INIT_EDEV(qdev); > struct rte_eth_rxmode *rxmode = ð_dev->data->dev_conf.rxmode; > + int ret; > > PMD_INIT_FUNC_TRACE(edev); > > @@ -1237,9 +1240,11 @@ static int qede_dev_configure(struct rte_eth_dev *eth_dev) > qdev->enable_lro = rxmode->enable_lro; > > /* Enable VLAN offloads by default */ > - qede_vlan_offload_set(eth_dev, ETH_VLAN_STRIP_MASK | > + ret = qede_vlan_offload_set(eth_dev, ETH_VLAN_STRIP_MASK | > ETH_VLAN_FILTER_MASK | > ETH_VLAN_EXTEND_MASK); > + if (ret) > + return ret; > > DP_INFO(edev, "Device configured with RSS=%d TSS=%d\n", > QEDE_RSS_COUNT(qdev), QEDE_TSS_COUNT(qdev)); > diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c > index e320811..72b4248 100644 > --- a/drivers/net/virtio/virtio_ethdev.c > +++ b/drivers/net/virtio/virtio_ethdev.c > @@ -72,6 +72,7 @@ static void virtio_dev_info_get(struct rte_eth_dev *dev, > struct rte_eth_dev_info *dev_info); > static int virtio_dev_link_update(struct rte_eth_dev *dev, > int wait_to_complete); > +static int virtio_dev_vlan_offload_set(struct rte_eth_dev *dev, int mask); > > static void virtio_set_hwaddr(struct virtio_hw *hw); > static void virtio_get_hwaddr(struct virtio_hw *hw); > @@ -779,6 +780,7 @@ struct rte_virtio_xstats_name_off { > .stats_reset = virtio_dev_stats_reset, > .xstats_reset = virtio_dev_stats_reset, > .link_update = virtio_dev_link_update, > + .vlan_offload_set = virtio_dev_vlan_offload_set, > .rx_queue_setup = virtio_dev_rx_queue_setup, > .rx_queue_intr_enable = virtio_dev_rx_queue_intr_enable, > .rx_queue_intr_disable = virtio_dev_rx_queue_intr_disable, > @@ -1875,6 +1877,25 @@ static void virtio_dev_free_mbufs(struct rte_eth_dev *dev) > return (old.link_status == link.link_status) ? -1 : 0; > } > > +static int > +virtio_dev_vlan_offload_set(struct rte_eth_dev *dev, int mask) > +{ > + const struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode; > + struct virtio_hw *hw = dev->data->dev_private; > + > + if (rxmode->hw_vlan_filter && > + !vtpci_with_feature(hw, VIRTIO_NET_F_CTRL_VLAN)) { > + PMD_DRV_LOG(NOTICE, > + "vlan filtering not available on this host"); > + return -ENOTSUP; > + } > + > + if (mask & ETH_VLAN_STRIP_MASK) > + hw->vlan_strip = rxmode->hw_vlan_strip; > + > + return 0; > +} > + > static void > virtio_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) > { > diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c > index 3910991..06735dd 100644 > --- a/drivers/net/vmxnet3/vmxnet3_ethdev.c > +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c > @@ -100,7 +100,7 @@ static void vmxnet3_dev_info_get(struct rte_eth_dev *dev, > vmxnet3_dev_supported_ptypes_get(struct rte_eth_dev *dev); > static int vmxnet3_dev_vlan_filter_set(struct rte_eth_dev *dev, > uint16_t vid, int on); > -static void vmxnet3_dev_vlan_offload_set(struct rte_eth_dev *dev, int mask); > +static int vmxnet3_dev_vlan_offload_set(struct rte_eth_dev *dev, int mask); > static void vmxnet3_mac_addr_set(struct rte_eth_dev *dev, > struct ether_addr *mac_addr); > static void vmxnet3_interrupt_handler(void *param); > @@ -730,8 +730,10 @@ static int eth_vmxnet3_pci_remove(struct rte_pci_device *pci_dev) > devRead->rssConfDesc.confPA = hw->rss_confPA; > } > > - vmxnet3_dev_vlan_offload_set(dev, > + ret = vmxnet3_dev_vlan_offload_set(dev, > ETH_VLAN_STRIP_MASK | ETH_VLAN_FILTER_MASK); > + if (ret) > + return ret; > > vmxnet3_write_mac(hw, dev->data->mac_addrs->addr_bytes); > > @@ -1275,7 +1277,7 @@ static int eth_vmxnet3_pci_remove(struct rte_pci_device *pci_dev) > return 0; > } > > -static void > +static int > vmxnet3_dev_vlan_offload_set(struct rte_eth_dev *dev, int mask) > { > struct vmxnet3_hw *hw = dev->data->dev_private; > @@ -1301,6 +1303,8 @@ static int eth_vmxnet3_pci_remove(struct rte_pci_device *pci_dev) > VMXNET3_WRITE_BAR1_REG(hw, VMXNET3_REG_CMD, > VMXNET3_CMD_UPDATE_VLAN_FILTERS); > } > + > + return 0; > } > > static void > diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c > index 0597641..05e52b8 100644 > --- a/lib/librte_ether/rte_ethdev.c > +++ b/lib/librte_ether/rte_ethdev.c > @@ -2048,29 +2048,35 @@ struct rte_eth_dev * > struct rte_eth_dev *dev; > int ret = 0; > int mask = 0; > - int cur, org = 0; > + int cur, orig = 0; > + uint8_t orig_strip, orig_filter, orig_extend; > > RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); > dev = &rte_eth_devices[port_id]; > > + /* save original values in case of failure */ > + orig_strip = dev->data->dev_conf.rxmode.hw_vlan_strip; > + orig_filter = dev->data->dev_conf.rxmode.hw_vlan_filter; > + orig_extend = dev->data->dev_conf.rxmode.hw_vlan_extend; > + > /*check which option changed by application*/ > cur = !!(offload_mask & ETH_VLAN_STRIP_OFFLOAD); > - org = !!(dev->data->dev_conf.rxmode.hw_vlan_strip); > - if (cur != org) { > + orig = !!(dev->data->dev_conf.rxmode.hw_vlan_strip); > + if (cur != orig) { > dev->data->dev_conf.rxmode.hw_vlan_strip = (uint8_t)cur; > mask |= ETH_VLAN_STRIP_MASK; > } > > cur = !!(offload_mask & ETH_VLAN_FILTER_OFFLOAD); > - org = !!(dev->data->dev_conf.rxmode.hw_vlan_filter); > - if (cur != org) { > + orig = !!(dev->data->dev_conf.rxmode.hw_vlan_filter); > + if (cur != orig) { > dev->data->dev_conf.rxmode.hw_vlan_filter = (uint8_t)cur; > mask |= ETH_VLAN_FILTER_MASK; > } > > cur = !!(offload_mask & ETH_VLAN_EXTEND_OFFLOAD); > - org = !!(dev->data->dev_conf.rxmode.hw_vlan_extend); > - if (cur != org) { > + orig = !!(dev->data->dev_conf.rxmode.hw_vlan_extend); > + if (cur != orig) { > dev->data->dev_conf.rxmode.hw_vlan_extend = (uint8_t)cur; > mask |= ETH_VLAN_EXTEND_MASK; > } > @@ -2080,7 +2086,13 @@ struct rte_eth_dev * > return ret; > > RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->vlan_offload_set, -ENOTSUP); > - (*dev->dev_ops->vlan_offload_set)(dev, mask); > + ret = (*dev->dev_ops->vlan_offload_set)(dev, mask); > + if (ret) { > + /* hit an error restore original values */ > + dev->data->dev_conf.rxmode.hw_vlan_strip = orig_strip; > + dev->data->dev_conf.rxmode.hw_vlan_filter = orig_filter; > + dev->data->dev_conf.rxmode.hw_vlan_extend = orig_extend; > + } > Currently vlan offload is combining three functions: strip, filter and extend. Not all PMDs in DPDK support all of three. Should not the error we extended to reflect, which of the VLAN offload is not supported? > return ret; > } > diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h > index 0adf327..7254fd0 100644 > --- a/lib/librte_ether/rte_ethdev.h > +++ b/lib/librte_ether/rte_ethdev.h > @@ -1245,7 +1245,7 @@ typedef int (*vlan_tpid_set_t)(struct rte_eth_dev *dev, > enum rte_vlan_type type, uint16_t tpid); > /**< @internal set the outer/inner VLAN-TPID by an Ethernet device. */ > > -typedef void (*vlan_offload_set_t)(struct rte_eth_dev *dev, int mask); > +typedef int (*vlan_offload_set_t)(struct rte_eth_dev *dev, int mask); > /**< @internal set VLAN offload function by an Ethernet device. */ > > typedef int (*vlan_pvid_set_t)(struct rte_eth_dev *dev, >