arcnet: use netstats in net_device structure
Subsystems (3)
PATCH 1/1 arcnet: use netstats in net_device structure
Use net_device_stats from net_device structure instead of local. Kill arcnet_get_stats function, because by default it is used identical internal_stats function from net/core/dev.c
Signed-off-by Paulius Zaleckas <[email protected]>
drivers/net/arcnet/arc-rawmode.c +1 -1
@@ -102,7 +102,7 @@ static void rx(struct net_device *dev, int bufnum, skb =alloc_skb (length +ARC_HDR_SIZE ,GFP_ATOMIC );if (skb ==NULL ) {BUGMSG (D_NORMAL ,"Memory squeeze, dropping packet.\n" ); - lp->stats.rx_dropped++; + dev->stats.rx_dropped++;return ; }skb_put (skb, length +ARC_HDR_SIZE );
drivers/net/arcnet/arcnet.c +12 -26
@@ -105,7 +105,6 @@ static int arcnet_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, const void *daddr, const void *saddr, unsigned len);static int arcnet_rebuild_header (struct sk_buff *skb); -static struct net_device_stats *arcnet_get_stats (struct net_device *dev);static int go_tx (struct net_device *dev);static int debug =ARCNET_DEBUG ;
@@ -347,7 +346,6 @@ static void arcdev_setup(struct net_device *dev) dev->stop = arcnet_close; dev->hard_start_xmit = arcnet_send_packet; dev->tx_timeout = arcnet_timeout; - dev->get_stats = arcnet_get_stats; }struct net_device *alloc_arcdev (char *name)
@@ -583,8 +581,8 @@ static int arcnet_rebuild_header(struct sk_buff *skb) }else {BUGMSG (D_NORMAL ,"I don't understand ethernet protocol %Xh addresses!\n" , type); - lp->stats.tx_errors++; - lp->stats.tx_aborted_errors++; + dev->stats.tx_errors++; + dev->stats.tx_aborted_errors++; }/* 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) !proto->ack_tx) { /* done right away and we don't want to acknowledge the package later - forget about it now */ - lp->stats.tx_bytes += skb->len; + dev->stats.tx_bytes += skb->len; freeskb = 1; } else {/* do it the 'split' way */
@@ -709,7 +707,7 @@ static int go_tx(struct net_device *dev)/* start sending */ ACOMMAND (TXcmd | (lp->cur_tx <<3 )); - lp->stats.tx_packets++; + dev->stats.tx_packets++; lp->lasttrans_dest = lp->lastload_dest; lp->lastload_dest =0 ; lp->excnak_pending =0 ;
@@ -732,11 +730,11 @@ static void arcnet_timeout(struct net_device *dev) msg =" - missed IRQ?" ; }else { msg ="" ; - lp->stats.tx_aborted_errors++; + dev->stats.tx_aborted_errors++; lp->timed_out =1 ;ACOMMAND (NOTXcmd | (lp->cur_tx <<3 )); } - lp->stats.tx_errors++; + dev->stats.tx_errors++;/* make sure we didn't miss a TX or a EXC NAK IRQ */ AINTMASK (0 );
@@ -865,8 +863,8 @@ irqreturn_t arcnet_interrupt(int irq, void *dev_id)"transmit was not acknowledged! " "(status=%Xh, dest=%02Xh)\n" , status, lp->lasttrans_dest); - lp->stats.tx_errors++; - lp->stats.tx_carrier_errors++; + dev->stats.tx_errors++; + dev->stats.tx_carrier_errors++; }else {BUGMSG (D_DURING , "broadcast was not acknowledged; that's normal "
@@ -905,7 +903,7 @@ irqreturn_t arcnet_interrupt(int irq, void *dev_id)if (txbuf !=-1 ) {if (lp->outgoing.proto->continue_tx (dev, txbuf)) {/* that was the last segment */ - lp->stats.tx_bytes += lp->outgoing.skb->len; + dev->stats.tx_bytes += lp->outgoing.skb->len;if (!lp->outgoing.proto->ack_tx) {dev_kfree_skb_irq (lp->outgoing.skb);
@@ -930,7 +928,7 @@ irqreturn_t arcnet_interrupt(int irq, void *dev_id) }if (status & lp->intmask & RECONflag) {ACOMMAND (CFLAGScmd | CONFIGclear); - lp->stats.tx_carrier_errors++; + dev->stats.tx_carrier_errors++;BUGMSG (D_RECON ,"Network reconfiguration detected (status=%Xh)\n" , status);
@@ -1038,8 +1036,8 @@ static void arcnet_rx(struct net_device *dev, int bufnum)"(%d+4 bytes)\n" , bufnum, pkt.hard.source, pkt.hard.dest, length); - lp->stats.rx_packets++; - lp->stats.rx_bytes += length +ARC_HDR_SIZE ; + dev->stats.rx_packets++; + dev->stats.rx_bytes += length +ARC_HDR_SIZE ;/* call the right receiver for the protocol */ if (arc_proto_map[soft->proto]->is_ip) {
@@ -1067,18 +1065,6 @@ static void arcnet_rx(struct net_device *dev, int bufnum) } - -/* -* Get the current statistics. This may be called with the card open or -* closed. -*/ -static struct net_device_stats *arcnet_get_stats (struct net_device *dev) -{ -struct arcnet_local *lp = dev->priv; -return &lp->stats; -} - -static void null_rx (struct net_device *dev,int bufnum,struct archdr *pkthdr,int length) {
drivers/net/arcnet/capmode.c +1 -1
@@ -119,7 +119,7 @@ static void rx(struct net_device *dev, int bufnum, skb =alloc_skb (length +ARC_HDR_SIZE +sizeof (int ),GFP_ATOMIC );if (skb ==NULL ) {BUGMSG (D_NORMAL ,"Memory squeeze, dropping packet.\n" ); - lp->stats.rx_dropped++; + dev->stats.rx_dropped++;return ; }skb_put (skb, length +ARC_HDR_SIZE +sizeof (int ));
drivers/net/arcnet/rfc1051.c +5 -7
@@ -88,7 +88,6 @@ MODULE_LICENSE("GPL");*/ static __be16 type_trans (struct sk_buff *skb,struct net_device *dev) { -struct arcnet_local *lp = dev->priv;struct archdr *pkt = (struct archdr *) skb->data;struct arc_rfc1051 *soft = &pkt->soft.rfc1051;int hdr_size =ARC_HDR_SIZE +RFC1051_HDR_SIZE ;
@@ -112,8 +111,8 @@ static __be16 type_trans(struct sk_buff *skb, struct net_device *dev)return htons (ETH_P_ARP );default : - lp->stats.rx_errors++; - lp->stats.rx_crc_errors++; + dev->stats.rx_errors++; + dev->stats.rx_crc_errors++;return 0 ; }
@@ -140,7 +139,7 @@ static void rx(struct net_device *dev, int bufnum, skb =alloc_skb (length +ARC_HDR_SIZE ,GFP_ATOMIC );if (skb ==NULL ) {BUGMSG (D_NORMAL ,"Memory squeeze, dropping packet.\n" ); - lp->stats.rx_dropped++; + dev->stats.rx_dropped++;return ; }skb_put (skb, length +ARC_HDR_SIZE );
@@ -169,7 +168,6 @@ static void rx(struct net_device *dev, int bufnum,static int build_header (struct sk_buff *skb,struct net_device *dev,unsigned short type,uint8_t daddr) { -struct arcnet_local *lp = dev->priv;int hdr_size =ARC_HDR_SIZE +RFC1051_HDR_SIZE ;struct archdr *pkt = (struct archdr *)skb_push (skb, hdr_size);struct arc_rfc1051 *soft = &pkt->soft.rfc1051;
@@ -185,8 +183,8 @@ static int build_header(struct sk_buff *skb, struct net_device *dev,default :BUGMSG (D_NORMAL ,"RFC1051: I don't understand protocol %d (%Xh)\n" , type, type); - lp->stats.tx_errors++; - lp->stats.tx_aborted_errors++; + dev->stats.tx_errors++; + dev->stats.tx_aborted_errors++;return 0 ; }
drivers/net/arcnet/rfc1201.c +23 -24
131 lines not on this page · raw message
include/linux/arcdevice.h +0 -2
@@ -235,8 +235,6 @@ struct Outgoing {struct arcnet_local { -struct net_device_stats stats; -uint8_t config,/* current value of CONFIG register */ timeout,/* Extended timeout for COM20020 */ backplane, /* Backplane flag for COM20020 */