* qlogic: netxen: possibly incorrect mask used for a couple of NEXTXEN_DIMM_* macros
@ 2025-05-08 11:52 Colin King (gmail)
0 siblings, 0 replies; only message in thread
From: Colin King (gmail) @ 2025-05-08 11:52 UTC (permalink / raw)
To: Manish Chopra, Manish Chopra, GR-Linux-NIC-Dev, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
[-- Attachment #1.1.1: Type: text/plain, Size: 1648 bytes --]
Hi,
In drivers/net/ethernet/qlogic/netxen/netxen_nic_hdr.h there are the
following macros:
#define NETXEN_DIMM_NUMRANKS(VAL) ((VAL >> 15) & 0x3)
#define NETXEN_DIMM_DATAWIDTH(VAL) ((VAL >> 18) & 0x3)
#define NETXEN_DIMM_NUMBANKS(VAL) ((VAL >> 21) & 0xf)
The NETXEN_DIMM_NUMRANKS and NETXEN_DIMM_DATAWIDTH macros extract 3 bits
worth of information from VAL however the mask is 0x3 (just 2 bits)
rather than 0x7 (3 bits). I don't have the hardware or datasheet for the
hardware so I can't be sure if this is intentional or just a masking bug
in one and/or both of these two macros.
I highly suspect the NETXEN_DIMM_DATAWIDTH is incorrect because 8
different data widths are being checked in the switch statement in
netxen_sysfs_read_dimm():
switch (dw) {
case 0x0:
dw = 32;
break;
case 0x1:
dw = 33;
break;
case 0x2:
dw = 36;
break;
case 0x3:
dw = 64;
break;
case 0x4:
dw = 72;
break;
case 0x5:
dw = 80;
break;
case 0x6:
dw = 128;
break;
case 0x7:
dw = 144;
break;
default:
netdev_err(netdev, "Invalid data-width %x\n", dw);
goto out;
}
Anyhow, I'm unsure about this and I wanted to flag this up as potential
issue in the driver.
Colin
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 4901 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-05-08 11:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-08 11:52 qlogic: netxen: possibly incorrect mask used for a couple of NEXTXEN_DIMM_* macros Colin King (gmail)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox