diff options
author | Stephen Hemminger <shemminger@vyatta.com> | 2009-03-20 15:36:19 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-03-22 01:43:55 -0400 |
commit | fe6c6fbbcdd6675244fbbde62a9790ca57bd2785 (patch) | |
tree | a697d87c86aab93a53fb03c525e5f5d8753e47b0 /drivers/net/wan | |
parent | 39549b1e83e640907b0ed58f76d3331c2ae40e3d (diff) |
sbni: use internal net_device_stats
Convert to use existing net_device_stats.
This driver,
has bad style,
of using commas,
when brackets should be used...
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/wan')
-rw-r--r-- | drivers/net/wan/sbni.c | 68 |
1 files changed, 26 insertions, 42 deletions
diff --git a/drivers/net/wan/sbni.c b/drivers/net/wan/sbni.c index 78f7bc92cbe8..e3031607eaf6 100644 --- a/drivers/net/wan/sbni.c +++ b/drivers/net/wan/sbni.c | |||
@@ -68,7 +68,6 @@ | |||
68 | /* device private data */ | 68 | /* device private data */ |
69 | 69 | ||
70 | struct net_local { | 70 | struct net_local { |
71 | struct net_device_stats stats; | ||
72 | struct timer_list watchdog; | 71 | struct timer_list watchdog; |
73 | 72 | ||
74 | spinlock_t lock; | 73 | spinlock_t lock; |
@@ -117,7 +116,6 @@ static int sbni_open( struct net_device * ); | |||
117 | static int sbni_close( struct net_device * ); | 116 | static int sbni_close( struct net_device * ); |
118 | static int sbni_start_xmit( struct sk_buff *, struct net_device * ); | 117 | static int sbni_start_xmit( struct sk_buff *, struct net_device * ); |
119 | static int sbni_ioctl( struct net_device *, struct ifreq *, int ); | 118 | static int sbni_ioctl( struct net_device *, struct ifreq *, int ); |
120 | static struct net_device_stats *sbni_get_stats( struct net_device * ); | ||
121 | static void set_multicast_list( struct net_device * ); | 119 | static void set_multicast_list( struct net_device * ); |
122 | 120 | ||
123 | static irqreturn_t sbni_interrupt( int, void * ); | 121 | static irqreturn_t sbni_interrupt( int, void * ); |
@@ -723,13 +721,11 @@ upload_data( struct net_device *dev, unsigned framelen, unsigned frameno, | |||
723 | nl->wait_frameno = 0, | 721 | nl->wait_frameno = 0, |
724 | nl->inppos = 0, | 722 | nl->inppos = 0, |
725 | #ifdef CONFIG_SBNI_MULTILINE | 723 | #ifdef CONFIG_SBNI_MULTILINE |
726 | ((struct net_local *)netdev_priv(nl->master)) | 724 | nl->master->stats.rx_errors++, |
727 | ->stats.rx_errors++, | 725 | nl->master->stats.rx_missed_errors++; |
728 | ((struct net_local *)netdev_priv(nl->master)) | ||
729 | ->stats.rx_missed_errors++; | ||
730 | #else | 726 | #else |
731 | nl->stats.rx_errors++, | 727 | dev->stats.rx_errors++, |
732 | nl->stats.rx_missed_errors++; | 728 | dev->stats.rx_missed_errors++; |
733 | #endif | 729 | #endif |
734 | /* now skip all frames until is_first != 0 */ | 730 | /* now skip all frames until is_first != 0 */ |
735 | } else | 731 | } else |
@@ -742,13 +738,11 @@ upload_data( struct net_device *dev, unsigned framelen, unsigned frameno, | |||
742 | */ | 738 | */ |
743 | nl->wait_frameno = 0, | 739 | nl->wait_frameno = 0, |
744 | #ifdef CONFIG_SBNI_MULTILINE | 740 | #ifdef CONFIG_SBNI_MULTILINE |
745 | ((struct net_local *)netdev_priv(nl->master)) | 741 | nl->master->stats.rx_errors++, |
746 | ->stats.rx_errors++, | 742 | nl->master->stats.rx_crc_errors++; |
747 | ((struct net_local *)netdev_priv(nl->master)) | ||
748 | ->stats.rx_crc_errors++; | ||
749 | #else | 743 | #else |
750 | nl->stats.rx_errors++, | 744 | dev->stats.rx_errors++, |
751 | nl->stats.rx_crc_errors++; | 745 | dev->stats.rx_crc_errors++; |
752 | #endif | 746 | #endif |
753 | 747 | ||
754 | return frame_ok; | 748 | return frame_ok; |
@@ -756,15 +750,16 @@ upload_data( struct net_device *dev, unsigned framelen, unsigned frameno, | |||
756 | 750 | ||
757 | 751 | ||
758 | static inline void | 752 | static inline void |
759 | send_complete( struct net_local *nl ) | 753 | send_complete( struct net_device *dev ) |
760 | { | 754 | { |
755 | struct net_local *nl = netdev_priv(dev); | ||
756 | |||
761 | #ifdef CONFIG_SBNI_MULTILINE | 757 | #ifdef CONFIG_SBNI_MULTILINE |
762 | ((struct net_local *)netdev_priv(nl->master))->stats.tx_packets++; | 758 | nl->master->stats.tx_packets++; |
763 | ((struct net_local *)netdev_priv(nl->master))->stats.tx_bytes | 759 | nl->master->stats.tx_bytes += nl->tx_buf_p->len; |
764 | += nl->tx_buf_p->len; | ||
765 | #else | 760 | #else |
766 | nl->stats.tx_packets++; | 761 | dev->stats.tx_packets++; |
767 | nl->stats.tx_bytes += nl->tx_buf_p->len; | 762 | dev->stats.tx_bytes += nl->tx_buf_p->len; |
768 | #endif | 763 | #endif |
769 | dev_kfree_skb_irq( nl->tx_buf_p ); | 764 | dev_kfree_skb_irq( nl->tx_buf_p ); |
770 | 765 | ||
@@ -792,7 +787,7 @@ interpret_ack( struct net_device *dev, unsigned ack ) | |||
792 | nl->maxframe, | 787 | nl->maxframe, |
793 | nl->tx_buf_p->len - nl->outpos); | 788 | nl->tx_buf_p->len - nl->outpos); |
794 | else | 789 | else |
795 | send_complete( nl ), | 790 | send_complete( dev ), |
796 | #ifdef CONFIG_SBNI_MULTILINE | 791 | #ifdef CONFIG_SBNI_MULTILINE |
797 | netif_wake_queue( nl->master ); | 792 | netif_wake_queue( nl->master ); |
798 | #else | 793 | #else |
@@ -881,13 +876,11 @@ drop_xmit_queue( struct net_device *dev ) | |||
881 | dev_kfree_skb_any( nl->tx_buf_p ), | 876 | dev_kfree_skb_any( nl->tx_buf_p ), |
882 | nl->tx_buf_p = NULL, | 877 | nl->tx_buf_p = NULL, |
883 | #ifdef CONFIG_SBNI_MULTILINE | 878 | #ifdef CONFIG_SBNI_MULTILINE |
884 | ((struct net_local *)netdev_priv(nl->master)) | 879 | nl->master->stats.tx_errors++, |
885 | ->stats.tx_errors++, | 880 | nl->master->stats.tx_carrier_errors++; |
886 | ((struct net_local *)netdev_priv(nl->master)) | ||
887 | ->stats.tx_carrier_errors++; | ||
888 | #else | 881 | #else |
889 | nl->stats.tx_errors++, | 882 | dev->stats.tx_errors++, |
890 | nl->stats.tx_carrier_errors++; | 883 | dev->stats.tx_carrier_errors++; |
891 | #endif | 884 | #endif |
892 | 885 | ||
893 | nl->tx_frameno = 0; | 886 | nl->tx_frameno = 0; |
@@ -1017,14 +1010,13 @@ indicate_pkt( struct net_device *dev ) | |||
1017 | #ifdef CONFIG_SBNI_MULTILINE | 1010 | #ifdef CONFIG_SBNI_MULTILINE |
1018 | skb->protocol = eth_type_trans( skb, nl->master ); | 1011 | skb->protocol = eth_type_trans( skb, nl->master ); |
1019 | netif_rx( skb ); | 1012 | netif_rx( skb ); |
1020 | ++((struct net_local *)netdev_priv(nl->master))->stats.rx_packets; | 1013 | ++nl->master->stats.rx_packets; |
1021 | ((struct net_local *)netdev_priv(nl->master))->stats.rx_bytes += | 1014 | nl->master->stats.rx_bytes += nl->inppos; |
1022 | nl->inppos; | ||
1023 | #else | 1015 | #else |
1024 | skb->protocol = eth_type_trans( skb, dev ); | 1016 | skb->protocol = eth_type_trans( skb, dev ); |
1025 | netif_rx( skb ); | 1017 | netif_rx( skb ); |
1026 | ++nl->stats.rx_packets; | 1018 | ++dev->stats.rx_packets; |
1027 | nl->stats.rx_bytes += nl->inppos; | 1019 | dev->stats.rx_bytes += nl->inppos; |
1028 | #endif | 1020 | #endif |
1029 | nl->rx_buf_p = NULL; /* protocol driver will clear this sk_buff */ | 1021 | nl->rx_buf_p = NULL; /* protocol driver will clear this sk_buff */ |
1030 | } | 1022 | } |
@@ -1197,7 +1189,7 @@ sbni_open( struct net_device *dev ) | |||
1197 | handler_attached: | 1189 | handler_attached: |
1198 | 1190 | ||
1199 | spin_lock( &nl->lock ); | 1191 | spin_lock( &nl->lock ); |
1200 | memset( &nl->stats, 0, sizeof(struct net_device_stats) ); | 1192 | memset( &dev->stats, 0, sizeof(struct net_device_stats) ); |
1201 | memset( &nl->in_stats, 0, sizeof(struct sbni_in_stats) ); | 1193 | memset( &nl->in_stats, 0, sizeof(struct sbni_in_stats) ); |
1202 | 1194 | ||
1203 | card_start( dev ); | 1195 | card_start( dev ); |
@@ -1413,7 +1405,7 @@ enslave( struct net_device *dev, struct net_device *slave_dev ) | |||
1413 | 1405 | ||
1414 | /* Summary statistics of MultiLine operation will be stored | 1406 | /* Summary statistics of MultiLine operation will be stored |
1415 | in master's counters */ | 1407 | in master's counters */ |
1416 | memset( &snl->stats, 0, sizeof(struct net_device_stats) ); | 1408 | memset( &slave_dev->stats, 0, sizeof(struct net_device_stats) ); |
1417 | netif_stop_queue( slave_dev ); | 1409 | netif_stop_queue( slave_dev ); |
1418 | netif_wake_queue( dev ); /* Now we are able to transmit */ | 1410 | netif_wake_queue( dev ); /* Now we are able to transmit */ |
1419 | 1411 | ||
@@ -1464,14 +1456,6 @@ emancipate( struct net_device *dev ) | |||
1464 | 1456 | ||
1465 | #endif | 1457 | #endif |
1466 | 1458 | ||
1467 | |||
1468 | static struct net_device_stats * | ||
1469 | sbni_get_stats( struct net_device *dev ) | ||
1470 | { | ||
1471 | return &((struct net_local *)netdev_priv(dev))->stats; | ||
1472 | } | ||
1473 | |||
1474 | |||
1475 | static void | 1459 | static void |
1476 | set_multicast_list( struct net_device *dev ) | 1460 | set_multicast_list( struct net_device *dev ) |
1477 | { | 1461 | { |