Commit fbe80776 authored by Hariprasad Shenai's avatar Hariprasad Shenai Committed by David S. Miller

cxgb4: Avoids race and deadlock while freeing tx descriptor

There could be race between t4_eth_xmit() and t4_free_sge_resources() while
freeing tx descriptors, take txq lock in t4_free_sge_resources(). We need
to stop the xmit frame path which runs in bottom half context while
unloading the driver using _bh variant of the lock. This is to prevent
the deadlock between xmit and driver unload.
Signed-off-by: default avatarHariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ed98c85e
...@@ -3006,7 +3006,9 @@ void t4_free_sge_resources(struct adapter *adap) ...@@ -3006,7 +3006,9 @@ void t4_free_sge_resources(struct adapter *adap)
if (etq->q.desc) { if (etq->q.desc) {
t4_eth_eq_free(adap, adap->mbox, adap->pf, 0, t4_eth_eq_free(adap, adap->mbox, adap->pf, 0,
etq->q.cntxt_id); etq->q.cntxt_id);
__netif_tx_lock_bh(etq->txq);
free_tx_desc(adap, &etq->q, etq->q.in_use, true); free_tx_desc(adap, &etq->q, etq->q.in_use, true);
__netif_tx_unlock_bh(etq->txq);
kfree(etq->q.sdesc); kfree(etq->q.sdesc);
free_txq(adap, &etq->q); free_txq(adap, &etq->q);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment