Merge branch 'cxgb4-Fix-ethtool-selftest-flits-calculation'
Ganji Aravind says: ==================== cxgb4: Fix ethtool selftest flits calculation Patch 1 will fix work request size calculation for loopback selftest. Patch 2 will fix race between loopback selftest and normal Tx handler. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Коммит
5680790b2d
|
@ -2553,19 +2553,22 @@ int cxgb4_selftest_lb_pkt(struct net_device *netdev)
|
|||
|
||||
pkt_len = ETH_HLEN + sizeof(CXGB4_SELFTEST_LB_STR);
|
||||
|
||||
flits = DIV_ROUND_UP(pkt_len + sizeof(struct cpl_tx_pkt) +
|
||||
sizeof(*wr), sizeof(__be64));
|
||||
flits = DIV_ROUND_UP(pkt_len + sizeof(*cpl) + sizeof(*wr),
|
||||
sizeof(__be64));
|
||||
ndesc = flits_to_desc(flits);
|
||||
|
||||
lb = &pi->ethtool_lb;
|
||||
lb->loopback = 1;
|
||||
|
||||
q = &adap->sge.ethtxq[pi->first_qset];
|
||||
__netif_tx_lock(q->txq, smp_processor_id());
|
||||
|
||||
reclaim_completed_tx(adap, &q->q, -1, true);
|
||||
credits = txq_avail(&q->q) - ndesc;
|
||||
if (unlikely(credits < 0))
|
||||
if (unlikely(credits < 0)) {
|
||||
__netif_tx_unlock(q->txq);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
wr = (void *)&q->q.desc[q->q.pidx];
|
||||
memset(wr, 0, sizeof(struct tx_desc));
|
||||
|
@ -2598,6 +2601,7 @@ int cxgb4_selftest_lb_pkt(struct net_device *netdev)
|
|||
init_completion(&lb->completion);
|
||||
txq_advance(&q->q, ndesc);
|
||||
cxgb4_ring_tx_db(adap, &q->q, ndesc);
|
||||
__netif_tx_unlock(q->txq);
|
||||
|
||||
/* wait for the pkt to return */
|
||||
ret = wait_for_completion_timeout(&lb->completion, 10 * HZ);
|
||||
|
|
Загрузка…
Ссылка в новой задаче