Commit ff7e2122 authored by Jim Harris's avatar Jim Harris Committed by Daniel Verkamp
Browse files

nvme: reduce number of mmio writes in completion path



Instead of writing the completion doorbell once per completion,
just write it once at the end of the completion while loop.
This reduces the number of mmio writes by coalescing several
writes into one when we get multiple completions at a time.

Signed-off-by: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: I3cc3864dcfe43186bec51be1a732e84ef3be05ae
parent 047c5aaa
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -509,13 +509,15 @@ nvme_qpair_process_completions(struct nvme_qpair *qpair, uint32_t max_completion
			qpair->phase = !qpair->phase;
		}

		spdk_mmio_write_4(qpair->cq_hdbl, qpair->cq_head);

		if (++num_completions == max_completions) {
			break;
		}
	}

	if (num_completions > 0) {
		spdk_mmio_write_4(qpair->cq_hdbl, qpair->cq_head);
	}

	return num_completions;
}