Re: [PATCH net] net: stmmac: dwmac-sun8i: Honor the RX checksum offload setting

From: James Hilliard

Date: Thu Nov 19 2026 - 18:33:23 EST


On Thu, Nov 19, 2026 at 3:48 PM Jakub Kicinski <kuba@xxxxxxxxxx> wrote:
>
> On Sun, 15 Nov 2026 17:58:26 -0700 James Hilliard wrote:
> > stmmac_set_features() clears hw->rx_csum when RX checksum offload is
> > disabled, but sun8i_dwmac_rx_ipc_enable() unconditionally enables the
> > hardware checksum engine. The MAC therefore keeps dropping packets with
> > invalid IP or transport checksums before they reach the host, even after
> > ethtool reports RX checksumming as disabled.
>
> Rx checksumming only controls whether the _good_ packet indication /
> offload is communicated up the stack. The device should never drop
> packets due to a bad L4 checksum. Checksumming L4 is not much of a DoS
> vector. Oleksij was fixing this in other stmmac variants. I _think_ you
> should always clear this bit if it leads to packet drops.

The case I hit was `rx off`: on H616, ethtool reported RX checksumming
off, but the driver still set EMAC_RX_CTL0 bit 27. Clearing it let
packets with a bad UDP checksum reach the stack, where they failed
software validation. With `rx on`, the driver sets bit 27 both before
and after my patch, so the drops in that mode predate the patch.

H616 also has a separate control for forwarding error frames to DMA:
RX_ERR_FRM (EMAC_RX_CTL1 bit 3). With bit 27 set and normal filtering,
none of 100 packets with a bad UDP checksum reached an RX descriptor.
Setting RX_ERR_FRM let all 100 through to DMA in both the IPv4 and
IPv6 tests. The descriptors had the payload checksum error and error
summary bits set, but not the CRC error bit. The driver discarded
them on the error summary.

> (FCS is fine, bad FCS should only be passed up if RX_ALL is set,
> but sounds like your device has all checksums controlled by one bit?
> in which case we prefer to see all and let driver discard the bad FCS)

Ethernet FCS checking stays active on H616 with bit 27 clear. With
normal filtering, bad-FCS frames produced no RX descriptor in either
setting. With error forwarding enabled, all 100 bad-FCS frames had
RDES0_CRC_ERROR set in each setting, and the driver discarded them.

> If I completely misunderstand things we should at least get a respin
> to update the cover letter. The commit message talks about L4 offload,
> and rx_csum is L4 AFAIU but the bit is called CRC which deserves a
> mention somewhere IMVHO.

The H616 manual calls bit 27 CHECK_CRC and mentions the IPv4 header
checksum. What I should have made clearer is that the bit also affects
transport checksum checking, but clearing it doesn't disable Ethernet
FCS detection.

Would it make sense to address the `rx on` drops in a separate
follow-up along the lines of Oleksij's dwmac4 fix [0]? On sun8i that
would mean enabling error forwarding to DMA and passing packets whose
only error is an IP or transport checksum up as CHECKSUM_NONE, while
still discarding frames with a bad FCS or other fatal RX errors.

If we leave the checker enabled in both modes, `rx off` would only
control whether the driver reports a checksum as verified. In that
form the follow-up would replace the conditional bit-27 write rather
than depend on this patch.

[0] https://lore.kernel.org/r/20250818090217.2789521-4-o.rempel@xxxxxxxxxxxxxx/

> --
> pw-bot: cr