aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/meth.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/meth.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/meth.c')
-rw-r--r--drivers/net/meth.c28
1 files changed, 10 insertions, 18 deletions
diff --git a/drivers/net/meth.c b/drivers/net/meth.c
index 32bed6bc6c06..fe5b6c372072 100644
--- a/drivers/net/meth.c
+++ b/drivers/net/meth.c
@@ -66,7 +66,6 @@ module_param(timeout, int, 0);
66 * packets in and out, so there is place for a packet 66 * packets in and out, so there is place for a packet
67 */ 67 */
68struct meth_private { 68struct meth_private {
69 struct net_device_stats stats;
70 /* in-memory copy of MAC Control register */ 69 /* in-memory copy of MAC Control register */
71 unsigned long mac_ctrl; 70 unsigned long mac_ctrl;
72 /* in-memory copy of DMA Control register */ 71 /* in-memory copy of DMA Control register */
@@ -401,15 +400,15 @@ static void meth_rx(struct net_device* dev, unsigned long int_status)
401 printk(KERN_DEBUG "%s: bogus packet size: %ld, status=%#2lx.\n", 400 printk(KERN_DEBUG "%s: bogus packet size: %ld, status=%#2lx.\n",
402 dev->name, priv->rx_write, 401 dev->name, priv->rx_write,
403 priv->rx_ring[priv->rx_write]->status.raw); 402 priv->rx_ring[priv->rx_write]->status.raw);
404 priv->stats.rx_errors++; 403 dev->stats.rx_errors++;
405 priv->stats.rx_length_errors++; 404 dev->stats.rx_length_errors++;
406 skb = priv->rx_skbs[priv->rx_write]; 405 skb = priv->rx_skbs[priv->rx_write];
407 } else { 406 } else {
408 skb = alloc_skb(METH_RX_BUFF_SIZE, GFP_ATOMIC); 407 skb = alloc_skb(METH_RX_BUFF_SIZE, GFP_ATOMIC);
409 if (!skb) { 408 if (!skb) {
410 /* Ouch! No memory! Drop packet on the floor */ 409 /* Ouch! No memory! Drop packet on the floor */
411 DPRINTK("No mem: dropping packet\n"); 410 DPRINTK("No mem: dropping packet\n");
412 priv->stats.rx_dropped++; 411 dev->stats.rx_dropped++;
413 skb = priv->rx_skbs[priv->rx_write]; 412 skb = priv->rx_skbs[priv->rx_write];
414 } else { 413 } else {
415 struct sk_buff *skb_c = priv->rx_skbs[priv->rx_write]; 414 struct sk_buff *skb_c = priv->rx_skbs[priv->rx_write];
@@ -421,13 +420,13 @@ static void meth_rx(struct net_device* dev, unsigned long int_status)
421 priv->rx_skbs[priv->rx_write] = skb; 420 priv->rx_skbs[priv->rx_write] = skb;
422 skb_c->protocol = eth_type_trans(skb_c, dev); 421 skb_c->protocol = eth_type_trans(skb_c, dev);
423 dev->last_rx = jiffies; 422 dev->last_rx = jiffies;
424 priv->stats.rx_packets++; 423 dev->stats.rx_packets++;
425 priv->stats.rx_bytes += len; 424 dev->stats.rx_bytes += len;
426 netif_rx(skb_c); 425 netif_rx(skb_c);
427 } 426 }
428 } 427 }
429 } else { 428 } else {
430 priv->stats.rx_errors++; 429 dev->stats.rx_errors++;
431 skb=priv->rx_skbs[priv->rx_write]; 430 skb=priv->rx_skbs[priv->rx_write];
432#if MFE_DEBUG>0 431#if MFE_DEBUG>0
433 printk(KERN_WARNING "meth: RX error: status=0x%016lx\n",status); 432 printk(KERN_WARNING "meth: RX error: status=0x%016lx\n",status);
@@ -490,10 +489,10 @@ static void meth_tx_cleanup(struct net_device* dev, unsigned long int_status)
490#endif 489#endif
491 if (status & METH_TX_ST_DONE) { 490 if (status & METH_TX_ST_DONE) {
492 if (status & METH_TX_ST_SUCCESS){ 491 if (status & METH_TX_ST_SUCCESS){
493 priv->stats.tx_packets++; 492 dev->stats.tx_packets++;
494 priv->stats.tx_bytes += skb->len; 493 dev->stats.tx_bytes += skb->len;
495 } else { 494 } else {
496 priv->stats.tx_errors++; 495 dev->stats.tx_errors++;
497#if MFE_DEBUG>=1 496#if MFE_DEBUG>=1
498 DPRINTK("TX error: status=%016lx <",status); 497 DPRINTK("TX error: status=%016lx <",status);
499 if(status & METH_TX_ST_SUCCESS) 498 if(status & METH_TX_ST_SUCCESS)
@@ -734,7 +733,7 @@ static void meth_tx_timeout(struct net_device *dev)
734 /* Try to reset the interface. */ 733 /* Try to reset the interface. */
735 meth_reset(dev); 734 meth_reset(dev);
736 735
737 priv->stats.tx_errors++; 736 dev->stats.tx_errors++;
738 737
739 /* Clear all rings */ 738 /* Clear all rings */
740 meth_free_tx_ring(priv); 739 meth_free_tx_ring(priv);
@@ -773,12 +772,6 @@ static int meth_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
773/* 772/*
774 * Return statistics to the caller 773 * Return statistics to the caller
775 */ 774 */
776static struct net_device_stats *meth_stats(struct net_device *dev)
777{
778 struct meth_private *priv = netdev_priv(dev);
779 return &priv->stats;
780}
781
782/* 775/*
783 * The init function. 776 * The init function.
784 */ 777 */
@@ -796,7 +789,6 @@ static int __init meth_probe(struct platform_device *pdev)
796 dev->stop = meth_release; 789 dev->stop = meth_release;
797 dev->hard_start_xmit = meth_tx; 790 dev->hard_start_xmit = meth_tx;
798 dev->do_ioctl = meth_ioctl; 791 dev->do_ioctl = meth_ioctl;
799 dev->get_stats = meth_stats;
800#ifdef HAVE_TX_TIMEOUT 792#ifdef HAVE_TX_TIMEOUT
801 dev->tx_timeout = meth_tx_timeout; 793 dev->tx_timeout = meth_tx_timeout;
802 dev->watchdog_timeo = timeout; 794 dev->watchdog_timeo = timeout;