diff options
author | Stephen Hemminger <shemminger@vyatta.com> | 2009-03-20 15:35:48 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-03-21 22:40:58 -0400 |
commit | edc4ae08644045dc803dc519f96ff245cb80adad (patch) | |
tree | cb813d14e32e3b6ee1c41359009b1b57cb0b3deb /drivers/net | |
parent | 94ffab6d199ab36e5dfd2f2f0e4bb135728526c4 (diff) |
usbnet: convert catc to internal net_device_stats
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/usb/catc.c | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/drivers/net/usb/catc.c b/drivers/net/usb/catc.c index cb7acbbb2798..2fb4e3654d79 100644 --- a/drivers/net/usb/catc.c +++ b/drivers/net/usb/catc.c | |||
@@ -163,7 +163,6 @@ struct catc { | |||
163 | struct net_device *netdev; | 163 | struct net_device *netdev; |
164 | struct usb_device *usbdev; | 164 | struct usb_device *usbdev; |
165 | 165 | ||
166 | struct net_device_stats stats; | ||
167 | unsigned long flags; | 166 | unsigned long flags; |
168 | 167 | ||
169 | unsigned int tx_ptr, tx_idx; | 168 | unsigned int tx_ptr, tx_idx; |
@@ -245,8 +244,8 @@ static void catc_rx_done(struct urb *urb) | |||
245 | if(!catc->is_f5u011) { | 244 | if(!catc->is_f5u011) { |
246 | pkt_len = le16_to_cpup((__le16*)pkt_start); | 245 | pkt_len = le16_to_cpup((__le16*)pkt_start); |
247 | if (pkt_len > urb->actual_length) { | 246 | if (pkt_len > urb->actual_length) { |
248 | catc->stats.rx_length_errors++; | 247 | catc->netdev->stats.rx_length_errors++; |
249 | catc->stats.rx_errors++; | 248 | catc->netdev->stats.rx_errors++; |
250 | break; | 249 | break; |
251 | } | 250 | } |
252 | } else { | 251 | } else { |
@@ -262,8 +261,8 @@ static void catc_rx_done(struct urb *urb) | |||
262 | skb->protocol = eth_type_trans(skb, catc->netdev); | 261 | skb->protocol = eth_type_trans(skb, catc->netdev); |
263 | netif_rx(skb); | 262 | netif_rx(skb); |
264 | 263 | ||
265 | catc->stats.rx_packets++; | 264 | catc->netdev->stats.rx_packets++; |
266 | catc->stats.rx_bytes += pkt_len; | 265 | catc->netdev->stats.rx_bytes += pkt_len; |
267 | 266 | ||
268 | /* F5U011 only does one packet per RX */ | 267 | /* F5U011 only does one packet per RX */ |
269 | if (catc->is_f5u011) | 268 | if (catc->is_f5u011) |
@@ -386,7 +385,7 @@ static void catc_tx_done(struct urb *urb) | |||
386 | dbg("Tx Reset."); | 385 | dbg("Tx Reset."); |
387 | urb->status = 0; | 386 | urb->status = 0; |
388 | catc->netdev->trans_start = jiffies; | 387 | catc->netdev->trans_start = jiffies; |
389 | catc->stats.tx_errors++; | 388 | catc->netdev->stats.tx_errors++; |
390 | clear_bit(TX_RUNNING, &catc->flags); | 389 | clear_bit(TX_RUNNING, &catc->flags); |
391 | netif_wake_queue(catc->netdev); | 390 | netif_wake_queue(catc->netdev); |
392 | return; | 391 | return; |
@@ -412,7 +411,7 @@ static void catc_tx_done(struct urb *urb) | |||
412 | spin_unlock_irqrestore(&catc->tx_lock, flags); | 411 | spin_unlock_irqrestore(&catc->tx_lock, flags); |
413 | } | 412 | } |
414 | 413 | ||
415 | static int catc_hard_start_xmit(struct sk_buff *skb, struct net_device *netdev) | 414 | static int catc_start_xmit(struct sk_buff *skb, struct net_device *netdev) |
416 | { | 415 | { |
417 | struct catc *catc = netdev_priv(netdev); | 416 | struct catc *catc = netdev_priv(netdev); |
418 | unsigned long flags; | 417 | unsigned long flags; |
@@ -443,8 +442,8 @@ static int catc_hard_start_xmit(struct sk_buff *skb, struct net_device *netdev) | |||
443 | spin_unlock_irqrestore(&catc->tx_lock, flags); | 442 | spin_unlock_irqrestore(&catc->tx_lock, flags); |
444 | 443 | ||
445 | if (r >= 0) { | 444 | if (r >= 0) { |
446 | catc->stats.tx_bytes += skb->len; | 445 | catc->netdev->stats.tx_bytes += skb->len; |
447 | catc->stats.tx_packets++; | 446 | catc->netdev->stats.tx_packets++; |
448 | } | 447 | } |
449 | 448 | ||
450 | dev_kfree_skb(skb); | 449 | dev_kfree_skb(skb); |
@@ -588,15 +587,15 @@ static void catc_stats_done(struct catc *catc, struct ctrl_queue *q) | |||
588 | switch (index) { | 587 | switch (index) { |
589 | case TxSingleColl: | 588 | case TxSingleColl: |
590 | case TxMultiColl: | 589 | case TxMultiColl: |
591 | catc->stats.collisions += data - last; | 590 | catc->netdev->stats.collisions += data - last; |
592 | break; | 591 | break; |
593 | case TxExcessColl: | 592 | case TxExcessColl: |
594 | catc->stats.tx_aborted_errors += data - last; | 593 | catc->netdev->stats.tx_aborted_errors += data - last; |
595 | catc->stats.tx_errors += data - last; | 594 | catc->netdev->stats.tx_errors += data - last; |
596 | break; | 595 | break; |
597 | case RxFramErr: | 596 | case RxFramErr: |
598 | catc->stats.rx_frame_errors += data - last; | 597 | catc->netdev->stats.rx_frame_errors += data - last; |
599 | catc->stats.rx_errors += data - last; | 598 | catc->netdev->stats.rx_errors += data - last; |
600 | break; | 599 | break; |
601 | } | 600 | } |
602 | 601 | ||
@@ -614,12 +613,6 @@ static void catc_stats_timer(unsigned long data) | |||
614 | mod_timer(&catc->timer, jiffies + STATS_UPDATE); | 613 | mod_timer(&catc->timer, jiffies + STATS_UPDATE); |
615 | } | 614 | } |
616 | 615 | ||
617 | static struct net_device_stats *catc_get_stats(struct net_device *netdev) | ||
618 | { | ||
619 | struct catc *catc = netdev_priv(netdev); | ||
620 | return &catc->stats; | ||
621 | } | ||
622 | |||
623 | /* | 616 | /* |
624 | * Receive modes. Broadcast, Multicast, Promisc. | 617 | * Receive modes. Broadcast, Multicast, Promisc. |
625 | */ | 618 | */ |
@@ -777,7 +770,6 @@ static int catc_probe(struct usb_interface *intf, const struct usb_device_id *id | |||
777 | netdev->open = catc_open; | 770 | netdev->open = catc_open; |
778 | netdev->hard_start_xmit = catc_hard_start_xmit; | 771 | netdev->hard_start_xmit = catc_hard_start_xmit; |
779 | netdev->stop = catc_stop; | 772 | netdev->stop = catc_stop; |
780 | netdev->get_stats = catc_get_stats; | ||
781 | netdev->tx_timeout = catc_tx_timeout; | 773 | netdev->tx_timeout = catc_tx_timeout; |
782 | netdev->watchdog_timeo = TX_TIMEOUT; | 774 | netdev->watchdog_timeo = TX_TIMEOUT; |
783 | netdev->set_multicast_list = catc_set_multicast_list; | 775 | netdev->set_multicast_list = catc_set_multicast_list; |