diff options
author | Stephen Hemminger <shemminger@linux-foundation.org> | 2009-01-09 08:01:37 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-01-21 17:02:38 -0500 |
commit | 3c94acb7ee343e49075c8f3c72c1920633fc230c (patch) | |
tree | a067a2c0f3442e7fcfddb99df1a1f7395bdda5b8 /drivers/net/hamradio/yam.c | |
parent | 2d8b223d81a385a746befc7facf93680f4185533 (diff) |
yam: convert to internal net_device_stats
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/hamradio/yam.c')
-rw-r--r-- | drivers/net/hamradio/yam.c | 42 |
1 files changed, 9 insertions, 33 deletions
diff --git a/drivers/net/hamradio/yam.c b/drivers/net/hamradio/yam.c index 5407f7486c9c..be280871e9ac 100644 --- a/drivers/net/hamradio/yam.c +++ b/drivers/net/hamradio/yam.c | |||
@@ -115,10 +115,6 @@ struct yam_port { | |||
115 | 115 | ||
116 | struct net_device *dev; | 116 | struct net_device *dev; |
117 | 117 | ||
118 | /* Stats section */ | ||
119 | |||
120 | struct net_device_stats stats; | ||
121 | |||
122 | int nb_rxint; | 118 | int nb_rxint; |
123 | int nb_mdint; | 119 | int nb_mdint; |
124 | 120 | ||
@@ -507,7 +503,7 @@ static inline void yam_rx_flag(struct net_device *dev, struct yam_port *yp) | |||
507 | } else { | 503 | } else { |
508 | if (!(skb = dev_alloc_skb(pkt_len))) { | 504 | if (!(skb = dev_alloc_skb(pkt_len))) { |
509 | printk(KERN_WARNING "%s: memory squeeze, dropping packet\n", dev->name); | 505 | printk(KERN_WARNING "%s: memory squeeze, dropping packet\n", dev->name); |
510 | ++yp->stats.rx_dropped; | 506 | ++dev->stats.rx_dropped; |
511 | } else { | 507 | } else { |
512 | unsigned char *cp; | 508 | unsigned char *cp; |
513 | cp = skb_put(skb, pkt_len); | 509 | cp = skb_put(skb, pkt_len); |
@@ -515,7 +511,7 @@ static inline void yam_rx_flag(struct net_device *dev, struct yam_port *yp) | |||
515 | memcpy(cp, yp->rx_buf, pkt_len - 1); | 511 | memcpy(cp, yp->rx_buf, pkt_len - 1); |
516 | skb->protocol = ax25_type_trans(skb, dev); | 512 | skb->protocol = ax25_type_trans(skb, dev); |
517 | netif_rx(skb); | 513 | netif_rx(skb); |
518 | ++yp->stats.rx_packets; | 514 | ++dev->stats.rx_packets; |
519 | } | 515 | } |
520 | } | 516 | } |
521 | } | 517 | } |
@@ -677,7 +673,7 @@ static void yam_tx_byte(struct net_device *dev, struct yam_port *yp) | |||
677 | yp->tx_count = 1; | 673 | yp->tx_count = 1; |
678 | yp->tx_state = TX_HEAD; | 674 | yp->tx_state = TX_HEAD; |
679 | } | 675 | } |
680 | ++yp->stats.tx_packets; | 676 | ++dev->stats.tx_packets; |
681 | break; | 677 | break; |
682 | case TX_TAIL: | 678 | case TX_TAIL: |
683 | if (--yp->tx_count <= 0) { | 679 | if (--yp->tx_count <= 0) { |
@@ -716,7 +712,7 @@ static irqreturn_t yam_interrupt(int irq, void *dev_id) | |||
716 | handled = 1; | 712 | handled = 1; |
717 | 713 | ||
718 | if (lsr & LSR_OE) | 714 | if (lsr & LSR_OE) |
719 | ++yp->stats.rx_fifo_errors; | 715 | ++dev->stats.rx_fifo_errors; |
720 | 716 | ||
721 | yp->dcd = (msr & RX_DCD) ? 1 : 0; | 717 | yp->dcd = (msr & RX_DCD) ? 1 : 0; |
722 | 718 | ||
@@ -778,11 +774,11 @@ static int yam_seq_show(struct seq_file *seq, void *v) | |||
778 | seq_printf(seq, " TxTail %u\n", yp->txtail); | 774 | seq_printf(seq, " TxTail %u\n", yp->txtail); |
779 | seq_printf(seq, " SlotTime %u\n", yp->slot); | 775 | seq_printf(seq, " SlotTime %u\n", yp->slot); |
780 | seq_printf(seq, " Persist %u\n", yp->pers); | 776 | seq_printf(seq, " Persist %u\n", yp->pers); |
781 | seq_printf(seq, " TxFrames %lu\n", yp->stats.tx_packets); | 777 | seq_printf(seq, " TxFrames %lu\n", dev->stats.tx_packets); |
782 | seq_printf(seq, " RxFrames %lu\n", yp->stats.rx_packets); | 778 | seq_printf(seq, " RxFrames %lu\n", dev->stats.rx_packets); |
783 | seq_printf(seq, " TxInt %u\n", yp->nb_mdint); | 779 | seq_printf(seq, " TxInt %u\n", yp->nb_mdint); |
784 | seq_printf(seq, " RxInt %u\n", yp->nb_rxint); | 780 | seq_printf(seq, " RxInt %u\n", yp->nb_rxint); |
785 | seq_printf(seq, " RxOver %lu\n", yp->stats.rx_fifo_errors); | 781 | seq_printf(seq, " RxOver %lu\n", dev->stats.rx_fifo_errors); |
786 | seq_printf(seq, "\n"); | 782 | seq_printf(seq, "\n"); |
787 | return 0; | 783 | return 0; |
788 | } | 784 | } |
@@ -812,26 +808,6 @@ static const struct file_operations yam_info_fops = { | |||
812 | 808 | ||
813 | /* --------------------------------------------------------------------- */ | 809 | /* --------------------------------------------------------------------- */ |
814 | 810 | ||
815 | static struct net_device_stats *yam_get_stats(struct net_device *dev) | ||
816 | { | ||
817 | struct yam_port *yp; | ||
818 | |||
819 | if (!dev) | ||
820 | return NULL; | ||
821 | |||
822 | yp = netdev_priv(dev); | ||
823 | if (yp->magic != YAM_MAGIC) | ||
824 | return NULL; | ||
825 | |||
826 | /* | ||
827 | * Get the current statistics. This may be called with the | ||
828 | * card open or closed. | ||
829 | */ | ||
830 | return &yp->stats; | ||
831 | } | ||
832 | |||
833 | /* --------------------------------------------------------------------- */ | ||
834 | |||
835 | static int yam_open(struct net_device *dev) | 811 | static int yam_open(struct net_device *dev) |
836 | { | 812 | { |
837 | struct yam_port *yp = netdev_priv(dev); | 813 | struct yam_port *yp = netdev_priv(dev); |
@@ -878,9 +854,9 @@ static int yam_open(struct net_device *dev) | |||
878 | /* Reset overruns for all ports - FPGA programming makes overruns */ | 854 | /* Reset overruns for all ports - FPGA programming makes overruns */ |
879 | for (i = 0; i < NR_PORTS; i++) { | 855 | for (i = 0; i < NR_PORTS; i++) { |
880 | struct net_device *dev = yam_devs[i]; | 856 | struct net_device *dev = yam_devs[i]; |
881 | struct yam_port *yp = netdev_priv(dev); | 857 | |
882 | inb(LSR(dev->base_addr)); | 858 | inb(LSR(dev->base_addr)); |
883 | yp->stats.rx_fifo_errors = 0; | 859 | dev->stats.rx_fifo_errors = 0; |
884 | } | 860 | } |
885 | 861 | ||
886 | printk(KERN_INFO "%s at iobase 0x%lx irq %u uart %s\n", dev->name, dev->base_addr, dev->irq, | 862 | printk(KERN_INFO "%s at iobase 0x%lx irq %u uart %s\n", dev->name, dev->base_addr, dev->irq, |