public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC net-next 0/4] devlink: Add boot-time defaults
@ 2026-05-06 12:37 Mark Bloch
  2026-05-06 12:37 ` [RFC net-next 1/4] devlink: Add infrastructure for " Mark Bloch
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Mark Bloch @ 2026-05-06 12:37 UTC (permalink / raw)
  To: Eric Dumazet, Jakub Kicinski, Paolo Abeni, Andrew Lunn,
	David S. Miller
  Cc: Jonathan Corbet, Shuah Khan, Jiri Pirko, Simon Horman,
	Saeed Mahameed, Leon Romanovsky, Tariq Toukan, Mark Bloch,
	Andrew Morton, Borislav Petkov (AMD), Randy Dunlap, Dave Hansen,
	Christian Brauner, Petr Mladek, Peter Zijlstra (Intel),
	Thomas Gleixner, Pawan Gupta, Dapeng Mi, Kees Cook, Marco Elver,
	Eric Biggers, Li RongQing, Paul E. McKenney, linux-doc,
	linux-kernel, netdev, linux-rdma

This series adds a devlink= kernel command line parameter for applying
selected devlink settings during device initialization.

Following a discussion with Jakub[1], I am sending this RFC to get the
conversation moving. I started from Jakub's example/request and extended
it to cover requirements from production systems and configurations that
customers use.

One important caveat is that the parsing logic in this RFC was written
with AI assistance. I am also not sure whether the resulting syntax and
parser are too complex for a kernel command line interface. This is part
of why I am sending it as an RFC: to understand what direction and level
of complexity would be acceptable to people.

The implementation is intended to support the following properties:

- A system may have multiple devlink devices that usually need the same
  configuration. For a configuration such as eswitch mode switchdev, a
  user should be able to specify multiple devices to which that
  configuration applies.

- There may be ordering dependencies between options. For example, in
  mlx5, flow_steering_mode should be set before moving to switchdev.
  With this in mind, defaults are applied per device in the left-to-right
  order in which they appear on the command line.

The intent is to let deployments set devlink defaults before normal
userspace orchestration runs, while still using devlink concepts and
driver callbacks rather than adding driver-specific module parameters.
A default is scoped to one or more devlink handles, for example:

  devlink=[pci/0000:08:00.0]:esw:mode:switchdev
  devlink=[pci/0000:08:00.0]:param:flow_steering_mode:smfs
  devlink=[pci/0000:08:00.0,pci/0000:08:00.1]:param:flow_steering_mode:hmfs,[pci/0000:08:00.0,pci/0000:08:00.1]:esw:mode:switchdev

The infrastructure stores parsed defaults per devlink handle and
applies them in command-line order when a matching devlink instance is
ready. Duplicate defaults for the same handle are rejected so the
resulting state is deterministic.

The first supported command is eswitch mode configuration. The second
is generic runtime devlink parameter setting. Parameter values are
parsed according to the registered devlink parameter type and are
applied only in runtime configuration mode.

mlx5 wires this into device initialization after the devlink instance
is registered and after mlx5 devlink operations and parameters are
available, so both eswitch mode defaults and runtime parameter
defaults can be applied to matching devlink devices.

Patch 1 adds the generic devlink boot-default parser, storage,
duplicate handling and devl_apply_defaults() API.

Patch 2 adds eswitch mode defaults and documents the devlink= syntax.

Patch 3 adds runtime devlink parameter defaults, including string to
devlink parameter value conversion.

Patch 4 calls devl_apply_defaults() from mlx5 device initialization.

[1] https://lore.kernel.org/all/20260502184153.4fd8d06f@kernel.org/

Mark Bloch (4):
  devlink: Add infrastructure for boot-time defaults
  devlink: Add eswitch mode boot default
  devlink: Add runtime parameter boot defaults
  net/mlx5: Apply devlink boot defaults during init

 .../admin-guide/kernel-parameters.txt         |  26 +
 .../networking/devlink/devlink-defaults.rst   | 115 ++++
 Documentation/networking/devlink/index.rst    |   1 +
 .../net/ethernet/mellanox/mlx5/core/main.c    |   2 +
 include/net/devlink.h                         |   1 +
 net/devlink/core.c                            | 591 ++++++++++++++++++
 net/devlink/devl_internal.h                   |   3 +
 net/devlink/param.c                           |  70 +++
 8 files changed, 809 insertions(+)
 create mode 100644 Documentation/networking/devlink/devlink-defaults.rst


base-commit: 7e0cccae6b45b12eaf71fc3ab8eb133bb50b28ad
-- 
2.34.1

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-05-06 17:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-06 12:37 [RFC net-next 0/4] devlink: Add boot-time defaults Mark Bloch
2026-05-06 12:37 ` [RFC net-next 1/4] devlink: Add infrastructure for " Mark Bloch
2026-05-06 12:37 ` [RFC net-next 2/4] devlink: Add eswitch mode boot default Mark Bloch
2026-05-06 12:37 ` [RFC net-next 3/4] devlink: Add runtime parameter boot defaults Mark Bloch
2026-05-06 12:37 ` [RFC net-next 4/4] net/mlx5: Apply devlink boot defaults during init Mark Bloch
2026-05-06 15:22 ` [RFC net-next 0/4] devlink: Add boot-time defaults Jiri Pirko
2026-05-06 17:35   ` Mark Bloch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox