aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/7990.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/7990.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/7990.c')
-rw-r--r--drivers/net/7990.c47
1 files changed, 20 insertions, 27 deletions
diff --git a/drivers/net/7990.c b/drivers/net/7990.c
index e89ace109a5d..224e0bff1ae0 100644
--- a/drivers/net/7990.c
+++ b/drivers/net/7990.c
@@ -305,18 +305,18 @@ static int lance_rx (struct net_device *dev)
305 305
306 /* We got an incomplete frame? */ 306 /* We got an incomplete frame? */
307 if ((bits & LE_R1_POK) != LE_R1_POK) { 307 if ((bits & LE_R1_POK) != LE_R1_POK) {
308 lp->stats.rx_over_errors++; 308 dev->stats.rx_over_errors++;
309 lp->stats.rx_errors++; 309 dev->stats.rx_errors++;
310 continue; 310 continue;
311 } else if (bits & LE_R1_ERR) { 311 } else if (bits & LE_R1_ERR) {
312 /* Count only the end frame as a rx error, 312 /* Count only the end frame as a rx error,
313 * not the beginning 313 * not the beginning
314 */ 314 */
315 if (bits & LE_R1_BUF) lp->stats.rx_fifo_errors++; 315 if (bits & LE_R1_BUF) dev->stats.rx_fifo_errors++;
316 if (bits & LE_R1_CRC) lp->stats.rx_crc_errors++; 316 if (bits & LE_R1_CRC) dev->stats.rx_crc_errors++;
317 if (bits & LE_R1_OFL) lp->stats.rx_over_errors++; 317 if (bits & LE_R1_OFL) dev->stats.rx_over_errors++;
318 if (bits & LE_R1_FRA) lp->stats.rx_frame_errors++; 318 if (bits & LE_R1_FRA) dev->stats.rx_frame_errors++;
319 if (bits & LE_R1_EOP) lp->stats.rx_errors++; 319 if (bits & LE_R1_EOP) dev->stats.rx_errors++;
320 } else { 320 } else {
321 len = (rd->mblength & 0xfff) - 4; 321 len = (rd->mblength & 0xfff) - 4;
322 skb = dev_alloc_skb (len+2); 322 skb = dev_alloc_skb (len+2);
@@ -324,7 +324,7 @@ static int lance_rx (struct net_device *dev)
324 if (skb == 0) { 324 if (skb == 0) {
325 printk ("%s: Memory squeeze, deferring packet.\n", 325 printk ("%s: Memory squeeze, deferring packet.\n",
326 dev->name); 326 dev->name);
327 lp->stats.rx_dropped++; 327 dev->stats.rx_dropped++;
328 rd->mblength = 0; 328 rd->mblength = 0;
329 rd->rmd1_bits = LE_R1_OWN; 329 rd->rmd1_bits = LE_R1_OWN;
330 lp->rx_new = (lp->rx_new + 1) & lp->rx_ring_mod_mask; 330 lp->rx_new = (lp->rx_new + 1) & lp->rx_ring_mod_mask;
@@ -339,8 +339,8 @@ static int lance_rx (struct net_device *dev)
339 skb->protocol = eth_type_trans (skb, dev); 339 skb->protocol = eth_type_trans (skb, dev);
340 netif_rx (skb); 340 netif_rx (skb);
341 dev->last_rx = jiffies; 341 dev->last_rx = jiffies;
342 lp->stats.rx_packets++; 342 dev->stats.rx_packets++;
343 lp->stats.rx_bytes += len; 343 dev->stats.rx_bytes += len;
344 } 344 }
345 345
346 /* Return the packet to the pool */ 346 /* Return the packet to the pool */
@@ -377,12 +377,12 @@ static int lance_tx (struct net_device *dev)
377 if (td->tmd1_bits & LE_T1_ERR) { 377 if (td->tmd1_bits & LE_T1_ERR) {
378 status = td->misc; 378 status = td->misc;
379 379
380 lp->stats.tx_errors++; 380 dev->stats.tx_errors++;
381 if (status & LE_T3_RTY) lp->stats.tx_aborted_errors++; 381 if (status & LE_T3_RTY) dev->stats.tx_aborted_errors++;
382 if (status & LE_T3_LCOL) lp->stats.tx_window_errors++; 382 if (status & LE_T3_LCOL) dev->stats.tx_window_errors++;
383 383
384 if (status & LE_T3_CLOS) { 384 if (status & LE_T3_CLOS) {
385 lp->stats.tx_carrier_errors++; 385 dev->stats.tx_carrier_errors++;
386 if (lp->auto_select) { 386 if (lp->auto_select) {
387 lp->tpe = 1 - lp->tpe; 387 lp->tpe = 1 - lp->tpe;
388 printk("%s: Carrier Lost, trying %s\n", 388 printk("%s: Carrier Lost, trying %s\n",
@@ -400,7 +400,7 @@ static int lance_tx (struct net_device *dev)
400 /* buffer errors and underflows turn off the transmitter */ 400 /* buffer errors and underflows turn off the transmitter */
401 /* Restart the adapter */ 401 /* Restart the adapter */
402 if (status & (LE_T3_BUF|LE_T3_UFL)) { 402 if (status & (LE_T3_BUF|LE_T3_UFL)) {
403 lp->stats.tx_fifo_errors++; 403 dev->stats.tx_fifo_errors++;
404 404
405 printk ("%s: Tx: ERR_BUF|ERR_UFL, restarting\n", 405 printk ("%s: Tx: ERR_BUF|ERR_UFL, restarting\n",
406 dev->name); 406 dev->name);
@@ -420,13 +420,13 @@ static int lance_tx (struct net_device *dev)
420 420
421 /* One collision before packet was sent. */ 421 /* One collision before packet was sent. */
422 if (td->tmd1_bits & LE_T1_EONE) 422 if (td->tmd1_bits & LE_T1_EONE)
423 lp->stats.collisions++; 423 dev->stats.collisions++;
424 424
425 /* More than one collision, be optimistic. */ 425 /* More than one collision, be optimistic. */
426 if (td->tmd1_bits & LE_T1_EMORE) 426 if (td->tmd1_bits & LE_T1_EMORE)
427 lp->stats.collisions += 2; 427 dev->stats.collisions += 2;
428 428
429 lp->stats.tx_packets++; 429 dev->stats.tx_packets++;
430 } 430 }
431 431
432 j = (j + 1) & lp->tx_ring_mod_mask; 432 j = (j + 1) & lp->tx_ring_mod_mask;
@@ -471,9 +471,9 @@ lance_interrupt (int irq, void *dev_id)
471 471
472 /* Log misc errors. */ 472 /* Log misc errors. */
473 if (csr0 & LE_C0_BABL) 473 if (csr0 & LE_C0_BABL)
474 lp->stats.tx_errors++; /* Tx babble. */ 474 dev->stats.tx_errors++; /* Tx babble. */
475 if (csr0 & LE_C0_MISS) 475 if (csr0 & LE_C0_MISS)
476 lp->stats.rx_errors++; /* Missed a Rx frame. */ 476 dev->stats.rx_errors++; /* Missed a Rx frame. */
477 if (csr0 & LE_C0_MERR) { 477 if (csr0 & LE_C0_MERR) {
478 printk("%s: Bus master arbitration failure, status %4.4x.\n", 478 printk("%s: Bus master arbitration failure, status %4.4x.\n",
479 dev->name, csr0); 479 dev->name, csr0);
@@ -589,13 +589,6 @@ int lance_start_xmit (struct sk_buff *skb, struct net_device *dev)
589 return 0; 589 return 0;
590} 590}
591 591
592struct net_device_stats *lance_get_stats (struct net_device *dev)
593{
594 struct lance_private *lp = netdev_priv(dev);
595
596 return &lp->stats;
597}
598
599/* taken from the depca driver via a2065.c */ 592/* taken from the depca driver via a2065.c */
600static void lance_load_multicast (struct net_device *dev) 593static void lance_load_multicast (struct net_device *dev)
601{ 594{