]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/net/ethernet/freescale/gianfar.c
Merge remote-tracking branch 'dt-rh/for-next'
[karo-tx-linux.git] / drivers / net / ethernet / freescale / gianfar.c
index 9fbe4dda7a0e4d68d6bee463fbc6e0a18fa8c061..b14d7904a075e69779e4a2847dee1bedaba791d2 100644 (file)
@@ -78,6 +78,8 @@
 #include <linux/if_vlan.h>
 #include <linux/spinlock.h>
 #include <linux/mm.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
 #include <linux/of_mdio.h>
 #include <linux/of_platform.h>
 #include <linux/ip.h>
@@ -2918,7 +2920,7 @@ static int gfar_poll(struct napi_struct *napi, int budget)
        struct gfar_priv_rx_q *rx_queue = NULL;
        int work_done = 0, work_done_per_q = 0;
        int i, budget_per_q = 0;
-       int has_tx_work;
+       int has_tx_work = 0;
        unsigned long rstat_rxf;
        int num_act_queues;
 
@@ -2933,62 +2935,51 @@ static int gfar_poll(struct napi_struct *napi, int budget)
        if (num_act_queues)
                budget_per_q = budget/num_act_queues;
 
-       while (1) {
-               has_tx_work = 0;
-               for_each_set_bit(i, &gfargrp->tx_bit_map, priv->num_tx_queues) {
-                       tx_queue = priv->tx_queue[i];
-                       /* run Tx cleanup to completion */
-                       if (tx_queue->tx_skbuff[tx_queue->skb_dirtytx]) {
-                               gfar_clean_tx_ring(tx_queue);
-                               has_tx_work = 1;
-                       }
+       for_each_set_bit(i, &gfargrp->tx_bit_map, priv->num_tx_queues) {
+               tx_queue = priv->tx_queue[i];
+               /* run Tx cleanup to completion */
+               if (tx_queue->tx_skbuff[tx_queue->skb_dirtytx]) {
+                       gfar_clean_tx_ring(tx_queue);
+                       has_tx_work = 1;
                }
+       }
 
-               for_each_set_bit(i, &gfargrp->rx_bit_map, priv->num_rx_queues) {
-                       /* skip queue if not active */
-                       if (!(rstat_rxf & (RSTAT_CLEAR_RXF0 >> i)))
-                               continue;
-
-                       rx_queue = priv->rx_queue[i];
-                       work_done_per_q =
-                               gfar_clean_rx_ring(rx_queue, budget_per_q);
-                       work_done += work_done_per_q;
-
-                       /* finished processing this queue */
-                       if (work_done_per_q < budget_per_q) {
-                               /* clear active queue hw indication */
-                               gfar_write(&regs->rstat,
-                                          RSTAT_CLEAR_RXF0 >> i);
-                               rstat_rxf &= ~(RSTAT_CLEAR_RXF0 >> i);
-                               num_act_queues--;
-
-                               if (!num_act_queues)
-                                       break;
-                               /* recompute budget per Rx queue */
-                               budget_per_q =
-                                       (budget - work_done) / num_act_queues;
-                       }
-               }
+       for_each_set_bit(i, &gfargrp->rx_bit_map, priv->num_rx_queues) {
+               /* skip queue if not active */
+               if (!(rstat_rxf & (RSTAT_CLEAR_RXF0 >> i)))
+                       continue;
 
-               if (work_done >= budget)
-                       break;
+               rx_queue = priv->rx_queue[i];
+               work_done_per_q =
+                       gfar_clean_rx_ring(rx_queue, budget_per_q);
+               work_done += work_done_per_q;
+
+               /* finished processing this queue */
+               if (work_done_per_q < budget_per_q) {
+                       /* clear active queue hw indication */
+                       gfar_write(&regs->rstat,
+                                  RSTAT_CLEAR_RXF0 >> i);
+                       num_act_queues--;
+
+                       if (!num_act_queues)
+                               break;
+               }
+       }
 
-               if (!num_act_queues && !has_tx_work) {
+       if (!num_act_queues && !has_tx_work) {
 
-                       napi_complete(napi);
+               napi_complete(napi);
 
-                       /* Clear the halt bit in RSTAT */
-                       gfar_write(&regs->rstat, gfargrp->rstat);
+               /* Clear the halt bit in RSTAT */
+               gfar_write(&regs->rstat, gfargrp->rstat);
 
-                       gfar_write(&regs->imask, IMASK_DEFAULT);
+               gfar_write(&regs->imask, IMASK_DEFAULT);
 
-                       /* If we are coalescing interrupts, update the timer
-                        * Otherwise, clear it
-                        */
-                       gfar_configure_coalescing(priv, gfargrp->rx_bit_map,
-                                                 gfargrp->tx_bit_map);
-                       break;
-               }
+               /* If we are coalescing interrupts, update the timer
+                * Otherwise, clear it
+                */
+               gfar_configure_coalescing(priv, gfargrp->rx_bit_map,
+                                         gfargrp->tx_bit_map);
        }
 
        return work_done;