All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Durrant <paul.durrant@citrix.com>
To: netdev@vger.kernel.org, xen-devel@lists.xenproject.org
Cc: Paul Durrant <paul.durrant@citrix.com>,
	Wei Liu <wei.liu2@citrix.com>,
	David Vrabel <david.vrabel@citrix.com>
Subject: [PATCH v2 net-next 6/7] xen-netback: batch copies for multiple to-guest rx packets
Date: Tue, 4 Oct 2016 10:29:17 +0100	[thread overview]
Message-ID: <1475573358-32414-7-git-send-email-paul.durrant__49738.8485506692$1475574706$gmane$org@citrix.com> (raw)
In-Reply-To: <1475573358-32414-1-git-send-email-paul.durrant@citrix.com>

From: David Vrabel <david.vrabel@citrix.com>

Instead of flushing the copy ops when an packet is complete, complete
packets when their copy ops are done.  This improves performance by
reducing the number of grant copy hypercalls.

Latency is still limited by the relatively small size of the copy
batch.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
[re-based]
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
---
Cc: Wei Liu <wei.liu2@citrix.com>
---
 drivers/net/xen-netback/common.h |  1 +
 drivers/net/xen-netback/rx.c     | 27 +++++++++++++++++----------
 2 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/drivers/net/xen-netback/common.h b/drivers/net/xen-netback/common.h
index 7d12a38..cf68149 100644
--- a/drivers/net/xen-netback/common.h
+++ b/drivers/net/xen-netback/common.h
@@ -132,6 +132,7 @@ struct xenvif_copy_state {
 	struct gnttab_copy op[COPY_BATCH_SIZE];
 	RING_IDX idx[COPY_BATCH_SIZE];
 	unsigned int num;
+	struct sk_buff_head *completed;
 };
 
 struct xenvif_queue { /* Per-queue data for xenvif */
diff --git a/drivers/net/xen-netback/rx.c b/drivers/net/xen-netback/rx.c
index ae822b8..8c8c5b5 100644
--- a/drivers/net/xen-netback/rx.c
+++ b/drivers/net/xen-netback/rx.c
@@ -133,6 +133,7 @@ static void xenvif_rx_queue_drop_expired(struct xenvif_queue *queue)
 static void xenvif_rx_copy_flush(struct xenvif_queue *queue)
 {
 	unsigned int i;
+	int notify;
 
 	gnttab_batch_copy(queue->rx_copy.op, queue->rx_copy.num);
 
@@ -154,6 +155,13 @@ static void xenvif_rx_copy_flush(struct xenvif_queue *queue)
 	}
 
 	queue->rx_copy.num = 0;
+
+	/* Push responses for all completed packets. */
+	RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&queue->rx, notify);
+	if (notify)
+		notify_remote_via_irq(queue->rx_irq);
+
+	__skb_queue_purge(queue->rx_copy.completed);
 }
 
 static void xenvif_rx_copy_add(struct xenvif_queue *queue,
@@ -279,18 +287,10 @@ static void xenvif_rx_next_skb(struct xenvif_queue *queue,
 static void xenvif_rx_complete(struct xenvif_queue *queue,
 			       struct xenvif_pkt_state *pkt)
 {
-	int notify;
-
-	/* Complete any outstanding copy ops for this skb. */
-	xenvif_rx_copy_flush(queue);
-
-	/* Push responses and notify. */
+	/* All responses are ready to be pushed. */
 	queue->rx.rsp_prod_pvt = queue->rx.req_cons;
-	RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&queue->rx, notify);
-	if (notify)
-		notify_remote_via_irq(queue->rx_irq);
 
-	dev_kfree_skb(pkt->skb);
+	__skb_queue_tail(queue->rx_copy.completed, pkt->skb);
 }
 
 static void xenvif_rx_next_chunk(struct xenvif_queue *queue,
@@ -429,13 +429,20 @@ void xenvif_rx_skb(struct xenvif_queue *queue)
 
 void xenvif_rx_action(struct xenvif_queue *queue)
 {
+	struct sk_buff_head completed_skbs;
 	unsigned int work_done = 0;
 
+	__skb_queue_head_init(&completed_skbs);
+	queue->rx_copy.completed = &completed_skbs;
+
 	while (xenvif_rx_ring_slots_available(queue) &&
 	       work_done < RX_BATCH_SIZE) {
 		xenvif_rx_skb(queue);
 		work_done++;
 	}
+
+	/* Flush any pending copies and complete all skbs. */
+	xenvif_rx_copy_flush(queue);
 }
 
 static bool xenvif_rx_queue_stalled(struct xenvif_queue *queue)
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  parent reply	other threads:[~2016-10-04  9:49 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-04  9:29 [PATCH v2 net-next 0/7] xen-netback: guest rx side refactor Paul Durrant
2016-10-04  9:29 ` [PATCH v2 net-next 1/7] xen-netback: separate guest side rx code into separate module Paul Durrant
2016-10-04  9:29 ` Paul Durrant
2016-10-04  9:29 ` [PATCH v2 net-next 2/7] xen-netback: retire guest rx side prefix GSO feature Paul Durrant
2016-10-04 10:14   ` David Vrabel
2016-10-04 10:14   ` [Xen-devel] " David Vrabel
2016-10-04 12:52   ` Konrad Rzeszutek Wilk
2016-10-04 12:52   ` [Xen-devel] " Konrad Rzeszutek Wilk
2016-10-04 13:35     ` Paul Durrant
2016-10-04 13:35     ` [Xen-devel] " Paul Durrant
2016-10-04 14:24       ` Konrad Rzeszutek Wilk
2016-10-04 14:24       ` [Xen-devel] " Konrad Rzeszutek Wilk
2016-10-05 15:30         ` Roger Pau Monné
2016-10-05 15:30         ` [Xen-devel] " Roger Pau Monné
2016-10-05 15:40           ` Manuel Bouyer
2016-10-04  9:29 ` Paul Durrant
2016-10-04  9:29 ` [PATCH v2 net-next 3/7] xen-netback: refactor guest rx Paul Durrant
2016-10-04  9:29 ` Paul Durrant
2016-10-04  9:29 ` [PATCH v2 net-next 4/7] xen-netback: immediately wake tx queue when guest rx queue has space Paul Durrant
2016-10-04  9:29 ` Paul Durrant
2016-10-04 12:48   ` [Xen-devel] " Konrad Rzeszutek Wilk
2016-10-04 13:56     ` Paul Durrant
2016-10-04 13:56     ` Paul Durrant
2016-10-04 12:48   ` Konrad Rzeszutek Wilk
2016-10-04  9:29 ` [PATCH v2 net-next 5/7] xen-netback: process guest rx packets in batches Paul Durrant
2016-10-04 12:47   ` Konrad Rzeszutek Wilk
2016-10-04 12:47   ` [Xen-devel] " Konrad Rzeszutek Wilk
2016-10-04 14:02     ` Paul Durrant
2016-10-04 14:02     ` [Xen-devel] " Paul Durrant
2016-10-04 14:51     ` David Vrabel
2016-10-04 14:51     ` [Xen-devel] " David Vrabel
2016-10-04  9:29 ` Paul Durrant
2016-10-04  9:29 ` Paul Durrant [this message]
2016-10-04  9:29 ` [PATCH v2 net-next 6/7] xen-netback: batch copies for multiple to-guest rx packets Paul Durrant
2016-10-04  9:29 ` [PATCH v2 net-next 7/7] xen/netback: add fraglist support for to-guest rx Paul Durrant
2016-10-04 10:56   ` David Vrabel
2016-10-04 10:56   ` [Xen-devel] " David Vrabel
2016-10-04  9:29 ` Paul Durrant
2016-10-07  0:38 ` [PATCH v2 net-next 0/7] xen-netback: guest rx side refactor David Miller
2016-10-07  0:38 ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='1475573358-32414-7-git-send-email-paul.durrant__49738.8485506692$1475574706$gmane$org@citrix.com' \
    --to=paul.durrant@citrix.com \
    --cc=david.vrabel@citrix.com \
    --cc=netdev@vger.kernel.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.