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__ */
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to