From: sashiko-bot@kernel.org
To: "James Hilliard" <james.hilliard1@gmail.com>
Cc: linux-sunxi@lists.linux.dev
Subject: Re: [PATCH net-next v3 4/4] net: stmmac: dwmac-sun8i: support ethtool rx-all
Date: Thu, 03 Dec 2026 06:29:23 +0000 [thread overview]
Message-ID: <sashiko-outbox-247233@kernel.org> (raw)
In-Reply-To: <20261201-submit-sun8i-rxall-v1-v3-4-01aa6280e6ae@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] net: stmmac: dwmac-sun8i: EMAC_RX_CTL1 RMW race in
sun8i_dwmac_set_rx_all()
--
commit 39ced794d174f2d3a44a86ff63330a2f1a439467
Author: James Hilliard <james.hilliard1@gmail.com>
net: stmmac: dwmac-sun8i: support ethtool rx-all
This commit adds NETIF_F_RXALL support for dwmac-sun8i by controlling
EMAC_RX_RUNT_FRM in EMAC_RX_CTL1 and returning rx_error_frame | csum_none
for runt and wire-errored frames.
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
> index 8377dc7985377..c1c5ab38022ac 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
[ ... ]
> @@ -655,7 +656,21 @@ static void sun8i_dwmac_core_init(struct mac_device_info *hw,
> writel(v, ioaddr + EMAC_BASIC_CTL1);
>
> /* Forward checksum failures to software before starting RX. */
> - writel(EMAC_RX_ERR_FRM, ioaddr + EMAC_RX_CTL1);
> + v = EMAC_RX_ERR_FRM;
> + if (dev->features & NETIF_F_RXALL)
> + v |= EMAC_RX_RUNT_FRM;
> + writel(v, ioaddr + EMAC_RX_CTL1);
> +}
> +
> +static void sun8i_dwmac_set_rx_all(struct stmmac_priv *priv, bool enable)
> +{
> + u32 v = readl(priv->ioaddr + EMAC_RX_CTL1);
> +
> + if (enable)
> + v |= EMAC_RX_RUNT_FRM;
> + else
> + v &= ~EMAC_RX_RUNT_FRM;
> + writel(v, priv->ioaddr + EMAC_RX_CTL1);
> }
[Severity: Medium]
Can sun8i_dwmac_set_rx_all() race with sun8i_dwmac_flow_ctrl() on
EMAC_RX_CTL1?
stmmac_set_features() calls set_rx_all() under rtnl_lock(), whereas
sun8i_dwmac_flow_ctrl() also updates EMAC_RX_CTL1 from phylink_resolve()
workqueue context under pl->state_mutex without holding rtnl_lock():
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c:sun8i_dwmac_flow_ctrl() {
...
v = readl(ioaddr + EMAC_RX_CTL1);
v &= ~(EMAC_RX_FIFO_FLOW_CTL | EMAC_RX_FLOW_CTL_TH_ACT |
EMAC_RX_FLOW_CTL_TH_DEACT);
if (fc & FLOW_TX)
v |= EMAC_RX_FIFO_FLOW_CTL |
FIELD_PREP(EMAC_RX_FLOW_CTL_TH_ACT,
EMAC_RX_FLOW_CTL_TH_2K) |
FIELD_PREP(EMAC_RX_FLOW_CTL_TH_DEACT,
EMAC_RX_FLOW_CTL_TH_4K);
writel(v, ioaddr + EMAC_RX_CTL1);
...
}
If an ethtool rx-all toggle overlaps with link-up resolution, the two
read-modify-write sequences can interleave:
CPU0 CPU1 (kworker)
stmmac_set_features() phylink_resolve()
sun8i_dwmac_set_rx_all() ...
v = readl(... + EMAC_RX_CTL1) stmmac_mac_link_up()
...
sun8i_dwmac_flow_ctrl()
v = readl(... + EMAC_RX_CTL1)
v |= EMAC_RX_FIFO_FLOW_CTL...
writel(v, ... + EMAC_RX_CTL1)
v |= EMAC_RX_RUNT_FRM
writel(v, ... + EMAC_RX_CTL1) <-- overwrites flow control bits
Depending on which write finishes last, either the RX FIFO flow-control
settings or EMAC_RX_RUNT_FRM is lost.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261201-submit-sun8i-rxall-v1-v3-0-01aa6280e6ae@gmail.com?part=4
next prev parent reply other threads:[~2026-12-03 6:29 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 6:25 [PATCH net-next v3 0/4] net: stmmac: support ethtool rx-all on sun8i James Hilliard
2026-12-02 6:25 ` [PATCH net-next v3 1/4] net: stmmac: dwmac-sun8i: deliver RX checksum errors to the stack James Hilliard
2026-12-03 7:28 ` netdev-bot+sashiko
2026-12-02 6:25 ` [PATCH net-next v3 2/4] net: stmmac: dwmac-sun8i: align EMAC_RX_MD with tabs James Hilliard
2026-12-02 6:25 ` [PATCH net-next v3 3/4] net: stmmac: add common RXALL handling James Hilliard
2026-12-03 7:28 ` netdev-bot+sashiko
2026-12-02 6:25 ` [PATCH net-next v3 4/4] net: stmmac: dwmac-sun8i: support ethtool rx-all James Hilliard
2026-12-03 6:29 ` sashiko-bot [this message]
2026-12-03 7:28 ` netdev-bot+sashiko
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-247233@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox