The CMIS parser uses the same trick as the SFF-8636 parser to identify copper cables for which attenuation should be printed. That is, it considers every transmitter technology value above 0x09 as an indication that it is dealing with a copper cable. This is not true for CMIS transceivers which support more transmitter technologies compared to SFF-8636. For example, according to table 8-40 in CMIS 5.3, 0x10 is "C-band tunable laser". Fix the identification of copper cables by only matching on the relevant transmitter technology values. For all the rest, only print the wavelength if Page 01h is supported and the nominal wavelength is not 0. Fixes: 88ca347ef35a ("Add QSFP-DD support") Reviewed-by: Danielle Ratson Signed-off-by: Ido Schimmel --- cmis.c | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/cmis.c b/cmis.c index 19a3eb7cf925..351e18484854 100644 --- a/cmis.c +++ b/cmis.c @@ -255,10 +255,20 @@ static void cmis_show_sig_integrity(const struct cmis_memory_map *map) static void cmis_show_mit_compliance(const struct cmis_memory_map *map) { __u8 value = map->page_00h[CMIS_MEDIA_INTF_TECH_OFFSET]; + float wl, wl_tol; module_show_mit_compliance(value); - if (value >= MODULE_TT_COPPER_UNEQUAL) { + switch (value) { + case MODULE_TT_COPPER_UNEQUAL: + case MODULE_TT_COPPER_PASS_EQUAL: + case MODULE_TT_COPPER_NF_EQUAL: + case MODULE_TT_COPPER_F_EQUAL: + case MODULE_TT_COPPER_N_EQUAL: + case MODULE_TT_COPPER_LINEAR_EQUAL: + case MODULE_TT_COPPER_NF_LINEAR: + case MODULE_TT_COPPER_F_LINEAR: + case MODULE_TT_COPPER_N_LINEAR: module_print_any_uint("Attenuation at 5GHz", map->page_00h[CMIS_COPPER_ATT_5GHZ], "db"); module_print_any_uint("Attenuation at 7GHz", @@ -269,15 +279,20 @@ static void cmis_show_mit_compliance(const struct cmis_memory_map *map) module_print_any_uint("Attenuation at 25.8GHz", map->page_00h[CMIS_COPPER_ATT_25P8GHZ], "db"); - } else if (map->page_01h) { - module_print_any_float("Laser wavelength", - (((map->page_01h[CMIS_NOM_WAVELENGTH_MSB] << 8) | - map->page_01h[CMIS_NOM_WAVELENGTH_LSB]) * 0.05), - "nm"); - module_print_any_float("Laser wavelength tolerance", - (((map->page_01h[CMIS_WAVELENGTH_TOL_MSB] << 8) | - map->page_01h[CMIS_WAVELENGTH_TOL_LSB]) * 0.005), + break; + default: + if (!map->page_01h) + break; + wl = ((map->page_01h[CMIS_NOM_WAVELENGTH_MSB] << 8) | + map->page_01h[CMIS_NOM_WAVELENGTH_LSB]) * 0.05; + wl_tol = ((map->page_01h[CMIS_WAVELENGTH_TOL_MSB] << 8) | + map->page_01h[CMIS_WAVELENGTH_TOL_LSB]) * 0.005; + if (!wl) + break; + module_print_any_float("Laser wavelength", wl, "nm"); + module_print_any_float("Laser wavelength tolerance", wl_tol, "nm"); + break; } } -- 2.55.0