From patchwork Tue Nov 28 19:34:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 10080953 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 21DA9602DC for ; Tue, 28 Nov 2017 19:35:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 15497280B0 for ; Tue, 28 Nov 2017 19:35:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0993229638; Tue, 28 Nov 2017 19:35:40 +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 3F3A5280B0 for ; Tue, 28 Nov 2017 19:35:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932161AbdK1Tf0 (ORCPT ); Tue, 28 Nov 2017 14:35:26 -0500 Received: from mail-cys01nam02on0086.outbound.protection.outlook.com ([104.47.37.86]:30249 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932146AbdK1TfR (ORCPT ); Tue, 28 Nov 2017 14:35:17 -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=FRPyqicwoqST6jnziPE3JE2Gzgr6v0XlQ2HlQogMrGiEeyhZiTg7XkmQs10LWn3NIYzqKbMV1TyDFuAP05miA3/O6/PK4JMMISiY9LTPa9ATS0dm4sgFImQH9mb0nhlF1f6ZMWimsgTnQzm/wB9GfI/fGX6ZVF63rkwLkJUCY8o= Received: from CO2PR07CA0043.namprd07.prod.outlook.com (2603:10b6:100::11) by SN4PR0701MB3824.namprd07.prod.outlook.com (2603:10b6:803:4f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.260.4; Tue, 28 Nov 2017 19:35:15 +0000 Received: from BY2FFO11FD017.protection.gbl (2a01:111:f400:7c0c::194) by CO2PR07CA0043.outlook.office365.com (2603:10b6:100::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.282.5 via Frontend Transport; Tue, 28 Nov 2017 19:35:15 +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 BY2FFO11FD017.mail.protection.outlook.com (10.1.14.105) 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; Tue, 28 Nov 2017 19:35:15 +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, 28 Nov 2017 11:35:05 -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 vASJZ5sm013758; Tue, 28 Nov 2017 11:35:05 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id vASJZ5Et013757; Tue, 28 Nov 2017 11:35:05 -0800 From: Himanshu Madhani To: , CC: , Subject: [PATCH 07/22] qla2xxx: Serialize GPNID for multiple RSCN Date: Tue, 28 Nov 2017 11:34:48 -0800 Message-ID: <20171128193503.13695-8-himanshu.madhani@cavium.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20171128193503.13695-1-himanshu.madhani@cavium.com> References: <20171128193503.13695-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)(346002)(376002)(2980300002)(428002)(199003)(189002)(6666003)(4326008)(106466001)(80596001)(76176999)(69596002)(48376002)(50986999)(50466002)(54906003)(16586007)(110136005)(105586002)(316002)(189998001)(2950100002)(101416001)(5660300001)(72206003)(86362001)(87636003)(305945005)(47776003)(478600001)(42186006)(1076002)(8936002)(33646002)(51416003)(356003)(50226002)(36756003)(8676002)(2906002)(81166006)(575784001)(81156014); DIR:OUT; SFP:1101; SCL:1; SRVR:SN4PR0701MB3824; H:CAEXCH02.caveonetworks.com; FPR:; SPF:None; PTR:50-232-66-26-static.hfc.comcastbusiness.net; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD017; 1:ABUJPlwS4ytcGPjhT5hUjP88C9revCDl9luvXjeij6J2codp2BTFkn4/dKI+rCIhxs2NqJdmlGYvxUpF8R453jC3pUSHSyHS8vu2+pRgLU/URFkgZQzSDG/TDlzRumAv X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 97666dc2-316e-4249-b705-08d536972650 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603199); SRVR:SN4PR0701MB3824; X-Microsoft-Exchange-Diagnostics: 1; SN4PR0701MB3824; 3:rBnF/X8WifN5pYnt05U+KEKqiblMmKkjOBjtqW9G0awTvycdQAgK3PODr8Dw94Ceskw+x4PGb54IxIO1HA5WcIJsGXngclNO9Fh7+oXnrwerptQlQO1gAoeETDEUlFUsPD1Yb/TxYx7gVn7b1ZgyyWuSXtCp2EZQiJLGGRt0smzg2BSkA72IqCWi5C7wvckqL8ulyEqj9cwn2k1CdredmfBQgecoW3fiOc7+jEhVsE6ZFB+kVeVIEwDQO7t3Vi177qqNUyQgwi6Dqj3lqZVcOW0sE36yyo0wH+NEDFyIdHr4rqDQorkk/FDt3/CeDE0j6V40b++dez1er76d5mem/jh4Xy42BPZgTKxJ63PuVBQ=; 25:qPjQcc+ht+1FKXgpvg6kATcHxBmgs3u8vteawxWWTe80AQM8eK+l6c8tcUGeqgB76aE4x0FL+7O7USxte9wBMRiKFi2WKsxTi3w77wwODM8nT3U/8pC92W2WSbGdXSVJt9qbQ+biYZC00QcV0Y6HOZcHoHWC8BRY9W0aV0jUETdaBPhBLRQQDSGv2lfWoWryad0AeDBBgN7bZAeHsyADW8QS5rqxPyqzR3Z4YmS6bXf7OTOM6LNKgY+te9NOYLcRQgSblwA0ozx8uQT9QXiboX2hNfvYBZLAIpcGwa25A8A0G7rxzlSDG52srk1NT/WJPzBDMe7qnOa/dA5T7teGIg== X-MS-TrafficTypeDiagnostic: SN4PR0701MB3824: X-Microsoft-Exchange-Diagnostics: 1; SN4PR0701MB3824; 31:7OROidciKZz3hHcJRCvW42vfXX0guhNIf7VhwFYs9QJAnZqLDntfMMa+YJ8N4PIGvP8xUc6dhpV9EMqpxUXJXbqXAwuG0EVdQ3tT5bXpIr0BFoRVSA2IhpRJrtKTY4a2iHbrUN1Zm0wAwzCMebCzULaq2H8pXABC1e+WI+wHUGLpnmD3Y+doYTXI7E0MBkVobOGJWxmuayoTW1+OdBwsYEu5dE7Dytd+TT54H+vdgpM=; 20:WomlXqZm7qh8lQStjXlOI/IAjubuH5ssbIW/321+CGcvIb24TPu0+A6DILnvkbXB0NGYDb9l7wVcBOjfYJ6SFjSS5+1N65VtpBbI3k55GdXJzdydOXiKaEnZN/8MFFbOM1eaaW+enquBd9Oy+5cY9+156+0iDxCnyst8g8XmxwcrgMZYD7l2QBuJauQp6X+r2/KXrma8RgQdxd9/B8BL4pbaU+ZoHrsqNJPKtJxiZCipUOv26z9/PSqUSSJNBUJ7PbG7f6fKE4fG+iObKM7O+4hD12kHgblqCq1FYNreMqigqAfFI011aZyYOV7JkUISav5F/MVkmGwW50Fve7VJaE2nSY29rrvUwnihyxSv/V4akgXVfS+juAlIzNWeK6p4WbfknCtThsqlqQ4S3L40mbCTkgaVBUCplbHwvdHv+CRP/6JrceAiNPJcLraoa4LVl/UMVCNLURiNZNB2VzSgeFs5PNJ4LrvSEHq8xay3qvNp1R03Rr/Lqh54FDnVVc3Y 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)(8121501046)(5005006)(3231022)(3002001)(10201501046)(93006095)(93001095)(6041248)(20161123562025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123560025)(20161123555025)(6072148)(201708071742011); SRVR:SN4PR0701MB3824; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:SN4PR0701MB3824; X-Microsoft-Exchange-Diagnostics: 1; SN4PR0701MB3824; 4:iR1tqlSbhugx33E+42zQt4IuL8cBL63taEZvqoiJBm9p8F5kaRGsykn18L3E4O1ceEzKKbCXRYdJ3P2IBcexWRrOYTEbsuLgcMzdObLUcnl13mDNYVLr94rKwyXZSWdypbpB3OUp16cXvvlleRgkdKbIatqinLnH4W9rKZrfl00dBQfj1aJDkAvoyU41wT97u7KC5KCs3Sa3qfzyGyzu43HZEFU+DlIGre7e2SO9lJF4IB8TzFlQWScKHbhjbC3Wtlf5XpYzy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7:TpugpUu3JyqQPB65bo8i97f+9RPiPC5gGWs10Dy6F75XninmPn8zIo70X52pzMu9qGfBjCQ/yXVmz2e35FrE2gnNvl1Rh5avIi4rFovTF6mjW+OBEHiUWwUwId0muBMv0LZY3ZwZAGAQPD5OjV5ZytuHxDH1rewOlMcDMG5+8Jmu78aMqlyz16Dm5bX1vhX2OSs9GTELVr93fJN+g+KYer3g0GabcyEBEpfb40IF4f0e/dfcW1KdYSEmJfieN1Sd SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2017 19:35:15.1394 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 97666dc2-316e-4249-b705-08d536972650 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: SN4PR0701MB3824 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);