mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: netdev-bot+sashiko@kernel.org
Cc: andrew+netdev@lunn.ch, kuba@kernel.org, davem@davemloft.net,
	edumazet@google.com, 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
Subject: Re: [PATCH net-next 2/3] net: stmmac: dwmac-sun8i: emit pause frames when the RX FIFO fills
Date: Mon, 23 Nov 2026 17:19:11 +0100	[thread overview]
Message-ID: <c4dfa9e9-6df3-4251-945c-b476d6c65fbd@bootlin.com> (raw)
In-Reply-To: <179544551937.3135.9976133356956488963@kernel.org>



On 11/23/26 15:51, netdev-bot+sashiko@kernel.org wrote:
> 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] Unserialized read-modify-write of EMAC_RX_CTL1 in
>   sun8i_dwmac_flow_ctrl() (drivers/net/ethernet/stmicro/stmmac/dwmac-…
> 
> --
> 
> net: stmmac: dwmac-sun8i: emit pause frames when the RX FIFO fills
> 
> This commit sets the RX FIFO flow control thresholds in EMAC_RX_CTL1 from
> sun8i_dwmac_flow_ctrl(). With these thresholds, the MAC sends pause
> frames when less than 2K is left in the RX FIFO and stops when more than
> 4K is free. The new bits are set only when TX flow control is requested.
> 
>> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
>> index c63f4d87de509..75c743dfe3483 100644
>> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
>> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
> 
> [ ... ]
> 
>> @@ -766,6 +772,17 @@ 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: Medium]
> Can this read-modify-write of EMAC_RX_CTL1 race with the RX DMA start and
> stop helpers?

Hmmm yes indeed, I think we can work around that by writing these FIFO
values in sun8i_dwmac_dma_operation_mode_rx(), just like we do in dwmac1000
and dwmac4, that way no race :)

I'll iterate and fix my typos,

Maxime


  reply	other threads:[~2026-11-23 16:19 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-22 14:49 [PATCH net-next 0/3] net: stmmac: dwmac-sun8i: enable Flow Control Maxime Chevallier
2026-11-22 14:49 ` [PATCH net-next 1/3] net: stmmac: dwmac-sun8i: allow controlling TX and RX flow control separately Maxime Chevallier
2026-11-22 15:54   ` Nicolai Buchwitz
2026-11-22 16:00   ` Chen-Yu Tsai
2026-11-23 14:51   ` netdev-bot+sashiko
2026-11-22 14:49 ` [PATCH net-next 2/3] net: stmmac: dwmac-sun8i: emit pause frames when the RX FIFO fills Maxime Chevallier
2026-11-22 15:57   ` Nicolai Buchwitz
2026-11-22 16:11   ` Chen-Yu Tsai
2026-11-23 14:51   ` netdev-bot+sashiko
2026-11-23 16:19     ` Maxime Chevallier [this message]
2026-11-22 14:49 ` [PATCH net-next 3/3] net: stmmac: dwmac-sun8i: configure the pause time for TX flow control Maxime Chevallier
2026-11-22 15:58   ` Nicolai Buchwitz

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=c4dfa9e9-6df3-4251-945c-b476d6c65fbd@bootlin.com \
    --to=maxime.chevallier@bootlin.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=alexis.lothore@bootlin.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jernej.skrabec@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=linux@armlinux.org.uk \
    --cc=lorenzo.bianconi@oss.qualcomm.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=nb@tipi-net.de \
    --cc=netdev-bot+sashiko@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=samuel@sholland.org \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=wens@kernel.org \
    --cc=willemb@google.com \
    /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

all inboxes | Powered by JetHome®