From patchwork Tue Oct 4 09:29:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Durrant X-Patchwork-Id: 9361529 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 8FFB8600C8 for ; Tue, 4 Oct 2016 09:52:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7EDFD287EF for ; Tue, 4 Oct 2016 09:52:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 73A522896A; Tue, 4 Oct 2016 09:52:20 +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 2E252287EF for ; Tue, 4 Oct 2016 09:52:20 +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 1brMLT-0006Es-2b; Tue, 04 Oct 2016 09:49:07 +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-0006DQ-Pm for xen-devel@lists.xenproject.org; Tue, 04 Oct 2016 09:49:05 +0000 Received: from [85.158.137.68] by server-3.bemta-3.messagelabs.com id 9A/5C-23620-11B73F75; Tue, 04 Oct 2016 09:49:05 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrMIsWRWlGSWpSXmKPExsXitHSDva5A9ed wg3cvNS2+b5nM5MDocfjDFZYAxijWzLyk/IoE1oynWxawF0zmrbj2cS17A+NG7i5GTg4JAX+J Lfdfs4LYbAI6ElOfXgKzRQTsJC5tPsAOYjMLFEksnTOLBcQWFkiV2L54MSOIzSKgIrFjyQywG l4Bd4lNp06xQMyUkzh//CcziM0p4CHx9VQ7G4gtBFTz+g2MrSKxfuosNoheQYmTM5+wQOySkD j44gUzxBxuidunpzJPYOSbhaRsFpKyBYxMqxg1ilOLylKLdA0t9ZKKMtMzSnITM3N0DQ2M9XJ Ti4sT01NzEpOK9ZLzczcxAoOqnoGBcQfj7+N+hxglOZiURHkrX38KF+JLyk+pzEgszogvKs1J LT7EKMPBoSTBu73yc7iQYFFqempFWmYOMLxh0hIcPEoivI8qgNK8xQWJucWZ6RCpU4zGHB8mX 1/LxPHq8YO1TEIsefl5qVLivHtAJgmAlGaU5sENgsXdJUZZKWFeRgYGBiGegtSi3MwSVPlXjO IcjErCvD9BpvBk5pXA7XsFdAoT0CmBWz6AnFKSiJCSamB0lMn9NkNE1rlDbYZgzD590Tf72N/ /4q0X/29mOrlm/Qn7R+Xu2vKiG8XVsyb/ZXh15tu0EpH3X4Sm5i4xOXL/Y0rwgo8/xR6kb7rX vzUgpaWes2IDQ/ym6ZodE520psVUTTS6+29i+93YfD/Xd2LyLMu8GW7/ZSmOOdDjEyO5f0m2K 6d2S60SS3FGoqEWc1FxIgDzX5cUtgIAAA== X-Env-Sender: prvs=0787cd24c=Paul.Durrant@citrix.com X-Msg-Ref: server-10.tower-31.messagelabs.com!1475574539!63627478!4 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 14064 invoked from network); 4 Oct 2016 09:49:04 -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:04 -0000 X-IronPort-AV: E=Sophos;i="5.31,442,1473120000"; d="scan'208";a="390530428" From: Paul Durrant To: , Date: Tue, 4 Oct 2016 10:29:15 +0100 Message-ID: <1475573358-32414-5-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 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(); }