Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Aug 2019 18:48:17 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r350926 - stable/12/sys/dev/nvme
Message-ID:  <201908121848.x7CImHKQ059019@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Mon Aug 12 18:48:17 2019
New Revision: 350926
URL: https://svnweb.freebsd.org/changeset/base/350926

Log:
  MFC r347369 (by imp): rename nvme_ctrlr_destroy_qpair to nvme_ctrlr_destroy_qpairs
  
  Maintain symmetry with nvme_ctrlr_create_qpairs, making it easier to
  match init/uninit scenarios.

Modified:
  stable/12/sys/dev/nvme/nvme_ctrlr.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/nvme/nvme_ctrlr.c
==============================================================================
--- stable/12/sys/dev/nvme/nvme_ctrlr.c	Mon Aug 12 18:47:40 2019	(r350925)
+++ stable/12/sys/dev/nvme/nvme_ctrlr.c	Mon Aug 12 18:48:17 2019	(r350926)
@@ -515,28 +515,33 @@ nvme_ctrlr_create_qpairs(struct nvme_controller *ctrlr
 }
 
 static int
-nvme_ctrlr_destroy_qpair(struct nvme_controller *ctrlr, struct nvme_qpair *qpair)
+nvme_ctrlr_destroy_qpairs(struct nvme_controller *ctrlr)
 {
 	struct nvme_completion_poll_status	status;
+	struct nvme_qpair			*qpair;
 
-	status.done = 0;
-	nvme_ctrlr_cmd_delete_io_sq(ctrlr, qpair,
-	    nvme_completion_poll_cb, &status);
-	while (!atomic_load_acq_int(&status.done))
-		pause("nvme", 1);
-	if (nvme_completion_is_error(&status.cpl)) {
-		nvme_printf(ctrlr, "nvme_destroy_io_sq failed!\n");
-		return (ENXIO);
-	}
+	for (int i = 0; i < ctrlr->num_io_queues; i++) {
+		qpair = &ctrlr->ioq[i];
 
-	status.done = 0;
-	nvme_ctrlr_cmd_delete_io_cq(ctrlr, qpair,
-	    nvme_completion_poll_cb, &status);
-	while (!atomic_load_acq_int(&status.done))
-		pause("nvme", 1);
-	if (nvme_completion_is_error(&status.cpl)) {
-		nvme_printf(ctrlr, "nvme_destroy_io_cq failed!\n");
-		return (ENXIO);
+		status.done = 0;
+		nvme_ctrlr_cmd_delete_io_sq(ctrlr, qpair,
+		    nvme_completion_poll_cb, &status);
+		while (!atomic_load_acq_int(&status.done))
+			pause("nvme", 1);
+		if (nvme_completion_is_error(&status.cpl)) {
+			nvme_printf(ctrlr, "nvme_destroy_io_sq failed!\n");
+			return (ENXIO);
+		}
+
+		status.done = 0;
+		nvme_ctrlr_cmd_delete_io_cq(ctrlr, qpair,
+		    nvme_completion_poll_cb, &status);
+		while (!atomic_load_acq_int(&status.done))
+			pause("nvme", 1);
+		if (nvme_completion_is_error(&status.cpl)) {
+			nvme_printf(ctrlr, "nvme_destroy_io_cq failed!\n");
+			return (ENXIO);
+		}
 	}
 
 	return (0);
@@ -1314,8 +1319,8 @@ nvme_ctrlr_destruct(struct nvme_controller *ctrlr, dev
 	if (ctrlr->cdev)
 		destroy_dev(ctrlr->cdev);
 
+	nvme_ctrlr_destroy_qpairs(ctrlr);
 	for (i = 0; i < ctrlr->num_io_queues; i++) {
-		nvme_ctrlr_destroy_qpair(ctrlr, &ctrlr->ioq[i]);
 		nvme_io_qpair_destroy(&ctrlr->ioq[i]);
 	}
 	free(ctrlr->ioq, M_NVME);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201908121848.x7CImHKQ059019>