Commit c9f92cbf authored by Konrad Sztyber's avatar Konrad Sztyber
Browse files

accel/error: check interval before submission



It's prep for the next patch which will make it so that tasks with
FAILURE errors injected aren't submitted to the accel_sw module.

Signed-off-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Change-Id: Ice504f857d62391eec3a6d880a956b24cfccb442
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/25282


Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Community CI Samsung <spdk.community.ci.samsung@gmail.com>
Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@nvidia.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
parent ff0dc8ce
Loading
Loading
Loading
Loading
+31 −24
Original line number Diff line number Diff line
@@ -60,12 +60,6 @@ accel_error_task_complete_cb(void *arg, int status)
	spdk_accel_completion_cb cb_fn = errtask->cb_fn;
	void *cb_arg = errtask->cb_arg;

	info->interval++;
	if (info->interval >= info->opts.interval) {
		info->interval = 0;
		info->count++;

		if (info->count <= info->opts.count) {
	switch (info->opts.type) {
	case ACCEL_ERROR_INJECT_CORRUPT:
		accel_error_corrupt_task(task);
@@ -76,10 +70,6 @@ accel_error_task_complete_cb(void *arg, int status)
	default:
		break;
	}
		} else {
			info->opts.type = ACCEL_ERROR_INJECT_DISABLE;
		}
	}

	cb_fn(cb_arg, status);
}
@@ -89,13 +79,30 @@ accel_error_submit_tasks(struct spdk_io_channel *ch, struct spdk_accel_task *tas
{
	struct accel_error_channel *errch = spdk_io_channel_get_ctx(ch);
	struct accel_error_task *errtask = accel_error_get_task_ctx(task);
	struct accel_error_inject_info *info = &errch->injects[task->op_code];

	if (info->opts.type == ACCEL_ERROR_INJECT_DISABLE) {
		goto submit;
	}

	info->interval++;
	if (info->interval >= info->opts.interval) {
		info->interval = 0;
		info->count++;

		if (info->count <= info->opts.count) {
			errtask->ch = errch;
			errtask->cb_fn = task->cb_fn;
			errtask->cb_arg = task->cb_arg;
			task->cb_fn = accel_error_task_complete_cb;
			task->cb_arg = task;

		} else {
			info->opts.type = ACCEL_ERROR_INJECT_DISABLE;
			info->interval = 0;
			info->count = 0;
		}
	}
submit:
	return g_sw_module->submit_tasks(errch->swch, task);
}