Commit 4330508f authored by Ben Walker's avatar Ben Walker Committed by Tomasz Zawadzki
Browse files

idxd: When we have a batch of 1, don't submit a batch



Convert the batch to the single command inside of it.

Signed-off-by: default avatarBen Walker <benjamin.walker@intel.com>
Change-Id: Ia117175ef3f4a8290d313e0bdc794f6a3276e042
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11166


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarPaul Luse <paul.e.luse@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
parent 86bb0df1
Loading
Loading
Loading
Loading
+19 −39
Original line number Diff line number Diff line
@@ -417,28 +417,6 @@ _idxd_prep_batch_cmd(struct spdk_idxd_io_channel *chan, spdk_idxd_req_cb cb_fn,
	return 0;
}

static int
_idxd_batch_prep_nop(struct spdk_idxd_io_channel *chan, struct idxd_batch *batch)
{
	struct idxd_hw_desc *desc;
	struct idxd_ops *op;
	int rc;

	/* Common prep. */
	rc = _idxd_prep_batch_cmd(chan, NULL, NULL, batch, &desc, &op);
	if (rc) {
		return rc;
	}

	/* Command specific. */
	desc->opcode = IDXD_OPCODE_NOOP;

	if (chan->idxd->impl->nop_check && chan->idxd->impl->nop_check(chan->idxd)) {
		desc->xfer_size = 1;
	}
	return 0;
}

static struct idxd_batch *
idxd_batch_create(struct spdk_idxd_io_channel *chan)
{
@@ -509,19 +487,20 @@ idxd_batch_submit(struct spdk_idxd_io_channel *chan, struct idxd_batch *batch,
		return idxd_batch_cancel(chan, batch);
	}

	if (batch->index < MIN_USER_DESC_COUNT) {
		/* DSA needs at least MIN_USER_DESC_COUNT for a batch, add a NOP to make it so. */
		if (_idxd_batch_prep_nop(chan, batch)) {
			return -EINVAL;
		}
	}

	/* Common prep. */
	rc = _idxd_prep_command(chan, cb_fn, cb_arg, &desc, &op);
	if (rc) {
		return rc;
	}

	if (batch->index == 1) {
		uint64_t completion_addr;

		/* If there's only one command, convert it away from a batch. */
		completion_addr = desc->completion_addr;
		memcpy(desc, &batch->user_desc[0], sizeof(*desc));
		desc->completion_addr = completion_addr;
	} else {
		/* Command specific. */
		desc->opcode = IDXD_OPCODE_BATCH;
		desc->desc_list_addr = batch->user_desc_addr;
@@ -534,6 +513,7 @@ idxd_batch_submit(struct spdk_idxd_io_channel *chan, struct idxd_batch *batch,
			TAILQ_INSERT_TAIL(&chan->ops_outstanding, (struct idxd_ops *)&batch->user_ops[i],
					  link);
		}
	}

	/* Submit operation. */
	_submit_to_hw(chan, op);
+0 −1
Original line number Diff line number Diff line
@@ -64,7 +64,6 @@ static inline void movdir64b(void *dst, const void *src)
/* The following sets up a max desc count per batch of 32 */
#define LOG2_WQ_MAX_BATCH	5  /* 2^5 = 32 */
#define DESC_PER_BATCH		(1 << LOG2_WQ_MAX_BATCH)
#define MIN_USER_DESC_COUNT	2

#define LOG2_WQ_MAX_XFER	30 /* 2^30 = 1073741824 */
#define WQCFG_NUM_DWORDS	8