diff options
author | Paulius Zaleckas <paulius.zaleckas@teltonika.lt> | 2008-05-05 09:05:17 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-05-13 01:35:23 -0400 |
commit | 237225f70f159b607382b5ffcd86f36fc8915cfd (patch) | |
tree | e52b7b82fd2b644a7504bcf98725a71da238c1b2 /drivers | |
parent | ad0e8a4c15d82d55a731056eeef1288bf7e1c4dc (diff) |
8139cp: use netstats in net_device structure
Use net_device_stats from net_device structure instead of local.
Signed-off-by: Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/8139cp.c | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c index a453eda834d5..934db350e339 100644 --- a/drivers/net/8139cp.c +++ b/drivers/net/8139cp.c | |||
@@ -340,7 +340,6 @@ struct cp_private { | |||
340 | u32 rx_config; | 340 | u32 rx_config; |
341 | u16 cpcmd; | 341 | u16 cpcmd; |
342 | 342 | ||
343 | struct net_device_stats net_stats; | ||
344 | struct cp_extra_stats cp_stats; | 343 | struct cp_extra_stats cp_stats; |
345 | 344 | ||
346 | unsigned rx_head ____cacheline_aligned; | 345 | unsigned rx_head ____cacheline_aligned; |
@@ -457,8 +456,8 @@ static inline void cp_rx_skb (struct cp_private *cp, struct sk_buff *skb, | |||
457 | { | 456 | { |
458 | skb->protocol = eth_type_trans (skb, cp->dev); | 457 | skb->protocol = eth_type_trans (skb, cp->dev); |
459 | 458 | ||
460 | cp->net_stats.rx_packets++; | 459 | cp->dev->stats.rx_packets++; |
461 | cp->net_stats.rx_bytes += skb->len; | 460 | cp->dev->stats.rx_bytes += skb->len; |
462 | cp->dev->last_rx = jiffies; | 461 | cp->dev->last_rx = jiffies; |
463 | 462 | ||
464 | #if CP_VLAN_TAG_USED | 463 | #if CP_VLAN_TAG_USED |
@@ -477,17 +476,17 @@ static void cp_rx_err_acct (struct cp_private *cp, unsigned rx_tail, | |||
477 | printk (KERN_DEBUG | 476 | printk (KERN_DEBUG |
478 | "%s: rx err, slot %d status 0x%x len %d\n", | 477 | "%s: rx err, slot %d status 0x%x len %d\n", |
479 | cp->dev->name, rx_tail, status, len); | 478 | cp->dev->name, rx_tail, status, len); |
480 | cp->net_stats.rx_errors++; | 479 | cp->dev->stats.rx_errors++; |
481 | if (status & RxErrFrame) | 480 | if (status & RxErrFrame) |
482 | cp->net_stats.rx_frame_errors++; | 481 | cp->dev->stats.rx_frame_errors++; |
483 | if (status & RxErrCRC) | 482 | if (status & RxErrCRC) |
484 | cp->net_stats.rx_crc_errors++; | 483 | cp->dev->stats.rx_crc_errors++; |
485 | if ((status & RxErrRunt) || (status & RxErrLong)) | 484 | if ((status & RxErrRunt) || (status & RxErrLong)) |
486 | cp->net_stats.rx_length_errors++; | 485 | cp->dev->stats.rx_length_errors++; |
487 | if ((status & (FirstFrag | LastFrag)) != (FirstFrag | LastFrag)) | 486 | if ((status & (FirstFrag | LastFrag)) != (FirstFrag | LastFrag)) |
488 | cp->net_stats.rx_length_errors++; | 487 | cp->dev->stats.rx_length_errors++; |
489 | if (status & RxErrFIFO) | 488 | if (status & RxErrFIFO) |
490 | cp->net_stats.rx_fifo_errors++; | 489 | cp->dev->stats.rx_fifo_errors++; |
491 | } | 490 | } |
492 | 491 | ||
493 | static inline unsigned int cp_rx_csum_ok (u32 status) | 492 | static inline unsigned int cp_rx_csum_ok (u32 status) |
@@ -539,7 +538,7 @@ rx_status_loop: | |||
539 | * that RX fragments are never encountered | 538 | * that RX fragments are never encountered |
540 | */ | 539 | */ |
541 | cp_rx_err_acct(cp, rx_tail, status, len); | 540 | cp_rx_err_acct(cp, rx_tail, status, len); |
542 | cp->net_stats.rx_dropped++; | 541 | dev->stats.rx_dropped++; |
543 | cp->cp_stats.rx_frags++; | 542 | cp->cp_stats.rx_frags++; |
544 | goto rx_next; | 543 | goto rx_next; |
545 | } | 544 | } |
@@ -556,7 +555,7 @@ rx_status_loop: | |||
556 | buflen = cp->rx_buf_sz + RX_OFFSET; | 555 | buflen = cp->rx_buf_sz + RX_OFFSET; |
557 | new_skb = dev_alloc_skb (buflen); | 556 | new_skb = dev_alloc_skb (buflen); |
558 | if (!new_skb) { | 557 | if (!new_skb) { |
559 | cp->net_stats.rx_dropped++; | 558 | dev->stats.rx_dropped++; |
560 | goto rx_next; | 559 | goto rx_next; |
561 | } | 560 | } |
562 | 561 | ||
@@ -710,20 +709,20 @@ static void cp_tx (struct cp_private *cp) | |||
710 | if (netif_msg_tx_err(cp)) | 709 | if (netif_msg_tx_err(cp)) |
711 | printk(KERN_DEBUG "%s: tx err, status 0x%x\n", | 710 | printk(KERN_DEBUG "%s: tx err, status 0x%x\n", |
712 | cp->dev->name, status); | 711 | cp->dev->name, status); |
713 | cp->net_stats.tx_errors++; | 712 | cp->dev->stats.tx_errors++; |
714 | if (status & TxOWC) | 713 | if (status & TxOWC) |
715 | cp->net_stats.tx_window_errors++; | 714 | cp->dev->stats.tx_window_errors++; |
716 | if (status & TxMaxCol) | 715 | if (status & TxMaxCol) |
717 | cp->net_stats.tx_aborted_errors++; | 716 | cp->dev->stats.tx_aborted_errors++; |
718 | if (status & TxLinkFail) | 717 | if (status & TxLinkFail) |
719 | cp->net_stats.tx_carrier_errors++; | 718 | cp->dev->stats.tx_carrier_errors++; |
720 | if (status & TxFIFOUnder) | 719 | if (status & TxFIFOUnder) |
721 | cp->net_stats.tx_fifo_errors++; | 720 | cp->dev->stats.tx_fifo_errors++; |
722 | } else { | 721 | } else { |
723 | cp->net_stats.collisions += | 722 | cp->dev->stats.collisions += |
724 | ((status >> TxColCntShift) & TxColCntMask); | 723 | ((status >> TxColCntShift) & TxColCntMask); |
725 | cp->net_stats.tx_packets++; | 724 | cp->dev->stats.tx_packets++; |
726 | cp->net_stats.tx_bytes += skb->len; | 725 | cp->dev->stats.tx_bytes += skb->len; |
727 | if (netif_msg_tx_done(cp)) | 726 | if (netif_msg_tx_done(cp)) |
728 | printk(KERN_DEBUG "%s: tx done, slot %d\n", cp->dev->name, tx_tail); | 727 | printk(KERN_DEBUG "%s: tx done, slot %d\n", cp->dev->name, tx_tail); |
729 | } | 728 | } |
@@ -956,7 +955,7 @@ static void cp_set_rx_mode (struct net_device *dev) | |||
956 | static void __cp_get_stats(struct cp_private *cp) | 955 | static void __cp_get_stats(struct cp_private *cp) |
957 | { | 956 | { |
958 | /* only lower 24 bits valid; write any value to clear */ | 957 | /* only lower 24 bits valid; write any value to clear */ |
959 | cp->net_stats.rx_missed_errors += (cpr32 (RxMissed) & 0xffffff); | 958 | cp->dev->stats.rx_missed_errors += (cpr32 (RxMissed) & 0xffffff); |
960 | cpw32 (RxMissed, 0); | 959 | cpw32 (RxMissed, 0); |
961 | } | 960 | } |
962 | 961 | ||
@@ -971,7 +970,7 @@ static struct net_device_stats *cp_get_stats(struct net_device *dev) | |||
971 | __cp_get_stats(cp); | 970 | __cp_get_stats(cp); |
972 | spin_unlock_irqrestore(&cp->lock, flags); | 971 | spin_unlock_irqrestore(&cp->lock, flags); |
973 | 972 | ||
974 | return &cp->net_stats; | 973 | return &dev->stats; |
975 | } | 974 | } |
976 | 975 | ||
977 | static void cp_stop_hw (struct cp_private *cp) | 976 | static void cp_stop_hw (struct cp_private *cp) |
@@ -1142,7 +1141,7 @@ static void cp_clean_rings (struct cp_private *cp) | |||
1142 | PCI_DMA_TODEVICE); | 1141 | PCI_DMA_TODEVICE); |
1143 | if (le32_to_cpu(desc->opts1) & LastFrag) | 1142 | if (le32_to_cpu(desc->opts1) & LastFrag) |
1144 | dev_kfree_skb(skb); | 1143 | dev_kfree_skb(skb); |
1145 | cp->net_stats.tx_dropped++; | 1144 | cp->dev->stats.tx_dropped++; |
1146 | } | 1145 | } |
1147 | } | 1146 | } |
1148 | 1147 | ||