qla2xxx bug fixes
Subsystems (2)
Nilesh Javali
maintainercover qla2xxx bug fixes
Martin,
Please apply the qla2xxx driver bug fixes to the scsi tree at your earliest convenience.
Thanks,
Nilesh
Arun Easi (6):
qla2xxx: Fix excessive IO error messages by default
qla2xxx: Fix crash due to stale srb access around IO timeouts
qla2xxx: Fix losing FCP-2 targets during port perturbation tests
qla2xxx: Fix losing target when it reappears during delete
qla2xxx: Add debug prints in the device remove path
qla2xxx: Fix losing FCP-2 targets on long port disable with IOs
Bikash Hazarika (1):
qla2xxx: Add a new v2 dport diagnostic feature
Nilesh Javali (1):
qla2xxx: Update version to 10.02.07.700-k
Quinn Tran (3):
qla2xxx: Wind down adapter after pcie error
qla2xxx: Turn off multi-queue for 8G adapter
qla2xxx: Fix erroneous mailbox timeout after pci error inject
drivers/scsi/qla2xxx/qla_attr.c | 27 ++++++--- drivers/scsi/qla2xxx/qla_bsg.c | 96 +++++++++++++++++++++++++++++- drivers/scsi/qla2xxx/qla_bsg.h | 15 +++++ drivers/scsi/qla2xxx/qla_def.h | 24 +++++++- drivers/scsi/qla2xxx/qla_gbl.h | 4 ++ drivers/scsi/qla2xxx/qla_gs.c | 2 +- drivers/scsi/qla2xxx/qla_init.c | 35 +++++++++-- drivers/scsi/qla2xxx/qla_isr.c | 23 ++++--- drivers/scsi/qla2xxx/qla_mbx.c | 60 +++++++++++++++++-- drivers/scsi/qla2xxx/qla_os.c | 89 +++++++++++++++++++++++---- drivers/scsi/qla2xxx/qla_version.h | 4 +- 11 files changed, 333 insertions(+), 46 deletions(-)
base-commit: b9f50e3cfd13687279f2170ff6ef5d71f6c7db11
Signature · 1 line
2.19.0.rc0
Nilesh Javali
maintainerPATCH 1/11 qla2xxx: Fix excessive IO error messages by default
From: Arun Easi <[email protected]>
Disable printing IO error messages by default.
The messages will be printed only when logging
was enabled.
--- drivers/scsi/qla2xxx/qla_isr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/qla2xxx/qla_isr.c +2 -2
@@ -2645,7 +2645,7 @@ static void qla24xx_nvme_iocb_entry(scsi_qla_host_t *vha, struct req_que *req, }if (unlikely (logit)) - ql_log(ql_dbg_io, fcport->vha, 0x5060, + ql_dbg(ql_dbg_io, fcport->vha, 0x5060, "NVME-%s ERR Handling - hdl=%x status(%x) tr_len:%x resid=%x ox_id=%x\n", sp->name, sp->handle, comp_status, fd->transferred_length, le32_to_cpu(sts->residual_len),
@@ -3503,7 +3503,7 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt) out:if (logit) - ql_log(ql_dbg_io, fcport->vha, 0x3022, + ql_dbg(ql_dbg_io, fcport->vha, 0x3022, "FCP command status: 0x%x-0x%x (0x%x) nexus=%ld:%d:%llu portid=%02x%02x%02x oxid=0x%x cdb=%10phN len=0x%x rsp_info=0x%x resid=0x%x fw_resid=0x%x sp=%p cp=%p.\n", comp_status, scsi_status, res, vha->host_no, cp->device->id, cp->device->lun, fcport->d_id.b.domain,
Signature · 1 line
2.19.0.rc0
Nilesh Javali
maintainerPATCH 2/11 qla2xxx: Add a new v2 dport diagnostic feature
In reply to Nilesh JavaliFrom: Bikash Hazarika <[email protected]>
FW requires minimum 72 bytes buffer size forD_port result. Buffer size 1024 is mentioned in the FW spec so buffer size is increased to 1024.
Re-write the logic to handle START/RESTART command from SDMAPI.
--- drivers/scsi/qla2xxx/qla_bsg.c | 86 +++++++++++++++++++++++++++++++++ drivers/scsi/qla2xxx/qla_bsg.h | 15 ++++++ drivers/scsi/qla2xxx/qla_def.h | 10 ++++ drivers/scsi/qla2xxx/qla_gbl.h | 4 ++ drivers/scsi/qla2xxx/qla_init.c | 3 ++ drivers/scsi/qla2xxx/qla_isr.c | 3 ++ drivers/scsi/qla2xxx/qla_mbx.c | 48 ++++++++++++++++++ 7 files changed, 169 insertions(+)
drivers/scsi/qla2xxx/qla_bsg.c +86 -0
@@ -2424,6 +2424,89 @@ qla2x00_do_dport_diagnostics(struct bsg_job *bsg_job)return 0 ; } +static int +qla2x00_do_dport_diagnostics_v2 (struct bsg_job *bsg_job) +{ +struct fc_bsg_reply *bsg_reply = bsg_job->reply; +struct Scsi_Host *host =fc_bsg_to_shost (bsg_job); +scsi_qla_host_t *vha =shost_priv (host); +int rval; +struct qla_dport_diag_v2 *dd; +mbx_cmd_t mc; +mbx_cmd_t *mcp = &mc; +uint16_t options; + +if (!IS_DPORT_CAPABLE (vha->hw)) +return -EPERM ; + + dd =kzalloc (sizeof (*dd),GFP_KERNEL ); +if (!dd) +return -ENOMEM ; + +sg_copy_to_buffer (bsg_job->request_payload.sg_list, + bsg_job->request_payload.sg_cnt, dd,sizeof (*dd)); + + options = dd->options; + +/* Check dport Test in progress */ +if (options ==QLA_GET_DPORT_RESULT_V2 && + vha->dport_status &DPORT_DIAG_IN_PROGRESS ) { + bsg_reply->reply_data.vendor_reply.vendor_rsp[0 ] = +EXT_STATUS_DPORT_DIAG_IN_PROCESS ; + goto dportcomplete; + } + +/* Check chip reset in progress and start/restart requests arrive */ +if (vha->dport_status &DPORT_DIAG_CHIP_RESET_IN_PROGRESS && + (options ==QLA_START_DPORT_TEST_V2 || + options ==QLA_RESTART_DPORT_TEST_V2 )) { + vha->dport_status &= ~DPORT_DIAG_CHIP_RESET_IN_PROGRESS ; + } + +/* Check chip reset in progress and get result request arrive */ +if (vha->dport_status &DPORT_DIAG_CHIP_RESET_IN_PROGRESS && + options ==QLA_GET_DPORT_RESULT_V2 ) { + bsg_reply->reply_data.vendor_reply.vendor_rsp[0 ] = +EXT_STATUS_DPORT_DIAG_NOT_RUNNING ; + goto dportcomplete; + } + + rval =qla26xx_dport_diagnostics_v2 (vha, dd, mcp); + +if (rval ==QLA_SUCCESS ) { + bsg_reply->reply_data.vendor_reply.vendor_rsp[0 ] = +EXT_STATUS_OK ; +if (options ==QLA_START_DPORT_TEST_V2 || + options ==QLA_RESTART_DPORT_TEST_V2 ) { + dd->mbx1 = mcp->mb[0 ]; + dd->mbx2 = mcp->mb[1 ]; + vha->dport_status |=DPORT_DIAG_IN_PROGRESS ; + }else if (options ==QLA_GET_DPORT_RESULT_V2 ) { + dd->mbx1 = vha->dport_data[1 ]; + dd->mbx2 = vha->dport_data[2 ]; + } + }else { + dd->mbx1 = mcp->mb[0 ]; + dd->mbx2 = mcp->mb[1 ]; + bsg_reply->reply_data.vendor_reply.vendor_rsp[0 ] = +EXT_STATUS_DPORT_DIAG_ERR ; + } + +dportcomplete: +sg_copy_from_buffer (bsg_job->reply_payload.sg_list, + bsg_job->reply_payload.sg_cnt, dd,sizeof (*dd)); + + bsg_reply->reply_payload_rcv_len =sizeof (*dd); + bsg_job->reply_len =sizeof (*bsg_reply); + bsg_reply->result =DID_OK <<16 ; +bsg_job_done (bsg_job, bsg_reply->result, + bsg_reply->reply_payload_rcv_len); + +kfree (dd); + +return 0 ; +} +static int qla2x00_get_flash_image_status (struct bsg_job *bsg_job) {
@@ -2860,6 +2943,9 @@ qla2x00_process_vendor_specific(struct scsi_qla_host *vha, struct bsg_job *bsg_jcase QL_VND_DPORT_DIAGNOSTICS :return qla2x00_do_dport_diagnostics (bsg_job); +case QL_VND_DPORT_DIAGNOSTICS_V2 : +return qla2x00_do_dport_diagnostics_v2 (bsg_job); +case QL_VND_EDIF_MGMT :return qla_edif_app_mgmt (bsg_job);
drivers/scsi/qla2xxx/qla_bsg.h +15 -0
@@ -37,6 +37,7 @@#define QL_VND_GET_TGT_STATS 0x25#define QL_VND_MANAGE_HOST_PORT 0x26#define QL_VND_MBX_PASSTHRU 0x2B +#define QL_VND_DPORT_DIAGNOSTICS_V2 0x2C/* BSG Vendor specific subcode returns */ #define EXT_STATUS_OK 0
@@ -60,6 +61,9 @@#define EXT_STATUS_TIMEOUT 30#define EXT_STATUS_THREAD_FAILED 31#define EXT_STATUS_DATA_CMP_FAILED 32 +#define EXT_STATUS_DPORT_DIAG_ERR 40 +#define EXT_STATUS_DPORT_DIAG_IN_PROCESS 41 +#define EXT_STATUS_DPORT_DIAG_NOT_RUNNING 42/* BSG definations for interpreting CommandSent field */ #define INT_DEF_LB_LOOPBACK_CMD 0
@@ -288,6 +292,17 @@ struct qla_dport_diag {uint8_t unused[62 ]; } __packed; +#define QLA_GET_DPORT_RESULT_V2 0/* Get Result */ +#define QLA_RESTART_DPORT_TEST_V2 1/* Restart test */ +#define QLA_START_DPORT_TEST_V2 2/* Start test */ +struct qla_dport_diag_v2 { +uint16_t options; +uint16_t mbx1; +uint16_t mbx2; +uint8_t unused[58 ]; +uint8_t buf[1024 ];/* Test Result */ +} __packed; +/* D_Port options */ #define QLA_DPORT_RESULT 0x0#define QLA_DPORT_START 0x2
drivers/scsi/qla2xxx/qla_def.h +10 -0
@@ -1173,6 +1173,12 @@ static inline bool qla2xxx_is_valid_mbs(unsigned int mbs)/* ISP mailbox loopback echo diagnostic error code */ #define MBS_LB_RESET 0x17 + +/* AEN mailbox Port Diagnostics test */ +#define AEN_START_DIAG_TEST 0x0/* start the diagnostics */ +#define AEN_DONE_DIAG_TEST_WITH_NOERR 0x1/* Done with no errors */ +#define AEN_DONE_DIAG_TEST_WITH_ERR 0x2/* Done with error.*/ +/* * Firmware options 1, 2, 3. */
@@ -5019,6 +5025,10 @@ typedef struct scsi_qla_host {u64 short_link_down_cnt;struct edif_dbell e_dbell;struct pur_core pur_cinfo; + +#define DPORT_DIAG_IN_PROGRESS BIT_0 +#define DPORT_DIAG_CHIP_RESET_IN_PROGRESS BIT_1 +uint16_t dport_status; } scsi_qla_host_t;struct qla27xx_image_status {
drivers/scsi/qla2xxx/qla_gbl.h +4 -0
@@ -555,6 +555,10 @@ qla2x00_dump_mctp_data(scsi_qla_host_t *, dma_addr_t, uint32_t, uint32_t);extern int qla26xx_dport_diagnostics (scsi_qla_host_t *,void *,uint ,uint ); +extern int +qla26xx_dport_diagnostics_v2 (scsi_qla_host_t *, +struct qla_dport_diag_v2 *,mbx_cmd_t *); +int qla24xx_send_mb_cmd (struct scsi_qla_host *,mbx_cmd_t *);int qla24xx_gpdb_wait (struct scsi_qla_host *,fc_port_t *,u8 ); int qla24xx_gidlist_wait(struct scsi_qla_host *, void *, dma_addr_t,
drivers/scsi/qla2xxx/qla_init.c +3 -0
@@ -7208,6 +7208,9 @@ qla2x00_abort_isp(scsi_qla_host_t *vha)if (vha->flags.online) {qla2x00_abort_isp_cleanup (vha); + vha->dport_status |=DPORT_DIAG_CHIP_RESET_IN_PROGRESS ; + vha->dport_status &= ~DPORT_DIAG_IN_PROGRESS ; +if (vha->hw->flags.port_isolated)return status;
drivers/scsi/qla2xxx/qla_isr.c +3 -0
@@ -1761,6 +1761,9 @@ qla2x00_async_event(scsi_qla_host_t *vha, struct rsp_que *rsp, uint16_t *mb)break ;case MBA_DPORT_DIAGNOSTICS : +if ((mb[1 ] &0xF ) ==AEN_DONE_DIAG_TEST_WITH_NOERR || + (mb[1 ] &0xF ) ==AEN_DONE_DIAG_TEST_WITH_ERR ) + vha->dport_status &= ~DPORT_DIAG_IN_PROGRESS ;ql_dbg (ql_dbg_async, vha,0x5052 ,"D-Port Diagnostics: %04x %04x %04x %04x\n" , mb[0 ], mb[1 ], mb[2 ], mb[3 ]);
drivers/scsi/qla2xxx/qla_mbx.c +48 -0
54 lines not on this page · raw message
Signature · 1 line
2.19.0.rc0
Nilesh Javali
maintainerPATCH 3/11 qla2xxx: Wind down adapter after pcie error
In reply to Nilesh JavaliFrom: Quinn Tran <[email protected]>
Put adapter into a wind down state if OS does not
make any attempt to recover the adapter after
PCIE error.
--- drivers/scsi/qla2xxx/qla_bsg.c | 10 ++++++- drivers/scsi/qla2xxx/qla_def.h | 4 +++ drivers/scsi/qla2xxx/qla_init.c | 20 ++++++++++++++ drivers/scsi/qla2xxx/qla_os.c | 48 +++++++++++++++++++++++++++++++++ 4 files changed, 81 insertions(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_bsg.c +9 -1
@@ -3061,6 +3061,13 @@ qla24xx_bsg_timeout(struct bsg_job *bsg_job)ql_log (ql_log_info, vha,0x708b ,"%s CMD timeout. bsg ptr %p.\n" , __func__, bsg_job); + +if (qla2x00_isp_reg_stat (ha)) { +ql_log (ql_log_info, vha,0x9007 , +"PCI/Register disconnect.\n" ); +qla_pci_set_eeh_busy (vha); + } +/* find the bsg job from the active list of commands */ spin_lock_irqsave (&ha->hardware_lock, flags);for (que =0 ; que < ha->max_req_queues; que++) {
@@ -3078,7 +3085,8 @@ qla24xx_bsg_timeout(struct bsg_job *bsg_job) sp->u.bsg_job == bsg_job) { req->outstanding_cmds[cnt] =NULL ;spin_unlock_irqrestore (&ha->hardware_lock, flags); -if (ha->isp_ops->abort_command (sp)) { + +if (!ha->flags.eeh_busy && ha->isp_ops->abort_command (sp)) {ql_log (ql_log_warn, vha,0x7089 ,"mbx abort_command failed.\n" ); bsg_reply->result = -EIO ;
drivers/scsi/qla2xxx/qla_def.h +4 -0
@@ -4053,6 +4053,9 @@ struct qla_hw_data { uint32_t n2n_fw_acc_sec:1; uint32_t plogi_template_valid:1; uint32_t port_isolated:1; + uint32_t eeh_flush:2; +#define EEH_FLUSH_RDY 1 +#define EEH_FLUSH_DONE 2 } flags;uint16_t max_exchg;
@@ -4087,6 +4090,7 @@ struct qla_hw_data {uint32_t rsp_que_len;uint32_t req_que_off;uint32_t rsp_que_off; +unsigned long eeh_jif;/* Multi queue data structs */ device_reg_t *mqiobase;
drivers/scsi/qla2xxx/qla_init.c +20 -0
@@ -47,6 +47,7 @@ qla2x00_sp_timeout(struct timer_list *t) {srb_t *sp =from_timer (sp, t, u.iocb_cmd.timer);struct srb_iocb *iocb; +scsi_qla_host_t *vha = sp->vha;WARN_ON (irqs_disabled ()); iocb = &sp->u.iocb_cmd;
@@ -54,6 +55,12 @@ qla2x00_sp_timeout(struct timer_list *t)/* ref: TMR */ kref_put (&sp->cmd_kref, qla2x00_sp_release); + +if (vha &&qla2x00_isp_reg_stat (vha->hw)) { +ql_log (ql_log_info, vha,0x9008 , +"PCI/Register disconnect.\n" ); +qla_pci_set_eeh_busy (vha); + } }void qla2x00_sp_free (srb_t *sp)
@@ -9671,6 +9678,12 @@ int qla2xxx_disable_port(struct Scsi_Host *host) vha->hw->flags.port_isolated =1 ; +if (qla2x00_isp_reg_stat (vha->hw)) { +ql_log (ql_log_info, vha,0x9006 , +"PCI/Register disconnect, exiting.\n" ); +qla_pci_set_eeh_busy (vha); +return FAILED ; + }if (qla2x00_chip_is_down (vha))return 0 ;
@@ -9686,6 +9699,13 @@ int qla2xxx_enable_port(struct Scsi_Host *host) {scsi_qla_host_t *vha =shost_priv (host); +if (qla2x00_isp_reg_stat (vha->hw)) { +ql_log (ql_log_info, vha,0x9001 , +"PCI/Register disconnect, exiting.\n" ); +qla_pci_set_eeh_busy (vha); +return FAILED ; + } + vha->hw->flags.port_isolated =0 ;/* Set the flag to 1, so that isp_abort can proceed */ vha->flags.online =1 ;
drivers/scsi/qla2xxx/qla_os.c +48 -0
72 lines not on this page · raw message
Signature · 1 line
2.19.0.rc0
Nilesh Javali
maintainerPATCH 4/11 qla2xxx: Turn off multi-queue for 8G adapter
In reply to Nilesh JavaliFrom: Quinn Tran <[email protected]>
For 8G adapter, multi-queue was enabled accidentally. This patch make sure multi-queue is not enabled accidentally.
--- drivers/scsi/qla2xxx/qla_def.h | 4 ++-- drivers/scsi/qla2xxx/qla_isr.c | 16 ++++++---------- 2 files changed, 8 insertions(+), 12 deletions(-)
drivers/scsi/qla2xxx/qla_def.h +2 -2
@@ -4273,8 +4273,8 @@ struct qla_hw_data {#define IS_OEM_001 (ha) ((ha)->device_type & DT_OEM_001)#define HAS_EXTENDED_IDS (ha) ((ha)->device_type & DT_EXTENDED_IDS)#define IS_CT6_SUPPORTED (ha) ((ha)->device_type & DT_CT6_SUPPORTED) -#define IS_MQUE_CAPABLE (ha) ((ha)->mqenable || IS_QLA83XX(ha) || \ - IS_QLA27XX(ha) || IS_QLA28XX(ha)) +#define IS_MQUE_CAPABLE (ha) (IS_QLA83XX(ha) || IS_QLA27XX(ha) || \ + IS_QLA28XX(ha))#define IS_BIDI_CAPABLE (ha) \ (IS_QLA25XX(ha) || IS_QLA2031(ha) || IS_QLA27XX(ha) || IS_QLA28XX(ha))/* Bit 21 of fw_attributes decides the MCTP capabilities */
drivers/scsi/qla2xxx/qla_isr.c +6 -10
@@ -4430,16 +4430,12 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp) }/* Enable MSI-X vector for response queue update for queue 0 */ -if (IS_QLA83XX (ha) ||IS_QLA27XX (ha) ||IS_QLA28XX (ha)) { -if (ha->msixbase && ha->mqiobase && - (ha->max_rsp_queues >1 || ha->max_req_queues >1 || - ql2xmqsupport)) - ha->mqenable =1 ; - }else -if (ha->mqiobase && - (ha->max_rsp_queues >1 || ha->max_req_queues >1 || - ql2xmqsupport)) - ha->mqenable =1 ; +if (IS_MQUE_CAPABLE (ha) && + (ha->msixbase && ha->mqiobase && ha->max_qpairs)) + ha->mqenable =1 ; +else + ha->mqenable =0 ; +ql_dbg (ql_dbg_multiq, vha,0xc005 ,"mqiobase=%p, max_rsp_queues=%d, max_req_queues=%d.\n" , ha->mqiobase, ha->max_rsp_queues, ha->max_req_queues);
Signature · 1 line
2.19.0.rc0
Nilesh Javali
maintainerPATCH 5/11 qla2xxx: Fix crash due to stale srb access around IO timeouts
In reply to Nilesh JavaliFrom: Arun Easi <[email protected]>
Ensure srb is returned during IO timeout error escalation. If that is not possible fail the escalation path.
Following crash stack was seen:
BUG: unable to handle kernel paging request at 0000002f56aa90f8 IP: qla_chk_edif_rx_sa_delete_pending+0x14/0x30 [qla2xxx] Call Trace: ? qla2x00_status_entry+0x19f/0x1c50 [qla2xxx] ? qla2x00_start_sp+0x116/0x1170 [qla2xxx] ? dma_pool_alloc+0x1d6/0x210 ? mempool_alloc+0x54/0x130 ? qla24xx_process_response_queue+0x548/0x12b0 [qla2xxx] ? qla_do_work+0x2d/0x40 [qla2xxx] ? process_one_work+0x14c/0x390
--- drivers/scsi/qla2xxx/qla_os.c | 41 +++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 11 deletions(-)
drivers/scsi/qla2xxx/qla_os.c +30 -11
@@ -1342,21 +1342,20 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)/* * Returns: QLA_SUCCESS or QLA_FUNCTION_FAILED. */ -int -qla2x00_eh_wait_for_pending_commands (scsi_qla_host_t *vha,unsigned int t, -uint64_t l,enum nexus_wait_type type) +static int +__qla2x00_eh_wait_for_pending_commands (struct qla_qpair *qpair,unsigned int t, +uint64_t l,enum nexus_wait_type type) {int cnt, match, status;unsigned long flags; -struct qla_hw_data *ha = vha->hw; -struct req_que *req; +scsi_qla_host_t *vha = qpair->vha; +struct req_que *req = qpair->req;srb_t *sp;struct scsi_cmnd *cmd; status =QLA_SUCCESS ; -spin_lock_irqsave (&ha->hardware_lock, flags); - req = vha->req; +spin_lock_irqsave (qpair->qp_lock_ptr, flags);for (cnt =1 ; status ==QLA_SUCCESS && cnt < req->num_outstanding_cmds; cnt++) { sp = req->outstanding_cmds[cnt];
@@ -1383,12 +1382,32 @@ qla2x00_eh_wait_for_pending_commands(scsi_qla_host_t *vha, unsigned int t,if (!match)continue ; -spin_unlock_irqrestore (&ha->hardware_lock, flags); +spin_unlock_irqrestore (qpair->qp_lock_ptr, flags); status =qla2x00_eh_wait_on_command (cmd); -spin_lock_irqsave (&ha->hardware_lock, flags); +spin_lock_irqsave (qpair->qp_lock_ptr, flags); } -spin_unlock_irqrestore (&ha->hardware_lock, flags); +spin_unlock_irqrestore (qpair->qp_lock_ptr, flags); + +return status; +} + +int +qla2x00_eh_wait_for_pending_commands (scsi_qla_host_t *vha,unsigned int t, +uint64_t l,enum nexus_wait_type type) +{ +struct qla_qpair *qpair; +struct qla_hw_data *ha = vha->hw; +int i, status =QLA_SUCCESS ; + status =__qla2x00_eh_wait_for_pending_commands (ha->base_qpair, t, l, + type); +for (i =0 ; status ==QLA_SUCCESS && i < ha->max_qpairs; i++) { + qpair = ha->queue_pair_map[i]; +if (!qpair) +continue ; + status =__qla2x00_eh_wait_for_pending_commands (qpair, t, l, + type); + }return status; }
@@ -1425,7 +1444,7 @@ qla2xxx_eh_device_reset(struct scsi_cmnd *cmd)return err;if (fcport->deleted) -return SUCCESS ; +return FAILED ; ql_log(ql_log_info, vha, 0x8009, "DEVICE RESET ISSUED nexus=%ld:%d:%llu cmd=%p.\n", vha->host_no,
Signature · 1 line
2.19.0.rc0
Nilesh Javali
maintainerRE: [PATCH 05/11] qla2xxx: Fix crash due to stale srb access around IO timeouts
Hi Martin,
I have a v2 of this patch with additional change.
Please ignore this series and I will send the v2.
Thanks,
Nilesh
Quoted 122 lines
-----Original Message-----
From: Nilesh Javali <[email protected]>
Sent: Tuesday, June 14, 2022 1:00 PM
To: [email protected]
Cc: [email protected]; GR-QLogic-Storage-Upstream <GR-QLogic- [email protected]>
Subject: [PATCH 05/11] qla2xxx: Fix crash due to stale srb access around IO timeoutsFrom: Arun Easi <[email protected]>
Ensure srb is returned during IO timeout error escalation. If that is not possible fail the escalation path.
Following crash stack was seen:
BUG: unable to handle kernel paging request at 0000002f56aa90f8 IP: qla_chk_edif_rx_sa_delete_pending+0x14/0x30 [qla2xxx] Call Trace: ? qla2x00_status_entry+0x19f/0x1c50 [qla2xxx] ? qla2x00_start_sp+0x116/0x1170 [qla2xxx] ? dma_pool_alloc+0x1d6/0x210 ? mempool_alloc+0x54/0x130 ? qla24xx_process_response_queue+0x548/0x12b0 [qla2xxx] ? qla_do_work+0x2d/0x40 [qla2xxx] ? process_one_work+0x14c/0x390Fixes d74595278f4a ("scsi: qla2xxx: Add multiple queue pair functionality.)Signed-off-by Arun Easi <[email protected]>Signed-off-by Nilesh Javali <[email protected]>--- drivers/scsi/qla2xxx/qla_os.c | 41 +++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 11 deletions(-)drivers/scsi/qla2xxx/qla_os.c +6
-7@@ -1342,21 +1342,20 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)/* * Returns: QLA_SUCCESS or QLA_FUNCTION_FAILED. */ -int -qla2x00_eh_wait_for_pending_commands (scsi_qla_host_t *vha,unsigned int t, -uint64_t l,enum nexus_wait_type type) +static int +__qla2x00_eh_wait_for_pending_commands(struct qla_qpair *qpair, unsigned int t, + uint64_t l, enum nexus_wait_type type) { int cnt, match, status;unsigned long flags; -struct qla_hw_data *ha = vha->hw; -struct req_que *req; +scsi_qla_host_t *vha = qpair->vha; +struct req_que *req = qpair->req;srb_t *sp;struct scsi_cmnd *cmd; status =QLA_SUCCESS ; -spin_lock_irqsave (&ha->hardware_lock, flags); - req = vha->req; +spin_lock_irqsave (qpair->qp_lock_ptr, flags); for (cnt = 1; status == QLA_SUCCESS &&drivers/scsi/qla2xxx/qla_os.c +0
-0cnt < req->num_outstanding_cmds; cnt++) { sp = req->outstanding_cmds[cnt];@@ -1383,12 +1382,32 @@qla2x00_eh_wait_for_pending_commands(scsi_qla_host_t *vha, unsigned int t,
drivers/scsi/qla2xxx/qla_os.c +9
-3if (!match)continue ; -spin_unlock_irqrestore (&ha->hardware_lock, flags); +spin_unlock_irqrestore (qpair->qp_lock_ptr, flags); status =qla2x00_eh_wait_on_command (cmd); -spin_lock_irqsave (&ha->hardware_lock, flags); +spin_lock_irqsave (qpair->qp_lock_ptr, flags); } -spin_unlock_irqrestore (&ha->hardware_lock, flags); +spin_unlock_irqrestore (qpair->qp_lock_ptr, flags); + +return status; +} + +int +qla2x00_eh_wait_for_pending_commands(scsi_qla_host_t *vha, unsignedint t,
drivers/scsi/qla2xxx/qla_os.c +6
-0+ uint64_t l, enum nexus_wait_type type) +{ +struct qla_qpair *qpair; +struct qla_hw_data *ha = vha->hw; +int i, status =QLA_SUCCESS ; + status = __qla2x00_eh_wait_for_pending_commands(ha-Quoted 1 line
base_qpair, t, l,drivers/scsi/qla2xxx/qla_os.c +6
-0+ type); +for (i =0 ; status ==QLA_SUCCESS && i < ha->max_qpairs; i++) { + qpair = ha->queue_pair_map[i]; +if (!qpair) +continue ; + status = __qla2x00_eh_wait_for_pending_commands(qpair,t, l,
drivers/scsi/qla2xxx/qla_os.c +3
-1+ type); + }return status; }@@ -1425,7 +1444,7 @@ qla2xxx_eh_device_reset(struct scsi_cmnd *cmd)return err;if (fcport->deleted) -return SUCCESS ; +return FAILED ; ql_log(ql_log_info, vha, 0x8009, "DEVICE RESET ISSUED nexus=%ld:%d:%llu cmd=%p.\n", vha-Quoted 1 line
host_no,--
2.19.0.rc0
Nilesh Javali
maintainerPATCH 6/11 qla2xxx: Fix losing FCP-2 targets during port perturbation tests
In reply to Nilesh JavaliFrom: Arun Easi <[email protected]>
When a mix of FCP-2 (tape) and non-FCP-2 targets are present, FCP-2 target state was incorrectly transitioned when both of the targets were gone. Fix this by ignoring state transition for FCP-2 targets.
--- drivers/scsi/qla2xxx/qla_gs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_gs.c +1 -1
@@ -3632,7 +3632,7 @@ void qla24xx_async_gnnft_done(scsi_qla_host_t *vha, srb_t *sp) do_delete) {if (fcport->loop_id !=FC_NO_LOOP_ID ) {if (fcport->flags &FCF_FCP2_DEVICE ) - fcport->logout_on_delete =0 ; +continue ; ql_log(ql_log_warn, vha, 0x20f0, "%s %d %8phC post del sess\n",
Signature · 1 line
2.19.0.rc0
Nilesh Javali
maintainerPATCH 7/11 qla2xxx: Fix losing target when it reappears during delete
In reply to Nilesh JavaliFrom: Arun Easi <[email protected]>
FC target disappeared during port perturbation tests due to a race that tramples target state.
Fix the issue by adding state checks before proceeding.
--- drivers/scsi/qla2xxx/qla_attr.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-)
drivers/scsi/qla2xxx/qla_attr.c +17 -7
@@ -2714,17 +2714,24 @@ qla2x00_dev_loss_tmo_callbk(struct fc_rport *rport)if (!fcport)return ; -/* Now that the rport has been deleted, set the fcport state to -FCS_DEVICE_DEAD */ -qla2x00_set_fcport_state (fcport,FCS_DEVICE_DEAD ); + +/* +* Now that the rport has been deleted, set the fcport state to +* FCS_DEVICE_DEAD, if the fcport is still lost. +*/ +if (fcport->scan_state !=QLA_FCPORT_FOUND ) +qla2x00_set_fcport_state (fcport,FCS_DEVICE_DEAD );/* * Transport has effectively 'deleted' the rport, clear * all local references. */ spin_lock_irqsave (host->host_lock, flags); - fcport->rport = fcport->drport =NULL ; - *((fc_port_t **)rport->dd_data) =NULL ; +/* Confirm port has not reappeared before clearing pointers. */ +if (rport->port_state !=FC_PORTSTATE_ONLINE ) { + fcport->rport = fcport->drport =NULL ; + *((fc_port_t **)rport->dd_data) =NULL ; + }spin_unlock_irqrestore (host->host_lock, flags);if (test_bit (ABORT_ISP_ACTIVE , &fcport->vha->dpc_flags))
@@ -2757,9 +2764,12 @@ qla2x00_terminate_rport_io(struct fc_rport *rport)/* * At this point all fcport's software-states are cleared. Perform any * final cleanup of firmware resources (PCBs and XCBs). +* +* Attempt to cleanup only lost devices. */ if (fcport->loop_id !=FC_NO_LOOP_ID ) { -if (IS_FWI2_CAPABLE (fcport->vha->hw)) { +if (IS_FWI2_CAPABLE (fcport->vha->hw) && + fcport->scan_state !=QLA_FCPORT_FOUND ) {if (fcport->loop_id !=FC_NO_LOOP_ID ) fcport->logout_on_delete =1 ;
@@ -2769,7 +2779,7 @@ qla2x00_terminate_rport_io(struct fc_rport *rport) __LINE__);qlt_schedule_sess_for_deletion (fcport); } - }else { + }else if (!IS_FWI2_CAPABLE (fcport->vha->hw)) {qla2x00_port_logout (fcport->vha, fcport); } }
Signature · 1 line
2.19.0.rc0
Nilesh Javali
maintainerPATCH 8/11 qla2xxx: Add debug prints in the device remove path
In reply to Nilesh JavaliFrom: Arun Easi <[email protected]>
Add a debug print in the devloss callback.
--- drivers/scsi/qla2xxx/qla_attr.c | 3 +++ drivers/scsi/qla2xxx/qla_def.h | 6 ++++++ 2 files changed, 9 insertions(+)
drivers/scsi/qla2xxx/qla_attr.c +3 -0
@@ -2714,6 +2714,9 @@ qla2x00_dev_loss_tmo_callbk(struct fc_rport *rport)if (!fcport)return ; +ql_dbg (ql_dbg_async, fcport->vha,0x5101 , +DBG_FCPORT_PRFMT (fcport,"dev_loss_tmo expiry, rport_state=%d" , + rport->port_state));/* * Now that the rport has been deleted, set the fcport state to
drivers/scsi/qla2xxx/qla_def.h +6 -0
@@ -5464,4 +5464,10 @@ struct ql_vnd_tgt_stats_resp {#define IS_SESSION_DELETED (_fcport) (_fcport->disc_state == DSC_DELETE_PEND || \ _fcport->disc_state == DSC_DELETED) +#define DBG_FCPORT_PRFMT(_fp, _fmt, _args...) \ + "%s: %8phC: " _fmt " (state=%d disc_state=%d scan_state=%d loopid=0x%x deleted=%d flags=0x%x)\n", \ + __func__, _fp->port_name, ##_args, atomic_read(&_fp->state), \ + _fp->disc_state, _fp->scan_state, _fp->loop_id, _fp->deleted, \ + _fp->flags +#endif
Signature · 1 line
2.19.0.rc0
Nilesh Javali
maintainerPATCH 9/11 qla2xxx: Fix losing FCP-2 targets on long port disable with IOs
In reply to Nilesh JavaliFrom: Arun Easi <[email protected]>
FCP-2 devices were not coming back online once it was lost, login retries exhausted and then came back up. Fix this by accepting RSCN when the device is not online.
--- drivers/scsi/qla2xxx/qla_init.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/scsi/qla2xxx/qla_init.c +8 -4
@@ -1832,7 +1832,8 @@ void qla2x00_handle_rscn(scsi_qla_host_t *vha, struct event_arg *ea)case RSCN_PORT_ADDR : fcport =qla2x00_find_fcport_by_nportid (vha, &ea->id,1 );if (fcport) { -if (fcport->flags &FCF_FCP2_DEVICE ) { +if (fcport->flags &FCF_FCP2_DEVICE && +atomic_read (&fcport->state) ==FCS_ONLINE ) {ql_dbg (ql_dbg_disc, vha,0x2115 ,"Delaying session delete for FCP2 portid=%06x %8phC " , fcport->d_id.b24, fcport->port_name);
@@ -1864,7 +1865,8 @@ void qla2x00_handle_rscn(scsi_qla_host_t *vha, struct event_arg *ea)break ;case RSCN_AREA_ADDR :list_for_each_entry (fcport, &vha->vp_fcports, list) { -if (fcport->flags &FCF_FCP2_DEVICE ) +if (fcport->flags &FCF_FCP2_DEVICE && +atomic_read (&fcport->state) ==FCS_ONLINE )continue ;if ((ea->id.b24 &0xffff00 ) == (fcport->d_id.b24 &0xffff00 )) {
@@ -1875,7 +1877,8 @@ void qla2x00_handle_rscn(scsi_qla_host_t *vha, struct event_arg *ea)break ;case RSCN_DOM_ADDR :list_for_each_entry (fcport, &vha->vp_fcports, list) { -if (fcport->flags &FCF_FCP2_DEVICE ) +if (fcport->flags &FCF_FCP2_DEVICE && +atomic_read (&fcport->state) ==FCS_ONLINE )continue ;if ((ea->id.b24 &0xff0000 ) == (fcport->d_id.b24 &0xff0000 )) {
@@ -1887,7 +1890,8 @@ void qla2x00_handle_rscn(scsi_qla_host_t *vha, struct event_arg *ea)case RSCN_FAB_ADDR :default :list_for_each_entry (fcport, &vha->vp_fcports, list) { -if (fcport->flags &FCF_FCP2_DEVICE ) +if (fcport->flags &FCF_FCP2_DEVICE && +atomic_read (&fcport->state) ==FCS_ONLINE )continue ; fcport->scan_needed =1 ;
Signature · 1 line
2.19.0.rc0
Nilesh Javali
maintainerPATCH 10/11 qla2xxx: Fix erroneous mailbox timeout after pci error inject
In reply to Nilesh JavaliFrom: Quinn Tran <[email protected]>
Clear wait for mailbox interrupt flag to prevent stale mailbox
Feb 22 05:22:56 ltcden4-lp7 kernel: qla2xxx [0135:90:00.1]-500a:4: LOOP UP detected (16 Gbps). Feb 22 05:22:59 ltcden4-lp7 kernel: qla2xxx [0135:90:00.1]-d04c:4: MBX Command timeout for cmd 69, ...
To fix the issue, driver need to clear the MBX_INTR_WAIT flag on purging the mailbox. When the stale mailbox completion do arrive, it will be dropped.
--- drivers/scsi/qla2xxx/qla_mbx.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/scsi/qla2xxx/qla_mbx.c +6 -6
@@ -274,6 +274,12 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp)atomic_inc (&ha->num_pend_mbx_stage3);if (!wait_for_completion_timeout (&ha->mbx_intr_comp, mcp->tov *HZ )) { +ql_dbg (ql_dbg_mbx, vha,0x117a , +"cmd=%x Timeout.\n" , command); +spin_lock_irqsave (&ha->hardware_lock, flags); +clear_bit (MBX_INTR_WAIT , &ha->mbx_cmd_flags); +spin_unlock_irqrestore (&ha->hardware_lock, flags); +if (chip_reset != ha->chip_reset) { eeh_delay = ha->flags.eeh_busy ?1 :0 ;
@@ -286,12 +292,6 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp) rval =QLA_ABORTED ; goto premature_exit; } -ql_dbg (ql_dbg_mbx, vha,0x117a , -"cmd=%x Timeout.\n" , command); -spin_lock_irqsave (&ha->hardware_lock, flags); -clear_bit (MBX_INTR_WAIT , &ha->mbx_cmd_flags); -spin_unlock_irqrestore (&ha->hardware_lock, flags); - }else if (ha->flags.purge_mbox || chip_reset != ha->chip_reset) { eeh_delay = ha->flags.eeh_busy ?1 :0 ;
Signature · 1 line
2.19.0.rc0
Nilesh Javali
maintainerPATCH 11/11 qla2xxx: Update version to 10.02.07.700-k
In reply to Nilesh Javali--- drivers/scsi/qla2xxx/qla_version.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/qla2xxx/qla_version.h +2 -2
@@ -6,9 +6,9 @@/* * Driver version */ -#define QLA2XXX_VERSION "10.02.07.600-k" +#define QLA2XXX_VERSION "10.02.07.700-k"#define QLA_DRIVER_MAJOR_VER 10#define QLA_DRIVER_MINOR_VER 2#define QLA_DRIVER_PATCH_VER 7 -#define QLA_DRIVER_BETA_VER 600 +#define QLA_DRIVER_BETA_VER 700
Signature · 1 line
2.19.0.rc0