Skip to content

devlink: Add boot-time eswitch mode defaults

Mark Bloch linux-doc linux-rdma netdev 8 versions – NAK

Status from this message: Nack, please don't insert such hacks into core helpers :|

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v7 Latest4 patches 8 repliesNAK
  2. v64 patches 3 repliesSuperseded
  3. v56 patches 8 repliesSuperseded
Earlier versions · 5
VersionPostedPatchesRepliesStatus
v46 patches12 repliesSuperseded
v37 patches7 repliesSuperseded
v2 posting 2/27 patches6 repliesSuperseded
v2 RFC posting 1/22 patches0 repliesSuperseded
v1 RFC4 patches22 repliesSuperseded

Changes in v7 from the cover letter

- Added Reviewed-by tags from Jiri Pirko.

- Renamed the default eswitch mode functions to spell out eswitch instead of esw.

- Renamed the per-devlink initialization helper to devlink_default_eswitch_mode_init(), dropping instance from its name.

Patches in v7

#Subject and filesSizeRepliesApplied
1/4net/mlx5: Clear FW reset-in-progress bit before reloaddrivers/net/ethernet/mellanox/mlx5/core/fw_reset.c+17 -110 replies
2/4devlink: Factor out eswitch mode settingnet/devlink/dev.c net/devlink/devl_internal.h+23 -70 replies
3/4devlink: Parse eswitch mode boot defaultsDocumentation/admin-guide/kernel-parameters.txt Documentation/networking/devlink/devlink-defaults.rst Documentation/networking/devlink/index.rst +4 more+351 -10 replies
4/4devlink: Apply eswitch mode boot defaultsnet/devlink/core.c net/devlink/default.c net/devlink/dev.c +1 more+82 -28 replies

Reviews trailers per patch

All 4 patches have a Reviewed-by or Acked-by.

PatchShay DroriMoshe ShemeshJiri Pirko
1/4R-b R-b
2/4R-b
3/4R-b
4/4R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v7 thread

Cover letter [PATCH net-next V7 0/4] devlink: Add boot-time eswitch mode defaults

This series adds a devlink_eswitch_mode= kernel command line parameter for setting a default devlink eswitch mode during boot.

Following the discussion with Jakub[1] and the feedback on the RFC postings, this version keeps the scope limited to a boot-time devlink eswitch mode default only.

The option selects either all devlink handles or an explicit comma-separated handle list:

devlink_eswitch_mode=*=switchdev devlink_eswitch_mode=pci/0000:08:00.0,pci/0000:09:00.1=switchdev_inactive

The supported modes are legacy, switchdev and switchdev_inactive. The selected mode is applied through the existing eswitch_mode_set() devlink operation, the same operation used by the devlink eswitch mode command.

Registration may happen while a driver holds the devlink lock and continues device initialization. Devlink core marks the default as pending and applies it from devl_unlock() once the instance is registered, before releasing the lock. This prevents userspace from racing with the boot default.

After a successful reload that performed DRIVER_REINIT, devlink core already holds the devlink instance lock and the driver completed reload_up(), so the default is applied directly from the reload path.

Patch 1 clears the mlx5 FW reset-in-progress bit before reload.

Patch 2 factors the common eswitch mode set validation into a helper.

Patch 3 adds the devlink_eswitch_mode= parser and documentation.

Patch 4 applies parsed defaults from devlink core.

Changelog:

v6 -> v7:

- Added Reviewed-by tags from Jiri Pirko.

- Renamed the default eswitch mode functions to spell out eswitch instead of esw.

- Renamed the per-devlink initialization helper to devlink_default_eswitch_mode_init(), dropping instance from its name.

v5 -> v6:

- Dropped regular work and applied a pending default directly from devl_unlock() while the devlink instance lock is still held.

- Dropped the driver API and mlx5-specific default application patches.

v4 -> v5:

- Moved the default eswitch mode code into a separate file, per Jiri's comment.

- Dropped the delayed workqueue and switched to regular work triggered via devl_unlock(), per Jiri's comment.

- Renamed some functions to better align with devlink code.

v3 -> v4:

- Rework registration time apply to use per devlink work queued from devl_unlock(), instead of calling eswitch_mode_set() directly from devl_register().

- Apply the default directly after successful DRIVER_REINIT devlink reload, where the devlink lock is already held and reload_up() has completed.

- Add devl_apply_default_esw_mode() for drivers that know their exact ready point.

- Drop the driver registration-ordering preparation patches that are no longer needed with the async registration apply path.

v2 -> v3:

- Change the devlink_eswitch_mode= API syntax to use <selector>=<mode> instead of [<selector>]:<mode>, following a comment from Randy Dunlap.

v1 -> v2:

- Move default eswitch mode application into devlink core. The default is now applied during devlink registration and after a successful devlink reload that performed DRIVER_REINIT.

- Remove the exported devl_apply_default_esw_mode() driver API and the mlx5 driver-side call to it.

- Skip devlink health recovery notifications while the devlink instance is not registered, so drivers can move registration later without early health work hitting registration assertions.

- Move mlx5 devlink registration after device initialization, including the lightweight init path, so the core can apply the default through the normal registration flow.

- Move the matching netdevsim and mlx5 unregister paths before object teardown, so unregister notifications come from devl_unregister() and the later object teardown paths run while the devlink instance is no longer registered.

- Add registration-ordering preparation patches for netdevsim and octeontx2 AF/PF, so their eswitch state is ready before registration-time defaults may call eswitch_mode_set().

[1] lore.kernel.org/r/[email protected]/ RFC v1: lore.kernel.org/r/[email protected]/ RFC v2: lore.kernel.org/r/[email protected]/
v1: lore.kernel.org/r/[email protected]/
v2: lore.kernel.org/all/[email protected]/
v3: lore.kernel.org/all/[email protected]/
v4: lore.kernel.org/all/[email protected]/
v5: lore.kernel.org/all/[email protected]/
v6: lore.kernel.org/all/[email protected]/

Mark Bloch (4):
net/mlx5: Clear FW reset-in-progress bit before reload
devlink: Factor out eswitch mode setting
devlink: Parse eswitch mode boot defaults
devlink: Apply eswitch mode boot defaults

 .../admin-guide/kernel-parameters.txt         |  25 ++
 .../networking/devlink/devlink-defaults.rst   |  78 +++++
 Documentation/networking/devlink/index.rst    |   1 +
 .../ethernet/mellanox/mlx5/core/fw_reset.c    |  28 +-
 net/devlink/Makefile                          |   2 +-
 net/devlink/core.c                            |  10 +
 net/devlink/default.c                         | 303 ++++++++++++++++++
 net/devlink/dev.c                             |  33 +-
 net/devlink/devl_internal.h                   |  10 +
 9 files changed, 471 insertions(+), 19 deletions(-)
 create mode 100644 Documentation/networking/devlink/devlink-defaults.rst
 create mode 100644 net/devlink/default.c

base-commit: f6f3b36c15ed44de1fbb44e645e4fae8c4a4453e

Signature · 1 line
2.43.0