netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v2 0/4] net/mlx5: Expose additional devlink dev info
@ 2025-03-20  8:59 Jiri Pirko
  2025-03-20  8:59 ` [PATCH net-next v2 1/4] ynl: devlink: add missing board-serial-number Jiri Pirko
                   ` (5 more replies)
  0 siblings, 6 replies; 21+ messages in thread
From: Jiri Pirko @ 2025-03-20  8:59 UTC (permalink / raw)
  To: netdev
  Cc: davem, edumazet, kuba, pabeni, saeedm, leon, tariqt,
	andrew+netdev, horms, donald.hunter, parav

From: Jiri Pirko <jiri@nvidia.com>

This patchset aims to expose couple of already defined serial numbers
for mlx5 driver.

On top of that, it introduces new field, "function.uid" and exposes
that for mlx5 driver.

Example:

$ devlink dev info
pci/0000:08:00.0:
  driver mlx5_core
  serial_number e4397f872caeed218000846daa7d2f49
  board.serial_number MT2314XZ00YA
  function.uid MT2314XZ00YAMLNXS0D0F0
  versions:
      fixed:
        fw.psid MT_0000000894
      running:
        fw.version 28.41.1000
        fw 28.41.1000
      stored:
        fw.version 28.41.1000
        fw 28.41.1000
auxiliary/mlx5_core.eth.0:
  driver mlx5_core.eth
pci/0000:08:00.1:
  driver mlx5_core
  serial_number e4397f872caeed218000846daa7d2f49
  board.serial_number MT2314XZ00YA
  function.uid MT2314XZ00YAMLNXS0D0F1
  versions:
      fixed:
        fw.psid MT_0000000894
      running:
        fw.version 28.41.1000
        fw 28.41.1000
      stored:
        fw.version 28.41.1000
        fw 28.41.1000
auxiliary/mlx5_core.eth.1:
  driver mlx5_core.eth

The first patch just adds a small missing bit in devlink ynl spec.

---
v1->v2:
- patch#2:
  - fixed possibly uninitialized variable "err"

Jiri Pirko (4):
  ynl: devlink: add missing board-serial-number
  net/mlx5: Expose serial numbers in devlink info
  devlink: add function unique identifier to devlink dev info
  net/mlx5: Expose function UID in devlink info

 Documentation/netlink/specs/devlink.yaml      |  5 ++
 .../networking/devlink/devlink-info.rst       |  5 ++
 .../net/ethernet/mellanox/mlx5/core/devlink.c | 62 +++++++++++++++++++
 include/net/devlink.h                         |  2 +
 include/uapi/linux/devlink.h                  |  2 +
 net/devlink/dev.c                             |  9 +++
 6 files changed, 85 insertions(+)

-- 
2.48.1


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH net-next v2 1/4] ynl: devlink: add missing board-serial-number
  2025-03-20  8:59 [PATCH net-next v2 0/4] net/mlx5: Expose additional devlink dev info Jiri Pirko
@ 2025-03-20  8:59 ` Jiri Pirko
  2025-03-23 17:47   ` Simon Horman
  2025-03-24  4:08   ` Kalesh Anakkur Purayil
  2025-03-20  8:59 ` [PATCH net-next v2 2/4] net/mlx5: Expose serial numbers in devlink info Jiri Pirko
                   ` (4 subsequent siblings)
  5 siblings, 2 replies; 21+ messages in thread
From: Jiri Pirko @ 2025-03-20  8:59 UTC (permalink / raw)
  To: netdev
  Cc: davem, edumazet, kuba, pabeni, saeedm, leon, tariqt,
	andrew+netdev, horms, donald.hunter, parav

From: Jiri Pirko <jiri@nvidia.com>

Add a missing attribute of board serial number.

Signed-off-by: Jiri Pirko <jiri@nvidia.com>
---
 Documentation/netlink/specs/devlink.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/netlink/specs/devlink.yaml b/Documentation/netlink/specs/devlink.yaml
index 09fbb4c03fc8..bd9726269b4f 100644
--- a/Documentation/netlink/specs/devlink.yaml
+++ b/Documentation/netlink/specs/devlink.yaml
@@ -1868,6 +1868,7 @@ operations:
             - info-version-fixed
             - info-version-running
             - info-version-stored
+            - info-board-serial-number
       dump:
         reply: *info-get-reply
 
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH net-next v2 2/4] net/mlx5: Expose serial numbers in devlink info
  2025-03-20  8:59 [PATCH net-next v2 0/4] net/mlx5: Expose additional devlink dev info Jiri Pirko
  2025-03-20  8:59 ` [PATCH net-next v2 1/4] ynl: devlink: add missing board-serial-number Jiri Pirko
@ 2025-03-20  8:59 ` Jiri Pirko
  2025-03-23 17:47   ` Simon Horman
                     ` (2 more replies)
  2025-03-20  8:59 ` [PATCH net-next v2 3/4] devlink: add function unique identifier to devlink dev info Jiri Pirko
                   ` (3 subsequent siblings)
  5 siblings, 3 replies; 21+ messages in thread
From: Jiri Pirko @ 2025-03-20  8:59 UTC (permalink / raw)
  To: netdev
  Cc: davem, edumazet, kuba, pabeni, saeedm, leon, tariqt,
	andrew+netdev, horms, donald.hunter, parav

From: Jiri Pirko <jiri@nvidia.com>

Devlink info allows to expose serial number and board serial number
Get the values from PCI VPD and expose it.

$ devlink dev info
pci/0000:08:00.0:
  driver mlx5_core
  serial_number e4397f872caeed218000846daa7d2f49
  board.serial_number MT2314XZ00YA
  versions:
      fixed:
        fw.psid MT_0000000894
      running:
        fw.version 28.41.1000
        fw 28.41.1000
      stored:
        fw.version 28.41.1000
        fw 28.41.1000
auxiliary/mlx5_core.eth.0:
  driver mlx5_core.eth
pci/0000:08:00.1:
  driver mlx5_core
  serial_number e4397f872caeed218000846daa7d2f49
  board.serial_number MT2314XZ00YA
  versions:
      fixed:
        fw.psid MT_0000000894
      running:
        fw.version 28.41.1000
        fw 28.41.1000
      stored:
        fw.version 28.41.1000
        fw 28.41.1000
auxiliary/mlx5_core.eth.1:
  driver mlx5_core.eth

Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Reviewed-by: Parav Pandit <parav@nvidia.com>
---
v1->v2:
- fixed possibly uninitialized variable "err"
---
 .../net/ethernet/mellanox/mlx5/core/devlink.c | 49 +++++++++++++++++++
 1 file changed, 49 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/devlink.c b/drivers/net/ethernet/mellanox/mlx5/core/devlink.c
index 73cd74644378..ebe48f405379 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/devlink.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/devlink.c
@@ -35,6 +35,51 @@ static u16 mlx5_fw_ver_subminor(u32 version)
 	return version & 0xffff;
 }
 
+static int mlx5_devlink_serial_numbers_put(struct mlx5_core_dev *dev,
+					   struct devlink_info_req *req,
+					   struct netlink_ext_ack *extack)
+{
+	struct pci_dev *pdev = dev->pdev;
+	unsigned int vpd_size, kw_len;
+	char *str, *end;
+	u8 *vpd_data;
+	int err = 0;
+	int start;
+
+	vpd_data = pci_vpd_alloc(pdev, &vpd_size);
+	if (IS_ERR(vpd_data))
+		return 0;
+
+	start = pci_vpd_find_ro_info_keyword(vpd_data, vpd_size,
+					     PCI_VPD_RO_KEYWORD_SERIALNO, &kw_len);
+	if (start >= 0) {
+		str = kstrndup(vpd_data + start, kw_len, GFP_KERNEL);
+		if (!str) {
+			err = -ENOMEM;
+			goto end;
+		}
+		end = strchrnul(str, ' ');
+		*end = '\0';
+		err = devlink_info_board_serial_number_put(req, str);
+		kfree(str);
+	}
+
+	start = pci_vpd_find_ro_info_keyword(vpd_data, vpd_size, "V3", &kw_len);
+	if (start >= 0) {
+		str = kstrndup(vpd_data + start, kw_len, GFP_KERNEL);
+		if (!str) {
+			err = -ENOMEM;
+			goto end;
+		}
+		err = devlink_info_serial_number_put(req, str);
+		kfree(str);
+	}
+
+end:
+	kfree(vpd_data);
+	return err;
+}
+
 #define DEVLINK_FW_STRING_LEN 32
 
 static int
@@ -49,6 +94,10 @@ mlx5_devlink_info_get(struct devlink *devlink, struct devlink_info_req *req,
 	if (!mlx5_core_is_pf(dev))
 		return 0;
 
+	err = mlx5_devlink_serial_numbers_put(dev, req, extack);
+	if (err)
+		return err;
+
 	err = devlink_info_version_fixed_put(req, "fw.psid", dev->board_id);
 	if (err)
 		return err;
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH net-next v2 3/4] devlink: add function unique identifier to devlink dev info
  2025-03-20  8:59 [PATCH net-next v2 0/4] net/mlx5: Expose additional devlink dev info Jiri Pirko
  2025-03-20  8:59 ` [PATCH net-next v2 1/4] ynl: devlink: add missing board-serial-number Jiri Pirko
  2025-03-20  8:59 ` [PATCH net-next v2 2/4] net/mlx5: Expose serial numbers in devlink info Jiri Pirko
@ 2025-03-20  8:59 ` Jiri Pirko
  2025-03-23 17:47   ` Simon Horman
                     ` (2 more replies)
  2025-03-20  8:59 ` [PATCH net-next v2 4/4] net/mlx5: Expose function UID in devlink info Jiri Pirko
                   ` (2 subsequent siblings)
  5 siblings, 3 replies; 21+ messages in thread
From: Jiri Pirko @ 2025-03-20  8:59 UTC (permalink / raw)
  To: netdev
  Cc: davem, edumazet, kuba, pabeni, saeedm, leon, tariqt,
	andrew+netdev, horms, donald.hunter, parav

From: Jiri Pirko <jiri@nvidia.com>

Presently, for multi-PF NIC each PF reports the same serial_number and
board.serial_number.

To universally identify a function, add function unique identifier (uid)
to be obtained from the driver as a string of arbitrary length.

Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Reviewed-by: Parav Pandit <parav@nvidia.com>
---
 Documentation/netlink/specs/devlink.yaml          | 4 ++++
 Documentation/networking/devlink/devlink-info.rst | 5 +++++
 include/net/devlink.h                             | 2 ++
 include/uapi/linux/devlink.h                      | 2 ++
 net/devlink/dev.c                                 | 9 +++++++++
 5 files changed, 22 insertions(+)

diff --git a/Documentation/netlink/specs/devlink.yaml b/Documentation/netlink/specs/devlink.yaml
index bd9726269b4f..5d39eb68aefb 100644
--- a/Documentation/netlink/specs/devlink.yaml
+++ b/Documentation/netlink/specs/devlink.yaml
@@ -820,6 +820,9 @@ attribute-sets:
       -
         name: region-direct
         type: flag
+      -
+        name: info-function-uid
+        type: string
 
   -
     name: dl-dev-stats
@@ -1869,6 +1872,7 @@ operations:
             - info-version-running
             - info-version-stored
             - info-board-serial-number
+            - info-function-uid
       dump:
         reply: *info-get-reply
 
diff --git a/Documentation/networking/devlink/devlink-info.rst b/Documentation/networking/devlink/devlink-info.rst
index 23073bc219d8..04afceee0c03 100644
--- a/Documentation/networking/devlink/devlink-info.rst
+++ b/Documentation/networking/devlink/devlink-info.rst
@@ -50,6 +50,11 @@ versions is generally discouraged - here, and via any other Linux API.
        This is usually the serial number of the board, often available in
        PCI *Vital Product Data*.
 
+   * - ``function.uid``
+     - Function uniqueue identifier.
+
+       Vendor defined uniqueue identifier of a function.
+
    * - ``fixed``
      - Group for hardware identifiers, and versions of components
        which are not field-updatable.
diff --git a/include/net/devlink.h b/include/net/devlink.h
index b8783126c1ed..a0b84efd4740 100644
--- a/include/net/devlink.h
+++ b/include/net/devlink.h
@@ -1846,6 +1846,8 @@ int devlink_info_serial_number_put(struct devlink_info_req *req,
 				   const char *sn);
 int devlink_info_board_serial_number_put(struct devlink_info_req *req,
 					 const char *bsn);
+int devlink_info_function_uid_put(struct devlink_info_req *req,
+				  const char *fuid);
 
 enum devlink_info_version_type {
 	DEVLINK_INFO_VERSION_TYPE_NONE,
diff --git a/include/uapi/linux/devlink.h b/include/uapi/linux/devlink.h
index 9401aa343673..816339790409 100644
--- a/include/uapi/linux/devlink.h
+++ b/include/uapi/linux/devlink.h
@@ -614,6 +614,8 @@ enum devlink_attr {
 
 	DEVLINK_ATTR_REGION_DIRECT,		/* flag */
 
+	DEVLINK_ATTR_INFO_FUNCTION_UID,		/* string */
+
 	/* Add new attributes above here, update the spec in
 	 * Documentation/netlink/specs/devlink.yaml and re-generate
 	 * net/devlink/netlink_gen.c.
diff --git a/net/devlink/dev.c b/net/devlink/dev.c
index d6e3db300acb..6c442549722c 100644
--- a/net/devlink/dev.c
+++ b/net/devlink/dev.c
@@ -763,6 +763,15 @@ int devlink_info_board_serial_number_put(struct devlink_info_req *req,
 }
 EXPORT_SYMBOL_GPL(devlink_info_board_serial_number_put);
 
+int devlink_info_function_uid_put(struct devlink_info_req *req,
+				  const char *fuid)
+{
+	if (!req->msg)
+		return 0;
+	return nla_put_string(req->msg, DEVLINK_ATTR_INFO_FUNCTION_UID, fuid);
+}
+EXPORT_SYMBOL_GPL(devlink_info_function_uid_put);
+
 static int devlink_info_version_put(struct devlink_info_req *req, int attr,
 				    const char *version_name,
 				    const char *version_value,
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH net-next v2 4/4] net/mlx5: Expose function UID in devlink info
  2025-03-20  8:59 [PATCH net-next v2 0/4] net/mlx5: Expose additional devlink dev info Jiri Pirko
                   ` (2 preceding siblings ...)
  2025-03-20  8:59 ` [PATCH net-next v2 3/4] devlink: add function unique identifier to devlink dev info Jiri Pirko
@ 2025-03-20  8:59 ` Jiri Pirko
  2025-03-23 17:48   ` Simon Horman
  2025-03-24  4:05   ` Kalesh Anakkur Purayil
  2025-03-23 12:00 ` [PATCH net-next v2 0/4] net/mlx5: Expose additional devlink dev info Tariq Toukan
  2025-03-25 12:00 ` patchwork-bot+netdevbpf
  5 siblings, 2 replies; 21+ messages in thread
From: Jiri Pirko @ 2025-03-20  8:59 UTC (permalink / raw)
  To: netdev
  Cc: davem, edumazet, kuba, pabeni, saeedm, leon, tariqt,
	andrew+netdev, horms, donald.hunter, parav

From: Jiri Pirko <jiri@nvidia.com>

Devlink info allows to expose function UID.
Get the value from PCI VPD and expose it.

$ devlink dev info
pci/0000:08:00.0:
  driver mlx5_core
  serial_number e4397f872caeed218000846daa7d2f49
  board.serial_number MT2314XZ00YA
  function.uid MT2314XZ00YAMLNXS0D0F0
  versions:
      fixed:
        fw.psid MT_0000000894
      running:
        fw.version 28.41.1000
        fw 28.41.1000
      stored:
        fw.version 28.41.1000
        fw 28.41.1000
auxiliary/mlx5_core.eth.0:
  driver mlx5_core.eth
pci/0000:08:00.1:
  driver mlx5_core
  serial_number e4397f872caeed218000846daa7d2f49
  board.serial_number MT2314XZ00YA
  function.uid MT2314XZ00YAMLNXS0D0F1
  versions:
      fixed:
        fw.psid MT_0000000894
      running:
        fw.version 28.41.1000
        fw 28.41.1000
      stored:
        fw.version 28.41.1000
        fw 28.41.1000
auxiliary/mlx5_core.eth.1:
  driver mlx5_core.eth

Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Reviewed-by: Parav Pandit <parav@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/devlink.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/devlink.c b/drivers/net/ethernet/mellanox/mlx5/core/devlink.c
index ebe48f405379..97bde76af399 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/devlink.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/devlink.c
@@ -75,6 +75,19 @@ static int mlx5_devlink_serial_numbers_put(struct mlx5_core_dev *dev,
 		kfree(str);
 	}
 
+	start = pci_vpd_find_ro_info_keyword(vpd_data, vpd_size, "VU", &kw_len);
+	if (start >= 0) {
+		str = kstrndup(vpd_data + start, kw_len, GFP_KERNEL);
+		if (!str) {
+			err = -ENOMEM;
+			goto end;
+		}
+		end = strchrnul(str, ' ');
+		*end = '\0';
+		err = devlink_info_function_uid_put(req, str);
+		kfree(str);
+	}
+
 end:
 	kfree(vpd_data);
 	return err;
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH net-next v2 0/4] net/mlx5: Expose additional devlink dev info
  2025-03-20  8:59 [PATCH net-next v2 0/4] net/mlx5: Expose additional devlink dev info Jiri Pirko
                   ` (3 preceding siblings ...)
  2025-03-20  8:59 ` [PATCH net-next v2 4/4] net/mlx5: Expose function UID in devlink info Jiri Pirko
@ 2025-03-23 12:00 ` Tariq Toukan
  2025-03-25 12:00 ` patchwork-bot+netdevbpf
  5 siblings, 0 replies; 21+ messages in thread
From: Tariq Toukan @ 2025-03-23 12:00 UTC (permalink / raw)
  To: Jiri Pirko, netdev
  Cc: davem, edumazet, kuba, pabeni, saeedm, leon, tariqt,
	andrew+netdev, horms, donald.hunter, parav



On 20/03/2025 10:59, Jiri Pirko wrote:
> From: Jiri Pirko <jiri@nvidia.com>
> 
> This patchset aims to expose couple of already defined serial numbers
> for mlx5 driver.
> 
> On top of that, it introduces new field, "function.uid" and exposes
> that for mlx5 driver.
> 
> Example:
> 
> $ devlink dev info
> pci/0000:08:00.0:
>    driver mlx5_core
>    serial_number e4397f872caeed218000846daa7d2f49
>    board.serial_number MT2314XZ00YA
>    function.uid MT2314XZ00YAMLNXS0D0F0
>    versions:
>        fixed:
>          fw.psid MT_0000000894
>        running:
>          fw.version 28.41.1000
>          fw 28.41.1000
>        stored:
>          fw.version 28.41.1000
>          fw 28.41.1000
> auxiliary/mlx5_core.eth.0:
>    driver mlx5_core.eth
> pci/0000:08:00.1:
>    driver mlx5_core
>    serial_number e4397f872caeed218000846daa7d2f49
>    board.serial_number MT2314XZ00YA
>    function.uid MT2314XZ00YAMLNXS0D0F1
>    versions:
>        fixed:
>          fw.psid MT_0000000894
>        running:
>          fw.version 28.41.1000
>          fw 28.41.1000
>        stored:
>          fw.version 28.41.1000
>          fw 28.41.1000
> auxiliary/mlx5_core.eth.1:
>    driver mlx5_core.eth
> 
> The first patch just adds a small missing bit in devlink ynl spec.
> 
> ---
> v1->v2:
> - patch#2:
>    - fixed possibly uninitialized variable "err"
> 
> Jiri Pirko (4):
>    ynl: devlink: add missing board-serial-number
>    net/mlx5: Expose serial numbers in devlink info
>    devlink: add function unique identifier to devlink dev info
>    net/mlx5: Expose function UID in devlink info
> 
>   Documentation/netlink/specs/devlink.yaml      |  5 ++
>   .../networking/devlink/devlink-info.rst       |  5 ++
>   .../net/ethernet/mellanox/mlx5/core/devlink.c | 62 +++++++++++++++++++
>   include/net/devlink.h                         |  2 +
>   include/uapi/linux/devlink.h                  |  2 +
>   net/devlink/dev.c                             |  9 +++
>   6 files changed, 85 insertions(+)
> 

For the mlx5 parts:
Acked-by: Tariq Toukan <tariqt@nvidia.com>

Thanks,
Tariq

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH net-next v2 1/4] ynl: devlink: add missing board-serial-number
  2025-03-20  8:59 ` [PATCH net-next v2 1/4] ynl: devlink: add missing board-serial-number Jiri Pirko
@ 2025-03-23 17:47   ` Simon Horman
  2025-03-24  4:08   ` Kalesh Anakkur Purayil
  1 sibling, 0 replies; 21+ messages in thread
From: Simon Horman @ 2025-03-23 17:47 UTC (permalink / raw)
  To: Jiri Pirko
  Cc: netdev, davem, edumazet, kuba, pabeni, saeedm, leon, tariqt,
	andrew+netdev, donald.hunter, parav

On Thu, Mar 20, 2025 at 09:59:44AM +0100, Jiri Pirko wrote:
> From: Jiri Pirko <jiri@nvidia.com>
> 
> Add a missing attribute of board serial number.
> 
> Signed-off-by: Jiri Pirko <jiri@nvidia.com>

Reviewed-by: Simon Horman <horms@kernel.org>


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH net-next v2 2/4] net/mlx5: Expose serial numbers in devlink info
  2025-03-20  8:59 ` [PATCH net-next v2 2/4] net/mlx5: Expose serial numbers in devlink info Jiri Pirko
@ 2025-03-23 17:47   ` Simon Horman
  2025-03-24  4:07   ` Kalesh Anakkur Purayil
  2025-03-25 11:46   ` Jakub Kicinski
  2 siblings, 0 replies; 21+ messages in thread
From: Simon Horman @ 2025-03-23 17:47 UTC (permalink / raw)
  To: Jiri Pirko
  Cc: netdev, davem, edumazet, kuba, pabeni, saeedm, leon, tariqt,
	andrew+netdev, donald.hunter, parav

On Thu, Mar 20, 2025 at 09:59:45AM +0100, Jiri Pirko wrote:
> From: Jiri Pirko <jiri@nvidia.com>
> 
> Devlink info allows to expose serial number and board serial number
> Get the values from PCI VPD and expose it.
> 
> $ devlink dev info
> pci/0000:08:00.0:
>   driver mlx5_core
>   serial_number e4397f872caeed218000846daa7d2f49
>   board.serial_number MT2314XZ00YA
>   versions:
>       fixed:
>         fw.psid MT_0000000894
>       running:
>         fw.version 28.41.1000
>         fw 28.41.1000
>       stored:
>         fw.version 28.41.1000
>         fw 28.41.1000
> auxiliary/mlx5_core.eth.0:
>   driver mlx5_core.eth
> pci/0000:08:00.1:
>   driver mlx5_core
>   serial_number e4397f872caeed218000846daa7d2f49
>   board.serial_number MT2314XZ00YA
>   versions:
>       fixed:
>         fw.psid MT_0000000894
>       running:
>         fw.version 28.41.1000
>         fw 28.41.1000
>       stored:
>         fw.version 28.41.1000
>         fw 28.41.1000
> auxiliary/mlx5_core.eth.1:
>   driver mlx5_core.eth
> 
> Signed-off-by: Jiri Pirko <jiri@nvidia.com>
> Reviewed-by: Parav Pandit <parav@nvidia.com>

Reviewed-by: Simon Horman <horms@kernel.org>


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH net-next v2 3/4] devlink: add function unique identifier to devlink dev info
  2025-03-20  8:59 ` [PATCH net-next v2 3/4] devlink: add function unique identifier to devlink dev info Jiri Pirko
@ 2025-03-23 17:47   ` Simon Horman
  2025-03-24  4:06   ` Kalesh Anakkur Purayil
  2025-03-25 11:49   ` Jakub Kicinski
  2 siblings, 0 replies; 21+ messages in thread
From: Simon Horman @ 2025-03-23 17:47 UTC (permalink / raw)
  To: Jiri Pirko
  Cc: netdev, davem, edumazet, kuba, pabeni, saeedm, leon, tariqt,
	andrew+netdev, donald.hunter, parav

On Thu, Mar 20, 2025 at 09:59:46AM +0100, Jiri Pirko wrote:
> From: Jiri Pirko <jiri@nvidia.com>
> 
> Presently, for multi-PF NIC each PF reports the same serial_number and
> board.serial_number.
> 
> To universally identify a function, add function unique identifier (uid)
> to be obtained from the driver as a string of arbitrary length.
> 
> Signed-off-by: Jiri Pirko <jiri@nvidia.com>
> Reviewed-by: Parav Pandit <parav@nvidia.com>

Reviewed-by: Simon Horman <horms@kernel.org>


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH net-next v2 4/4] net/mlx5: Expose function UID in devlink info
  2025-03-20  8:59 ` [PATCH net-next v2 4/4] net/mlx5: Expose function UID in devlink info Jiri Pirko
@ 2025-03-23 17:48   ` Simon Horman
  2025-03-24  4:05   ` Kalesh Anakkur Purayil
  1 sibling, 0 replies; 21+ messages in thread
From: Simon Horman @ 2025-03-23 17:48 UTC (permalink / raw)
  To: Jiri Pirko
  Cc: netdev, davem, edumazet, kuba, pabeni, saeedm, leon, tariqt,
	andrew+netdev, donald.hunter, parav

On Thu, Mar 20, 2025 at 09:59:47AM +0100, Jiri Pirko wrote:
> From: Jiri Pirko <jiri@nvidia.com>
> 
> Devlink info allows to expose function UID.
> Get the value from PCI VPD and expose it.
> 
> $ devlink dev info
> pci/0000:08:00.0:
>   driver mlx5_core
>   serial_number e4397f872caeed218000846daa7d2f49
>   board.serial_number MT2314XZ00YA
>   function.uid MT2314XZ00YAMLNXS0D0F0
>   versions:
>       fixed:
>         fw.psid MT_0000000894
>       running:
>         fw.version 28.41.1000
>         fw 28.41.1000
>       stored:
>         fw.version 28.41.1000
>         fw 28.41.1000
> auxiliary/mlx5_core.eth.0:
>   driver mlx5_core.eth
> pci/0000:08:00.1:
>   driver mlx5_core
>   serial_number e4397f872caeed218000846daa7d2f49
>   board.serial_number MT2314XZ00YA
>   function.uid MT2314XZ00YAMLNXS0D0F1
>   versions:
>       fixed:
>         fw.psid MT_0000000894
>       running:
>         fw.version 28.41.1000
>         fw 28.41.1000
>       stored:
>         fw.version 28.41.1000
>         fw 28.41.1000
> auxiliary/mlx5_core.eth.1:
>   driver mlx5_core.eth
> 
> Signed-off-by: Jiri Pirko <jiri@nvidia.com>
> Reviewed-by: Parav Pandit <parav@nvidia.com>

Reviewed-by: Simon Horman <horms@kernel.org>


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH net-next v2 4/4] net/mlx5: Expose function UID in devlink info
  2025-03-20  8:59 ` [PATCH net-next v2 4/4] net/mlx5: Expose function UID in devlink info Jiri Pirko
  2025-03-23 17:48   ` Simon Horman
@ 2025-03-24  4:05   ` Kalesh Anakkur Purayil
  1 sibling, 0 replies; 21+ messages in thread
From: Kalesh Anakkur Purayil @ 2025-03-24  4:05 UTC (permalink / raw)
  To: Jiri Pirko
  Cc: netdev, davem, edumazet, kuba, pabeni, saeedm, leon, tariqt,
	andrew+netdev, horms, donald.hunter, parav

[-- Attachment #1: Type: text/plain, Size: 1315 bytes --]

On Thu, Mar 20, 2025 at 4:02 PM Jiri Pirko <jiri@resnulli.us> wrote:
>
> From: Jiri Pirko <jiri@nvidia.com>
>
> Devlink info allows to expose function UID.
> Get the value from PCI VPD and expose it.
>
> $ devlink dev info
> pci/0000:08:00.0:
>   driver mlx5_core
>   serial_number e4397f872caeed218000846daa7d2f49
>   board.serial_number MT2314XZ00YA
>   function.uid MT2314XZ00YAMLNXS0D0F0
>   versions:
>       fixed:
>         fw.psid MT_0000000894
>       running:
>         fw.version 28.41.1000
>         fw 28.41.1000
>       stored:
>         fw.version 28.41.1000
>         fw 28.41.1000
> auxiliary/mlx5_core.eth.0:
>   driver mlx5_core.eth
> pci/0000:08:00.1:
>   driver mlx5_core
>   serial_number e4397f872caeed218000846daa7d2f49
>   board.serial_number MT2314XZ00YA
>   function.uid MT2314XZ00YAMLNXS0D0F1
>   versions:
>       fixed:
>         fw.psid MT_0000000894
>       running:
>         fw.version 28.41.1000
>         fw 28.41.1000
>       stored:
>         fw.version 28.41.1000
>         fw 28.41.1000
> auxiliary/mlx5_core.eth.1:
>   driver mlx5_core.eth
>
> Signed-off-by: Jiri Pirko <jiri@nvidia.com>
> Reviewed-by: Parav Pandit <parav@nvidia.com>

Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>


-- 
Regards,
Kalesh AP

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4226 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH net-next v2 3/4] devlink: add function unique identifier to devlink dev info
  2025-03-20  8:59 ` [PATCH net-next v2 3/4] devlink: add function unique identifier to devlink dev info Jiri Pirko
  2025-03-23 17:47   ` Simon Horman
@ 2025-03-24  4:06   ` Kalesh Anakkur Purayil
  2025-03-25 11:49   ` Jakub Kicinski
  2 siblings, 0 replies; 21+ messages in thread
From: Kalesh Anakkur Purayil @ 2025-03-24  4:06 UTC (permalink / raw)
  To: Jiri Pirko
  Cc: netdev, davem, edumazet, kuba, pabeni, saeedm, leon, tariqt,
	andrew+netdev, horms, donald.hunter, parav

[-- Attachment #1: Type: text/plain, Size: 550 bytes --]

On Thu, Mar 20, 2025 at 4:02 PM Jiri Pirko <jiri@resnulli.us> wrote:
>
> From: Jiri Pirko <jiri@nvidia.com>
>
> Presently, for multi-PF NIC each PF reports the same serial_number and
> board.serial_number.
>
> To universally identify a function, add function unique identifier (uid)
> to be obtained from the driver as a string of arbitrary length.
>
> Signed-off-by: Jiri Pirko <jiri@nvidia.com>
> Reviewed-by: Parav Pandit <parav@nvidia.com>

Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

-- 
Regards,
Kalesh AP

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4226 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH net-next v2 2/4] net/mlx5: Expose serial numbers in devlink info
  2025-03-20  8:59 ` [PATCH net-next v2 2/4] net/mlx5: Expose serial numbers in devlink info Jiri Pirko
  2025-03-23 17:47   ` Simon Horman
@ 2025-03-24  4:07   ` Kalesh Anakkur Purayil
  2025-03-25 11:46   ` Jakub Kicinski
  2 siblings, 0 replies; 21+ messages in thread
From: Kalesh Anakkur Purayil @ 2025-03-24  4:07 UTC (permalink / raw)
  To: Jiri Pirko
  Cc: netdev, davem, edumazet, kuba, pabeni, saeedm, leon, tariqt,
	andrew+netdev, horms, donald.hunter, parav

[-- Attachment #1: Type: text/plain, Size: 1258 bytes --]

On Thu, Mar 20, 2025 at 4:02 PM Jiri Pirko <jiri@resnulli.us> wrote:
>
> From: Jiri Pirko <jiri@nvidia.com>
>
> Devlink info allows to expose serial number and board serial number
> Get the values from PCI VPD and expose it.
>
> $ devlink dev info
> pci/0000:08:00.0:
>   driver mlx5_core
>   serial_number e4397f872caeed218000846daa7d2f49
>   board.serial_number MT2314XZ00YA
>   versions:
>       fixed:
>         fw.psid MT_0000000894
>       running:
>         fw.version 28.41.1000
>         fw 28.41.1000
>       stored:
>         fw.version 28.41.1000
>         fw 28.41.1000
> auxiliary/mlx5_core.eth.0:
>   driver mlx5_core.eth
> pci/0000:08:00.1:
>   driver mlx5_core
>   serial_number e4397f872caeed218000846daa7d2f49
>   board.serial_number MT2314XZ00YA
>   versions:
>       fixed:
>         fw.psid MT_0000000894
>       running:
>         fw.version 28.41.1000
>         fw 28.41.1000
>       stored:
>         fw.version 28.41.1000
>         fw 28.41.1000
> auxiliary/mlx5_core.eth.1:
>   driver mlx5_core.eth
>
> Signed-off-by: Jiri Pirko <jiri@nvidia.com>
> Reviewed-by: Parav Pandit <parav@nvidia.com>

Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>


-- 
Regards,
Kalesh AP

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4226 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH net-next v2 1/4] ynl: devlink: add missing board-serial-number
  2025-03-20  8:59 ` [PATCH net-next v2 1/4] ynl: devlink: add missing board-serial-number Jiri Pirko
  2025-03-23 17:47   ` Simon Horman
@ 2025-03-24  4:08   ` Kalesh Anakkur Purayil
  1 sibling, 0 replies; 21+ messages in thread
From: Kalesh Anakkur Purayil @ 2025-03-24  4:08 UTC (permalink / raw)
  To: Jiri Pirko
  Cc: netdev, davem, edumazet, kuba, pabeni, saeedm, leon, tariqt,
	andrew+netdev, horms, donald.hunter, parav

[-- Attachment #1: Type: text/plain, Size: 311 bytes --]

On Thu, Mar 20, 2025 at 4:02 PM Jiri Pirko <jiri@resnulli.us> wrote:
>
> From: Jiri Pirko <jiri@nvidia.com>
>
> Add a missing attribute of board serial number.
>
> Signed-off-by: Jiri Pirko <jiri@nvidia.com>

Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>


-- 
Regards,
Kalesh AP

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4226 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH net-next v2 2/4] net/mlx5: Expose serial numbers in devlink info
  2025-03-20  8:59 ` [PATCH net-next v2 2/4] net/mlx5: Expose serial numbers in devlink info Jiri Pirko
  2025-03-23 17:47   ` Simon Horman
  2025-03-24  4:07   ` Kalesh Anakkur Purayil
@ 2025-03-25 11:46   ` Jakub Kicinski
  2025-03-31 13:06     ` Jiri Pirko
  2 siblings, 1 reply; 21+ messages in thread
From: Jakub Kicinski @ 2025-03-25 11:46 UTC (permalink / raw)
  To: Jiri Pirko
  Cc: netdev, davem, edumazet, pabeni, saeedm, leon, tariqt,
	andrew+netdev, horms, donald.hunter, parav

On Thu, 20 Mar 2025 09:59:45 +0100 Jiri Pirko wrote:
> +	start = pci_vpd_find_ro_info_keyword(vpd_data, vpd_size,
> +					     PCI_VPD_RO_KEYWORD_SERIALNO, &kw_len);
> +	if (start >= 0) {
> +		str = kstrndup(vpd_data + start, kw_len, GFP_KERNEL);
> +		if (!str) {
> +			err = -ENOMEM;
> +			goto end;
> +		}
> +		end = strchrnul(str, ' ');
> +		*end = '\0';
> +		err = devlink_info_board_serial_number_put(req, str);
> +		kfree(str);
> +	}
> +
> +	start = pci_vpd_find_ro_info_keyword(vpd_data, vpd_size, "V3", &kw_len);
> +	if (start >= 0) {
> +		str = kstrndup(vpd_data + start, kw_len, GFP_KERNEL);
> +		if (!str) {
> +			err = -ENOMEM;
> +			goto end;
> +		}
> +		err = devlink_info_serial_number_put(req, str);
> +		kfree(str);
> +	}

I suppose you only expect one of the fields to be populated but 
the code as is doesn't express that.

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH net-next v2 3/4] devlink: add function unique identifier to devlink dev info
  2025-03-20  8:59 ` [PATCH net-next v2 3/4] devlink: add function unique identifier to devlink dev info Jiri Pirko
  2025-03-23 17:47   ` Simon Horman
  2025-03-24  4:06   ` Kalesh Anakkur Purayil
@ 2025-03-25 11:49   ` Jakub Kicinski
  2 siblings, 0 replies; 21+ messages in thread
From: Jakub Kicinski @ 2025-03-25 11:49 UTC (permalink / raw)
  To: Jiri Pirko
  Cc: netdev, davem, edumazet, pabeni, saeedm, leon, tariqt,
	andrew+netdev, horms, donald.hunter, parav

On Thu, 20 Mar 2025 09:59:46 +0100 Jiri Pirko wrote:
> From: Jiri Pirko <jiri@nvidia.com>
> 
> Presently, for multi-PF NIC each PF reports the same serial_number and
> board.serial_number.
> 
> To universally identify a function, add function unique identifier (uid)
> to be obtained from the driver as a string of arbitrary length.

We need more explanation for the "why"; this:

+   * - ``function.uid``
+     - Function uniqueue identifier.
+
+       Vendor defined uniqueue identifier of a function.

is really below bar in terms of documentation.

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH net-next v2 0/4] net/mlx5: Expose additional devlink dev info
  2025-03-20  8:59 [PATCH net-next v2 0/4] net/mlx5: Expose additional devlink dev info Jiri Pirko
                   ` (4 preceding siblings ...)
  2025-03-23 12:00 ` [PATCH net-next v2 0/4] net/mlx5: Expose additional devlink dev info Tariq Toukan
@ 2025-03-25 12:00 ` patchwork-bot+netdevbpf
  5 siblings, 0 replies; 21+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-03-25 12:00 UTC (permalink / raw)
  To: Jiri Pirko
  Cc: netdev, davem, edumazet, kuba, pabeni, saeedm, leon, tariqt,
	andrew+netdev, horms, donald.hunter, parav

Hello:

This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Thu, 20 Mar 2025 09:59:43 +0100 you wrote:
> From: Jiri Pirko <jiri@nvidia.com>
> 
> This patchset aims to expose couple of already defined serial numbers
> for mlx5 driver.
> 
> On top of that, it introduces new field, "function.uid" and exposes
> that for mlx5 driver.
> 
> [...]

Here is the summary with links:
  - [net-next,v2,1/4] ynl: devlink: add missing board-serial-number
    https://git.kernel.org/netdev/net-next/c/3e25c1a7c056
  - [net-next,v2,2/4] net/mlx5: Expose serial numbers in devlink info
    (no matching commit)
  - [net-next,v2,3/4] devlink: add function unique identifier to devlink dev info
    (no matching commit)
  - [net-next,v2,4/4] net/mlx5: Expose function UID in devlink info
    (no matching commit)

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH net-next v2 2/4] net/mlx5: Expose serial numbers in devlink info
  2025-03-25 11:46   ` Jakub Kicinski
@ 2025-03-31 13:06     ` Jiri Pirko
  2025-03-31 16:22       ` Jakub Kicinski
  0 siblings, 1 reply; 21+ messages in thread
From: Jiri Pirko @ 2025-03-31 13:06 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: netdev, davem, edumazet, pabeni, saeedm, leon, tariqt,
	andrew+netdev, horms, donald.hunter, parav

Tue, Mar 25, 2025 at 12:46:53PM +0100, kuba@kernel.org wrote:
>On Thu, 20 Mar 2025 09:59:45 +0100 Jiri Pirko wrote:
>> +	start = pci_vpd_find_ro_info_keyword(vpd_data, vpd_size,
>> +					     PCI_VPD_RO_KEYWORD_SERIALNO, &kw_len);
>> +	if (start >= 0) {
>> +		str = kstrndup(vpd_data + start, kw_len, GFP_KERNEL);
>> +		if (!str) {
>> +			err = -ENOMEM;
>> +			goto end;
>> +		}
>> +		end = strchrnul(str, ' ');
>> +		*end = '\0';
>> +		err = devlink_info_board_serial_number_put(req, str);
>> +		kfree(str);
>> +	}
>> +
>> +	start = pci_vpd_find_ro_info_keyword(vpd_data, vpd_size, "V3", &kw_len);
>> +	if (start >= 0) {
>> +		str = kstrndup(vpd_data + start, kw_len, GFP_KERNEL);
>> +		if (!str) {
>> +			err = -ENOMEM;
>> +			goto end;
>> +		}
>> +		err = devlink_info_serial_number_put(req, str);
>> +		kfree(str);
>> +	}
>
>I suppose you only expect one of the fields to be populated but 
>the code as is doesn't express that.

Nope. none or all could be populated, depends on what device exposes.


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH net-next v2 2/4] net/mlx5: Expose serial numbers in devlink info
  2025-03-31 13:06     ` Jiri Pirko
@ 2025-03-31 16:22       ` Jakub Kicinski
  2025-04-01  9:01         ` Jiri Pirko
  0 siblings, 1 reply; 21+ messages in thread
From: Jakub Kicinski @ 2025-03-31 16:22 UTC (permalink / raw)
  To: Jiri Pirko
  Cc: netdev, davem, edumazet, pabeni, saeedm, leon, tariqt,
	andrew+netdev, horms, donald.hunter, parav

On Mon, 31 Mar 2025 15:06:18 +0200 Jiri Pirko wrote:
> >I suppose you only expect one of the fields to be populated but 
> >the code as is doesn't express that.  
> 
> Nope. none or all could be populated, depends on what device exposes.

Then you override the err in case first put fails.
But also having two serial numbers makes no sense.

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH net-next v2 2/4] net/mlx5: Expose serial numbers in devlink info
  2025-03-31 16:22       ` Jakub Kicinski
@ 2025-04-01  9:01         ` Jiri Pirko
  2025-04-01 14:52           ` Jakub Kicinski
  0 siblings, 1 reply; 21+ messages in thread
From: Jiri Pirko @ 2025-04-01  9:01 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: netdev, davem, edumazet, pabeni, saeedm, leon, tariqt,
	andrew+netdev, horms, donald.hunter, parav

Mon, Mar 31, 2025 at 06:22:26PM +0200, kuba@kernel.org wrote:
>On Mon, 31 Mar 2025 15:06:18 +0200 Jiri Pirko wrote:
>> >I suppose you only expect one of the fields to be populated but 
>> >the code as is doesn't express that.  
>> 
>> Nope. none or all could be populated, depends on what device exposes.
>
>Then you override the err in case first put fails.

Correct, will fix.


>But also having two serial numbers makes no sense.

They are serial number for different entity:
  serial_number e4397f872caeed218000846daa7d2f49
  board.serial_number MT2314XZ00YA

Why it does not make sense?

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH net-next v2 2/4] net/mlx5: Expose serial numbers in devlink info
  2025-04-01  9:01         ` Jiri Pirko
@ 2025-04-01 14:52           ` Jakub Kicinski
  0 siblings, 0 replies; 21+ messages in thread
From: Jakub Kicinski @ 2025-04-01 14:52 UTC (permalink / raw)
  To: Jiri Pirko
  Cc: netdev, davem, edumazet, pabeni, saeedm, leon, tariqt,
	andrew+netdev, horms, donald.hunter, parav

On Tue, 1 Apr 2025 11:01:44 +0200 Jiri Pirko wrote:
> >But also having two serial numbers makes no sense.  
> 
> They are serial number for different entity:
>   serial_number e4397f872caeed218000846daa7d2f49
>   board.serial_number MT2314XZ00YA
> 
> Why it does not make sense?

Missed the exact put helper is different. Makes sense now!

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2025-04-01 14:52 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-20  8:59 [PATCH net-next v2 0/4] net/mlx5: Expose additional devlink dev info Jiri Pirko
2025-03-20  8:59 ` [PATCH net-next v2 1/4] ynl: devlink: add missing board-serial-number Jiri Pirko
2025-03-23 17:47   ` Simon Horman
2025-03-24  4:08   ` Kalesh Anakkur Purayil
2025-03-20  8:59 ` [PATCH net-next v2 2/4] net/mlx5: Expose serial numbers in devlink info Jiri Pirko
2025-03-23 17:47   ` Simon Horman
2025-03-24  4:07   ` Kalesh Anakkur Purayil
2025-03-25 11:46   ` Jakub Kicinski
2025-03-31 13:06     ` Jiri Pirko
2025-03-31 16:22       ` Jakub Kicinski
2025-04-01  9:01         ` Jiri Pirko
2025-04-01 14:52           ` Jakub Kicinski
2025-03-20  8:59 ` [PATCH net-next v2 3/4] devlink: add function unique identifier to devlink dev info Jiri Pirko
2025-03-23 17:47   ` Simon Horman
2025-03-24  4:06   ` Kalesh Anakkur Purayil
2025-03-25 11:49   ` Jakub Kicinski
2025-03-20  8:59 ` [PATCH net-next v2 4/4] net/mlx5: Expose function UID in devlink info Jiri Pirko
2025-03-23 17:48   ` Simon Horman
2025-03-24  4:05   ` Kalesh Anakkur Purayil
2025-03-23 12:00 ` [PATCH net-next v2 0/4] net/mlx5: Expose additional devlink dev info Tariq Toukan
2025-03-25 12:00 ` patchwork-bot+netdevbpf

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).