Netdev List
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: netdev-bot+sashiko@kernel.org
Cc: netdev@vger.kernel.org, andrew+netdev@lunn.ch,
	davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
	pabeni@redhat.com, hkallweit1@gmail.com, linux@armlinux.org.uk,
	shaojijie@huawei.com, horms@kernel.org, runyu.xiao@seu.edu.cn,
	mmyangfl@gmail.com, hvr@gnu.org, danny.kukawka@bisect.de,
	mugunthanvnm@ti.com, sebastian.hesselbarth@gmail.com,
	linux-kernel@vger.kernel.org, manuel.lauss@gmail.com
Subject: Re: [PATCH net v3 07/10] net: au1000: restore RX buffer addresses when restarting the MAC
Date: Fri, 20 Nov 2026 16:22:18 -0800	[thread overview]
Message-ID: <b42ab368-cb3a-485d-94f3-8f175435f532@gmail.com> (raw)
In-Reply-To: <179517075795.3136.15427400757159569527@kernel.org>

On 11/20/26 02:32, 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] The patch puts each RX descriptor's buffer address back to
>    rx_db_inuse[i]->dma_addr only in au1000_init()…
> 
> --
> 
> net: au1000: restore RX buffer addresses when restarting the MAC
> 
> au1000_init() now rewrites each RX descriptor with its buffer's start
> address from rx_db_inuse[] before setting RX_DMA_ENABLE. Before this,
> it only set the enable bit on whatever address the DMA engine had left
> behind. That could let a receive after close/open start partway through
> its buffer.
> 
>> diff --git a/drivers/net/ethernet/amd/au1000_eth.c b/drivers/net/ethernet/amd/au1000_eth.c
>> index 0e9226ea05e18..cb2f3333ba9fd 100644
>> --- a/drivers/net/ethernet/amd/au1000_eth.c
>> +++ b/drivers/net/ethernet/amd/au1000_eth.c
>> @@ -724,7 +724,8 @@ static int au1000_init(struct net_device *dev)
>>
>>
>>   	for (i = 0; i < NUM_RX_DMA; i++)
>> -		aup->rx_dma_ring[i]->buff_stat |= RX_DMA_ENABLE;
>> +		writel(lower_32_bits(aup->rx_db_inuse[i]->dma_addr) |
>> +		       RX_DMA_ENABLE, &aup->rx_dma_ring[i]->buff_stat);
> 
> [Severity: Medium]
> Is au1000_init() the only place the receiver gets restarted?
> 
> au1000_adjust_link() also stops and restarts RX on every duplex change,
> and it does not go through au1000_init() or au1000_reset_mac_unlocked():
> 
> drivers/net/ethernet/amd/au1000_eth.c:au1000_adjust_link() {
>      ...
> 	if (phydev->link && (aup->old_duplex != phydev->duplex)) {
> 		/* duplex mode changed */
> 
> 		/* switching duplex mode requires to disable rx and tx! */
> 		au1000_hard_stop(dev);
> 		...
> 		au1000_enable_rx_tx(dev);
>      ...
> }
> 
> On link down, old_duplex is set to -1, so this path runs on every link-up
> after a link-down. au1000_hard_stop() only clears MAC_RX_ENABLE and
> MAC_TX_ENABLE in mac->control. It leaves rx_dma_ring[i]->buff_stat alone.
> 
> Suppose clearing RE stops a frame partway through. The descriptor would
> keep RX_DMA_ENABLE with RX_T_DONE still clear. au1000_rx() only reloads
> the address inside its while (buff_stat & RX_T_DONE) loop, so it would
> not reset this descriptor:
> 
> 	prxd->buff_stat = lower_32_bits(pDB->dma_addr) | RX_DMA_ENABLE;
> 
> Could the next frame then start at the advanced address, partway into
> the MAX_BUF_SIZE buffer? The free list is LIFO, so rx_db_inuse[0] at
> probe is the last slot of the dma_alloc_coherent() region. An overrun
> from that slot would land outside the allocation.
> 
> A later patch in this series, "net: au1000: keep the MAC stopped until
> the PHY link is ready", adds another au1000_hard_stop() on link-down in
> au1000_adjust_link(). Each link flap would then stop RX twice, and the
> restart on link-up still skips the reload.
> 
> This depends on what the MAC does when RE is cleared mid-frame. If it
> always finishes the frame and sets RX_T_DONE, au1000_rx() covers it.
> Nothing in the driver documents that behaviour.
> 
> Would it make sense to put the descriptor reload in a helper that both
> au1000_init() and the au1000_adjust_link() stop/start sequence call?
> 
>>
>>   	wmb(); /* drain writebuffer */
>>
> 

Thanks for pointing out the additional restart path. I checked it on 
MTX-1 using a temporary instrumented kernel, switching duplex modes 
under incoming traffic and recording RX descriptor state before clearing 
RE and after the existing 10 ms wait in au1000_hard_stop().

Across 11 stops and 44 descriptor snapshots, nine descriptors had 
advanced addresses with EN set and DN clear before stopping. All nine 
had DN set after the wait. No descriptor retained an advanced address 
with DN clear afterward. Those completed descriptors can therefore be 
processed and rearmed by au1000_rx().

The Au1500 databook, section 7.4.4.1, page 134 
(https://assets.sourcengine.com/datasheets/e176e7fe-d2b8-4143-8002-16670131c1ce.pdf#page=134) 
also specifies that an enabled RX address register must not be rewritten 
until DN is set. Moving an unconditional reload into the link-change 
path would need a demonstrated safe DMA quiesce point.

I have not reproduced the proposed failure on the tested hardware, so I 
am leaving this patch scoped to restoring addresses after a full MAC 
reset. This finite test does not establish the behavior of every silicon 
revision or every link-loss timing, but it provides evidence that the 
in-flight receive completes during the existing stop delay on MTX-1.

pw-bot: cr
-- 
Florian

  reply	other threads:[~2026-11-21  0:22 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17 19:32 [PATCH net v3 00/10] net: au1000: Bug fixes Florian Fainelli
2026-11-17 19:32 ` [PATCH net v3 01/10] net: au1000: recycle RX descriptors on allocation failure Florian Fainelli
2026-11-17 19:32 ` [PATCH net v3 02/10] net: au1000: clear all-multicast mode when restoring hash filtering Florian Fainelli
2026-11-17 19:32 ` [PATCH net v3 03/10] net: au1000: disconnect the PHY before freeing the MDIO bus Florian Fainelli
2026-11-20 10:32   ` netdev-bot+sashiko
2026-11-20 23:58     ` Florian Fainelli
2026-11-17 19:32 ` [PATCH net v3 04/10] net: au1000: report MDIO transaction timeouts Florian Fainelli
2026-11-17 19:32 ` [PATCH net v3 05/10] net: au1000: serialize TX completion with packet submission Florian Fainelli
2026-11-20 10:32   ` netdev-bot+sashiko
2026-11-21  0:06     ` Florian Fainelli
2026-11-17 19:32 ` [PATCH net v3 06/10] net: au1000: restore receive filtering before enabling RX Florian Fainelli
2026-11-17 19:32 ` [PATCH net v3 07/10] net: au1000: restore RX buffer addresses when restarting the MAC Florian Fainelli
2026-11-20 10:32   ` netdev-bot+sashiko
2026-11-21  0:22     ` Florian Fainelli [this message]
2026-11-17 19:32 ` [PATCH net v3 08/10] net: phy: smsc: wait for LAN83C183 power-down recovery Florian Fainelli
2026-11-20 10:32   ` netdev-bot+sashiko
2026-11-21  0:25     ` Florian Fainelli
2026-11-17 19:32 ` [PATCH net v3 09/10] net: au1000: keep the MAC stopped until the PHY link is ready Florian Fainelli
2026-11-20 10:32   ` netdev-bot+sashiko
2026-11-17 19:32 ` [PATCH net v3 10/10] net: au1000: reject frames larger than the TX bounce buffer Florian Fainelli
2026-11-17 19:38 ` [PATCH net v3 00/10] net: au1000: Bug fixes netdev-bot+sinfo
2026-11-17 21:54   ` Florian Fainelli

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=b42ab368-cb3a-485d-94f3-8f175435f532@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=danny.kukawka@bisect.de \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=hkallweit1@gmail.com \
    --cc=horms@kernel.org \
    --cc=hvr@gnu.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=manuel.lauss@gmail.com \
    --cc=mmyangfl@gmail.com \
    --cc=mugunthanvnm@ti.com \
    --cc=netdev-bot+sashiko@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=runyu.xiao@seu.edu.cn \
    --cc=sebastian.hesselbarth@gmail.com \
    --cc=shaojijie@huawei.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