git: 0e2175cef502 - main - libmlx5: sync PCI device allowlist with mlx5_core_pci_table

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Wed, 17 Jun 2026 18:23:54 UTC
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=0e2175cef5027728c0ca1ff98366cf6ecfbe2db3

commit 0e2175cef5027728c0ca1ff98366cf6ecfbe2db3
Author:     Slava Shwartsman <slavash@nvidia.com>
AuthorDate: 2026-05-04 11:19:36 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-06-17 18:23:14 +0000

    libmlx5: sync PCI device allowlist with mlx5_core_pci_table
    
    Userspace mlx5_driver_init() only attached when vendor/device matched
    hca_table, while the kernel already probed additional Mellanox PCI IDs
    That mismatch prevented libibverbs from loading the mlx5 provider on
    those HCAs.
    
    Extend hca_table to mirror mlx5_core_pci_table and add cross-references
    so future kernel ID additions are paired with a userspace update.
    
    Reviewed by:    kib
    Tested by:      Wafa Hamzah <wafah@nvidia.com>
    Sponsored by:   Nvidia networking
    MFC after:      1 week
---
 contrib/ofed/libmlx5/mlx5.c        | 19 +++++++++++++++++++
 sys/dev/mlx5/mlx5_core/mlx5_main.c |  4 ++++
 2 files changed, 23 insertions(+)

diff --git a/contrib/ofed/libmlx5/mlx5.c b/contrib/ofed/libmlx5/mlx5.c
index 6b1cb770ddd8..6fe6cf594c3b 100644
--- a/contrib/ofed/libmlx5/mlx5.c
+++ b/contrib/ofed/libmlx5/mlx5.c
@@ -67,6 +67,11 @@ static struct {
 	unsigned		vendor;
 	unsigned		device;
 } hca_table[] = {
+	/*
+	 * PCI IDs must match mlx5_core_pci_table in
+	 * sys/dev/mlx5/mlx5_core/mlx5_main.c so userspace loads for every
+	 * mlx5 device the kernel probes.
+	 */
 	HCA(MELLANOX, 4113),	/* MT4113 Connect-IB */
 	HCA(MELLANOX, 4114),	/* Connect-IB Virtual Function */
 	HCA(MELLANOX, 4115),	/* ConnectX-4 */
@@ -82,9 +87,23 @@ static struct {
 	HCA(MELLANOX, 4125),	/* ConnectX-6 DX */
 	HCA(MELLANOX, 4126),	/* ConnectX family mlx5Gen Virtual Function */
 	HCA(MELLANOX, 4127),	/* ConnectX-6 LX */
+	HCA(MELLANOX, 4128),
 	HCA(MELLANOX, 4129),	/* ConnectX-7 */
+	HCA(MELLANOX, 4130),
 	HCA(MELLANOX, 4131),	/* ConnectX-8 */
+	HCA(MELLANOX, 4132),
 	HCA(MELLANOX, 4133),	/* ConnectX-9 */
+	HCA(MELLANOX, 4134),
+	HCA(MELLANOX, 4135),
+	HCA(MELLANOX, 4136),
+	HCA(MELLANOX, 4137),
+	HCA(MELLANOX, 4138),
+	HCA(MELLANOX, 4139),
+	HCA(MELLANOX, 4140),
+	HCA(MELLANOX, 4141),
+	HCA(MELLANOX, 4142),
+	HCA(MELLANOX, 4143),
+	HCA(MELLANOX, 4144),
 	HCA(MELLANOX, 41682),	/* BlueField integrated ConnectX-5 network controller */
 	HCA(MELLANOX, 41683),	/* BlueField integrated ConnectX-5 network controller VF */
 	HCA(MELLANOX, 41686),	/* BlueField-2 integrated ConnectX-6 Dx network controller */
diff --git a/sys/dev/mlx5/mlx5_core/mlx5_main.c b/sys/dev/mlx5/mlx5_core/mlx5_main.c
index 058085348a3f..184457b7d0b5 100644
--- a/sys/dev/mlx5/mlx5_core/mlx5_main.c
+++ b/sys/dev/mlx5/mlx5_core/mlx5_main.c
@@ -2105,6 +2105,10 @@ static void shutdown_one(struct pci_dev *pdev)
 	mlx5_pci_disable_device(dev);
 }
 
+/*
+ * When adding device IDs, also update hca_table in
+ * contrib/ofed/libmlx5/mlx5.c or libibverbs will reject the device.
+ */
 static const struct pci_device_id mlx5_core_pci_table[] = {
 	{ PCI_VDEVICE(MELLANOX, 4113) }, /* Connect-IB */
 	{ PCI_VDEVICE(MELLANOX, 4114) }, /* Connect-IB VF */