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 <paul.e.luse@intel.com>
Change-Id: I00cdcdec3376a1c32c9dab72c68fea868c1cb540
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4810
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: Mellanox Build Bot
This commit is contained in:
paul luse 2020-10-21 14:04:02 -04:00 committed by Jim Harris
parent 33eac886b9
commit 63d7ac35c9
2 changed files with 6 additions and 11 deletions

View File

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

View File

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