From: Florian Fainelli <f.fainelli@gmail.com>
To: netdev@vger.kernel.org
Cc: Florian Fainelli <f.fainelli@gmail.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
"Maciej W. Rozycki" <macro@orcam.me.uk>,
Daniel Machon <daniel.machon@microchip.com>,
linux-kernel@vger.kernel.org (open list)
Subject: [PATCH net v2 4/4] net: sb1250-mac: Fix RX checksum status and header offset setup
Date: Tue, 10 Nov 2026 15:03:00 -0800 [thread overview]
Message-ID: <20261110230300.2769327-5-f.fainelli@gmail.com> (raw)
In-Reply-To: <20261110230300.2769327-1-f.fainelli@gmail.com>
The receive path tests M_DMA_ETHRX_BADTCPCS in descriptor A, but the
hardware reports it in descriptor B. Bit zero of descriptor A belongs
to the buffer address and is clear for the aligned receive buffers.
Consequently, a frame with a valid IPv4 checksum and a bad TCP checksum
can be marked CHECKSUM_UNNECESSARY. Read the TCP status from descriptor B.
The IP header offset setup also only masks the old register value due
to the combined AND/OR expression. Split the mask and field assignment
so that the intended offset of 15 is actually programmed.
Channel startup clears the receive filter register, losing any offset
set during probe. Program it again before enabling reception on every
channel start, including link changes, and preserve it when enabling
unicast and broadcast reception.
Both bugs predate the RX checksum feature advertisement. Sashiko AI
reported them during review of that change.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/ethernet/broadcom/sb1250-mac.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/sb1250-mac.c b/drivers/net/ethernet/broadcom/sb1250-mac.c
index 433aa1e24439..7998ab9fc46c 100644
--- a/drivers/net/ethernet/broadcom/sb1250-mac.c
+++ b/drivers/net/ethernet/broadcom/sb1250-mac.c
@@ -280,6 +280,7 @@ static void sbdma_tx_process(struct sbmac_softc *sc, struct sbmacdma *d,
int poll);
static int sbmac_initctx(struct sbmac_softc *s);
static void sbmac_channel_start(struct sbmac_softc *s);
+static void sbmac_set_iphdr_offset(struct sbmac_softc *sc);
static void sbmac_channel_stop(struct sbmac_softc *s);
static enum sbmac_state sbmac_set_channel_state(struct sbmac_softc *,
enum sbmac_state);
@@ -1145,7 +1146,7 @@ static int sbdma_rx_process(struct sbmac_softc *sc, struct sbmacdma *d,
/* Honor the RX checksum offload feature setting. */
if (dev->features & NETIF_F_RXCSUM) {
if (!((dsc->dscr_a) & M_DMA_ETHRX_BADIP4CS) &&
- !((dsc->dscr_a) & M_DMA_ETHRX_BADTCPCS)) {
+ !((dsc->dscr_b) & M_DMA_ETHRX_BADTCPCS)) {
sb->ip_summed = CHECKSUM_UNNECESSARY;
/* don't need to set sb->csum */
} else {
@@ -1496,6 +1497,7 @@ static void sbmac_channel_start(struct sbmac_softc *s)
*/
__raw_writeq(0, s->sbm_rxfilter);
+ sbmac_set_iphdr_offset(s);
__raw_writeq(0, s->sbm_imr);
__raw_writeq(framecfg, s->sbm_framecfg);
__raw_writeq(fifo, s->sbm_fifocfg);
@@ -1549,7 +1551,9 @@ static void sbmac_channel_start(struct sbmac_softc *s)
* Enable receiving unicasts and broadcasts
*/
- __raw_writeq(M_MAC_UCAST_EN | M_MAC_BCAST_EN, s->sbm_rxfilter);
+ reg = __raw_readq(s->sbm_rxfilter);
+ reg |= M_MAC_UCAST_EN | M_MAC_BCAST_EN;
+ __raw_writeq(reg, s->sbm_rxfilter);
/*
* we're running now.
@@ -1717,7 +1721,8 @@ static void sbmac_set_iphdr_offset(struct sbmac_softc *sc)
/* Hard code the off set to 15 for now */
reg = __raw_readq(sc->sbm_rxfilter);
- reg &= ~M_MAC_IPHDR_OFFSET | V_MAC_IPHDR_OFFSET(15);
+ reg &= ~M_MAC_IPHDR_OFFSET;
+ reg |= V_MAC_IPHDR_OFFSET(15);
__raw_writeq(reg, sc->sbm_rxfilter);
/* BCM1250 pass1 didn't have hardware checksum. Everything
--
2.53.0
next prev parent reply other threads:[~2026-11-10 23:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 23:02 [PATCH net v2 0/4] net: sb1250-mac: ethtool link updates Florian Fainelli
2026-11-10 23:02 ` [PATCH net v2 1/4] net: sb1250-mac: Add ethtool link settings support Florian Fainelli
2026-11-10 23:02 ` [PATCH net v2 2/4] net: sb1250-mac: Advertise and honor RX checksum offload Florian Fainelli
2026-11-10 23:02 ` [PATCH net v2 3/4] net: sb1250-mac: Add ethtool autonegotiation restart support Florian Fainelli
2026-11-10 23:03 ` Florian Fainelli [this message]
2026-11-10 23:52 ` [PATCH net v2 0/4] net: sb1250-mac: ethtool link updates netdev-bot+sinfo
2026-11-10 23:54 ` Florian Fainelli
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=20261110230300.2769327-5-f.fainelli@gmail.com \
--to=f.fainelli@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=daniel.machon@microchip.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=macro@orcam.me.uk \
--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®