From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796439180; b=KFIuMwPz3k0H0hpAIFr47+2J2kZAaF+sZUUCI+oG/EQpjcnVZSO/n9Apdc4Amn1arCwE L0tJt29JGxeREpskn3X9DfjGvHFhDkEog5sF1fG1azZSH2I281+EurIQIF5bgEaHCrPBy 40K1De3iH5FsD65FsUMaGDl3/2leQ4rTdxedY4YMqdtQXbgTqwQnbFgfFKqz55i5c8FoY 7AgiaiA9+8M1cm6tjvuGmQ4f0Lzni3Y9l5VWb+D2YmP/1EjC3gQoYQt2jUdUYSWZOHCBw 8min5nDgQ35oAfQAhDt7T8/n/uJVQhIcVgR5LGxTUSHoM+jB/3t7FrOIIq5JuEfIz3g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796439180; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=DKRUs5kA2X8NqovZ5eQAVr9r/1ptjo9chDlRmQWshrY=; b=C7mdRRobpkvtUpyrLh24juJjzCEnJ9d6I45qhZiBJmEJc91Kzvcm+mbxsuYnTypMOCDf cweE5PJGY+hWrd9zIxCYv35dYVwGtcSxynh/MochkZIlA8+HdT6eLfZ2tKrlxplsymaO9 F0QYCcFd7nTeOela3UJ+EzVDyQBuhWIG12CWup3/qQIYcT//etTZ9AwhIEEIRuIPeVtu9 huwu+06skxZAeIguA7KwKlqJZx8ZAPjHdHhV03UGfFG0fs2GLRiLNp2nw+3Eg9iWZzin5 wSJgclx3TqtJwsHFlU7AT5Bgid1d/zOd4ghu+aPdlok61Z6PMiBiXv4W6c4WTxfgxFA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=a7gcX9Yo; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D2E87606A339; Sat, 5 Dec 2026 02:53:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=a7gcX9Yo Received: by smtp.kernel.org (Postfix) with ESMTPSA id 794D01F00936; Sat, 5 Dec 2026 02:52:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796439180; bh=DKRUs5kA2X8NqovZ5eQAVr9r/1ptjo9chDlRmQWshrY=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=a7gcX9YopH1Eoo7bchZM8UJA2uZZN2R+RdrGBMjrQgSboAPj4U1Aj8owXxDnW/qbJ hWjo/nrdqfQVPuOwcRHQv0l7aBaInbLaGG4T4UnMpZdlBdDOsPnqynHJnWfWt+uley PIoyNE2j/LDcN5QlrdEJMMINGtkyOQmt9TlxrXkfPH1Pa52Gnr42SFzlu62NHPqYyE fHi8yvO2t4bxkWwDeoAKa8eo80QzStOLUiTkuLONSHcwkQ+/BQELP/upAXGRtpFYeO owb5U4t4DmfsmNiKNY4JxXfulJDNEhiXUhooYP4UabwpT/otrzkaoUhc1LlWeX9X/D VhBzOKvLPewSA== Subject: Re: [PATCH net-next v4 4/5] net: stmmac: add common RXALL handling 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, willemb@google.com, nbb@tipi-net.de, kuba@kernel.org, o.rempel@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev Date: Sat, 05 Dec 2026 02:52:59 +0000 Message-ID: <179643917903.3146.16853339147522457093@kernel.org> In-Reply-To: <20261203-submit-sun8i-rxall-v1-v4-4-af22aec6ae13@gmail.com> References: <20261203-submit-sun8i-rxall-v1-v4-4-af22aec6ae13@gmail.com> X-sashiko-severity: Low Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 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] Concern: frames that stmmac_rx() and stmmac_dispatch_skb_zc() deliver as rx_error_frame under NETIF_F_RXALL could be marked… - [Low] Concern: set_rx_all() is called only from stmmac_set_features() and only while the interface is running and present. - [Low] Concern: the new stmmac_ops::set_rx_all() callback has no locking contract, and stmmac_set_features() calls it without hw->reg_lock. - [Low] Concern: stmmac_set_features() calls set_rx_all() outside phylink_rx_clk_stop_block()/unblock(), so if the PHY stopped RXC in… Pre-existing issues: - [Medium] priv->xstats.rx_errors and priv->xstats.rx_dropped are device- wide counters. -- net: stmmac: add common RXALL handling This adds an rx_error_frame status bit. A MAC can use it to mark complete frames with wire errors separately from descriptors that must always be discarded. With NETIF_F_RXALL enabled, those frames are delivered on the page-pool and zero-copy RX paths but are not counted as good packets. NETIF_F_RXALL is advertised only when the MAC provides the new set_rx_all() callback. > diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h > index 08de79107c503..91025ebd1afbc 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/common.h > +++ b/drivers/net/ethernet/stmicro/stmmac/common.h > @@ -372,6 +372,8 @@ enum rx_frame_status { > llc_snap = 0x4, > dma_own = 0x8, > rx_not_ls = 0x10, > + /* Complete frame with a wire error, deliverable only with RXALL. */ > + rx_error_frame = 0x20, > }; [Severity: Low] The commit message says these frames are delivered "without trusting their checksum". Does anything in this patch enforce that? The checksum test in stmmac_rx() and stmmac_dispatch_skb_zc() has not changed, and it does not look at rx_error_frame: if (unlikely(!coe) || !stmmac_has_ip_ethertype(skb) || (status & csum_none)) skb_checksum_none_assert(skb); else skb->ip_summed = CHECKSUM_UNNECESSARY; If a frame had rx_error_frame set and csum_none clear, it would be passed up as CHECKSUM_UNNECESSARY. This doesn't happen anywhere in the series. The only producer is sun8i_dwmac_rx_status(), added later in "net: stmmac: dwmac-sun8i: support ethtool rx-all", and it returns rx_error_frame | csum_none. sun8i also doesn't use extended descriptors, so stmmac_rx_extended_status() never rewrites that status. Could this comment say that producers of rx_error_frame must also set csum_none? Alternatively, the common checksum test could treat rx_error_frame like csum_none. > diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.h b/drivers/net/ethernet/stmicro/stmmac/hwif.h > index 6849b58ba2f82..5f910df7f7658 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/hwif.h > +++ b/drivers/net/ethernet/stmicro/stmmac/hwif.h > @@ -354,6 +354,8 @@ struct stmmac_ops { > struct mac_device_info *hw, u32 chan); > /* Multicast filter setting */ > void (*set_filter)(struct mac_device_info *hw, struct net_device *dev); > + /* Program the MAC receive mode for NETIF_F_RXALL. */ > + void (*set_rx_all)(struct stmmac_priv *priv, bool enable); [Severity: Low] What locking rule applies to set_rx_all()? stmmac_set_features() calls it without holding hw->reg_lock. Meanwhile, set_filter() can run read-modify-write cycles on MAC filter registers from ndo_set_rx_mode, for example GMAC_PACKET_FILTER_RA in dwmac4_set_filter(). There is no race in the series today. sun8i_dwmac_set_rx_all(), the only implementer, takes hw->reg_lock inside sun8i_dwmac_update_rx_ctl1(). sun8i_dwmac_set_filter() writes EMAC_RX_FRM_FLT, not EMAC_RX_CTL1. Should this comment state that implementers must serialize against other writers of the same register? > /* Flow control setting */ > void (*flow_ctrl)(struct mac_device_info *hw, unsigned int duplex, > unsigned int fc, unsigned int pause_time, u8 tx_cnt); > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > index 99252fb836750..842d6d7f82a44 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c [ ... ] > @@ -5713,6 +5715,21 @@ static struct stmmac_xdp_buff *xsk_buff_to_stmmac_ctx(struct xdp_buff *xdp) > return (struct stmmac_xdp_buff *)xdp; > } > > +static bool stmmac_rx_discard(struct stmmac_priv *priv, int status, u32 *rx_errors) > +{ > + if (likely(!(status & (discard_frame | rx_error_frame)))) > + return false; > + > + if (status & discard_frame) { > + if (!priv->hwts_rx_en) > + (*rx_errors)++; > + return true; > + } > + > + (*rx_errors)++; [Severity: Medium] This is a pre-existing issue and was not introduced by this patch. The local count kept here is added to device-wide counters without any synchronization. At the end of stmmac_rx() and stmmac_rx_zc(): priv->xstats.rx_dropped += rx_dropped; priv->xstats.rx_errors += rx_errors; stmmac_dispatch_skb_zc() also does priv->xstats.rx_dropped++ directly. These paths run in per-queue NAPI contexts, which can poll on different CPUs at the same time. If two RX queues finish polling at once, can increments to priv->xstats.rx_errors and priv->xstats.rx_dropped get lost? This patch only sends the new rx_error_frame class into the same counter. sun8i, the only RXALL implementer, has a single RX queue by default, so the race doesn't occur there. > + return !(READ_ONCE(priv->dev->features) & NETIF_F_RXALL); > +} [ ... ] > @@ -6468,6 +6481,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: Low] Is set_rx_all() called again after a reset? This is its only call site, and it is skipped while the interface is down. stmmac_hw_setup() doesn't call it after the DMA/MAC reset on open, resume or reconfiguration. The MAC could then filter normally while dev->features still shows NETIF_F_RXALL. An rx-all change made while the interface was down would also never reach the hardware. This patch on its own has no implementer. In the later "net: stmmac: dwmac-sun8i: support ethtool rx-all" commit, sun8i_dwmac_dma_reset() clears EMAC_RX_CTL1. stmmac_hw_setup() then calls stmmac_core_init(), and sun8i_dwmac_core_init() rebuilds the register from dev->features: if (dev->features & NETIF_F_RXALL) v |= EMAC_RX_RUNT_FRM; writel(v, ioaddr + EMAC_RX_CTL1); That covers sun8i. Should the callback documentation say that core_init() must restore the RXALL state from dev->features? Another option is for stmmac_hw_setup() to call set_rx_all() itself. [Severity: Low] This call is made outside the phylink_rx_clk_stop_block() and phylink_rx_clk_stop_unblock() pair used below for the VLAN registers. If the PHY has stopped RXC in EEE LPI, could the set_rx_all() register write be lost or stall? This can't happen on sun8i. Its DMA ops have no get_hw_feature callback, so dma_cap.eee stays 0. stmmac_phylink_setup() then never sets lpi_capabilities, and phylink disables EEE on the PHY. stmmac_rx_ipc() and stmmac_enable_sph() are also called outside the block in this function. Would a future set_rx_all() implementer on an EEE-capable MAC need this call moved inside the block? > 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/20261203-submit-sun8i-rxall-v1-v4-0-af22aec6ae13%40gmail.com