devlink: introduce shared devlink instance for PFs on same chip
Status from this message: This series was applied to netdev/net-next.git (main)
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v4 Latest13 patches 12 repliesApplied 13/13
- v313 patches 2 repliesSuperseded
- v210 patches 10 repliesSuperseded
Earlier versions · 1
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v1 | 10 patches | 6 replies | Superseded |
Patches in v4 All 13 applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/13 | devlink: expose devlink instance index over netlinkDocumentation/ include/ net/ +1 more | +10 | 0 replies | Applied |
| 2/13 | devlink: add helpers to get bus_name/dev_nameinclude/ include/ net/ +3 more | +34 | 0 replies | Applied |
| 3/13 | devlink: avoid extra iterations when found devlink is not registerednet/ | +10 | 0 replies | Applied |
| 4/13 | devlink: allow to use devlink index as a command handleDocumentation/ net/ net/ +2 more | +296 | 1 reply | Applied |
| 5/13 | devlink: support index-based lookup via bus_name/dev_name handleinclude/ net/ | +11 | 0 replies | Applied |
| 6/13 | devlink: support index-based notification filteringnet/ net/ | +14 | 0 replies | Applied |
| 7/13 | devlink: introduce __devlink_alloc() with dev driver pointernet/ net/ | +29 | 0 replies | Applied |
| 8/13 | devlink: add devlink_dev_driver_name() helper and use it in trace eventsinclude/ include/ net/ | +13 | 0 replies | Applied |
| 9/13 | devlink: add devl_warn() helper and use it in port warningsnet/ net/ | +16 | 0 replies | Applied |
| 10/13 | devlink: allow devlink instance allocation without a backing devicenet/ net/ net/ | +25 | 0 replies | Applied |
| 11/13 | devlink: introduce shared devlink instance for PFs on same chipinclude/ net/ net/ | +169 | 0 replies | Applied |
| 12/13 | documentation: networking: add shared devlink documentationDocumentation/ Documentation/ | +98 | 0 replies | Applied |
| 13/13 | net/mlx5: Add a shared devlink instance for PFs on same chipdrivers/ drivers/ drivers/ +2 more | +94 | 11 replies | Applied |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.
Cover letter [PATCH net-next v4 00/13] devlink: introduce shared devlink instance for PFs on same chip
From: Jiri Pirko <[email protected]>
Multiple PFs on a network adapter often reside on the same physical chip, running a single firmware. Some resources and configurations are inherently shared among these PFs - PTP clocks, VF group rates, firmware parameters, and others. Today there is no good object in the devlink model to attach these chip-wide configuration knobs to. Drivers resort to workarounds like pinning shared state to PF0 or maintaining ad-hoc internal structures (e.g., ice_adapter) that are invisible to userspace.
This problem was discussed extensively starting with Przemek Kitszel's "whole device devlink instance" RFC for the ice driver [1]. Several approaches for representing the parent instance were considered:
using a partial PCI BDF as the dev_name (breaks when PFs have different BDFs in VMs), creating a per-driver bus, using auxiliary devices, or using faux devices. All of these required a backing struct device for the parent devlink instance, which does not naturally exist - there is no PCI device that represents the chip as a whole.
This patchset takes a different approach: allow devlink instances to exist without any backing struct device. The instance is identified purely by its internal index, exposed over devlin netlink. This avoids fabricating fake devices and keeps the devlink handle semantics clean.
The first ten patches prepare the devlink core for device-less instances by decoupling the handle from the parent device. The last three introduce the shared devlink infrastructure and its first user in the mlx5 driver.
Example output showing the shared instance and nesting:
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
[1] https://lore.kernel.org/netdev/[email protected]/
---
Decoupled from "devlink and mlx5: Support cross-function rate scheduling" patchset to maintain 15-patches limit.
See individual patches for changelog.
Jiri Pirko (13):
devlink: expose devlink instance index over netlink
devlink: add helpers to get bus_name/dev_name
devlink: avoid extra iterations when found devlink is not registered
devlink: allow to use devlink index as a command handle
devlink: support index-based lookup via bus_name/dev_name handle
devlink: support index-based notification filtering
devlink: introduce __devlink_alloc() with dev driver pointer
devlink: add devlink_dev_driver_name() helper and use it in trace
events
devlink: add devl_warn() helper and use it in port warnings
devlink: allow devlink instance allocation without a backing device
devlink: introduce shared devlink instance for PFs on same chip
documentation: networking: add shared devlink documentation net/mlx5: Add a shared devlink instance for PFs on same chip
Documentation/netlink/specs/devlink.yaml | 58 +++ .../networking/devlink/devlink-shared.rst | 97 +++++ Documentation/networking/devlink/index.rst | 1 + .../net/ethernet/mellanox/mlx5/core/Makefile | 5 +- .../net/ethernet/mellanox/mlx5/core/main.c | 17 + .../ethernet/mellanox/mlx5/core/sh_devlink.c | 61 +++ .../ethernet/mellanox/mlx5/core/sh_devlink.h | 12 + include/linux/mlx5/driver.h | 1 + include/net/devlink.h | 10 + include/trace/events/devlink.h | 36 +- include/uapi/linux/devlink.h | 4 + net/devlink/Makefile | 2 +- net/devlink/core.c | 91 ++++- net/devlink/dev.c | 8 +- net/devlink/devl_internal.h | 34 +- net/devlink/netlink.c | 52 ++- net/devlink/netlink_gen.c | 355 +++++++++++------- net/devlink/port.c | 19 +- net/devlink/sh_dev.c | 161 ++++++++ 19 files changed, 815 insertions(+), 209 deletions(-) create mode 100644 Documentation/networking/devlink/devlink-shared.rst create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/sh_devlink.c create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/sh_devlink.h create mode 100644 net/devlink/sh_dev.c
Signature · 1 line
2.51.1