Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider. Critical: 0 · High: 0 · Medium: 2 · Low: 0 If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough). - [Medium] Undocumented stable-backport prerequisite. - [Medium] The new sun8i_dwmac_rx_status() (drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c) assumes the… -- net: stmmac: dwmac-sun8i: deliver RX checksum errors to the stack This patch sets the sun8i EMAC error-forwarding bit, so frames with bad IP or transport checksums now reach the stack. It also adds a sun8i-specific RX status decoder that both stmmac_rx() and stmmac_rx_zc() use. The hardware checksum checker now stays enabled whenever the receiver is on, and checksum failures and unchecked frames are returned as csum_none.
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c > index 613199da57c1b..a7e4fca50141f 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
[ ... ]
> @@ -652,6 +653,9 @@ static void sun8i_dwmac_core_init(struct mac_device_info *hw, > > v = (8 << EMAC_BURSTLEN_SHIFT); /* burst len */ > writel(v, ioaddr + EMAC_BASIC_CTL1); > + > + /* Forward checksum failures to software before starting RX. */ > + writel(EMAC_RX_ERR_FRM, ioaddr + EMAC_RX_CTL1); > }
[Severity: Medium] With EMAC_RX_ERR_FRM set, the MAC now passes frames with bad IP/TCP/UDP checksums up instead of dropping them. This patch never sets skb->ip_summed itself. These frames only end up as CHECKSUM_NONE because the common RX paths check csum_none: stmmac_rx(): if (unlikely(!coe) || !stmmac_has_ip_ethertype(skb) || (status & csum_none)) skb_checksum_none_assert(skb); else skb->ip_summed = CHECKSUM_UNNECESSARY; In stmmac_rx(), the csum_none test came from ee0aace5f844 ("net: stmmac: Correctly handle Rx checksum offload errors"), which has no Fixes: or Cc: stable tag. In stmmac_dispatch_skb_zc(), it came from fcfc52fcf89a ("net: stmmac: honour Rx checksum errors in the AF_XDP zero-copy path"). This patch carries Fixes: 9f93ac8d4085, so stable may pick it up for every tree back to the original dwmac-sun8i addition. In a tree without ee0aace5f844, stmmac_rx() marks a frame CHECKSUM_UNNECESSARY whenever coe is set and the ethertype is IP. sun8i uses STMMAC_RX_COE_TYPE2, and RXCSUM is on by default. In such a tree, would a backport cause frames with corrupted TCP/UDP payloads to be accepted by the stack as already verified? The v3 notes say: - Document the checksum-status requirements for stable backports. However, the commit message does not mention any prerequisite, and the notes below the --- line are dropped when the patch is applied. Could the dependencies on ee0aace5f844 and fcfc52fcf89a be recorded in the commit message, for example as prerequisite annotations on Cc: stable lines? [ ... ]
> @@ -1081,6 +1078,83 @@ static const struct stmmac_ops sun8i_dwmac_ops = { > .set_mac_loopback = sun8i_dwmac_set_mac_loopback, > }; >
[ ... ]
> +static int sun8i_dwmac_rx_status(struct stmmac_extra_stats *x, struct dma_desc *p) > +{ > + const u32 csum_mask = RDES0_IPC_CSUM_ERROR | RDES0_PAYLOAD_CSUM_ERR; > + const u32 dma_errors = RDES0_DESCRIPTOR_ERROR | RDES0_OVERFLOW_ERROR; > + const u32 wire_errors = RDES0_CRC_ERROR | RDES0_MII_ERROR | > + RDES0_RECEIVE_WATCHDOG | RDES0_COLLISION | > + RDES0_LENGTH_ERROR;
[ ... ]
> + if (unlikely(status & (RDES0_ERROR_SUMMARY | wire_errors | dma_errors))) { > + sun8i_dwmac_rx_error_stats(x, status); > + if (status & dma_errors) > + return discard_frame; > + /* An unexplained error summary is not a checksum verdict. */ > + if (!(status & wire_errors) && > + (!(status & RDES0_FRAME_TYPE) || !(status & csum_mask))) > + return discard_frame; > + }
[ ... ]
> + /* Only a checked IP frame is eligible for CHECKSUM_UNNECESSARY. */ > + if (!(status & RDES0_FRAME_TYPE) || (status & (csum_mask | RDES0_DRIBBLING))) > + return csum_none; > + > + return good_frame; > +}
[Severity: Medium] Is it known that the Allwinner EMAC fills RDES0 bits 5, 7 and 0 (RDES0_FRAME_TYPE, RDES0_IPC_CSUM_ERROR, RDES0_PAYLOAD_CSUM_ERR) using the Synopsys Type-2 COE encoding? The previous sun8i decoder, ndesc_get_rx_status() in norm_desc.c, never read RDES0_FRAME_TYPE. Only enh_desc_coe_rdes0() decodes these three bits, and sun8i does not use enhanced descriptors. The probe code only says the rx_coe TYPE2 setting was copied from the Allwinner drivers. If the hardware does not set bit 5 for checked IPv4/IPv6 frames, every frame would return csum_none in sun8i_dwmac_rx_status(). Would that silently disable RX checksum offload on all sun8i/H6/H616 boards? The test in the commit message shows that frames with a bad UDP checksum are delivered. It does not show that good frames still get CHECKSUM_UNNECESSARY. Bits 7 and 0 might also mean something else when the error summary is set, for example the giant frame or Rx MAC address meanings in the Synopsys layout. In that case, could the error summary branch treat non-checksum error frames as checksum failures and deliver them? Those frames would still get CHECKSUM_NONE and go through the buffer length check. Is there a datasheet reference, or a test with good frames, that confirms this encoding?
-- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/2026…%40gmail.com