aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/irda/irda-usb.c
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2009-01-06 13:40:43 -0500
committerDavid S. Miller <davem@davemloft.net>2009-01-06 13:40:43 -0500
commitaf0490810cfa159b4894ddecfc5eb2e4432fb976 (patch)
tree7c5074c11633b5c9cfa1489859d015974be5fe32 /drivers/net/irda/irda-usb.c
parent46377bb311a7682f6240c954c48e81a1e4f51e66 (diff)
irda: convert to internal stats
Convert IRDA drivers to use already existing net_device_stats structure in network device. This is a pre-cursor to conversion to net_device ops. Compile tested only. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/irda/irda-usb.c')
-rw-r--r--drivers/net/irda/irda-usb.c28
1 files changed, 9 insertions, 19 deletions
diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c
index 205e4e825a97..29118f58a141 100644
--- a/drivers/net/irda/irda-usb.c
+++ b/drivers/net/irda/irda-usb.c
@@ -122,7 +122,6 @@ static int irda_usb_net_open(struct net_device *dev);
122static int irda_usb_net_close(struct net_device *dev); 122static int irda_usb_net_close(struct net_device *dev);
123static int irda_usb_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); 123static int irda_usb_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
124static void irda_usb_net_timeout(struct net_device *dev); 124static void irda_usb_net_timeout(struct net_device *dev);
125static struct net_device_stats *irda_usb_net_get_stats(struct net_device *dev);
126 125
127/************************ TRANSMIT ROUTINES ************************/ 126/************************ TRANSMIT ROUTINES ************************/
128/* 127/*
@@ -525,13 +524,13 @@ static int irda_usb_hard_xmit(struct sk_buff *skb, struct net_device *netdev)
525 /* Ask USB to send the packet - Irq disabled -> GFP_ATOMIC */ 524 /* Ask USB to send the packet - Irq disabled -> GFP_ATOMIC */
526 if ((res = usb_submit_urb(urb, GFP_ATOMIC))) { 525 if ((res = usb_submit_urb(urb, GFP_ATOMIC))) {
527 IRDA_WARNING("%s(), failed Tx URB\n", __func__); 526 IRDA_WARNING("%s(), failed Tx URB\n", __func__);
528 self->stats.tx_errors++; 527 netdev->stats.tx_errors++;
529 /* Let USB recover : We will catch that in the watchdog */ 528 /* Let USB recover : We will catch that in the watchdog */
530 /*netif_start_queue(netdev);*/ 529 /*netif_start_queue(netdev);*/
531 } else { 530 } else {
532 /* Increment packet stats */ 531 /* Increment packet stats */
533 self->stats.tx_packets++; 532 netdev->stats.tx_packets++;
534 self->stats.tx_bytes += skb->len; 533 netdev->stats.tx_bytes += skb->len;
535 534
536 netdev->trans_start = jiffies; 535 netdev->trans_start = jiffies;
537 } 536 }
@@ -677,7 +676,7 @@ static void irda_usb_net_timeout(struct net_device *netdev)
677 IRDA_DEBUG(0, "%s: Tx timed out, urb->status=%d, urb->transfer_flags=0x%04X\n", netdev->name, urb->status, urb->transfer_flags); 676 IRDA_DEBUG(0, "%s: Tx timed out, urb->status=%d, urb->transfer_flags=0x%04X\n", netdev->name, urb->status, urb->transfer_flags);
678 677
679 /* Increase error count */ 678 /* Increase error count */
680 self->stats.tx_errors++; 679 netdev->stats.tx_errors++;
681 680
682#ifdef IU_BUG_KICK_TIMEOUT 681#ifdef IU_BUG_KICK_TIMEOUT
683 /* Can't be a bad idea to reset the speed ;-) - Jean II */ 682 /* Can't be a bad idea to reset the speed ;-) - Jean II */
@@ -826,7 +825,7 @@ static void irda_usb_receive(struct urb *urb)
826 if (urb->status != 0) { 825 if (urb->status != 0) {
827 switch (urb->status) { 826 switch (urb->status) {
828 case -EILSEQ: 827 case -EILSEQ:
829 self->stats.rx_crc_errors++; 828 self->netdev->stats.rx_crc_errors++;
830 /* Also precursor to a hot-unplug on UHCI. */ 829 /* Also precursor to a hot-unplug on UHCI. */
831 /* Fallthrough... */ 830 /* Fallthrough... */
832 case -ECONNRESET: 831 case -ECONNRESET:
@@ -839,7 +838,7 @@ static void irda_usb_receive(struct urb *urb)
839 case -ETIME: 838 case -ETIME:
840 /* Usually precursor to a hot-unplug on OHCI. */ 839 /* Usually precursor to a hot-unplug on OHCI. */
841 default: 840 default:
842 self->stats.rx_errors++; 841 self->netdev->stats.rx_errors++;
843 IRDA_DEBUG(0, "%s(), RX status %d, transfer_flags 0x%04X \n", __func__, urb->status, urb->transfer_flags); 842 IRDA_DEBUG(0, "%s(), RX status %d, transfer_flags 0x%04X \n", __func__, urb->status, urb->transfer_flags);
844 break; 843 break;
845 } 844 }
@@ -890,7 +889,7 @@ static void irda_usb_receive(struct urb *urb)
890 IRDA_SKB_MAX_MTU); 889 IRDA_SKB_MAX_MTU);
891 890
892 if (!newskb) { 891 if (!newskb) {
893 self->stats.rx_dropped++; 892 self->netdev->stats.rx_dropped++;
894 /* We could deliver the current skb, but this would stall 893 /* We could deliver the current skb, but this would stall
895 * the Rx path. Better drop the packet... Jean II */ 894 * the Rx path. Better drop the packet... Jean II */
896 goto done; 895 goto done;
@@ -927,8 +926,8 @@ static void irda_usb_receive(struct urb *urb)
927 netif_rx(dataskb); 926 netif_rx(dataskb);
928 927
929 /* Keep stats up to date */ 928 /* Keep stats up to date */
930 self->stats.rx_bytes += len; 929 self->netdev->stats.rx_bytes += len;
931 self->stats.rx_packets++; 930 self->netdev->stats.rx_packets++;
932 931
933done: 932done:
934 /* Note : at this point, the URB we've just received (urb) 933 /* Note : at this point, the URB we've just received (urb)
@@ -1342,14 +1341,6 @@ static int irda_usb_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
1342} 1341}
1343 1342
1344/*------------------------------------------------------------------*/ 1343/*------------------------------------------------------------------*/
1345/*
1346 * Get device stats (for /proc/net/dev and ifconfig)
1347 */
1348static struct net_device_stats *irda_usb_net_get_stats(struct net_device *dev)
1349{
1350 struct irda_usb_cb *self = netdev_priv(dev);
1351 return &self->stats;
1352}
1353 1344
1354/********************* IRDA CONFIG SUBROUTINES *********************/ 1345/********************* IRDA CONFIG SUBROUTINES *********************/
1355/* 1346/*
@@ -1428,7 +1419,6 @@ static inline int irda_usb_open(struct irda_usb_cb *self)
1428 netdev->watchdog_timeo = 250*HZ/1000; /* 250 ms > USB timeout */ 1419 netdev->watchdog_timeo = 250*HZ/1000; /* 250 ms > USB timeout */
1429 netdev->open = irda_usb_net_open; 1420 netdev->open = irda_usb_net_open;
1430 netdev->stop = irda_usb_net_close; 1421 netdev->stop = irda_usb_net_close;
1431 netdev->get_stats = irda_usb_net_get_stats;
1432 netdev->do_ioctl = irda_usb_net_ioctl; 1422 netdev->do_ioctl = irda_usb_net_ioctl;
1433 1423
1434 return register_netdev(netdev); 1424 return register_netdev(netdev);