DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: stable@dpdk.org, Dariusz Sosnowski <dsosnowski@nvidia.com>,
	Viacheslav Ovsiienko <viacheslavo@nvidia.com>,
	Bing Zhao <bingz@nvidia.com>, Ori Kam <orika@nvidia.com>,
	Suanming Mou <suanmingm@nvidia.com>,
	Matan Azrad <matan@nvidia.com>,
	Nelio Laranjeiro <nelio.laranjeiro@6wind.com>,
	Adrien Mazarguil <adrien.mazarguil@6wind.com>
Subject: [PATCH 2/2] net/mlx5: reset promiscuous modes on device close
Date: Fri, 31 Jul 2026 11:23:32 +0200	[thread overview]
Message-ID: <20260731092332.3833632-2-david.marchand@redhat.com> (raw)
In-Reply-To: <20260731092332.3833632-1-david.marchand@redhat.com>

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: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 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	other threads:[~2026-07-31  9:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-31  9:23 [PATCH 1/2] net/mlx5: fix promiscuous inconsistency on port start David Marchand
2026-07-31  9:23 ` David Marchand [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260731092332.3833632-2-david.marchand@redhat.com \
    --to=david.marchand@redhat.com \
    --cc=adrien.mazarguil@6wind.com \
    --cc=bingz@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=dsosnowski@nvidia.com \
    --cc=matan@nvidia.com \
    --cc=nelio.laranjeiro@6wind.com \
    --cc=orika@nvidia.com \
    --cc=stable@dpdk.org \
    --cc=suanmingm@nvidia.com \
    --cc=viacheslavo@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox