Skip to contentSkip to conversation

qla2xxx: Allow nvme report port registration

PATCH In review Daniel Wagner 2 participants 4 messages Jul 28, 2022 – Aug 5, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qla2xxx: Allow nvme report port registration

Move the both ONLINE state check into qla2x00_update_fcport and call both register port register functions.

Currently, qla2x00_reg_remote_port and qla_nvme_register_remote check the state if it is ONLINE. If it not, the state is set to ONLINE and the function is executed.

qla2x00_reg_remote_port is called before qla_nvme_register_remote and hence qla_nvme_register_remote will always bail out and never register a nvme remote port.

Fixes 6a45c8e137d4 ("scsi: qla2xxx: Fix disk failure to rediscover")
Cc Himanshu Madhani <[email protected]>
Cc Quinn Tran <[email protected]>
Cc Nilesh Javali <[email protected]>
---
 drivers/scsi/qla2xxx/qla_init.c | 33 ++++++++++++++++-----------------
 drivers/scsi/qla2xxx/qla_nvme.c |  5 -----
 2 files changed, 16 insertions(+), 22 deletions(-)
drivers/scsi/qla2xxx/qla_init.c +16 -17
index 3f3417a3e891..71b804cfd808 100644
@@ -5764,11 +5764,6 @@ qla2x00_reg_remote_port(scsi_qla_host_t *vha, fc_port_t *fcport)
 	struct fc_rport *rport;
 	unsigned long flags;
 
-	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 |
@@ -5864,18 +5859,25 @@ qla2x00_update_fcport(scsi_qla_host_t *vha, fc_port_t *fcport)
 
 	qla24xx_update_fcport_fcp_prio(vha, fcport);
 
+	if (atomic_read(&fcport->state) != FCS_ONLINE) {
+		qla2x00_set_fcport_state(fcport, FCS_ONLINE);
+
+		switch (vha->host->active_mode) {
+		case MODE_INITIATOR:
+		case MODE_DUAL:
+			qla2x00_reg_remote_port(vha, fcport);
+			break;
+		default:
+			break;
+		}
+
+		if (NVME_TARGET(vha->hw, fcport))
+			qla_nvme_register_remote(vha, fcport);
+	}
+
 	switch (vha->host->active_mode) {
-	case MODE_INITIATOR:
-		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);
-		break;
 	case MODE_DUAL:
-		qla2x00_reg_remote_port(vha, fcport);
 		if (!vha->vha_tgt.qla_tgt->tgt_stop &&
 			!vha->vha_tgt.qla_tgt->tgt_stopped)
 			qlt_fc_port_added(vha, fcport);
@@ -5884,9 +5886,6 @@ qla2x00_update_fcport(scsi_qla_host_t *vha, fc_port_t *fcport)
 		break;
 	}
 
-	if (NVME_TARGET(vha->hw, fcport))
-		qla_nvme_register_remote(vha, fcport);
-
 	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 +0 -5
index 87c9404aa401..7450c3458be7 100644
@@ -37,11 +37,6 @@ 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.35.3
#1 lore raw
Quoted 11 lines · Daniel Wagner

Move the both ONLINE state check into qla2x00_update_fcport and call both register port register functions.

Currently, qla2x00_reg_remote_port and qla_nvme_register_remote check the state if it is ONLINE. If it not, the state is set to ONLINE and the function is executed.

qla2x00_reg_remote_port is called before qla_nvme_register_remote and hence qla_nvme_register_remote will always bail out and never register a nvme remote port.

Quoted 5 lines
Fixes 6a45c8e137d4 ("scsi: qla2xxx: Fix disk failure to rediscover")
Cc Himanshu Madhani <[email protected]>
Cc Quinn Tran <[email protected]>
Cc Nilesh Javali <[email protected]>

I see the offending patch got reverted. FWIW, this patch works for me fine.

#2 lore raw

Hey Daniel,

Quoted 14 lines · Daniel Wagner
Quoted 11 lines · Daniel Wagner

Move the both ONLINE state check into qla2x00_update_fcport and call both register port register functions.

Currently, qla2x00_reg_remote_port and qla_nvme_register_remote check the state if it is ONLINE. If it not, the state is set to ONLINE and the function is executed.

qla2x00_reg_remote_port is called before qla_nvme_register_remote and hence qla_nvme_register_remote will always bail out and never register a nvme remote port.

Quoted 8 lines
Quoted 5 lines
Fixes 6a45c8e137d4 ("scsi: qla2xxx: Fix disk failure to rediscover")
Cc Himanshu Madhani <[email protected]>
Cc Quinn Tran <[email protected]>
Cc Nilesh Javali <[email protected]>

I see the offending patch got reverted. FWIW, this patch works for me fine.

Do you see issue with reverted patch?

I see no issues with the code change per say, just want to understand if you were seeing issue with the offending patch reverted as well?

--
Himanshu Madhani Oracle Linux Engineering

#3 lore raw
Quoted 1 line · Himanshu Madhani

Do you see issue with reverted patch?

No, all is good again with 6a45c8e137d4 ("scsi: qla2xxx: Fix disk failure to rediscover") reverted.

Quoted 2 lines

I see no issues with the code change per say, just want to understand if you were seeing issue with the offending patch reverted as well?

I didn't see the revert in time hence I started to fix the code because I understood the patch actually fixes a race.