Date: Sun, 15 Oct 2017 16:18:08 +0000 (UTC) From: Warner Losh <imp@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324633 - head/sys/dev/nvme Message-ID: <201710151618.v9FGI8mA096028@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: imp Date: Sun Oct 15 16:18:08 2017 New Revision: 324633 URL: https://svnweb.freebsd.org/changeset/base/324633 Log: 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. Sponsored by: Netflix Suggested by: scottl@ Modified: head/sys/dev/nvme/nvme_ctrlr.c head/sys/dev/nvme/nvme_private.h Modified: head/sys/dev/nvme/nvme_ctrlr.c ============================================================================== --- head/sys/dev/nvme/nvme_ctrlr.c Sun Oct 15 16:18:03 2017 (r324632) +++ head/sys/dev/nvme/nvme_ctrlr.c Sun Oct 15 16:18:08 2017 (r324633) @@ -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: head/sys/dev/nvme/nvme_private.h ============================================================================== --- head/sys/dev/nvme/nvme_private.h Sun Oct 15 16:18:03 2017 (r324632) +++ head/sys/dev/nvme/nvme_private.h Sun Oct 15 16:18:08 2017 (r324633) @@ -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__ */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201710151618.v9FGI8mA096028>