From: Hannes Reinecke <hare@suse.de>
To: Nic Bellinger <nab@daterainc.com>
Cc: target-devel@vger.kernel.org, linux-scsi@vger.kernel.org,
Christoph Hellwig <hch@lst.de>, Ewan Milne <emilne@redhat.com>,
Hannes Reinecke <hare@suse.de>
Subject: [PATCH 1/8] tcm_loop: Hook into SAS transport class
Date: Thu, 18 Jun 2015 11:43:35 +0200 [thread overview]
Message-ID: <1434620622-65391-2-git-send-email-hare@suse.de> (raw)
In-Reply-To: <1434620622-65391-1-git-send-email-hare@suse.de>
If tcm_loop emulates a SAS HBA it should hook into the SAS
transport class, too.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
drivers/target/loopback/tcm_loop.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c
index a556bde..45ae3e4 100644
--- a/drivers/target/loopback/tcm_loop.c
+++ b/drivers/target/loopback/tcm_loop.c
@@ -31,6 +31,7 @@
#include <scsi/scsi_host.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_cmnd.h>
+#include <scsi/scsi_transport_sas.h>
#include <target/target_core_base.h>
#include <target/target_core_fabric.h>
@@ -42,7 +43,7 @@
static struct workqueue_struct *tcm_loop_workqueue;
static struct kmem_cache *tcm_loop_cmd_cache;
-
+static struct scsi_transport_template *tcm_loop_sas_transport_template;
static int tcm_loop_hba_no_cnt;
static int tcm_loop_queue_status(struct se_cmd *se_cmd);
@@ -360,6 +361,9 @@ static int tcm_loop_slave_alloc(struct scsi_device *sd)
return 0;
}
+struct sas_function_template tcm_loop_sas_transport_functions = {
+};
+
static struct scsi_host_template tcm_loop_driver_template = {
.show_info = tcm_loop_show_info,
.proc_name = "tcm_loopback",
@@ -408,6 +412,8 @@ static int tcm_loop_driver_probe(struct device *dev)
sh->max_lun = 0;
sh->max_channel = 0;
sh->max_cmd_len = SCSI_MAX_VARLEN_CDB_SIZE;
+ if (tl_hba->tl_proto_id == SCSI_PROTOCOL_SAS)
+ sh->transportt = tcm_loop_sas_transport_template;
host_prot = SHOST_DIF_TYPE1_PROTECTION | SHOST_DIF_TYPE2_PROTECTION |
SHOST_DIF_TYPE3_PROTECTION | SHOST_DIX_TYPE1_PROTECTION |
@@ -1290,8 +1296,15 @@ static int __init tcm_loop_fabric_init(void)
if (ret)
goto out_release_core_bus;
+ tcm_loop_sas_transport_template =
+ sas_attach_transport(&tcm_loop_sas_transport_functions);
+ if (!tcm_loop_sas_transport_template)
+ goto out_unregister_template;
+
return 0;
+out_unregister_template:
+ target_unregister_template(&loop_ops);
out_release_core_bus:
tcm_loop_release_core_bus();
out_destroy_cache:
@@ -1304,6 +1317,7 @@ out:
static void __exit tcm_loop_fabric_exit(void)
{
+ sas_release_transport(tcm_loop_sas_transport_template);
target_unregister_template(&loop_ops);
tcm_loop_release_core_bus();
kmem_cache_destroy(tcm_loop_cmd_cache);
--
1.8.5.2
next prev parent reply other threads:[~2015-06-18 9:43 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-18 9:43 [PATCH 0/8] tcm_loop updates Hannes Reinecke
2015-06-18 9:43 ` Hannes Reinecke [this message]
2015-06-18 9:43 ` [PATCH 2/8] tcm_loop: Add SAS transport topology Hannes Reinecke
2015-06-18 9:43 ` [PATCH 3/8] tcm_loop: Remove SAS vestigies Hannes Reinecke
2015-06-18 9:43 ` [PATCH 4/8] tcm_loop: Send I_T_NEXUS_LOSS_OCCURRED UA Hannes Reinecke
2015-06-18 9:43 ` [PATCH 5/8] tcm_loop: Rescan SCSI target on transport online Hannes Reinecke
2015-06-18 9:43 ` [PATCH 6/8] target: Issue Power-On/Reset UA upon LUN instantiation Hannes Reinecke
2015-06-18 9:43 ` [PATCH 7/8] target_core_alua: disallow READ_CAPACITY when in standby Hannes Reinecke
2015-06-18 11:40 ` Chris Boot
2015-06-18 14:32 ` Hannes Reinecke
2015-06-19 6:49 ` Christoph Hellwig
2015-06-19 7:07 ` Hannes Reinecke
2015-06-18 9:43 ` [PATCH 8/8] target: display 'write_protect' attribute for demo-mode LUNs Hannes Reinecke
2015-06-19 6:51 ` Christoph Hellwig
2015-06-19 7:05 ` Hannes Reinecke
2015-06-19 6:48 ` [PATCH 0/8] tcm_loop updates Christoph Hellwig
2015-06-19 7:13 ` Hannes Reinecke
2015-06-23 8:29 ` Nicholas A. Bellinger
2015-06-23 9:05 ` Hannes Reinecke
2015-07-07 0:25 ` Nicholas A. Bellinger
2015-07-07 5:50 ` Hannes Reinecke
2015-07-07 6:26 ` Nicholas A. Bellinger
2015-07-07 6:29 ` Hannes Reinecke
2015-07-07 6:42 ` Nicholas A. Bellinger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1434620622-65391-2-git-send-email-hare@suse.de \
--to=hare@suse.de \
--cc=emilne@redhat.com \
--cc=hch@lst.de \
--cc=linux-scsi@vger.kernel.org \
--cc=nab@daterainc.com \
--cc=target-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.