200-fix_gianfar_napi_poll.patch 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. --- a/drivers/net/ethernet/freescale/gianfar.c
  2. +++ b/drivers/net/ethernet/freescale/gianfar.c
  3. @@ -2835,7 +2835,7 @@ static int gfar_poll(struct napi_struct
  4. struct gfar_priv_rx_q *rx_queue = NULL;
  5. int work_done = 0, work_done_per_q = 0;
  6. int i, budget_per_q = 0;
  7. - int has_tx_work;
  8. + int has_tx_work = 0;
  9. unsigned long rstat_rxf;
  10. int num_act_queues;
  11. @@ -2850,62 +2850,48 @@ static int gfar_poll(struct napi_struct
  12. if (num_act_queues)
  13. budget_per_q = budget/num_act_queues;
  14. - while (1) {
  15. - has_tx_work = 0;
  16. - for_each_set_bit(i, &gfargrp->tx_bit_map, priv->num_tx_queues) {
  17. - tx_queue = priv->tx_queue[i];
  18. - /* run Tx cleanup to completion */
  19. - if (tx_queue->tx_skbuff[tx_queue->skb_dirtytx]) {
  20. - gfar_clean_tx_ring(tx_queue);
  21. - has_tx_work = 1;
  22. - }
  23. - }
  24. -
  25. - for_each_set_bit(i, &gfargrp->rx_bit_map, priv->num_rx_queues) {
  26. - /* skip queue if not active */
  27. - if (!(rstat_rxf & (RSTAT_CLEAR_RXF0 >> i)))
  28. - continue;
  29. -
  30. - rx_queue = priv->rx_queue[i];
  31. - work_done_per_q =
  32. - gfar_clean_rx_ring(rx_queue, budget_per_q);
  33. - work_done += work_done_per_q;
  34. -
  35. - /* finished processing this queue */
  36. - if (work_done_per_q < budget_per_q) {
  37. - /* clear active queue hw indication */
  38. - gfar_write(&regs->rstat,
  39. - RSTAT_CLEAR_RXF0 >> i);
  40. - rstat_rxf &= ~(RSTAT_CLEAR_RXF0 >> i);
  41. - num_act_queues--;
  42. -
  43. - if (!num_act_queues)
  44. - break;
  45. - /* recompute budget per Rx queue */
  46. - budget_per_q =
  47. - (budget - work_done) / num_act_queues;
  48. - }
  49. + for_each_set_bit(i, &gfargrp->tx_bit_map, priv->num_tx_queues) {
  50. + tx_queue = priv->tx_queue[i];
  51. + /* run Tx cleanup to completion */
  52. + if (tx_queue->tx_skbuff[tx_queue->skb_dirtytx]) {
  53. + gfar_clean_tx_ring(tx_queue);
  54. + has_tx_work = 1;
  55. }
  56. + }
  57. - if (work_done >= budget)
  58. - break;
  59. + for_each_set_bit(i, &gfargrp->rx_bit_map, priv->num_rx_queues) {
  60. + /* skip queue if not active */
  61. + if (!(rstat_rxf & (RSTAT_CLEAR_RXF0 >> i)))
  62. + continue;
  63. +
  64. + rx_queue = priv->rx_queue[i];
  65. + work_done_per_q = gfar_clean_rx_ring(rx_queue, budget_per_q);
  66. + work_done += work_done_per_q;
  67. +
  68. + /* finished processing this queue */
  69. + if (work_done_per_q < budget_per_q) {
  70. + /* clear active queue hw indication */
  71. + gfar_write(&regs->rstat, RSTAT_CLEAR_RXF0 >> i);
  72. + num_act_queues--;
  73. - if (!num_act_queues && !has_tx_work) {
  74. + if (!num_act_queues)
  75. + break;
  76. + }
  77. + }
  78. - napi_complete(napi);
  79. + if (!num_act_queues && !has_tx_work) {
  80. + napi_complete(napi);
  81. - /* Clear the halt bit in RSTAT */
  82. - gfar_write(&regs->rstat, gfargrp->rstat);
  83. + /* Clear the halt bit in RSTAT */
  84. + gfar_write(&regs->rstat, gfargrp->rstat);
  85. - gfar_write(&regs->imask, IMASK_DEFAULT);
  86. + gfar_write(&regs->imask, IMASK_DEFAULT);
  87. - /* If we are coalescing interrupts, update the timer
  88. - * Otherwise, clear it
  89. - */
  90. - gfar_configure_coalescing(priv, gfargrp->rx_bit_map,
  91. - gfargrp->tx_bit_map);
  92. - break;
  93. - }
  94. + /* If we are coalescing interrupts, update the timer
  95. + * Otherwise, clear it
  96. + */
  97. + gfar_configure_coalescing(priv, gfargrp->rx_bit_map,
  98. + gfargrp->tx_bit_map);
  99. }
  100. return work_done;