From 6a707608dc61372501c45ae25de6e7e26b26e561 Mon Sep 17 00:00:00 2001 From: Adrien Mazarguil Date: Wed, 8 Jun 2016 11:43:28 +0200 Subject: [PATCH] net/mlx5: fix Rx VLAN stripping capability check A hardware capability check is missing before enabling RX VLAN stripping during queue setup. Also, while dev_conf.rxmode.hw_vlan_strip is currently a single bit that can be stored in priv->hw_vlan_strip directly, it should be interpreted as a boolean value for safety. Fixes: f3db9489188a ("mlx5: support Rx VLAN stripping") Signed-off-by: Adrien Mazarguil --- drivers/net/mlx5/mlx5_rxq.c | 3 ++- drivers/net/mlx5/mlx5_vlan.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index 469ba987b0..0bcf55bb4b 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -1222,7 +1222,8 @@ rxq_setup(struct rte_eth_dev *dev, struct rxq *rxq, uint16_t desc, DEBUG("priv->device_attr.max_sge is %d", priv->device_attr.max_sge); /* Configure VLAN stripping. */ - tmpl.vlan_strip = dev->data->dev_conf.rxmode.hw_vlan_strip; + tmpl.vlan_strip = (priv->hw_vlan_strip && + !!dev->data->dev_conf.rxmode.hw_vlan_strip); attr.wq = (struct ibv_exp_wq_init_attr){ .wq_context = NULL, /* Could be useful in the future. */ .wq_type = IBV_EXP_WQT_RQ, diff --git a/drivers/net/mlx5/mlx5_vlan.c b/drivers/net/mlx5/mlx5_vlan.c index ea7af1e420..ff40538e30 100644 --- a/drivers/net/mlx5/mlx5_vlan.c +++ b/drivers/net/mlx5/mlx5_vlan.c @@ -218,7 +218,7 @@ mlx5_vlan_offload_set(struct rte_eth_dev *dev, int mask) unsigned int i; if (mask & ETH_VLAN_STRIP_MASK) { - int hw_vlan_strip = dev->data->dev_conf.rxmode.hw_vlan_strip; + int hw_vlan_strip = !!dev->data->dev_conf.rxmode.hw_vlan_strip; if (!priv->hw_vlan_strip) { ERROR("VLAN stripping is not supported"); -- 2.20.1