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] sun8i_dwmac_set_rx_all() (drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c:665-674) does an… -- net: stmmac: dwmac-sun8i: support ethtool rx-all This patch adds rx-all support to dwmac-sun8i. Runt forwarding in EMAC_RX_CTL1 is set from NETIF_F_RXALL at core init, and a new set_rx_all op updates the bit on a running interface. Frames with complete wire errors, runts included, are now returned as rx_error_frame | csum_none instead of discard_frame.
> 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
[ ... ]
> +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 this read-modify-write of EMAC_RX_CTL1 race with sun8i_dwmac_flow_ctrl()? The commit message says: "RX_CTL1 also controls DMA, but RTNL serializes the ethtool update with open, close and reset. ... The setter can therefore update the register directly." sun8i_dwmac_flow_ctrl() also does a read-modify-write of the same register: 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 | ... writel(v, ioaddr + EMAC_RX_CTL1); ... } It runs on every link-up from the phylink resolve worker: phylink_resolve() phylink_link_up() stmmac_mac_link_up() stmmac_mac_flow_ctrl() sun8i_dwmac_flow_ctrl() phylink_resolve() takes pl->phydev_mutex, phy->lock and pl->state_mutex. It never takes RTNL. The new setter is only protected by RTNL in stmmac_set_features(): 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); Close and reset go through phylink_stop(), which stops the resolve work, so their RX_CTL1 writes are safe. The ethtool path does not stop it. So "ethtool -K ethX rx-all on" can overlap with a link-up resolve. If the worker reads RX_CTL1, the setter then writes RUNT_FRM, and the worker writes back its stale value, RUNT_FRM is lost. NETIF_F_RXALL then reports on while the MAC still drops runts. The opposite order can also happen. The setter reads, the worker programs the negotiated EMAC_RX_FIFO_FLOW_CTL and threshold bits, and the setter writes back its stale value. The flow-control setup is then lost until the next link change. Would some locking between the two paths be needed here? If not, could the commit message be updated to cover the phylink resolve worker? [ ... ]
-- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/2026…%40gmail.com