Skip to contentSkip to conversation

target: Initial merge of v4.0.0-rc6 for .38

PATCH Superseded Nicholas A. Bellinger 1 participant 3 messages Dec 17, 2010

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover target: Initial merge of v4.0.0-rc6 for .38

From: Nicholas Bellinger <[email protected]>

Greetings James,

This following series is based on scsi-misc-2.6.git/master and has been cut against v2.6.37-rc5. It contains three seperate patches to add Target v4.0.0-rc6 and TCM_Loop virtual SCSI LLD for the .38 merge window.

A pullable version of this series is available from:

git://git.kernel.org/pub/scm/linux/kernel/git/nab/scsi-misc-2.6.git merge-for-38

and the individual patches are also available as individual files here:

http://www.kernel.org/pub/linux/kernel/people/nab/TCM-v4-patches-for-v2.6.38/

The full RFC and release history for target core has been included in patch #2.

Best Regards,

Nicholas Bellinger (3):
scsi: Add missing SPC-4 CDB and MAINTENANCE_[IN,OUT] service action
definitions
target: Add target core v4.0.0-rc6 for .38
tcm_loop: Add multi-fabric Linux/SCSI LLD fabric module

 Documentation/target/tcm_mod_builder.py        | 1094 +++++
 Documentation/target/tcm_mod_builder.txt       |  145 +
 drivers/Kconfig                                |    2 +
 drivers/Makefile                               |    1 +
 drivers/target/Kconfig                         |   33 +
 drivers/target/Makefile                        |   27 +
 drivers/target/target_core_alua.c              | 1991 ++++++++
 drivers/target/target_core_alua.h              |  126 +
 drivers/target/target_core_cdb.c               | 1131 +++++
 drivers/target/target_core_configfs.c          | 3231 +++++++++++++
 drivers/target/target_core_device.c            | 1694 +++++++
 drivers/target/target_core_fabric_configfs.c   | 1001 ++++
 drivers/target/target_core_fabric_lib.c        |  451 ++
 drivers/target/target_core_file.c              |  688 +++
 drivers/target/target_core_file.h              |   50 +
 drivers/target/target_core_hba.c               |  185 +
 drivers/target/target_core_hba.h               |    7 +
 drivers/target/target_core_iblock.c            |  808 ++++
 drivers/target/target_core_iblock.h            |   40 +
 drivers/target/target_core_mib.c               | 1078 +++++
 drivers/target/target_core_mib.h               |   29 +
 drivers/target/target_core_pr.c                | 4251 ++++++++++++++++
 drivers/target/target_core_pr.h                |   67 +
 drivers/target/target_core_pscsi.c             | 1471 ++++++
 drivers/target/target_core_pscsi.h             |   65 +
 drivers/target/target_core_rd.c                | 1091 +++++
 drivers/target/target_core_rd.h                |   73 +
 drivers/target/target_core_scdb.c              |  105 +
 drivers/target/target_core_scdb.h              |   10 +
 drivers/target/target_core_tmr.c               |  395 ++
 drivers/target/target_core_tpg.c               |  826 ++++
 drivers/target/target_core_transport.c         | 6133 ++++++++++++++++++++++++
 drivers/target/target_core_ua.c                |  332 ++
 drivers/target/target_core_ua.h                |   36 +
 drivers/target/tcm_loop/Kconfig                |   11 +
 drivers/target/tcm_loop/Makefile               |   11 +
 drivers/target/tcm_loop/tcm_loop_configfs.c    |  647 +++
 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      |  474 ++
 drivers/target/tcm_loop/tcm_loop_fabric.h      |   40 +
 drivers/target/tcm_loop/tcm_loop_fabric_scsi.c |  605 +++
 drivers/target/tcm_loop/tcm_loop_fabric_scsi.h |   10 +
 include/scsi/scsi.h                            |   28 +
 include/target/configfs_macros.h               |  147 +
 include/target/target_core_base.h              |  936 ++++
 include/target/target_core_configfs.h          |   52 +
 include/target/target_core_device.h            |   61 +
 include/target/target_core_fabric_configfs.h   |  106 +
 include/target/target_core_fabric_lib.h        |   28 +
 include/target/target_core_fabric_ops.h        |  100 +
 include/target/target_core_tmr.h               |   43 +
 include/target/target_core_tpg.h               |   35 +
 include/target/target_core_transport.h         |  350 ++
 54 files changed, 32430 insertions(+), 0 deletions(-)
 create mode 100755 Documentation/target/tcm_mod_builder.py
 create mode 100644 Documentation/target/tcm_mod_builder.txt
 create mode 100644 drivers/target/Kconfig
 create mode 100644 drivers/target/Makefile
 create mode 100644 drivers/target/target_core_alua.c
 create mode 100644 drivers/target/target_core_alua.h
 create mode 100644 drivers/target/target_core_cdb.c
 create mode 100644 drivers/target/target_core_configfs.c
 create mode 100644 drivers/target/target_core_device.c
 create mode 100644 drivers/target/target_core_fabric_configfs.c
 create mode 100644 drivers/target/target_core_fabric_lib.c
 create mode 100644 drivers/target/target_core_file.c
 create mode 100644 drivers/target/target_core_file.h
 create mode 100644 drivers/target/target_core_hba.c
 create mode 100644 drivers/target/target_core_hba.h
 create mode 100644 drivers/target/target_core_iblock.c
 create mode 100644 drivers/target/target_core_iblock.h
 create mode 100644 drivers/target/target_core_mib.c
 create mode 100644 drivers/target/target_core_mib.h
 create mode 100644 drivers/target/target_core_pr.c
 create mode 100644 drivers/target/target_core_pr.h
 create mode 100644 drivers/target/target_core_pscsi.c
 create mode 100644 drivers/target/target_core_pscsi.h
 create mode 100644 drivers/target/target_core_rd.c
 create mode 100644 drivers/target/target_core_rd.h
 create mode 100644 drivers/target/target_core_scdb.c
 create mode 100644 drivers/target/target_core_scdb.h
 create mode 100644 drivers/target/target_core_tmr.c
 create mode 100644 drivers/target/target_core_tpg.c
 create mode 100644 drivers/target/target_core_transport.c
 create mode 100644 drivers/target/target_core_ua.c
 create mode 100644 drivers/target/target_core_ua.h
 create mode 100644 drivers/target/tcm_loop/Kconfig
 create mode 100644 drivers/target/tcm_loop/Makefile
 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
 create mode 100644 include/target/configfs_macros.h
 create mode 100644 include/target/target_core_base.h
 create mode 100644 include/target/target_core_configfs.h
 create mode 100644 include/target/target_core_device.h
 create mode 100644 include/target/target_core_fabric_configfs.h
 create mode 100644 include/target/target_core_fabric_lib.h
 create mode 100644 include/target/target_core_fabric_ops.h
 create mode 100644 include/target/target_core_tmr.h
 create mode 100644 include/target/target_core_tpg.h
 create mode 100644 include/target/target_core_transport.h
Signature · 1 line
1.7.3.4
#1 lore raw

PATCH 1/3 scsi: Add missing SPC-4 CDB and MAINTENANCE_[IN,OUT] service action definitions

From: Nicholas Bellinger <[email protected]>

This patch adds a handful of missing CDBs defs that are used by TCM persistent reservation logic in the SPC-4 defined CDB exclusion table for registrations and reservations.

This includes a number of missing MI_* and MO_* prefixed service actions defs for MAINTENANCE_IN and MAINTENANCE_OUT that are mentioned wrt to persistent registration and reservation status for the SCSI Initiator Port.

---
 include/scsi/scsi.h |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)
include/scsi/scsi.h +28 -0
index 216af85..1651fef 100644
@@ -115,33 +115,61 @@ struct scsi_cmnd;
 #define PERSISTENT_RESERVE_OUT 0x5f
 #define VARIABLE_LENGTH_CMD   0x7f
 #define REPORT_LUNS           0xa0
+#define SECURITY_PROTOCOL_IN  0xa2
 #define MAINTENANCE_IN        0xa3
 #define MAINTENANCE_OUT       0xa4
 #define MOVE_MEDIUM           0xa5
 #define EXCHANGE_MEDIUM       0xa6
 #define READ_12               0xa8
 #define WRITE_12              0xaa
+#define READ_MEDIA_SERIAL_NUMBER 0xab
 #define WRITE_VERIFY_12       0xae
 #define VERIFY_12	      0xaf
 #define SEARCH_HIGH_12        0xb0
 #define SEARCH_EQUAL_12       0xb1
 #define SEARCH_LOW_12         0xb2
+#define SECURITY_PROTOCOL_OUT 0xb5
 #define READ_ELEMENT_STATUS   0xb8
 #define SEND_VOLUME_TAG       0xb6
 #define WRITE_LONG_2          0xea
+#define EXTENDED_COPY         0x83
+#define RECEIVE_COPY_RESULTS  0x84
+#define ACCESS_CONTROL_IN     0x86
+#define ACCESS_CONTROL_OUT    0x87
 #define READ_16               0x88
 #define WRITE_16              0x8a
+#define READ_ATTRIBUTE        0x8c
+#define WRITE_ATTRIBUTE	      0x8d
 #define VERIFY_16	      0x8f
 #define WRITE_SAME_16	      0x93
 #define SERVICE_ACTION_IN     0x9e
 /* values for service action in */
 #define	SAI_READ_CAPACITY_16  0x10
 #define SAI_GET_LBA_STATUS    0x12
+/* values for VARIABLE_LENGTH_CMD service action codes
+ * see spc4r17 Section D.3.5, table D.7 and D.8 */
+#define VLC_SA_RECEIVE_CREDENTIAL 0x1800
 /* values for maintenance in */
+#define MI_REPORT_IDENTIFYING_INFORMATION 0x05
 #define MI_REPORT_TARGET_PGS  0x0a
+#define MI_REPORT_ALIASES     0x0b
+#define MI_REPORT_SUPPORTED_OPERATION_CODES 0x0c
+#define MI_REPORT_SUPPORTED_TASK_MANAGEMENT_FUNCTIONS 0x0d
+#define MI_REPORT_PRIORITY   0x0e
+#define MI_REPORT_TIMESTAMP  0x0f
+#define MI_MANAGEMENT_PROTOCOL_IN 0x10
 /* values for maintenance out */
+#define MO_SET_IDENTIFYING_INFORMATION 0x06
 #define MO_SET_TARGET_PGS     0x0a
+#define MO_CHANGE_ALIASES     0x0b
+#define MO_SET_PRIORITY       0x0e
+#define MO_SET_TIMESTAMP      0x0f
+#define MO_MANAGEMENT_PROTOCOL_OUT 0x10
 /* values for variable length command */
+#define XDREAD_32	      0x03
+#define XDWRITE_32	      0x04
+#define XPWRITE_32	      0x06
+#define XDWRITEREAD_32	      0x07
 #define READ_32		      0x09
 #define VERIFY_32	      0x0a
 #define WRITE_32	      0x0b
Signature · 1 line
1.7.3.4
#2 lore raw

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

In reply to Nicholas A. Bellinger

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/Kconfig                         |    2 +
 drivers/target/Makefile                        |    3 +
 drivers/target/tcm_loop/Kconfig                |   11 +
 drivers/target/tcm_loop/Makefile               |   11 +
 drivers/target/tcm_loop/tcm_loop_configfs.c    |  647 ++++++++++++++++++++++++
 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      |  474 +++++++++++++++++
 drivers/target/tcm_loop/tcm_loop_fabric.h      |   40 ++
 drivers/target/tcm_loop/tcm_loop_fabric_scsi.c |  605 ++++++++++++++++++++++
 drivers/target/tcm_loop/tcm_loop_fabric_scsi.h |   10 +
 11 files changed, 1882 insertions(+), 0 deletions(-)
 create mode 100644 drivers/target/tcm_loop/Kconfig
 create mode 100644 drivers/target/tcm_loop/Makefile
 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/Kconfig +2 -0
index 21fadd1..3d6ae0f 100644
@@ -28,4 +28,6 @@ config TCM_PSCSI
 	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"
+
 endif
drivers/target/Makefile +3 -0
index 5cfd708..6127872 100644
@@ -22,3 +22,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/tcm_loop/Kconfig new file +11 -0
new file mode 100644
index 0000000..633aaf4
@@ -0,0 +1,11 @@
+config TCM_LOOP_FABRIC
+	tristate "TCM Virtual SAS target and Linux/SCSI LDD fabric loopback module"
+	help
+	Say Y here to enable the TCM Virtual SAS target and Linux/SCSI LLD
+	fabric loopback module.
+
+config TCM_LOOP_CDB_DEBUG
+	bool "TCM loopback fabric module CDB debug code"
+	depends on TCM_LOOP_FABRIC
+	help
+	Say Y here to enable the TCM loopback fabric module CDB debug code
drivers/target/tcm_loop/Makefile new file +11 -0
new file mode 100644
index 0000000..d5088ec
@@ -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-y			:= 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/tcm_loop_configfs.c new file +647 -0

647 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 +474 -0

474 lines not on this page · raw message

drivers/target/tcm_loop/tcm_loop_fabric.h new file +40 -0
new file mode 100644
index 0000000..45af1f9
@@ -0,0 +1,40 @@
+extern char *tcm_loop_get_fabric_name(void);
+extern u8 tcm_loop_get_fabric_proto_ident(struct se_portal_group *);
+extern char *tcm_loop_get_endpoint_wwn(struct se_portal_group *);
+extern u16 tcm_loop_get_tag(struct se_portal_group *);
+extern u32 tcm_loop_get_default_depth(struct se_portal_group *);
+extern u32 tcm_loop_get_pr_transport_id(struct se_portal_group *, struct se_node_acl *,
+				struct t10_pr_registration *, int *,
+				unsigned char *);
+extern u32 tcm_loop_get_pr_transport_id_len(struct se_portal_group *,
+				struct se_node_acl *, struct t10_pr_registration *,
+				int *);
+extern char *tcm_loop_parse_pr_out_transport_id(struct se_portal_group *,
+				const char *, u32 *, char **);
+extern int tcm_loop_check_demo_mode(struct se_portal_group *);
+extern int tcm_loop_check_demo_mode_cache(struct se_portal_group *);
+extern int tcm_loop_check_demo_mode_write_protect(struct se_portal_group *);
+extern int tcm_loop_check_prod_mode_write_protect(struct se_portal_group *);
+extern struct se_node_acl *tcm_loop_tpg_alloc_fabric_acl(
+				struct se_portal_group *);
+void tcm_loop_tpg_release_fabric_acl(struct se_portal_group *, struct se_node_acl *);
+extern u32 tcm_loop_get_inst_index(struct se_portal_group *);
+extern void tcm_loop_new_cmd_failure(struct se_cmd *);
+extern int tcm_loop_is_state_remove(struct se_cmd *);
+extern int tcm_loop_sess_logged_in(struct se_session *);
+extern u32 tcm_loop_sess_get_index(struct se_session *);
+extern void tcm_loop_set_default_node_attributes(struct se_node_acl *);
+extern u32 tcm_loop_get_task_tag(struct se_cmd *);
+extern int tcm_loop_get_cmd_state(struct se_cmd *);
+extern int tcm_loop_shutdown_session(struct se_session *);
+extern void tcm_loop_close_session(struct se_session *);
+extern void tcm_loop_stop_session(struct se_session *, int, int);
+extern void tcm_loop_fall_back_to_erl0(struct se_session *);
+extern int tcm_loop_write_pending(struct se_cmd *);
+extern int tcm_loop_write_pending_status(struct se_cmd *);
+extern int tcm_loop_queue_data_in(struct se_cmd *);
+extern int tcm_loop_queue_status(struct se_cmd *);
+extern int tcm_loop_queue_tm_rsp(struct se_cmd *);
+extern u16 tcm_loop_set_fabric_sense_len(struct se_cmd *, u32);
+extern u16 tcm_loop_get_fabric_sense_len(void);
+extern u64 tcm_loop_pack_lun(unsigned int);
drivers/target/tcm_loop/tcm_loop_fabric_scsi.c new file +605 -0

605 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.4