Re: [PATCH net v3 05/10] net: au1000: serialize TX completion with packet submission

From: netdev-bot+sashiko

Date: Fri Nov 20 2026 - 05:32:55 EST


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) {

[ ... ]

--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261117193223.2795612-1-f.fainelli%40gmail.com