Skip to contentSkip to conversation

devlink: Add boot-time defaults

RFC Superseded Mark Bloch 4 participants 27 messages May 6 – May 14

Subsystems (6)

v1 of 7 Superseded Latest is v7 →

lore
Share & tools
lore

Mark Bloch

author maintainer
#0 lore raw

cover devlink: Add boot-time defaults

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/[email protected]/

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

Signature · 1 line
2.34.1
author maintainer
#1 lore raw

RFC 1/4 devlink: Add infrastructure for boot-time defaults

Add generic devlink boot-default infrastructure driven by the devlink= kernel command line parameter.

The parser stores defaults per devlink handle using the same bus/device handle format exposed by devlink. Each handle keeps an ordered list of parsed commands so that defaults can later be applied in command-line order when the matching devlink instance is initialized.

This commit only adds the generic parsing, storage, duplicate handling and devl_apply_defaults() API. Concrete default commands are added in later commits.

---
 include/net/devlink.h |   1 +
 net/devlink/core.c    | 441 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 442 insertions(+)
include/net/devlink.h +1 -0
index bcd31de1f890..058654d6800f 100644
@@ -1622,6 +1622,7 @@ int devl_trylock(struct devlink *devlink);
 void devl_unlock(struct devlink *devlink);
 void devl_assert_locked(struct devlink *devlink);
 bool devl_lock_is_held(struct devlink *devlink);
+int devl_apply_defaults(struct devlink *devlink);
 DEFINE_GUARD(devl, struct devlink *, devl_lock(_T), devl_unlock(_T));
 
 struct ib_device;
net/devlink/core.c +441 -0

466 lines not on this page · raw message

Signature · 1 line
2.34.1
author maintainer
#2 lore raw

RFC 2/4 devlink: Add eswitch mode boot default

In reply to Mark Bloch

Add support for configuring the devlink eswitch mode from the devlink= kernel command line parameter.

The supported syntax is:

devlink=[<handle>]:esw:mode:<mode>

where <mode> is one of legacy, switchdev or switchdev_inactive. The default is applied through the existing eswitch_mode_set() devlink operation, matching the userspace devlink eswitch set command.

Document the devlink= syntax and the eswitch mode default.

---
 .../admin-guide/kernel-parameters.txt         |  24 ++++
 .../networking/devlink/devlink-defaults.rst   |  99 +++++++++++++++
 Documentation/networking/devlink/index.rst    |   1 +
 net/devlink/core.c                            | 114 ++++++++++++++++++
 4 files changed, 238 insertions(+)
 create mode 100644 Documentation/networking/devlink/devlink-defaults.rst
Documentation/admin-guide/kernel-parameters.txt +24 -0
index 7834ee927310..150202882870 100644
@@ -1278,6 +1278,30 @@ Kernel parameters
 	dell_smm_hwmon.fan_max=
 			[HW] Maximum configurable fan speed.
 
+	devlink=	[NET]
+			Format:
+			<entry>[,<entry>...]
+
+			<entry>:
+			[<handle>[,<handle>...]]:<cmd>:<cmd-options>
+
+			<handle>:
+			<bus-name>/<dev-name>
+
+			Configure default devlink settings for matching
+			devlink instances during device initialization.
+
+			Currently supported settings:
+			esw:mode:{ legacy | switchdev | switchdev_inactive }
+
+			Examples:
+			devlink=[pci/0000:08:00.0]:esw:mode:switchdev
+			devlink=[pci/0000:08:00.0,pci/0000:08:00.1]:esw:mode:legacy
+			devlink=[pci/0000:08:00.0]:esw:mode:switchdev,[pci/0000:08:00.1]:esw:mode:switchdev_inactive
+
+			See Documentation/networking/devlink/devlink-defaults.rst
+			for the full syntax and duplicate handling rules.
+
 	dfltcc=		[HW,S390]
 			Format: { on | off | def_only | inf_only | always }
 			on:       s390 zlib hardware support for compression on
Documentation/networking/devlink/devlink-defaults.rst new file +99 -0

99 lines not on this page · raw message

Documentation/networking/devlink/index.rst +1 -0
index f7ba7dcf477d..0d27a7008b14 100644
@@ -56,6 +56,7 @@ general.
    :maxdepth: 1
 
    devlink-dpipe
+   devlink-defaults
    devlink-eswitch-attr
    devlink-flash
    devlink-health
net/devlink/core.c +114 -0

123 lines not on this page · raw message

Signature · 1 line
2.34.1
author maintainer
#3 lore raw

RFC 3/4 devlink: Add runtime parameter boot defaults

In reply to Mark Bloch

Add support for setting devlink device parameters from the devlink= kernel command line parameter.

The supported syntax is:

devlink=[<handle>]:param:<name>:<value>

Parameter values are parsed according to the registered devlink parameter type and are applied in runtime configuration mode. Driverinit and permanent configuration modes are intentionally not part of the boot-default syntax.

Add a helper that finds a parameter by name, verifies runtime mode support, converts the string value, runs the parameter validator and invokes the existing set callback.

---
 .../admin-guide/kernel-parameters.txt         |   2 +
 .../networking/devlink/devlink-defaults.rst   |  18 ++-
 net/devlink/core.c                            | 110 ++++++++++++------
 net/devlink/devl_internal.h                   |   3 +
 net/devlink/param.c                           |  70 +++++++++++
 5 files changed, 165 insertions(+), 38 deletions(-)
Documentation/admin-guide/kernel-parameters.txt +2 -0
index 150202882870..761ae45b8607 100644
@@ -1293,9 +1293,11 @@ Kernel parameters
 
 			Currently supported settings:
 			esw:mode:{ legacy | switchdev | switchdev_inactive }
+			param:<name>:<value>
 
 			Examples:
 			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]:esw:mode:legacy
 			devlink=[pci/0000:08:00.0]:esw:mode:switchdev,[pci/0000:08:00.1]:esw:mode:switchdev_inactive
 
Documentation/networking/devlink/devlink-defaults.rst +17 -1
index 7d6ccaddca86..0d4036e59e88 100644
@@ -55,13 +55,16 @@ The following syntax rules apply:
 * Defaults for the same handle are applied in command-line order.
 * The same ``esw`` attribute may be specified only once for a given devlink
   handle.
+* The same ``param`` name may be specified only once for a given devlink
+  handle.
 * Duplicate entries for the same handle are rejected and all devlink defaults
   are ignored.
+* Parameter names and values must not contain ``:`` or ``,``.
 
 Supported defaults
 ==================
 
-The supported command is ``esw``:
+The supported commands are ``esw`` and ``param``:
 
 .. list-table::
    :widths: 10 25 35
@@ -73,11 +76,16 @@ The supported command is ``esw``:
    * - ``esw``
      - ``mode:<mode>``
      - ``legacy``, ``switchdev``, ``switchdev_inactive``
+   * - ``param``
+     - ``<name>:<value>``
+     - ``<value>`` is parsed according to the registered devlink parameter
+       type. Only runtime devlink parameters are supported.
 
 The ``esw:mode`` default corresponds to the userspace command::
 
   devlink dev eswitch set <handle> mode <value>
 
+The ``param`` default applies the named devlink parameter in runtime mode.
 
 Examples
 ========
@@ -90,6 +98,10 @@ Set two PCI devlink instances to legacy mode::
 
   devlink=[pci/0000:08:00.0,pci/0000:08:00.1]:esw:mode:legacy
 
+Set a runtime devlink device parameter::
+
+  devlink=[pci/0000:08:00.0]:param:flow_steering_mode:smfs
+
 Set different modes for different PCI devlink instances::
 
   devlink=[pci/0000:08:00.0]:esw:mode:switchdev,[pci/0000:08:00.1]:esw:mode:switchdev_inactive
@@ -97,3 +109,7 @@ Set different modes for different PCI devlink instances::
 The following is invalid because the same handle receives ``esw:mode`` twice::
 
   devlink=[pci/0000:08:00.0]:esw:mode:legacy,[pci/0000:08:00.0]:esw:mode:switchdev
+
+The following is invalid because the same handle receives ``param:x`` twice::
+
+  devlink=[pci/0]:param:x:1,[pci/0]:param:x:2
net/devlink/core.c +73 -37

162 lines not on this page · raw message

net/devlink/devl_internal.h +3 -0
index e4e48ee2da5a..bde333c22f18 100644
@@ -212,6 +212,9 @@ static inline int devlink_nl_put_u64(struct sk_buff *msg, int attrtype, u64 val)
 int devlink_nl_put_nested_handle(struct sk_buff *msg, struct net *net,
 				 struct devlink *devlink, int attrtype);
 int devlink_nl_msg_reply_and_new(struct sk_buff **msg, struct genl_info *info);
+int devlink_param_set_from_string(struct devlink *devlink,
+				  const char *param_name,
+				  const char *value_str);
 
 static inline bool devlink_nl_notify_need(struct devlink *devlink)
 {
net/devlink/param.c +70 -0

82 lines not on this page · raw message

Signature · 1 line
2.34.1
author maintainer
#4 lore raw

RFC 4/4 net/mlx5: Apply devlink boot defaults during init

In reply to Mark Bloch

Apply devlink boot defaults for mlx5 devices after successful device initialization, while holding the devlink instance lock.

At this point the devlink instance is registered and the mlx5 devlink operations and parameters have been registered, so generic devlink defaults such as eswitch mode and runtime parameters can be applied to the matching PCI devlink handle.

---
 drivers/net/ethernet/mellanox/mlx5/core/main.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/main.c +2 -0
index b1b9ebfd3866..a119d199f9a5 100644
@@ -1464,6 +1464,8 @@ int mlx5_init_one(struct mlx5_core_dev *dev)
 	err = mlx5_init_one_devl_locked(dev);
 	if (err)
 		devl_unregister(devlink);
+	else
+		devl_apply_defaults(devlink);
 unlock:
 	devl_unlock(devlink);
 	return err;
Signature · 1 line
2.34.1
maintainer
#5 lore raw
In reply to Mark Bloch
Quoted 21 lines · Wed, May 06, 2026 at 02:37:35PM +0200, [email protected] wrote:

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.

Quoted 7 lines

- 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

"defaults before normal userspace orchestrarion". I read it as config before config, which eventually could be skipped.

Quoted 6 lines

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

I don't like this. What you do, you are basically introducing user configuration tool on kernel cmdline.

The same you would achieve with a proper userspace tool/daemon. I did try to come up with it and push it here:
https://github.com/systemd/systemd/pull/37393
That didn't get merged for unknown reason, but the idea is sound. You provide configuration files for devlink object and systemd-devlinkd will apply when they appear. Wouldn't this help your case?

[..]

author maintainer
#6 lore raw
Quoted 44 lines · Jiri Pirko
Quoted 21 lines · Wed, May 06, 2026 at 02:37:35PM +0200, [email protected] wrote:

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.

Quoted 7 lines

- 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

"defaults before normal userspace orchestrarion". I read it as config before config, which eventually could be skipped.

Quoted 6 lines

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

I don't like this. What you do, you are basically introducing user configuration tool on kernel cmdline.

Quoted 6 lines

The same you would achieve with a proper userspace tool/daemon. I did try to come up with it and push it here:
https://github.com/systemd/systemd/pull/37393
That didn't get merged for unknown reason, but the idea is sound. You provide configuration files for devlink object and systemd-devlinkd will apply when they appear. Wouldn't this help your case?

I agree that systemd-devlinkd is the right shape for normal devlink configuration, and it could probably replace the udev/devlink plumbing we use today.

The case I am trying to cover is earlier than that.

On BlueField/ECPF/DPU systems, the host PF driver cannot always finish probing independently of the ECPF side. When the ECPF is the eswitch manager, the host PF is kept in initializing state until the ECPF eswitch side is set up and mlx5 enables the external host PF HCA. That happens as part of moving the ECPF to switchdev.

Today userspace observes the ECPF instance and then switches the mode through devlink, usually via udev or similar plumbing. That still leaves a window where the ECPF has probed, userspace has not applied the mode yet, and the host PF is waiting. With many ECPFs this becomes visible in host PF probe/boot time. A daemon reacting to the devlink object appearing can make the userspace side cleaner, but it still runs after the device has appeared and after userspace scheduling/uevent handling.

Long term, for these DPU deployments, we would like mlx5 to initialize directly in switchdev. I am hesitant to make that unconditional because it changes existing behavior and there is no early opt-out before probe. The cmdline parameter was meant as an explicit opt-in middle step: ask the driver to apply the same devlink operation during init, before this path depends on userspace.

We previously tried to address this with an mlx5 module parameter. By design, that was too coarse: it applied to all mlx5 devices handled by the module. That makes it usable only for narrow DPU-only configurations. The devlink-handle based cmdline syntax was intended to keep the opt-in scoped to the specific devices that need this early switchdev transition.

Mark

Quoted 2 lines

[..]

maintainer
#7 lore raw
Quoted 81 lines · Wed, May 06, 2026 at 07:35:10PM +0200, [email protected] wrote:
Quoted 44 lines · Jiri Pirko
Quoted 21 lines · Wed, May 06, 2026 at 02:37:35PM +0200, [email protected] wrote:

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.

Quoted 7 lines

- 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

"defaults before normal userspace orchestrarion". I read it as config before config, which eventually could be skipped.

Quoted 6 lines

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

I don't like this. What you do, you are basically introducing user configuration tool on kernel cmdline.

Quoted 6 lines

The same you would achieve with a proper userspace tool/daemon. I did try to come up with it and push it here:
https://github.com/systemd/systemd/pull/37393
That didn't get merged for unknown reason, but the idea is sound. You provide configuration files for devlink object and systemd-devlinkd will apply when they appear. Wouldn't this help your case?

I agree that systemd-devlinkd is the right shape for normal devlink configuration, and it could probably replace the udev/devlink plumbing we use today.

The case I am trying to cover is earlier than that.

On BlueField/ECPF/DPU systems, the host PF driver cannot always finish probing independently of the ECPF side. When the ECPF is the eswitch manager, the host PF is kept in initializing state until the ECPF eswitch side is set up and mlx5 enables the external host PF HCA. That happens as part of moving the ECPF to switchdev.

Today userspace observes the ECPF instance and then switches the mode through devlink, usually via udev or similar plumbing. That still leaves a window where the ECPF has probed, userspace has not applied the mode yet, and the host PF is waiting. With many ECPFs this becomes visible in host PF probe/boot time. A daemon reacting to the devlink object appearing can make the userspace side cleaner, but it still runs after the device has appeared and after userspace scheduling/uevent handling.

Long term, for these DPU deployments, we would like mlx5 to initialize directly in switchdev. I am hesitant to make that unconditional because it changes existing behavior and there is no early opt-out before probe. The cmdline parameter was meant as an explicit opt-in middle step: ask the driver to apply the same devlink operation during init, before this path depends on userspace.

Quoted 5 lines

We previously tried to address this with an mlx5 module parameter. By design, that was too coarse: it applied to all mlx5 devices handled by the module. That makes it usable only for narrow DPU-only configurations. The devlink-handle based cmdline syntax was intended to keep the opt-in scoped to the specific devices that need this early switchdev transition.

The switchdev mode was introduced at roughly the time CX4 was out. What stopped us from making it default for CX4+ ?

Introducing this horrible plumbing only bacause we were not able to change the default sounds so absurd.

Can we write the default mode as a bit in ASIC NV memory perhaps? Simple devlink cmode permanent param to write it, the driver can read this bit during init to decide the init flow path?

author maintainer
#8 lore raw
Quoted 91 lines · Jiri Pirko
Quoted 81 lines · Wed, May 06, 2026 at 07:35:10PM +0200, [email protected] wrote:
Quoted 44 lines · Jiri Pirko
Quoted 21 lines · Wed, May 06, 2026 at 02:37:35PM +0200, [email protected] wrote:

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.

Quoted 7 lines

- 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

"defaults before normal userspace orchestrarion". I read it as config before config, which eventually could be skipped.

Quoted 6 lines

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

I don't like this. What you do, you are basically introducing user configuration tool on kernel cmdline.

Quoted 6 lines

The same you would achieve with a proper userspace tool/daemon. I did try to come up with it and push it here:
https://github.com/systemd/systemd/pull/37393
That didn't get merged for unknown reason, but the idea is sound. You provide configuration files for devlink object and systemd-devlinkd will apply when they appear. Wouldn't this help your case?

I agree that systemd-devlinkd is the right shape for normal devlink configuration, and it could probably replace the udev/devlink plumbing we use today.

The case I am trying to cover is earlier than that.

On BlueField/ECPF/DPU systems, the host PF driver cannot always finish probing independently of the ECPF side. When the ECPF is the eswitch manager, the host PF is kept in initializing state until the ECPF eswitch side is set up and mlx5 enables the external host PF HCA. That happens as part of moving the ECPF to switchdev.

Today userspace observes the ECPF instance and then switches the mode through devlink, usually via udev or similar plumbing. That still leaves a window where the ECPF has probed, userspace has not applied the mode yet, and the host PF is waiting. With many ECPFs this becomes visible in host PF probe/boot time. A daemon reacting to the devlink object appearing can make the userspace side cleaner, but it still runs after the device has appeared and after userspace scheduling/uevent handling.

Long term, for these DPU deployments, we would like mlx5 to initialize directly in switchdev. I am hesitant to make that unconditional because it changes existing behavior and there is no early opt-out before probe. The cmdline parameter was meant as an explicit opt-in middle step: ask the driver to apply the same devlink operation during init, before this path depends on userspace.

Quoted 5 lines

We previously tried to address this with an mlx5 module parameter. By design, that was too coarse: it applied to all mlx5 devices handled by the module. That makes it usable only for narrow DPU-only configurations. The devlink-handle based cmdline syntax was intended to keep the opt-in scoped to the specific devices that need this early switchdev transition.

The switchdev mode was introduced at roughly the time CX4 was out. What stopped us from making it default for CX4+ ?

Quoted 6 lines

Introducing this horrible plumbing only bacause we were not able to change the default sounds so absurd.

Can we write the default mode as a bit in ASIC NV memory perhaps? Simple devlink cmode permanent param to write it, the driver can read this bit during init to decide the init flow path?

I don't think switchdev by default should mean CX4+ in general. If we get there, I would expect it to be limited to the DPU/BlueField/ECPF case, where the host PF probe path can depend on the ECPF reaching switchdev. Changing the default for regular host NIC deployments feels like a much larger compatibility change.

For the ASIC/NV bit: maybe technically possible, but it feels like the wrong layer. This is boot/deployment policy, not a persistent hardware property, and storing it in NV memory would make the state persist across kernels/hosts in a surprising way.

I do agree the RFC probably went too far by making a generic devlink cmdline configuration language. Maybe the smaller thing to discuss is only:

devlink=[pci/...]:esw:mode:{legacy|switchdev|switchdev_inactive}

No runtime params, no ordering between different operations, just early eswitch mode for explicitly selected handles.

@Jakub, I know you wanted something more generic/extensible, but maybe the generic case belongs in the devlinkd/systemd direction Jiri pointed at, while the kernel cmdline handles only this early boot eswitch mode case.

Mark

maintainer
#9 lore raw
Quoted 101 lines · Fri, May 08, 2026 at 07:59:04PM +0200, [email protected] wrote:
Quoted 91 lines · Jiri Pirko
Quoted 81 lines · Wed, May 06, 2026 at 07:35:10PM +0200, [email protected] wrote:
Quoted 44 lines · Jiri Pirko
Quoted 21 lines · Wed, May 06, 2026 at 02:37:35PM +0200, [email protected] wrote:

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.

Quoted 7 lines

- 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

"defaults before normal userspace orchestrarion". I read it as config before config, which eventually could be skipped.

Quoted 6 lines

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

I don't like this. What you do, you are basically introducing user configuration tool on kernel cmdline.

Quoted 6 lines

The same you would achieve with a proper userspace tool/daemon. I did try to come up with it and push it here:
https://github.com/systemd/systemd/pull/37393
That didn't get merged for unknown reason, but the idea is sound. You provide configuration files for devlink object and systemd-devlinkd will apply when they appear. Wouldn't this help your case?

I agree that systemd-devlinkd is the right shape for normal devlink configuration, and it could probably replace the udev/devlink plumbing we use today.

The case I am trying to cover is earlier than that.

On BlueField/ECPF/DPU systems, the host PF driver cannot always finish probing independently of the ECPF side. When the ECPF is the eswitch manager, the host PF is kept in initializing state until the ECPF eswitch side is set up and mlx5 enables the external host PF HCA. That happens as part of moving the ECPF to switchdev.

Today userspace observes the ECPF instance and then switches the mode through devlink, usually via udev or similar plumbing. That still leaves a window where the ECPF has probed, userspace has not applied the mode yet, and the host PF is waiting. With many ECPFs this becomes visible in host PF probe/boot time. A daemon reacting to the devlink object appearing can make the userspace side cleaner, but it still runs after the device has appeared and after userspace scheduling/uevent handling.

Long term, for these DPU deployments, we would like mlx5 to initialize directly in switchdev. I am hesitant to make that unconditional because it changes existing behavior and there is no early opt-out before probe. The cmdline parameter was meant as an explicit opt-in middle step: ask the driver to apply the same devlink operation during init, before this path depends on userspace.

Quoted 5 lines

We previously tried to address this with an mlx5 module parameter. By design, that was too coarse: it applied to all mlx5 devices handled by the module. That makes it usable only for narrow DPU-only configurations. The devlink-handle based cmdline syntax was intended to keep the opt-in scoped to the specific devices that need this early switchdev transition.

The switchdev mode was introduced at roughly the time CX4 was out. What stopped us from making it default for CX4+ ?

Quoted 6 lines

Introducing this horrible plumbing only bacause we were not able to change the default sounds so absurd.

Can we write the default mode as a bit in ASIC NV memory perhaps? Simple devlink cmode permanent param to write it, the driver can read this bit during init to decide the init flow path?

Quoted 5 lines

I don't think switchdev by default should mean CX4+ in general. If we get there, I would expect it to be limited to the DPU/BlueField/ECPF case, where the host PF probe path can depend on the ECPF reaching switchdev. Changing the default for regular host NIC deployments feels like a much larger compatibility change.

We can't travel throught time, but if from CX5 onwards the default would be switchdev, nobody would feel broken in terms of compatibility. That is my point. Having "legacy" as default is simply wrong for never NIC generations. That is why it is called "legacy" and it should have been rotten through and out since CX4 times.

Quoted 5 lines

For the ASIC/NV bit: maybe technically possible, but it feels like the wrong layer. This is boot/deployment policy, not a persistent hardware property, and storing it in NV memory would make the state persist across kernels/hosts in a surprising way.

Well, as any other nv config, it persists across kernels/hosts. Think about it as "unbreak-my-not-legacy-device" bit.

Quoted 8 lines

I do agree the RFC probably went too far by making a generic devlink cmdline configuration language. Maybe the smaller thing to discuss is only:

devlink=[pci/...]:esw:mode:{legacy|switchdev|switchdev_inactive}

No runtime params, no ordering between different operations, just early eswitch mode for explicitly selected handles.

FWIW, I'm still against this.

Quoted 6 lines

@Jakub, I know you wanted something more generic/extensible, but maybe the generic case belongs in the devlinkd/systemd direction Jiri pointed at, while the kernel cmdline handles only this early boot eswitch mode case.

Mark

maintainer
#10 lore raw
Quoted 11 lines · On Fri, 8 May 2026 20:07:44 +0200 Jiri Pirko wrote:
Quoted 5 lines

I don't think switchdev by default should mean CX4+ in general. If we get there, I would expect it to be limited to the DPU/BlueField/ECPF case, where the host PF probe path can depend on the ECPF reaching switchdev. Changing the default for regular host NIC deployments feels like a much larger compatibility change.

We can't travel throught time, but if from CX5 onwards the default would be switchdev, nobody would feel broken in terms of compatibility. That is my point. Having "legacy" as default is simply wrong for never NIC generations. That is why it is called "legacy" and it should have been rotten through and out since CX4 times.

legacy vs switchdev only describes the eswitch configuration. As a non-SR-IOV user I really don't want to see the extra representors hanging around my systems, confusing all daemons. IIRC mlx5 had some limitations around the uplink representor. Maybe that's the disconnect. But for a real, fully featured switchdev eswitches having the PHY and PF representors on boot, always, will not make sense.

IOW it's not a question of the generation of the card but of the deployment type / use case.

Quoted 7 lines
Quoted 4 lines

For the ASIC/NV bit: maybe technically possible, but it feels like the wrong layer. This is boot/deployment policy, not a persistent hardware property, and storing it in NV memory would make the state persist across kernels/hosts in a surprising way.

Well, as any other nv config, it persists across kernels/hosts. Think about it as "unbreak-my-not-legacy-device" bit.

For most devices the switchdev mode does not change anything substantial about the device. It's purely a kernel / driver config. It changes what objects and default rules kernel / driver installs. So I don't get why it would make sense to flash into the device nvmem a Linux SW stack specific config.

Quoted 7 lines
Quoted 7 lines

I do agree the RFC probably went too far by making a generic devlink cmdline configuration language. Maybe the smaller thing to discuss is only:

devlink=[pci/...]:esw:mode:{legacy|switchdev|switchdev_inactive}

No runtime params, no ordering between different operations, just early eswitch mode for explicitly selected handles.

Yes, let's cut this down, AI went too far :) As I said we should just document how we envision the format growing but for now we can literally implement just the global "esw mode".

One note on the formatting, you mentioned:

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

TBH when I used the square brackets I meant that the field is optional. But I guess you used them like we use them for IPv6 addresses to separate the : signs, makes sense.

Since AFAIU we only care about global default should we focus on supporting:

devlink=*:esw:mode:switchdev

meaning all devices default to switchdev?

Quoted 1 line

FWIW, I'm still against this.

One more option, tho IDK if it actually is good enough for Mark, would be to let user space "pause" devlink probing. So that the systemd daemon can configure the device before it populates all the netdev stuff. Basically make the devices probe into the reload_down state, until user space configures them. IDK how much of the time is spent building and tearing down the legacy mode on mlx5 but the thinking is that we'd at least stave that wasted effort.

maintainer
#11 lore raw
Quoted 13 lines · Sat, May 09, 2026 at 02:52:13AM +0200, [email protected] wrote:
Quoted 11 lines · On Fri, 8 May 2026 20:07:44 +0200 Jiri Pirko wrote:
Quoted 5 lines

I don't think switchdev by default should mean CX4+ in general. If we get there, I would expect it to be limited to the DPU/BlueField/ECPF case, where the host PF probe path can depend on the ECPF reaching switchdev. Changing the default for regular host NIC deployments feels like a much larger compatibility change.

We can't travel throught time, but if from CX5 onwards the default would be switchdev, nobody would feel broken in terms of compatibility. That is my point. Having "legacy" as default is simply wrong for never NIC generations. That is why it is called "legacy" and it should have been rotten through and out since CX4 times.

Quoted 6 lines

legacy vs switchdev only describes the eswitch configuration. As a non-SR-IOV user I really don't want to see the extra representors hanging around my systems, confusing all daemons. IIRC mlx5 had some limitations around the uplink representor. Maybe that's the disconnect. But for a real, fully featured switchdev eswitches having the PHY and PF representors on boot, always, will not make sense.

As "a non-SR-IOV user", what extra representors you talk about? When you have pfs only, you don't have anything extra. Just 1 netdev per-pf, one devlink port per-pf. What's extra about it? When you don't have VFs/SFs. Everyhing is the same:

c-220-136-220-218:~$ sudo devlink dev eswitch show pci/0000:08:00.0
pci/0000:08:00.0: mode switchdev inline-mode none encap-mode basic
c-220-136-220-218:~$ sudo devlink dev eswitch show pci/0000:08:00.1
pci/0000:08:00.1: mode legacy inline-mode none encap-mode basic
c-220-136-220-218:~$ devlink dev
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
c-220-136-220-218:~$ devlink port
auxiliary/mlx5_core.eth.0/65535: type eth netdev eth2 flavour physical port 0 splittable false
auxiliary/mlx5_core.eth.1/131071: type eth netdev eth3 flavour physical port 1 splittable false
c-220-136-220-218:~$ ip link
...
4: eth2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether b8:e9:24:f2:b7:6c brd ff:ff:ff:ff:ff:ff
    altname enp8s0f0np0
5: eth3: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether b8:e9:24:f2:b7:6d brd ff:ff:ff:ff:ff:ff
    altname enp8s0f1np1
Quoted 3 lines

IOW it's not a question of the generation of the card but of the deployment type / use case.

I don't think so, not in the case of mlx5. The difference is only when you work with sr-iov, you either use legacy way (ip vf) or the new one. Same usecase.

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

For the ASIC/NV bit: maybe technically possible, but it feels like the wrong layer. This is boot/deployment policy, not a persistent hardware property, and storing it in NV memory would make the state persist across kernels/hosts in a surprising way.

Quoted 8 lines
Quoted 2 lines

Well, as any other nv config, it persists across kernels/hosts. Think about it as "unbreak-my-not-legacy-device" bit.

For most devices the switchdev mode does not change anything substantial about the device. It's purely a kernel / driver config. It changes what objects and default rules kernel / driver installs. So I don't get why it would make sense to flash into the device nvmem a Linux SW stack specific config.

I look at it from the perspective that from some CX generation, switchdev mode should be default. So that is a device-based decision. I believe as such it can optionally be permanenty configured (nv config) on older device. Why not?

[...]

author maintainer
#12 lore raw
Quoted 21 lines · Jiri Pirko
Quoted 13 lines · Sat, May 09, 2026 at 02:52:13AM +0200, [email protected] wrote:
Quoted 11 lines · On Fri, 8 May 2026 20:07:44 +0200 Jiri Pirko wrote:
Quoted 5 lines

I don't think switchdev by default should mean CX4+ in general. If we get there, I would expect it to be limited to the DPU/BlueField/ECPF case, where the host PF probe path can depend on the ECPF reaching switchdev. Changing the default for regular host NIC deployments feels like a much larger compatibility change.

We can't travel throught time, but if from CX5 onwards the default would be switchdev, nobody would feel broken in terms of compatibility. That is my point. Having "legacy" as default is simply wrong for never NIC generations. That is why it is called "legacy" and it should have been rotten through and out since CX4 times.

Quoted 6 lines

legacy vs switchdev only describes the eswitch configuration. As a non-SR-IOV user I really don't want to see the extra representors hanging around my systems, confusing all daemons. IIRC mlx5 had some limitations around the uplink representor. Maybe that's the disconnect. But for a real, fully featured switchdev eswitches having the PHY and PF representors on boot, always, will not make sense.

Quoted 4 lines

As "a non-SR-IOV user", what extra representors you talk about? When you have pfs only, you don't have anything extra. Just 1 netdev per-pf, one devlink port per-pf. What's extra about it? When you don't have VFs/SFs. Everyhing is the same:

The netdev list looking similar is a bit misleading. What matters here is not only how many netdevs show up, but what that netdev actually is.

In legacy mode, a PF only user can just use the PF netdev as a regular NIC and use ROCE on it directly.

In switchdev mode, even if there are no VFs or SFs yet, the PF is moved into the switchdev model and the visible netdev is the uplink representor. That is not the same thing from a user point of view. The uplink representor is not a ROCE capable endpoint. So a user who used to boot the machine and use ROCE on the PF now has to create a VF or SF, use that as the roce endpoint, and also set up the switchdev forwarding path with tc, bridge or OVS so traffic from that function actually reaches the wire.

That is why I don't think this is only a card generation question. It changes the deployment model. It may be the right default for BlueField/ECPF style systems, where the host is expected to sit behind a switchdev control plane, but it is not a safe default for every regular host NIC setup.

Quoted 55 lines
c-220-136-220-218:~$ sudo devlink dev eswitch show pci/0000:08:00.0
pci/0000:08:00.0: mode switchdev inline-mode none encap-mode basic
c-220-136-220-218:~$ sudo devlink dev eswitch show pci/0000:08:00.1
pci/0000:08:00.1: mode legacy inline-mode none encap-mode basic
c-220-136-220-218:~$ devlink dev
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
c-220-136-220-218:~$ devlink port
auxiliary/mlx5_core.eth.0/65535: type eth netdev eth2 flavour physical port 0 splittable false
auxiliary/mlx5_core.eth.1/131071: type eth netdev eth3 flavour physical port 1 splittable false
c-220-136-220-218:~$ ip link
...
4: eth2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether b8:e9:24:f2:b7:6c brd ff:ff:ff:ff:ff:ff
    altname enp8s0f0np0
5: eth3: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether b8:e9:24:f2:b7:6d brd ff:ff:ff:ff:ff:ff
    altname enp8s0f1np1
Quoted 3 lines

IOW it's not a question of the generation of the card but of the deployment type / use case.

I don't think so, not in the case of mlx5. The difference is only when you work with sr-iov, you either use legacy way (ip vf) or the new one. Same usecase.

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

For the ASIC/NV bit: maybe technically possible, but it feels like the wrong layer. This is boot/deployment policy, not a persistent hardware property, and storing it in NV memory would make the state persist across kernels/hosts in a surprising way.

Quoted 8 lines
Quoted 2 lines

Well, as any other nv config, it persists across kernels/hosts. Think about it as "unbreak-my-not-legacy-device" bit.

For most devices the switchdev mode does not change anything substantial about the device. It's purely a kernel / driver config. It changes what objects and default rules kernel / driver installs. So I don't get why it would make sense to flash into the device nvmem a Linux SW stack specific config.

Quoted 4 lines

I look at it from the perspective that from some CX generation, switchdev mode should be default. So that is a device-based decision. I believe as such it can optionally be permanenty configured (nv config) on older device. Why not?

This is a deployment policy decision, not a permanent property of the card. The same adapter can be used in a regular host/RDMA setup or in a switchdev/offload setup. If we store this in NVM, that Linux switchdev policy follows the device across hosts, kernels and use cases, and can surprise the next deployment that just expects a normal NIC.

I'll send another RFC v2 with support limited to:
devlink=[...]:esw:mode:{ switchdev | switchdev_inactive | legacy } and let's see where we land with that.

I still think a small kernel command line knob is the cleanest way to get to "switchdev by default" without making the interface too broad. For more complex boot-time configuration, I agree that a devlinkd or similar userspace path is probably the better direction.

The "pause probing until userspace configures devlink" idea feels less clear to me. It is not quite the simple boot policy knob, and not quite the full userspace policy manager either. It would add a new probe state and require early userspace orchestration before the device is fully materialized. At least for now, I would prefer either the small cmdline option for the simple global/default case, or a proper devlinkd-like solution for more complex policy. Between those, I still prefer the cmdline option for this specific early eswitch mode default.

Mark

Quoted 2 lines

[...]

maintainer
#13 lore raw
Quoted 29 lines · Sun, May 10, 2026 at 02:31:35PM +0200, [email protected] wrote:
Quoted 21 lines · Jiri Pirko
Quoted 13 lines · Sat, May 09, 2026 at 02:52:13AM +0200, [email protected] wrote:
Quoted 11 lines · On Fri, 8 May 2026 20:07:44 +0200 Jiri Pirko wrote:
Quoted 5 lines

I don't think switchdev by default should mean CX4+ in general. If we get there, I would expect it to be limited to the DPU/BlueField/ECPF case, where the host PF probe path can depend on the ECPF reaching switchdev. Changing the default for regular host NIC deployments feels like a much larger compatibility change.

We can't travel throught time, but if from CX5 onwards the default would be switchdev, nobody would feel broken in terms of compatibility. That is my point. Having "legacy" as default is simply wrong for never NIC generations. That is why it is called "legacy" and it should have been rotten through and out since CX4 times.

Quoted 6 lines

legacy vs switchdev only describes the eswitch configuration. As a non-SR-IOV user I really don't want to see the extra representors hanging around my systems, confusing all daemons. IIRC mlx5 had some limitations around the uplink representor. Maybe that's the disconnect. But for a real, fully featured switchdev eswitches having the PHY and PF representors on boot, always, will not make sense.

Quoted 4 lines

As "a non-SR-IOV user", what extra representors you talk about? When you have pfs only, you don't have anything extra. Just 1 netdev per-pf, one devlink port per-pf. What's extra about it? When you don't have VFs/SFs. Everyhing is the same:

Quoted 5 lines

The netdev list looking similar is a bit misleading. What matters here is not only how many netdevs show up, but what that netdev actually is.

In legacy mode, a PF only user can just use the PF netdev as a regular NIC and use ROCE on it directly.

I don't see why we have this limitation. Sounds more like a bug to me. The netdev is still the same, capable of the same things no matter in which mode you have it. RoCE should work on it in both modes.

Quoted 9 lines

In switchdev mode, even if there are no VFs or SFs yet, the PF is moved into the switchdev model and the visible netdev is the uplink representor. That is not the same thing from a user point of view. The uplink representor is not a ROCE capable endpoint. So a user who used to boot the machine and use ROCE on the PF now has to create a VF or SF, use that as the roce endpoint, and also set up the switchdev forwarding path with tc, bridge or OVS so traffic from that function actually reaches the wire.

Quoted 4 lines

That is why I don't think this is only a card generation question. It changes the deployment model. It may be the right default for BlueField/ECPF style systems, where the host is expected to sit behind a switchdev control plane, but it is not a safe default for every regular host NIC setup.

Yeah, the point is, not to change deployment model. The legacy/switchdev should only change behaviour for sriov/eswitch usecase. The rest (PF/uplink netdev and related objects) should stay the same.

Quoted 61 lines
Quoted 56 lines

c-220-136-220-218:~$ sudo devlink dev eswitch show pci/0000:08:00.0
pci/0000:08:00.0: mode switchdev inline-mode none encap-mode basic
c-220-136-220-218:~$ sudo devlink dev eswitch show pci/0000:08:00.1
pci/0000:08:00.1: mode legacy inline-mode none encap-mode basic
c-220-136-220-218:~$ devlink dev
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
c-220-136-220-218:~$ devlink port
auxiliary/mlx5_core.eth.0/65535: type eth netdev eth2 flavour physical port 0 splittable false
auxiliary/mlx5_core.eth.1/131071: type eth netdev eth3 flavour physical port 1 splittable false
c-220-136-220-218:~$ ip link
...
4: eth2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether b8:e9:24:f2:b7:6c brd ff:ff:ff:ff:ff:ff
    altname enp8s0f0np0
5: eth3: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether b8:e9:24:f2:b7:6d brd ff:ff:ff:ff:ff:ff
    altname enp8s0f1np1
Quoted 3 lines

IOW it's not a question of the generation of the card but of the deployment type / use case.

I don't think so, not in the case of mlx5. The difference is only when you work with sr-iov, you either use legacy way (ip vf) or the new one. Same usecase.

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

For the ASIC/NV bit: maybe technically possible, but it feels like the wrong layer. This is boot/deployment policy, not a persistent hardware property, and storing it in NV memory would make the state persist across kernels/hosts in a surprising way.

Quoted 8 lines
Quoted 2 lines

Well, as any other nv config, it persists across kernels/hosts. Think about it as "unbreak-my-not-legacy-device" bit.

For most devices the switchdev mode does not change anything substantial about the device. It's purely a kernel / driver config. It changes what objects and default rules kernel / driver installs. So I don't get why it would make sense to flash into the device nvmem a Linux SW stack specific config.

Quoted 4 lines

I look at it from the perspective that from some CX generation, switchdev mode should be default. So that is a device-based decision. I believe as such it can optionally be permanenty configured (nv config) on older device. Why not?

Quoted 5 lines

This is a deployment policy decision, not a permanent property of the card. The same adapter can be used in a regular host/RDMA setup or in a switchdev/offload setup. If we store this in NVM, that Linux switchdev policy follows the device across hosts, kernels and use cases, and can surprise the next deployment that just expects a normal NIC.

Yeah, from my perspective, there should be not surprise/behaviour_change for non-sriov/eswitch user. Then switchdev can be default and everyone is happy. Why to complicate things?

Quoted 24 lines

I'll send another RFC v2 with support limited to:
devlink=[...]:esw:mode:{ switchdev | switchdev_inactive | legacy } and let's see where we land with that.

I still think a small kernel command line knob is the cleanest way to get to "switchdev by default" without making the interface too broad. For more complex boot-time configuration, I agree that a devlinkd or similar userspace path is probably the better direction.

The "pause probing until userspace configures devlink" idea feels less clear to me. It is not quite the simple boot policy knob, and not quite the full userspace policy manager either. It would add a new probe state and require early userspace orchestration before the device is fully materialized. At least for now, I would prefer either the small cmdline option for the simple global/default case, or a proper devlinkd-like solution for more complex policy. Between those, I still prefer the cmdline option for this specific early eswitch mode default.

Mark

Quoted 2 lines

[...]

#14 lore raw
In reply to Mark Bloch
Quoted 4 lines

From: Mark Bloch <[email protected]>
Sent: 10 May 2026 06:02 PM

[..]

Quoted 5 lines
Quoted 4 lines

I look at it from the perspective that from some CX generation, switchdev mode should be default. So that is a device-based decision. I believe as such it can optionally be permanenty configured (nv config) on older device. Why not?

Because sometimes switchdev_inactive is needed and sometimes not.
Such knob is not device decision.
If it is placed in the device, orchestration needs to yet use additional vendor tool to configure in the device. And that theoretical tool cannot even run yet because driver is not yet loaded.

That sort of defeats the purpose.

Quoted 1 line

This is a deployment policy decision, not a permanent property of the card.

+1

Quoted 9 lines

The same adapter can be used in a regular host/RDMA setup or in a switchdev/offload setup. If we store this in NVM, that Linux switchdev policy follows the device across hosts, kernels and use cases, and can surprise the next deployment that just expects a normal NIC.

I'll send another RFC v2 with support limited to:
devlink=[...]:esw:mode:{ switchdev | switchdev_inactive | legacy } and let's see where we land with that.

This looks elegant to me as well covering all eswitch modes and still sw is in control.

maintainer
#15 lore raw
Quoted 7 lines · Mon, May 11, 2026 at 08:21:37PM +0200, [email protected] wrote:
Quoted 4 lines

From: Mark Bloch <[email protected]>
Sent: 10 May 2026 06:02 PM

[..]

Quoted 7 lines
Quoted 5 lines
Quoted 4 lines

I look at it from the perspective that from some CX generation, switchdev mode should be default. So that is a device-based decision. I believe as such it can optionally be permanenty configured (nv config) on older device. Why not?

Because sometimes switchdev_inactive is needed and sometimes not. Such knob is not device decision.

That is what I would call corner case. In that, user can use userspace configuration to change the mode in runtime.

Quoted 18 lines

If it is placed in the device, orchestration needs to yet use additional vendor tool to configure in the device. And that theoretical tool cannot even run yet because driver is not yet loaded.

That sort of defeats the purpose.

Quoted 1 line

This is a deployment policy decision, not a permanent property of the card.

+1

Quoted 9 lines

The same adapter can be used in a regular host/RDMA setup or in a switchdev/offload setup. If we store this in NVM, that Linux switchdev policy follows the device across hosts, kernels and use cases, and can surprise the next deployment that just expects a normal NIC.

I'll send another RFC v2 with support limited to:
devlink=[...]:esw:mode:{ switchdev | switchdev_inactive | legacy } and let's see where we land with that.

This looks elegant to me as well covering all eswitch modes and still sw is in control.

#16 lore raw
Quoted 17 lines

From: Jiri Pirko <[email protected]>
Sent: 12 May 2026 02:16 PM

Quoted 12 lines · Mon, May 11, 2026 at 08:21:37PM +0200, [email protected] wrote:
Quoted 4 lines

From: Mark Bloch <[email protected]>
Sent: 10 May 2026 06:02 PM

[..]

Quoted 5 lines
Quoted 4 lines

I look at it from the perspective that from some CX generation, switchdev mode should be default. So that is a device-based decision. I believe as such it can optionally be permanenty configured (nv config) on older device. Why not?

Quoted 6 lines
Quoted 2 lines

Because sometimes switchdev_inactive is needed and sometimes not. Such knob is not device decision.

That is what I would call corner case. In that, user can use userspace configuration to change the mode in runtime.

Corner vs common depends on users one talks to. :)
If fw has switchdev(active) as default, and then
And user needs to run switchdev_inactive, it will actually break their switching applications.

So, one needs to invent switchdev_inactive in the FW.

Jakub's suggestion in this RFC is covering both the scenarios uniformly without above problems. Single uapi for all the cases, so looks good to me.

Moreover, do not understand how alternative solves such problems. i.e. user is unable to configure the fw because driver is not yet loaded/up.

Quoted 19 lines
Quoted 19 lines

If it is placed in the device, orchestration needs to yet use additional vendor tool to configure in the device. And that theoretical tool cannot even run yet because driver is not yet loaded.

That sort of defeats the purpose.

Quoted 1 line

This is a deployment policy decision, not a permanent property of the card.

+1

Quoted 9 lines

The same adapter can be used in a regular host/RDMA setup or in a switchdev/offload setup. If we store this in NVM, that Linux switchdev policy follows the device across hosts, kernels and use cases, and can surprise the next deployment that just expects a normal NIC.

I'll send another RFC v2 with support limited to:
devlink=[...]:esw:mode:{ switchdev | switchdev_inactive | legacy } and let's see where we land with that.

This looks elegant to me as well covering all eswitch modes and still sw is in control.

maintainer
#17 lore raw
Quoted 20 lines · Tue, May 12, 2026 at 03:48:32PM CEST, [email protected] wrote:
Quoted 20 lines

From: Jiri Pirko <[email protected]>
Sent: 12 May 2026 02:16 PM

Quoted 14 lines · Mon, May 11, 2026 at 08:21:37PM +0200, [email protected] wrote:
Quoted 4 lines

From: Mark Bloch <[email protected]>
Sent: 10 May 2026 06:02 PM

[..]

Quoted 5 lines
Quoted 4 lines

I look at it from the perspective that from some CX generation, switchdev mode should be default. So that is a device-based decision. I believe as such it can optionally be permanenty configured (nv config) on older device. Why not?

Because sometimes switchdev_inactive is needed and sometimes not. Such knob is not device decision.

Quoted 6 lines
Quoted 3 lines

That is what I would call corner case. In that, user can use userspace configuration to change the mode in runtime.

Corner vs common depends on users one talks to. :)
If fw has switchdev(active) as default, and then
And user needs to run switchdev_inactive, it will actually break their switching applications.

Can you describe the actutal breakage please?

Quoted 8 lines

So, one needs to invent switchdev_inactive in the FW.

Jakub's suggestion in this RFC is covering both the scenarios uniformly without above problems. Single uapi for all the cases, so looks good to me.

Moreover, do not understand how alternative solves such problems. i.e. user is unable to configure the fw because driver is not yet loaded/up.

See my other reply in this thread. I don't think there is a need to configure anything in FW. If we fix the behaviour in switchdev mode for non-sriov user and change the default, no fw knob needed. What am I missing?

Quoted 20 lines
Quoted 20 lines
Quoted 20 lines

If it is placed in the device, orchestration needs to yet use additional vendor tool to configure in the device. And that theoretical tool cannot even run yet because driver is not yet loaded.

That sort of defeats the purpose.

Quoted 1 line

This is a deployment policy decision, not a permanent property of the card.

+1

Quoted 9 lines

The same adapter can be used in a regular host/RDMA setup or in a switchdev/offload setup. If we store this in NVM, that Linux switchdev policy follows the device across hosts, kernels and use cases, and can surprise the next deployment that just expects a normal NIC.

I'll send another RFC v2 with support limited to:
devlink=[...]:esw:mode:{ switchdev | switchdev_inactive | legacy } and let's see where we land with that.

This looks elegant to me as well covering all eswitch modes and still sw is in control.

#18 lore raw
Quoted 26 lines

From: Jiri Pirko <[email protected]>
Sent: 12 May 2026 07:37 PM

Quoted 20 lines · Tue, May 12, 2026 at 03:48:32PM CEST, [email protected] wrote:
Quoted 20 lines

From: Jiri Pirko <[email protected]>
Sent: 12 May 2026 02:16 PM

Quoted 14 lines · Mon, May 11, 2026 at 08:21:37PM +0200, [email protected] wrote:
Quoted 4 lines

From: Mark Bloch <[email protected]>
Sent: 10 May 2026 06:02 PM

[..]

Quoted 5 lines
Quoted 4 lines

I look at it from the perspective that from some CX generation, switchdev mode should be default. So that is a device-based decision. I believe as such it can optionally be permanenty configured (nv config) on older device. Why not?

Because sometimes switchdev_inactive is needed and sometimes not. Such knob is not device decision.

Quoted 9 lines
Quoted 6 lines
Quoted 3 lines

That is what I would call corner case. In that, user can use userspace configuration to change the mode in runtime.

Corner vs common depends on users one talks to. :)
If fw has switchdev(active) as default, and then
And user needs to run switchdev_inactive, it will actually break their switching applications.

Can you describe the actutal breakage please?

Driver default was switchdev so all the traffic is forwarded to the switch, and user didn't have chance to setup the fdb rules.
So packets are dropped but user didn't expect the traffic to be forwarded.

With this RFC, the device would start in the switchdev_inactive. And user's goal is achieved.

Quoted 6 lines
Quoted 6 lines

So, one needs to invent switchdev_inactive in the FW.

Jakub's suggestion in this RFC is covering both the scenarios uniformly without above problems. Single uapi for all the cases, so looks good to me.

Quoted 8 lines
Quoted 2 lines

Moreover, do not understand how alternative solves such problems. i.e. user is unable to configure the fw because driver is not yet loaded/up.

See my other reply in this thread. I don't think there is a need to configure anything in FW. If we fix the behaviour in switchdev mode for non-sriov user and change the default, no fw knob needed. What am I missing?

If I understood your suggestion right, is it the devlinkd based solution?

If yes, then Mark explained that it has the issue of all drivers to be loaded, followed by user space to start.

maintainer
#19 lore raw
Quoted 33 lines · Tue, May 12, 2026 at 05:25:21PM CEST, [email protected] wrote:
Quoted 33 lines

From: Jiri Pirko <[email protected]>
Sent: 12 May 2026 07:37 PM

Quoted 26 lines · Tue, May 12, 2026 at 03:48:32PM CEST, [email protected] wrote:
Quoted 17 lines

From: Jiri Pirko <[email protected]>
Sent: 12 May 2026 02:16 PM

Quoted 12 lines · Mon, May 11, 2026 at 08:21:37PM +0200, [email protected] wrote:
Quoted 4 lines

From: Mark Bloch <[email protected]>
Sent: 10 May 2026 06:02 PM

[..]

Quoted 5 lines
Quoted 4 lines

I look at it from the perspective that from some CX generation, switchdev mode should be default. So that is a device-based decision. I believe as such it can optionally be permanenty configured (nv config) on older device. Why not?

Quoted 6 lines
Quoted 2 lines

Because sometimes switchdev_inactive is needed and sometimes not. Such knob is not device decision.

That is what I would call corner case. In that, user can use userspace configuration to change the mode in runtime.

Corner vs common depends on users one talks to. :)
If fw has switchdev(active) as default, and then
And user needs to run switchdev_inactive, it will actually break their switching applications.

Quoted 5 lines
Quoted 2 lines

Can you describe the actutal breakage please?

Driver default was switchdev so all the traffic is forwarded to the switch, and user didn't have chance to setup the fdb rules.
So packets are dropped but user didn't expect the traffic to be forwarded.

User may switch mode to switchdev_inactive early on, before any of the representors are created. What's the issue then?

Quoted 13 lines

With this RFC, the device would start in the switchdev_inactive. And user's goal is achieved.

Quoted 9 lines
Quoted 8 lines

So, one needs to invent switchdev_inactive in the FW.

Jakub's suggestion in this RFC is covering both the scenarios uniformly without above problems. Single uapi for all the cases, so looks good to me.

Moreover, do not understand how alternative solves such problems. i.e. user is unable to configure the fw because driver is not yet loaded/up.

Quoted 6 lines
Quoted 5 lines

See my other reply in this thread. I don't think there is a need to configure anything in FW. If we fix the behaviour in switchdev mode for non-sriov user and change the default, no fw knob needed. What am I missing?

If I understood your suggestion right, is it the devlinkd based solution?

The suggestion is to use "switchdev" as default with user configuration no matter if it is devlinkd or something else.

Quoted 2 lines

If yes, then Mark explained that it has the issue of all drivers to be loaded, followed by user space to start.

author maintainer
#20 lore raw
Quoted 34 lines · Jiri Pirko
Quoted 33 lines · Tue, May 12, 2026 at 05:25:21PM CEST, [email protected] wrote:
Quoted 33 lines

From: Jiri Pirko <[email protected]>
Sent: 12 May 2026 07:37 PM

Quoted 26 lines · Tue, May 12, 2026 at 03:48:32PM CEST, [email protected] wrote:
Quoted 17 lines

From: Jiri Pirko <[email protected]>
Sent: 12 May 2026 02:16 PM

Quoted 12 lines · Mon, May 11, 2026 at 08:21:37PM +0200, [email protected] wrote:
Quoted 4 lines

From: Mark Bloch <[email protected]>
Sent: 10 May 2026 06:02 PM

[..]

Quoted 5 lines
Quoted 4 lines

I look at it from the perspective that from some CX generation, switchdev mode should be default. So that is a device-based decision. I believe as such it can optionally be permanenty configured (nv config) on older device. Why not?

Quoted 6 lines
Quoted 2 lines

Because sometimes switchdev_inactive is needed and sometimes not. Such knob is not device decision.

That is what I would call corner case. In that, user can use userspace configuration to change the mode in runtime.

Corner vs common depends on users one talks to. :)
If fw has switchdev(active) as default, and then
And user needs to run switchdev_inactive, it will actually break their switching applications.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Can you describe the actutal breakage please?

Driver default was switchdev so all the traffic is forwarded to the switch, and user didn't have chance to setup the fdb rules.
So packets are dropped but user didn't expect the traffic to be forwarded.

User may switch mode to switchdev_inactive early on, before any of the representors are created. What's the issue then?

That is the ordering problem I am trying to solve.

On a DPU, the host PF cannot finish loading until the ECPF moves the eswitch to switchdev/switchdev_inactive. So we need to do that transition during ECPF driver init, as early as possible. Waiting for userspace means the host PF stays blocked until userspace is up and has the right logic.

That is not always true in practice, the driver may be built in, loaded from an initramfs, or the initramfs may simply not contain the devlink policy we need.

Also, after talking with Parav, my understanding is that we need to support both switchdev and switchdev_inactive, since different customers want different boot behavior. Once we do the transition, the host PF can load and may start sending packets. At that point the initial mode already matters: in switchdev_inactive packets are dropped until userspace programs the pipeline; in switchdev they may reach the FDB before the pipeline is ready.

So I do not think an early userspace transition is equivalent here. The initial mode needs to be known by the kernel before userspace runs, which is why I am proposing the devlink= command line default.

Mark

Quoted 28 lines
Quoted 15 lines

With this RFC, the device would start in the switchdev_inactive. And user's goal is achieved.

Quoted 9 lines
Quoted 8 lines

So, one needs to invent switchdev_inactive in the FW.

Jakub's suggestion in this RFC is covering both the scenarios uniformly without above problems. Single uapi for all the cases, so looks good to me.

Moreover, do not understand how alternative solves such problems. i.e. user is unable to configure the fw because driver is not yet loaded/up.

Quoted 6 lines
Quoted 5 lines

See my other reply in this thread. I don't think there is a need to configure anything in FW. If we fix the behaviour in switchdev mode for non-sriov user and change the default, no fw knob needed. What am I missing?

If I understood your suggestion right, is it the devlinkd based solution?

The suggestion is to use "switchdev" as default with user configuration no matter if it is devlinkd or something else.

Quoted 2 lines

If yes, then Mark explained that it has the issue of all drivers to be loaded, followed by user space to start.

maintainer
#21 lore raw
Quoted 63 lines · Wed, May 13, 2026 at 07:53:05AM CEST, [email protected] wrote:
Quoted 34 lines · Jiri Pirko
Quoted 33 lines · Tue, May 12, 2026 at 05:25:21PM CEST, [email protected] wrote:
Quoted 33 lines

From: Jiri Pirko <[email protected]>
Sent: 12 May 2026 07:37 PM

Quoted 26 lines · Tue, May 12, 2026 at 03:48:32PM CEST, [email protected] wrote:
Quoted 17 lines

From: Jiri Pirko <[email protected]>
Sent: 12 May 2026 02:16 PM

Quoted 12 lines · Mon, May 11, 2026 at 08:21:37PM +0200, [email protected] wrote:
Quoted 4 lines

From: Mark Bloch <[email protected]>
Sent: 10 May 2026 06:02 PM

[..]

Quoted 5 lines
Quoted 4 lines

I look at it from the perspective that from some CX generation, switchdev mode should be default. So that is a device-based decision. I believe as such it can optionally be permanenty configured (nv config) on older device. Why not?

Quoted 6 lines
Quoted 2 lines

Because sometimes switchdev_inactive is needed and sometimes not. Such knob is not device decision.

That is what I would call corner case. In that, user can use userspace configuration to change the mode in runtime.

Corner vs common depends on users one talks to. :)
If fw has switchdev(active) as default, and then
And user needs to run switchdev_inactive, it will actually break their switching applications.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Can you describe the actutal breakage please?

Driver default was switchdev so all the traffic is forwarded to the switch, and user didn't have chance to setup the fdb rules.
So packets are dropped but user didn't expect the traffic to be forwarded.

User may switch mode to switchdev_inactive early on, before any of the representors are created. What's the issue then?

That is the ordering problem I am trying to solve.

On a DPU, the host PF cannot finish loading until the ECPF moves the eswitch to switchdev/switchdev_inactive. So we need to do that transition during ECPF driver init, as early as possible. Waiting for userspace means the host PF stays blocked until userspace is up and has the right logic.

That is not always true in practice, the driver may be built in, loaded from an initramfs, or the initramfs may simply not contain the devlink policy we need.

Also, after talking with Parav, my understanding is that we need to support both switchdev and switchdev_inactive, since different customers want different boot behavior. Once we do the transition, the host PF can load and may start sending packets. At that point the initial mode already matters: in switchdev_inactive packets are dropped until userspace programs the pipeline; in switchdev they may reach the FDB before the pipeline is ready.

Quoted 3 lines

So I do not think an early userspace transition is equivalent here. The initial mode needs to be known by the kernel before userspace runs, which is why I am proposing the devlink= command line default.

Okay fair enough. Could you please at least make sure this is mode only config and noone would ever think about abusing this for any other configuration? Perhaps call it "devlink_eswitch_mode=" to remove the "devlink=" namespace flexibility?

author maintainer
#22 lore raw
Quoted 64 lines · Jiri Pirko
Quoted 63 lines · Wed, May 13, 2026 at 07:53:05AM CEST, [email protected] wrote:
Quoted 34 lines · Jiri Pirko
Quoted 33 lines · Tue, May 12, 2026 at 05:25:21PM CEST, [email protected] wrote:
Quoted 33 lines

From: Jiri Pirko <[email protected]>
Sent: 12 May 2026 07:37 PM

Quoted 26 lines · Tue, May 12, 2026 at 03:48:32PM CEST, [email protected] wrote:
Quoted 17 lines

From: Jiri Pirko <[email protected]>
Sent: 12 May 2026 02:16 PM

Quoted 12 lines · Mon, May 11, 2026 at 08:21:37PM +0200, [email protected] wrote:
Quoted 4 lines

From: Mark Bloch <[email protected]>
Sent: 10 May 2026 06:02 PM

[..]

Quoted 5 lines
Quoted 4 lines

I look at it from the perspective that from some CX generation, switchdev mode should be default. So that is a device-based decision. I believe as such it can optionally be permanenty configured (nv config) on older device. Why not?

Quoted 6 lines
Quoted 2 lines

Because sometimes switchdev_inactive is needed and sometimes not. Such knob is not device decision.

That is what I would call corner case. In that, user can use userspace configuration to change the mode in runtime.

Corner vs common depends on users one talks to. :)
If fw has switchdev(active) as default, and then
And user needs to run switchdev_inactive, it will actually break their switching applications.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Can you describe the actutal breakage please?

Driver default was switchdev so all the traffic is forwarded to the switch, and user didn't have chance to setup the fdb rules.
So packets are dropped but user didn't expect the traffic to be forwarded.

User may switch mode to switchdev_inactive early on, before any of the representors are created. What's the issue then?

That is the ordering problem I am trying to solve.

On a DPU, the host PF cannot finish loading until the ECPF moves the eswitch to switchdev/switchdev_inactive. So we need to do that transition during ECPF driver init, as early as possible. Waiting for userspace means the host PF stays blocked until userspace is up and has the right logic.

That is not always true in practice, the driver may be built in, loaded from an initramfs, or the initramfs may simply not contain the devlink policy we need.

Also, after talking with Parav, my understanding is that we need to support both switchdev and switchdev_inactive, since different customers want different boot behavior. Once we do the transition, the host PF can load and may start sending packets. At that point the initial mode already matters: in switchdev_inactive packets are dropped until userspace programs the pipeline; in switchdev they may reach the FDB before the pipeline is ready.

Quoted 8 lines
Quoted 3 lines

So I do not think an early userspace transition is equivalent here. The initial mode needs to be known by the kernel before userspace runs, which is why I am proposing the devlink= command line default.

Okay fair enough. Could you please at least make sure this is mode only config and noone would ever think about abusing this for any other configuration? Perhaps call it "devlink_eswitch_mode=" to remove the "devlink=" namespace flexibility?

Sure, something along these lines:
devlink_eswitch_mode=[*]:switchdev devlink_eswitch_mode=[pci/0000:08:00.0,pci/0000:09:00.1]:switchdev_inactive

The proper (not RFC) series will have 3 patches:

- devlink: add the command-line default eswitch mode handling
- mlx5: cleanup/prep patch
- mlx5: use the devlink API to apply the early eswitch mode

Since the mlx5 changes are part of the series, I suspect this will need to go through Tariq. The patches are ready, but are currently in our submission queue.

Mark

maintainer
#23 lore raw
In reply to Jiri Pirko
Quoted 9 lines · On Sat, 9 May 2026 09:01:23 +0200 Jiri Pirko wrote:
Quoted 7 lines · Sat, May 09, 2026 at 02:52:13AM +0200, [email protected] wrote:

On Fri, 8 May 2026 20:07:44 +0200 Jiri Pirko wrote:
legacy vs switchdev only describes the eswitch configuration. As a non-SR-IOV user I really don't want to see the extra representors hanging around my systems, confusing all daemons. IIRC mlx5 had some limitations around the uplink representor. Maybe that's the disconnect. But for a real, fully featured switchdev eswitches having the PHY and PF representors on boot, always, will not make sense.

Quoted 4 lines

As "a non-SR-IOV user", what extra representors you talk about? When you have pfs only, you don't have anything extra. Just 1 netdev per-pf, one devlink port per-pf. What's extra about it? When you don't have VFs/SFs. Everyhing is the same:

Some devices have separate uplink ports and PF representors. As I said, what you're proposing isn't going to work for all drivers.

Quoted 9 lines
Quoted 8 lines
Quoted 2 lines

Well, as any other nv config, it persists across kernels/hosts. Think about it as "unbreak-my-not-legacy-device" bit.

For most devices the switchdev mode does not change anything substantial about the device. It's purely a kernel / driver config. It changes what objects and default rules kernel / driver installs. So I don't get why it would make sense to flash into the device nvmem a Linux SW stack specific config.

Quoted 4 lines

I look at it from the perspective that from some CX generation, switchdev mode should be default. So that is a device-based decision. I believe as such it can optionally be permanenty configured (nv config) on older device. Why not?

Feels a bit arbitrary and won't cover all cases. The question should be why you are nacking a more reasonable solution. Keeping Linux config in Linux params.

maintainer
#24 lore raw
Quoted 10 lines · Sun, May 10, 2026 at 06:37:32PM +0200, [email protected] wrote:
Quoted 9 lines · On Sat, 9 May 2026 09:01:23 +0200 Jiri Pirko wrote:
Quoted 7 lines · Sat, May 09, 2026 at 02:52:13AM +0200, [email protected] wrote:

On Fri, 8 May 2026 20:07:44 +0200 Jiri Pirko wrote:
legacy vs switchdev only describes the eswitch configuration. As a non-SR-IOV user I really don't want to see the extra representors hanging around my systems, confusing all daemons. IIRC mlx5 had some limitations around the uplink representor. Maybe that's the disconnect. But for a real, fully featured switchdev eswitches having the PHY and PF representors on boot, always, will not make sense.

Quoted 7 lines
Quoted 4 lines

As "a non-SR-IOV user", what extra representors you talk about? When you have pfs only, you don't have anything extra. Just 1 netdev per-pf, one devlink port per-pf. What's extra about it? When you don't have VFs/SFs. Everyhing is the same:

Some devices have separate uplink ports and PF representors. As I said, what you're proposing isn't going to work for all drivers.

Well, the point is, mlx5 appears to the the one needing this, not other drivers. What I'm trying to point at, mlx5 should not need this. It makes things compicated, adding a ugly knob for no good reason. Legacy/switchdev mode, in both, the non-sriov/eswitch user should not see different behaviour. The mode is an eswitch attribute.

devlink dev eswitch set - sets devlink device eswitch attributes
mode { legacy | switchdev }
Set eswitch mode

legacy - Legacy SRIOV

switchdev - SRIOV switchdev offloads

Briefly looking over other drivers, looks like ice, bnxt, octeon, sfc, there is no new entity created in case of switching to switchdev mode. The only driver that creates separate pf entities seems to be nfp, but the mode seems to be determined by the app being run (loaded firmware).

Am I missing something?

Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
Quoted 3 lines

Well, as any other nv config, it persists across kernels/hosts. Think about it as "unbreak-my-not-legacy-device" bit.

For most devices the switchdev mode does not change anything substantial about the device. It's purely a kernel / driver config. It changes what objects and default rules kernel / driver installs. So I don't get why it would make sense to flash into the device nvmem a Linux SW stack specific config.

Quoted 6 lines
Quoted 4 lines

I look at it from the perspective that from some CX generation, switchdev mode should be default. So that is a device-based decision. I believe as such it can optionally be permanenty configured (nv config) on older device. Why not?

Feels a bit arbitrary and won't cover all cases. The question should be

What cases it does not cover? I don't follow.

Quoted 2 lines

why you are nacking a more reasonable solution. Keeping Linux config in Linux params.

What's reasonable about adding basically a module option (kernel cmdline is pretty much the same) for no reason?

maintainer
#25 lore raw
Quoted 26 lines · On Mon, 11 May 2026 10:42:56 +0200 Jiri Pirko wrote:
Quoted 9 lines · Sun, May 10, 2026 at 06:37:32PM +0200, [email protected] wrote:
Quoted 5 lines · On Sat, 9 May 2026 09:01:23 +0200 Jiri Pirko wrote:

Sat, May 09, 2026 at 02:52:13AM +0200, [email protected] wrote:
As "a non-SR-IOV user", what extra representors you talk about? When you have pfs only, you don't have anything extra. Just 1 netdev per-pf, one devlink port per-pf. What's extra about it? When you don't have VFs/SFs. Everyhing is the same:

Some devices have separate uplink ports and PF representors. As I said, what you're proposing isn't going to work for all drivers.

Well, the point is, mlx5 appears to the the one needing this, not other drivers. What I'm trying to point at, mlx5 should not need this. It makes things compicated, adding a ugly knob for no good reason. Legacy/switchdev mode, in both, the non-sriov/eswitch user should not see different behaviour. The mode is an eswitch attribute.

devlink dev eswitch set - sets devlink device eswitch attributes
mode { legacy | switchdev }
Set eswitch mode

legacy - Legacy SRIOV

switchdev - SRIOV switchdev offloads

Quoted 7 lines

Briefly looking over other drivers, looks like ice, bnxt, octeon, sfc, there is no new entity created in case of switching to switchdev mode. The only driver that creates separate pf entities seems to be nfp, but the mode seems to be determined by the app being run (loaded firmware).

Am I missing something?

Hm. Okay, I wasn't aware that mlx5 was the only driver that did heavy-duty reinit for switching modes.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

I look at it from the perspective that from some CX generation, switchdev mode should be default. So that is a device-based decision. I believe as such it can optionally be permanenty configured (nv config) on older device. Why not?

Feels a bit arbitrary and won't cover all cases. The question should be

What cases it does not cover? I don't follow.

Other FW and HW versions. People are still using EOL devices (CX4/CX5), IIUC the nvmem config path would require FW upgrade.

Quoted 5 lines
Quoted 2 lines

why you are nacking a more reasonable solution. Keeping Linux config in Linux params.

What's reasonable about adding basically a module option (kernel cmdline is pretty much the same) for no reason?

The initial patch as posted added this to a mlx5-specific module param. If we need a module param IMO generic one is much better. Doesn't matter if other drivers take no time to reinit into switchdev mode, having to switch mlx5 with a module param and all the rest in runtime is not the best user experience?

maintainer
#26 lore raw
Quoted 43 lines · Tue, May 12, 2026 at 01:41:32AM +0200, [email protected] wrote:
Quoted 26 lines · On Mon, 11 May 2026 10:42:56 +0200 Jiri Pirko wrote:
Quoted 9 lines · Sun, May 10, 2026 at 06:37:32PM +0200, [email protected] wrote:
Quoted 5 lines · On Sat, 9 May 2026 09:01:23 +0200 Jiri Pirko wrote:

Sat, May 09, 2026 at 02:52:13AM +0200, [email protected] wrote:
As "a non-SR-IOV user", what extra representors you talk about? When you have pfs only, you don't have anything extra. Just 1 netdev per-pf, one devlink port per-pf. What's extra about it? When you don't have VFs/SFs. Everyhing is the same:

Some devices have separate uplink ports and PF representors. As I said, what you're proposing isn't going to work for all drivers.

Well, the point is, mlx5 appears to the the one needing this, not other drivers. What I'm trying to point at, mlx5 should not need this. It makes things compicated, adding a ugly knob for no good reason. Legacy/switchdev mode, in both, the non-sriov/eswitch user should not see different behaviour. The mode is an eswitch attribute.

devlink dev eswitch set - sets devlink device eswitch attributes
mode { legacy | switchdev }
Set eswitch mode

legacy - Legacy SRIOV

switchdev - SRIOV switchdev offloads

Quoted 7 lines

Briefly looking over other drivers, looks like ice, bnxt, octeon, sfc, there is no new entity created in case of switching to switchdev mode. The only driver that creates separate pf entities seems to be nfp, but the mode seems to be determined by the app being run (loaded firmware).

Am I missing something?

Hm. Okay, I wasn't aware that mlx5 was the only driver that did heavy-duty reinit for switching modes.

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

I look at it from the perspective that from some CX generation, switchdev mode should be default. So that is a device-based decision. I believe as such it can optionally be permanenty configured (nv config) on older device. Why not?

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Feels a bit arbitrary and won't cover all cases. The question should be

What cases it does not cover? I don't follow.

Other FW and HW versions. People are still using EOL devices (CX4/CX5), IIUC the nvmem config path would require FW upgrade.

If user wants to have a new feature (a bit odd to call this feature, but ok), he is obliged to upgrade FW. What's wrong about it?

But, even without nvconfig knob, what's stopping us from fixing the behaviour (/bugs) and just make "switchdev" mode default in net-next for all in mlx5 driver? Again, perhaps I'm missing something.

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

why you are nacking a more reasonable solution. Keeping Linux config in Linux params.

Quoted 8 lines
Quoted 2 lines

What's reasonable about adding basically a module option (kernel cmdline is pretty much the same) for no reason?

The initial patch as posted added this to a mlx5-specific module param. If we need a module param IMO generic one is much better. Doesn't matter if other drivers take no time to reinit into switchdev mode, having to switch mlx5 with a module param and all the rest in runtime is not the best user experience?

I still believe we don't need either, not module param, not cmdline devlink option. We just need to fix bugs and have proper defaults. The rest is shortcut.