[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b7a4d9cf-2606-4d0f-8164-ae3e05069388@intel.com>
Date: Tue, 29 Apr 2025 15:54:53 +0200
From: Przemek Kitszel <przemyslaw.kitszel@...el.com>
To: Jiri Pirko <jiri@...nulli.us>, Jakub Kicinski <kuba@...nel.org>
CC: Saeed Mahameed <saeed@...nel.org>, "David S. Miller"
<davem@...emloft.net>, Paolo Abeni <pabeni@...hat.com>, Eric Dumazet
<edumazet@...gle.com>, Saeed Mahameed <saeedm@...dia.com>,
<netdev@...r.kernel.org>, Tariq Toukan <tariqt@...dia.com>, Gal Pressman
<gal@...dia.com>, Leon Romanovsky <leonro@...dia.com>, Jiri Pirko
<jiri@...dia.com>
Subject: Re: [PATCH net-next V3 14/15] devlink: Implement devlink param multi
attribute nested data values
On 4/29/25 13:34, Jiri Pirko wrote:
> Tue, Apr 29, 2025 at 01:17:32AM +0200, kuba@...nel.org wrote:
>> On Fri, 25 Apr 2025 14:48:07 -0700 Saeed Mahameed wrote:
>>> + case DEVLINK_PARAM_TYPE_ARR_U32:
>>> + len = 0;
>>> + nla_for_each_attr_type(param_data,
>>> + DEVLINK_ATTR_PARAM_VALUE_DATA,
>>> + genlmsg_data(info->genlhdr),
>>> + genlmsg_len(info->genlhdr), rem) {
>>> + if (nla_len(param_data) != sizeof(u32)) {
>>> + NL_SET_ERR_MSG_MOD(extack,
>>> + "Array element size must be 4 bytes");
>>> + return -EINVAL;
>>> + }
>>> + if (++len > __DEVLINK_PARAM_MAX_ARRAY_SIZE) {
>>> + NL_SET_ERR_MSG_MOD(extack,
>>> + "Array size exceeds maximum");
>>> + return -EINVAL;
>>> + }
>>> + }
>>> + if (len)
>>> + return 0;
>>> + NL_SET_ERR_MSG_MOD(extack,
>>> + "Value array must have at least one entry");
>>> + break;
>>
>> I'd really rather not build any more complexity into this funny
>> indirect attribute construct. Do you have many more arrays to expose?
>
> How else do you imagine to expose arrays in params?
> Btw, why is it "funny"? I mean, if you would be designing it from
> scratch, how would you do that (params with multiple types) differently?
> From netlink perspective there's nothing wrong with it, is it?
>
I would put name, type (array of u32's), array len, then the content.
Powered by blists - more mailing lists