From: David Ahern <dsahern@kernel.org>
To: Ratheesh Kannoth <rkannoth@marvell.com>,
stephen@networkplumber.org, kuba@kernel.org,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Cc: andrew+netdev@lunn.ch, edumazet@google.com, pabeni@redhat.com,
jiri@resnulli.us
Subject: Re: [PATCH iproute2-next v4 2/2] devlink: support u64-array values in devlink param show/set
Date: Wed, 8 Jul 2026 09:18:16 -0600 [thread overview]
Message-ID: <d7e3955e-6605-4de9-9641-f1755de65f1a@kernel.org> (raw)
In-Reply-To: <20260702031359.2392868-3-rkannoth@marvell.com>
On 7/1/26 9:13 PM, Ratheesh Kannoth wrote:
> diff --git a/devlink/devlink.c b/devlink/devlink.c
> index 803ea5d7..5d092d92 100644
> --- a/devlink/devlink.c
> +++ b/devlink/devlink.c
> @@ -3516,12 +3516,143 @@ static const struct param_val_conv param_val_conv[] = {
>
> #define PARAM_VAL_CONV_LEN ARRAY_SIZE(param_val_conv)
>
> +struct devlink_param_u64_array {
> + uint64_t size;
use of uint64_t here causes claude to comment:
Style 2: int i loop counter vs uint64_t size field in
param_value_u64_array_put_from_str() — signed/unsigned comparison.
> + uint64_t *val;
> +};
> +
> +static void param_value_u64_array_free(struct devlink_param_u64_array *arr)
> +{
> + free(arr->val);
> + arr->val = NULL;
> + arr->size = 0;
> +}
> +
> +static int param_value_nested_u64_attr_cb(const struct nlattr *attr, void *data)
> +{
> + struct devlink_param_u64_array *arr = data;
> + unsigned int len;
> + uint64_t val;
> + uint64_t *new_val;
iproute2 follows netdev coding style - reverse xmas tree.
other comments from claude:
Bug 1 (both cmd_dev_param_set and cmd_port_param_set): When the new and
current U64_ARRAY values are equal, param_value_u64_array_put_from_str()
returns 1 as a sentinel. The code jumps to out: but err is still 1, so
the function returns a non-zero error code to its caller even though
nothing went wrong. All other types reach goto out with err = 0 because
a prior mnlu_gen_socket_sndrcv() call succeeded. Fix: explicitly set err
= 0 before the goto.
Bug 2 (JSON output for U64_ARRAY in pr_out_param_value_print): The loop
calls print_u64(PRINT_ANY, label, ...) with the same key on every
iteration. In JSON mode this produces duplicate keys ("value": 0,
"value": 1, ...), which is invalid JSON. Needs
open_json_array()/close_json_array() wrapping the loop.
Style 1: flag_as_u8 is repurposed to select which netlink attribute to
parse for U64_ARRAY — its name is completely unrelated to this use,
making the code fragile.
Please show json output in the commit message as well.
prev parent reply other threads:[~2026-07-08 15:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-02 3:13 [PATCH iproute2-next v4 0/2] devlink: support u64-array devlink parameters Ratheesh Kannoth
2026-07-02 3:13 ` [PATCH iproute2-next v4 1/2] devlink: use DEVLINK_VAR_ATTR_TYPE_* in param show/set Ratheesh Kannoth
2026-07-02 3:13 ` [PATCH iproute2-next v4 2/2] devlink: support u64-array values in devlink " Ratheesh Kannoth
2026-07-08 15:18 ` 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=d7e3955e-6605-4de9-9641-f1755de65f1a@kernel.org \
--to=dsahern@kernel.org \
--cc=andrew+netdev@lunn.ch \
--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=rkannoth@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