All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "James Hilliard" <james.hilliard1@gmail.com>
Cc: linux-sunxi@lists.linux.dev
Subject: Re: [PATCH net-next v4 1/5] net: stmmac: dwmac-sun8i: deliver RX checksum errors to the stack
Date: Sat, 05 Dec 2026 02:39:30 +0000	[thread overview]
Message-ID: <sashiko-outbox-250947@kernel.org> (raw)
In-Reply-To: <20261203-submit-sun8i-rxall-v1-v4-1-af22aec6ae13@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] net: stmmac: sun8i_dwmac_rx_status() counts sub-18-byte runts as
  rx_desc
--

commit 705eeeb953f28a50b2a34c3b376c2df9f061f595
Author: James Hilliard <james.hilliard1@gmail.com>

net: stmmac: dwmac-sun8i: deliver RX checksum errors to the stack

This commit enables error-frame forwarding on sun8i MACs and adds a
sun8i-specific RX descriptor status decoder so frames with IP or transport
checksum errors are delivered to the stack with CHECKSUM_NONE instead of
being dropped in hardware.

> 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

[ ... ]

> @@ -1081,6 +1078,83 @@ static const struct stmmac_ops sun8i_dwmac_ops = {

[ ... ]

> +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;
> +	u32 status = le32_to_cpu(READ_ONCE(p->des0));
> +	u32 len = FIELD_GET(RDES0_FRAME_LEN_MASK, status);
> +	bool runt = len < ETH_ZLEN + ETH_FCS_LEN;

[ ... ]

> +	/* One buffer per chain descriptor; the reported length includes FCS. */
> +	if (unlikely(len < ETH_HLEN + ETH_FCS_LEN ||
> +		     len > FIELD_GET(RDES1_BUFFER1_SIZE_MASK, le32_to_cpu(p->des1)))) {
> +		x->rx_desc++;
> +		return discard_frame;
> +	}
> +	if (unlikely(runt || (status & wire_errors))) {
> +		if (runt && !(status & RDES0_LENGTH_ERROR))
> +			x->rx_length++;
> +		return discard_frame;
> +	}

[Severity: Low]
Does combining len < ETH_HLEN + ETH_FCS_LEN with the buffer-size check
miscount short frames in x->rx_desc?

When EMAC_RX_ERR_FRM forwards a sub-18-byte collision or CRC error fragment
with RDES0_DESCRIPTOR_ERROR clear, this branch increments x->rx_desc even
though no DMA descriptor error occurred.  The early return also skips the
runt check below, so sub-18-byte runts without RDES0_LENGTH_ERROR are omitted
from x->rx_length (exported as rx_length_errors by stmmac_get_stats64()).

Splitting the len < ETH_HLEN + ETH_FCS_LEN check from the buffer-size check
would let those frames increment x->rx_length (when RDES0_LENGTH_ERROR is
clear) instead of x->rx_desc.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261203-submit-sun8i-rxall-v1-v4-0-af22aec6ae13@gmail.com?part=1

  reply	other threads:[~2026-12-05  2:39 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04  2:37 [PATCH net-next v4 0/5] net: stmmac: support ethtool rx-all on sun8i James Hilliard
2026-12-04  2:37 ` [PATCH net-next v4 1/5] net: stmmac: dwmac-sun8i: deliver RX checksum errors to the stack James Hilliard
2026-12-05  2:39   ` sashiko-bot [this message]
2026-12-05  2:52   ` netdev-bot+sashiko
2026-12-04  2:37 ` [PATCH net-next v4 2/5] net: stmmac: dwmac-sun8i: align EMAC_RX_MD with tabs James Hilliard
2026-12-04  2:37 ` [PATCH net-next v4 3/5] net: stmmac: dwmac-sun8i: serialize RX_CTL1 updates James Hilliard
2026-12-05  2:52   ` netdev-bot+sashiko
2026-12-04  2:37 ` [PATCH net-next v4 4/5] net: stmmac: add common RXALL handling James Hilliard
2026-12-05  2:39   ` sashiko-bot
2026-12-05  2:52   ` netdev-bot+sashiko
2026-12-04  2:37 ` [PATCH net-next v4 5/5] net: stmmac: dwmac-sun8i: support ethtool rx-all James Hilliard
2026-12-04  2:42 ` [PATCH net-next v4 0/5] net: stmmac: support ethtool rx-all on sun8i netdev-bot+sinfo

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=sashiko-outbox-250947@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=james.hilliard1@gmail.com \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.