* [PATCH v3 iproute2-next] devlink: Add board.serial_number to info subcommand.
@ 2020-07-31 10:46 Vasundhara Volam
2020-08-03 11:22 ` Jiri Pirko
2020-08-03 15:37 ` David Ahern
0 siblings, 2 replies; 3+ messages in thread
From: Vasundhara Volam @ 2020-07-31 10:46 UTC (permalink / raw)
To: netdev
Cc: dsahern, stephen, davem, jiri, kuba, michael.chan, Vasundhara Volam
Add support for reading board serial_number to devlink info
subcommand. Example:
$ devlink dev info pci/0000:af:00.0 -jp
{
"info": {
"pci/0000:af:00.0": {
"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"
}
}
}
}
}
Signed-off-by: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
---
v2: Rebase. Resending the patch as I see this patch didn't make it to
mailing list.
v3: Rebase the patch and remove the line from commit message
"This patch has dependency on updated include/uapi/linux/devlink.h file."
as the headers are updated.
---
devlink/devlink.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/devlink/devlink.c b/devlink/devlink.c
index 7dbe9c7e..f4230dac 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -648,6 +648,7 @@ static const enum mnl_attr_data_type devlink_policy[DEVLINK_ATTR_MAX + 1] = {
[DEVLINK_ATTR_REGION_CHUNK_LEN] = MNL_TYPE_U64,
[DEVLINK_ATTR_INFO_DRIVER_NAME] = MNL_TYPE_STRING,
[DEVLINK_ATTR_INFO_SERIAL_NUMBER] = MNL_TYPE_STRING,
+ [DEVLINK_ATTR_INFO_BOARD_SERIAL_NUMBER] = MNL_TYPE_STRING,
[DEVLINK_ATTR_INFO_VERSION_FIXED] = MNL_TYPE_NESTED,
[DEVLINK_ATTR_INFO_VERSION_RUNNING] = MNL_TYPE_NESTED,
[DEVLINK_ATTR_INFO_VERSION_STORED] = MNL_TYPE_NESTED,
@@ -2979,6 +2980,16 @@ static void pr_out_info(struct dl *dl, const struct nlmsghdr *nlh,
print_string(PRINT_ANY, "serial_number", "serial_number %s",
mnl_attr_get_str(nla_sn));
}
+
+ if (tb[DEVLINK_ATTR_INFO_BOARD_SERIAL_NUMBER]) {
+ struct nlattr *nla_bsn = tb[DEVLINK_ATTR_INFO_BOARD_SERIAL_NUMBER];
+
+ if (!dl->json_output)
+ __pr_out_newline();
+ check_indent_newline(dl);
+ print_string(PRINT_ANY, "board.serial_number", "board.serial_number %s",
+ mnl_attr_get_str(nla_bsn));
+ }
__pr_out_indent_dec();
if (has_versions) {
@@ -3014,6 +3025,7 @@ static int cmd_versions_show_cb(const struct nlmsghdr *nlh, void *data)
tb[DEVLINK_ATTR_INFO_VERSION_STORED];
has_info = tb[DEVLINK_ATTR_INFO_DRIVER_NAME] ||
tb[DEVLINK_ATTR_INFO_SERIAL_NUMBER] ||
+ tb[DEVLINK_ATTR_INFO_BOARD_SERIAL_NUMBER] ||
has_versions;
if (has_info)
--
2.18.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v3 iproute2-next] devlink: Add board.serial_number to info subcommand.
2020-07-31 10:46 [PATCH v3 iproute2-next] devlink: Add board.serial_number to info subcommand Vasundhara Volam
@ 2020-08-03 11:22 ` Jiri Pirko
2020-08-03 15:37 ` David Ahern
1 sibling, 0 replies; 3+ messages in thread
From: Jiri Pirko @ 2020-08-03 11:22 UTC (permalink / raw)
To: Vasundhara Volam
Cc: netdev, dsahern, stephen, davem, jiri, kuba, michael.chan
Fri, Jul 31, 2020 at 12:46:43PM CEST, vasundhara-v.volam@broadcom.com wrote:
>Add support for reading board serial_number to devlink info
>subcommand. Example:
>
>$ devlink dev info pci/0000:af:00.0 -jp
>{
> "info": {
> "pci/0000:af:00.0": {
> "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"
> }
> }
> }
> }
>}
>
>Signed-off-by: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
Looks fine.
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v3 iproute2-next] devlink: Add board.serial_number to info subcommand.
2020-07-31 10:46 [PATCH v3 iproute2-next] devlink: Add board.serial_number to info subcommand Vasundhara Volam
2020-08-03 11:22 ` Jiri Pirko
@ 2020-08-03 15:37 ` David Ahern
1 sibling, 0 replies; 3+ messages in thread
From: David Ahern @ 2020-08-03 15:37 UTC (permalink / raw)
To: Vasundhara Volam, netdev
Cc: dsahern, stephen, davem, jiri, kuba, michael.chan
On 7/31/20 4:46 AM, Vasundhara Volam wrote:
> Add support for reading board serial_number to devlink info
> subcommand. Example:
>
> $ devlink dev info pci/0000:af:00.0 -jp
> {
> "info": {
> "pci/0000:af:00.0": {
> "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"
> }
> }
> }
> }
> }
>
> Signed-off-by: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
> ---
> v2: Rebase. Resending the patch as I see this patch didn't make it to
> mailing list.
> v3: Rebase the patch and remove the line from commit message
> "This patch has dependency on updated include/uapi/linux/devlink.h file."
> as the headers are updated.
> ---
> devlink/devlink.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
applied to iproute2-next
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-08-03 15:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-31 10:46 [PATCH v3 iproute2-next] devlink: Add board.serial_number to info subcommand Vasundhara Volam
2020-08-03 11:22 ` Jiri Pirko
2020-08-03 15:37 ` David Ahern
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).