diff options
author | Stephen Hemminger <shemminger@linux-foundation.org> | 2007-10-11 22:48:22 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-12 01:17:19 -0400 |
commit | 7138a0f591b0aac3b9117e68db46903606a97b0c (patch) | |
tree | 0a43923c7cba19c0a59599001051b76ffe383bf4 /drivers/net | |
parent | df3fe1f318b226453b8dc48622c2b6eb78d75dbb (diff) |
[SKY2]: use netdevice stats struct
Use builtin statistics structure from net device.
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/sky2.c | 33 | ||||
-rw-r--r-- | drivers/net/sky2.h | 2 |
2 files changed, 13 insertions, 22 deletions
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index 55cda58bf59f..93655efae50b 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
@@ -1635,8 +1635,8 @@ static void sky2_tx_complete(struct sky2_port *sky2, u16 done) | |||
1635 | printk(KERN_DEBUG "%s: tx done %u\n", | 1635 | printk(KERN_DEBUG "%s: tx done %u\n", |
1636 | dev->name, idx); | 1636 | dev->name, idx); |
1637 | 1637 | ||
1638 | sky2->net_stats.tx_packets++; | 1638 | dev->stats.tx_packets++; |
1639 | sky2->net_stats.tx_bytes += re->skb->len; | 1639 | dev->stats.tx_bytes += re->skb->len; |
1640 | 1640 | ||
1641 | dev_kfree_skb_any(re->skb); | 1641 | dev_kfree_skb_any(re->skb); |
1642 | sky2->tx_next = RING_NEXT(idx, TX_RING_SIZE); | 1642 | sky2->tx_next = RING_NEXT(idx, TX_RING_SIZE); |
@@ -2204,16 +2204,16 @@ resubmit: | |||
2204 | len_error: | 2204 | len_error: |
2205 | /* Truncation of overlength packets | 2205 | /* Truncation of overlength packets |
2206 | causes PHY length to not match MAC length */ | 2206 | causes PHY length to not match MAC length */ |
2207 | ++sky2->net_stats.rx_length_errors; | 2207 | ++dev->stats.rx_length_errors; |
2208 | if (netif_msg_rx_err(sky2) && net_ratelimit()) | 2208 | if (netif_msg_rx_err(sky2) && net_ratelimit()) |
2209 | pr_info(PFX "%s: rx length error: status %#x length %d\n", | 2209 | pr_info(PFX "%s: rx length error: status %#x length %d\n", |
2210 | dev->name, status, length); | 2210 | dev->name, status, length); |
2211 | goto resubmit; | 2211 | goto resubmit; |
2212 | 2212 | ||
2213 | error: | 2213 | error: |
2214 | ++sky2->net_stats.rx_errors; | 2214 | ++dev->stats.rx_errors; |
2215 | if (status & GMR_FS_RX_FF_OV) { | 2215 | if (status & GMR_FS_RX_FF_OV) { |
2216 | sky2->net_stats.rx_over_errors++; | 2216 | dev->stats.rx_over_errors++; |
2217 | goto resubmit; | 2217 | goto resubmit; |
2218 | } | 2218 | } |
2219 | 2219 | ||
@@ -2222,11 +2222,11 @@ error: | |||
2222 | dev->name, status, length); | 2222 | dev->name, status, length); |
2223 | 2223 | ||
2224 | if (status & (GMR_FS_LONG_ERR | GMR_FS_UN_SIZE)) | 2224 | if (status & (GMR_FS_LONG_ERR | GMR_FS_UN_SIZE)) |
2225 | sky2->net_stats.rx_length_errors++; | 2225 | dev->stats.rx_length_errors++; |
2226 | if (status & GMR_FS_FRAGMENT) | 2226 | if (status & GMR_FS_FRAGMENT) |
2227 | sky2->net_stats.rx_frame_errors++; | 2227 | dev->stats.rx_frame_errors++; |
2228 | if (status & GMR_FS_CRC_ERR) | 2228 | if (status & GMR_FS_CRC_ERR) |
2229 | sky2->net_stats.rx_crc_errors++; | 2229 | dev->stats.rx_crc_errors++; |
2230 | 2230 | ||
2231 | goto resubmit; | 2231 | goto resubmit; |
2232 | } | 2232 | } |
@@ -2271,7 +2271,7 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do, u16 idx) | |||
2271 | ++rx[port]; | 2271 | ++rx[port]; |
2272 | skb = sky2_receive(dev, length, status); | 2272 | skb = sky2_receive(dev, length, status); |
2273 | if (unlikely(!skb)) { | 2273 | if (unlikely(!skb)) { |
2274 | sky2->net_stats.rx_dropped++; | 2274 | dev->stats.rx_dropped++; |
2275 | break; | 2275 | break; |
2276 | } | 2276 | } |
2277 | 2277 | ||
@@ -2286,8 +2286,8 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do, u16 idx) | |||
2286 | } | 2286 | } |
2287 | 2287 | ||
2288 | skb->protocol = eth_type_trans(skb, dev); | 2288 | skb->protocol = eth_type_trans(skb, dev); |
2289 | sky2->net_stats.rx_packets++; | 2289 | dev->stats.rx_packets++; |
2290 | sky2->net_stats.rx_bytes += skb->len; | 2290 | dev->stats.rx_bytes += skb->len; |
2291 | dev->last_rx = jiffies; | 2291 | dev->last_rx = jiffies; |
2292 | 2292 | ||
2293 | #ifdef SKY2_VLAN_TAG_USED | 2293 | #ifdef SKY2_VLAN_TAG_USED |
@@ -2478,12 +2478,12 @@ static void sky2_mac_intr(struct sky2_hw *hw, unsigned port) | |||
2478 | gma_read16(hw, port, GM_TX_IRQ_SRC); | 2478 | gma_read16(hw, port, GM_TX_IRQ_SRC); |
2479 | 2479 | ||
2480 | if (status & GM_IS_RX_FF_OR) { | 2480 | if (status & GM_IS_RX_FF_OR) { |
2481 | ++sky2->net_stats.rx_fifo_errors; | 2481 | ++dev->stats.rx_fifo_errors; |
2482 | sky2_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_CLI_RX_FO); | 2482 | sky2_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_CLI_RX_FO); |
2483 | } | 2483 | } |
2484 | 2484 | ||
2485 | if (status & GM_IS_TX_FF_UR) { | 2485 | if (status & GM_IS_TX_FF_UR) { |
2486 | ++sky2->net_stats.tx_fifo_errors; | 2486 | ++dev->stats.tx_fifo_errors; |
2487 | sky2_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_CLI_TX_FU); | 2487 | sky2_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_CLI_TX_FU); |
2488 | } | 2488 | } |
2489 | } | 2489 | } |
@@ -3222,12 +3222,6 @@ static void sky2_get_strings(struct net_device *dev, u32 stringset, u8 * data) | |||
3222 | } | 3222 | } |
3223 | } | 3223 | } |
3224 | 3224 | ||
3225 | static struct net_device_stats *sky2_get_stats(struct net_device *dev) | ||
3226 | { | ||
3227 | struct sky2_port *sky2 = netdev_priv(dev); | ||
3228 | return &sky2->net_stats; | ||
3229 | } | ||
3230 | |||
3231 | static int sky2_set_mac_address(struct net_device *dev, void *p) | 3225 | static int sky2_set_mac_address(struct net_device *dev, void *p) |
3232 | { | 3226 | { |
3233 | struct sky2_port *sky2 = netdev_priv(dev); | 3227 | struct sky2_port *sky2 = netdev_priv(dev); |
@@ -3977,7 +3971,6 @@ static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw, | |||
3977 | dev->stop = sky2_down; | 3971 | dev->stop = sky2_down; |
3978 | dev->do_ioctl = sky2_ioctl; | 3972 | dev->do_ioctl = sky2_ioctl; |
3979 | dev->hard_start_xmit = sky2_xmit_frame; | 3973 | dev->hard_start_xmit = sky2_xmit_frame; |
3980 | dev->get_stats = sky2_get_stats; | ||
3981 | dev->set_multicast_list = sky2_set_multicast; | 3974 | dev->set_multicast_list = sky2_set_multicast; |
3982 | dev->set_mac_address = sky2_set_mac_address; | 3975 | dev->set_mac_address = sky2_set_mac_address; |
3983 | dev->change_mtu = sky2_change_mtu; | 3976 | dev->change_mtu = sky2_change_mtu; |
diff --git a/drivers/net/sky2.h b/drivers/net/sky2.h index f4a3c2f403e5..49ee264064ab 100644 --- a/drivers/net/sky2.h +++ b/drivers/net/sky2.h | |||
@@ -2031,8 +2031,6 @@ struct sky2_port { | |||
2031 | #ifdef CONFIG_SKY2_DEBUG | 2031 | #ifdef CONFIG_SKY2_DEBUG |
2032 | struct dentry *debugfs; | 2032 | struct dentry *debugfs; |
2033 | #endif | 2033 | #endif |
2034 | struct net_device_stats net_stats; | ||
2035 | |||
2036 | }; | 2034 | }; |
2037 | 2035 | ||
2038 | struct sky2_hw { | 2036 | struct sky2_hw { |