aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJing Huang <huangj@Brocade.COM>2012-04-04 01:43:48 -0400
committerDavid S. Miller <davem@davemloft.net>2012-04-04 18:19:18 -0400
commitd95d1081c3c3ed70a72b47cd578830c85c55da2e (patch)
tree38d0d6a7def789c0038a116be7ea8a1b3e19609d
parent01b54b1451853593739816a392485c4e2bee7dda (diff)
bna: Remove tx tasklet
The scheduling of tasklet and keeping the interrupts enabled makes interrupt reduntant. 20% of the Tx interrupts have nothing left to process or could not process as Tx tasklet was running. Signed-off-by: Jing Huang <huangj@brocade.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/brocade/bna/bnad.c73
-rw-r--r--drivers/net/ethernet/brocade/bna/bnad.h1
2 files changed, 3 insertions, 71 deletions
diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c
index 032a306c0569..f1103e6f31c1 100644
--- a/drivers/net/ethernet/brocade/bna/bnad.c
+++ b/drivers/net/ethernet/brocade/bna/bnad.c
@@ -185,7 +185,6 @@ bnad_free_all_txbufs(struct bnad *bnad,
185 * bnad_free_txbufs : Frees the Tx bufs on Tx completion 185 * bnad_free_txbufs : Frees the Tx bufs on Tx completion
186 * Can be called in a) Interrupt context 186 * Can be called in a) Interrupt context
187 * b) Sending context 187 * b) Sending context
188 * c) Tasklet context
189 */ 188 */
190static u32 189static u32
191bnad_free_txbufs(struct bnad *bnad, 190bnad_free_txbufs(struct bnad *bnad,
@@ -197,13 +196,7 @@ bnad_free_txbufs(struct bnad *bnad,
197 struct bnad_skb_unmap *unmap_array; 196 struct bnad_skb_unmap *unmap_array;
198 struct sk_buff *skb; 197 struct sk_buff *skb;
199 198
200 /* 199 /* Just return if TX is stopped */
201 * Just return if TX is stopped. This check is useful
202 * when bnad_free_txbufs() runs out of a tasklet scheduled
203 * before bnad_cb_tx_cleanup() cleared BNAD_TXQ_TX_STARTED bit
204 * but this routine runs actually after the cleanup has been
205 * executed.
206 */
207 if (!test_bit(BNAD_TXQ_TX_STARTED, &tcb->flags)) 200 if (!test_bit(BNAD_TXQ_TX_STARTED, &tcb->flags))
208 return 0; 201 return 0;
209 202
@@ -242,55 +235,6 @@ bnad_free_txbufs(struct bnad *bnad,
242 return sent_packets; 235 return sent_packets;
243} 236}
244 237
245/* Tx Free Tasklet function */
246/* Frees for all the tcb's in all the Tx's */
247/*
248 * Scheduled from sending context, so that
249 * the fat Tx lock is not held for too long
250 * in the sending context.
251 */
252static void
253bnad_tx_free_tasklet(unsigned long bnad_ptr)
254{
255 struct bnad *bnad = (struct bnad *)bnad_ptr;
256 struct bna_tcb *tcb;
257 u32 acked = 0;
258 int i, j;
259
260 for (i = 0; i < bnad->num_tx; i++) {
261 for (j = 0; j < bnad->num_txq_per_tx; j++) {
262 tcb = bnad->tx_info[i].tcb[j];
263 if (!tcb)
264 continue;
265 if (((u16) (*tcb->hw_consumer_index) !=
266 tcb->consumer_index) &&
267 (!test_and_set_bit(BNAD_TXQ_FREE_SENT,
268 &tcb->flags))) {
269 acked = bnad_free_txbufs(bnad, tcb);
270 if (likely(test_bit(BNAD_TXQ_TX_STARTED,
271 &tcb->flags)))
272 bna_ib_ack(tcb->i_dbell, acked);
273 smp_mb__before_clear_bit();
274 clear_bit(BNAD_TXQ_FREE_SENT, &tcb->flags);
275 }
276 if (unlikely(!test_bit(BNAD_TXQ_TX_STARTED,
277 &tcb->flags)))
278 continue;
279 if (netif_queue_stopped(bnad->netdev)) {
280 if (acked && netif_carrier_ok(bnad->netdev) &&
281 BNA_QE_FREE_CNT(tcb, tcb->q_depth) >=
282 BNAD_NETIF_WAKE_THRESHOLD) {
283 netif_wake_queue(bnad->netdev);
284 /* TODO */
285 /* Counters for individual TxQs? */
286 BNAD_UPDATE_CTR(bnad,
287 netif_queue_wakeup);
288 }
289 }
290 }
291 }
292}
293
294static u32 238static u32
295bnad_tx(struct bnad *bnad, struct bna_tcb *tcb) 239bnad_tx(struct bnad *bnad, struct bna_tcb *tcb)
296{ 240{
@@ -1789,9 +1733,6 @@ bnad_cleanup_tx(struct bnad *bnad, u32 tx_id)
1789 bnad_tx_msix_unregister(bnad, tx_info, 1733 bnad_tx_msix_unregister(bnad, tx_info,
1790 bnad->num_txq_per_tx); 1734 bnad->num_txq_per_tx);
1791 1735
1792 if (0 == tx_id)
1793 tasklet_kill(&bnad->tx_free_tasklet);
1794
1795 spin_lock_irqsave(&bnad->bna_lock, flags); 1736 spin_lock_irqsave(&bnad->bna_lock, flags);
1796 bna_tx_destroy(tx_info->tx); 1737 bna_tx_destroy(tx_info->tx);
1797 spin_unlock_irqrestore(&bnad->bna_lock, flags); 1738 spin_unlock_irqrestore(&bnad->bna_lock, flags);
@@ -2871,9 +2812,6 @@ bnad_start_xmit(struct sk_buff *skb, struct net_device *netdev)
2871 bna_txq_prod_indx_doorbell(tcb); 2812 bna_txq_prod_indx_doorbell(tcb);
2872 smp_mb(); 2813 smp_mb();
2873 2814
2874 if ((u16) (*tcb->hw_consumer_index) != tcb->consumer_index)
2875 tasklet_schedule(&bnad->tx_free_tasklet);
2876
2877 return NETDEV_TX_OK; 2815 return NETDEV_TX_OK;
2878} 2816}
2879 2817
@@ -3155,9 +3093,8 @@ bnad_netdev_init(struct bnad *bnad, bool using_dac)
3155/* 3093/*
3156 * 1. Initialize the bnad structure 3094 * 1. Initialize the bnad structure
3157 * 2. Setup netdev pointer in pci_dev 3095 * 2. Setup netdev pointer in pci_dev
3158 * 3. Initialze Tx free tasklet 3096 * 3. Initialize no. of TxQ & CQs & MSIX vectors
3159 * 4. Initialize no. of TxQ & CQs & MSIX vectors 3097 * 4. Initialize work queue.
3160 * 5. Initialize work queue.
3161 */ 3098 */
3162static int 3099static int
3163bnad_init(struct bnad *bnad, 3100bnad_init(struct bnad *bnad,
@@ -3200,9 +3137,6 @@ bnad_init(struct bnad *bnad,
3200 bnad->tx_coalescing_timeo = BFI_TX_COALESCING_TIMEO; 3137 bnad->tx_coalescing_timeo = BFI_TX_COALESCING_TIMEO;
3201 bnad->rx_coalescing_timeo = BFI_RX_COALESCING_TIMEO; 3138 bnad->rx_coalescing_timeo = BFI_RX_COALESCING_TIMEO;
3202 3139
3203 tasklet_init(&bnad->tx_free_tasklet, bnad_tx_free_tasklet,
3204 (unsigned long)bnad);
3205
3206 sprintf(bnad->wq_name, "%s_wq_%d", BNAD_NAME, bnad->id); 3140 sprintf(bnad->wq_name, "%s_wq_%d", BNAD_NAME, bnad->id);
3207 bnad->work_q = create_singlethread_workqueue(bnad->wq_name); 3141 bnad->work_q = create_singlethread_workqueue(bnad->wq_name);
3208 3142
@@ -3345,7 +3279,6 @@ bnad_pci_probe(struct pci_dev *pdev,
3345 /* 3279 /*
3346 * Initialize bnad structure 3280 * Initialize bnad structure
3347 * Setup relation between pci_dev & netdev 3281 * Setup relation between pci_dev & netdev
3348 * Init Tx free tasklet
3349 */ 3282 */
3350 err = bnad_init(bnad, pdev, netdev); 3283 err = bnad_init(bnad, pdev, netdev);
3351 if (err) 3284 if (err)
diff --git a/drivers/net/ethernet/brocade/bna/bnad.h b/drivers/net/ethernet/brocade/bna/bnad.h
index ff129aa7cb66..cf1d3bad01b6 100644
--- a/drivers/net/ethernet/brocade/bna/bnad.h
+++ b/drivers/net/ethernet/brocade/bna/bnad.h
@@ -320,7 +320,6 @@ struct bnad {
320 /* Burnt in MAC address */ 320 /* Burnt in MAC address */
321 mac_t perm_addr; 321 mac_t perm_addr;
322 322
323 struct tasklet_struct tx_free_tasklet;
324 struct workqueue_struct *work_q; 323 struct workqueue_struct *work_q;
325 324
326 /* Statistics */ 325 /* Statistics */