diff options
author | Krishna Kumar <krkumar2@in.ibm.com> | 2008-01-30 02:00:16 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2008-02-11 10:44:28 -0500 |
commit | a8cc21f64648073e443365d113c55755b92622a6 (patch) | |
tree | bda4eacf003636fdf5418e777711cfd1f4e2a0f8 /drivers/net/cxgb3/sge.c | |
parent | 3c34ac36ac1084e571ef9b6fb1d6a5b10ccc1fd0 (diff) |
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>
Diffstat (limited to 'drivers/net/cxgb3/sge.c')
-rw-r--r-- | drivers/net/cxgb3/sge.c | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c index 9ca8c66abd16..979f3fc5e765 100644 --- a/drivers/net/cxgb3/sge.c +++ b/drivers/net/cxgb3/sge.c | |||
@@ -1059,6 +1059,14 @@ static void write_tx_pkt_wr(struct adapter *adap, struct sk_buff *skb, | |||
1059 | htonl(V_WR_TID(q->token))); | 1059 | htonl(V_WR_TID(q->token))); |
1060 | } | 1060 | } |
1061 | 1061 | ||
1062 | static inline void t3_stop_queue(struct net_device *dev, struct sge_qset *qs, | ||
1063 | struct sge_txq *q) | ||
1064 | { | ||
1065 | netif_stop_queue(dev); | ||
1066 | set_bit(TXQ_ETH, &qs->txq_stopped); | ||
1067 | q->stops++; | ||
1068 | } | ||
1069 | |||
1062 | /** | 1070 | /** |
1063 | * eth_xmit - add a packet to the Ethernet Tx queue | 1071 | * eth_xmit - add a packet to the Ethernet Tx queue |
1064 | * @skb: the packet | 1072 | * @skb: the packet |
@@ -1090,31 +1098,18 @@ int t3_eth_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1090 | ndesc = calc_tx_descs(skb); | 1098 | ndesc = calc_tx_descs(skb); |
1091 | 1099 | ||
1092 | if (unlikely(credits < ndesc)) { | 1100 | if (unlikely(credits < ndesc)) { |
1093 | if (!netif_queue_stopped(dev)) { | 1101 | t3_stop_queue(dev, qs, q); |
1094 | netif_stop_queue(dev); | 1102 | dev_err(&adap->pdev->dev, |
1095 | set_bit(TXQ_ETH, &qs->txq_stopped); | 1103 | "%s: Tx ring %u full while queue awake!\n", |
1096 | q->stops++; | 1104 | dev->name, q->cntxt_id & 7); |
1097 | dev_err(&adap->pdev->dev, | ||
1098 | "%s: Tx ring %u full while queue awake!\n", | ||
1099 | dev->name, q->cntxt_id & 7); | ||
1100 | } | ||
1101 | spin_unlock(&q->lock); | 1105 | spin_unlock(&q->lock); |
1102 | return NETDEV_TX_BUSY; | 1106 | return NETDEV_TX_BUSY; |
1103 | } | 1107 | } |
1104 | 1108 | ||
1105 | q->in_use += ndesc; | 1109 | q->in_use += ndesc; |
1106 | if (unlikely(credits - ndesc < q->stop_thres)) { | 1110 | if (unlikely(credits - ndesc < q->stop_thres)) |
1107 | q->stops++; | 1111 | if (USE_GTS || !should_restart_tx(q)) |
1108 | netif_stop_queue(dev); | 1112 | t3_stop_queue(dev, qs, q); |
1109 | set_bit(TXQ_ETH, &qs->txq_stopped); | ||
1110 | #if !USE_GTS | ||
1111 | if (should_restart_tx(q) && | ||
1112 | test_and_clear_bit(TXQ_ETH, &qs->txq_stopped)) { | ||
1113 | q->restarts++; | ||
1114 | netif_wake_queue(dev); | ||
1115 | } | ||
1116 | #endif | ||
1117 | } | ||
1118 | 1113 | ||
1119 | gen = q->gen; | 1114 | gen = q->gen; |
1120 | q->unacked += ndesc; | 1115 | q->unacked += ndesc; |