Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 Dec 2019 22:12:40 +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: r355465 - head/sys/dev/nvme
Message-ID:  <201912062212.xB6MCedu041746@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: imp
Date: Fri Dec  6 22:12:39 2019
New Revision: 355465
URL: https://svnweb.freebsd.org/changeset/base/355465

Log:
  trackers always know what qpair they are on
  
  Don't needlessly pass around qpair pointers when the tracker knows what
  qpair it's on.  This will simplify code and make it easier to split
  submission and completion queues in the future.
  
  Signed-off-by: John Meneghini <johnm@netapp.com>

Modified:
  head/sys/dev/nvme/nvme_qpair.c

Modified: head/sys/dev/nvme/nvme_qpair.c
==============================================================================
--- head/sys/dev/nvme/nvme_qpair.c	Fri Dec  6 21:50:24 2019	(r355464)
+++ head/sys/dev/nvme/nvme_qpair.c	Fri Dec  6 22:12:39 2019	(r355465)
@@ -418,9 +418,10 @@ nvme_completion_is_retry(const struct nvme_completion 
 }
 
 static void
-nvme_qpair_complete_tracker(struct nvme_qpair *qpair, struct nvme_tracker *tr,
+nvme_qpair_complete_tracker(struct nvme_tracker *tr,
     struct nvme_completion *cpl, error_print_t print_on_error)
 {
+	struct nvme_qpair * qpair = tr->qpair;
 	struct nvme_request	*req;
 	boolean_t		retry, error, retriable;
 
@@ -484,19 +485,22 @@ nvme_qpair_complete_tracker(struct nvme_qpair *qpair, 
 }
 
 static void
-nvme_qpair_manual_complete_tracker(struct nvme_qpair *qpair,
+nvme_qpair_manual_complete_tracker(
     struct nvme_tracker *tr, uint32_t sct, uint32_t sc, uint32_t dnr,
     error_print_t print_on_error)
 {
 	struct nvme_completion	cpl;
 
 	memset(&cpl, 0, sizeof(cpl));
+
+	struct nvme_qpair * qpair = tr->qpair;
+
 	cpl.sqid = qpair->id;
 	cpl.cid = tr->cid;
 	cpl.status |= (sct & NVME_STATUS_SCT_MASK) << NVME_STATUS_SCT_SHIFT;
 	cpl.status |= (sc & NVME_STATUS_SC_MASK) << NVME_STATUS_SC_SHIFT;
 	cpl.status |= (dnr & NVME_STATUS_DNR_MASK) << NVME_STATUS_DNR_SHIFT;
-	nvme_qpair_complete_tracker(qpair, tr, &cpl, print_on_error);
+	nvme_qpair_complete_tracker(tr, &cpl, print_on_error);
 }
 
 void
@@ -589,7 +593,7 @@ nvme_qpair_process_completions(struct nvme_qpair *qpai
 		tr = qpair->act_tr[cpl.cid];
 
 		if (tr != NULL) {
-			nvme_qpair_complete_tracker(qpair, tr, &cpl, ERROR_PRINT_ALL);
+			nvme_qpair_complete_tracker(tr, &cpl, ERROR_PRINT_ALL);
 			qpair->sq_head = cpl.sqhd;
 			done++;
 		} else if (!in_panic) {
@@ -842,7 +846,7 @@ nvme_admin_qpair_abort_aers(struct nvme_qpair *qpair)
 	tr = TAILQ_FIRST(&qpair->outstanding_tr);
 	while (tr != NULL) {
 		if (tr->req->cmd.opc == NVME_OPC_ASYNC_EVENT_REQUEST) {
-			nvme_qpair_manual_complete_tracker(qpair, tr,
+			nvme_qpair_manual_complete_tracker(tr,
 			    NVME_SCT_GENERIC, NVME_SC_ABORTED_SQ_DELETION, 0,
 			    ERROR_PRINT_NONE);
 			tr = TAILQ_FIRST(&qpair->outstanding_tr);
@@ -886,7 +890,7 @@ nvme_abort_complete(void *arg, const struct nvme_compl
 		 */
 		nvme_printf(tr->qpair->ctrlr,
 		    "abort command failed, aborting command manually\n");
-		nvme_qpair_manual_complete_tracker(tr->qpair, tr,
+		nvme_qpair_manual_complete_tracker(tr,
 		    NVME_SCT_GENERIC, NVME_SC_ABORTED_BY_REQUEST, 0, ERROR_PRINT_ALL);
 	}
 }
@@ -1104,7 +1108,7 @@ _nvme_qpair_submit_request(struct nvme_qpair *qpair, s
 		 *  with the qpair lock held.
 		 */
 		mtx_unlock(&qpair->lock);
-		nvme_qpair_manual_complete_tracker(qpair, tr, NVME_SCT_GENERIC,
+		nvme_qpair_manual_complete_tracker(tr, NVME_SCT_GENERIC,
 		    NVME_SC_DATA_TRANSFER_ERROR, DO_NOT_RETRY, ERROR_PRINT_ALL);
 		mtx_lock(&qpair->lock);
 	}
@@ -1162,7 +1166,7 @@ nvme_admin_qpair_enable(struct nvme_qpair *qpair)
 	TAILQ_FOREACH_SAFE(tr, &qpair->outstanding_tr, tailq, tr_temp) {
 		nvme_printf(qpair->ctrlr,
 		    "aborting outstanding admin command\n");
-		nvme_qpair_manual_complete_tracker(qpair, tr, NVME_SCT_GENERIC,
+		nvme_qpair_manual_complete_tracker(tr, NVME_SCT_GENERIC,
 		    NVME_SC_ABORTED_BY_REQUEST, DO_NOT_RETRY, ERROR_PRINT_ALL);
 	}
 
@@ -1184,7 +1188,7 @@ nvme_io_qpair_enable(struct nvme_qpair *qpair)
 	 */
 	TAILQ_FOREACH_SAFE(tr, &qpair->outstanding_tr, tailq, tr_temp) {
 		nvme_printf(qpair->ctrlr, "aborting outstanding i/o\n");
-		nvme_qpair_manual_complete_tracker(qpair, tr, NVME_SCT_GENERIC,
+		nvme_qpair_manual_complete_tracker(tr, NVME_SCT_GENERIC,
 		    NVME_SC_ABORTED_BY_REQUEST, 0, ERROR_PRINT_NO_RETRY);
 	}
 
@@ -1263,11 +1267,10 @@ nvme_qpair_fail(struct nvme_qpair *qpair)
 		 */
 		nvme_printf(qpair->ctrlr, "failing outstanding i/o\n");
 		mtx_unlock(&qpair->lock);
-		nvme_qpair_manual_complete_tracker(qpair, tr, NVME_SCT_GENERIC,
+		nvme_qpair_manual_complete_tracker(tr, NVME_SCT_GENERIC,
 		    NVME_SC_ABORTED_BY_REQUEST, DO_NOT_RETRY, ERROR_PRINT_ALL);
 		mtx_lock(&qpair->lock);
 	}
 
 	mtx_unlock(&qpair->lock);
 }
-



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