Commit 58d844e8 authored by David S. Miller's avatar David S. Miller

Merge branch 'devlink-Add-board-serial_number-field-to-info_get-cb'

Vasundhara Volam says:

====================
devlink: Add board.serial_number field to info_get cb.

This patchset adds support for board.serial_number to devlink info_get
cb and also use it in bnxt_en driver.

Sample output:

$ devlink dev info pci/0000:af:00.1
pci/0000:af:00.1:
  driver bnxt_en
  serial_number 00-10-18-FF-FE-AD-1A-00
  board.serial_number 433551F+172300000
  versions:
      fixed:
        board.id 7339763 Rev 0.
        asic.id 16D7
        asic.rev 1
      running:
        fw 216.1.216.0
        fw.psid 0.0.0
        fw.mgmt 216.1.192.0
        fw.mgmt.api 1.10.1
        fw.ncsi 0.0.0.0
        fw.roce 216.1.16.0

v2:
- Modify board_serial_number to board.serial_number for maintaining
consistency.
- Combine 2 lines in second patchset as column limit is 100 now
====================
Reviewed-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 406fcb5b 9bf88b9f
...@@ -44,9 +44,11 @@ versions is generally discouraged - here, and via any other Linux API. ...@@ -44,9 +44,11 @@ versions is generally discouraged - here, and via any other Linux API.
reported for two ports of the same device or on two hosts of reported for two ports of the same device or on two hosts of
a multi-host device should be identical. a multi-host device should be identical.
.. note:: ``devlink-info`` API should be extended with a new field * - ``board.serial_number``
if devices want to report board/product serial number (often - Board serial number of the device.
reported in PCI *Vital Product Data* capability).
This is usually the serial number of the board, often available in
PCI *Vital Product Data*.
* - ``fixed`` * - ``fixed``
- Group for hardware identifiers, and versions of components - Group for hardware identifiers, and versions of components
...@@ -201,10 +203,6 @@ Future work ...@@ -201,10 +203,6 @@ Future work
The following extensions could be useful: The following extensions could be useful:
- product serial number - NIC boards often get labeled with a board serial
number rather than ASIC serial number; it'd be useful to add board serial
numbers to the API if they can be retrieved from the device;
- on-disk firmware file names - drivers list the file names of firmware they - on-disk firmware file names - drivers list the file names of firmware they
may need to load onto devices via the ``MODULE_FIRMWARE()`` macro. These, may need to load onto devices via the ``MODULE_FIRMWARE()`` macro. These,
however, are per module, rather than per device. It'd be useful to list however, are per module, rather than per device. It'd be useful to list
......
...@@ -411,6 +411,12 @@ static int bnxt_dl_info_get(struct devlink *dl, struct devlink_info_req *req, ...@@ -411,6 +411,12 @@ static int bnxt_dl_info_get(struct devlink *dl, struct devlink_info_req *req,
return rc; return rc;
} }
if (strlen(bp->board_serialno)) {
rc = devlink_info_board_serial_number_put(req, bp->board_serialno);
if (rc)
return rc;
}
sprintf(buf, "%X", bp->chip_num); sprintf(buf, "%X", bp->chip_num);
rc = devlink_info_version_fixed_put(req, rc = devlink_info_version_fixed_put(req,
DEVLINK_INFO_VERSION_GENERIC_ASIC_ID, buf); DEVLINK_INFO_VERSION_GENERIC_ASIC_ID, buf);
......
...@@ -1284,6 +1284,8 @@ int devlink_info_serial_number_put(struct devlink_info_req *req, ...@@ -1284,6 +1284,8 @@ int devlink_info_serial_number_put(struct devlink_info_req *req,
const char *sn); const char *sn);
int devlink_info_driver_name_put(struct devlink_info_req *req, int devlink_info_driver_name_put(struct devlink_info_req *req,
const char *name); const char *name);
int devlink_info_board_serial_number_put(struct devlink_info_req *req,
const char *bsn);
int devlink_info_version_fixed_put(struct devlink_info_req *req, int devlink_info_version_fixed_put(struct devlink_info_req *req,
const char *version_name, const char *version_name,
const char *version_value); const char *version_value);
......
...@@ -453,6 +453,8 @@ enum devlink_attr { ...@@ -453,6 +453,8 @@ enum devlink_attr {
DEVLINK_ATTR_PORT_FUNCTION, /* nested */ DEVLINK_ATTR_PORT_FUNCTION, /* nested */
DEVLINK_ATTR_INFO_BOARD_SERIAL_NUMBER, /* string */
/* add new attributes above here, update the policy in devlink.c */ /* add new attributes above here, update the policy in devlink.c */
__DEVLINK_ATTR_MAX, __DEVLINK_ATTR_MAX,
......
...@@ -4502,6 +4502,14 @@ int devlink_info_serial_number_put(struct devlink_info_req *req, const char *sn) ...@@ -4502,6 +4502,14 @@ int devlink_info_serial_number_put(struct devlink_info_req *req, const char *sn)
} }
EXPORT_SYMBOL_GPL(devlink_info_serial_number_put); EXPORT_SYMBOL_GPL(devlink_info_serial_number_put);
int devlink_info_board_serial_number_put(struct devlink_info_req *req,
const char *bsn)
{
return nla_put_string(req->msg, DEVLINK_ATTR_INFO_BOARD_SERIAL_NUMBER,
bsn);
}
EXPORT_SYMBOL_GPL(devlink_info_board_serial_number_put);
static int devlink_info_version_put(struct devlink_info_req *req, int attr, static int devlink_info_version_put(struct devlink_info_req *req, int attr,
const char *version_name, const char *version_name,
const char *version_value) const char *version_value)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment