From patchwork Wed Feb 15 00:25:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 9573121 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 A84CC6045F for ; Wed, 15 Feb 2017 00:27:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9A56B205D6 for ; Wed, 15 Feb 2017 00:27:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8EE7028437; Wed, 15 Feb 2017 00:27:27 +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,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 1629D267EC for ; Wed, 15 Feb 2017 00:27:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751440AbdBOA10 (ORCPT ); Tue, 14 Feb 2017 19:27:26 -0500 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:36970 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751338AbdBOA1Z (ORCPT ); Tue, 14 Feb 2017 19:27:25 -0500 X-IronPort-AV: E=Sophos;i="5.35,163,1483977600"; d="scan'208";a="81774818" Received: from unknown (HELO milsmgep15.sandisk.com) ([63.163.107.21]) by ob1.hgst.iphmx.com with ESMTP; 15 Feb 2017 08:43:10 +0800 Received: from MILHUBIP03.sdcorp.global.sandisk.com (Unknown_Domain [10.201.67.162]) (using TLS with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by (Symantec Messaging Gateway) with SMTP id 86.E4.57638.A20A3A85; Tue, 14 Feb 2017 16:26:18 -0800 (PST) Received: from milsmgip11.sandisk.com (10.177.9.6) by MILHUBIP03.sdcorp.global.sandisk.com (10.177.9.96) with Microsoft SMTP Server id 14.3.319.2; Tue, 14 Feb 2017 16:26:15 -0800 X-AuditID: 0ac94369-26dee9800001e126-67-58a3a02aa4f5 Received: from exp-402881.sdcorp.global.sandisk.com ( [10.177.9.6]) by (Symantec Messaging Gateway) with SMTP id 48.7D.11415.720A3A85; Tue, 14 Feb 2017 16:26:15 -0800 (PST) From: Bart Van Assche To: "Nicholas A . Bellinger" CC: , Bart Van Assche , Himanshu Madhani , Quinn Tran Subject: [PATCH v6 04/33] tcm_qla2xxx: Move the code for freeing a TMF into tcm_qla2xxx.c Date: Tue, 14 Feb 2017 16:25:43 -0800 Message-ID: <20170215002612.14566-5-bart.vanassche@sandisk.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170215002612.14566-1-bart.vanassche@sandisk.com> References: <20170215002612.14566-1-bart.vanassche@sandisk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrALMWRmVeSWpSXmKPExsXCddJ5ka7WgsURBnOuqVhc2NPNaNG2+gyj xc/214wWrUvfMjmweMz4vYjF4/72I0wenzfJBTBHcdmkpOZklqUW6dslcGX0d3QwFhxSrPhx 5i1bA+NzmS5GDg4JAROJt9Msuhg5OYQEljJJTHzJ3sXIBWRvY5RYveIqO0gCpGb7l1lsEImN jBJP999iBkmwCRhJfHs/kwXEFgGyV/csYwIpYhZYwSjxqGUKI0hCWCBSYtHdm2A2i4CqxNF7 bWANvAL2Ett37GOC2CAvsavtIiuIzSngIDFjx0kWkOuEgGoenbEGmSkh8I9F4uyzX4wQvYIS J2c+AZvDLCAhcfDFC2aIF9QlTi6ZzzSBUWgWkrJZSMoWMDKtYhTLzcwpzk1PLTA01StOzEvJ LM7WS87P3cQICefMHYx3n3gfYhTgYFTi4T0huzhCiDWxrLgy9xCjBAezkggvWz1QiDclsbIq tSg/vqg0J7X4EKM0B4uSOO85makRQgLpiSWp2ampBalFMFkmDk6pBsb0i4rPXtvxG9vP2V1z 7/XSOVuXFW4OKVNUCkh+WHyo8cdp307h1zPeRE3tvzvdkM1hpZYVfyDvVNl7653d3y64beA9 5YfR29vN69O+XJ6+szjh64uA2y/Cn0Rw7jh5w8strTlnq5fe4YWJM+btY767Q/l+Q+PH3b+T V6pffyHKt4nrqCKf2oNZSizFGYmGWsxFxYkA7pkIB2MCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrIJMWRmVeSWpSXmKPExsXCtZGTTVd9weIIg4nruS0O/mxjtLiwp5vR om31GUaLn+2vGS1al75lcmD1mPF7EYvH/e1HmDymrTnP5PF5k1wASxSXTUpqTmZZapG+XQJX Rn9HB2PBIcWKH2fesjUwPpfpYuTkkBAwkdj+ZRZbFyMXh5DAekaJM3unsoEk2ASMJL69n8kC YosA2at7ljGBFDELrGCUWLfkDViRsECkxKK7NxlBbBYBVYmj99rAGngF7CU6Nlxmg9ggL7Gr 7SIriM0p4CAxY8dJoBoOoG32Eo/OWE9g5F7AyLCKUSw3M6c4Nz2zwNBQrzgxLyWzOFsvOT93 EyMkECJ3MD6daH6IkYmDU6qB0eXd3oVpvyfcU+Vxr50p4/P/r8bdCbfMrz5UqV/HurV+eWyb 1SZdBrbOsoadgSlbo5iV/dm2cVTK/33BOzf4fF5UXt57i7ndHF752V+nVrx3mmws0MjRPEGt kK8h/4Ca6xMuO2nWGVPuHVE4/X9+XIhNNE/tZ6Ugzewpr/8feSz070fE2+x/SizFGYmGWsxF xYkAxndK37QBAAA= MIME-Version: 1.0 Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Move the code for freeingn a TMF from qla_target.c into tcm_qla2xxx.c. This allows to remove the free_mcmd function pointer from struct qla_tgt_func_tmpl. Since tcm_qla2xxx_queue_tm_rsp() is called from thread context, call transport_generic_free_cmd() directly instead of queueing another work item. Signed-off-by: Bart Van Assche Cc: Himanshu Madhani Cc: Quinn Tran --- drivers/scsi/qla2xxx/qla_target.c | 10 ---------- drivers/scsi/qla2xxx/qla_target.h | 1 - drivers/scsi/qla2xxx/tcm_qla2xxx.c | 22 ++-------------------- 3 files changed, 2 insertions(+), 31 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 02d4aee5c422..5a3fd2c63512 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -2030,7 +2030,6 @@ void qlt_xmit_tm_rsp(struct qla_tgt_mgmt_cmd *mcmd) "RESET-TMR online/active/old-count/new-count = %d/%d/%d/%d.\n", vha->flags.online, qla2x00_reset_active(vha), mcmd->reset_count, ha->chip_reset); - ha->tgt.tgt_ops->free_mcmd(mcmd); spin_unlock_irqrestore(&ha->hardware_lock, flags); return; } @@ -2059,15 +2058,6 @@ void qlt_xmit_tm_rsp(struct qla_tgt_mgmt_cmd *mcmd) qlt_24xx_send_task_mgmt_ctio(vha, mcmd, mcmd->fc_tm_rsp); } - /* - * Make the callback for ->free_mcmd() to queue_work() and invoke - * target_put_sess_cmd() to drop cmd_kref to 1. The final - * target_put_sess_cmd() call will be made from TFO->check_stop_free() - * -> tcm_qla2xxx_check_stop_free() to release the TMR associated se_cmd - * descriptor after TFO->queue_tm_rsp() -> tcm_qla2xxx_queue_tm_rsp() -> - * qlt_xmit_tm_rsp() returns here.. - */ - ha->tgt.tgt_ops->free_mcmd(mcmd); spin_unlock_irqrestore(&ha->hardware_lock, flags); } EXPORT_SYMBOL(qlt_xmit_tm_rsp); diff --git a/drivers/scsi/qla2xxx/qla_target.h b/drivers/scsi/qla2xxx/qla_target.h index 6aab4b4d5eee..edf548621cb2 100644 --- a/drivers/scsi/qla2xxx/qla_target.h +++ b/drivers/scsi/qla2xxx/qla_target.h @@ -671,7 +671,6 @@ struct qla_tgt_func_tmpl { int (*handle_tmr)(struct qla_tgt_mgmt_cmd *, uint32_t, uint16_t, uint32_t); void (*free_cmd)(struct qla_tgt_cmd *); - void (*free_mcmd)(struct qla_tgt_mgmt_cmd *); void (*free_session)(struct fc_port *); int (*check_initiator_node_acl)(struct scsi_qla_host *, unsigned char *, diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c index 752a17dbeb47..061ba85a2168 100644 --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c @@ -257,25 +257,6 @@ static u32 tcm_qla2xxx_tpg_get_inst_index(struct se_portal_group *se_tpg) return tpg->lport_tpgt; } -static void tcm_qla2xxx_complete_mcmd(struct work_struct *work) -{ - struct qla_tgt_mgmt_cmd *mcmd = container_of(work, - struct qla_tgt_mgmt_cmd, free_work); - - transport_generic_free_cmd(&mcmd->se_cmd, 0); -} - -/* - * Called from qla_target_template->free_mcmd(), and will call - * tcm_qla2xxx_release_cmd() via normal struct target_core_fabric_ops - * release callback. qla_hw_data->hardware_lock is expected to be held - */ -static void tcm_qla2xxx_free_mcmd(struct qla_tgt_mgmt_cmd *mcmd) -{ - INIT_WORK(&mcmd->free_work, tcm_qla2xxx_complete_mcmd); - queue_work(tcm_qla2xxx_free_wq, &mcmd->free_work); -} - static void tcm_qla2xxx_complete_free(struct work_struct *work) { struct qla_tgt_cmd *cmd = container_of(work, struct qla_tgt_cmd, work); @@ -716,6 +697,8 @@ static void tcm_qla2xxx_queue_tm_rsp(struct se_cmd *se_cmd) * CTIO response packet. */ qlt_xmit_tm_rsp(mcmd); + + transport_generic_free_cmd(&mcmd->se_cmd, 0); } static void tcm_qla2xxx_aborted_task(struct se_cmd *se_cmd) @@ -1573,7 +1556,6 @@ static struct qla_tgt_func_tmpl tcm_qla2xxx_template = { .handle_dif_err = tcm_qla2xxx_handle_dif_err, .handle_tmr = tcm_qla2xxx_handle_tmr, .free_cmd = tcm_qla2xxx_free_cmd, - .free_mcmd = tcm_qla2xxx_free_mcmd, .free_session = tcm_qla2xxx_free_session, .update_sess = tcm_qla2xxx_update_sess, .check_initiator_node_acl = tcm_qla2xxx_check_initiator_node_acl,