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: Jim Harris <james.r.harris@intel.com>
Change-Id: I3cc3864dcfe43186bec51be1a732e84ef3be05ae
This commit is contained in:
Jim Harris 2016-01-22 13:21:26 -07:00 committed by Daniel Verkamp
parent 047c5aaaa8
commit ff7e2122c7

View File

@ -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;
}