Thread (8 messages) 8 messages, 2 authors, 2d ago

Re: [PATCH iproute2-next v2 2/2] devlink: support u64-array values in devlink param show/set

From: Ratheesh Kannoth <rkannoth@marvell.com>
Date: 2026-07-02 02:47:56
Also in: lkml

On 2026-07-01 at 20:04:56, David Ahern (dsahern@kernel.org) wrote:
On 6/30/26 8:29 PM, Ratheesh Kannoth wrote:
quoted
On 2026-06-30 at 20:06:17, David Ahern (dsahern@kernel.org) wrote:
quoted
On 6/29/26 7:50 PM, Ratheesh Kannoth wrote:
quoted
diff --git a/devlink/devlink.c b/devlink/devlink.c
index 9372e92f..3c29601d 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -3496,13 +3496,115 @@ static const struct param_val_conv param_val_conv[] = {
 };

 #define PARAM_VAL_CONV_LEN ARRAY_SIZE(param_val_conv)
+#define DEVLINK_PARAM_MAX_ARRAY_SIZE 32
Why 32? Is that based on current code?
Yes, this aligns with the current kernel-side limits. See:
https://lore.kernel.org/all/20260609040453.711932-5-rkannoth@marvell.com/ (local)
quoted
How does the kernel side handle
the number of parameters? What happens if the kernel sends more than 32
parameters - from a user's perspective, not this code and processing the
output?
The kernel strictly validates and restricts the number of parameters. To be safe, this patch
adds an explicit bounds check to prevent userspace issues if that threshold is ever crossed.

Ideally, since "union devlink_param_value" is omitted from the UAPI, we have to define
DEVLINK_PARAM_MAX_ARRAY_SIZE here. Moving the underlying structures to the UAPI in the
future would allow us to share a single definition and avoid this hardcoded value in userspace.
iproute2 needs to be backward and forward compatible. As it stands, a
new kernel can allow more than 32 entries and an older iproute2 will not
display all of them. That is wrong.

Let's make the limit part of the uapi. If you do not want to do that
now, then iproute2 code needs to handle a larger size.
ACK.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help