Skip to contentSkip to conversation

tcm_loop: Add multi-fabric Linux/SCSI LLD fabric module

RFC Superseded Nicholas A. Bellinger 1 participant 1 message Sep 22, 2010

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

RFC v2 21/21 tcm_loop: Add multi-fabric Linux/SCSI LLD fabric module

From: Nicholas Bellinger <[email protected]>

This patch adds the TCM_Loop Linux/SCSI LLD fabric module for accessing TCM device backstores as locally accessable SCSI LUNs in virtual SAS, FC, and iSCSI Target ports using the generic fabric TransportID and Target Port WWN naming handlers from TCM's target_core_fabric_lib.c The TCM_Loop module uses the generic fabric configfs infratructure provided by target_core_fabric_configfs.c and adds a module dependent attribute for the creation/release of the virtual I_T Nexus connected the TCM_Loop Target and Initiator Ports.

TCM_Loop can also be used with the scsi-generic driver so that STGT userspace fabric modules, QEMU-KVM and other hypervisor SCSI passthrough support can access TCM device backstore and control CDB emulation.

---
 drivers/target/Kbuild                          |    3 +
 drivers/target/Kconfig                         |    2 +
 drivers/target/tcm_loop/Kbuild                 |   11 +
 drivers/target/tcm_loop/Kconfig                |   13 +
 drivers/target/tcm_loop/tcm_loop_configfs.c    |  649 ++++++++++++++++++++++++
 drivers/target/tcm_loop/tcm_loop_configfs.h    |    2 +
 drivers/target/tcm_loop/tcm_loop_core.h        |   77 +++
 drivers/target/tcm_loop/tcm_loop_fabric.c      |  494 ++++++++++++++++++
 drivers/target/tcm_loop/tcm_loop_fabric.h      |   43 ++
 drivers/target/tcm_loop/tcm_loop_fabric_scsi.c |  618 ++++++++++++++++++++++
 drivers/target/tcm_loop/tcm_loop_fabric_scsi.h |   10 +
 11 files changed, 1922 insertions(+), 0 deletions(-)
 create mode 100644 drivers/target/tcm_loop/Kbuild
 create mode 100644 drivers/target/tcm_loop/Kconfig
 create mode 100644 drivers/target/tcm_loop/tcm_loop_configfs.c
 create mode 100644 drivers/target/tcm_loop/tcm_loop_configfs.h
 create mode 100644 drivers/target/tcm_loop/tcm_loop_core.h
 create mode 100644 drivers/target/tcm_loop/tcm_loop_fabric.c
 create mode 100644 drivers/target/tcm_loop/tcm_loop_fabric.h
 create mode 100644 drivers/target/tcm_loop/tcm_loop_fabric_scsi.c
 create mode 100644 drivers/target/tcm_loop/tcm_loop_fabric_scsi.h
drivers/target/Kbuild +3 -0
index a610f67..6d41a95 100644
@@ -25,3 +25,6 @@ obj-$(CONFIG_TARGET_CORE)	+= target_core_mod.o
 obj-$(CONFIG_TCM_IBLOCK)	+= target_core_iblock.o
 obj-$(CONFIG_TCM_FILEIO)	+= target_core_file.o
 obj-$(CONFIG_TCM_PSCSI)		+= target_core_pscsi.o
+
+# Fabric modules
+obj-$(CONFIG_TCM_LOOP_FABRIC)	+= tcm_loop/
drivers/target/Kconfig +2 -0
index 5c37653..55975fc 100644
@@ -32,3 +32,5 @@ config TCM_PSCSI
 	default y
 	---help---
 	Say Y here to enable the TCM/pSCSI subsystem plugin for non-buffered passthrough access to Linux/SCSI device
+
+source "drivers/target/tcm_loop/Kconfig"
drivers/target/tcm_loop/Kbuild new file +11 -0
new file mode 100644
index 0000000..f2c633a
@@ -0,0 +1,11 @@
+EXTRA_CFLAGS += -I$(srctree)/drivers/target/ -I$(srctree)/drivers/scsi/ -I$(srctree)/include/scsi/ -I$(srctree)/drivers/target/tcm_loop/
+
+tcm_loop-objs			:= tcm_loop_fabric.o \
+				   tcm_loop_fabric_scsi.o \
+				   tcm_loop_configfs.o \
+
+obj-$(CONFIG_TCM_LOOP_FABRIC)	+= tcm_loop.o
+
+ifdef CONFIG_TCM_LOOP_CDB_DEBUG
+EXTRA_CFLAGS			+= -DTCM_LOOP_CDB_DEBUG
+endif
drivers/target/tcm_loop/Kconfig new file +13 -0
new file mode 100644
index 0000000..7520a6d
@@ -0,0 +1,13 @@
+config TCM_LOOP_FABRIC
+        tristate "TCM Virtual SAS target and Linux/SCSI LDD fabric loopback module "
+        depends on TARGET_CORE && CONFIGFS_FS
+        default n
+        ---help---
+        Say Y here to enable the TCM Virtual SAS target and Linux/SCSI LDD fabric loopback module
+
+config TCM_LOOP_CDB_DEBUG
+	tristate "TCM loopback fabric module CDB debug code"
+	depends on TARGET_CORE && CONFIGFS_FS && TCM_LOOP_FABRIC
+	default n
+	---help---
+	Say Y here to enable the TCM loopback fabric module CDB debug code
drivers/target/tcm_loop/tcm_loop_configfs.c new file +649 -0

649 lines not on this page · raw message

drivers/target/tcm_loop/tcm_loop_configfs.h new file +2 -0
new file mode 100644
index 0000000..f46aa4b
@@ -0,0 +1,2 @@
+extern int tcm_loop_register_configfs(void);
+extern void tcm_loop_deregister_configfs(void);
drivers/target/tcm_loop/tcm_loop_core.h new file +77 -0

77 lines not on this page · raw message

drivers/target/tcm_loop/tcm_loop_fabric.c new file +494 -0

494 lines not on this page · raw message

drivers/target/tcm_loop/tcm_loop_fabric.h new file +43 -0

43 lines not on this page · raw message

drivers/target/tcm_loop/tcm_loop_fabric_scsi.c new file +618 -0

618 lines not on this page · raw message

drivers/target/tcm_loop/tcm_loop_fabric_scsi.h new file +10 -0
new file mode 100644
index 0000000..bcba89b
@@ -0,0 +1,10 @@
+extern struct kmem_cache *tcm_loop_cmd_cache;
+
+extern int tcm_loop_new_cmd_map(struct se_cmd *);
+extern void tcm_loop_check_stop_free(struct se_cmd *);
+extern void tcm_loop_deallocate_core_cmd(struct se_cmd *);
+extern void tcm_loop_scsi_forget_host(struct Scsi_Host *);
+extern void tcm_loop_deallocate_core_cmd(struct se_cmd *);
+extern int tcm_loop_setup_hba_bus(struct tcm_loop_hba *, int);
+extern int tcm_loop_alloc_core_bus(void);
+extern void tcm_loop_release_core_bus(void);
Signature · 1 line
1.7.3