Thread (5 messages) 5 messages, 4 authors, 2d ago

Re: [PATCH net] net: bcmasp: fix lost TX wakeup race with lockless queue API

From: Nicolai Buchwitz <nb@tipi-net.de>
Date: 2026-09-28 21:35:20

Hi Justin

On 28.9.2026 22:18, justin.chen@broadcom.com wrote:
From: Justin Chen <justin.chen@broadcom.com>

netif_stop_queue() in bcmasp_xmit() raced with netif_wake_queue() in
bcmasp_tx_poll(): a reclaim landing between the ring-full check and
the stop call left the queue stopped despite free descriptors,
hanging TX until timeout.

Switch to netif_txq_maybe_stop()/netif_txq_completed_wake() (the
lockless TX queue API, which also brings in BQL), replace
tx_spb_ring_full() with a live bcmasp_tx_avail() count.

Fixes: 490cb412007d ("net: bcmasp: Add support for ASP2.0 Ethernet 
controller")
Signed-off-by: Justin Chen <justin.chen@broadcom.com>
Assisted-by: Claude:claude-sonnet-5
---
 .../net/ethernet/broadcom/asp2/bcmasp_intf.c  | 68 +++++++++++--------
[...]
quoted hunk ↗ jump to hunk
 static struct sk_buff *bcmasp_csum_offload(struct net_device *dev,
@@ -241,16 +239,18 @@ static netdev_tx_t bcmasp_xmit(struct sk_buff 
*skb, struct net_device *dev)
 	struct bcmasp_tx_cb *txcb;
 	dma_addr_t mapping, valid;
 	struct bcmasp_desc *desc;
+	struct netdev_queue *txq;
 	bool csum_hw = false;
 	struct device *kdev;
 	skb_frag_t *frag;

 	kdev = &intf->parent->pdev->dev;
+	txq = netdev_get_tx_queue(dev, 0);

 	nr_frags = skb_shinfo(skb)->nr_frags;

-	if (tx_spb_ring_full(intf, nr_frags + 1)) {
-		netif_stop_queue(dev);
+	if (unlikely(bcmasp_tx_avail(intf) < nr_frags + 1)) {
+		netif_tx_stop_queue(txq);
nit: AFAIU this is unreachable for now, but to prevent future races 
maybe
better use netif_txq_try_stop()?
[...]
Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de>

Thanks,
Nicolai
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help