diff options
author | Stephen Hemminger <shemminger@linux-foundation.org> | 2009-01-09 08:01:08 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-01-21 17:02:19 -0500 |
commit | 5803c5122acb31ebf5f76b1a9925e2c72c4436e1 (patch) | |
tree | 5c676bbf593c28fd211ea3af451b5040ef1e6700 /drivers/net/arcnet/arcnet.c | |
parent | 60961ce4d09db7c1ba49da3375123a18845ec864 (diff) |
arcnet: convert to internal stats
Use pre-existing network_device_stats inside network_device rather than own
private structure.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/arcnet/arcnet.c')
-rw-r--r-- | drivers/net/arcnet/arcnet.c | 38 |
1 files changed, 12 insertions, 26 deletions
diff --git a/drivers/net/arcnet/arcnet.c b/drivers/net/arcnet/arcnet.c index 6b53e5ed125c..34b9a4d0da30 100644 --- a/drivers/net/arcnet/arcnet.c +++ b/drivers/net/arcnet/arcnet.c | |||
@@ -105,7 +105,6 @@ static int arcnet_header(struct sk_buff *skb, struct net_device *dev, | |||
105 | unsigned short type, const void *daddr, | 105 | unsigned short type, const void *daddr, |
106 | const void *saddr, unsigned len); | 106 | const void *saddr, unsigned len); |
107 | static int arcnet_rebuild_header(struct sk_buff *skb); | 107 | static int arcnet_rebuild_header(struct sk_buff *skb); |
108 | static struct net_device_stats *arcnet_get_stats(struct net_device *dev); | ||
109 | static int go_tx(struct net_device *dev); | 108 | static int go_tx(struct net_device *dev); |
110 | 109 | ||
111 | static int debug = ARCNET_DEBUG; | 110 | static int debug = ARCNET_DEBUG; |
@@ -347,7 +346,6 @@ static void arcdev_setup(struct net_device *dev) | |||
347 | dev->stop = arcnet_close; | 346 | dev->stop = arcnet_close; |
348 | dev->hard_start_xmit = arcnet_send_packet; | 347 | dev->hard_start_xmit = arcnet_send_packet; |
349 | dev->tx_timeout = arcnet_timeout; | 348 | dev->tx_timeout = arcnet_timeout; |
350 | dev->get_stats = arcnet_get_stats; | ||
351 | } | 349 | } |
352 | 350 | ||
353 | struct net_device *alloc_arcdev(char *name) | 351 | struct net_device *alloc_arcdev(char *name) |
@@ -583,8 +581,8 @@ static int arcnet_rebuild_header(struct sk_buff *skb) | |||
583 | } else { | 581 | } else { |
584 | BUGMSG(D_NORMAL, | 582 | BUGMSG(D_NORMAL, |
585 | "I don't understand ethernet protocol %Xh addresses!\n", type); | 583 | "I don't understand ethernet protocol %Xh addresses!\n", type); |
586 | lp->stats.tx_errors++; | 584 | dev->stats.tx_errors++; |
587 | lp->stats.tx_aborted_errors++; | 585 | dev->stats.tx_aborted_errors++; |
588 | } | 586 | } |
589 | 587 | ||
590 | /* if we couldn't resolve the address... give up. */ | 588 | /* if we couldn't resolve the address... give up. */ |
@@ -645,7 +643,7 @@ static int arcnet_send_packet(struct sk_buff *skb, struct net_device *dev) | |||
645 | !proto->ack_tx) { | 643 | !proto->ack_tx) { |
646 | /* done right away and we don't want to acknowledge | 644 | /* done right away and we don't want to acknowledge |
647 | the package later - forget about it now */ | 645 | the package later - forget about it now */ |
648 | lp->stats.tx_bytes += skb->len; | 646 | dev->stats.tx_bytes += skb->len; |
649 | freeskb = 1; | 647 | freeskb = 1; |
650 | } else { | 648 | } else { |
651 | /* do it the 'split' way */ | 649 | /* do it the 'split' way */ |
@@ -709,7 +707,7 @@ static int go_tx(struct net_device *dev) | |||
709 | /* start sending */ | 707 | /* start sending */ |
710 | ACOMMAND(TXcmd | (lp->cur_tx << 3)); | 708 | ACOMMAND(TXcmd | (lp->cur_tx << 3)); |
711 | 709 | ||
712 | lp->stats.tx_packets++; | 710 | dev->stats.tx_packets++; |
713 | lp->lasttrans_dest = lp->lastload_dest; | 711 | lp->lasttrans_dest = lp->lastload_dest; |
714 | lp->lastload_dest = 0; | 712 | lp->lastload_dest = 0; |
715 | lp->excnak_pending = 0; | 713 | lp->excnak_pending = 0; |
@@ -732,11 +730,11 @@ static void arcnet_timeout(struct net_device *dev) | |||
732 | msg = " - missed IRQ?"; | 730 | msg = " - missed IRQ?"; |
733 | } else { | 731 | } else { |
734 | msg = ""; | 732 | msg = ""; |
735 | lp->stats.tx_aborted_errors++; | 733 | dev->stats.tx_aborted_errors++; |
736 | lp->timed_out = 1; | 734 | lp->timed_out = 1; |
737 | ACOMMAND(NOTXcmd | (lp->cur_tx << 3)); | 735 | ACOMMAND(NOTXcmd | (lp->cur_tx << 3)); |
738 | } | 736 | } |
739 | lp->stats.tx_errors++; | 737 | dev->stats.tx_errors++; |
740 | 738 | ||
741 | /* make sure we didn't miss a TX or a EXC NAK IRQ */ | 739 | /* make sure we didn't miss a TX or a EXC NAK IRQ */ |
742 | AINTMASK(0); | 740 | AINTMASK(0); |
@@ -865,8 +863,8 @@ irqreturn_t arcnet_interrupt(int irq, void *dev_id) | |||
865 | "transmit was not acknowledged! " | 863 | "transmit was not acknowledged! " |
866 | "(status=%Xh, dest=%02Xh)\n", | 864 | "(status=%Xh, dest=%02Xh)\n", |
867 | status, lp->lasttrans_dest); | 865 | status, lp->lasttrans_dest); |
868 | lp->stats.tx_errors++; | 866 | dev->stats.tx_errors++; |
869 | lp->stats.tx_carrier_errors++; | 867 | dev->stats.tx_carrier_errors++; |
870 | } else { | 868 | } else { |
871 | BUGMSG(D_DURING, | 869 | BUGMSG(D_DURING, |
872 | "broadcast was not acknowledged; that's normal " | 870 | "broadcast was not acknowledged; that's normal " |
@@ -905,7 +903,7 @@ irqreturn_t arcnet_interrupt(int irq, void *dev_id) | |||
905 | if (txbuf != -1) { | 903 | if (txbuf != -1) { |
906 | if (lp->outgoing.proto->continue_tx(dev, txbuf)) { | 904 | if (lp->outgoing.proto->continue_tx(dev, txbuf)) { |
907 | /* that was the last segment */ | 905 | /* that was the last segment */ |
908 | lp->stats.tx_bytes += lp->outgoing.skb->len; | 906 | dev->stats.tx_bytes += lp->outgoing.skb->len; |
909 | if(!lp->outgoing.proto->ack_tx) | 907 | if(!lp->outgoing.proto->ack_tx) |
910 | { | 908 | { |
911 | dev_kfree_skb_irq(lp->outgoing.skb); | 909 | dev_kfree_skb_irq(lp->outgoing.skb); |
@@ -930,7 +928,7 @@ irqreturn_t arcnet_interrupt(int irq, void *dev_id) | |||
930 | } | 928 | } |
931 | if (status & lp->intmask & RECONflag) { | 929 | if (status & lp->intmask & RECONflag) { |
932 | ACOMMAND(CFLAGScmd | CONFIGclear); | 930 | ACOMMAND(CFLAGScmd | CONFIGclear); |
933 | lp->stats.tx_carrier_errors++; | 931 | dev->stats.tx_carrier_errors++; |
934 | 932 | ||
935 | BUGMSG(D_RECON, "Network reconfiguration detected (status=%Xh)\n", | 933 | BUGMSG(D_RECON, "Network reconfiguration detected (status=%Xh)\n", |
936 | status); | 934 | status); |
@@ -1038,8 +1036,8 @@ static void arcnet_rx(struct net_device *dev, int bufnum) | |||
1038 | "(%d+4 bytes)\n", | 1036 | "(%d+4 bytes)\n", |
1039 | bufnum, pkt.hard.source, pkt.hard.dest, length); | 1037 | bufnum, pkt.hard.source, pkt.hard.dest, length); |
1040 | 1038 | ||
1041 | lp->stats.rx_packets++; | 1039 | dev->stats.rx_packets++; |
1042 | lp->stats.rx_bytes += length + ARC_HDR_SIZE; | 1040 | dev->stats.rx_bytes += length + ARC_HDR_SIZE; |
1043 | 1041 | ||
1044 | /* call the right receiver for the protocol */ | 1042 | /* call the right receiver for the protocol */ |
1045 | if (arc_proto_map[soft->proto]->is_ip) { | 1043 | if (arc_proto_map[soft->proto]->is_ip) { |
@@ -1067,18 +1065,6 @@ static void arcnet_rx(struct net_device *dev, int bufnum) | |||
1067 | } | 1065 | } |
1068 | 1066 | ||
1069 | 1067 | ||
1070 | |||
1071 | /* | ||
1072 | * Get the current statistics. This may be called with the card open or | ||
1073 | * closed. | ||
1074 | */ | ||
1075 | static struct net_device_stats *arcnet_get_stats(struct net_device *dev) | ||
1076 | { | ||
1077 | struct arcnet_local *lp = netdev_priv(dev); | ||
1078 | return &lp->stats; | ||
1079 | } | ||
1080 | |||
1081 | |||
1082 | static void null_rx(struct net_device *dev, int bufnum, | 1068 | static void null_rx(struct net_device *dev, int bufnum, |
1083 | struct archdr *pkthdr, int length) | 1069 | struct archdr *pkthdr, int length) |
1084 | { | 1070 | { |