aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sky2.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2007-10-11 21:08:29 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-11 21:08:29 -0400
commit6f535763165331bb91277d7519b507fed22034e5 (patch)
tree1968a01affa1cce3a3199c455d1fe1ebdca3ff47 /drivers/net/sky2.c
parentb08d6cb22c777c8c91c16d8e3b8aafc93c98cbd9 (diff)
[NET]: Fix NAPI completion handling in some drivers.
In order for the list handling in net_rx_action() to be correct, drivers must follow certain rules as stated by this comment in net_rx_action(): /* Drivers must not modify the NAPI state if they * consume the entire weight. In such cases this code * still "owns" the NAPI instance and therefore can * move the instance around on the list at-will. */ A few drivers do not do this because they mix the budget checks with reading hardware state, resulting in crashes like the one reported by takano@axe-inc.co.jp. BNX2 and TG3 are taken care of here, SKY2 fix is from Stephen Hemminger. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/sky2.c')
-rw-r--r--drivers/net/sky2.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index fe0e7560d236..4e569fa0f96c 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -2606,7 +2606,7 @@ static int sky2_poll(struct napi_struct *napi, int work_limit)
2606{ 2606{
2607 struct sky2_hw *hw = container_of(napi, struct sky2_hw, napi); 2607 struct sky2_hw *hw = container_of(napi, struct sky2_hw, napi);
2608 u32 status = sky2_read32(hw, B0_Y2_SP_EISR); 2608 u32 status = sky2_read32(hw, B0_Y2_SP_EISR);
2609 int work_done; 2609 int work_done = 0;
2610 2610
2611 if (unlikely(status & Y2_IS_ERROR)) 2611 if (unlikely(status & Y2_IS_ERROR))
2612 sky2_err_intr(hw, status); 2612 sky2_err_intr(hw, status);
@@ -2617,10 +2617,16 @@ static int sky2_poll(struct napi_struct *napi, int work_limit)
2617 if (status & Y2_IS_IRQ_PHY2) 2617 if (status & Y2_IS_IRQ_PHY2)
2618 sky2_phy_intr(hw, 1); 2618 sky2_phy_intr(hw, 1);
2619 2619
2620 work_done = sky2_status_intr(hw, work_limit); 2620 for(;;) {
2621 work_done += sky2_status_intr(hw, work_limit);
2622
2623 if (work_done >= work_limit)
2624 break;
2625
2626 /* More work? */
2627 if (hw->st_idx != sky2_read16(hw, STAT_PUT_IDX))
2628 continue;
2621 2629
2622 /* More work? */
2623 if (hw->st_idx == sky2_read16(hw, STAT_PUT_IDX)) {
2624 /* Bug/Errata workaround? 2630 /* Bug/Errata workaround?
2625 * Need to kick the TX irq moderation timer. 2631 * Need to kick the TX irq moderation timer.
2626 */ 2632 */
@@ -2631,7 +2637,10 @@ static int sky2_poll(struct napi_struct *napi, int work_limit)
2631 2637
2632 napi_complete(napi); 2638 napi_complete(napi);
2633 sky2_read32(hw, B0_Y2_SP_LISR); 2639 sky2_read32(hw, B0_Y2_SP_LISR);
2640 break;
2641
2634 } 2642 }
2643
2635 return work_done; 2644 return work_done;
2636} 2645}
2637 2646