net/mlx5: preserve allmulticast flag for flow isolation mode
authorYongseok Koh <yskoh@mellanox.com>
Thu, 2 Aug 2018 21:06:32 +0000 (14:06 -0700)
committerShahaf Shuler <shahafs@mellanox.com>
Sun, 5 Aug 2018 06:47:41 +0000 (08:47 +0200)
mlx5_dev_ops_isolate doesn't have APIs for enabling/disabling allmulti
mode as it can't be enabled in flow isolation mode. If the function
pointers are null, librte APIs such as
rte_eth_allmulticast_enable/disable() fail to set the flag
(dev->data->all_multicast). The flag is used when starting traffic by
mlx5_traffic_enable(). When switching out of flow isolation mode, allmulti
mode will not be set even though it has been enabled.

Fixes: 0887aa7f27f3 ("net/mlx5: add new operations for isolated mode")
Cc: stable@dpdk.org
Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
drivers/net/mlx5/mlx5.c
drivers/net/mlx5/mlx5_rxmode.c

index 83b82f1..ec63bc6 100644 (file)
@@ -401,6 +401,8 @@ const struct eth_dev_ops mlx5_dev_ops_isolate = {
        .dev_close = mlx5_dev_close,
        .promiscuous_enable = mlx5_promiscuous_enable,
        .promiscuous_disable = mlx5_promiscuous_disable,
+       .allmulticast_enable = mlx5_allmulticast_enable,
+       .allmulticast_disable = mlx5_allmulticast_disable,
        .link_update = mlx5_link_update,
        .stats_get = mlx5_stats_get,
        .stats_reset = mlx5_stats_reset,
index 3c0373b..e74fdef 100644 (file)
@@ -81,10 +81,18 @@ 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 (((struct priv *)dev->data->dev_private)->config.vf)
+       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)
@@ -101,10 +109,11 @@ 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 (((struct priv *)dev->data->dev_private)->config.vf)
+       if (priv->config.vf)
                mlx5_nl_allmulti(dev, 0);
        ret = mlx5_traffic_restart(dev);
        if (ret)