lib/accel: Add suport for copy + CRC32C to accel framework

Upcoming patches will add support for the idxd engine and
the accel_perf tool.  Also following will come vectored support and
batch versions.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I7223517a844525ad52ed49d65627b04c3cd9fe7c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8141
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
This commit is contained in:
paul luse 2021-06-01 15:17:50 -04:00 committed by Tomasz Zawadzki
parent 1076008e63
commit be8f5a3963
6 changed files with 67 additions and 7 deletions

View File

@ -2,6 +2,10 @@
## v21.07: (Upcoming Release)
### accel_fw
Added API `spdk_accel_submit_copy_crc32c` to perform a CRC32C while copying data.
### bdev
Change `spdk_bdev_read_blocks_with_md` arg offset definiton from int64_t to uint64_t.

View File

@ -51,6 +51,7 @@ enum accel_capability {
ACCEL_COMPARE = 1 << 3,
ACCEL_CRC32C = 1 << 4,
ACCEL_DIF = 1 << 5,
ACCEL_COPY_CRC32C = 1 << 6,
};
/**
@ -372,6 +373,26 @@ int spdk_accel_submit_crc32c(struct spdk_io_channel *ch, uint32_t *dst, void *sr
int spdk_accel_submit_crc32cv(struct spdk_io_channel *ch, uint32_t *dst, struct iovec *iovs,
uint32_t iovcnt, uint32_t seed, spdk_accel_completion_cb cb_fn, void *cb_arg);
/**
* Submit a copy with CRC-32C calculation request.
*
* This operation will copy data and calculate the 4 byte CRC32-C for the given data.
*
* \param ch I/O channel associated with this call.
* \param dst Destination to write the data to.
* \param src The source address for the data.
* \param crc_dst Destination to write the CRC-32C to.
* \param seed Four byte seed value.
* \param nbytes Length in bytes.
* \param cb_fn Called when this CRC-32C operation completes.
* \param cb_arg Callback argument.
*
* \return 0 on success, negative errno on failure.
*/
int spdk_accel_submit_copy_crc32c(struct spdk_io_channel *ch, void *dst, void *src,
uint32_t *crc_dst, uint32_t seed, uint64_t nbytes,
spdk_accel_completion_cb cb_fn, void *cb_arg);
struct spdk_json_write_ctx;
/**

View File

@ -67,12 +67,13 @@ struct spdk_accel_batch {
};
enum accel_opcode {
ACCEL_OPCODE_MEMMOVE = 0,
ACCEL_OPCODE_MEMFILL = 1,
ACCEL_OPCODE_COMPARE = 2,
ACCEL_OPCODE_BATCH = 3,
ACCEL_OPCODE_CRC32C = 4,
ACCEL_OPCODE_DUALCAST = 5,
ACCEL_OPCODE_MEMMOVE = 0,
ACCEL_OPCODE_MEMFILL = 1,
ACCEL_OPCODE_COMPARE = 2,
ACCEL_OPCODE_BATCH = 3,
ACCEL_OPCODE_CRC32C = 4,
ACCEL_OPCODE_DUALCAST = 5,
ACCEL_OPCODE_COPY_CRC32C = 6,
};
struct spdk_accel_task {
@ -100,6 +101,7 @@ struct spdk_accel_task {
uint32_t seed;
uint64_t fill_pattern;
};
uint32_t *crc_dst;
enum accel_opcode op_code;
uint64_t nbytes;
TAILQ_ENTRY(spdk_accel_task) link;

View File

@ -34,7 +34,7 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
SO_VER := 5
SO_VER := 6
SO_MINOR := 0
SO_SUFFIX := $(SO_VER).$(SO_MINOR)

View File

@ -401,6 +401,38 @@ spdk_accel_submit_crc32cv(struct spdk_io_channel *ch, uint32_t *dst, struct iove
}
}
/* Accel framework public API for copy with CRC-32C function */
int
spdk_accel_submit_copy_crc32c(struct spdk_io_channel *ch, void *dst, void *src,
uint32_t *crc_dst, uint32_t seed, uint64_t nbytes,
spdk_accel_completion_cb cb_fn, void *cb_arg)
{
struct accel_io_channel *accel_ch = spdk_io_channel_get_ctx(ch);
struct spdk_accel_task *accel_task;
accel_task = _get_task(accel_ch, NULL, cb_fn, cb_arg);
if (accel_task == NULL) {
return -ENOMEM;
}
accel_task->dst = dst;
accel_task->src = src;
accel_task->crc_dst = crc_dst;
accel_task->v.iovcnt = 0;
accel_task->seed = seed;
accel_task->nbytes = nbytes;
accel_task->op_code = ACCEL_OPCODE_COPY_CRC32C;
if (_is_supported(accel_ch->engine, ACCEL_COPY_CRC32C)) {
return accel_ch->engine->submit_tasks(accel_ch->engine_ch, accel_task);
} else {
_sw_accel_copy(dst, src, nbytes);
_sw_accel_crc32c(crc_dst, src, seed, nbytes);
spdk_accel_task_complete(accel_task, 0);
return 0;
}
}
/* Accel framework public API for getting max operations for a batch. */
uint32_t
spdk_accel_batch_get_max(struct spdk_io_channel *ch)

View File

@ -23,6 +23,7 @@
spdk_accel_submit_fill;
spdk_accel_submit_crc32c;
spdk_accel_submit_crc32cv;
spdk_accel_submit_copy_crc32c;
spdk_accel_write_config_json;
# functions needed by modules