aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/arm
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2010-08-18 16:15:04 -0400
committerDavid S. Miller <davem@davemloft.net>2010-08-19 03:12:38 -0400
commit25aec76a3bd962f0aae1d7980ab1efa56cb24b43 (patch)
tree5eaf9b0c69027f9ae617f23513808c05968e154a /drivers/net/arm
parent2244d07bfa2097cb00600da91c715a8aa547917e (diff)
ether1: Use net_device_stats from struct net_device
struct net_device has its own struct net_device_stats member, so use this one instead of a private copy in the ether1_priv struct. As the new ndo_get_stats function would just return dev->stats we can omit it. This patch also removes an incorrect memset of the stats on open. Signed-off-by: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/arm')
-rw-r--r--drivers/net/arm/ether1.c34
-rw-r--r--drivers/net/arm/ether1.h1
2 files changed, 12 insertions, 23 deletions
diff --git a/drivers/net/arm/ether1.c b/drivers/net/arm/ether1.c
index b17ab5153f51..b00781c02d5d 100644
--- a/drivers/net/arm/ether1.c
+++ b/drivers/net/arm/ether1.c
@@ -68,7 +68,6 @@ static int ether1_open(struct net_device *dev);
68static int ether1_sendpacket(struct sk_buff *skb, struct net_device *dev); 68static int ether1_sendpacket(struct sk_buff *skb, struct net_device *dev);
69static irqreturn_t ether1_interrupt(int irq, void *dev_id); 69static irqreturn_t ether1_interrupt(int irq, void *dev_id);
70static int ether1_close(struct net_device *dev); 70static int ether1_close(struct net_device *dev);
71static struct net_device_stats *ether1_getstats(struct net_device *dev);
72static void ether1_setmulticastlist(struct net_device *dev); 71static void ether1_setmulticastlist(struct net_device *dev);
73static void ether1_timeout(struct net_device *dev); 72static void ether1_timeout(struct net_device *dev);
74 73
@@ -649,8 +648,6 @@ ether1_open (struct net_device *dev)
649 if (request_irq(dev->irq, ether1_interrupt, 0, "ether1", dev)) 648 if (request_irq(dev->irq, ether1_interrupt, 0, "ether1", dev))
650 return -EAGAIN; 649 return -EAGAIN;
651 650
652 memset (&priv(dev)->stats, 0, sizeof (struct net_device_stats));
653
654 if (ether1_init_for_open (dev)) { 651 if (ether1_init_for_open (dev)) {
655 free_irq (dev->irq, dev); 652 free_irq (dev->irq, dev);
656 return -EAGAIN; 653 return -EAGAIN;
@@ -673,7 +670,7 @@ ether1_timeout(struct net_device *dev)
673 if (ether1_init_for_open (dev)) 670 if (ether1_init_for_open (dev))
674 printk (KERN_ERR "%s: unable to restart interface\n", dev->name); 671 printk (KERN_ERR "%s: unable to restart interface\n", dev->name);
675 672
676 priv(dev)->stats.tx_errors++; 673 dev->stats.tx_errors++;
677 netif_wake_queue(dev); 674 netif_wake_queue(dev);
678} 675}
679 676
@@ -802,21 +799,21 @@ again:
802 799
803 while (nop.nop_status & STAT_COMPLETE) { 800 while (nop.nop_status & STAT_COMPLETE) {
804 if (nop.nop_status & STAT_OK) { 801 if (nop.nop_status & STAT_OK) {
805 priv(dev)->stats.tx_packets ++; 802 dev->stats.tx_packets++;
806 priv(dev)->stats.collisions += (nop.nop_status & STAT_COLLISIONS); 803 dev->stats.collisions += (nop.nop_status & STAT_COLLISIONS);
807 } else { 804 } else {
808 priv(dev)->stats.tx_errors ++; 805 dev->stats.tx_errors++;
809 806
810 if (nop.nop_status & STAT_COLLAFTERTX) 807 if (nop.nop_status & STAT_COLLAFTERTX)
811 priv(dev)->stats.collisions ++; 808 dev->stats.collisions++;
812 if (nop.nop_status & STAT_NOCARRIER) 809 if (nop.nop_status & STAT_NOCARRIER)
813 priv(dev)->stats.tx_carrier_errors ++; 810 dev->stats.tx_carrier_errors++;
814 if (nop.nop_status & STAT_TXLOSTCTS) 811 if (nop.nop_status & STAT_TXLOSTCTS)
815 printk (KERN_WARNING "%s: cts lost\n", dev->name); 812 printk (KERN_WARNING "%s: cts lost\n", dev->name);
816 if (nop.nop_status & STAT_TXSLOWDMA) 813 if (nop.nop_status & STAT_TXSLOWDMA)
817 priv(dev)->stats.tx_fifo_errors ++; 814 dev->stats.tx_fifo_errors++;
818 if (nop.nop_status & STAT_COLLEXCESSIVE) 815 if (nop.nop_status & STAT_COLLEXCESSIVE)
819 priv(dev)->stats.collisions += 16; 816 dev->stats.collisions += 16;
820 } 817 }
821 818
822 if (nop.nop_link == caddr) { 819 if (nop.nop_link == caddr) {
@@ -879,13 +876,13 @@ ether1_recv_done (struct net_device *dev)
879 876
880 skb->protocol = eth_type_trans (skb, dev); 877 skb->protocol = eth_type_trans (skb, dev);
881 netif_rx (skb); 878 netif_rx (skb);
882 priv(dev)->stats.rx_packets ++; 879 dev->stats.rx_packets++;
883 } else 880 } else
884 priv(dev)->stats.rx_dropped ++; 881 dev->stats.rx_dropped++;
885 } else { 882 } else {
886 printk(KERN_WARNING "%s: %s\n", dev->name, 883 printk(KERN_WARNING "%s: %s\n", dev->name,
887 (rbd.rbd_status & RBD_EOF) ? "oversized packet" : "acnt not valid"); 884 (rbd.rbd_status & RBD_EOF) ? "oversized packet" : "acnt not valid");
888 priv(dev)->stats.rx_dropped ++; 885 dev->stats.rx_dropped++;
889 } 886 }
890 887
891 nexttail = ether1_readw(dev, priv(dev)->rx_tail, rfd_t, rfd_link, NORMALIRQS); 888 nexttail = ether1_readw(dev, priv(dev)->rx_tail, rfd_t, rfd_link, NORMALIRQS);
@@ -939,7 +936,7 @@ ether1_interrupt (int irq, void *dev_id)
939 printk (KERN_WARNING "%s: RU went not ready: RU suspended\n", dev->name); 936 printk (KERN_WARNING "%s: RU went not ready: RU suspended\n", dev->name);
940 ether1_writew(dev, SCB_CMDRXRESUME, SCB_ADDR, scb_t, scb_command, NORMALIRQS); 937 ether1_writew(dev, SCB_CMDRXRESUME, SCB_ADDR, scb_t, scb_command, NORMALIRQS);
941 writeb(CTRL_CA, REG_CONTROL); 938 writeb(CTRL_CA, REG_CONTROL);
942 priv(dev)->stats.rx_dropped ++; /* we suspended due to lack of buffer space */ 939 dev->stats.rx_dropped++; /* we suspended due to lack of buffer space */
943 } else 940 } else
944 printk(KERN_WARNING "%s: RU went not ready: %04X\n", dev->name, 941 printk(KERN_WARNING "%s: RU went not ready: %04X\n", dev->name,
945 ether1_readw(dev, SCB_ADDR, scb_t, scb_status, NORMALIRQS)); 942 ether1_readw(dev, SCB_ADDR, scb_t, scb_status, NORMALIRQS));
@@ -962,12 +959,6 @@ ether1_close (struct net_device *dev)
962 return 0; 959 return 0;
963} 960}
964 961
965static struct net_device_stats *
966ether1_getstats (struct net_device *dev)
967{
968 return &priv(dev)->stats;
969}
970
971/* 962/*
972 * Set or clear the multicast filter for this adaptor. 963 * Set or clear the multicast filter for this adaptor.
973 * num_addrs == -1 Promiscuous mode, receive all packets. 964 * num_addrs == -1 Promiscuous mode, receive all packets.
@@ -994,7 +985,6 @@ static const struct net_device_ops ether1_netdev_ops = {
994 .ndo_open = ether1_open, 985 .ndo_open = ether1_open,
995 .ndo_stop = ether1_close, 986 .ndo_stop = ether1_close,
996 .ndo_start_xmit = ether1_sendpacket, 987 .ndo_start_xmit = ether1_sendpacket,
997 .ndo_get_stats = ether1_getstats,
998 .ndo_set_multicast_list = ether1_setmulticastlist, 988 .ndo_set_multicast_list = ether1_setmulticastlist,
999 .ndo_tx_timeout = ether1_timeout, 989 .ndo_tx_timeout = ether1_timeout,
1000 .ndo_validate_addr = eth_validate_addr, 990 .ndo_validate_addr = eth_validate_addr,
diff --git a/drivers/net/arm/ether1.h b/drivers/net/arm/ether1.h
index c8a4b2389d85..3a5830ab3dc7 100644
--- a/drivers/net/arm/ether1.h
+++ b/drivers/net/arm/ether1.h
@@ -38,7 +38,6 @@
38 38
39struct ether1_priv { 39struct ether1_priv {
40 void __iomem *base; 40 void __iomem *base;
41 struct net_device_stats stats;
42 unsigned int tx_link; 41 unsigned int tx_link;
43 unsigned int tx_head; 42 unsigned int tx_head;
44 volatile unsigned int tx_tail; 43 volatile unsigned int tx_tail;