diff options
author | Jeff Garzik <jeff@garzik.org> | 2007-10-03 20:41:50 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:51:16 -0400 |
commit | 09f75cd7bf13720738e6a196cc0107ce9a5bd5a0 (patch) | |
tree | 4c85b0b395abe7f88c87162fc22570e5de255cb1 /drivers/net/myri_sbus.c | |
parent | ff8ac60948ba819b89e9c87083e8050fc2f89999 (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/myri_sbus.c')
-rw-r--r-- | drivers/net/myri_sbus.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/drivers/net/myri_sbus.c b/drivers/net/myri_sbus.c index 331b76c49561..35c4c598c8d2 100644 --- a/drivers/net/myri_sbus.c +++ b/drivers/net/myri_sbus.c | |||
@@ -353,7 +353,7 @@ static void myri_tx(struct myri_eth *mp, struct net_device *dev) | |||
353 | sbus_unmap_single(mp->myri_sdev, dma_addr, skb->len, SBUS_DMA_TODEVICE); | 353 | sbus_unmap_single(mp->myri_sdev, dma_addr, skb->len, SBUS_DMA_TODEVICE); |
354 | dev_kfree_skb(skb); | 354 | dev_kfree_skb(skb); |
355 | mp->tx_skbs[entry] = NULL; | 355 | mp->tx_skbs[entry] = NULL; |
356 | mp->enet_stats.tx_packets++; | 356 | dev->stats.tx_packets++; |
357 | entry = NEXT_TX(entry); | 357 | entry = NEXT_TX(entry); |
358 | } | 358 | } |
359 | mp->tx_old = entry; | 359 | mp->tx_old = entry; |
@@ -434,20 +434,20 @@ static void myri_rx(struct myri_eth *mp, struct net_device *dev) | |||
434 | RX_ALLOC_SIZE, SBUS_DMA_FROMDEVICE); | 434 | RX_ALLOC_SIZE, SBUS_DMA_FROMDEVICE); |
435 | if (len < (ETH_HLEN + MYRI_PAD_LEN) || (skb->data[0] != MYRI_PAD_LEN)) { | 435 | if (len < (ETH_HLEN + MYRI_PAD_LEN) || (skb->data[0] != MYRI_PAD_LEN)) { |
436 | DRX(("ERROR[")); | 436 | DRX(("ERROR[")); |
437 | mp->enet_stats.rx_errors++; | 437 | dev->stats.rx_errors++; |
438 | if (len < (ETH_HLEN + MYRI_PAD_LEN)) { | 438 | if (len < (ETH_HLEN + MYRI_PAD_LEN)) { |
439 | DRX(("BAD_LENGTH] ")); | 439 | DRX(("BAD_LENGTH] ")); |
440 | mp->enet_stats.rx_length_errors++; | 440 | dev->stats.rx_length_errors++; |
441 | } else { | 441 | } else { |
442 | DRX(("NO_PADDING] ")); | 442 | DRX(("NO_PADDING] ")); |
443 | mp->enet_stats.rx_frame_errors++; | 443 | dev->stats.rx_frame_errors++; |
444 | } | 444 | } |
445 | 445 | ||
446 | /* Return it to the LANAI. */ | 446 | /* Return it to the LANAI. */ |
447 | drop_it: | 447 | drop_it: |
448 | drops++; | 448 | drops++; |
449 | DRX(("DROP ")); | 449 | DRX(("DROP ")); |
450 | mp->enet_stats.rx_dropped++; | 450 | dev->stats.rx_dropped++; |
451 | sbus_dma_sync_single_for_device(mp->myri_sdev, | 451 | sbus_dma_sync_single_for_device(mp->myri_sdev, |
452 | sbus_readl(&rxd->myri_scatters[0].addr), | 452 | sbus_readl(&rxd->myri_scatters[0].addr), |
453 | RX_ALLOC_SIZE, | 453 | RX_ALLOC_SIZE, |
@@ -527,8 +527,8 @@ static void myri_rx(struct myri_eth *mp, struct net_device *dev) | |||
527 | netif_rx(skb); | 527 | netif_rx(skb); |
528 | 528 | ||
529 | dev->last_rx = jiffies; | 529 | dev->last_rx = jiffies; |
530 | mp->enet_stats.rx_packets++; | 530 | dev->stats.rx_packets++; |
531 | mp->enet_stats.rx_bytes += len; | 531 | dev->stats.rx_bytes += len; |
532 | next: | 532 | next: |
533 | DRX(("NEXT\n")); | 533 | DRX(("NEXT\n")); |
534 | entry = NEXT_RX(entry); | 534 | entry = NEXT_RX(entry); |
@@ -596,7 +596,7 @@ static void myri_tx_timeout(struct net_device *dev) | |||
596 | 596 | ||
597 | printk(KERN_ERR "%s: transmit timed out, resetting\n", dev->name); | 597 | printk(KERN_ERR "%s: transmit timed out, resetting\n", dev->name); |
598 | 598 | ||
599 | mp->enet_stats.tx_errors++; | 599 | dev->stats.tx_errors++; |
600 | myri_init(mp, 0); | 600 | myri_init(mp, 0); |
601 | netif_wake_queue(dev); | 601 | netif_wake_queue(dev); |
602 | } | 602 | } |
@@ -806,9 +806,6 @@ static int myri_change_mtu(struct net_device *dev, int new_mtu) | |||
806 | return 0; | 806 | return 0; |
807 | } | 807 | } |
808 | 808 | ||
809 | static struct net_device_stats *myri_get_stats(struct net_device *dev) | ||
810 | { return &(((struct myri_eth *)dev->priv)->enet_stats); } | ||
811 | |||
812 | static void myri_set_multicast(struct net_device *dev) | 809 | static void myri_set_multicast(struct net_device *dev) |
813 | { | 810 | { |
814 | /* Do nothing, all MyriCOM nodes transmit multicast frames | 811 | /* Do nothing, all MyriCOM nodes transmit multicast frames |
@@ -1060,7 +1057,6 @@ static int __devinit myri_ether_init(struct sbus_dev *sdev) | |||
1060 | dev->hard_start_xmit = &myri_start_xmit; | 1057 | dev->hard_start_xmit = &myri_start_xmit; |
1061 | dev->tx_timeout = &myri_tx_timeout; | 1058 | dev->tx_timeout = &myri_tx_timeout; |
1062 | dev->watchdog_timeo = 5*HZ; | 1059 | dev->watchdog_timeo = 5*HZ; |
1063 | dev->get_stats = &myri_get_stats; | ||
1064 | dev->set_multicast_list = &myri_set_multicast; | 1060 | dev->set_multicast_list = &myri_set_multicast; |
1065 | dev->irq = sdev->irqs[0]; | 1061 | dev->irq = sdev->irqs[0]; |
1066 | 1062 | ||