net/mlx5: separate DPDK from verbs Rx queue objects
[dpdk.git] / drivers / net / mlx5 / mlx5_vlan.c
index fa9e3b8..d707984 100644 (file)
 #include <assert.h>
 #include <stdint.h>
 
-/* DPDK headers don't like -pedantic. */
-#ifdef PEDANTIC
-#pragma GCC diagnostic ignored "-pedantic"
-#endif
 #include <rte_ethdev.h>
 #include <rte_common.h>
-#ifdef PEDANTIC
-#pragma GCC diagnostic error "-pedantic"
-#endif
 
 #include "mlx5_utils.h"
 #include "mlx5.h"
@@ -87,7 +80,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);
@@ -98,9 +92,10 @@ vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
                priv->vlan_filter[priv->vlan_filter_n] = vlan_id;
                ++priv->vlan_filter_n;
        }
-       /* Rehash MAC flows in all hash RX queues. */
+       /* Rehash flows in all hash RX queues. */
        priv_mac_addrs_disable(priv);
-       return priv_mac_addrs_enable(priv);
+       priv_special_flow_disable_all(priv);
+       return priv_rehash_flows(priv);
 }
 
 /**
@@ -142,30 +137,30 @@ mlx5_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
 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 ibv_exp_wq_attr mod;
+       struct mlx5_rxq_data *rxq = (*priv->rxqs)[idx];
+       struct mlx5_rxq_ctrl *rxq_ctrl =
+               container_of(rxq, struct mlx5_rxq_ctrl, rxq);
+       struct ibv_wq_attr mod;
        uint16_t vlan_offloads =
-               (on ? IBV_EXP_RECEIVE_WQ_CVLAN_STRIP : 0) |
+               (on ? IBV_WQ_FLAGS_CVLAN_STRIPPING : 0) |
                0;
        int err;
 
        DEBUG("set VLAN offloads 0x%x for port %d queue %d",
              vlan_offloads, rxq->port_id, idx);
-       mod = (struct ibv_exp_wq_attr){
-               .attr_mask = IBV_EXP_WQ_ATTR_VLAN_OFFLOADS,
-               .vlan_offloads = vlan_offloads,
+       mod = (struct ibv_wq_attr){
+               .attr_mask = IBV_WQ_ATTR_FLAGS,
+               .flags_mask = IBV_WQ_FLAGS_CVLAN_STRIPPING,
+               .flags = vlan_offloads,
        };
 
-       err = ibv_exp_modify_wq(rxq->wq, &mod);
+       err = ibv_modify_wq(rxq_ctrl->ibv->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;
 }
@@ -217,7 +212,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");