aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/eth16i.c
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2007-10-03 20:41:50 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:51:16 -0400
commit09f75cd7bf13720738e6a196cc0107ce9a5bd5a0 (patch)
tree4c85b0b395abe7f88c87162fc22570e5de255cb1 /drivers/net/eth16i.c
parentff8ac60948ba819b89e9c87083e8050fc2f89999 (diff)
[NET] drivers/net: statistics cleanup #1 -- save memory and shrink code
We now have struct net_device_stats embedded in struct net_device, and the default ->get_stats() hook does the obvious thing for us. Run through drivers/net/* and remove the driver-local storage of statistics, and driver-local ->get_stats() hook where applicable. This was just the low-hanging fruit in drivers/net; plenty more drivers remain to be updated. [ Resolved conflicts with napi_struct changes and fix sunqe build regression... -DaveM ] Signed-off-by: Jeff Garzik <jeff@garzik.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/eth16i.c')
-rw-r--r--drivers/net/eth16i.c49
1 files changed, 19 insertions, 30 deletions
diff --git a/drivers/net/eth16i.c b/drivers/net/eth16i.c
index 0e3b33717cac..243fc6b354b5 100644
--- a/drivers/net/eth16i.c
+++ b/drivers/net/eth16i.c
@@ -380,7 +380,6 @@ static unsigned int eth16i_debug = ETH16I_DEBUG;
380/* Information for each board */ 380/* Information for each board */
381 381
382struct eth16i_local { 382struct eth16i_local {
383 struct net_device_stats stats;
384 unsigned char tx_started; 383 unsigned char tx_started;
385 unsigned char tx_buf_busy; 384 unsigned char tx_buf_busy;
386 unsigned short tx_queue; /* Number of packets in transmit buffer */ 385 unsigned short tx_queue; /* Number of packets in transmit buffer */
@@ -426,8 +425,6 @@ static int eth16i_set_irq(struct net_device *dev);
426static ushort eth16i_parse_mediatype(const char* s); 425static ushort eth16i_parse_mediatype(const char* s);
427#endif 426#endif
428 427
429static struct net_device_stats *eth16i_get_stats(struct net_device *dev);
430
431static char cardname[] __initdata = "ICL EtherTeam 16i/32"; 428static char cardname[] __initdata = "ICL EtherTeam 16i/32";
432 429
433static int __init do_eth16i_probe(struct net_device *dev) 430static int __init do_eth16i_probe(struct net_device *dev)
@@ -557,7 +554,6 @@ static int __init eth16i_probe1(struct net_device *dev, int ioaddr)
557 dev->open = eth16i_open; 554 dev->open = eth16i_open;
558 dev->stop = eth16i_close; 555 dev->stop = eth16i_close;
559 dev->hard_start_xmit = eth16i_tx; 556 dev->hard_start_xmit = eth16i_tx;
560 dev->get_stats = eth16i_get_stats;
561 dev->set_multicast_list = eth16i_multicast; 557 dev->set_multicast_list = eth16i_multicast;
562 dev->tx_timeout = eth16i_timeout; 558 dev->tx_timeout = eth16i_timeout;
563 dev->watchdog_timeo = TX_TIMEOUT; 559 dev->watchdog_timeo = TX_TIMEOUT;
@@ -1045,7 +1041,7 @@ static void eth16i_timeout(struct net_device *dev)
1045 printk(KERN_DEBUG "lp->tx_queue_len = %d\n", lp->tx_queue_len); 1041 printk(KERN_DEBUG "lp->tx_queue_len = %d\n", lp->tx_queue_len);
1046 printk(KERN_DEBUG "lp->tx_started = %d\n", lp->tx_started); 1042 printk(KERN_DEBUG "lp->tx_started = %d\n", lp->tx_started);
1047 } 1043 }
1048 lp->stats.tx_errors++; 1044 dev->stats.tx_errors++;
1049 eth16i_reset(dev); 1045 eth16i_reset(dev);
1050 dev->trans_start = jiffies; 1046 dev->trans_start = jiffies;
1051 outw(ETH16I_INTR_ON, ioaddr + TX_INTR_REG); 1047 outw(ETH16I_INTR_ON, ioaddr + TX_INTR_REG);
@@ -1130,7 +1126,6 @@ static int eth16i_tx(struct sk_buff *skb, struct net_device *dev)
1130 1126
1131static void eth16i_rx(struct net_device *dev) 1127static void eth16i_rx(struct net_device *dev)
1132{ 1128{
1133 struct eth16i_local *lp = netdev_priv(dev);
1134 int ioaddr = dev->base_addr; 1129 int ioaddr = dev->base_addr;
1135 int boguscount = MAX_RX_LOOP; 1130 int boguscount = MAX_RX_LOOP;
1136 1131
@@ -1149,16 +1144,16 @@ static void eth16i_rx(struct net_device *dev)
1149 inb(ioaddr + RECEIVE_MODE_REG), status); 1144 inb(ioaddr + RECEIVE_MODE_REG), status);
1150 1145
1151 if( !(status & PKT_GOOD) ) { 1146 if( !(status & PKT_GOOD) ) {
1152 lp->stats.rx_errors++; 1147 dev->stats.rx_errors++;
1153 1148
1154 if( (pkt_len < ETH_ZLEN) || (pkt_len > ETH_FRAME_LEN) ) { 1149 if( (pkt_len < ETH_ZLEN) || (pkt_len > ETH_FRAME_LEN) ) {
1155 lp->stats.rx_length_errors++; 1150 dev->stats.rx_length_errors++;
1156 eth16i_reset(dev); 1151 eth16i_reset(dev);
1157 return; 1152 return;
1158 } 1153 }
1159 else { 1154 else {
1160 eth16i_skip_packet(dev); 1155 eth16i_skip_packet(dev);
1161 lp->stats.rx_dropped++; 1156 dev->stats.rx_dropped++;
1162 } 1157 }
1163 } 1158 }
1164 else { /* Ok so now we should have a good packet */ 1159 else { /* Ok so now we should have a good packet */
@@ -1169,7 +1164,7 @@ static void eth16i_rx(struct net_device *dev)
1169 printk(KERN_WARNING "%s: Could'n allocate memory for packet (len %d)\n", 1164 printk(KERN_WARNING "%s: Could'n allocate memory for packet (len %d)\n",
1170 dev->name, pkt_len); 1165 dev->name, pkt_len);
1171 eth16i_skip_packet(dev); 1166 eth16i_skip_packet(dev);
1172 lp->stats.rx_dropped++; 1167 dev->stats.rx_dropped++;
1173 break; 1168 break;
1174 } 1169 }
1175 1170
@@ -1212,8 +1207,8 @@ static void eth16i_rx(struct net_device *dev)
1212 } 1207 }
1213 netif_rx(skb); 1208 netif_rx(skb);
1214 dev->last_rx = jiffies; 1209 dev->last_rx = jiffies;
1215 lp->stats.rx_packets++; 1210 dev->stats.rx_packets++;
1216 lp->stats.rx_bytes += pkt_len; 1211 dev->stats.rx_bytes += pkt_len;
1217 1212
1218 } /* else */ 1213 } /* else */
1219 1214
@@ -1250,32 +1245,32 @@ static irqreturn_t eth16i_interrupt(int irq, void *dev_id)
1250 1245
1251 if( status & 0x7f00 ) { 1246 if( status & 0x7f00 ) {
1252 1247
1253 lp->stats.rx_errors++; 1248 dev->stats.rx_errors++;
1254 1249
1255 if(status & (BUS_RD_ERR << 8) ) 1250 if(status & (BUS_RD_ERR << 8) )
1256 printk(KERN_WARNING "%s: Bus read error.\n",dev->name); 1251 printk(KERN_WARNING "%s: Bus read error.\n",dev->name);
1257 if(status & (SHORT_PKT_ERR << 8) ) lp->stats.rx_length_errors++; 1252 if(status & (SHORT_PKT_ERR << 8) ) dev->stats.rx_length_errors++;
1258 if(status & (ALIGN_ERR << 8) ) lp->stats.rx_frame_errors++; 1253 if(status & (ALIGN_ERR << 8) ) dev->stats.rx_frame_errors++;
1259 if(status & (CRC_ERR << 8) ) lp->stats.rx_crc_errors++; 1254 if(status & (CRC_ERR << 8) ) dev->stats.rx_crc_errors++;
1260 if(status & (RX_BUF_OVERFLOW << 8) ) lp->stats.rx_over_errors++; 1255 if(status & (RX_BUF_OVERFLOW << 8) ) dev->stats.rx_over_errors++;
1261 } 1256 }
1262 if( status & 0x001a) { 1257 if( status & 0x001a) {
1263 1258
1264 lp->stats.tx_errors++; 1259 dev->stats.tx_errors++;
1265 1260
1266 if(status & CR_LOST) lp->stats.tx_carrier_errors++; 1261 if(status & CR_LOST) dev->stats.tx_carrier_errors++;
1267 if(status & TX_JABBER_ERR) lp->stats.tx_window_errors++; 1262 if(status & TX_JABBER_ERR) dev->stats.tx_window_errors++;
1268 1263
1269#if 0 1264#if 0
1270 if(status & COLLISION) { 1265 if(status & COLLISION) {
1271 lp->stats.collisions += 1266 dev->stats.collisions +=
1272 ((inb(ioaddr+TRANSMIT_MODE_REG) & 0xF0) >> 4); 1267 ((inb(ioaddr+TRANSMIT_MODE_REG) & 0xF0) >> 4);
1273 } 1268 }
1274#endif 1269#endif
1275 if(status & COLLISIONS_16) { 1270 if(status & COLLISIONS_16) {
1276 if(lp->col_16 < MAX_COL_16) { 1271 if(lp->col_16 < MAX_COL_16) {
1277 lp->col_16++; 1272 lp->col_16++;
1278 lp->stats.collisions++; 1273 dev->stats.collisions++;
1279 /* Resume transmitting, skip failed packet */ 1274 /* Resume transmitting, skip failed packet */
1280 outb(0x02, ioaddr + COL_16_REG); 1275 outb(0x02, ioaddr + COL_16_REG);
1281 } 1276 }
@@ -1288,8 +1283,8 @@ static irqreturn_t eth16i_interrupt(int irq, void *dev_id)
1288 if( status & 0x00ff ) { /* Let's check the transmit status reg */ 1283 if( status & 0x00ff ) { /* Let's check the transmit status reg */
1289 1284
1290 if(status & TX_DONE) { /* The transmit has been done */ 1285 if(status & TX_DONE) { /* The transmit has been done */
1291 lp->stats.tx_packets = lp->tx_buffered_packets; 1286 dev->stats.tx_packets = lp->tx_buffered_packets;
1292 lp->stats.tx_bytes += lp->tx_buffered_bytes; 1287 dev->stats.tx_bytes += lp->tx_buffered_bytes;
1293 lp->col_16 = 0; 1288 lp->col_16 = 0;
1294 1289
1295 if(lp->tx_queue) { /* Is there still packets ? */ 1290 if(lp->tx_queue) { /* Is there still packets ? */
@@ -1369,12 +1364,6 @@ static void eth16i_multicast(struct net_device *dev)
1369 } 1364 }
1370} 1365}
1371 1366
1372static struct net_device_stats *eth16i_get_stats(struct net_device *dev)
1373{
1374 struct eth16i_local *lp = netdev_priv(dev);
1375 return &lp->stats;
1376}
1377
1378static void eth16i_select_regbank(unsigned char banknbr, int ioaddr) 1367static void eth16i_select_regbank(unsigned char banknbr, int ioaddr)
1379{ 1368{
1380 unsigned char data; 1369 unsigned char data;