All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ether1: Use net_device_stats from struct net_device
@ 2010-08-17 16:15 ` Tobias Klauser
  0 siblings, 0 replies; 45+ messages in thread
From: Tobias Klauser @ 2010-08-17 16:15 UTC (permalink / raw)
  To: David S. Miller, Russell King, netdev; +Cc: linux-arm-kernel, kernel-janitors

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.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
---
 drivers/net/arm/ether1.c |   26 +++++++++++++-------------
 drivers/net/arm/ether1.h |    1 -
 2 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/drivers/net/arm/ether1.c b/drivers/net/arm/ether1.c
index b17ab51..430085b 100644
--- a/drivers/net/arm/ether1.c
+++ b/drivers/net/arm/ether1.c
@@ -673,7 +673,7 @@ ether1_timeout(struct net_device *dev)
 	if (ether1_init_for_open (dev))
 		printk (KERN_ERR "%s: unable to restart interface\n", dev->name);
 
-	priv(dev)->stats.tx_errors++;
+	dev->stats.tx_errors++;
 	netif_wake_queue(dev);
 }
 
@@ -802,21 +802,21 @@ again:
 
 	while (nop.nop_status & STAT_COMPLETE) {
 		if (nop.nop_status & STAT_OK) {
-			priv(dev)->stats.tx_packets ++;
-			priv(dev)->stats.collisions += (nop.nop_status & STAT_COLLISIONS);
+			dev->stats.tx_packets++;
+			dev->stats.collisions += (nop.nop_status & STAT_COLLISIONS);
 		} else {
-			priv(dev)->stats.tx_errors ++;
+			dev->stats.tx_errors++;
 
 			if (nop.nop_status & STAT_COLLAFTERTX)
-				priv(dev)->stats.collisions ++;
+				dev->stats.collisions++;
 			if (nop.nop_status & STAT_NOCARRIER)
-				priv(dev)->stats.tx_carrier_errors ++;
+				dev->stats.tx_carrier_errors++;
 			if (nop.nop_status & STAT_TXLOSTCTS)
 				printk (KERN_WARNING "%s: cts lost\n", dev->name);
 			if (nop.nop_status & STAT_TXSLOWDMA)
-				priv(dev)->stats.tx_fifo_errors ++;
+				dev->stats.tx_fifo_errors++;
 			if (nop.nop_status & STAT_COLLEXCESSIVE)
-				priv(dev)->stats.collisions += 16;
+				dev->stats.collisions += 16;
 		}
 
 		if (nop.nop_link == caddr) {
@@ -879,13 +879,13 @@ ether1_recv_done (struct net_device *dev)
 
 				skb->protocol = eth_type_trans (skb, dev);
 				netif_rx (skb);
-				priv(dev)->stats.rx_packets ++;
+				dev->stats.rx_packets++;
 			} else
-				priv(dev)->stats.rx_dropped ++;
+				dev->stats.rx_dropped++;
 		} else {
 			printk(KERN_WARNING "%s: %s\n", dev->name,
 				(rbd.rbd_status & RBD_EOF) ? "oversized packet" : "acnt not valid");
-			priv(dev)->stats.rx_dropped ++;
+			dev->stats.rx_dropped++;
 		}
 
 		nexttail = ether1_readw(dev, priv(dev)->rx_tail, rfd_t, rfd_link, NORMALIRQS);
@@ -939,7 +939,7 @@ ether1_interrupt (int irq, void *dev_id)
 				printk (KERN_WARNING "%s: RU went not ready: RU suspended\n", dev->name);
 				ether1_writew(dev, SCB_CMDRXRESUME, SCB_ADDR, scb_t, scb_command, NORMALIRQS);
 				writeb(CTRL_CA, REG_CONTROL);
-				priv(dev)->stats.rx_dropped ++;	/* we suspended due to lack of buffer space */
+				dev->stats.rx_dropped++;	/* we suspended due to lack of buffer space */
 			} else
 				printk(KERN_WARNING "%s: RU went not ready: %04X\n", dev->name,
 					ether1_readw(dev, SCB_ADDR, scb_t, scb_status, NORMALIRQS));
@@ -965,7 +965,7 @@ ether1_close (struct net_device *dev)
 static struct net_device_stats *
 ether1_getstats (struct net_device *dev)
 {
-	return &priv(dev)->stats;
+	return &dev->stats;
 }
 
 /*
diff --git a/drivers/net/arm/ether1.h b/drivers/net/arm/ether1.h
index c8a4b23..3a5830a 100644
--- a/drivers/net/arm/ether1.h
+++ b/drivers/net/arm/ether1.h
@@ -38,7 +38,6 @@
 
 struct ether1_priv {
 	void __iomem *base;
-	struct net_device_stats stats;
 	unsigned int tx_link;
 	unsigned int tx_head;
 	volatile unsigned int tx_tail;
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH] ether1: Use net_device_stats from struct net_device
@ 2010-08-17 16:15 ` Tobias Klauser
  0 siblings, 0 replies; 45+ messages in thread
From: Tobias Klauser @ 2010-08-17 16:15 UTC (permalink / raw)
  To: linux-arm-kernel

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.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
---
 drivers/net/arm/ether1.c |   26 +++++++++++++-------------
 drivers/net/arm/ether1.h |    1 -
 2 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/drivers/net/arm/ether1.c b/drivers/net/arm/ether1.c
index b17ab51..430085b 100644
--- a/drivers/net/arm/ether1.c
+++ b/drivers/net/arm/ether1.c
@@ -673,7 +673,7 @@ ether1_timeout(struct net_device *dev)
 	if (ether1_init_for_open (dev))
 		printk (KERN_ERR "%s: unable to restart interface\n", dev->name);
 
-	priv(dev)->stats.tx_errors++;
+	dev->stats.tx_errors++;
 	netif_wake_queue(dev);
 }
 
@@ -802,21 +802,21 @@ again:
 
 	while (nop.nop_status & STAT_COMPLETE) {
 		if (nop.nop_status & STAT_OK) {
-			priv(dev)->stats.tx_packets ++;
-			priv(dev)->stats.collisions += (nop.nop_status & STAT_COLLISIONS);
+			dev->stats.tx_packets++;
+			dev->stats.collisions += (nop.nop_status & STAT_COLLISIONS);
 		} else {
-			priv(dev)->stats.tx_errors ++;
+			dev->stats.tx_errors++;
 
 			if (nop.nop_status & STAT_COLLAFTERTX)
-				priv(dev)->stats.collisions ++;
+				dev->stats.collisions++;
 			if (nop.nop_status & STAT_NOCARRIER)
-				priv(dev)->stats.tx_carrier_errors ++;
+				dev->stats.tx_carrier_errors++;
 			if (nop.nop_status & STAT_TXLOSTCTS)
 				printk (KERN_WARNING "%s: cts lost\n", dev->name);
 			if (nop.nop_status & STAT_TXSLOWDMA)
-				priv(dev)->stats.tx_fifo_errors ++;
+				dev->stats.tx_fifo_errors++;
 			if (nop.nop_status & STAT_COLLEXCESSIVE)
-				priv(dev)->stats.collisions += 16;
+				dev->stats.collisions += 16;
 		}
 
 		if (nop.nop_link = caddr) {
@@ -879,13 +879,13 @@ ether1_recv_done (struct net_device *dev)
 
 				skb->protocol = eth_type_trans (skb, dev);
 				netif_rx (skb);
-				priv(dev)->stats.rx_packets ++;
+				dev->stats.rx_packets++;
 			} else
-				priv(dev)->stats.rx_dropped ++;
+				dev->stats.rx_dropped++;
 		} else {
 			printk(KERN_WARNING "%s: %s\n", dev->name,
 				(rbd.rbd_status & RBD_EOF) ? "oversized packet" : "acnt not valid");
-			priv(dev)->stats.rx_dropped ++;
+			dev->stats.rx_dropped++;
 		}
 
 		nexttail = ether1_readw(dev, priv(dev)->rx_tail, rfd_t, rfd_link, NORMALIRQS);
@@ -939,7 +939,7 @@ ether1_interrupt (int irq, void *dev_id)
 				printk (KERN_WARNING "%s: RU went not ready: RU suspended\n", dev->name);
 				ether1_writew(dev, SCB_CMDRXRESUME, SCB_ADDR, scb_t, scb_command, NORMALIRQS);
 				writeb(CTRL_CA, REG_CONTROL);
-				priv(dev)->stats.rx_dropped ++;	/* we suspended due to lack of buffer space */
+				dev->stats.rx_dropped++;	/* we suspended due to lack of buffer space */
 			} else
 				printk(KERN_WARNING "%s: RU went not ready: %04X\n", dev->name,
 					ether1_readw(dev, SCB_ADDR, scb_t, scb_status, NORMALIRQS));
@@ -965,7 +965,7 @@ ether1_close (struct net_device *dev)
 static struct net_device_stats *
 ether1_getstats (struct net_device *dev)
 {
-	return &priv(dev)->stats;
+	return &dev->stats;
 }
 
 /*
diff --git a/drivers/net/arm/ether1.h b/drivers/net/arm/ether1.h
index c8a4b23..3a5830a 100644
--- a/drivers/net/arm/ether1.h
+++ b/drivers/net/arm/ether1.h
@@ -38,7 +38,6 @@
 
 struct ether1_priv {
 	void __iomem *base;
-	struct net_device_stats stats;
 	unsigned int tx_link;
 	unsigned int tx_head;
 	volatile unsigned int tx_tail;
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH] ether1: Use net_device_stats from struct net_device
@ 2010-08-17 16:15 ` Tobias Klauser
  0 siblings, 0 replies; 45+ messages in thread
From: Tobias Klauser @ 2010-08-17 16:15 UTC (permalink / raw)
  To: linux-arm-kernel

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.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
---
 drivers/net/arm/ether1.c |   26 +++++++++++++-------------
 drivers/net/arm/ether1.h |    1 -
 2 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/drivers/net/arm/ether1.c b/drivers/net/arm/ether1.c
index b17ab51..430085b 100644
--- a/drivers/net/arm/ether1.c
+++ b/drivers/net/arm/ether1.c
@@ -673,7 +673,7 @@ ether1_timeout(struct net_device *dev)
 	if (ether1_init_for_open (dev))
 		printk (KERN_ERR "%s: unable to restart interface\n", dev->name);
 
-	priv(dev)->stats.tx_errors++;
+	dev->stats.tx_errors++;
 	netif_wake_queue(dev);
 }
 
@@ -802,21 +802,21 @@ again:
 
 	while (nop.nop_status & STAT_COMPLETE) {
 		if (nop.nop_status & STAT_OK) {
-			priv(dev)->stats.tx_packets ++;
-			priv(dev)->stats.collisions += (nop.nop_status & STAT_COLLISIONS);
+			dev->stats.tx_packets++;
+			dev->stats.collisions += (nop.nop_status & STAT_COLLISIONS);
 		} else {
-			priv(dev)->stats.tx_errors ++;
+			dev->stats.tx_errors++;
 
 			if (nop.nop_status & STAT_COLLAFTERTX)
-				priv(dev)->stats.collisions ++;
+				dev->stats.collisions++;
 			if (nop.nop_status & STAT_NOCARRIER)
-				priv(dev)->stats.tx_carrier_errors ++;
+				dev->stats.tx_carrier_errors++;
 			if (nop.nop_status & STAT_TXLOSTCTS)
 				printk (KERN_WARNING "%s: cts lost\n", dev->name);
 			if (nop.nop_status & STAT_TXSLOWDMA)
-				priv(dev)->stats.tx_fifo_errors ++;
+				dev->stats.tx_fifo_errors++;
 			if (nop.nop_status & STAT_COLLEXCESSIVE)
-				priv(dev)->stats.collisions += 16;
+				dev->stats.collisions += 16;
 		}
 
 		if (nop.nop_link == caddr) {
@@ -879,13 +879,13 @@ ether1_recv_done (struct net_device *dev)
 
 				skb->protocol = eth_type_trans (skb, dev);
 				netif_rx (skb);
-				priv(dev)->stats.rx_packets ++;
+				dev->stats.rx_packets++;
 			} else
-				priv(dev)->stats.rx_dropped ++;
+				dev->stats.rx_dropped++;
 		} else {
 			printk(KERN_WARNING "%s: %s\n", dev->name,
 				(rbd.rbd_status & RBD_EOF) ? "oversized packet" : "acnt not valid");
-			priv(dev)->stats.rx_dropped ++;
+			dev->stats.rx_dropped++;
 		}
 
 		nexttail = ether1_readw(dev, priv(dev)->rx_tail, rfd_t, rfd_link, NORMALIRQS);
@@ -939,7 +939,7 @@ ether1_interrupt (int irq, void *dev_id)
 				printk (KERN_WARNING "%s: RU went not ready: RU suspended\n", dev->name);
 				ether1_writew(dev, SCB_CMDRXRESUME, SCB_ADDR, scb_t, scb_command, NORMALIRQS);
 				writeb(CTRL_CA, REG_CONTROL);
-				priv(dev)->stats.rx_dropped ++;	/* we suspended due to lack of buffer space */
+				dev->stats.rx_dropped++;	/* we suspended due to lack of buffer space */
 			} else
 				printk(KERN_WARNING "%s: RU went not ready: %04X\n", dev->name,
 					ether1_readw(dev, SCB_ADDR, scb_t, scb_status, NORMALIRQS));
@@ -965,7 +965,7 @@ ether1_close (struct net_device *dev)
 static struct net_device_stats *
 ether1_getstats (struct net_device *dev)
 {
-	return &priv(dev)->stats;
+	return &dev->stats;
 }
 
 /*
diff --git a/drivers/net/arm/ether1.h b/drivers/net/arm/ether1.h
index c8a4b23..3a5830a 100644
--- a/drivers/net/arm/ether1.h
+++ b/drivers/net/arm/ether1.h
@@ -38,7 +38,6 @@
 
 struct ether1_priv {
 	void __iomem *base;
-	struct net_device_stats stats;
 	unsigned int tx_link;
 	unsigned int tx_head;
 	volatile unsigned int tx_tail;
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* Re: [PATCH] ether1: Use net_device_stats from struct net_device
  2010-08-17 16:15 ` Tobias Klauser
  (?)
@ 2010-08-17 18:32   ` Dan Carpenter
  -1 siblings, 0 replies; 45+ messages in thread
From: Dan Carpenter @ 2010-08-17 18:32 UTC (permalink / raw)
  To: Tobias Klauser
  Cc: David S. Miller, Russell King, netdev, linux-arm-kernel, kernel-janitors

On Tue, Aug 17, 2010 at 06:15:19PM +0200, Tobias Klauser wrote:
> 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.
> 

You missed one in ether1_open().

        memset (&priv(dev)->stats, 0, sizeof (struct net_device_stats));

regards,
dan carpenter



^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH] ether1: Use net_device_stats from struct net_device
@ 2010-08-17 18:32   ` Dan Carpenter
  0 siblings, 0 replies; 45+ messages in thread
From: Dan Carpenter @ 2010-08-17 18:32 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Aug 17, 2010 at 06:15:19PM +0200, Tobias Klauser wrote:
> 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.
> 

You missed one in ether1_open().

        memset (&priv(dev)->stats, 0, sizeof (struct net_device_stats));

regards,
dan carpenter



^ permalink raw reply	[flat|nested] 45+ messages in thread

* [PATCH] ether1: Use net_device_stats from struct net_device
@ 2010-08-17 18:32   ` Dan Carpenter
  0 siblings, 0 replies; 45+ messages in thread
From: Dan Carpenter @ 2010-08-17 18:32 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Aug 17, 2010 at 06:15:19PM +0200, Tobias Klauser wrote:
> 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.
> 

You missed one in ether1_open().

        memset (&priv(dev)->stats, 0, sizeof (struct net_device_stats));

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH] ether1: Use net_device_stats from struct net_device
  2010-08-17 18:32   ` Dan Carpenter
  (?)
@ 2010-08-17 18:34     ` Tobias Klauser
  -1 siblings, 0 replies; 45+ messages in thread
From: Tobias Klauser @ 2010-08-17 18:34 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: David S. Miller, Russell King, netdev, linux-arm-kernel, kernel-janitors

On 2010-08-17 at 20:32:05 +0200, Dan Carpenter <error27@gmail.com> wrote:
> On Tue, Aug 17, 2010 at 06:15:19PM +0200, Tobias Klauser wrote:
> > 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.
> > 
> 
> You missed one in ether1_open().
> 
>         memset (&priv(dev)->stats, 0, sizeof (struct net_device_stats));

Thanks. I'll send an updated patch.

Tobias

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH] ether1: Use net_device_stats from struct net_device
@ 2010-08-17 18:34     ` Tobias Klauser
  0 siblings, 0 replies; 45+ messages in thread
From: Tobias Klauser @ 2010-08-17 18:34 UTC (permalink / raw)
  To: linux-arm-kernel

On 2010-08-17 at 20:32:05 +0200, Dan Carpenter <error27@gmail.com> wrote:
> On Tue, Aug 17, 2010 at 06:15:19PM +0200, Tobias Klauser wrote:
> > 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.
> > 
> 
> You missed one in ether1_open().
> 
>         memset (&priv(dev)->stats, 0, sizeof (struct net_device_stats));

Thanks. I'll send an updated patch.

Tobias

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [PATCH] ether1: Use net_device_stats from struct net_device
@ 2010-08-17 18:34     ` Tobias Klauser
  0 siblings, 0 replies; 45+ messages in thread
From: Tobias Klauser @ 2010-08-17 18:34 UTC (permalink / raw)
  To: linux-arm-kernel

On 2010-08-17 at 20:32:05 +0200, Dan Carpenter <error27@gmail.com> wrote:
> On Tue, Aug 17, 2010 at 06:15:19PM +0200, Tobias Klauser wrote:
> > 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.
> > 
> 
> You missed one in ether1_open().
> 
>         memset (&priv(dev)->stats, 0, sizeof (struct net_device_stats));

Thanks. I'll send an updated patch.

Tobias

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [PATCH v2] ether1: Use net_device_stats from struct net_device
  2010-08-17 16:15 ` Tobias Klauser
  (?)
@ 2010-08-18  7:04   ` Tobias Klauser
  -1 siblings, 0 replies; 45+ messages in thread
From: Tobias Klauser @ 2010-08-18  7:04 UTC (permalink / raw)
  To: David S. Miller, Russell King, netdev
  Cc: linux-arm-kernel, kernel-janitors, Dan Carpenter

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.

Cc: Dan Carpenter <error27@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
---
 drivers/net/arm/ether1.c |   28 ++++++++++++++--------------
 drivers/net/arm/ether1.h |    1 -
 2 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/drivers/net/arm/ether1.c b/drivers/net/arm/ether1.c
index b17ab51..f08b6b2 100644
--- a/drivers/net/arm/ether1.c
+++ b/drivers/net/arm/ether1.c
@@ -649,7 +649,7 @@ ether1_open (struct net_device *dev)
 	if (request_irq(dev->irq, ether1_interrupt, 0, "ether1", dev))
 		return -EAGAIN;
 
-	memset (&priv(dev)->stats, 0, sizeof (struct net_device_stats));
+	memset(&dev->stats, 0, sizeof(struct net_device_stats));
 
 	if (ether1_init_for_open (dev)) {
 		free_irq (dev->irq, dev);
@@ -673,7 +673,7 @@ ether1_timeout(struct net_device *dev)
 	if (ether1_init_for_open (dev))
 		printk (KERN_ERR "%s: unable to restart interface\n", dev->name);
 
-	priv(dev)->stats.tx_errors++;
+	dev->stats.tx_errors++;
 	netif_wake_queue(dev);
 }
 
@@ -802,21 +802,21 @@ again:
 
 	while (nop.nop_status & STAT_COMPLETE) {
 		if (nop.nop_status & STAT_OK) {
-			priv(dev)->stats.tx_packets ++;
-			priv(dev)->stats.collisions += (nop.nop_status & STAT_COLLISIONS);
+			dev->stats.tx_packets++;
+			dev->stats.collisions += (nop.nop_status & STAT_COLLISIONS);
 		} else {
-			priv(dev)->stats.tx_errors ++;
+			dev->stats.tx_errors++;
 
 			if (nop.nop_status & STAT_COLLAFTERTX)
-				priv(dev)->stats.collisions ++;
+				dev->stats.collisions++;
 			if (nop.nop_status & STAT_NOCARRIER)
-				priv(dev)->stats.tx_carrier_errors ++;
+				dev->stats.tx_carrier_errors++;
 			if (nop.nop_status & STAT_TXLOSTCTS)
 				printk (KERN_WARNING "%s: cts lost\n", dev->name);
 			if (nop.nop_status & STAT_TXSLOWDMA)
-				priv(dev)->stats.tx_fifo_errors ++;
+				dev->stats.tx_fifo_errors++;
 			if (nop.nop_status & STAT_COLLEXCESSIVE)
-				priv(dev)->stats.collisions += 16;
+				dev->stats.collisions += 16;
 		}
 
 		if (nop.nop_link == caddr) {
@@ -879,13 +879,13 @@ ether1_recv_done (struct net_device *dev)
 
 				skb->protocol = eth_type_trans (skb, dev);
 				netif_rx (skb);
-				priv(dev)->stats.rx_packets ++;
+				dev->stats.rx_packets++;
 			} else
-				priv(dev)->stats.rx_dropped ++;
+				dev->stats.rx_dropped++;
 		} else {
 			printk(KERN_WARNING "%s: %s\n", dev->name,
 				(rbd.rbd_status & RBD_EOF) ? "oversized packet" : "acnt not valid");
-			priv(dev)->stats.rx_dropped ++;
+			dev->stats.rx_dropped++;
 		}
 
 		nexttail = ether1_readw(dev, priv(dev)->rx_tail, rfd_t, rfd_link, NORMALIRQS);
@@ -939,7 +939,7 @@ ether1_interrupt (int irq, void *dev_id)
 				printk (KERN_WARNING "%s: RU went not ready: RU suspended\n", dev->name);
 				ether1_writew(dev, SCB_CMDRXRESUME, SCB_ADDR, scb_t, scb_command, NORMALIRQS);
 				writeb(CTRL_CA, REG_CONTROL);
-				priv(dev)->stats.rx_dropped ++;	/* we suspended due to lack of buffer space */
+				dev->stats.rx_dropped++;	/* we suspended due to lack of buffer space */
 			} else
 				printk(KERN_WARNING "%s: RU went not ready: %04X\n", dev->name,
 					ether1_readw(dev, SCB_ADDR, scb_t, scb_status, NORMALIRQS));
@@ -965,7 +965,7 @@ ether1_close (struct net_device *dev)
 static struct net_device_stats *
 ether1_getstats (struct net_device *dev)
 {
-	return &priv(dev)->stats;
+	return &dev->stats;
 }
 
 /*
diff --git a/drivers/net/arm/ether1.h b/drivers/net/arm/ether1.h
index c8a4b23..3a5830a 100644
--- a/drivers/net/arm/ether1.h
+++ b/drivers/net/arm/ether1.h
@@ -38,7 +38,6 @@
 
 struct ether1_priv {
 	void __iomem *base;
-	struct net_device_stats stats;
 	unsigned int tx_link;
 	unsigned int tx_head;
 	volatile unsigned int tx_tail;
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH v2] ether1: Use net_device_stats from struct net_device
@ 2010-08-18  7:04   ` Tobias Klauser
  0 siblings, 0 replies; 45+ messages in thread
From: Tobias Klauser @ 2010-08-18  7:04 UTC (permalink / raw)
  To: linux-arm-kernel

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.

Cc: Dan Carpenter <error27@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
---
 drivers/net/arm/ether1.c |   28 ++++++++++++++--------------
 drivers/net/arm/ether1.h |    1 -
 2 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/drivers/net/arm/ether1.c b/drivers/net/arm/ether1.c
index b17ab51..f08b6b2 100644
--- a/drivers/net/arm/ether1.c
+++ b/drivers/net/arm/ether1.c
@@ -649,7 +649,7 @@ ether1_open (struct net_device *dev)
 	if (request_irq(dev->irq, ether1_interrupt, 0, "ether1", dev))
 		return -EAGAIN;
 
-	memset (&priv(dev)->stats, 0, sizeof (struct net_device_stats));
+	memset(&dev->stats, 0, sizeof(struct net_device_stats));
 
 	if (ether1_init_for_open (dev)) {
 		free_irq (dev->irq, dev);
@@ -673,7 +673,7 @@ ether1_timeout(struct net_device *dev)
 	if (ether1_init_for_open (dev))
 		printk (KERN_ERR "%s: unable to restart interface\n", dev->name);
 
-	priv(dev)->stats.tx_errors++;
+	dev->stats.tx_errors++;
 	netif_wake_queue(dev);
 }
 
@@ -802,21 +802,21 @@ again:
 
 	while (nop.nop_status & STAT_COMPLETE) {
 		if (nop.nop_status & STAT_OK) {
-			priv(dev)->stats.tx_packets ++;
-			priv(dev)->stats.collisions += (nop.nop_status & STAT_COLLISIONS);
+			dev->stats.tx_packets++;
+			dev->stats.collisions += (nop.nop_status & STAT_COLLISIONS);
 		} else {
-			priv(dev)->stats.tx_errors ++;
+			dev->stats.tx_errors++;
 
 			if (nop.nop_status & STAT_COLLAFTERTX)
-				priv(dev)->stats.collisions ++;
+				dev->stats.collisions++;
 			if (nop.nop_status & STAT_NOCARRIER)
-				priv(dev)->stats.tx_carrier_errors ++;
+				dev->stats.tx_carrier_errors++;
 			if (nop.nop_status & STAT_TXLOSTCTS)
 				printk (KERN_WARNING "%s: cts lost\n", dev->name);
 			if (nop.nop_status & STAT_TXSLOWDMA)
-				priv(dev)->stats.tx_fifo_errors ++;
+				dev->stats.tx_fifo_errors++;
 			if (nop.nop_status & STAT_COLLEXCESSIVE)
-				priv(dev)->stats.collisions += 16;
+				dev->stats.collisions += 16;
 		}
 
 		if (nop.nop_link = caddr) {
@@ -879,13 +879,13 @@ ether1_recv_done (struct net_device *dev)
 
 				skb->protocol = eth_type_trans (skb, dev);
 				netif_rx (skb);
-				priv(dev)->stats.rx_packets ++;
+				dev->stats.rx_packets++;
 			} else
-				priv(dev)->stats.rx_dropped ++;
+				dev->stats.rx_dropped++;
 		} else {
 			printk(KERN_WARNING "%s: %s\n", dev->name,
 				(rbd.rbd_status & RBD_EOF) ? "oversized packet" : "acnt not valid");
-			priv(dev)->stats.rx_dropped ++;
+			dev->stats.rx_dropped++;
 		}
 
 		nexttail = ether1_readw(dev, priv(dev)->rx_tail, rfd_t, rfd_link, NORMALIRQS);
@@ -939,7 +939,7 @@ ether1_interrupt (int irq, void *dev_id)
 				printk (KERN_WARNING "%s: RU went not ready: RU suspended\n", dev->name);
 				ether1_writew(dev, SCB_CMDRXRESUME, SCB_ADDR, scb_t, scb_command, NORMALIRQS);
 				writeb(CTRL_CA, REG_CONTROL);
-				priv(dev)->stats.rx_dropped ++;	/* we suspended due to lack of buffer space */
+				dev->stats.rx_dropped++;	/* we suspended due to lack of buffer space */
 			} else
 				printk(KERN_WARNING "%s: RU went not ready: %04X\n", dev->name,
 					ether1_readw(dev, SCB_ADDR, scb_t, scb_status, NORMALIRQS));
@@ -965,7 +965,7 @@ ether1_close (struct net_device *dev)
 static struct net_device_stats *
 ether1_getstats (struct net_device *dev)
 {
-	return &priv(dev)->stats;
+	return &dev->stats;
 }
 
 /*
diff --git a/drivers/net/arm/ether1.h b/drivers/net/arm/ether1.h
index c8a4b23..3a5830a 100644
--- a/drivers/net/arm/ether1.h
+++ b/drivers/net/arm/ether1.h
@@ -38,7 +38,6 @@
 
 struct ether1_priv {
 	void __iomem *base;
-	struct net_device_stats stats;
 	unsigned int tx_link;
 	unsigned int tx_head;
 	volatile unsigned int tx_tail;
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH v2] ether1: Use net_device_stats from struct net_device
@ 2010-08-18  7:04   ` Tobias Klauser
  0 siblings, 0 replies; 45+ messages in thread
From: Tobias Klauser @ 2010-08-18  7:04 UTC (permalink / raw)
  To: linux-arm-kernel

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.

Cc: Dan Carpenter <error27@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
---
 drivers/net/arm/ether1.c |   28 ++++++++++++++--------------
 drivers/net/arm/ether1.h |    1 -
 2 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/drivers/net/arm/ether1.c b/drivers/net/arm/ether1.c
index b17ab51..f08b6b2 100644
--- a/drivers/net/arm/ether1.c
+++ b/drivers/net/arm/ether1.c
@@ -649,7 +649,7 @@ ether1_open (struct net_device *dev)
 	if (request_irq(dev->irq, ether1_interrupt, 0, "ether1", dev))
 		return -EAGAIN;
 
-	memset (&priv(dev)->stats, 0, sizeof (struct net_device_stats));
+	memset(&dev->stats, 0, sizeof(struct net_device_stats));
 
 	if (ether1_init_for_open (dev)) {
 		free_irq (dev->irq, dev);
@@ -673,7 +673,7 @@ ether1_timeout(struct net_device *dev)
 	if (ether1_init_for_open (dev))
 		printk (KERN_ERR "%s: unable to restart interface\n", dev->name);
 
-	priv(dev)->stats.tx_errors++;
+	dev->stats.tx_errors++;
 	netif_wake_queue(dev);
 }
 
@@ -802,21 +802,21 @@ again:
 
 	while (nop.nop_status & STAT_COMPLETE) {
 		if (nop.nop_status & STAT_OK) {
-			priv(dev)->stats.tx_packets ++;
-			priv(dev)->stats.collisions += (nop.nop_status & STAT_COLLISIONS);
+			dev->stats.tx_packets++;
+			dev->stats.collisions += (nop.nop_status & STAT_COLLISIONS);
 		} else {
-			priv(dev)->stats.tx_errors ++;
+			dev->stats.tx_errors++;
 
 			if (nop.nop_status & STAT_COLLAFTERTX)
-				priv(dev)->stats.collisions ++;
+				dev->stats.collisions++;
 			if (nop.nop_status & STAT_NOCARRIER)
-				priv(dev)->stats.tx_carrier_errors ++;
+				dev->stats.tx_carrier_errors++;
 			if (nop.nop_status & STAT_TXLOSTCTS)
 				printk (KERN_WARNING "%s: cts lost\n", dev->name);
 			if (nop.nop_status & STAT_TXSLOWDMA)
-				priv(dev)->stats.tx_fifo_errors ++;
+				dev->stats.tx_fifo_errors++;
 			if (nop.nop_status & STAT_COLLEXCESSIVE)
-				priv(dev)->stats.collisions += 16;
+				dev->stats.collisions += 16;
 		}
 
 		if (nop.nop_link == caddr) {
@@ -879,13 +879,13 @@ ether1_recv_done (struct net_device *dev)
 
 				skb->protocol = eth_type_trans (skb, dev);
 				netif_rx (skb);
-				priv(dev)->stats.rx_packets ++;
+				dev->stats.rx_packets++;
 			} else
-				priv(dev)->stats.rx_dropped ++;
+				dev->stats.rx_dropped++;
 		} else {
 			printk(KERN_WARNING "%s: %s\n", dev->name,
 				(rbd.rbd_status & RBD_EOF) ? "oversized packet" : "acnt not valid");
-			priv(dev)->stats.rx_dropped ++;
+			dev->stats.rx_dropped++;
 		}
 
 		nexttail = ether1_readw(dev, priv(dev)->rx_tail, rfd_t, rfd_link, NORMALIRQS);
@@ -939,7 +939,7 @@ ether1_interrupt (int irq, void *dev_id)
 				printk (KERN_WARNING "%s: RU went not ready: RU suspended\n", dev->name);
 				ether1_writew(dev, SCB_CMDRXRESUME, SCB_ADDR, scb_t, scb_command, NORMALIRQS);
 				writeb(CTRL_CA, REG_CONTROL);
-				priv(dev)->stats.rx_dropped ++;	/* we suspended due to lack of buffer space */
+				dev->stats.rx_dropped++;	/* we suspended due to lack of buffer space */
 			} else
 				printk(KERN_WARNING "%s: RU went not ready: %04X\n", dev->name,
 					ether1_readw(dev, SCB_ADDR, scb_t, scb_status, NORMALIRQS));
@@ -965,7 +965,7 @@ ether1_close (struct net_device *dev)
 static struct net_device_stats *
 ether1_getstats (struct net_device *dev)
 {
-	return &priv(dev)->stats;
+	return &dev->stats;
 }
 
 /*
diff --git a/drivers/net/arm/ether1.h b/drivers/net/arm/ether1.h
index c8a4b23..3a5830a 100644
--- a/drivers/net/arm/ether1.h
+++ b/drivers/net/arm/ether1.h
@@ -38,7 +38,6 @@
 
 struct ether1_priv {
 	void __iomem *base;
-	struct net_device_stats stats;
 	unsigned int tx_link;
 	unsigned int tx_head;
 	volatile unsigned int tx_tail;
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* Re: [PATCH v2] ether1: Use net_device_stats from struct net_device
  2010-08-18  7:04   ` Tobias Klauser
  (?)
@ 2010-08-18  8:13     ` Russell King - ARM Linux
  -1 siblings, 0 replies; 45+ messages in thread
From: Russell King - ARM Linux @ 2010-08-18  8:13 UTC (permalink / raw)
  To: Tobias Klauser
  Cc: David S. Miller, netdev, linux-arm-kernel, kernel-janitors,
	Dan Carpenter

On Wed, Aug 18, 2010 at 09:04:24AM +0200, Tobias Klauser wrote:
> @@ -965,7 +965,7 @@ ether1_close (struct net_device *dev)
>  static struct net_device_stats *
>  ether1_getstats (struct net_device *dev)
>  {
> -	return &priv(dev)->stats;
> +	return &dev->stats;
>  }

Doesn't the core do this for you already if you omit this function?

Same comment for ether3.c

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH v2] ether1: Use net_device_stats from struct net_device
@ 2010-08-18  8:13     ` Russell King - ARM Linux
  0 siblings, 0 replies; 45+ messages in thread
From: Russell King - ARM Linux @ 2010-08-18  8:13 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Aug 18, 2010 at 09:04:24AM +0200, Tobias Klauser wrote:
> @@ -965,7 +965,7 @@ ether1_close (struct net_device *dev)
>  static struct net_device_stats *
>  ether1_getstats (struct net_device *dev)
>  {
> -	return &priv(dev)->stats;
> +	return &dev->stats;
>  }

Doesn't the core do this for you already if you omit this function?

Same comment for ether3.c

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [PATCH v2] ether1: Use net_device_stats from struct net_device
@ 2010-08-18  8:13     ` Russell King - ARM Linux
  0 siblings, 0 replies; 45+ messages in thread
From: Russell King - ARM Linux @ 2010-08-18  8:13 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Aug 18, 2010 at 09:04:24AM +0200, Tobias Klauser wrote:
> @@ -965,7 +965,7 @@ ether1_close (struct net_device *dev)
>  static struct net_device_stats *
>  ether1_getstats (struct net_device *dev)
>  {
> -	return &priv(dev)->stats;
> +	return &dev->stats;
>  }

Doesn't the core do this for you already if you omit this function?

Same comment for ether3.c

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH v2] ether1: Use net_device_stats from struct net_device
  2010-08-18  8:13     ` Russell King - ARM Linux
  (?)
@ 2010-08-18  8:27       ` Eric Dumazet
  -1 siblings, 0 replies; 45+ messages in thread
From: Eric Dumazet @ 2010-08-18  8:27 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: Tobias Klauser, David S. Miller, netdev, linux-arm-kernel,
	kernel-janitors, Dan Carpenter

Le mercredi 18 août 2010 à 09:13 +0100, Russell King - ARM Linux a
écrit :
> On Wed, Aug 18, 2010 at 09:04:24AM +0200, Tobias Klauser wrote:
> > @@ -965,7 +965,7 @@ ether1_close (struct net_device *dev)
> >  static struct net_device_stats *
> >  ether1_getstats (struct net_device *dev)
> >  {
> > -	return &priv(dev)->stats;
> > +	return &dev->stats;
> >  }
> 
> Doesn't the core do this for you already if you omit this function?
> 
> Same comment for ether3.c

Yes, thats right, no need to declare ndo_get_stats() methods that only
returns &dev->stats




^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH v2] ether1: Use net_device_stats from struct net_device
@ 2010-08-18  8:27       ` Eric Dumazet
  0 siblings, 0 replies; 45+ messages in thread
From: Eric Dumazet @ 2010-08-18  8:27 UTC (permalink / raw)
  To: linux-arm-kernel

Le mercredi 18 août 2010 à 09:13 +0100, Russell King - ARM Linux a
écrit :
> On Wed, Aug 18, 2010 at 09:04:24AM +0200, Tobias Klauser wrote:
> > @@ -965,7 +965,7 @@ ether1_close (struct net_device *dev)
> >  static struct net_device_stats *
> >  ether1_getstats (struct net_device *dev)
> >  {
> > -	return &priv(dev)->stats;
> > +	return &dev->stats;
> >  }
> 
> Doesn't the core do this for you already if you omit this function?
> 
> Same comment for ether3.c

Yes, thats right, no need to declare ndo_get_stats() methods that only
returns &dev->stats




^ permalink raw reply	[flat|nested] 45+ messages in thread

* [PATCH v2] ether1: Use net_device_stats from struct net_device
@ 2010-08-18  8:27       ` Eric Dumazet
  0 siblings, 0 replies; 45+ messages in thread
From: Eric Dumazet @ 2010-08-18  8:27 UTC (permalink / raw)
  To: linux-arm-kernel

Le mercredi 18 ao?t 2010 ? 09:13 +0100, Russell King - ARM Linux a
?crit :
> On Wed, Aug 18, 2010 at 09:04:24AM +0200, Tobias Klauser wrote:
> > @@ -965,7 +965,7 @@ ether1_close (struct net_device *dev)
> >  static struct net_device_stats *
> >  ether1_getstats (struct net_device *dev)
> >  {
> > -	return &priv(dev)->stats;
> > +	return &dev->stats;
> >  }
> 
> Doesn't the core do this for you already if you omit this function?
> 
> Same comment for ether3.c

Yes, thats right, no need to declare ndo_get_stats() methods that only
returns &dev->stats

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH v2] ether1: Use net_device_stats from struct net_device
  2010-08-18  8:27       ` Eric Dumazet
  (?)
@ 2010-08-18  8:33         ` Tobias Klauser
  -1 siblings, 0 replies; 45+ messages in thread
From: Tobias Klauser @ 2010-08-18  8:33 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: Russell King - ARM Linux, David S. Miller, netdev,
	linux-arm-kernel, kernel-janitors, Dan Carpenter

On 2010-08-18 at 10:27:53 +0200, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> Le mercredi 18 août 2010 à 09:13 +0100, Russell King - ARM Linux a
> écrit :
> > On Wed, Aug 18, 2010 at 09:04:24AM +0200, Tobias Klauser wrote:
> > > @@ -965,7 +965,7 @@ ether1_close (struct net_device *dev)
> > >  static struct net_device_stats *
> > >  ether1_getstats (struct net_device *dev)
> > >  {
> > > -	return &priv(dev)->stats;
> > > +	return &dev->stats;
> > >  }
> > 
> > Doesn't the core do this for you already if you omit this function?
> > 
> > Same comment for ether3.c
> 
> Yes, thats right, no need to declare ndo_get_stats() methods that only
> returns &dev->stats

Thanks. I'll send another updated patch, omitting the ether1_getstats
(same for ether3). Sorry for the mess.

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH v2] ether1: Use net_device_stats from struct net_device
@ 2010-08-18  8:33         ` Tobias Klauser
  0 siblings, 0 replies; 45+ messages in thread
From: Tobias Klauser @ 2010-08-18  8:33 UTC (permalink / raw)
  To: linux-arm-kernel

On 2010-08-18 at 10:27:53 +0200, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> Le mercredi 18 août 2010 à 09:13 +0100, Russell King - ARM Linux a
> écrit :
> > On Wed, Aug 18, 2010 at 09:04:24AM +0200, Tobias Klauser wrote:
> > > @@ -965,7 +965,7 @@ ether1_close (struct net_device *dev)
> > >  static struct net_device_stats *
> > >  ether1_getstats (struct net_device *dev)
> > >  {
> > > -	return &priv(dev)->stats;
> > > +	return &dev->stats;
> > >  }
> > 
> > Doesn't the core do this for you already if you omit this function?
> > 
> > Same comment for ether3.c
> 
> Yes, thats right, no need to declare ndo_get_stats() methods that only
> returns &dev->stats

Thanks. I'll send another updated patch, omitting the ether1_getstats
(same for ether3). Sorry for the mess.
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [PATCH v2] ether1: Use net_device_stats from struct net_device
@ 2010-08-18  8:33         ` Tobias Klauser
  0 siblings, 0 replies; 45+ messages in thread
From: Tobias Klauser @ 2010-08-18  8:33 UTC (permalink / raw)
  To: linux-arm-kernel

On 2010-08-18 at 10:27:53 +0200, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> Le mercredi 18 ao?t 2010 ? 09:13 +0100, Russell King - ARM Linux a
> ?crit :
> > On Wed, Aug 18, 2010 at 09:04:24AM +0200, Tobias Klauser wrote:
> > > @@ -965,7 +965,7 @@ ether1_close (struct net_device *dev)
> > >  static struct net_device_stats *
> > >  ether1_getstats (struct net_device *dev)
> > >  {
> > > -	return &priv(dev)->stats;
> > > +	return &dev->stats;
> > >  }
> > 
> > Doesn't the core do this for you already if you omit this function?
> > 
> > Same comment for ether3.c
> 
> Yes, thats right, no need to declare ndo_get_stats() methods that only
> returns &dev->stats

Thanks. I'll send another updated patch, omitting the ether1_getstats
(same for ether3). Sorry for the mess.

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [PATCH v3] ether1: Use net_device_stats from struct net_device
  2010-08-17 16:15 ` Tobias Klauser
  (?)
@ 2010-08-18  8:45   ` Tobias Klauser
  -1 siblings, 0 replies; 45+ messages in thread
From: Tobias Klauser @ 2010-08-18  8:45 UTC (permalink / raw)
  To: David S. Miller, Russell King, netdev
  Cc: linux-arm-kernel, kernel-janitors, Eric Dumazet, Dan Carpenter

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.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
---
 drivers/net/arm/ether1.c |   34 +++++++++++++---------------------
 drivers/net/arm/ether1.h |    1 -
 2 files changed, 13 insertions(+), 22 deletions(-)

diff --git a/drivers/net/arm/ether1.c b/drivers/net/arm/ether1.c
index b17ab51..ad90447 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);
 static int ether1_sendpacket(struct sk_buff *skb, struct net_device *dev);
 static irqreturn_t ether1_interrupt(int irq, void *dev_id);
 static int ether1_close(struct net_device *dev);
-static struct net_device_stats *ether1_getstats(struct net_device *dev);
 static void ether1_setmulticastlist(struct net_device *dev);
 static void ether1_timeout(struct net_device *dev);
 
@@ -649,7 +648,7 @@ ether1_open (struct net_device *dev)
 	if (request_irq(dev->irq, ether1_interrupt, 0, "ether1", dev))
 		return -EAGAIN;
 
-	memset (&priv(dev)->stats, 0, sizeof (struct net_device_stats));
+	memset(&dev->stats, 0, sizeof(struct net_device_stats));
 
 	if (ether1_init_for_open (dev)) {
 		free_irq (dev->irq, dev);
@@ -673,7 +672,7 @@ ether1_timeout(struct net_device *dev)
 	if (ether1_init_for_open (dev))
 		printk (KERN_ERR "%s: unable to restart interface\n", dev->name);
 
-	priv(dev)->stats.tx_errors++;
+	dev->stats.tx_errors++;
 	netif_wake_queue(dev);
 }
 
@@ -802,21 +801,21 @@ again:
 
 	while (nop.nop_status & STAT_COMPLETE) {
 		if (nop.nop_status & STAT_OK) {
-			priv(dev)->stats.tx_packets ++;
-			priv(dev)->stats.collisions += (nop.nop_status & STAT_COLLISIONS);
+			dev->stats.tx_packets++;
+			dev->stats.collisions += (nop.nop_status & STAT_COLLISIONS);
 		} else {
-			priv(dev)->stats.tx_errors ++;
+			dev->stats.tx_errors++;
 
 			if (nop.nop_status & STAT_COLLAFTERTX)
-				priv(dev)->stats.collisions ++;
+				dev->stats.collisions++;
 			if (nop.nop_status & STAT_NOCARRIER)
-				priv(dev)->stats.tx_carrier_errors ++;
+				dev->stats.tx_carrier_errors++;
 			if (nop.nop_status & STAT_TXLOSTCTS)
 				printk (KERN_WARNING "%s: cts lost\n", dev->name);
 			if (nop.nop_status & STAT_TXSLOWDMA)
-				priv(dev)->stats.tx_fifo_errors ++;
+				dev->stats.tx_fifo_errors++;
 			if (nop.nop_status & STAT_COLLEXCESSIVE)
-				priv(dev)->stats.collisions += 16;
+				dev->stats.collisions += 16;
 		}
 
 		if (nop.nop_link == caddr) {
@@ -879,13 +878,13 @@ ether1_recv_done (struct net_device *dev)
 
 				skb->protocol = eth_type_trans (skb, dev);
 				netif_rx (skb);
-				priv(dev)->stats.rx_packets ++;
+				dev->stats.rx_packets++;
 			} else
-				priv(dev)->stats.rx_dropped ++;
+				dev->stats.rx_dropped++;
 		} else {
 			printk(KERN_WARNING "%s: %s\n", dev->name,
 				(rbd.rbd_status & RBD_EOF) ? "oversized packet" : "acnt not valid");
-			priv(dev)->stats.rx_dropped ++;
+			dev->stats.rx_dropped++;
 		}
 
 		nexttail = ether1_readw(dev, priv(dev)->rx_tail, rfd_t, rfd_link, NORMALIRQS);
@@ -939,7 +938,7 @@ ether1_interrupt (int irq, void *dev_id)
 				printk (KERN_WARNING "%s: RU went not ready: RU suspended\n", dev->name);
 				ether1_writew(dev, SCB_CMDRXRESUME, SCB_ADDR, scb_t, scb_command, NORMALIRQS);
 				writeb(CTRL_CA, REG_CONTROL);
-				priv(dev)->stats.rx_dropped ++;	/* we suspended due to lack of buffer space */
+				dev->stats.rx_dropped++;	/* we suspended due to lack of buffer space */
 			} else
 				printk(KERN_WARNING "%s: RU went not ready: %04X\n", dev->name,
 					ether1_readw(dev, SCB_ADDR, scb_t, scb_status, NORMALIRQS));
@@ -962,12 +961,6 @@ ether1_close (struct net_device *dev)
 	return 0;
 }
 
-static struct net_device_stats *
-ether1_getstats (struct net_device *dev)
-{
-	return &priv(dev)->stats;
-}
-
 /*
  * Set or clear the multicast filter for this adaptor.
  * num_addrs == -1	Promiscuous mode, receive all packets.
@@ -994,7 +987,6 @@ static const struct net_device_ops ether1_netdev_ops = {
 	.ndo_open		= ether1_open,
 	.ndo_stop		= ether1_close,
 	.ndo_start_xmit		= ether1_sendpacket,
-	.ndo_get_stats		= ether1_getstats,
 	.ndo_set_multicast_list	= ether1_setmulticastlist,
 	.ndo_tx_timeout		= ether1_timeout,
 	.ndo_validate_addr	= eth_validate_addr,
diff --git a/drivers/net/arm/ether1.h b/drivers/net/arm/ether1.h
index c8a4b23..3a5830a 100644
--- a/drivers/net/arm/ether1.h
+++ b/drivers/net/arm/ether1.h
@@ -38,7 +38,6 @@
 
 struct ether1_priv {
 	void __iomem *base;
-	struct net_device_stats stats;
 	unsigned int tx_link;
 	unsigned int tx_head;
 	volatile unsigned int tx_tail;
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH v3] ether1: Use net_device_stats from struct net_device
@ 2010-08-18  8:45   ` Tobias Klauser
  0 siblings, 0 replies; 45+ messages in thread
From: Tobias Klauser @ 2010-08-18  8:45 UTC (permalink / raw)
  To: linux-arm-kernel

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.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
---
 drivers/net/arm/ether1.c |   34 +++++++++++++---------------------
 drivers/net/arm/ether1.h |    1 -
 2 files changed, 13 insertions(+), 22 deletions(-)

diff --git a/drivers/net/arm/ether1.c b/drivers/net/arm/ether1.c
index b17ab51..ad90447 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);
 static int ether1_sendpacket(struct sk_buff *skb, struct net_device *dev);
 static irqreturn_t ether1_interrupt(int irq, void *dev_id);
 static int ether1_close(struct net_device *dev);
-static struct net_device_stats *ether1_getstats(struct net_device *dev);
 static void ether1_setmulticastlist(struct net_device *dev);
 static void ether1_timeout(struct net_device *dev);
 
@@ -649,7 +648,7 @@ ether1_open (struct net_device *dev)
 	if (request_irq(dev->irq, ether1_interrupt, 0, "ether1", dev))
 		return -EAGAIN;
 
-	memset (&priv(dev)->stats, 0, sizeof (struct net_device_stats));
+	memset(&dev->stats, 0, sizeof(struct net_device_stats));
 
 	if (ether1_init_for_open (dev)) {
 		free_irq (dev->irq, dev);
@@ -673,7 +672,7 @@ ether1_timeout(struct net_device *dev)
 	if (ether1_init_for_open (dev))
 		printk (KERN_ERR "%s: unable to restart interface\n", dev->name);
 
-	priv(dev)->stats.tx_errors++;
+	dev->stats.tx_errors++;
 	netif_wake_queue(dev);
 }
 
@@ -802,21 +801,21 @@ again:
 
 	while (nop.nop_status & STAT_COMPLETE) {
 		if (nop.nop_status & STAT_OK) {
-			priv(dev)->stats.tx_packets ++;
-			priv(dev)->stats.collisions += (nop.nop_status & STAT_COLLISIONS);
+			dev->stats.tx_packets++;
+			dev->stats.collisions += (nop.nop_status & STAT_COLLISIONS);
 		} else {
-			priv(dev)->stats.tx_errors ++;
+			dev->stats.tx_errors++;
 
 			if (nop.nop_status & STAT_COLLAFTERTX)
-				priv(dev)->stats.collisions ++;
+				dev->stats.collisions++;
 			if (nop.nop_status & STAT_NOCARRIER)
-				priv(dev)->stats.tx_carrier_errors ++;
+				dev->stats.tx_carrier_errors++;
 			if (nop.nop_status & STAT_TXLOSTCTS)
 				printk (KERN_WARNING "%s: cts lost\n", dev->name);
 			if (nop.nop_status & STAT_TXSLOWDMA)
-				priv(dev)->stats.tx_fifo_errors ++;
+				dev->stats.tx_fifo_errors++;
 			if (nop.nop_status & STAT_COLLEXCESSIVE)
-				priv(dev)->stats.collisions += 16;
+				dev->stats.collisions += 16;
 		}
 
 		if (nop.nop_link = caddr) {
@@ -879,13 +878,13 @@ ether1_recv_done (struct net_device *dev)
 
 				skb->protocol = eth_type_trans (skb, dev);
 				netif_rx (skb);
-				priv(dev)->stats.rx_packets ++;
+				dev->stats.rx_packets++;
 			} else
-				priv(dev)->stats.rx_dropped ++;
+				dev->stats.rx_dropped++;
 		} else {
 			printk(KERN_WARNING "%s: %s\n", dev->name,
 				(rbd.rbd_status & RBD_EOF) ? "oversized packet" : "acnt not valid");
-			priv(dev)->stats.rx_dropped ++;
+			dev->stats.rx_dropped++;
 		}
 
 		nexttail = ether1_readw(dev, priv(dev)->rx_tail, rfd_t, rfd_link, NORMALIRQS);
@@ -939,7 +938,7 @@ ether1_interrupt (int irq, void *dev_id)
 				printk (KERN_WARNING "%s: RU went not ready: RU suspended\n", dev->name);
 				ether1_writew(dev, SCB_CMDRXRESUME, SCB_ADDR, scb_t, scb_command, NORMALIRQS);
 				writeb(CTRL_CA, REG_CONTROL);
-				priv(dev)->stats.rx_dropped ++;	/* we suspended due to lack of buffer space */
+				dev->stats.rx_dropped++;	/* we suspended due to lack of buffer space */
 			} else
 				printk(KERN_WARNING "%s: RU went not ready: %04X\n", dev->name,
 					ether1_readw(dev, SCB_ADDR, scb_t, scb_status, NORMALIRQS));
@@ -962,12 +961,6 @@ ether1_close (struct net_device *dev)
 	return 0;
 }
 
-static struct net_device_stats *
-ether1_getstats (struct net_device *dev)
-{
-	return &priv(dev)->stats;
-}
-
 /*
  * Set or clear the multicast filter for this adaptor.
  * num_addrs = -1	Promiscuous mode, receive all packets.
@@ -994,7 +987,6 @@ static const struct net_device_ops ether1_netdev_ops = {
 	.ndo_open		= ether1_open,
 	.ndo_stop		= ether1_close,
 	.ndo_start_xmit		= ether1_sendpacket,
-	.ndo_get_stats		= ether1_getstats,
 	.ndo_set_multicast_list	= ether1_setmulticastlist,
 	.ndo_tx_timeout		= ether1_timeout,
 	.ndo_validate_addr	= eth_validate_addr,
diff --git a/drivers/net/arm/ether1.h b/drivers/net/arm/ether1.h
index c8a4b23..3a5830a 100644
--- a/drivers/net/arm/ether1.h
+++ b/drivers/net/arm/ether1.h
@@ -38,7 +38,6 @@
 
 struct ether1_priv {
 	void __iomem *base;
-	struct net_device_stats stats;
 	unsigned int tx_link;
 	unsigned int tx_head;
 	volatile unsigned int tx_tail;
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH v3] ether1: Use net_device_stats from struct net_device
@ 2010-08-18  8:45   ` Tobias Klauser
  0 siblings, 0 replies; 45+ messages in thread
From: Tobias Klauser @ 2010-08-18  8:45 UTC (permalink / raw)
  To: linux-arm-kernel

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.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
---
 drivers/net/arm/ether1.c |   34 +++++++++++++---------------------
 drivers/net/arm/ether1.h |    1 -
 2 files changed, 13 insertions(+), 22 deletions(-)

diff --git a/drivers/net/arm/ether1.c b/drivers/net/arm/ether1.c
index b17ab51..ad90447 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);
 static int ether1_sendpacket(struct sk_buff *skb, struct net_device *dev);
 static irqreturn_t ether1_interrupt(int irq, void *dev_id);
 static int ether1_close(struct net_device *dev);
-static struct net_device_stats *ether1_getstats(struct net_device *dev);
 static void ether1_setmulticastlist(struct net_device *dev);
 static void ether1_timeout(struct net_device *dev);
 
@@ -649,7 +648,7 @@ ether1_open (struct net_device *dev)
 	if (request_irq(dev->irq, ether1_interrupt, 0, "ether1", dev))
 		return -EAGAIN;
 
-	memset (&priv(dev)->stats, 0, sizeof (struct net_device_stats));
+	memset(&dev->stats, 0, sizeof(struct net_device_stats));
 
 	if (ether1_init_for_open (dev)) {
 		free_irq (dev->irq, dev);
@@ -673,7 +672,7 @@ ether1_timeout(struct net_device *dev)
 	if (ether1_init_for_open (dev))
 		printk (KERN_ERR "%s: unable to restart interface\n", dev->name);
 
-	priv(dev)->stats.tx_errors++;
+	dev->stats.tx_errors++;
 	netif_wake_queue(dev);
 }
 
@@ -802,21 +801,21 @@ again:
 
 	while (nop.nop_status & STAT_COMPLETE) {
 		if (nop.nop_status & STAT_OK) {
-			priv(dev)->stats.tx_packets ++;
-			priv(dev)->stats.collisions += (nop.nop_status & STAT_COLLISIONS);
+			dev->stats.tx_packets++;
+			dev->stats.collisions += (nop.nop_status & STAT_COLLISIONS);
 		} else {
-			priv(dev)->stats.tx_errors ++;
+			dev->stats.tx_errors++;
 
 			if (nop.nop_status & STAT_COLLAFTERTX)
-				priv(dev)->stats.collisions ++;
+				dev->stats.collisions++;
 			if (nop.nop_status & STAT_NOCARRIER)
-				priv(dev)->stats.tx_carrier_errors ++;
+				dev->stats.tx_carrier_errors++;
 			if (nop.nop_status & STAT_TXLOSTCTS)
 				printk (KERN_WARNING "%s: cts lost\n", dev->name);
 			if (nop.nop_status & STAT_TXSLOWDMA)
-				priv(dev)->stats.tx_fifo_errors ++;
+				dev->stats.tx_fifo_errors++;
 			if (nop.nop_status & STAT_COLLEXCESSIVE)
-				priv(dev)->stats.collisions += 16;
+				dev->stats.collisions += 16;
 		}
 
 		if (nop.nop_link == caddr) {
@@ -879,13 +878,13 @@ ether1_recv_done (struct net_device *dev)
 
 				skb->protocol = eth_type_trans (skb, dev);
 				netif_rx (skb);
-				priv(dev)->stats.rx_packets ++;
+				dev->stats.rx_packets++;
 			} else
-				priv(dev)->stats.rx_dropped ++;
+				dev->stats.rx_dropped++;
 		} else {
 			printk(KERN_WARNING "%s: %s\n", dev->name,
 				(rbd.rbd_status & RBD_EOF) ? "oversized packet" : "acnt not valid");
-			priv(dev)->stats.rx_dropped ++;
+			dev->stats.rx_dropped++;
 		}
 
 		nexttail = ether1_readw(dev, priv(dev)->rx_tail, rfd_t, rfd_link, NORMALIRQS);
@@ -939,7 +938,7 @@ ether1_interrupt (int irq, void *dev_id)
 				printk (KERN_WARNING "%s: RU went not ready: RU suspended\n", dev->name);
 				ether1_writew(dev, SCB_CMDRXRESUME, SCB_ADDR, scb_t, scb_command, NORMALIRQS);
 				writeb(CTRL_CA, REG_CONTROL);
-				priv(dev)->stats.rx_dropped ++;	/* we suspended due to lack of buffer space */
+				dev->stats.rx_dropped++;	/* we suspended due to lack of buffer space */
 			} else
 				printk(KERN_WARNING "%s: RU went not ready: %04X\n", dev->name,
 					ether1_readw(dev, SCB_ADDR, scb_t, scb_status, NORMALIRQS));
@@ -962,12 +961,6 @@ ether1_close (struct net_device *dev)
 	return 0;
 }
 
-static struct net_device_stats *
-ether1_getstats (struct net_device *dev)
-{
-	return &priv(dev)->stats;
-}
-
 /*
  * Set or clear the multicast filter for this adaptor.
  * num_addrs == -1	Promiscuous mode, receive all packets.
@@ -994,7 +987,6 @@ static const struct net_device_ops ether1_netdev_ops = {
 	.ndo_open		= ether1_open,
 	.ndo_stop		= ether1_close,
 	.ndo_start_xmit		= ether1_sendpacket,
-	.ndo_get_stats		= ether1_getstats,
 	.ndo_set_multicast_list	= ether1_setmulticastlist,
 	.ndo_tx_timeout		= ether1_timeout,
 	.ndo_validate_addr	= eth_validate_addr,
diff --git a/drivers/net/arm/ether1.h b/drivers/net/arm/ether1.h
index c8a4b23..3a5830a 100644
--- a/drivers/net/arm/ether1.h
+++ b/drivers/net/arm/ether1.h
@@ -38,7 +38,6 @@
 
 struct ether1_priv {
 	void __iomem *base;
-	struct net_device_stats stats;
 	unsigned int tx_link;
 	unsigned int tx_head;
 	volatile unsigned int tx_tail;
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* Re: [PATCH v2] ether1: Use net_device_stats from struct net_device
  2010-08-18  7:04   ` Tobias Klauser
  (?)
@ 2010-08-18 15:33     ` Stephen Hemminger
  -1 siblings, 0 replies; 45+ messages in thread
From: Stephen Hemminger @ 2010-08-18 15:33 UTC (permalink / raw)
  To: Tobias Klauser
  Cc: David S. Miller, Russell King, netdev, linux-arm-kernel,
	kernel-janitors, Dan Carpenter

On Wed, 18 Aug 2010 09:04:24 +0200
Tobias Klauser <tklauser@distanz.ch> wrote:

>  
> -	memset (&priv(dev)->stats, 0, sizeof (struct net_device_stats));
> +	memset(&dev->stats, 0, sizeof(struct net_device_stats));

This is incorrect, just remove the memset.  The stats are initialized
when device is created.  The Linux device driver convention is to
keep stats when device is set down and brought back up; that is what
the majority of other drivers do.

-- 

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH v2] ether1: Use net_device_stats from struct net_device
@ 2010-08-18 15:33     ` Stephen Hemminger
  0 siblings, 0 replies; 45+ messages in thread
From: Stephen Hemminger @ 2010-08-18 15:33 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 18 Aug 2010 09:04:24 +0200
Tobias Klauser <tklauser@distanz.ch> wrote:

>  
> -	memset (&priv(dev)->stats, 0, sizeof (struct net_device_stats));
> +	memset(&dev->stats, 0, sizeof(struct net_device_stats));

This is incorrect, just remove the memset.  The stats are initialized
when device is created.  The Linux device driver convention is to
keep stats when device is set down and brought back up; that is what
the majority of other drivers do.

-- 

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [PATCH v2] ether1: Use net_device_stats from struct net_device
@ 2010-08-18 15:33     ` Stephen Hemminger
  0 siblings, 0 replies; 45+ messages in thread
From: Stephen Hemminger @ 2010-08-18 15:33 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 18 Aug 2010 09:04:24 +0200
Tobias Klauser <tklauser@distanz.ch> wrote:

>  
> -	memset (&priv(dev)->stats, 0, sizeof (struct net_device_stats));
> +	memset(&dev->stats, 0, sizeof(struct net_device_stats));

This is incorrect, just remove the memset.  The stats are initialized
when device is created.  The Linux device driver convention is to
keep stats when device is set down and brought back up; that is what
the majority of other drivers do.

-- 

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH v2] ether1: Use net_device_stats from struct net_device
  2010-08-18 15:33     ` Stephen Hemminger
  (?)
@ 2010-08-18 20:10       ` David Miller
  -1 siblings, 0 replies; 45+ messages in thread
From: David Miller @ 2010-08-18 20:10 UTC (permalink / raw)
  To: shemminger
  Cc: tklauser, linux, netdev, linux-arm-kernel, kernel-janitors, error27

From: Stephen Hemminger <shemminger@vyatta.com>
Date: Wed, 18 Aug 2010 08:33:04 -0700

> On Wed, 18 Aug 2010 09:04:24 +0200
> Tobias Klauser <tklauser@distanz.ch> wrote:
> 
>>  
>> -	memset (&priv(dev)->stats, 0, sizeof (struct net_device_stats));
>> +	memset(&dev->stats, 0, sizeof(struct net_device_stats));
> 
> This is incorrect, just remove the memset.  The stats are initialized
> when device is created.  The Linux device driver convention is to
> keep stats when device is set down and brought back up; that is what
> the majority of other drivers do.

Yep, both the ether1 and ether3 patch have this problem.  Looks
like we'll see v4 coming some :-)

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH v2] ether1: Use net_device_stats from struct net_device
@ 2010-08-18 20:10       ` David Miller
  0 siblings, 0 replies; 45+ messages in thread
From: David Miller @ 2010-08-18 20:10 UTC (permalink / raw)
  To: linux-arm-kernel

From: Stephen Hemminger <shemminger@vyatta.com>
Date: Wed, 18 Aug 2010 08:33:04 -0700

> On Wed, 18 Aug 2010 09:04:24 +0200
> Tobias Klauser <tklauser@distanz.ch> wrote:
> 
>>  
>> -	memset (&priv(dev)->stats, 0, sizeof (struct net_device_stats));
>> +	memset(&dev->stats, 0, sizeof(struct net_device_stats));
> 
> This is incorrect, just remove the memset.  The stats are initialized
> when device is created.  The Linux device driver convention is to
> keep stats when device is set down and brought back up; that is what
> the majority of other drivers do.

Yep, both the ether1 and ether3 patch have this problem.  Looks
like we'll see v4 coming some :-)

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [PATCH v2] ether1: Use net_device_stats from struct net_device
@ 2010-08-18 20:10       ` David Miller
  0 siblings, 0 replies; 45+ messages in thread
From: David Miller @ 2010-08-18 20:10 UTC (permalink / raw)
  To: linux-arm-kernel

From: Stephen Hemminger <shemminger@vyatta.com>
Date: Wed, 18 Aug 2010 08:33:04 -0700

> On Wed, 18 Aug 2010 09:04:24 +0200
> Tobias Klauser <tklauser@distanz.ch> wrote:
> 
>>  
>> -	memset (&priv(dev)->stats, 0, sizeof (struct net_device_stats));
>> +	memset(&dev->stats, 0, sizeof(struct net_device_stats));
> 
> This is incorrect, just remove the memset.  The stats are initialized
> when device is created.  The Linux device driver convention is to
> keep stats when device is set down and brought back up; that is what
> the majority of other drivers do.

Yep, both the ether1 and ether3 patch have this problem.  Looks
like we'll see v4 coming some :-)

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [PATCH net-next-2.6] atm: remove a net_device_stats clear
  2010-08-18 20:10       ` David Miller
  (?)
@ 2010-08-18 20:44         ` Eric Dumazet
  -1 siblings, 0 replies; 45+ messages in thread
From: Eric Dumazet @ 2010-08-18 20:44 UTC (permalink / raw)
  To: David Miller
  Cc: shemminger, tklauser, linux, netdev, linux-arm-kernel,
	kernel-janitors, error27

Le mercredi 18 août 2010 à 13:10 -0700, David Miller a écrit :
> From: Stephen Hemminger <shemminger@vyatta.com>
> Date: Wed, 18 Aug 2010 08:33:04 -0700
> 
> > On Wed, 18 Aug 2010 09:04:24 +0200
> > Tobias Klauser <tklauser@distanz.ch> wrote:
> > 
> >>  
> >> -	memset (&priv(dev)->stats, 0, sizeof (struct net_device_stats));
> >> +	memset(&dev->stats, 0, sizeof(struct net_device_stats));
> > 
> > This is incorrect, just remove the memset.  The stats are initialized
> > when device is created.  The Linux device driver convention is to
> > keep stats when device is set down and brought back up; that is what
> > the majority of other drivers do.
> 
> Yep, both the ether1 and ether3 patch have this problem.  Looks
> like we'll see v4 coming some :-)

To be fair, we accepted some bits like that in the past ;)

[PATCH net-next-2.6] atm: remove a net_device_stats clear

No need to clear device stats in lec_open()

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
net/atm/lec.c |    1 -
1 file changed, 1 deletion(-)

diff --git a/net/atm/lec.c b/net/atm/lec.c
index d98bde1..181d70c 100644
--- a/net/atm/lec.c
+++ b/net/atm/lec.c
@@ -220,7 +220,6 @@ static unsigned char *get_tr_dst(unsigned char *packet, unsigned char *rdesc)
 static int lec_open(struct net_device *dev)
 {
 	netif_start_queue(dev);
-	memset(&dev->stats, 0, sizeof(struct net_device_stats));
 
 	return 0;
 }



^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH net-next-2.6] atm: remove a net_device_stats clear
@ 2010-08-18 20:44         ` Eric Dumazet
  0 siblings, 0 replies; 45+ messages in thread
From: Eric Dumazet @ 2010-08-18 20:44 UTC (permalink / raw)
  To: linux-arm-kernel

Le mercredi 18 août 2010 à 13:10 -0700, David Miller a écrit :
> From: Stephen Hemminger <shemminger@vyatta.com>
> Date: Wed, 18 Aug 2010 08:33:04 -0700
> 
> > On Wed, 18 Aug 2010 09:04:24 +0200
> > Tobias Klauser <tklauser@distanz.ch> wrote:
> > 
> >>  
> >> -	memset (&priv(dev)->stats, 0, sizeof (struct net_device_stats));
> >> +	memset(&dev->stats, 0, sizeof(struct net_device_stats));
> > 
> > This is incorrect, just remove the memset.  The stats are initialized
> > when device is created.  The Linux device driver convention is to
> > keep stats when device is set down and brought back up; that is what
> > the majority of other drivers do.
> 
> Yep, both the ether1 and ether3 patch have this problem.  Looks
> like we'll see v4 coming some :-)

To be fair, we accepted some bits like that in the past ;)

[PATCH net-next-2.6] atm: remove a net_device_stats clear

No need to clear device stats in lec_open()

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
net/atm/lec.c |    1 -
1 file changed, 1 deletion(-)

diff --git a/net/atm/lec.c b/net/atm/lec.c
index d98bde1..181d70c 100644
--- a/net/atm/lec.c
+++ b/net/atm/lec.c
@@ -220,7 +220,6 @@ static unsigned char *get_tr_dst(unsigned char *packet, unsigned char *rdesc)
 static int lec_open(struct net_device *dev)
 {
 	netif_start_queue(dev);
-	memset(&dev->stats, 0, sizeof(struct net_device_stats));
 
 	return 0;
 }



^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH net-next-2.6] atm: remove a net_device_stats clear
@ 2010-08-18 20:44         ` Eric Dumazet
  0 siblings, 0 replies; 45+ messages in thread
From: Eric Dumazet @ 2010-08-18 20:44 UTC (permalink / raw)
  To: linux-arm-kernel

Le mercredi 18 ao?t 2010 ? 13:10 -0700, David Miller a ?crit :
> From: Stephen Hemminger <shemminger@vyatta.com>
> Date: Wed, 18 Aug 2010 08:33:04 -0700
> 
> > On Wed, 18 Aug 2010 09:04:24 +0200
> > Tobias Klauser <tklauser@distanz.ch> wrote:
> > 
> >>  
> >> -	memset (&priv(dev)->stats, 0, sizeof (struct net_device_stats));
> >> +	memset(&dev->stats, 0, sizeof(struct net_device_stats));
> > 
> > This is incorrect, just remove the memset.  The stats are initialized
> > when device is created.  The Linux device driver convention is to
> > keep stats when device is set down and brought back up; that is what
> > the majority of other drivers do.
> 
> Yep, both the ether1 and ether3 patch have this problem.  Looks
> like we'll see v4 coming some :-)

To be fair, we accepted some bits like that in the past ;)

[PATCH net-next-2.6] atm: remove a net_device_stats clear

No need to clear device stats in lec_open()

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
net/atm/lec.c |    1 -
1 file changed, 1 deletion(-)

diff --git a/net/atm/lec.c b/net/atm/lec.c
index d98bde1..181d70c 100644
--- a/net/atm/lec.c
+++ b/net/atm/lec.c
@@ -220,7 +220,6 @@ static unsigned char *get_tr_dst(unsigned char *packet, unsigned char *rdesc)
 static int lec_open(struct net_device *dev)
 {
 	netif_start_queue(dev);
-	memset(&dev->stats, 0, sizeof(struct net_device_stats));
 
 	return 0;
 }

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* Re: [PATCH v2] ether1: Use net_device_stats from struct net_device
  2010-08-18 20:10       ` David Miller
  (?)
@ 2010-08-19  6:14         ` Tobias Klauser
  -1 siblings, 0 replies; 45+ messages in thread
From: Tobias Klauser @ 2010-08-19  6:14 UTC (permalink / raw)
  To: David Miller
  Cc: shemminger, linux, netdev, linux-arm-kernel, kernel-janitors, error27

On 2010-08-18 at 22:10:43 +0200, David Miller <davem@davemloft.net> wrote:
> From: Stephen Hemminger <shemminger@vyatta.com>
> Date: Wed, 18 Aug 2010 08:33:04 -0700
> 
> > On Wed, 18 Aug 2010 09:04:24 +0200
> > Tobias Klauser <tklauser@distanz.ch> wrote:
> > 
> >>  
> >> -	memset (&priv(dev)->stats, 0, sizeof (struct net_device_stats));
> >> +	memset(&dev->stats, 0, sizeof(struct net_device_stats));
> > 
> > This is incorrect, just remove the memset.  The stats are initialized
> > when device is created.  The Linux device driver convention is to
> > keep stats when device is set down and brought back up; that is what
> > the majority of other drivers do.
> 
> Yep, both the ether1 and ether3 patch have this problem.  Looks
> like we'll see v4 coming some :-)

Thanks a lot. I'll send another updated patch. Hope I get it right this
time :-)

AFAICS there are a few other network drivers having the same problem,
I'll send patches for those too.

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH v2] ether1: Use net_device_stats from struct net_device
@ 2010-08-19  6:14         ` Tobias Klauser
  0 siblings, 0 replies; 45+ messages in thread
From: Tobias Klauser @ 2010-08-19  6:14 UTC (permalink / raw)
  To: linux-arm-kernel

On 2010-08-18 at 22:10:43 +0200, David Miller <davem@davemloft.net> wrote:
> From: Stephen Hemminger <shemminger@vyatta.com>
> Date: Wed, 18 Aug 2010 08:33:04 -0700
> 
> > On Wed, 18 Aug 2010 09:04:24 +0200
> > Tobias Klauser <tklauser@distanz.ch> wrote:
> > 
> >>  
> >> -	memset (&priv(dev)->stats, 0, sizeof (struct net_device_stats));
> >> +	memset(&dev->stats, 0, sizeof(struct net_device_stats));
> > 
> > This is incorrect, just remove the memset.  The stats are initialized
> > when device is created.  The Linux device driver convention is to
> > keep stats when device is set down and brought back up; that is what
> > the majority of other drivers do.
> 
> Yep, both the ether1 and ether3 patch have this problem.  Looks
> like we'll see v4 coming some :-)

Thanks a lot. I'll send another updated patch. Hope I get it right this
time :-)

AFAICS there are a few other network drivers having the same problem,
I'll send patches for those too.

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [PATCH v2] ether1: Use net_device_stats from struct net_device
@ 2010-08-19  6:14         ` Tobias Klauser
  0 siblings, 0 replies; 45+ messages in thread
From: Tobias Klauser @ 2010-08-19  6:14 UTC (permalink / raw)
  To: linux-arm-kernel

On 2010-08-18 at 22:10:43 +0200, David Miller <davem@davemloft.net> wrote:
> From: Stephen Hemminger <shemminger@vyatta.com>
> Date: Wed, 18 Aug 2010 08:33:04 -0700
> 
> > On Wed, 18 Aug 2010 09:04:24 +0200
> > Tobias Klauser <tklauser@distanz.ch> wrote:
> > 
> >>  
> >> -	memset (&priv(dev)->stats, 0, sizeof (struct net_device_stats));
> >> +	memset(&dev->stats, 0, sizeof(struct net_device_stats));
> > 
> > This is incorrect, just remove the memset.  The stats are initialized
> > when device is created.  The Linux device driver convention is to
> > keep stats when device is set down and brought back up; that is what
> > the majority of other drivers do.
> 
> Yep, both the ether1 and ether3 patch have this problem.  Looks
> like we'll see v4 coming some :-)

Thanks a lot. I'll send another updated patch. Hope I get it right this
time :-)

AFAICS there are a few other network drivers having the same problem,
I'll send patches for those too.

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [PATCH v4] ether1: Use net_device_stats from struct net_device
  2010-08-17 16:15 ` Tobias Klauser
  (?)
@ 2010-08-19  6:15   ` Tobias Klauser
  -1 siblings, 0 replies; 45+ messages in thread
From: Tobias Klauser @ 2010-08-19  6:15 UTC (permalink / raw)
  To: David S. Miller, Russell King, netdev
  Cc: linux-arm-kernel, kernel-janitors, Stephen Hemminger,
	Eric Dumazet, Dan Carpenter

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>
---
 drivers/net/arm/ether1.c |   34 ++++++++++++----------------------
 drivers/net/arm/ether1.h |    1 -
 2 files changed, 12 insertions(+), 23 deletions(-)

diff --git a/drivers/net/arm/ether1.c b/drivers/net/arm/ether1.c
index b17ab51..b00781c 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);
 static int ether1_sendpacket(struct sk_buff *skb, struct net_device *dev);
 static irqreturn_t ether1_interrupt(int irq, void *dev_id);
 static int ether1_close(struct net_device *dev);
-static struct net_device_stats *ether1_getstats(struct net_device *dev);
 static void ether1_setmulticastlist(struct net_device *dev);
 static void ether1_timeout(struct net_device *dev);
 
@@ -649,8 +648,6 @@ ether1_open (struct net_device *dev)
 	if (request_irq(dev->irq, ether1_interrupt, 0, "ether1", dev))
 		return -EAGAIN;
 
-	memset (&priv(dev)->stats, 0, sizeof (struct net_device_stats));
-
 	if (ether1_init_for_open (dev)) {
 		free_irq (dev->irq, dev);
 		return -EAGAIN;
@@ -673,7 +670,7 @@ ether1_timeout(struct net_device *dev)
 	if (ether1_init_for_open (dev))
 		printk (KERN_ERR "%s: unable to restart interface\n", dev->name);
 
-	priv(dev)->stats.tx_errors++;
+	dev->stats.tx_errors++;
 	netif_wake_queue(dev);
 }
 
@@ -802,21 +799,21 @@ again:
 
 	while (nop.nop_status & STAT_COMPLETE) {
 		if (nop.nop_status & STAT_OK) {
-			priv(dev)->stats.tx_packets ++;
-			priv(dev)->stats.collisions += (nop.nop_status & STAT_COLLISIONS);
+			dev->stats.tx_packets++;
+			dev->stats.collisions += (nop.nop_status & STAT_COLLISIONS);
 		} else {
-			priv(dev)->stats.tx_errors ++;
+			dev->stats.tx_errors++;
 
 			if (nop.nop_status & STAT_COLLAFTERTX)
-				priv(dev)->stats.collisions ++;
+				dev->stats.collisions++;
 			if (nop.nop_status & STAT_NOCARRIER)
-				priv(dev)->stats.tx_carrier_errors ++;
+				dev->stats.tx_carrier_errors++;
 			if (nop.nop_status & STAT_TXLOSTCTS)
 				printk (KERN_WARNING "%s: cts lost\n", dev->name);
 			if (nop.nop_status & STAT_TXSLOWDMA)
-				priv(dev)->stats.tx_fifo_errors ++;
+				dev->stats.tx_fifo_errors++;
 			if (nop.nop_status & STAT_COLLEXCESSIVE)
-				priv(dev)->stats.collisions += 16;
+				dev->stats.collisions += 16;
 		}
 
 		if (nop.nop_link == caddr) {
@@ -879,13 +876,13 @@ ether1_recv_done (struct net_device *dev)
 
 				skb->protocol = eth_type_trans (skb, dev);
 				netif_rx (skb);
-				priv(dev)->stats.rx_packets ++;
+				dev->stats.rx_packets++;
 			} else
-				priv(dev)->stats.rx_dropped ++;
+				dev->stats.rx_dropped++;
 		} else {
 			printk(KERN_WARNING "%s: %s\n", dev->name,
 				(rbd.rbd_status & RBD_EOF) ? "oversized packet" : "acnt not valid");
-			priv(dev)->stats.rx_dropped ++;
+			dev->stats.rx_dropped++;
 		}
 
 		nexttail = ether1_readw(dev, priv(dev)->rx_tail, rfd_t, rfd_link, NORMALIRQS);
@@ -939,7 +936,7 @@ ether1_interrupt (int irq, void *dev_id)
 				printk (KERN_WARNING "%s: RU went not ready: RU suspended\n", dev->name);
 				ether1_writew(dev, SCB_CMDRXRESUME, SCB_ADDR, scb_t, scb_command, NORMALIRQS);
 				writeb(CTRL_CA, REG_CONTROL);
-				priv(dev)->stats.rx_dropped ++;	/* we suspended due to lack of buffer space */
+				dev->stats.rx_dropped++;	/* we suspended due to lack of buffer space */
 			} else
 				printk(KERN_WARNING "%s: RU went not ready: %04X\n", dev->name,
 					ether1_readw(dev, SCB_ADDR, scb_t, scb_status, NORMALIRQS));
@@ -962,12 +959,6 @@ ether1_close (struct net_device *dev)
 	return 0;
 }
 
-static struct net_device_stats *
-ether1_getstats (struct net_device *dev)
-{
-	return &priv(dev)->stats;
-}
-
 /*
  * Set or clear the multicast filter for this adaptor.
  * num_addrs == -1	Promiscuous mode, receive all packets.
@@ -994,7 +985,6 @@ static const struct net_device_ops ether1_netdev_ops = {
 	.ndo_open		= ether1_open,
 	.ndo_stop		= ether1_close,
 	.ndo_start_xmit		= ether1_sendpacket,
-	.ndo_get_stats		= ether1_getstats,
 	.ndo_set_multicast_list	= ether1_setmulticastlist,
 	.ndo_tx_timeout		= ether1_timeout,
 	.ndo_validate_addr	= eth_validate_addr,
diff --git a/drivers/net/arm/ether1.h b/drivers/net/arm/ether1.h
index c8a4b23..3a5830a 100644
--- a/drivers/net/arm/ether1.h
+++ b/drivers/net/arm/ether1.h
@@ -38,7 +38,6 @@
 
 struct ether1_priv {
 	void __iomem *base;
-	struct net_device_stats stats;
 	unsigned int tx_link;
 	unsigned int tx_head;
 	volatile unsigned int tx_tail;
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH v4] ether1: Use net_device_stats from struct net_device
@ 2010-08-19  6:15   ` Tobias Klauser
  0 siblings, 0 replies; 45+ messages in thread
From: Tobias Klauser @ 2010-08-19  6:15 UTC (permalink / raw)
  To: linux-arm-kernel

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>
---
 drivers/net/arm/ether1.c |   34 ++++++++++++----------------------
 drivers/net/arm/ether1.h |    1 -
 2 files changed, 12 insertions(+), 23 deletions(-)

diff --git a/drivers/net/arm/ether1.c b/drivers/net/arm/ether1.c
index b17ab51..b00781c 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);
 static int ether1_sendpacket(struct sk_buff *skb, struct net_device *dev);
 static irqreturn_t ether1_interrupt(int irq, void *dev_id);
 static int ether1_close(struct net_device *dev);
-static struct net_device_stats *ether1_getstats(struct net_device *dev);
 static void ether1_setmulticastlist(struct net_device *dev);
 static void ether1_timeout(struct net_device *dev);
 
@@ -649,8 +648,6 @@ ether1_open (struct net_device *dev)
 	if (request_irq(dev->irq, ether1_interrupt, 0, "ether1", dev))
 		return -EAGAIN;
 
-	memset (&priv(dev)->stats, 0, sizeof (struct net_device_stats));
-
 	if (ether1_init_for_open (dev)) {
 		free_irq (dev->irq, dev);
 		return -EAGAIN;
@@ -673,7 +670,7 @@ ether1_timeout(struct net_device *dev)
 	if (ether1_init_for_open (dev))
 		printk (KERN_ERR "%s: unable to restart interface\n", dev->name);
 
-	priv(dev)->stats.tx_errors++;
+	dev->stats.tx_errors++;
 	netif_wake_queue(dev);
 }
 
@@ -802,21 +799,21 @@ again:
 
 	while (nop.nop_status & STAT_COMPLETE) {
 		if (nop.nop_status & STAT_OK) {
-			priv(dev)->stats.tx_packets ++;
-			priv(dev)->stats.collisions += (nop.nop_status & STAT_COLLISIONS);
+			dev->stats.tx_packets++;
+			dev->stats.collisions += (nop.nop_status & STAT_COLLISIONS);
 		} else {
-			priv(dev)->stats.tx_errors ++;
+			dev->stats.tx_errors++;
 
 			if (nop.nop_status & STAT_COLLAFTERTX)
-				priv(dev)->stats.collisions ++;
+				dev->stats.collisions++;
 			if (nop.nop_status & STAT_NOCARRIER)
-				priv(dev)->stats.tx_carrier_errors ++;
+				dev->stats.tx_carrier_errors++;
 			if (nop.nop_status & STAT_TXLOSTCTS)
 				printk (KERN_WARNING "%s: cts lost\n", dev->name);
 			if (nop.nop_status & STAT_TXSLOWDMA)
-				priv(dev)->stats.tx_fifo_errors ++;
+				dev->stats.tx_fifo_errors++;
 			if (nop.nop_status & STAT_COLLEXCESSIVE)
-				priv(dev)->stats.collisions += 16;
+				dev->stats.collisions += 16;
 		}
 
 		if (nop.nop_link = caddr) {
@@ -879,13 +876,13 @@ ether1_recv_done (struct net_device *dev)
 
 				skb->protocol = eth_type_trans (skb, dev);
 				netif_rx (skb);
-				priv(dev)->stats.rx_packets ++;
+				dev->stats.rx_packets++;
 			} else
-				priv(dev)->stats.rx_dropped ++;
+				dev->stats.rx_dropped++;
 		} else {
 			printk(KERN_WARNING "%s: %s\n", dev->name,
 				(rbd.rbd_status & RBD_EOF) ? "oversized packet" : "acnt not valid");
-			priv(dev)->stats.rx_dropped ++;
+			dev->stats.rx_dropped++;
 		}
 
 		nexttail = ether1_readw(dev, priv(dev)->rx_tail, rfd_t, rfd_link, NORMALIRQS);
@@ -939,7 +936,7 @@ ether1_interrupt (int irq, void *dev_id)
 				printk (KERN_WARNING "%s: RU went not ready: RU suspended\n", dev->name);
 				ether1_writew(dev, SCB_CMDRXRESUME, SCB_ADDR, scb_t, scb_command, NORMALIRQS);
 				writeb(CTRL_CA, REG_CONTROL);
-				priv(dev)->stats.rx_dropped ++;	/* we suspended due to lack of buffer space */
+				dev->stats.rx_dropped++;	/* we suspended due to lack of buffer space */
 			} else
 				printk(KERN_WARNING "%s: RU went not ready: %04X\n", dev->name,
 					ether1_readw(dev, SCB_ADDR, scb_t, scb_status, NORMALIRQS));
@@ -962,12 +959,6 @@ ether1_close (struct net_device *dev)
 	return 0;
 }
 
-static struct net_device_stats *
-ether1_getstats (struct net_device *dev)
-{
-	return &priv(dev)->stats;
-}
-
 /*
  * Set or clear the multicast filter for this adaptor.
  * num_addrs = -1	Promiscuous mode, receive all packets.
@@ -994,7 +985,6 @@ static const struct net_device_ops ether1_netdev_ops = {
 	.ndo_open		= ether1_open,
 	.ndo_stop		= ether1_close,
 	.ndo_start_xmit		= ether1_sendpacket,
-	.ndo_get_stats		= ether1_getstats,
 	.ndo_set_multicast_list	= ether1_setmulticastlist,
 	.ndo_tx_timeout		= ether1_timeout,
 	.ndo_validate_addr	= eth_validate_addr,
diff --git a/drivers/net/arm/ether1.h b/drivers/net/arm/ether1.h
index c8a4b23..3a5830a 100644
--- a/drivers/net/arm/ether1.h
+++ b/drivers/net/arm/ether1.h
@@ -38,7 +38,6 @@
 
 struct ether1_priv {
 	void __iomem *base;
-	struct net_device_stats stats;
 	unsigned int tx_link;
 	unsigned int tx_head;
 	volatile unsigned int tx_tail;
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 45+ messages in thread

* [PATCH v4] ether1: Use net_device_stats from struct net_device
@ 2010-08-19  6:15   ` Tobias Klauser
  0 siblings, 0 replies; 45+ messages in thread
From: Tobias Klauser @ 2010-08-19  6:15 UTC (permalink / raw)
  To: linux-arm-kernel

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>
---
 drivers/net/arm/ether1.c |   34 ++++++++++++----------------------
 drivers/net/arm/ether1.h |    1 -
 2 files changed, 12 insertions(+), 23 deletions(-)

diff --git a/drivers/net/arm/ether1.c b/drivers/net/arm/ether1.c
index b17ab51..b00781c 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);
 static int ether1_sendpacket(struct sk_buff *skb, struct net_device *dev);
 static irqreturn_t ether1_interrupt(int irq, void *dev_id);
 static int ether1_close(struct net_device *dev);
-static struct net_device_stats *ether1_getstats(struct net_device *dev);
 static void ether1_setmulticastlist(struct net_device *dev);
 static void ether1_timeout(struct net_device *dev);
 
@@ -649,8 +648,6 @@ ether1_open (struct net_device *dev)
 	if (request_irq(dev->irq, ether1_interrupt, 0, "ether1", dev))
 		return -EAGAIN;
 
-	memset (&priv(dev)->stats, 0, sizeof (struct net_device_stats));
-
 	if (ether1_init_for_open (dev)) {
 		free_irq (dev->irq, dev);
 		return -EAGAIN;
@@ -673,7 +670,7 @@ ether1_timeout(struct net_device *dev)
 	if (ether1_init_for_open (dev))
 		printk (KERN_ERR "%s: unable to restart interface\n", dev->name);
 
-	priv(dev)->stats.tx_errors++;
+	dev->stats.tx_errors++;
 	netif_wake_queue(dev);
 }
 
@@ -802,21 +799,21 @@ again:
 
 	while (nop.nop_status & STAT_COMPLETE) {
 		if (nop.nop_status & STAT_OK) {
-			priv(dev)->stats.tx_packets ++;
-			priv(dev)->stats.collisions += (nop.nop_status & STAT_COLLISIONS);
+			dev->stats.tx_packets++;
+			dev->stats.collisions += (nop.nop_status & STAT_COLLISIONS);
 		} else {
-			priv(dev)->stats.tx_errors ++;
+			dev->stats.tx_errors++;
 
 			if (nop.nop_status & STAT_COLLAFTERTX)
-				priv(dev)->stats.collisions ++;
+				dev->stats.collisions++;
 			if (nop.nop_status & STAT_NOCARRIER)
-				priv(dev)->stats.tx_carrier_errors ++;
+				dev->stats.tx_carrier_errors++;
 			if (nop.nop_status & STAT_TXLOSTCTS)
 				printk (KERN_WARNING "%s: cts lost\n", dev->name);
 			if (nop.nop_status & STAT_TXSLOWDMA)
-				priv(dev)->stats.tx_fifo_errors ++;
+				dev->stats.tx_fifo_errors++;
 			if (nop.nop_status & STAT_COLLEXCESSIVE)
-				priv(dev)->stats.collisions += 16;
+				dev->stats.collisions += 16;
 		}
 
 		if (nop.nop_link == caddr) {
@@ -879,13 +876,13 @@ ether1_recv_done (struct net_device *dev)
 
 				skb->protocol = eth_type_trans (skb, dev);
 				netif_rx (skb);
-				priv(dev)->stats.rx_packets ++;
+				dev->stats.rx_packets++;
 			} else
-				priv(dev)->stats.rx_dropped ++;
+				dev->stats.rx_dropped++;
 		} else {
 			printk(KERN_WARNING "%s: %s\n", dev->name,
 				(rbd.rbd_status & RBD_EOF) ? "oversized packet" : "acnt not valid");
-			priv(dev)->stats.rx_dropped ++;
+			dev->stats.rx_dropped++;
 		}
 
 		nexttail = ether1_readw(dev, priv(dev)->rx_tail, rfd_t, rfd_link, NORMALIRQS);
@@ -939,7 +936,7 @@ ether1_interrupt (int irq, void *dev_id)
 				printk (KERN_WARNING "%s: RU went not ready: RU suspended\n", dev->name);
 				ether1_writew(dev, SCB_CMDRXRESUME, SCB_ADDR, scb_t, scb_command, NORMALIRQS);
 				writeb(CTRL_CA, REG_CONTROL);
-				priv(dev)->stats.rx_dropped ++;	/* we suspended due to lack of buffer space */
+				dev->stats.rx_dropped++;	/* we suspended due to lack of buffer space */
 			} else
 				printk(KERN_WARNING "%s: RU went not ready: %04X\n", dev->name,
 					ether1_readw(dev, SCB_ADDR, scb_t, scb_status, NORMALIRQS));
@@ -962,12 +959,6 @@ ether1_close (struct net_device *dev)
 	return 0;
 }
 
-static struct net_device_stats *
-ether1_getstats (struct net_device *dev)
-{
-	return &priv(dev)->stats;
-}
-
 /*
  * Set or clear the multicast filter for this adaptor.
  * num_addrs == -1	Promiscuous mode, receive all packets.
@@ -994,7 +985,6 @@ static const struct net_device_ops ether1_netdev_ops = {
 	.ndo_open		= ether1_open,
 	.ndo_stop		= ether1_close,
 	.ndo_start_xmit		= ether1_sendpacket,
-	.ndo_get_stats		= ether1_getstats,
 	.ndo_set_multicast_list	= ether1_setmulticastlist,
 	.ndo_tx_timeout		= ether1_timeout,
 	.ndo_validate_addr	= eth_validate_addr,
diff --git a/drivers/net/arm/ether1.h b/drivers/net/arm/ether1.h
index c8a4b23..3a5830a 100644
--- a/drivers/net/arm/ether1.h
+++ b/drivers/net/arm/ether1.h
@@ -38,7 +38,6 @@
 
 struct ether1_priv {
 	void __iomem *base;
-	struct net_device_stats stats;
 	unsigned int tx_link;
 	unsigned int tx_head;
 	volatile unsigned int tx_tail;
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 45+ messages in thread

* Re: [PATCH v4] ether1: Use net_device_stats from struct net_device
  2010-08-19  6:15   ` Tobias Klauser
  (?)
@ 2010-08-19  7:12     ` David Miller
  -1 siblings, 0 replies; 45+ messages in thread
From: David Miller @ 2010-08-19  7:12 UTC (permalink / raw)
  To: tklauser
  Cc: linux, netdev, linux-arm-kernel, kernel-janitors, shemminger,
	eric.dumazet, error27

From: Tobias Klauser <tklauser@distanz.ch>
Date: Thu, 19 Aug 2010 08:15:04 +0200

> 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>

Applied.

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH v4] ether1: Use net_device_stats from struct net_device
@ 2010-08-19  7:12     ` David Miller
  0 siblings, 0 replies; 45+ messages in thread
From: David Miller @ 2010-08-19  7:12 UTC (permalink / raw)
  To: linux-arm-kernel

From: Tobias Klauser <tklauser@distanz.ch>
Date: Thu, 19 Aug 2010 08:15:04 +0200

> 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>

Applied.

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [PATCH v4] ether1: Use net_device_stats from struct net_device
@ 2010-08-19  7:12     ` David Miller
  0 siblings, 0 replies; 45+ messages in thread
From: David Miller @ 2010-08-19  7:12 UTC (permalink / raw)
  To: linux-arm-kernel

From: Tobias Klauser <tklauser@distanz.ch>
Date: Thu, 19 Aug 2010 08:15:04 +0200

> 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>

Applied.

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH net-next-2.6] atm: remove a net_device_stats clear
  2010-08-18 20:44         ` Eric Dumazet
  (?)
@ 2010-08-19  7:15           ` David Miller
  -1 siblings, 0 replies; 45+ messages in thread
From: David Miller @ 2010-08-19  7:15 UTC (permalink / raw)
  To: eric.dumazet
  Cc: shemminger, tklauser, linux, netdev, linux-arm-kernel,
	kernel-janitors, error27

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 18 Aug 2010 22:44:34 +0200

> Le mercredi 18 août 2010 à 13:10 -0700, David Miller a écrit :
>> Yep, both the ether1 and ether3 patch have this problem.  Looks
>> like we'll see v4 coming some :-)
> 
> To be fair, we accepted some bits like that in the past ;)

Yes, but let's nip it in the butt immediately when we do
notice it :-)

> [PATCH net-next-2.6] atm: remove a net_device_stats clear
> 
> No need to clear device stats in lec_open()
> 
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>

Applied, thanks!

^ permalink raw reply	[flat|nested] 45+ messages in thread

* Re: [PATCH net-next-2.6] atm: remove a net_device_stats clear
@ 2010-08-19  7:15           ` David Miller
  0 siblings, 0 replies; 45+ messages in thread
From: David Miller @ 2010-08-19  7:15 UTC (permalink / raw)
  To: linux-arm-kernel

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 18 Aug 2010 22:44:34 +0200

> Le mercredi 18 août 2010 à 13:10 -0700, David Miller a écrit :
>> Yep, both the ether1 and ether3 patch have this problem.  Looks
>> like we'll see v4 coming some :-)
> 
> To be fair, we accepted some bits like that in the past ;)

Yes, but let's nip it in the butt immediately when we do
notice it :-)

> [PATCH net-next-2.6] atm: remove a net_device_stats clear
> 
> No need to clear device stats in lec_open()
> 
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>

Applied, thanks!
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 45+ messages in thread

* [PATCH net-next-2.6] atm: remove a net_device_stats clear
@ 2010-08-19  7:15           ` David Miller
  0 siblings, 0 replies; 45+ messages in thread
From: David Miller @ 2010-08-19  7:15 UTC (permalink / raw)
  To: linux-arm-kernel

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 18 Aug 2010 22:44:34 +0200

> Le mercredi 18 ao?t 2010 ? 13:10 -0700, David Miller a ?crit :
>> Yep, both the ether1 and ether3 patch have this problem.  Looks
>> like we'll see v4 coming some :-)
> 
> To be fair, we accepted some bits like that in the past ;)

Yes, but let's nip it in the butt immediately when we do
notice it :-)

> [PATCH net-next-2.6] atm: remove a net_device_stats clear
> 
> No need to clear device stats in lec_open()
> 
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>

Applied, thanks!

^ permalink raw reply	[flat|nested] 45+ messages in thread

end of thread, other threads:[~2010-08-19  7:15 UTC | newest]

Thread overview: 45+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-17 16:15 [PATCH] ether1: Use net_device_stats from struct net_device Tobias Klauser
2010-08-17 16:15 ` Tobias Klauser
2010-08-17 16:15 ` Tobias Klauser
2010-08-17 18:32 ` Dan Carpenter
2010-08-17 18:32   ` Dan Carpenter
2010-08-17 18:32   ` Dan Carpenter
2010-08-17 18:34   ` Tobias Klauser
2010-08-17 18:34     ` Tobias Klauser
2010-08-17 18:34     ` Tobias Klauser
2010-08-18  7:04 ` [PATCH v2] " Tobias Klauser
2010-08-18  7:04   ` Tobias Klauser
2010-08-18  7:04   ` Tobias Klauser
2010-08-18  8:13   ` Russell King - ARM Linux
2010-08-18  8:13     ` Russell King - ARM Linux
2010-08-18  8:13     ` Russell King - ARM Linux
2010-08-18  8:27     ` Eric Dumazet
2010-08-18  8:27       ` Eric Dumazet
2010-08-18  8:27       ` Eric Dumazet
2010-08-18  8:33       ` Tobias Klauser
2010-08-18  8:33         ` Tobias Klauser
2010-08-18  8:33         ` Tobias Klauser
2010-08-18 15:33   ` Stephen Hemminger
2010-08-18 15:33     ` Stephen Hemminger
2010-08-18 15:33     ` Stephen Hemminger
2010-08-18 20:10     ` David Miller
2010-08-18 20:10       ` David Miller
2010-08-18 20:10       ` David Miller
2010-08-18 20:44       ` [PATCH net-next-2.6] atm: remove a net_device_stats clear Eric Dumazet
2010-08-18 20:44         ` Eric Dumazet
2010-08-18 20:44         ` Eric Dumazet
2010-08-19  7:15         ` David Miller
2010-08-19  7:15           ` David Miller
2010-08-19  7:15           ` David Miller
2010-08-19  6:14       ` [PATCH v2] ether1: Use net_device_stats from struct net_device Tobias Klauser
2010-08-19  6:14         ` Tobias Klauser
2010-08-19  6:14         ` Tobias Klauser
2010-08-18  8:45 ` [PATCH v3] " Tobias Klauser
2010-08-18  8:45   ` Tobias Klauser
2010-08-18  8:45   ` Tobias Klauser
2010-08-19  6:15 ` [PATCH v4] " Tobias Klauser
2010-08-19  6:15   ` Tobias Klauser
2010-08-19  6:15   ` Tobias Klauser
2010-08-19  7:12   ` David Miller
2010-08-19  7:12     ` David Miller
2010-08-19  7:12     ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.