patch 'common/mlx5: fix bonding check' has been queued to stable release 23.11.7
Shani Peretz
shperetz at nvidia.com
Wed Apr 15 11:59:19 CEST 2026
Hi,
FYI, your patch has been queued to stable release 23.11.7
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 04/19/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/shanipr/dpdk-stable
This queued commit can be viewed at:
https://github.com/shanipr/dpdk-stable/commit/f68d9907d4a803f9d55efb4d42d12c9445f63e10
Thanks.
Shani
---
>From f68d9907d4a803f9d55efb4d42d12c9445f63e10 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 | 85 ++++++++++++++++++++--
drivers/common/mlx5/linux/mlx5_common_os.h | 9 +++
drivers/common/mlx5/version.map | 1 +
3 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 41345e1597..e6f4891576 100644
--- a/drivers/common/mlx5/linux/mlx5_common_os.c
+++ b/drivers/common/mlx5/linux/mlx5_common_os.c
@@ -555,6 +555,14 @@ mlx5_os_pd_prepare(struct mlx5_common_device *cdev)
#endif /* HAVE_IBV_FLOW_DV_SUPPORT */
}
+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)
{
@@ -576,17 +584,23 @@ 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)
continue;
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;
}
@@ -1097,3 +1111,64 @@ mlx5_os_interrupt_handler_destroy(struct rte_intr_handle *intr_handle,
mlx5_intr_callback_unregister(intr_handle, cb, cb_arg);
rte_intr_instance_free(intr_handle);
}
+
+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 e8aa1d46ec..5be27080f6 100644
--- a/drivers/common/mlx5/linux/mlx5_common_os.h
+++ b/drivers/common/mlx5/linux/mlx5_common_os.h
@@ -311,4 +311,13 @@ void
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_ */
diff --git a/drivers/common/mlx5/version.map b/drivers/common/mlx5/version.map
index e43164235e..ca734dcb3a 100644
--- a/drivers/common/mlx5/version.map
+++ b/drivers/common/mlx5/version.map
@@ -143,6 +143,7 @@ INTERNAL {
mlx5_nl_vlan_vmwa_create; # WINDOWS_NO_EXPORT
mlx5_nl_vlan_vmwa_delete; # WINDOWS_NO_EXPORT
mlx5_nl_get_mtu_bounds; # WINDOWS_NO_EXPORT
+ mlx5_os_is_device_bond; # WINDOWS_NO_EXPORT
mlx5_os_umem_dereg;
mlx5_os_umem_reg;
--
2.43.0
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2026-04-14 14:44:30.715028650 +0300
+++ 0018-common-mlx5-fix-bonding-check.patch 2026-04-14 14:44:28.481433000 +0300
@@ -1 +1 @@
-From 2aa207b1144abe99e7c57e5c1690ffa676a2d731 Mon Sep 17 00:00:00 2001
+From f68d9907d4a803f9d55efb4d42d12c9445f63e10 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 2aa207b1144abe99e7c57e5c1690ffa676a2d731 ]
+
@@ -21 +22,0 @@
-Cc: stable at dpdk.org
@@ -26 +27 @@
- drivers/common/mlx5/linux/mlx5_common_os.c | 86 ++++++++++++++++++++--
+ drivers/common/mlx5/linux/mlx5_common_os.c | 85 ++++++++++++++++++++--
@@ -28 +29,2 @@
- 2 files changed, 90 insertions(+), 5 deletions(-)
+ drivers/common/mlx5/version.map | 1 +
+ 3 files changed, 90 insertions(+), 5 deletions(-)
@@ -31 +33 @@
-index 926b56e419..fc7e9ecddc 100644
+index 41345e1597..e6f4891576 100644
@@ -34 +36 @@
-@@ -560,6 +560,14 @@ mlx5_os_pd_prepare(struct mlx5_common_device *cdev)
+@@ -555,6 +555,14 @@ mlx5_os_pd_prepare(struct mlx5_common_device *cdev)
@@ -49 +51 @@
-@@ -581,17 +589,23 @@ mlx5_os_get_ibv_device(const struct rte_pci_device *pci_dev)
+@@ -576,17 +584,23 @@ mlx5_os_get_ibv_device(const struct rte_pci_device *pci_dev)
@@ -78 +80 @@
-@@ -1160,3 +1174,65 @@ mlx5_os_interrupt_handler_destroy(struct rte_intr_handle *intr_handle,
+@@ -1097,3 +1111,64 @@ mlx5_os_interrupt_handler_destroy(struct rte_intr_handle *intr_handle,
@@ -83 +84,0 @@
-+RTE_EXPORT_INTERNAL_SYMBOL(mlx5_os_is_device_bond)
@@ -145 +146 @@
-index 2e2c54f1fa..7d4e3c5fe8 100644
+index e8aa1d46ec..5be27080f6 100644
@@ -148 +149 @@
-@@ -317,4 +317,13 @@ void
+@@ -311,4 +311,13 @@ void
@@ -161,0 +163,12 @@
+diff --git a/drivers/common/mlx5/version.map b/drivers/common/mlx5/version.map
+index e43164235e..ca734dcb3a 100644
+--- a/drivers/common/mlx5/version.map
++++ b/drivers/common/mlx5/version.map
+@@ -143,6 +143,7 @@ INTERNAL {
+ mlx5_nl_vlan_vmwa_create; # WINDOWS_NO_EXPORT
+ mlx5_nl_vlan_vmwa_delete; # WINDOWS_NO_EXPORT
+ mlx5_nl_get_mtu_bounds; # WINDOWS_NO_EXPORT
++ mlx5_os_is_device_bond; # WINDOWS_NO_EXPORT
+
+ mlx5_os_umem_dereg;
+ mlx5_os_umem_reg;
More information about the stable
mailing list