aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/smc9194.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/smc9194.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/smc9194.c')
-rw-r--r--drivers/net/smc9194.c59
1 files changed, 17 insertions, 42 deletions
diff --git a/drivers/net/smc9194.c b/drivers/net/smc9194.c
index 0a79516d196e..5b6748e3ea0e 100644
--- a/drivers/net/smc9194.c
+++ b/drivers/net/smc9194.c
@@ -191,13 +191,6 @@ static struct devlist smc_devlist[] __initdata = {
191/* store this information for the driver.. */ 191/* store this information for the driver.. */
192struct smc_local { 192struct smc_local {
193 /* 193 /*
194 these are things that the kernel wants me to keep, so users
195 can find out semi-useless statistics of how well the card is
196 performing
197 */
198 struct net_device_stats stats;
199
200 /*
201 If I have to wait until memory is available to send 194 If I have to wait until memory is available to send
202 a packet, I will store the skbuff here, until I get the 195 a packet, I will store the skbuff here, until I get the
203 desired memory. Then, I'll send it out and free it. 196 desired memory. Then, I'll send it out and free it.
@@ -249,12 +242,6 @@ static void smc_timeout(struct net_device *dev);
249static int smc_close(struct net_device *dev); 242static int smc_close(struct net_device *dev);
250 243
251/* 244/*
252 . This routine allows the proc file system to query the driver's
253 . statistics.
254*/
255static struct net_device_stats * smc_query_statistics( struct net_device *dev);
256
257/*
258 . Finally, a call to set promiscuous mode ( for TCPDUMP and related 245 . Finally, a call to set promiscuous mode ( for TCPDUMP and related
259 . programs ) and multicast modes. 246 . programs ) and multicast modes.
260*/ 247*/
@@ -514,7 +501,7 @@ static int smc_wait_to_send_packet( struct sk_buff * skb, struct net_device * de
514 501
515 if ( lp->saved_skb) { 502 if ( lp->saved_skb) {
516 /* THIS SHOULD NEVER HAPPEN. */ 503 /* THIS SHOULD NEVER HAPPEN. */
517 lp->stats.tx_aborted_errors++; 504 dev->stats.tx_aborted_errors++;
518 printk(CARDNAME": Bad Craziness - sent packet while busy.\n" ); 505 printk(CARDNAME": Bad Craziness - sent packet while busy.\n" );
519 return 1; 506 return 1;
520 } 507 }
@@ -1065,7 +1052,6 @@ static int __init smc_probe(struct net_device *dev, int ioaddr)
1065 dev->hard_start_xmit = smc_wait_to_send_packet; 1052 dev->hard_start_xmit = smc_wait_to_send_packet;
1066 dev->tx_timeout = smc_timeout; 1053 dev->tx_timeout = smc_timeout;
1067 dev->watchdog_timeo = HZ/20; 1054 dev->watchdog_timeo = HZ/20;
1068 dev->get_stats = smc_query_statistics;
1069 dev->set_multicast_list = smc_set_multicast_list; 1055 dev->set_multicast_list = smc_set_multicast_list;
1070 1056
1071 return 0; 1057 return 0;
@@ -1199,7 +1185,6 @@ static void smc_timeout(struct net_device *dev)
1199*/ 1185*/
1200static void smc_rcv(struct net_device *dev) 1186static void smc_rcv(struct net_device *dev)
1201{ 1187{
1202 struct smc_local *lp = netdev_priv(dev);
1203 int ioaddr = dev->base_addr; 1188 int ioaddr = dev->base_addr;
1204 int packet_number; 1189 int packet_number;
1205 word status; 1190 word status;
@@ -1243,13 +1228,13 @@ static void smc_rcv(struct net_device *dev)
1243 1228
1244 /* set multicast stats */ 1229 /* set multicast stats */
1245 if ( status & RS_MULTICAST ) 1230 if ( status & RS_MULTICAST )
1246 lp->stats.multicast++; 1231 dev->stats.multicast++;
1247 1232
1248 skb = dev_alloc_skb( packet_length + 5); 1233 skb = dev_alloc_skb( packet_length + 5);
1249 1234
1250 if ( skb == NULL ) { 1235 if ( skb == NULL ) {
1251 printk(KERN_NOTICE CARDNAME ": Low memory, packet dropped.\n"); 1236 printk(KERN_NOTICE CARDNAME ": Low memory, packet dropped.\n");
1252 lp->stats.rx_dropped++; 1237 dev->stats.rx_dropped++;
1253 goto done; 1238 goto done;
1254 } 1239 }
1255 1240
@@ -1289,16 +1274,16 @@ static void smc_rcv(struct net_device *dev)
1289 skb->protocol = eth_type_trans(skb, dev ); 1274 skb->protocol = eth_type_trans(skb, dev );
1290 netif_rx(skb); 1275 netif_rx(skb);
1291 dev->last_rx = jiffies; 1276 dev->last_rx = jiffies;
1292 lp->stats.rx_packets++; 1277 dev->stats.rx_packets++;
1293 lp->stats.rx_bytes += packet_length; 1278 dev->stats.rx_bytes += packet_length;
1294 } else { 1279 } else {
1295 /* error ... */ 1280 /* error ... */
1296 lp->stats.rx_errors++; 1281 dev->stats.rx_errors++;
1297 1282
1298 if ( status & RS_ALGNERR ) lp->stats.rx_frame_errors++; 1283 if ( status & RS_ALGNERR ) dev->stats.rx_frame_errors++;
1299 if ( status & (RS_TOOSHORT | RS_TOOLONG ) ) 1284 if ( status & (RS_TOOSHORT | RS_TOOLONG ) )
1300 lp->stats.rx_length_errors++; 1285 dev->stats.rx_length_errors++;
1301 if ( status & RS_BADCRC) lp->stats.rx_crc_errors++; 1286 if ( status & RS_BADCRC) dev->stats.rx_crc_errors++;
1302 } 1287 }
1303 1288
1304done: 1289done:
@@ -1346,12 +1331,12 @@ static void smc_tx( struct net_device * dev )
1346 tx_status = inw( ioaddr + DATA_1 ); 1331 tx_status = inw( ioaddr + DATA_1 );
1347 PRINTK3((CARDNAME": TX DONE STATUS: %4x \n", tx_status )); 1332 PRINTK3((CARDNAME": TX DONE STATUS: %4x \n", tx_status ));
1348 1333
1349 lp->stats.tx_errors++; 1334 dev->stats.tx_errors++;
1350 if ( tx_status & TS_LOSTCAR ) lp->stats.tx_carrier_errors++; 1335 if ( tx_status & TS_LOSTCAR ) dev->stats.tx_carrier_errors++;
1351 if ( tx_status & TS_LATCOL ) { 1336 if ( tx_status & TS_LATCOL ) {
1352 printk(KERN_DEBUG CARDNAME 1337 printk(KERN_DEBUG CARDNAME
1353 ": Late collision occurred on last xmit.\n"); 1338 ": Late collision occurred on last xmit.\n");
1354 lp->stats.tx_window_errors++; 1339 dev->stats.tx_window_errors++;
1355 } 1340 }
1356#if 0 1341#if 0
1357 if ( tx_status & TS_16COL ) { ... } 1342 if ( tx_status & TS_16COL ) { ... }
@@ -1446,10 +1431,10 @@ static irqreturn_t smc_interrupt(int irq, void * dev_id)
1446 SMC_SELECT_BANK( 0 ); 1431 SMC_SELECT_BANK( 0 );
1447 card_stats = inw( ioaddr + COUNTER ); 1432 card_stats = inw( ioaddr + COUNTER );
1448 /* single collisions */ 1433 /* single collisions */
1449 lp->stats.collisions += card_stats & 0xF; 1434 dev->stats.collisions += card_stats & 0xF;
1450 card_stats >>= 4; 1435 card_stats >>= 4;
1451 /* multiple collisions */ 1436 /* multiple collisions */
1452 lp->stats.collisions += card_stats & 0xF; 1437 dev->stats.collisions += card_stats & 0xF;
1453 1438
1454 /* these are for when linux supports these statistics */ 1439 /* these are for when linux supports these statistics */
1455 1440
@@ -1458,7 +1443,7 @@ static irqreturn_t smc_interrupt(int irq, void * dev_id)
1458 ": TX_BUFFER_EMPTY handled\n")); 1443 ": TX_BUFFER_EMPTY handled\n"));
1459 outb( IM_TX_EMPTY_INT, ioaddr + INTERRUPT ); 1444 outb( IM_TX_EMPTY_INT, ioaddr + INTERRUPT );
1460 mask &= ~IM_TX_EMPTY_INT; 1445 mask &= ~IM_TX_EMPTY_INT;
1461 lp->stats.tx_packets += lp->packets_waiting; 1446 dev->stats.tx_packets += lp->packets_waiting;
1462 lp->packets_waiting = 0; 1447 lp->packets_waiting = 0;
1463 1448
1464 } else if (status & IM_ALLOC_INT ) { 1449 } else if (status & IM_ALLOC_INT ) {
@@ -1477,8 +1462,8 @@ static irqreturn_t smc_interrupt(int irq, void * dev_id)
1477 1462
1478 PRINTK2((CARDNAME": Handoff done successfully.\n")); 1463 PRINTK2((CARDNAME": Handoff done successfully.\n"));
1479 } else if (status & IM_RX_OVRN_INT ) { 1464 } else if (status & IM_RX_OVRN_INT ) {
1480 lp->stats.rx_errors++; 1465 dev->stats.rx_errors++;
1481 lp->stats.rx_fifo_errors++; 1466 dev->stats.rx_fifo_errors++;
1482 outb( IM_RX_OVRN_INT, ioaddr + INTERRUPT ); 1467 outb( IM_RX_OVRN_INT, ioaddr + INTERRUPT );
1483 } else if (status & IM_EPH_INT ) { 1468 } else if (status & IM_EPH_INT ) {
1484 PRINTK((CARDNAME ": UNSUPPORTED: EPH INTERRUPT \n")); 1469 PRINTK((CARDNAME ": UNSUPPORTED: EPH INTERRUPT \n"));
@@ -1521,16 +1506,6 @@ static int smc_close(struct net_device *dev)
1521 return 0; 1506 return 0;
1522} 1507}
1523 1508
1524/*------------------------------------------------------------
1525 . Get the current statistics.
1526 . This may be called with the card open or closed.
1527 .-------------------------------------------------------------*/
1528static struct net_device_stats* smc_query_statistics(struct net_device *dev) {
1529 struct smc_local *lp = netdev_priv(dev);
1530
1531 return &lp->stats;
1532}
1533
1534/*----------------------------------------------------------- 1509/*-----------------------------------------------------------
1535 . smc_set_multicast_list 1510 . smc_set_multicast_list
1536 . 1511 .