linux/net/devlink
Jiri Pirko 1850e76b38 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>
2026-03-14 13:08:50 -07:00
..
Makefile devlink: introduce shared devlink instance for PFs on same chip 2026-03-14 13:08:50 -07:00
core.c devlink: allow devlink instance allocation without a backing device 2026-03-14 13:08:49 -07:00
dev.c devlink: allow devlink instance allocation without a backing device 2026-03-14 13:08:49 -07:00
devl_internal.h devlink: allow devlink instance allocation without a backing device 2026-03-14 13:08:49 -07:00
dpipe.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
health.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
linecard.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
netlink.c devlink: support index-based notification filtering 2026-03-14 13:08:48 -07:00
netlink_gen.c devlink: allow to use devlink index as a command handle 2026-03-14 13:08:47 -07:00
netlink_gen.h tools: ynl-gen: add regeneration comment 2025-11-25 19:20:42 -08:00
param.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
port.c devlink: add devl_warn() helper and use it in port warnings 2026-03-14 13:08:49 -07:00
rate.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
region.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
resource.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
sb.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
sh_dev.c devlink: introduce shared devlink instance for PFs on same chip 2026-03-14 13:08:50 -07:00
trap.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00