diff options
author | Damjan Marion <damarion@cisco.com> | 2018-09-24 15:17:36 +0200 |
---|---|---|
committer | Neale Ranns <nranns@cisco.com> | 2018-09-25 12:16:57 +0000 |
commit | c45e190f70e0317b62eeec23ad92a80b81e0b384 (patch) | |
tree | 9bfdc43d65562da147585a6efb7e042fefc75275 /src/plugins | |
parent | fe4e48f617f3e0f62880adebdcfb5989aa4e6db7 (diff) |
dpdk: show pluggable info in 'show hardware'
module: id SFP/SFP+/SFP28, compatibility: 40g_active_cable
vendor: Amphenol, part NDCCGF-I202
revision: C, serial: APF1711202351C, date code: 170318
cable length: 2m
Change-Id: Ife35607b4f078f7b56737fe066ad4cbd247a7504
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/dpdk/device/format.c | 28 | ||||
-rw-r--r-- | src/plugins/ixge/ixge.c | 4 |
2 files changed, 30 insertions, 2 deletions
diff --git a/src/plugins/dpdk/device/format.c b/src/plugins/dpdk/device/format.c index eed7e2862d3..5cb03b85dab 100644 --- a/src/plugins/dpdk/device/format.c +++ b/src/plugins/dpdk/device/format.c @@ -22,6 +22,7 @@ #include <dlfcn.h> #include <vnet/ethernet/ethernet.h> +#include <vnet/ethernet/sfp.h> #include <dpdk/device/dpdk.h> #include <dpdk/device/dpdk_priv.h> @@ -496,6 +497,30 @@ format_dpdk_device_errors (u8 * s, va_list * args) return s; } +static u8 * +format_dpdk_device_module_info (u8 * s, va_list * args) +{ + dpdk_device_t *xd = va_arg (*args, dpdk_device_t *); + struct rte_eth_dev_module_info mi = { 0 }; + struct rte_dev_eeprom_info ei = { 0 }; + + if (rte_eth_dev_get_module_info (xd->port_id, &mi) != 0) + return format (s, "unknown"); + + ei.length = mi.eeprom_len; + ei.data = clib_mem_alloc (mi.eeprom_len); + + if (rte_eth_dev_get_module_eeprom (xd->port_id, &ei) == 0) + { + s = format (s, "%U", format_sfp_eeprom, ei.data); + } + else + s = format (s, "eeprom read error"); + + clib_mem_free (ei.data); + return s; +} + static const char * ptr2sname (void *p) { @@ -567,6 +592,9 @@ format_dpdk_device (u8 * s, va_list * args) vec_free (s2); } + s = format (s, "%Umodule: %U\n", format_white_space, indent + 2, + format_dpdk_device_module_info, xd); + s = format (s, "%Umax rx packet len: %d\n", format_white_space, indent + 2, di.max_rx_pktlen); s = format (s, "%Upromiscuous: unicast %s all-multicast %s\n", diff --git a/src/plugins/ixge/ixge.c b/src/plugins/ixge/ixge.c index c13537da74e..aa14eac7fd7 100644 --- a/src/plugins/ixge/ixge.c +++ b/src/plugins/ixge/ixge.c @@ -359,7 +359,7 @@ ixge_sfp_phy_init (ixge_device_t * xd) vlib_i2c_read_eeprom (ib, 0x50, 0, 128, (u8 *) & xd->sfp_eeprom); if (vlib_i2c_bus_timed_out (ib) || !sfp_eeprom_is_valid (&xd->sfp_eeprom)) - xd->sfp_eeprom.id = SFP_ID_unknown; + xd->sfp_eeprom.id = SFP_ID_UNKNOWN; else { /* FIXME 5 => SR/LR eeprom ID. */ @@ -2364,7 +2364,7 @@ format_ixge_device (u8 * s, va_list * args) s = format (s, "\n%U", format_white_space, indent + 2); if (phy->mdio_address != ~0) s = format (s, "PHY address %d, id 0x%x", phy->mdio_address, phy->id); - else if (xd->sfp_eeprom.id == SFP_ID_sfp) + else if (xd->sfp_eeprom.id == SFP_ID_SFP) s = format (s, "SFP %U", format_sfp_eeprom, &xd->sfp_eeprom); else s = format (s, "PHY not found"); |