Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

wavelan: convert to internal net_device_stats

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Stephen Hemminger and committed by
David S. Miller
385e63fb 1cc5920f

+17 -39
+17 -33
drivers/net/wireless/wavelan_cs.c
··· 1352 1352 * or wireless extensions 1353 1353 */ 1354 1354 1355 - /*------------------------------------------------------------------*/ 1356 - /* 1357 - * Get the current ethernet statistics. This may be called with the 1358 - * card open or closed. 1359 - * Used when the user read /proc/net/dev 1360 - */ 1361 - static en_stats * 1362 - wavelan_get_stats(struct net_device * dev) 1363 - { 1364 - #ifdef DEBUG_IOCTL_TRACE 1365 - printk(KERN_DEBUG "%s: <>wavelan_get_stats()\n", dev->name); 1366 - #endif 1367 - 1368 - return(&((net_local *)netdev_priv(dev))->stats); 1369 - } 1370 1355 1371 1356 /*------------------------------------------------------------------*/ 1372 1357 /* ··· 2802 2817 printk(KERN_INFO "%s: wv_packet_read(): could not alloc_skb(%d, GFP_ATOMIC)\n", 2803 2818 dev->name, sksize); 2804 2819 #endif 2805 - lp->stats.rx_dropped++; 2820 + dev->stats.rx_dropped++; 2806 2821 /* 2807 2822 * Not only do we want to return here, but we also need to drop the 2808 2823 * packet on the floor to clear the interrupt. ··· 2862 2877 netif_rx(skb); 2863 2878 2864 2879 /* Keep stats up to date */ 2865 - lp->stats.rx_packets++; 2866 - lp->stats.rx_bytes += sksize; 2880 + dev->stats.rx_packets++; 2881 + dev->stats.rx_bytes += sksize; 2867 2882 2868 2883 #ifdef DEBUG_RX_TRACE 2869 2884 printk(KERN_DEBUG "%s: <-wv_packet_read()\n", dev->name); ··· 2965 2980 /* Check status */ 2966 2981 if((status & RX_RCV_OK) != RX_RCV_OK) 2967 2982 { 2968 - lp->stats.rx_errors++; 2983 + dev->stats.rx_errors++; 2969 2984 if(status & RX_NO_SFD) 2970 - lp->stats.rx_frame_errors++; 2985 + dev->stats.rx_frame_errors++; 2971 2986 if(status & RX_CRC_ERR) 2972 - lp->stats.rx_crc_errors++; 2987 + dev->stats.rx_crc_errors++; 2973 2988 if(status & RX_OVRRUN) 2974 - lp->stats.rx_over_errors++; 2989 + dev->stats.rx_over_errors++; 2975 2990 2976 2991 #ifdef DEBUG_RX_FAIL 2977 2992 printk(KERN_DEBUG "%s: wv_packet_rcv(): packet not received ok, status = 0x%x\n", ··· 3058 3073 dev->trans_start = jiffies; 3059 3074 3060 3075 /* Keep stats up to date */ 3061 - lp->stats.tx_bytes += length; 3076 + dev->stats.tx_bytes += length; 3062 3077 3063 3078 spin_unlock_irqrestore(&lp->spinlock, flags); 3064 3079 ··· 4091 4106 printk(KERN_INFO "%s: wv_interrupt(): receive buffer overflow\n", 4092 4107 dev->name); 4093 4108 #endif 4094 - lp->stats.rx_over_errors++; 4109 + dev->stats.rx_over_errors++; 4095 4110 lp->overrunning = 1; 4096 4111 } 4097 4112 ··· 4140 4155 /* Check for possible errors */ 4141 4156 if((tx_status & TX_OK) != TX_OK) 4142 4157 { 4143 - lp->stats.tx_errors++; 4158 + dev->stats.tx_errors++; 4144 4159 4145 4160 if(tx_status & TX_FRTL) 4146 4161 { ··· 4155 4170 printk(KERN_DEBUG "%s: wv_interrupt(): DMA underrun\n", 4156 4171 dev->name); 4157 4172 #endif 4158 - lp->stats.tx_aborted_errors++; 4173 + dev->stats.tx_aborted_errors++; 4159 4174 } 4160 4175 if(tx_status & TX_LOST_CTS) 4161 4176 { 4162 4177 #ifdef DEBUG_TX_FAIL 4163 4178 printk(KERN_DEBUG "%s: wv_interrupt(): no CTS\n", dev->name); 4164 4179 #endif 4165 - lp->stats.tx_carrier_errors++; 4180 + dev->stats.tx_carrier_errors++; 4166 4181 } 4167 4182 if(tx_status & TX_LOST_CRS) 4168 4183 { ··· 4170 4185 printk(KERN_DEBUG "%s: wv_interrupt(): no carrier\n", 4171 4186 dev->name); 4172 4187 #endif 4173 - lp->stats.tx_carrier_errors++; 4188 + dev->stats.tx_carrier_errors++; 4174 4189 } 4175 4190 if(tx_status & TX_HRT_BEAT) 4176 4191 { 4177 4192 #ifdef DEBUG_TX_FAIL 4178 4193 printk(KERN_DEBUG "%s: wv_interrupt(): heart beat\n", dev->name); 4179 4194 #endif 4180 - lp->stats.tx_heartbeat_errors++; 4195 + dev->stats.tx_heartbeat_errors++; 4181 4196 } 4182 4197 if(tx_status & TX_DEFER) 4183 4198 { ··· 4201 4216 #endif 4202 4217 if(!(tx_status & TX_NCOL_MASK)) 4203 4218 { 4204 - lp->stats.collisions += 0x10; 4219 + dev->stats.collisions += 0x10; 4205 4220 } 4206 4221 } 4207 4222 } 4208 4223 } /* if(!(tx_status & TX_OK)) */ 4209 4224 4210 - lp->stats.collisions += (tx_status & TX_NCOL_MASK); 4211 - lp->stats.tx_packets++; 4225 + dev->stats.collisions += (tx_status & TX_NCOL_MASK); 4226 + dev->stats.tx_packets++; 4212 4227 4213 4228 netif_wake_queue(dev); 4214 4229 outb(CR0_INT_ACK | OP0_NOP, LCCR(base)); /* Acknowledge the interrupt */ ··· 4499 4514 dev->open = &wavelan_open; 4500 4515 dev->stop = &wavelan_close; 4501 4516 dev->hard_start_xmit = &wavelan_packet_xmit; 4502 - dev->get_stats = &wavelan_get_stats; 4503 4517 dev->set_multicast_list = &wavelan_set_multicast_list; 4504 4518 #ifdef SET_MAC_ADDRESS 4505 4519 dev->set_mac_address = &wavelan_set_mac_address;
-6
drivers/net/wireless/wavelan_cs.p.h
··· 576 576 /****************************** TYPES ******************************/ 577 577 578 578 /* Shortcuts */ 579 - typedef struct net_device_stats en_stats; 580 579 typedef struct iw_statistics iw_stats; 581 580 typedef struct iw_quality iw_qual; 582 581 typedef struct iw_freq iw_freq; ··· 591 592 * For each network interface, Linux keep data in two structure. "device" 592 593 * keep the generic data (same format for everybody) and "net_local" keep 593 594 * the additional specific data. 594 - * Note that some of this specific data is in fact generic (en_stats, for 595 - * example). 596 595 */ 597 596 struct net_local 598 597 { ··· 598 601 struct net_device * dev; /* Reverse link... */ 599 602 spinlock_t spinlock; /* Serialize access to the hardware (SMP) */ 600 603 struct pcmcia_device * link; /* pcmcia structure */ 601 - en_stats stats; /* Ethernet interface statistics */ 602 604 int nresets; /* Number of hw resets */ 603 605 u_char configured; /* If it is configured */ 604 606 u_char reconfig_82593; /* Need to reconfigure the controller */ ··· 690 694 static void 691 695 wv_init_info(struct net_device *); /* display startup info */ 692 696 /* ------------------- IOCTL, STATS & RECONFIG ------------------- */ 693 - static en_stats * 694 - wavelan_get_stats(struct net_device *); /* Give stats /proc/net/dev */ 695 697 static iw_stats * 696 698 wavelan_get_wireless_stats(struct net_device *); 697 699 /* ----------------------- PACKET RECEPTION ----------------------- */