]> git.ipfire.org Git - thirdparty/linux.git/commit
devlink: introduce shared devlink instance for PFs on same chip
authorJiri Pirko <jiri@nvidia.com>
Thu, 12 Mar 2026 10:04:05 +0000 (11:04 +0100)
committerJakub Kicinski <kuba@kernel.org>
Sat, 14 Mar 2026 20:08:50 +0000 (13:08 -0700)
commit1850e76b38049548ecb03c62bb10d40b94eecaac
tree8080ffaf22c436b6e34c3c063fd8a10f70cda793
parenta4c6d53e5fd61829f707b7a723dd2937ed67c803
devlink: introduce shared devlink instance for PFs on same chip

Multiple PFs may reside on the same physical chip, running a single
firmware. Some of the resources and configurations may be shared among
these PFs. Currently, there is no good object to pin the configuration
knobs on.

Introduce a shared devlink instance, instantiated upon probe of
the first PF and removed during remove of the last PF. The shared
devlink instance is not backed by any device device, as there is
no PCI device related to it.

The implementation uses reference counting to manage the lifecycle:
each PF that probes calls devlink_shd_get() to get or create
the shared instance, and calls devlink_shd_put() when it removes.
The shared instance is automatically destroyed when the last PF removes.

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-12-jiri@resnulli.us
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/net/devlink.h
net/devlink/Makefile
net/devlink/sh_dev.c [new file with mode: 0644]