Optimize cxgb3 xmit path (a bit)

1. Add common code for stopping queue.
	2. No need to call netif_stop_queue followed by netif_wake_queue (and
	   infact a netif_start_queue could have been used instead), instead
	   call stop_queue if required, and remove code under USE_GTS macro.
	3. There is no need to check for netif_queue_stopped, as the network
	   core guarantees that for us (I am sure every driver could remove
	   that check, eg e1000 - I have tested that path a few billion times
	   with about a few hundred thousand qstops but the condition never
	   hit even once).

Signed-off-by: Krishna Kumar <krkumar2@in.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
This commit is contained in:
Krishna Kumar 2008-01-30 12:30:16 +05:30 committed by Jeff Garzik
parent 3c34ac36ac
commit a8cc21f646

View file

@ -1059,6 +1059,14 @@ static void write_tx_pkt_wr(struct adapter *adap, struct sk_buff *skb,
htonl(V_WR_TID(q->token))); htonl(V_WR_TID(q->token)));
} }
static inline void t3_stop_queue(struct net_device *dev, struct sge_qset *qs,
struct sge_txq *q)
{
netif_stop_queue(dev);
set_bit(TXQ_ETH, &qs->txq_stopped);
q->stops++;
}
/** /**
* eth_xmit - add a packet to the Ethernet Tx queue * eth_xmit - add a packet to the Ethernet Tx queue
* @skb: the packet * @skb: the packet
@ -1090,31 +1098,18 @@ int t3_eth_xmit(struct sk_buff *skb, struct net_device *dev)
ndesc = calc_tx_descs(skb); ndesc = calc_tx_descs(skb);
if (unlikely(credits < ndesc)) { if (unlikely(credits < ndesc)) {
if (!netif_queue_stopped(dev)) { t3_stop_queue(dev, qs, q);
netif_stop_queue(dev); dev_err(&adap->pdev->dev,
set_bit(TXQ_ETH, &qs->txq_stopped); "%s: Tx ring %u full while queue awake!\n",
q->stops++; dev->name, q->cntxt_id & 7);
dev_err(&adap->pdev->dev,
"%s: Tx ring %u full while queue awake!\n",
dev->name, q->cntxt_id & 7);
}
spin_unlock(&q->lock); spin_unlock(&q->lock);
return NETDEV_TX_BUSY; return NETDEV_TX_BUSY;
} }
q->in_use += ndesc; q->in_use += ndesc;
if (unlikely(credits - ndesc < q->stop_thres)) { if (unlikely(credits - ndesc < q->stop_thres))
q->stops++; if (USE_GTS || !should_restart_tx(q))
netif_stop_queue(dev); t3_stop_queue(dev, qs, q);
set_bit(TXQ_ETH, &qs->txq_stopped);
#if !USE_GTS
if (should_restart_tx(q) &&
test_and_clear_bit(TXQ_ETH, &qs->txq_stopped)) {
q->restarts++;
netif_wake_queue(dev);
}
#endif
}
gen = q->gen; gen = q->gen;
q->unacked += ndesc; q->unacked += ndesc;