Skip to contentSkip to conversation

qla2xxx driver fixes

PATCH Superseded Nilesh Javali 2 participants 27 messages Mar 8, 2022 – Mar 9, 2022

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Nilesh Javali

author maintainer
#0 lore raw

cover qla2xxx driver fixes

Martin,

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

Thanks,
Nilesh

Arun Easi (3):
qla2xxx: Fix loss of NVME namespaces after driver reload test
qla2xxx: Fix missed DMA unmap for NVME ls requests
qla2xxx: Fix crash during module load unload test

Manish Rangankar (1):
qla2xxx: Use correct feature type field during rffid processing

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

Quinn Tran (7):
qla2xxx: Fix incorrect reporting of task management failure
qla2xxx: Fix disk failure to rediscover
qla2xxx: fix n2n inconsistent plogi
qla2xxx: Fix hang due to session stuck
qla2xxx: Fix laggy FC remote port session recovery
qla2xxx: reduce false trigger to login
qla2xxx: Fix stuck session of prli reject

Shreyas Deodhar (1):
qla2xxx: Increase max limit of ql2xnvme_queues

 drivers/scsi/qla2xxx/qla_def.h     |  5 +++
 drivers/scsi/qla2xxx/qla_gs.c      |  5 +--
 drivers/scsi/qla2xxx/qla_init.c    | 36 ++++++++++------
 drivers/scsi/qla2xxx/qla_iocb.c    |  8 ++--
 drivers/scsi/qla2xxx/qla_isr.c     |  1 +
 drivers/scsi/qla2xxx/qla_nvme.c    | 67 +++++++++++++++++++++++-------
 drivers/scsi/qla2xxx/qla_nvme.h    |  1 -
 drivers/scsi/qla2xxx/qla_os.c      | 23 ++++++++--
 drivers/scsi/qla2xxx/qla_version.h |  4 +-
 9 files changed, 107 insertions(+), 43 deletions(-)

base-commit: ac2beb4e3bd75b0049068516b9d42201bda0ded3

Signature · 1 line
2.19.0.rc0
author maintainer
#1 lore raw

PATCH 1/13 qla2xxx: Fix incorrect reporting of task management failure

From: Quinn Tran <[email protected]>

User experienced no task management error while target device is responding with error. The RSP_CODE field in the status iocb is in little endian. Driver assumes it's big endian, where it picked up erroneous data.

Convert the data back to big endian as is on the wire, where current code will pick up correct status.

Fixes faef62d13463 ("[SCSI] qla2xxx: Fix Task Management command asynchronous handling")
---
 drivers/scsi/qla2xxx/qla_isr.c | 1 +
 1 file changed, 1 insertion(+)
drivers/scsi/qla2xxx/qla_isr.c +1 -0
index aaf6504570fd..198b782d7790 100644
@@ -2498,6 +2498,7 @@ qla24xx_tm_iocb_entry(scsi_qla_host_t *vha, struct req_que *req, void *tsk)
 		iocb->u.tmf.data = QLA_FUNCTION_FAILED;
 	} else if ((le16_to_cpu(sts->scsi_status) &
 	    SS_RESPONSE_INFO_LEN_VALID)) {
+		host_to_fcp_swap(sts->data, sizeof(sts->data));
 		if (le32_to_cpu(sts->rsp_data_len) < 4) {
 			ql_log(ql_log_warn, fcport->vha, 0x503b,
 			    "Async-%s error - hdl=%x not enough response(%d).\n",
Signature · 1 line
2.19.0.rc0
Reviewed-by on v1 1/13
#2 lore raw

Re: [PATCH 01/13] qla2xxx: Fix incorrect reporting of task management failure

Quoted 37 lines · Nilesh Javali

From: Quinn Tran <[email protected]>

User experienced no task management error while target device is responding with error. The RSP_CODE field in the status iocb is in little endian. Driver assumes it's big endian, where it picked up erroneous data.

Convert the data back to big endian as is on the wire, where current code will pick up correct status.

Fixes faef62d13463 ("[SCSI] qla2xxx: Fix Task Management command asynchronous handling")

---
drivers/scsi/qla2xxx/qla_isr.c | 1 +

1 file changed, 1 insertion(+)
drivers/scsi/qla2xxx/qla_isr.c +1 -0
index aaf6504570fd..198b782d7790 100644
@@ -2498,6 +2498,7 @@ qla24xx_tm_iocb_entry(scsi_qla_host_t *vha, struct req_que *req, void *tsk)
 		iocb->u.tmf.data = QLA_FUNCTION_FAILED;
 	} else if ((le16_to_cpu(sts->scsi_status) &
 	    SS_RESPONSE_INFO_LEN_VALID)) {
+		host_to_fcp_swap(sts->data, sizeof(sts->data));
 		if (le32_to_cpu(sts->rsp_data_len) < 4) {
 			ql_log(ql_log_warn, fcport->vha, 0x503b,
 			    "Async-%s error - hdl=%x not enough response(%d).\n",
Signature · 1 line
2.19.0.rc0

--
Himanshu Madhani Oracle Linux Engineering

author maintainer
#3 lore raw

PATCH 2/13 qla2xxx: Fix disk failure to rediscover

In reply to Nilesh Javali

From: Quinn Tran <[email protected]>

User experience some of the LUN failed to rediscovered after long cable pull test. The issue is triggered by a race condition between driver setting session online state vs upper layer/UL starting the LUN scan process at the same time. Current code set the online state after notifying upper layer the session is available. In this case, UL was faster on the trigger to start the LUN scan process before driver could set the session in online state. LUN scan ends up with failure due to the session online check was failing.

Set the online state before reporting to UL
of the availability of the session.

Fixes aecf043443d3 ("scsi: qla2xxx: Fix Remote port registration")
---
 drivers/scsi/qla2xxx/qla_init.c | 5 +++--
 drivers/scsi/qla2xxx/qla_nvme.c | 5 +++++
 2 files changed, 8 insertions(+), 2 deletions(-)
drivers/scsi/qla2xxx/qla_init.c +3 -2
index 835ed4179887..6ffe44b805b6 100644
@@ -5758,6 +5758,8 @@ qla2x00_reg_remote_port(scsi_qla_host_t *vha, fc_port_t *fcport)
 	if (atomic_read(&fcport->state) == FCS_ONLINE)
 		return;
 
+	qla2x00_set_fcport_state(fcport, FCS_ONLINE);
+
 	rport_ids.node_name = wwn_to_u64(fcport->node_name);
 	rport_ids.port_name = wwn_to_u64(fcport->port_name);
 	rport_ids.port_id = fcport->d_id.b.domain << 16 |
@@ -5858,6 +5860,7 @@ qla2x00_update_fcport(scsi_qla_host_t *vha, fc_port_t *fcport)
 		qla2x00_reg_remote_port(vha, fcport);
 		break;
 	case MODE_TARGET:
+		qla2x00_set_fcport_state(fcport, FCS_ONLINE);
 		if (!vha->vha_tgt.qla_tgt->tgt_stop &&
 			!vha->vha_tgt.qla_tgt->tgt_stopped)
 			qlt_fc_port_added(vha, fcport);
@@ -5875,8 +5878,6 @@ qla2x00_update_fcport(scsi_qla_host_t *vha, fc_port_t *fcport)
 	if (NVME_TARGET(vha->hw, fcport))
 		qla_nvme_register_remote(vha, fcport);
 
-	qla2x00_set_fcport_state(fcport, FCS_ONLINE);
-
 	if (IS_IIDMA_CAPABLE(vha->hw) && vha->hw->flags.gpsc_supported) {
 		if (fcport->id_changed) {
 			fcport->id_changed = 0;
drivers/scsi/qla2xxx/qla_nvme.c +5 -0
index 718c761ff5f8..5723082d94d6 100644
@@ -37,6 +37,11 @@ int qla_nvme_register_remote(struct scsi_qla_host *vha, struct fc_port *fcport)
 		(fcport->nvme_flag & NVME_FLAG_REGISTERED))
 		return 0;
 
+	if (atomic_read(&fcport->state) == FCS_ONLINE)
+		return 0;
+
+	qla2x00_set_fcport_state(fcport, FCS_ONLINE);
+
 	fcport->nvme_flag &= ~NVME_FLAG_RESETTING;
 
 	memset(&req, 0, sizeof(struct nvme_fc_port_info));
Signature · 1 line
2.19.0.rc0
Reviewed-by on v1 2/13
#4 lore raw

Re: [PATCH 02/13] qla2xxx: Fix disk failure to rediscover

Quoted 9 lines · Nilesh Javali

From: Quinn Tran <[email protected]>

User experience some of the LUN failed to rediscovered after long cable pull test. The issue is triggered by a race condition between driver setting session online state vs upper layer/UL

							   ^^^^^^^^^^^^^ 

I would just remove “upper layer” in above statement.

Quoted 10 lines

starting the LUN scan process at the same time. Current code set the online state after notifying upper layer the session is available. In this case, UL was faster on the trigger to start the LUN scan process before driver could set the session in online state. LUN scan ends up with failure due to the session online check was failing.

Set the online state before reporting to UL
of the availability of the session.

The above 2 lines are redundant with the first paragraph.

Quoted 58 lines
Fixes aecf043443d3 ("scsi: qla2xxx: Fix Remote port registration")

---
drivers/scsi/qla2xxx/qla_init.c | 5 +++--
drivers/scsi/qla2xxx/qla_nvme.c | 5 +++++

2 files changed, 8 insertions(+), 2 deletions(-)
drivers/scsi/qla2xxx/qla_init.c +3 -2
index 835ed4179887..6ffe44b805b6 100644
@@ -5758,6 +5758,8 @@ qla2x00_reg_remote_port(scsi_qla_host_t *vha, fc_port_t *fcport)
 	if (atomic_read(&fcport->state) == FCS_ONLINE)
 		return;
 
+	qla2x00_set_fcport_state(fcport, FCS_ONLINE);
+
 	rport_ids.node_name = wwn_to_u64(fcport->node_name);
 	rport_ids.port_name = wwn_to_u64(fcport->port_name);
 	rport_ids.port_id = fcport->d_id.b.domain << 16 |
@@ -5858,6 +5860,7 @@ qla2x00_update_fcport(scsi_qla_host_t *vha, fc_port_t *fcport)
 		qla2x00_reg_remote_port(vha, fcport);
 		break;
 	case MODE_TARGET:
+		qla2x00_set_fcport_state(fcport, FCS_ONLINE);
 		if (!vha->vha_tgt.qla_tgt->tgt_stop &&
 			!vha->vha_tgt.qla_tgt->tgt_stopped)
 			qlt_fc_port_added(vha, fcport);
@@ -5875,8 +5878,6 @@ qla2x00_update_fcport(scsi_qla_host_t *vha, fc_port_t *fcport)
 	if (NVME_TARGET(vha->hw, fcport))
 		qla_nvme_register_remote(vha, fcport);
 
-	qla2x00_set_fcport_state(fcport, FCS_ONLINE);
-
 	if (IS_IIDMA_CAPABLE(vha->hw) && vha->hw->flags.gpsc_supported) {
 		if (fcport->id_changed) {
 			fcport->id_changed = 0;
drivers/scsi/qla2xxx/qla_nvme.c +5 -0
index 718c761ff5f8..5723082d94d6 100644
@@ -37,6 +37,11 @@ int qla_nvme_register_remote(struct scsi_qla_host *vha, struct fc_port *fcport)
 		(fcport->nvme_flag & NVME_FLAG_REGISTERED))
 		return 0;
 
+	if (atomic_read(&fcport->state) == FCS_ONLINE)
+		return 0;
+
+	qla2x00_set_fcport_state(fcport, FCS_ONLINE);
+
 	fcport->nvme_flag &= ~NVME_FLAG_RESETTING;
 
 	memset(&req, 0, sizeof(struct nvme_fc_port_info));
Signature · 1 line
2.19.0.rc0

Patch itself looks good. After fixing commit message you can add

--
Himanshu Madhani Oracle Linux Engineering

author maintainer
#5 lore raw

PATCH 3/13 qla2xxx: Fix loss of NVME namespaces after driver reload test

In reply to Nilesh Javali

From: Arun Easi <[email protected]>

Driver registration of localport can race when it
happens at the remote port discovery time. Fix
this by calling the registration under a mutex.

Fixes e84067d74301 ("scsi: qla2xxx: Add FC-NVMe F/W initialization and transport registration")
---
 drivers/scsi/qla2xxx/qla_nvme.c | 30 ++++++++++++++++++++----------
 1 file changed, 20 insertions(+), 10 deletions(-)
drivers/scsi/qla2xxx/qla_nvme.c +20 -10
index 5723082d94d6..3bf5cbd754a7 100644
@@ -782,8 +782,6 @@ int qla_nvme_register_hba(struct scsi_qla_host *vha)
 	ha = vha->hw;
 	tmpl = &qla_nvme_fc_transport;
 
-	WARN_ON(vha->nvme_local_port);
-
 	if (ql2xnvme_queues < MIN_NVME_HW_QUEUES || ql2xnvme_queues > MAX_NVME_HW_QUEUES) {
 		ql_log(ql_log_warn, vha, 0xfffd,
 		    "ql2xnvme_queues=%d is out of range(MIN:%d - MAX:%d). Resetting ql2xnvme_queues to:%d\n",
@@ -797,7 +795,7 @@ int qla_nvme_register_hba(struct scsi_qla_host *vha)
 		(uint8_t)(ha->max_qpairs ? ha->max_qpairs : 1));
 
 	ql_log(ql_log_info, vha, 0xfffb,
-	    "Number of NVME queues used for this port: %d\n",
+	       "Number of NVME queues used for this port: %d\n",
 	    qla_nvme_fc_transport.max_hw_queues);
 
 	pinfo.node_name = wwn_to_u64(vha->node_name);
@@ -805,13 +803,25 @@ int qla_nvme_register_hba(struct scsi_qla_host *vha)
 	pinfo.port_role = FC_PORT_ROLE_NVME_INITIATOR;
 	pinfo.port_id = vha->d_id.b24;
 
-	ql_log(ql_log_info, vha, 0xffff,
-	    "register_localport: host-traddr=nn-0x%llx:pn-0x%llx on portID:%x\n",
-	    pinfo.node_name, pinfo.port_name, pinfo.port_id);
-	qla_nvme_fc_transport.dma_boundary = vha->host->dma_boundary;
-
-	ret = nvme_fc_register_localport(&pinfo, tmpl,
-	    get_device(&ha->pdev->dev), &vha->nvme_local_port);
+	mutex_lock(&ha->vport_lock);
+	/*
+	 * Check again for nvme_local_port to see if any other thread raced
+	 * with this one and finished registration.
+	 */
+	if (!vha->nvme_local_port) {
+		ql_log(ql_log_info, vha, 0xffff,
+		    "register_localport: host-traddr=nn-0x%llx:pn-0x%llx on portID:%x\n",
+		    pinfo.node_name, pinfo.port_name, pinfo.port_id);
+		qla_nvme_fc_transport.dma_boundary = vha->host->dma_boundary;
+
+		ret = nvme_fc_register_localport(&pinfo, tmpl,
+						 get_device(&ha->pdev->dev),
+						 &vha->nvme_local_port);
+		mutex_unlock(&ha->vport_lock);
+	} else {
+		mutex_unlock(&ha->vport_lock);
+		return 0;
+	}
 	if (ret) {
 		ql_log(ql_log_warn, vha, 0xffff,
 		    "register_localport failed: ret=%x\n", ret);
Signature · 1 line
2.19.0.rc0
Reviewed-by on v1 3/13
#6 lore raw

Re: [PATCH 03/13] qla2xxx: Fix loss of NVME namespaces after driver reload test

Quoted 78 lines · Nilesh Javali

From: Arun Easi <[email protected]>

Driver registration of localport can race when it
happens at the remote port discovery time. Fix
this by calling the registration under a mutex.

Fixes e84067d74301 ("scsi: qla2xxx: Add FC-NVMe F/W initialization and transport registration")

---
drivers/scsi/qla2xxx/qla_nvme.c | 30 ++++++++++++++++++++----------

1 file changed, 20 insertions(+), 10 deletions(-)
drivers/scsi/qla2xxx/qla_nvme.c +20 -10
index 5723082d94d6..3bf5cbd754a7 100644
@@ -782,8 +782,6 @@ int qla_nvme_register_hba(struct scsi_qla_host *vha)
 	ha = vha->hw;
 	tmpl = &qla_nvme_fc_transport;
 
-	WARN_ON(vha->nvme_local_port);
-
 	if (ql2xnvme_queues < MIN_NVME_HW_QUEUES || ql2xnvme_queues > MAX_NVME_HW_QUEUES) {
 		ql_log(ql_log_warn, vha, 0xfffd,
 		    "ql2xnvme_queues=%d is out of range(MIN:%d - MAX:%d). Resetting ql2xnvme_queues to:%d\n",
@@ -797,7 +795,7 @@ int qla_nvme_register_hba(struct scsi_qla_host *vha)
 		(uint8_t)(ha->max_qpairs ? ha->max_qpairs : 1));
 
 	ql_log(ql_log_info, vha, 0xfffb,
-	    "Number of NVME queues used for this port: %d\n",
+	       "Number of NVME queues used for this port: %d\n",
 	    qla_nvme_fc_transport.max_hw_queues);
 
 	pinfo.node_name = wwn_to_u64(vha->node_name);
@@ -805,13 +803,25 @@ int qla_nvme_register_hba(struct scsi_qla_host *vha)
 	pinfo.port_role = FC_PORT_ROLE_NVME_INITIATOR;
 	pinfo.port_id = vha->d_id.b24;
 
-	ql_log(ql_log_info, vha, 0xffff,
-	    "register_localport: host-traddr=nn-0x%llx:pn-0x%llx on portID:%x\n",
-	    pinfo.node_name, pinfo.port_name, pinfo.port_id);
-	qla_nvme_fc_transport.dma_boundary = vha->host->dma_boundary;
-
-	ret = nvme_fc_register_localport(&pinfo, tmpl,
-	    get_device(&ha->pdev->dev), &vha->nvme_local_port);
+	mutex_lock(&ha->vport_lock);
+	/*
+	 * Check again for nvme_local_port to see if any other thread raced
+	 * with this one and finished registration.
+	 */
+	if (!vha->nvme_local_port) {
+		ql_log(ql_log_info, vha, 0xffff,
+		    "register_localport: host-traddr=nn-0x%llx:pn-0x%llx on portID:%x\n",
+		    pinfo.node_name, pinfo.port_name, pinfo.port_id);
+		qla_nvme_fc_transport.dma_boundary = vha->host->dma_boundary;
+
+		ret = nvme_fc_register_localport(&pinfo, tmpl,
+						 get_device(&ha->pdev->dev),
+						 &vha->nvme_local_port);
+		mutex_unlock(&ha->vport_lock);
+	} else {
+		mutex_unlock(&ha->vport_lock);
+		return 0;
+	}
 	if (ret) {
 		ql_log(ql_log_warn, vha, 0xffff,
 		    "register_localport failed: ret=%x\n", ret);
Signature · 1 line
2.19.0.rc0

--
Himanshu Madhani Oracle Linux Engineering

author maintainer
#7 lore raw

PATCH 4/13 qla2xxx: Fix missed DMA unmap for NVME ls requests

In reply to Nilesh Javali

From: Arun Easi <[email protected]>

At NVME ELS request time, request structure is DMA mapped and never unmapped. Fix this by calling the unmap on ELS completion.

Fixes e84067d74301 ("scsi: qla2xxx: Add FC-NVMe F/W initialization and transport registration")
---
 drivers/scsi/qla2xxx/qla_nvme.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
drivers/scsi/qla2xxx/qla_nvme.c +17 -0
index 3bf5cbd754a7..794a95b2e3b4 100644
@@ -175,6 +175,18 @@ static void qla_nvme_release_fcp_cmd_kref(struct kref *kref)
 	qla2xxx_rel_qpair_sp(sp->qpair, sp);
 }
 
+static void qla_nvme_ls_unmap(struct srb *sp, struct nvmefc_ls_req *fd)
+{
+	if (sp->flags & SRB_DMA_VALID) {
+		struct srb_iocb *nvme = &sp->u.iocb_cmd;
+		struct qla_hw_data *ha = sp->fcport->vha->hw;
+
+		dma_unmap_single(&ha->pdev->dev, nvme->u.nvme.cmd_dma,
+				 fd->rqstlen, DMA_TO_DEVICE);
+		sp->flags &= ~SRB_DMA_VALID;
+	}
+}
+
 static void qla_nvme_release_ls_cmd_kref(struct kref *kref)
 {
 	struct srb *sp = container_of(kref, struct srb, cmd_kref);
@@ -191,6 +203,8 @@ static void qla_nvme_release_ls_cmd_kref(struct kref *kref)
 	spin_unlock_irqrestore(&priv->cmd_lock, flags);
 
 	fd = priv->fd;
+
+	qla_nvme_ls_unmap(sp, fd);
 	fd->done(fd, priv->comp_status);
 out:
 	qla2x00_rel_sp(sp);
@@ -361,6 +375,8 @@ static int qla_nvme_ls_req(struct nvme_fc_local_port *lport,
 	dma_sync_single_for_device(&ha->pdev->dev, nvme->u.nvme.cmd_dma,
 	    fd->rqstlen, DMA_TO_DEVICE);
 
+	sp->flags |= SRB_DMA_VALID;
+
 	rval = qla2x00_start_sp(sp);
 	if (rval != QLA_SUCCESS) {
 		ql_log(ql_log_warn, vha, 0x700e,
@@ -368,6 +384,7 @@ static int qla_nvme_ls_req(struct nvme_fc_local_port *lport,
 		wake_up(&sp->nvme_ls_waitq);
 		sp->priv = NULL;
 		priv->sp = NULL;
+		qla_nvme_ls_unmap(sp, fd);
 		qla2x00_rel_sp(sp);
 		return rval;
 	}
Signature · 1 line
2.19.0.rc0
Reviewed-by on v1 4/13
#8 lore raw

Re: [PATCH 04/13] qla2xxx: Fix missed DMA unmap for NVME ls requests

Quoted 70 lines · Nilesh Javali

From: Arun Easi <[email protected]>

At NVME ELS request time, request structure is DMA mapped and never unmapped. Fix this by calling the unmap on ELS completion.

Fixes e84067d74301 ("scsi: qla2xxx: Add FC-NVMe F/W initialization and transport registration")

---
drivers/scsi/qla2xxx/qla_nvme.c | 17 +++++++++++++++++

1 file changed, 17 insertions(+)
drivers/scsi/qla2xxx/qla_nvme.c +14 -0
index 3bf5cbd754a7..794a95b2e3b4 100644
@@ -175,6 +175,18 @@ static void qla_nvme_release_fcp_cmd_kref(struct kref *kref)
 	qla2xxx_rel_qpair_sp(sp->qpair, sp);
 }
 
+static void qla_nvme_ls_unmap(struct srb *sp, struct nvmefc_ls_req *fd)
+{
+	if (sp->flags & SRB_DMA_VALID) {
+		struct srb_iocb *nvme = &sp->u.iocb_cmd;
+		struct qla_hw_data *ha = sp->fcport->vha->hw;
+
+		dma_unmap_single(&ha->pdev->dev, nvme->u.nvme.cmd_dma,
+				 fd->rqstlen, DMA_TO_DEVICE);
+		sp->flags &= ~SRB_DMA_VALID;
+	}
+}
+
 static void qla_nvme_release_ls_cmd_kref(struct kref *kref)
 {
 	struct srb *sp = container_of(kref, struct srb, cmd_kref);
@@ -191,6 +203,8 @@ static void qla_nvme_release_ls_cmd_kref(struct kref *kref)
 	spin_unlock_irqrestore(&priv->cmd_lock, flags);
 
 	fd = priv->fd;
+
+	qla_nvme_ls_unmap(sp, fd);
 	fd->done(fd, priv->comp_status);

out:

	qla2x00_rel_sp(sp);
drivers/scsi/qla2xxx/qla_nvme.c +3 -0
@@ -361,6 +375,8 @@ static int qla_nvme_ls_req(struct nvme_fc_local_port *lport,
 	dma_sync_single_for_device(&ha->pdev->dev, nvme->u.nvme.cmd_dma,
 	    fd->rqstlen, DMA_TO_DEVICE);
 
+	sp->flags |= SRB_DMA_VALID;
+
 	rval = qla2x00_start_sp(sp);
 	if (rval != QLA_SUCCESS) {
 		ql_log(ql_log_warn, vha, 0x700e,
@@ -368,6 +384,7 @@ static int qla_nvme_ls_req(struct nvme_fc_local_port *lport,
 		wake_up(&sp->nvme_ls_waitq);
 		sp->priv = NULL;
 		priv->sp = NULL;
+		qla_nvme_ls_unmap(sp, fd);
 		qla2x00_rel_sp(sp);
 		return rval;
 	}
Signature · 1 line
2.19.0.rc0

--
Himanshu Madhani Oracle Linux Engineering

author maintainer
#9 lore raw

PATCH 5/13 qla2xxx: Fix crash during module load unload test

In reply to Nilesh Javali

From: Arun Easi <[email protected]>

During purex packet handling driver was incorrectly freeing a pre-allocated structure. Fix this by skipping that entry.

System crashed with the following stack during a
module unload test.

Call Trace:
          sbitmap_init_node+0x7f/0x1e0
          sbitmap_queue_init_node+0x24/0x150
          blk_mq_init_bitmaps+0x3d/0xa0
          blk_mq_init_tags+0x68/0x90
          blk_mq_alloc_map_and_rqs+0x44/0x120
          blk_mq_alloc_set_map_and_rqs+0x63/0x150
          blk_mq_alloc_tag_set+0x11b/0x230
          scsi_add_host_with_dma.cold+0x3f/0x245
          qla2x00_probe_one+0xd5a/0x1b80 [qla2xxx]

Call Trace with slub_debug and debug kernel:

        kasan_report_invalid_free+0x50/0x80
        __kasan_slab_free+0x137/0x150
        slab_free_freelist_hook+0xc6/0x190
        kfree+0xe8/0x2e0
        qla2x00_free_device+0x3bb/0x5d0 [qla2xxx]
        qla2x00_remove_one+0x668/0xcf0 [qla2xxx]
Fixes 62e9dd177732 ("scsi: qla2xxx: Change in PUREX to handle FPIN ELS requests")
---
 drivers/scsi/qla2xxx/qla_os.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/scsi/qla2xxx/qla_os.c +2 -0
index a4546346c18b..d572a76d0fa0 100644
@@ -3904,6 +3904,8 @@ qla24xx_free_purex_list(struct purex_list *list)
 	spin_lock_irqsave(&list->lock, flags);
 	list_for_each_entry_safe(item, next, &list->head, list) {
 		list_del(&item->list);
+		if (item == &item->vha->default_item)
+			continue;
 		kfree(item);
 	}
 	spin_unlock_irqrestore(&list->lock, flags);
Signature · 1 line
2.19.0.rc0
Reviewed-by on v1 5/13
#10 lore raw

Re: [PATCH 05/13] qla2xxx: Fix crash during module load unload test

Quoted 58 lines · Nilesh Javali

From: Arun Easi <[email protected]>

During purex packet handling driver was incorrectly freeing a pre-allocated structure. Fix this by skipping that entry.

System crashed with the following stack during a
module unload test.

Call Trace:
         sbitmap_init_node+0x7f/0x1e0
         sbitmap_queue_init_node+0x24/0x150
         blk_mq_init_bitmaps+0x3d/0xa0
         blk_mq_init_tags+0x68/0x90
         blk_mq_alloc_map_and_rqs+0x44/0x120
         blk_mq_alloc_set_map_and_rqs+0x63/0x150
         blk_mq_alloc_tag_set+0x11b/0x230
         scsi_add_host_with_dma.cold+0x3f/0x245
         qla2x00_probe_one+0xd5a/0x1b80 [qla2xxx]

Call Trace with slub_debug and debug kernel:

       kasan_report_invalid_free+0x50/0x80
       __kasan_slab_free+0x137/0x150
       slab_free_freelist_hook+0xc6/0x190
       kfree+0xe8/0x2e0
       qla2x00_free_device+0x3bb/0x5d0 [qla2xxx]
       qla2x00_remove_one+0x668/0xcf0 [qla2xxx]
Fixes 62e9dd177732 ("scsi: qla2xxx: Change in PUREX to handle FPIN ELS requests")

---
drivers/scsi/qla2xxx/qla_os.c | 2 ++

1 file changed, 2 insertions(+)
drivers/scsi/qla2xxx/qla_os.c +2 -0
index a4546346c18b..d572a76d0fa0 100644
@@ -3904,6 +3904,8 @@ qla24xx_free_purex_list(struct purex_list *list)
 	spin_lock_irqsave(&list->lock, flags);
 	list_for_each_entry_safe(item, next, &list->head, list) {
 		list_del(&item->list);
+		if (item == &item->vha->default_item)
+			continue;
 		kfree(item);
 	}
 	spin_unlock_irqrestore(&list->lock, flags);
Signature · 1 line
2.19.0.rc0

--
Himanshu Madhani Oracle Linux Engineering

author maintainer
#11 lore raw

PATCH 6/13 qla2xxx: fix n2n inconsistent plogi

In reply to Nilesh Javali

From: Quinn Tran <[email protected]>

For N2N topology, ELS Passthrough is used to send PLOGI. On failure of ELS pass through PLOGI, driver flipped over to using LLIOCB PLOGI for N2N. This is not consistent. This patch would delete the session to restart the connection, where ELS pass through PLOGI would be used consistently.

Fixes c76ae845ea83 ("scsi: qla2xxx: Add error handling for PLOGI ELS passthrough")
---
 drivers/scsi/qla2xxx/qla_iocb.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/scsi/qla2xxx/qla_iocb.c +3 -5
index 5e3ee1f7b43c..e0fe9ddb4bd2 100644
@@ -2958,6 +2958,7 @@ static void qla2x00_els_dcmd2_sp_done(srb_t *sp, int res)
 					set_bit(ISP_ABORT_NEEDED,
 					    &vha->dpc_flags);
 					qla2xxx_wake_dpc(vha);
+					break;
 				}
 				fallthrough;
 			default:
@@ -2967,9 +2968,7 @@ static void qla2x00_els_dcmd2_sp_done(srb_t *sp, int res)
 				    fw_status[0], fw_status[1], fw_status[2]);
 
 				fcport->flags &= ~FCF_ASYNC_SENT;
-				qla2x00_set_fcport_disc_state(fcport,
-				    DSC_LOGIN_FAILED);
-				set_bit(RELOGIN_NEEDED, &vha->dpc_flags);
+				qlt_schedule_sess_for_deletion(fcport);
 				break;
 			}
 			break;
@@ -2981,8 +2980,7 @@ static void qla2x00_els_dcmd2_sp_done(srb_t *sp, int res)
 			    fw_status[0], fw_status[1], fw_status[2]);
 
 			sp->fcport->flags &= ~FCF_ASYNC_SENT;
-			qla2x00_set_fcport_disc_state(fcport, DSC_LOGIN_FAILED);
-			set_bit(RELOGIN_NEEDED, &vha->dpc_flags);
+			qlt_schedule_sess_for_deletion(fcport);
 			break;
 		}
 
Signature · 1 line
2.19.0.rc0
Reviewed-by on v1 6/13
#12 lore raw

Re: [PATCH 06/13] qla2xxx: fix n2n inconsistent plogi

Quoted 56 lines · Nilesh Javali

From: Quinn Tran <[email protected]>

For N2N topology, ELS Passthrough is used to send PLOGI. On failure of ELS pass through PLOGI, driver flipped over to using LLIOCB PLOGI for N2N. This is not consistent. This patch would delete the session to restart the connection, where ELS pass through PLOGI would be used consistently.

Fixes c76ae845ea83 ("scsi: qla2xxx: Add error handling for PLOGI ELS passthrough")

---
drivers/scsi/qla2xxx/qla_iocb.c | 8 +++-----

1 file changed, 3 insertions(+), 5 deletions(-)
drivers/scsi/qla2xxx/qla_iocb.c +3 -5
index 5e3ee1f7b43c..e0fe9ddb4bd2 100644
@@ -2958,6 +2958,7 @@ static void qla2x00_els_dcmd2_sp_done(srb_t *sp, int res)
 					set_bit(ISP_ABORT_NEEDED,
 					    &vha->dpc_flags);
 					qla2xxx_wake_dpc(vha);
+					break;
 				}
 				fallthrough;
 			default:
@@ -2967,9 +2968,7 @@ static void qla2x00_els_dcmd2_sp_done(srb_t *sp, int res)
 				    fw_status[0], fw_status[1], fw_status[2]);
 
 				fcport->flags &= ~FCF_ASYNC_SENT;
-				qla2x00_set_fcport_disc_state(fcport,
-				    DSC_LOGIN_FAILED);
-				set_bit(RELOGIN_NEEDED, &vha->dpc_flags);
+				qlt_schedule_sess_for_deletion(fcport);
 				break;
 			}
 			break;
@@ -2981,8 +2980,7 @@ static void qla2x00_els_dcmd2_sp_done(srb_t *sp, int res)
 			    fw_status[0], fw_status[1], fw_status[2]);
 
 			sp->fcport->flags &= ~FCF_ASYNC_SENT;
-			qla2x00_set_fcport_disc_state(fcport, DSC_LOGIN_FAILED);
-			set_bit(RELOGIN_NEEDED, &vha->dpc_flags);
+			qlt_schedule_sess_for_deletion(fcport);
 			break;
 		}
 
Signature · 1 line
2.19.0.rc0

Looks Good.

--
Himanshu Madhani Oracle Linux Engineering

author maintainer
#13 lore raw

PATCH 7/13 qla2xxx: Fix hang due to session stuck

In reply to Nilesh Javali

From: Quinn Tran <[email protected]>

User experience device lost. The log shows Get port data base command was queued up, failed, and requeued again. Every time it is requeued, it set the FCF_ASYNC_ACTIVE. This prevents any recovery code from occurring because driver thinks a recovery is in progress for this session. In essence, this session is hung. The reason it gets into this place is the session deletion got in front of this call due to link perturbation.

Break the requeue cycle and exit.
The session deletion code will trigger a session relogin.

Fixes 726b85487067 ("qla2xxx: Add framework for async fabric discovery")
---
 drivers/scsi/qla2xxx/qla_def.h  |  4 ++++
 drivers/scsi/qla2xxx/qla_init.c | 19 +++++++++++++++++--
 2 files changed, 21 insertions(+), 2 deletions(-)
drivers/scsi/qla2xxx/qla_def.h +4 -0
index 47d7fa1c7ae8..b0579bce5b88 100644
@@ -5437,4 +5437,8 @@ struct ql_vnd_tgt_stats_resp {
 #include "qla_gbl.h"
 #include "qla_dbg.h"
 #include "qla_inline.h"
+
+#define SESSION_DELETE(_fcport) (_fcport->disc_state == DSC_DELETE_PEND || \
+				 _fcport->disc_state == DSC_DELETED)
+
 #endif
drivers/scsi/qla2xxx/qla_init.c +17 -2
index 6ffe44b805b6..3c58a2911937 100644
@@ -575,6 +575,14 @@ qla2x00_async_adisc(struct scsi_qla_host *vha, fc_port_t *fcport,
 	struct srb_iocb *lio;
 	int rval = QLA_FUNCTION_FAILED;
 
+	if (SESSION_DELETE(fcport)) {
+		ql_log(ql_log_warn, vha, 0xffff,
+		       "%s: %8phC is being delete - not sending command.\n",
+		       __func__, fcport->port_name);
+		fcport->flags &= ~FCF_ASYNC_ACTIVE;
+		return rval;
+	}
+
 	if (!vha->flags.online || (fcport->flags & FCF_ASYNC_SENT))
 		return rval;
 
@@ -1338,8 +1346,15 @@ int qla24xx_async_gpdb(struct scsi_qla_host *vha, fc_port_t *fcport, u8 opt)
 	struct port_database_24xx *pd;
 	struct qla_hw_data *ha = vha->hw;
 
-	if (!vha->flags.online || (fcport->flags & FCF_ASYNC_SENT) ||
-	    fcport->loop_id == FC_NO_LOOP_ID) {
+	if (SESSION_DELETE(fcport)) {
+		ql_log(ql_log_warn, vha, 0xffff,
+		       "%s: %8phC is being delete - not sending command.\n",
+		       __func__, fcport->port_name);
+		fcport->flags &= ~FCF_ASYNC_ACTIVE;
+		return rval;
+	}
+
+	if (!vha->flags.online || fcport->flags & FCF_ASYNC_SENT) {
 		ql_log(ql_log_warn, vha, 0xffff,
 		    "%s: %8phC online %d flags %x - not sending command.\n",
 		    __func__, fcport->port_name, vha->flags.online, fcport->flags);
Signature · 1 line
2.19.0.rc0
#14 lore raw

Re: [PATCH 07/13] qla2xxx: Fix hang due to session stuck

Quoted 31 lines · Nilesh Javali

From: Quinn Tran <[email protected]>

User experience device lost. The log shows Get port data base command was queued up, failed, and requeued again. Every time it is requeued, it set the FCF_ASYNC_ACTIVE. This prevents any recovery code from occurring because driver thinks a recovery is in progress for this session. In essence, this session is hung. The reason it gets into this place is the session deletion got in front of this call due to link perturbation.

Break the requeue cycle and exit.
The session deletion code will trigger a session relogin.

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

---
drivers/scsi/qla2xxx/qla_def.h | 4 ++++ drivers/scsi/qla2xxx/qla_init.c | 19 +++++++++++++++++--

2 files changed, 21 insertions(+), 2 deletions(-)
drivers/scsi/qla2xxx/qla_def.h +0 -0
index 47d7fa1c7ae8..b0579bce5b88 100644

drivers/scsi/qla2xxx/qla_def.h struct ql_vnd_tgt_stats_resp { · line 5443

Quoted 7 lines
drivers/scsi/qla2xxx/qla_def.h +4 -0
@@ -5437,4 +5437,8 @@ struct ql_vnd_tgt_stats_resp {
 #include "qla_gbl.h"
 #include "qla_dbg.h"
 #include "qla_inline.h"
+
+#define SESSION_DELETE(_fcport) (_fcport->disc_state == DSC_DELETE_PEND || \
+				 _fcport->disc_state == DSC_DELETED)
+

would you be open to changing the macro name to IS_SESSION_DELETED(). Since you are checking for pending deletion in progress or deleted for session, name SESSION_DELETE is not reader friendly.

Quoted 41 lines
drivers/scsi/qla2xxx/qla_def.h +0 -0
 #endif
drivers/scsi/qla2xxx/qla_init.c +17 -2
index 6ffe44b805b6..3c58a2911937 100644
@@ -575,6 +575,14 @@ qla2x00_async_adisc(struct scsi_qla_host *vha, fc_port_t *fcport,
 	struct srb_iocb *lio;
 	int rval = QLA_FUNCTION_FAILED;
 
+	if (SESSION_DELETE(fcport)) {
+		ql_log(ql_log_warn, vha, 0xffff,
+		       "%s: %8phC is being delete - not sending command.\n",
+		       __func__, fcport->port_name);
+		fcport->flags &= ~FCF_ASYNC_ACTIVE;
+		return rval;
+	}
+
 	if (!vha->flags.online || (fcport->flags & FCF_ASYNC_SENT))
 		return rval;
 
@@ -1338,8 +1346,15 @@ int qla24xx_async_gpdb(struct scsi_qla_host *vha, fc_port_t *fcport, u8 opt)
 	struct port_database_24xx *pd;
 	struct qla_hw_data *ha = vha->hw;
 
-	if (!vha->flags.online || (fcport->flags & FCF_ASYNC_SENT) ||
-	    fcport->loop_id == FC_NO_LOOP_ID) {
+	if (SESSION_DELETE(fcport)) {
+		ql_log(ql_log_warn, vha, 0xffff,
+		       "%s: %8phC is being delete - not sending command.\n",
+		       __func__, fcport->port_name);
+		fcport->flags &= ~FCF_ASYNC_ACTIVE;
+		return rval;
+	}
+
+	if (!vha->flags.online || fcport->flags & FCF_ASYNC_SENT) {
 		ql_log(ql_log_warn, vha, 0xffff,
 		    "%s: %8phC online %d flags %x - not sending command.\n",
 		    __func__, fcport->port_name, vha->flags.online, fcport->flags);
Signature · 1 line
2.19.0.rc0

--
Himanshu Madhani Oracle Linux Engineering

author maintainer
#15 lore raw

PATCH 8/13 qla2xxx: Fix laggy FC remote port session recovery

In reply to Nilesh Javali

From: Quinn Tran <[email protected]>

For session recovery, driver relies on the dpc thread to initiate certain operation. The dpc thread runs exclusively without the Mailbox interface being occupied. Recent code change for heartbeat check via mailbox cmd 0 is causing the dpc thread from carrying out its operation. This patch allows the higher priority error recovery to run first before running the lower priority heartbeat check.

Fixes d94d8158e184 ("scsi: qla2xxx: Add heartbeat check")
---
 drivers/scsi/qla2xxx/qla_def.h |  1 +
 drivers/scsi/qla2xxx/qla_os.c  | 20 +++++++++++++++++---
 2 files changed, 18 insertions(+), 3 deletions(-)
drivers/scsi/qla2xxx/qla_def.h +1 -0
index b0579bce5b88..80b02b077753 100644
@@ -4621,6 +4621,7 @@ struct qla_hw_data {
 	struct workqueue_struct *wq;
 	struct work_struct heartbeat_work;
 	struct qlfc_fw fw_buf;
+	unsigned long last_heartbeat_run_jiffies;
 
 	/* FCP_CMND priority support */
 	struct qla_fcp_prio_cfg *fcp_prio_cfg;
drivers/scsi/qla2xxx/qla_os.c +17 -3
index d572a76d0fa0..89c7ac36a41a 100644
@@ -7218,7 +7218,7 @@ static bool qla_do_heartbeat(struct scsi_qla_host *vha)
 	return do_heartbeat;
 }
 
-static void qla_heart_beat(struct scsi_qla_host *vha)
+static void qla_heart_beat(struct scsi_qla_host *vha, u16 dpc_started)
 {
 	struct qla_hw_data *ha = vha->hw;
 
@@ -7228,8 +7228,19 @@ static void qla_heart_beat(struct scsi_qla_host *vha)
 	if (vha->hw->flags.eeh_busy || qla2x00_chip_is_down(vha))
 		return;
 
-	if (qla_do_heartbeat(vha))
+	/*
+	 * dpc thread cannot run if heartbeat is running at the same time.
+	 * We also do not want to starve heartbeat task. Therefore, do
+	 * heartbeat task at least once every 5 seconds.
+	 */
+	if (dpc_started &&
+	    time_before(jiffies, ha->last_heartbeat_run_jiffies + 5 * HZ))
+		return;
+
+	if (qla_do_heartbeat(vha)) {
+		ha->last_heartbeat_run_jiffies = jiffies;
 		queue_work(ha->wq, &ha->heartbeat_work);
+	}
 }
 
 /**************************************************************************
@@ -7420,6 +7431,8 @@ qla2x00_timer(struct timer_list *t)
 		start_dpc++;
 	}
 
+	/* borrowing w to signify dpc will run */
+	w = 0;
 	/* Schedule the DPC routine if needed */
 	if ((test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) ||
 	    test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags) ||
@@ -7452,9 +7465,10 @@ qla2x00_timer(struct timer_list *t)
 		    test_bit(RELOGIN_NEEDED, &vha->dpc_flags),
 		    test_bit(PROCESS_PUREX_IOCB, &vha->dpc_flags));
 		qla2xxx_wake_dpc(vha);
+		w = 1;
 	}
 
-	qla_heart_beat(vha);
+	qla_heart_beat(vha, w);
 
 	qla2x00_restart_timer(vha, WATCH_INTERVAL);
 }
Signature · 1 line
2.19.0.rc0
Reviewed-by on v1 8/13
#16 lore raw

Re: [PATCH 08/13] qla2xxx: Fix laggy FC remote port session recovery

Quoted 93 lines · Nilesh Javali

From: Quinn Tran <[email protected]>

For session recovery, driver relies on the dpc thread to initiate certain operation. The dpc thread runs exclusively without the Mailbox interface being occupied. Recent code change for heartbeat check via mailbox cmd 0 is causing the dpc thread from carrying out its operation. This patch allows the higher priority error recovery to run first before running the lower priority heartbeat check.

Fixes d94d8158e184 ("scsi: qla2xxx: Add heartbeat check")

---
drivers/scsi/qla2xxx/qla_def.h | 1 + drivers/scsi/qla2xxx/qla_os.c | 20 +++++++++++++++++---

2 files changed, 18 insertions(+), 3 deletions(-)
drivers/scsi/qla2xxx/qla_def.h +1 -0
index b0579bce5b88..80b02b077753 100644
@@ -4621,6 +4621,7 @@ struct qla_hw_data {
 	struct workqueue_struct *wq;
 	struct work_struct heartbeat_work;
 	struct qlfc_fw fw_buf;
+	unsigned long last_heartbeat_run_jiffies;
 
 	/* FCP_CMND priority support */
 	struct qla_fcp_prio_cfg *fcp_prio_cfg;
drivers/scsi/qla2xxx/qla_os.c +17 -3
index d572a76d0fa0..89c7ac36a41a 100644
@@ -7218,7 +7218,7 @@ static bool qla_do_heartbeat(struct scsi_qla_host *vha)
 	return do_heartbeat;
 }
 
-static void qla_heart_beat(struct scsi_qla_host *vha)
+static void qla_heart_beat(struct scsi_qla_host *vha, u16 dpc_started)
 {
 	struct qla_hw_data *ha = vha->hw;
 
@@ -7228,8 +7228,19 @@ static void qla_heart_beat(struct scsi_qla_host *vha)
 	if (vha->hw->flags.eeh_busy || qla2x00_chip_is_down(vha))
 		return;
 
-	if (qla_do_heartbeat(vha))
+	/*
+	 * dpc thread cannot run if heartbeat is running at the same time.
+	 * We also do not want to starve heartbeat task. Therefore, do
+	 * heartbeat task at least once every 5 seconds.
+	 */
+	if (dpc_started &&
+	    time_before(jiffies, ha->last_heartbeat_run_jiffies + 5 * HZ))
+		return;
+
+	if (qla_do_heartbeat(vha)) {
+		ha->last_heartbeat_run_jiffies = jiffies;
 		queue_work(ha->wq, &ha->heartbeat_work);
+	}
 }
 
 /**************************************************************************
@@ -7420,6 +7431,8 @@ qla2x00_timer(struct timer_list *t)
 		start_dpc++;
 	}
 
+	/* borrowing w to signify dpc will run */
+	w = 0;
 	/* Schedule the DPC routine if needed */
 	if ((test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags) ||
 	    test_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags) ||
@@ -7452,9 +7465,10 @@ qla2x00_timer(struct timer_list *t)
 		    test_bit(RELOGIN_NEEDED, &vha->dpc_flags),
 		    test_bit(PROCESS_PUREX_IOCB, &vha->dpc_flags));
 		qla2xxx_wake_dpc(vha);
+		w = 1;
 	}
 
-	qla_heart_beat(vha);
+	qla_heart_beat(vha, w);
 
 	qla2x00_restart_timer(vha, WATCH_INTERVAL);
 }
Signature · 1 line
2.19.0.rc0

Looks Good.

--
Himanshu Madhani Oracle Linux Engineering

author maintainer
#17 lore raw

PATCH 9/13 qla2xxx: reduce false trigger to login

In reply to Nilesh Javali

From: Quinn Tran <[email protected]>

While a session is in the middle of a relogin,
a late RSCN can be delivered from switch. RSCN trigger fabric scan where the scan logic can trigger another session login while a login is in progress.
This patch reduce the extra trigger to prevent multiple login to the same session.

Fixes bee8b84686c4 ("scsi: qla2xxx: Reduce redundant ADISC command for RSCNs")
---
 drivers/scsi/qla2xxx/qla_init.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/scsi/qla2xxx/qla_init.c +3 -2
index 3c58a2911937..a53894444460 100644
@@ -1644,7 +1644,8 @@ int qla24xx_fcport_handle_login(struct scsi_qla_host *vha, fc_port_t *fcport)
 	    fcport->login_gen, fcport->loop_id, fcport->scan_state,
 	    fcport->fc4_type);
 
-	if (fcport->scan_state != QLA_FCPORT_FOUND)
+	if (fcport->scan_state != QLA_FCPORT_FOUND ||
+	    fcport->disc_state == DSC_DELETE_PEND)
 		return 0;
 
 	if ((fcport->loop_id != FC_NO_LOOP_ID) &&
@@ -1665,7 +1666,7 @@ int qla24xx_fcport_handle_login(struct scsi_qla_host *vha, fc_port_t *fcport)
 	if (vha->host->active_mode == MODE_TARGET && !N2N_TOPO(vha->hw))
 		return 0;
 
-	if (fcport->flags & FCF_ASYNC_SENT) {
+	if (fcport->flags & (FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE)) {
 		set_bit(RELOGIN_NEEDED, &vha->dpc_flags);
 		return 0;
 	}
Signature · 1 line
2.19.0.rc0
Reviewed-by on v1 9/13
#18 lore raw

Re: [PATCH 09/13] qla2xxx: reduce false trigger to login

Quoted 47 lines · Nilesh Javali

From: Quinn Tran <[email protected]>

While a session is in the middle of a relogin,
a late RSCN can be delivered from switch. RSCN trigger fabric scan where the scan logic can trigger another session login while a login is in progress.
This patch reduce the extra trigger to prevent multiple login to the same session.

Fixes bee8b84686c4 ("scsi: qla2xxx: Reduce redundant ADISC command for RSCNs")

---
drivers/scsi/qla2xxx/qla_init.c | 5 +++--

1 file changed, 3 insertions(+), 2 deletions(-)
drivers/scsi/qla2xxx/qla_init.c +3 -2
index 3c58a2911937..a53894444460 100644
@@ -1644,7 +1644,8 @@ int qla24xx_fcport_handle_login(struct scsi_qla_host *vha, fc_port_t *fcport)
 	    fcport->login_gen, fcport->loop_id, fcport->scan_state,
 	    fcport->fc4_type);
 
-	if (fcport->scan_state != QLA_FCPORT_FOUND)
+	if (fcport->scan_state != QLA_FCPORT_FOUND ||
+	    fcport->disc_state == DSC_DELETE_PEND)
 		return 0;
 
 	if ((fcport->loop_id != FC_NO_LOOP_ID) &&
@@ -1665,7 +1666,7 @@ int qla24xx_fcport_handle_login(struct scsi_qla_host *vha, fc_port_t *fcport)
 	if (vha->host->active_mode == MODE_TARGET && !N2N_TOPO(vha->hw))
 		return 0;
 
-	if (fcport->flags & FCF_ASYNC_SENT) {
+	if (fcport->flags & (FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE)) {
 		set_bit(RELOGIN_NEEDED, &vha->dpc_flags);
 		return 0;
 	}
Signature · 1 line
2.19.0.rc0

--
Himanshu Madhani Oracle Linux Engineering

author maintainer
#19 lore raw

PATCH 10/13 qla2xxx: Fix stuck session of prli reject

In reply to Nilesh Javali

From: Quinn Tran <[email protected]>

Remove stale recovery code that prevents normal path recovery.

Fixes 1cbc0efcd9be ("scsi: qla2xxx: Fix retry for PRLI RJT with reason of BUSY")
---
 drivers/scsi/qla2xxx/qla_init.c | 7 -------
 1 file changed, 7 deletions(-)
drivers/scsi/qla2xxx/qla_init.c +0 -7
index a53894444460..bf6979eb478a 100644
@@ -2105,13 +2105,6 @@ qla24xx_handle_prli_done_event(struct scsi_qla_host *vha, struct event_arg *ea)
 		qla24xx_post_gpdb_work(vha, ea->fcport, 0);
 		break;
 	default:
-		if ((ea->iop[0] == LSC_SCODE_ELS_REJECT) &&
-		    (ea->iop[1] == 0x50000)) {   /* reson 5=busy expl:0x0 */
-			set_bit(RELOGIN_NEEDED, &vha->dpc_flags);
-			ea->fcport->fw_login_state = DSC_LS_PLOGI_COMP;
-			break;
-		}
-
 		sp = ea->sp;
 		ql_dbg(ql_dbg_disc, vha, 0x2118,
 		       "%s %d %8phC priority %s, fc4type %x prev try %s\n",
Signature · 1 line
2.19.0.rc0
Reviewed-by on v1 10/13
#20 lore raw

Re: [PATCH 10/13] qla2xxx: Fix stuck session of prli reject

Quoted 37 lines · Nilesh Javali

From: Quinn Tran <[email protected]>

Remove stale recovery code that prevents normal path recovery.

Fixes 1cbc0efcd9be ("scsi: qla2xxx: Fix retry for PRLI RJT with reason of BUSY")

---
drivers/scsi/qla2xxx/qla_init.c | 7 -------

1 file changed, 7 deletions(-)
drivers/scsi/qla2xxx/qla_init.c +0 -7
index a53894444460..bf6979eb478a 100644
@@ -2105,13 +2105,6 @@ qla24xx_handle_prli_done_event(struct scsi_qla_host *vha, struct event_arg *ea)
 		qla24xx_post_gpdb_work(vha, ea->fcport, 0);
 		break;
 	default:
-		if ((ea->iop[0] == LSC_SCODE_ELS_REJECT) &&
-		    (ea->iop[1] == 0x50000)) {   /* reson 5=busy expl:0x0 */
-			set_bit(RELOGIN_NEEDED, &vha->dpc_flags);
-			ea->fcport->fw_login_state = DSC_LS_PLOGI_COMP;
-			break;
-		}
-
 		sp = ea->sp;
 		ql_dbg(ql_dbg_disc, vha, 0x2118,
 		       "%s %d %8phC priority %s, fc4type %x prev try %s\n",
Signature · 1 line
2.19.0.rc0

--
Himanshu Madhani Oracle Linux Engineering

author maintainer
#21 lore raw

PATCH 11/13 qla2xxx: Use correct feature type field during rffid processing

In reply to Nilesh Javali

From: Manish Rangankar <[email protected]>

During SNS Register FC-4 Features (RFF_ID) for initiator driver was sending incorrect type field for nvme supported device. Use correct feature type field.

---
 drivers/scsi/qla2xxx/qla_gs.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/scsi/qla2xxx/qla_gs.c +2 -3
index a812f4a45232..6b67bd561810 100644
@@ -676,8 +676,7 @@ qla2x00_rff_id(scsi_qla_host_t *vha, u8 type)
 		return (QLA_SUCCESS);
 	}
 
-	return qla_async_rffid(vha, &vha->d_id, qlt_rff_id(vha),
-	    FC4_TYPE_FCP_SCSI);
+	return qla_async_rffid(vha, &vha->d_id, qlt_rff_id(vha), type);
 }
 
 static int qla_async_rffid(scsi_qla_host_t *vha, port_id_t *d_id,
@@ -729,7 +728,7 @@ static int qla_async_rffid(scsi_qla_host_t *vha, port_id_t *d_id,
 	/* Prepare CT arguments -- port_id, FC-4 feature, FC-4 type */
 	ct_req->req.rff_id.port_id = port_id_to_be_id(*d_id);
 	ct_req->req.rff_id.fc4_feature = fc4feature;
-	ct_req->req.rff_id.fc4_type = fc4type;		/* SCSI - FCP */
+	ct_req->req.rff_id.fc4_type = fc4type;		/* SCSI-FCP or FC-NVMe */
 
 	sp->u.iocb_cmd.u.ctarg.req_size = RFF_ID_REQ_SIZE;
 	sp->u.iocb_cmd.u.ctarg.rsp_size = RFF_ID_RSP_SIZE;
Signature · 1 line
2.19.0.rc0
#22 lore raw

Re: [PATCH 11/13] qla2xxx: Use correct feature type field during rffid processing

Quoted 11 lines · Nilesh Javali

From: Manish Rangankar <[email protected]>

During SNS Register FC-4 Features (RFF_ID) for initiator driver was sending incorrect type field for nvme supported device. Use correct feature type field.

Fixes tags perhaps missing?

Quoted 32 lines

---
drivers/scsi/qla2xxx/qla_gs.c | 5 ++---

1 file changed, 2 insertions(+), 3 deletions(-)
drivers/scsi/qla2xxx/qla_gs.c +2 -3
index a812f4a45232..6b67bd561810 100644
@@ -676,8 +676,7 @@ qla2x00_rff_id(scsi_qla_host_t *vha, u8 type)
 		return (QLA_SUCCESS);
 	}
 
-	return qla_async_rffid(vha, &vha->d_id, qlt_rff_id(vha),
-	    FC4_TYPE_FCP_SCSI);
+	return qla_async_rffid(vha, &vha->d_id, qlt_rff_id(vha), type);
 }
 
 static int qla_async_rffid(scsi_qla_host_t *vha, port_id_t *d_id,
@@ -729,7 +728,7 @@ static int qla_async_rffid(scsi_qla_host_t *vha, port_id_t *d_id,
 	/* Prepare CT arguments -- port_id, FC-4 feature, FC-4 type */
 	ct_req->req.rff_id.port_id = port_id_to_be_id(*d_id);
 	ct_req->req.rff_id.fc4_feature = fc4feature;
-	ct_req->req.rff_id.fc4_type = fc4type;		/* SCSI - FCP */
+	ct_req->req.rff_id.fc4_type = fc4type;		/* SCSI-FCP or FC-NVMe */
 
 	sp->u.iocb_cmd.u.ctarg.req_size = RFF_ID_REQ_SIZE;
 	sp->u.iocb_cmd.u.ctarg.rsp_size = RFF_ID_RSP_SIZE;
Signature · 1 line
2.19.0.rc0

--
Himanshu Madhani Oracle Linux Engineering

author maintainer
#23 lore raw

PATCH 12/13 qla2xxx: Increase max limit of ql2xnvme_queues

In reply to Nilesh Javali

From: Shreyas Deodhar <[email protected]>

Increase max limit of ql2xnvme_queues to (max_qpair - 1).

Fixes 65120de26a547 ("scsi: qla2xxx: Add ql2xnvme_queues module param to configure number of NVMe queues")
---
 drivers/scsi/qla2xxx/qla_nvme.c | 15 ++++++++++-----
 drivers/scsi/qla2xxx/qla_nvme.h |  1 -
 drivers/scsi/qla2xxx/qla_os.c   |  1 -
 3 files changed, 10 insertions(+), 7 deletions(-)
drivers/scsi/qla2xxx/qla_nvme.c +10 -5
index 794a95b2e3b4..87c9404aa401 100644
@@ -799,17 +799,22 @@ int qla_nvme_register_hba(struct scsi_qla_host *vha)
 	ha = vha->hw;
 	tmpl = &qla_nvme_fc_transport;
 
-	if (ql2xnvme_queues < MIN_NVME_HW_QUEUES || ql2xnvme_queues > MAX_NVME_HW_QUEUES) {
+	if (ql2xnvme_queues < MIN_NVME_HW_QUEUES) {
 		ql_log(ql_log_warn, vha, 0xfffd,
-		    "ql2xnvme_queues=%d is out of range(MIN:%d - MAX:%d). Resetting ql2xnvme_queues to:%d\n",
-		    ql2xnvme_queues, MIN_NVME_HW_QUEUES, MAX_NVME_HW_QUEUES,
-		    DEF_NVME_HW_QUEUES);
+		    "ql2xnvme_queues=%d is lower than minimum queues: %d. Resetting ql2xnvme_queues to:%d\n",
+		    ql2xnvme_queues, MIN_NVME_HW_QUEUES, DEF_NVME_HW_QUEUES);
 		ql2xnvme_queues = DEF_NVME_HW_QUEUES;
+	} else if (ql2xnvme_queues > (ha->max_qpairs - 1)) {
+		ql_log(ql_log_warn, vha, 0xfffd,
+		       "ql2xnvme_queues=%d is greater than available IRQs: %d. Resetting ql2xnvme_queues to: %d\n",
+		       ql2xnvme_queues, (ha->max_qpairs - 1),
+		       (ha->max_qpairs - 1));
+		ql2xnvme_queues = ((ha->max_qpairs - 1));
 	}
 
 	qla_nvme_fc_transport.max_hw_queues =
 	    min((uint8_t)(ql2xnvme_queues),
-		(uint8_t)(ha->max_qpairs ? ha->max_qpairs : 1));
+		(uint8_t)((ha->max_qpairs - 1) ? (ha->max_qpairs - 1) : 1));
 
 	ql_log(ql_log_info, vha, 0xfffb,
 	       "Number of NVME queues used for this port: %d\n",
drivers/scsi/qla2xxx/qla_nvme.h +0 -1
index d0e3c0e07baa..d299478371b2 100644
@@ -14,7 +14,6 @@
 #include "qla_dsd.h"
 
 #define MIN_NVME_HW_QUEUES 1
-#define MAX_NVME_HW_QUEUES 128
 #define DEF_NVME_HW_QUEUES 8
 
 #define NVME_ATIO_CMD_OFF 32
drivers/scsi/qla2xxx/qla_os.c +0 -1
index 89c7ac36a41a..8f47dd421e33 100644
@@ -344,7 +344,6 @@ MODULE_PARM_DESC(ql2xnvme_queues,
 	"Number of NVMe Queues that can be configured.\n"
 	"Final value will be min(ql2xnvme_queues, num_cpus,num_chip_queues)\n"
 	"1 - Minimum number of queues supported\n"
-	"128 - Maximum number of queues supported\n"
 	"8 - Default value");
 
 static struct scsi_transport_template *qla2xxx_transport_template = NULL;
Signature · 1 line
2.19.0.rc0
Reviewed-by on v1 12/13
#24 lore raw

Re: [PATCH 12/13] qla2xxx: Increase max limit of ql2xnvme_queues

Quoted 77 lines · Nilesh Javali

From: Shreyas Deodhar <[email protected]>

Increase max limit of ql2xnvme_queues to (max_qpair - 1).

Fixes 65120de26a547 ("scsi: qla2xxx: Add ql2xnvme_queues module param to configure number of NVMe queues")

---

drivers/scsi/qla2xxx/qla_nvme.c | 15 ++++++++++-----
drivers/scsi/qla2xxx/qla_nvme.h |  1 -
drivers/scsi/qla2xxx/qla_os.c   |  1 -
3 files changed, 10 insertions(+), 7 deletions(-)
drivers/scsi/qla2xxx/qla_nvme.c +10 -5
index 794a95b2e3b4..87c9404aa401 100644
@@ -799,17 +799,22 @@ int qla_nvme_register_hba(struct scsi_qla_host *vha)
 	ha = vha->hw;
 	tmpl = &qla_nvme_fc_transport;
 
-	if (ql2xnvme_queues < MIN_NVME_HW_QUEUES || ql2xnvme_queues > MAX_NVME_HW_QUEUES) {
+	if (ql2xnvme_queues < MIN_NVME_HW_QUEUES) {
 		ql_log(ql_log_warn, vha, 0xfffd,
-		    "ql2xnvme_queues=%d is out of range(MIN:%d - MAX:%d). Resetting ql2xnvme_queues to:%d\n",
-		    ql2xnvme_queues, MIN_NVME_HW_QUEUES, MAX_NVME_HW_QUEUES,
-		    DEF_NVME_HW_QUEUES);
+		    "ql2xnvme_queues=%d is lower than minimum queues: %d. Resetting ql2xnvme_queues to:%d\n",
+		    ql2xnvme_queues, MIN_NVME_HW_QUEUES, DEF_NVME_HW_QUEUES);
 		ql2xnvme_queues = DEF_NVME_HW_QUEUES;
+	} else if (ql2xnvme_queues > (ha->max_qpairs - 1)) {
+		ql_log(ql_log_warn, vha, 0xfffd,
+		       "ql2xnvme_queues=%d is greater than available IRQs: %d. Resetting ql2xnvme_queues to: %d\n",
+		       ql2xnvme_queues, (ha->max_qpairs - 1),
+		       (ha->max_qpairs - 1));
+		ql2xnvme_queues = ((ha->max_qpairs - 1));
 	}
 
 	qla_nvme_fc_transport.max_hw_queues =
 	    min((uint8_t)(ql2xnvme_queues),
-		(uint8_t)(ha->max_qpairs ? ha->max_qpairs : 1));
+		(uint8_t)((ha->max_qpairs - 1) ? (ha->max_qpairs - 1) : 1));
 
 	ql_log(ql_log_info, vha, 0xfffb,
 	       "Number of NVME queues used for this port: %d\n",
drivers/scsi/qla2xxx/qla_nvme.h +0 -1
index d0e3c0e07baa..d299478371b2 100644
@@ -14,7 +14,6 @@
 #include "qla_dsd.h"
 
 #define MIN_NVME_HW_QUEUES 1
-#define MAX_NVME_HW_QUEUES 128
 #define DEF_NVME_HW_QUEUES 8
 
 #define NVME_ATIO_CMD_OFF 32
drivers/scsi/qla2xxx/qla_os.c +0 -1
index 89c7ac36a41a..8f47dd421e33 100644
@@ -344,7 +344,6 @@ MODULE_PARM_DESC(ql2xnvme_queues,
 	"Number of NVMe Queues that can be configured.\n"
 	"Final value will be min(ql2xnvme_queues, num_cpus,num_chip_queues)\n"
 	"1 - Minimum number of queues supported\n"
-	"128 - Maximum number of queues supported\n"
 	"8 - Default value");
 
 static struct scsi_transport_template *qla2xxx_transport_template = NULL;
Signature · 1 line
2.19.0.rc0

--
Himanshu Madhani Oracle Linux Engineering

author maintainer
#25 lore raw

PATCH 13/13 qla2xxx: Update version to 10.02.07.400-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 913d454f4949..b09d7d2080c0 100644
@@ -6,9 +6,9 @@
 /*
  * Driver version
  */
-#define QLA2XXX_VERSION      "10.02.07.300-k"
+#define QLA2XXX_VERSION      "10.02.07.400-k"
 
 #define QLA_DRIVER_MAJOR_VER	10
 #define QLA_DRIVER_MINOR_VER	2
 #define QLA_DRIVER_PATCH_VER	7
-#define QLA_DRIVER_BETA_VER	300
+#define QLA_DRIVER_BETA_VER	400
Signature · 1 line
2.19.0.rc0
Reviewed-by on v1 13/13
#26 lore raw

Re: [PATCH 13/13] qla2xxx: Update version to 10.02.07.400-k

Quoted 28 lines · 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 913d454f4949..b09d7d2080c0 100644
@@ -6,9 +6,9 @@
 /*
 * Driver version
 */
-#define QLA2XXX_VERSION      "10.02.07.300-k"
+#define QLA2XXX_VERSION      "10.02.07.400-k"
 
 #define QLA_DRIVER_MAJOR_VER	10
 #define QLA_DRIVER_MINOR_VER	2
 #define QLA_DRIVER_PATCH_VER	7
-#define QLA_DRIVER_BETA_VER	300
+#define QLA_DRIVER_BETA_VER	400
Signature · 1 line
2.19.0.rc0

--
Himanshu Madhani Oracle Linux Engineering