From owner-svn-src-stable@freebsd.org Thu Feb 1 19:05:49 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 49462EE5F03; Thu, 1 Feb 2018 19:05:49 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EC04F7E45B; Thu, 1 Feb 2018 19:05:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E70B6110E8; Thu, 1 Feb 2018 19:05:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11J5m5X007519; Thu, 1 Feb 2018 19:05:48 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11J5mTe007517; Thu, 1 Feb 2018 19:05:48 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011905.w11J5mTe007517@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 19:05:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328701 - stable/11/sys/dev/nvme X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/dev/nvme X-SVN-Commit-Revision: 328701 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 19:05:49 -0000 Author: mav Date: Thu Feb 1 19:05:48 2018 New Revision: 328701 URL: https://svnweb.freebsd.org/changeset/base/328701 Log: MFC r324633 (by imp): Create general polling function for the nvme controller. Use it when we're doing the various pin-based interrupt modes. Adjust nvme_ctrlr_intx_handler to use nvme_ctrlr_poll. Modified: stable/11/sys/dev/nvme/nvme_ctrlr.c stable/11/sys/dev/nvme/nvme_private.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/nvme/nvme_ctrlr.c ============================================================================== --- stable/11/sys/dev/nvme/nvme_ctrlr.c Thu Feb 1 19:04:50 2018 (r328700) +++ stable/11/sys/dev/nvme/nvme_ctrlr.c Thu Feb 1 19:05:48 2018 (r328701) @@ -815,18 +815,33 @@ nvme_ctrlr_reset_task(void *arg, int pending) atomic_cmpset_32(&ctrlr->is_resetting, 1, 0); } +/* + * Poll all the queues enabled on the device for completion. + */ void -nvme_ctrlr_intx_handler(void *arg) +nvme_ctrlr_poll(struct nvme_controller *ctrlr) { - struct nvme_controller *ctrlr = arg; + int i; - nvme_mmio_write_4(ctrlr, intms, 1); - nvme_qpair_process_completions(&ctrlr->adminq); - if (ctrlr->ioq && ctrlr->ioq[0].cpl) - nvme_qpair_process_completions(&ctrlr->ioq[0]); + for (i = 0; i < ctrlr->num_io_queues; i++) + if (ctrlr->ioq && ctrlr->ioq[i].cpl) + nvme_qpair_process_completions(&ctrlr->ioq[i]); +} +/* + * Poll the single-vector intertrupt case: num_io_queues will be 1 and + * there's only a single vector. While we're polling, we mask further + * interrupts in the controller. + */ +void +nvme_ctrlr_intx_handler(void *arg) +{ + struct nvme_controller *ctrlr = arg; + + nvme_mmio_write_4(ctrlr, intms, 1); + nvme_ctrlr_poll(ctrlr); nvme_mmio_write_4(ctrlr, intmc, 1); } Modified: stable/11/sys/dev/nvme/nvme_private.h ============================================================================== --- stable/11/sys/dev/nvme/nvme_private.h Thu Feb 1 19:04:50 2018 (r328700) +++ stable/11/sys/dev/nvme/nvme_private.h Thu Feb 1 19:05:48 2018 (r328701) @@ -542,5 +542,6 @@ void nvme_notify_fail_consumers(struct nvme_controller void nvme_notify_new_controller(struct nvme_controller *ctrlr); void nvme_ctrlr_intx_handler(void *arg); +void nvme_ctrlr_poll(struct nvme_controller *ctrlr); #endif /* __NVME_PRIVATE_H__ */