patch 'common/mlx5: fix bonding check' has been queued to stable release 25.11.1
Kevin Traynor
ktraynor at redhat.com
Thu Mar 19 11:02:30 CET 2026
Hi,
FYI, your patch has been queued to stable release 25.11.1
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 03/23/26. So please
shout if anyone has objections.
Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.
Queued patches are on a temporary branch at:
https://github.com/kevintraynor/dpdk-stable
This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable/commit/521478a5e8720c108b07dfc37214c6936a010dd1
Thanks.
Kevin
---
>From 521478a5e8720c108b07dfc37214c6936a010dd1 Mon Sep 17 00:00:00 2001
From: Dariusz Sosnowski <dsosnowski at nvidia.com>
Date: Wed, 4 Mar 2026 11:57:16 +0100
Subject: [PATCH] common/mlx5: fix bonding check
[ upstream commit 2aa207b1144abe99e7c57e5c1690ffa676a2d731 ]
mlx5 PMD supports probing a device where PF kernel netdevs
are part of a netdev bonding device in the Linux kernel.
In such scenario, there is only IB device exposed
which mlx5 PMD later uses to configure the device.
This IB device is created only one of the PFs.
PMD allowed probing this device by any of the PFs.
As part of the logic for allowing this, mlx5 common driver
checked if the name of IB device contained "bond", but this is not
always the case and depends on existence of specific udev rules.
This patch fixes that by attempting to resolve, through sysfs,
if any of the netdevs related to probed PCI device
are part of the bonding netdev, instead of relying on device name.
Fixes: f956d3d4c33c ("net/mlx5: fix probing with secondary bonding member")
Signed-off-by: Dariusz Sosnowski <dsosnowski at nvidia.com>
Acked-by: Bing Zhao <bingz at nvidia.com>
---
drivers/common/mlx5/linux/mlx5_common_os.c | 86 ++++++++++++++++++++--
drivers/common/mlx5/linux/mlx5_common_os.h | 9 +++
2 files changed, 90 insertions(+), 5 deletions(-)
diff --git a/drivers/common/mlx5/linux/mlx5_common_os.c b/drivers/common/mlx5/linux/mlx5_common_os.c
index 2867e21618..0fe4deb749 100644
--- a/drivers/common/mlx5/linux/mlx5_common_os.c
+++ b/drivers/common/mlx5/linux/mlx5_common_os.c
@@ -561,4 +561,12 @@ mlx5_os_pd_prepare(struct mlx5_common_device *cdev)
}
+static bool
+pci_addr_partial_match(const struct rte_pci_addr *addr1, const struct rte_pci_addr *addr2)
+{
+ return addr1->domain == addr2->domain &&
+ addr1->bus == addr2->bus &&
+ addr1->devid == addr2->devid;
+}
+
static struct ibv_device *
mlx5_os_get_ibv_device(const struct rte_pci_device *pci_dev)
@@ -582,4 +590,8 @@ mlx5_os_get_ibv_device(const struct rte_pci_device *pci_dev)
ret1 = mlx5_get_device_guid(addr, guid1, sizeof(guid1));
while (n-- > 0) {
+ bool pci_partial_match;
+ bool guid_match;
+ bool bond_match;
+
DRV_LOG(DEBUG, "Checking device \"%s\"..", ibv_list[n]->name);
if (mlx5_get_pci_addr(ibv_list[n]->ibdev_path, &paddr) != 0)
@@ -587,10 +599,12 @@ mlx5_os_get_ibv_device(const struct rte_pci_device *pci_dev)
if (ret1 > 0)
ret2 = mlx5_get_device_guid(&paddr, guid2, sizeof(guid2));
+ guid_match = ret1 > 0 && ret2 > 0 && memcmp(guid1, guid2, sizeof(guid1)) == 0;
+ pci_partial_match = pci_addr_partial_match(addr, &paddr);
/* Bond device can bond secondary PCIe */
- if ((strstr(ibv_list[n]->name, "bond") && !is_vf_dev &&
- ((ret1 > 0 && ret2 > 0 && !memcmp(guid1, guid2, sizeof(guid1))) ||
- (addr->domain == paddr.domain && addr->bus == paddr.bus &&
- addr->devid == paddr.devid))) ||
- !rte_pci_addr_cmp(addr, &paddr)) {
+ bond_match = !is_vf_dev &&
+ mlx5_os_is_device_bond(ibv_list[n]) &&
+ (guid_match || pci_partial_match);
+ /* IB device matches either through bond or directly. */
+ if (bond_match || !rte_pci_addr_cmp(addr, &paddr)) {
ibv_match = ibv_list[n];
break;
@@ -1161,2 +1175,64 @@ mlx5_os_interrupt_handler_destroy(struct rte_intr_handle *intr_handle,
rte_intr_instance_free(intr_handle);
}
+
+RTE_EXPORT_INTERNAL_SYMBOL(mlx5_os_is_device_bond)
+bool
+mlx5_os_is_device_bond(const void *dev)
+{
+ const struct ibv_device *ibdev;
+ char path[PATH_MAX];
+ struct dirent *e;
+ DIR *net_dir;
+ bool result;
+ int ret;
+
+ if (dev == NULL)
+ return false;
+ ibdev = dev;
+
+ DRV_LOG(DEBUG, "Checking if %s ibdev belongs to bond", ibdev->name);
+
+ ret = snprintf(path, sizeof(path), "%s/device/net", ibdev->ibdev_path);
+ if (ret < 0 || ret >= (int)sizeof(path)) {
+ DRV_LOG(DEBUG, "Unable to get netdevs path for IB device %s", ibdev->name);
+ return false;
+ }
+
+ net_dir = opendir(path);
+ if (net_dir == NULL) {
+ DRV_LOG(DEBUG, "Unable to open directory %s (%s)", path, rte_strerror(errno));
+ return false;
+ }
+
+ result = false;
+ while ((e = readdir(net_dir)) != NULL) {
+ if (e->d_name[0] == '.')
+ continue;
+
+ DRV_LOG(DEBUG, "Checking if %s netdev related to %s ibdev belongs to bond",
+ e->d_name, ibdev->name);
+
+ ret = snprintf(path, sizeof(path), "/sys/class/net/%s/master/bonding", e->d_name);
+ if (ret < 0 || ret >= (int)sizeof(path)) {
+ DRV_LOG(DEBUG, "Unable to get bond path for %s netdev", e->d_name);
+ continue;
+ }
+
+ if (access(path, F_OK) == 0) {
+ /* At least one associated netdev is part of a bond. */
+ DRV_LOG(DEBUG, "Bonding path exists for %s netdev", e->d_name);
+ result = true;
+ goto end;
+ }
+
+ DRV_LOG(DEBUG, "Unable to access bond path for %s netdev (%s)",
+ e->d_name, rte_strerror(errno));
+ }
+
+ DRV_LOG(DEBUG, "No bonded netdev related to %s ibdev found",
+ ibdev->name);
+
+end:
+ closedir(net_dir);
+ return result;
+}
diff --git a/drivers/common/mlx5/linux/mlx5_common_os.h b/drivers/common/mlx5/linux/mlx5_common_os.h
index 2e2c54f1fa..7d4e3c5fe8 100644
--- a/drivers/common/mlx5/linux/mlx5_common_os.h
+++ b/drivers/common/mlx5/linux/mlx5_common_os.h
@@ -318,3 +318,12 @@ mlx5_os_interrupt_handler_destroy(struct rte_intr_handle *intr_handle,
rte_intr_callback_fn cb, void *cb_arg);
+/**
+ * Return true if given IB device is associated with a networking bond.
+ *
+ * @param dev[in]
+ * Pointer to IB device.
+ */
+__rte_internal
+bool mlx5_os_is_device_bond(const void *dev);
+
#endif /* RTE_PMD_MLX5_COMMON_OS_H_ */
--
2.53.0
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2026-03-19 10:01:08.068641292 +0000
+++ 0032-common-mlx5-fix-bonding-check.patch 2026-03-19 10:01:07.097331262 +0000
@@ -1 +1 @@
-From 2aa207b1144abe99e7c57e5c1690ffa676a2d731 Mon Sep 17 00:00:00 2001
+From 521478a5e8720c108b07dfc37214c6936a010dd1 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 2aa207b1144abe99e7c57e5c1690ffa676a2d731 ]
+
@@ -21 +22,0 @@
-Cc: stable at dpdk.org
@@ -31 +32 @@
-index 926b56e419..fc7e9ecddc 100644
+index 2867e21618..0fe4deb749 100644
More information about the stable
mailing list