From: Himanshu Madhani <himanshu.madhani@qlogic.com> To: target-devel@vger.kernel.org, nab@linux-iscsi.org Cc: giridhar.malavali@qlogic.com, linux-scsi@vger.kernel.org, himanshu.madhani@qlogic.com Subject: [PATCH 20/20] qla2xxx: Check for online flag instead of active reset when transmitting responses Date: Mon, 7 Dec 2015 19:49:07 -0500 [thread overview] Message-ID: <1449535747-2850-21-git-send-email-himanshu.madhani@qlogic.com> (raw) In-Reply-To: <1449535747-2850-1-git-send-email-himanshu.madhani@qlogic.com> From: Dilip Kumar Uppugandla <dilip@purestorage.com> Driver has following initialization sequence for Target mode 1. Driver initialization starts 2. ISP Abort is scheduled when the target is enabled. qla2xxx [0000:04:00.0]-4807:25: ISP abort scheduled qla2xxx [0000:04:00.0]-00af:25: Performing ISP error recovery - ha=ffff880caa9e0000. 3. DPC thread starts the ISP Abort 4. While DPC is resetting the chip and initializing the firmware, we get async events from the firmware about P2P mode, LOOP UP and PORT UPDATE. 5. PRLI from a initiator is delivered to us followed by a PLOGI and then a SCSI command which creates a session. 6. If the SCSI command is a WRITE in this case, we issue XFR RDY and it gets dropped as can be seen with messages RESET-XFR because ISP Abort is still active qla2xxx [0000:04:00.0]-e902:25: RESET-XFR active/old-count/new-count = 1/1/1. 7. If the SCSI command is a READ, we issue RESPONSE and they get dropped as well because Abort is still active. qla2xxx [0000:04:00.0]-e901:25: RESET-RSP active/old-count/new-count = 1/1/1 8. Now eventually, ISP Abort finishes clearing the DPC flags. qla2xxx [0000:04:00.0]-8822:25: qla2x00_abort_isp succeeded. qla2xxx [0000:04:00.0]-4808:25: ISP abort end. 9. Since we dropped SCSI commands silently (without any responses sent to the initiator) initiator waits for a SCSI timeout (which is 60 seconds in our case), Sends an ABTS which fails since there no se_cmd found for the tag that ABTS is referencing as the commands were cleaned up in Step 6 and 7. 10. Initiator send an IO after the ABTS which succeed fine. To fix the above case, the following changes have been made: - To prevent target from dropping commands silently, use the online flag instead to check for an active chip reset. Once the port is online during a chip reset phase, we are good to process the commands. - Clean up qla2x00_restart_isp to not set the online flag and process ATIO as it is unnecessary. During a chip reset, interrupts are enabled only after setting the online flag to 1, so ATIO's won't be missed and hence no need to process ATIO's after setting the online flag. Signed-off-by: Dilip Kumar Uppugandla <dilip@purestorage.com> Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com> --- drivers/scsi/qla2xxx/qla_init.c | 34 ++++++++++++++++++++-------------- drivers/scsi/qla2xxx/qla_target.c | 34 +++++++++++++++++----------------- 2 files changed, 37 insertions(+), 31 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 993dd25..52a8765 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -3065,6 +3065,26 @@ qla2x00_configure_loop(scsi_qla_host_t *vha) atomic_set(&vha->loop_state, LOOP_READY); ql_dbg(ql_dbg_disc, vha, 0x2069, "LOOP READY.\n"); + + /* + * Process any ATIO queue entries that came in + * while we weren't online. + */ + if (qla_tgt_mode_enabled(vha)) { + if (IS_QLA27XX(ha) || IS_QLA83XX(ha)) { + spin_lock_irqsave(&ha->tgt.atio_lock, + flags); + qlt_24xx_process_atio_queue(vha, 0); + spin_unlock_irqrestore( + &ha->tgt.atio_lock, flags); + } else { + spin_lock_irqsave(&ha->hardware_lock, + flags); + qlt_24xx_process_atio_queue(vha, 1); + spin_unlock_irqrestore( + &ha->hardware_lock, flags); + } + } } } @@ -4919,7 +4939,6 @@ qla2x00_restart_isp(scsi_qla_host_t *vha) struct qla_hw_data *ha = vha->hw; struct req_que *req = ha->req_q_map[0]; struct rsp_que *rsp = ha->rsp_q_map[0]; - unsigned long flags, flags2; /* If firmware needs to be loaded */ if (qla2x00_isp_firmware(vha)) { @@ -4941,19 +4960,6 @@ qla2x00_restart_isp(scsi_qla_host_t *vha) /* Issue a marker after FW becomes ready. */ qla2x00_marker(vha, req, rsp, 0, 0, MK_SYNC_ALL); - vha->flags.online = 1; - - /* - * Process any ATIO queue entries that came in - * while we weren't online. - */ - spin_lock_irqsave(&ha->hardware_lock, flags); - spin_lock_irqsave(&ha->tgt.atio_lock, flags2); - if (qla_tgt_mode_enabled(vha)) - qlt_24xx_process_atio_queue(vha, 1); - spin_unlock_irqrestore(&ha->tgt.atio_lock, flags2); - spin_unlock_irqrestore(&ha->hardware_lock, flags); - set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); } diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 9cf812f..81dd308 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -229,7 +229,7 @@ static inline void qlt_decr_num_pend_cmds(struct scsi_qla_host *vha) spin_unlock_irqrestore(&vha->hw->tgt.q_full_lock, flags); } -static void qlt_24xx_atio_pkt_all_vps(struct scsi_qla_host *vha, +static bool qlt_24xx_atio_pkt_all_vps(struct scsi_qla_host *vha, struct atio_from_isp *atio, uint8_t ha_locked) { ql_dbg(ql_dbg_tgt, vha, 0xe072, @@ -285,7 +285,7 @@ static void qlt_24xx_atio_pkt_all_vps(struct scsi_qla_host *vha, break; } - return; + return false; } void qlt_response_pkt_all_vps(struct scsi_qla_host *vha, response_t *pkt) @@ -1736,15 +1736,15 @@ void qlt_xmit_tm_rsp(struct qla_tgt_mgmt_cmd *mcmd) spin_lock_irqsave(&ha->hardware_lock, flags); - if (qla2x00_reset_active(vha) || mcmd->reset_count != ha->chip_reset) { + if (!vha->flags.online || mcmd->reset_count != ha->chip_reset) { /* - * Either a chip reset is active or this request was from + * Either the port is not online or this request was from * previous life, just abort the processing. */ ql_dbg(ql_dbg_async, vha, 0xe100, - "RESET-TMR active/old-count/new-count = %d/%d/%d.\n", - qla2x00_reset_active(vha), mcmd->reset_count, - ha->chip_reset); + "RESET-TMR online/active/old-count/new-count = %d/%d/%d/%d.\n", + vha->flags.online, qla2x00_reset_active(vha), + mcmd->reset_count, ha->chip_reset); ha->tgt.tgt_ops->free_mcmd(mcmd); spin_unlock_irqrestore(&ha->hardware_lock, flags); return; @@ -2691,17 +2691,17 @@ int qlt_xmit_response(struct qla_tgt_cmd *cmd, int xmit_type, else vha->tgt_counters.core_qla_que_buf++; - if (qla2x00_reset_active(vha) || cmd->reset_count != ha->chip_reset) { + if (!vha->flags.online || cmd->reset_count != ha->chip_reset) { /* - * Either a chip reset is active or this request was from + * Either the port is not online or this request was from * previous life, just abort the processing. */ cmd->state = QLA_TGT_STATE_PROCESSED; qlt_abort_cmd_on_host_reset(cmd->vha, cmd); ql_dbg(ql_dbg_async, vha, 0xe101, - "RESET-RSP active/old-count/new-count = %d/%d/%d.\n", - qla2x00_reset_active(vha), cmd->reset_count, - ha->chip_reset); + "RESET-RSP online/active/old-count/new-count = %d/%d/%d/%d.\n", + vha->flags.online, qla2x00_reset_active(vha), + cmd->reset_count, ha->chip_reset); spin_unlock_irqrestore(&ha->hardware_lock, flags); return 0; } @@ -2832,18 +2832,18 @@ int qlt_rdy_to_xfer(struct qla_tgt_cmd *cmd) spin_lock_irqsave(&ha->hardware_lock, flags); - if (qla2x00_reset_active(vha) || (cmd->reset_count != ha->chip_reset) || + if (!vha->flags.online || (cmd->reset_count != ha->chip_reset) || (cmd->sess && cmd->sess->deleted == QLA_SESS_DELETION_IN_PROGRESS)) { /* - * Either a chip reset is active or this request was from + * Either the port is not online or this request was from * previous life, just abort the processing. */ cmd->state = QLA_TGT_STATE_NEED_DATA; qlt_abort_cmd_on_host_reset(cmd->vha, cmd); ql_dbg(ql_dbg_async, vha, 0xe102, - "RESET-XFR active/old-count/new-count = %d/%d/%d.\n", - qla2x00_reset_active(vha), cmd->reset_count, - ha->chip_reset); + "RESET-XFR online/active/old-count/new-count = %d/%d/%d/%d.\n", + vha->flags.online, qla2x00_reset_active(vha), + cmd->reset_count, ha->chip_reset); spin_unlock_irqrestore(&ha->hardware_lock, flags); return 0; } -- 1.7.7
prev parent reply other threads:[~2015-12-08 1:29 UTC|newest] Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-12-08 0:48 [PATCH 00/20] qla2xxx: Patches for target-pending branch Himanshu Madhani 2015-12-08 0:48 ` [PATCH 01/20] qla2xxx: Enable Extended Login support Himanshu Madhani 2015-12-08 15:51 ` Hannes Reinecke 2015-12-08 19:35 ` Himanshu Madhani 2015-12-08 0:48 ` [PATCH 02/20] qla2xxx: Enable Exchange offload support Himanshu Madhani 2015-12-08 15:52 ` Hannes Reinecke 2015-12-08 0:48 ` [PATCH 03/20] qla2xxx: Enable Target counters in DebugFS Himanshu Madhani 2015-12-08 15:52 ` Hannes Reinecke 2015-12-08 0:48 ` [PATCH 04/20] qla2xxx: Add FW resource count " Himanshu Madhani 2015-12-08 15:53 ` Hannes Reinecke 2015-12-08 0:48 ` [PATCH 05/20] qla2xxx: Added interface to send ELS commands from driver Himanshu Madhani 2015-12-08 2:10 ` kbuild test robot 2015-12-08 2:10 ` [PATCH] qla2xxx: fix ifnullfree.cocci warnings kbuild test robot 2015-12-08 15:54 ` [PATCH 05/20] qla2xxx: Added interface to send ELS commands from driver Hannes Reinecke 2015-12-08 0:48 ` [PATCH 06/20] qla2xxx: Delete session if initiator is gone from FW Himanshu Madhani 2015-12-08 1:41 ` kbuild test robot 2015-12-08 15:58 ` Hannes Reinecke 2015-12-08 0:48 ` [PATCH 07/20] qla2xxx: Wait for all conflicts before ack'ing PLOGI Himanshu Madhani 2015-12-08 16:00 ` Hannes Reinecke 2015-12-08 0:48 ` [PATCH 08/20] qla2xxx: Replace QLA_TGT_STATE_ABORTED with a bit Himanshu Madhani 2015-12-08 16:01 ` Hannes Reinecke 2015-12-08 0:48 ` [PATCH 09/20] qla2xxx: Change check_stop_free to always return 1 Himanshu Madhani 2015-12-08 2:33 ` Christoph Hellwig 2015-12-09 6:56 ` Hannes Reinecke 2015-12-10 1:06 ` Quinn Tran 2015-12-08 0:48 ` [PATCH 10/20] qla2xxx: Fix interaction issue between qla2xxx and Target Core Module Himanshu Madhani 2015-12-08 2:37 ` Christoph Hellwig 2015-12-09 22:07 ` Quinn Tran 2015-12-14 10:34 ` Christoph Hellwig 2015-12-14 21:59 ` Quinn Tran 2015-12-09 7:01 ` Hannes Reinecke 2015-12-09 22:41 ` Quinn Tran 2015-12-08 0:48 ` [PATCH 11/20] qla2xxx: Add TAS detection for kernel 3.15 n newer Himanshu Madhani 2015-12-08 2:48 ` Christoph Hellwig 2015-12-09 20:24 ` Quinn Tran 2015-12-14 10:37 ` Christoph Hellwig 2015-12-14 22:00 ` Quinn Tran 2015-12-09 7:02 ` Hannes Reinecke 2015-12-08 0:48 ` [PATCH 12/20] target/tmr: LUN reset cause cmd premature free Himanshu Madhani 2015-12-08 2:48 ` Christoph Hellwig 2015-12-09 20:11 ` Quinn Tran 2016-01-04 7:44 ` Bart Van Assche 2015-12-09 7:03 ` Hannes Reinecke 2015-12-08 0:49 ` [PATCH 13/20] qla2xxx: Remove dependency on hardware_lock to reduce lock contention Himanshu Madhani 2015-12-08 0:49 ` [PATCH 14/20] qla2xxx: Add irq affinity notification Himanshu Madhani 2015-12-08 0:49 ` [PATCH 15/20] qla2xxx: Add selective command queuing Himanshu Madhani 2015-12-08 0:49 ` [PATCH 16/20] qla2xxx: Move atioq to a different lock to reduce lock contention Himanshu Madhani 2015-12-08 0:49 ` [PATCH 17/20] qla2xxx: Disable ZIO at start time Himanshu Madhani 2015-12-08 0:49 ` [PATCH 18/20] qla2xxx: Set all queues to 4k Himanshu Madhani 2015-12-08 0:49 ` [PATCH 19/20] qla2xxx: Add bulk send for atio & ctio completion paths Himanshu Madhani 2015-12-08 0:49 ` Himanshu Madhani [this message]
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1449535747-2850-21-git-send-email-himanshu.madhani@qlogic.com \ --to=himanshu.madhani@qlogic.com \ --cc=giridhar.malavali@qlogic.com \ --cc=linux-scsi@vger.kernel.org \ --cc=nab@linux-iscsi.org \ --cc=target-devel@vger.kernel.org \ --subject='Re: [PATCH 20/20] qla2xxx: Check for online flag instead of active reset when transmitting responses' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.