Commit 193b50b9 authored by Quinn Tran's avatar Quinn Tran Committed by Nicholas Bellinger

qla2xxx: Replace QLA_TGT_STATE_ABORTED with a bit.

Replace QLA_TGT_STATE_ABORTED state with a bit because
the current state of the command is lost when an abort
is requested by upper layer.
Signed-off-by: default avatarQuinn Tran <quinn.tran@qlogic.com>
Signed-off-by: default avatarHimanshu Madhani <himanshu.madhani@qlogic.com>
Reviewed-by: default avatarHannes Reinecke <hare@suse.com>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent b7bd104e
...@@ -1469,7 +1469,7 @@ static int abort_cmd_for_tag(struct scsi_qla_host *vha, uint32_t tag) ...@@ -1469,7 +1469,7 @@ static int abort_cmd_for_tag(struct scsi_qla_host *vha, uint32_t tag)
list_for_each_entry(cmd, &vha->qla_cmd_list, cmd_list) { list_for_each_entry(cmd, &vha->qla_cmd_list, cmd_list) {
if (tag == cmd->atio.u.isp24.exchange_addr) { if (tag == cmd->atio.u.isp24.exchange_addr) {
cmd->state = QLA_TGT_STATE_ABORTED; cmd->aborted = 1;
spin_unlock(&vha->cmd_list_lock); spin_unlock(&vha->cmd_list_lock);
return 1; return 1;
} }
...@@ -1511,7 +1511,7 @@ static void abort_cmds_for_lun(struct scsi_qla_host *vha, ...@@ -1511,7 +1511,7 @@ static void abort_cmds_for_lun(struct scsi_qla_host *vha,
cmd_lun = scsilun_to_int( cmd_lun = scsilun_to_int(
(struct scsi_lun *)&cmd->atio.u.isp24.fcp_cmnd.lun); (struct scsi_lun *)&cmd->atio.u.isp24.fcp_cmnd.lun);
if (cmd_key == key && cmd_lun == lun) if (cmd_key == key && cmd_lun == lun)
cmd->state = QLA_TGT_STATE_ABORTED; cmd->aborted = 1;
} }
spin_unlock(&vha->cmd_list_lock); spin_unlock(&vha->cmd_list_lock);
} }
...@@ -3175,7 +3175,7 @@ static void qlt_send_term_exchange(struct scsi_qla_host *vha, ...@@ -3175,7 +3175,7 @@ static void qlt_send_term_exchange(struct scsi_qla_host *vha,
qlt_alloc_qfull_cmd(vha, atio, 0, 0); qlt_alloc_qfull_cmd(vha, atio, 0, 0);
done: done:
if (cmd && ((cmd->state != QLA_TGT_STATE_ABORTED) || if (cmd && (!cmd->aborted ||
!cmd->cmd_sent_to_fw)) { !cmd->cmd_sent_to_fw)) {
if (cmd->sg_mapped) if (cmd->sg_mapped)
qlt_unmap_sg(vha, cmd); qlt_unmap_sg(vha, cmd);
...@@ -3246,7 +3246,7 @@ void qlt_abort_cmd(struct qla_tgt_cmd *cmd) ...@@ -3246,7 +3246,7 @@ void qlt_abort_cmd(struct qla_tgt_cmd *cmd)
"(se_cmd=%p, tag=%llu)", vha->vp_idx, cmd, &cmd->se_cmd, "(se_cmd=%p, tag=%llu)", vha->vp_idx, cmd, &cmd->se_cmd,
se_cmd->tag); se_cmd->tag);
cmd->state = QLA_TGT_STATE_ABORTED; cmd->aborted = 1;
cmd->cmd_flags |= BIT_6; cmd->cmd_flags |= BIT_6;
qlt_send_term_exchange(vha, cmd, &cmd->atio, 0); qlt_send_term_exchange(vha, cmd, &cmd->atio, 0);
...@@ -3466,9 +3466,6 @@ qlt_abort_cmd_on_host_reset(struct scsi_qla_host *vha, struct qla_tgt_cmd *cmd) ...@@ -3466,9 +3466,6 @@ qlt_abort_cmd_on_host_reset(struct scsi_qla_host *vha, struct qla_tgt_cmd *cmd)
ha->tgt.tgt_ops->handle_data(cmd); ha->tgt.tgt_ops->handle_data(cmd);
return; return;
} else if (cmd->state == QLA_TGT_STATE_ABORTED) {
ql_dbg(ql_dbg_io, vha, 0xff02,
"HOST-ABORT: handle=%d, state=ABORTED.\n", handle);
} else { } else {
ql_dbg(ql_dbg_io, vha, 0xff03, ql_dbg(ql_dbg_io, vha, 0xff03,
"HOST-ABORT: handle=%d, state=BAD(%d).\n", handle, "HOST-ABORT: handle=%d, state=BAD(%d).\n", handle,
...@@ -3633,14 +3630,14 @@ static void qlt_do_ctio_completion(struct scsi_qla_host *vha, uint32_t handle, ...@@ -3633,14 +3630,14 @@ static void qlt_do_ctio_completion(struct scsi_qla_host *vha, uint32_t handle,
} }
/* "cmd->state == QLA_TGT_STATE_ABORTED" means /* "cmd->aborted" means
* cmd is already aborted/terminated, we don't * cmd is already aborted/terminated, we don't
* need to terminate again. The exchange is already * need to terminate again. The exchange is already
* cleaned up/freed at FW level. Just cleanup at driver * cleaned up/freed at FW level. Just cleanup at driver
* level. * level.
*/ */
if ((cmd->state != QLA_TGT_STATE_NEED_DATA) && if ((cmd->state != QLA_TGT_STATE_NEED_DATA) &&
(cmd->state != QLA_TGT_STATE_ABORTED)) { (!cmd->aborted)) {
cmd->cmd_flags |= BIT_13; cmd->cmd_flags |= BIT_13;
if (qlt_term_ctio_exchange(vha, ctio, cmd, status)) if (qlt_term_ctio_exchange(vha, ctio, cmd, status))
return; return;
...@@ -3658,7 +3655,7 @@ static void qlt_do_ctio_completion(struct scsi_qla_host *vha, uint32_t handle, ...@@ -3658,7 +3655,7 @@ static void qlt_do_ctio_completion(struct scsi_qla_host *vha, uint32_t handle,
ha->tgt.tgt_ops->handle_data(cmd); ha->tgt.tgt_ops->handle_data(cmd);
return; return;
} else if (cmd->state == QLA_TGT_STATE_ABORTED) { } else if (cmd->aborted) {
cmd->cmd_flags |= BIT_18; cmd->cmd_flags |= BIT_18;
ql_dbg(ql_dbg_tgt_mgt, vha, 0xf01e, ql_dbg(ql_dbg_tgt_mgt, vha, 0xf01e,
"Aborted command %p (tag %lld) finished\n", cmd, se_cmd->tag); "Aborted command %p (tag %lld) finished\n", cmd, se_cmd->tag);
...@@ -3670,7 +3667,7 @@ static void qlt_do_ctio_completion(struct scsi_qla_host *vha, uint32_t handle, ...@@ -3670,7 +3667,7 @@ static void qlt_do_ctio_completion(struct scsi_qla_host *vha, uint32_t handle,
} }
if (unlikely(status != CTIO_SUCCESS) && if (unlikely(status != CTIO_SUCCESS) &&
(cmd->state != QLA_TGT_STATE_ABORTED)) { !cmd->aborted) {
ql_dbg(ql_dbg_tgt_mgt, vha, 0xf01f, "Finishing failed CTIO\n"); ql_dbg(ql_dbg_tgt_mgt, vha, 0xf01f, "Finishing failed CTIO\n");
dump_stack(); dump_stack();
} }
...@@ -3732,7 +3729,7 @@ static void __qlt_do_work(struct qla_tgt_cmd *cmd) ...@@ -3732,7 +3729,7 @@ static void __qlt_do_work(struct qla_tgt_cmd *cmd)
if (tgt->tgt_stop) if (tgt->tgt_stop)
goto out_term; goto out_term;
if (cmd->state == QLA_TGT_STATE_ABORTED) { if (cmd->aborted) {
ql_dbg(ql_dbg_tgt_mgt, vha, 0xf082, ql_dbg(ql_dbg_tgt_mgt, vha, 0xf082,
"cmd with tag %u is aborted\n", "cmd with tag %u is aborted\n",
cmd->atio.u.isp24.exchange_addr); cmd->atio.u.isp24.exchange_addr);
...@@ -4290,7 +4287,7 @@ static int abort_cmds_for_s_id(struct scsi_qla_host *vha, port_id_t *s_id) ...@@ -4290,7 +4287,7 @@ static int abort_cmds_for_s_id(struct scsi_qla_host *vha, port_id_t *s_id)
list_for_each_entry(cmd, &vha->qla_cmd_list, cmd_list) { list_for_each_entry(cmd, &vha->qla_cmd_list, cmd_list) {
uint32_t cmd_key = sid_to_key(cmd->atio.u.isp24.fcp_hdr.s_id); uint32_t cmd_key = sid_to_key(cmd->atio.u.isp24.fcp_hdr.s_id);
if (cmd_key == key) { if (cmd_key == key) {
cmd->state = QLA_TGT_STATE_ABORTED; cmd->aborted = 1;
count++; count++;
} }
} }
......
...@@ -787,7 +787,7 @@ int qla2x00_wait_for_hba_online(struct scsi_qla_host *); ...@@ -787,7 +787,7 @@ int qla2x00_wait_for_hba_online(struct scsi_qla_host *);
#define QLA_TGT_STATE_NEED_DATA 1 /* target needs data to continue */ #define QLA_TGT_STATE_NEED_DATA 1 /* target needs data to continue */
#define QLA_TGT_STATE_DATA_IN 2 /* Data arrived + target processing */ #define QLA_TGT_STATE_DATA_IN 2 /* Data arrived + target processing */
#define QLA_TGT_STATE_PROCESSED 3 /* target done processing */ #define QLA_TGT_STATE_PROCESSED 3 /* target done processing */
#define QLA_TGT_STATE_ABORTED 4 /* Command aborted */
/* Special handles */ /* Special handles */
#define QLA_TGT_NULL_HANDLE 0 #define QLA_TGT_NULL_HANDLE 0
...@@ -960,6 +960,7 @@ struct qla_tgt_cmd { ...@@ -960,6 +960,7 @@ struct qla_tgt_cmd {
unsigned int term_exchg:1; unsigned int term_exchg:1;
unsigned int cmd_sent_to_fw:1; unsigned int cmd_sent_to_fw:1;
unsigned int cmd_in_wq:1; unsigned int cmd_in_wq:1;
unsigned int aborted:1;
struct scatterlist *sg; /* cmd data buffer SG vector */ struct scatterlist *sg; /* cmd data buffer SG vector */
int sg_cnt; /* SG segments count */ int sg_cnt; /* SG segments count */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment