diff options
author | Stephen Hemminger <shemminger@vyatta.com> | 2009-08-18 11:17:07 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-08-18 23:26:47 -0400 |
commit | c119731d6606ae25d787740d60706e2732454637 (patch) | |
tree | 0819755e251de0e2d6fcbff0ca0a12ee8c26f957 /drivers/net/sky2.c | |
parent | 5dce95e5687a5a335202b03d133c1b4411ef7ce3 (diff) |
sky2: simplify list element error
The code for list element error (which should only happen on hardware
errors) should be cleaner and safer. Gets rid of unused ring_size
argument, which makes next patch easier.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/sky2.c')
-rw-r--r-- | drivers/net/sky2.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index 88041e578870..58d35214d12d 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
@@ -2661,19 +2661,15 @@ static void sky2_mac_intr(struct sky2_hw *hw, unsigned port) | |||
2661 | } | 2661 | } |
2662 | 2662 | ||
2663 | /* This should never happen it is a bug. */ | 2663 | /* This should never happen it is a bug. */ |
2664 | static void sky2_le_error(struct sky2_hw *hw, unsigned port, | 2664 | static void sky2_le_error(struct sky2_hw *hw, unsigned port, u16 q) |
2665 | u16 q, unsigned ring_size) | ||
2666 | { | 2665 | { |
2667 | struct net_device *dev = hw->dev[port]; | 2666 | struct net_device *dev = hw->dev[port]; |
2668 | struct sky2_port *sky2 = netdev_priv(dev); | 2667 | u16 idx = sky2_read16(hw, Y2_QADDR(q, PREF_UNIT_GET_IDX)); |
2669 | unsigned idx; | ||
2670 | const u64 *le = (q == Q_R1 || q == Q_R2) | ||
2671 | ? (u64 *) sky2->rx_le : (u64 *) sky2->tx_le; | ||
2672 | 2668 | ||
2673 | idx = sky2_read16(hw, Y2_QADDR(q, PREF_UNIT_GET_IDX)); | 2669 | dev_err(&hw->pdev->dev, PFX |
2674 | printk(KERN_ERR PFX "%s: descriptor error q=%#x get=%u [%llx] put=%u\n", | 2670 | "%s: descriptor error q=%#x get=%u put=%u\n", |
2675 | dev->name, (unsigned) q, idx, (unsigned long long) le[idx], | 2671 | dev->name, (unsigned) q, (unsigned) idx, |
2676 | (unsigned) sky2_read16(hw, Y2_QADDR(q, PREF_UNIT_PUT_IDX))); | 2672 | (unsigned) sky2_read16(hw, Y2_QADDR(q, PREF_UNIT_PUT_IDX))); |
2677 | 2673 | ||
2678 | sky2_write32(hw, Q_ADDR(q, Q_CSR), BMU_CLR_IRQ_CHK); | 2674 | sky2_write32(hw, Q_ADDR(q, Q_CSR), BMU_CLR_IRQ_CHK); |
2679 | } | 2675 | } |
@@ -2759,16 +2755,16 @@ static void sky2_err_intr(struct sky2_hw *hw, u32 status) | |||
2759 | sky2_mac_intr(hw, 1); | 2755 | sky2_mac_intr(hw, 1); |
2760 | 2756 | ||
2761 | if (status & Y2_IS_CHK_RX1) | 2757 | if (status & Y2_IS_CHK_RX1) |
2762 | sky2_le_error(hw, 0, Q_R1, RX_LE_SIZE); | 2758 | sky2_le_error(hw, 0, Q_R1); |
2763 | 2759 | ||
2764 | if (status & Y2_IS_CHK_RX2) | 2760 | if (status & Y2_IS_CHK_RX2) |
2765 | sky2_le_error(hw, 1, Q_R2, RX_LE_SIZE); | 2761 | sky2_le_error(hw, 1, Q_R2); |
2766 | 2762 | ||
2767 | if (status & Y2_IS_CHK_TXA1) | 2763 | if (status & Y2_IS_CHK_TXA1) |
2768 | sky2_le_error(hw, 0, Q_XA1, TX_RING_SIZE); | 2764 | sky2_le_error(hw, 0, Q_XA1); |
2769 | 2765 | ||
2770 | if (status & Y2_IS_CHK_TXA2) | 2766 | if (status & Y2_IS_CHK_TXA2) |
2771 | sky2_le_error(hw, 1, Q_XA2, TX_RING_SIZE); | 2767 | sky2_le_error(hw, 1, Q_XA2); |
2772 | } | 2768 | } |
2773 | 2769 | ||
2774 | static int sky2_poll(struct napi_struct *napi, int work_limit) | 2770 | static int sky2_poll(struct napi_struct *napi, int work_limit) |