From patchwork Mon Mar 12 18:16:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 10276951 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 ABDB8602BD for ; Mon, 12 Mar 2018 18:17:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 92B4428E53 for ; Mon, 12 Mar 2018 18:17:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8447928E73; Mon, 12 Mar 2018 18:17:22 +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 3969D28E77 for ; Mon, 12 Mar 2018 18:17:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932812AbeCLSRU (ORCPT ); Mon, 12 Mar 2018 14:17:20 -0400 Received: from mail-sn1nam01on0059.outbound.protection.outlook.com ([104.47.32.59]:61248 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932745AbeCLSRP (ORCPT ); Mon, 12 Mar 2018 14:17:15 -0400 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=wmySAyzFT08IR/e8Xa3n9/RojsQm3r1ASb424tdeO5E=; b=b3CvDHkXnCL6Ni4KgVxpxn3WEGjVGrqfJJrelFxojeGZnwGRDGKakNfRW5Ub0fqNonMNlzldNuxCkbrgcGXf7A1iJIavjEfnNnC3E6ohi8TX9fgCYxB96FaW9bmIB/CuFHeUqLMlyVTFAZTx3Yhkde8qCnOcwOLRbLtq3keN1VA= Received: from DM5PR07CA0045.namprd07.prod.outlook.com (2603:10b6:3:16::31) by BLUPR0701MB2081.namprd07.prod.outlook.com (2a01:111:e400:52f4::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.567.12; Mon, 12 Mar 2018 18:17:12 +0000 Received: from BL2FFO11OLC007.protection.gbl (2a01:111:f400:7c09::184) by DM5PR07CA0045.outlook.office365.com (2603:10b6:3:16::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.567.14 via Frontend Transport; Mon, 12 Mar 2018 18:17:12 +0000 Authentication-Results: spf=fail (sender IP is 50.232.66.26) smtp.mailfrom=cavium.com; HansenPartnership.com; dkim=none (message not signed) header.d=none;HansenPartnership.com; dmarc=none action=none header.from=cavium.com; Received-SPF: Fail (protection.outlook.com: domain of cavium.com does not designate 50.232.66.26 as permitted sender) receiver=protection.outlook.com; client-ip=50.232.66.26; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (50.232.66.26) by BL2FFO11OLC007.mail.protection.outlook.com (10.173.160.142) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.527.18 via Frontend Transport; Mon, 12 Mar 2018 18:17:11 +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; Mon, 12 Mar 2018 11:16:53 -0700 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 w2CIGr3v020787; Mon, 12 Mar 2018 11:16:53 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id w2CIGrrR020786; Mon, 12 Mar 2018 11:16:53 -0700 From: Himanshu Madhani To: , , , , CC: , Subject: [PATCH 12/13] qla2xxx: Fix Async GPN_FT for FCP and FC-NVMe scan Date: Mon, 12 Mar 2018 11:16:49 -0700 Message-ID: <20180312181650.20704-13-himanshu.madhani@cavium.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20180312181650.20704-1-himanshu.madhani@cavium.com> References: <20180312181650.20704-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)(376002)(39860400002)(396003)(346002)(2980300002)(1110001)(1109001)(339900001)(199004)(189003)(186003)(110136005)(575784001)(86362001)(336012)(50466002)(2906002)(105606002)(356003)(6666003)(106466001)(305945005)(8676002)(85426001)(50226002)(81166006)(81156014)(316002)(2201001)(80596001)(69596002)(54906003)(8936002)(51416003)(114624004)(36756003)(59450400001)(87636003)(76176011)(1076002)(47776003)(478600001)(4326008)(2950100002)(5660300001)(72206003)(26005)(42186006)(16586007)(48376002); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0701MB2081; H:CAEXCH02.caveonetworks.com; FPR:; SPF:Fail; PTR:50-232-66-26-static.hfc.comcastbusiness.net; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11OLC007; 1:wzdE3Zk7rXvopHb8w6hRPZ/2XwxMP2p/LKaab/K8CHqLn3NyTvQ2Oj4hwq4VXESvwKGz6XqLHRzF6rXuk8hOpqATU4ZRegf7kggX1dI24hb5GFiySwOHlTFaaHS/nP8L X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 701a7e60-7cf7-413f-cc66-08d5884579d8 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060); SRVR:BLUPR0701MB2081; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB2081; 3:0ni4D6BJD9tKQxRp8Mw/UqW9HarvIWQ9Qi22IMxjyadnJZaRcVbgxe0KmZzwsWA4K3JeARCos7VLxvixe3kUEoVr/GdETgu/UB+FqDM5Ig7BnheERT1mB4d6saQja2w7jeLWfBtMHxlitHTVFbXAe9A0XrNIMNXCQFL7SywKOsCeMrHHwq2sEhFxy2p3CJatjk5VkE9x5m8dMZtl8ZWzsl1T4TYACvPyPWZuMunUV+z90JY4+WjODKSy7XeWpseEsJkrb+XBHfgwQIWEXWCd2rVI7/vwE1pdruXTfK32RCzic7l9gVbSzrV9XRAdKoOgu4gu4nMDtElKIBcs5sKBE7ucUFcCiwBI5jazQxX4Fq8=; 25:l2Ei/JDCDtYT31pQrYxyWieOk3urgjAWJKygpUcZeUAHbYotA6zYDL1W42eu6iprCu8D6T7yMRmWPflnU2EESxDDUbrHewRL1Q8wVCeUeMBj07ruXR6dEbhNwSmNMzDCy+mIePz8/ytR6Fxc5zy9OjO4aRAmqqHxGL2ywvsCToRuVtGQ3dCYj5ExTIdo5HZQwbPmmQJzZjrzNjG5zGvoC14CeiFvzQuMApEL6T2vBMAO2eMwd5ANvMS1n+5lMBumeMJOYNSXyWf9WA6tfXPEHji9XF3d9tLUJnKllQ6AWQghNZyI/TDZUeOHU7gIfKGXNvaClHejLpdvqXj//YZcEQ== X-MS-TrafficTypeDiagnostic: BLUPR0701MB2081: X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB2081; 31:IgkvXEMrxyxnILayDexKeOEf2XBRjFIiLcIgOYv86D+5X8l35WwWz1t3HDlDUm4vz4sCPvyQ8OCrR7G4hh2Lps5AsBBLgMVWNGKtKFF/PED2DdegwjkRAGN5l/2UOCzG072np8Ru78plXv7Mxc6sCeb6xcli2p2BxSpMEytSjeVyfSO5hEeZ+O33zigiLkGRtKn5lhw8C0+5G6yUa/dhmP6uxfGusXx+OpVkdfp+g1E=; 20:t81Zk3YUKgJxJ1Rl3yyugrqJpiI/XoKm0HEq1RMB7fUouYtU8lGPde90HqBXNKGPo9gTd9Nu/MIHRq1Zh8LlyIZh6GQtfbuc7E7StplTj2M2DNuHpc2t2F7D+DziEbIRuM7SVtVOH1/NMqQCwerXX6W0KvDdKQ1vQH/fazqAiHPM0/GGYFdp0b1mcoi3lOh9EqhAc8xRQMwv44H1h0HOrE529zBebI5XDky8KI8DRL6WS58nNRXQEgq+kakYhV06VYFj9DTjHzYQKmzECtuW59KcNBwnI1Dk5L0y1+H78rrutPq46NgfCcSqFSjpePbrlj7lsqwfBfJC5XH52cS2XaaXhfY1B4tT/24ofVjU4nFQJiKbnYvWWqHaQA/nd+1Rn9iZ7cLlP+Kb2BahxF5ClyQ5xcjpLTvQnWpTW4q2gd8xJ7iaMgpmutlMKIWWlzRK/vNWBdjhkhMbHLHRljfb5apA0FbBv89PzKtw/rUPyQ0Wrg60jgIOe8KDZu3NoCUn X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(209352067349851); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(93006095)(93001095)(10201501046)(3231220)(944501244)(52105095)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123558120)(6072148)(201708071742011); SRVR:BLUPR0701MB2081; BCL:0; PCL:0; RULEID:; SRVR:BLUPR0701MB2081; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB2081; 4:HYw7drPDsrnrf4ic56zgNpv2rC5p1QiWF2Efmu7wFonoTKLduXMQK12pIqrT7re9UrzM1N0OvhnUiyc1i57kIEoKOBzKQzpJGOEFvtmXHZzzqSHyZH1pJtYzLDzGZJGxjy2JJZb6U73ZABTW/MRKZF9Bv9NZpcuGH7sN6nfUbjdx1k7ZzR0q3QIs/bHn+h0v6ReoSqD8usqBOvWY/pGRveLVb6fkdrF8MODYLYnVucdZJNiOiu42mdIwkoMnoFeqZqsjUpsjfvk2NMoJ9oqAM+Ul/qMSKZltwJgriiDqfPQm66rhODoQsvYLRT+iyAec X-Forefront-PRVS: 06098A2863 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR0701MB2081; 23:d/jW6YOBBC2c4AtSqijqhc/BIQd1oJ4CYGhybA9?= =?us-ascii?Q?Gw4DdPwocnyc0E4B7ZXMuELvv4uK/UuCPeGZ13iwVDFduPK90NaQQpk2q9GH?= =?us-ascii?Q?xNbTi6Qkdp/qbP1v/7bynRRt0MqB1bxAY1+izAVatabfT4viu9OhW/jygsOm?= =?us-ascii?Q?9GGGewT0cUESmeCxHjvdPYFFD8EpOtCZgE5g7av24OzHtUHgqmYX9s2X0z4J?= =?us-ascii?Q?NXnlQ2HdeWhScQnnjRl/NR16kn2xT32e4bGcu9IwuA7tA9HS0/hrzA8pajvG?= =?us-ascii?Q?GhwAEzU2Rp8hYZo1fKzO2FtAW4vAoG7xkbtnJDwnOmCskajymuG24+F5b3Qb?= =?us-ascii?Q?0dguitMvLUyzAiXMdsegOV3DnVN2nVQ0L0N8G5LPSpSfkvpNlGycZ0ae7O2U?= =?us-ascii?Q?pzNJvCQspytFGqzZ20y6Fz/LmWE3xn0yc+zZk33ESA0Rmxbb4GsQzHFeS2nh?= =?us-ascii?Q?QUhtU6Gsz046nLcYxuhg9QDrq40B1eKuZcVJgZs6NivNtWN5rzCmEbCaSOF8?= =?us-ascii?Q?gRDW0yBwEHI2TaSMwi87E0h7gSD0Pz6TQOPnw3/hq4EbnAzObHclXw4z4xUH?= =?us-ascii?Q?BJEN++CSPqMOAk1EJvvHTUG8L2fvovNCsl9yC7eGdTyr4ItrKfa0dYoDMJNU?= =?us-ascii?Q?oUHcl2tIla3ExP4reKibWthdtNb/FYRQ2k4UZvwcqHYgV/vfHUlWJBm9MGrV?= =?us-ascii?Q?CE21c3rMIqylpouV4rShLur30GnAnlBhlPAQy4Z5VgyragHsROTGh+gy/MH9?= =?us-ascii?Q?Pb4uOjpH+87sEY1uLBy6xDMUY74Rrbk0hhBVa/Tycuw/LV9YXw9HBY4esvp4?= =?us-ascii?Q?SIYd3agkgpEskKpPWV96i3BLDfMggLL4Uy0kliME9de0XZnwLEH1tZkMHvDO?= =?us-ascii?Q?d42vSAr3fBIlH+d04sCP6OIxQPXcjXW9TeLWZJD02FpR+bbKumTUWymSpgVO?= =?us-ascii?Q?hqsyw1HZGd/5SdtH2BpdM+2T2gtC3LQAq0plqK0uI1epQQZ9wPGAb01E9mnb?= =?us-ascii?Q?BfHhJwdzENMjAP1NZKU3+eiiWdyGEPhWYstuhUtc3EXKNuYv9DDnprQ3us6F?= =?us-ascii?Q?JXm1T1pX8btRxPIp5ZgRK+YMwHKtxW1zGbu2ga47GyAxnw3jzfxAfLyIKbJr?= =?us-ascii?Q?8SHsqgAwTRyQYGRkPwrTW8KDzs8aFPBxYkRnz/Ov39+9itgTMNhJGJChzL2L?= =?us-ascii?Q?uidmzhbZ+eTYE62w=3D?= X-Microsoft-Antispam-Message-Info: uLBsIw2YQuKcB+nJ1nMm/lLdCJHc5dXylDr9Q2lGcuUcfdu5Vh4E8NlTaNE+Fuv8eX5WNBfghmjHhWWrgavklJkaO3eWSkujmW9eHlcE9naIuvYWd/7GtRBvxf20Zkv079J3Cfohh1Sn9IG4TLSDRYB515G4PRFQPg6M23XH+kk4TA0cErJcg7p30rHONGyo X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB2081; 6:3I6LwXNWWH68YizpEyWGZdBtuN2qiUQ+XyHX3SrazkEW+qgPntoYNtmngJj7RNbM4jDs4bU1F0S1G+3Nau0MTUf3mZ7Y0+meu3uWn5+I4iabyhbTk6WoVGTxAZE2nCp/iJxar87qAAthsNx+Fzwdk5kLQyrZ6LTiBOouwDKE+U9H3DGLDC+iKua0eXGlrbKUriQhHcoGjsASEroZVxytFlVCJ8x3flUWZqsYhbqGFOXSWg3yCf5cAyYWMry6bSf7ibjqM95YYa6hpIIvMvTDiFte2zCFWZwbALbC3qzW20MCnlekvg6EfikBWliml/Va10a074Ap/D2jS/sFZaCdKPcHa9zmJXeV0UlSQpQFca8=; 5:5eIfn+VE41XgGdITJPUnPu3zcib2aooPqcOjHNhRMISzBFGDVwi4s9JgzuTsz3E2eCf+J34TkXF2tIYHOSTgviD/OgcKrE7wxJ8xRx1cb6JuwaSUUmM/AAqdYpazhDaHUFdlh1GcRA1McHaru3gZfNv05cWtteVKp3M51YcDTj4=; 24:Jc87wIStpI4r/gi9P52D2Udhzwr4CRvqTo+UvPDWVDqp4xO3I3YpQnmS1RwZ+YqjpH2HTx+bP5uyhtA3QxIO4lO3MJIRjRwIbcy8Y4za9MA=; 7:RSPBdSFYs+8eQHYPe6o4N5ifQUl8TvCZ53Cl8Wh6xakSt3pIx6NC9G+0bvDbowA390xtBX+IpSZH0ziNl2fWZZQyhbsMLM+Y1jquuag9jQQI5I2jaL/SaAl/F5bHXbOffcXu6z7j+F2SpnQ9m313uii+gSzPt+r+TD+HWpqTEoTmaRXn8fJiYsrSywDXuMPfaQmP0EV7sQHZ4jpo1vaOUcpostbiUsXbGV/6FLsnbiWXffEm1+gJJmnWYU1jyLl8 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Mar 2018 18:17:11.7733 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 701a7e60-7cf7-413f-cc66-08d5884579d8 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: BLUPR0701MB2081 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 This patch combines FCP and FC-NVMe scan into single scan when driver detects FC-NVMe capability on same port. Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_def.h | 7 ++ drivers/scsi/qla2xxx/qla_gbl.h | 2 +- drivers/scsi/qla2xxx/qla_gs.c | 231 ++++++++++++++++++++++++++++++++-------- drivers/scsi/qla2xxx/qla_init.c | 8 +- drivers/scsi/qla2xxx/qla_os.c | 8 +- 5 files changed, 204 insertions(+), 52 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 576b72bef01d..eb2ec1fb07cb 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -2983,8 +2983,14 @@ enum scan_flags_t { SF_QUEUED = BIT_1, }; +enum fc4type_t { + FS_FC4TYPE_FCP = BIT_0, + FS_FC4TYPE_NVME = BIT_1, +}; + struct fab_scan_rp { port_id_t id; + enum fc4type_t fc4type; u8 port_name[8]; u8 node_name[8]; }; @@ -3276,6 +3282,7 @@ struct qla_work_evt { } nack; struct { u8 fc4_type; + srb_t *sp; } gpnft; } u; }; diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index 19f44e12926b..3c4c84ed0f0f 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h @@ -658,7 +658,7 @@ void qla24xx_handle_gpsc_event(scsi_qla_host_t *, struct event_arg *); int qla2x00_mgmt_svr_login(scsi_qla_host_t *); void qla24xx_handle_gffid_event(scsi_qla_host_t *vha, struct event_arg *ea); int qla24xx_async_gffid(scsi_qla_host_t *vha, fc_port_t *fcport); -int qla24xx_async_gpnft(scsi_qla_host_t *, u8); +int qla24xx_async_gpnft(scsi_qla_host_t *, u8, srb_t *); void qla24xx_async_gpnft_done(scsi_qla_host_t *, srb_t *); void qla24xx_async_gnnft_done(scsi_qla_host_t *, srb_t *); int qla24xx_async_gnnid(scsi_qla_host_t *, fc_port_t *); diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c index e6bb78e6f1d4..a7dfdef460cf 100644 --- a/drivers/scsi/qla2xxx/qla_gs.c +++ b/drivers/scsi/qla2xxx/qla_gs.c @@ -3860,7 +3860,6 @@ void qla24xx_async_gnnft_done(scsi_qla_host_t *vha, srb_t *sp) fc_port_t *fcport; u32 i, rc; bool found; - u8 fc4type = sp->gen2; struct fab_scan_rp *rp; unsigned long flags; @@ -3933,7 +3932,7 @@ void qla24xx_async_gnnft_done(scsi_qla_host_t *vha, srb_t *sp) "%s %d %8phC post new sess\n", __func__, __LINE__, rp->port_name); qla24xx_post_newsess_work(vha, &rp->id, rp->port_name, - rp->node_name, NULL, fc4type); + rp->node_name, NULL, rp->fc4type); } } @@ -3972,8 +3971,6 @@ void qla24xx_async_gnnft_done(scsi_qla_host_t *vha, srb_t *sp) vha->scan.scan_flags &= ~SF_SCANNING; spin_unlock_irqrestore(&vha->work_lock, flags); - if ((fc4type == FC4_TYPE_FCP_SCSI) && vha->flags.nvme_enabled) - qla24xx_async_gpnft(vha, FC4_TYPE_NVME); } static void qla2x00_async_gpnft_gnnft_sp_done(void *s, int res) @@ -3989,6 +3986,9 @@ static void qla2x00_async_gpnft_gnnft_sp_done(void *s, int res) struct fab_scan_rp *rp; int i, j, k; u16 cmd = be16_to_cpu(ct_req->command); + u8 fc4_type = sp->gen2; + u8 found; + unsigned long flags; /* gen2 field is holding the fc4type */ ql_dbg(ql_dbg_disc, vha, 0xffff, @@ -4033,25 +4033,127 @@ static void qla2x00_async_gpnft_gnnft_sp_done(void *s, int res) if (id.b24 == 0 || wwn == 0) continue; - if (cmd == GPN_FT_CMD) { - rp = &vha->scan.l[j]; - rp->id = id; - memcpy(rp->port_name, d->port_name, 8); - j++; - } else {/* GNN_FT_CMD */ - for (k = 0; k < vha->hw->max_fibre_devices; - k++) { - rp = &vha->scan.l[k]; - if (id.b24 == rp->id.b24) { - memcpy(rp->node_name, + if (fc4_type == FC4_TYPE_FCP_SCSI) { + if (cmd == GPN_FT_CMD) { + rp = &vha->scan.l[j]; + rp->id = id; + memcpy(rp->port_name, d->port_name, 8); + j++; + rp->fc4type = FS_FC4TYPE_FCP; + } else {/* GNN_FT_CMD */ + for (k = 0; + k < vha->hw->max_fibre_devices; + k++) { + rp = &vha->scan.l[k]; + if (id.b24 == rp->id.b24) { + memcpy(rp->node_name, + d->port_name, 8); + break; + } + } + } + } else { /* FC4_TYPE_NVME */ + if (cmd == GPN_FT_CMD) { + found = 0; + for (k = 0; + k < vha->hw->max_fibre_devices; + k++) { + rp = &vha->scan.l[k]; + if (!memcmp(rp->port_name, + d->port_name, 8)) { + /* + * This remote port + * supports NVME & FCP + */ + rp->fc4type |= + FS_FC4TYPE_NVME; + found = 1; + break; + } + } + if (!found) { + /* find free slot */ + for (k = 0; + k < vha->hw->max_fibre_devices; + k++) { + rp = &vha->scan.l[k]; + if (wwn_to_u64 + (rp->port_name)) + continue; + else + /* + * found free + * slot + */ + break; + } + + rp->id = id; + memcpy(rp->port_name, d->port_name, 8); - break; + rp->fc4type |= FS_FC4TYPE_NVME; + } + + } else {/* GNN_FT_CMD */ + for (k = 0; + k < vha->hw->max_fibre_devices; + k++) { + rp = &vha->scan.l[k]; + if (id.b24 == rp->id.b24) { + memcpy(rp->node_name, + d->port_name, 8); + break; + } } } } } } + if ((fc4_type == FC4_TYPE_FCP_SCSI) && vha->flags.nvme_enabled && + cmd == GNN_FT_CMD) { + del_timer(&sp->u.iocb_cmd.timer); + spin_lock_irqsave(&vha->work_lock, flags); + vha->scan.scan_flags &= ~SF_SCANNING; + spin_unlock_irqrestore(&vha->work_lock, flags); + + e = qla2x00_alloc_work(vha, QLA_EVT_GPNFT); + 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; + } + + ql_dbg(ql_dbg_disc, vha, 0xffff, + "Async done-%s unable to alloc work element\n", + sp->name); + sp->free(sp); + set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags); + set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); + return; + } + e->u.gpnft.fc4_type = FC4_TYPE_NVME; + sp->rc = res; + e->u.gpnft.sp = sp; + + qla2x00_post_work(vha, e); + return; + } + if (cmd == GPN_FT_CMD) e = qla2x00_alloc_work(vha, QLA_EVT_GPNFT_DONE); else @@ -4100,9 +4202,12 @@ static int qla24xx_async_gnnft(scsi_qla_host_t *vha, struct srb *sp, int rval = QLA_FUNCTION_FAILED; struct ct_sns_req *ct_req; struct ct_sns_pkt *ct_sns; + unsigned long flags; if (!vha->flags.online) { + spin_lock_irqsave(&vha->work_lock, flags); vha->scan.scan_flags &= ~SF_SCANNING; + spin_unlock_irqrestore(&vha->work_lock, flags); goto done_free_sp; } @@ -4111,10 +4216,18 @@ static int qla24xx_async_gnnft(scsi_qla_host_t *vha, struct srb *sp, "%s: req %p rsp %p are not setup\n", __func__, sp->u.iocb_cmd.u.ctarg.req, sp->u.iocb_cmd.u.ctarg.rsp); + spin_lock_irqsave(&vha->work_lock, flags); vha->scan.scan_flags &= ~SF_SCANNING; + spin_unlock_irqrestore(&vha->work_lock, flags); WARN_ON(1); goto done_free_sp; } + + ql_dbg(ql_dbg_disc, vha, 0xfffff, + "%s: FC4Type %x, CT-PASSTRHU %s command ctarg rsp size %d, ctarg req size %d\n", + __func__, fc4_type, sp->name, sp->u.iocb_cmd.u.ctarg.rsp_size, + sp->u.iocb_cmd.u.ctarg.req_size); + sp->type = SRB_CT_PTHRU_CMD; sp->name = "gnnft"; sp->gen1 = vha->hw->base_qpair->chip_reset; @@ -4177,15 +4290,17 @@ void qla24xx_async_gpnft_done(scsi_qla_host_t *vha, srb_t *sp) } /* Get WWPN list for certain fc4_type */ -int qla24xx_async_gpnft(scsi_qla_host_t *vha, u8 fc4_type) +int qla24xx_async_gpnft(scsi_qla_host_t *vha, u8 fc4_type, srb_t *sp) { int rval = QLA_FUNCTION_FAILED; struct ct_sns_req *ct_req; - srb_t *sp; struct ct_sns_pkt *ct_sns; u32 rspsz; unsigned long flags; + ql_dbg(ql_dbg_disc, vha, 0xffff, + "%s enter\n", __func__); + if (!vha->flags.online) return rval; @@ -4198,9 +4313,58 @@ int qla24xx_async_gpnft(scsi_qla_host_t *vha, u8 fc4_type) vha->scan.scan_flags |= SF_SCANNING; spin_unlock_irqrestore(&vha->work_lock, flags); - sp = qla2x00_get_sp(vha, NULL, GFP_KERNEL); - if (!sp) { - vha->scan.scan_flags &= ~SF_SCANNING; + if (fc4_type == FC4_TYPE_FCP_SCSI) { + ql_dbg(ql_dbg_disc, vha, 0xffff, + "%s: Performing FCP Scan\n", __func__); + + if (sp) + sp->free(sp); /* should not happen */ + + sp = qla2x00_get_sp(vha, NULL, GFP_KERNEL); + if (!sp) { + spin_lock_irqsave(&vha->work_lock, flags); + vha->scan.scan_flags &= ~SF_SCANNING; + spin_unlock_irqrestore(&vha->work_lock, flags); + return rval; + } + + sp->u.iocb_cmd.u.ctarg.req = dma_zalloc_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, 0xffff, + "Failed to allocate ct_sns request.\n"); + spin_lock_irqsave(&vha->work_lock, flags); + vha->scan.scan_flags &= ~SF_SCANNING; + spin_unlock_irqrestore(&vha->work_lock, flags); + goto done_free_sp; + } + sp->u.iocb_cmd.u.ctarg.req_size = GPN_FT_REQ_SIZE; + + rspsz = sizeof(struct ct_sns_gpnft_rsp) + + ((vha->hw->max_fibre_devices - 1) * + sizeof(struct ct_sns_gpn_ft_data)); + + sp->u.iocb_cmd.u.ctarg.rsp = dma_zalloc_coherent( + &vha->hw->pdev->dev, rspsz, + &sp->u.iocb_cmd.u.ctarg.rsp_dma, GFP_KERNEL); + if (!sp->u.iocb_cmd.u.ctarg.rsp) { + ql_log(ql_log_warn, vha, 0xffff, + "Failed to allocate ct_sns request.\n"); + spin_lock_irqsave(&vha->work_lock, flags); + vha->scan.scan_flags &= ~SF_SCANNING; + spin_unlock_irqrestore(&vha->work_lock, flags); + goto done_free_sp; + } + sp->u.iocb_cmd.u.ctarg.rsp_size = rspsz; + + ql_dbg(ql_dbg_disc, vha, 0xffff, + "%s scan list size %d\n", __func__, vha->scan.size); + + memset(vha->scan.l, 0, vha->scan.size); + } else if (!sp) { + ql_dbg(ql_dbg_disc, vha, 0xffff, + "NVME scan did not provide SP\n"); return rval; } @@ -4210,31 +4374,10 @@ int qla24xx_async_gpnft(scsi_qla_host_t *vha, u8 fc4_type) sp->gen2 = fc4_type; qla2x00_init_timer(sp, qla2x00_get_async_timeout(vha) + 2); - sp->u.iocb_cmd.u.ctarg.req = dma_zalloc_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, 0xffff, - "Failed to allocate ct_sns request.\n"); - vha->scan.scan_flags &= ~SF_SCANNING; - goto done_free_sp; - } - rspsz = sizeof(struct ct_sns_gpnft_rsp) + ((vha->hw->max_fibre_devices - 1) * sizeof(struct ct_sns_gpn_ft_data)); - sp->u.iocb_cmd.u.ctarg.rsp = dma_zalloc_coherent(&vha->hw->pdev->dev, - rspsz, &sp->u.iocb_cmd.u.ctarg.rsp_dma, GFP_KERNEL); - if (!sp->u.iocb_cmd.u.ctarg.rsp) { - ql_log(ql_log_warn, vha, 0xffff, - "Failed to allocate ct_sns request.\n"); - vha->scan.scan_flags &= ~SF_SCANNING; - goto done_free_sp; - } - - memset(vha->scan.l, 0, vha->scan.size); - ct_sns = (struct ct_sns_pkt *)sp->u.iocb_cmd.u.ctarg.req; /* CT_IU preamble */ ct_req = qla2x00_prep_ct_req(ct_sns, GPN_FT_CMD, rspsz); @@ -4242,8 +4385,6 @@ int qla24xx_async_gpnft(scsi_qla_host_t *vha, u8 fc4_type) /* GPN_FT req */ ct_req->req.gpn_ft.port_type = fc4_type; - sp->u.iocb_cmd.u.ctarg.req_size = GPN_FT_REQ_SIZE; - sp->u.iocb_cmd.u.ctarg.rsp_size = rspsz; sp->u.iocb_cmd.u.ctarg.nport_handle = NPH_SNS; sp->u.iocb_cmd.timeout = qla2x00_async_iocb_timeout; @@ -4251,7 +4392,9 @@ int qla24xx_async_gpnft(scsi_qla_host_t *vha, u8 fc4_type) rval = qla2x00_start_sp(sp); if (rval != QLA_SUCCESS) { + spin_lock_irqsave(&vha->work_lock, flags); vha->scan.scan_flags &= ~SF_SCANNING; + spin_unlock_irqrestore(&vha->work_lock, flags); goto done_free_sp; } diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 5520477a66d9..8aeb0ed524a1 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -5039,9 +5039,9 @@ qla2x00_iidma_fcport(scsi_qla_host_t *vha, fc_port_t *fcport) fcport->port_name, rval, fcport->fp_speed, mb[0], mb[1]); } else { ql_dbg(ql_dbg_disc, vha, 0x2005, - "iIDMA adjusted to %s GB/s on %8phN.\n", + "iIDMA adjusted to %s GB/s (%X) on %8phN.\n", qla2x00_get_link_speed_str(ha, fcport->fp_speed), - fcport->port_name); + fcport->fp_speed, fcport->port_name); } } @@ -5267,8 +5267,8 @@ qla2x00_configure_fabric(scsi_qla_host_t *vha) qlt_do_generation_tick(vha, &discovery_gen); if (USE_ASYNC_SCAN(ha)) { - rval = QLA_SUCCESS; - rval = qla24xx_async_gpnft(vha, FC4_TYPE_FCP_SCSI); + rval = qla24xx_async_gpnft(vha, FC4_TYPE_FCP_SCSI, + NULL); if (rval) set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); } else { diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 7fe265aca617..cb7294d2ac83 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -4821,9 +4821,10 @@ void qla24xx_create_new_sess(struct scsi_qla_host *vha, struct qla_work_evt *e) fcport->d_id = e->u.new_sess.id; fcport->flags |= FCF_FABRIC_DEVICE; fcport->fw_login_state = DSC_LS_PLOGI_PEND; - if (e->u.new_sess.fc4_type == FC4_TYPE_FCP_SCSI) { + if (e->u.new_sess.fc4_type & FS_FC4TYPE_FCP) fcport->fc4_type = FC4_TYPE_FCP_SCSI; - } else if (e->u.new_sess.fc4_type == FC4_TYPE_NVME) { + + if (e->u.new_sess.fc4_type == FS_FC4TYPE_NVME) { fcport->fc4_type = FC4_TYPE_OTHER; fcport->fc4f_nvme = FC4_TYPE_NVME; } @@ -5046,7 +5047,8 @@ qla2x00_do_work(struct scsi_qla_host *vha) e->u.logio.data); break; case QLA_EVT_GPNFT: - qla24xx_async_gpnft(vha, e->u.gpnft.fc4_type); + qla24xx_async_gpnft(vha, e->u.gpnft.fc4_type, + e->u.gpnft.sp); break; case QLA_EVT_GPNFT_DONE: qla24xx_async_gpnft_done(vha, e->u.iosb.sp);