Commit 2b1ad70c authored by Konrad Sztyber's avatar Konrad Sztyber
Browse files

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: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Change-Id: If8da6ae52d78358b66b2d9303413a9723687a767
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17568


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarAleksey Marchuk <alexeymar@nvidia.com>
parent b0c93eb3
Loading
Loading
Loading
Loading
+18 −11
Original line number Diff line number Diff line
@@ -1726,19 +1726,26 @@ 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)
{
	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;
	}

	return true;
}