Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp707872pxb; Tue, 5 Apr 2022 19:41:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwA6j/U0urx1iqEkcyTtfjL5FLyB1TH+72qTsCQRCD9YDa1xO4s2Ncy2Y9maMKIv2F3wuek X-Received: by 2002:a17:907:3f10:b0:6da:818d:4525 with SMTP id hq16-20020a1709073f1000b006da818d4525mr6088228ejc.47.1649212884261; Tue, 05 Apr 2022 19:41:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649212884; cv=none; d=google.com; s=arc-20160816; b=FwwHKzJ2MUAHmr8saStQOlpfViw5BZ9ZjiIQEwjZ3VrNl+Q8OAuNNrFrm+cnkXDMOt XuQvDQVj/IdZnelctuOJrVzbYg01RHVsy7/8kogP1STMsB+j8HRIEtGr2PNMZpeOoOLs t2BA13Tlv4KrI7iMInFB9C7TennMpABt2CYbsOysG/kGprvwBFkxmG2RDBCmrTwHpKqE W4BLTvWVKkwS3BoeTXG6cbgsZjNcjG7eQ/zdV7+d3Z0PIklirmRqitnF68Aqy/Jq6Dc3 DOfhY2ATPji/DZCgBWP1Anmfhwebx0uMmckXk+EAzTm9wrzNlYqPDeMFSnkbJpjdaPKS JPWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ULlxJuREwgStQEfq435S0E6/m8iaHQqUYTtyZoxQN24=; b=vvBmnMsjDAzv4mXi+jMMhqqxyPmx8fR4z875UT+KrycaRcvsN4zaGgejeZkt4AWXmb H1NLkuA3Lxw1+u1K1TLn7rILIvHL440zX1LCOJrJ0hfpw3ykmFzlGMVrNm8rGrdmKmtf E4YOjDsuAK+zzOIrlrSi7kQWDC8jGNJXDxN875/OKHeEoX+xwnkb+DeZ2IRdOim0h9Cg FzunZVwcbkzbrukoFFX2ZiWVhs3AWqngXY/5864O8twMnFewVjBgomAXY4/zTMFluI9X 71tk0Xay9eDjjDVsL12w4wmRtHSTr54c/dpl8jIobiCD7g6uA8XCxwD5bHH+2qfH2wPw CtDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wzjvNdur; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x12-20020a50d9cc000000b0041904b21a46si8914161edj.281.2022.04.05.19.40.56; Tue, 05 Apr 2022 19:41:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wzjvNdur; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353208AbiDEKFv (ORCPT + 99 others); Tue, 5 Apr 2022 06:05:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240320AbiDEIbw (ORCPT ); Tue, 5 Apr 2022 04:31:52 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 053206A41B; Tue, 5 Apr 2022 01:23:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5A56BB81BA7; Tue, 5 Apr 2022 08:23:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F25EC385A0; Tue, 5 Apr 2022 08:23:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649147032; bh=ZLTP0CsQzKamaFohUBCVD0Y/Pr2t2IZyPkvu0eeCTco=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wzjvNdurNzCzJFuNDPAk19m/Vv+gX4Nka6Q/dUChkzSauC4FIlFw1HPj2leJaXYxi Dsq46O3APiACl5iWSZ9xnkllp/eeepjyACabk64xoDXn2GgiSoqtvqpvvagLjdoIKX 80ziPRDWzLnCeaVlOplWI7dxBQHUbN9nV2v8Kl5o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Himanshu Madhani , Arun Easi , Nilesh Javali , "Martin K. Petersen" Subject: [PATCH 5.17 0978/1126] scsi: qla2xxx: Fix device reconnect in loop topology Date: Tue, 5 Apr 2022 09:28:45 +0200 Message-Id: <20220405070436.208692731@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070407.513532867@linuxfoundation.org> References: <20220405070407.513532867@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arun Easi commit 8ad4be3d15cf144b5834bdb00d5bbe4050938dc7 upstream. A device logout in loop topology initiates a device connection teardown which loses the FW device handle. In loop topo, the device handle is not regrabbed leading to device login failures and eventually to loss of the device. Fix this by taking the main login path that does it. Link: https://lore.kernel.org/r/20220110050218.3958-11-njavali@marvell.com Cc: stable@vger.kernel.org Reviewed-by: Himanshu Madhani Signed-off-by: Arun Easi Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/qla2xxx/qla_init.c | 15 +++++++++++++++ drivers/scsi/qla2xxx/qla_os.c | 5 +++++ 2 files changed, 20 insertions(+) --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -974,6 +974,9 @@ static void qla24xx_handle_gnl_done_even set_bit(RELOGIN_NEEDED, &vha->dpc_flags); } break; + case ISP_CFG_NL: + qla24xx_fcport_handle_login(vha, fcport); + break; default: break; } @@ -1563,6 +1566,11 @@ static void qla_chk_n2n_b4_login(struct u8 login = 0; int rc; + ql_dbg(ql_dbg_disc, vha, 0x307b, + "%s %8phC DS %d LS %d lid %d retries=%d\n", + __func__, fcport->port_name, fcport->disc_state, + fcport->fw_login_state, fcport->loop_id, fcport->login_retry); + if (qla_tgt_mode_enabled(vha)) return; @@ -5604,6 +5612,13 @@ qla2x00_configure_local_loop(scsi_qla_ho memcpy(fcport->node_name, new_fcport->node_name, WWN_SIZE); fcport->scan_state = QLA_FCPORT_FOUND; + if (fcport->login_retry == 0) { + fcport->login_retry = vha->hw->login_retry_count; + ql_dbg(ql_dbg_disc, vha, 0x2135, + "Port login retry %8phN, lid 0x%04x retry cnt=%d.\n", + fcport->port_name, fcport->loop_id, + fcport->login_retry); + } found++; break; } --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -5533,6 +5533,11 @@ void qla2x00_relogin(struct scsi_qla_hos ea.fcport = fcport; qla24xx_handle_relogin_event(vha, &ea); } else if (vha->hw->current_topology == + ISP_CFG_NL && + IS_QLA2XXX_MIDTYPE(vha->hw)) { + (void)qla24xx_fcport_handle_login(vha, + fcport); + } else if (vha->hw->current_topology == ISP_CFG_NL) { fcport->login_retry--; status =