[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4C1740923F034ABB8BFCC03E69B8E3AC@hobbes>
Date: Thu, 16 Apr 2009 11:41:57 -0700
From: "Gerard Kam" <gerardk5@...izon.net>
To: "'Haavard Skinnemoen'" <haavard.skinnemoen@...el.com>,
<netdev@...r.kernel.org>
Cc: "'Nicolas Ferre'" <nicolas.ferre@...el.com>,
"'Erik Waling'" <erik.waling@...ftel.com>
Subject: RE: [PATCH 2/2] macb: process the RX ring regardless of interrupt status
Hi there
> From: netdev-owner@...r.kernel.org [mailto:netdev-owner@...r.kernel.org]
> Sent: Thursday, April 16, 2009 2:32 AM
> Fix this by scanning the ring no matter what flags are set in the
> interrupt status register.
I've been using a similar patch to macb, however, it's to fix an issue with
rotting packets. I'm using kernel 2.6.25, and haven't updated this patch to
a more recent kernel version. Patch was developed with input from Travis
Stratman, tstratman@...cinc.com.
Fix for RX rotting packets.
diff -pruN a/drivers/net/macb.c b/drivers/net/macb.c
--- a/drivers/net/macb.c 2008-05-18 22:21:53.000000000 -0700
+++ b/drivers/net/macb.c 2008-08-28 11:36:42.000000000 -0700
@@ -508,40 +508,29 @@ static int macb_poll(struct napi_struct
u32 status;
status = macb_readl(bp, RSR);
- macb_writel(bp, RSR, status);
-
- work_done = 0;
- if (!status) {
- /*
- * This may happen if an interrupt was pending before
- * this function was called last time, and no packets
- * have been received since.
- */
- netif_rx_complete(dev, napi);
- goto out;
- }
+ macb_writel(bp, RSR, status); /* not atomic read-clear! */
dev_dbg(&bp->pdev->dev, "poll: status = %08lx, budget = %d\n",
(unsigned long)status, budget);
- if (!(status & MACB_BIT(REC))) {
- dev_warn(&bp->pdev->dev,
- "No RX buffers complete, status = %02lx\n",
- (unsigned long)status);
- netif_rx_complete(dev, napi);
- goto out;
- }
-
work_done = macb_rx(bp, budget);
- if (work_done < budget)
+ if ((work_done < budget) && !macb_readl(bp, RSR)) {
+ /*
+ * We've done what we can to clean the buffers.
+ * Make sure there's no new RX activity during transition
+ * from poll mode back to interrupt mode.
+ */
netif_rx_complete(dev, napi);
-
- /*
- * We've done what we can to clean the buffers. Make sure we
- * get notified when new packets arrive.
- */
-out:
- macb_writel(bp, IER, MACB_RX_INT_FLAGS);
+ macb_writel(bp, IER, MACB_RX_INT_FLAGS);
+ status = macb_readl(bp, RSR);
+ if (status) {
+ /* new RX, undo the polling-done operations */
+ macb_writel(bp, IDR, MACB_RX_INT_FLAGS);
+ netif_rx_reschedule(dev, napi);
+ dev_dbg(&bp->pdev->dev, "poll: undo status =
%08lx\n",
+ (unsigned long)status);
+ }
+ }
/* TODO: Handle errors */
@@ -554,7 +543,7 @@ static irqreturn_t macb_interrupt(int ir
struct macb *bp = netdev_priv(dev);
u32 status;
- status = macb_readl(bp, ISR);
+ status = macb_readl(bp, ISR) & ~macb_readl(bp, IMR);
if (unlikely(!status))
return IRQ_NONE;
@@ -578,7 +567,9 @@ static irqreturn_t macb_interrupt(int ir
dev_dbg(&bp->pdev->dev,
"scheduling RX softirq\n");
__netif_rx_schedule(dev, &bp->napi);
- }
+ } else
+ printk(KERN_ERR "%s: sched RX poll
failed\n",
+ dev->name);
}
if (status & (MACB_BIT(TCOMP) | MACB_BIT(ISR_TUND)))
@@ -598,7 +589,7 @@ static irqreturn_t macb_interrupt(int ir
dev->name);
}
- status = macb_readl(bp, ISR);
+ status = macb_readl(bp, ISR) & ~macb_readl(bp, IMR);
}
spin_unlock(&bp->lock);
--
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists