aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2009-03-20 15:35:50 -0400
committerDavid S. Miller <davem@davemloft.net>2009-03-21 22:40:59 -0400
commitb7e41e23055f20be334c404b15373c8deb2262b9 (patch)
treef838eab0d799cc83741415627629e422c83c3ff1
parent19b8f8f1a1cd9e31a1092a6841065471df8db00f (diff)
usbnet: convert to internal net_device stats
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/usb/rtl8150.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c
index d8664bf18c0..67368ccdb15 100644
--- a/drivers/net/usb/rtl8150.c
+++ b/drivers/net/usb/rtl8150.c
@@ -155,7 +155,6 @@ struct rtl8150 {
155 unsigned long flags; 155 unsigned long flags;
156 struct usb_device *udev; 156 struct usb_device *udev;
157 struct tasklet_struct tl; 157 struct tasklet_struct tl;
158 struct net_device_stats stats;
159 struct net_device *netdev; 158 struct net_device *netdev;
160 struct urb *rx_urb, *tx_urb, *intr_urb, *ctrl_urb; 159 struct urb *rx_urb, *tx_urb, *intr_urb, *ctrl_urb;
161 struct sk_buff *tx_skb, *rx_skb; 160 struct sk_buff *tx_skb, *rx_skb;
@@ -463,8 +462,8 @@ static void read_bulk_callback(struct urb *urb)
463 skb_put(dev->rx_skb, pkt_len); 462 skb_put(dev->rx_skb, pkt_len);
464 dev->rx_skb->protocol = eth_type_trans(dev->rx_skb, netdev); 463 dev->rx_skb->protocol = eth_type_trans(dev->rx_skb, netdev);
465 netif_rx(dev->rx_skb); 464 netif_rx(dev->rx_skb);
466 dev->stats.rx_packets++; 465 netdev->stats.rx_packets++;
467 dev->stats.rx_bytes += pkt_len; 466 netdev->stats.rx_bytes += pkt_len;
468 467
469 spin_lock(&dev->rx_pool_lock); 468 spin_lock(&dev->rx_pool_lock);
470 skb = pull_skb(dev); 469 skb = pull_skb(dev);
@@ -573,13 +572,13 @@ static void intr_callback(struct urb *urb)
573 572
574 d = urb->transfer_buffer; 573 d = urb->transfer_buffer;
575 if (d[0] & TSR_ERRORS) { 574 if (d[0] & TSR_ERRORS) {
576 dev->stats.tx_errors++; 575 dev->netdev->stats.tx_errors++;
577 if (d[INT_TSR] & (TSR_ECOL | TSR_JBR)) 576 if (d[INT_TSR] & (TSR_ECOL | TSR_JBR))
578 dev->stats.tx_aborted_errors++; 577 dev->netdev->stats.tx_aborted_errors++;
579 if (d[INT_TSR] & TSR_LCOL) 578 if (d[INT_TSR] & TSR_LCOL)
580 dev->stats.tx_window_errors++; 579 dev->netdev->stats.tx_window_errors++;
581 if (d[INT_TSR] & TSR_LOSS_CRS) 580 if (d[INT_TSR] & TSR_LOSS_CRS)
582 dev->stats.tx_carrier_errors++; 581 dev->netdev->stats.tx_carrier_errors++;
583 } 582 }
584 /* Report link status changes to the network stack */ 583 /* Report link status changes to the network stack */
585 if ((d[INT_MSR] & MSR_LINK) == 0) { 584 if ((d[INT_MSR] & MSR_LINK) == 0) {
@@ -697,17 +696,12 @@ static void disable_net_traffic(rtl8150_t * dev)
697 set_registers(dev, CR, 1, &cr); 696 set_registers(dev, CR, 1, &cr);
698} 697}
699 698
700static struct net_device_stats *rtl8150_netdev_stats(struct net_device *dev)
701{
702 return &((rtl8150_t *)netdev_priv(dev))->stats;
703}
704
705static void rtl8150_tx_timeout(struct net_device *netdev) 699static void rtl8150_tx_timeout(struct net_device *netdev)
706{ 700{
707 rtl8150_t *dev = netdev_priv(netdev); 701 rtl8150_t *dev = netdev_priv(netdev);
708 dev_warn(&netdev->dev, "Tx timeout.\n"); 702 dev_warn(&netdev->dev, "Tx timeout.\n");
709 usb_unlink_urb(dev->tx_urb); 703 usb_unlink_urb(dev->tx_urb);
710 dev->stats.tx_errors++; 704 netdev->stats.tx_errors++;
711} 705}
712 706
713static void rtl8150_set_multicast(struct net_device *netdev) 707static void rtl8150_set_multicast(struct net_device *netdev)
@@ -747,12 +741,12 @@ static int rtl8150_start_xmit(struct sk_buff *skb, struct net_device *netdev)
747 netif_device_detach(dev->netdev); 741 netif_device_detach(dev->netdev);
748 else { 742 else {
749 dev_warn(&netdev->dev, "failed tx_urb %d\n", res); 743 dev_warn(&netdev->dev, "failed tx_urb %d\n", res);
750 dev->stats.tx_errors++; 744 netdev->stats.tx_errors++;
751 netif_start_queue(netdev); 745 netif_start_queue(netdev);
752 } 746 }
753 } else { 747 } else {
754 dev->stats.tx_packets++; 748 netdev->stats.tx_packets++;
755 dev->stats.tx_bytes += skb->len; 749 netdev->stats.tx_bytes += skb->len;
756 netdev->trans_start = jiffies; 750 netdev->trans_start = jiffies;
757 } 751 }
758 752
@@ -931,7 +925,7 @@ static int rtl8150_probe(struct usb_interface *intf,
931 netdev->hard_start_xmit = rtl8150_start_xmit; 925 netdev->hard_start_xmit = rtl8150_start_xmit;
932 netdev->set_multicast_list = rtl8150_set_multicast; 926 netdev->set_multicast_list = rtl8150_set_multicast;
933 netdev->set_mac_address = rtl8150_set_mac_address; 927 netdev->set_mac_address = rtl8150_set_mac_address;
934 netdev->get_stats = rtl8150_netdev_stats; 928
935 SET_ETHTOOL_OPS(netdev, &ops); 929 SET_ETHTOOL_OPS(netdev, &ops);
936 dev->intr_interval = 100; /* 100ms */ 930 dev->intr_interval = 100; /* 100ms */
937 931