Skip to contentSkip to conversation

qla2xxx bug fixes

PATCH Superseded Nilesh Javali 2 participants 15 messages Sep 28, 2020

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Nilesh Javali

author maintainer
#0 lore raw

cover qla2xxx bug fixes

Martin,

Please apply the qla2xxx bug fixes to the scsi tree at your earliest convenience.

Thanks,
Nilesh

Arun Easi (3):
qla2xxx: Fix MPI reset needed message.
qla2xxx: Fix reset of MPI firmware.
qla2xxx: Fix point-to-point (N2N) device discovery issue.

Nilesh Javali (1):
qla2xxx: Update version to 10.02.00.103-k

Quinn Tran (2):
qla2xxx: Fix buffer-buffer credit extraction error
qla2xxx: fix crash on session cleanup with unload.

Saurav Kashyap (1):
qla2xxx: Correct the check for sscanf return value

 drivers/scsi/qla2xxx/qla_attr.c    | 10 ++++--
 drivers/scsi/qla2xxx/qla_def.h     |  6 +++-
 drivers/scsi/qla2xxx/qla_gbl.h     |  1 -
 drivers/scsi/qla2xxx/qla_init.c    | 51 ++++++++++++++--------------
 drivers/scsi/qla2xxx/qla_iocb.c    |  3 +-
 drivers/scsi/qla2xxx/qla_isr.c     |  2 +-
 drivers/scsi/qla2xxx/qla_mbx.c     | 42 ++---------------------
 drivers/scsi/qla2xxx/qla_os.c      | 21 ++++--------
 drivers/scsi/qla2xxx/qla_target.c  | 13 ++++----
 drivers/scsi/qla2xxx/qla_tmpl.c    | 53 +++++++++---------------------
 drivers/scsi/qla2xxx/qla_version.h |  4 +--
 11 files changed, 74 insertions(+), 132 deletions(-)

base-commit: c1a3bf99d76e5ae5537265433def019a34a9dac0

Signature · 1 line
2.23.1
author maintainer
#1 lore raw

PATCH 1/7 qla2xxx: Correct the check for sscanf return value

From: Saurav Kashyap <[email protected]>

Since the version string is modified sscanf returns 4 instead of 6.

---
 drivers/scsi/qla2xxx/qla_tmpl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/qla2xxx/qla_tmpl.c +2 -2
index 8dc82cfd38b2..591df89a4d13 100644
@@ -906,8 +906,8 @@ qla27xx_driver_info(struct qla27xx_fwdt_template *tmp)
 	uint8_t v[] = { 0, 0, 0, 0, 0, 0 };
 
 	WARN_ON_ONCE(sscanf(qla2x00_version_str,
-			    "%hhu.%hhu.%hhu.%hhu.%hhu.%hhu",
-			    v+0, v+1, v+2, v+3, v+4, v+5) != 6);
+			    "%hhu.%hhu.%hhu.%hhu",
+			    v + 0, v + 1, v + 2, v + 3) != 4);
 
 	tmp->driver_info[0] = cpu_to_le32(
 		v[3] << 24 | v[2] << 16 | v[1] << 8 | v[0]);
Signature · 1 line
2.19.0.rc0
Reviewed-by on v1 1/7
#2 lore raw

Re: [PATCH 1/7] qla2xxx: Correct the check for sscanf return value

Quoted 16 lines · Nilesh Javali

From: Saurav Kashyap <[email protected]>

Since the version string is modified sscanf returns 4 instead of 6.

---
  drivers/scsi/qla2xxx/qla_tmpl.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/qla2xxx/qla_tmpl.c +0 -0
index 8dc82cfd38b2..591df89a4d13 100644

drivers/scsi/qla2xxx/qla_tmpl.c qla27xx_driver_info(struct qla27xx_fwdt_template *tmp) · line 913

Quoted 10 lines
drivers/scsi/qla2xxx/qla_tmpl.c +2 -2
@@ -906,8 +906,8 @@ qla27xx_driver_info(struct qla27xx_fwdt_template *tmp)
  	uint8_t v[] = { 0, 0, 0, 0, 0, 0 };
 
  	WARN_ON_ONCE(sscanf(qla2x00_version_str,
-			    "%hhu.%hhu.%hhu.%hhu.%hhu.%hhu",
-			    v+0, v+1, v+2, v+3, v+4, v+5) != 6);
+			    "%hhu.%hhu.%hhu.%hhu",
+			    v + 0, v + 1, v + 2, v + 3) != 4);
 
  	tmp->driver_info[0] = cpu_to_le32(
  		v[3] << 24 | v[2] << 16 | v[1] << 8 | v[0]);

Looks good.

Signature · 1 line
Himanshu Madhani                         Oracle Linux Engineering
author maintainer
#3 lore raw

PATCH 2/7 qla2xxx: Fix buffer-buffer credit extraction error

In reply to Nilesh Javali

From: Quinn Tran <[email protected]>

Current code uses wrong mailbox option to extract bbc from fw. This field is nested inside of Plogi payload. Extract bbc from PLOGI template payload.

---
 drivers/scsi/qla2xxx/qla_def.h  |  4 ++-
 drivers/scsi/qla2xxx/qla_init.c | 49 +++++++++++++++++----------------
 drivers/scsi/qla2xxx/qla_iocb.c |  3 +-
 drivers/scsi/qla2xxx/qla_mbx.c  | 39 --------------------------
 drivers/scsi/qla2xxx/qla_os.c   | 19 +++----------
 5 files changed, 33 insertions(+), 81 deletions(-)
drivers/scsi/qla2xxx/qla_def.h +3 -1
index fa31301528bd..98814a9a8ea6 100644
@@ -3915,6 +3915,7 @@ struct qla_hw_data {
 				/* Enabled in Driver */
 		uint32_t	scm_enabled:1;
 		uint32_t	max_req_queue_warned:1;
+		uint32_t	plogi_template_valid:1;
 	} flags;
 
 	uint16_t max_exchg;
@@ -4263,7 +4264,8 @@ struct qla_hw_data {
 	int 		exchoffld_count;
 
 	/* n2n */
-	struct els_plogi_payload plogi_els_payld;
+	struct fc_els_flogi plogi_els_payld;
+#define LOGIN_TEMPLATE_SIZE (sizeof(struct fc_els_flogi) - 4)
 
 	void            *swl;
 
drivers/scsi/qla2xxx/qla_init.c +25 -24

76 lines not on this page · raw message

drivers/scsi/qla2xxx/qla_iocb.c +1 -2
index 310db7e4e233..3202c9ca42f6 100644
@@ -3013,8 +3013,7 @@ qla24xx_els_dcmd2_iocb(scsi_qla_host_t *vha, int els_opcode,
 	memset(ptr, 0, sizeof(struct els_plogi_payload));
 	memset(resp_ptr, 0, sizeof(struct els_plogi_payload));
 	memcpy(elsio->u.els_plogi.els_plogi_pyld->data,
-	    &ha->plogi_els_payld.data,
-	    sizeof(elsio->u.els_plogi.els_plogi_pyld->data));
+	    &ha->plogi_els_payld.fl_csp, LOGIN_TEMPLATE_SIZE);
 
 	elsio->u.els_plogi.els_cmd = els_opcode;
 	elsio->u.els_plogi.els_plogi_pyld->opcode = els_opcode;
drivers/scsi/qla2xxx/qla_mbx.c +0 -39
index 92166b86369a..d861d025bce1 100644
@@ -4979,45 +4979,6 @@ qla25xx_set_els_cmds_supported(scsi_qla_host_t *vha)
 	return rval;
 }
 
-int
-qla24xx_get_buffer_credits(scsi_qla_host_t *vha, struct buffer_credit_24xx *bbc,
-	dma_addr_t bbc_dma)
-{
-	mbx_cmd_t mc;
-	mbx_cmd_t *mcp = &mc;
-	int rval;
-
-	if (!IS_FWI2_CAPABLE(vha->hw))
-		return QLA_FUNCTION_FAILED;
-
-	ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x118e,
-	    "Entered %s.\n", __func__);
-
-	mcp->mb[0] = MBC_GET_RNID_PARAMS;
-	mcp->mb[1] = RNID_BUFFER_CREDITS << 8;
-	mcp->mb[2] = MSW(LSD(bbc_dma));
-	mcp->mb[3] = LSW(LSD(bbc_dma));
-	mcp->mb[6] = MSW(MSD(bbc_dma));
-	mcp->mb[7] = LSW(MSD(bbc_dma));
-	mcp->mb[8] = sizeof(*bbc) / sizeof(*bbc->parameter);
-	mcp->out_mb = MBX_8|MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0;
-	mcp->in_mb = MBX_1|MBX_0;
-	mcp->buf_size = sizeof(*bbc);
-	mcp->flags = MBX_DMA_IN;
-	mcp->tov = MBX_TOV_SECONDS;
-	rval = qla2x00_mailbox_command(vha, mcp);
-
-	if (rval != QLA_SUCCESS) {
-		ql_dbg(ql_dbg_mbx, vha, 0x118f,
-		    "Failed=%x mb[0]=%x,%x.\n", rval, mcp->mb[0], mcp->mb[1]);
-	} else {
-		ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x1190,
-		    "Done %s.\n", __func__);
-	}
-
-	return rval;
-}
-
 static int
 qla2x00_read_asic_temperature(scsi_qla_host_t *vha, uint16_t *temp)
 {
drivers/scsi/qla2xxx/qla_os.c +4 -15
index b943b2f1df6b..6c4dc8eff8b8 100644
@@ -5837,12 +5837,10 @@ void qla24xx_process_purex_rdp(struct scsi_qla_host *vha,
 	dma_addr_t rsp_els_dma;
 	dma_addr_t rsp_payload_dma;
 	dma_addr_t stat_dma;
-	dma_addr_t bbc_dma;
 	dma_addr_t sfp_dma;
 	struct els_entry_24xx *rsp_els = NULL;
 	struct rdp_rsp_payload *rsp_payload = NULL;
 	struct link_statistics *stat = NULL;
-	struct buffer_credit_24xx *bbc = NULL;
 	uint8_t *sfp = NULL;
 	uint16_t sfp_flags = 0;
 	uint rsp_payload_length = sizeof(*rsp_payload);
@@ -5886,9 +5884,6 @@ void qla24xx_process_purex_rdp(struct scsi_qla_host *vha,
 	stat = dma_alloc_coherent(&ha->pdev->dev, sizeof(*stat),
 	    &stat_dma, GFP_KERNEL);
 
-	bbc = dma_alloc_coherent(&ha->pdev->dev, sizeof(*bbc),
-	    &bbc_dma, GFP_KERNEL);
-
 	/* Prepare Response IOCB */
 	rsp_els->entry_type = ELS_IOCB_TYPE;
 	rsp_els->entry_count = 1;
@@ -6042,13 +6037,10 @@ void qla24xx_process_purex_rdp(struct scsi_qla_host *vha,
 	rsp_payload->buffer_credit_desc.attached_fcport_b2b = cpu_to_be32(0);
 	rsp_payload->buffer_credit_desc.fcport_rtt = cpu_to_be32(0);
 
-	if (bbc) {
-		memset(bbc, 0, sizeof(*bbc));
-		rval = qla24xx_get_buffer_credits(vha, bbc, bbc_dma);
-		if (!rval) {
-			rsp_payload->buffer_credit_desc.fcport_b2b =
-			    cpu_to_be32(LSW(bbc->parameter[0]));
-		}
+	if (ha->flags.plogi_template_valid) {
+		uint32_t tmp =
+		be16_to_cpu(ha->plogi_els_payld.fl_csp.sp_bb_cred);
+		rsp_payload->buffer_credit_desc.fcport_b2b = cpu_to_be32(tmp);
 	}
 
 	if (rsp_payload_length < sizeof(*rsp_payload))
@@ -6226,9 +6218,6 @@ void qla24xx_process_purex_rdp(struct scsi_qla_host *vha,
 	}
 
 dealloc:
-	if (bbc)
-		dma_free_coherent(&ha->pdev->dev, sizeof(*bbc),
-		    bbc, bbc_dma);
 	if (stat)
 		dma_free_coherent(&ha->pdev->dev, sizeof(*stat),
 		    stat, stat_dma);
Signature · 1 line
2.19.0.rc0
Reviewed-by on v1 2/7
#4 lore raw

Re: [PATCH 2/7] qla2xxx: Fix buffer-buffer credit extraction error

drivers/scsi/qla2xxx/qla_init.c qla2x00_free_fcport(fc_port_t *fcport) · line 5003

Quoted 10 lines · Nilesh Javali
drivers/scsi/qla2xxx/qla_init.c +10 -0
+	if (rval == QLA_SUCCESS) {
+		__be32 *q = (__be32 *)&ha->plogi_els_payld.fl_csp;
+
+		bp = (uint32_t *)ha->init_cb;
+		cpu_to_be32_array(q, bp, sz / 4);
+		ha->flags.plogi_template_valid = 1;
+	} else {
+		ql_dbg(ql_dbg_init, vha, 0x00d1,
+		       "PLOGI ELS param read fail.\n");
+	}

How about making this more readable as following

if (rval != QLA_SUCCESS) {
	ql_dbg(ql_dbg_ini, vha, 0x00d1,
		"PLOGI ELS parameter read failed.\n");
	return;

}

*q = (__be32 *)&ha->plogi_els_payld.fl_csp;
bp = (uint32_t *)ha->init_cb;
cpu_to_be32_array(q, bp, sz / 4);
ha->flags.plogi_template_valid = 1;

Otherwise looks good

Signature · 1 line
Himanshu Madhani                         Oracle Linux Engineering
author maintainer
#5 lore raw

PATCH 3/7 qla2xxx: Fix MPI reset needed message

In reply to Nilesh Javali

From: Arun Easi <[email protected]>

When printing the message:
"MPI Heartbeat stop. MPI reset is not needed.."

..the wrong register was checked leading to always printing that MPI reset is not needed, even when it is needed.
Fix the MPI reset message.

---
 drivers/scsi/qla2xxx/qla_isr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_isr.c +1 -1
index bb3beaa77d39..27c2a89bd2ff 100644
@@ -767,7 +767,7 @@ qla27xx_handle_8200_aen(scsi_qla_host_t *vha, uint16_t *mb)
 	ql_log(ql_log_warn, vha, 0x02f0,
 	       "MPI Heartbeat stop. MPI reset is%s needed. "
 	       "MB0[%xh] MB1[%xh] MB2[%xh] MB3[%xh]\n",
-	       mb[0] & BIT_8 ? "" : " not",
+	       mb[1] & BIT_8 ? "" : " not",
 	       mb[0], mb[1], mb[2], mb[3]);
 
 	if ((mb[1] & BIT_8) == 0)
Signature · 1 line
2.19.0.rc0
Reviewed-by on v1 3/7
#6 lore raw

Re: [PATCH 3/7] qla2xxx: Fix MPI reset needed message

Quoted 21 lines · Nilesh Javali

From: Arun Easi <[email protected]>

When printing the message:
"MPI Heartbeat stop. MPI reset is not needed.."

..the wrong register was checked leading to always printing that MPI reset is not needed, even when it is needed.
Fix the MPI reset message.

---
  drivers/scsi/qla2xxx/qla_isr.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_isr.c +0 -0
index bb3beaa77d39..27c2a89bd2ff 100644

drivers/scsi/qla2xxx/qla_isr.c qla27xx_handle_8200_aen(scsi_qla_host_t *vha, uint16_t *mb) · line 773

Quoted 8 lines
drivers/scsi/qla2xxx/qla_isr.c +1 -1
@@ -767,7 +767,7 @@ qla27xx_handle_8200_aen(scsi_qla_host_t *vha, uint16_t *mb)
  	ql_log(ql_log_warn, vha, 0x02f0,
  	       "MPI Heartbeat stop. MPI reset is%s needed. "
  	       "MB0[%xh] MB1[%xh] MB2[%xh] MB3[%xh]\n",
-	       mb[0] & BIT_8 ? "" : " not",
+	       mb[1] & BIT_8 ? "" : " not",
  	       mb[0], mb[1], mb[2], mb[3]);
 
  	if ((mb[1] & BIT_8) == 0)

Following tag needs to be added

Fixes cbb01c2f2f630 ("scsi: qla2xxx: Fix MPI failure AEN (8200) handling")
Signature · 1 line
Himanshu Madhani                         Oracle Linux Engineering
author maintainer
#7 lore raw

PATCH 4/7 qla2xxx: Fix reset of MPI firmware

In reply to Nilesh Javali

From: Arun Easi <[email protected]>

Normally, the MPI firmware is reset when an MPI dump is collected. If an unsaved MPI dump exists in the driver, though, an alternate mechanism is used. This mechanism, which was not fully correct, is not recommended and instead an MPI dump template walk is suggested to perform the MPI reset.

To allow for the MPI dump template walk, extra space is reserved in the MPI dump buffer, which gets used only when there is already an MPI dump in place.

Fixes qla2xxx: Fix MPI failure AEN (8200) handling
---
 drivers/scsi/qla2xxx/qla_attr.c | 10 +++++--
 drivers/scsi/qla2xxx/qla_gbl.h  |  1 -
 drivers/scsi/qla2xxx/qla_init.c |  2 ++
 drivers/scsi/qla2xxx/qla_tmpl.c | 49 +++++++++------------------------
 4 files changed, 23 insertions(+), 39 deletions(-)
drivers/scsi/qla2xxx/qla_attr.c +8 -2
index 1ee747ba4ecc..284b1cc91c80 100644
@@ -157,6 +157,14 @@ qla2x00_sysfs_write_fw_dump(struct file *filp, struct kobject *kobj,
 			       vha->host_no);
 		}
 		break;
+	case 10:
+		if (IS_QLA27XX(ha) || IS_QLA28XX(ha)) {
+			ql_log(ql_log_info, vha, 0x70e9,
+			       "Issuing MPI firmware dump on host#%ld.\n",
+			       vha->host_no);
+			ha->isp_ops->mpi_fw_dump(vha, 0);
+		}
+		break;
 	}
 	return count;
 }
@@ -744,8 +752,6 @@ qla2x00_sysfs_write_reset(struct file *filp, struct kobject *kobj,
 			qla83xx_idc_audit(vha, IDC_AUDIT_TIMESTAMP);
 			qla83xx_idc_unlock(vha, 0);
 			break;
-		} else if (IS_QLA27XX(ha) || IS_QLA28XX(ha)) {
-			qla27xx_reset_mpi(vha);
 		} else {
 			/* Make sure FC side is not in reset */
 			WARN_ON_ONCE(qla2x00_wait_for_hba_online(vha) !=
drivers/scsi/qla2xxx/qla_gbl.h +0 -1
index 9c4d077edf9e..26dc055d93b3 100644
@@ -945,6 +945,5 @@ extern void qla2x00_dfs_remove_rport(scsi_qla_host_t *vha, struct fc_port *fp);
 
 /* nvme.c */
 void qla_nvme_unregister_remote_port(struct fc_port *fcport);
-void qla27xx_reset_mpi(scsi_qla_host_t *vha);
 void qla_handle_els_plogi_done(scsi_qla_host_t *vha, struct event_arg *ea);
 #endif /* _QLA_GBL_H */
drivers/scsi/qla2xxx/qla_init.c +2 -0
index 6b88b0e6d91a..9c57e29020ad 100644
@@ -3288,6 +3288,8 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *vha)
 			    j, fwdt->dump_size);
 			dump_size += fwdt->dump_size;
 		}
+		/* Add space for spare MPI fw dump. */
+		dump_size += ha->fwdt[1].dump_size;
 	} else {
 		req_q_size = req->length * sizeof(request_t);
 		rsp_q_size = rsp->length * sizeof(response_t);
drivers/scsi/qla2xxx/qla_tmpl.c +13 -36

84 lines not on this page · raw message

Signature · 1 line
2.19.0.rc0
Reviewed-by on v1 4/7
#8 lore raw

Re: [PATCH 4/7] qla2xxx: Fix reset of MPI firmware

Quoted 8 lines · Nilesh Javali

From: Arun Easi <[email protected]>

Normally, the MPI firmware is reset when an MPI dump is collected. If an unsaved MPI dump exists in the driver, though, an alternate mechanism is used. This mechanism, which was not fully correct, is not recommended and instead an MPI dump template walk is suggested to perform the MPI reset.

Quoted 5 lines

To allow for the MPI dump template walk, extra space is reserved in the MPI dump buffer, which gets used only when there is already an MPI dump in place.

Fixes qla2xxx: Fix MPI failure AEN (8200) handling

missing commit hash and wrong format.. Please use following (for future)

Fixes cbb01c2f2f630 ("scsi: qla2xxx: Fix MPI failure AEN (8200) handling")
Quoted 147 lines
---
  drivers/scsi/qla2xxx/qla_attr.c | 10 +++++--
  drivers/scsi/qla2xxx/qla_gbl.h  |  1 -
  drivers/scsi/qla2xxx/qla_init.c |  2 ++
  drivers/scsi/qla2xxx/qla_tmpl.c | 49 +++++++++------------------------
  4 files changed, 23 insertions(+), 39 deletions(-)
drivers/scsi/qla2xxx/qla_attr.c +8 -2
index 1ee747ba4ecc..284b1cc91c80 100644
@@ -157,6 +157,14 @@ qla2x00_sysfs_write_fw_dump(struct file *filp, struct kobject *kobj,
  			       vha->host_no);
  		}
  		break;
+	case 10:
+		if (IS_QLA27XX(ha) || IS_QLA28XX(ha)) {
+			ql_log(ql_log_info, vha, 0x70e9,
+			       "Issuing MPI firmware dump on host#%ld.\n",
+			       vha->host_no);
+			ha->isp_ops->mpi_fw_dump(vha, 0);
+		}
+		break;
  	}
  	return count;
  }
@@ -744,8 +752,6 @@ qla2x00_sysfs_write_reset(struct file *filp, struct kobject *kobj,
  			qla83xx_idc_audit(vha, IDC_AUDIT_TIMESTAMP);
  			qla83xx_idc_unlock(vha, 0);
  			break;
-		} else if (IS_QLA27XX(ha) || IS_QLA28XX(ha)) {
-			qla27xx_reset_mpi(vha);
  		} else {
  			/* Make sure FC side is not in reset */
  			WARN_ON_ONCE(qla2x00_wait_for_hba_online(vha) !=
drivers/scsi/qla2xxx/qla_gbl.h +0 -1
index 9c4d077edf9e..26dc055d93b3 100644
@@ -945,6 +945,5 @@ extern void qla2x00_dfs_remove_rport(scsi_qla_host_t *vha, struct fc_port *fp);
 
  /* nvme.c */
  void qla_nvme_unregister_remote_port(struct fc_port *fcport);
-void qla27xx_reset_mpi(scsi_qla_host_t *vha);
  void qla_handle_els_plogi_done(scsi_qla_host_t *vha, struct event_arg *ea);
  #endif /* _QLA_GBL_H */
drivers/scsi/qla2xxx/qla_init.c +2 -0
index 6b88b0e6d91a..9c57e29020ad 100644
@@ -3288,6 +3288,8 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *vha)
  			    j, fwdt->dump_size);
  			dump_size += fwdt->dump_size;
  		}
+		/* Add space for spare MPI fw dump. */
+		dump_size += ha->fwdt[1].dump_size;
  	} else {
  		req_q_size = req->length * sizeof(request_t);
  		rsp_q_size = rsp->length * sizeof(response_t);
drivers/scsi/qla2xxx/qla_tmpl.c +13 -34
index 591df89a4d13..0af3e7fa31f0 100644
@@ -12,33 +12,6 @@
  #define IOBASE(vha)	IOBAR(ISPREG(vha))
  #define INVALID_ENTRY ((struct qla27xx_fwdt_entry *)0xffffffffffffffffUL)
 
-/* hardware_lock assumed held. */
-static void
-qla27xx_write_remote_reg(struct scsi_qla_host *vha,
-			 u32 addr, u32 data)
-{
-	struct device_reg_24xx __iomem *reg = &vha->hw->iobase->isp24;
-
-	ql_dbg(ql_dbg_misc, vha, 0xd300,
-	       "%s: addr/data = %xh/%xh\n", __func__, addr, data);
-
-	wrt_reg_dword(&reg->iobase_addr, 0x40);
-	wrt_reg_dword(&reg->iobase_c4, data);
-	wrt_reg_dword(&reg->iobase_window, addr);
-}
-
-void
-qla27xx_reset_mpi(scsi_qla_host_t *vha)
-{
-	ql_dbg(ql_dbg_misc + ql_dbg_verbose, vha, 0xd301,
-	       "Entered %s.\n", __func__);
-
-	qla27xx_write_remote_reg(vha, 0x104050, 0x40004);
-	qla27xx_write_remote_reg(vha, 0x10405c, 0x4);
-
-	vha->hw->stat.num_mpi_reset++;
-}
-
  static inline void
  qla27xx_insert16(uint16_t value, void *buf, ulong *len)
  {
@@ -1028,7 +1001,6 @@ void
  qla27xx_mpi_fwdump(scsi_qla_host_t *vha, int hardware_locked)
  {
  	ulong flags = 0;
-	bool need_mpi_reset = true;
 
  #ifndef __CHECKER__
  	if (!hardware_locked)
@@ -1036,14 +1008,20 @@ qla27xx_mpi_fwdump(scsi_qla_host_t *vha, int hardware_locked)
  #endif
  	if (!vha->hw->mpi_fw_dump) {
  		ql_log(ql_log_warn, vha, 0x02f3, "-> mpi_fwdump no buffer\n");
-	} else if (vha->hw->mpi_fw_dumped) {
-		ql_log(ql_log_warn, vha, 0x02f4,
-		       "-> MPI firmware already dumped (%p) -- ignoring request\n",
-		       vha->hw->mpi_fw_dump);
  	} else {
  		struct fwdt *fwdt = &vha->hw->fwdt[1];
  		ulong len;
  		void *buf = vha->hw->mpi_fw_dump;
+		bool walk_template_only = false;
+
+		if (vha->hw->mpi_fw_dumped) {
+			/* Use the spare area for any further dumps. */
+			buf += fwdt->dump_size;
+			walk_template_only = true;
+			ql_log(ql_log_warn, vha, 0x02f4,
+			       "-> MPI firmware already dumped -- dump saving to temporary buffer %p.\n",
+			       buf);
+		}
 
  		ql_log(ql_log_warn, vha, 0x02f5, "-> fwdt1 running...\n");
  		if (!fwdt->template) {
@@ -1058,9 +1036,10 @@ qla27xx_mpi_fwdump(scsi_qla_host_t *vha, int hardware_locked)
  			ql_log(ql_log_warn, vha, 0x02f7,
  			       "-> fwdt1 fwdump residual=%+ld\n",
  			       fwdt->dump_size - len);
-		} else {
-			need_mpi_reset = false;
  		}
+		vha->hw->stat.num_mpi_reset++;
+		if (walk_template_only)
+			goto bailout;
 
  		vha->hw->mpi_fw_dump_len = len;
  		vha->hw->mpi_fw_dumped = 1;

drivers/scsi/qla2xxx/qla_tmpl.c qla27xx_mpi_fwdump(scsi_qla_host_t *vha, int hardware_locked) · line 1056

Quoted 8 lines
drivers/scsi/qla2xxx/qla_tmpl.c +0 -2
@@ -1072,8 +1051,6 @@ qla27xx_mpi_fwdump(scsi_qla_host_t *vha, int hardware_locked)
  	}
 
  bailout:
-	if (need_mpi_reset)
-		qla27xx_reset_mpi(vha);
  #ifndef __CHECKER__
  	if (!hardware_locked)
  		spin_unlock_irqrestore(&vha->hw->hardware_lock, flags);

small nit with the Fixes tag. Otherwise looks good.

Signature · 1 line
Himanshu Madhani                         Oracle Linux Engineering
author maintainer
#9 lore raw

PATCH 5/7 qla2xxx: fix crash on session cleanup with unload

In reply to Nilesh Javali

From: Quinn Tran <[email protected]>

On unload, session cleanup prematurely gave the signal for driver unload path to advance.

---
 drivers/scsi/qla2xxx/qla_target.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/scsi/qla2xxx/qla_target.c +7 -6
index 7711f95033c0..2a0d3c85766a 100644
@@ -1231,14 +1231,15 @@ void qlt_schedule_sess_for_deletion(struct fc_port *sess)
 	case DSC_DELETE_PEND:
 		return;
 	case DSC_DELETED:
-		if (tgt && tgt->tgt_stop && (tgt->sess_count == 0))
-			wake_up_all(&tgt->waitQ);
-		if (sess->vha->fcport_count == 0)
-			wake_up_all(&sess->vha->fcport_waitQ);
-
 		if (!sess->plogi_link[QLT_PLOGI_LINK_SAME_WWN] &&
-			!sess->plogi_link[QLT_PLOGI_LINK_CONFLICT])
+			!sess->plogi_link[QLT_PLOGI_LINK_CONFLICT]) {
+			if (tgt && tgt->tgt_stop && tgt->sess_count == 0)
+				wake_up_all(&tgt->waitQ);
+
+			if (sess->vha->fcport_count == 0)
+				wake_up_all(&sess->vha->fcport_waitQ);
 			return;
+		}
 		break;
 	case DSC_UPD_FCPORT:
 		/*
Signature · 1 line
2.19.0.rc0
Reviewed-by on v1 5/7
#10 lore raw

Re: [PATCH 5/7] qla2xxx: fix crash on session cleanup with unload

Quoted 28 lines · Nilesh Javali

From: Quinn Tran <[email protected]>

On unload, session cleanup prematurely gave the signal for driver unload path to advance.

---
  drivers/scsi/qla2xxx/qla_target.c | 13 +++++++------
  1 file changed, 7 insertions(+), 6 deletions(-)
drivers/scsi/qla2xxx/qla_target.c +1 -6
index 7711f95033c0..2a0d3c85766a 100644
@@ -1231,14 +1231,15 @@ void qlt_schedule_sess_for_deletion(struct fc_port *sess)
  	case DSC_DELETE_PEND:
  		return;
  	case DSC_DELETED:
-		if (tgt && tgt->tgt_stop && (tgt->sess_count == 0))
-			wake_up_all(&tgt->waitQ);
-		if (sess->vha->fcport_count == 0)
-			wake_up_all(&sess->vha->fcport_waitQ);
-
  		if (!sess->plogi_link[QLT_PLOGI_LINK_SAME_WWN] &&
-			!sess->plogi_link[QLT_PLOGI_LINK_CONFLICT])
+			!sess->plogi_link[QLT_PLOGI_LINK_CONFLICT]) {

drivers/scsi/qla2xxx/qla_target.c void qlt_schedule_sess_for_deletion(struct fc_port *sess) · line 1245

Quoted 10 lines
drivers/scsi/qla2xxx/qla_target.c +6 -0
+			if (tgt && tgt->tgt_stop && tgt->sess_count == 0)
+				wake_up_all(&tgt->waitQ);
+
+			if (sess->vha->fcport_count == 0)
+				wake_up_all(&sess->vha->fcport_waitQ);
  			return;
+		}
  		break;
  	case DSC_UPD_FCPORT:
  		/*q

This needs to go to stable as well.

Please add

Fixes 726b85487067d ("qla2xxx: Add framework for async fabric discovery")

otherwise looks good

Signature · 1 line
Himanshu Madhani                         Oracle Linux Engineering
author maintainer
#11 lore raw

PATCH 6/7 qla2xxx: Fix point-to-point (N2N) device discovery issue

In reply to Nilesh Javali

From: Arun Easi <[email protected]>

Driver was using a shorter timeout waiting for PLOGI from the peer in point-to-point configurations. Some devices takes some time (~4 seconds) to initiate the PLOGI. This peer initiating PLOGI is when the peer has a higher P-WWN.

Increase the wait time based on N2N R_A_TOV.

---
 drivers/scsi/qla2xxx/qla_def.h | 2 ++
 drivers/scsi/qla2xxx/qla_mbx.c | 3 ++-
 drivers/scsi/qla2xxx/qla_os.c  | 2 ++
 3 files changed, 6 insertions(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_def.h +2 -0
index 98814a9a8ea6..b0b4228050e9 100644
@@ -5147,6 +5147,8 @@ struct sff_8247_a0 {
 	 ha->current_topology == ISP_CFG_N || \
 	 !ha->current_topology)
 
+#define QLA_N2N_WAIT_TIME	5 /* 2 * ra_tov(n2n) + 1 */
+
 #define NVME_TYPE(fcport) \
 	(fcport->fc4_type & FS_FC4TYPE_NVME) \
 
drivers/scsi/qla2xxx/qla_mbx.c +2 -1
index d861d025bce1..d90880d5cf46 100644
@@ -3994,7 +3994,8 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha,
 
 			if (fcport) {
 				fcport->plogi_nack_done_deadline = jiffies + HZ;
-				fcport->dm_login_expire = jiffies + 2*HZ;
+				fcport->dm_login_expire = jiffies +
+					QLA_N2N_WAIT_TIME * HZ;
 				fcport->scan_state = QLA_FCPORT_FOUND;
 				fcport->n2n_flag = 1;
 				fcport->keep_nport_handle = 1;
drivers/scsi/qla2xxx/qla_os.c +2 -0
index 6c4dc8eff8b8..b7a0feecac76 100644
@@ -5097,6 +5097,8 @@ void qla24xx_create_new_sess(struct scsi_qla_host *vha, struct qla_work_evt *e)
 
 			fcport->fc4_type = e->u.new_sess.fc4_type;
 			if (e->u.new_sess.fc4_type & FS_FCP_IS_N2N) {
+				fcport->dm_login_expire = jiffies +
+					QLA_N2N_WAIT_TIME * HZ;
 				fcport->fc4_type = FS_FC4TYPE_FCP;
 				fcport->n2n_flag = 1;
 				if (vha->flags.nvme_enabled)
Signature · 1 line
2.19.0.rc0
Reviewed-by on v1 6/7
#12 lore raw

Re: [PATCH 6/7] qla2xxx: Fix point-to-point (N2N) device discovery issue

Quoted 50 lines · Nilesh Javali

From: Arun Easi <[email protected]>

Driver was using a shorter timeout waiting for PLOGI from the peer in point-to-point configurations. Some devices takes some time (~4 seconds) to initiate the PLOGI. This peer initiating PLOGI is when the peer has a higher P-WWN.

Increase the wait time based on N2N R_A_TOV.

---
  drivers/scsi/qla2xxx/qla_def.h | 2 ++
  drivers/scsi/qla2xxx/qla_mbx.c | 3 ++-
  drivers/scsi/qla2xxx/qla_os.c  | 2 ++
  3 files changed, 6 insertions(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_def.h +2 -0
index 98814a9a8ea6..b0b4228050e9 100644
@@ -5147,6 +5147,8 @@ struct sff_8247_a0 {
  	 ha->current_topology == ISP_CFG_N || \
  	 !ha->current_topology)
 
+#define QLA_N2N_WAIT_TIME	5 /* 2 * ra_tov(n2n) + 1 */
+
  #define NVME_TYPE(fcport) \
  	(fcport->fc4_type & FS_FC4TYPE_NVME) \
 
drivers/scsi/qla2xxx/qla_mbx.c +2 -1
index d861d025bce1..d90880d5cf46 100644
@@ -3994,7 +3994,8 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha,
 
  			if (fcport) {
  				fcport->plogi_nack_done_deadline = jiffies + HZ;
-				fcport->dm_login_expire = jiffies + 2*HZ;
+				fcport->dm_login_expire = jiffies +
+					QLA_N2N_WAIT_TIME * HZ;
  				fcport->scan_state = QLA_FCPORT_FOUND;
  				fcport->n2n_flag = 1;
  				fcport->keep_nport_handle = 1;
drivers/scsi/qla2xxx/qla_os.c +0 -0
index 6c4dc8eff8b8..b7a0feecac76 100644

drivers/scsi/qla2xxx/qla_os.c void qla24xx_create_new_sess(struct scsi_qla_host *vha, struct qla_work_evt *e) · line 5104

Quoted 8 lines
drivers/scsi/qla2xxx/qla_os.c +2 -0
@@ -5097,6 +5097,8 @@ void qla24xx_create_new_sess(struct scsi_qla_host *vha, struct qla_work_evt *e)
 
  			fcport->fc4_type = e->u.new_sess.fc4_type;
  			if (e->u.new_sess.fc4_type & FS_FCP_IS_N2N) {
+				fcport->dm_login_expire = jiffies +
+					QLA_N2N_WAIT_TIME * HZ;
  				fcport->fc4_type = FS_FC4TYPE_FCP;
  				fcport->n2n_flag = 1;
  				if (vha->flags.nvme_enabled)

Looks Good.

Signature · 1 line
Himanshu Madhani                         Oracle Linux Engineering
author maintainer
#13 lore raw

PATCH 7/7 qla2xxx: Update version to 10.02.00.103-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
index 0f5a5f17dcef..120e511d2ed5 100644
@@ -7,9 +7,9 @@
 /*
  * Driver version
  */
-#define QLA2XXX_VERSION      "10.02.00.102-k"
+#define QLA2XXX_VERSION      "10.02.00.103-k"
 
 #define QLA_DRIVER_MAJOR_VER	10
 #define QLA_DRIVER_MINOR_VER	2
 #define QLA_DRIVER_PATCH_VER	0
-#define QLA_DRIVER_BETA_VER	102
+#define QLA_DRIVER_BETA_VER	103
Signature · 1 line
2.19.0.rc0
Reviewed-by on v1 7/7
#14 lore raw

Re: [PATCH 7/7] qla2xxx: Update version to 10.02.00.103-k

Quoted 12 lines · Nilesh Javali
---
  drivers/scsi/qla2xxx/qla_version.h | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/qla2xxx/qla_version.h +0 -0
index 0f5a5f17dcef..120e511d2ed5 100644
@@ -7,9 +7,9 @@
  /*

drivers/scsi/qla2xxx/qla_version.h line 15

Quoted 10 lines
drivers/scsi/qla2xxx/qla_version.h +2 -2
   * Driver version
   */
-#define QLA2XXX_VERSION      "10.02.00.102-k"
+#define QLA2XXX_VERSION      "10.02.00.103-k"
 
  #define QLA_DRIVER_MAJOR_VER	10
  #define QLA_DRIVER_MINOR_VER	2
  #define QLA_DRIVER_PATCH_VER	0
-#define QLA_DRIVER_BETA_VER	102
+#define QLA_DRIVER_BETA_VER	103
Signature · 1 line
Himanshu Madhani                         Oracle Linux Engineering