aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/irda/mcs7780.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/mcs7780.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/mcs7780.c')
-rw-r--r--drivers/net/irda/mcs7780.c49
1 files changed, 20 insertions, 29 deletions
diff --git a/drivers/net/irda/mcs7780.c b/drivers/net/irda/mcs7780.c
index 904c9610c0dd..7eafdca19f34 100644
--- a/drivers/net/irda/mcs7780.c
+++ b/drivers/net/irda/mcs7780.c
@@ -403,8 +403,8 @@ static void mcs_unwrap_mir(struct mcs_cb *mcs, __u8 *buf, int len)
403 if(unlikely(new_len <= 0)) { 403 if(unlikely(new_len <= 0)) {
404 IRDA_ERROR("%s short frame length %d\n", 404 IRDA_ERROR("%s short frame length %d\n",
405 mcs->netdev->name, new_len); 405 mcs->netdev->name, new_len);
406 ++mcs->stats.rx_errors; 406 ++mcs->netdev->stats.rx_errors;
407 ++mcs->stats.rx_length_errors; 407 ++mcs->netdev->stats.rx_length_errors;
408 return; 408 return;
409 } 409 }
410 fcs = 0; 410 fcs = 0;
@@ -413,14 +413,14 @@ static void mcs_unwrap_mir(struct mcs_cb *mcs, __u8 *buf, int len)
413 if(fcs != GOOD_FCS) { 413 if(fcs != GOOD_FCS) {
414 IRDA_ERROR("crc error calc 0x%x len %d\n", 414 IRDA_ERROR("crc error calc 0x%x len %d\n",
415 fcs, new_len); 415 fcs, new_len);
416 mcs->stats.rx_errors++; 416 mcs->netdev->stats.rx_errors++;
417 mcs->stats.rx_crc_errors++; 417 mcs->netdev->stats.rx_crc_errors++;
418 return; 418 return;
419 } 419 }
420 420
421 skb = dev_alloc_skb(new_len + 1); 421 skb = dev_alloc_skb(new_len + 1);
422 if(unlikely(!skb)) { 422 if(unlikely(!skb)) {
423 ++mcs->stats.rx_dropped; 423 ++mcs->netdev->stats.rx_dropped;
424 return; 424 return;
425 } 425 }
426 426
@@ -433,8 +433,8 @@ static void mcs_unwrap_mir(struct mcs_cb *mcs, __u8 *buf, int len)
433 433
434 netif_rx(skb); 434 netif_rx(skb);
435 435
436 mcs->stats.rx_packets++; 436 mcs->netdev->stats.rx_packets++;
437 mcs->stats.rx_bytes += new_len; 437 mcs->netdev->stats.rx_bytes += new_len;
438 438
439 return; 439 return;
440} 440}
@@ -458,22 +458,22 @@ static void mcs_unwrap_fir(struct mcs_cb *mcs, __u8 *buf, int len)
458 if(unlikely(new_len <= 0)) { 458 if(unlikely(new_len <= 0)) {
459 IRDA_ERROR("%s short frame length %d\n", 459 IRDA_ERROR("%s short frame length %d\n",
460 mcs->netdev->name, new_len); 460 mcs->netdev->name, new_len);
461 ++mcs->stats.rx_errors; 461 ++mcs->netdev->stats.rx_errors;
462 ++mcs->stats.rx_length_errors; 462 ++mcs->netdev->stats.rx_length_errors;
463 return; 463 return;
464 } 464 }
465 465
466 fcs = ~(crc32_le(~0, buf, new_len)); 466 fcs = ~(crc32_le(~0, buf, new_len));
467 if(fcs != get_unaligned_le32(buf + new_len)) { 467 if(fcs != get_unaligned_le32(buf + new_len)) {
468 IRDA_ERROR("crc error calc 0x%x len %d\n", fcs, new_len); 468 IRDA_ERROR("crc error calc 0x%x len %d\n", fcs, new_len);
469 mcs->stats.rx_errors++; 469 mcs->netdev->stats.rx_errors++;
470 mcs->stats.rx_crc_errors++; 470 mcs->netdev->stats.rx_crc_errors++;
471 return; 471 return;
472 } 472 }
473 473
474 skb = dev_alloc_skb(new_len + 1); 474 skb = dev_alloc_skb(new_len + 1);
475 if(unlikely(!skb)) { 475 if(unlikely(!skb)) {
476 ++mcs->stats.rx_dropped; 476 ++mcs->netdev->stats.rx_dropped;
477 return; 477 return;
478 } 478 }
479 479
@@ -486,8 +486,8 @@ static void mcs_unwrap_fir(struct mcs_cb *mcs, __u8 *buf, int len)
486 486
487 netif_rx(skb); 487 netif_rx(skb);
488 488
489 mcs->stats.rx_packets++; 489 mcs->netdev->stats.rx_packets++;
490 mcs->stats.rx_bytes += new_len; 490 mcs->netdev->stats.rx_bytes += new_len;
491 491
492 return; 492 return;
493} 493}
@@ -756,14 +756,6 @@ static int mcs_net_open(struct net_device *netdev)
756 return ret; 756 return ret;
757} 757}
758 758
759
760/* Get device stats for /proc/net/dev and ifconfig */
761static struct net_device_stats *mcs_net_get_stats(struct net_device *netdev)
762{
763 struct mcs_cb *mcs = netdev_priv(netdev);
764 return &mcs->stats;
765}
766
767/* Receive callback function. */ 759/* Receive callback function. */
768static void mcs_receive_irq(struct urb *urb) 760static void mcs_receive_irq(struct urb *urb)
769{ 761{
@@ -786,14 +778,14 @@ static void mcs_receive_irq(struct urb *urb)
786 */ 778 */
787 /* SIR speed */ 779 /* SIR speed */
788 if(mcs->speed < 576000) { 780 if(mcs->speed < 576000) {
789 async_unwrap_char(mcs->netdev, &mcs->stats, 781 async_unwrap_char(mcs->netdev, &mcs->netdev->stats,
790 &mcs->rx_buff, 0xc0); 782 &mcs->rx_buff, 0xc0);
791 783
792 for (i = 0; i < urb->actual_length; i++) 784 for (i = 0; i < urb->actual_length; i++)
793 async_unwrap_char(mcs->netdev, &mcs->stats, 785 async_unwrap_char(mcs->netdev, &mcs->netdev->stats,
794 &mcs->rx_buff, bytes[i]); 786 &mcs->rx_buff, bytes[i]);
795 787
796 async_unwrap_char(mcs->netdev, &mcs->stats, 788 async_unwrap_char(mcs->netdev, &mcs->netdev->stats,
797 &mcs->rx_buff, 0xc1); 789 &mcs->rx_buff, 0xc1);
798 } 790 }
799 /* MIR speed */ 791 /* MIR speed */
@@ -868,12 +860,12 @@ static int mcs_hard_xmit(struct sk_buff *skb, struct net_device *ndev)
868 case -EPIPE: 860 case -EPIPE:
869 break; 861 break;
870 default: 862 default:
871 mcs->stats.tx_errors++; 863 mcs->netdev->stats.tx_errors++;
872 netif_start_queue(ndev); 864 netif_start_queue(ndev);
873 } 865 }
874 } else { 866 } else {
875 mcs->stats.tx_packets++; 867 mcs->netdev->stats.tx_packets++;
876 mcs->stats.tx_bytes += skb->len; 868 mcs->netdev->stats.tx_bytes += skb->len;
877 } 869 }
878 870
879 dev_kfree_skb(skb); 871 dev_kfree_skb(skb);
@@ -931,7 +923,6 @@ static int mcs_probe(struct usb_interface *intf,
931 ndev->hard_start_xmit = mcs_hard_xmit; 923 ndev->hard_start_xmit = mcs_hard_xmit;
932 ndev->open = mcs_net_open; 924 ndev->open = mcs_net_open;
933 ndev->stop = mcs_net_close; 925 ndev->stop = mcs_net_close;
934 ndev->get_stats = mcs_net_get_stats;
935 ndev->do_ioctl = mcs_net_ioctl; 926 ndev->do_ioctl = mcs_net_ioctl;
936 927
937 if (!intf->cur_altsetting) 928 if (!intf->cur_altsetting)