diff options
author | Stephen Hemminger <shemminger@linux-foundation.org> | 2007-10-16 15:15:52 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-10-16 21:10:28 -0400 |
commit | da00772fb587841fb1aac57a9edb5e10f2757967 (patch) | |
tree | aa72927391fae45901eb25920d799f7b8ff25cb3 /drivers/net/skge.c | |
parent | 501fb72d052d2a302b423bef7dec98d9d98c8a36 (diff) |
skge: internal stats
Use internal stats structure
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/skge.c')
-rw-r--r-- | drivers/net/skge.c | 52 |
1 files changed, 24 insertions, 28 deletions
diff --git a/drivers/net/skge.c b/drivers/net/skge.c index 180e82f85ac8..a439d4304458 100644 --- a/drivers/net/skge.c +++ b/drivers/net/skge.c | |||
@@ -445,15 +445,15 @@ static struct net_device_stats *skge_get_stats(struct net_device *dev) | |||
445 | else | 445 | else |
446 | yukon_get_stats(skge, data); | 446 | yukon_get_stats(skge, data); |
447 | 447 | ||
448 | skge->net_stats.tx_bytes = data[0]; | 448 | dev->stats.tx_bytes = data[0]; |
449 | skge->net_stats.rx_bytes = data[1]; | 449 | dev->stats.rx_bytes = data[1]; |
450 | skge->net_stats.tx_packets = data[2] + data[4] + data[6]; | 450 | dev->stats.tx_packets = data[2] + data[4] + data[6]; |
451 | skge->net_stats.rx_packets = data[3] + data[5] + data[7]; | 451 | dev->stats.rx_packets = data[3] + data[5] + data[7]; |
452 | skge->net_stats.multicast = data[3] + data[5]; | 452 | dev->stats.multicast = data[3] + data[5]; |
453 | skge->net_stats.collisions = data[10]; | 453 | dev->stats.collisions = data[10]; |
454 | skge->net_stats.tx_aborted_errors = data[12]; | 454 | dev->stats.tx_aborted_errors = data[12]; |
455 | 455 | ||
456 | return &skge->net_stats; | 456 | return &dev->stats; |
457 | } | 457 | } |
458 | 458 | ||
459 | static void skge_get_strings(struct net_device *dev, u32 stringset, u8 *data) | 459 | static void skge_get_strings(struct net_device *dev, u32 stringset, u8 *data) |
@@ -1684,12 +1684,13 @@ static void genesis_get_stats(struct skge_port *skge, u64 *data) | |||
1684 | 1684 | ||
1685 | static void genesis_mac_intr(struct skge_hw *hw, int port) | 1685 | static void genesis_mac_intr(struct skge_hw *hw, int port) |
1686 | { | 1686 | { |
1687 | struct skge_port *skge = netdev_priv(hw->dev[port]); | 1687 | struct net_device *dev = hw->dev[port]; |
1688 | struct skge_port *skge = netdev_priv(dev); | ||
1688 | u16 status = xm_read16(hw, port, XM_ISRC); | 1689 | u16 status = xm_read16(hw, port, XM_ISRC); |
1689 | 1690 | ||
1690 | if (netif_msg_intr(skge)) | 1691 | if (netif_msg_intr(skge)) |
1691 | printk(KERN_DEBUG PFX "%s: mac interrupt status 0x%x\n", | 1692 | printk(KERN_DEBUG PFX "%s: mac interrupt status 0x%x\n", |
1692 | skge->netdev->name, status); | 1693 | dev->name, status); |
1693 | 1694 | ||
1694 | if (hw->phy_type == SK_PHY_XMAC && (status & XM_IS_INP_ASS)) { | 1695 | if (hw->phy_type == SK_PHY_XMAC && (status & XM_IS_INP_ASS)) { |
1695 | xm_link_down(hw, port); | 1696 | xm_link_down(hw, port); |
@@ -1698,12 +1699,12 @@ static void genesis_mac_intr(struct skge_hw *hw, int port) | |||
1698 | 1699 | ||
1699 | if (status & XM_IS_TXF_UR) { | 1700 | if (status & XM_IS_TXF_UR) { |
1700 | xm_write32(hw, port, XM_MODE, XM_MD_FTF); | 1701 | xm_write32(hw, port, XM_MODE, XM_MD_FTF); |
1701 | ++skge->net_stats.tx_fifo_errors; | 1702 | ++dev->stats.tx_fifo_errors; |
1702 | } | 1703 | } |
1703 | 1704 | ||
1704 | if (status & XM_IS_RXF_OV) { | 1705 | if (status & XM_IS_RXF_OV) { |
1705 | xm_write32(hw, port, XM_MODE, XM_MD_FRF); | 1706 | xm_write32(hw, port, XM_MODE, XM_MD_FRF); |
1706 | ++skge->net_stats.rx_fifo_errors; | 1707 | ++dev->stats.rx_fifo_errors; |
1707 | } | 1708 | } |
1708 | } | 1709 | } |
1709 | 1710 | ||
@@ -2200,12 +2201,12 @@ static void yukon_mac_intr(struct skge_hw *hw, int port) | |||
2200 | dev->name, status); | 2201 | dev->name, status); |
2201 | 2202 | ||
2202 | if (status & GM_IS_RX_FF_OR) { | 2203 | if (status & GM_IS_RX_FF_OR) { |
2203 | ++skge->net_stats.rx_fifo_errors; | 2204 | ++dev->stats.rx_fifo_errors; |
2204 | skge_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_CLI_RX_FO); | 2205 | skge_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_CLI_RX_FO); |
2205 | } | 2206 | } |
2206 | 2207 | ||
2207 | if (status & GM_IS_TX_FF_UR) { | 2208 | if (status & GM_IS_TX_FF_UR) { |
2208 | ++skge->net_stats.tx_fifo_errors; | 2209 | ++dev->stats.tx_fifo_errors; |
2209 | skge_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_CLI_TX_FU); | 2210 | skge_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_CLI_TX_FU); |
2210 | } | 2211 | } |
2211 | 2212 | ||
@@ -3039,18 +3040,18 @@ error: | |||
3039 | 3040 | ||
3040 | if (skge->hw->chip_id == CHIP_ID_GENESIS) { | 3041 | if (skge->hw->chip_id == CHIP_ID_GENESIS) { |
3041 | if (status & (XMR_FS_RUNT|XMR_FS_LNG_ERR)) | 3042 | if (status & (XMR_FS_RUNT|XMR_FS_LNG_ERR)) |
3042 | skge->net_stats.rx_length_errors++; | 3043 | dev->stats.rx_length_errors++; |
3043 | if (status & XMR_FS_FRA_ERR) | 3044 | if (status & XMR_FS_FRA_ERR) |
3044 | skge->net_stats.rx_frame_errors++; | 3045 | dev->stats.rx_frame_errors++; |
3045 | if (status & XMR_FS_FCS_ERR) | 3046 | if (status & XMR_FS_FCS_ERR) |
3046 | skge->net_stats.rx_crc_errors++; | 3047 | dev->stats.rx_crc_errors++; |
3047 | } else { | 3048 | } else { |
3048 | if (status & (GMR_FS_LONG_ERR|GMR_FS_UN_SIZE)) | 3049 | if (status & (GMR_FS_LONG_ERR|GMR_FS_UN_SIZE)) |
3049 | skge->net_stats.rx_length_errors++; | 3050 | dev->stats.rx_length_errors++; |
3050 | if (status & GMR_FS_FRAGMENT) | 3051 | if (status & GMR_FS_FRAGMENT) |
3051 | skge->net_stats.rx_frame_errors++; | 3052 | dev->stats.rx_frame_errors++; |
3052 | if (status & GMR_FS_CRC_ERR) | 3053 | if (status & GMR_FS_CRC_ERR) |
3053 | skge->net_stats.rx_crc_errors++; | 3054 | dev->stats.rx_crc_errors++; |
3054 | } | 3055 | } |
3055 | 3056 | ||
3056 | resubmit: | 3057 | resubmit: |
@@ -3148,10 +3149,7 @@ static void skge_mac_parity(struct skge_hw *hw, int port) | |||
3148 | { | 3149 | { |
3149 | struct net_device *dev = hw->dev[port]; | 3150 | struct net_device *dev = hw->dev[port]; |
3150 | 3151 | ||
3151 | if (dev) { | 3152 | ++dev->stats.tx_heartbeat_errors; |
3152 | struct skge_port *skge = netdev_priv(dev); | ||
3153 | ++skge->net_stats.tx_heartbeat_errors; | ||
3154 | } | ||
3155 | 3153 | ||
3156 | if (hw->chip_id == CHIP_ID_GENESIS) | 3154 | if (hw->chip_id == CHIP_ID_GENESIS) |
3157 | skge_write16(hw, SK_REG(port, TX_MFF_CTRL1), | 3155 | skge_write16(hw, SK_REG(port, TX_MFF_CTRL1), |
@@ -3304,9 +3302,7 @@ static irqreturn_t skge_intr(int irq, void *dev_id) | |||
3304 | skge_write16(hw, B3_PA_CTRL, PA_CLR_TO_TX1); | 3302 | skge_write16(hw, B3_PA_CTRL, PA_CLR_TO_TX1); |
3305 | 3303 | ||
3306 | if (status & IS_PA_TO_RX1) { | 3304 | if (status & IS_PA_TO_RX1) { |
3307 | struct skge_port *skge = netdev_priv(hw->dev[0]); | 3305 | ++hw->dev[0]->stats.rx_over_errors; |
3308 | |||
3309 | ++skge->net_stats.rx_over_errors; | ||
3310 | skge_write16(hw, B3_PA_CTRL, PA_CLR_TO_RX1); | 3306 | skge_write16(hw, B3_PA_CTRL, PA_CLR_TO_RX1); |
3311 | } | 3307 | } |
3312 | 3308 | ||
@@ -3323,7 +3319,7 @@ static irqreturn_t skge_intr(int irq, void *dev_id) | |||
3323 | } | 3319 | } |
3324 | 3320 | ||
3325 | if (status & IS_PA_TO_RX2) { | 3321 | if (status & IS_PA_TO_RX2) { |
3326 | ++skge->net_stats.rx_over_errors; | 3322 | ++hw->dev[1]->stats.rx_over_errors; |
3327 | skge_write16(hw, B3_PA_CTRL, PA_CLR_TO_RX2); | 3323 | skge_write16(hw, B3_PA_CTRL, PA_CLR_TO_RX2); |
3328 | } | 3324 | } |
3329 | 3325 | ||