Re: [PATCH iproute2-next] devlink: support u32-array values in devlink param show/set
From: Ratheesh Kannoth
Date: Sun Jun 28 2026 - 22:22:46 EST
On 2026-06-28 at 22:49:48, David Ahern (dsahern@xxxxxxxxxx) wrote:
> On 6/14/26 10:10 PM, Ratheesh Kannoth wrote:
> > @@ -3904,6 +3935,14 @@ static int cmd_dev_param_set(struct dl *dl)
> > if (!strcmp(dl->opts.param_value, ctx.value.vstr))
> > return 0;
> > break;
> > + case 129:
>
> no magic numbers. What does 129 represent? Is there a named macro for
> it? If not, why not if this is part of a UAPI?
The magic number 129 actually represents DEVLINK_PARAM_TYPE_U64_ARRAY from the kernel UAPI (include/uapi/linux/devlink.h).
The other cases in this switch block utilize MNL_TYPE_* constants from libmnl. I previously tried to
patch libmnl to add a matching MNL_TYPE_UARR = 129 macro, but the netfilter maintainers declined it,
noting that the enum is internal to libmnl (thread: https://lore.kernel.org/netfilter-devel/20260623043755.2435685-1-rkannoth@xxxxxxxxxxx/).
To resolve this without magic numbers, I can use the existing kernel macro directly in
the case statement with an explanatory comment, like so:
/* DEVLINK_PARAM_TYPE_U64_ARRAY maps to 129 */
case DEVLINK_PARAM_TYPE_U64_ARRAY:
Please let me know if this approach works for you, or if you prefer a different handling.
>