Since the DPDK port is backed by a kernel netdevice, leaving this
netdevice in promiscuous mode may have unexpected consequences.

Reset promiscuous and all multicast modes on close.

Fixes: dd4bb90bc3cb ("net/mlx5: use Netlink to enable promisc/allmulti mode")
Cc: [email protected]

Signed-off-by: David Marchand <[email protected]>
---
 drivers/net/mlx5/mlx5.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 3fa38694e5..c7b0d3ef8b 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -2498,6 +2498,16 @@ mlx5_dev_close(struct rte_eth_dev *dev)
                mlx5_free(priv->rss_conf.rss_key);
        if (priv->reta_idx != NULL)
                mlx5_free(priv->reta_idx);
+       if (priv->sh->dev_cap.vf || priv->sh->dev_cap.sf) {
+               if (mlx5_os_get_promisc(dev)) {
+                       DRV_LOG(DEBUG, "port %u resetting promiscuous mode", 
dev->data->port_id);
+                       mlx5_os_set_promisc(dev, 0);
+               }
+               if (mlx5_os_get_allmulti(dev)) {
+                       DRV_LOG(DEBUG, "port %u resetting all multicast mode", 
dev->data->port_id);
+                       mlx5_os_set_allmulti(dev, 0);
+               }
+       }
        if (sh->dev_cap.vf)
                mlx5_os_mac_addr_flush(dev);
        if (priv->nl_socket_route >= 0)
-- 
2.54.0

Reply via email to