net/mlx5: make vectorized Tx threshold configurable
[dpdk.git] / drivers / net / mlx5 / mlx5_rxmode.c
index e43a4b0..e74fdef 100644 (file)
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  * Copyright 2015 6WIND S.A.
- * Copyright 2015 Mellanox.
+ * Copyright 2015 Mellanox Technologies, Ltd
  */
 
 #include <stddef.h>
 void
 mlx5_promiscuous_enable(struct rte_eth_dev *dev)
 {
+       struct priv *priv = dev->data->dev_private;
        int ret;
 
        dev->data->promiscuous = 1;
+       if (priv->isolated) {
+               DRV_LOG(WARNING,
+                       "port %u cannot enable promiscuous mode"
+                       " in flow isolation mode",
+                       dev->data->port_id);
+               return;
+       }
+       if (priv->config.vf)
+               mlx5_nl_promisc(dev, 1);
        ret = mlx5_traffic_restart(dev);
        if (ret)
                DRV_LOG(ERR, "port %u cannot enable promiscuous mode: %s",
@@ -50,9 +60,12 @@ mlx5_promiscuous_enable(struct rte_eth_dev *dev)
 void
 mlx5_promiscuous_disable(struct rte_eth_dev *dev)
 {
+       struct priv *priv = dev->data->dev_private;
        int ret;
 
        dev->data->promiscuous = 0;
+       if (priv->config.vf)
+               mlx5_nl_promisc(dev, 0);
        ret = mlx5_traffic_restart(dev);
        if (ret)
                DRV_LOG(ERR, "port %u cannot disable promiscuous mode: %s",
@@ -68,9 +81,19 @@ mlx5_promiscuous_disable(struct rte_eth_dev *dev)
 void
 mlx5_allmulticast_enable(struct rte_eth_dev *dev)
 {
+       struct priv *priv = dev->data->dev_private;
        int ret;
 
        dev->data->all_multicast = 1;
+       if (priv->isolated) {
+               DRV_LOG(WARNING,
+                       "port %u cannot enable allmulticast mode"
+                       " in flow isolation mode",
+                       dev->data->port_id);
+               return;
+       }
+       if (priv->config.vf)
+               mlx5_nl_allmulti(dev, 1);
        ret = mlx5_traffic_restart(dev);
        if (ret)
                DRV_LOG(ERR, "port %u cannot enable allmulicast mode: %s",
@@ -86,9 +109,12 @@ mlx5_allmulticast_enable(struct rte_eth_dev *dev)
 void
 mlx5_allmulticast_disable(struct rte_eth_dev *dev)
 {
+       struct priv *priv = dev->data->dev_private;
        int ret;
 
        dev->data->all_multicast = 0;
+       if (priv->config.vf)
+               mlx5_nl_allmulti(dev, 0);
        ret = mlx5_traffic_restart(dev);
        if (ret)
                DRV_LOG(ERR, "port %u cannot disable allmulicast mode: %s",