Skip to content

Commit b5872cd

Browse files
Vasundhara Volamdavem330
authored andcommitted
devlink: Add support for board.serial_number to info_get cb.
Board serial number is a serial number, often available in PCI *Vital Product Data*. Also, update devlink-info.rst documentation file. Cc: Jiri Pirko <jiri@mellanox.com> Cc: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Vasundhara Volam <vasundhara-v.volam@broadcom.com> Reviewed-by: Michael Chan <michael.chan@broadcom.com> Reviewed-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 406fcb5 commit b5872cd

4 files changed

Lines changed: 17 additions & 7 deletions

File tree

‎Documentation/networking/devlink/devlink-info.rst‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,11 @@ versions is generally discouraged - here, and via any other Linux API.
4444
reported for two ports of the same device or on two hosts of
4545
a multi-host device should be identical.
4646

47-
.. note:: ``devlink-info`` API should be extended with a new field
48-
if devices want to report board/product serial number (often
49-
reported in PCI *Vital Product Data* capability).
47+
* - ``board.serial_number``
48+
- Board serial number of the device.
49+
50+
This is usually the serial number of the board, often available in
51+
PCI *Vital Product Data*.
5052

5153
* - ``fixed``
5254
- Group for hardware identifiers, and versions of components
@@ -201,10 +203,6 @@ Future work
201203

202204
The following extensions could be useful:
203205

204-
- product serial number - NIC boards often get labeled with a board serial
205-
number rather than ASIC serial number; it'd be useful to add board serial
206-
numbers to the API if they can be retrieved from the device;
207-
208206
- on-disk firmware file names - drivers list the file names of firmware they
209207
may need to load onto devices via the ``MODULE_FIRMWARE()`` macro. These,
210208
however, are per module, rather than per device. It'd be useful to list

‎include/net/devlink.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1284,6 +1284,8 @@ int devlink_info_serial_number_put(struct devlink_info_req *req,
12841284
const char *sn);
12851285
int devlink_info_driver_name_put(struct devlink_info_req *req,
12861286
const char *name);
1287+
int devlink_info_board_serial_number_put(struct devlink_info_req *req,
1288+
const char *bsn);
12871289
int devlink_info_version_fixed_put(struct devlink_info_req *req,
12881290
const char *version_name,
12891291
const char *version_value);

‎include/uapi/linux/devlink.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,8 @@ enum devlink_attr {
453453

454454
DEVLINK_ATTR_PORT_FUNCTION, /* nested */
455455

456+
DEVLINK_ATTR_INFO_BOARD_SERIAL_NUMBER, /* string */
457+
456458
/* add new attributes above here, update the policy in devlink.c */
457459

458460
__DEVLINK_ATTR_MAX,

‎net/core/devlink.c‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4502,6 +4502,14 @@ int devlink_info_serial_number_put(struct devlink_info_req *req, const char *sn)
45024502
}
45034503
EXPORT_SYMBOL_GPL(devlink_info_serial_number_put);
45044504

4505+
int devlink_info_board_serial_number_put(struct devlink_info_req *req,
4506+
const char *bsn)
4507+
{
4508+
return nla_put_string(req->msg, DEVLINK_ATTR_INFO_BOARD_SERIAL_NUMBER,
4509+
bsn);
4510+
}
4511+
EXPORT_SYMBOL_GPL(devlink_info_board_serial_number_put);
4512+
45054513
static int devlink_info_version_put(struct devlink_info_req *req, int attr,
45064514
const char *version_name,
45074515
const char *version_value)

0 commit comments

Comments
 (0)