mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Colin King (gmail)" <colin.i.king@gmail.com>
To: Manish Chopra <manishc@marvell.com>,
	Manish Chopra <manishc@marvell.com>,
	GR-Linux-NIC-Dev@marvell.com, Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: qlogic: netxen: possibly incorrect mask used for a couple of NEXTXEN_DIMM_* macros
Date: Thu, 8 May 2025 12:52:19 +0100	[thread overview]
Message-ID: <90373113-c45f-4fdb-bbe9-08cb65b862d3@gmail.com> (raw)


[-- 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 --]

                 reply	other threads:[~2025-05-08 11:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=90373113-c45f-4fdb-bbe9-08cb65b862d3@gmail.com \
    --to=colin.i.king@gmail.com \
    --cc=GR-Linux-NIC-Dev@marvell.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manishc@marvell.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /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

all inboxes | Powered by JetHome®