From patchwork Mon Oct 3 07:31:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Durrant X-Patchwork-Id: 9360163 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 ECB52601C0 for ; Mon, 3 Oct 2016 07:54:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EB8C82890E for ; Mon, 3 Oct 2016 07:54:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DF9AE28963; Mon, 3 Oct 2016 07:54:12 +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 762E02890E for ; Mon, 3 Oct 2016 07:54:12 +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 1bqy1d-0000dZ-14; Mon, 03 Oct 2016 07:51:01 +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-0000cB-Kh for xen-devel@lists.xenproject.org; Mon, 03 Oct 2016 07:50:59 +0000 Received: from [85.158.137.68] by server-3.bemta-3.messagelabs.com id 77/DE-23620-2ED02F75; Mon, 03 Oct 2016 07:50:58 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrEIsWRWlGSWpSXmKPExsXitHRDpO593k/ hBisnKVt83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBlPtyxgL5jMW3Ht41r2BsaN3F2MnBwSAv4S nw4tZQKx2QR0JKY+vcQKYosI2Elc2nyAHcRmFiiSWDpnFguILSyQJHF+w2awOIuAikT73tVsI DavgLvE351HWCFmykmcP/6TGcTmFPCQWHp+OlA9B4cQUM2hueYgYSGg1vVTZ0G1CkqcnPmEBW KVhMTBFy+YIcZwS9w+PZV5AiPfLCRls5CULWBkWsWoUZxaVJZapGtopJdUlJmeUZKbmJmja2h grJebWlycmJ6ak5hUrJecn7uJERhSDECwg/FVt/MhRkkOJiVRXv/NH8OF+JLyUyozEosz4otK c1KLDzHKcHAoSfA+4PkULiRYlJqeWpGWmQMMbpi0BAePkgjvLZA0b3FBYm5xZjpE6hSjMceHy dfXMnG8evxgLZMQS15+XqqUOO8SkFIBkNKM0jy4QbCou8QoKyXMywh0mhBPQWpRbmYJqvwrRn EORiVh3rcgU3gy80rg9r0COoUJ6JTALR9ATilJREhJNTAK8N7s+1CTeX7G96lJDHYSeV/9NwU ujP774vWX1Il9L5yNnhkuX9jzNLFimoP4ZPsVT5LFIrcpVl47lfJ8loFwBp/+lBVTxVn0VrWc Odp08vnZf4tfG4ZMOl7yzHUF1+lDF4zd/phWf1bZXePZKFP/UWij9mvFtVb/LRjFk/5s2Mpc5 veq2KpciaU4I9FQi7moOBEAPXUxf7UCAAA= X-Env-Sender: prvs=0774b174f=Paul.Durrant@citrix.com X-Msg-Ref: server-15.tower-31.messagelabs.com!1475481053!60090227!1 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 2696 invoked from network); 3 Oct 2016 07:50:55 -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:55 -0000 X-IronPort-AV: E=Sophos;i="5.31,289,1473120000"; d="scan'208";a="382006615" From: Paul Durrant To: , Date: Mon, 3 Oct 2016 08:31:09 +0100 Message-ID: <1475479872-23717-5-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: MIA2 Cc: Paul Durrant , Wei Liu , David Vrabel Subject: [Xen-devel] [PATCH net-next 4/7] xen-netback: immediately wake tx queue when guest rx queue has space 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 When an skb is removed from the guest rx queue, immediately wake the tx queue, instead of after processing them. Signed-off-by: David Vrabel [re-based] Signed-off-by: Paul Durrant --- Cc: Wei Liu --- drivers/net/xen-netback/rx.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/drivers/net/xen-netback/rx.c b/drivers/net/xen-netback/rx.c index b0ce4c6..9548709 100644 --- a/drivers/net/xen-netback/rx.c +++ b/drivers/net/xen-netback/rx.c @@ -92,27 +92,21 @@ static struct sk_buff *xenvif_rx_dequeue(struct xenvif_queue *queue) spin_lock_irq(&queue->rx_queue.lock); skb = __skb_dequeue(&queue->rx_queue); - if (skb) + if (skb) { queue->rx_queue_len -= skb->len; + if (queue->rx_queue_len < queue->rx_queue_max) { + struct netdev_queue *txq; + + txq = netdev_get_tx_queue(queue->vif->dev, queue->id); + netif_tx_wake_queue(txq); + } + } spin_unlock_irq(&queue->rx_queue.lock); return skb; } -static void xenvif_rx_queue_maybe_wake(struct xenvif_queue *queue) -{ - spin_lock_irq(&queue->rx_queue.lock); - - if (queue->rx_queue_len < queue->rx_queue_max) { - struct net_device *dev = queue->vif->dev; - - netif_tx_wake_queue(netdev_get_tx_queue(dev, queue->id)); - } - - spin_unlock_irq(&queue->rx_queue.lock); -} - static void xenvif_rx_queue_purge(struct xenvif_queue *queue) { struct sk_buff *skb; @@ -585,8 +579,6 @@ int xenvif_kthread_guest_rx(void *data) */ xenvif_rx_queue_drop_expired(queue); - xenvif_rx_queue_maybe_wake(queue); - cond_resched(); }