From patchwork Wed Mar 12 21:04:41 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zoltan Kiss X-Patchwork-Id: 329689 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id E6FD42C00A1 for ; Thu, 13 Mar 2014 08:05:19 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752349AbaCLVEw (ORCPT ); Wed, 12 Mar 2014 17:04:52 -0400 Received: from smtp.citrix.com ([66.165.176.89]:33846 "EHLO SMTP.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752031AbaCLVEv (ORCPT ); Wed, 12 Mar 2014 17:04:51 -0400 X-IronPort-AV: E=Sophos;i="4.97,641,1389744000"; d="scan'208";a="110794638" Received: from accessns.citrite.net (HELO FTLPEX01CL03.citrite.net) ([10.9.154.239]) by FTLPIPO01.CITRIX.COM with ESMTP; 12 Mar 2014 21:04:50 +0000 Received: from imagesandwords.uk.xensource.com (10.80.2.133) by FTLPEX01CL03.citrite.net (10.13.107.80) with Microsoft SMTP Server id 14.2.342.4; Wed, 12 Mar 2014 17:04:50 -0400 From: Zoltan Kiss To: , , CC: , , , Zoltan Kiss Subject: [PATCH net-next] xen-netback: Schedule NAPI from dealloc thread instead of callback Date: Wed, 12 Mar 2014 21:04:41 +0000 Message-ID: <1394658281-2488-1-git-send-email-zoltan.kiss@citrix.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 X-Originating-IP: [10.80.2.133] X-DLP: MIA2 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org If there are unconsumed requests in the ring, but there isn't enough free pending slots, the NAPI instance deschedule itself. As the frontend won't send any more interrupts in this case, it is the task of whoever release the pending slots to schedule the NAPI instance in this case. Originally it was done in the callback, but it's better at the end of the dealloc thread, otherwise there is a risk that the NAPI instance just deschedule itself as the dealloc thread couldn't release any used slot yet. However, as there are a lot of pending packets, NAPI will be scheduled again, and it is very unlikely that the dealloc thread can't release enough slots in the meantime. Signed-off-by: Zoltan Kiss Acked-by: Ian Campbell --- -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c index eae9724..07c9677 100644 --- a/drivers/net/xen-netback/netback.c +++ b/drivers/net/xen-netback/netback.c @@ -1516,13 +1516,6 @@ void xenvif_zerocopy_callback(struct ubuf_info *ubuf, bool zerocopy_success) wake_up(&vif->dealloc_wq); spin_unlock_irqrestore(&vif->callback_lock, flags); - if (RING_HAS_UNCONSUMED_REQUESTS(&vif->tx) && - xenvif_tx_pending_slots_available(vif)) { - local_bh_disable(); - napi_schedule(&vif->napi); - local_bh_enable(); - } - if (likely(zerocopy_success)) vif->tx_zerocopy_success++; else @@ -1594,6 +1587,13 @@ static inline void xenvif_tx_dealloc_action(struct xenvif *vif) for (i = 0; i < gop - vif->tx_unmap_ops; ++i) xenvif_idx_release(vif, pending_idx_release[i], XEN_NETIF_RSP_OKAY); + + if (RING_HAS_UNCONSUMED_REQUESTS(&vif->tx) && + xenvif_tx_pending_slots_available(vif)) { + local_bh_disable(); + napi_schedule(&vif->napi); + local_bh_enable(); + } }