scsi: Remove the TMF code parameter because it is already set in task struct
This is a preparation to the next patch. Change-Id: Ia7af66ba129a4666730f94be64d3699cded65e09 Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-on: https://review.gerrithub.io/434762 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@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
a115177b98
commit
b60923191d
@ -252,7 +252,7 @@ spdk_scsi_dev_queue_mgmt_task(struct spdk_scsi_dev *dev,
|
||||
assert(task != NULL);
|
||||
|
||||
task->function = func;
|
||||
spdk_scsi_lun_task_mgmt_execute(task, func);
|
||||
spdk_scsi_lun_task_mgmt_execute(task);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -68,8 +68,7 @@ spdk_scsi_lun_complete_mgmt_task(struct spdk_scsi_lun *lun, struct spdk_scsi_tas
|
||||
}
|
||||
|
||||
int
|
||||
spdk_scsi_lun_task_mgmt_execute(struct spdk_scsi_task *task,
|
||||
enum spdk_scsi_task_func func)
|
||||
spdk_scsi_lun_task_mgmt_execute(struct spdk_scsi_task *task)
|
||||
{
|
||||
if (!task) {
|
||||
return -1;
|
||||
@ -82,7 +81,7 @@ spdk_scsi_lun_task_mgmt_execute(struct spdk_scsi_task *task,
|
||||
return -1;
|
||||
}
|
||||
|
||||
switch (func) {
|
||||
switch (task->function) {
|
||||
case SPDK_SCSI_TASK_FUNC_ABORT_TASK:
|
||||
task->response = SPDK_SCSI_TASK_MGMT_RESP_REJECT_FUNC_NOT_SUPPORTED;
|
||||
SPDK_ERRLOG("ABORT_TASK failed\n");
|
||||
|
@ -137,7 +137,7 @@ _spdk_scsi_lun *spdk_scsi_lun_construct(struct spdk_bdev *bdev,
|
||||
void spdk_scsi_lun_destruct(struct spdk_scsi_lun *lun);
|
||||
|
||||
void spdk_scsi_lun_execute_task(struct spdk_scsi_lun *lun, struct spdk_scsi_task *task);
|
||||
int spdk_scsi_lun_task_mgmt_execute(struct spdk_scsi_task *task, enum spdk_scsi_task_func func);
|
||||
int spdk_scsi_lun_task_mgmt_execute(struct spdk_scsi_task *task);
|
||||
void spdk_scsi_lun_complete_task(struct spdk_scsi_lun *lun, struct spdk_scsi_task *task);
|
||||
void spdk_scsi_lun_complete_mgmt_task(struct spdk_scsi_lun *lun, struct spdk_scsi_task *task);
|
||||
bool spdk_scsi_lun_has_pending_tasks(const struct spdk_scsi_lun *lun);
|
||||
|
@ -112,7 +112,7 @@ spdk_bdev_get_by_name(const char *bdev_name)
|
||||
}
|
||||
|
||||
int
|
||||
spdk_scsi_lun_task_mgmt_execute(struct spdk_scsi_task *task, enum spdk_scsi_task_func func)
|
||||
spdk_scsi_lun_task_mgmt_execute(struct spdk_scsi_task *task)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -224,7 +224,7 @@ lun_task_mgmt_execute_null_task(void)
|
||||
{
|
||||
int rc;
|
||||
|
||||
rc = spdk_scsi_lun_task_mgmt_execute(NULL, SPDK_SCSI_TASK_FUNC_ABORT_TASK);
|
||||
rc = spdk_scsi_lun_task_mgmt_execute(NULL);
|
||||
|
||||
/* returns -1 since we passed NULL for the task */
|
||||
CU_ASSERT_TRUE(rc < 0);
|
||||
@ -241,8 +241,9 @@ lun_task_mgmt_execute_abort_task_null_lun_failure(void)
|
||||
ut_init_task(&mgmt_task);
|
||||
mgmt_task.lun = NULL;
|
||||
mgmt_task.initiator_port = &initiator_port;
|
||||
mgmt_task.function = SPDK_SCSI_TASK_FUNC_ABORT_TASK;
|
||||
|
||||
rc = spdk_scsi_lun_task_mgmt_execute(&mgmt_task, SPDK_SCSI_TASK_FUNC_ABORT_TASK);
|
||||
rc = spdk_scsi_lun_task_mgmt_execute(&mgmt_task);
|
||||
|
||||
/* returns -1 since we passed NULL for LUN */
|
||||
CU_ASSERT_TRUE(rc < 0);
|
||||
@ -266,6 +267,7 @@ lun_task_mgmt_execute_abort_task_not_supported(void)
|
||||
ut_init_task(&mgmt_task);
|
||||
mgmt_task.lun = lun;
|
||||
mgmt_task.initiator_port = &initiator_port;
|
||||
mgmt_task.function = SPDK_SCSI_TASK_FUNC_ABORT_TASK;
|
||||
|
||||
/* Params to add regular task to the lun->tasks */
|
||||
ut_init_task(&task);
|
||||
@ -277,7 +279,7 @@ lun_task_mgmt_execute_abort_task_not_supported(void)
|
||||
/* task should now be on the tasks list */
|
||||
CU_ASSERT(!TAILQ_EMPTY(&lun->tasks));
|
||||
|
||||
rc = spdk_scsi_lun_task_mgmt_execute(&mgmt_task, SPDK_SCSI_TASK_FUNC_ABORT_TASK);
|
||||
rc = spdk_scsi_lun_task_mgmt_execute(&mgmt_task);
|
||||
|
||||
/* returns -1 since task abort is not supported */
|
||||
CU_ASSERT_TRUE(rc < 0);
|
||||
@ -302,8 +304,9 @@ lun_task_mgmt_execute_abort_task_all_null_lun_failure(void)
|
||||
ut_init_task(&mgmt_task);
|
||||
mgmt_task.lun = NULL;
|
||||
mgmt_task.initiator_port = &initiator_port;
|
||||
mgmt_task.function = SPDK_SCSI_TASK_FUNC_ABORT_TASK_SET;
|
||||
|
||||
rc = spdk_scsi_lun_task_mgmt_execute(&mgmt_task, SPDK_SCSI_TASK_FUNC_ABORT_TASK_SET);
|
||||
rc = spdk_scsi_lun_task_mgmt_execute(&mgmt_task);
|
||||
|
||||
/* Returns -1 since we passed NULL for lun */
|
||||
CU_ASSERT_TRUE(rc < 0);
|
||||
@ -328,6 +331,7 @@ lun_task_mgmt_execute_abort_task_all_not_supported(void)
|
||||
ut_init_task(&mgmt_task);
|
||||
mgmt_task.lun = lun;
|
||||
mgmt_task.initiator_port = &initiator_port;
|
||||
mgmt_task.function = SPDK_SCSI_TASK_FUNC_ABORT_TASK_SET;
|
||||
|
||||
/* Params to add regular task to the lun->tasks */
|
||||
ut_init_task(&task);
|
||||
@ -340,7 +344,7 @@ lun_task_mgmt_execute_abort_task_all_not_supported(void)
|
||||
/* task should now be on the tasks list */
|
||||
CU_ASSERT(!TAILQ_EMPTY(&lun->tasks));
|
||||
|
||||
rc = spdk_scsi_lun_task_mgmt_execute(&mgmt_task, SPDK_SCSI_TASK_FUNC_ABORT_TASK_SET);
|
||||
rc = spdk_scsi_lun_task_mgmt_execute(&mgmt_task);
|
||||
|
||||
/* returns -1 since task abort is not supported */
|
||||
CU_ASSERT_TRUE(rc < 0);
|
||||
@ -364,8 +368,9 @@ lun_task_mgmt_execute_lun_reset_failure(void)
|
||||
|
||||
ut_init_task(&mgmt_task);
|
||||
mgmt_task.lun = NULL;
|
||||
mgmt_task.function = SPDK_SCSI_TASK_FUNC_LUN_RESET;
|
||||
|
||||
rc = spdk_scsi_lun_task_mgmt_execute(&mgmt_task, SPDK_SCSI_TASK_FUNC_LUN_RESET);
|
||||
rc = spdk_scsi_lun_task_mgmt_execute(&mgmt_task);
|
||||
|
||||
/* Returns -1 since we passed NULL for lun */
|
||||
CU_ASSERT_TRUE(rc < 0);
|
||||
@ -386,8 +391,9 @@ lun_task_mgmt_execute_lun_reset(void)
|
||||
|
||||
ut_init_task(&mgmt_task);
|
||||
mgmt_task.lun = lun;
|
||||
mgmt_task.function = SPDK_SCSI_TASK_FUNC_LUN_RESET;
|
||||
|
||||
rc = spdk_scsi_lun_task_mgmt_execute(&mgmt_task, SPDK_SCSI_TASK_FUNC_LUN_RESET);
|
||||
rc = spdk_scsi_lun_task_mgmt_execute(&mgmt_task);
|
||||
|
||||
/* Returns success */
|
||||
CU_ASSERT_EQUAL(rc, 0);
|
||||
@ -411,8 +417,10 @@ lun_task_mgmt_execute_invalid_case(void)
|
||||
lun->dev = &dev;
|
||||
|
||||
ut_init_task(&mgmt_task);
|
||||
mgmt_task.function = 5;
|
||||
|
||||
/* Pass an invalid value to the switch statement */
|
||||
rc = spdk_scsi_lun_task_mgmt_execute(&mgmt_task, 5);
|
||||
rc = spdk_scsi_lun_task_mgmt_execute(&mgmt_task);
|
||||
|
||||
/* Returns -1 on passing an invalid value to the switch case */
|
||||
CU_ASSERT_TRUE(rc < 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user