Merge branch 'upstream-16.11-stable' into 16.11.x
[deb_dpdk.git] / drivers / net / mlx5 / mlx5_vlan.c
index ea7af1e..4e11ead 100644 (file)
 #include <assert.h>
 #include <stdint.h>
 
+/*
+ * Not needed by this file; included to work around the lack of off_t
+ * definition for mlx5dv.h with unpatched rdma-core versions.
+ */
+#include <sys/types.h>
+
 /* DPDK headers don't like -pedantic. */
 #ifdef PEDANTIC
-#pragma GCC diagnostic ignored "-pedantic"
+#pragma GCC diagnostic ignored "-Wpedantic"
 #endif
 #include <rte_ethdev.h>
 #include <rte_common.h>
 #ifdef PEDANTIC
-#pragma GCC diagnostic error "-pedantic"
+#pragma GCC diagnostic error "-Wpedantic"
 #endif
 
 #include "mlx5_utils.h"
@@ -87,7 +93,8 @@ vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
                --priv->vlan_filter_n;
                memmove(&priv->vlan_filter[i],
                        &priv->vlan_filter[i + 1],
-                       priv->vlan_filter_n - i);
+                       sizeof(priv->vlan_filter[i]) *
+                       (priv->vlan_filter_n - i));
                priv->vlan_filter[priv->vlan_filter_n] = 0;
        } else {
                assert(i == priv->vlan_filter_n);
@@ -144,7 +151,7 @@ static void
 priv_vlan_strip_queue_set(struct priv *priv, uint16_t idx, int on)
 {
        struct rxq *rxq = (*priv->rxqs)[idx];
-#ifdef HAVE_EXP_DEVICE_ATTR_VLAN_OFFLOADS
+       struct rxq_ctrl *rxq_ctrl = container_of(rxq, struct rxq_ctrl, rxq);
        struct ibv_exp_wq_attr mod;
        uint16_t vlan_offloads =
                (on ? IBV_EXP_RECEIVE_WQ_CVLAN_STRIP : 0) |
@@ -158,15 +165,13 @@ priv_vlan_strip_queue_set(struct priv *priv, uint16_t idx, int on)
                .vlan_offloads = vlan_offloads,
        };
 
-       err = ibv_exp_modify_wq(rxq->wq, &mod);
+       err = ibv_exp_modify_wq(rxq_ctrl->wq, &mod);
        if (err) {
                ERROR("%p: failed to modified stripping mode: %s",
                      (void *)priv, strerror(err));
                return;
        }
 
-#endif /* HAVE_EXP_DEVICE_ATTR_VLAN_OFFLOADS */
-
        /* Update related bits in RX queue. */
        rxq->vlan_strip = !!on;
 }
@@ -218,7 +223,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");