netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Saeed Mahameed <saeed@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>,
	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 V3 02/15] devlink: define enum for attr types of dynamic attributes
Date: Mon, 28 Apr 2025 16:10:31 -0700	[thread overview]
Message-ID: <20250428161031.2e64b41f@kernel.org> (raw)
In-Reply-To: <20250425214808.507732-3-saeed@kernel.org>

On Fri, 25 Apr 2025 14:47:55 -0700 Saeed Mahameed wrote:
> +/**
> + * enum devlink_var_attr_type - Dynamic attribute type type.

we no longer have "dynamic" in the name

> + */
> +enum devlink_var_attr_type {
> +	/* Following values relate to the internal NLA_* values */
> +	DEVLINK_VAR_ATTR_TYPE_U8 = 1,
> +	DEVLINK_VAR_ATTR_TYPE_U16,
> +	DEVLINK_VAR_ATTR_TYPE_U32,
> +	DEVLINK_VAR_ATTR_TYPE_U64,
> +	DEVLINK_VAR_ATTR_TYPE_STRING,
> +	DEVLINK_VAR_ATTR_TYPE_FLAG,
> +	DEVLINK_VAR_ATTR_TYPE_NUL_STRING = 10,
> +	DEVLINK_VAR_ATTR_TYPE_BINARY,
> +	__DEVLINK_VAR_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,

>  static int
> -devlink_param_type_to_nla_type(enum devlink_param_type param_type)
> +devlink_param_type_to_var_attr_type(enum devlink_param_type param_type)
>  {
>  	switch (param_type) {
>  	case DEVLINK_PARAM_TYPE_U8:
> -		return NLA_U8;
> +		return DEVLINK_VAR_ATTR_TYPE_U8;
>  	case DEVLINK_PARAM_TYPE_U16:
> -		return NLA_U16;
> +		return DEVLINK_VAR_ATTR_TYPE_U16;
>  	case DEVLINK_PARAM_TYPE_U32:
> -		return NLA_U32;
> +		return DEVLINK_VAR_ATTR_TYPE_U32;
>  	case DEVLINK_PARAM_TYPE_STRING:
> -		return NLA_STRING;
> +		return DEVLINK_VAR_ATTR_TYPE_STRING;
>  	case DEVLINK_PARAM_TYPE_BOOL:
> -		return NLA_FLAG;
> +		return DEVLINK_VAR_ATTR_TYPE_FLAG;
>  	default:
>  		return -EINVAL;

Why do you keep the DEVLINK_PARAM_TYPE_* defines around?
IMO it'd be fine to just use them directly instead of adding 
the new enum, fmsg notwithstanding. But failing that we can rename 
in the existing in-tree users to DEVLINK_VAR_ATTR_TYPE_* right?
What does this translating back and forth buy us?

  reply	other threads:[~2025-04-28 23:10 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-25 21:47 [PATCH net-next V3 00/15] devlink, mlx5: Add new parameters for link management and SRIOV/eSwitch configurations Saeed Mahameed
2025-04-25 21:47 ` [PATCH net-next V3 01/15] tools: ynl-gen: allow noncontiguous enums Saeed Mahameed
2025-04-28 23:06   ` Jakub Kicinski
2025-04-29  7:22     ` Jiri Pirko
2025-04-25 21:47 ` [PATCH net-next V3 02/15] devlink: define enum for attr types of dynamic attributes Saeed Mahameed
2025-04-28 23:10   ` Jakub Kicinski [this message]
2025-04-29  7:20     ` Jiri Pirko
2025-04-29 11:49       ` Jiri Pirko
2025-04-29 17:01         ` Jakub Kicinski
2025-04-25 21:47 ` [PATCH net-next V3 03/15] devlink: Add 'total_vfs' generic device param Saeed Mahameed
2025-04-25 21:47 ` [PATCH net-next V3 04/15] net/mlx5: Implement cqe_compress_type via devlink params Saeed Mahameed
2025-04-25 21:47 ` [PATCH net-next V3 05/15] net/mlx5: Implement devlink enable_sriov parameter Saeed Mahameed
2025-04-25 21:47 ` [PATCH net-next V3 06/15] net/mlx5: Implement devlink total_vfs parameter Saeed Mahameed
2025-04-25 21:48 ` [PATCH net-next V3 07/15] devlink: pass struct devlink_port * as arg to devlink_nl_param_fill() Saeed Mahameed
2025-04-25 21:48 ` [PATCH net-next V3 08/15] devlink: Implement port params registration Saeed Mahameed
2025-04-25 21:48 ` [PATCH net-next V3 09/15] devlink: Implement get/dump netlink commands for port params Saeed Mahameed
2025-04-25 21:48 ` [PATCH net-next V3 10/15] devlink: Implement set netlink command " Saeed Mahameed
2025-04-25 21:48 ` [PATCH net-next V3 11/15] devlink: Add 'keep_link_up' generic devlink device param Saeed Mahameed
2025-04-25 21:48 ` [PATCH net-next V3 12/15] net/mlx5: Implement devlink keep_link_up port parameter Saeed Mahameed
2025-04-25 21:48 ` [PATCH net-next V3 13/15] devlink: Throw extack messages on param value validation error Saeed Mahameed
2025-04-25 21:48 ` [PATCH net-next V3 14/15] devlink: Implement devlink param multi attribute nested data values Saeed Mahameed
2025-04-28 23:17   ` Jakub Kicinski
2025-04-29 11:34     ` Jiri Pirko
2025-04-29 13:54       ` Przemek Kitszel
2025-04-29 16:33         ` Jiri Pirko
2025-04-29 16:58       ` Jakub Kicinski
2025-04-30  6:24         ` Jiri Pirko
2025-05-02 11:16           ` Jiri Pirko
2025-04-25 21:48 ` [PATCH net-next V3 15/15] 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=20250428161031.2e64b41f@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gal@nvidia.com \
    --cc=jiri@nvidia.com \
    --cc=leonro@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=saeed@kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).