[dpdk-dev,13/17] mlx5: remove normal MAC flows when enabling promiscuous mode
Commit Message
From: Nelio Laranjeiro <nelio.laranjeiro@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@6wind.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
---
drivers/net/mlx5/mlx5_rxmode.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
@@ -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;
}