Daniel Wagner 969f06
From: Quinn Tran <qutran@marvell.com>
Daniel Wagner 969f06
Date: Wed, 8 Jun 2022 04:58:48 -0700
Daniel Wagner 969f06
Subject: scsi: qla2xxx: edif: Fix slow session teardown
Denis Kirjanov 718367
Patch-mainline: v5.20-rc1
Daniel Wagner 969f06
Git-commit: bcf536072f7475c65f21fd1681e94f99c04f9d15
Daniel Wagner 969f06
References: bsc#1201958
Daniel Wagner 969f06
Daniel Wagner 969f06
User experience slow recovery when target device went through a stop/start
Daniel Wagner 969f06
of the authentication application (app_stop/app_start).
Daniel Wagner 969f06
Daniel Wagner 969f06
Between the period of app_stop and app_start on the target device, target
Daniel Wagner 969f06
device choose to send ELS Reject for any receive AUTH ELS command.  At this
Daniel Wagner 969f06
time, authentication application does not do ELS reject if it encounters
Daniel Wagner 969f06
error.
Daniel Wagner 969f06
Daniel Wagner 969f06
Therefore, AUTH ELS reject signify authentication application is not
Daniel Wagner 969f06
running. If driver passes up the AUTH ELS Reject to the authentication
Daniel Wagner 969f06
application, then it would result in authentication application
Daniel Wagner 969f06
retrying/resending the same AUTH ELS command again + delay.
Daniel Wagner 969f06
Daniel Wagner 969f06
As a work around, driver should trigger a session tear down where it tells
Daniel Wagner 969f06
the local authentication application to also tear down.  At the next
Daniel Wagner 969f06
relogin, both sides are then synchronized.
Daniel Wagner 969f06
Daniel Wagner 969f06
Link: https://lore.kernel.org/r/20220608115849.16693-10-njavali@marvell.com
Daniel Wagner 969f06
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Daniel Wagner 969f06
Signed-off-by: Quinn Tran <qutran@marvell.com>
Daniel Wagner 969f06
Signed-off-by: Nilesh Javali <njavali@marvell.com>
Daniel Wagner 969f06
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Daniel Wagner 969f06
Acked-by: Daniel Wagner <dwagner@suse.de>
Daniel Wagner 969f06
---
Daniel Wagner 969f06
 drivers/scsi/qla2xxx/qla_isr.c |   34 ++++++++++++++++++++--------------
Daniel Wagner 969f06
 1 file changed, 20 insertions(+), 14 deletions(-)
Daniel Wagner 969f06
Daniel Wagner 969f06
--- a/drivers/scsi/qla2xxx/qla_isr.c
Daniel Wagner 969f06
+++ b/drivers/scsi/qla2xxx/qla_isr.c
Daniel Wagner 969f06
@@ -2246,9 +2246,9 @@ qla24xx_els_ct_entry(scsi_qla_host_t *v,
Daniel Wagner 969f06
 				res = DID_ERROR << 16;
Daniel Wagner 969f06
 			}
Daniel Wagner 969f06
 
Daniel Wagner 969f06
-			if (logit) {
Daniel Wagner 969f06
-				if (sp->remap.remapped &&
Daniel Wagner 969f06
-				    ((u8 *)sp->remap.rsp.buf)[0] == ELS_LS_RJT) {
Daniel Wagner 969f06
+			if (sp->remap.remapped &&
Daniel Wagner 969f06
+			    ((u8 *)sp->remap.rsp.buf)[0] == ELS_LS_RJT) {
Daniel Wagner 969f06
+				if (logit) {
Daniel Wagner 969f06
 					ql_dbg(ql_dbg_user, vha, 0x503f,
Daniel Wagner 969f06
 					    "%s IOCB Done LS_RJT hdl=%x comp_status=0x%x\n",
Daniel Wagner 969f06
 					    type, sp->handle, comp_status);
Daniel Wagner 969f06
@@ -2260,18 +2260,24 @@ qla24xx_els_ct_entry(scsi_qla_host_t *v,
Daniel Wagner 969f06
 						pkt)->total_byte_count),
Daniel Wagner 969f06
 					    e->s_id[0], e->s_id[2], e->s_id[1],
Daniel Wagner 969f06
 					    e->d_id[2], e->d_id[1], e->d_id[0]);
Daniel Wagner 969f06
-				} else {
Daniel Wagner 969f06
-					ql_log(ql_log_info, vha, 0x503f,
Daniel Wagner 969f06
-					    "%s IOCB Done hdl=%x comp_status=0x%x\n",
Daniel Wagner 969f06
-					    type, sp->handle, comp_status);
Daniel Wagner 969f06
-					ql_log(ql_log_info, vha, 0x503f,
Daniel Wagner 969f06
-					    "subcode 1=0x%x subcode 2=0x%x bytes=0x%x %02x%02x%02x -> %02x%02x%02x\n",
Daniel Wagner 969f06
-					    fw_status[1], fw_status[2],
Daniel Wagner 969f06
-					    le32_to_cpu(((struct els_sts_entry_24xx *)
Daniel Wagner 969f06
-						pkt)->total_byte_count),
Daniel Wagner 969f06
-					    e->s_id[0], e->s_id[2], e->s_id[1],
Daniel Wagner 969f06
-					    e->d_id[2], e->d_id[1], e->d_id[0]);
Daniel Wagner 969f06
 				}
Daniel Wagner 969f06
+				if (sp->fcport && sp->fcport->flags & FCF_FCSP_DEVICE &&
Daniel Wagner 969f06
+				    sp->type == SRB_ELS_CMD_HST_NOLOGIN) {
Daniel Wagner 969f06
+					ql_dbg(ql_dbg_edif, vha, 0x911e,
Daniel Wagner 969f06
+					    "%s rcv reject. Sched delete\n", __func__);
Daniel Wagner 969f06
+					qlt_schedule_sess_for_deletion(sp->fcport);
Daniel Wagner 969f06
+				}
Daniel Wagner 969f06
+			} else if (logit) {
Daniel Wagner 969f06
+				ql_log(ql_log_info, vha, 0x503f,
Daniel Wagner 969f06
+				    "%s IOCB Done hdl=%x comp_status=0x%x\n",
Daniel Wagner 969f06
+				    type, sp->handle, comp_status);
Daniel Wagner 969f06
+				ql_log(ql_log_info, vha, 0x503f,
Daniel Wagner 969f06
+				    "subcode 1=0x%x subcode 2=0x%x bytes=0x%x %02x%02x%02x -> %02x%02x%02x\n",
Daniel Wagner 969f06
+				    fw_status[1], fw_status[2],
Daniel Wagner 969f06
+				    le32_to_cpu(((struct els_sts_entry_24xx *)
Daniel Wagner 969f06
+				    pkt)->total_byte_count),
Daniel Wagner 969f06
+				    e->s_id[0], e->s_id[2], e->s_id[1],
Daniel Wagner 969f06
+				    e->d_id[2], e->d_id[1], e->d_id[0]);
Daniel Wagner 969f06
 			}
Daniel Wagner 969f06
 		}
Daniel Wagner 969f06
 		goto els_ct_done;