aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/dpdk/device/init.c
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2019-07-15 01:04:11 -0700
committerNeale Ranns <nranns@cisco.com>2019-07-26 11:43:52 +0000
commit08ac303e43492c8b25911340fb62811289dd3935 (patch)
treea27d19ca73d5472b76276bda5c62a448613ffadb /src/plugins/dpdk/device/init.c
parent99536f4b492478bab66ee8c6b0905a940b8db3c9 (diff)
dpdk: fix vlan stripping
Type: fix Fixes: ce3e971 Change-Id: I30bbeced2f5ae7613e65546f2b9b41e2fb514208 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/plugins/dpdk/device/init.c')
-rw-r--r--src/plugins/dpdk/device/init.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/plugins/dpdk/device/init.c b/src/plugins/dpdk/device/init.c
index d15f5bf4774..07cbbf99725 100644
--- a/src/plugins/dpdk/device/init.c
+++ b/src/plugins/dpdk/device/init.c
@@ -266,7 +266,7 @@ dpdk_lib_init (dpdk_main_t * dm)
RTE_ETH_FOREACH_DEV(i)
{
u8 addr[6];
- u8 vlan_strip = 0;
+ int vlan_off;
struct rte_eth_dev_info dev_info;
struct rte_pci_device *pci_dev;
struct rte_eth_link l;
@@ -778,22 +778,26 @@ dpdk_lib_init (dpdk_main_t * dm)
* VLAN stripping: default to VLAN strip disabled, unless specified
* otherwise in the startup config.
*/
- if (devconf->vlan_strip_offload == DPDK_DEVICE_VLAN_STRIP_ON)
- vlan_strip = 1;
- if (vlan_strip)
+ vlan_off = rte_eth_dev_get_vlan_offload (xd->port_id);
+ if (devconf->vlan_strip_offload == DPDK_DEVICE_VLAN_STRIP_ON)
{
- int vlan_off;
- vlan_off = rte_eth_dev_get_vlan_offload (xd->port_id);
vlan_off |= ETH_VLAN_STRIP_OFFLOAD;
- if (vlan_off)
- xd->port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_VLAN_STRIP;
- else
- xd->port_conf.rxmode.offloads &= ~DEV_RX_OFFLOAD_VLAN_STRIP;
- if (rte_eth_dev_set_vlan_offload (xd->port_id, vlan_off) == 0)
+ if (rte_eth_dev_set_vlan_offload (xd->port_id, vlan_off) >= 0)
dpdk_log_info ("VLAN strip enabled for interface\n");
else
dpdk_log_warn ("VLAN strip cannot be supported by interface\n");
+ xd->port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_VLAN_STRIP;
+ }
+ else
+ {
+ if (vlan_off & ETH_VLAN_STRIP_OFFLOAD)
+ {
+ vlan_off &= ~ETH_VLAN_STRIP_OFFLOAD;
+ if (rte_eth_dev_set_vlan_offload (xd->port_id, vlan_off) >= 0)
+ dpdk_log_warn ("set VLAN offload failed\n");
+ }
+ xd->port_conf.rxmode.offloads &= ~DEV_RX_OFFLOAD_VLAN_STRIP;
}
if (hi)