diff options
| author | Mark Brown <broonie@sirena.org.uk> | 2006-02-01 19:00:02 -0500 |
|---|---|---|
| committer | Jeff Garzik <jeff@garzik.org> | 2006-03-04 12:14:56 -0500 |
| commit | e72fd96e8ee3ff4dd80757172a4fe49bd92fea9c (patch) | |
| tree | 2b544e905888845f7115c3302156119ac627d340 | |
| parent | b27a16b7c4738ea16f6f0730caf382a3f57317bb (diff) | |
[PATCH] natsemi: NAPI and a bugfix
As documented in National application note 1287 the RX state machine on
the natsemi chip can lock up under some conditions (mostly related to
heavy load). When this happens a series of bogus packets are reported
by the chip including some oversized frames prior to the final lockup.
This patch implements the fix from the application note: when an
oversized packet is reported it resets the RX state machine, dropping
any currently pending packets.
Signed-off-by: Mark Brown <broonie@sirena.org.uk>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
| -rw-r--r-- | drivers/net/natsemi.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c index e363f9bb35ea..8d4999837b65 100644 --- a/drivers/net/natsemi.c +++ b/drivers/net/natsemi.c | |||
| @@ -1498,6 +1498,31 @@ static void natsemi_reset(struct net_device *dev) | |||
| 1498 | writel(rfcr, ioaddr + RxFilterAddr); | 1498 | writel(rfcr, ioaddr + RxFilterAddr); |
| 1499 | } | 1499 | } |
| 1500 | 1500 | ||
| 1501 | static void reset_rx(struct net_device *dev) | ||
| 1502 | { | ||
| 1503 | int i; | ||
| 1504 | struct netdev_private *np = netdev_priv(dev); | ||
| 1505 | void __iomem *ioaddr = ns_ioaddr(dev); | ||
| 1506 | |||
| 1507 | np->intr_status &= ~RxResetDone; | ||
| 1508 | |||
| 1509 | writel(RxReset, ioaddr + ChipCmd); | ||
| 1510 | |||
| 1511 | for (i=0;i<NATSEMI_HW_TIMEOUT;i++) { | ||
| 1512 | np->intr_status |= readl(ioaddr + IntrStatus); | ||
| 1513 | if (np->intr_status & RxResetDone) | ||
| 1514 | break; | ||
| 1515 | udelay(15); | ||
| 1516 | } | ||
| 1517 | if (i==NATSEMI_HW_TIMEOUT) { | ||
| 1518 | printk(KERN_WARNING "%s: RX reset did not complete in %d usec.\n", | ||
| 1519 | dev->name, i*15); | ||
| 1520 | } else if (netif_msg_hw(np)) { | ||
| 1521 | printk(KERN_WARNING "%s: RX reset took %d usec.\n", | ||
| 1522 | dev->name, i*15); | ||
| 1523 | } | ||
| 1524 | } | ||
| 1525 | |||
| 1501 | static void natsemi_reload_eeprom(struct net_device *dev) | 1526 | static void natsemi_reload_eeprom(struct net_device *dev) |
| 1502 | { | 1527 | { |
| 1503 | struct netdev_private *np = netdev_priv(dev); | 1528 | struct netdev_private *np = netdev_priv(dev); |
| @@ -2292,6 +2317,23 @@ static void netdev_rx(struct net_device *dev, int *work_done, int work_to_do) | |||
| 2292 | "status %#08x.\n", dev->name, | 2317 | "status %#08x.\n", dev->name, |
| 2293 | np->cur_rx, desc_status); | 2318 | np->cur_rx, desc_status); |
| 2294 | np->stats.rx_length_errors++; | 2319 | np->stats.rx_length_errors++; |
| 2320 | |||
| 2321 | /* The RX state machine has probably | ||
| 2322 | * locked up beneath us. Follow the | ||
| 2323 | * reset procedure documented in | ||
| 2324 | * AN-1287. */ | ||
| 2325 | |||
| 2326 | spin_lock_irq(&np->lock); | ||
| 2327 | reset_rx(dev); | ||
| 2328 | reinit_rx(dev); | ||
| 2329 | writel(np->ring_dma, ioaddr + RxRingPtr); | ||
| 2330 | check_link(dev); | ||
| 2331 | spin_unlock_irq(&np->lock); | ||
| 2332 | |||
| 2333 | /* We'll enable RX on exit from this | ||
| 2334 | * function. */ | ||
| 2335 | break; | ||
| 2336 | |||
| 2295 | } else { | 2337 | } else { |
| 2296 | /* There was an error. */ | 2338 | /* There was an error. */ |
| 2297 | np->stats.rx_errors++; | 2339 | np->stats.rx_errors++; |
