From patchwork Wed Dec 20 06:56:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 10125093 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 090A96057F for ; Wed, 20 Dec 2017 06:57:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F27F829649 for ; Wed, 20 Dec 2017 06:57:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E70D82964F; Wed, 20 Dec 2017 06:57:44 +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 70FEB29649 for ; Wed, 20 Dec 2017 06:57:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932521AbdLTG5k (ORCPT ); Wed, 20 Dec 2017 01:57:40 -0500 Received: from mail-bl2nam02on0078.outbound.protection.outlook.com ([104.47.38.78]:2080 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932393AbdLTG5T (ORCPT ); Wed, 20 Dec 2017 01:57:19 -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=2DuTPh4RAo4P4Qy5cBFFLUEfa1D9U9MYaXyV89YFEzs=; b=JUJ3CxDL+N7tf0j+Li7yrdlza/TkXxW1a6FKk21RuTDr0sRnafgkDHru4H+AoBvyCwMIA6o2H7Clkdz7ScCPJPdKgQIARF7bfmq2xLmVuCRnLqFanT4md0JHdnDiu7AH5fIRjrrphvdj+reAsNOFirRUK1MeZSVOmj9qptnSjNU= Received: from CO2PR07CA0067.namprd07.prod.outlook.com (2603:10b6:100::35) by MWHPR0701MB3817.namprd07.prod.outlook.com (2603:10b6:301:7f::21) 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:17 +0000 Received: from BN1AFFO11FD043.protection.gbl (2a01:111:f400:7c10::176) by CO2PR07CA0067.outlook.office365.com (2603:10b6:100::35) 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:17 +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 BN1AFFO11FD043.mail.protection.outlook.com (10.58.52.190) 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:57:04 +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:50 -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 vBK6uoXG021654; Tue, 19 Dec 2017 22:56:50 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id vBK6uo79021653; Tue, 19 Dec 2017 22:56:50 -0800 From: Himanshu Madhani To: , CC: , Subject: [PATCH 27/43] qla2xxx: Migrate switch registration commands away from mailbox interface Date: Tue, 19 Dec 2017 22:56:28 -0800 Message-ID: <20171220065644.21511-28-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)(39860400002)(346002)(396003)(39380400002)(376002)(2980300002)(448002)(199004)(189003)(87636003)(48376002)(72206003)(80596001)(1076002)(478600001)(85326001)(47776003)(51416003)(2950100002)(6666003)(356003)(2906002)(76176011)(59450400001)(8676002)(50226002)(15650500001)(81156014)(81166006)(4326008)(8936002)(86362001)(5660300001)(36756003)(110136005)(16586007)(69596002)(54906003)(50466002)(316002)(106466001)(42186006)(305945005); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR0701MB3817; 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; BN1AFFO11FD043; 1:ykHl/4E1j7ZfSqUW2tf9oP90PBeTwB7gnmZ5NtTzlRHk3xmeCgX/Ysgq9WXYv/h+bbT27spWkMxqjuEfxIz50vgPPlinFelI9/1gyZvaY1chKYBp/+l5g90nc40ucWdr X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8994756c-a4bb-4eeb-150a-08d54776e0ce X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060); SRVR:MWHPR0701MB3817; X-Microsoft-Exchange-Diagnostics: 1; MWHPR0701MB3817; 3:0ejb8hwM6hT+DELqN+9kLEktXtbmdv9vqpjgp0xbV6kz6JhbIsgHrdtqudgzPLX4klgRtlU+LCHUJYUUV/CN29hRi4Xde9F4wFC4JJ0PXpG2vNAds4nwFINLOga92YzsKGycE6DKK47z1hLwQaBT07dUoqWwCWrGXPz1VDxHS2vpLfl9O4aDUuuN01Tm2eUtKVFIPrd/Iwl3G0Q6gn+bqGk9UUGmHrrp1sO2IMYMT1Pq1JwV0FFE7+sjeE/BCFcLlJPy4ZZaezGrJ8FUlSh2wMSc2UkpdF0XyJ+iLNp9iN6cMj7hEHRSdXa+Qqfex/uzuIGN0mdoyPiM8AZOlJ4oJ4FuebPkOvngtUuC3w8OEhQ=; 25:Nhtsvi8Dx41NZ7fgsngeZon7wz2mYz4Rkirq9nAmZ3yt7m5hDjQPoJiakDODKOswJ60R+9gFdKEZdvzIY/2qvAsKVz5P8/x1PN3HwfB3Wx4YpAi7dPfjBKdeEXQWQXmj8SrXOefI2CxwqD9roF4ff72WUKitVeesBh2d/HBAc12TV0ZkjKzFYoFyCHYbh3DILR14SBEQNnaS2w06OhnpF7glTUomSX2h32pfflU7igb4JA1OWCN8vYJ+TGgyRIzVzea2b/pXFddNp5YWWbJDhRnC0JboOs61n0BMUQhVEhUsp9q/MT8EEeo1p5TeRV9ylAvtgaydgHs/ek/j2MPmKQ== X-MS-TrafficTypeDiagnostic: MWHPR0701MB3817: X-Microsoft-Exchange-Diagnostics: 1; MWHPR0701MB3817; 31:zk8EvhqUKpLL6jbzZj5+K75DTmRbZMIXEMdwfrrPllzXqjAFCBoa8ROdnEFxixGLV1JiCORUrVT6v2V5m2zn7bVqjEguAtbALarYPGrUcffL8fmzdhtuhhDNd0Zh8Q04aZEV7ipUMTiRk68rByEUPLNO4efyq8LwkoWzDPOK4ltLpxA85rEWkjCvwCEuwMC9HPKDQL49BmK0mqoLZ5QRsuUWGeoKQeCMNgLOdKGIz+Q=; 20:iKSUQgiWgmomgE3S3a6XP3EoLqEs6C91JsR/EK7nJhEhQNY246qIfyafGs9+zvDOEMl961zt4hJn03PuxCAMqUvbEYt77cbis6rtAdroPfmLuO2dFFuuoV78sE4//jU/gxee9Ho7tr2gFPRUs1ulPz1a49nXEtJ9Ud9IYNvo3O+wEZr4pxC68mL0HpkEV+3UkcFWMsMNaPQA9e/TbWbM2Ncg3mfYQ6KC6N22it2fc8Gf2ctypCD67wDQFoYh316MBKq/Dz9dVyYBQL5ReI++rLysBAd0iTCZdeS36LG7vjHKggGE+iiDH1aPdkFnIas9VtEc8HovGJQDTfGG8V8IfToJH1lWe1LcTCX+KWi62MwEyiaXPT5/lWy4D0EWRkAO/lKTYU5GipvfiHKNT6sbJnZk0fbieIQjWIDb80BdhVqKwYyQU+HHo0wwMZfbzKz2l3dE543x8EwO/4Hm+4929Gj+ij/Q/XObt8jBIedXsNgd7dWkjaRcKZFifRQ+Op7G X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(209352067349851); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(3231023)(93006095)(93001095)(10201501046)(3002001)(6041268)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:MWHPR0701MB3817; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:MWHPR0701MB3817; X-Microsoft-Exchange-Diagnostics: 1; MWHPR0701MB3817; 4:kFrRhGzRb+p5WJrQlXU5qbvwO29Oddf0pdiQfXdYXG11DJd9GYYMlq8xjL6MVmoTJrbT7lQ8lBcU6WVLcmdnvTGm+fri/R3hBaVk55dmaTyjDtbICt2OoeKp088pUBnKdNbRmePi8N7laHaWd7sJXgYSFulrw9oQ465nkOhhVpuTuryFQT4gU06Be7VFQP5K3SyCGq1GYJPSRW81VVSHJlR4FG1tKsy7Pui11fBOn87FeIxlWZSEcetItQwvdfJcxgqgIO3VSSnsapvTywt441onEdOUAETvjsVv8aJCmI4crhx+xwuks0w/PPj3sifJ X-Forefront-PRVS: 0527DFA348 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR0701MB3817; 23:+Dl3aM//arXSlrN5Zi5oQt0AyxWnqfzVixzLJQc?= =?us-ascii?Q?aWlbyEylcQigscFB1BzB85rTyPQsVpDmxgYGGLGNwRK5lmXEqaIjxKyhNMIj?= =?us-ascii?Q?wvEAra9HQlOSF7xpD/I5o6ODQ8q+d7nRdpEk8njbpMgePdEVaV3hqT1cZBW0?= =?us-ascii?Q?1nlgJIVlGzRw5Hiy0h/zaaQYar4+C8M6aV2nVxtRdat+M3+vGq3lKtMoQLkv?= =?us-ascii?Q?bg1LDRkv8M92TYT2P2sOBqKEnv7/I3fWdKpjvmPJRU9PHDqmV1gWy+yNLuxU?= =?us-ascii?Q?iaXrxS3/WL0GSADTVyyCKy+fEpZUEOGcNrpvKL9K+l+EXFrdsXGvw0xuMiOz?= =?us-ascii?Q?KusXbrAs/B+HWCJQnDAICHMWopRSqWKxONtR/64rTtxrJgZjsqd+a4dVojF+?= =?us-ascii?Q?r0a5EFPLBDe7l7LoFZc/LQmNJNOLkqAH2miv4ydNWqW8w1THsQRfd3wDMc/e?= =?us-ascii?Q?oG+muFdX5qAh6h0UkkYdN+VCOY4T/7YHMkC1W7DygewTqLxoKicIA5tmOFxm?= =?us-ascii?Q?5pI2pTRp9iyloxYQMuZ6vrseeJ4VMcpkSylN4p6DbypbrkrximhaV1+Yc8B5?= =?us-ascii?Q?NUyf1NSLV6QR75y3OOZ5xF4DFamesnSMAUfXEJkPTx5J3B5uiMKdvSuCWZv4?= =?us-ascii?Q?zHaDeddogwT4obTIt/TTWbFu6SJtZ622IcaRKauA7Qi6M4SoV/VbWks0Xi9A?= =?us-ascii?Q?vG01xi2i9VjwVFtQl1xZ81yH8nL+QMS1LBgkYbAaIeezY3fCV3DJWLMJtF/s?= =?us-ascii?Q?R8AHHmzkP9dExuHpiRemWKiwZWOUT+jsF9Ieh7pviqnXbRBxkUyu98yTgytx?= =?us-ascii?Q?SXa6BwJI8BUHLtqlzCK1zjyC+Kz1c5/actwp8xOkYNk+CpzPKyFgDmTn7WUS?= =?us-ascii?Q?YIUvrwBkIW/Gac83HALXm+JRZI4ENv0xsnkam0ZxTqfRRhrD67lYfrxhx2FT?= =?us-ascii?Q?yZfzhqbE7Ei+EuP8Kt44oVIrsRuZpGwa/jMe/88Gq4e6bemCtt4EhG4ao6sy?= =?us-ascii?Q?LKEbgjKP5Y7N1S9DSJGy79JBtDlrBw45/5AfY051tdLOdpw=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; MWHPR0701MB3817; 6:6YWvnrWDIE3fpxVVnCRAn3h3REOGwqBjmzsNcTSJzXL+M99c5ux9XNZiE2j4NIMWI8siu+rDJcIq62Ko+87aV3HJ3OnwRgsV/0EjYfHQbe4kEl/EugTgkPqLzXeh4H4yK+9N0O72gB6JvivlJxeVTl5mmqDPa/0zONwcxhu6ICDY/jp2+P70MzOr/nSTRByJI2wuHFizMJilAjYRlFr7ojSEWkgMj+kODILO7/nhoh+Usw0vr3SAJ2/hK+AuyGlQ56aVekBb/Jbdv0/PTFxYskncKvAUhNit0Hh7xHNPg3B03fDimKEoVwF+uHfZMeti46rhIH+vQWrGqTwVx17A/mSDbDs7BXgiXaGmfqSWeIU=; 5:HKQYIvfvgIMDbzmUnSvMwZpyAkbK8rCEgSuCM8B29+MIAaEFZ5vYZ/HREY8gtg0Uq22nQJ+RjAgJVIrTlR90tZOTRNp9ODpzbZePI/cDRxVnH8VeSDjeiuZDXDWSTCUGaOz6C006DKJC6JB2gSHO/5PkhHDy5ZPR1QUBnAaJVps=; 24:CxoVH9BSf3t0dCCfmn/Tm0glAOFq5gXpE6KUKV+StrAsPw2tJE+l1ashYdRV3JTBdbg/c1Z4UlQCzQDj0qYldonWIw9W0Jm4f2/95li824o=; 7:R2mFdXdOxKEmIRWetGPTi3d1789J5qjblEDNNss8M7dE9QyoxmXkTBPHQTtdkwBPnogqh3J7ZQG3taMaGVLVgmFWCmohzNbF8jdyyt2BJOtdSysJdWphU0VWSjz6VkOUW3a7onDBb8vP7sluqapr8yRFnXYqb/3UW41IeL6DczIQbmBSqq2etrwtiur4cNcx+dNBSjuTm5um4EaGgYPhcdH/8MaS+rfimTR90ChoT6K9kA+OybtH2Lrk+sRhL4eW SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2017 06:57:04.2676 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8994756c-a4bb-4eeb-150a-08d54776e0ce 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: MWHPR0701MB3817 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 Migrate switch registration commands: RFTID, RFFID, RNNID and RSNN_NN out of mailbox interface to reduce fabric scan bottle neck. Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_def.h | 8 +- drivers/scsi/qla2xxx/qla_gbl.h | 2 +- drivers/scsi/qla2xxx/qla_gs.c | 454 +++++++++++++++++++++++++++----------- drivers/scsi/qla2xxx/qla_os.c | 20 +- drivers/scsi/qla2xxx/qla_target.c | 13 +- drivers/scsi/qla2xxx/qla_target.h | 2 +- 6 files changed, 355 insertions(+), 144 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 3042697b92ae..db1f68c3e074 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -516,6 +516,10 @@ enum { SPCN_NVME_CMD, SPCN_CTRL_VP, SPCN_PRLO, + SPCN_RFTID, + SPCN_RFFID, + SPCN_RNNID, + SPCN_RSNNNN, }; struct sp_name { @@ -581,6 +585,7 @@ typedef struct srb { u32 gen1; /* scratch */ u32 gen2; /* scratch */ int rc; + int retry_count; struct completion comp; union { struct srb_iocb iocb_cmd; @@ -3234,7 +3239,7 @@ enum qla_work_type { QLA_EVT_AENFX, QLA_EVT_GIDPN, QLA_EVT_GPNID, - QLA_EVT_GPNID_DONE, + QLA_EVT_UNMAP, QLA_EVT_NEW_SESS, QLA_EVT_GPDB, QLA_EVT_PRLI, @@ -3250,6 +3255,7 @@ enum qla_work_type { QLA_EVT_GNNFT_DONE, QLA_EVT_GNNID, QLA_EVT_GFPNID, + QLA_EVT_SP_RETRY, }; diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index 43799e8dc68a..650ec54e3255 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h @@ -650,7 +650,6 @@ extern void qla2x00_free_fcport(fc_port_t *); extern int qla24xx_post_gpnid_work(struct scsi_qla_host *, port_id_t *); extern int qla24xx_async_gpnid(scsi_qla_host_t *, port_id_t *); -void qla24xx_async_gpnid_done(scsi_qla_host_t *, srb_t*); void qla24xx_handle_gpnid_event(scsi_qla_host_t *, struct event_arg *); int qla24xx_post_gpsc_work(struct scsi_qla_host *, fc_port_t *); @@ -669,6 +668,7 @@ int qla24xx_post_gnnid_work(struct scsi_qla_host *, fc_port_t *); int qla24xx_post_gfpnid_work(struct scsi_qla_host *, fc_port_t *); int qla24xx_async_gfpnid(scsi_qla_host_t *, fc_port_t *); void qla24xx_handle_gfpnid_event(scsi_qla_host_t *vha, struct event_arg *ea); +void qla24xx_sp_unmap(scsi_qla_host_t *, srb_t *); /* * Global Function Prototypes in qla_attr.c source file. diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c index 643ce1578cbe..0e84381e227e 100644 --- a/drivers/scsi/qla2xxx/qla_gs.c +++ b/drivers/scsi/qla2xxx/qla_gs.c @@ -14,6 +14,10 @@ static int qla2x00_sns_gpn_id(scsi_qla_host_t *, sw_info_t *); static int qla2x00_sns_gnn_id(scsi_qla_host_t *, sw_info_t *); static int qla2x00_sns_rft_id(scsi_qla_host_t *); static int qla2x00_sns_rnn_id(scsi_qla_host_t *); +static int qla_async_rftid(scsi_qla_host_t *, port_id_t *); +static int qla_async_rffid(scsi_qla_host_t *, port_id_t *, u8, u8); +static int qla_async_rnnid(scsi_qla_host_t *, port_id_t *, u8*); +static int qla_async_rsnn_nn(scsi_qla_host_t *); struct sp_name sp_str[] = { { SPCN_UNKNOWN, "unknown" }, @@ -43,6 +47,10 @@ struct sp_name sp_str[] = { { SPCN_NVME_CMD, "nvme_cmd" }, { SPCN_CTRL_VP, "ctrl_vp" }, { SPCN_PRLO, "prlo" }, + { SPCN_RFTID, "rftid" }, + { SPCN_RFFID, "rffid" }, + { SPCN_RNNID, "rnnid" }, + { SPCN_RSNNNN, "rsnn_nn" }, }; const char *sp_to_str(uint16_t cmd) @@ -556,6 +564,72 @@ qla2x00_gnn_id(scsi_qla_host_t *vha, sw_info_t *list) return (rval); } +static void qla2x00_async_sns_sp_done(void *s, int rc) +{ + struct srb *sp = s; + struct scsi_qla_host *vha = sp->vha; + struct ct_sns_pkt *ct_sns; + struct qla_work_evt *e; + + sp->rc = rc; + if (rc == QLA_SUCCESS) { + ql_dbg(ql_dbg_disc, vha, 0x204f, + "Async done-%s exiting normally.\n", + sp->name); + } else if (rc == QLA_FUNCTION_TIMEOUT) { + ql_dbg(ql_dbg_disc, vha, 0x204f, + "Async done-%s timeout\n", sp->name); + } else { + ct_sns = (struct ct_sns_pkt *)sp->u.iocb_cmd.u.ctarg.rsp; + memset(ct_sns, 0, sizeof(*ct_sns)); + sp->retry_count++; + if (sp->retry_count > 3) + goto err; + + ql_dbg(ql_dbg_disc, vha, 0x204f, + "Async done-%s fail rc %x. Retry count %d\n", + sp->name, rc, sp->retry_count); + + e = qla2x00_alloc_work(vha, QLA_EVT_SP_RETRY); + if (!e) + goto err2; + + del_timer(&sp->u.iocb_cmd.timer); + e->u.iosb.sp = sp; + qla2x00_post_work(vha, e); + return; + } + +err: + e = qla2x00_alloc_work(vha, QLA_EVT_UNMAP); +err2: + if (!e) { + /* please ignore kernel warning. otherwise, we have mem leak. */ + if (sp->u.iocb_cmd.u.ctarg.req) { + dma_free_coherent(&vha->hw->pdev->dev, + sizeof(struct ct_sns_pkt), + sp->u.iocb_cmd.u.ctarg.req, + sp->u.iocb_cmd.u.ctarg.req_dma); + sp->u.iocb_cmd.u.ctarg.req = NULL; + } + + if (sp->u.iocb_cmd.u.ctarg.rsp) { + dma_free_coherent(&vha->hw->pdev->dev, + sizeof(struct ct_sns_pkt), + sp->u.iocb_cmd.u.ctarg.rsp, + sp->u.iocb_cmd.u.ctarg.rsp_dma); + sp->u.iocb_cmd.u.ctarg.rsp = NULL; + } + + sp->free(sp); + + return; + } + + e->u.iosb.sp = sp; + qla2x00_post_work(vha, e); +} + /** * qla2x00_rft_id() - SNS Register FC-4 TYPEs (RFT_ID) supported by the HBA. * @ha: HA context @@ -565,57 +639,87 @@ qla2x00_gnn_id(scsi_qla_host_t *vha, sw_info_t *list) int qla2x00_rft_id(scsi_qla_host_t *vha) { - int rval; struct qla_hw_data *ha = vha->hw; - ms_iocb_entry_t *ms_pkt; - struct ct_sns_req *ct_req; - struct ct_sns_rsp *ct_rsp; - struct ct_arg arg; if (IS_QLA2100(ha) || IS_QLA2200(ha)) return qla2x00_sns_rft_id(vha); - arg.iocb = ha->ms_iocb; - arg.req_dma = ha->ct_sns_dma; - arg.rsp_dma = ha->ct_sns_dma; - arg.req_size = RFT_ID_REQ_SIZE; - arg.rsp_size = RFT_ID_RSP_SIZE; - arg.nport_handle = NPH_SNS; + return qla_async_rftid(vha, &vha->d_id); +} - /* Issue RFT_ID */ - /* Prepare common MS IOCB */ - ms_pkt = ha->isp_ops->prep_ms_iocb(vha, &arg); +static int qla_async_rftid(scsi_qla_host_t *vha, port_id_t *d_id) +{ + int rval = QLA_MEMORY_ALLOC_FAILED; + struct ct_sns_req *ct_req; + srb_t *sp; + struct ct_sns_pkt *ct_sns; + + if (!vha->flags.online) + goto done; + + sp = qla2x00_get_sp(vha, NULL, GFP_KERNEL); + if (!sp) + goto done; + + sp->type = SRB_CT_PTHRU_CMD; + sp->name = sp_to_str(SPCN_RFTID); + qla2x00_init_timer(sp, qla2x00_get_async_timeout(vha) + 2); + + sp->u.iocb_cmd.u.ctarg.req = dma_alloc_coherent(&vha->hw->pdev->dev, + sizeof(struct ct_sns_pkt), &sp->u.iocb_cmd.u.ctarg.req_dma, + GFP_KERNEL); + if (!sp->u.iocb_cmd.u.ctarg.req) { + ql_log(ql_log_warn, vha, 0xd041, + "%s: Failed to allocate ct_sns request.\n", + __func__); + goto done_free_sp; + } + + sp->u.iocb_cmd.u.ctarg.rsp = dma_alloc_coherent(&vha->hw->pdev->dev, + sizeof(struct ct_sns_pkt), &sp->u.iocb_cmd.u.ctarg.rsp_dma, + GFP_KERNEL); + if (!sp->u.iocb_cmd.u.ctarg.rsp) { + ql_log(ql_log_warn, vha, 0xd042, + "%s: Failed to allocate ct_sns request.\n", + __func__); + goto done_free_sp; + } + ct_sns = (struct ct_sns_pkt *)sp->u.iocb_cmd.u.ctarg.rsp; + memset(ct_sns, 0, sizeof(*ct_sns)); + ct_sns = (struct ct_sns_pkt *)sp->u.iocb_cmd.u.ctarg.req; /* Prepare CT request */ - ct_req = qla2x00_prep_ct_req(ha->ct_sns, RFT_ID_CMD, - RFT_ID_RSP_SIZE); - ct_rsp = &ha->ct_sns->p.rsp; + ct_req = qla2x00_prep_ct_req(ct_sns, RFT_ID_CMD, RFT_ID_RSP_SIZE); /* Prepare CT arguments -- port_id, FC-4 types */ ct_req->req.rft_id.port_id[0] = vha->d_id.b.domain; ct_req->req.rft_id.port_id[1] = vha->d_id.b.area; ct_req->req.rft_id.port_id[2] = vha->d_id.b.al_pa; - ct_req->req.rft_id.fc4_types[2] = 0x01; /* FCP-3 */ if (vha->flags.nvme_enabled) ct_req->req.rft_id.fc4_types[6] = 1; /* NVMe type 28h */ - /* Execute MS IOCB */ - rval = qla2x00_issue_iocb(vha, ha->ms_iocb, ha->ms_iocb_dma, - sizeof(ms_iocb_entry_t)); + + sp->u.iocb_cmd.u.ctarg.req_size = RFT_ID_REQ_SIZE; + sp->u.iocb_cmd.u.ctarg.rsp_size = RFT_ID_RSP_SIZE; + sp->u.iocb_cmd.u.ctarg.nport_handle = NPH_SNS; + sp->u.iocb_cmd.timeout = qla2x00_async_iocb_timeout; + sp->done = qla2x00_async_sns_sp_done; + + rval = qla2x00_start_sp(sp); if (rval != QLA_SUCCESS) { - /*EMPTY*/ ql_dbg(ql_dbg_disc, vha, 0x2043, "RFT_ID issue IOCB failed (%d).\n", rval); - } else if (qla2x00_chk_ms_status(vha, ms_pkt, ct_rsp, "RFT_ID") != - QLA_SUCCESS) { - rval = QLA_FUNCTION_FAILED; - } else { - ql_dbg(ql_dbg_disc, vha, 0x2044, - "RFT_ID exiting normally.\n"); + goto done_free_sp; } - - return (rval); + ql_dbg(ql_dbg_disc, vha, 0xffff, + "Async-%s - hdl=%x portid %06x.\n", + sp->name, sp->handle, d_id->b24); + return rval; +done_free_sp: + sp->free(sp); +done: + return rval; } /** @@ -627,12 +731,7 @@ qla2x00_rft_id(scsi_qla_host_t *vha) int qla2x00_rff_id(scsi_qla_host_t *vha, u8 type) { - int rval; struct qla_hw_data *ha = vha->hw; - ms_iocb_entry_t *ms_pkt; - struct ct_sns_req *ct_req; - struct ct_sns_rsp *ct_rsp; - struct ct_arg arg; if (IS_QLA2100(ha) || IS_QLA2200(ha)) { ql_dbg(ql_dbg_disc, vha, 0x2046, @@ -640,47 +739,81 @@ qla2x00_rff_id(scsi_qla_host_t *vha, u8 type) return (QLA_SUCCESS); } - arg.iocb = ha->ms_iocb; - arg.req_dma = ha->ct_sns_dma; - arg.rsp_dma = ha->ct_sns_dma; - arg.req_size = RFF_ID_REQ_SIZE; - arg.rsp_size = RFF_ID_RSP_SIZE; - arg.nport_handle = NPH_SNS; + return qla_async_rffid(vha, &vha->d_id, qlt_rff_id(vha), + FC4_TYPE_FCP_SCSI); +} - /* Issue RFF_ID */ - /* Prepare common MS IOCB */ - ms_pkt = ha->isp_ops->prep_ms_iocb(vha, &arg); +static int qla_async_rffid(scsi_qla_host_t *vha, port_id_t *d_id, + u8 fc4feature, u8 fc4type) +{ + int rval = QLA_MEMORY_ALLOC_FAILED; + struct ct_sns_req *ct_req; + srb_t *sp; + struct ct_sns_pkt *ct_sns; - /* Prepare CT request */ - ct_req = qla2x00_prep_ct_req(ha->ct_sns, RFF_ID_CMD, - RFF_ID_RSP_SIZE); - ct_rsp = &ha->ct_sns->p.rsp; + sp = qla2x00_get_sp(vha, NULL, GFP_KERNEL); + if (!sp) + goto done; - /* Prepare CT arguments -- port_id, FC-4 feature, FC-4 type */ - ct_req->req.rff_id.port_id[0] = vha->d_id.b.domain; - ct_req->req.rff_id.port_id[1] = vha->d_id.b.area; - ct_req->req.rff_id.port_id[2] = vha->d_id.b.al_pa; + sp->type = SRB_CT_PTHRU_CMD; + sp->name = sp_to_str(SPCN_RFFID); + qla2x00_init_timer(sp, qla2x00_get_async_timeout(vha) + 2); - qlt_rff_id(vha, ct_req); + sp->u.iocb_cmd.u.ctarg.req = dma_alloc_coherent(&vha->hw->pdev->dev, + sizeof(struct ct_sns_pkt), &sp->u.iocb_cmd.u.ctarg.req_dma, + GFP_KERNEL); + if (!sp->u.iocb_cmd.u.ctarg.req) { + ql_log(ql_log_warn, vha, 0xd041, + "%s: Failed to allocate ct_sns request.\n", + __func__); + goto done_free_sp; + } - ct_req->req.rff_id.fc4_type = type; /* SCSI - FCP */ + sp->u.iocb_cmd.u.ctarg.rsp = dma_alloc_coherent(&vha->hw->pdev->dev, + sizeof(struct ct_sns_pkt), &sp->u.iocb_cmd.u.ctarg.rsp_dma, + GFP_KERNEL); + if (!sp->u.iocb_cmd.u.ctarg.rsp) { + ql_log(ql_log_warn, vha, 0xd042, + "%s: Failed to allocate ct_sns request.\n", + __func__); + goto done_free_sp; + } + ct_sns = (struct ct_sns_pkt *)sp->u.iocb_cmd.u.ctarg.rsp; + memset(ct_sns, 0, sizeof(*ct_sns)); + ct_sns = (struct ct_sns_pkt *)sp->u.iocb_cmd.u.ctarg.req; - /* Execute MS IOCB */ - rval = qla2x00_issue_iocb(vha, ha->ms_iocb, ha->ms_iocb_dma, - sizeof(ms_iocb_entry_t)); + /* Prepare CT request */ + ct_req = qla2x00_prep_ct_req(ct_sns, RFF_ID_CMD, RFF_ID_RSP_SIZE); + + /* Prepare CT arguments -- port_id, FC-4 feature, FC-4 type */ + ct_req->req.rff_id.port_id[0] = d_id->b.domain; + ct_req->req.rff_id.port_id[1] = d_id->b.area; + ct_req->req.rff_id.port_id[2] = d_id->b.al_pa; + ct_req->req.rff_id.fc4_feature = fc4feature; + ct_req->req.rff_id.fc4_type = fc4type; /* SCSI - FCP */ + + sp->u.iocb_cmd.u.ctarg.req_size = RFF_ID_REQ_SIZE; + sp->u.iocb_cmd.u.ctarg.rsp_size = RFF_ID_RSP_SIZE; + sp->u.iocb_cmd.u.ctarg.nport_handle = NPH_SNS; + sp->u.iocb_cmd.timeout = qla2x00_async_iocb_timeout; + sp->done = qla2x00_async_sns_sp_done; + + rval = qla2x00_start_sp(sp); if (rval != QLA_SUCCESS) { - /*EMPTY*/ ql_dbg(ql_dbg_disc, vha, 0x2047, "RFF_ID issue IOCB failed (%d).\n", rval); - } else if (qla2x00_chk_ms_status(vha, ms_pkt, ct_rsp, "RFF_ID") != - QLA_SUCCESS) { - rval = QLA_FUNCTION_FAILED; - } else { - ql_dbg(ql_dbg_disc, vha, 0x2048, - "RFF_ID exiting normally.\n"); + goto done_free_sp; } - return (rval); + ql_dbg(ql_dbg_disc, vha, 0xffff, + "Async-%s - hdl=%x portid %06x feature %x type %x.\n", + sp->name, sp->handle, d_id->b24, fc4feature, fc4type); + return rval; + +done_free_sp: + sp->free(sp); +done: + return rval; } /** @@ -692,54 +825,85 @@ qla2x00_rff_id(scsi_qla_host_t *vha, u8 type) int qla2x00_rnn_id(scsi_qla_host_t *vha) { - int rval; struct qla_hw_data *ha = vha->hw; - ms_iocb_entry_t *ms_pkt; - struct ct_sns_req *ct_req; - struct ct_sns_rsp *ct_rsp; - struct ct_arg arg; if (IS_QLA2100(ha) || IS_QLA2200(ha)) return qla2x00_sns_rnn_id(vha); - arg.iocb = ha->ms_iocb; - arg.req_dma = ha->ct_sns_dma; - arg.rsp_dma = ha->ct_sns_dma; - arg.req_size = RNN_ID_REQ_SIZE; - arg.rsp_size = RNN_ID_RSP_SIZE; - arg.nport_handle = NPH_SNS; + return qla_async_rnnid(vha, &vha->d_id, vha->node_name); +} - /* Issue RNN_ID */ - /* Prepare common MS IOCB */ - ms_pkt = ha->isp_ops->prep_ms_iocb(vha, &arg); +static int qla_async_rnnid(scsi_qla_host_t *vha, port_id_t *d_id, + u8 *node_name) +{ + int rval = QLA_MEMORY_ALLOC_FAILED; + struct ct_sns_req *ct_req; + srb_t *sp; + struct ct_sns_pkt *ct_sns; + + sp = qla2x00_get_sp(vha, NULL, GFP_KERNEL); + if (!sp) + goto done; + + sp->type = SRB_CT_PTHRU_CMD; + sp->name = sp_to_str(SPCN_RNNID); + qla2x00_init_timer(sp, qla2x00_get_async_timeout(vha) + 2); + + sp->u.iocb_cmd.u.ctarg.req = dma_alloc_coherent(&vha->hw->pdev->dev, + sizeof(struct ct_sns_pkt), &sp->u.iocb_cmd.u.ctarg.req_dma, + GFP_KERNEL); + if (!sp->u.iocb_cmd.u.ctarg.req) { + ql_log(ql_log_warn, vha, 0xd041, + "%s: Failed to allocate ct_sns request.\n", + __func__); + goto done_free_sp; + } + + sp->u.iocb_cmd.u.ctarg.rsp = dma_alloc_coherent(&vha->hw->pdev->dev, + sizeof(struct ct_sns_pkt), &sp->u.iocb_cmd.u.ctarg.rsp_dma, + GFP_KERNEL); + if (!sp->u.iocb_cmd.u.ctarg.rsp) { + ql_log(ql_log_warn, vha, 0xd042, + "%s: Failed to allocate ct_sns request.\n", + __func__); + goto done_free_sp; + } + ct_sns = (struct ct_sns_pkt *)sp->u.iocb_cmd.u.ctarg.rsp; + memset(ct_sns, 0, sizeof(*ct_sns)); + ct_sns = (struct ct_sns_pkt *)sp->u.iocb_cmd.u.ctarg.req; /* Prepare CT request */ - ct_req = qla2x00_prep_ct_req(ha->ct_sns, RNN_ID_CMD, RNN_ID_RSP_SIZE); - ct_rsp = &ha->ct_sns->p.rsp; + ct_req = qla2x00_prep_ct_req(ct_sns, RNN_ID_CMD, RNN_ID_RSP_SIZE); /* Prepare CT arguments -- port_id, node_name */ ct_req->req.rnn_id.port_id[0] = vha->d_id.b.domain; ct_req->req.rnn_id.port_id[1] = vha->d_id.b.area; ct_req->req.rnn_id.port_id[2] = vha->d_id.b.al_pa; - memcpy(ct_req->req.rnn_id.node_name, vha->node_name, WWN_SIZE); - /* Execute MS IOCB */ - rval = qla2x00_issue_iocb(vha, ha->ms_iocb, ha->ms_iocb_dma, - sizeof(ms_iocb_entry_t)); + sp->u.iocb_cmd.u.ctarg.req_size = RNN_ID_REQ_SIZE; + sp->u.iocb_cmd.u.ctarg.rsp_size = RNN_ID_RSP_SIZE; + sp->u.iocb_cmd.u.ctarg.nport_handle = NPH_SNS; + + sp->u.iocb_cmd.timeout = qla2x00_async_iocb_timeout; + sp->done = qla2x00_async_sns_sp_done; + + rval = qla2x00_start_sp(sp); if (rval != QLA_SUCCESS) { - /*EMPTY*/ ql_dbg(ql_dbg_disc, vha, 0x204d, "RNN_ID issue IOCB failed (%d).\n", rval); - } else if (qla2x00_chk_ms_status(vha, ms_pkt, ct_rsp, "RNN_ID") != - QLA_SUCCESS) { - rval = QLA_FUNCTION_FAILED; - } else { - ql_dbg(ql_dbg_disc, vha, 0x204e, - "RNN_ID exiting normally.\n"); + goto done_free_sp; } + ql_dbg(ql_dbg_disc, vha, 0xffff, + "Async-%s - hdl=%x portid %06x\n", + sp->name, sp->handle, d_id->b24); - return (rval); + return rval; + +done_free_sp: + sp->free(sp); +done: + return rval; } void @@ -766,12 +930,7 @@ qla2x00_get_sym_node_name(scsi_qla_host_t *vha, uint8_t *snn, size_t size) int qla2x00_rsnn_nn(scsi_qla_host_t *vha) { - int rval; struct qla_hw_data *ha = vha->hw; - ms_iocb_entry_t *ms_pkt; - struct ct_sns_req *ct_req; - struct ct_sns_rsp *ct_rsp; - struct ct_arg arg; if (IS_QLA2100(ha) || IS_QLA2200(ha)) { ql_dbg(ql_dbg_disc, vha, 0x2050, @@ -779,22 +938,49 @@ qla2x00_rsnn_nn(scsi_qla_host_t *vha) return (QLA_SUCCESS); } - arg.iocb = ha->ms_iocb; - arg.req_dma = ha->ct_sns_dma; - arg.rsp_dma = ha->ct_sns_dma; - arg.req_size = 0; - arg.rsp_size = RSNN_NN_RSP_SIZE; - arg.nport_handle = NPH_SNS; + return qla_async_rsnn_nn(vha); +} - /* Issue RSNN_NN */ - /* Prepare common MS IOCB */ - /* Request size adjusted after CT preparation */ - ms_pkt = ha->isp_ops->prep_ms_iocb(vha, &arg); +static int qla_async_rsnn_nn(scsi_qla_host_t *vha) +{ + int rval = QLA_MEMORY_ALLOC_FAILED; + struct ct_sns_req *ct_req; + srb_t *sp; + struct ct_sns_pkt *ct_sns; + + sp = qla2x00_get_sp(vha, NULL, GFP_KERNEL); + if (!sp) + goto done; + + sp->type = SRB_CT_PTHRU_CMD; + sp->name = sp_to_str(SPCN_RSNNNN); + qla2x00_init_timer(sp, qla2x00_get_async_timeout(vha) + 2); + + sp->u.iocb_cmd.u.ctarg.req = dma_alloc_coherent(&vha->hw->pdev->dev, + sizeof(struct ct_sns_pkt), &sp->u.iocb_cmd.u.ctarg.req_dma, + GFP_KERNEL); + if (!sp->u.iocb_cmd.u.ctarg.req) { + ql_log(ql_log_warn, vha, 0xd041, + "%s: Failed to allocate ct_sns request.\n", + __func__); + goto done_free_sp; + } + + sp->u.iocb_cmd.u.ctarg.rsp = dma_alloc_coherent(&vha->hw->pdev->dev, + sizeof(struct ct_sns_pkt), &sp->u.iocb_cmd.u.ctarg.rsp_dma, + GFP_KERNEL); + if (!sp->u.iocb_cmd.u.ctarg.rsp) { + ql_log(ql_log_warn, vha, 0xd042, + "%s: Failed to allocate ct_sns request.\n", + __func__); + goto done_free_sp; + } + ct_sns = (struct ct_sns_pkt *)sp->u.iocb_cmd.u.ctarg.rsp; + memset(ct_sns, 0, sizeof(*ct_sns)); + ct_sns = (struct ct_sns_pkt *)sp->u.iocb_cmd.u.ctarg.req; /* Prepare CT request */ - ct_req = qla2x00_prep_ct_req(ha->ct_sns, RSNN_NN_CMD, - RSNN_NN_RSP_SIZE); - ct_rsp = &ha->ct_sns->p.rsp; + ct_req = qla2x00_prep_ct_req(ct_sns, RSNN_NN_CMD, RSNN_NN_RSP_SIZE); /* Prepare CT arguments -- node_name, symbolic node_name, size */ memcpy(ct_req->req.rsnn_nn.node_name, vha->node_name, WWN_SIZE); @@ -802,32 +988,33 @@ qla2x00_rsnn_nn(scsi_qla_host_t *vha) /* Prepare the Symbolic Node Name */ qla2x00_get_sym_node_name(vha, ct_req->req.rsnn_nn.sym_node_name, sizeof(ct_req->req.rsnn_nn.sym_node_name)); - - /* Calculate SNN length */ ct_req->req.rsnn_nn.name_len = (uint8_t)strlen(ct_req->req.rsnn_nn.sym_node_name); - /* Update MS IOCB request */ - ms_pkt->req_bytecount = - cpu_to_le32(24 + 1 + ct_req->req.rsnn_nn.name_len); - ms_pkt->dseg_req_length = ms_pkt->req_bytecount; - /* Execute MS IOCB */ - rval = qla2x00_issue_iocb(vha, ha->ms_iocb, ha->ms_iocb_dma, - sizeof(ms_iocb_entry_t)); + sp->u.iocb_cmd.u.ctarg.req_size = 24 + 1 + ct_req->req.rsnn_nn.name_len; + sp->u.iocb_cmd.u.ctarg.rsp_size = RSNN_NN_RSP_SIZE; + sp->u.iocb_cmd.u.ctarg.nport_handle = NPH_SNS; + + sp->u.iocb_cmd.timeout = qla2x00_async_iocb_timeout; + sp->done = qla2x00_async_sns_sp_done; + + rval = qla2x00_start_sp(sp); if (rval != QLA_SUCCESS) { - /*EMPTY*/ - ql_dbg(ql_dbg_disc, vha, 0x2051, - "RSNN_NN issue IOCB failed (%d).\n", rval); - } else if (qla2x00_chk_ms_status(vha, ms_pkt, ct_rsp, "RSNN_NN") != - QLA_SUCCESS) { - rval = QLA_FUNCTION_FAILED; - } else { - ql_dbg(ql_dbg_disc, vha, 0x2052, - "RSNN_NN exiting normally.\n"); + ql_dbg(ql_dbg_disc, vha, 0x2043, + "RFT_ID issue IOCB failed (%d).\n", rval); + goto done_free_sp; } + ql_dbg(ql_dbg_disc, vha, 0xffff, + "Async-%s - hdl=%x.\n", + sp->name, sp->handle); - return (rval); + return rval; + +done_free_sp: + sp->free(sp); +done: + return rval; } /** @@ -3249,7 +3436,7 @@ int qla24xx_post_gpnid_work(struct scsi_qla_host *vha, port_id_t *id) return qla2x00_post_work(vha, e); } -void qla24xx_async_gpnid_done(scsi_qla_host_t *vha, srb_t *sp) +void qla24xx_sp_unmap(scsi_qla_host_t *vha, srb_t *sp) { if (sp->u.iocb_cmd.u.ctarg.req) { dma_free_coherent(&vha->hw->pdev->dev, @@ -3457,7 +3644,7 @@ static void qla2x00_async_gpnid_sp_done(void *s, int res) qla2x00_fcport_event_handler(vha, &ea); - e = qla2x00_alloc_work(vha, QLA_EVT_GPNID_DONE); + e = qla2x00_alloc_work(vha, QLA_EVT_UNMAP); if (!e) { /* please ignore kernel warning. otherwise, we have mem leak. */ if (sp->u.iocb_cmd.u.ctarg.req) { @@ -3827,8 +4014,7 @@ void qla24xx_async_gnnft_done(scsi_qla_host_t *vha, srb_t *sp) } out: - /* re-use gpnid_done to free resource */ - qla24xx_async_gpnid_done(vha, sp); + qla24xx_sp_unmap(vha, sp); } static void qla2x00_async_gpnft_gnnft_sp_done(void *s, int res) diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index cab39a6d9776..d4a967410893 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -4907,6 +4907,20 @@ void qla24xx_create_new_sess(struct scsi_qla_host *vha, struct qla_work_evt *e) } } +static void qla_sp_retry(struct scsi_qla_host *vha, struct qla_work_evt *e) +{ + struct srb *sp = e->u.iosb.sp; + int rval; + + rval = qla2x00_start_sp(sp); + if (rval != QLA_SUCCESS) { + ql_dbg(ql_dbg_disc, vha, 0x2043, + "%s: %s: Re-issue IOCB failed (%d).\n", + __func__, sp->name, rval); + qla24xx_sp_unmap(vha, sp); + } +} + void qla2x00_do_work(struct scsi_qla_host *vha) { @@ -4960,8 +4974,8 @@ qla2x00_do_work(struct scsi_qla_host *vha) case QLA_EVT_GPNID: qla24xx_async_gpnid(vha, &e->u.gpnid.id); break; - case QLA_EVT_GPNID_DONE: - qla24xx_async_gpnid_done(vha, e->u.iosb.sp); + case QLA_EVT_UNMAP: + qla24xx_sp_unmap(vha, e->u.iosb.sp); break; case QLA_EVT_RELOGIN: qla2x00_relogin(vha); @@ -5010,6 +5024,8 @@ qla2x00_do_work(struct scsi_qla_host *vha) case QLA_EVT_GFPNID: qla24xx_async_gfpnid(vha, e->u.fcport.fcport); break; + case QLA_EVT_SP_RETRY: + qla_sp_retry(vha, e); } if (e->flags & QLA_EVT_FLAG_FREE) kfree(e); diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index e7e0689d9ca5..93910e56643d 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -6641,18 +6641,21 @@ qlt_vport_create(struct scsi_qla_host *vha, struct qla_hw_data *ha) qlt_add_target(ha, vha); } -void -qlt_rff_id(struct scsi_qla_host *vha, struct ct_sns_req *ct_req) +u8 +qlt_rff_id(struct scsi_qla_host *vha) { + u8 fc4_feature = 0; /* * FC-4 Feature bit 0 indicates target functionality to the name server. */ if (qla_tgt_mode_enabled(vha)) { - ct_req->req.rff_id.fc4_feature = BIT_0; + fc4_feature = BIT_0; } else if (qla_ini_mode_enabled(vha)) { - ct_req->req.rff_id.fc4_feature = BIT_1; + fc4_feature = BIT_1; } else if (qla_dual_mode_enabled(vha)) - ct_req->req.rff_id.fc4_feature = BIT_0 | BIT_1; + fc4_feature = BIT_0 | BIT_1; + + return fc4_feature; } /* diff --git a/drivers/scsi/qla2xxx/qla_target.h b/drivers/scsi/qla2xxx/qla_target.h index dc11b83700c1..42a7cadab81a 100644 --- a/drivers/scsi/qla2xxx/qla_target.h +++ b/drivers/scsi/qla2xxx/qla_target.h @@ -1073,7 +1073,7 @@ extern void qlt_free_cmd(struct qla_tgt_cmd *cmd); extern void qlt_async_event(uint16_t, struct scsi_qla_host *, uint16_t *); extern void qlt_enable_vha(struct scsi_qla_host *); extern void qlt_vport_create(struct scsi_qla_host *, struct qla_hw_data *); -extern void qlt_rff_id(struct scsi_qla_host *, struct ct_sns_req *); +extern u8 qlt_rff_id(struct scsi_qla_host *); extern void qlt_init_atio_q_entries(struct scsi_qla_host *); extern void qlt_24xx_process_atio_queue(struct scsi_qla_host *, uint8_t); extern void qlt_24xx_config_rings(struct scsi_qla_host *);