* [PATCH] net/mlx5/windows: fix MAC address ownership tracking
@ 2025-12-09 12:24 Itai Sharoni
0 siblings, 0 replies; only message in thread
From: Itai Sharoni @ 2025-12-09 12:24 UTC (permalink / raw)
To: dev
Cc: mkashani, rasland, Itai Sharoni, stable, Bing Zhao,
Dariusz Sosnowski, Viacheslav Ovsiienko, Ori Kam, Suanming Mou,
Matan Azrad, Gavin Li
The Windows implementation was not properly tracking MAC address
ownership via the mac_own bitfield, unlike the Linux implementation.
This caused issues with control flow creation for MAC addresses.
Commit 8c06434cd9e4 ("net/mlx5: fix multicast") added a check to skip
creating control flows for MAC addresses where the mac_own bit is not
set. Since Windows never set these bits, the primary MAC address flow
was skipped, resulting in packet drops when promiscuous mode is
disabled.
Update all three MAC address ownership functions to properly manage
the mac_own bitfield:
- mlx5_os_mac_addr_add: Set mac_own bit when adding the device's
primary MAC address (the only MAC that Windows supports)
- mlx5_os_mac_addr_remove: Clear mac_own bit for the specified index
to maintain internal tracking consistency
- mlx5_os_mac_addr_flush: Iterate and clear all mac_own bits during
device cleanup
While Windows cannot add or remove MAC addresses from hardware (no
Netlink equivalent), proper bitfield tracking is essential for internal
state consistency and correct control flow management.
Fixes: 8c06434cd9e4 ("net/mlx5: fix multicast")
Cc: stable@dpdk.org
Signed-off-by: Itai Sharoni <isharoni@nvidia.com>
Acked-by: Bing Zhao <bingz@nvidia.com>
---
drivers/net/mlx5/windows/mlx5_os.c | 32 +++++++++++++++++++-----------
1 file changed, 20 insertions(+), 12 deletions(-)
diff --git a/drivers/net/mlx5/windows/mlx5_os.c b/drivers/net/mlx5/windows/mlx5_os.c
index 4eadc872a5..4a00c28009 100644
--- a/drivers/net/mlx5/windows/mlx5_os.c
+++ b/drivers/net/mlx5/windows/mlx5_os.c
@@ -689,23 +689,27 @@ mlx5_os_read_dev_stat(struct mlx5_priv *priv, const char *ctr_name,
/**
* Flush device MAC addresses
- * Currently it has no support under Windows.
- *
+ * Currently Windows does not support adding and removing MAC addresses,
+ * This function resets the mac_own bit for all MAC addresses for internal tracking.
* @param dev
* Pointer to Ethernet device structure.
- *
*/
void
mlx5_os_mac_addr_flush(struct rte_eth_dev *dev)
{
- (void)dev;
- DRV_LOG(WARNING, "%s: is not supported", __func__);
+ struct mlx5_priv *priv = dev->data->dev_private;
+ int i;
+
+ for (i = MLX5_MAX_MAC_ADDRESSES - 1; i >= 0; --i) {
+ if (BITFIELD_ISSET(priv->mac_own, i))
+ BITFIELD_RESET(priv->mac_own, i);
+ }
}
/**
* Remove a MAC address from device
- * Currently it has no support under Windows.
- *
+ * Currently Windows does not support adding and removing MAC addresses,
+ * This function resets the mac_own bit for the specified index for internal tracking.
* @param dev
* Pointer to Ethernet device structure.
* @param index
@@ -714,14 +718,16 @@ mlx5_os_mac_addr_flush(struct rte_eth_dev *dev)
void
mlx5_os_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index)
{
- (void)dev;
- (void)(index);
- DRV_LOG(WARNING, "%s: is not supported", __func__);
+ struct mlx5_priv *priv = dev->data->dev_private;
+
+ if (index < MLX5_MAX_MAC_ADDRESSES)
+ BITFIELD_RESET(priv->mac_own, index);
}
/**
* Adds a MAC address to the device
- * Currently it has no support under Windows.
+ * Currently Windows does not support adding and removing MAC addresses,
+ * This function sets the mac_own bit only if the MAC address already exists.
*
* @param dev
* Pointer to Ethernet device structure.
@@ -737,7 +743,7 @@ int
mlx5_os_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac,
uint32_t index)
{
- (void)index;
+ struct mlx5_priv *priv = dev->data->dev_private;
struct rte_ether_addr lmac;
if (mlx5_get_mac(dev, &lmac.addr_bytes)) {
@@ -752,6 +758,8 @@ mlx5_os_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac,
"adding new mac address to device is unsupported");
return -ENOTSUP;
}
+ /* Mark this MAC address as owned by the PMD */
+ BITFIELD_SET(priv->mac_own, index);
return 0;
}
--
2.28.0.windows.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-12-09 12:24 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-09 12:24 [PATCH] net/mlx5/windows: fix MAC address ownership tracking Itai Sharoni
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).