Skip to content

Commit

Permalink
skge: NAPI/irq race fix
Browse files Browse the repository at this point in the history
Fix a race in the receive NAPI, irq handling. The interrupt clear and the
start need to be separated.  Otherwise there is a window between the last
frame received and the NAPI done level handling.

Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
  • Loading branch information
Stephen Hemminger authored and Francois Romieu committed Feb 23, 2006
1 parent 61a4dcc commit a9cdab8
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions drivers/net/skge.c
Original file line number Diff line number Diff line change
Expand Up @@ -2678,8 +2678,7 @@ static int skge_poll(struct net_device *dev, int *budget)

/* restart receiver */
wmb();
skge_write8(hw, Q_ADDR(rxqaddr[skge->port], Q_CSR),
CSR_START | CSR_IRQ_CL_F);
skge_write8(hw, Q_ADDR(rxqaddr[skge->port], Q_CSR), CSR_START);

*budget -= work_done;
dev->quota -= work_done;
Expand Down Expand Up @@ -2856,14 +2855,6 @@ static void skge_extirq(unsigned long data)
local_irq_enable();
}

static inline void skge_wakeup(struct net_device *dev)
{
struct skge_port *skge = netdev_priv(dev);

prefetch(skge->rx_ring.to_clean);
netif_rx_schedule(dev);
}

static irqreturn_t skge_intr(int irq, void *dev_id, struct pt_regs *regs)
{
struct skge_hw *hw = dev_id;
Expand All @@ -2874,13 +2865,15 @@ static irqreturn_t skge_intr(int irq, void *dev_id, struct pt_regs *regs)

status &= hw->intr_mask;
if (status & IS_R1_F) {
skge_write8(hw, Q_ADDR(Q_R1, Q_CSR), CSR_IRQ_CL_F);
hw->intr_mask &= ~IS_R1_F;
skge_wakeup(hw->dev[0]);
netif_rx_schedule(hw->dev[0]);
}

if (status & IS_R2_F) {
skge_write8(hw, Q_ADDR(Q_R2, Q_CSR), CSR_IRQ_CL_F);
hw->intr_mask &= ~IS_R2_F;
skge_wakeup(hw->dev[1]);
netif_rx_schedule(hw->dev[1]);
}

if (status & IS_XA1_F)
Expand Down

0 comments on commit a9cdab8

Please sign in to comment.