lib/idxd: add batching support for compare command

Also one small bug fix w/compare in accel_perf as a result
of changes made in accel_perf sicne base compare was added.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: Id8e67bd9de9cbd006ac148f4a77807cc3e8e662b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2958
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
This commit is contained in:
paul luse 2020-06-18 18:46:27 -04:00 committed by Jim Harris
parent 8d0334726f
commit 8cee297c3f
5 changed files with 64 additions and 1 deletions

View File

@ -296,6 +296,8 @@ _accel_done(void *arg1)
worker->xfer_failed++; worker->xfer_failed++;
} }
break; break;
case ACCEL_COMPARE:
break;
default: default:
assert(false); assert(false);
break; break;

View File

@ -255,7 +255,28 @@ int spdk_idxd_submit_dualcast(struct spdk_idxd_io_channel *chan,
spdk_idxd_req_cb cb_fn, void *cb_arg); spdk_idxd_req_cb cb_fn, void *cb_arg);
/** /**
* Build and submit an idxd memory compare request. * Synchronous call to prepare a compare request into a previously initialized batch
* created with spdk_idxd_batch_create(). The callback will be called when the compare
* completes after the batch has been submitted by an asynchronous call to
* spdk_idxd_batch_submit().
*
* \param chan IDXD channel to submit request.
* \param batch Handle provided when the batch was started with spdk_idxd_batch_create().
* \param src1 First source to compare.
* \param src2 Second source to compare.
* \param nbytes Number of bytes to compare.
* \param cb_fn Callback function which will be called when the request is complete.
* \param cb_arg Opaque value which will be passed back as the arg parameter in
* the completion callback.
*
* \return 0 on success, negative errno on failure.
*/
int spdk_idxd_batch_prep_compare(struct spdk_idxd_io_channel *chan, struct idxd_batch *batch,
void *src1, void *src2, uint64_t nbytes, spdk_idxd_req_cb cb_fn,
void *cb_arg);
/**
* Build and submit a memory compare request.
* *
* This function will build the compare descriptor and then immediately submit * This function will build the compare descriptor and then immediately submit
* by writing to the proper device portal. * by writing to the proper device portal.

View File

@ -1072,12 +1072,14 @@ spdk_idxd_batch_prep_crc32c(struct spdk_idxd_io_channel *chan, struct idxd_batch
spdk_idxd_req_cb cb_fn, void *cb_arg) spdk_idxd_req_cb cb_fn, void *cb_arg)
{ {
struct idxd_hw_desc *desc; struct idxd_hw_desc *desc;
/* Common prep. */ /* Common prep. */
desc = _idxd_prep_batch_cmd(chan, cb_fn, cb_arg, batch); desc = _idxd_prep_batch_cmd(chan, cb_fn, cb_arg, batch);
if (desc == NULL) { if (desc == NULL) {
return -EINVAL; return -EINVAL;
} }
/* Command specific. */
desc->opcode = IDXD_OPCODE_CRC32C_GEN; desc->opcode = IDXD_OPCODE_CRC32C_GEN;
desc->dst_addr = (uintptr_t)dst; desc->dst_addr = (uintptr_t)dst;
desc->src_addr = (uintptr_t)src; desc->src_addr = (uintptr_t)src;
@ -1088,6 +1090,28 @@ spdk_idxd_batch_prep_crc32c(struct spdk_idxd_io_channel *chan, struct idxd_batch
return 0; return 0;
} }
int
spdk_idxd_batch_prep_compare(struct spdk_idxd_io_channel *chan, struct idxd_batch *batch,
void *src1, void *src2, uint64_t nbytes, spdk_idxd_req_cb cb_fn,
void *cb_arg)
{
struct idxd_hw_desc *desc;
/* Common prep. */
desc = _idxd_prep_batch_cmd(chan, cb_fn, cb_arg, batch);
if (desc == NULL) {
return -EINVAL;
}
/* Command specific. */
desc->opcode = IDXD_OPCODE_COMPARE;
desc->src_addr = (uintptr_t)src1;
desc->src2_addr = (uintptr_t)src2;
desc->xfer_size = nbytes;
return 0;
}
static void static void
_dump_error_reg(struct spdk_idxd_io_channel *chan) _dump_error_reg(struct spdk_idxd_io_channel *chan)
{ {

View File

@ -10,6 +10,7 @@
spdk_idxd_batch_prep_dualcast; spdk_idxd_batch_prep_dualcast;
spdk_idxd_batch_prep_fill; spdk_idxd_batch_prep_fill;
spdk_idxd_batch_prep_crc32c; spdk_idxd_batch_prep_crc32c;
spdk_idxd_batch_prep_compare;
spdk_idxd_batch_submit; spdk_idxd_batch_submit;
spdk_idxd_batch_create; spdk_idxd_batch_create;
spdk_idxd_batch_get_max; spdk_idxd_batch_get_max;

View File

@ -541,6 +541,20 @@ idxd_batch_prep_crc32c(void *cb_arg, struct spdk_io_channel *ch, struct spdk_acc
idxd_task); idxd_task);
} }
static int
idxd_batch_prep_compare(void *cb_arg, struct spdk_io_channel *ch, struct spdk_accel_batch *_batch,
void *src1, void *src2, uint64_t nbytes, spdk_accel_completion_cb cb)
{
struct idxd_task *idxd_task = (struct idxd_task *)cb_arg;
struct idxd_io_channel *chan = spdk_io_channel_get_ctx(ch);
struct idxd_batch *batch = (struct idxd_batch *)_batch;
idxd_task->cb = cb;
return spdk_idxd_batch_prep_compare(chan->chan, batch, src1, src2, nbytes, idxd_done,
idxd_task);
}
static struct spdk_accel_engine idxd_accel_engine = { static struct spdk_accel_engine idxd_accel_engine = {
.get_capabilities = idxd_get_capabilities, .get_capabilities = idxd_get_capabilities,
.copy = idxd_submit_copy, .copy = idxd_submit_copy,
@ -550,6 +564,7 @@ static struct spdk_accel_engine idxd_accel_engine = {
.batch_prep_fill = idxd_batch_prep_fill, .batch_prep_fill = idxd_batch_prep_fill,
.batch_prep_dualcast = idxd_batch_prep_dualcast, .batch_prep_dualcast = idxd_batch_prep_dualcast,
.batch_prep_crc32c = idxd_batch_prep_crc32c, .batch_prep_crc32c = idxd_batch_prep_crc32c,
.batch_prep_compare = idxd_batch_prep_compare,
.batch_submit = idxd_batch_submit, .batch_submit = idxd_batch_submit,
.dualcast = idxd_submit_dualcast, .dualcast = idxd_submit_dualcast,
.compare = idxd_submit_compare, .compare = idxd_submit_compare,