[PATCH net-next v4 0/6] devlink: net/mlx5: implement swp_l4_csum_mode via devlink params
From: Daniel Zahka <daniel.zahka@gmail.com>
Date: 2025-11-18 00:24:37
Also in:
linux-doc, linux-rdma
This series introduces a new devlink feature for querying param
default values, and resetting params to their default values. This
feature is then used to implement a new mlx5 driver param.
The series starts with two pure refactor patches: one that passes
through the extack to devlink_param::get() implementations. And a
second small refactor that prepares the netlink tlv handling code in
the devlink_param::get() path to better handle default parameter
values.
The third patch introduces the uapi and driver api for default
parameter values. The driver api is opt-in, and both the uapi and
driver api preserve existing behavior when not used by drivers or
older userapace binaries.
The fourth patch introduces the a new mlx5 driver param,
swp_l4_csum_mode, for controlling tx csum behavior. The "l4_only"
value of this param is a dependency for PSP initialization on CX7
NICs.
Lastly, the series introduces a new driver param with cmode runtime to
netdevsim, and then uses this param in a new testcase for netdevsim
devlink params.
Here are some examples of using the default param uapi with the devlink
cli. Note the devlink cli binary I am using has changes which I am
posting in accompanying series targeting iproute2-next:
# netdevsim
./devlink dev param show netdevsim/netdevsim0
netdevsim/netdevsim0:
name max_macs type generic
values:
cmode driverinit value 32 default 32
name test1 type driver-specific
values:
cmode driverinit value true default true
# set to false
./devlink dev param set netdevsim/netdevsim0 name test1 value false cmode driverinit
./devlink dev param show netdevsim/netdevsim0
netdevsim/netdevsim0:
name max_macs type generic
values:
cmode driverinit value 32 default 32
name test1 type driver-specific
values:
cmode driverinit value false default true
# set back to default
./devlink dev param set netdevsim/netdevsim0 name test1 default cmode driverinit
./devlink dev param show netdevsim/netdevsim0
netdevsim/netdevsim0:
name max_macs type generic
values:
cmode driverinit value 32 default 32
name test1 type driver-specific
values:
cmode driverinit value true default true
# mlx5 params on cx7
./devlink dev param show pci/0000:01:00.0
pci/0000:01:00.0:
name max_macs type generic
values:
cmode driverinit value 128 default 128
...
name swp_l4_csum_mode type driver-specific
values:
cmode permanent value default default default
# set to l4_only
./devlink dev param set pci/0000:01:00.0 name swp_l4_csum_mode value l4_only cmode permanent
./devlink dev param show pci/0000:01:00.0 name swp_l4_csum_mode
pci/0000:01:00.0:
name swp_l4_csum_mode type driver-specific
values:
cmode permanent value l4_only default default
# reset to default
./devlink dev param set pci/0000:01:00.0 name swp_l4_csum_mode default cmode permanent
./devlink dev param show pci/0000:01:00.0 name swp_l4_csum_mode
pci/0000:01:00.0:
name swp_l4_csum_mode type driver-specific
values:
cmode permanent value default default default
CHANGES:
v4:
- add test case for default params.
- add new cmode runtime test param to netdevsim.
- introduce uapi and driver api for supporting default param values.
- rename device_default to default in mlx5 patch.
v3: https://lore.kernel.org/netdev/20251107204347.4060542-1-daniel.zahka@gmail.com/ (local)
- fix warnings about undocumented param in intel ice driver
v2: https://lore.kernel.org/netdev/20251103194554.3203178-1-daniel.zahka@gmail.com/ (local)
- fix indentation issue in new mlx5.rst entry
- use extack in mlx5_nv_param_devlink_swp_l4_csum_mode_get()
- introduce extack patch.
v1: https://lore.kernel.org/netdev/20251022190932.1073898-1-daniel.zahka@gmail.com/ (local)
Daniel Zahka (6):
devlink: pass extack through to devlink_param::get()
devlink: refactor devlink_nl_param_value_fill_one()
devlink: support default values for param-get and param-set
net/mlx5: implement swp_l4_csum_mode via devlink params
netdevsim: register a new devlink param with default value interface
selftest: netdevsim: test devlink default params
Documentation/netlink/specs/devlink.yaml | 9 +
.../networking/devlink/devlink-params.rst | 10 +
Documentation/networking/devlink/mlx5.rst | 14 ++
.../marvell/octeontx2/otx2_cpt_devlink.c | 6 +-
drivers/net/ethernet/amd/pds_core/core.h | 3 +-
drivers/net/ethernet/amd/pds_core/devlink.c | 3 +-
.../net/ethernet/broadcom/bnxt/bnxt_devlink.c | 6 +-
.../net/ethernet/intel/i40e/i40e_devlink.c | 3 +-
.../net/ethernet/intel/ice/devlink/devlink.c | 14 +-
.../marvell/octeontx2/af/rvu_devlink.c | 15 +-
.../marvell/octeontx2/nic/otx2_devlink.c | 6 +-
drivers/net/ethernet/mellanox/mlx4/main.c | 6 +-
.../net/ethernet/mellanox/mlx5/core/devlink.h | 3 +-
.../net/ethernet/mellanox/mlx5/core/eswitch.c | 3 +-
.../mellanox/mlx5/core/eswitch_offloads.c | 3 +-
.../net/ethernet/mellanox/mlx5/core/fs_core.c | 3 +-
.../ethernet/mellanox/mlx5/core/fw_reset.c | 3 +-
.../mellanox/mlx5/core/lib/nv_param.c | 238 +++++++++++++++++-
.../mellanox/mlxsw/spectrum_acl_tcam.c | 3 +-
.../ethernet/netronome/nfp/devlink_param.c | 3 +-
drivers/net/ethernet/qlogic/qed/qed_devlink.c | 3 +-
.../net/ethernet/stmicro/stmmac/stmmac_main.c | 3 +-
drivers/net/ethernet/ti/am65-cpsw-nuss.c | 3 +-
drivers/net/ethernet/ti/cpsw_new.c | 6 +-
drivers/net/netdevsim/dev.c | 55 ++++
drivers/net/netdevsim/netdevsim.h | 1 +
drivers/net/wwan/iosm/iosm_ipc_devlink.c | 3 +-
include/net/devlink.h | 45 +++-
include/net/dsa.h | 3 +-
include/uapi/linux/devlink.h | 3 +
net/devlink/netlink_gen.c | 5 +-
net/devlink/param.c | 180 +++++++++----
net/dsa/devlink.c | 3 +-
.../drivers/net/netdevsim/devlink.sh | 113 ++++++++-
34 files changed, 689 insertions(+), 91 deletions(-)
--
2.47.3