From: Saeed Mahameed <saeed@kernel.org>
To: Simon Horman <horms@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Eric Dumazet <edumazet@google.com>,
Saeed Mahameed <saeedm@nvidia.com>,
netdev@vger.kernel.org, Tariq Toukan <tariqt@nvidia.com>,
Gal Pressman <gal@nvidia.com>,
Leon Romanovsky <leonro@nvidia.com>, Jiri Pirko <jiri@nvidia.com>
Subject: Re: [PATCH net-next 01/14] devlink: define enum for attr types of dynamic attributes
Date: Wed, 19 Mar 2025 15:45:36 -0700 [thread overview]
Message-ID: <Z9tJEDfPK0HecSR5@x130> (raw)
In-Reply-To: <20250306120545.GY3666230@kernel.org>
On 06 Mar 12:05, Simon Horman wrote:
>On Thu, Feb 27, 2025 at 06:12:14PM -0800, Saeed Mahameed wrote:
>> From: Jiri Pirko <jiri@nvidia.com>
>>
>> Devlink param and health reporter fmsg use attributes with dynamic type
>> which is determined according to a different type. Currently used values
>> are NLA_*. The problem is, they are not part of UAPI. They may change
>> which would cause a break.
>>
>> To make this future safe, introduce a enum that shadows NLA_* values in
>> it and is part of UAPI.
>>
>> Also, this allows to possibly carry types that are unrelated to NLA_*
>> values.
>>
>> Signed-off-by: Jiri Pirko <jiri@nvidia.com>
>> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
>> ---
>> Documentation/netlink/specs/devlink.yaml | 23 ++++++++++++++++++
>> include/uapi/linux/devlink.h | 17 ++++++++++++++
>> net/devlink/health.c | 17 ++++++++++++--
>> net/devlink/param.c | 30 ++++++++++++------------
>> 4 files changed, 70 insertions(+), 17 deletions(-)
>>
>> diff --git a/Documentation/netlink/specs/devlink.yaml b/Documentation/netlink/specs/devlink.yaml
>> index 09fbb4c03fc8..e99fc51856c5 100644
>> --- a/Documentation/netlink/specs/devlink.yaml
>> +++ b/Documentation/netlink/specs/devlink.yaml
>> @@ -202,6 +202,29 @@ definitions:
>> name: exception
>> -
>> name: control
>> + -
>> + type: enum
>> + name: dyn_attr_type
>> + entries:
>> + -
>> + name: u8
>> + value: 1
>> + -
>> + name: u16
>> + -
>> + name: u32
>> + -
>> + name: u64
>> + -
>> + name: string
>> + -
>> + name: flag
>> + -
>> + name: nul_string
>> + value: 10
>> + -
>> + name: binary
>> + -
^^^^^^^ extra empty type..
>
>Hi Saeed,
>
>Thanks for these patches.
>
>Unfortunately the above seems to cause ynl-regen to blow up.
Thanks Simon, good catch, there was an extra empty type added by mistake,
see above, will remove in V2.
>I don't know why, but I see:
>
> $ ./tools/net/ynl/ynl-regen.sh
> Traceback (most recent call last):
> File "/home/nipa/net-next/wt-1/tools/net/ynl/pyynl/ynl_gen_c.py", line 3074, in <module>
> main()
> ~~~~^^
> File "/home/nipa/net-next/wt-1/tools/net/ynl/pyynl/ynl_gen_c.py", line 2783, in main
> parsed = Family(args.spec, exclude_ops)
> File "/home/nipa/net-next/wt-1/tools/net/ynl/pyynl/ynl_gen_c.py", line 954, in __init__
> super().__init__(file_name, exclude_ops=exclude_ops)
> ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> File "/home/nipa/net-next/wt-1/tools/net/ynl/pyynl/lib/nlspec.py", line 462, in __init__
> jsonschema.validate(self.yaml, schema)
> ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
> File "/usr/lib/python3.13/site-packages/jsonschema/validators.py", line 1307, in validate
> raise error
> jsonschema.exceptions.ValidationError: None is not of type 'object'
>
> ...
>
>Perhaps I need a newer version of jsonschema?
>
>
>> diff --git a/include/uapi/linux/devlink.h b/include/uapi/linux/devlink.h
>> index 9401aa343673..8cdd60eb3c43 100644
>> --- a/include/uapi/linux/devlink.h
>> +++ b/include/uapi/linux/devlink.h
>> @@ -385,6 +385,23 @@ enum devlink_linecard_state {
>> DEVLINK_LINECARD_STATE_MAX = __DEVLINK_LINECARD_STATE_MAX - 1
>> };
>>
>> +/**
>> + * enum devlink_dyn_attr_type - Dynamic attribute type type.
>
>Perhaps this relates to auto-generation.
>But I think the Kernel doc should also document the enum values:
>DEVLINK_DYN_ATTR_TYPE_U8, ...
>
>> + */
>> +enum devlink_dyn_attr_type {
>> + /* Following values relate to the internal NLA_* values */
>> + DEVLINK_DYN_ATTR_TYPE_U8 = 1,
>> + DEVLINK_DYN_ATTR_TYPE_U16,
>> + DEVLINK_DYN_ATTR_TYPE_U32,
>> + DEVLINK_DYN_ATTR_TYPE_U64,
>> + DEVLINK_DYN_ATTR_TYPE_STRING,
>> + DEVLINK_DYN_ATTR_TYPE_FLAG,
>> + DEVLINK_DYN_ATTR_TYPE_NUL_STRING = 10,
>> + DEVLINK_DYN_ATTR_TYPE_BINARY,
>> + __DEVLINK_DYN_ATTR_TYPE_CUSTOM_BASE = 0x80,
>> + /* Any possible custom types, unrelated to NLA_* values go below */
>> +};
>> +
>> enum devlink_attr {
>> /* don't change the order or add anything between, this is ABI! */
>> DEVLINK_ATTR_UNSPEC,
>
>...
next prev parent reply other threads:[~2025-03-19 22:45 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-28 2:12 [PATCH net-next 00/14] devlink, mlx5: Add new parameters for link management and SRIOV/eSwitch configurations Saeed Mahameed
2025-02-28 2:12 ` [PATCH net-next 01/14] devlink: define enum for attr types of dynamic attributes Saeed Mahameed
2025-03-06 12:05 ` Simon Horman
2025-03-19 22:45 ` Saeed Mahameed [this message]
2025-02-28 2:12 ` [PATCH net-next 02/14] devlink: Add 'total_vfs' generic device param Saeed Mahameed
2025-02-28 12:39 ` Jiri Pirko
2025-03-04 16:42 ` Kamal Heib
2025-02-28 2:12 ` [PATCH net-next 03/14] net/mlx5: Implement cqe_compress_type via devlink params Saeed Mahameed
2025-02-28 2:12 ` [PATCH net-next 04/14] net/mlx5: Implement devlink enable_sriov parameter Saeed Mahameed
2025-02-28 12:46 ` Jiri Pirko
2025-02-28 18:19 ` Saeed Mahameed
2025-03-03 11:35 ` Jiri Pirko
2025-03-03 2:27 ` kernel test robot
2025-03-04 16:43 ` Kamal Heib
2025-02-28 2:12 ` [PATCH net-next 05/14] net/mlx5: Implement devlink total_vfs parameter Saeed Mahameed
2025-03-04 16:45 ` Kamal Heib
2025-02-28 2:12 ` [PATCH net-next 06/14] devlink: pass struct devlink_port * as arg to devlink_nl_param_fill() Saeed Mahameed
2025-02-28 2:12 ` [PATCH net-next 07/14] devlink: Implement port params registration Saeed Mahameed
2025-02-28 11:58 ` Przemek Kitszel
2025-02-28 12:28 ` Jiri Pirko
2025-02-28 13:23 ` Przemek Kitszel
2025-02-28 15:21 ` Jiri Pirko
2025-03-20 8:16 ` Przemek Kitszel
2025-02-28 2:12 ` [PATCH net-next 08/14] devlink: Implement get/dump netlink commands for port params Saeed Mahameed
2025-02-28 2:12 ` [PATCH net-next 09/14] devlink: Implement set netlink command " Saeed Mahameed
2025-02-28 12:49 ` Jiri Pirko
2025-02-28 2:12 ` [PATCH net-next 10/14] devlink: Add 'keep_link_up' generic devlink device param Saeed Mahameed
2025-02-28 12:51 ` Jiri Pirko
2025-02-28 2:12 ` [PATCH net-next 11/14] net/mlx5: Implement devlink keep_link_up port parameter Saeed Mahameed
2025-02-28 12:51 ` Jiri Pirko
2025-02-28 2:12 ` [PATCH net-next 12/14] devlink: Throw extack messages on param value validation error Saeed Mahameed
2025-02-28 12:53 ` Jiri Pirko
2025-03-03 7:06 ` Dan Carpenter
2025-02-28 2:12 ` [PATCH net-next 13/14] devlink: Implement devlink param multi attribute nested data values Saeed Mahameed
2025-02-28 2:12 ` [PATCH net-next 14/14] net/mlx5: Implement eSwitch hairpin per prio buffers devlink params Saeed Mahameed
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=Z9tJEDfPK0HecSR5@x130 \
--to=saeed@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gal@nvidia.com \
--cc=horms@kernel.org \
--cc=jiri@nvidia.com \
--cc=kuba@kernel.org \
--cc=leonro@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=saeedm@nvidia.com \
--cc=tariqt@nvidia.com \
/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