Re: [PATCH net] net: bcmasp: fix lost TX wakeup race with lockless queue API
From: Justin Chen <justin.chen@broadcom.com>
Date: 2026-09-28 21:56:45
On 9/28/26 2:35 PM, Nicolai Buchwitz wrote:
Hi Justin On 28.9.2026 22:18, justin.chen@broadcom.com wrote:quoted
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
[...]quoted
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()?
Will use netif_txq_try_stop() in v2. My understanding is this is still reachable since the maybe_stop call at the end of the xmit may have false wake ups when the ring is full. That is what is documented in the function header description for netif_txq_try_stop(). Thanks, Justin
quoted
[...]Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de> Thanks, Nicolai