scsi: qla2xxx: Tear down session if FW say it is down
authorQuinn Tran <qutran@marvell.com>
Wed, 2 Dec 2020 13:23:01 +0000 (05:23 -0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 9 Dec 2020 16:34:17 +0000 (11:34 -0500)
The completion status 0x28 (ppc = be = 0x2800) below indicates session is
not there, trigger session deletion.

qla2xxx [000b:04:00.1]-8009:8: DEVICE RESET ISSUED nexus=8:1:51 cmd=c000001432d0f600.
qla2xxx [000b:04:00.1]-5039:8: Async-tmf error - hdl=67b completion status(2800).
qla2xxx [000b:04:00.1]-8030:8: TM IOCB failed (102).
qla2xxx [000b:04:00.1]-800c:8: do_reset failed for cmd=c000001432d0f600.
qla2xxx [000b:04:00.1]-800f:8: DEVICE RESET FAILED: Task management failed nexus=8:1:51 cmd=c000001432d0f600.
qla2xxx [000b:04:00.1]-8009:8: DEVICE RESET ISSUED nexus=8:1:52 cmd=c000001432d0c200.
qla2xxx [000b:04:00.1]-5039:8: Async-tmf error - hdl=67c completion status(2800).
qla2xxx [000b:04:00.1]-8030:8: TM IOCB failed (102).

Link: https://lore.kernel.org/r/20201202132312.19966-5-njavali@marvell.com
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Quinn Tran <qutran@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/qla2xxx/qla_isr.c

index 77dd763..f9142db 100644 (file)
@@ -2226,11 +2226,13 @@ qla24xx_tm_iocb_entry(scsi_qla_host_t *vha, struct req_que *req, void *tsk)
        srb_t *sp;
        struct srb_iocb *iocb;
        struct sts_entry_24xx *sts = (struct sts_entry_24xx *)tsk;
+       u16 comp_status;
 
        sp = qla2x00_get_sp_from_handle(vha, func, req, tsk);
        if (!sp)
                return;
 
+       comp_status = le16_to_cpu(sts->comp_status);
        iocb = &sp->u.iocb_cmd;
        type = sp->name;
        fcport = sp->fcport;
@@ -2244,7 +2246,7 @@ qla24xx_tm_iocb_entry(scsi_qla_host_t *vha, struct req_que *req, void *tsk)
        } else if (sts->comp_status != cpu_to_le16(CS_COMPLETE)) {
                ql_log(ql_log_warn, fcport->vha, 0x5039,
                    "Async-%s error - hdl=%x completion status(%x).\n",
-                   type, sp->handle, sts->comp_status);
+                   type, sp->handle, comp_status);
                iocb->u.tmf.data = QLA_FUNCTION_FAILED;
        } else if ((le16_to_cpu(sts->scsi_status) &
            SS_RESPONSE_INFO_LEN_VALID)) {
@@ -2260,6 +2262,30 @@ qla24xx_tm_iocb_entry(scsi_qla_host_t *vha, struct req_que *req, void *tsk)
                }
        }
 
+       switch (comp_status) {
+       case CS_PORT_LOGGED_OUT:
+       case CS_PORT_CONFIG_CHG:
+       case CS_PORT_BUSY:
+       case CS_INCOMPLETE:
+       case CS_PORT_UNAVAILABLE:
+       case CS_TIMEOUT:
+       case CS_RESET:
+               if (atomic_read(&fcport->state) == FCS_ONLINE) {
+                       ql_dbg(ql_dbg_disc, fcport->vha, 0x3021,
+                              "-Port to be marked lost on fcport=%02x%02x%02x, current port state= %s comp_status %x.\n",
+                              fcport->d_id.b.domain, fcport->d_id.b.area,
+                              fcport->d_id.b.al_pa,
+                              port_state_str[FCS_ONLINE],
+                              comp_status);
+
+                       qlt_schedule_sess_for_deletion(fcport);
+               }
+               break;
+
+       default:
+               break;
+       }
+
        if (iocb->u.tmf.data != QLA_SUCCESS)
                ql_dump_buffer(ql_dbg_async + ql_dbg_buffer, sp->vha, 0x5055,
                    sts, sizeof(*sts));