From patchwork Mon Dec 4 22:45:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 10091701 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 E8BEF600C5 for ; Mon, 4 Dec 2017 22:45:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D9D8029387 for ; Mon, 4 Dec 2017 22:45:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CE1D229446; Mon, 4 Dec 2017 22:45:50 +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 0730629387 for ; Mon, 4 Dec 2017 22:45:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752457AbdLDWps (ORCPT ); Mon, 4 Dec 2017 17:45:48 -0500 Received: from mail-sn1nam01on0059.outbound.protection.outlook.com ([104.47.32.59]:33811 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752374AbdLDWpj (ORCPT ); Mon, 4 Dec 2017 17:45:39 -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=dQWL6w9qjyphaK6QvgOyqRmteY9jhKt2UjOAkLzl83IiZ1JlQlp/rkw7p6cTJI4mv54sWPgtELZvB/W80yh8mvYZsixQm4ZKkB3ZFM8uu9ZKfpGjPJ6ITYLE6Ir80J8bJVp0RoiVpNAkQ+UqtIsMWaj3C/O7YyM0FtBKJrRgAMw= Received: from SN1PR0701CA0061.namprd07.prod.outlook.com (2a01:111:e400:52fd::29) by DM5PR0701MB3815.namprd07.prod.outlook.com (2603:10b6:4:7f::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.282.5; Mon, 4 Dec 2017 22:45:36 +0000 Received: from BL2FFO11FD008.protection.gbl (2a01:111:f400:7c09::174) by SN1PR0701CA0061.outlook.office365.com (2a01:111:e400:52fd::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.282.5 via Frontend Transport; Mon, 4 Dec 2017 22:45:36 +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 BL2FFO11FD008.mail.protection.outlook.com (10.173.161.4) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.239.4 via Frontend Transport; Mon, 4 Dec 2017 22:45:35 +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, 4 Dec 2017 14:45:19 -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 vB4MjJvs003473; Mon, 4 Dec 2017 14:45:19 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id vB4MjJnB003472; Mon, 4 Dec 2017 14:45:19 -0800 From: Himanshu Madhani To: , CC: , Subject: [PATCH v3 07/22] qla2xxx: Serialize GPNID for multiple RSCN Date: Mon, 4 Dec 2017 14:45:02 -0800 Message-ID: <20171204224517.3409-8-himanshu.madhani@cavium.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20171204224517.3409-1-himanshu.madhani@cavium.com> References: <20171204224517.3409-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)(189002)(199003)(575784001)(42186006)(47776003)(86362001)(36756003)(50226002)(8936002)(1076002)(87636003)(110136005)(76176011)(478600001)(189998001)(54906003)(72206003)(16586007)(316002)(2906002)(51416003)(356003)(305945005)(5660300001)(101416001)(81156014)(81166006)(8676002)(2950100002)(48376002)(4326008)(50466002)(33646002)(105586002)(69596002)(80596001)(106466001)(6666003); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR0701MB3815; 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; BL2FFO11FD008; 1:cdkfBBHtXrxoV4V7wD07wI4y9CyObAcASFzbVnjLS92yPCOHOZ2m8vhldSM1HuAm8Wjl71UyrbjUrr/DERAgT+OZvhSPY3AQYoSIAVvYXdbhxvG2AUiFb7rfwc9p43mF X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f24d879f-2591-4869-3475-08d53b68bc0d X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600026)(4604075)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603286); SRVR:DM5PR0701MB3815; X-Microsoft-Exchange-Diagnostics: 1; DM5PR0701MB3815; 3:XXl16x8egGDbOXSVMzDZosvYdBmZ15dVAZ89byq8GaG48KOME+JK2HL7wapYZL1hvVp3S8jpMfm4JdwKuE68D9owwbu9xmQBJqrBusGtEQJbHH+VcpEiZSpBpVsZYEqMPFrONrhxx2zxAwcu8oAPhsxdqNq2z2NAVRRTU+SxKjhvcA0HSO5zHP2MW55ZWPg1xYdClcqzSlGvUDKxffwsJPXT2TiLS+OKbw18GlnYGJctjJ/LgR9BoWnba2w1MCjn1S93PDYWP6doHWHEfmDHn/hzjVIhjbeT7YD/kK2+PjuBMJktt8C9xHil4rLdvPOo6UmItna6GyN7Sgd0Tjf/AoDLT/ioZm02epR8yrOXqfs=; 25:5X2aIiQTKw79YqNRQFolFApGdV6SW39qS7I4rlqHK2t/tnJH5vqbeuhrMBYXJfjY9j6etWOexYlfnCtLy34GB8St8BuUsZYskTrWn7iPpYKdKUJcikHGmvm8o3rVOcoFHTXL9qSKj1o/QxgDsw+rbQ44R9Y0vtc4TLVM9hm4xg4vBflZnRKyBs3HDUAs74RMA0EPwh42hDdbRbyRyB9cD3ZUy8cbfXsTyOrio6lbVC4g0VtMTyykpEpH+5fJirtGtAxF2C+q3b1loG5UZmcftT5WsuSSn4dzZkkZZaZdvEjvlQprMqG0QMxluwK5i5JyvegwBkhaxBTbqtkS9Zvhkw== X-MS-TrafficTypeDiagnostic: DM5PR0701MB3815: X-Microsoft-Exchange-Diagnostics: 1; DM5PR0701MB3815; 31:LzkJxqN1RTLycqy/TCc6FcWKKv6GI1wGpL8RFpmouMD5/TVjZF9ZUYt0BwAakbcdaKp8k1FI7i1JfUZ6vJe9jgr2YPL1mMXIvZGlWtlD12i/wSC95uhmzQDoflR048/Ji6gfJGoVVoi94NRJRVf0nALthXBOV51cBHGvU5SKdB4yVRVCERju0Du6IaIsQOCtY99WGgfczlFjcs5QGrg/dp/UHiLp5FwBZ2UQmzI5j5I=; 20:6OXlz1LQwCrgPob6VnnLvjQQEIXuQxurbQK+fQjraTCOcxDs+G7dPX71iJ650NA0Li05wUBHuhkBIq+9W9Eq0Dz1lSfrmXivN0w+kdEUaZJHexEur5n+9FBiFUDJQ3BEVAIRjWgdgBnn8ODk1j+Y4Tj7Lt1w+piX5Zl3CvwI5EHxUtn6LFealVhOE6TE7zx7cxaRGuus6RfXzR446skkLQnHf55ltppPf/C4qXwgRSnEmwuZuujfXKplaRiqKsKiaMJwRadGzt3Hdp9WG+ozddKYTL+DNN1bqmMKlr7fJiWVofzdns1RuXN1LLQtmihszLUVfvmjLdtSSJGkBSC0CUZD/8Nx66glWZX1Vdle/xP2b5MNVzZsruWH9PV/b4kBp5VuDEBJSf5oSXx+nT1QgGLxEE1+4acTnV4EGkPFWnT1z13H/JPoR09Uk+icYmq0Ue6C8n96wQUazaw7hZJ7GYtr7KD6W2Q7ww2lBcWaOKw7pjhvU+qGkIfvN/X96t+s 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)(10201501046)(93006095)(93001095)(3002001)(3231022)(6041248)(20161123562025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123560025)(20161123558100)(6072148)(201708071742011); SRVR:DM5PR0701MB3815; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:DM5PR0701MB3815; X-Microsoft-Exchange-Diagnostics: 1; DM5PR0701MB3815; 4:P8/FfiJp/j3+TogCt4CnrwzzVWziHYdJEAy7BSkpWwpg6UpfBe+TPaGmn2KDC1rvIOj6NQORBizeBdBpiNg4kkfXrD+1ljaVpXVVbn8Bk6IBF7LRJK90p/83QOvCrfudaoCBkkX085R5j5IQuDjeFoz8kf47FoHim3XBgQu64QfMZGtxZSLYLCh0mnrevNxZSllaMRGfHEK7lv5o/vBameeoBmWw1maeNZa1fZ339JSmah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26WsfDZhg=; 7:a9RtVTUWt8Qww2jQv+Hz13E8M6K3Dj4r+39Xn2s5b2uTIZPHsyh8w4gdtA7x6YVPf7fP18PSQSjtYhcsyLal+V2AqKZGob9GUpliuxAgUHbgBzN612lGtBhveKbD7rY6Z81TQtD+qW6zXR76du+Ub4CArTbdupzoVl8e8Cz4sq0xSI4la/4IjvGLYfMq/C14STwu62YJF8laC5mS+cQGo9IxqjKiJq5ai0Nio8yCUB3nTh7GyitJdW9V4MdJnrIL SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2017 22:45:35.6668 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f24d879f-2591-4869-3475-08d53b68bc0d 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: DM5PR0701MB3815 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);