]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
net/mlx5: Add a shared devlink instance for PFs on same chip
authorJiri Pirko <jiri@nvidia.com>
Thu, 12 Mar 2026 10:04:07 +0000 (11:04 +0100)
committerJakub Kicinski <kuba@kernel.org>
Sat, 14 Mar 2026 20:08:51 +0000 (13:08 -0700)
commit2a8c8a03f306e21a0ea74c93d4332119557f4575
tree5fb34a4e749566fe020860e27af0a0938c999992
parent63fff8c0f7025a838f1afab5fc8e6ad989e4823e
net/mlx5: Add a shared devlink instance for PFs on same chip

Use the previously introduced shared devlink infrastructure to create
a shared devlink instance for mlx5 PFs that reside on the same physical
chip. The shared instance is identified by the chip's serial number
extracted from PCI VPD (V3 keyword, with fallback to serial number
for older devices).

Each PF that probes calls mlx5_shd_init() which extracts the chip serial
number and uses devlink_shd_get() to get or create the shared instance.
When a PF is removed, mlx5_shd_uninit() calls devlink_shd_put()
to release the reference. The shared instance is automatically destroyed
when the last PF is removed.

Make the PF devlink instances nested in this shared devlink instance,
allowing userspace to identify which PFs belong to the same physical
chip.

Example:

pci/0000:08:00.0: index 0
  nested_devlink:
    auxiliary/mlx5_core.eth.0
devlink_index/1: index 1
  nested_devlink:
    pci/0000:08:00.0
    pci/0000:08:00.1
auxiliary/mlx5_core.eth.0: index 2
pci/0000:08:00.1: index 3
  nested_devlink:
    auxiliary/mlx5_core.eth.1
auxiliary/mlx5_core.eth.1: index 4

Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Link: https://patch.msgid.link/20260312100407.551173-14-jiri@resnulli.us
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/Makefile
drivers/net/ethernet/mellanox/mlx5/core/main.c
drivers/net/ethernet/mellanox/mlx5/core/sh_devlink.c [new file with mode: 0644]
drivers/net/ethernet/mellanox/mlx5/core/sh_devlink.h [new file with mode: 0644]
include/linux/mlx5/driver.h