From patchwork Mon Oct 3 07:31:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Durrant X-Patchwork-Id: 9360151 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 348EE608A6 for ; Mon, 3 Oct 2016 07:53:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 35CB62890E for ; Mon, 3 Oct 2016 07:53:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2A830289B3; Mon, 3 Oct 2016 07:53:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 60B1928963 for ; Mon, 3 Oct 2016 07:53:26 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bqy1c-0000cr-QP; Mon, 03 Oct 2016 07:51:00 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bqy1b-0000cA-E9 for xen-devel@lists.xenproject.org; Mon, 03 Oct 2016 07:50:59 +0000 Received: from [85.158.137.68] by server-16.bemta-3.messagelabs.com id 1A/4D-29579-2ED02F75; Mon, 03 Oct 2016 07:50:58 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprFIsWRWlGSWpSXmKPExsXitHRDpO4D3k/ hBss+SVl83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBl/X9xnLljBVXFo91P2BsaPHF2MHBwSAv4S uw5GdzFycrAJ6EhMfXqJFcQWEbCTuLT5ADuIzSxQJLF0ziwWEFtYwE+io2crM4jNIqAi8WTaO bB6XgF3idOLX7OB2BICchLnj/8Eq+EU8JBYen46O8gqIaCaQ3PNQcJCQK3rp85ig2gVlDg58w kLxCoJiYMvXjBDXMYt8bfbfgIj3ywkVbOQVC1gZFrFqFGcWlSWWqRraKSXVJSZnlGSm5iZo2t oYKyXm1pcnJiempOYVKyXnJ+7iREYTgxAsIPxVbfzIUZJDiYlUV7/zR/DhfiS8lMqMxKLM+KL SnNSiw8xynBwKEnwPuD5FC4kWJSanlqRlpkDDGyYtAQHj5II7y2QNG9xQWJucWY6ROoUoy7Hh 8nX1zIJseTl56VKifMuASkSACnKKM2DGwGLskuMslLCvIxARwnxFKQW5WaWoMq/YhTnYFQS5n 0LMoUnM68EbtMroCOYgI4I3PIB5IiSRISUVAMj+47173cf0Pk8Ye+lEjmhAwXN2uvfuvnf8Wy +a/5fMLDsQ8DxGR5+171/Nur5z3sx0e4Wx8Fi5ukbk2JsZrz+PPPz18nNnBlavy911Tm5P3wT +Wmeb8ba+n8SX+ILYq4nNEdmBLCln03peTvLNjiufusrlUWzNy/r92KNDi2Tyi5fm86beV9Ji aU4I9FQi7moOBEA4gOybq0CAAA= X-Env-Sender: prvs=0774b174f=Paul.Durrant@citrix.com X-Msg-Ref: server-15.tower-31.messagelabs.com!1475481053!60090227!2 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 2833 invoked from network); 3 Oct 2016 07:50:56 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-15.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 3 Oct 2016 07:50:56 -0000 X-IronPort-AV: E=Sophos;i="5.31,289,1473120000"; d="scan'208";a="382006616" From: Paul Durrant To: , Date: Mon, 3 Oct 2016 08:31:10 +0100 Message-ID: <1475479872-23717-6-git-send-email-paul.durrant@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1475479872-23717-1-git-send-email-paul.durrant@citrix.com> References: <1475479872-23717-1-git-send-email-paul.durrant@citrix.com> MIME-Version: 1.0 X-DLP: MIA1 Cc: Paul Durrant , Wei Liu , David Vrabel Subject: [Xen-devel] [PATCH net-next 5/7] xen-netback: process guest rx packets in batches X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: David Vrabel Instead of only placing one skb on the guest rx ring at a time, process a batch of up-to 64. This improves performance by ~10% in some tests. Signed-off-by: David Vrabel [re-based] Signed-off-by: Paul Durrant --- Cc: Wei Liu --- drivers/net/xen-netback/rx.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/net/xen-netback/rx.c b/drivers/net/xen-netback/rx.c index 9548709..ae822b8 100644 --- a/drivers/net/xen-netback/rx.c +++ b/drivers/net/xen-netback/rx.c @@ -399,7 +399,7 @@ static void xenvif_rx_extra_slot(struct xenvif_queue *queue, BUG(); } -void xenvif_rx_action(struct xenvif_queue *queue) +void xenvif_rx_skb(struct xenvif_queue *queue) { struct xenvif_pkt_state pkt; @@ -425,6 +425,19 @@ void xenvif_rx_action(struct xenvif_queue *queue) xenvif_rx_complete(queue, &pkt); } +#define RX_BATCH_SIZE 64 + +void xenvif_rx_action(struct xenvif_queue *queue) +{ + unsigned int work_done = 0; + + while (xenvif_rx_ring_slots_available(queue) && + work_done < RX_BATCH_SIZE) { + xenvif_rx_skb(queue); + work_done++; + } +} + static bool xenvif_rx_queue_stalled(struct xenvif_queue *queue) { RING_IDX prod, cons;