Netdev List
 help / color / mirror / Atom feed
From: David Ahern <dsahern@kernel.org>
To: Ratheesh Kannoth <rkannoth@marvell.com>, pablo@netfilter.org
Cc: stephen@networkplumber.org, kuba@kernel.org,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
	pabeni@redhat.com, sgoutham@marvell.com,
	Jiri Pirko <jiri@resnulli.us>
Subject: Re: [PATCH iproute2-next] devlink: support u32-array values in devlink param show/set
Date: Mon, 29 Jun 2026 08:19:48 -0600	[thread overview]
Message-ID: <b93b6a29-2ced-4a0e-82ba-1da8225f9308@kernel.org> (raw)
In-Reply-To: <akHW1ZiovKdwUq6s@rkannoth-OptiPlex-7090>

On 6/28/26 8:22 PM, Ratheesh Kannoth wrote:
> On 2026-06-28 at 22:49:48, David Ahern (dsahern@kernel.org) 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 uapi is actually devlink_var_attr_type and in this case
DEVLINK_VAR_ATTR_TYPE_U64_ARRAY.

> 
> 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@marvell.com/).

I agree with them.

Looking at the use of devlink_var_attr_type it is duplicating MNL values
for the early entries, but it is not nla_type as part of the nla_attr
uapi. Seems to me the 'nla_type' reference in the code is misleading.

I think cmd_dev_param_set in iproute2 needs to be changed to reference
devlink_var_attr_type instead of MNL_TYPE_*. With that as a prep patch,
add in the new use of DEVLINK_VAR_ATTR_TYPE_U64_ARRAY for this patch.
@Jiri: agree?

And then your subject line and commit message need to be updated to
reference a u64 array, not u32, correct?

> 
> 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.
> 
>>


      reply	other threads:[~2026-06-29 14:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-15  4:10 [PATCH iproute2-next] devlink: support u32-array values in devlink param show/set Ratheesh Kannoth
2026-06-28 17:19 ` David Ahern
2026-06-29  2:22   ` Ratheesh Kannoth
2026-06-29 14:19     ` David Ahern [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b93b6a29-2ced-4a0e-82ba-1da8225f9308@kernel.org \
    --to=dsahern@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pablo@netfilter.org \
    --cc=rkannoth@marvell.com \
    --cc=sgoutham@marvell.com \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox