Commit 63d7ac35 authored by paul luse's avatar paul luse Committed by Jim Harris
Browse files

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: default avatarpaul luse <paul.e.luse@intel.com>
Change-Id: I00cdcdec3376a1c32c9dab72c68fea868c1cb540
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4810


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Community-CI: Mellanox Build Bot
parent 33eac886
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -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
+1 −4
Original line number Diff line number Diff line
@@ -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;
};