Skip to content

devlink: support u64-array devlink parameters

Ratheesh Kannoth lkml netdev 4 versions – Applied

Status from this message: This series was applied to iproute2/iproute2-next.git (main)

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest2 patches 0 repliesApplied
  2. v42 patches 1 replySuperseded
  3. v32 patches 3 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v22 patches5 repliesSuperseded

Patches in v5 Applied

#Subject and filesSizeRepliesApplied
1/2devlink: use DEVLINK_VAR_ATTR_TYPE_* in param show/setdevlink/devlink.c+17 -170 replies
2/2devlink: support u64-array values in devlink param show/setdevlink/devlink.c+223 -230 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v5 yet.

Read the v5 thread

Cover letter [PATCH iproute2-next v5 0/2] devlink: support u64-array devlink parameters

The kernel gained support for devlink parameters of type DEVLINK_VAR_ATTR_TYPE_U64_ARRAY. These parameters carry a variable-length list of u64 values encoded as multiple DEVLINK_ATTR_PARAM_VALUE_DATA attributes. This is used by drivers that need to expose ordered lists of configuration values, such as the Marvell CN20K npc_srch_order parameter.

This series updates the devlink tool to handle the new UAPI and adds show/set support for u64-array parameters on both device and port params.

Patch 1 switches devlink param show/set to use DEVLINK_VAR_ATTR_TYPE_* constants instead of generic MNL_TYPE_* values when interpreting DEVLINK_ATTR_PARAM_TYPE. The kernel now reports param types using devlink_var_attr_type, so userspace must use the matching symbols.

Patch 2 adds parsing, display, and configuration support for DEVLINK_VAR_ATTR_TYPE_U64_ARRAY. Values are shown as a space-separated list of u64 elements. Setting accepts a space- or comma-separated list and emits one DEVLINK_ATTR_PARAM_VALUE_DATA attribute per element.

Tested on CN20K hardware with npc_srch_order:

  # show search order
  devlink dev param show pci/0002:01:00.0 name npc_srch_order
  pci/0002:01:00.0:
    name npc_srch_order type driver-specific
      values:
        cmode runtime value  value  0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
  # set search order
  devlink dev param set pci/0002:01:00.0 name npc_srch_order \
    value 31,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30 \
    cmode runtime

Ratheesh Kannoth (2):
devlink: use DEVLINK_VAR_ATTR_TYPE_* in param show/set
devlink: support u64-array values in devlink param show/set

 devlink/devlink.c            | 178 ++++++++++++++++++++++++++++++++---
 include/uapi/linux/devlink.h |   1 +
 2 files changed, 164 insertions(+), 15 deletions(-)

--
v4 -> v5: Addressed David comments

	https://lore.kernel.org/netdev/[email protected]/

v3 -> v4: Addressed David comments

	https://lore.kernel.org/netdev/[email protected]/

v2 -> v3: Addressed David comments

	https://lore.kernel.org/netdev/akSCBN0N_7ug1-Fy@rkannoth-OptiPlex-7090/

v1 -> v2: Addressed David comments

	https://lore.kernel.org/netdev/[email protected]/

2.43.0