Netdev List
 help / color / mirror / Atom feed
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 2/8] cmis: Fix printing of channel-level flags
Date: Thu, 16 Jul 2026 09:45:26 +0300	[thread overview]
Message-ID: <20260716064532.1522382-3-idosch@nvidia.com> (raw)
In-Reply-To: <20260716064532.1522382-1-idosch@nvidia.com>

CMIS encodes different channel-level flags (e.g., "Laser bias current
high alarm") in different bytes where each bit corresponds to the value
of the flag in a different channel. Since CMIS supports more than 8
channels, these flags can be banked (e.g., channels 1-8 in bank 0,
channels 9-16 in bank 1 etc.).

The code is currently applying the wrong bit mask (the channel number
itself) when extracting the per-channel flag. Fix the calculation of the
bit mask so that the channel offset (0-7) in the current bank determines
the number of bits that are shifted.

Fixes: 340d88ee1289 ("cmis: Parse and print diagnostic information")
Reviewed-by: Danielle Ratson <danieller@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
---
 cmis.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cmis.c b/cmis.c
index a4bf455c2a77..16f168a3b1af 100644
--- a/cmis.c
+++ b/cmis.c
@@ -766,7 +766,7 @@ static void cmis_show_dom_chan_lvl_flag(const struct cmis_memory_map *map,
 		char str[80];
 		bool value;
 
-		value = page_11h[module_aw_chan_flags[flag].offset] & chan;
+		value = page_11h[module_aw_chan_flags[flag].offset] & (1 << i);
 		if (is_json_context()) {
 			print_bool(PRINT_JSON, NULL, NULL, value);
 		} else {
-- 
2.55.0


  parent reply	other threads:[~2026-07-16  6:47 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 ` Ido Schimmel [this message]
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 ` [PATCH ethtool 7/8] cmis: Fix printing of attenuation and wavelength Ido Schimmel
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-3-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