[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250320085947.103419-4-jiri@resnulli.us>
Date: Thu, 20 Mar 2025 09:59:46 +0100
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
Subject: [PATCH net-next v2 3/4] devlink: add function unique identifier to devlink dev info
From: Jiri Pirko <jiri@...dia.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@...dia.com>
Reviewed-by: Parav Pandit <parav@...dia.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
Powered by blists - more mailing lists