net/mlx5: add queue and RSS HW steering action
[dpdk.git] / drivers / net / mlx5 / linux / mlx5_vlan_os.c
index 92fc17d..80ccd5a 100644 (file)
@@ -14,7 +14,7 @@
  */
 #include <sys/types.h>
 
-#include <rte_ethdev_driver.h>
+#include <ethdev_driver.h>
 #include <rte_common.h>
 #include <rte_malloc.h>
 #include <rte_hypervisor.h>
@@ -44,12 +44,14 @@ mlx5_vlan_vmwa_release(struct rte_eth_dev *dev,
        if (!vlan->created || !vmwa)
                return;
        vlan->created = 0;
+       rte_spinlock_lock(&vmwa->sl);
        MLX5_ASSERT(vlan_dev[vlan->tag].refcnt);
        if (--vlan_dev[vlan->tag].refcnt == 0 &&
            vlan_dev[vlan->tag].ifindex) {
                mlx5_nl_vlan_vmwa_delete(vmwa, vlan_dev[vlan->tag].ifindex);
                vlan_dev[vlan->tag].ifindex = 0;
        }
+       rte_spinlock_unlock(&vmwa->sl);
 }
 
 /**
@@ -72,6 +74,7 @@ mlx5_vlan_vmwa_acquire(struct rte_eth_dev *dev,
        MLX5_ASSERT(priv->vmwa_context);
        if (vlan->created || !vmwa)
                return;
+       rte_spinlock_lock(&vmwa->sl);
        if (vlan_dev[vlan->tag].refcnt == 0) {
                MLX5_ASSERT(!vlan_dev[vlan->tag].ifindex);
                vlan_dev[vlan->tag].ifindex =
@@ -82,6 +85,7 @@ mlx5_vlan_vmwa_acquire(struct rte_eth_dev *dev,
                vlan_dev[vlan->tag].refcnt++;
                vlan->created = 1;
        }
+       rte_spinlock_unlock(&vmwa->sl);
 }
 
 /*
@@ -99,12 +103,11 @@ void *
 mlx5_vlan_vmwa_init(struct rte_eth_dev *dev, uint32_t ifindex)
 {
        struct mlx5_priv *priv = dev->data->dev_private;
-       struct mlx5_dev_config *config = &priv->config;
        struct mlx5_nl_vlan_vmwa_context *vmwa;
        enum rte_hypervisor hv_type;
 
        /* Do not engage workaround over PF. */
-       if (!config->vf)
+       if (!priv->sh->dev_cap.vf)
                return NULL;
        /* Check whether there is desired virtual environment */
        hv_type = rte_hypervisor_get();
@@ -131,6 +134,7 @@ mlx5_vlan_vmwa_init(struct rte_eth_dev *dev, uint32_t ifindex)
                        " for VLAN workaround context");
                return NULL;
        }
+       rte_spinlock_init(&vmwa->sl);
        vmwa->nl_socket = mlx5_nl_init(NETLINK_ROUTE);
        if (vmwa->nl_socket < 0) {
                DRV_LOG(WARNING,