[2/2] net/mlx5: preserve allmulti flag for flow isolation mode

Message ID 20180802010557.16648-2-yskoh@mellanox.com (mailing list archive)
State Superseded, archived
Delegated to: Shahaf Shuler
Headers
Series None |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Yongseok Koh Aug. 2, 2018, 1:05 a.m. UTC
  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). Also, there's need to preserve allmulti mode
setting when toggling flow isolation mode. Allmulti mode, if enabled,
should be disabled when switching to flow isolation mode and vice versa.

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        | 2 ++
 drivers/net/mlx5/mlx5_flow.c   | 6 ++++++
 drivers/net/mlx5/mlx5_rxmode.c | 8 ++++++--
 3 files changed, 14 insertions(+), 2 deletions(-)
  

Patch

diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 83b82f11ab..ec63bc6e22 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -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,
diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 268d1f056c..fcaa7ddfc3 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -3345,11 +3345,17 @@  mlx5_flow_isolate(struct rte_eth_dev *dev,
 			mlx5_promiscuous_disable(dev);
 			dev->data->promiscuous = 1;
 		}
+		if (dev->data->all_multicast) {
+			mlx5_allmulticast_disable(dev);
+			dev->data->all_multicast = 1;
+		}
 	} else {
 		dev->dev_ops = &mlx5_dev_ops;
 		/* Take back disabled features if needed. */
 		if (dev->data->promiscuous)
 			mlx5_promiscuous_enable(dev);
+		if (dev->data->all_multicast)
+			mlx5_allmulticast_enable(dev);
 	}
 	return 0;
 }
diff --git a/drivers/net/mlx5/mlx5_rxmode.c b/drivers/net/mlx5/mlx5_rxmode.c
index 0ed4c1a174..5b73f3eb8b 100644
--- a/drivers/net/mlx5/mlx5_rxmode.c
+++ b/drivers/net/mlx5/mlx5_rxmode.c
@@ -76,10 +76,13 @@  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)
+		return;
+	if (priv->config.vf)
 		mlx5_nl_allmulti(dev, 1);
 	ret = mlx5_traffic_restart(dev);
 	if (ret)
@@ -96,10 +99,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)