From 63d7ac35c922e9cf6e2d52a37d471e598bc2eda7 Mon Sep 17 00:00:00 2001 From: paul luse Date: Wed, 21 Oct 2020 14:04:02 -0400 Subject: [PATCH] lib/idxd: small code simplifcation Earlier refactoring enables us to not have to keep track of batch completions in the batch struct as they're always used sequentially now so we can just add the addresses from the start up to the number of elements in the batch. Signed-off-by: paul luse Change-Id: I00cdcdec3376a1c32c9dab72c68fea868c1cb540 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4810 Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Jim Harris Community-CI: Mellanox Build Bot --- lib/idxd/idxd.c | 12 +++++------- lib/idxd/idxd.h | 5 +---- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/lib/idxd/idxd.c b/lib/idxd/idxd.c index 6f3e253c8..35999e746 100644 --- a/lib/idxd/idxd.c +++ b/lib/idxd/idxd.c @@ -712,14 +712,11 @@ _track_comp(struct spdk_idxd_io_channel *chan, bool batch_op, uint32_t index, /* Tag this as a batched operation or not so we know which bit array index to clear. */ comp_ctx->batch_op = batch_op; + /* Only add non-batch completions here. Batch completions are added when the batch is + * submitted. + */ if (batch_op == false) { TAILQ_INSERT_TAIL(&chan->comp_ctx_oustanding, comp_ctx, link); - } else { - /* Build up completion addresses for batches but don't add them to - * the outstanding list until submission as it simplifies batch - * cancellation. - */ - batch->comp_ctx[index] = comp_ctx; } } @@ -1090,7 +1087,8 @@ spdk_idxd_batch_submit(struct spdk_idxd_io_channel *chan, struct idxd_batch *bat /* Add the batch elements completion contexts to the outstanding list to be polled. */ for (i = 0 ; i < batch->index; i++) { - TAILQ_INSERT_TAIL(&chan->comp_ctx_oustanding, (struct idxd_comp *)batch->comp_ctx[i], link); + TAILQ_INSERT_TAIL(&chan->comp_ctx_oustanding, (struct idxd_comp *)&batch->user_completions[i], + link); } /* Add one for the batch desc itself, we use this to determine when diff --git a/lib/idxd/idxd.h b/lib/idxd/idxd.h index 2435d9ee6..59bb1e45b 100644 --- a/lib/idxd/idxd.h +++ b/lib/idxd/idxd.h @@ -79,16 +79,13 @@ static inline void movdir64b(void *dst, const void *src) #define IDXD_MAX_QUEUES 64 /* Each pre-allocated batch structure goes on a per channel list and - * contains the memory for both user descriptors. The array of comp_ctx - * holds the list of completion contexts that we will add to the list - * used by the poller. The list is updated when the batch is submitted. + * contains the memory for both user descriptors. */ struct idxd_batch { struct idxd_hw_desc *user_desc; struct idxd_comp *user_completions; uint32_t remaining; bool submitted; - void *comp_ctx[DESC_PER_BATCH]; uint8_t index; TAILQ_ENTRY(idxd_batch) link; };