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/sgiseeq.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/sgiseeq.c')
-rw-r--r-- | drivers/net/sgiseeq.c | 39 |
1 files changed, 14 insertions, 25 deletions
diff --git a/drivers/net/sgiseeq.c b/drivers/net/sgiseeq.c index eb67b024e413..5189ef066884 100644 --- a/drivers/net/sgiseeq.c +++ b/drivers/net/sgiseeq.c | |||
@@ -93,8 +93,6 @@ struct sgiseeq_private { | |||
93 | unsigned char control; | 93 | unsigned char control; |
94 | unsigned char mode; | 94 | unsigned char mode; |
95 | 95 | ||
96 | struct net_device_stats stats; | ||
97 | |||
98 | spinlock_t tx_lock; | 96 | spinlock_t tx_lock; |
99 | }; | 97 | }; |
100 | 98 | ||
@@ -267,18 +265,17 @@ static int init_seeq(struct net_device *dev, struct sgiseeq_private *sp, | |||
267 | return 0; | 265 | return 0; |
268 | } | 266 | } |
269 | 267 | ||
270 | static inline void record_rx_errors(struct sgiseeq_private *sp, | 268 | static void record_rx_errors(struct net_device *dev, unsigned char status) |
271 | unsigned char status) | ||
272 | { | 269 | { |
273 | if (status & SEEQ_RSTAT_OVERF || | 270 | if (status & SEEQ_RSTAT_OVERF || |
274 | status & SEEQ_RSTAT_SFRAME) | 271 | status & SEEQ_RSTAT_SFRAME) |
275 | sp->stats.rx_over_errors++; | 272 | dev->stats.rx_over_errors++; |
276 | if (status & SEEQ_RSTAT_CERROR) | 273 | if (status & SEEQ_RSTAT_CERROR) |
277 | sp->stats.rx_crc_errors++; | 274 | dev->stats.rx_crc_errors++; |
278 | if (status & SEEQ_RSTAT_DERROR) | 275 | if (status & SEEQ_RSTAT_DERROR) |
279 | sp->stats.rx_frame_errors++; | 276 | dev->stats.rx_frame_errors++; |
280 | if (status & SEEQ_RSTAT_REOF) | 277 | if (status & SEEQ_RSTAT_REOF) |
281 | sp->stats.rx_errors++; | 278 | dev->stats.rx_errors++; |
282 | } | 279 | } |
283 | 280 | ||
284 | static inline void rx_maybe_restart(struct sgiseeq_private *sp, | 281 | static inline void rx_maybe_restart(struct sgiseeq_private *sp, |
@@ -328,8 +325,8 @@ static inline void sgiseeq_rx(struct net_device *dev, struct sgiseeq_private *sp | |||
328 | if (memcmp(eth_hdr(skb)->h_source, dev->dev_addr, ETH_ALEN)) { | 325 | if (memcmp(eth_hdr(skb)->h_source, dev->dev_addr, ETH_ALEN)) { |
329 | netif_rx(skb); | 326 | netif_rx(skb); |
330 | dev->last_rx = jiffies; | 327 | dev->last_rx = jiffies; |
331 | sp->stats.rx_packets++; | 328 | dev->stats.rx_packets++; |
332 | sp->stats.rx_bytes += len; | 329 | dev->stats.rx_bytes += len; |
333 | } else { | 330 | } else { |
334 | /* Silently drop my own packets */ | 331 | /* Silently drop my own packets */ |
335 | dev_kfree_skb_irq(skb); | 332 | dev_kfree_skb_irq(skb); |
@@ -337,10 +334,10 @@ static inline void sgiseeq_rx(struct net_device *dev, struct sgiseeq_private *sp | |||
337 | } else { | 334 | } else { |
338 | printk (KERN_NOTICE "%s: Memory squeeze, deferring packet.\n", | 335 | printk (KERN_NOTICE "%s: Memory squeeze, deferring packet.\n", |
339 | dev->name); | 336 | dev->name); |
340 | sp->stats.rx_dropped++; | 337 | dev->stats.rx_dropped++; |
341 | } | 338 | } |
342 | } else { | 339 | } else { |
343 | record_rx_errors(sp, pkt_status); | 340 | record_rx_errors(dev, pkt_status); |
344 | } | 341 | } |
345 | 342 | ||
346 | /* Return the entry to the ring pool. */ | 343 | /* Return the entry to the ring pool. */ |
@@ -392,11 +389,11 @@ static inline void sgiseeq_tx(struct net_device *dev, struct sgiseeq_private *sp | |||
392 | if (!(status & (HPC3_ETXCTRL_ACTIVE | SEEQ_TSTAT_PTRANS))) { | 389 | if (!(status & (HPC3_ETXCTRL_ACTIVE | SEEQ_TSTAT_PTRANS))) { |
393 | /* Oops, HPC detected some sort of error. */ | 390 | /* Oops, HPC detected some sort of error. */ |
394 | if (status & SEEQ_TSTAT_R16) | 391 | if (status & SEEQ_TSTAT_R16) |
395 | sp->stats.tx_aborted_errors++; | 392 | dev->stats.tx_aborted_errors++; |
396 | if (status & SEEQ_TSTAT_UFLOW) | 393 | if (status & SEEQ_TSTAT_UFLOW) |
397 | sp->stats.tx_fifo_errors++; | 394 | dev->stats.tx_fifo_errors++; |
398 | if (status & SEEQ_TSTAT_LCLS) | 395 | if (status & SEEQ_TSTAT_LCLS) |
399 | sp->stats.collisions++; | 396 | dev->stats.collisions++; |
400 | } | 397 | } |
401 | 398 | ||
402 | /* Ack 'em... */ | 399 | /* Ack 'em... */ |
@@ -412,7 +409,7 @@ static inline void sgiseeq_tx(struct net_device *dev, struct sgiseeq_private *sp | |||
412 | } | 409 | } |
413 | break; | 410 | break; |
414 | } | 411 | } |
415 | sp->stats.tx_packets++; | 412 | dev->stats.tx_packets++; |
416 | sp->tx_old = NEXT_TX(sp->tx_old); | 413 | sp->tx_old = NEXT_TX(sp->tx_old); |
417 | td->tdma.cntinfo &= ~(HPCDMA_XIU | HPCDMA_XIE); | 414 | td->tdma.cntinfo &= ~(HPCDMA_XIU | HPCDMA_XIE); |
418 | td->tdma.cntinfo |= HPCDMA_EOX; | 415 | td->tdma.cntinfo |= HPCDMA_EOX; |
@@ -516,7 +513,7 @@ static int sgiseeq_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
516 | /* Setup... */ | 513 | /* Setup... */ |
517 | skblen = skb->len; | 514 | skblen = skb->len; |
518 | len = (skblen <= ETH_ZLEN) ? ETH_ZLEN : skblen; | 515 | len = (skblen <= ETH_ZLEN) ? ETH_ZLEN : skblen; |
519 | sp->stats.tx_bytes += len; | 516 | dev->stats.tx_bytes += len; |
520 | entry = sp->tx_new; | 517 | entry = sp->tx_new; |
521 | td = &sp->tx_desc[entry]; | 518 | td = &sp->tx_desc[entry]; |
522 | 519 | ||
@@ -569,13 +566,6 @@ static void timeout(struct net_device *dev) | |||
569 | netif_wake_queue(dev); | 566 | netif_wake_queue(dev); |
570 | } | 567 | } |
571 | 568 | ||
572 | static struct net_device_stats *sgiseeq_get_stats(struct net_device *dev) | ||
573 | { | ||
574 | struct sgiseeq_private *sp = netdev_priv(dev); | ||
575 | |||
576 | return &sp->stats; | ||
577 | } | ||
578 | |||
579 | static void sgiseeq_set_multicast(struct net_device *dev) | 569 | static void sgiseeq_set_multicast(struct net_device *dev) |
580 | { | 570 | { |
581 | struct sgiseeq_private *sp = (struct sgiseeq_private *) dev->priv; | 571 | struct sgiseeq_private *sp = (struct sgiseeq_private *) dev->priv; |
@@ -694,7 +684,6 @@ static int __init sgiseeq_probe(struct platform_device *pdev) | |||
694 | dev->hard_start_xmit = sgiseeq_start_xmit; | 684 | dev->hard_start_xmit = sgiseeq_start_xmit; |
695 | dev->tx_timeout = timeout; | 685 | dev->tx_timeout = timeout; |
696 | dev->watchdog_timeo = (200 * HZ) / 1000; | 686 | dev->watchdog_timeo = (200 * HZ) / 1000; |
697 | dev->get_stats = sgiseeq_get_stats; | ||
698 | dev->set_multicast_list = sgiseeq_set_multicast; | 687 | dev->set_multicast_list = sgiseeq_set_multicast; |
699 | dev->set_mac_address = sgiseeq_set_mac_address; | 688 | dev->set_mac_address = sgiseeq_set_mac_address; |
700 | dev->irq = irq; | 689 | dev->irq = irq; |