Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3707643ybv; Mon, 10 Feb 2020 05:05:14 -0800 (PST) X-Google-Smtp-Source: APXvYqyheEx9Hi2M9EmjrGQACPY+6pfmW/jKZFCylc+1BwhTQDLylJDzMpGOiYYrGrp1kVHjGEJa X-Received: by 2002:aca:4e02:: with SMTP id c2mr774194oib.142.1581339914161; Mon, 10 Feb 2020 05:05:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581339914; cv=none; d=google.com; s=arc-20160816; b=UlOTxko7BJbpBoJ0O7Pf6+bcGlMR3+fLVt34jJ7pMdM9bjZV1NgCa5Vp03d4GMLn+u xEm5OiAkhXaMW4q0t5P6eGmlbR5DKOYbunclTJuKOptt7tMhduRsikVD8kPlP4/kFRHZ 1efPQ6Vx/L8H2dyPMb1AGdGXGDNQsK2je5J5J8uVDNMc0QkRvRoAyY7YM+cElOhcPgSp kF24HHxoOJwfJktTIIEfNJUAQMkH9EgC/ZW8yu6qPm0DsKRPJL2kTlv8EC/FOiW/Q4pN 3rq6aiGrmQAzYbGllvofOppdM4z0qviiSne0m4g361A1xFUTw88yaQYbHyKCxTpYE1Ao vVAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3idF4mREqcFbh1Zot+iJOnzlV0WGAx6tM1y0g/ITXWg=; b=YrgkaAZmk59L8onSgg4xCZfDPzNIFFLJAPSK4W8YH9WnRMWaok9L7U8HJOr8zZa12e cXrvOcCOM34YBIqHfqNJjbb4qVxPk9yf8NHoumQUb+f2HH51/wRWJbZMnaf+45b18PFB +Hopkcpd34USl+8W/EvnxtcIsGEKTMxoN/QQFWqFjEL0d45f2ogUC8wVL+Vvgz8p8aWL LRO7lcNqrgzrc2YYS3oHLPO+7hmavKov7R+7e5WwP/YqUUBWKu96S9WXJfXj38xj4gmk LPsRrFZqUzn8cOZqUu0jgUPm2XYP/6VaAItwTQuJ1v9i6O0dS3Ry4/MHqJ9Ru8og+IGU cXzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QMZ4EcTl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s128si140911oig.204.2020.02.10.05.05.02; Mon, 10 Feb 2020 05:05:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QMZ4EcTl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730470AbgBJNEe (ORCPT + 99 others); Mon, 10 Feb 2020 08:04:34 -0500 Received: from mail.kernel.org ([198.145.29.99]:39818 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729658AbgBJMkN (ORCPT ); Mon, 10 Feb 2020 07:40:13 -0500 Received: from localhost (unknown [209.37.97.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 13450208C4; Mon, 10 Feb 2020 12:40:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581338413; bh=sRs++E4t1kZNrONi78VVXVpwChn7iG0smoVYU6Cgytg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QMZ4EcTlbbHMmFt3eiEB5nTKYcxCwHnjydg/cQEmgWq+PQmjGxaa8PrqLUXE3E0Yq Rxm5GomX1eZFzmSHTsX6iNzJI4Y1q7fys+e00llcd7eRpnw7WPNru7s42tgT+Vq7ZH 5VCAOQoq85anKO2xz2YuD1KbZoLk4Jipw/4xdvKs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Quinn Tran , Himanshu Madhani , "Martin K. Petersen" Subject: [PATCH 5.5 125/367] scsi: qla2xxx: Fix stuck login session using prli_pend_timer Date: Mon, 10 Feb 2020 04:30:38 -0800 Message-Id: <20200210122436.373249165@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200210122423.695146547@linuxfoundation.org> References: <20200210122423.695146547@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Quinn Tran commit 8aaac2d7da873aebeba92c666f82c00bbd74aaf9 upstream. Session is stuck if driver sees FW has received a PRLI. Driver allows FW to finish with processing of PRLI by checking back with FW at a later time to see if the PRLI has finished. Instead, driver failed to push forward after re-checking PRLI completion. Fixes: ce0ba496dccf ("scsi: qla2xxx: Fix stuck login session") Cc: stable@vger.kernel.org # 5.3 Link: https://lore.kernel.org/r/20191217220617.28084-9-hmadhani@marvell.com Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/qla2xxx/qla_def.h | 5 +++++ drivers/scsi/qla2xxx/qla_init.c | 34 ++++++++++++++++++++++++++-------- drivers/scsi/qla2xxx/qla_target.c | 1 + 3 files changed, 32 insertions(+), 8 deletions(-) --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -2402,6 +2402,7 @@ typedef struct fc_port { unsigned int scan_needed:1; unsigned int n2n_flag:1; unsigned int explicit_logout:1; + unsigned int prli_pend_timer:1; struct completion nvme_del_done; uint32_t nvme_prli_service_param; @@ -2428,6 +2429,7 @@ typedef struct fc_port { struct work_struct free_work; struct work_struct reg_work; uint64_t jiffies_at_registration; + unsigned long prli_expired; struct qlt_plogi_ack_t *plogi_link[QLT_PLOGI_LINK_MAX]; uint16_t tgt_id; @@ -4845,6 +4847,9 @@ struct sff_8247_a0 { (ha->fc4_type_priority == FC4_PRIORITY_NVME)) || \ NVME_ONLY_TARGET(fcport)) \ +#define PRLI_PHASE(_cls) \ + ((_cls == DSC_LS_PRLI_PEND) || (_cls == DSC_LS_PRLI_COMP)) + #include "qla_target.h" #include "qla_gbl.h" #include "qla_dbg.h" --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -685,7 +685,7 @@ static void qla24xx_handle_gnl_done_even port_id_t id; u64 wwn; u16 data[2]; - u8 current_login_state; + u8 current_login_state, nvme_cls; fcport = ea->fcport; ql_dbg(ql_dbg_disc, vha, 0xffff, @@ -744,10 +744,17 @@ static void qla24xx_handle_gnl_done_even loop_id = le16_to_cpu(e->nport_handle); loop_id = (loop_id & 0x7fff); - if (NVME_TARGET(vha->hw, fcport)) - current_login_state = e->current_login_state >> 4; - else - current_login_state = e->current_login_state & 0xf; + nvme_cls = e->current_login_state >> 4; + current_login_state = e->current_login_state & 0xf; + + if (PRLI_PHASE(nvme_cls)) { + current_login_state = nvme_cls; + fcport->fc4_type &= ~FS_FC4TYPE_FCP; + fcport->fc4_type |= FS_FC4TYPE_NVME; + } else if (PRLI_PHASE(current_login_state)) { + fcport->fc4_type |= FS_FC4TYPE_FCP; + fcport->fc4_type &= ~FS_FC4TYPE_NVME; + } ql_dbg(ql_dbg_disc, vha, 0x20e2, "%s found %8phC CLS [%x|%x] fc4_type %d ID[%06x|%06x] lid[%d|%d]\n", @@ -1216,12 +1223,19 @@ qla24xx_async_prli(struct scsi_qla_host struct srb_iocb *lio; int rval = QLA_FUNCTION_FAILED; - if (!vha->flags.online) + if (!vha->flags.online) { + ql_dbg(ql_dbg_disc, vha, 0xffff, "%s %d %8phC exit\n", + __func__, __LINE__, fcport->port_name); return rval; + } - 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 || + fcport->fw_login_state == DSC_LS_PRLI_PEND) && + qla_dual_mode_enabled(vha)) { + ql_dbg(ql_dbg_disc, vha, 0xffff, "%s %d %8phC exit\n", + __func__, __LINE__, fcport->port_name); return rval; + } sp = qla2x00_get_sp(vha, fcport, GFP_KERNEL); if (!sp) @@ -1600,6 +1614,10 @@ int qla24xx_fcport_handle_login(struct s break; default: if (fcport->login_pause) { + ql_dbg(ql_dbg_disc, vha, 0x20d8, + "%s %d %8phC exit\n", + __func__, __LINE__, + fcport->port_name); fcport->last_rscn_gen = fcport->rscn_gen; fcport->last_login_gen = fcport->login_gen; set_bit(RELOGIN_NEEDED, &vha->dpc_flags); --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -1257,6 +1257,7 @@ void qlt_schedule_sess_for_deletion(stru sess->deleted = QLA_SESS_DELETION_IN_PROGRESS; spin_unlock_irqrestore(&sess->vha->work_lock, flags); + sess->prli_pend_timer = 0; sess->disc_state = DSC_DELETE_PEND; qla24xx_chk_fcp_state(sess);