[dpdk-dev] [PATCH 13/17] mlx5: remove normal MAC flows when enabling promiscuous mode

Adrien Mazarguil adrien.mazarguil at 6wind.com
Mon Oct 5 19:54:48 CEST 2015


From: Nelio Laranjeiro <nelio.laranjeiro at 6wind.com>

Normal MAC flows are not necessary when promiscuous mode is enabled.
Removing them frees up hardware resources.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro at 6wind.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil at 6wind.com>
---
 drivers/net/mlx5/mlx5_rxmode.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_rxmode.c b/drivers/net/mlx5/mlx5_rxmode.c
index aab38ee..578f2fb 100644
--- a/drivers/net/mlx5/mlx5_rxmode.c
+++ b/drivers/net/mlx5/mlx5_rxmode.c
@@ -123,6 +123,8 @@ priv_promiscuous_enable(struct priv *priv)
 		struct hash_rxq *hash_rxq = &(*priv->hash_rxqs)[i];
 		int ret;
 
+		/* Remove normal MAC flows first. */
+		hash_rxq_mac_addrs_del(hash_rxq);
 		ret = hash_rxq_promiscuous_enable(hash_rxq);
 		if (!ret)
 			continue;
@@ -130,6 +132,9 @@ priv_promiscuous_enable(struct priv *priv)
 		while (i != 0) {
 			hash_rxq = &(*priv->hash_rxqs)[--i];
 			hash_rxq_promiscuous_disable(hash_rxq);
+			/* Restore MAC flows. */
+			if (priv->started)
+				hash_rxq_mac_addrs_add(hash_rxq);
 		}
 		return ret;
 	}
@@ -189,8 +194,14 @@ priv_promiscuous_disable(struct priv *priv)
 
 	if (!priv->promisc)
 		return;
-	for (i = 0; (i != priv->hash_rxqs_n); ++i)
-		hash_rxq_promiscuous_disable(&(*priv->hash_rxqs)[i]);
+	for (i = 0; (i != priv->hash_rxqs_n); ++i) {
+		struct hash_rxq *hash_rxq = &(*priv->hash_rxqs)[i];
+
+		hash_rxq_promiscuous_disable(hash_rxq);
+		/* Restore MAC flows. */
+		if (priv->started)
+			hash_rxq_mac_addrs_add(hash_rxq);
+	}
 	priv->promisc = 0;
 }
 
-- 
2.1.0



More information about the dev mailing list