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/plip.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/plip.c')
-rw-r--r-- | drivers/net/plip.c | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/drivers/net/plip.c b/drivers/net/plip.c index 2cfab4b36654..c17d9ac9ff30 100644 --- a/drivers/net/plip.c +++ b/drivers/net/plip.c | |||
@@ -154,7 +154,6 @@ static int plip_hard_header_cache(struct neighbour *neigh, | |||
154 | struct hh_cache *hh); | 154 | struct hh_cache *hh); |
155 | static int plip_open(struct net_device *dev); | 155 | static int plip_open(struct net_device *dev); |
156 | static int plip_close(struct net_device *dev); | 156 | static int plip_close(struct net_device *dev); |
157 | static struct net_device_stats *plip_get_stats(struct net_device *dev); | ||
158 | static int plip_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); | 157 | static int plip_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); |
159 | static int plip_preempt(void *handle); | 158 | static int plip_preempt(void *handle); |
160 | static void plip_wakeup(void *handle); | 159 | static void plip_wakeup(void *handle); |
@@ -206,7 +205,6 @@ struct plip_local { | |||
206 | }; | 205 | }; |
207 | 206 | ||
208 | struct net_local { | 207 | struct net_local { |
209 | struct net_device_stats enet_stats; | ||
210 | struct net_device *dev; | 208 | struct net_device *dev; |
211 | struct work_struct immediate; | 209 | struct work_struct immediate; |
212 | struct delayed_work deferred; | 210 | struct delayed_work deferred; |
@@ -285,7 +283,6 @@ plip_init_netdev(struct net_device *dev) | |||
285 | dev->hard_start_xmit = plip_tx_packet; | 283 | dev->hard_start_xmit = plip_tx_packet; |
286 | dev->open = plip_open; | 284 | dev->open = plip_open; |
287 | dev->stop = plip_close; | 285 | dev->stop = plip_close; |
288 | dev->get_stats = plip_get_stats; | ||
289 | dev->do_ioctl = plip_ioctl; | 286 | dev->do_ioctl = plip_ioctl; |
290 | dev->header_cache_update = NULL; | 287 | dev->header_cache_update = NULL; |
291 | dev->tx_queue_len = 10; | 288 | dev->tx_queue_len = 10; |
@@ -430,8 +427,8 @@ plip_bh_timeout_error(struct net_device *dev, struct net_local *nl, | |||
430 | dev->name, snd->state, c0); | 427 | dev->name, snd->state, c0); |
431 | } else | 428 | } else |
432 | error = HS_TIMEOUT; | 429 | error = HS_TIMEOUT; |
433 | nl->enet_stats.tx_errors++; | 430 | dev->stats.tx_errors++; |
434 | nl->enet_stats.tx_aborted_errors++; | 431 | dev->stats.tx_aborted_errors++; |
435 | } else if (nl->connection == PLIP_CN_RECEIVE) { | 432 | } else if (nl->connection == PLIP_CN_RECEIVE) { |
436 | if (rcv->state == PLIP_PK_TRIGGER) { | 433 | if (rcv->state == PLIP_PK_TRIGGER) { |
437 | /* Transmission was interrupted. */ | 434 | /* Transmission was interrupted. */ |
@@ -448,7 +445,7 @@ plip_bh_timeout_error(struct net_device *dev, struct net_local *nl, | |||
448 | printk(KERN_WARNING "%s: receive timeout(%d,%02x)\n", | 445 | printk(KERN_WARNING "%s: receive timeout(%d,%02x)\n", |
449 | dev->name, rcv->state, c0); | 446 | dev->name, rcv->state, c0); |
450 | } | 447 | } |
451 | nl->enet_stats.rx_dropped++; | 448 | dev->stats.rx_dropped++; |
452 | } | 449 | } |
453 | rcv->state = PLIP_PK_DONE; | 450 | rcv->state = PLIP_PK_DONE; |
454 | if (rcv->skb) { | 451 | if (rcv->skb) { |
@@ -661,7 +658,7 @@ plip_receive_packet(struct net_device *dev, struct net_local *nl, | |||
661 | &rcv->nibble, &rcv->data)) | 658 | &rcv->nibble, &rcv->data)) |
662 | return TIMEOUT; | 659 | return TIMEOUT; |
663 | if (rcv->data != rcv->checksum) { | 660 | if (rcv->data != rcv->checksum) { |
664 | nl->enet_stats.rx_crc_errors++; | 661 | dev->stats.rx_crc_errors++; |
665 | if (net_debug) | 662 | if (net_debug) |
666 | printk(KERN_DEBUG "%s: checksum error\n", dev->name); | 663 | printk(KERN_DEBUG "%s: checksum error\n", dev->name); |
667 | return ERROR; | 664 | return ERROR; |
@@ -673,8 +670,8 @@ plip_receive_packet(struct net_device *dev, struct net_local *nl, | |||
673 | rcv->skb->protocol=plip_type_trans(rcv->skb, dev); | 670 | rcv->skb->protocol=plip_type_trans(rcv->skb, dev); |
674 | netif_rx(rcv->skb); | 671 | netif_rx(rcv->skb); |
675 | dev->last_rx = jiffies; | 672 | dev->last_rx = jiffies; |
676 | nl->enet_stats.rx_bytes += rcv->length.h; | 673 | dev->stats.rx_bytes += rcv->length.h; |
677 | nl->enet_stats.rx_packets++; | 674 | dev->stats.rx_packets++; |
678 | rcv->skb = NULL; | 675 | rcv->skb = NULL; |
679 | if (net_debug > 2) | 676 | if (net_debug > 2) |
680 | printk(KERN_DEBUG "%s: receive end\n", dev->name); | 677 | printk(KERN_DEBUG "%s: receive end\n", dev->name); |
@@ -776,7 +773,7 @@ plip_send_packet(struct net_device *dev, struct net_local *nl, | |||
776 | if (nl->connection == PLIP_CN_RECEIVE) { | 773 | if (nl->connection == PLIP_CN_RECEIVE) { |
777 | spin_unlock_irq(&nl->lock); | 774 | spin_unlock_irq(&nl->lock); |
778 | /* Interrupted. */ | 775 | /* Interrupted. */ |
779 | nl->enet_stats.collisions++; | 776 | dev->stats.collisions++; |
780 | return OK; | 777 | return OK; |
781 | } | 778 | } |
782 | c0 = read_status(dev); | 779 | c0 = read_status(dev); |
@@ -792,7 +789,7 @@ plip_send_packet(struct net_device *dev, struct net_local *nl, | |||
792 | {enable,disable}_irq *counts* | 789 | {enable,disable}_irq *counts* |
793 | them. -- AV */ | 790 | them. -- AV */ |
794 | ENABLE(dev->irq); | 791 | ENABLE(dev->irq); |
795 | nl->enet_stats.collisions++; | 792 | dev->stats.collisions++; |
796 | return OK; | 793 | return OK; |
797 | } | 794 | } |
798 | disable_parport_interrupts (dev); | 795 | disable_parport_interrupts (dev); |
@@ -840,9 +837,9 @@ plip_send_packet(struct net_device *dev, struct net_local *nl, | |||
840 | &snd->nibble, snd->checksum)) | 837 | &snd->nibble, snd->checksum)) |
841 | return TIMEOUT; | 838 | return TIMEOUT; |
842 | 839 | ||
843 | nl->enet_stats.tx_bytes += snd->skb->len; | 840 | dev->stats.tx_bytes += snd->skb->len; |
844 | dev_kfree_skb(snd->skb); | 841 | dev_kfree_skb(snd->skb); |
845 | nl->enet_stats.tx_packets++; | 842 | dev->stats.tx_packets++; |
846 | snd->state = PLIP_PK_DONE; | 843 | snd->state = PLIP_PK_DONE; |
847 | 844 | ||
848 | case PLIP_PK_DONE: | 845 | case PLIP_PK_DONE: |
@@ -1199,15 +1196,6 @@ plip_wakeup(void *handle) | |||
1199 | return; | 1196 | return; |
1200 | } | 1197 | } |
1201 | 1198 | ||
1202 | static struct net_device_stats * | ||
1203 | plip_get_stats(struct net_device *dev) | ||
1204 | { | ||
1205 | struct net_local *nl = netdev_priv(dev); | ||
1206 | struct net_device_stats *r = &nl->enet_stats; | ||
1207 | |||
1208 | return r; | ||
1209 | } | ||
1210 | |||
1211 | static int | 1199 | static int |
1212 | plip_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | 1200 | plip_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) |
1213 | { | 1201 | { |