accel: plumb accel flags through operations that need them
This patch is just plumbing the flags param. Use of it for PMEM will come in upcoming patches. Signed-off-by: paul luse <paul.e.luse@intel.com> Change-Id: I620df072aaad3f8062a0312bbea3da1bc3f911b9 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9281 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Community-CI: Mellanox Build Bot Reviewed-by: GangCao <gang.cao@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
0d5ce8c2cf
commit
12c40f05e2
10
CHANGELOG.md
10
CHANGELOG.md
@ -11,6 +11,16 @@ Removed deprecated spdk_bdev_module_finish_done(). Use spdk_bdev_module_fini_don
|
||||
A new parameter `flags` was added to all low level submission and preparation
|
||||
APIs to enable the caller to pass operation flags per the DSA specification.
|
||||
|
||||
### accel_fw
|
||||
|
||||
A new parameter `flags` was added to accel API.
|
||||
The APIs include:
|
||||
`spdk_accel_submit_copy`
|
||||
`spdk_accel_submit_dualcast`
|
||||
`spdk_accel_submit_fill`
|
||||
`spdk_accel_submit_copy_crc32c`
|
||||
`spdk_accel_submit_copy_crc32cv`
|
||||
|
||||
### bdev_nvme
|
||||
|
||||
Added `bdev_nvme_add_error_injection` and `bdev_nvme_remove_error_injection` RPCs to add and
|
||||
|
@ -350,18 +350,19 @@ _submit_single(struct worker_thread *worker, struct ap_task *task)
|
||||
{
|
||||
int random_num;
|
||||
int rc = 0;
|
||||
int flags = 0;
|
||||
|
||||
assert(worker);
|
||||
|
||||
switch (g_workload_selection) {
|
||||
case ACCEL_COPY:
|
||||
rc = spdk_accel_submit_copy(worker->ch, task->dst, task->src,
|
||||
g_xfer_size_bytes, accel_done, task);
|
||||
g_xfer_size_bytes, flags, accel_done, task);
|
||||
break;
|
||||
case ACCEL_FILL:
|
||||
/* For fill use the first byte of the task->dst buffer */
|
||||
rc = spdk_accel_submit_fill(worker->ch, task->dst, *(uint8_t *)task->src,
|
||||
g_xfer_size_bytes, accel_done, task);
|
||||
g_xfer_size_bytes, flags, accel_done, task);
|
||||
break;
|
||||
case ACCEL_CRC32C:
|
||||
rc = spdk_accel_submit_crc32cv(worker->ch, &task->crc_dst,
|
||||
@ -370,7 +371,7 @@ _submit_single(struct worker_thread *worker, struct ap_task *task)
|
||||
break;
|
||||
case ACCEL_COPY_CRC32C:
|
||||
rc = spdk_accel_submit_copy_crc32cv(worker->ch, task->dst, task->iovs, task->iov_cnt,
|
||||
&task->crc_dst, g_crc32c_seed, accel_done, task);
|
||||
&task->crc_dst, g_crc32c_seed, flags, accel_done, task);
|
||||
break;
|
||||
case ACCEL_COMPARE:
|
||||
random_num = rand() % 100;
|
||||
@ -386,7 +387,7 @@ _submit_single(struct worker_thread *worker, struct ap_task *task)
|
||||
break;
|
||||
case ACCEL_DUALCAST:
|
||||
rc = spdk_accel_submit_dualcast(worker->ch, task->dst, task->dst2,
|
||||
task->src, g_xfer_size_bytes, accel_done, task);
|
||||
task->src, g_xfer_size_bytes, flags, accel_done, task);
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
|
@ -114,13 +114,14 @@ uint64_t spdk_accel_get_capabilities(struct spdk_io_channel *ch);
|
||||
* \param dst Destination to copy to.
|
||||
* \param src Source to copy from.
|
||||
* \param nbytes Length in bytes to copy.
|
||||
* \param flags Accel framework flags for operations.
|
||||
* \param cb_fn Called when this copy operation completes.
|
||||
* \param cb_arg Callback argument.
|
||||
*
|
||||
* \return 0 on success, negative errno on failure.
|
||||
*/
|
||||
int spdk_accel_submit_copy(struct spdk_io_channel *ch, void *dst, void *src, uint64_t nbytes,
|
||||
spdk_accel_completion_cb cb_fn, void *cb_arg);
|
||||
int flags, spdk_accel_completion_cb cb_fn, void *cb_arg);
|
||||
|
||||
/**
|
||||
* Submit a dual cast copy request.
|
||||
@ -130,13 +131,14 @@ int spdk_accel_submit_copy(struct spdk_io_channel *ch, void *dst, void *src, uin
|
||||
* \param dst2 Second destination to copy to (must be 4K aligned).
|
||||
* \param src Source to copy from.
|
||||
* \param nbytes Length in bytes to copy.
|
||||
* \param flags Accel framework flags for operations.
|
||||
* \param cb_fn Called when this copy operation completes.
|
||||
* \param cb_arg Callback argument.
|
||||
*
|
||||
* \return 0 on success, negative errno on failure.
|
||||
*/
|
||||
int spdk_accel_submit_dualcast(struct spdk_io_channel *ch, void *dst1, void *dst2, void *src,
|
||||
uint64_t nbytes, spdk_accel_completion_cb cb_fn, void *cb_arg);
|
||||
uint64_t nbytes, int flags, spdk_accel_completion_cb cb_fn, void *cb_arg);
|
||||
|
||||
/**
|
||||
* Submit a compare request.
|
||||
@ -162,13 +164,14 @@ int spdk_accel_submit_compare(struct spdk_io_channel *ch, void *src1, void *src2
|
||||
* \param dst Destination to fill.
|
||||
* \param fill Constant byte to fill to the destination.
|
||||
* \param nbytes Length in bytes to fill.
|
||||
* \param flags Accel framework flags for operations.
|
||||
* \param cb_fn Called when this fill operation completes.
|
||||
* \param cb_arg Callback argument.
|
||||
*
|
||||
* \return 0 on success, negative errno on failure.
|
||||
*/
|
||||
int spdk_accel_submit_fill(struct spdk_io_channel *ch, void *dst, uint8_t fill, uint64_t nbytes,
|
||||
spdk_accel_completion_cb cb_fn, void *cb_arg);
|
||||
int flags, spdk_accel_completion_cb cb_fn, void *cb_arg);
|
||||
|
||||
/**
|
||||
* Submit a CRC-32C calculation request.
|
||||
@ -218,13 +221,14 @@ int spdk_accel_submit_crc32cv(struct spdk_io_channel *ch, uint32_t *crc_dst, str
|
||||
* \param crc_dst Destination to write the CRC-32C to.
|
||||
* \param seed Four byte seed value.
|
||||
* \param nbytes Length in bytes.
|
||||
* \param flags Accel framework flags for operations.
|
||||
* \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,
|
||||
uint32_t *crc_dst, uint32_t seed, uint64_t nbytes, int flags,
|
||||
spdk_accel_completion_cb cb_fn, void *cb_arg);
|
||||
|
||||
/**
|
||||
@ -238,13 +242,15 @@ int spdk_accel_submit_copy_crc32c(struct spdk_io_channel *ch, void *dst, void *s
|
||||
* \param iovcnt The size of the io vectors.
|
||||
* \param crc_dst Destination to write the CRC-32C to.
|
||||
* \param seed Four byte seed value.
|
||||
* \param flags Accel framework flags for operations.
|
||||
* \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_crc32cv(struct spdk_io_channel *ch, void *dst, struct iovec *src_iovs,
|
||||
uint32_t iovcnt, uint32_t *crc_dst, uint32_t seed, spdk_accel_completion_cb cb_fn, void *cb_arg);
|
||||
uint32_t iovcnt, uint32_t *crc_dst, uint32_t seed,
|
||||
int flags, spdk_accel_completion_cb cb_fn, void *cb_arg);
|
||||
|
||||
|
||||
struct spdk_json_write_ctx;
|
||||
|
@ -89,6 +89,7 @@ struct spdk_accel_task {
|
||||
uint32_t *crc_dst;
|
||||
enum accel_opcode op_code;
|
||||
uint64_t nbytes;
|
||||
int flags;
|
||||
int status;
|
||||
TAILQ_ENTRY(spdk_accel_task) link;
|
||||
};
|
||||
|
@ -168,7 +168,7 @@ _add_to_comp_list(struct accel_io_channel *accel_ch, struct spdk_accel_task *acc
|
||||
/* Accel framework public API for copy function */
|
||||
int
|
||||
spdk_accel_submit_copy(struct spdk_io_channel *ch, void *dst, void *src, uint64_t nbytes,
|
||||
spdk_accel_completion_cb cb_fn, void *cb_arg)
|
||||
int flags, 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;
|
||||
@ -182,6 +182,7 @@ spdk_accel_submit_copy(struct spdk_io_channel *ch, void *dst, void *src, uint64_
|
||||
accel_task->src = src;
|
||||
accel_task->op_code = ACCEL_OPCODE_MEMMOVE;
|
||||
accel_task->nbytes = nbytes;
|
||||
accel_task->flags = flags;
|
||||
|
||||
if (_is_supported(accel_ch->engine, ACCEL_COPY)) {
|
||||
return accel_ch->engine->submit_tasks(accel_ch->engine_ch, accel_task);
|
||||
@ -195,7 +196,7 @@ spdk_accel_submit_copy(struct spdk_io_channel *ch, void *dst, void *src, uint64_
|
||||
/* Accel framework public API for dual cast copy function */
|
||||
int
|
||||
spdk_accel_submit_dualcast(struct spdk_io_channel *ch, void *dst1, void *dst2, void *src,
|
||||
uint64_t nbytes, spdk_accel_completion_cb cb_fn, void *cb_arg)
|
||||
uint64_t nbytes, int flags, 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;
|
||||
@ -214,6 +215,7 @@ spdk_accel_submit_dualcast(struct spdk_io_channel *ch, void *dst1, void *dst2, v
|
||||
accel_task->dst = dst1;
|
||||
accel_task->dst2 = dst2;
|
||||
accel_task->nbytes = nbytes;
|
||||
accel_task->flags = flags;
|
||||
accel_task->op_code = ACCEL_OPCODE_DUALCAST;
|
||||
|
||||
if (_is_supported(accel_ch->engine, ACCEL_DUALCAST)) {
|
||||
@ -256,7 +258,7 @@ spdk_accel_submit_compare(struct spdk_io_channel *ch, void *src1, void *src2, ui
|
||||
/* Accel framework public API for fill function */
|
||||
int
|
||||
spdk_accel_submit_fill(struct spdk_io_channel *ch, void *dst, uint8_t fill, uint64_t nbytes,
|
||||
spdk_accel_completion_cb cb_fn, void *cb_arg)
|
||||
int flags, 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;
|
||||
@ -269,6 +271,7 @@ spdk_accel_submit_fill(struct spdk_io_channel *ch, void *dst, uint8_t fill, uint
|
||||
accel_task->dst = dst;
|
||||
accel_task->fill_pattern = fill;
|
||||
accel_task->nbytes = nbytes;
|
||||
accel_task->flags = flags;
|
||||
accel_task->op_code = ACCEL_OPCODE_MEMFILL;
|
||||
|
||||
if (_is_supported(accel_ch->engine, ACCEL_FILL)) {
|
||||
@ -353,7 +356,7 @@ spdk_accel_submit_crc32cv(struct spdk_io_channel *ch, uint32_t *crc_dst, struct
|
||||
/* 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,
|
||||
uint32_t *crc_dst, uint32_t seed, uint64_t nbytes, int flags,
|
||||
spdk_accel_completion_cb cb_fn, void *cb_arg)
|
||||
{
|
||||
struct accel_io_channel *accel_ch = spdk_io_channel_get_ctx(ch);
|
||||
@ -370,6 +373,7 @@ spdk_accel_submit_copy_crc32c(struct spdk_io_channel *ch, void *dst, void *src,
|
||||
accel_task->v.iovcnt = 0;
|
||||
accel_task->seed = seed;
|
||||
accel_task->nbytes = nbytes;
|
||||
accel_task->flags = flags;
|
||||
accel_task->op_code = ACCEL_OPCODE_COPY_CRC32C;
|
||||
|
||||
if (_is_supported(accel_ch->engine, ACCEL_COPY_CRC32C)) {
|
||||
@ -385,7 +389,7 @@ spdk_accel_submit_copy_crc32c(struct spdk_io_channel *ch, void *dst, void *src,
|
||||
/* Accel framework public API for chained copy + CRC-32C function */
|
||||
int
|
||||
spdk_accel_submit_copy_crc32cv(struct spdk_io_channel *ch, void *dst, struct iovec *src_iovs,
|
||||
uint32_t iov_cnt, uint32_t *crc_dst, uint32_t seed,
|
||||
uint32_t iov_cnt, uint32_t *crc_dst, uint32_t seed, int flags,
|
||||
spdk_accel_completion_cb cb_fn, void *cb_arg)
|
||||
{
|
||||
struct accel_io_channel *accel_ch;
|
||||
@ -414,6 +418,7 @@ spdk_accel_submit_copy_crc32cv(struct spdk_io_channel *ch, void *dst, struct iov
|
||||
accel_task->dst = (void *)dst;
|
||||
accel_task->crc_dst = crc_dst;
|
||||
accel_task->seed = seed;
|
||||
accel_task->flags = flags;
|
||||
accel_task->op_code = ACCEL_OPCODE_COPY_CRC32C;
|
||||
|
||||
if (_is_supported(accel_ch->engine, ACCEL_COPY_CRC32C)) {
|
||||
|
@ -176,7 +176,7 @@ bdev_malloc_readv(struct malloc_disk *mdisk, struct spdk_io_channel *ch,
|
||||
for (i = 0; i < iovcnt; i++) {
|
||||
task->num_outstanding++;
|
||||
res = spdk_accel_submit_copy(ch, iov[i].iov_base,
|
||||
src, iov[i].iov_len, malloc_done, task);
|
||||
src, iov[i].iov_len, 0, malloc_done, task);
|
||||
|
||||
if (res != 0) {
|
||||
malloc_done(task, res);
|
||||
@ -212,7 +212,7 @@ bdev_malloc_writev(struct malloc_disk *mdisk, struct spdk_io_channel *ch,
|
||||
for (i = 0; i < iovcnt; i++) {
|
||||
task->num_outstanding++;
|
||||
res = spdk_accel_submit_copy(ch, dst, iov[i].iov_base,
|
||||
iov[i].iov_len, malloc_done, task);
|
||||
iov[i].iov_len, 0, malloc_done, task);
|
||||
|
||||
if (res != 0) {
|
||||
malloc_done(task, res);
|
||||
@ -234,7 +234,7 @@ bdev_malloc_unmap(struct malloc_disk *mdisk,
|
||||
task->num_outstanding = 1;
|
||||
|
||||
return spdk_accel_submit_fill(ch, mdisk->malloc_buf + offset, 0,
|
||||
byte_count, malloc_done, task);
|
||||
byte_count, 0, malloc_done, task);
|
||||
}
|
||||
|
||||
static int _bdev_malloc_submit_request(struct malloc_channel *mch, struct spdk_bdev_io *bdev_io)
|
||||
|
@ -222,16 +222,18 @@ test_spdk_accel_submit_copy(void)
|
||||
int rc;
|
||||
struct spdk_accel_task task;
|
||||
struct spdk_accel_task *expected_accel_task = NULL;
|
||||
int flags = 0;
|
||||
|
||||
TAILQ_INIT(&g_accel_ch->task_pool);
|
||||
|
||||
/* Fail with no tasks on _get_task() */
|
||||
rc = spdk_accel_submit_copy(g_ch, src, dst, nbytes, dummy_submit_cb_fn, cb_arg);
|
||||
rc = spdk_accel_submit_copy(g_ch, src, dst, nbytes, flags, dummy_submit_cb_fn, cb_arg);
|
||||
CU_ASSERT(rc == -ENOMEM);
|
||||
|
||||
task.cb_fn = dummy_submit_cb_fn;
|
||||
task.cb_arg = cb_arg;
|
||||
task.accel_ch = g_accel_ch;
|
||||
task.flags = 1;
|
||||
TAILQ_INSERT_TAIL(&g_accel_ch->task_pool, &task, link);
|
||||
|
||||
g_accel_ch->engine = &g_accel_engine;
|
||||
@ -239,12 +241,13 @@ test_spdk_accel_submit_copy(void)
|
||||
g_accel_ch->engine->submit_tasks = dummy_submit_tasks;
|
||||
|
||||
/* HW accel submission OK. */
|
||||
rc = spdk_accel_submit_copy(g_ch, dst, src, nbytes, dummy_submit_cb_fn, cb_arg);
|
||||
rc = spdk_accel_submit_copy(g_ch, dst, src, nbytes, flags, dummy_submit_cb_fn, cb_arg);
|
||||
CU_ASSERT(rc == 0);
|
||||
CU_ASSERT(task.dst == dst);
|
||||
CU_ASSERT(task.src == src);
|
||||
CU_ASSERT(task.op_code == ACCEL_OPCODE_MEMMOVE);
|
||||
CU_ASSERT(task.nbytes == nbytes);
|
||||
CU_ASSERT(task.flags == 0);
|
||||
CU_ASSERT(g_dummy_submit_called == true);
|
||||
|
||||
TAILQ_INSERT_TAIL(&g_accel_ch->task_pool, &task, link);
|
||||
@ -255,14 +258,16 @@ test_spdk_accel_submit_copy(void)
|
||||
task.src = 0;
|
||||
task.op_code = 0xff;
|
||||
task.nbytes = 0;
|
||||
task.flags = 1;
|
||||
|
||||
/* SW engine does copy. */
|
||||
rc = spdk_accel_submit_copy(g_ch, dst, src, nbytes, dummy_submit_cb_fn, cb_arg);
|
||||
rc = spdk_accel_submit_copy(g_ch, dst, src, nbytes, flags, dummy_submit_cb_fn, cb_arg);
|
||||
CU_ASSERT(rc == 0);
|
||||
CU_ASSERT(task.dst == dst);
|
||||
CU_ASSERT(task.src == src);
|
||||
CU_ASSERT(task.op_code == ACCEL_OPCODE_MEMMOVE);
|
||||
CU_ASSERT(task.nbytes == nbytes);
|
||||
CU_ASSERT(task.flags == 0);
|
||||
CU_ASSERT(g_dummy_submit_cb_called == false);
|
||||
CU_ASSERT(memcmp(dst, src, TEST_SUBMIT_SIZE) == 0);
|
||||
expected_accel_task = TAILQ_FIRST(&g_sw_ch->tasks_to_complete);
|
||||
@ -282,6 +287,7 @@ test_spdk_accel_submit_dualcast(void)
|
||||
int rc;
|
||||
struct spdk_accel_task task;
|
||||
struct spdk_accel_task *expected_accel_task = NULL;
|
||||
int flags = 0;
|
||||
|
||||
/* Dualcast requires 4K alignment on dst addresses,
|
||||
* hence using the hard coded address to test the buffer alignment
|
||||
@ -295,14 +301,14 @@ test_spdk_accel_submit_dualcast(void)
|
||||
TAILQ_INIT(&g_accel_ch->task_pool);
|
||||
|
||||
/* This should fail since dst2 is not 4k aligned */
|
||||
rc = spdk_accel_submit_dualcast(g_ch, dst1, dst2, src, nbytes, dummy_submit_cb_fn,
|
||||
rc = spdk_accel_submit_dualcast(g_ch, dst1, dst2, src, nbytes, flags, dummy_submit_cb_fn,
|
||||
cb_arg);
|
||||
CU_ASSERT(rc == -EINVAL);
|
||||
|
||||
dst1 = (void *)0x7010;
|
||||
dst2 = (void *)0x6000;
|
||||
/* This should fail since dst1 is not 4k aligned */
|
||||
rc = spdk_accel_submit_dualcast(g_ch, dst1, dst2, src, nbytes, dummy_submit_cb_fn,
|
||||
rc = spdk_accel_submit_dualcast(g_ch, dst1, dst2, src, nbytes, flags, dummy_submit_cb_fn,
|
||||
cb_arg);
|
||||
CU_ASSERT(rc == -EINVAL);
|
||||
|
||||
@ -310,7 +316,7 @@ test_spdk_accel_submit_dualcast(void)
|
||||
dst1 = (void *)0x7000;
|
||||
dst2 = (void *)0x6000;
|
||||
/* Fail with no tasks on _get_task() */
|
||||
rc = spdk_accel_submit_dualcast(g_ch, dst1, dst2, src, nbytes, dummy_submit_cb_fn,
|
||||
rc = spdk_accel_submit_dualcast(g_ch, dst1, dst2, src, nbytes, flags, dummy_submit_cb_fn,
|
||||
cb_arg);
|
||||
CU_ASSERT(rc == -ENOMEM);
|
||||
|
||||
@ -324,7 +330,7 @@ test_spdk_accel_submit_dualcast(void)
|
||||
g_accel_ch->engine->submit_tasks = dummy_submit_tasks;
|
||||
|
||||
/* HW accel submission OK. */
|
||||
rc = spdk_accel_submit_dualcast(g_ch, dst1, dst2, src, nbytes, dummy_submit_cb_fn,
|
||||
rc = spdk_accel_submit_dualcast(g_ch, dst1, dst2, src, nbytes, flags, dummy_submit_cb_fn,
|
||||
cb_arg);
|
||||
CU_ASSERT(rc == 0);
|
||||
CU_ASSERT(task.dst == dst1);
|
||||
@ -332,6 +338,7 @@ test_spdk_accel_submit_dualcast(void)
|
||||
CU_ASSERT(task.src == src);
|
||||
CU_ASSERT(task.op_code == ACCEL_OPCODE_DUALCAST);
|
||||
CU_ASSERT(task.nbytes == nbytes);
|
||||
CU_ASSERT(task.flags == 0);
|
||||
CU_ASSERT(g_dummy_submit_called == true);
|
||||
|
||||
TAILQ_INSERT_TAIL(&g_accel_ch->task_pool, &task, link);
|
||||
@ -343,6 +350,7 @@ test_spdk_accel_submit_dualcast(void)
|
||||
task.src = 0;
|
||||
task.op_code = 0xff;
|
||||
task.nbytes = 0;
|
||||
task.flags = 1;
|
||||
/* Since we test the SW path next, need to use valid memory addresses
|
||||
* cannot hardcode them anymore
|
||||
*/
|
||||
@ -351,7 +359,7 @@ test_spdk_accel_submit_dualcast(void)
|
||||
dst2 = spdk_dma_zmalloc(nbytes, align, NULL);
|
||||
SPDK_CU_ASSERT_FATAL(dst2 != NULL);
|
||||
/* SW engine does the dualcast. */
|
||||
rc = spdk_accel_submit_dualcast(g_ch, dst1, dst2, src, nbytes, dummy_submit_cb_fn,
|
||||
rc = spdk_accel_submit_dualcast(g_ch, dst1, dst2, src, nbytes, flags, dummy_submit_cb_fn,
|
||||
cb_arg);
|
||||
CU_ASSERT(rc == 0);
|
||||
CU_ASSERT(task.dst == dst1);
|
||||
@ -359,6 +367,7 @@ test_spdk_accel_submit_dualcast(void)
|
||||
CU_ASSERT(task.src == src);
|
||||
CU_ASSERT(task.op_code == ACCEL_OPCODE_DUALCAST);
|
||||
CU_ASSERT(task.nbytes == nbytes);
|
||||
CU_ASSERT(task.flags == 0);
|
||||
CU_ASSERT(g_dummy_submit_cb_called == false);
|
||||
CU_ASSERT(memcmp(dst1, src, TEST_SUBMIT_SIZE) == 0);
|
||||
CU_ASSERT(memcmp(dst2, src, TEST_SUBMIT_SIZE) == 0);
|
||||
@ -450,6 +459,7 @@ test_spdk_accel_submit_fill(void)
|
||||
int rc;
|
||||
struct spdk_accel_task task;
|
||||
struct spdk_accel_task *expected_accel_task = NULL;
|
||||
int flags = 0;
|
||||
|
||||
dst = calloc(1, TEST_SUBMIT_SIZE);
|
||||
SPDK_CU_ASSERT_FATAL(dst != NULL);
|
||||
@ -458,7 +468,7 @@ test_spdk_accel_submit_fill(void)
|
||||
memset(src, fill, TEST_SUBMIT_SIZE);
|
||||
|
||||
/* Fail with no tasks on _get_task() */
|
||||
rc = spdk_accel_submit_fill(g_ch, dst, fill, nbytes, dummy_submit_cb_fn, cb_arg);
|
||||
rc = spdk_accel_submit_fill(g_ch, dst, fill, nbytes, flags, dummy_submit_cb_fn, cb_arg);
|
||||
CU_ASSERT(rc == -ENOMEM);
|
||||
|
||||
TAILQ_INIT(&g_accel_ch->task_pool);
|
||||
@ -472,12 +482,13 @@ test_spdk_accel_submit_fill(void)
|
||||
g_accel_ch->engine->submit_tasks = dummy_submit_tasks;
|
||||
|
||||
/* HW accel submission OK. */
|
||||
rc = spdk_accel_submit_fill(g_ch, dst, fill, nbytes, dummy_submit_cb_fn, cb_arg);
|
||||
rc = spdk_accel_submit_fill(g_ch, dst, fill, nbytes, flags, dummy_submit_cb_fn, cb_arg);
|
||||
CU_ASSERT(rc == 0);
|
||||
CU_ASSERT(task.dst == dst);
|
||||
CU_ASSERT(task.fill_pattern == fill);
|
||||
CU_ASSERT(task.op_code == ACCEL_OPCODE_MEMFILL);
|
||||
CU_ASSERT(task.nbytes == nbytes);
|
||||
CU_ASSERT(task.flags == 0);
|
||||
CU_ASSERT(g_dummy_submit_called == true);
|
||||
|
||||
TAILQ_INSERT_TAIL(&g_accel_ch->task_pool, &task, link);
|
||||
@ -488,14 +499,16 @@ test_spdk_accel_submit_fill(void)
|
||||
task.fill_pattern = 0;
|
||||
task.op_code = 0xff;
|
||||
task.nbytes = 0;
|
||||
task.flags = 1;
|
||||
|
||||
/* SW engine does the fill. */
|
||||
rc = spdk_accel_submit_fill(g_ch, dst, fill, nbytes, dummy_submit_cb_fn, cb_arg);
|
||||
rc = spdk_accel_submit_fill(g_ch, dst, fill, nbytes, flags, dummy_submit_cb_fn, cb_arg);
|
||||
CU_ASSERT(rc == 0);
|
||||
CU_ASSERT(task.dst == dst);
|
||||
CU_ASSERT(task.fill_pattern == fill);
|
||||
CU_ASSERT(task.op_code == ACCEL_OPCODE_MEMFILL);
|
||||
CU_ASSERT(task.nbytes == nbytes);
|
||||
CU_ASSERT(task.flags == 0);
|
||||
CU_ASSERT(g_dummy_submit_cb_called == false);
|
||||
CU_ASSERT(memcmp(dst, src, TEST_SUBMIT_SIZE) == 0);
|
||||
expected_accel_task = TAILQ_FIRST(&g_sw_ch->tasks_to_complete);
|
||||
@ -696,9 +709,11 @@ test_spdk_accel_submit_copy_crc32c(void)
|
||||
int rc;
|
||||
struct spdk_accel_task task;
|
||||
struct spdk_accel_task *expected_accel_task = NULL;
|
||||
int flags = 0;
|
||||
|
||||
/* Fail with no tasks on _get_task() */
|
||||
rc = spdk_accel_submit_copy_crc32c(g_ch, dst, src, &crc_dst, seed, nbytes, dummy_submit_cb_fn,
|
||||
rc = spdk_accel_submit_copy_crc32c(g_ch, dst, src, &crc_dst, seed, nbytes, flags,
|
||||
dummy_submit_cb_fn,
|
||||
cb_arg);
|
||||
CU_ASSERT(rc == -ENOMEM);
|
||||
|
||||
@ -713,7 +728,8 @@ test_spdk_accel_submit_copy_crc32c(void)
|
||||
g_accel_ch->engine->submit_tasks = dummy_submit_tasks;
|
||||
|
||||
/* HW accel submission OK. */
|
||||
rc = spdk_accel_submit_copy_crc32c(g_ch, dst, src, &crc_dst, seed, nbytes, dummy_submit_cb_fn,
|
||||
rc = spdk_accel_submit_copy_crc32c(g_ch, dst, src, &crc_dst, seed, nbytes, flags,
|
||||
dummy_submit_cb_fn,
|
||||
cb_arg);
|
||||
CU_ASSERT(rc == 0);
|
||||
CU_ASSERT(task.dst == dst);
|
||||
@ -722,6 +738,7 @@ test_spdk_accel_submit_copy_crc32c(void)
|
||||
CU_ASSERT(task.v.iovcnt == 0);
|
||||
CU_ASSERT(task.seed == seed);
|
||||
CU_ASSERT(task.nbytes == nbytes);
|
||||
CU_ASSERT(task.flags == 0);
|
||||
CU_ASSERT(task.op_code == ACCEL_OPCODE_COPY_CRC32C);
|
||||
CU_ASSERT(g_dummy_submit_called == true);
|
||||
|
||||
@ -733,12 +750,14 @@ test_spdk_accel_submit_copy_crc32c(void)
|
||||
task.v.iovcnt = 0;
|
||||
task.seed = 0;
|
||||
task.nbytes = 0;
|
||||
task.flags = 1;
|
||||
task.op_code = 0xff;
|
||||
g_accel_ch->engine->capabilities = 0;
|
||||
memset(src, 0x5A, TEST_SUBMIT_SIZE);
|
||||
|
||||
/* SW engine does copy crc. */
|
||||
rc = spdk_accel_submit_copy_crc32c(g_ch, dst, src, &crc_dst, seed, nbytes, dummy_submit_cb_fn,
|
||||
rc = spdk_accel_submit_copy_crc32c(g_ch, dst, src, &crc_dst, seed, nbytes, flags,
|
||||
dummy_submit_cb_fn,
|
||||
cb_arg);
|
||||
CU_ASSERT(rc == 0);
|
||||
CU_ASSERT(memcmp(dst, src, TEST_SUBMIT_SIZE) == 0);
|
||||
@ -748,6 +767,7 @@ test_spdk_accel_submit_copy_crc32c(void)
|
||||
CU_ASSERT(task.v.iovcnt == 0);
|
||||
CU_ASSERT(task.seed == seed);
|
||||
CU_ASSERT(task.nbytes == nbytes);
|
||||
CU_ASSERT(task.flags == 0);
|
||||
CU_ASSERT(task.op_code == ACCEL_OPCODE_COPY_CRC32C);
|
||||
CU_ASSERT(g_dummy_submit_cb_called == false);
|
||||
expected_accel_task = TAILQ_FIRST(&g_sw_ch->tasks_to_complete);
|
||||
|
Loading…
Reference in New Issue
Block a user