From ec95646a6167a5eabdaea7a5969b80c75f9484c9 Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Fri, 15 Feb 2019 16:00:56 -0700 Subject: [PATCH] ioat: make ioat_flush a public spdk_ioat_flush API This will enable batching of doorbell writes in future commits. For now, just make the API public. This is the first in a series of patches that drastically improves performance for high queue depth CB-DMA workloads. Some basic tests on my Xeon E5-v3 platform shows about 4x improvement for 512B transfers. Signed-off-by: Jim Harris Change-Id: Ia8d28a63f5020ae8644c1efdec7f68740bb6920c Reviewed-on: https://review.gerrithub.io/c/444972 Tested-by: SPDK CI Jenkins Reviewed-by: Darek Stojaczyk Reviewed-by: Shuhei Matsumoto Reviewed-by: Changpeng Liu --- include/spdk/ioat.h | 11 +++++++++++ lib/ioat/ioat.c | 10 +++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/include/spdk/ioat.h b/include/spdk/ioat.h index c323a0b46..99a670a2d 100644 --- a/include/spdk/ioat.h +++ b/include/spdk/ioat.h @@ -141,6 +141,17 @@ int spdk_ioat_submit_fill(struct spdk_ioat_chan *chan, void *cb_arg, spdk_ioat_req_cb cb_fn, void *dst, uint64_t fill_pattern, uint64_t nbytes); +/** + * Flush previously built descriptors. + * + * Descriptors are flushed by writing the channel's dmacount doorbell + * register. This function enables batching multiple descriptors followed by + * a single doorbell write. + * + * \param chan I/OAT channel to flush. + */ +void spdk_ioat_flush(struct spdk_ioat_chan *chan); + /** * Check for completed requests on an I/OAT channel. * diff --git a/lib/ioat/ioat.c b/lib/ioat/ioat.c index 29f2d7ef2..7ff1d1271 100644 --- a/lib/ioat/ioat.c +++ b/lib/ioat/ioat.c @@ -158,8 +158,8 @@ ioat_submit_single(struct spdk_ioat_chan *ioat) ioat->head++; } -static void -ioat_flush(struct spdk_ioat_chan *ioat) +void +spdk_ioat_flush(struct spdk_ioat_chan *ioat) { ioat->regs->dmacount = (uint16_t)ioat->head; } @@ -454,7 +454,7 @@ ioat_channel_start(struct spdk_ioat_chan *ioat) ioat_write_chainaddr(ioat, ioat->ring[0].phys_addr); ioat_prep_null(ioat); - ioat_flush(ioat); + spdk_ioat_flush(ioat); i = 100; while (i-- > 0) { @@ -652,7 +652,7 @@ spdk_ioat_submit_copy(struct spdk_ioat_chan *ioat, void *cb_arg, spdk_ioat_req_c return -ENOMEM; } - ioat_flush(ioat); + spdk_ioat_flush(ioat); return 0; } @@ -709,7 +709,7 @@ spdk_ioat_submit_fill(struct spdk_ioat_chan *ioat, void *cb_arg, spdk_ioat_req_c return -ENOMEM; } - ioat_flush(ioat); + spdk_ioat_flush(ioat); return 0; }