From patchwork Wed Feb 13 18:53:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Madhani X-Patchwork-Id: 10810735 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 C1A3D13B4 for ; Wed, 13 Feb 2019 18:55:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A6F8E2D52D for ; Wed, 13 Feb 2019 18:55:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 98EB12E047; Wed, 13 Feb 2019 18:55:03 +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 7D7CC2E04A for ; Wed, 13 Feb 2019 18:55:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2436552AbfBMSzB (ORCPT ); Wed, 13 Feb 2019 13:55:01 -0500 Received: from mail-eopbgr810088.outbound.protection.outlook.com ([40.107.81.88]:40436 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2403932AbfBMSzA (ORCPT ); Wed, 13 Feb 2019 13:55:00 -0500 Received: from SN4PR0701CA0005.namprd07.prod.outlook.com (2603:10b6:803:28::15) by DM5PR07MB2905.namprd07.prod.outlook.com (2603:10b6:3:9::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1601.21; Wed, 13 Feb 2019 18:54:57 +0000 Received: from DM3NAM05FT004.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e51::203) by SN4PR0701CA0005.outlook.office365.com (2603:10b6:803:28::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1622.16 via Frontend Transport; Wed, 13 Feb 2019 18:54:57 +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 DM3NAM05FT004.mail.protection.outlook.com (10.152.98.109) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA) id 15.20.1580.2 via Frontend Transport; Wed, 13 Feb 2019 18:54:56 +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; Wed, 13 Feb 2019 10:53:51 -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 x1DIro8G021719; Wed, 13 Feb 2019 10:53:50 -0800 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x1DIroT5021718; Wed, 13 Feb 2019 10:53:50 -0800 From: Himanshu Madhani To: , CC: , Subject: [PATCH v2 08/12] qla2xxx: Add workqueue to delete fcport from bsg sp->free(). Date: Wed, 13 Feb 2019 10:53:20 -0800 Message-ID: <20190213185324.21652-9-hmadhani@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190213185324.21652-1-hmadhani@marvell.com> References: <20190213185324.21652-1-hmadhani@marvell.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131945576969950717;(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)(39860400002)(376002)(346002)(136003)(396003)(2980300002)(1109001)(1110001)(339900001)(199004)(189003)(85426001)(54906003)(48376002)(316002)(36906005)(42186006)(16586007)(110136005)(50466002)(51416003)(76176011)(80596001)(446003)(2616005)(126002)(486006)(11346002)(26005)(336012)(36756003)(69596002)(1076003)(97736004)(68736007)(476003)(6666004)(356004)(105606002)(305945005)(47776003)(4326008)(106466001)(14444005)(86362001)(8936002)(50226002)(2906002)(8676002)(81166006)(81156014)(53936002)(87636003)(26826003)(498600001);DIR:OUT;SFP:1101;SCL:1;SRVR:DM5PR07MB2905;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Fail;LANG:en;PTR:InfoDomainNonexistent;A:1;MX:1; X-Microsoft-Exchange-Diagnostics: 1;DM3NAM05FT004;1:nSLwOZAtoKYbkYSB01a6CEQ9riViHMEFnr87nCul2U0wlJDXb+LXVJ5EJMfhhSHZytnJAccpOHENuZqJs7IpzzjqZ/FD+b7FNe/9PdEWoz9iM5XLsV8/Ww9rffQBwKaRbel/pHnNNmOz6IVkxfV/iA== X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7e8583db-fce6-4e0a-24ca-08d691e4bf6c X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(5600110)(711020)(4605077)(2017052603328);SRVR:DM5PR07MB2905; X-MS-TrafficTypeDiagnostic: DM5PR07MB2905: X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 094700CA91 X-Microsoft-Exchange-Diagnostics: 1;DM5PR07MB2905;23:fQR5mtfc3FFxY0luTfYZY+zGEpowxs7drNr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p1wVh+gMCWcQXfXBYm6Y0hEWsff0cDMpkpt0+npMI6Wr2CGaAnLduhbHeVdgASvCiJo9AfmfnVqL2MTIoPe02AVVqWfi3MQfzu0qPRMBPPZ/1Bfsf+g== X-Microsoft-Antispam-Message-Info: 9Nq301G8yaL9Pl1czn7LAl+kZ57B6GhSS+4rnSbJyP6vWvY89zqJE7VkFY2XkcYm152DmymPIspW7k05auyrWbWM1CpMsCUqa/9cHMEFkabFwUkH1pnnnrlOhSZ9pP7xeHXMNK8ejz0Ij4vj8RbKycQWBfn1cabUJ6L5UIXWAZ0k8sNBCvsitIhz+Fy0d2aBm7MWTmglat7WiZuSmVV6Hy6j4cuR/o/2GE06A/gNH1zOmMx3N8nI5a/yXE0NQ7NNC3qO6z1wpjJeTRhYJ+vRw3HQ0pRyD+vMB5tM5e1021N4tsPWBxnfWOmsi1VCPzp5KhVgFkl5o/HGEMgFv0EDwVvmrB4io2FiOuXWVDwWgxTkMCdW/uSbrDwBuTjv60DBsVFxF9/4K6SguSu5cJe1UtsBJT7RbxjW8Hs3YghNHjo= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Feb 2019 18:54:56.6257 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7e8583db-fce6-4e0a-24ca-08d691e4bf6c 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: DM5PR07MB2905 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;