From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EE923606A330 for ; Fri, 4 Dec 2026 08:15:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=Q/CFfHqx; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=dkim header.b=lpNbv/H8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Unsubscribe-Post: List-Owner; bh=UtVmEK0aF7HWW25dP2lvzGGiMHy8aYUJBkUrBG5jGno=; b=Q/CFfHqxiZv5cj TF8HtPDbKb8dHLzO9JGL7I44gsbzfs2wWxUkKliXplYnUu7iOn9KsWZWvG66HdTpkk5gAZARreU0K Yxls2IEeiLI5try2to5bTL5Q2viW6KAMxAMqNynzxS0oE19ilzOkwQP6IWSvZH+8mtnuK60SaMqOE n+AmdYyb/8h1aDQZ6Hp2auVPkMEW0Nl0nB6JsLxG4+ohfXw4YCHK1necjHa3VP3huwtp6cakapg5M HSJGlo3pWRe1/5G64Kuj5h6RsKsbeAZfDR/Kt7sBs9OoX/uXHWdmzMDDXonaqooUa6GF6fz3vJ59L u1rijCbOQW3JYOJ8SZ7g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZORl-0000000H4do-2A3q; Fri, 04 Dec 2026 08:15:13 +0000 Received: from smtpout-03.galae.net ([185.246.85.4]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZORg-0000000H4cZ-3ZK1 for linux-arm-kernel@lists.infradead.org; Fri, 04 Dec 2026 08:15:12 +0000 Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 654B44E4187C; Fri, 4 Dec 2026 08:15:05 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 30876607FC; Fri, 4 Dec 2026 08:15:05 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id C9FCD11EA187F; Fri, 04 Dec 2026 09:14:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1796372103; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:content-language:in-reply-to:references; bh=UtVmEK0aF7HWW25dP2lvzGGiMHy8aYUJBkUrBG5jGno=; b=lpNbv/H8yAhgvMXepn1h7VVttOHLfin889vOJlBxx84KE0ULO3bjYJ1BdWgbNEKLWGGe5Z YVRAKDR1e1vEmkdBVxM9qc+o9bCEm7ONyZthy/3VizwCuSfCyXV6X5isQvYaF8EXGtfO0U nNJhOgw81o4R89ytCSGpQ0lSSSlmlHmIYoVUKhevemVc6KFLQVR3THP3/Sd0vIH/LuYds8 +ZCDFWo/1XPpJvykWRNqsjGIfUFw5uX+W+FPiiornB9CtBP8HADDCI4BBluxXrkKGq+xKy VzXkXJLPHFLRblKDJp3qTcjmFHAXemH7Bp6riIuAI7iULkoQ2ach1+xbwMQh7g== Message-ID: <2cd00a15-ab7e-43bc-8b87-7ebd6428e586@bootlin.com> Date: Fri, 4 Dec 2026 09:14:44 +0100 X-Archived-By: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net-next] net: stmmac: dwmac-sun8i: set the RX FIFO flow control in the RX mode setup To: netdev-bot+sashiko@kernel.org Cc: andrew+netdev@lunn.ch, kuba@kernel.org, davem@davemloft.net, edumazet@kernel.org, pabeni@redhat.com, horms@kernel.org, willemb@google.com, wens@kernel.org, jernej.skrabec@gmail.com, samuel@sholland.org, mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com, linux@armlinux.org.uk, lorenzo.bianconi@oss.qualcomm.com, nb@tipi-net.de, thomas.petazzoni@bootlin.com, alexis.lothore@bootlin.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev References: <20261203073137.958539-1-maxime.chevallier@bootlin.com> <179637103775.3146.6270261810238093842@kernel.org> From: Maxime Chevallier Content-Language: en-US In-Reply-To: <179637103775.3146.6270261810238093842@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Last-TLS-Session-Version: TLSv1.3 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261204_001509_457942_6FDE521A X-CRM114-Status: GOOD ( 31.76 ) X-Spam-Score: -2.1 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On 12/4/26 08:57, netdev-bot+sashiko@kernel.org wrote: > Thank you for your contribution! Sashiko AI review found 2 potential > issue(s) to consider. > > Critical: 0 · High: 0 · Medium: 1 · Low: 1 > > 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 patch changes behaviour without saying so, and the commit > message is inaccurate. > - [Low] The commit fixes a race that commit 22fc89783468 ("net: stmmac: > dwmac-sun8i: emit pause frames when the RX FIFO fills") introduced,… > > -- > > net: stmmac: dwmac-sun8i: set the RX FIFO flow control in the RX mode setup > > This patch moves the EMAC_RX_CTL1 RX FIFO flow control threshold setup > out of sun8i_dwmac_flow_ctrl() and into > sun8i_dwmac_dma_operation_mode_rx(). The flow control path then no longer > does a read-modify-write of the register that also holds the RX DMA > start/enable bits. The thresholds and EMAC_RX_FIFO_FLOW_CTL are now set > unconditionally. > >> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c >> index 613199da57c1b..5a660d22b219f 100644 >> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c >> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c >> @@ -562,6 +562,12 @@ static void sun8i_dwmac_dma_operation_mode_rx(struct stmmac_priv *priv, >> else if (mode < 128) >> v |= EMAC_RX_TH_128; >> } >> + >> + v &= ~(EMAC_RX_FLOW_CTL_TH_ACT | EMAC_RX_FLOW_CTL_TH_DEACT); >> + 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); > > [Severity: Medium] > Is this change in behaviour intended? There's no change in behaviour. Before this patch, > sun8i_dwmac_flow_ctrl() cleared EMAC_RX_FIFO_FLOW_CTL unless fc & FLOW_TX > was set: > > 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 | ... > > Now this code always sets the bit, and the clear mask here does not > include it. sun8i_dwmac_flow_ctrl() also no longer touches EMAC_RX_CTL1. > The only thing that clears the bit is the writel(0, ioaddr + EMAC_RX_CTL1) > in sun8i_dwmac_dma_reset(), and stmmac_hw_setup() sets it again right > after. > > When TX pause is disabled (ethtool -A tx off, or a link partner without > pause support), only EMAC_TX_FLOW_CTL_EN in EMAC_TX_FLOW_CTL now gates TX > pause. > > If the sun8i EMAC does not gate RX FIFO threshold flow control on > EMAC_TX_FLOW_CTL_EN, could the MAC now send pause frames in full duplex, > or apply back-pressure in half duplex, while TX pause is off? > > The other Synopsys cores do set the equivalent bit unconditionally in the > rx mode path (DMA_CONTROL_EFC in dwmac1000, MTL_OP_MODE_EHFC in dwmac4, > XGMAC_EHFC in dwxgmac2). I couldn't find anything showing that the > Allwinner EMAC behaves the same way. see my reply to Nicolai, "gating TX pause" with EMAC_TX_FLOW_CTL is enough. > > The commit message also says: > > Let's move the threshold setup in the DMA configuration path, making it > the only piece of code that touches this register. This is OK, as we > just set the thresholds, we don't change the FC status. > > EMAC_RX_FIFO_FLOW_CTL looks like an enable bit rather than a threshold. > > sun8i_dwmac_dma_reset(), sun8i_dwmac_dma_start_rx() and > sun8i_dwmac_dma_stop_rx() also still write EMAC_RX_CTL1, for example: > > sun8i_dwmac_dma_start_rx() { > v = readl(ioaddr + EMAC_RX_CTL1); > v |= EMAC_RX_DMA_START; > v |= EMAC_RX_DMA_EN; > writel(v, ioaddr + EMAC_RX_CTL1); > } > > Could the commit message say that the flow control path no longer writes > EMAC_RX_CTL1, and mention the EMAC_RX_FIFO_FLOW_CTL change? > > [ ... ] > >> @@ -774,17 +780,6 @@ static void sun8i_dwmac_flow_ctrl(struct mac_device_info *hw, >> v &= ~EMAC_RX_FLOW_CTL_EN; >> writel(v, ioaddr + EMAC_RX_CTL0); >> >> - 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); >> - > > [Severity: Low] > This isn't a bug, but this removes the EMAC_RX_CTL1 read-modify-write that > commit 22fc89783468 added. The commit message already names that commit > as the source of the race. Should this carry a Fixes: tag? > > Fixes: 22fc89783468 ("net: stmmac: dwmac-sun8i: emit pause frames when the RX FIFO fills") it's net-next, I can add it but not super necessary, no need to backport or anything. Maxime