Skip to content

Commit 9067ecc

Browse files
Sebastian Andrzej Siewiorkuba-moo
authored andcommitted
cxgb4: Properly lock TX queue for the selftest.
The selftest for the driver sends a dummy packet and checks if the packet will be received properly as it should be. The regular TX path and the selftest can use the same network queue so locking is required and was missing in the selftest path. This was addressed in the commit cited below. Unfortunately locking the TX queue requires BH to be disabled which is not the case in selftest path which is invoked in process context. Lockdep should be complaining about this. Use __netif_tx_lock_bh() for TX queue locking. Fixes: c650e04 ("cxgb4: Fix race between loopback and normal Tx path") Reported-by: "John B. Wyatt IV" <[email protected]> Closes: https://lore.kernel.org/all/Zic0ot5aGgR-V4Ks@thinkpad2021/ Signed-off-by: Sebastian Andrzej Siewior <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 9f8eeea commit 9067ecc

File tree

1 file changed

+3
-3
lines changed
  • drivers/net/ethernet/chelsio/cxgb4

1 file changed

+3
-3
lines changed

drivers/net/ethernet/chelsio/cxgb4/sge.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2670,12 +2670,12 @@ int cxgb4_selftest_lb_pkt(struct net_device *netdev)
26702670
lb->loopback = 1;
26712671

26722672
q = &adap->sge.ethtxq[pi->first_qset];
2673-
__netif_tx_lock(q->txq, smp_processor_id());
2673+
__netif_tx_lock_bh(q->txq);
26742674

26752675
reclaim_completed_tx(adap, &q->q, -1, true);
26762676
credits = txq_avail(&q->q) - ndesc;
26772677
if (unlikely(credits < 0)) {
2678-
__netif_tx_unlock(q->txq);
2678+
__netif_tx_unlock_bh(q->txq);
26792679
return -ENOMEM;
26802680
}
26812681

@@ -2710,7 +2710,7 @@ int cxgb4_selftest_lb_pkt(struct net_device *netdev)
27102710
init_completion(&lb->completion);
27112711
txq_advance(&q->q, ndesc);
27122712
cxgb4_ring_tx_db(adap, &q->q, ndesc);
2713-
__netif_tx_unlock(q->txq);
2713+
__netif_tx_unlock_bh(q->txq);
27142714

27152715
/* wait for the pkt to return */
27162716
ret = wait_for_completion_timeout(&lb->completion, 10 * HZ);

0 commit comments

Comments
 (0)