From patchwork Tue Oct 4 09:29:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Durrant X-Patchwork-Id: 9361527 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 4DACD608A6 for ; Tue, 4 Oct 2016 09:52:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3BEDD287EF for ; Tue, 4 Oct 2016 09:52:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3068028990; Tue, 4 Oct 2016 09:52:19 +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 D6EB628968 for ; Tue, 4 Oct 2016 09:52:18 +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 1brMLS-0006E6-DT; Tue, 04 Oct 2016 09:49:06 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1brMLR-0006DE-4e for xen-devel@lists.xenproject.org; Tue, 04 Oct 2016 09:49:05 +0000 Received: from [85.158.137.68] by server-12.bemta-3.messagelabs.com id 28/75-09160-01B73F75; Tue, 04 Oct 2016 09:49:04 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprNIsWRWlGSWpSXmKPExsXitHSDvS5/9ed wg6dzDC2+b5nM5MDocfjDFZYAxijWzLyk/IoE1oy/L+4zF6zgqji0+yl7A+NHji5GTg4JAX+J pZePM4HYbAI6ElOfXmIFsUUE7CQubT7ADmIzCxRJLJ0zi6WLkYNDWCBQYssnDZAwi4CKxKLdr YwgYV4Bd4nu87UQE+Ukzh//yQxicwp4SHw91c4GYgsBlbx+A2OrSKyfOgvM5hUQlDg58wkLxC YJiYMvXjBDzOGWuH16KvMERr5ZSMpmISlbwMi0ilGjOLWoLLVI19BSL6koMz2jJDcxM0fX0MB YLze1uDgxPTUnMalYLzk/dxMjMKDqGRgYdzD+Pu53iFGSg0lJlLfy9adwIb6k/JTKjMTijPii 0pzU4kOMMhwcShK82ys/hwsJFqWmp1akZeYAQxsmLcHBoyTC+6gCKM1bXJCYW5yZDpE6xajL8 WHy9bVMQix5+XmpUuK8e0BmCIAUZZTmwY2AxdklRlkpYV5GBgYGIZ6C1KLczBJU+VeM4hyMSs K8P0Gm8GTmlcBtegV0BBPQEYFbPoAcUZKIkJJqYCzaabJ55klRhRN7S9pOnVx+K3xnzP6o/ZZ Bwncln/O6Z930XZsotD/lZM+0GasPmDbI/3G59Oj+08v3vUqnvjrzKqnlvTz3b52G9e+q+CRe GltPWDbPWTlsNY9rX8O7S0Y6z1QOlUjF7VJewZ73v1lEJOLwj+71wb+1ltwUrVlzclnghND2R 25KLMUZiYZazEXFiQClLayxrgIAAA== X-Env-Sender: prvs=0787cd24c=Paul.Durrant@citrix.com X-Msg-Ref: server-10.tower-31.messagelabs.com!1475574539!63627478!3 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 14004 invoked from network); 4 Oct 2016 09:49:03 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-10.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 4 Oct 2016 09:49:03 -0000 X-IronPort-AV: E=Sophos;i="5.31,442,1473120000"; d="scan'208";a="390530425" From: Paul Durrant To: , Date: Tue, 4 Oct 2016 10:29:16 +0100 Message-ID: <1475573358-32414-6-git-send-email-paul.durrant@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1475573358-32414-1-git-send-email-paul.durrant@citrix.com> References: <1475573358-32414-1-git-send-email-paul.durrant@citrix.com> MIME-Version: 1.0 X-DLP: MIA2 Cc: Paul Durrant , Wei Liu , David Vrabel Subject: [Xen-devel] [PATCH v2 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;