From: Ido Schimmel <idosch@nvidia.com>
To: netdev@vger.kernel.org
Cc: mkubecek@suse.cz, danieller@nvidia.com, Ido Schimmel <idosch@nvidia.com>
Subject: [PATCH ethtool 7/8] cmis: Fix printing of attenuation and wavelength
Date: Thu, 16 Jul 2026 09:45:31 +0300 [thread overview]
Message-ID: <20260716064532.1522382-8-idosch@nvidia.com> (raw)
In-Reply-To: <20260716064532.1522382-1-idosch@nvidia.com>
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 <danieller@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
---
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
next prev parent reply other threads:[~2026-07-16 6:48 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-16 6:45 [PATCH ethtool 0/8] cmis: Miscellaneous fixes Ido Schimmel
2026-07-16 6:45 ` [PATCH ethtool 1/8] cmis: Fix printing of Tx bias current Ido Schimmel
2026-07-16 6:45 ` [PATCH ethtool 2/8] cmis: Fix printing of channel-level flags Ido Schimmel
2026-07-16 6:45 ` [PATCH ethtool 3/8] cmis: Fix printing of CDB EPL pages Ido Schimmel
2026-07-16 6:45 ` [PATCH ethtool 4/8] module-common: Fix printing of transmitter technology for CMIS transceivers Ido Schimmel
2026-07-16 6:45 ` [PATCH ethtool 5/8] module-common: Avoid undefined behavior with " Ido Schimmel
2026-07-16 6:45 ` [PATCH ethtool 6/8] module-common: Add missing CMIS transmitter technologies Ido Schimmel
2026-07-16 6:45 ` Ido Schimmel [this message]
2026-07-16 6:45 ` [PATCH ethtool 8/8] cmis: Fix printing of link length Ido Schimmel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260716064532.1522382-8-idosch@nvidia.com \
--to=idosch@nvidia.com \
--cc=danieller@nvidia.com \
--cc=mkubecek@suse.cz \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox