[PATCH net-next 2/2] net: stmmac: dwmac-sun8i: support ethtool rx-all
netdev-bot+sashiko at kernel.org
netdev-bot+sashiko at kernel.org
Tue Nov 24 07:47:13 PST 2026
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] The patch adds a `set_rx_all` member to `struct stmmac_ops`
(drivers/net/ethernet/stmicro/stmmac/hwif.h:322) but no…
--
net: stmmac: dwmac-sun8i: support ethtool rx-all
This adds opt-in NETIF_F_RXALL support for dwmac-sun8i. With it, complete
frames with a reported wire error, and runts the MAC can forward, are
delivered to the stack and are not counted in the good packet and byte
totals. A new set_rx_all op in struct stmmac_ops updates the runt
forwarding bit in RX_CTL1, and a new spinlock serializes those updates
against the DMA start/stop bits.
> diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.h b/drivers/net/ethernet/stmicro/stmmac/hwif.h
> index 047d809b8b889..2cfadc6861047 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/hwif.h
> +++ b/drivers/net/ethernet/stmicro/stmmac/hwif.h
> @@ -319,6 +319,7 @@ struct stmmac_ops {
> void (*set_mac)(void __iomem *ioaddr, bool enable);
> /* Enable and verify that the IPC module is supported */
> int (*rx_ipc)(struct mac_device_info *hw);
> + void (*set_rx_all)(struct stmmac_priv *priv, bool enable);
> /* Enable RX Queues */
> void (*rx_queue_enable)(struct mac_device_info *hw, u8 mode, u32 queue);
> /* RX Queues Priority */
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 2f33fc0126b11..0a893c2cea78b 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
[ ... ]
> @@ -6453,6 +6466,11 @@ static int stmmac_set_features(struct net_device *netdev,
> {
> struct stmmac_priv *priv = netdev_priv(netdev);
>
> + 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: Low]
This isn't a bug, but should the new op get a stmmac_set_rx_all() wrapper
in hwif.h like the other struct stmmac_ops members have?
Every other MAC op in that table goes through stmmac_do_callback() or
stmmac_do_void_callback(), which checks both hw->mac and the op pointer
for NULL:
drivers/net/ethernet/stmicro/stmmac/hwif.h:
#define stmmac_core_init(__priv, __args...) \
stmmac_do_void_callback(__priv, mac, core_init, __args)
...
#define stmmac_rx_ipc(__priv, __args...) \
stmmac_do_callback(__priv, mac, rx_ipc, __args)
Here stmmac_set_features() calls priv->hw->mac->set_rx_all() directly
and does its own NULL check. A few lines below, the same function calls
stmmac_rx_ipc() through the wrapper.
__stmmac_dvr_probe() also reads priv->hw->mac->set_rx_all directly to
decide whether to advertise NETIF_F_RXALL.
Both sites check for NULL today, so nothing breaks now. Only
sun8i_dwmac_ops sets this op, though. If a later caller copies the
direct call without the NULL check, could it oops on every other MAC?
> /* Keep the COE Type in case of csum is supporting */
> if (features & NETIF_F_RXCSUM)
> priv->hw->rx_csum = priv->plat->rx_coe;
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261120-submit-sun8i-rx-features-v1-v1-0-5058fecba6b3%40gmail.com
More information about the linux-arm-kernel
mailing list