[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250416214133.10582-3-jiri@resnulli.us>
Date: Wed, 16 Apr 2025 23:41:32 +0200
From: Jiri Pirko <jiri@...nulli.us>
To: netdev@...r.kernel.org
Cc: davem@...emloft.net,
edumazet@...gle.com,
kuba@...nel.org,
pabeni@...hat.com,
saeedm@...dia.com,
leon@...nel.org,
tariqt@...dia.com,
andrew+netdev@...n.ch,
horms@...nel.org,
donald.hunter@...il.com,
parav@...dia.com,
kalesh-anakkur.purayil@...adcom.com
Subject: [PATCH net-next v3 2/3] devlink: add function unique identifier to devlink dev info
From: Jiri Pirko <jiri@...dia.com>
A physical device may consists of several PCI physical functions.
Each of this PCI function's "serial_number" is same because they are
part of single board. From this serial number, PCI function cannot be
uniquely referenced in a system.
Expanding this in slightly more complex system of multi-host
"board.serial_number" is not even now unique across two hosts.
Further expanding this for DPU based board, a DPU board has PCI
functions on the external host as well as DPU internal host.
Such DPU side PCI physical functions also have the same "serial_number".
There is a need to identify each PCI function uniquely in a factory.
We are presently missing this function unique identifier.
Hence, introduce a function unique identifier, which is uniquely
identifies a function across one or multiple hosts, also has unique
identifier with/without DPU based NICs.
Signed-off-by: Jiri Pirko <jiri@...dia.com>
Reviewed-by: Parav Pandit <parav@...dia.com>
Reviewed-by: Simon Horman <horms@...nel.org>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@...adcom.com>
---
v2->v3:
- extended patch description
- extended documentation
---
Documentation/netlink/specs/devlink.yaml | 4 ++++
.../networking/devlink/devlink-info.rst | 20 +++++++++++++++++++
include/net/devlink.h | 2 ++
include/uapi/linux/devlink.h | 2 ++
net/devlink/dev.c | 9 +++++++++
5 files changed, 37 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 dd6adc4d0559..d0d4e17df148 100644
--- a/Documentation/networking/devlink/devlink-info.rst
+++ b/Documentation/networking/devlink/devlink-info.rst
@@ -50,6 +50,26 @@ 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.
+
+ A physical device may consists of several PCI physical functions.
+ Each of this PCI function's ``serial_number`` is same because they are
+ part of single board. From this serial number, PCI function cannot be
+ uniquely referenced in a system.
+
+ Expanding this in slightly more complex system of multi-host
+ ``board.serial_number`` is not even now unique across two hosts.
+
+ Further expanding this for DPU based board, a DPU board has PCI
+ functions on the external host as well as DPU internal host.
+ Such DPU side PCI physical functions also have the same
+ ``serial_number``.
+
+ The function unique identifier uniquely identifies a function
+ across one or multiple hosts, also has unique identifier
+ with/without DPU based NICs.
+
* - ``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 02602704bdea..581a8ad7a568 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.49.0
Powered by blists - more mailing lists