aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/cxgb3/sge.c
diff options
context:
space:
mode:
authorDivy Le Ray <divy@chelsio.com>2008-12-16 04:09:39 -0500
committerDavid S. Miller <davem@davemloft.net>2008-12-16 04:09:39 -0500
commit82ad33297410c1af8e993210da76e114a4c1670d (patch)
tree63044ca2d003efc85461a5e0943a175dbc960742 /drivers/net/cxgb3/sge.c
parent89c88b16f12e9df9ac39418638f267ec3b36a6c6 (diff)
cxgb3: Add multiple Tx queue support.
Implement NIC Tx multiqueue. Bump up driver version. Signed-off-by: Divy Le Ray <divy@chelsio.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/cxgb3/sge.c')
-rw-r--r--drivers/net/cxgb3/sge.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c
index d3a6e245f1e..63eb97473c8 100644
--- a/drivers/net/cxgb3/sge.c
+++ b/drivers/net/cxgb3/sge.c
@@ -1120,10 +1120,10 @@ static void write_tx_pkt_wr(struct adapter *adap, struct sk_buff *skb,
1120 htonl(V_WR_TID(q->token))); 1120 htonl(V_WR_TID(q->token)));
1121} 1121}
1122 1122
1123static inline void t3_stop_queue(struct net_device *dev, struct sge_qset *qs, 1123static inline void t3_stop_tx_queue(struct netdev_queue *txq,
1124 struct sge_txq *q) 1124 struct sge_qset *qs, struct sge_txq *q)
1125{ 1125{
1126 netif_stop_queue(dev); 1126 netif_tx_stop_queue(txq);
1127 set_bit(TXQ_ETH, &qs->txq_stopped); 1127 set_bit(TXQ_ETH, &qs->txq_stopped);
1128 q->stops++; 1128 q->stops++;
1129} 1129}
@@ -1137,11 +1137,13 @@ static inline void t3_stop_queue(struct net_device *dev, struct sge_qset *qs,
1137 */ 1137 */
1138int t3_eth_xmit(struct sk_buff *skb, struct net_device *dev) 1138int t3_eth_xmit(struct sk_buff *skb, struct net_device *dev)
1139{ 1139{
1140 int qidx;
1140 unsigned int ndesc, pidx, credits, gen, compl; 1141 unsigned int ndesc, pidx, credits, gen, compl;
1141 const struct port_info *pi = netdev_priv(dev); 1142 const struct port_info *pi = netdev_priv(dev);
1142 struct adapter *adap = pi->adapter; 1143 struct adapter *adap = pi->adapter;
1143 struct sge_qset *qs = pi->qs; 1144 struct netdev_queue *txq;
1144 struct sge_txq *q = &qs->txq[TXQ_ETH]; 1145 struct sge_qset *qs;
1146 struct sge_txq *q;
1145 1147
1146 /* 1148 /*
1147 * The chip min packet length is 9 octets but play safe and reject 1149 * The chip min packet length is 9 octets but play safe and reject
@@ -1152,6 +1154,11 @@ int t3_eth_xmit(struct sk_buff *skb, struct net_device *dev)
1152 return NETDEV_TX_OK; 1154 return NETDEV_TX_OK;
1153 } 1155 }
1154 1156
1157 qidx = skb_get_queue_mapping(skb);
1158 qs = &pi->qs[qidx];
1159 q = &qs->txq[TXQ_ETH];
1160 txq = netdev_get_tx_queue(dev, qidx);
1161
1155 spin_lock(&q->lock); 1162 spin_lock(&q->lock);
1156 reclaim_completed_tx(adap, q); 1163 reclaim_completed_tx(adap, q);
1157 1164
@@ -1159,7 +1166,7 @@ int t3_eth_xmit(struct sk_buff *skb, struct net_device *dev)
1159 ndesc = calc_tx_descs(skb); 1166 ndesc = calc_tx_descs(skb);
1160 1167
1161 if (unlikely(credits < ndesc)) { 1168 if (unlikely(credits < ndesc)) {
1162 t3_stop_queue(dev, qs, q); 1169 t3_stop_tx_queue(txq, qs, q);
1163 dev_err(&adap->pdev->dev, 1170 dev_err(&adap->pdev->dev,
1164 "%s: Tx ring %u full while queue awake!\n", 1171 "%s: Tx ring %u full while queue awake!\n",
1165 dev->name, q->cntxt_id & 7); 1172 dev->name, q->cntxt_id & 7);
@@ -1169,12 +1176,12 @@ int t3_eth_xmit(struct sk_buff *skb, struct net_device *dev)
1169 1176
1170 q->in_use += ndesc; 1177 q->in_use += ndesc;
1171 if (unlikely(credits - ndesc < q->stop_thres)) { 1178 if (unlikely(credits - ndesc < q->stop_thres)) {
1172 t3_stop_queue(dev, qs, q); 1179 t3_stop_tx_queue(txq, qs, q);
1173 1180
1174 if (should_restart_tx(q) && 1181 if (should_restart_tx(q) &&
1175 test_and_clear_bit(TXQ_ETH, &qs->txq_stopped)) { 1182 test_and_clear_bit(TXQ_ETH, &qs->txq_stopped)) {
1176 q->restarts++; 1183 q->restarts++;
1177 netif_wake_queue(dev); 1184 netif_tx_wake_queue(txq);
1178 } 1185 }
1179 } 1186 }
1180 1187
@@ -1838,7 +1845,7 @@ static void restart_tx(struct sge_qset *qs)
1838 test_and_clear_bit(TXQ_ETH, &qs->txq_stopped)) { 1845 test_and_clear_bit(TXQ_ETH, &qs->txq_stopped)) {
1839 qs->txq[TXQ_ETH].restarts++; 1846 qs->txq[TXQ_ETH].restarts++;
1840 if (netif_running(qs->netdev)) 1847 if (netif_running(qs->netdev))
1841 netif_wake_queue(qs->netdev); 1848 netif_tx_wake_queue(qs->tx_q);
1842 } 1849 }
1843 1850
1844 if (test_bit(TXQ_OFLD, &qs->txq_stopped) && 1851 if (test_bit(TXQ_OFLD, &qs->txq_stopped) &&
@@ -2824,6 +2831,7 @@ void t3_update_qset_coalesce(struct sge_qset *qs, const struct qset_params *p)
2824 * @p: configuration parameters for this queue set 2831 * @p: configuration parameters for this queue set
2825 * @ntxq: number of Tx queues for the queue set 2832 * @ntxq: number of Tx queues for the queue set
2826 * @netdev: net device associated with this queue set 2833 * @netdev: net device associated with this queue set
2834 * @netdevq: net device TX queue associated with this queue set
2827 * 2835 *
2828 * Allocate resources and initialize an SGE queue set. A queue set 2836 * Allocate resources and initialize an SGE queue set. A queue set
2829 * comprises a response queue, two Rx free-buffer queues, and up to 3 2837 * comprises a response queue, two Rx free-buffer queues, and up to 3
@@ -2832,7 +2840,8 @@ void t3_update_qset_coalesce(struct sge_qset *qs, const struct qset_params *p)
2832 */ 2840 */
2833int t3_sge_alloc_qset(struct adapter *adapter, unsigned int id, int nports, 2841int t3_sge_alloc_qset(struct adapter *adapter, unsigned int id, int nports,
2834 int irq_vec_idx, const struct qset_params *p, 2842 int irq_vec_idx, const struct qset_params *p,
2835 int ntxq, struct net_device *dev) 2843 int ntxq, struct net_device *dev,
2844 struct netdev_queue *netdevq)
2836{ 2845{
2837 int i, avail, ret = -ENOMEM; 2846 int i, avail, ret = -ENOMEM;
2838 struct sge_qset *q = &adapter->sge.qs[id]; 2847 struct sge_qset *q = &adapter->sge.qs[id];
@@ -2968,6 +2977,7 @@ int t3_sge_alloc_qset(struct adapter *adapter, unsigned int id, int nports,
2968 2977
2969 q->adap = adapter; 2978 q->adap = adapter;
2970 q->netdev = dev; 2979 q->netdev = dev;
2980 q->tx_q = netdevq;
2971 t3_update_qset_coalesce(q, p); 2981 t3_update_qset_coalesce(q, p);
2972 2982
2973 init_lro_mgr(q, lro_mgr); 2983 init_lro_mgr(q, lro_mgr);