]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
scsi: qla2xxx: Query FW again before proceeding with login
authorAnil Gurumurthy <agurumurthy@marvell.com>
Wed, 10 Dec 2025 10:16:02 +0000 (15:46 +0530)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 17 Dec 2025 03:34:23 +0000 (22:34 -0500)
Issue occurred during a continuous reboot test of several thousand
iterations specific to a fabric topo with dual mode target where it
sends a PLOGI/PRLI and then sends a LOGO. The initiator was also in the
process of discovery and sent a PLOGI to the switch. It then queried a
list of ports logged in via mbx 75h and the GPDB response indicated that
the target was logged in. This caused a mismatch in the states between
the driver and FW.  Requery the FW for the state and proceed with the
rest of discovery process.

Fixes: a4239945b8ad ("scsi: qla2xxx: Add switch command to simplify fabric discovery")
Cc: stable@vger.kernel.org
Signed-off-by: Anil Gurumurthy <agurumurthy@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Reviewed-by: Himanshu Madhani <hmadhani2024@gmail.com>
Link: https://patch.msgid.link/20251210101604.431868-11-njavali@marvell.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/qla2xxx/qla_init.c
drivers/scsi/qla2xxx/qla_isr.c

index 6ce3a492ad6f52f85d3231d85a74652e124a530d..689f909943b4c60b208ac9a4e7bc77f3e5f381e2 100644 (file)
@@ -2462,8 +2462,23 @@ qla24xx_handle_plogi_done_event(struct scsi_qla_host *vha, struct event_arg *ea)
            ea->sp->gen1, fcport->rscn_gen,
            ea->data[0], ea->data[1], ea->iop[0], ea->iop[1]);
 
-       if ((fcport->fw_login_state == DSC_LS_PLOGI_PEND) ||
-           (fcport->fw_login_state == DSC_LS_PRLI_PEND)) {
+       if (fcport->fw_login_state == DSC_LS_PLOGI_PEND) {
+               ql_dbg(ql_dbg_disc, vha, 0x20ea,
+                   "%s %d %8phC Remote is trying to login\n",
+                   __func__, __LINE__, fcport->port_name);
+               /*
+                * If we get here, there is port thats already logged in,
+                * but it's state has not moved ahead. Recheck with FW on
+                * what state it is in and proceed ahead
+                */
+               if (!N2N_TOPO(vha->hw)) {
+                       fcport->fw_login_state = DSC_LS_PRLI_COMP;
+                       qla24xx_post_gpdb_work(vha, fcport, 0);
+               }
+               return;
+       }
+
+       if (fcport->fw_login_state == DSC_LS_PRLI_PEND) {
                ql_dbg(ql_dbg_disc, vha, 0x20ea,
                    "%s %d %8phC Remote is trying to login\n",
                    __func__, __LINE__, fcport->port_name);
index a3971afc2dd1e9d1c6e90c7e426e35a15f608ca2..a4dda4fcb52cea4558129ce26dc88955466ce8a1 100644 (file)
@@ -1669,13 +1669,28 @@ skip_rio:
 
                        /* Port logout */
                        fcport = qla2x00_find_fcport_by_loopid(vha, mb[1]);
-                       if (!fcport)
+                       if (!fcport) {
+                               ql_dbg(ql_dbg_async, vha, 0x5011,
+                                       "Could not find fcport:%04x %04x %04x\n",
+                                       mb[1], mb[2], mb[3]);
                                break;
-                       if (atomic_read(&fcport->state) != FCS_ONLINE)
+                       }
+
+                       if (atomic_read(&fcport->state) != FCS_ONLINE) {
+                               ql_dbg(ql_dbg_async, vha, 0x5012,
+                                       "Port state is not online State:0x%x \n",
+                                       atomic_read(&fcport->state));
+                               ql_dbg(ql_dbg_async, vha, 0x5012,
+                                       "Scheduling session for deletion \n");
+                               fcport->logout_on_delete = 0;
+                               qlt_schedule_sess_for_deletion(fcport);
                                break;
+                       }
+
                        ql_dbg(ql_dbg_async, vha, 0x508a,
                            "Marking port lost loopid=%04x portid=%06x.\n",
                            fcport->loop_id, fcport->d_id.b24);
+
                        if (qla_ini_mode_enabled(vha)) {
                                fcport->logout_on_delete = 0;
                                qlt_schedule_sess_for_deletion(fcport);