aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sky2.c
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@linux-foundation.org>2007-04-11 17:47:59 -0400
committerJeff Garzik <jeff@garzik.org>2007-04-19 15:01:17 -0400
commit40b01727a5a65597160f1738d3fbe63de902f0cb (patch)
treebdd854422122703257d5c25658201455f977abc0 /drivers/net/sky2.c
parent0a17e4c252ce951615f3c1fccae6d6262c8d4187 (diff)
sky2: handle descriptor errors
There should never be descriptor error unless hardware or driver is buggy. But if an error occurs, print useful information, clear irq, and recover. Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/sky2.c')
-rw-r--r--drivers/net/sky2.c67
1 files changed, 36 insertions, 31 deletions
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 98b1f3acff86..a2cc721a2bf5 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -2343,26 +2343,22 @@ static void sky2_mac_intr(struct sky2_hw *hw, unsigned port)
2343 } 2343 }
2344} 2344}
2345 2345
2346/* This should never happen it is a fatal situation */ 2346/* This should never happen it is a bug. */
2347static void sky2_descriptor_error(struct sky2_hw *hw, unsigned port, 2347static void sky2_le_error(struct sky2_hw *hw, unsigned port,
2348 const char *rxtx, u32 mask) 2348 u16 q, unsigned ring_size)
2349{ 2349{
2350 struct net_device *dev = hw->dev[port]; 2350 struct net_device *dev = hw->dev[port];
2351 struct sky2_port *sky2 = netdev_priv(dev); 2351 struct sky2_port *sky2 = netdev_priv(dev);
2352 u32 imask; 2352 unsigned idx;
2353 2353 const u64 *le = (q == Q_R1 || q == Q_R2)
2354 printk(KERN_ERR PFX "%s: %s descriptor error (hardware problem)\n", 2354 ? (u64 *) sky2->rx_le : (u64 *) sky2->tx_le;
2355 dev ? dev->name : "<not registered>", rxtx);
2356 2355
2357 imask = sky2_read32(hw, B0_IMSK); 2356 idx = sky2_read16(hw, Y2_QADDR(q, PREF_UNIT_GET_IDX));
2358 imask &= ~mask; 2357 printk(KERN_ERR PFX "%s: descriptor error q=%#x get=%u [%llx] put=%u\n",
2359 sky2_write32(hw, B0_IMSK, imask); 2358 dev->name, (unsigned) q, idx, (unsigned long long) le[idx],
2359 (unsigned) sky2_read16(hw, Y2_QADDR(q, PREF_UNIT_PUT_IDX)));
2360 2360
2361 if (dev) { 2361 sky2_write32(hw, Q_ADDR(q, Q_CSR), BMU_CLR_IRQ_CHK);
2362 spin_lock(&sky2->phy_lock);
2363 sky2_link_down(sky2);
2364 spin_unlock(&sky2->phy_lock);
2365 }
2366} 2362}
2367 2363
2368/* If idle then force a fake soft NAPI poll once a second 2364/* If idle then force a fake soft NAPI poll once a second
@@ -2386,23 +2382,15 @@ static void sky2_idle(unsigned long arg)
2386 mod_timer(&hw->idle_timer, jiffies + msecs_to_jiffies(idle_timeout)); 2382 mod_timer(&hw->idle_timer, jiffies + msecs_to_jiffies(idle_timeout));
2387} 2383}
2388 2384
2389 2385/* Hardware/software error handling */
2390static int sky2_poll(struct net_device *dev0, int *budget) 2386static void sky2_err_intr(struct sky2_hw *hw, u32 status)
2391{ 2387{
2392 struct sky2_hw *hw = ((struct sky2_port *) netdev_priv(dev0))->hw; 2388 if (net_ratelimit())
2393 int work_limit = min(dev0->quota, *budget); 2389 dev_warn(&hw->pdev->dev, "error interrupt status=%#x\n", status);
2394 int work_done = 0;
2395 u32 status = sky2_read32(hw, B0_Y2_SP_EISR);
2396 2390
2397 if (status & Y2_IS_HW_ERR) 2391 if (status & Y2_IS_HW_ERR)
2398 sky2_hw_intr(hw); 2392 sky2_hw_intr(hw);
2399 2393
2400 if (status & Y2_IS_IRQ_PHY1)
2401 sky2_phy_intr(hw, 0);
2402
2403 if (status & Y2_IS_IRQ_PHY2)
2404 sky2_phy_intr(hw, 1);
2405
2406 if (status & Y2_IS_IRQ_MAC1) 2394 if (status & Y2_IS_IRQ_MAC1)
2407 sky2_mac_intr(hw, 0); 2395 sky2_mac_intr(hw, 0);
2408 2396
@@ -2410,16 +2398,33 @@ static int sky2_poll(struct net_device *dev0, int *budget)
2410 sky2_mac_intr(hw, 1); 2398 sky2_mac_intr(hw, 1);
2411 2399
2412 if (status & Y2_IS_CHK_RX1) 2400 if (status & Y2_IS_CHK_RX1)
2413 sky2_descriptor_error(hw, 0, "receive", Y2_IS_CHK_RX1); 2401 sky2_le_error(hw, 0, Q_R1, RX_LE_SIZE);
2414 2402
2415 if (status & Y2_IS_CHK_RX2) 2403 if (status & Y2_IS_CHK_RX2)
2416 sky2_descriptor_error(hw, 1, "receive", Y2_IS_CHK_RX2); 2404 sky2_le_error(hw, 1, Q_R2, RX_LE_SIZE);
2417 2405
2418 if (status & Y2_IS_CHK_TXA1) 2406 if (status & Y2_IS_CHK_TXA1)
2419 sky2_descriptor_error(hw, 0, "transmit", Y2_IS_CHK_TXA1); 2407 sky2_le_error(hw, 0, Q_XA1, TX_RING_SIZE);
2420 2408
2421 if (status & Y2_IS_CHK_TXA2) 2409 if (status & Y2_IS_CHK_TXA2)
2422 sky2_descriptor_error(hw, 1, "transmit", Y2_IS_CHK_TXA2); 2410 sky2_le_error(hw, 1, Q_XA2, TX_RING_SIZE);
2411}
2412
2413static int sky2_poll(struct net_device *dev0, int *budget)
2414{
2415 struct sky2_hw *hw = ((struct sky2_port *) netdev_priv(dev0))->hw;
2416 int work_limit = min(dev0->quota, *budget);
2417 int work_done = 0;
2418 u32 status = sky2_read32(hw, B0_Y2_SP_EISR);
2419
2420 if (unlikely(status & Y2_IS_ERROR))
2421 sky2_err_intr(hw, status);
2422
2423 if (status & Y2_IS_IRQ_PHY1)
2424 sky2_phy_intr(hw, 0);
2425
2426 if (status & Y2_IS_IRQ_PHY2)
2427 sky2_phy_intr(hw, 1);
2423 2428
2424 work_done = sky2_status_intr(hw, work_limit); 2429 work_done = sky2_status_intr(hw, work_limit);
2425 if (work_done < work_limit) { 2430 if (work_done < work_limit) {