[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <pdk3mppsxfyuot7cfej2xy5xfszcyqyme2i6l2uqr3pnmgp22d@6zf74g2qwhol>
Date: Tue, 29 Apr 2025 18:33:05 +0200
From: Jiri Pirko <jiri@...nulli.us>
To: Przemek Kitszel <przemyslaw.kitszel@...el.com>
Cc: Jakub Kicinski <kuba@...nel.org>, 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
Tue, Apr 29, 2025 at 03:54:53PM +0200, przemyslaw.kitszel@...el.com wrote:
>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.
Isn't that exactly what we do here in devlink params? Am I missing
something?
Powered by blists - more mailing lists