提交 734cbc36 编写于 作者: S Stephen Hemminger 提交者: Jeff Garzik

[PATCH] sky2: reschedule if irq still pending

This is a workaround for the case edge-triggered irq's. Several users
seem to have broken configurations sharing edge-triggered irq's. To avoid
losing IRQ's, reshedule if more work arrives.

The changes to netdevice.h are to extract the part that puts device
back in list into separate inline.
Signed-off-by: NStephen Hemminger <shemminger@osdl.org>
Signed-off-by: NJeff Garzik <jeff@garzik.org>
上级 3b908870
...@@ -2093,6 +2093,7 @@ static int sky2_poll(struct net_device *dev0, int *budget) ...@@ -2093,6 +2093,7 @@ static int sky2_poll(struct net_device *dev0, int *budget)
int work_done = 0; int work_done = 0;
u32 status = sky2_read32(hw, B0_Y2_SP_EISR); u32 status = sky2_read32(hw, B0_Y2_SP_EISR);
restart_poll:
if (unlikely(status & ~Y2_IS_STAT_BMU)) { if (unlikely(status & ~Y2_IS_STAT_BMU)) {
if (status & Y2_IS_HW_ERR) if (status & Y2_IS_HW_ERR)
sky2_hw_intr(hw); sky2_hw_intr(hw);
...@@ -2123,7 +2124,7 @@ static int sky2_poll(struct net_device *dev0, int *budget) ...@@ -2123,7 +2124,7 @@ static int sky2_poll(struct net_device *dev0, int *budget)
} }
if (status & Y2_IS_STAT_BMU) { if (status & Y2_IS_STAT_BMU) {
work_done = sky2_status_intr(hw, work_limit); work_done += sky2_status_intr(hw, work_limit - work_done);
*budget -= work_done; *budget -= work_done;
dev0->quota -= work_done; dev0->quota -= work_done;
...@@ -2133,9 +2134,22 @@ static int sky2_poll(struct net_device *dev0, int *budget) ...@@ -2133,9 +2134,22 @@ static int sky2_poll(struct net_device *dev0, int *budget)
sky2_write32(hw, STAT_CTRL, SC_STAT_CLR_IRQ); sky2_write32(hw, STAT_CTRL, SC_STAT_CLR_IRQ);
} }
netif_rx_complete(dev0); local_irq_disable();
__netif_rx_complete(dev0);
status = sky2_read32(hw, B0_Y2_SP_LISR); status = sky2_read32(hw, B0_Y2_SP_LISR);
if (unlikely(status)) {
/* More work pending, try and keep going */
if (__netif_rx_schedule_prep(dev0)) {
__netif_rx_reschedule(dev0, work_done);
status = sky2_read32(hw, B0_Y2_SP_EISR);
local_irq_enable();
goto restart_poll;
}
}
local_irq_enable();
return 0; return 0;
} }
...@@ -2153,8 +2167,6 @@ static irqreturn_t sky2_intr(int irq, void *dev_id, struct pt_regs *regs) ...@@ -2153,8 +2167,6 @@ static irqreturn_t sky2_intr(int irq, void *dev_id, struct pt_regs *regs)
prefetch(&hw->st_le[hw->st_idx]); prefetch(&hw->st_le[hw->st_idx]);
if (likely(__netif_rx_schedule_prep(dev0))) if (likely(__netif_rx_schedule_prep(dev0)))
__netif_rx_schedule(dev0); __netif_rx_schedule(dev0);
else
printk(KERN_DEBUG PFX "irq race detected\n");
return IRQ_HANDLED; return IRQ_HANDLED;
} }
......
...@@ -829,19 +829,21 @@ static inline void netif_rx_schedule(struct net_device *dev) ...@@ -829,19 +829,21 @@ static inline void netif_rx_schedule(struct net_device *dev)
__netif_rx_schedule(dev); __netif_rx_schedule(dev);
} }
/* Try to reschedule poll. Called by dev->poll() after netif_rx_complete().
* Do not inline this? static inline void __netif_rx_reschedule(struct net_device *dev, int undo)
*/ {
dev->quota += undo;
list_add_tail(&dev->poll_list, &__get_cpu_var(softnet_data).poll_list);
__raise_softirq_irqoff(NET_RX_SOFTIRQ);
}
/* Try to reschedule poll. Called by dev->poll() after netif_rx_complete(). */
static inline int netif_rx_reschedule(struct net_device *dev, int undo) static inline int netif_rx_reschedule(struct net_device *dev, int undo)
{ {
if (netif_rx_schedule_prep(dev)) { if (netif_rx_schedule_prep(dev)) {
unsigned long flags; unsigned long flags;
dev->quota += undo;
local_irq_save(flags); local_irq_save(flags);
list_add_tail(&dev->poll_list, &__get_cpu_var(softnet_data).poll_list); __netif_rx_reschedule(dev, undo);
__raise_softirq_irqoff(NET_RX_SOFTIRQ);
local_irq_restore(flags); local_irq_restore(flags);
return 1; return 1;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册