accel: check operation type in accel_task_set_dstbuf()

This will reduce the amount of changes in the following patch which
makes this function recursive.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: If8da6ae52d78358b66b2d9303413a9723687a767
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17568
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
This commit is contained in:
Konrad Sztyber 2023-04-13 16:05:24 +02:00 committed by David Ko
parent 351355a51f
commit 5d3f3ee464

View File

@ -1726,20 +1726,27 @@ accel_compare_iovs(struct iovec *iova, uint32_t iovacnt, struct iovec *iovb, uin
static bool
accel_task_set_dstbuf(struct spdk_accel_task *task, struct spdk_accel_task *next)
{
if (task->dst_domain != next->src_domain) {
switch (task->op_code) {
case ACCEL_OPC_DECOMPRESS:
case ACCEL_OPC_FILL:
case ACCEL_OPC_ENCRYPT:
case ACCEL_OPC_DECRYPT:
if (task->dst_domain != next->src_domain) {
return false;
}
if (!accel_compare_iovs(task->d.iovs, task->d.iovcnt,
next->s.iovs, next->s.iovcnt)) {
return false;
}
task->d.iovs = next->d.iovs;
task->d.iovcnt = next->d.iovcnt;
task->dst_domain = next->dst_domain;
task->dst_domain_ctx = next->dst_domain_ctx;
break;
default:
return false;
}
if (!accel_compare_iovs(task->d.iovs, task->d.iovcnt,
next->s.iovs, next->s.iovcnt)) {
return false;
}
task->d.iovs = next->d.iovs;
task->d.iovcnt = next->d.iovcnt;
task->dst_domain = next->dst_domain;
task->dst_domain_ctx = next->dst_domain_ctx;
return true;
}