From: netdev-bot+sashiko@kernel.org
To: james.hilliard1@gmail.com
Cc: netdev@vger.kernel.org, maxime.chevallier@bootlin.com,
andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
pabeni@redhat.com, mcoquelin.stm32@gmail.com,
alexandre.torgue@foss.st.com, wens@kernel.org,
jernej.skrabec@gmail.com, samuel@sholland.org,
clabbe.montjoie@gmail.com, kuba@kernel.org,
o.rempel@pengutronix.de, linux-arm-kernel@lists.infradead.org,
linux-sunxi@lists.linux.dev
Subject: Re: [PATCH net-next v3 3/4] net: stmmac: add common RXALL handling
Date: Thu, 03 Dec 2026 07:28:08 +0000 [thread overview]
Message-ID: <179628288840.3146.15996822646593537048@kernel.org> (raw)
In-Reply-To: <20261201-submit-sun8i-rxall-v1-v3-3-01aa6280e6ae@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · 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] The new stmops->set_rx_all() hook is called from
stmmac_set_features() holding only RTNL and the netdev ops lock.
--
net: stmmac: add common RXALL handling
This adds an rx_error_frame status so a MAC can mark complete frames with
wire errors separately from descriptors that must always be discarded.
With NETIF_F_RXALL enabled, those frames are delivered without being
counted as good packets. A new set_rx_all() stmmac_ops hook is called
from stmmac_set_features(), and rx-all is advertised only when the MAC
provides that hook.
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 70157efc22559..8102a72c52c5d 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
[ ... ]
> @@ -6462,6 +6475,11 @@ static int stmmac_set_features(struct net_device *netdev,
> stmmac_enable_sph(priv, priv->ioaddr, sph_en, chan);
> }
>
> + if (((netdev->features ^ features) & NETIF_F_RXALL) &&
> + netif_running(netdev) && netif_device_present(netdev) &&
> + priv->hw->mac->set_rx_all)
> + priv->hw->mac->set_rx_all(priv, features & NETIF_F_RXALL);
> +
[Severity: Medium]
Is anything serializing set_rx_all() against other writers of the same
MAC register that run without RTNL?
stmmac_set_features() calls the hook while holding only RTNL and the
netdev ops lock. The new set_rx_all member in struct stmmac_ops does not
document any locking or context rules for implementers.
The only implementation in the series is sun8i_dwmac_set_rx_all(), from
"net: stmmac: dwmac-sun8i: support ethtool rx-all". It does a plain
read-modify-write of EMAC_RX_CTL1:
dwmac-sun8i.c:sun8i_dwmac_set_rx_all() {
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);
}
sun8i_dwmac_flow_ctrl() also does a read-modify-write of EMAC_RX_CTL1:
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);
...
writel(v, ioaddr + EMAC_RX_CTL1);
}
That second function runs from the phylink resolve work item:
phylink_resolve()
phylink_link_up()
stmmac_mac_link_up()
stmmac_mac_flow_ctrl()
sun8i_dwmac_flow_ctrl()
phylink_resolve() holds pl->phydev_mutex, phydev->lock and
pl->state_mutex, but not RTNL.
If "ethtool -K ethX rx-all on" runs while a link-up is being resolved,
can the two read-modify-writes interleave and lose one of the updates?
One outcome is that the EMAC_RX_RUNT_FRM change is undone. Then
dev->features shows rx-all on while the MAC still drops runts, or the
reverse.
The other outcome is that the negotiated RX FIFO flow-control and
threshold bits are cleared while phylink believes TX pause is active.
The sun8i commit message says the direct register update is safe because
RTNL serializes it with open, close and reset, and because the IRQ
handler does not touch the RX threshold. Does that reasoning cover the
phylink link-up path?
> if (features & NETIF_F_HW_VLAN_CTAG_RX)
> priv->hw->hw_vlan_en = true;
> else
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261201-submit-sun8i-rxall-v1-v3-0-01aa6280e6ae%40gmail.com
next prev parent reply other threads:[~2026-12-03 7:28 UTC|newest]
Thread overview: 8+ 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 [this message]
2026-12-02 6:25 ` [PATCH net-next v3 4/4] net: stmmac: dwmac-sun8i: support ethtool rx-all James Hilliard
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=179628288840.3146.15996822646593537048@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=alexandre.torgue@foss.st.com \
--cc=andrew+netdev@lunn.ch \
--cc=clabbe.montjoie@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=james.hilliard1@gmail.com \
--cc=jernej.skrabec@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=maxime.chevallier@bootlin.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=o.rempel@pengutronix.de \
--cc=pabeni@redhat.com \
--cc=samuel@sholland.org \
--cc=wens@kernel.org \
/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