build: disable experimental API check internally
[dpdk.git] / drivers / net / mlx5 / mlx5_rxmode.c
index 56fc1b6..84c8b05 100644 (file)
@@ -47,7 +47,8 @@ mlx5_promiscuous_enable(struct rte_eth_dev *dev)
                return 0;
        }
        if (priv->config.vf) {
-               ret = mlx5_nl_promisc(dev, 1);
+               ret = mlx5_nl_promisc(priv->nl_socket_route, mlx5_ifindex(dev),
+                                     1);
                if (ret)
                        return ret;
        }
@@ -80,7 +81,8 @@ mlx5_promiscuous_disable(struct rte_eth_dev *dev)
 
        dev->data->promiscuous = 0;
        if (priv->config.vf) {
-               ret = mlx5_nl_promisc(dev, 0);
+               ret = mlx5_nl_promisc(priv->nl_socket_route, mlx5_ifindex(dev),
+                                     0);
                if (ret)
                        return ret;
        }
@@ -101,8 +103,11 @@ mlx5_promiscuous_disable(struct rte_eth_dev *dev)
  *
  * @param dev
  *   Pointer to Ethernet device structure.
+ *
+ * @return
+ *   0 on success, a negative errno value otherwise and rte_errno is set.
  */
-void
+int
 mlx5_allmulticast_enable(struct rte_eth_dev *dev)
 {
        struct mlx5_priv *priv = dev->data->dev_private;
@@ -114,14 +119,24 @@ mlx5_allmulticast_enable(struct rte_eth_dev *dev)
                        "port %u cannot enable allmulticast mode"
                        " in flow isolation mode",
                        dev->data->port_id);
-               return;
+               return 0;
+       }
+       if (priv->config.vf) {
+               ret = mlx5_nl_allmulti(priv->nl_socket_route, mlx5_ifindex(dev),
+                                      1);
+               if (ret)
+                       goto error;
        }
-       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",
                        dev->data->port_id, strerror(rte_errno));
+error:
+       /*
+        * rte_eth_allmulticast_enable() rollback
+        * dev->data->all_multicast in the case of failure.
+        */
+       return ret;
 }
 
 /**
@@ -129,18 +144,31 @@ mlx5_allmulticast_enable(struct rte_eth_dev *dev)
  *
  * @param dev
  *   Pointer to Ethernet device structure.
+ *
+ * @return
+ *   0 on success, a negative errno value otherwise and rte_errno is set.
  */
-void
+int
 mlx5_allmulticast_disable(struct rte_eth_dev *dev)
 {
        struct mlx5_priv *priv = dev->data->dev_private;
        int ret;
 
        dev->data->all_multicast = 0;
-       if (priv->config.vf)
-               mlx5_nl_allmulti(dev, 0);
+       if (priv->config.vf) {
+               ret = mlx5_nl_allmulti(priv->nl_socket_route, mlx5_ifindex(dev),
+                                      0);
+               if (ret)
+                       goto error;
+       }
        ret = mlx5_traffic_restart(dev);
        if (ret)
                DRV_LOG(ERR, "port %u cannot disable allmulicast mode: %s",
                        dev->data->port_id, strerror(rte_errno));
+error:
+       /*
+        * rte_eth_allmulticast_disable() rollback
+        * dev->data->all_multicast in the case of failure.
+        */
+       return ret;
 }