From patchwork Wed Dec 20 06:56:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 10125071 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 5AFF56019C for ; Wed, 20 Dec 2017 06:57:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 519D729649 for ; Wed, 20 Dec 2017 06:57:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4674C2964F; Wed, 20 Dec 2017 06:57:24 +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 99E4E29649 for ; Wed, 20 Dec 2017 06:57:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932479AbdLTG5V (ORCPT ); Wed, 20 Dec 2017 01:57:21 -0500 Received: from mail-co1nam03on0045.outbound.protection.outlook.com ([104.47.40.45]:62688 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932386AbdLTG5L (ORCPT ); Wed, 20 Dec 2017 01:57:11 -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=bvqNtAyrrG0H2RvchoUbCyiRYNtPHAyClNiPM2uZpJU=; b=AYHDp43+nJzFppmRzzMKf7/9wz91EtcPG8OrBPso/ms5CQx8pnLvsQkEGcJg+dzdk9e9G/U2Uh5iwhn2d8jWX2VMN7P3oo877v8zW9ab/PdwPeYL1V+cBMzp0GPqgZnDLFHO4mSggDgxqcRSDkpevJDe+6rqYgpcheVej86rs6A= Received: from SN4PR0701CA0020.namprd07.prod.outlook.com (2603:10b6:803:28::30) by SN4PR0701MB3823.namprd07.prod.outlook.com (2603:10b6:803:4f::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.323.15; Wed, 20 Dec 2017 06:57:08 +0000 Received: from BN1AFFO11FD027.protection.gbl (2a01:111:f400:7c10::106) by SN4PR0701CA0020.outlook.office365.com (2603:10b6:803:28::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.323.15 via Frontend Transport; Wed, 20 Dec 2017 06:57:08 +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 BN1AFFO11FD027.mail.protection.outlook.com (10.58.52.87) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.302.6 via Frontend Transport; Wed, 20 Dec 2017 06:56:55 +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; Tue, 19 Dec 2017 22:56:48 -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 vBK6umPR021606; Tue, 19 Dec 2017 22:56:48 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id vBK6umDc021605; Tue, 19 Dec 2017 22:56:48 -0800 From: Himanshu Madhani To: , CC: , Subject: [PATCH 15/43] qla2xxx: Add ability to send PRLO Date: Tue, 19 Dec 2017 22:56:16 -0800 Message-ID: <20171220065644.21511-16-himanshu.madhani@cavium.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20171220065644.21511-1-himanshu.madhani@cavium.com> References: <20171220065644.21511-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)(376002)(39860400002)(396003)(39380400002)(346002)(2980300002)(448002)(189003)(199004)(87636003)(4326008)(478600001)(51416003)(1076002)(106466001)(2906002)(50466002)(72206003)(47776003)(85326001)(76176011)(6666003)(48376002)(305945005)(81166006)(36756003)(5660300001)(2950100002)(316002)(59450400001)(42186006)(16586007)(50226002)(69596002)(81156014)(575784001)(86362001)(80596001)(110136005)(8936002)(54906003)(356003)(8676002); DIR:OUT; SFP:1101; SCL:1; SRVR:SN4PR0701MB3823; H:CAEXCH02.caveonetworks.com; FPR:; SPF:PermError; PTR:50-232-66-26-static.hfc.comcastbusiness.net; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD027; 1:mq84UGjL/VvTGay7C9Nc2iIKp5VWucBXXkbnbEd3+RBIpJuC20waM4ygDLbeAVr8scEe9+O3Qe4vsJ5EF0CMy3U/rPPqgBCAt3cnEVLIOjAeM5My0Baz2h26ni37J8Yz X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 28ae86e6-7287-400a-4b0f-08d54776db94 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060); SRVR:SN4PR0701MB3823; X-Microsoft-Exchange-Diagnostics: 1; SN4PR0701MB3823; 3:NMBI73WIKxG106B5KczpO9YTCpzwOXZK0zjZBAy6RvHn74LuI9l4nic96nauQxQbuFz44MDMZtQf4DRJPDhatwU7rNOFFo2vv7Az7hUTIXHv8TAqgjfryk0WgUAYx9D2It58zJXt9aRLZB0WMqKNgY5mM1NvZLQBfvIAyQulEp6xzeL9aVQiHFt9b8M9/CeVISJd6hcF/Er3QPsi066HTYPgGU+mPO9JNbRWFjiFCyMcnDiDxCtPNVhmelL4gBntgKVCL+Flqze33nlPYuMds8EB0TfGBfpqXkN61Qz8UwQeE3rJa9dcYG9R0qInogrxrR9ENW8g+nydgNFnVLCu025NiAA2iKdkXWtR5+51Erc=; 25:yw6QjYrUYeZobtNWzdSxZVMtU4f0dQqkpfmmXVgo6OoHXoCcXr3zv5O0oGmViN86ue3/4W+iEuJyFQtbNu3ilUY1G8cmLZCF3eagS9427aPBAtrqgqD1pHFAh9M07QUTH2tQYeywvSbzf6LvTF9t125HV3N+9xgX1mh3rD4T1L4Yf0+Jzagq+kB8B+kMia0yteca4qseaFUh9jAJG8K4TAaBAgMOkhd5xy5eirzn+oARc2i8wNbgMCwFfHHWBdvZ7tuQTyWJ8ew4suTDghNMPpAXLJh2NH2OHvjJrnsYyl0mAXfYHsrU9jQI185IJwIbWr3ZXaugBaBlHX9ZaHDTfQ== X-MS-TrafficTypeDiagnostic: SN4PR0701MB3823: X-Microsoft-Exchange-Diagnostics: 1; SN4PR0701MB3823; 31:lwdTSYkwp0TtjzmmHld+d24Pr5MyKP/GQrvXADeYREnLtTL4OeQAK/V7XHX/mEYtrylA2BcDjuycKNU3jW71eVbs5Qyn9crAeH55uNCL0LiaZnwtRu4L0g8oEK8EjZaLOZcH0e/xrwxPQO4D2uKIf24Sc8ha6TloDT+3SuCWgJvVbQEGMkvHr4nT/+5uvrFt3/dRfYpwXkDTToP0/x7xViJnqmndnubz/nLeLnQYd4A=; 20:iPUtHcd3ydOD9hO7wgnj7dq2VI9Uysk1AQYOcOLJsL6IGoZPi/kokgAu8MguvYPTHYm3ZTWx8WfBuYYEzf7IGfWMEDz7cMrgPYkR29QCAfNMNIGXtJlASVTNMue0Rgyp+FuGMUtXTgvrbreyt16GT5daqnPsHYI3Yb3drZHvq7AajR4vCLj/Rm7oXtnvVjwU16/hz+apIPmE8ZbbG/i1QE4OZTqt6ZslA5mwAft9k6unqmDJ7TEYF1H4M+CAt6Gu8YfbNJnV8VGtKJwtAgj2SiDRp5WwTX5mLl4WLpML6wlU1YIN/6jkMRf4K1x5mAMGgKJgslWfPxT10acRlrLylv8qSt34xrmf3bNWzhErb7zc0V3mtqprBZVQX14rjB6B6vZ+ILgYJuAygVBzDnfwX5vIBzPdQBAkLCGXYZBzCZIHwwHPn1HbzzIoEK1PqQZo4oyG28iOmYMKDRTMXbF2YayQKtVvi3FaHmyexuj8+0HVmgv2BJNurPjUl4iYSs1/ X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3002001)(3231023)(6041268)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:SN4PR0701MB3823; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:SN4PR0701MB3823; X-Microsoft-Exchange-Diagnostics: 1; SN4PR0701MB3823; 4:14tL1bZbZHEFFXFmB7qNddIqqqn/Ec2WPk+O1bGMW6SI+jHr7QXzGgSGr4qR97G4uqkOBuN8VOmzsTfD/ENN69pDblJg60u6SbidV3YBYprTsTs6pdK2j49mJjUK6UzzlOmqgJ/A49nSUy2MJmln1WRIzkcYhMW7j6BcFStdKkWJyQ1I61iXMkrwV23NLRadi6R0vYpHGzWAKmEAMo8bMQjJHyuj0qJGbSSdZTCawbsaJCTsNjYXKb8mv/QgHARnOpHdEO4MVoMrRJu62vAgKg== X-Forefront-PRVS: 0527DFA348 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN4PR0701MB3823; 23:6zGL2J19UUT5Z1r2Lrsch7fo33gYtGTZzFFPNJu?= =?us-ascii?Q?kPdCsWy3nlHQBbrBKXflhNK6hW/+PQW1e60qmEslTwZSw9O2J/u5D8d2GU1n?= =?us-ascii?Q?Nco3Apm5x7lW4h830kijMk6oQ9VFXsJQHt261g8RIxCYwPKbXcRqOayXKJO0?= =?us-ascii?Q?RjJZgPhkv3JdLjkKxstptydX0bG95mQ9VwhMFL6YpXph36u0VW/J6vQusX5T?= =?us-ascii?Q?T9EdfFpQuzk1OrfLAvEFxDbqcoMLCoWtKvytSCD2BvXbkNP+qv29Rf94l6PW?= =?us-ascii?Q?gg+UUIjeNXkrzMOeCLvrBZqYAhyMSlr1Ye3dy66CF/w5NHGGAONRw6EZsXlN?= =?us-ascii?Q?1baPfgMALVZN1aT16YGpZhjocv+vYJ0Y5r8s+On4dQkyakSfdZSbWdJ6vyTb?= =?us-ascii?Q?whM+rYu/dEGg8srsMDLy5chlpKpiNT2Offgcp+m74Js4CF1DIaS8WyEtMsEW?= =?us-ascii?Q?2vNM0FfDlVPA4n+9MmhyI8rQfhMRnTjZOxx9Sua4oHB2NN5ND1dRdWpzt7Vw?= =?us-ascii?Q?CMIEIeeYfoRBFAA5sMTEwbE0DYrPyZ/Uy+tLL3o55JP5RExo3TbSJRDCRAZJ?= =?us-ascii?Q?1t9PN45N7I51N0aqls8LVLTB1tA6v+sX7uE1YeBtMvEfGj5D1SzMStVFUS//?= =?us-ascii?Q?Xc1LX9BFa2uq1yZu9CBQy++5R0UxCffVM8n8RL5aogB/rrfwZNgBf7kCKlZi?= =?us-ascii?Q?k//Yf5fW8Ev2Ig5ED9JpKoJTFuzjf+4ifHSAXUScYlGq46JNm/xSqyrD3jp3?= =?us-ascii?Q?sfICnY8pywqU8rT8ZkY/nWRXhI7MthfLJZkQAu9RJPDaBVcHyxzdGe2kqOEh?= =?us-ascii?Q?b1oc0hjn2AS9L4aFhcTNnyocrkFqMyE4/jFUMZAYhQxY4V1Gf61N4qseUSgO?= =?us-ascii?Q?Z4hMSW7+hb6c/N/cxhp8B5rCVoexS6jO97gy5UDfk+NCjFj/Gq0YpPJ6ULsi?= =?us-ascii?Q?E8yBAKpBvl4eyFx93RsSeMEf54TBur3ijhaNBAwWZW9w1pZ29oBqEVzQgdSo?= =?us-ascii?Q?6fAaTonLrQ6BPqE2gHHQSOMhEAMi/hdyUwagoNs+T3mWQYQ=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; SN4PR0701MB3823; 6:+yz+PquH88Js2sD1H4S5mA80pQJ9LF69j12XelRV4xqmb5aG9ZKTZOoYvo2SfAAxYOkfdm9VmCbM866u+XDqDfhN7lf7Oj/JLEl0LD3pmxms0Sc2ozWxKZL9cLxjeLzbJHcezVEABFMsWNbm+ks+aIqkCLOjQHCAKoC6lu9toGhA9KcMmRzPue/uzsbUHNfLXdwExis2ybcDHsPb6O7C20TBc/+HrViPFhu7I6WbEb8RHmw0KnV602Y2a9VIJzSA4ax5aMqQtb2x9aNZNd+YDn48LveNIpp7OzmbMdxUc72khFY3jeRrStthF8xFSCgQOJrMT1yFXAWeEEDBzqLZGtvgrBoyrYSOyAczKqgxu08=; 5:ecTPskPLtrClExjmynQd2Ho8MhSbb0DdzDRbaghhzWClp6gwckuEoqqzI1gI0xJEMlraAz73N/FtvtY/+AkjcjyCXPwRumJ3L0VPpgubLLJ+EeZytoyxKAzQ6iptljUCe007sgAVyUGUbUWTcm/7kKaFNXQsP07RYa0eLnoeG3A=; 24:5KXP2n92OmCeg3oB2PKIdBM25Iow+GyGyElsFQR2msn0JD9V1D6KSMgdyinn6vbTnZLc8l9mY9+hAM1RELTe4zwsz07zyoIwXxtR5XZpKE8=; 7:f9wQaz8QZ61H2JJ0aOg9o0jQStpwBv5kS8EFZ9dsJQeMGlfsgQ5HK5Ngi20FzFH5ddld79suZstdxICgwT7cVxzKaN4YKX8MlmS3ypWdE/m4CyQw4uvca9zsN+ZSuEJTvGmML9Fv2sGdicsp3Bdmd07MSwKHduzQe5F3E9fifS/wRpzzEcMOU3DFvFjVIm5Pys2yS5iKUvcmL43RowAkF0M/+E/GdQMNZIJ85JfSiLIi6MZVtnixVYcYx4cDF+JF SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2017 06:56:55.5003 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 28ae86e6-7287-400a-4b0f-08d54776db94 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: SN4PR0701MB3823 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 Add ability to send Implicit PRLO to flush IOs from FW back to driver. Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_def.h | 5 ++++ drivers/scsi/qla2xxx/qla_gbl.h | 8 ++++++ drivers/scsi/qla2xxx/qla_gs.c | 1 + drivers/scsi/qla2xxx/qla_init.c | 59 +++++++++++++++++++++++++++++++++++++++++ drivers/scsi/qla2xxx/qla_iocb.c | 17 ++++++++++++ drivers/scsi/qla2xxx/qla_os.c | 9 +++++++ 6 files changed, 99 insertions(+) diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index a2c0f3d78b35..ba659aa9ae83 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -514,6 +514,7 @@ enum { SPCN_NVME_LS, SPCN_NVME_CMD, SPCN_CTRL_VP, + SPCN_PRLO, }; struct sp_name { @@ -544,6 +545,8 @@ struct sp_name { #define SRB_NVME_LS 20 #define SRB_PRLI_CMD 21 #define SRB_CTRL_VP 22 +#define SRB_PRLO_CMD 23 + enum { TYPE_SRB, TYPE_TGT_CMD, @@ -3184,6 +3187,8 @@ enum qla_work_type { QLA_EVT_GNL, QLA_EVT_NACK, QLA_EVT_RELOGIN, + QLA_EVT_ASYNC_PRLO, + QLA_EVT_ASYNC_PRLO_DONE, }; diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index 88c7746c023a..ea8f24e07409 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h @@ -66,6 +66,7 @@ extern void qla84xx_put_chip(struct scsi_qla_host *); extern int qla2x00_async_login(struct scsi_qla_host *, fc_port_t *, uint16_t *); extern int qla2x00_async_logout(struct scsi_qla_host *, fc_port_t *); +extern int qla2x00_async_prlo(struct scsi_qla_host *, fc_port_t *); extern int qla2x00_async_adisc(struct scsi_qla_host *, fc_port_t *, uint16_t *); extern int qla2x00_async_tm_cmd(fc_port_t *, uint32_t, uint32_t, uint32_t); @@ -109,6 +110,13 @@ int qla24xx_post_newsess_work(struct scsi_qla_host *, port_id_t *, u8 *, int qla24xx_fcport_handle_login(struct scsi_qla_host *, fc_port_t *); int qla24xx_detect_sfp(scsi_qla_host_t *vha); int qla24xx_post_gpdb_work(struct scsi_qla_host *, fc_port_t *, u8); +void qla2x00_async_prlo_done(struct scsi_qla_host *, fc_port_t *, + uint16_t *); +extern int qla2x00_post_async_prlo_work(struct scsi_qla_host *, fc_port_t *, + uint16_t *); +extern int qla2x00_post_async_prlo_done_work(struct scsi_qla_host *, + fc_port_t *, uint16_t *); + /* * Global Data in qla_os.c source file. */ diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c index b1c6485c307b..22702a8f5ce6 100644 --- a/drivers/scsi/qla2xxx/qla_gs.c +++ b/drivers/scsi/qla2xxx/qla_gs.c @@ -42,6 +42,7 @@ struct sp_name sp_str[] = { { SPCN_NVME_LS, "nvme_ls" }, { SPCN_NVME_CMD, "nvme_cmd" }, { SPCN_CTRL_VP, "ctrl_vp" }, + { SPCN_PRLO, "prlo" }, }; const char *sp_to_str(uint16_t cmd) diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 6223dfe20767..900f6d3f3a3a 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -278,6 +278,65 @@ qla2x00_async_logout(struct scsi_qla_host *vha, fc_port_t *fcport) fcport->flags &= ~FCF_ASYNC_SENT; return rval; } + +void +qla2x00_async_prlo_done(struct scsi_qla_host *vha, fc_port_t *fcport, + uint16_t *data) +{ + /* Don't re-login in target mode */ + if (!fcport->tgt_session) + qla2x00_mark_device_lost(vha, fcport, 1, 0); + qlt_logo_completion_handler(fcport, data[0]); +} + +static void +qla2x00_async_prlo_sp_done(void *s, int res) +{ + srb_t *sp = (srb_t *)s; + struct srb_iocb *lio = &sp->u.iocb_cmd; + struct scsi_qla_host *vha = sp->vha; + + if (!test_bit(UNLOADING, &vha->dpc_flags)) + qla2x00_post_async_prlo_done_work(sp->fcport->vha, sp->fcport, + lio->u.logio.data); + sp->free(sp); +} + +int +qla2x00_async_prlo(struct scsi_qla_host *vha, fc_port_t *fcport) +{ + srb_t *sp; + struct srb_iocb *lio; + int rval; + + rval = QLA_FUNCTION_FAILED; + sp = qla2x00_get_sp(vha, fcport, GFP_KERNEL); + if (!sp) + goto done; + + sp->type = SRB_PRLO_CMD; + sp->name = sp_to_str(SPCN_PRLO); + qla2x00_init_timer(sp, qla2x00_get_async_timeout(vha) + 2); + + lio = &sp->u.iocb_cmd; + lio->timeout = qla2x00_async_iocb_timeout; + sp->done = qla2x00_async_prlo_sp_done; + rval = qla2x00_start_sp(sp); + if (rval != QLA_SUCCESS) + goto done_free_sp; + + ql_dbg(ql_dbg_disc, vha, 0x2070, + "Async-prlo - hdl=%x loop-id=%x portid=%02x%02x%02x.\n", + sp->handle, fcport->loop_id, fcport->d_id.b.domain, + fcport->d_id.b.area, fcport->d_id.b.al_pa); + return rval; + +done_free_sp: + sp->free(sp); +done: + return rval; +} + static void qla24xx_handle_adisc_event(scsi_qla_host_t *vha, struct event_arg *ea) { diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c index 519a0d2920b8..b2cec8313f27 100644 --- a/drivers/scsi/qla2xxx/qla_iocb.c +++ b/drivers/scsi/qla2xxx/qla_iocb.c @@ -3424,6 +3424,20 @@ qla25xx_ctrlvp_iocb(srb_t *sp, struct vp_ctrl_entry_24xx *vce) vce->vp_idx_map[map] |= 1 << pos; } +static void +qla24xx_prlo_iocb(srb_t *sp, struct logio_entry_24xx *logio) +{ + logio->entry_type = LOGINOUT_PORT_IOCB_TYPE; + logio->control_flags = + cpu_to_le16(LCF_COMMAND_PRLO|LCF_IMPL_PRLO); + + logio->nport_handle = cpu_to_le16(sp->fcport->loop_id); + logio->port_id[0] = sp->fcport->d_id.b.al_pa; + logio->port_id[1] = sp->fcport->d_id.b.area; + logio->port_id[2] = sp->fcport->d_id.b.domain; + logio->vp_index = sp->fcport->vha->vp_idx; +} + int qla2x00_start_sp(srb_t *sp) { @@ -3505,6 +3519,9 @@ qla2x00_start_sp(srb_t *sp) case SRB_CTRL_VP: qla25xx_ctrlvp_iocb(sp, pkt); break; + case SRB_PRLO_CMD: + qla24xx_prlo_iocb(sp, pkt); + break; default: break; } diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index fd107c4feda5..13550a8584ca 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -4679,6 +4679,8 @@ qla2x00_post_async_work(logout, QLA_EVT_ASYNC_LOGOUT); qla2x00_post_async_work(logout_done, QLA_EVT_ASYNC_LOGOUT_DONE); qla2x00_post_async_work(adisc, QLA_EVT_ASYNC_ADISC); qla2x00_post_async_work(adisc_done, QLA_EVT_ASYNC_ADISC_DONE); +qla2x00_post_async_work(prlo, QLA_EVT_ASYNC_PRLO); +qla2x00_post_async_work(prlo_done, QLA_EVT_ASYNC_PRLO_DONE); int qla2x00_post_uevent_work(struct scsi_qla_host *vha, u32 code) @@ -4932,6 +4934,13 @@ qla2x00_do_work(struct scsi_qla_host *vha) case QLA_EVT_NACK: qla24xx_do_nack_work(vha, e); break; + case QLA_EVT_ASYNC_PRLO: + qla2x00_async_prlo(vha, e->u.logio.fcport); + break; + case QLA_EVT_ASYNC_PRLO_DONE: + qla2x00_async_prlo_done(vha, e->u.logio.fcport, + e->u.logio.data); + break; } if (e->flags & QLA_EVT_FLAG_FREE) kfree(e);