From patchwork Tue Feb 12 23:40:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Madhani X-Patchwork-Id: 10808959 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1571817FB for ; Tue, 12 Feb 2019 23:42:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 046B12C080 for ; Tue, 12 Feb 2019 23:42:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ED24B2C083; Tue, 12 Feb 2019 23:42:21 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, 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 885F52C082 for ; Tue, 12 Feb 2019 23:42:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729458AbfBLXmU (ORCPT ); Tue, 12 Feb 2019 18:42:20 -0500 Received: from mail-eopbgr740054.outbound.protection.outlook.com ([40.107.74.54]:46309 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728924AbfBLXmU (ORCPT ); Tue, 12 Feb 2019 18:42:20 -0500 Received: from DM6PR07CA0001.namprd07.prod.outlook.com (2603:10b6:5:94::14) by CY4PR07MB2901.namprd07.prod.outlook.com (2603:10b6:903:2e::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1622.16; Tue, 12 Feb 2019 23:42:16 +0000 Received: from CO1NAM05FT009.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e50::205) by DM6PR07CA0001.outlook.office365.com (2603:10b6:5:94::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1622.16 via Frontend Transport; Tue, 12 Feb 2019 23:42:16 +0000 Authentication-Results: spf=fail (sender IP is 199.233.58.38) smtp.mailfrom=marvell.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=marvell.com; Received-SPF: Fail (protection.outlook.com: domain of marvell.com does not designate 199.233.58.38 as permitted sender) receiver=protection.outlook.com; client-ip=199.233.58.38; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (199.233.58.38) by CO1NAM05FT009.mail.protection.outlook.com (10.152.96.116) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1580.2 via Frontend Transport; Tue, 12 Feb 2019 23:42:16 +0000 Received: from dut1171.mv.qlogic.com (10.112.88.18) by CAEXCH02.caveonetworks.com (10.67.98.110) with Microsoft SMTP Server (TLS) id 14.2.347.0; Tue, 12 Feb 2019 15:41:12 -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 x1CNfCij029886; Tue, 12 Feb 2019 15:41:12 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x1CNfCff029885; Tue, 12 Feb 2019 15:41:12 -0800 From: Himanshu Madhani To: , CC: , Subject: [PATCH 08/12] qla2xxx: Add workqueue to delete fcport from bsg sp->free(). Date: Tue, 12 Feb 2019 15:40:42 -0800 Message-ID: <20190212234046.29809-9-hmadhani@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190212234046.29809-1-hmadhani@marvell.com> References: <20190212234046.29809-1-hmadhani@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131944885367310108;(abac79dc-c90b-41ba-8033-08d666125e47);(abac79dc-c90b-41ba-8033-08d666125e47) X-Forefront-Antispam-Report: CIP:199.233.58.38;IPV:CAL;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(376002)(396003)(346002)(39860400002)(136003)(2980300002)(1110001)(1109001)(339900001)(199004)(189003)(106466001)(446003)(486006)(4326008)(11346002)(80596001)(1076003)(105606002)(498600001)(2906002)(26826003)(476003)(2616005)(85426001)(87636003)(126002)(76176011)(51416003)(68736007)(50226002)(336012)(356004)(14444005)(6666004)(36756003)(81156014)(8676002)(69596002)(316002)(81166006)(36906005)(8936002)(305945005)(54906003)(86362001)(53936002)(47776003)(48376002)(26005)(50466002)(97736004)(16586007)(110136005)(42186006);DIR:OUT;SFP:1101;SCL:1;SRVR:CY4PR07MB2901;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;A:1;MX:1; X-Microsoft-Exchange-Diagnostics: 1;CO1NAM05FT009;1:am6mAERud3urtSXPAk0ZIx2u6juFsHZ3k76qY43yMowhrLyl1NisqSHue4RvPBc6fOmhsV7ng5+2vwQPio5TUDqd6vcMfaMM2PKGtYF2AoJWjbsW8m0sStikk3mXoWq+DfTpuROvHhTXbYZBBt+HVxgdQzelLRtPf/E056FCmXU= X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 72292c4d-006f-4ffc-11d8-08d69143b8b6 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600110)(711020)(4605077)(2017052603328);SRVR:CY4PR07MB2901; X-MS-TrafficTypeDiagnostic: CY4PR07MB2901: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0946DC87A1 X-Microsoft-Exchange-Diagnostics: 1;CY4PR07MB2901;23:Ei8+QIMe1h6TQdViQsRDYgtUFMRbLF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vmnSbUCHo/VX5SOwL5sljzrM9fcXaTCOgUhV90sWIV8pkRCLkU3njDNaVEvv0vHs6wL6JrXxbr3aEOEwRijuM46ExUTJjynaaixxMHi8CNq5TrDrWffni4wF6Qg== X-Microsoft-Antispam-Message-Info: M2mlAa3QP3QoJDGgxXjv6LvwUiZ+toEV0Usf7DHecbmIocov6F2zofff3UXQd0igZ7Ftv1CezUy9eck7KMEo3g7HpdHfyzaHPJaICllVerXTl8bBeTTetndDZ7eYU+6Ob6lxCIJrlTzXDD+xJrJXU8clnx7xFgzm50PDW0yat7dtX6xVSotdl8ZnGjwLrU1TMnkRx/XlXfGIaAHVztrw2FXWsMUBUJ3qVuYc2Xq2KJcwmXxJO8i1UHGQCNmgZsPiiwkFph5CCvtk/jvBp3/udJbY0pIMrJMOAi9zpBxJUtkICrlJYPokB1HBV9Rg2oV4lPcxxqsLHrHwsq1kx7y3kpuDQ3uvfI3WhhqJTtrTz/Cn04WlbzPNupGJQMoy5k6yiJfgVzb+Codd0aXF6ah76JR7speeUIIIMFdGewTwjus= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2019 23:42:16.4357 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 72292c4d-006f-4ffc-11d8-08d69143b8b6 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[199.233.58.38];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR07MB2901 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: Joe Carnuccio This patch adds workqueue mechanism for deleting fcport via BSG interface. Signed-off-by: Joe Carnuccio Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_bsg.c | 18 +++++++++++++++++- drivers/scsi/qla2xxx/qla_def.h | 1 + drivers/scsi/qla2xxx/qla_os.c | 11 +++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c index 4a9fd8d944d6..d9b6af975691 100644 --- a/drivers/scsi/qla2xxx/qla_bsg.c +++ b/drivers/scsi/qla2xxx/qla_bsg.c @@ -11,6 +11,14 @@ #include #include +static void qla2xxx_free_fcport_work(struct work_struct *work) +{ + struct fc_port *fcport = container_of(work, typeof(*fcport), + free_work); + + qla2x00_free_fcport(fcport); +} + /* BSG support for ELS/CT pass through */ void qla2x00_bsg_job_done(void *ptr, int res) @@ -57,8 +65,16 @@ qla2x00_bsg_sp_free(void *ptr) if (sp->type == SRB_CT_CMD || sp->type == SRB_FXIOCB_BCMD || - sp->type == SRB_ELS_CMD_HST) + sp->type == SRB_ELS_CMD_HST) { + if (ha->free_fcport) { + INIT_WORK(&sp->fcport->free_work, + qla2xxx_free_fcport_work); + queue_work(ha->free_fcport, &sp->fcport->free_work); + goto done; + } kfree(sp->fcport); + } +done: qla2x00_rel_sp(sp); } diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index c0f7593666a1..a0304746e8a5 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -4190,6 +4190,7 @@ struct qla_hw_data { struct work_struct idc_state_handler; struct work_struct nic_core_unrecoverable; struct work_struct board_disable; + struct workqueue_struct *free_fcport; struct mr_data_fx00 mr; uint32_t chip_reset; diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 7bf23943c815..8bc60ba7fd13 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -3196,6 +3196,12 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) host->max_cmd_len, host->max_channel, host->max_lun, host->transportt, sht->vendor_id); + ha->free_fcport = create_workqueue("free_fcport"); + if (!ha->free_fcport) { + ql_log(ql_log_info, base_vha, 0xee00, + "Failed to allocate workqueue ha->free_fcport\n"); + } + INIT_WORK(&base_vha->iocb_work, qla2x00_iocb_work_fn); /* Set up the irqs */ @@ -3650,6 +3656,11 @@ qla2x00_destroy_deferred_work(struct qla_hw_data *ha) ha->dpc_hp_wq = NULL; } + if (ha->free_fcport) { + destroy_workqueue(ha->free_fcport); + ha->free_fcport = NULL; + } + /* Kill the kernel thread for this host */ if (ha->dpc_thread) { struct task_struct *t = ha->dpc_thread;