public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] xen-netfront: use net_device's stats structure
@ 2007-10-10  1:13 Jeremy Fitzhardinge
  2007-10-15 18:21 ` Jeff Garzik
  0 siblings, 1 reply; 4+ messages in thread
From: Jeremy Fitzhardinge @ 2007-10-10  1:13 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Stephen Hemminger, Rusty Russell, Linux Kernel Mailing List

struct net_device has its own stats structure, so use that instead.
Also, we can use the default get_stats function.

Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Cc: Stephen Hemminger <shemminger@linux-foundation.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>
---
 drivers/net/xen-netfront.c |   25 +++++++------------------
 1 file changed, 7 insertions(+), 18 deletions(-)

===================================================================
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -72,8 +72,6 @@ struct netfront_info {
 	struct list_head list;
 	struct net_device *netdev;
 
-	struct net_device_stats stats;
-
 	struct xen_netif_tx_front_ring tx;
 	struct xen_netif_rx_front_ring rx;
 
@@ -339,8 +337,6 @@ static int xennet_open(struct net_device
 static int xennet_open(struct net_device *dev)
 {
 	struct netfront_info *np = netdev_priv(dev);
-
-	memset(&np->stats, 0, sizeof(np->stats));
 
 	spin_lock_bh(&np->rx_lock);
 	if (netif_carrier_ok(dev)) {
@@ -566,8 +562,8 @@ static int xennet_start_xmit(struct sk_b
 	if (notify)
 		notify_remote_via_irq(np->netdev->irq);
 
-	np->stats.tx_bytes += skb->len;
-	np->stats.tx_packets++;
+	np->netdev->stats.tx_bytes += skb->len;
+	np->netdev->stats.tx_packets++;
 
 	/* Note: It is not safe to access skb after xennet_tx_buf_gc()! */
 	xennet_tx_buf_gc(dev);
@@ -580,7 +576,7 @@ static int xennet_start_xmit(struct sk_b
 	return 0;
 
  drop:
-	np->stats.tx_dropped++;
+	np->netdev->stats.tx_dropped++;
 	dev_kfree_skb(skb);
 	return 0;
 }
@@ -590,12 +586,6 @@ static int xennet_close(struct net_devic
 	struct netfront_info *np = netdev_priv(dev);
 	netif_stop_queue(np->netdev);
 	return 0;
-}
-
-static struct net_device_stats *xennet_get_stats(struct net_device *dev)
-{
-	struct netfront_info *np = netdev_priv(dev);
-	return &np->stats;
 }
 
 static void xennet_move_rx_slot(struct netfront_info *np, struct sk_buff *skb,
@@ -856,13 +846,13 @@ static int handle_incoming_queue(struct 
 			if (skb_checksum_setup(skb)) {
 				kfree_skb(skb);
 				packets_dropped++;
-				np->stats.rx_errors++;
+				np->netdev->stats.rx_errors++;
 				continue;
 			}
 		}
 
-		np->stats.rx_packets++;
-		np->stats.rx_bytes += skb->len;
+		np->netdev->stats.rx_packets++;
+		np->netdev->stats.rx_bytes += skb->len;
 
 		/* Pass it up. */
 		netif_receive_skb(skb);
@@ -917,7 +907,7 @@ err:
 err:
 			while ((skb = __skb_dequeue(&tmpq)))
 				__skb_queue_tail(&errq, skb);
-			np->stats.rx_errors++;
+			np->netdev->stats.rx_errors++;
 			i = np->rx.rsp_cons;
 			continue;
 		}
@@ -1200,7 +1190,6 @@ static struct net_device * __devinit xen
 	netdev->open            = xennet_open;
 	netdev->hard_start_xmit = xennet_start_xmit;
 	netdev->stop            = xennet_close;
-	netdev->get_stats       = xennet_get_stats;
 	netdev->poll            = xennet_poll;
 	netdev->uninit          = xennet_uninit;
 	netdev->change_mtu	= xennet_change_mtu;


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

* Re: [PATCH 1/3] xen-netfront: use net_device's stats structure
  2007-10-10  1:13 [PATCH 1/3] xen-netfront: use net_device's stats structure Jeremy Fitzhardinge
@ 2007-10-15 18:21 ` Jeff Garzik
  2007-10-15 19:59   ` Jeremy Fitzhardinge
  0 siblings, 1 reply; 4+ messages in thread
From: Jeff Garzik @ 2007-10-15 18:21 UTC (permalink / raw)
  To: Jeremy Fitzhardinge
  Cc: Stephen Hemminger, Rusty Russell, Linux Kernel Mailing List

Jeremy Fitzhardinge wrote:
> struct net_device has its own stats structure, so use that instead.
> Also, we can use the default get_stats function.
> 
> Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
> Cc: Stephen Hemminger <shemminger@linux-foundation.org>
> Cc: Rusty Russell <rusty@rustcorp.com.au>
> ---
>  drivers/net/xen-netfront.c |   25 +++++++------------------
>  1 file changed, 7 insertions(+), 18 deletions(-)

ACK patches 1-3, but they still do not apply.

Since net-2.6.24 has gone upstream, you may send diffs against 
torvalds/linux-2.6.git if you like -- there are no outstanding 
dependencies at this time.



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

* Re: [PATCH 1/3] xen-netfront: use net_device's stats structure
  2007-10-15 18:21 ` Jeff Garzik
@ 2007-10-15 19:59   ` Jeremy Fitzhardinge
  2007-10-15 20:13     ` Jeff Garzik
  0 siblings, 1 reply; 4+ messages in thread
From: Jeremy Fitzhardinge @ 2007-10-15 19:59 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Stephen Hemminger, Rusty Russell, Linux Kernel Mailing List

Jeff Garzik wrote:
> ACK patches 1-3, but they still do not apply.
>
> Since net-2.6.24 has gone upstream, you may send diffs against
> torvalds/linux-2.6.git if you like -- there are no outstanding
> dependencies at this time.

Yes, there was a larger patch which globally rolled all the private
stats structures into the netdev one, so the xen-specfic one was
redundant, and someone else submitted the deadcode removal one, so the
only outstanding patch is this one:

Subject: xen-netfront: rearrange netfront structure to separate tx and rx

Keep tx and rx elements separate on different cachelines to prevent
bouncing.

Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Acked-by: Jeff Garzik <jgarzik@pobox.com>
Cc: Stephen Hemminger <shemminger@linux-foundation.org>
Cc: Christoph Hellwig <hch@infradead.org>

---
 drivers/net/xen-netfront.c |   37 ++++++++++++++++++-------------------
 1 file changed, 18 insertions(+), 19 deletions(-)

===================================================================
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -74,22 +74,12 @@ struct netfront_info {
 
 	struct napi_struct napi;
 
+	unsigned int evtchn;
+	struct xenbus_device *xbdev;
+
+	spinlock_t   tx_lock;
 	struct xen_netif_tx_front_ring tx;
-	struct xen_netif_rx_front_ring rx;
-
-	spinlock_t   tx_lock;
-	spinlock_t   rx_lock;
-
-	unsigned int evtchn;
-
-	/* Receive-ring batched refills. */
-#define RX_MIN_TARGET 8
-#define RX_DFL_MIN_TARGET 64
-#define RX_MAX_TARGET min_t(int, NET_RX_RING_SIZE, 256)
-	unsigned rx_min_target, rx_max_target, rx_target;
-	struct sk_buff_head rx_batch;
-
-	struct timer_list rx_refill_timer;
+	int tx_ring_ref;
 
 	/*
 	 * {tx,rx}_skbs store outstanding skbuffs. Free tx_skb entries
@@ -108,13 +98,22 @@ struct netfront_info {
 	grant_ref_t grant_tx_ref[NET_TX_RING_SIZE];
 	unsigned tx_skb_freelist;
 
+	spinlock_t   rx_lock ____cacheline_aligned_in_smp;
+	struct xen_netif_rx_front_ring rx;
+	int rx_ring_ref;
+
+	/* Receive-ring batched refills. */
+#define RX_MIN_TARGET 8
+#define RX_DFL_MIN_TARGET 64
+#define RX_MAX_TARGET min_t(int, NET_RX_RING_SIZE, 256)
+	unsigned rx_min_target, rx_max_target, rx_target;
+	struct sk_buff_head rx_batch;
+
+	struct timer_list rx_refill_timer;
+
 	struct sk_buff *rx_skbs[NET_RX_RING_SIZE];
 	grant_ref_t gref_rx_head;
 	grant_ref_t grant_rx_ref[NET_RX_RING_SIZE];
-
-	struct xenbus_device *xbdev;
-	int tx_ring_ref;
-	int rx_ring_ref;
 
 	unsigned long rx_pfn_array[NET_RX_RING_SIZE];
 	struct multicall_entry rx_mcl[NET_RX_RING_SIZE+1];



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

* Re: [PATCH 1/3] xen-netfront: use net_device's stats structure
  2007-10-15 19:59   ` Jeremy Fitzhardinge
@ 2007-10-15 20:13     ` Jeff Garzik
  0 siblings, 0 replies; 4+ messages in thread
From: Jeff Garzik @ 2007-10-15 20:13 UTC (permalink / raw)
  To: Jeremy Fitzhardinge
  Cc: Stephen Hemminger, Rusty Russell, Linux Kernel Mailing List

Jeremy Fitzhardinge wrote:
> Jeff Garzik wrote:
>> ACK patches 1-3, but they still do not apply.
>>
>> Since net-2.6.24 has gone upstream, you may send diffs against
>> torvalds/linux-2.6.git if you like -- there are no outstanding
>> dependencies at this time.
> 
> Yes, there was a larger patch which globally rolled all the private
> stats structures into the netdev one, so the xen-specfic one was
> redundant, and someone else submitted the deadcode removal one, so the
> only outstanding patch is this one:
> 
> Subject: xen-netfront: rearrange netfront structure to separate tx and rx
> 
> Keep tx and rx elements separate on different cachelines to prevent
> bouncing.
> 
> Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
> Acked-by: Jeff Garzik <jgarzik@pobox.com>
> Cc: Stephen Hemminger <shemminger@linux-foundation.org>
> Cc: Christoph Hellwig <hch@infradead.org>

applied



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

end of thread, other threads:[~2007-10-15 20:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-10  1:13 [PATCH 1/3] xen-netfront: use net_device's stats structure Jeremy Fitzhardinge
2007-10-15 18:21 ` Jeff Garzik
2007-10-15 19:59   ` Jeremy Fitzhardinge
2007-10-15 20:13     ` Jeff Garzik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox