Skip to contentSkip to conversation

qla2xxx bug fixes

PATCH Applied Nilesh Javali 2 participants 10 messages Sep 29, 2020 – Oct 3, 2020

Subsystems (2)
lore
Share & tools
lore

Nilesh Javali

author maintainer
#0 lore raw

v2 cover qla2xxx bug fixes

Martin,

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

v1->v2:
Added correct "Fixes:" and "Cc:" tags in commits
Added Reviewed-by tag

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    | 52 +++++++++++++++--------------
 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, 75 insertions(+), 132 deletions(-)

base-commit: c1a3bf99d76e5ae5537265433def019a34a9dac0

Signature · 1 line
2.23.1
author maintainer
#1 lore raw

PATCH v2 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
author maintainer
#2 lore raw

PATCH v2 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 | 50 +++++++++++++++++----------------
 drivers/scsi/qla2xxx/qla_iocb.c |  3 +-
 drivers/scsi/qla2xxx/qla_mbx.c  | 39 -------------------------
 drivers/scsi/qla2xxx/qla_os.c   | 19 +++----------
 5 files changed, 34 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 +26 -24

77 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
author maintainer
#3 lore raw

PATCH v2 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.

Fixes cbb01c2f2f630 ("scsi: qla2xxx: Fix MPI failure AEN (8200) handling")
---
 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
author maintainer
#4 lore raw

PATCH v2 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 cbb01c2f2f630 ("scsi: 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 4659c8bc8c0d..e493c2df8aad 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
author maintainer
#5 lore raw

PATCH v2 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.

Fixes 726b85487067d ("qla2xxx: Add framework for async fabric discovery")
---
 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
author maintainer
#6 lore raw

PATCH v2 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
author maintainer
#7 lore raw

PATCH v2 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
#8 lore raw
In reply to Nilesh Javali

Nilesh,

Quoted 4 lines

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

Added correct "Fixes:" and "Cc:" tags in commits

Applied to 5.10/scsi-staging, thanks!

Your Fixes: tags used 13-char SHAs instead of 12. I fixed them up.

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#9 lore raw
In reply to Nilesh Javali
Quoted 10 lines · Nilesh Javali

Martin,

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

v1->v2:
Added correct "Fixes:" and "Cc:" tags in commits
Added Reviewed-by tag

[...]

Applied to 5.10/scsi-queue, thanks!

[1/7] scsi: qla2xxx: Correct the check for sscanf() return value

      https://git.kernel.org/mkp/scsi/c/7dc0f671d89c
[2/7] scsi: qla2xxx: Fix buffer-buffer credit extraction error
      https://git.kernel.org/mkp/scsi/c/44f5a37d1e3e
[3/7] scsi: qla2xxx: Fix MPI reset needed message
      https://git.kernel.org/mkp/scsi/c/7a6cdbd5e875
[4/7] scsi: qla2xxx: Fix reset of MPI firmware
      https://git.kernel.org/mkp/scsi/c/3e6efab865ac
[5/7] scsi: qla2xxx: Fix crash on session cleanup with unload
      https://git.kernel.org/mkp/scsi/c/50457dab670f
[6/7] scsi: qla2xxx: Fix point-to-point (N2N) device discovery issue
      https://git.kernel.org/mkp/scsi/c/94eda2717826
[7/7] scsi: qla2xxx: Update version to 10.02.00.103-k
      https://git.kernel.org/mkp/scsi/c/718c2fe92b20
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering