aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx/qla_target.h
diff options
context:
space:
mode:
authorQuinn Tran <quinn.tran@qlogic.com>2015-12-07 19:48:57 -0500
committerNicholas Bellinger <nab@linux-iscsi.org>2016-01-29 22:30:00 -0500
commita07100e00ac42a4474530ce17b4978c9e06bde55 (patch)
treea2f1bff160a62463533cf177c3b126737b46dbe5 /drivers/scsi/qla2xxx/qla_target.h
parentdacb58221805bb72ec46a73826c9e59a587d7d68 (diff)
qla2xxx: Fix TMR ABORT interaction issue between qla2xxx and TCM
During lun reset, TMR thread from TCM would issue abort to qla driver. At abort time, each command is in different state. Depending on the state, qla will use the TMR thread to trigger a command free(cmd_kref--) if command is not down at firmware. Signed-off-by: Quinn Tran <quinn.tran@qlogic.com> Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com> Cc: stable@vger.kernel.org # 3.10+ Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_target.h')
-rw-r--r--drivers/scsi/qla2xxx/qla_target.h59
1 files changed, 34 insertions, 25 deletions
diff --git a/drivers/scsi/qla2xxx/qla_target.h b/drivers/scsi/qla2xxx/qla_target.h
index 71b2865ba3c8..22a6a767fe07 100644
--- a/drivers/scsi/qla2xxx/qla_target.h
+++ b/drivers/scsi/qla2xxx/qla_target.h
@@ -943,6 +943,36 @@ struct qla_tgt_sess {
943 qlt_plogi_ack_t *plogi_link[QLT_PLOGI_LINK_MAX]; 943 qlt_plogi_ack_t *plogi_link[QLT_PLOGI_LINK_MAX];
944}; 944};
945 945
946typedef enum {
947 /*
948 * BIT_0 - Atio Arrival / schedule to work
949 * BIT_1 - qlt_do_work
950 * BIT_2 - qlt_do work failed
951 * BIT_3 - xfer rdy/tcm_qla2xxx_write_pending
952 * BIT_4 - read respond/tcm_qla2xx_queue_data_in
953 * BIT_5 - status respond / tcm_qla2xx_queue_status
954 * BIT_6 - tcm request to abort/Term exchange.
955 * pre_xmit_response->qlt_send_term_exchange
956 * BIT_7 - SRR received (qlt_handle_srr->qlt_xmit_response)
957 * BIT_8 - SRR received (qlt_handle_srr->qlt_rdy_to_xfer)
958 * BIT_9 - SRR received (qla_handle_srr->qlt_send_term_exchange)
959 * BIT_10 - Data in - hanlde_data->tcm_qla2xxx_handle_data
960
961 * BIT_12 - good completion - qlt_ctio_do_completion -->free_cmd
962 * BIT_13 - Bad completion -
963 * qlt_ctio_do_completion --> qlt_term_ctio_exchange
964 * BIT_14 - Back end data received/sent.
965 * BIT_15 - SRR prepare ctio
966 * BIT_16 - complete free
967 * BIT_17 - flush - qlt_abort_cmd_on_host_reset
968 * BIT_18 - completion w/abort status
969 * BIT_19 - completion w/unknown status
970 * BIT_20 - tcm_qla2xxx_free_cmd
971 */
972 CMD_FLAG_DATA_WORK = BIT_11,
973 CMD_FLAG_DATA_WORK_FREE = BIT_21,
974} cmd_flags_t;
975
946struct qla_tgt_cmd { 976struct qla_tgt_cmd {
947 struct se_cmd se_cmd; 977 struct se_cmd se_cmd;
948 struct qla_tgt_sess *sess; 978 struct qla_tgt_sess *sess;
@@ -952,6 +982,7 @@ struct qla_tgt_cmd {
952 /* Sense buffer that will be mapped into outgoing status */ 982 /* Sense buffer that will be mapped into outgoing status */
953 unsigned char sense_buffer[TRANSPORT_SENSE_BUFFER]; 983 unsigned char sense_buffer[TRANSPORT_SENSE_BUFFER];
954 984
985 spinlock_t cmd_lock;
955 /* to save extra sess dereferences */ 986 /* to save extra sess dereferences */
956 unsigned int conf_compl_supported:1; 987 unsigned int conf_compl_supported:1;
957 unsigned int sg_mapped:1; 988 unsigned int sg_mapped:1;
@@ -986,30 +1017,8 @@ struct qla_tgt_cmd {
986 1017
987 uint64_t jiffies_at_alloc; 1018 uint64_t jiffies_at_alloc;
988 uint64_t jiffies_at_free; 1019 uint64_t jiffies_at_free;
989 /* BIT_0 - Atio Arrival / schedule to work 1020
990 * BIT_1 - qlt_do_work 1021 cmd_flags_t cmd_flags;
991 * BIT_2 - qlt_do work failed
992 * BIT_3 - xfer rdy/tcm_qla2xxx_write_pending
993 * BIT_4 - read respond/tcm_qla2xx_queue_data_in
994 * BIT_5 - status respond / tcm_qla2xx_queue_status
995 * BIT_6 - tcm request to abort/Term exchange.
996 * pre_xmit_response->qlt_send_term_exchange
997 * BIT_7 - SRR received (qlt_handle_srr->qlt_xmit_response)
998 * BIT_8 - SRR received (qlt_handle_srr->qlt_rdy_to_xfer)
999 * BIT_9 - SRR received (qla_handle_srr->qlt_send_term_exchange)
1000 * BIT_10 - Data in - hanlde_data->tcm_qla2xxx_handle_data
1001 * BIT_11 - Data actually going to TCM : tcm_qla2xx_handle_data_work
1002 * BIT_12 - good completion - qlt_ctio_do_completion -->free_cmd
1003 * BIT_13 - Bad completion -
1004 * qlt_ctio_do_completion --> qlt_term_ctio_exchange
1005 * BIT_14 - Back end data received/sent.
1006 * BIT_15 - SRR prepare ctio
1007 * BIT_16 - complete free
1008 * BIT_17 - flush - qlt_abort_cmd_on_host_reset
1009 * BIT_18 - completion w/abort status
1010 * BIT_19 - completion w/unknown status
1011 */
1012 uint32_t cmd_flags;
1013}; 1022};
1014 1023
1015struct qla_tgt_sess_work_param { 1024struct qla_tgt_sess_work_param {
@@ -1148,7 +1157,7 @@ static inline void sid_to_portid(const uint8_t *s_id, port_id_t *p)
1148extern void qlt_response_pkt_all_vps(struct scsi_qla_host *, response_t *); 1157extern void qlt_response_pkt_all_vps(struct scsi_qla_host *, response_t *);
1149extern int qlt_rdy_to_xfer(struct qla_tgt_cmd *); 1158extern int qlt_rdy_to_xfer(struct qla_tgt_cmd *);
1150extern int qlt_xmit_response(struct qla_tgt_cmd *, int, uint8_t); 1159extern int qlt_xmit_response(struct qla_tgt_cmd *, int, uint8_t);
1151extern void qlt_abort_cmd(struct qla_tgt_cmd *); 1160extern int qlt_abort_cmd(struct qla_tgt_cmd *);
1152extern void qlt_xmit_tm_rsp(struct qla_tgt_mgmt_cmd *); 1161extern void qlt_xmit_tm_rsp(struct qla_tgt_mgmt_cmd *);
1153extern void qlt_free_mcmd(struct qla_tgt_mgmt_cmd *); 1162extern void qlt_free_mcmd(struct qla_tgt_mgmt_cmd *);
1154extern void qlt_free_cmd(struct qla_tgt_cmd *cmd); 1163extern void qlt_free_cmd(struct qla_tgt_cmd *cmd);