]> git.droids-corp.org - dpdk.git/commitdiff
net/mlx5: fix Rx VLAN stripping capability check
authorAdrien Mazarguil <adrien.mazarguil@6wind.com>
Wed, 8 Jun 2016 09:43:28 +0000 (11:43 +0200)
committerBruce Richardson <bruce.richardson@intel.com>
Mon, 20 Jun 2016 15:21:49 +0000 (17:21 +0200)
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 <adrien.mazarguil@6wind.com>
drivers/net/mlx5/mlx5_rxq.c
drivers/net/mlx5/mlx5_vlan.c

index 469ba987b0dbb5572d214555c91c7f0e9d275e9d..0bcf55bb4b36d28f7425a9e4001465123fd8b1fa 100644 (file)
@@ -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,
index ea7af1e42079b6c5c12f5db1e92ae15415e6dbc1..ff40538e307a7b53383ef06307d64dede7b8a60e 100644 (file)
@@ -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");