DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] net/mlx5: align PF and VF/SF MAC addresses handling
@ 2025-05-16  7:10 Gavin Li
  2025-05-19 11:20 ` Slava Ovsiienko
  0 siblings, 1 reply; 2+ messages in thread
From: Gavin Li @ 2025-05-16  7:10 UTC (permalink / raw)
  To: matan, viacheslavo, orika, thomas, Dariusz Sosnowski, Bing Zhao,
	Suanming Mou, Nelio Laranjeiro, Yongseok Koh
  Cc: dev, rasland, stable

In the mlx5_dev_spawn function, the Virtual Function (VF) synchronizes MAC
addresses from the kernel using netlink. It queries the netdev-configured
MACs and populates the list in the PMD device data, including multicast
MAC addresses. These addresses are later used for control flow creation,
allowing traffic for the listed MACs to be received. However, the Physical
Function (PF) does not synchronize with the kernel and thus does not add
any multicast MAC address rules when enabling traffic. This discrepancy
causes the IFF_ALLMULTI ioctl code to malfunction, as it fails to disable
all multicast traffic, leaving the VF still able to see it.

To align PF and VF behavior, only unicast MAC address flows should be
added.

Fixes: 272733b5ebfd ("net/mlx5: use flow to enable unicast traffic")
Cc: stable@dpdk.org
Signed-off-by: Gavin Li <gavinl@nvidia.com>
---
 drivers/net/mlx5/linux/mlx5_os.c | 3 ++-
 drivers/net/mlx5/mlx5_trigger.c  | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index 573e846ed2..696a3e12c7 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -1603,7 +1603,8 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 	eth_dev->rx_queue_count = mlx5_rx_queue_count;
 	/* Register MAC address. */
 	claim_zero(mlx5_mac_addr_add(eth_dev, &mac, 0, 0));
-	if (sh->dev_cap.vf && sh->config.vf_nl_en)
+	/* Sync mac addresses for PF or VF/SF if vf_nl_en is true */
+	if ((!sh->dev_cap.vf && !sh->dev_cap.sf) || sh->config.vf_nl_en)
 		mlx5_nl_mac_addr_sync(priv->nl_socket_route,
 				      mlx5_ifindex(eth_dev),
 				      eth_dev->data->mac_addrs,
diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c
index 8145ad4233..485984f9b0 100644
--- a/drivers/net/mlx5/mlx5_trigger.c
+++ b/drivers/net/mlx5/mlx5_trigger.c
@@ -1714,7 +1714,7 @@ mlx5_traffic_enable(struct rte_eth_dev *dev)
 	for (i = 0; i != MLX5_MAX_MAC_ADDRESSES; ++i) {
 		struct rte_ether_addr *mac = &dev->data->mac_addrs[i];
 
-		if (!memcmp(mac, &cmp, sizeof(*mac)))
+		if (!memcmp(mac, &cmp, sizeof(*mac)) || rte_is_multicast_ether_addr(mac))
 			continue;
 		memcpy(&unicast.hdr.dst_addr.addr_bytes,
 		       mac->addr_bytes,
-- 
2.34.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: [PATCH] net/mlx5: align PF and VF/SF MAC addresses handling
  2025-05-16  7:10 [PATCH] net/mlx5: align PF and VF/SF MAC addresses handling Gavin Li
@ 2025-05-19 11:20 ` Slava Ovsiienko
  0 siblings, 0 replies; 2+ messages in thread
From: Slava Ovsiienko @ 2025-05-19 11:20 UTC (permalink / raw)
  To: Minggang(Gavin) Li, Matan Azrad, Ori Kam,
	NBU-Contact-Thomas Monjalon (EXTERNAL),
	Dariusz Sosnowski, Bing Zhao, Suanming Mou,
	NBU-Contact-N?lio Laranjeiro (EXTERNAL),
	Yongseok Koh
  Cc: dev, Raslan Darawsheh, stable

> -----Original Message-----
> From: Minggang(Gavin) Li <gavinl@nvidia.com>
> Sent: Friday, May 16, 2025 10:11 AM
> To: Matan Azrad <matan@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>; Ori Kam <orika@nvidia.com>; NBU-Contact-
> Thomas Monjalon (EXTERNAL) <thomas@monjalon.net>; Dariusz Sosnowski
> <dsosnowski@nvidia.com>; Bing Zhao <bingz@nvidia.com>; Suanming Mou
> <suanmingm@nvidia.com>; NBU-Contact-N?lio Laranjeiro (EXTERNAL)
> <nelio.laranjeiro@6wind.com>; Yongseok Koh <yskoh@mellanox.com>
> Cc: dev@dpdk.org; Raslan Darawsheh <rasland@nvidia.com>;
> stable@dpdk.org
> Subject: [PATCH] net/mlx5: align PF and VF/SF MAC addresses handling
> 
> In the mlx5_dev_spawn function, the Virtual Function (VF) synchronizes
> MAC addresses from the kernel using netlink. It queries the netdev-
> configured MACs and populates the list in the PMD device data, including
> multicast MAC addresses. These addresses are later used for control flow
> creation, allowing traffic for the listed MACs to be received. However, the
> Physical Function (PF) does not synchronize with the kernel and thus does
> not add any multicast MAC address rules when enabling traffic. This
> discrepancy causes the IFF_ALLMULTI ioctl code to malfunction, as it fails to
> disable all multicast traffic, leaving the VF still able to see it.
> 
> To align PF and VF behavior, only unicast MAC address flows should be
> added.
> 
> Fixes: 272733b5ebfd ("net/mlx5: use flow to enable unicast traffic")
> Cc: stable@dpdk.org
> Signed-off-by: Gavin Li <gavinl@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-05-19 11:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-05-16  7:10 [PATCH] net/mlx5: align PF and VF/SF MAC addresses handling Gavin Li
2025-05-19 11:20 ` Slava Ovsiienko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).