netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Moshe Shemesh <moshe@nvidia.com>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Donald Hunter <donald.hunter@gmail.com>,
	Jiri Pirko <jiri@resnulli.us>, Jonathan Corbet <corbet@lwn.net>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	Tariq Toukan <tariqt@nvidia.com>,
	Saeed Mahameed <saeedm@nvidia.com>,
	Leon Romanovsky <leonro@nvidia.com>,
	Mark Bloch <mbloch@nvidia.com>, Avihai Horon <avihaih@nvidia.com>
Subject: Re: [RFC net-next 1/5] devlink: Add unique identifier to devlink port function
Date: Mon, 28 Apr 2025 13:33:29 +0100	[thread overview]
Message-ID: <20250428123329.GA3339421@horms.kernel.org> (raw)
In-Reply-To: <1745416242-1162653-2-git-send-email-moshe@nvidia.com>

On Wed, Apr 23, 2025 at 04:50:38PM +0300, Moshe Shemesh wrote:
> From: Avihai Horon <avihaih@nvidia.com>
> 
> A function unique identifier (UID) is a vendor defined string of
> arbitrary length that universally identifies a function. The function
> UID can be reported via devlink dev info.
> 
> Add UID attribute to devlink port function that reports the UID of the
> function that pertains to the devlink port.
> 
> This can be used to unambiguously map between a function and the devlink
> port that manages it, and vice versa.
> 
> Example output:
> 
> $ devlink port show pci/0000:03:00.0/327680 -jp
> {
>     "port": {
>         "pci/0000:03:00.0/327680": {
>             "type": "eth",
>             "netdev": "pf0hpf",
>             "flavour": "pcipf",
>             "controller": 1,
>             "pfnum": 0,
>             "external": true,
>             "splittable": false,
>             "function": {
>                 "hw_addr": "5c:25:73:37:70:5a",
>                 "roce": "enable",
>                 "max_io_eqs": 120,
>                 "uid": "C6A76AD20605BE026D23C14E70B90704F4A5F5B3F304D83B37000732BF861D48MLNXS0D0F0"
>             }
>         }
>     }
> }
> 
> Signed-off-by: Avihai Horon <avihaih@nvidia.com>
> ---
>  Documentation/netlink/specs/devlink.yaml      |  3 ++
>  .../networking/devlink/devlink-port.rst       | 12 +++++++
>  include/net/devlink.h                         |  8 +++++
>  include/uapi/linux/devlink.h                  |  1 +
>  net/devlink/port.c                            | 32 +++++++++++++++++++
>  5 files changed, 56 insertions(+)
> 
> diff --git a/Documentation/netlink/specs/devlink.yaml b/Documentation/netlink/specs/devlink.yaml
> index bd9726269b4f..f4dade0e3c70 100644
> --- a/Documentation/netlink/specs/devlink.yaml
> +++ b/Documentation/netlink/specs/devlink.yaml
> @@ -894,6 +894,9 @@ attribute-sets:
>          type: bitfield32
>          enum: port-fn-attr-cap
>          enum-as-flags: True
> +      -
> +       name: uid
> +       type: string
>  
>    -
>      name: dl-dpipe-tables

Hi Avihai,

With this patch, after running tools/net/ynl/ynl-regen.sh -f, I see the
following when I run git diff. So I think this patch needs these changes
too.

diff --git a/net/devlink/netlink_gen.c b/net/devlink/netlink_gen.c
index f9786d51f..1dc90bde8 100644
--- a/net/devlink/netlink_gen.c
+++ b/net/devlink/netlink_gen.c
@@ -11,11 +11,12 @@
 #include <uapi/linux/devlink.h>

 /* Common nested types */
-const struct nla_policy devlink_dl_port_function_nl_policy[DEVLINK_PORT_FN_ATTR_CAPS + 1] = {
+const struct nla_policy devlink_dl_port_function_nl_policy[DEVLINK_PORT_FN_ATTR_UID + 1] = {
 	[DEVLINK_PORT_FUNCTION_ATTR_HW_ADDR] = { .type = NLA_BINARY, },
 	[DEVLINK_PORT_FN_ATTR_STATE] = NLA_POLICY_MAX(NLA_U8, 1),
 	[DEVLINK_PORT_FN_ATTR_OPSTATE] = NLA_POLICY_MAX(NLA_U8, 1),
 	[DEVLINK_PORT_FN_ATTR_CAPS] = NLA_POLICY_BITFIELD32(15),
+	[DEVLINK_PORT_FN_ATTR_UID] = { .type = NLA_NUL_STRING, },
 };

 const struct nla_policy devlink_dl_selftest_id_nl_policy[DEVLINK_ATTR_SELFTEST_ID_FLASH + 1] = {
diff --git a/net/devlink/netlink_gen.h b/net/devlink/netlink_gen.h
index 8f2bd50dd..3a12c18c6 100644
--- a/net/devlink/netlink_gen.h
+++ b/net/devlink/netlink_gen.h
@@ -12,7 +12,7 @@
 #include <uapi/linux/devlink.h>

 /* Common nested types */
-extern const struct nla_policy devlink_dl_port_function_nl_policy[DEVLINK_PORT_FN_ATTR_CAPS + 1];
+extern const struct nla_policy devlink_dl_port_function_nl_policy[DEVLINK_PORT_FN_ATTR_UID + 1];
 extern const struct nla_policy devlink_dl_selftest_id_nl_policy[DEVLINK_ATTR_SELFTEST_ID_FLASH + 1];

 /* Ops table for devlink */

...

  reply	other threads:[~2025-04-28 12:33 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-23 13:50 [RFC net-next 0/5] devlink: Add unique identifier to devlink port function Moshe Shemesh
2025-04-23 13:50 ` [RFC net-next 1/5] " Moshe Shemesh
2025-04-28 12:33   ` Simon Horman [this message]
2025-04-29  9:33     ` Avihai Horon
2025-04-23 13:50 ` [RFC net-next 2/5] net/mlx5: Move mlx5_cmd_query_vuid() from IB to core Moshe Shemesh
2025-04-23 13:50 ` [RFC net-next 3/5] net/mlx5: Add vhca_id argument to mlx5_core_query_vuid() Moshe Shemesh
2025-04-23 13:50 ` [RFC net-next 4/5] net/mlx5: Add define for max VUID string size Moshe Shemesh
2025-04-23 13:50 ` [RFC net-next 5/5] net/mlx5: Expose unique identifier in devlink port function Moshe Shemesh
2025-04-24 23:24 ` [RFC net-next 0/5] devlink: Add unique identifier to " Jakub Kicinski
2025-04-25 11:26   ` Jiri Pirko
2025-04-25 17:51     ` Jakub Kicinski
2025-04-28 16:30       ` Jiri Pirko
2025-04-28 12:11   ` Moshe Shemesh
2025-04-28 18:19     ` Jakub Kicinski
2025-04-29  8:37       ` Moshe Shemesh
2025-05-02  0:39         ` Jakub Kicinski
2025-05-04 17:46           ` Mark Bloch
2025-05-05 18:55             ` Jakub Kicinski
2025-05-06 11:25               ` Mark Bloch
2025-05-06 15:20                 ` Jakub Kicinski
2025-05-06 15:34                   ` Mark Bloch
2025-05-08  0:43                     ` Jakub Kicinski
2025-05-08  9:04                       ` Mark Bloch
2025-05-14 12:01                         ` Mark Bloch
2025-05-14 14:52                           ` Jakub Kicinski

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=20250428123329.GA3339421@horms.kernel.org \
    --to=horms@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=avihaih@nvidia.com \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=donald.hunter@gmail.com \
    --cc=edumazet@google.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=leonro@nvidia.com \
    --cc=mbloch@nvidia.com \
    --cc=moshe@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;
as well as URLs for NNTP newsgroup(s).