From patchwork Thu Nov 30 03:40:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 10084185 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 97295602B9 for ; Thu, 30 Nov 2017 03:41:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8D6EE29935 for ; Thu, 30 Nov 2017 03:41:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 825CF29B02; Thu, 30 Nov 2017 03:41:14 +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 D38E429ADE for ; Thu, 30 Nov 2017 03:41:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753367AbdK3DlI (ORCPT ); Wed, 29 Nov 2017 22:41:08 -0500 Received: from mail-dm3nam03on0075.outbound.protection.outlook.com ([104.47.41.75]:32704 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753237AbdK3DlE (ORCPT ); Wed, 29 Nov 2017 22:41:04 -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=w7yMMhNd4fHfKqv4Wo/G2pDx6PihjSk/M3yJE/55IJU=; b=ErM0FrR36D2X3bCsgXavjnHKqR++QZSlrJJZEK9tlsFSkb3eNSzJHrvq6kMTIO69jX2f4sjIvB5qrkCeWo2vppHQkJY4vPW1KQ4n8JHRa1qxtOynYQA2RuUGI2qoysv69Cj2cEsNhTMfgyd3Uude4+KzSpCUGrP0UAtU76KD960= Received: from SN1PR0701CA0016.namprd07.prod.outlook.com (2a01:111:e400:5173::26) by CY4PR0701MB3809.namprd07.prod.outlook.com (2603:10b6:910:94::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.282.5; Thu, 30 Nov 2017 03:41:02 +0000 Received: from BL2FFO11FD056.protection.gbl (2a01:111:f400:7c09::189) by SN1PR0701CA0016.outlook.office365.com (2a01:111:e400:5173::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.282.5 via Frontend Transport; Thu, 30 Nov 2017 03:41:02 +0000 Authentication-Results: spf=none (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: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) Received: from CAEXCH02.caveonetworks.com (50.232.66.26) by BL2FFO11FD056.mail.protection.outlook.com (10.173.161.184) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.218.12 via Frontend Transport; Thu, 30 Nov 2017 03:41:02 +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; Wed, 29 Nov 2017 19:40: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 vAU3enXm015134; Wed, 29 Nov 2017 19:40:49 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id vAU3enu9015133; Wed, 29 Nov 2017 19:40:49 -0800 From: Himanshu Madhani To: , CC: , Subject: [PATCH v2 07/22] qla2xxx: Serialize GPNID for multiple RSCN Date: Wed, 29 Nov 2017 19:40:32 -0800 Message-ID: <20171130034047.15070-8-himanshu.madhani@cavium.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20171130034047.15070-1-himanshu.madhani@cavium.com> References: <20171130034047.15070-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)(6009001)(376002)(346002)(2980300002)(428002)(189002)(199003)(54906003)(42186006)(189998001)(110136005)(16586007)(1076002)(5660300001)(6666003)(101416001)(86362001)(316002)(575784001)(8936002)(50226002)(48376002)(105586002)(4326008)(356003)(36756003)(47776003)(106466001)(50466002)(305945005)(2906002)(80596001)(76176010)(50986010)(33646002)(87636003)(478600001)(72206003)(51416003)(69596002)(81166006)(2950100002)(8676002)(81156014); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR0701MB3809; H:CAEXCH02.caveonetworks.com; FPR:; SPF:None; PTR:50-232-66-26-static.hfc.comcastbusiness.net; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD056; 1:kjdOIBiBijeAzep1k/vZ2Gq3mM0qmdznxF1/X8UkBweWs1cNKDI0GpO3Z5XshsX3rKHt5QGFOMNZ/w13Pm37ALm1G90RxdIjUU9mqU6F7syvNaRdjBggPHt/PQprDbHL X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b5befc39-b1ff-467b-52ef-08d537a42ddc X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603280); SRVR:CY4PR0701MB3809; X-Microsoft-Exchange-Diagnostics: 1; CY4PR0701MB3809; 3:dyYlS8ZUe/9IeWyfZZmB0wQYvcKdZroiz33S/FcJyIYVTU1vbG4NIrbN59plvI+HDL8CszoqIJ/pZ/H3nMhdbElExzSIfaBjncMOSFe3emoaBBSZ58Frxkamiit9njsvl83UK5In9W6wHuFriE+iiIQkoEysvgIMgmZTw5Jf1CX3CAvt5WQeSHtglHzsL3pl9ArdAvWRaStqpIAxnGRSgOnlpRVdNzXKnx9X89jrC1Y+u0Wfq24hlH+iLc4GJLAtgJSa/JOJXu/QxZ0AXUa97ebDj25BRTmuJDFpw84I0kwFHZ39TkREasCTluaWvQMvqT3OgdUyknwwNDSxU8zcn5pA+wKu4F4mo1Vpz7ii0/g=; 25:YOFk6chkKAphjOo7bJSx2EXzLOdd9pAC4TxNi3GShNvkwkk+GeLYfGSU/n3yCK0ZN/l0XfXoXYyKDhGs1thUOfyIVWs3ZfZT6mYIKPprquWauOgVS/WP6r9l1zPYEvaENFoaZlHkf9l6qE6D8+gnc5hhGAQwvpPdReRIdLKSDkkktRDjBDhD9NGUH0S9aRKR8N6xfqWu4gwieJ2Zd8+F3RnXspM5w6WClCo2xuEKuRLH1HxPl3Y/96C3RPob1B6DXAGhdd42flh4SQp6Z0HscwtwCvDY3WClQpKSgaER1nYuXlTPTBUO+2RRiEe6tOyBsQaO99+IBtcKFETHxZ0Lww== X-MS-TrafficTypeDiagnostic: CY4PR0701MB3809: X-Microsoft-Exchange-Diagnostics: 1; CY4PR0701MB3809; 31:secREiHxSV6Jmu5GuZCOrsvL7ZV2cCQJ6qLFfwNlIRUzPfPJBzqskk5zg9okQJ+UAuHB3rMABrRPCJDUuRrWZWvizIad/gz8np5c4dHeFIYgcWh8ttREvM4JPt++jJazzofNmmCjcLXlSZNWFBuRFe6fMLvsJk1qoCeORhMMr1+Cam6bTz9fv4Zu3+75QSZoFRB4MbwzGoTQZD8cLE86VrkOU/rBNWnjPxiy5uyITUQ=; 20:EClKfFvBFH3q+GkpdVl7uboNLANJt3HTWTUHne4O7CXSUVwMMBD6a9Wyz9BJz7DYMOC2afyKdlounOfdwrdfnT4dkvwcLgguuZqVftuqt3O9kmbV58/izxsTT5AT0hDsgc4Q8pOwCaVC2DO4AV4fqmjgoOwIC3JAlm5qEfFr+lIAAvoW2u99yv7l2JPLkGutdoLj+RP0rdcNq7aSCvxMorLTRKvGuj2+ckek/wzczz+rwDcMT8sqyjnDVzg+0R2hnXEAUHViHciKINJuUiW3J3gDXpKIYF4pYF0Nn50/PmWeriaYtxP2LxGVLldgfOk0P8kbHCruFsQ/0Hcv5fJD9ea6eUrqN72I1Pii3ctDKPHVAspdgo5v6rZU+SeFJEcZ1Hk7hf+rMLeP72F76qj3YAC3HZ4mDXR9VrG0vql+qqv2gsBrWHewJe4ujxuk28ReQrPVzW+FF8/EqBy/0r2bitEy6Fit9o4d2PpHOdOG+LV9nRrAh3l9CUTVNc4G/IvU X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(209352067349851)(9452136761055); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(2401047)(5005006)(8121501046)(3231022)(3002001)(10201501046)(93006095)(93001095)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123560025)(20161123564025)(20161123558100)(20161123555025)(6072148)(201708071742011); SRVR:CY4PR0701MB3809; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:CY4PR0701MB3809; X-Microsoft-Exchange-Diagnostics: 1; CY4PR0701MB3809; 4:gMaww1mcdvItPy06PkkvmUM7An4fmqXlJot+wVBiW/BJ+UW+/FkXLa1M5+0JmAu+yXu0qWb66B5TF/fTCfjwYALRdXf01n3yBcGYzNZuKMNvRRB/1lWuiMfeo7w9tFdQwUh2IwHfHfNuW2oDjd/nsVEq373swlBfut//FoHRtNY1z5qDCq262Sx7v8cJT4j9bTjvjMFRtRWoaAgA2M6jD3jbIduk1aGkYjg9Uhv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haWVUZ664glxebGbfO89UszUbZ7M9mcaztLhJ1QRO4gkpY=; 7:FrAuIDCX5ebnDK6S8NzOjp+bYDM3Lu42QocCzodkGR3tnwh3lZvGHuocOr13uz0r+fnVKQfD5lyxa7TYgl+ddPYB8GjkjpLf8P2HonD6cMdzKrxLoqwysWSn5y+09CpsnjVbDxfwKROgo6a0bCbjeNX1O9r5KboW00tB7GfXdbot3wAf7gR8VomlfAMO0+L1wAFr70tOAn9paa31HPkqz3Y7vKa1FMoNMQWKtZO8Elp6n+CFynIIL9xR1z8/qLUF SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2017 03:41:02.2783 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b5befc39-b1ff-467b-52ef-08d537a42ddc 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: CY4PR0701MB3809 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 GPNID is triggered by RSCN. For multiple RSCNs of the same affected NPORT ID, serialize the GPNID to prevent confusion. Fixes: 726b85487067d ("qla2xxx: Add framework for async fabric discovery") Cc: # 4.10+ Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_def.h | 48 +++++++++++++++++++++++------------------- drivers/scsi/qla2xxx/qla_gs.c | 35 +++++++++++++++++++++++++----- drivers/scsi/qla2xxx/qla_isr.c | 2 +- drivers/scsi/qla2xxx/qla_os.c | 1 + 4 files changed, 58 insertions(+), 28 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 01a9b8971e88..d9b4a0651a0f 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -315,6 +315,29 @@ struct srb_cmd { /* To identify if a srb is of T10-CRC type. @sp => srb_t pointer */ #define IS_PROT_IO(sp) (sp->flags & SRB_CRC_CTX_DSD_VALID) +/* + * 24 bit port ID type definition. + */ +typedef union { + uint32_t b24 : 24; + + struct { +#ifdef __BIG_ENDIAN + uint8_t domain; + uint8_t area; + uint8_t al_pa; +#elif defined(__LITTLE_ENDIAN) + uint8_t al_pa; + uint8_t area; + uint8_t domain; +#else +#error "__BIG_ENDIAN or __LITTLE_ENDIAN must be defined!" +#endif + uint8_t rsvd_1; + } b; +} port_id_t; +#define INVALID_PORT_ID 0xFFFFFF + struct els_logo_payload { uint8_t opcode; uint8_t rsvd[3]; @@ -338,6 +361,7 @@ struct ct_arg { u32 rsp_size; void *req; void *rsp; + port_id_t id; }; /* @@ -499,6 +523,7 @@ typedef struct srb { const char *name; int iocbs; struct qla_qpair *qpair; + struct list_head elem; u32 gen1; /* scratch */ u32 gen2; /* scratch */ union { @@ -2164,28 +2189,6 @@ struct imm_ntfy_from_isp { #define REQUEST_ENTRY_SIZE (sizeof(request_t)) -/* - * 24 bit port ID type definition. - */ -typedef union { - uint32_t b24 : 24; - - struct { -#ifdef __BIG_ENDIAN - uint8_t domain; - uint8_t area; - uint8_t al_pa; -#elif defined(__LITTLE_ENDIAN) - uint8_t al_pa; - uint8_t area; - uint8_t domain; -#else -#error "__BIG_ENDIAN or __LITTLE_ENDIAN must be defined!" -#endif - uint8_t rsvd_1; - } b; -} port_id_t; -#define INVALID_PORT_ID 0xFFFFFF /* * Switch info gathering structure. @@ -4252,6 +4255,7 @@ typedef struct scsi_qla_host { uint8_t n2n_node_name[WWN_SIZE]; uint8_t n2n_port_name[WWN_SIZE]; uint16_t n2n_id; + struct list_head gpnid_list; } scsi_qla_host_t; struct qla27xx_image_status { diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c index ea1b562ebc8a..59ecc4eda6cd 100644 --- a/drivers/scsi/qla2xxx/qla_gs.c +++ b/drivers/scsi/qla2xxx/qla_gs.c @@ -3221,16 +3221,17 @@ static void qla2x00_async_gpnid_sp_done(void *s, int res) (struct ct_sns_rsp *)sp->u.iocb_cmd.u.ctarg.rsp; struct event_arg ea; struct qla_work_evt *e; + unsigned long flags; if (res) ql_dbg(ql_dbg_disc, vha, 0x2066, - "Async done-%s fail res %x ID %3phC. %8phC\n", - sp->name, res, ct_req->req.port_id.port_id, + "Async done-%s fail res %x rscn gen %d ID %3phC. %8phC\n", + sp->name, res, sp->gen1, ct_req->req.port_id.port_id, ct_rsp->rsp.gpn_id.port_name); else ql_dbg(ql_dbg_disc, vha, 0x2066, - "Async done-%s good ID %3phC. %8phC\n", - sp->name, ct_req->req.port_id.port_id, + "Async done-%s good rscn gen %d ID %3phC. %8phC\n", + sp->name, sp->gen1, ct_req->req.port_id.port_id, ct_rsp->rsp.gpn_id.port_name); memset(&ea, 0, sizeof(ea)); @@ -3242,11 +3243,20 @@ static void qla2x00_async_gpnid_sp_done(void *s, int res) ea.rc = res; ea.event = FCME_GPNID_DONE; + spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); + list_del(&sp->elem); + spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); + if (res) { if (res == QLA_FUNCTION_TIMEOUT) qla24xx_post_gpnid_work(sp->vha, &ea.id); sp->free(sp); return; + } else if (sp->gen1) { + /* There was anoter RSNC for this Nport ID */ + qla24xx_post_gpnid_work(sp->vha, &ea.id); + sp->free(sp); + return; } qla2x00_fcport_event_handler(vha, &ea); @@ -3282,8 +3292,9 @@ int qla24xx_async_gpnid(scsi_qla_host_t *vha, port_id_t *id) { int rval = QLA_FUNCTION_FAILED; struct ct_sns_req *ct_req; - srb_t *sp; + srb_t *sp, *tsp; struct ct_sns_pkt *ct_sns; + unsigned long flags; if (!vha->flags.online) goto done; @@ -3294,8 +3305,22 @@ int qla24xx_async_gpnid(scsi_qla_host_t *vha, port_id_t *id) sp->type = SRB_CT_PTHRU_CMD; sp->name = "gpnid"; + sp->u.iocb_cmd.u.ctarg.id = *id; + sp->gen1 = 0; qla2x00_init_timer(sp, qla2x00_get_async_timeout(vha) + 2); + spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); + list_for_each_entry(tsp, &vha->gpnid_list, elem) { + if (tsp->u.iocb_cmd.u.ctarg.id.b24 == id->b24) { + tsp->gen1++; + spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); + sp->free(sp); + goto done; + } + } + list_add_tail(&sp->elem, &vha->gpnid_list); + spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); + 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); diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index 545c527263d0..85382387a52b 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c @@ -1574,7 +1574,7 @@ qla24xx_els_ct_entry(scsi_qla_host_t *vha, struct req_que *req, /* borrowing sts_entry_24xx.comp_status. same location as ct_entry_24xx.comp_status */ - res = qla2x00_chk_ms_status(vha, (ms_iocb_entry_t *)pkt, + res = qla2x00_chk_ms_status(sp->vha, (ms_iocb_entry_t *)pkt, (struct ct_sns_rsp *)sp->u.iocb_cmd.u.ctarg.rsp, sp->name); sp->done(sp, res); diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 428e1bfaa83b..e71d99ba57f9 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -4515,6 +4515,7 @@ struct scsi_qla_host *qla2x00_create_host(struct scsi_host_template *sht, INIT_LIST_HEAD(&vha->qp_list); INIT_LIST_HEAD(&vha->gnl.fcports); INIT_LIST_HEAD(&vha->nvme_rport_list); + INIT_LIST_HEAD(&vha->gpnid_list); spin_lock_init(&vha->work_lock); spin_lock_init(&vha->cmd_list_lock);