diff options
author | Stephen Hemminger <shemminger@vyatta.com> | 2009-01-06 13:40:43 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-01-06 13:40:43 -0500 |
commit | af0490810cfa159b4894ddecfc5eb2e4432fb976 (patch) | |
tree | 7c5074c11633b5c9cfa1489859d015974be5fe32 /drivers/net/irda/stir4200.c | |
parent | 46377bb311a7682f6240c954c48e81a1e4f51e66 (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/stir4200.c')
-rw-r--r-- | drivers/net/irda/stir4200.c | 44 |
1 files changed, 17 insertions, 27 deletions
diff --git a/drivers/net/irda/stir4200.c b/drivers/net/irda/stir4200.c index ca4cd9266e55..8b1658c6c925 100644 --- a/drivers/net/irda/stir4200.c +++ b/drivers/net/irda/stir4200.c | |||
@@ -164,7 +164,7 @@ struct stir_cb { | |||
164 | struct usb_device *usbdev; /* init: probe_irda */ | 164 | struct usb_device *usbdev; /* init: probe_irda */ |
165 | struct net_device *netdev; /* network layer */ | 165 | struct net_device *netdev; /* network layer */ |
166 | struct irlap_cb *irlap; /* The link layer we are binded to */ | 166 | struct irlap_cb *irlap; /* The link layer we are binded to */ |
167 | struct net_device_stats stats; /* network statistics */ | 167 | |
168 | struct qos_info qos; | 168 | struct qos_info qos; |
169 | unsigned speed; /* Current speed */ | 169 | unsigned speed; /* Current speed */ |
170 | 170 | ||
@@ -323,16 +323,16 @@ static void fir_eof(struct stir_cb *stir) | |||
323 | pr_debug("%s: short frame len %d\n", | 323 | pr_debug("%s: short frame len %d\n", |
324 | stir->netdev->name, len); | 324 | stir->netdev->name, len); |
325 | 325 | ||
326 | ++stir->stats.rx_errors; | 326 | ++stir->netdev->stats.rx_errors; |
327 | ++stir->stats.rx_length_errors; | 327 | ++stir->netdev->stats.rx_length_errors; |
328 | return; | 328 | return; |
329 | } | 329 | } |
330 | 330 | ||
331 | fcs = ~(crc32_le(~0, rx_buff->data, len)); | 331 | fcs = ~(crc32_le(~0, rx_buff->data, len)); |
332 | if (fcs != get_unaligned_le32(rx_buff->data + len)) { | 332 | if (fcs != get_unaligned_le32(rx_buff->data + len)) { |
333 | pr_debug("crc error calc 0x%x len %d\n", fcs, len); | 333 | pr_debug("crc error calc 0x%x len %d\n", fcs, len); |
334 | stir->stats.rx_errors++; | 334 | stir->netdev->stats.rx_errors++; |
335 | stir->stats.rx_crc_errors++; | 335 | stir->netdev->stats.rx_crc_errors++; |
336 | return; | 336 | return; |
337 | } | 337 | } |
338 | 338 | ||
@@ -340,7 +340,7 @@ static void fir_eof(struct stir_cb *stir) | |||
340 | if (len < IRDA_RX_COPY_THRESHOLD) { | 340 | if (len < IRDA_RX_COPY_THRESHOLD) { |
341 | nskb = dev_alloc_skb(len + 1); | 341 | nskb = dev_alloc_skb(len + 1); |
342 | if (unlikely(!nskb)) { | 342 | if (unlikely(!nskb)) { |
343 | ++stir->stats.rx_dropped; | 343 | ++stir->netdev->stats.rx_dropped; |
344 | return; | 344 | return; |
345 | } | 345 | } |
346 | skb_reserve(nskb, 1); | 346 | skb_reserve(nskb, 1); |
@@ -349,7 +349,7 @@ static void fir_eof(struct stir_cb *stir) | |||
349 | } else { | 349 | } else { |
350 | nskb = dev_alloc_skb(rx_buff->truesize); | 350 | nskb = dev_alloc_skb(rx_buff->truesize); |
351 | if (unlikely(!nskb)) { | 351 | if (unlikely(!nskb)) { |
352 | ++stir->stats.rx_dropped; | 352 | ++stir->netdev->stats.rx_dropped; |
353 | return; | 353 | return; |
354 | } | 354 | } |
355 | skb_reserve(nskb, 1); | 355 | skb_reserve(nskb, 1); |
@@ -366,8 +366,8 @@ static void fir_eof(struct stir_cb *stir) | |||
366 | 366 | ||
367 | netif_rx(skb); | 367 | netif_rx(skb); |
368 | 368 | ||
369 | stir->stats.rx_packets++; | 369 | stir->netdev->stats.rx_packets++; |
370 | stir->stats.rx_bytes += len; | 370 | stir->netdev->stats.rx_bytes += len; |
371 | 371 | ||
372 | rx_buff->data = rx_buff->head; | 372 | rx_buff->data = rx_buff->head; |
373 | rx_buff->len = 0; | 373 | rx_buff->len = 0; |
@@ -437,7 +437,7 @@ static void stir_fir_chars(struct stir_cb *stir, | |||
437 | if (unlikely(rx_buff->len >= rx_buff->truesize)) { | 437 | if (unlikely(rx_buff->len >= rx_buff->truesize)) { |
438 | pr_debug("%s: fir frame exceeds %d\n", | 438 | pr_debug("%s: fir frame exceeds %d\n", |
439 | stir->netdev->name, rx_buff->truesize); | 439 | stir->netdev->name, rx_buff->truesize); |
440 | ++stir->stats.rx_over_errors; | 440 | ++stir->netdev->stats.rx_over_errors; |
441 | goto error_recovery; | 441 | goto error_recovery; |
442 | } | 442 | } |
443 | 443 | ||
@@ -445,10 +445,10 @@ static void stir_fir_chars(struct stir_cb *stir, | |||
445 | continue; | 445 | continue; |
446 | 446 | ||
447 | frame_error: | 447 | frame_error: |
448 | ++stir->stats.rx_frame_errors; | 448 | ++stir->netdev->stats.rx_frame_errors; |
449 | 449 | ||
450 | error_recovery: | 450 | error_recovery: |
451 | ++stir->stats.rx_errors; | 451 | ++stir->netdev->stats.rx_errors; |
452 | rx_buff->state = OUTSIDE_FRAME; | 452 | rx_buff->state = OUTSIDE_FRAME; |
453 | rx_buff->in_frame = FALSE; | 453 | rx_buff->in_frame = FALSE; |
454 | } | 454 | } |
@@ -461,7 +461,7 @@ static void stir_sir_chars(struct stir_cb *stir, | |||
461 | int i; | 461 | int i; |
462 | 462 | ||
463 | for (i = 0; i < len; i++) | 463 | for (i = 0; i < len; i++) |
464 | async_unwrap_char(stir->netdev, &stir->stats, | 464 | async_unwrap_char(stir->netdev, &stir->netdev->stats, |
465 | &stir->rx_buff, bytes[i]); | 465 | &stir->rx_buff, bytes[i]); |
466 | } | 466 | } |
467 | 467 | ||
@@ -692,7 +692,7 @@ static void receive_stop(struct stir_cb *stir) | |||
692 | usb_kill_urb(stir->rx_urb); | 692 | usb_kill_urb(stir->rx_urb); |
693 | 693 | ||
694 | if (stir->rx_buff.in_frame) | 694 | if (stir->rx_buff.in_frame) |
695 | stir->stats.collisions++; | 695 | stir->netdev->stats.collisions++; |
696 | } | 696 | } |
697 | /* | 697 | /* |
698 | * Wrap data in socket buffer and send it. | 698 | * Wrap data in socket buffer and send it. |
@@ -718,15 +718,15 @@ static void stir_send(struct stir_cb *stir, struct sk_buff *skb) | |||
718 | if (!first_frame) | 718 | if (!first_frame) |
719 | fifo_txwait(stir, wraplen); | 719 | fifo_txwait(stir, wraplen); |
720 | 720 | ||
721 | stir->stats.tx_packets++; | 721 | stir->netdev->stats.tx_packets++; |
722 | stir->stats.tx_bytes += skb->len; | 722 | stir->netdev->stats.tx_bytes += skb->len; |
723 | stir->netdev->trans_start = jiffies; | 723 | stir->netdev->trans_start = jiffies; |
724 | pr_debug("send %d (%d)\n", skb->len, wraplen); | 724 | pr_debug("send %d (%d)\n", skb->len, wraplen); |
725 | 725 | ||
726 | if (usb_bulk_msg(stir->usbdev, usb_sndbulkpipe(stir->usbdev, 1), | 726 | if (usb_bulk_msg(stir->usbdev, usb_sndbulkpipe(stir->usbdev, 1), |
727 | stir->io_buf, wraplen, | 727 | stir->io_buf, wraplen, |
728 | NULL, TRANSMIT_TIMEOUT)) | 728 | NULL, TRANSMIT_TIMEOUT)) |
729 | stir->stats.tx_errors++; | 729 | stir->netdev->stats.tx_errors++; |
730 | } | 730 | } |
731 | 731 | ||
732 | /* | 732 | /* |
@@ -1008,15 +1008,6 @@ static int stir_net_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd) | |||
1008 | } | 1008 | } |
1009 | 1009 | ||
1010 | /* | 1010 | /* |
1011 | * Get device stats (for /proc/net/dev and ifconfig) | ||
1012 | */ | ||
1013 | static struct net_device_stats *stir_net_get_stats(struct net_device *netdev) | ||
1014 | { | ||
1015 | struct stir_cb *stir = netdev_priv(netdev); | ||
1016 | return &stir->stats; | ||
1017 | } | ||
1018 | |||
1019 | /* | ||
1020 | * This routine is called by the USB subsystem for each new device | 1011 | * This routine is called by the USB subsystem for each new device |
1021 | * in the system. We need to check if the device is ours, and in | 1012 | * in the system. We need to check if the device is ours, and in |
1022 | * this case start handling it. | 1013 | * this case start handling it. |
@@ -1066,7 +1057,6 @@ static int stir_probe(struct usb_interface *intf, | |||
1066 | net->hard_start_xmit = stir_hard_xmit; | 1057 | net->hard_start_xmit = stir_hard_xmit; |
1067 | net->open = stir_net_open; | 1058 | net->open = stir_net_open; |
1068 | net->stop = stir_net_close; | 1059 | net->stop = stir_net_close; |
1069 | net->get_stats = stir_net_get_stats; | ||
1070 | net->do_ioctl = stir_net_ioctl; | 1060 | net->do_ioctl = stir_net_ioctl; |
1071 | 1061 | ||
1072 | ret = register_netdev(net); | 1062 | ret = register_netdev(net); |