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 05/10] net: au1000: serialize TX completion with packet submission
Date: Fri, 20 Nov 2026 16:06:15 -0800 [thread overview]
Message-ID: <3f4424da-9244-483c-8662-2ba2d3b5eb94@gmail.com> (raw)
In-Reply-To: <179517075632.3136.4816970691265925776@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] au1000_tx() (drivers/net/ethernet/amd/au1000_eth.c) now holds
> spin_lock_irqsave(&aup->lock) for the whole transmit path.
>
> --
>
> net: au1000: serialize TX completion with packet submission
>
> This patch takes the IRQ-safe aup->lock in both au1000_tx_ack() and
> au1000_tx(), so TX descriptor reclamation and queue state changes are
> serialized. When au1000_tx() reclaims a completed descriptor at tx_head,
> it now also advances tx_tail. The skb is now freed with
> dev_consume_skb_any() after the lock is released.
>
>> diff --git a/drivers/net/ethernet/amd/au1000_eth.c b/drivers/net/ethernet/amd/au1000_eth.c
>> index 1935b1d4b1738..805aabc6721b8 100644
>> --- a/drivers/net/ethernet/amd/au1000_eth.c
>> +++ b/drivers/net/ethernet/amd/au1000_eth.c
>
> [ ... ]
>
>> @@ -972,21 +976,25 @@ static netdev_tx_t au1000_tx(struct sk_buff *skb, struct net_device *dev)
>> u32 buff_stat;
>> struct db_dest *pDB;
>> int i;
>> + unsigned long flags;
>>
>> netif_dbg(aup, tx_queued, dev, "tx: aup %x len=%d, data=%p, head %d\n",
>> (unsigned)aup, skb->len,
>> skb->data, aup->tx_head);
>>
>> + spin_lock_irqsave(&aup->lock, flags);
>
> [Severity: Medium]
> With this lock taken here, the rest of au1000_tx() runs with local hard
> IRQs disabled until the spin_unlock_irqrestore() at the end. That
> includes the packet copy and the zero padding loop:
>
> pDB = aup->tx_db_inuse[aup->tx_head];
> skb_copy_from_linear_data(skb, (void *)pDB->vaddr, skb->len);
> if (skb->len < ETH_ZLEN) {
> for (i = skb->len; i < ETH_ZLEN; i++)
> ((char *)pDB->vaddr)[i] = 0;
> ...
>
> On Au1000/Au1500/Au1100, MIPS_ALCHEMY selects DMA_NONCOHERENT. That
> makes the dma_alloc_coherent() buffer uncached, so every store into
> pDB->vaddr is an uncached bus write. A full frame is up to about 1514
> bytes.
>
> The RX side has only NUM_RX_DMA (4) hardware buffers, and they are
> serviced only from au1000_interrupt()->au1000_rx(). Before this patch,
> the RX interrupt could preempt the copy.
>
> Could this longer IRQ-off window on every transmit lead to more RX
> overruns (RX_MISSED_FRAME) under combined TX/RX load? It would also add
> interrupt latency for the rest of the system on these single-core
> parts.
>
> The copy does not appear to need the lock. Suppose au1000_tx() has
> checked, under the lock, that TX_DMA_ENABLE and TX_T_DONE are clear at
> tx_head:
>
> - au1000_tx_ack() stops at the first descriptor without TX_T_DONE.
> - It never touches the tx_db_inuse[] buffers or tx_head.
> - ndo_start_xmit is already serialized by the TX queue lock.
>
> Would it be enough to hold aup->lock only for the descriptor state
> check, the tx_tail/tx_full handling, and the final len, buff_stat and
> tx_head updates, and do the copy and padding outside it?
>
>> ptxd = aup->tx_dma_ring[aup->tx_head];
>> buff_stat = ptxd->buff_stat;
>> if (buff_stat & TX_DMA_ENABLE) {
>
> [ ... ]
>
Agreed. I have narrowed aup->lock to descriptor reservation and final
publication, moving the packet copy and padding outside the IRQ-disabled
critical sections.
When submission reclaims a completed descriptor, it now clears TX_T_DONE
and advances tx_tail before dropping the lock. The TX queue lock
reserves that idle descriptor during the copy, while au1000_tx_ack()
stops at it because TX_T_DONE is clear.
pw-bot: cr
--
Florian
next prev parent reply other threads:[~2026-11-21 0:06 UTC|newest]
Thread overview: 21+ 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 [this message]
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
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-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=3f4424da-9244-483c-8662-2ba2d3b5eb94@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