* [PATCH net-next 0/2] devlink: Add board_serial_number field to info_get cb.
@ 2020-06-20 8:15 Vasundhara Volam
2020-06-20 8:15 ` [PATCH net-next 1/2] devlink: Add support for board_serial_number " Vasundhara Volam
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Vasundhara Volam @ 2020-06-20 8:15 UTC (permalink / raw)
To: davem; +Cc: netdev, michael.chan, kuba, jiri, jacob.e.keller,
Vasundhara Volam
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
Vasundhara Volam (2):
devlink: Add support for board_serial_number to info_get cb.
bnxt_en: Add board_serial_number field to info_get cb
Documentation/networking/devlink/devlink-info.rst | 12 +++++-------
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c | 7 +++++++
include/net/devlink.h | 2 ++
include/uapi/linux/devlink.h | 2 ++
net/core/devlink.c | 8 ++++++++
5 files changed, 24 insertions(+), 7 deletions(-)
--
1.8.3.1
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH net-next 1/2] devlink: Add support for board_serial_number to info_get cb. 2020-06-20 8:15 [PATCH net-next 0/2] devlink: Add board_serial_number field to info_get cb Vasundhara Volam @ 2020-06-20 8:15 ` Vasundhara Volam 2020-06-20 13:06 ` Jiri Pirko 2020-06-20 8:15 ` [PATCH net-next 2/2] bnxt_en: Add board_serial_number field " Vasundhara Volam 2020-06-20 12:09 ` [PATCH net-next 0/2] devlink: " Jiri Pirko 2 siblings, 1 reply; 8+ messages in thread From: Vasundhara Volam @ 2020-06-20 8:15 UTC (permalink / raw) To: davem; +Cc: netdev, michael.chan, kuba, jiri, jacob.e.keller, Vasundhara Volam 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> --- Documentation/networking/devlink/devlink-info.rst | 12 +++++------- include/net/devlink.h | 2 ++ include/uapi/linux/devlink.h | 2 ++ net/core/devlink.c | 8 ++++++++ 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/Documentation/networking/devlink/devlink-info.rst b/Documentation/networking/devlink/devlink-info.rst index 3fe1140..d80c846 100644 --- a/Documentation/networking/devlink/devlink-info.rst +++ b/Documentation/networking/devlink/devlink-info.rst @@ -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 a multi-host device should be identical. - .. note:: ``devlink-info`` API should be extended with a new field - if devices want to report board/product serial number (often - reported in PCI *Vital Product Data* capability). + * - ``board_serial_number`` + - Board serial number of the device. + + This is usually the serial number of the board, often available in + PCI *Vital Product Data*. * - ``fixed`` - Group for hardware identifiers, and versions of components @@ -201,10 +203,6 @@ Future work 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 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 diff --git a/include/net/devlink.h b/include/net/devlink.h index 1df6dfe..a8ceb7b 100644 --- a/include/net/devlink.h +++ b/include/net/devlink.h @@ -1262,6 +1262,8 @@ int devlink_info_serial_number_put(struct devlink_info_req *req, const char *sn); int devlink_info_driver_name_put(struct devlink_info_req *req, 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, const char *version_name, const char *version_value); diff --git a/include/uapi/linux/devlink.h b/include/uapi/linux/devlink.h index 08563e6..06eb29c 100644 --- a/include/uapi/linux/devlink.h +++ b/include/uapi/linux/devlink.h @@ -451,6 +451,8 @@ enum devlink_attr { DEVLINK_ATTR_TRAP_POLICER_RATE, /* u64 */ DEVLINK_ATTR_TRAP_POLICER_BURST, /* u64 */ + DEVLINK_ATTR_INFO_BOARD_SERIAL_NUMBER, /* string */ + /* add new attributes above here, update the policy in devlink.c */ __DEVLINK_ATTR_MAX, diff --git a/net/core/devlink.c b/net/core/devlink.c index 2cafbc8..a97c169 100644 --- a/net/core/devlink.c +++ b/net/core/devlink.c @@ -4378,6 +4378,14 @@ int devlink_info_serial_number_put(struct devlink_info_req *req, const char *sn) } 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, const char *version_name, const char *version_value) -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH net-next 1/2] devlink: Add support for board_serial_number to info_get cb. 2020-06-20 8:15 ` [PATCH net-next 1/2] devlink: Add support for board_serial_number " Vasundhara Volam @ 2020-06-20 13:06 ` Jiri Pirko 0 siblings, 0 replies; 8+ messages in thread From: Jiri Pirko @ 2020-06-20 13:06 UTC (permalink / raw) To: Vasundhara Volam; +Cc: davem, netdev, michael.chan, kuba, jiri, jacob.e.keller Sat, Jun 20, 2020 at 10:15:46AM CEST, vasundhara-v.volam@broadcom.com wrote: >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> ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH net-next 2/2] bnxt_en: Add board_serial_number field to info_get cb 2020-06-20 8:15 [PATCH net-next 0/2] devlink: Add board_serial_number field to info_get cb Vasundhara Volam 2020-06-20 8:15 ` [PATCH net-next 1/2] devlink: Add support for board_serial_number " Vasundhara Volam @ 2020-06-20 8:15 ` Vasundhara Volam 2020-06-20 13:07 ` Jiri Pirko 2020-06-20 12:09 ` [PATCH net-next 0/2] devlink: " Jiri Pirko 2 siblings, 1 reply; 8+ messages in thread From: Vasundhara Volam @ 2020-06-20 8:15 UTC (permalink / raw) To: davem; +Cc: netdev, michael.chan, kuba, jiri, jacob.e.keller, Vasundhara Volam Add board_serial_number field info to info_get cb via devlink, if driver can fetch the information from the device. 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> --- drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c index a812beb..16eca3b 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c @@ -411,6 +411,13 @@ static int bnxt_dl_info_get(struct devlink *dl, struct devlink_info_req *req, 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); rc = devlink_info_version_fixed_put(req, DEVLINK_INFO_VERSION_GENERIC_ASIC_ID, buf); -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH net-next 2/2] bnxt_en: Add board_serial_number field to info_get cb 2020-06-20 8:15 ` [PATCH net-next 2/2] bnxt_en: Add board_serial_number field " Vasundhara Volam @ 2020-06-20 13:07 ` Jiri Pirko 2020-06-20 16:19 ` Vasundhara Volam 0 siblings, 1 reply; 8+ messages in thread From: Jiri Pirko @ 2020-06-20 13:07 UTC (permalink / raw) To: Vasundhara Volam; +Cc: davem, netdev, michael.chan, kuba, jiri, jacob.e.keller Sat, Jun 20, 2020 at 10:15:47AM CEST, vasundhara-v.volam@broadcom.com wrote: >Add board_serial_number field info to info_get cb via devlink, >if driver can fetch the information from the device. > >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> >--- > drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c | 7 +++++++ > 1 file changed, 7 insertions(+) > >diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c >index a812beb..16eca3b 100644 >--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c >+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c >@@ -411,6 +411,13 @@ static int bnxt_dl_info_get(struct devlink *dl, struct devlink_info_req *req, > return rc; > } > >+ if (strlen(bp->board_serialno)) { >+ rc = devlink_info_board_serial_number_put(req, No need for linebreak here. >+ bp->board_serialno); >+ if (rc) >+ return rc; >+ } >+ > sprintf(buf, "%X", bp->chip_num); > rc = devlink_info_version_fixed_put(req, > DEVLINK_INFO_VERSION_GENERIC_ASIC_ID, buf); >-- >1.8.3.1 > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net-next 2/2] bnxt_en: Add board_serial_number field to info_get cb 2020-06-20 13:07 ` Jiri Pirko @ 2020-06-20 16:19 ` Vasundhara Volam 0 siblings, 0 replies; 8+ messages in thread From: Vasundhara Volam @ 2020-06-20 16:19 UTC (permalink / raw) To: Jiri Pirko Cc: David Miller, Netdev, Michael Chan, Jakub Kicinski, Jiri Pirko, Jacob Keller On Sat, Jun 20, 2020 at 6:37 PM Jiri Pirko <jiri@resnulli.us> wrote: > > Sat, Jun 20, 2020 at 10:15:47AM CEST, vasundhara-v.volam@broadcom.com wrote: > >Add board_serial_number field info to info_get cb via devlink, > >if driver can fetch the information from the device. > > > >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> > >--- > > drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c | 7 +++++++ > > 1 file changed, 7 insertions(+) > > > >diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c > >index a812beb..16eca3b 100644 > >--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c > >+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c > >@@ -411,6 +411,13 @@ static int bnxt_dl_info_get(struct devlink *dl, struct devlink_info_req *req, > > return rc; > > } > > > >+ if (strlen(bp->board_serialno)) { > >+ rc = devlink_info_board_serial_number_put(req, > > No need for linebreak here. Ah yes, now the column limit is 100. I will fix and send a v2. Thanks. > > >+ bp->board_serialno); > >+ if (rc) > >+ return rc; > >+ } > >+ > > sprintf(buf, "%X", bp->chip_num); > > rc = devlink_info_version_fixed_put(req, > > DEVLINK_INFO_VERSION_GENERIC_ASIC_ID, buf); > >-- > >1.8.3.1 > > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net-next 0/2] devlink: Add board_serial_number field to info_get cb. 2020-06-20 8:15 [PATCH net-next 0/2] devlink: Add board_serial_number field to info_get cb Vasundhara Volam 2020-06-20 8:15 ` [PATCH net-next 1/2] devlink: Add support for board_serial_number " Vasundhara Volam 2020-06-20 8:15 ` [PATCH net-next 2/2] bnxt_en: Add board_serial_number field " Vasundhara Volam @ 2020-06-20 12:09 ` Jiri Pirko 2020-06-20 16:17 ` Vasundhara Volam 2 siblings, 1 reply; 8+ messages in thread From: Jiri Pirko @ 2020-06-20 12:09 UTC (permalink / raw) To: Vasundhara Volam; +Cc: davem, netdev, michael.chan, kuba, jiri, jacob.e.keller Sat, Jun 20, 2020 at 10:15:45AM CEST, vasundhara-v.volam@broadcom.com wrote: >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. We have board.id already here. I understand that the serial number does not belong under the same nest, as it is not a "version". However, could you at least maintain the format: board.serial_number ? > 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 > >Vasundhara Volam (2): > devlink: Add support for board_serial_number to info_get cb. > bnxt_en: Add board_serial_number field to info_get cb > > Documentation/networking/devlink/devlink-info.rst | 12 +++++------- > drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c | 7 +++++++ > include/net/devlink.h | 2 ++ > include/uapi/linux/devlink.h | 2 ++ > net/core/devlink.c | 8 ++++++++ > 5 files changed, 24 insertions(+), 7 deletions(-) > >-- >1.8.3.1 > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net-next 0/2] devlink: Add board_serial_number field to info_get cb. 2020-06-20 12:09 ` [PATCH net-next 0/2] devlink: " Jiri Pirko @ 2020-06-20 16:17 ` Vasundhara Volam 0 siblings, 0 replies; 8+ messages in thread From: Vasundhara Volam @ 2020-06-20 16:17 UTC (permalink / raw) To: Jiri Pirko Cc: David Miller, Netdev, Michael Chan, Jakub Kicinski, Jiri Pirko, Jacob Keller On Sat, Jun 20, 2020 at 5:39 PM Jiri Pirko <jiri@resnulli.us> wrote: > > Sat, Jun 20, 2020 at 10:15:45AM CEST, vasundhara-v.volam@broadcom.com wrote: > >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. > > We have board.id already here. I understand that the serial number does > not belong under the same nest, as it is not a "version". > > However, could you at least maintain the format: > board.serial_number > ? Thank you for reviewing the patchset. Yes, I will modify it as board.serial_number in iproute patch. > > > > 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 > > > >Vasundhara Volam (2): > > devlink: Add support for board_serial_number to info_get cb. > > bnxt_en: Add board_serial_number field to info_get cb > > > > Documentation/networking/devlink/devlink-info.rst | 12 +++++------- > > drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c | 7 +++++++ > > include/net/devlink.h | 2 ++ > > include/uapi/linux/devlink.h | 2 ++ > > net/core/devlink.c | 8 ++++++++ > > 5 files changed, 24 insertions(+), 7 deletions(-) > > > >-- > >1.8.3.1 > > ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2020-06-20 16:20 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2020-06-20 8:15 [PATCH net-next 0/2] devlink: Add board_serial_number field to info_get cb Vasundhara Volam 2020-06-20 8:15 ` [PATCH net-next 1/2] devlink: Add support for board_serial_number " Vasundhara Volam 2020-06-20 13:06 ` Jiri Pirko 2020-06-20 8:15 ` [PATCH net-next 2/2] bnxt_en: Add board_serial_number field " Vasundhara Volam 2020-06-20 13:07 ` Jiri Pirko 2020-06-20 16:19 ` Vasundhara Volam 2020-06-20 12:09 ` [PATCH net-next 0/2] devlink: " Jiri Pirko 2020-06-20 16:17 ` Vasundhara Volam
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).