aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2010-08-09 01:04:34 -0400
committerDavid S. Miller <davem@davemloft.net>2010-08-17 05:32:55 -0400
commit264fd77a67f1a4fe102477d824014459c7ff61f3 (patch)
treef54820d2e3eed7bf95a3221ac9c950e4f6e76d9d
parent2154c704c7240379fae4633359e06e8df875c1fd (diff)
am79c961a: Use net_device_stats from struct net_device
struct net_device has its own struct net_device_stats member, so we can use this one instead of a private copy in the dev_priv struct. Cc: Kulikov Vasiliy <segooon@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/arm/am79c961a.c35
-rw-r--r--drivers/net/arm/am79c961a.h1
2 files changed, 16 insertions, 20 deletions
diff --git a/drivers/net/arm/am79c961a.c b/drivers/net/arm/am79c961a.c
index 8c496fb1ac9e..62f21106efec 100644
--- a/drivers/net/arm/am79c961a.c
+++ b/drivers/net/arm/am79c961a.c
@@ -300,8 +300,6 @@ am79c961_open(struct net_device *dev)
300 struct dev_priv *priv = netdev_priv(dev); 300 struct dev_priv *priv = netdev_priv(dev);
301 int ret; 301 int ret;
302 302
303 memset (&priv->stats, 0, sizeof (priv->stats));
304
305 ret = request_irq(dev->irq, am79c961_interrupt, 0, dev->name, dev); 303 ret = request_irq(dev->irq, am79c961_interrupt, 0, dev->name, dev);
306 if (ret) 304 if (ret)
307 return ret; 305 return ret;
@@ -347,8 +345,7 @@ am79c961_close(struct net_device *dev)
347 */ 345 */
348static struct net_device_stats *am79c961_getstats (struct net_device *dev) 346static struct net_device_stats *am79c961_getstats (struct net_device *dev)
349{ 347{
350 struct dev_priv *priv = netdev_priv(dev); 348 return &dev->stats;
351 return &priv->stats;
352} 349}
353 350
354static void am79c961_mc_hash(char *addr, unsigned short *hash) 351static void am79c961_mc_hash(char *addr, unsigned short *hash)
@@ -510,14 +507,14 @@ am79c961_rx(struct net_device *dev, struct dev_priv *priv)
510 507
511 if ((status & (RMD_ERR|RMD_STP|RMD_ENP)) != (RMD_STP|RMD_ENP)) { 508 if ((status & (RMD_ERR|RMD_STP|RMD_ENP)) != (RMD_STP|RMD_ENP)) {
512 am_writeword (dev, hdraddr + 2, RMD_OWN); 509 am_writeword (dev, hdraddr + 2, RMD_OWN);
513 priv->stats.rx_errors ++; 510 dev->stats.rx_errors++;
514 if (status & RMD_ERR) { 511 if (status & RMD_ERR) {
515 if (status & RMD_FRAM) 512 if (status & RMD_FRAM)
516 priv->stats.rx_frame_errors ++; 513 dev->stats.rx_frame_errors++;
517 if (status & RMD_CRC) 514 if (status & RMD_CRC)
518 priv->stats.rx_crc_errors ++; 515 dev->stats.rx_crc_errors++;
519 } else if (status & RMD_STP) 516 } else if (status & RMD_STP)
520 priv->stats.rx_length_errors ++; 517 dev->stats.rx_length_errors++;
521 continue; 518 continue;
522 } 519 }
523 520
@@ -531,12 +528,12 @@ am79c961_rx(struct net_device *dev, struct dev_priv *priv)
531 am_writeword(dev, hdraddr + 2, RMD_OWN); 528 am_writeword(dev, hdraddr + 2, RMD_OWN);
532 skb->protocol = eth_type_trans(skb, dev); 529 skb->protocol = eth_type_trans(skb, dev);
533 netif_rx(skb); 530 netif_rx(skb);
534 priv->stats.rx_bytes += len; 531 dev->stats.rx_bytes += len;
535 priv->stats.rx_packets ++; 532 dev->stats.rx_packets++;
536 } else { 533 } else {
537 am_writeword (dev, hdraddr + 2, RMD_OWN); 534 am_writeword (dev, hdraddr + 2, RMD_OWN);
538 printk (KERN_WARNING "%s: memory squeeze, dropping packet.\n", dev->name); 535 printk (KERN_WARNING "%s: memory squeeze, dropping packet.\n", dev->name);
539 priv->stats.rx_dropped ++; 536 dev->stats.rx_dropped++;
540 break; 537 break;
541 } 538 }
542 } while (1); 539 } while (1);
@@ -565,7 +562,7 @@ am79c961_tx(struct net_device *dev, struct dev_priv *priv)
565 if (status & TMD_ERR) { 562 if (status & TMD_ERR) {
566 u_int status2; 563 u_int status2;
567 564
568 priv->stats.tx_errors ++; 565 dev->stats.tx_errors++;
569 566
570 status2 = am_readword (dev, hdraddr + 6); 567 status2 = am_readword (dev, hdraddr + 6);
571 568
@@ -575,18 +572,18 @@ am79c961_tx(struct net_device *dev, struct dev_priv *priv)
575 am_writeword (dev, hdraddr + 6, 0); 572 am_writeword (dev, hdraddr + 6, 0);
576 573
577 if (status2 & TST_RTRY) 574 if (status2 & TST_RTRY)
578 priv->stats.collisions += 16; 575 dev->stats.collisions += 16;
579 if (status2 & TST_LCOL) 576 if (status2 & TST_LCOL)
580 priv->stats.tx_window_errors ++; 577 dev->stats.tx_window_errors++;
581 if (status2 & TST_LCAR) 578 if (status2 & TST_LCAR)
582 priv->stats.tx_carrier_errors ++; 579 dev->stats.tx_carrier_errors++;
583 if (status2 & TST_UFLO) 580 if (status2 & TST_UFLO)
584 priv->stats.tx_fifo_errors ++; 581 dev->stats.tx_fifo_errors++;
585 continue; 582 continue;
586 } 583 }
587 priv->stats.tx_packets ++; 584 dev->stats.tx_packets++;
588 len = am_readword (dev, hdraddr + 4); 585 len = am_readword (dev, hdraddr + 4);
589 priv->stats.tx_bytes += -len; 586 dev->stats.tx_bytes += -len;
590 } while (priv->txtail != priv->txhead); 587 } while (priv->txtail != priv->txhead);
591 588
592 netif_wake_queue(dev); 589 netif_wake_queue(dev);
@@ -616,7 +613,7 @@ am79c961_interrupt(int irq, void *dev_id)
616 } 613 }
617 if (status & CSR0_MISS) { 614 if (status & CSR0_MISS) {
618 handled = 1; 615 handled = 1;
619 priv->stats.rx_dropped ++; 616 dev->stats.rx_dropped++;
620 } 617 }
621 if (status & CSR0_CERR) { 618 if (status & CSR0_CERR) {
622 handled = 1; 619 handled = 1;
diff --git a/drivers/net/arm/am79c961a.h b/drivers/net/arm/am79c961a.h
index 483009fe6ec2..fd634d32756b 100644
--- a/drivers/net/arm/am79c961a.h
+++ b/drivers/net/arm/am79c961a.h
@@ -130,7 +130,6 @@
130#define ISALED0_LNKST 0x8000 130#define ISALED0_LNKST 0x8000
131 131
132struct dev_priv { 132struct dev_priv {
133 struct net_device_stats stats;
134 unsigned long rxbuffer[RX_BUFFERS]; 133 unsigned long rxbuffer[RX_BUFFERS];
135 unsigned long txbuffer[TX_BUFFERS]; 134 unsigned long txbuffer[TX_BUFFERS];
136 unsigned char txhead; 135 unsigned char txhead;