From patchwork Thu Dec 28 20:33:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 10135915 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5FF906037D for ; Thu, 28 Dec 2017 20:35:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 529082C0FA for ; Thu, 28 Dec 2017 20:35:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 478602C3FF; Thu, 28 Dec 2017 20:35:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C203B2C0FA for ; Thu, 28 Dec 2017 20:35:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754774AbdL1UfX (ORCPT ); Thu, 28 Dec 2017 15:35:23 -0500 Received: from mail-by2nam03on0054.outbound.protection.outlook.com ([104.47.42.54]:8768 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751220AbdL1UeN (ORCPT ); Thu, 28 Dec 2017 15:34:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=r/KNG2Hk+d7CHaTJKwbku0wTccF0L3zbUztHbkMDvaY=; b=FJ87PhqoRFU5wbUAiJWvxsPwhcW7KJO8B/cs95g4MyS2Wv28u6dNfPytB2bcD4S2YUDx0rvxJj2s2PCXNa8SBtCgZgHkzpMt3VrpYSiieVbkEPkFfp3aobNVnzbOdIfIBYNwQ6paHE/CN+rpPotRJElzd+dhAuvtNZQgeNhs0vU= Received: from BY2PR07CA0081.namprd07.prod.outlook.com (10.166.107.34) by BY2PR0701MB1943.namprd07.prod.outlook.com (10.163.155.156) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.366.8; Thu, 28 Dec 2017 20:34:12 +0000 Received: from BN1BFFO11FD008.protection.gbl (2a01:111:f400:7c10::1:183) by BY2PR07CA0081.outlook.office365.com (2a01:111:e400:7bff::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.366.8 via Frontend Transport; Thu, 28 Dec 2017 20:34:12 +0000 Authentication-Results: spf=permerror (sender IP is 50.232.66.26) smtp.mailfrom=cavium.com; vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=cavium.com; Received-SPF: PermError (protection.outlook.com: domain of cavium.com used an invalid SPF mechanism) Received: from CAEXCH02.caveonetworks.com (50.232.66.26) by BN1BFFO11FD008.mail.protection.outlook.com (10.58.144.71) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.345.12 via Frontend Transport; Thu, 28 Dec 2017 20:33:51 +0000 Received: from dut1171.mv.qlogic.com (172.29.51.171) by CAEXCH02.caveonetworks.com (10.17.4.29) with Microsoft SMTP Server id 14.2.347.0; Thu, 28 Dec 2017 12:33:49 -0800 Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id vBSKXmnH002860; Thu, 28 Dec 2017 12:33:48 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id vBSKXmI1002859; Thu, 28 Dec 2017 12:33:48 -0800 From: Himanshu Madhani To: , CC: , Subject: [PATCH v2 14/37] qla2xxx: Allow target mode to accept PRLI in dual mode Date: Thu, 28 Dec 2017 12:33:22 -0800 Message-ID: <20171228203345.2702-15-himanshu.madhani@cavium.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20171228203345.2702-1-himanshu.madhani@cavium.com> References: <20171228203345.2702-1-himanshu.madhani@cavium.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:50.232.66.26; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(39380400002)(346002)(376002)(396003)(39860400002)(2980300002)(448002)(199004)(189003)(51416003)(356003)(76176011)(305945005)(81156014)(2950100002)(5660300001)(8676002)(6666003)(47776003)(80596001)(36756003)(106466001)(1076002)(69596002)(4326008)(50466002)(478600001)(8936002)(50226002)(72206003)(54906003)(110136005)(85326001)(81166006)(42186006)(316002)(16586007)(87636003)(48376002)(2906002)(86362001)(59450400001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR0701MB1943; H:CAEXCH02.caveonetworks.com; FPR:; SPF:PermError; PTR:50-232-66-26-static.hfc.comcastbusiness.net; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD008; 1:Ta6RQAmd4Mfg9eNRm4pwAJpU2DUukjmLmHlTASGFxLKuMg9OgpRjZmAVbyZCQYT7MZh8dMyj/CUYFjCYQ1qygeH/6cN+/Z0ZtnOnqkfkxXZbCxOxUD5Utn3BQSoRSU+K X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 63c39041-74f8-4181-47d8-08d54e324ebd X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060); SRVR:BY2PR0701MB1943; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0701MB1943; 3:KHg4O4KKWZfgeMTFsE115osmuC/di+kUgdju5G3hdq9RQgbJSd09VFMjXzi2k4nibcdRCqI6C6M3QQSGY2hJoh+8/fe8wjHSPB4HHYEywDj2tfLLN9S0nfxFFrWMfx5iWlsiOf2edJKE3myKubhGCbuTjNGVtzwQQTpNLg1p2DBJt/YHs6QNsXCkVuS5LZvYPOTJFed0VO7d15Coqb3XtBocmwMaWfumF32PGF6Dq73xfPRpUriY53WgekbDzQ7GbU7yCNRYdW/jP/5T37FMfTTtpJuMcOKKeviQAoAoFnLf1KBP54lSroq53j2o4EeY/9vKA0O+jQeQqjllsPnH2Q==; 25:EIvfx03ZZoteLDCTYoOq/cxuT2fGZ2fTyqVLTdJC68km9k/JTBC2zuK1Fa+gRU0R71rNGmCvCmI0kcftrxE5wwMUOgQhbR22a3U8WZSA9CTtxUCviqZzupOKQ0hc1k1SfBBipxJHwdfbyjduF1I1EQVB9oR8+tFScXGfFLrl1JCDRQVM542TVTeBrDrIWpjWk5jElfZlYTGujrZ5ZSIjt0CCHw+7+/Fc+D/LloYK5dze/zYb5LCFA5zIlLiU53izQqReWKSIBiA+aOu/IJyX+9nGfbSc6LF424CkcczXp0JnWDwrHXIh9zzfGTsZAAGHqLPZ/FioKNqY/QCEZ5aX/g==; 31:Oyk+SH89TXcfMoMkQlC0EEQPIL4pRo9WY7XOfXYli2eDwC7tlCiT4FWH4ms/FLPHX4QCKWVURvo70ShpbGGvH8LMS/hzP0FC0Z8ntJ1GSkzLJD5wjKgbbTdgEIiaW/tYtSAylpH+4NYLuW9Q42C2FoJBMWfhNPVW1AP0mGED3k8PfBl0YzomzyVihDppDaSEJOgbMmUkTZL3FvXS79qyLV/kslHJDNW2ENbDO6Nv2dI= X-MS-TrafficTypeDiagnostic: BY2PR0701MB1943: X-Microsoft-Exchange-Diagnostics: 1; BY2PR0701MB1943; 20:KfZw7eDB3EBnzdnKjfaiU4I3nnieSsjQULTvb46q91rlkk8y/mJUtDxnqmU6O93FfLcFb/MLg7nCkSNJtCBLb+sXpgEBbuva42JRnjD29g9SnLrr0qJ+1xjIv6ztRMY6RMhcJzK1QX+VIPH4qx3lffGJlgC5f0fJ6Nu+w432sSYHWJkRxC01yFcziZrd1wMpbLPthN7DHDCAqz7Uyohj7FKaMEPorzRBcSptky1/yyi1aDXsZTV+eod1JwBr9EMJUNQhTSDPEcHkwQTh8DK24CJk5OPnC3oGLWTPgnwyXKQMRH4ZKoDKOzbDPLlsxLFkHiANK9kzNGPD4y4QTeun/RbuO2UbHVTKU+mnL2M1xcPN/iTKt2ZEn8yyoIvNuzNcDsvXobdGoUPNa+fB/yCzrU9tok8DAK1rxuO5TWPSHDRd/iwCrsNs/RZs/pusmkxWQFJm7QI2TNkaqL06J+sP77AVIywChKZbEyBbx4xI2F5doK3K9SUXme0cz+S/XN5B; 4:Uh2cXlH3D9tnSSsXomta4375a4b4hJEBDNXHFcPLIEKe3c/P+GFbCaotuEfpA7HD8YRKSttft6wep3GtSEZpnnq7CI0eU6jm1tCF0dYWj9TTxDmISEujt+v3NLzf+y6rrlCiGXhuTkjU+y3pT/0A1aIzzz41RAhdiN5TlTgsXy0uQUExah83VL3lDXmt6pdTqUVaP2h8wfDz3qv6okmp3m/US95jQ1PcKnhQ1tHdQWPpCazkiVeaOAkbQ+G3VAZ/e8+IuJm8wgp5KxC3oVnRQA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(5005006)(8121501046)(10201501046)(3002001)(3231023)(944501075)(93006095)(93001095)(6041268)(20161123558120)(20161123564045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(6072148)(201708071742011); SRVR:BY2PR0701MB1943; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:BY2PR0701MB1943; X-Forefront-PRVS: 05352A48BE X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR0701MB1943; 23:XucP/vOulvrQEKC39H3FRO7gbgrmKjsAzbCJuBZ?= =?us-ascii?Q?AqN+aFwntJQmdceuXfCr3XSSKVx230wALQVSr+vwq/FgNxcVkWizUPFSPwY7?= =?us-ascii?Q?dM3j98wDNkCEVexW7zhaQXRsyZXce0b/Whb4KqP0jr6EoaFqNjKRMZgORNi4?= =?us-ascii?Q?5KszxKpmDXGLPsvXFFwR6jvRh1O8s/WmNG6hD9OmiKoyKCvXxjCn/KyIkNRZ?= =?us-ascii?Q?pfZn1nwtmTkPGKtDKY+evAzgIRGhs0VAgblsRlwrA4G1oYmRvihLzgU5efWY?= =?us-ascii?Q?VS3uIc82o3yzduw5uEa8fUUKrto8YI7wmF5gxG0r6QCZ7Ifnim2ZhOIuSkwf?= =?us-ascii?Q?EinbupfEtULFYUetC6WSoB9+kbeDpGR9uZlsJh/rvHgHZiQeGmtamzSB1imn?= =?us-ascii?Q?WadF0yP5+75icaBswfOxvSkWADkXYiIIYE+kDZ9qvNDleI/zgaDB1Gi8fijk?= =?us-ascii?Q?eghSH1MGXCP/qhDdJtovPWiyImsVD4Mv3rVME2AhKpFBGI76CRD+ERc1BfYp?= =?us-ascii?Q?HrPgAwXi7njaAGxhxwOSj8geTxb3OPTU3e8OedRJgM6oP9eoNGuHMZtmDjnR?= =?us-ascii?Q?IQ7XmGhPDXJ/o55xwOYHJ+GxkDl6Ch8noq8eD0HYAcXMES7FX7KT9wHaoXXb?= =?us-ascii?Q?qJcKPL8xFAgU7KtTm+9U2vteKz7oDnLRV4/UZgafoHzOvcmsWhg1AFOB7Weh?= =?us-ascii?Q?Ba6UcntzrYF0MAGrb/6Qr74bzt8NLKFGdEdrD8PNtgaXoL19YxCiNis3+ynM?= =?us-ascii?Q?Z0QMd8id4fIN2AV7yVMud0TuwT6v8AWpo5aRs1xPN6jDvrCOoROvfOQkd3u6?= =?us-ascii?Q?3I3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GDb89husUoWHJqqjwtKpl6+7b1x5lXiSdi3qz1/TSAsnsatPxKyMngGiSGo0bT3KPpUb3Nz2bYbrk3dn6GvC1vvBVDRv+UwcRvf9fGWvstyjJA+rdhrMILA6W/dQ8e+4febZN2CY6 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2017 20:33:51.5720 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 63c39041-74f8-4181-47d8-08d54e324ebd X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=711e4ccf-2e9b-4bcf-a551-4094005b6194; Ip=[50.232.66.26]; Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR0701MB1943 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Quinn Tran For Dual Mode, Initiator side of the driver finish login, target side receive PRLI, but driver terminates PRLI. This patch allows target side to go ahead and accept PRLI. Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_init.c | 5 +++++ drivers/scsi/qla2xxx/qla_target.c | 16 +++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 4e6d3eb4caa4..34ee8c755655 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -1537,6 +1537,7 @@ qla24xx_handle_plogi_done_event(struct scsi_qla_host *vha, struct event_arg *ea) port_id_t cid; /* conflict Nport id */ u16 lid; struct fc_port *conflict_fcport; + unsigned long flags; switch (ea->data[0]) { case MBS_COMMAND_COMPLETE: @@ -1557,10 +1558,14 @@ qla24xx_handle_plogi_done_event(struct scsi_qla_host *vha, struct event_arg *ea) ea->fcport->loop_id, ea->fcport->d_id.b24); set_bit(ea->fcport->loop_id, vha->hw->loop_id_map); + spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); ea->fcport->loop_id = FC_NO_LOOP_ID; ea->fcport->chip_reset = vha->hw->base_qpair->chip_reset; ea->fcport->logout_on_delete = 1; ea->fcport->send_els_logo = 0; + ea->fcport->fw_login_state = DSC_LS_PRLI_COMP; + spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); + qla24xx_post_gpdb_work(vha, ea->fcport, 0); } break; diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index db6fd3b747ed..52a412132abb 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -4682,7 +4682,7 @@ static int qlt_24xx_handle_els(struct scsi_qla_host *vha, uint16_t wd3_lo; int res = 0; struct qlt_plogi_ack_t *pla; - unsigned long flags; + unsigned long flags = 0; wwn = wwn_to_u64(iocb->u.isp24.port_name); @@ -4818,8 +4818,14 @@ static int qlt_24xx_handle_els(struct scsi_qla_host *vha, } if (sess != NULL) { - if (sess->fw_login_state != DSC_LS_PLOGI_PEND && - sess->fw_login_state != DSC_LS_PLOGI_COMP) { + spin_lock_irqsave(&tgt->ha->tgt.sess_lock, flags); + switch (sess->fw_login_state) { + case DSC_LS_PLOGI_COMP: + case DSC_LS_PRLI_COMP: + break; + default: + spin_unlock_irqrestore(&tgt->ha->tgt.sess_lock, + flags); /* * Impatient initiator sent PRLI before last * PLOGI could finish. Will force him to re-try, @@ -4830,6 +4836,8 @@ static int qlt_24xx_handle_els(struct scsi_qla_host *vha, sess); qlt_send_term_imm_notif(vha, iocb, 1); res = 0; + spin_lock_irqsave(&tgt->ha->tgt.sess_lock, + flags); break; } @@ -4853,6 +4861,8 @@ static int qlt_24xx_handle_els(struct scsi_qla_host *vha, sess->port_type = FCT_INITIATOR; else sess->port_type = FCT_TARGET; + + spin_unlock_irqrestore(&tgt->ha->tgt.sess_lock, flags); } res = 1; /* send notify ack */