From patchwork Tue Mar 7 08:07:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Bogdanov X-Patchwork-Id: 660391 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2BC73C6FD1E for ; Tue, 7 Mar 2023 08:08:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229975AbjCGIId (ORCPT ); Tue, 7 Mar 2023 03:08:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229925AbjCGII2 (ORCPT ); Tue, 7 Mar 2023 03:08:28 -0500 Received: from mta-01.yadro.com (mta-02.yadro.com [89.207.88.252]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC30C7283; Tue, 7 Mar 2023 00:07:55 -0800 (PST) Received: from mta-01.yadro.com (localhost.localdomain [127.0.0.1]) by mta-01.yadro.com (Proxmox) with ESMTP id AF2F4341EB0; Tue, 7 Mar 2023 11:07:50 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yadro.com; h=cc :cc:content-transfer-encoding:content-type:content-type:date :from:from:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=mta-01; bh=d5NpFgk/odjS1rUJmA 7AcC2xftoy2oCWQyNfpUpzt4M=; b=pcho8Tn2fArdb5wY/VMACiMUP+5trYHe/+ DjF1zZXnZxolzoKjfiE3E0o0ur8kbiJAmPB0/4yQvQlcRUduF4Tz0zOtq/Z9eC4P 0v+xsvziP6OcIBwyV9QsVpsUBr6gpYwxqC3da79yguBcAq/Di5PDfqgAYwC9iqR1 0QpJrwRqE= Received: from T-EXCH-08.corp.yadro.com (unknown [172.17.10.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Proxmox) with ESMTPS id A45BB341E00; Tue, 7 Mar 2023 11:07:50 +0300 (MSK) Received: from NB-591.corp.yadro.com (10.199.20.11) by T-EXCH-08.corp.yadro.com (172.17.11.58) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.1118.9; Tue, 7 Mar 2023 11:07:50 +0300 From: Dmitry Bogdanov To: Martin Petersen , CC: Bart Van Assche , Jason Gunthorpe , Leon Romanovsky , James Smart , Ram Vegesna , Michael Cyr , Nilesh Javali , , Chris Boot , Greg Kroah-Hartman , "Michael S . Tsirkin" , Jason Wang , Juergen Gross , , , Dmitry Bogdanov Subject: [PATCH v2 01/12] scsi: target: add default fabric ops callaouts Date: Tue, 7 Mar 2023 11:07:31 +0300 Message-ID: <20230307080742.24631-2-d.bogdanov@yadro.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230307080742.24631-1-d.bogdanov@yadro.com> References: <20230307080742.24631-1-d.bogdanov@yadro.com> MIME-Version: 1.0 X-Originating-IP: [10.199.20.11] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-08.corp.yadro.com (172.17.11.58) Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org There are several callout in target fabric ops that most of fabric drivers fills with a function returning the same value. Stop requiring such callaouts to exist in the ops, fill them in TCM Core. Signed-off-by: Dmitry Bogdanov --- drivers/target/target_core_configfs.c | 94 +++++++++++++++++---------- 1 file changed, 61 insertions(+), 33 deletions(-) diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c index 611b0424e305..74b67c346dfe 100644 --- a/drivers/target/target_core_configfs.c +++ b/drivers/target/target_core_configfs.c @@ -335,6 +335,29 @@ EXPORT_SYMBOL(target_undepend_item); /*############################################################################## // Start functions called by external Target Fabrics Modules //############################################################################*/ +static int target_disable_feature(struct se_portal_group *se_tpg) +{ + return 0; +} + +static u32 target_default_get_inst_index(struct se_portal_group *se_tpg) +{ + return 1; +} + +static u32 target_default_sess_get_index(struct se_session *se_sess) +{ + return 0; +} + +static void target_set_default_node_attributes(struct se_node_acl *se_acl) +{ +} + +static int target_default_get_cmd_state(struct se_cmd *se_cmd) +{ + return 0; +} static int target_fabric_tf_ops_check(const struct target_core_fabric_ops *tfo) { @@ -362,46 +385,14 @@ static int target_fabric_tf_ops_check(const struct target_core_fabric_ops *tfo) pr_err("Missing tfo->tpg_get_tag()\n"); return -EINVAL; } - if (!tfo->tpg_check_demo_mode) { - pr_err("Missing tfo->tpg_check_demo_mode()\n"); - return -EINVAL; - } - if (!tfo->tpg_check_demo_mode_cache) { - pr_err("Missing tfo->tpg_check_demo_mode_cache()\n"); - return -EINVAL; - } - if (!tfo->tpg_check_demo_mode_write_protect) { - pr_err("Missing tfo->tpg_check_demo_mode_write_protect()\n"); - return -EINVAL; - } - if (!tfo->tpg_check_prod_mode_write_protect) { - pr_err("Missing tfo->tpg_check_prod_mode_write_protect()\n"); - return -EINVAL; - } - if (!tfo->tpg_get_inst_index) { - pr_err("Missing tfo->tpg_get_inst_index()\n"); - return -EINVAL; - } if (!tfo->release_cmd) { pr_err("Missing tfo->release_cmd()\n"); return -EINVAL; } - if (!tfo->sess_get_index) { - pr_err("Missing tfo->sess_get_index()\n"); - return -EINVAL; - } if (!tfo->write_pending) { pr_err("Missing tfo->write_pending()\n"); return -EINVAL; } - if (!tfo->set_default_node_attributes) { - pr_err("Missing tfo->set_default_node_attributes()\n"); - return -EINVAL; - } - if (!tfo->get_cmd_state) { - pr_err("Missing tfo->get_cmd_state()\n"); - return -EINVAL; - } if (!tfo->queue_data_in) { pr_err("Missing tfo->queue_data_in()\n"); return -EINVAL; @@ -447,8 +438,36 @@ static int target_fabric_tf_ops_check(const struct target_core_fabric_ops *tfo) return 0; } +static void target_set_default_ops(struct target_core_fabric_ops *tfo) +{ + if (!tfo->tpg_check_demo_mode) + tfo->tpg_check_demo_mode = target_disable_feature; + + if (!tfo->tpg_check_demo_mode_cache) + tfo->tpg_check_demo_mode_cache = target_disable_feature; + + if (!tfo->tpg_check_demo_mode_write_protect) + tfo->tpg_check_demo_mode_write_protect = target_disable_feature; + + if (!tfo->tpg_check_prod_mode_write_protect) + tfo->tpg_check_prod_mode_write_protect = target_disable_feature; + + if (!tfo->tpg_get_inst_index) + tfo->tpg_get_inst_index = target_default_get_inst_index; + + if (!tfo->sess_get_index) + tfo->sess_get_index = target_default_sess_get_index; + + if (!tfo->set_default_node_attributes) + tfo->set_default_node_attributes = target_set_default_node_attributes; + + if (!tfo->get_cmd_state) + tfo->get_cmd_state = target_default_get_cmd_state; +} + int target_register_template(const struct target_core_fabric_ops *fo) { + struct target_core_fabric_ops *tfo; struct target_fabric_configfs *tf; int ret; @@ -461,10 +480,18 @@ int target_register_template(const struct target_core_fabric_ops *fo) pr_err("%s: could not allocate memory!\n", __func__); return -ENOMEM; } + tfo = kzalloc(sizeof(struct target_core_fabric_ops), GFP_KERNEL); + if (!tfo) { + kfree(tf); + pr_err("%s: could not allocate memory!\n", __func__); + return -ENOMEM; + } + memcpy(tfo, fo, sizeof(*tfo)); + target_set_default_ops(tfo); INIT_LIST_HEAD(&tf->tf_list); atomic_set(&tf->tf_access_cnt, 0); - tf->tf_ops = fo; + tf->tf_ops = tfo; target_fabric_setup_cits(tf); mutex_lock(&g_tf_lock); @@ -492,6 +519,7 @@ void target_unregister_template(const struct target_core_fabric_ops *fo) */ rcu_barrier(); kfree(t->tf_tpg_base_cit.ct_attrs); + kfree(t->tf_ops); kfree(t); return; } From patchwork Tue Mar 7 08:07:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Bogdanov X-Patchwork-Id: 660975 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29CCBC678D4 for ; Tue, 7 Mar 2023 08:08:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229986AbjCGIIf (ORCPT ); Tue, 7 Mar 2023 03:08:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229933AbjCGIIa (ORCPT ); Tue, 7 Mar 2023 03:08:30 -0500 Received: from mta-01.yadro.com (mta-02.yadro.com [89.207.88.252]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 880ED23DB5; Tue, 7 Mar 2023 00:08:02 -0800 (PST) Received: from mta-01.yadro.com (localhost.localdomain [127.0.0.1]) by mta-01.yadro.com (Proxmox) with ESMTP id 2A94D341EB5; Tue, 7 Mar 2023 11:07:51 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yadro.com; h=cc :cc:content-transfer-encoding:content-type:content-type:date :from:from:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=mta-01; bh=t6YmvwSRe7WGVlVA6i xDRMSG7+0Bihd9czouuiOCJH0=; b=Lmx8uVmvsCESJi+3lQ/V+08BTTLd1FlR0/ 41Rmc/XAKEWXXH7CaUH4S/5Qk+pvtlCYUKYk9YWpSR6FllWnUR5FOhtcPVRYHxc3 fN+7zR6twU4MPMuyXdH8zLKLw8rclPUrQcgY9ALjOaEXPG7or5A+5ykegfKMiA4t usqb4IXkg= Received: from T-EXCH-08.corp.yadro.com (unknown [172.17.10.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Proxmox) with ESMTPS id 1F494341E00; Tue, 7 Mar 2023 11:07:51 +0300 (MSK) Received: from NB-591.corp.yadro.com (10.199.20.11) by T-EXCH-08.corp.yadro.com (172.17.11.58) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.1118.9; Tue, 7 Mar 2023 11:07:50 +0300 From: Dmitry Bogdanov To: Martin Petersen , CC: Bart Van Assche , Jason Gunthorpe , Leon Romanovsky , James Smart , Ram Vegesna , Michael Cyr , Nilesh Javali , , Chris Boot , Greg Kroah-Hartman , "Michael S . Tsirkin" , Jason Wang , Juergen Gross , , , Dmitry Bogdanov Subject: [PATCH v2 02/12] infiniband: srpt: remove default fabric ops callouts Date: Tue, 7 Mar 2023 11:07:32 +0300 Message-ID: <20230307080742.24631-3-d.bogdanov@yadro.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230307080742.24631-1-d.bogdanov@yadro.com> References: <20230307080742.24631-1-d.bogdanov@yadro.com> MIME-Version: 1.0 X-Originating-IP: [10.199.20.11] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-08.corp.yadro.com (172.17.11.58) Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Remove callouts that have the implementation like a default implementation in TCM Core. Signed-off-by: Dmitry Bogdanov --- drivers/infiniband/ulp/srpt/ib_srpt.c | 33 --------------------------- 1 file changed, 33 deletions(-) diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index 3c3fae738c3e..3e9343fd2d8e 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -3300,11 +3300,6 @@ static int srpt_check_true(struct se_portal_group *se_tpg) return 1; } -static int srpt_check_false(struct se_portal_group *se_tpg) -{ - return 0; -} - static struct srpt_port *srpt_tpg_to_sport(struct se_portal_group *tpg) { return tpg->se_tpg_wwn->priv; @@ -3334,11 +3329,6 @@ static u16 srpt_get_tag(struct se_portal_group *tpg) return 1; } -static u32 srpt_tpg_get_inst_index(struct se_portal_group *se_tpg) -{ - return 1; -} - static void srpt_release_cmd(struct se_cmd *se_cmd) { struct srpt_send_ioctx *ioctx = container_of(se_cmd, @@ -3378,24 +3368,6 @@ static void srpt_close_session(struct se_session *se_sess) srpt_disconnect_ch_sync(ch); } -/** - * srpt_sess_get_index - return the value of scsiAttIntrPortIndex (SCSI-MIB) - * @se_sess: SCSI target session. - * - * A quote from RFC 4455 (SCSI-MIB) about this MIB object: - * This object represents an arbitrary integer used to uniquely identify a - * particular attached remote initiator port to a particular SCSI target port - * within a particular SCSI target device within a particular SCSI instance. - */ -static u32 srpt_sess_get_index(struct se_session *se_sess) -{ - return 0; -} - -static void srpt_set_default_node_attrs(struct se_node_acl *nacl) -{ -} - /* Note: only used from inside debug printk's by the TCM core. */ static int srpt_get_tcm_cmd_state(struct se_cmd *se_cmd) { @@ -3866,18 +3838,13 @@ static const struct target_core_fabric_ops srpt_template = { .fabric_name = "srpt", .tpg_get_wwn = srpt_get_fabric_wwn, .tpg_get_tag = srpt_get_tag, - .tpg_check_demo_mode = srpt_check_false, .tpg_check_demo_mode_cache = srpt_check_true, .tpg_check_demo_mode_write_protect = srpt_check_true, - .tpg_check_prod_mode_write_protect = srpt_check_false, - .tpg_get_inst_index = srpt_tpg_get_inst_index, .release_cmd = srpt_release_cmd, .check_stop_free = srpt_check_stop_free, .close_session = srpt_close_session, - .sess_get_index = srpt_sess_get_index, .sess_get_initiator_sid = NULL, .write_pending = srpt_write_pending, - .set_default_node_attributes = srpt_set_default_node_attrs, .get_cmd_state = srpt_get_tcm_cmd_state, .queue_data_in = srpt_queue_data_in, .queue_status = srpt_queue_status, From patchwork Tue Mar 7 08:07:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Bogdanov X-Patchwork-Id: 660390 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 579EEC678DB for ; Tue, 7 Mar 2023 08:08:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230028AbjCGIIx (ORCPT ); Tue, 7 Mar 2023 03:08:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229972AbjCGIIc (ORCPT ); Tue, 7 Mar 2023 03:08:32 -0500 Received: from mta-01.yadro.com (mta-02.yadro.com [89.207.88.252]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C1BB2CFEA; Tue, 7 Mar 2023 00:08:07 -0800 (PST) Received: from mta-01.yadro.com (localhost.localdomain [127.0.0.1]) by mta-01.yadro.com (Proxmox) with ESMTP id CAF30341EB6; Tue, 7 Mar 2023 11:07:51 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yadro.com; h=cc :cc:content-transfer-encoding:content-type:content-type:date :from:from:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=mta-01; bh=y3vb4pAUffWzuoh9I2 ChX6phjhxw2mBq3/VY5m3Oavw=; b=ivBVESAvgR7ShEtkPM/7xZePJHq8qZNh8s 6zUEUHkBSPYAq0lQDSD3r0pVCDS9C5wydcB3ue4YEuk3eiIYnkaSfhZmdJRAZn97 KrPI0PBAjBP730jLJ/snMll7TPgXY65OGyCoeNbxX3e1PtVED+HifHBTwHPLQjSw InxnaOqSg= Received: from T-EXCH-08.corp.yadro.com (unknown [172.17.10.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Proxmox) with ESMTPS id C20C0341E00; Tue, 7 Mar 2023 11:07:51 +0300 (MSK) Received: from NB-591.corp.yadro.com (10.199.20.11) by T-EXCH-08.corp.yadro.com (172.17.11.58) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.1118.9; Tue, 7 Mar 2023 11:07:51 +0300 From: Dmitry Bogdanov To: Martin Petersen , CC: Bart Van Assche , Jason Gunthorpe , Leon Romanovsky , James Smart , Ram Vegesna , Michael Cyr , Nilesh Javali , , Chris Boot , Greg Kroah-Hartman , "Michael S . Tsirkin" , Jason Wang , Juergen Gross , , , Dmitry Bogdanov Subject: [PATCH v2 03/12] scsi: ibmvscsit: remove default fabric ops callouts Date: Tue, 7 Mar 2023 11:07:33 +0300 Message-ID: <20230307080742.24631-4-d.bogdanov@yadro.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230307080742.24631-1-d.bogdanov@yadro.com> References: <20230307080742.24631-1-d.bogdanov@yadro.com> MIME-Version: 1.0 X-Originating-IP: [10.199.20.11] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-08.corp.yadro.com (172.17.11.58) Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Remove callouts that have the implementation like a default implementation in TCM Core. Signed-off-by: Dmitry Bogdanov --- drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | 30 ------------------------ 1 file changed, 30 deletions(-) diff --git a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c index e8770310a64b..385f812b8793 100644 --- a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c +++ b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c @@ -3698,16 +3698,6 @@ static int ibmvscsis_check_true(struct se_portal_group *se_tpg) return 1; } -static int ibmvscsis_check_false(struct se_portal_group *se_tpg) -{ - return 0; -} - -static u32 ibmvscsis_tpg_get_inst_index(struct se_portal_group *se_tpg) -{ - return 1; -} - static int ibmvscsis_check_stop_free(struct se_cmd *se_cmd) { return target_put_sess_cmd(se_cmd); @@ -3726,11 +3716,6 @@ static void ibmvscsis_release_cmd(struct se_cmd *se_cmd) spin_unlock_bh(&vscsi->intr_lock); } -static u32 ibmvscsis_sess_get_index(struct se_session *se_sess) -{ - return 0; -} - static int ibmvscsis_write_pending(struct se_cmd *se_cmd) { struct ibmvscsis_cmd *cmd = container_of(se_cmd, struct ibmvscsis_cmd, @@ -3765,15 +3750,6 @@ static int ibmvscsis_write_pending(struct se_cmd *se_cmd) return 0; } -static void ibmvscsis_set_default_node_attrs(struct se_node_acl *nacl) -{ -} - -static int ibmvscsis_get_cmd_state(struct se_cmd *se_cmd) -{ - return 0; -} - static int ibmvscsis_queue_data_in(struct se_cmd *se_cmd) { struct ibmvscsis_cmd *cmd = container_of(se_cmd, struct ibmvscsis_cmd, @@ -3982,15 +3958,9 @@ static const struct target_core_fabric_ops ibmvscsis_ops = { .tpg_get_default_depth = ibmvscsis_get_default_depth, .tpg_check_demo_mode = ibmvscsis_check_true, .tpg_check_demo_mode_cache = ibmvscsis_check_true, - .tpg_check_demo_mode_write_protect = ibmvscsis_check_false, - .tpg_check_prod_mode_write_protect = ibmvscsis_check_false, - .tpg_get_inst_index = ibmvscsis_tpg_get_inst_index, .check_stop_free = ibmvscsis_check_stop_free, .release_cmd = ibmvscsis_release_cmd, - .sess_get_index = ibmvscsis_sess_get_index, .write_pending = ibmvscsis_write_pending, - .set_default_node_attributes = ibmvscsis_set_default_node_attrs, - .get_cmd_state = ibmvscsis_get_cmd_state, .queue_data_in = ibmvscsis_queue_data_in, .queue_status = ibmvscsis_queue_status, .queue_tm_rsp = ibmvscsis_queue_tm_rsp, From patchwork Tue Mar 7 08:07:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Bogdanov X-Patchwork-Id: 660974 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E4A27C678DB for ; Tue, 7 Mar 2023 08:08:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230039AbjCGII4 (ORCPT ); Tue, 7 Mar 2023 03:08:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229990AbjCGIIg (ORCPT ); Tue, 7 Mar 2023 03:08:36 -0500 Received: from mta-01.yadro.com (mta-02.yadro.com [89.207.88.252]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A91C125970; Tue, 7 Mar 2023 00:08:10 -0800 (PST) Received: from mta-01.yadro.com (localhost.localdomain [127.0.0.1]) by mta-01.yadro.com (Proxmox) with ESMTP id 75D54341EB8; Tue, 7 Mar 2023 11:07:52 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yadro.com; h=cc :cc:content-transfer-encoding:content-type:content-type:date :from:from:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=mta-01; bh=3eAU+aIyF6YkjbljD8 h+LIF0eqC0rHsc6DFVHsIfcxk=; b=gPe10e8w7MK0LAPkhutsuZ+hZDsqGc4pw8 wecCfgyNCpwUcCSnozBynwYvRFg9fLHgbArhjMYC6ehpkCeARwh27YBhmBHJnRZj c+XW4cADtFNBDHPlNZwPE7mGr/5uSc9R7SaEY/dzyIQf5B2iL1EDukQM45nFjlh8 JmC+gTJ6Q= Received: from T-EXCH-08.corp.yadro.com (unknown [172.17.10.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Proxmox) with ESMTPS id 6BB58341E00; Tue, 7 Mar 2023 11:07:52 +0300 (MSK) Received: from NB-591.corp.yadro.com (10.199.20.11) by T-EXCH-08.corp.yadro.com (172.17.11.58) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.1118.9; Tue, 7 Mar 2023 11:07:51 +0300 From: Dmitry Bogdanov To: Martin Petersen , CC: Bart Van Assche , Jason Gunthorpe , Leon Romanovsky , James Smart , Ram Vegesna , Michael Cyr , Nilesh Javali , , Chris Boot , Greg Kroah-Hartman , "Michael S . Tsirkin" , Jason Wang , Juergen Gross , , , Dmitry Bogdanov Subject: [PATCH v2 04/12] scsi: target: loop: remove default fabric ops callouts Date: Tue, 7 Mar 2023 11:07:34 +0300 Message-ID: <20230307080742.24631-5-d.bogdanov@yadro.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230307080742.24631-1-d.bogdanov@yadro.com> References: <20230307080742.24631-1-d.bogdanov@yadro.com> MIME-Version: 1.0 X-Originating-IP: [10.199.20.11] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-08.corp.yadro.com (172.17.11.58) Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Remove callouts that have the implementation like a default implementation in TCM Core. Signed-off-by: Dmitry Bogdanov --- drivers/target/loopback/tcm_loop.c | 41 ------------------------------ 1 file changed, 41 deletions(-) diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c index 139031ccb700..5c8646c2d4e9 100644 --- a/drivers/target/loopback/tcm_loop.c +++ b/drivers/target/loopback/tcm_loop.c @@ -480,30 +480,6 @@ static int tcm_loop_check_demo_mode(struct se_portal_group *se_tpg) return 1; } -static int tcm_loop_check_demo_mode_cache(struct se_portal_group *se_tpg) -{ - return 0; -} - -/* - * Allow I_T Nexus full READ-WRITE access without explict Initiator Node ACLs for - * local virtual Linux/SCSI LLD passthrough into VM hypervisor guest - */ -static int tcm_loop_check_demo_mode_write_protect(struct se_portal_group *se_tpg) -{ - return 0; -} - -/* - * Because TCM_Loop does not use explict ACLs and MappedLUNs, this will - * never be called for TCM_Loop by target_core_fabric_configfs.c code. - * It has been added here as a nop for target_fabric_tf_ops_check() - */ -static int tcm_loop_check_prod_mode_write_protect(struct se_portal_group *se_tpg) -{ - return 0; -} - static int tcm_loop_check_prot_fabric_only(struct se_portal_group *se_tpg) { struct tcm_loop_tpg *tl_tpg = container_of(se_tpg, struct tcm_loop_tpg, @@ -511,21 +487,11 @@ static int tcm_loop_check_prot_fabric_only(struct se_portal_group *se_tpg) return tl_tpg->tl_fabric_prot_type; } -static u32 tcm_loop_get_inst_index(struct se_portal_group *se_tpg) -{ - return 1; -} - static u32 tcm_loop_sess_get_index(struct se_session *se_sess) { return 1; } -static void tcm_loop_set_default_node_attributes(struct se_node_acl *se_acl) -{ - return; -} - static int tcm_loop_get_cmd_state(struct se_cmd *se_cmd) { struct tcm_loop_cmd *tl_cmd = container_of(se_cmd, @@ -1124,18 +1090,11 @@ static const struct target_core_fabric_ops loop_ops = { .tpg_get_wwn = tcm_loop_get_endpoint_wwn, .tpg_get_tag = tcm_loop_get_tag, .tpg_check_demo_mode = tcm_loop_check_demo_mode, - .tpg_check_demo_mode_cache = tcm_loop_check_demo_mode_cache, - .tpg_check_demo_mode_write_protect = - tcm_loop_check_demo_mode_write_protect, - .tpg_check_prod_mode_write_protect = - tcm_loop_check_prod_mode_write_protect, .tpg_check_prot_fabric_only = tcm_loop_check_prot_fabric_only, - .tpg_get_inst_index = tcm_loop_get_inst_index, .check_stop_free = tcm_loop_check_stop_free, .release_cmd = tcm_loop_release_cmd, .sess_get_index = tcm_loop_sess_get_index, .write_pending = tcm_loop_write_pending, - .set_default_node_attributes = tcm_loop_set_default_node_attributes, .get_cmd_state = tcm_loop_get_cmd_state, .queue_data_in = tcm_loop_queue_data_in, .queue_status = tcm_loop_queue_status, From patchwork Tue Mar 7 08:07:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Bogdanov X-Patchwork-Id: 660389 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5DF45C678DB for ; Tue, 7 Mar 2023 08:09:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229907AbjCGIJw (ORCPT ); Tue, 7 Mar 2023 03:09:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229978AbjCGIJj (ORCPT ); Tue, 7 Mar 2023 03:09:39 -0500 Received: from mta-01.yadro.com (mta-02.yadro.com [89.207.88.252]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87CC65099B; Tue, 7 Mar 2023 00:09:05 -0800 (PST) Received: from mta-01.yadro.com (localhost.localdomain [127.0.0.1]) by mta-01.yadro.com (Proxmox) with ESMTP id 0D483341EBB; Tue, 7 Mar 2023 11:07:53 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yadro.com; h=cc :cc:content-transfer-encoding:content-type:content-type:date :from:from:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=mta-01; bh=2W+4LtZZa24FHSOs4t 4NaHZOeSWzlTVXaQitGnl4kns=; b=SoQWUivkFEuXHPFaZNO/xLYyX9g9DS1TrL 5jWJay60hLGrhoxokAvtUtsQfXKxANZeEIs0hVMpYlC1CHzTrSwEI43qEjWWEaTl 1S3bLgL/zOfl+r2MiKMqG2CKPuue37ImvumChadJkzZToBjZVOtiF23AMmoGBc+e UJUTU3QuI= Received: from T-EXCH-08.corp.yadro.com (unknown [172.17.10.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Proxmox) with ESMTPS id 02336341E00; Tue, 7 Mar 2023 11:07:53 +0300 (MSK) Received: from NB-591.corp.yadro.com (10.199.20.11) by T-EXCH-08.corp.yadro.com (172.17.11.58) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.1118.9; Tue, 7 Mar 2023 11:07:52 +0300 From: Dmitry Bogdanov To: Martin Petersen , CC: Bart Van Assche , Jason Gunthorpe , Leon Romanovsky , James Smart , Ram Vegesna , Michael Cyr , Nilesh Javali , , Chris Boot , Greg Kroah-Hartman , "Michael S . Tsirkin" , Jason Wang , Juergen Gross , , , Dmitry Bogdanov Subject: [PATCH v2 05/12] scsi: target: sbp: remove default fabric ops callouts Date: Tue, 7 Mar 2023 11:07:35 +0300 Message-ID: <20230307080742.24631-6-d.bogdanov@yadro.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230307080742.24631-1-d.bogdanov@yadro.com> References: <20230307080742.24631-1-d.bogdanov@yadro.com> MIME-Version: 1.0 X-Originating-IP: [10.199.20.11] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-08.corp.yadro.com (172.17.11.58) Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Remove callouts that have the implementation like a default implementation in TCM Core. Signed-off-by: Dmitry Bogdanov --- drivers/target/sbp/sbp_target.c | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/drivers/target/sbp/sbp_target.c b/drivers/target/sbp/sbp_target.c index 504670994fb4..2a761bc09193 100644 --- a/drivers/target/sbp/sbp_target.c +++ b/drivers/target/sbp/sbp_target.c @@ -1673,11 +1673,6 @@ static int sbp_check_true(struct se_portal_group *se_tpg) return 1; } -static int sbp_check_false(struct se_portal_group *se_tpg) -{ - return 0; -} - static char *sbp_get_fabric_wwn(struct se_portal_group *se_tpg) { struct sbp_tpg *tpg = container_of(se_tpg, struct sbp_tpg, se_tpg); @@ -1692,11 +1687,6 @@ static u16 sbp_get_tag(struct se_portal_group *se_tpg) return tpg->tport_tpgt; } -static u32 sbp_tpg_get_inst_index(struct se_portal_group *se_tpg) -{ - return 1; -} - static void sbp_release_cmd(struct se_cmd *se_cmd) { struct sbp_target_request *req = container_of(se_cmd, @@ -1705,11 +1695,6 @@ static void sbp_release_cmd(struct se_cmd *se_cmd) sbp_free_request(req); } -static u32 sbp_sess_get_index(struct se_session *se_sess) -{ - return 0; -} - static int sbp_write_pending(struct se_cmd *se_cmd) { struct sbp_target_request *req = container_of(se_cmd, @@ -1733,16 +1718,6 @@ static int sbp_write_pending(struct se_cmd *se_cmd) return 0; } -static void sbp_set_default_node_attrs(struct se_node_acl *nacl) -{ - return; -} - -static int sbp_get_cmd_state(struct se_cmd *se_cmd) -{ - return 0; -} - static int sbp_queue_data_in(struct se_cmd *se_cmd) { struct sbp_target_request *req = container_of(se_cmd, @@ -2281,14 +2256,8 @@ static const struct target_core_fabric_ops sbp_ops = { .tpg_get_tag = sbp_get_tag, .tpg_check_demo_mode = sbp_check_true, .tpg_check_demo_mode_cache = sbp_check_true, - .tpg_check_demo_mode_write_protect = sbp_check_false, - .tpg_check_prod_mode_write_protect = sbp_check_false, - .tpg_get_inst_index = sbp_tpg_get_inst_index, .release_cmd = sbp_release_cmd, - .sess_get_index = sbp_sess_get_index, .write_pending = sbp_write_pending, - .set_default_node_attributes = sbp_set_default_node_attrs, - .get_cmd_state = sbp_get_cmd_state, .queue_data_in = sbp_queue_data_in, .queue_status = sbp_queue_status, .queue_tm_rsp = sbp_queue_tm_rsp, From patchwork Tue Mar 7 08:07:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Bogdanov X-Patchwork-Id: 660973 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D05B0C6FD1B for ; Tue, 7 Mar 2023 08:09:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229958AbjCGIJx (ORCPT ); Tue, 7 Mar 2023 03:09:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229981AbjCGIJj (ORCPT ); Tue, 7 Mar 2023 03:09:39 -0500 Received: from mta-01.yadro.com (mta-02.yadro.com [89.207.88.252]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8373850998; Tue, 7 Mar 2023 00:09:05 -0800 (PST) Received: from mta-01.yadro.com (localhost.localdomain [127.0.0.1]) by mta-01.yadro.com (Proxmox) with ESMTP id D49B1341EC3; Tue, 7 Mar 2023 11:07:53 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yadro.com; h=cc :cc:content-transfer-encoding:content-type:content-type:date :from:from:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=mta-01; bh=/0Z65Te9YumeUEZKFZ KB9uaJskGVpt2BXfshxvgV7Ro=; b=RmwW4gvOMkK2mHqTOHC2JbRX8nlXAO05R/ 3/ivlOSwsBVITAlNw7qer1K3ErChCZSS/0HUt12jWktlqQy1ad6YZkCw2l3tfsax yI1MHKrUhPF1jxdr+iSzsKDSXujux3ZPavvcFMntVXcaPG5EhqUfyfDh5dlJic5H /eSaQpv1A= Received: from T-EXCH-08.corp.yadro.com (unknown [172.17.10.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Proxmox) with ESMTPS id CBB81341E00; Tue, 7 Mar 2023 11:07:53 +0300 (MSK) Received: from NB-591.corp.yadro.com (10.199.20.11) by T-EXCH-08.corp.yadro.com (172.17.11.58) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.1118.9; Tue, 7 Mar 2023 11:07:52 +0300 From: Dmitry Bogdanov To: Martin Petersen , CC: Bart Van Assche , Jason Gunthorpe , Leon Romanovsky , James Smart , Ram Vegesna , Michael Cyr , Nilesh Javali , , Chris Boot , Greg Kroah-Hartman , "Michael S . Tsirkin" , Jason Wang , Juergen Gross , , , Dmitry Bogdanov Subject: [PATCH v2 06/12] scsi: target: fcoe: remove default fabric ops callouts Date: Tue, 7 Mar 2023 11:07:36 +0300 Message-ID: <20230307080742.24631-7-d.bogdanov@yadro.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230307080742.24631-1-d.bogdanov@yadro.com> References: <20230307080742.24631-1-d.bogdanov@yadro.com> MIME-Version: 1.0 X-Originating-IP: [10.199.20.11] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-08.corp.yadro.com (172.17.11.58) Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Remove callouts that have the implementation like a default implementation in TCM Core. Signed-off-by: Dmitry Bogdanov --- drivers/target/tcm_fc/tcm_fc.h | 1 - drivers/target/tcm_fc/tfc_cmd.c | 5 ----- drivers/target/tcm_fc/tfc_conf.c | 15 --------------- 3 files changed, 21 deletions(-) diff --git a/drivers/target/tcm_fc/tcm_fc.h b/drivers/target/tcm_fc/tcm_fc.h index 2ff716d8cbdd..00e5573c6296 100644 --- a/drivers/target/tcm_fc/tcm_fc.h +++ b/drivers/target/tcm_fc/tcm_fc.h @@ -146,7 +146,6 @@ void ft_release_cmd(struct se_cmd *); int ft_queue_status(struct se_cmd *); int ft_queue_data_in(struct se_cmd *); int ft_write_pending(struct se_cmd *); -int ft_get_cmd_state(struct se_cmd *); void ft_queue_tm_resp(struct se_cmd *); void ft_aborted_task(struct se_cmd *); diff --git a/drivers/target/tcm_fc/tfc_cmd.c b/drivers/target/tcm_fc/tfc_cmd.c index 410b723f9d79..21783cd71c15 100644 --- a/drivers/target/tcm_fc/tfc_cmd.c +++ b/drivers/target/tcm_fc/tfc_cmd.c @@ -223,11 +223,6 @@ int ft_write_pending(struct se_cmd *se_cmd) return 0; } -int ft_get_cmd_state(struct se_cmd *se_cmd) -{ - return 0; -} - /* * FC sequence response handler for follow-on sequences (data) and aborts. */ diff --git a/drivers/target/tcm_fc/tfc_conf.c b/drivers/target/tcm_fc/tfc_conf.c index 1a38c98f681b..6ac3fc1a7d39 100644 --- a/drivers/target/tcm_fc/tfc_conf.c +++ b/drivers/target/tcm_fc/tfc_conf.c @@ -398,15 +398,6 @@ static u16 ft_get_tag(struct se_portal_group *se_tpg) return ft_tpg(se_tpg)->index; } -static int ft_check_false(struct se_portal_group *se_tpg) -{ - return 0; -} - -static void ft_set_default_node_attr(struct se_node_acl *se_nacl) -{ -} - static u32 ft_tpg_get_inst_index(struct se_portal_group *se_tpg) { return ft_tpg(se_tpg)->index; @@ -418,10 +409,6 @@ static const struct target_core_fabric_ops ft_fabric_ops = { .node_acl_size = sizeof(struct ft_node_acl), .tpg_get_wwn = ft_get_fabric_wwn, .tpg_get_tag = ft_get_tag, - .tpg_check_demo_mode = ft_check_false, - .tpg_check_demo_mode_cache = ft_check_false, - .tpg_check_demo_mode_write_protect = ft_check_false, - .tpg_check_prod_mode_write_protect = ft_check_false, .tpg_get_inst_index = ft_tpg_get_inst_index, .check_stop_free = ft_check_stop_free, .release_cmd = ft_release_cmd, @@ -429,8 +416,6 @@ static const struct target_core_fabric_ops ft_fabric_ops = { .sess_get_index = ft_sess_get_index, .sess_get_initiator_sid = NULL, .write_pending = ft_write_pending, - .set_default_node_attributes = ft_set_default_node_attr, - .get_cmd_state = ft_get_cmd_state, .queue_data_in = ft_queue_data_in, .queue_status = ft_queue_status, .queue_tm_rsp = ft_queue_tm_resp, From patchwork Tue Mar 7 08:07:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Bogdanov X-Patchwork-Id: 660386 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5ADC7C678D5 for ; Tue, 7 Mar 2023 08:19:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230135AbjCGITB (ORCPT ); Tue, 7 Mar 2023 03:19:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230189AbjCGISu (ORCPT ); Tue, 7 Mar 2023 03:18:50 -0500 Received: from mta-01.yadro.com (mta-02.yadro.com [89.207.88.252]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F7E54FF2B; Tue, 7 Mar 2023 00:18:20 -0800 (PST) Received: from mta-01.yadro.com (localhost.localdomain [127.0.0.1]) by mta-01.yadro.com (Proxmox) with ESMTP id 7538F341EC5; Tue, 7 Mar 2023 11:07:54 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yadro.com; h=cc :cc:content-transfer-encoding:content-type:content-type:date :from:from:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=mta-01; bh=Nc0koPtsKLrnzRvVes Wg4rclWj5D/Nb4ap3SWkSCm4c=; b=PIIs044lkVFy+D0uHKgCmiWD3/K/0dxGjM 2SmY8rhorl7q7MtsXfaeEdElkzS6kKogBWsoRScNVtz9WfHdkrghJ7ur44TTDNNN dNy9jd8wjwuUl8c2mw+E3KA6R1RAz49gKsxmCRUkSH6KSkYHPsk2l+yHsmG0oLx2 aNB2FUJQo= Received: from T-EXCH-08.corp.yadro.com (unknown [172.17.10.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Proxmox) with ESMTPS id 6BC34341E00; Tue, 7 Mar 2023 11:07:54 +0300 (MSK) Received: from NB-591.corp.yadro.com (10.199.20.11) by T-EXCH-08.corp.yadro.com (172.17.11.58) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.1118.9; Tue, 7 Mar 2023 11:07:53 +0300 From: Dmitry Bogdanov To: Martin Petersen , CC: Bart Van Assche , Jason Gunthorpe , Leon Romanovsky , James Smart , Ram Vegesna , Michael Cyr , Nilesh Javali , , Chris Boot , Greg Kroah-Hartman , "Michael S . Tsirkin" , Jason Wang , Juergen Gross , , , Dmitry Bogdanov Subject: [PATCH v2 07/12] usb: gadjet: f_tcm: remove default fabric ops callouts Date: Tue, 7 Mar 2023 11:07:37 +0300 Message-ID: <20230307080742.24631-8-d.bogdanov@yadro.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230307080742.24631-1-d.bogdanov@yadro.com> References: <20230307080742.24631-1-d.bogdanov@yadro.com> MIME-Version: 1.0 X-Originating-IP: [10.199.20.11] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-08.corp.yadro.com (172.17.11.58) Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Remove callouts that have the implementation like a default implementation in TCM Core. Signed-off-by: Dmitry Bogdanov --- drivers/usb/gadget/function/f_tcm.c | 31 ----------------------------- 1 file changed, 31 deletions(-) diff --git a/drivers/usb/gadget/function/f_tcm.c b/drivers/usb/gadget/function/f_tcm.c index 658e2e21fdd0..d9d2ac28da66 100644 --- a/drivers/usb/gadget/function/f_tcm.c +++ b/drivers/usb/gadget/function/f_tcm.c @@ -1253,11 +1253,6 @@ static int usbg_check_true(struct se_portal_group *se_tpg) return 1; } -static int usbg_check_false(struct se_portal_group *se_tpg) -{ - return 0; -} - static char *usbg_get_fabric_wwn(struct se_portal_group *se_tpg) { struct usbg_tpg *tpg = container_of(se_tpg, @@ -1274,11 +1269,6 @@ static u16 usbg_get_tag(struct se_portal_group *se_tpg) return tpg->tport_tpgt; } -static u32 usbg_tpg_get_inst_index(struct se_portal_group *se_tpg) -{ - return 1; -} - static void usbg_release_cmd(struct se_cmd *se_cmd) { struct usbg_cmd *cmd = container_of(se_cmd, struct usbg_cmd, @@ -1289,20 +1279,6 @@ static void usbg_release_cmd(struct se_cmd *se_cmd) target_free_tag(se_sess, se_cmd); } -static u32 usbg_sess_get_index(struct se_session *se_sess) -{ - return 0; -} - -static void usbg_set_default_node_attrs(struct se_node_acl *nacl) -{ -} - -static int usbg_get_cmd_state(struct se_cmd *se_cmd) -{ - return 0; -} - static void usbg_queue_tm_rsp(struct se_cmd *se_cmd) { } @@ -1691,16 +1667,9 @@ static const struct target_core_fabric_ops usbg_ops = { .tpg_get_wwn = usbg_get_fabric_wwn, .tpg_get_tag = usbg_get_tag, .tpg_check_demo_mode = usbg_check_true, - .tpg_check_demo_mode_cache = usbg_check_false, - .tpg_check_demo_mode_write_protect = usbg_check_false, - .tpg_check_prod_mode_write_protect = usbg_check_false, - .tpg_get_inst_index = usbg_tpg_get_inst_index, .release_cmd = usbg_release_cmd, - .sess_get_index = usbg_sess_get_index, .sess_get_initiator_sid = NULL, .write_pending = usbg_send_write_request, - .set_default_node_attributes = usbg_set_default_node_attrs, - .get_cmd_state = usbg_get_cmd_state, .queue_data_in = usbg_send_read_response, .queue_status = usbg_send_status_response, .queue_tm_rsp = usbg_queue_tm_rsp, From patchwork Tue Mar 7 08:07:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Bogdanov X-Patchwork-Id: 660970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF739C6FD1B for ; Tue, 7 Mar 2023 08:19:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230194AbjCGITD (ORCPT ); Tue, 7 Mar 2023 03:19:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230190AbjCGISu (ORCPT ); Tue, 7 Mar 2023 03:18:50 -0500 Received: from mta-01.yadro.com (mta-02.yadro.com [89.207.88.252]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82DD14FF2C; Tue, 7 Mar 2023 00:18:20 -0800 (PST) Received: from mta-01.yadro.com (localhost.localdomain [127.0.0.1]) by mta-01.yadro.com (Proxmox) with ESMTP id 19835341ED8; Tue, 7 Mar 2023 11:07:55 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yadro.com; h=cc :cc:content-transfer-encoding:content-type:content-type:date :from:from:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=mta-01; bh=cNxREQDEQNC9uIQsj5 AOVmCpvfOWYS0Tpb8/jUg5Cso=; b=Qr3m9RKXyXII6I3iRSvx4HTke5fQjh6Ppl TjVKFBZZAluWnIe3wHNc8ZOFwSKxc4xAcZpST0roomlE1IJuIKTqCCX0TZTNwP5n tA21QZcjctiX9APa8Xw71foQKk3zuY7jq/6sRL5X5XTMoYBdPciYYyj7+JzEr04O iIGWpOeKs= Received: from T-EXCH-08.corp.yadro.com (unknown [172.17.10.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Proxmox) with ESMTPS id 0F915341ED5; Tue, 7 Mar 2023 11:07:55 +0300 (MSK) Received: from NB-591.corp.yadro.com (10.199.20.11) by T-EXCH-08.corp.yadro.com (172.17.11.58) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.1118.9; Tue, 7 Mar 2023 11:07:54 +0300 From: Dmitry Bogdanov To: Martin Petersen , CC: Bart Van Assche , Jason Gunthorpe , Leon Romanovsky , James Smart , Ram Vegesna , Michael Cyr , Nilesh Javali , , Chris Boot , Greg Kroah-Hartman , "Michael S . Tsirkin" , Jason Wang , Juergen Gross , , , Dmitry Bogdanov Subject: [PATCH v2 08/12] vhost-scsi: remove default fabric ops callouts Date: Tue, 7 Mar 2023 11:07:38 +0300 Message-ID: <20230307080742.24631-9-d.bogdanov@yadro.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230307080742.24631-1-d.bogdanov@yadro.com> References: <20230307080742.24631-1-d.bogdanov@yadro.com> MIME-Version: 1.0 X-Originating-IP: [10.199.20.11] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-08.corp.yadro.com (172.17.11.58) Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Remove callouts that have the implementation like a default implementation in TCM Core. Signed-off-by: Dmitry Bogdanov --- drivers/vhost/scsi.c | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index dca6346d75b3..8a1672a8d4e2 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c @@ -294,11 +294,6 @@ static int vhost_scsi_check_true(struct se_portal_group *se_tpg) return 1; } -static int vhost_scsi_check_false(struct se_portal_group *se_tpg) -{ - return 0; -} - static char *vhost_scsi_get_fabric_wwn(struct se_portal_group *se_tpg) { struct vhost_scsi_tpg *tpg = container_of(se_tpg, @@ -323,11 +318,6 @@ static int vhost_scsi_check_prot_fabric_only(struct se_portal_group *se_tpg) return tpg->tv_fabric_prot_type; } -static u32 vhost_scsi_tpg_get_inst_index(struct se_portal_group *se_tpg) -{ - return 1; -} - static void vhost_scsi_release_cmd_res(struct se_cmd *se_cmd) { struct vhost_scsi_cmd *tv_cmd = container_of(se_cmd, @@ -378,11 +368,6 @@ static void vhost_scsi_release_cmd(struct se_cmd *se_cmd) } } -static u32 vhost_scsi_sess_get_index(struct se_session *se_sess) -{ - return 0; -} - static int vhost_scsi_write_pending(struct se_cmd *se_cmd) { /* Go ahead and process the write immediately */ @@ -390,16 +375,6 @@ static int vhost_scsi_write_pending(struct se_cmd *se_cmd) return 0; } -static void vhost_scsi_set_default_node_attrs(struct se_node_acl *nacl) -{ - return; -} - -static int vhost_scsi_get_cmd_state(struct se_cmd *se_cmd) -{ - return 0; -} - static int vhost_scsi_queue_data_in(struct se_cmd *se_cmd) { transport_generic_free_cmd(se_cmd, 0); @@ -2447,17 +2422,11 @@ static const struct target_core_fabric_ops vhost_scsi_ops = { .tpg_get_tag = vhost_scsi_get_tpgt, .tpg_check_demo_mode = vhost_scsi_check_true, .tpg_check_demo_mode_cache = vhost_scsi_check_true, - .tpg_check_demo_mode_write_protect = vhost_scsi_check_false, - .tpg_check_prod_mode_write_protect = vhost_scsi_check_false, .tpg_check_prot_fabric_only = vhost_scsi_check_prot_fabric_only, - .tpg_get_inst_index = vhost_scsi_tpg_get_inst_index, .release_cmd = vhost_scsi_release_cmd, .check_stop_free = vhost_scsi_check_stop_free, - .sess_get_index = vhost_scsi_sess_get_index, .sess_get_initiator_sid = NULL, .write_pending = vhost_scsi_write_pending, - .set_default_node_attributes = vhost_scsi_set_default_node_attrs, - .get_cmd_state = vhost_scsi_get_cmd_state, .queue_data_in = vhost_scsi_queue_data_in, .queue_status = vhost_scsi_queue_status, .queue_tm_rsp = vhost_scsi_queue_tm_rsp, From patchwork Tue Mar 7 08:07:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Bogdanov X-Patchwork-Id: 660387 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF7B1C678D4 for ; Tue, 7 Mar 2023 08:10:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229983AbjCGIKS (ORCPT ); Tue, 7 Mar 2023 03:10:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229973AbjCGIJ4 (ORCPT ); Tue, 7 Mar 2023 03:09:56 -0500 Received: from mta-01.yadro.com (mta-02.yadro.com [89.207.88.252]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9654A509A8; Tue, 7 Mar 2023 00:09:17 -0800 (PST) Received: from mta-01.yadro.com (localhost.localdomain [127.0.0.1]) by mta-01.yadro.com (Proxmox) with ESMTP id 2BE74341ED5; Tue, 7 Mar 2023 11:07:56 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yadro.com; h=cc :cc:content-transfer-encoding:content-type:content-type:date :from:from:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=mta-01; bh=w/qGDtVpKabfMTaPy+ 4tYZgeIzkFDkkdV7ewNE1D7SA=; b=us9N3OyCI6GE7N1MlTmxuxcN1aB0wwp+m7 B3CDA6FZX4gUFmkqafP+WghKKtJKPmZBvONSAMQhtYf/5lCnRaozZxA3UfOL1Ctm kdRnQwL/eBaDh84Fer0GF+Z6BeKo1jpqhGJBcu3AorXZEYJRgea+r840J58WHMz5 vCshx+TJQ= Received: from T-EXCH-08.corp.yadro.com (unknown [172.17.10.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Proxmox) with ESMTPS id 20A41341E00; Tue, 7 Mar 2023 11:07:56 +0300 (MSK) Received: from NB-591.corp.yadro.com (10.199.20.11) by T-EXCH-08.corp.yadro.com (172.17.11.58) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.1118.9; Tue, 7 Mar 2023 11:07:54 +0300 From: Dmitry Bogdanov To: Martin Petersen , CC: Bart Van Assche , Jason Gunthorpe , Leon Romanovsky , James Smart , Ram Vegesna , Michael Cyr , Nilesh Javali , , Chris Boot , Greg Kroah-Hartman , "Michael S . Tsirkin" , Jason Wang , Juergen Gross , , , Dmitry Bogdanov Subject: [PATCH v2 09/12] xen-scsiback: remove default fabric ops callouts Date: Tue, 7 Mar 2023 11:07:39 +0300 Message-ID: <20230307080742.24631-10-d.bogdanov@yadro.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230307080742.24631-1-d.bogdanov@yadro.com> References: <20230307080742.24631-1-d.bogdanov@yadro.com> MIME-Version: 1.0 X-Originating-IP: [10.199.20.11] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-08.corp.yadro.com (172.17.11.58) Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Remove callouts that have the implementation like a default implementation in TCM Core. Signed-off-by: Dmitry Bogdanov --- drivers/xen/xen-scsiback.c | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/drivers/xen/xen-scsiback.c b/drivers/xen/xen-scsiback.c index 6106ed93817d..d267d2689dc7 100644 --- a/drivers/xen/xen-scsiback.c +++ b/drivers/xen/xen-scsiback.c @@ -1408,11 +1408,6 @@ static void scsiback_drop_tport(struct se_wwn *wwn) kfree(tport); } -static u32 scsiback_tpg_get_inst_index(struct se_portal_group *se_tpg) -{ - return 1; -} - static int scsiback_check_stop_free(struct se_cmd *se_cmd) { return transport_generic_free_cmd(se_cmd, 0); @@ -1423,11 +1418,6 @@ static void scsiback_release_cmd(struct se_cmd *se_cmd) target_free_tag(se_cmd->se_sess, se_cmd); } -static u32 scsiback_sess_get_index(struct se_session *se_sess) -{ - return 0; -} - static int scsiback_write_pending(struct se_cmd *se_cmd) { /* Go ahead and process the write immediately */ @@ -1436,15 +1426,6 @@ static int scsiback_write_pending(struct se_cmd *se_cmd) return 0; } -static void scsiback_set_default_node_attrs(struct se_node_acl *nacl) -{ -} - -static int scsiback_get_cmd_state(struct se_cmd *se_cmd) -{ - return 0; -} - static int scsiback_queue_data_in(struct se_cmd *se_cmd) { struct vscsibk_pend *pending_req = container_of(se_cmd, @@ -1824,11 +1805,6 @@ static int scsiback_check_true(struct se_portal_group *se_tpg) return 1; } -static int scsiback_check_false(struct se_portal_group *se_tpg) -{ - return 0; -} - static const struct target_core_fabric_ops scsiback_ops = { .module = THIS_MODULE, .fabric_name = "xen-pvscsi", @@ -1836,16 +1812,10 @@ static const struct target_core_fabric_ops scsiback_ops = { .tpg_get_tag = scsiback_get_tag, .tpg_check_demo_mode = scsiback_check_true, .tpg_check_demo_mode_cache = scsiback_check_true, - .tpg_check_demo_mode_write_protect = scsiback_check_false, - .tpg_check_prod_mode_write_protect = scsiback_check_false, - .tpg_get_inst_index = scsiback_tpg_get_inst_index, .check_stop_free = scsiback_check_stop_free, .release_cmd = scsiback_release_cmd, - .sess_get_index = scsiback_sess_get_index, .sess_get_initiator_sid = NULL, .write_pending = scsiback_write_pending, - .set_default_node_attributes = scsiback_set_default_node_attrs, - .get_cmd_state = scsiback_get_cmd_state, .queue_data_in = scsiback_queue_data_in, .queue_status = scsiback_queue_status, .queue_tm_rsp = scsiback_queue_tm_rsp, From patchwork Tue Mar 7 08:07:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Bogdanov X-Patchwork-Id: 660971 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6089C678D5 for ; Tue, 7 Mar 2023 08:10:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230073AbjCGIKT (ORCPT ); Tue, 7 Mar 2023 03:10:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229975AbjCGIJ6 (ORCPT ); Tue, 7 Mar 2023 03:09:58 -0500 Received: from mta-01.yadro.com (mta-02.yadro.com [89.207.88.252]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51A39509BD; Tue, 7 Mar 2023 00:09:18 -0800 (PST) Received: from mta-01.yadro.com (localhost.localdomain [127.0.0.1]) by mta-01.yadro.com (Proxmox) with ESMTP id 56347341ED7; Tue, 7 Mar 2023 11:07:57 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yadro.com; h=cc :cc:content-transfer-encoding:content-type:content-type:date :from:from:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=mta-01; bh=eQgqL6yVVBzAHgeHIZ e8DeLzHeAWs9GeaoL1cYm7QuI=; b=BuRRUbxYtOtGjDazflipjWnGNecVC2Oi2V plza866AufSmi+NneOynC8Ad871tEmL81lNPNeNkR1eU62lE4gixsEg0b1MNV9He 4zXWiNf9SrlhqrW7WxNkkShAw1unguSL8KTGlhubNkFdKtyINmpZJHxQT9UIh/B0 h1YVp7SmM= Received: from T-EXCH-08.corp.yadro.com (unknown [172.17.10.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Proxmox) with ESMTPS id 4CC71341E00; Tue, 7 Mar 2023 11:07:57 +0300 (MSK) Received: from NB-591.corp.yadro.com (10.199.20.11) by T-EXCH-08.corp.yadro.com (172.17.11.58) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.1118.9; Tue, 7 Mar 2023 11:07:56 +0300 From: Dmitry Bogdanov To: Martin Petersen , CC: Bart Van Assche , Jason Gunthorpe , Leon Romanovsky , James Smart , Ram Vegesna , Michael Cyr , Nilesh Javali , , Chris Boot , Greg Kroah-Hartman , "Michael S . Tsirkin" , Jason Wang , Juergen Gross , , , Dmitry Bogdanov Subject: [PATCH v2 10/12] scsi: qla2xxx: remove default fabric ops callouts Date: Tue, 7 Mar 2023 11:07:40 +0300 Message-ID: <20230307080742.24631-11-d.bogdanov@yadro.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230307080742.24631-1-d.bogdanov@yadro.com> References: <20230307080742.24631-1-d.bogdanov@yadro.com> MIME-Version: 1.0 X-Originating-IP: [10.199.20.11] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-08.corp.yadro.com (172.17.11.58) Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Remove callouts that have the implementation like a default implementation in TCM Core. Signed-off-by: Dmitry Bogdanov --- drivers/scsi/qla2xxx/tcm_qla2xxx.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c index 8024322c9c5a..3b5ba4b47b3b 100644 --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c @@ -377,11 +377,6 @@ static void tcm_qla2xxx_close_session(struct se_session *se_sess) tcm_qla2xxx_put_sess(sess); } -static u32 tcm_qla2xxx_sess_get_index(struct se_session *se_sess) -{ - return 0; -} - static int tcm_qla2xxx_write_pending(struct se_cmd *se_cmd) { struct qla_tgt_cmd *cmd = container_of(se_cmd, @@ -421,11 +416,6 @@ static int tcm_qla2xxx_write_pending(struct se_cmd *se_cmd) return qlt_rdy_to_xfer(cmd); } -static void tcm_qla2xxx_set_default_node_attrs(struct se_node_acl *nacl) -{ - return; -} - static int tcm_qla2xxx_get_cmd_state(struct se_cmd *se_cmd) { if (!(se_cmd->se_cmd_flags & SCF_SCSI_TMR_CDB)) { @@ -1811,10 +1801,8 @@ static const struct target_core_fabric_ops tcm_qla2xxx_ops = { .check_stop_free = tcm_qla2xxx_check_stop_free, .release_cmd = tcm_qla2xxx_release_cmd, .close_session = tcm_qla2xxx_close_session, - .sess_get_index = tcm_qla2xxx_sess_get_index, .sess_get_initiator_sid = NULL, .write_pending = tcm_qla2xxx_write_pending, - .set_default_node_attributes = tcm_qla2xxx_set_default_node_attrs, .get_cmd_state = tcm_qla2xxx_get_cmd_state, .queue_data_in = tcm_qla2xxx_queue_data_in, .queue_status = tcm_qla2xxx_queue_status, @@ -1852,10 +1840,8 @@ static const struct target_core_fabric_ops tcm_qla2xxx_npiv_ops = { .check_stop_free = tcm_qla2xxx_check_stop_free, .release_cmd = tcm_qla2xxx_release_cmd, .close_session = tcm_qla2xxx_close_session, - .sess_get_index = tcm_qla2xxx_sess_get_index, .sess_get_initiator_sid = NULL, .write_pending = tcm_qla2xxx_write_pending, - .set_default_node_attributes = tcm_qla2xxx_set_default_node_attrs, .get_cmd_state = tcm_qla2xxx_get_cmd_state, .queue_data_in = tcm_qla2xxx_queue_data_in, .queue_status = tcm_qla2xxx_queue_status, From patchwork Tue Mar 7 08:07:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Bogdanov X-Patchwork-Id: 660972 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4BBA0C6FD1E for ; Tue, 7 Mar 2023 08:10:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230015AbjCGIKE (ORCPT ); Tue, 7 Mar 2023 03:10:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230041AbjCGIJu (ORCPT ); Tue, 7 Mar 2023 03:09:50 -0500 Received: from mta-01.yadro.com (mta-02.yadro.com [89.207.88.252]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41903509B8; Tue, 7 Mar 2023 00:09:14 -0800 (PST) Received: from mta-01.yadro.com (localhost.localdomain [127.0.0.1]) by mta-01.yadro.com (Proxmox) with ESMTP id 71C6F341ED9; Tue, 7 Mar 2023 11:07:58 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yadro.com; h=cc :cc:content-transfer-encoding:content-type:content-type:date :from:from:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=mta-01; bh=KXowzq+5SRlg6NDOC/ ky1YlYmzef8uXGfH1ghtnXdUI=; b=cddaBnAVWjDwN7GF6rjcAcvmb6bCEwzS3h iF6JisWPtSbeHf2ByBSWwpL9JDfVm87NJkC3CuqtySZPfeoJmG4NyROEebMuvDZZ xuE/bYNugHdKS8RsKIbOcf8GDg5Ky3F1tw47tu61Eiy+D+ZUoRxNkPWtRibgYnYR txGaGoBTU= Received: from T-EXCH-08.corp.yadro.com (unknown [172.17.10.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Proxmox) with ESMTPS id 68290341E00; Tue, 7 Mar 2023 11:07:58 +0300 (MSK) Received: from NB-591.corp.yadro.com (10.199.20.11) by T-EXCH-08.corp.yadro.com (172.17.11.58) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.1118.9; Tue, 7 Mar 2023 11:07:57 +0300 From: Dmitry Bogdanov To: Martin Petersen , CC: Bart Van Assche , Jason Gunthorpe , Leon Romanovsky , James Smart , Ram Vegesna , Michael Cyr , Nilesh Javali , , Chris Boot , Greg Kroah-Hartman , "Michael S . Tsirkin" , Jason Wang , Juergen Gross , , , Dmitry Bogdanov Subject: [PATCH v2 11/12] scsi: efct: remove default fabric ops callouts Date: Tue, 7 Mar 2023 11:07:41 +0300 Message-ID: <20230307080742.24631-12-d.bogdanov@yadro.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230307080742.24631-1-d.bogdanov@yadro.com> References: <20230307080742.24631-1-d.bogdanov@yadro.com> MIME-Version: 1.0 X-Originating-IP: [10.199.20.11] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-08.corp.yadro.com (172.17.11.58) Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Remove callouts that have the implementation like a default implementation in TCM Core. Signed-off-by: Dmitry Bogdanov --- drivers/scsi/elx/efct/efct_lio.c | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/drivers/scsi/elx/efct/efct_lio.c b/drivers/scsi/elx/efct/efct_lio.c index be4b5c1ee32d..a982b9cf9870 100644 --- a/drivers/scsi/elx/efct/efct_lio.c +++ b/drivers/scsi/elx/efct/efct_lio.c @@ -285,11 +285,6 @@ efct_lio_npiv_check_prod_write_protect(struct se_portal_group *se_tpg) return tpg->tpg_attrib.prod_mode_write_protect; } -static u32 efct_lio_tpg_get_inst_index(struct se_portal_group *se_tpg) -{ - return 1; -} - static int efct_lio_check_stop_free(struct se_cmd *se_cmd) { struct efct_scsi_tgt_io *ocp = @@ -355,15 +350,6 @@ static void efct_lio_close_session(struct se_session *se_sess) efc_node_post_shutdown(node, NULL); } -static u32 efct_lio_sess_get_index(struct se_session *se_sess) -{ - return 0; -} - -static void efct_lio_set_default_node_attrs(struct se_node_acl *nacl) -{ -} - static int efct_lio_get_cmd_state(struct se_cmd *cmd) { struct efct_scsi_tgt_io *ocp = @@ -1607,14 +1593,11 @@ static const struct target_core_fabric_ops efct_lio_ops = { .tpg_check_demo_mode_cache = efct_lio_check_demo_mode_cache, .tpg_check_demo_mode_write_protect = efct_lio_check_demo_write_protect, .tpg_check_prod_mode_write_protect = efct_lio_check_prod_write_protect, - .tpg_get_inst_index = efct_lio_tpg_get_inst_index, .check_stop_free = efct_lio_check_stop_free, .aborted_task = efct_lio_aborted_task, .release_cmd = efct_lio_release_cmd, .close_session = efct_lio_close_session, - .sess_get_index = efct_lio_sess_get_index, .write_pending = efct_lio_write_pending, - .set_default_node_attributes = efct_lio_set_default_node_attrs, .get_cmd_state = efct_lio_get_cmd_state, .queue_data_in = efct_lio_queue_data_in, .queue_status = efct_lio_queue_status, @@ -1644,14 +1627,11 @@ static const struct target_core_fabric_ops efct_lio_npiv_ops = { efct_lio_npiv_check_demo_write_protect, .tpg_check_prod_mode_write_protect = efct_lio_npiv_check_prod_write_protect, - .tpg_get_inst_index = efct_lio_tpg_get_inst_index, .check_stop_free = efct_lio_check_stop_free, .aborted_task = efct_lio_aborted_task, .release_cmd = efct_lio_release_cmd, .close_session = efct_lio_close_session, - .sess_get_index = efct_lio_sess_get_index, .write_pending = efct_lio_write_pending, - .set_default_node_attributes = efct_lio_set_default_node_attrs, .get_cmd_state = efct_lio_get_cmd_state, .queue_data_in = efct_lio_queue_data_in, .queue_status = efct_lio_queue_status, From patchwork Tue Mar 7 08:07:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Bogdanov X-Patchwork-Id: 660388 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8911C678D4 for ; Tue, 7 Mar 2023 08:10:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230011AbjCGIKC (ORCPT ); Tue, 7 Mar 2023 03:10:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230026AbjCGIJr (ORCPT ); Tue, 7 Mar 2023 03:09:47 -0500 Received: from mta-01.yadro.com (mta-02.yadro.com [89.207.88.252]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B883509B4; Tue, 7 Mar 2023 00:09:10 -0800 (PST) Received: from mta-01.yadro.com (localhost.localdomain [127.0.0.1]) by mta-01.yadro.com (Proxmox) with ESMTP id 07E72341EDD; Tue, 7 Mar 2023 11:07:59 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yadro.com; h=cc :cc:content-transfer-encoding:content-type:content-type:date :from:from:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=mta-01; bh=iQMFxPEZSI8TZt1EiC PMyQKQdPfPchxjwyX5Lun++3I=; b=O2rL5+HT53IEW/WFcd/wLye8Yhy1VKsybr oY1R7VLdcBhUuaYKkvEv+bfvFKoIKV7o3fwvPtyT3qbkeY0CgEHRKtjx6hEdWUn8 qKC9Rgcyyh/bysS4DVSS/dIPTFBH9eqW6BxxI32jyybAXfyMw6dLvElEABXUwxSm /0BWZ01d4= Received: from T-EXCH-08.corp.yadro.com (unknown [172.17.10.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Proxmox) with ESMTPS id F1DBF341E00; Tue, 7 Mar 2023 11:07:58 +0300 (MSK) Received: from NB-591.corp.yadro.com (10.199.20.11) by T-EXCH-08.corp.yadro.com (172.17.11.58) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.1118.9; Tue, 7 Mar 2023 11:07:58 +0300 From: Dmitry Bogdanov To: Martin Petersen , CC: Bart Van Assche , Jason Gunthorpe , Leon Romanovsky , James Smart , Ram Vegesna , Michael Cyr , Nilesh Javali , , Chris Boot , Greg Kroah-Hartman , "Michael S . Tsirkin" , Jason Wang , Juergen Gross , , , Dmitry Bogdanov , Konstantin Shelekhin Subject: [PATCH v2 12/12] target: add virtual remote target Date: Tue, 7 Mar 2023 11:07:42 +0300 Message-ID: <20230307080742.24631-13-d.bogdanov@yadro.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230307080742.24631-1-d.bogdanov@yadro.com> References: <20230307080742.24631-1-d.bogdanov@yadro.com> MIME-Version: 1.0 X-Originating-IP: [10.199.20.11] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-08.corp.yadro.com (172.17.11.58) Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Create virtual remote target module. It can be used to see a whole acl/lun/tpg configuration from all nodes in storage cluster. For example, it allows to setup remote ports in ALUA port groups. To report all ports in a cluster in REPORT TARGET PORT GROUP command. Suggested-by: Konstantin Shelekhin Signed-off-by: Dmitry Bogdanov --- v2: code style cleanup remove default ops implementations --- drivers/target/Kconfig | 1 + drivers/target/Makefile | 1 + drivers/target/tcm_remote/Kconfig | 8 + drivers/target/tcm_remote/Makefile | 2 + drivers/target/tcm_remote/tcm_remote.c | 277 +++++++++++++++++++++++++ drivers/target/tcm_remote/tcm_remote.h | 20 ++ 6 files changed, 309 insertions(+) create mode 100644 drivers/target/tcm_remote/Kconfig create mode 100644 drivers/target/tcm_remote/Makefile create mode 100644 drivers/target/tcm_remote/tcm_remote.c create mode 100644 drivers/target/tcm_remote/tcm_remote.h diff --git a/drivers/target/Kconfig b/drivers/target/Kconfig index 72171ea3dd53..92641d39126a 100644 --- a/drivers/target/Kconfig +++ b/drivers/target/Kconfig @@ -47,5 +47,6 @@ source "drivers/target/loopback/Kconfig" source "drivers/target/tcm_fc/Kconfig" source "drivers/target/iscsi/Kconfig" source "drivers/target/sbp/Kconfig" +source "drivers/target/tcm_remote/Kconfig" endif diff --git a/drivers/target/Makefile b/drivers/target/Makefile index 45634747377e..431b84abfb94 100644 --- a/drivers/target/Makefile +++ b/drivers/target/Makefile @@ -30,3 +30,4 @@ obj-$(CONFIG_LOOPBACK_TARGET) += loopback/ obj-$(CONFIG_TCM_FC) += tcm_fc/ obj-$(CONFIG_ISCSI_TARGET) += iscsi/ obj-$(CONFIG_SBP_TARGET) += sbp/ +obj-$(CONFIG_REMOTE_TARGET) += tcm_remote/ diff --git a/drivers/target/tcm_remote/Kconfig b/drivers/target/tcm_remote/Kconfig new file mode 100644 index 000000000000..e6bebb5fe6f1 --- /dev/null +++ b/drivers/target/tcm_remote/Kconfig @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: GPL-2.0-only +config REMOTE_TARGET + tristate "TCM Virtual Remote target" + depends on SCSI + help + Say Y here to enable the TCM Virtual Remote fabric + That fabric is a dummy fabric to tell TCM about configuration + of TPG/ACL/LUN on peer nodes in a cluster. diff --git a/drivers/target/tcm_remote/Makefile b/drivers/target/tcm_remote/Makefile new file mode 100644 index 000000000000..5818ffd0b0fa --- /dev/null +++ b/drivers/target/tcm_remote/Makefile @@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0-only +obj-$(CONFIG_REMOTE_TARGET) += tcm_remote.o diff --git a/drivers/target/tcm_remote/tcm_remote.c b/drivers/target/tcm_remote/tcm_remote.c new file mode 100644 index 000000000000..1b7ce7803685 --- /dev/null +++ b/drivers/target/tcm_remote/tcm_remote.c @@ -0,0 +1,277 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "tcm_remote.h" + +static inline struct tcm_remote_tpg *remote_tpg(struct se_portal_group *se_tpg) +{ + return container_of(se_tpg, struct tcm_remote_tpg, remote_se_tpg); +} + +static char *tcm_remote_get_endpoint_wwn(struct se_portal_group *se_tpg) +{ + /* + * Return the passed NAA identifier for the Target Port + */ + return &remote_tpg(se_tpg)->remote_hba->remote_wwn_address[0]; +} + +static u16 tcm_remote_get_tag(struct se_portal_group *se_tpg) +{ + /* + * This Tag is used when forming SCSI Name identifier in EVPD=1 0x83 + * to represent the SCSI Target Port. + */ + return remote_tpg(se_tpg)->remote_tpgt; +} + +static int tcm_remote_dummy_cmd_fn(struct se_cmd *se_cmd) +{ + return 0; +} + +static void tcm_remote_dummy_cmd_void_fn(struct se_cmd *se_cmd) +{ + +} + +static char *tcm_remote_dump_proto_id(struct tcm_remote_hba *remote_hba) +{ + switch (remote_hba->remote_proto_id) { + case SCSI_PROTOCOL_SAS: + return "SAS"; + case SCSI_PROTOCOL_SRP: + return "SRP"; + case SCSI_PROTOCOL_FCP: + return "FCP"; + case SCSI_PROTOCOL_ISCSI: + return "iSCSI"; + default: + break; + } + + return "Unknown"; +} + +static int tcm_remote_port_link( + struct se_portal_group *se_tpg, + struct se_lun *lun) +{ + pr_debug("TCM_Remote_ConfigFS: Port Link LUN %lld Successful\n", + lun->unpacked_lun); + return 0; +} + +static void tcm_remote_port_unlink( + struct se_portal_group *se_tpg, + struct se_lun *lun) +{ + pr_debug("TCM_Remote_ConfigFS: Port Unlink LUN %lld Successful\n", + lun->unpacked_lun); +} + +static struct se_portal_group *tcm_remote_make_tpg( + struct se_wwn *wwn, + const char *name) +{ + struct tcm_remote_hba *remote_hba = container_of(wwn, + struct tcm_remote_hba, remote_hba_wwn); + struct tcm_remote_tpg *remote_tpg; + unsigned long tpgt; + int ret; + + if (strstr(name, "tpgt_") != name) { + pr_err("Unable to locate \"tpgt_#\" directory group\n"); + return ERR_PTR(-EINVAL); + } + if (kstrtoul(name+5, 10, &tpgt)) + return ERR_PTR(-EINVAL); + + if (tpgt >= TL_TPGS_PER_HBA) { + pr_err("Passed tpgt: %lu exceeds TL_TPGS_PER_HBA: %u\n", + tpgt, TL_TPGS_PER_HBA); + return ERR_PTR(-EINVAL); + } + remote_tpg = &remote_hba->remote_hba_tpgs[tpgt]; + remote_tpg->remote_hba = remote_hba; + remote_tpg->remote_tpgt = tpgt; + /* + * Register the remote_tpg as a emulated TCM Target Endpoint + */ + ret = core_tpg_register(wwn, &remote_tpg->remote_se_tpg, + remote_hba->remote_proto_id); + if (ret < 0) + return ERR_PTR(-ENOMEM); + + pr_debug("TCM_Remote_ConfigFS: Allocated Emulated %s Target Port %s,t,0x%04lx\n", + tcm_remote_dump_proto_id(remote_hba), + config_item_name(&wwn->wwn_group.cg_item), tpgt); + return &remote_tpg->remote_se_tpg; +} + +static void tcm_remote_drop_tpg(struct se_portal_group *se_tpg) +{ + struct se_wwn *wwn = se_tpg->se_tpg_wwn; + struct tcm_remote_tpg *remote_tpg = container_of(se_tpg, + struct tcm_remote_tpg, remote_se_tpg); + struct tcm_remote_hba *remote_hba; + unsigned short tpgt; + + remote_hba = remote_tpg->remote_hba; + tpgt = remote_tpg->remote_tpgt; + + /* + * Deregister the remote_tpg as a emulated TCM Target Endpoint + */ + core_tpg_deregister(se_tpg); + + remote_tpg->remote_hba = NULL; + remote_tpg->remote_tpgt = 0; + + pr_debug("TCM_Remote_ConfigFS: Deallocated Emulated %s Target Port %s,t,0x%04x\n", + tcm_remote_dump_proto_id(remote_hba), + config_item_name(&wwn->wwn_group.cg_item), tpgt); +} + +static struct se_wwn *tcm_remote_make_wwn( + struct target_fabric_configfs *tf, + struct config_group *group, + const char *name) +{ + struct tcm_remote_hba *remote_hba; + char *ptr; + int ret, off = 0; + + remote_hba = kzalloc(sizeof(*remote_hba), GFP_KERNEL); + if (!remote_hba) + return ERR_PTR(-ENOMEM); + + /* + * Determine the emulated Protocol Identifier and Target Port Name + * based on the incoming configfs directory name. + */ + ptr = strstr(name, "naa."); + if (ptr) { + remote_hba->remote_proto_id = SCSI_PROTOCOL_SAS; + goto check_len; + } + ptr = strstr(name, "fc."); + if (ptr) { + remote_hba->remote_proto_id = SCSI_PROTOCOL_FCP; + off = 3; /* Skip over "fc." */ + goto check_len; + } + ptr = strstr(name, "0x"); + if (ptr) { + remote_hba->remote_proto_id = SCSI_PROTOCOL_SRP; + off = 2; /* Skip over "0x" */ + goto check_len; + } + ptr = strstr(name, "iqn."); + if (!ptr) { + pr_err("Unable to locate prefix for emulated Target Port: %s\n", + name); + ret = -EINVAL; + goto out; + } + remote_hba->remote_proto_id = SCSI_PROTOCOL_ISCSI; + +check_len: + if (strlen(name) >= TL_WWN_ADDR_LEN) { + pr_err("Emulated NAA %s Address: %s, exceeds max: %d\n", + name, tcm_remote_dump_proto_id(remote_hba), TL_WWN_ADDR_LEN); + ret = -EINVAL; + goto out; + } + snprintf(&remote_hba->remote_wwn_address[0], TL_WWN_ADDR_LEN, "%s", &name[off]); + + pr_debug("TCM_Remote_ConfigFS: Allocated emulated Target %s Address: %s\n", + tcm_remote_dump_proto_id(remote_hba), name); + return &remote_hba->remote_hba_wwn; +out: + kfree(remote_hba); + return ERR_PTR(ret); +} + +static void tcm_remote_drop_wwn(struct se_wwn *wwn) +{ + struct tcm_remote_hba *remote_hba = container_of(wwn, + struct tcm_remote_hba, remote_hba_wwn); + + pr_debug("TCM_Remote_ConfigFS: Deallocating emulated Target %s Address: %s\n", + tcm_remote_dump_proto_id(remote_hba), + remote_hba->remote_wwn_address); + kfree(remote_hba); +} + +static ssize_t tcm_remote_wwn_version_show(struct config_item *item, char *page) +{ + return sprintf(page, "TCM Remote Fabric module %s\n", TCM_REMOTE_VERSION); +} + +CONFIGFS_ATTR_RO(tcm_remote_wwn_, version); + +static struct configfs_attribute *tcm_remote_wwn_attrs[] = { + &tcm_remote_wwn_attr_version, + NULL, +}; + +static const struct target_core_fabric_ops remote_ops = { + .module = THIS_MODULE, + .fabric_name = "remote", + .tpg_get_wwn = tcm_remote_get_endpoint_wwn, + .tpg_get_tag = tcm_remote_get_tag, + .check_stop_free = tcm_remote_dummy_cmd_fn, + .release_cmd = tcm_remote_dummy_cmd_void_fn, + .write_pending = tcm_remote_dummy_cmd_fn, + .queue_data_in = tcm_remote_dummy_cmd_fn, + .queue_status = tcm_remote_dummy_cmd_fn, + .queue_tm_rsp = tcm_remote_dummy_cmd_void_fn, + .aborted_task = tcm_remote_dummy_cmd_void_fn, + .fabric_make_wwn = tcm_remote_make_wwn, + .fabric_drop_wwn = tcm_remote_drop_wwn, + .fabric_make_tpg = tcm_remote_make_tpg, + .fabric_drop_tpg = tcm_remote_drop_tpg, + .fabric_post_link = tcm_remote_port_link, + .fabric_pre_unlink = tcm_remote_port_unlink, + .tfc_wwn_attrs = tcm_remote_wwn_attrs, +}; + +static int __init tcm_remote_fabric_init(void) +{ + int ret = -ENOMEM; + + ret = target_register_template(&remote_ops); + if (ret) + goto out; + + return 0; + +out: + return ret; +} + +static void __exit tcm_remote_fabric_exit(void) +{ + target_unregister_template(&remote_ops); +} + +MODULE_DESCRIPTION("TCM virtual remote target"); +MODULE_AUTHOR("Dmitry Bogdanov "); +MODULE_LICENSE("GPL"); +module_init(tcm_remote_fabric_init); +module_exit(tcm_remote_fabric_exit); diff --git a/drivers/target/tcm_remote/tcm_remote.h b/drivers/target/tcm_remote/tcm_remote.h new file mode 100644 index 000000000000..913d1a6eb3a2 --- /dev/null +++ b/drivers/target/tcm_remote/tcm_remote.h @@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#include +#include + +#define TCM_REMOTE_VERSION "v0.1" +#define TL_WWN_ADDR_LEN 256 +#define TL_TPGS_PER_HBA 32 + +struct tcm_remote_tpg { + unsigned short remote_tpgt; + struct se_portal_group remote_se_tpg; + struct tcm_remote_hba *remote_hba; +}; + +struct tcm_remote_hba { + u8 remote_proto_id; + unsigned char remote_wwn_address[TL_WWN_ADDR_LEN]; + struct tcm_remote_tpg remote_hba_tpgs[TL_TPGS_PER_HBA]; + struct se_wwn remote_hba_wwn; +};