diff options
author | Damjan Marion <damarion@cisco.com> | 2020-03-30 16:16:06 +0200 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2020-03-31 10:07:15 +0000 |
commit | e6b4a5ac1463226930bbe14bb7b058616df85073 (patch) | |
tree | dc181f6b5789fca0f63ccc104c881fbdc937326a | |
parent | b0d2eda75a268f6afc2b08080a3e00b0a3295702 (diff) |
rdma: print device info from PCI VPD in 'show hardware' output
Type: improvement
Change-Id: I275bbca17c5a0263b3e017b48aa6ccd8f59bc7c3
Signed-off-by: Damjan Marion <damarion@cisco.com>
-rw-r--r-- | src/plugins/rdma/format.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/plugins/rdma/format.c b/src/plugins/rdma/format.c index 89a2a7ca0a5..84b6439a2fd 100644 --- a/src/plugins/rdma/format.c +++ b/src/plugins/rdma/format.c @@ -75,13 +75,27 @@ format_rdma_bit_flag (u8 * s, va_list * args) u8 * format_rdma_device (u8 * s, va_list * args) { + vlib_main_t *vm = vlib_get_main (); u32 i = va_arg (*args, u32); rdma_main_t *rm = &rdma_main; rdma_device_t *rd = vec_elt_at_index (rm->devices, i); + vlib_pci_device_info_t *d; u32 indent = format_get_indent (s); s = format (s, "netdev %v pci-addr %U\n", rd->linux_ifname, format_vlib_pci_addr, &rd->pci->addr); + if ((d = vlib_pci_get_device_info (vm, &rd->pci->addr, 0))) + { + s = format (s, "%Uproduct name: %s\n", format_white_space, indent, + d->product_name ? (char *) d->product_name : ""); + s = format (s, "%Upart number: %U\n", format_white_space, indent, + format_vlib_pci_vpd, d->vpd_r, "PN"); + s = format (s, "%Urevision: %U\n", format_white_space, indent, + format_vlib_pci_vpd, d->vpd_r, "EC"); + s = format (s, "%Userial number: %U\n", format_white_space, indent, + format_vlib_pci_vpd, d->vpd_r, "SN"); + vlib_pci_free_device_info (d); + } s = format (s, "%Uflags: %U", format_white_space, indent, format_rdma_device_flags, rd); if (rd->error) |