From patchwork Thu Mar 9 13:16:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sagi Grimberg X-Patchwork-Id: 9613379 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 A30C660414 for ; Thu, 9 Mar 2017 13:38:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 926882857E for ; Thu, 9 Mar 2017 13:38:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 874252855E; Thu, 9 Mar 2017 13:38: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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1B83D2855E for ; Thu, 9 Mar 2017 13:38:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754909AbdCINiR (ORCPT ); Thu, 9 Mar 2017 08:38:17 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:49984 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754861AbdCINiQ (ORCPT ); Thu, 9 Mar 2017 08:38:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:To:From:Sender:Reply-To:Cc:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=KseD3P9c5Uirx/RHUAurqHjF7mwdrn4O0+d4fpI7Seo=; b=diUG3tTDafAvyw3ReU5oo9dTd 1BSjxtO++h2ah7fkb/rT/CEF3cpNJWQZypIjCwpb9O36EUDUp2R9HJQr3Pgopfnxsgjje+3AAbdz5 NLA2Qs1PRN83afaj+pMWNG2f5AOe7E/4A8ZV+egUy4jGacs6Yc+GnBSNuOlc1/QjJkbUmhQ9ihsu2 PkyAKwCM8aSX56RCyce8HcAFtSJWfCnPQzQpGe5kFSFP1Az+IyVEGLMJtJ2gBZxOZbaP5ysf88d3p zwqkr2KYe8IpaEwE0p61UuY2lxNImwo66WsnNGq7ulsy1JAHkkimJ8HQfY7MhEnX1jk/2f4wQvaOa SwIiilTDQ==; Received: from bzq-82-81-101-184.red.bezeqint.net ([82.81.101.184] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtpsa (Exim 4.87 #1 (Red Hat Linux)) id 1clxwU-0001My-9l; Thu, 09 Mar 2017 13:17:19 +0000 From: Sagi Grimberg To: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, linux-rdma@vger.kernel.org, target-devel@vger.kernel.org Subject: [PATCH rfc 05/10] nvme-pci: Support blk_poll_batch Date: Thu, 9 Mar 2017 15:16:37 +0200 Message-Id: <1489065402-14757-6-git-send-email-sagi@grimberg.me> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1489065402-14757-1-git-send-email-sagi@grimberg.me> References: <1489065402-14757-1-git-send-email-sagi@grimberg.me> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Sagi Grimberg --- drivers/nvme/host/pci.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index a7ad514c2451..f8dcd0bd19f8 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -789,6 +789,21 @@ static int nvme_poll(struct blk_mq_hw_ctx *hctx, unsigned int tag) return found; } +static int nvme_poll_batch(struct blk_mq_hw_ctx *hctx, unsigned int batch) +{ + struct nvme_queue *nvmeq = hctx->driver_data; + int completed; + + if (!nvme_cqe_valid(nvmeq, nvmeq->cq_head, nvmeq->cq_phase)) + return 0; + + spin_lock_irq(&nvmeq->q_lock); + completed = __nvme_process_cq(nvmeq, batch); + spin_unlock_irq(&nvmeq->q_lock); + + return completed; +} + static void nvme_pci_submit_async_event(struct nvme_ctrl *ctrl, int aer_idx) { struct nvme_dev *dev = to_nvme_dev(ctrl); @@ -1174,6 +1189,7 @@ static struct blk_mq_ops nvme_mq_ops = { .map_queues = nvme_pci_map_queues, .timeout = nvme_timeout, .poll = nvme_poll, + .poll_batch = nvme_poll_batch, }; static void nvme_dev_remove_admin(struct nvme_dev *dev)