aboutsummaryrefslogtreecommitdiffstats
path: root/include/target
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-04-24 13:22:09 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-04-24 13:22:09 -0400
commitc6668726d2c2c581e6c417448c472c994d026f5f (patch)
treeccbc5a73b9dfe09a065cb5d8627aa2297e730ec0 /include/target
parent06b45f2aa703837163496f5db6a53575665cc6b4 (diff)
parent68d4cef3bab3fb9bb0dbac690ba35a96cb5a16d9 (diff)
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending
Pull SCSI target updates from Nicholas Bellinger: "Lots of activity in target land the last months. The highlights include: - Convert fabric drivers tree-wide to target_register_template() (hch + bart) - iser-target hardening fixes + v1.0 improvements (sagi) - Convert iscsi_thread_set usage to kthread.h + kill iscsi_target_tq.c (sagi + nab) - Add support for T10-PI WRITE_STRIP + READ_INSERT operation (mkp + sagi + nab) - DIF fixes for CONFIG_DEBUG_SG=y + UNMAP file emulation (akinobu + sagi + mkp) - Extended TCMU ABI v2 for future BIDI + DIF support (andy + ilias) - Fix COMPARE_AND_WRITE handling for NO_ALLLOC drivers (hch + nab) Thanks to everyone who contributed this round with new features, bug-reports, fixes, cleanups and improvements. Looking forward, it's currently shaping up to be a busy v4.2 as well" * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (69 commits) target: Put TCMU under a new config option target: Version 2 of TCMU ABI target: fix tcm_mod_builder.py target/file: Fix UNMAP with DIF protection support target/file: Fix SG table for prot_buf initialization target/file: Fix BUG() when CONFIG_DEBUG_SG=y and DIF protection enabled target: Make core_tmr_abort_task() skip TMFs target/sbc: Update sbc_dif_generate pr_debug output target/sbc: Make internal DIF emulation honor ->prot_checks target/sbc: Return INVALID_CDB_FIELD if DIF + sess_prot_type disabled target: Ensure sess_prot_type is saved across session restart target/rd: Don't pass incomplete scatterlist entries to sbc_dif_verify_* target: Remove the unused flag SCF_ACK_KREF target: Fix two sparse warnings target: Fix COMPARE_AND_WRITE with SG_TO_MEM_NOALLOC handling target: simplify the target template registration API target: simplify target_xcopy_init_pt_lun target: remove the unused SCF_CMD_XCOPY_PASSTHROUGH flag target/rd: reduce code duplication in rd_execute_rw() tcm_loop: fixup tpgt string to integer conversion ...
Diffstat (limited to 'include/target')
-rw-r--r--include/target/iscsi/iscsi_target_core.h15
-rw-r--r--include/target/target_core_base.h10
-rw-r--r--include/target/target_core_configfs.h6
-rw-r--r--include/target/target_core_fabric.h33
-rw-r--r--include/target/target_core_fabric_configfs.h5
5 files changed, 51 insertions, 18 deletions
diff --git a/include/target/iscsi/iscsi_target_core.h b/include/target/iscsi/iscsi_target_core.h
index d3583d3ee193..54e7af301888 100644
--- a/include/target/iscsi/iscsi_target_core.h
+++ b/include/target/iscsi/iscsi_target_core.h
@@ -20,6 +20,8 @@
20#define ISCSIT_MIN_TAGS 16 20#define ISCSIT_MIN_TAGS 16
21#define ISCSIT_EXTRA_TAGS 8 21#define ISCSIT_EXTRA_TAGS 8
22#define ISCSIT_TCP_BACKLOG 256 22#define ISCSIT_TCP_BACKLOG 256
23#define ISCSI_RX_THREAD_NAME "iscsi_trx"
24#define ISCSI_TX_THREAD_NAME "iscsi_ttx"
23 25
24/* struct iscsi_node_attrib sanity values */ 26/* struct iscsi_node_attrib sanity values */
25#define NA_DATAOUT_TIMEOUT 3 27#define NA_DATAOUT_TIMEOUT 3
@@ -60,6 +62,7 @@
60#define TA_CACHE_CORE_NPS 0 62#define TA_CACHE_CORE_NPS 0
61/* T10 protection information disabled by default */ 63/* T10 protection information disabled by default */
62#define TA_DEFAULT_T10_PI 0 64#define TA_DEFAULT_T10_PI 0
65#define TA_DEFAULT_FABRIC_PROT_TYPE 0
63 66
64#define ISCSI_IOV_DATA_BUFFER 5 67#define ISCSI_IOV_DATA_BUFFER 5
65 68
@@ -600,8 +603,11 @@ struct iscsi_conn {
600 struct iscsi_tpg_np *tpg_np; 603 struct iscsi_tpg_np *tpg_np;
601 /* Pointer to parent session */ 604 /* Pointer to parent session */
602 struct iscsi_session *sess; 605 struct iscsi_session *sess;
603 /* Pointer to thread_set in use for this conn's threads */ 606 int bitmap_id;
604 struct iscsi_thread_set *thread_set; 607 int rx_thread_active;
608 struct task_struct *rx_thread;
609 int tx_thread_active;
610 struct task_struct *tx_thread;
605 /* list_head for session connection list */ 611 /* list_head for session connection list */
606 struct list_head conn_list; 612 struct list_head conn_list;
607} ____cacheline_aligned; 613} ____cacheline_aligned;
@@ -767,6 +773,7 @@ struct iscsi_tpg_attrib {
767 u32 demo_mode_discovery; 773 u32 demo_mode_discovery;
768 u32 default_erl; 774 u32 default_erl;
769 u8 t10_pi; 775 u8 t10_pi;
776 u32 fabric_prot_type;
770 struct iscsi_portal_group *tpg; 777 struct iscsi_portal_group *tpg;
771}; 778};
772 779
@@ -871,10 +878,10 @@ struct iscsit_global {
871 /* Unique identifier used for the authentication daemon */ 878 /* Unique identifier used for the authentication daemon */
872 u32 auth_id; 879 u32 auth_id;
873 u32 inactive_ts; 880 u32 inactive_ts;
874 /* Thread Set bitmap count */ 881#define ISCSIT_BITMAP_BITS 262144
875 int ts_bitmap_count;
876 /* Thread Set bitmap pointer */ 882 /* Thread Set bitmap pointer */
877 unsigned long *ts_bitmap; 883 unsigned long *ts_bitmap;
884 spinlock_t ts_bitmap_lock;
878 /* Used for iSCSI discovery session authentication */ 885 /* Used for iSCSI discovery session authentication */
879 struct iscsi_node_acl discovery_acl; 886 struct iscsi_node_acl discovery_acl;
880 struct iscsi_portal_group *discovery_tpg; 887 struct iscsi_portal_group *discovery_tpg;
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index 672150b6aaf5..480e9f82dfea 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -165,10 +165,8 @@ enum se_cmd_flags_table {
165 SCF_SEND_DELAYED_TAS = 0x00004000, 165 SCF_SEND_DELAYED_TAS = 0x00004000,
166 SCF_ALUA_NON_OPTIMIZED = 0x00008000, 166 SCF_ALUA_NON_OPTIMIZED = 0x00008000,
167 SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC = 0x00020000, 167 SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC = 0x00020000,
168 SCF_ACK_KREF = 0x00040000,
169 SCF_COMPARE_AND_WRITE = 0x00080000, 168 SCF_COMPARE_AND_WRITE = 0x00080000,
170 SCF_COMPARE_AND_WRITE_POST = 0x00100000, 169 SCF_COMPARE_AND_WRITE_POST = 0x00100000,
171 SCF_CMD_XCOPY_PASSTHROUGH = 0x00200000,
172}; 170};
173 171
174/* struct se_dev_entry->lun_flags and struct se_lun->lun_access */ 172/* struct se_dev_entry->lun_flags and struct se_lun->lun_access */
@@ -520,11 +518,11 @@ struct se_cmd {
520 struct list_head se_cmd_list; 518 struct list_head se_cmd_list;
521 struct completion cmd_wait_comp; 519 struct completion cmd_wait_comp;
522 struct kref cmd_kref; 520 struct kref cmd_kref;
523 struct target_core_fabric_ops *se_tfo; 521 const struct target_core_fabric_ops *se_tfo;
524 sense_reason_t (*execute_cmd)(struct se_cmd *); 522 sense_reason_t (*execute_cmd)(struct se_cmd *);
525 sense_reason_t (*execute_rw)(struct se_cmd *, struct scatterlist *, 523 sense_reason_t (*execute_rw)(struct se_cmd *, struct scatterlist *,
526 u32, enum dma_data_direction); 524 u32, enum dma_data_direction);
527 sense_reason_t (*transport_complete_callback)(struct se_cmd *); 525 sense_reason_t (*transport_complete_callback)(struct se_cmd *, bool);
528 526
529 unsigned char *t_task_cdb; 527 unsigned char *t_task_cdb;
530 unsigned char __t_task_cdb[TCM_MAX_COMMAND_SIZE]; 528 unsigned char __t_task_cdb[TCM_MAX_COMMAND_SIZE];
@@ -591,6 +589,7 @@ struct se_node_acl {
591 bool acl_stop:1; 589 bool acl_stop:1;
592 u32 queue_depth; 590 u32 queue_depth;
593 u32 acl_index; 591 u32 acl_index;
592 enum target_prot_type saved_prot_type;
594#define MAX_ACL_TAG_SIZE 64 593#define MAX_ACL_TAG_SIZE 64
595 char acl_tag[MAX_ACL_TAG_SIZE]; 594 char acl_tag[MAX_ACL_TAG_SIZE];
596 /* Used for PR SPEC_I_PT=1 and REGISTER_AND_MOVE */ 595 /* Used for PR SPEC_I_PT=1 and REGISTER_AND_MOVE */
@@ -616,6 +615,7 @@ struct se_session {
616 unsigned sess_tearing_down:1; 615 unsigned sess_tearing_down:1;
617 u64 sess_bin_isid; 616 u64 sess_bin_isid;
618 enum target_prot_op sup_prot_ops; 617 enum target_prot_op sup_prot_ops;
618 enum target_prot_type sess_prot_type;
619 struct se_node_acl *se_node_acl; 619 struct se_node_acl *se_node_acl;
620 struct se_portal_group *se_tpg; 620 struct se_portal_group *se_tpg;
621 void *fabric_sess_ptr; 621 void *fabric_sess_ptr;
@@ -890,7 +890,7 @@ struct se_portal_group {
890 /* List of TCM sessions associated wth this TPG */ 890 /* List of TCM sessions associated wth this TPG */
891 struct list_head tpg_sess_list; 891 struct list_head tpg_sess_list;
892 /* Pointer to $FABRIC_MOD dependent code */ 892 /* Pointer to $FABRIC_MOD dependent code */
893 struct target_core_fabric_ops *se_tpg_tfo; 893 const struct target_core_fabric_ops *se_tpg_tfo;
894 struct se_wwn *se_tpg_wwn; 894 struct se_wwn *se_tpg_wwn;
895 struct config_group tpg_group; 895 struct config_group tpg_group;
896 struct config_group *tpg_default_groups[7]; 896 struct config_group *tpg_default_groups[7];
diff --git a/include/target/target_core_configfs.h b/include/target/target_core_configfs.h
index e0801386e4dc..25bb04c4209e 100644
--- a/include/target/target_core_configfs.h
+++ b/include/target/target_core_configfs.h
@@ -5,12 +5,6 @@
5#define TARGET_CORE_NAME_MAX_LEN 64 5#define TARGET_CORE_NAME_MAX_LEN 64
6#define TARGET_FABRIC_NAME_SIZE 32 6#define TARGET_FABRIC_NAME_SIZE 32
7 7
8extern struct target_fabric_configfs *target_fabric_configfs_init(
9 struct module *, const char *);
10extern void target_fabric_configfs_free(struct target_fabric_configfs *);
11extern int target_fabric_configfs_register(struct target_fabric_configfs *);
12extern void target_fabric_configfs_deregister(struct target_fabric_configfs *);
13
14struct target_fabric_configfs_template { 8struct target_fabric_configfs_template {
15 struct config_item_type tfc_discovery_cit; 9 struct config_item_type tfc_discovery_cit;
16 struct config_item_type tfc_wwn_cit; 10 struct config_item_type tfc_wwn_cit;
diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h
index 22a4e98eec80..17c7f5ac7ea0 100644
--- a/include/target/target_core_fabric.h
+++ b/include/target/target_core_fabric.h
@@ -2,6 +2,8 @@
2#define TARGET_CORE_FABRIC_H 2#define TARGET_CORE_FABRIC_H
3 3
4struct target_core_fabric_ops { 4struct target_core_fabric_ops {
5 struct module *module;
6 const char *name;
5 struct configfs_subsystem *tf_subsys; 7 struct configfs_subsystem *tf_subsys;
6 char *(*get_fabric_name)(void); 8 char *(*get_fabric_name)(void);
7 u8 (*get_fabric_proto_ident)(struct se_portal_group *); 9 u8 (*get_fabric_proto_ident)(struct se_portal_group *);
@@ -27,6 +29,14 @@ struct target_core_fabric_ops {
27 * inquiry response 29 * inquiry response
28 */ 30 */
29 int (*tpg_check_demo_mode_login_only)(struct se_portal_group *); 31 int (*tpg_check_demo_mode_login_only)(struct se_portal_group *);
32 /*
33 * Optionally used as a configfs tunable to determine when
34 * target-core should signal the PROTECT=1 feature bit for
35 * backends that don't support T10-PI, so that either fabric
36 * HW offload or target-core emulation performs the associated
37 * WRITE_STRIP and READ_INSERT operations.
38 */
39 int (*tpg_check_prot_fabric_only)(struct se_portal_group *);
30 struct se_node_acl *(*tpg_alloc_fabric_acl)( 40 struct se_node_acl *(*tpg_alloc_fabric_acl)(
31 struct se_portal_group *); 41 struct se_portal_group *);
32 void (*tpg_release_fabric_acl)(struct se_portal_group *, 42 void (*tpg_release_fabric_acl)(struct se_portal_group *,
@@ -82,8 +92,23 @@ struct target_core_fabric_ops {
82 struct se_node_acl *(*fabric_make_nodeacl)(struct se_portal_group *, 92 struct se_node_acl *(*fabric_make_nodeacl)(struct se_portal_group *,
83 struct config_group *, const char *); 93 struct config_group *, const char *);
84 void (*fabric_drop_nodeacl)(struct se_node_acl *); 94 void (*fabric_drop_nodeacl)(struct se_node_acl *);
95
96 struct configfs_attribute **tfc_discovery_attrs;
97 struct configfs_attribute **tfc_wwn_attrs;
98 struct configfs_attribute **tfc_tpg_base_attrs;
99 struct configfs_attribute **tfc_tpg_np_base_attrs;
100 struct configfs_attribute **tfc_tpg_attrib_attrs;
101 struct configfs_attribute **tfc_tpg_auth_attrs;
102 struct configfs_attribute **tfc_tpg_param_attrs;
103 struct configfs_attribute **tfc_tpg_nacl_base_attrs;
104 struct configfs_attribute **tfc_tpg_nacl_attrib_attrs;
105 struct configfs_attribute **tfc_tpg_nacl_auth_attrs;
106 struct configfs_attribute **tfc_tpg_nacl_param_attrs;
85}; 107};
86 108
109int target_register_template(const struct target_core_fabric_ops *fo);
110void target_unregister_template(const struct target_core_fabric_ops *fo);
111
87struct se_session *transport_init_session(enum target_prot_op); 112struct se_session *transport_init_session(enum target_prot_op);
88int transport_alloc_session_tags(struct se_session *, unsigned int, 113int transport_alloc_session_tags(struct se_session *, unsigned int,
89 unsigned int); 114 unsigned int);
@@ -95,13 +120,15 @@ void transport_register_session(struct se_portal_group *,
95 struct se_node_acl *, struct se_session *, void *); 120 struct se_node_acl *, struct se_session *, void *);
96void target_get_session(struct se_session *); 121void target_get_session(struct se_session *);
97void target_put_session(struct se_session *); 122void target_put_session(struct se_session *);
123ssize_t target_show_dynamic_sessions(struct se_portal_group *, char *);
98void transport_free_session(struct se_session *); 124void transport_free_session(struct se_session *);
99void target_put_nacl(struct se_node_acl *); 125void target_put_nacl(struct se_node_acl *);
100void transport_deregister_session_configfs(struct se_session *); 126void transport_deregister_session_configfs(struct se_session *);
101void transport_deregister_session(struct se_session *); 127void transport_deregister_session(struct se_session *);
102 128
103 129
104void transport_init_se_cmd(struct se_cmd *, struct target_core_fabric_ops *, 130void transport_init_se_cmd(struct se_cmd *,
131 const struct target_core_fabric_ops *,
105 struct se_session *, u32, int, int, unsigned char *); 132 struct se_session *, u32, int, int, unsigned char *);
106sense_reason_t transport_lookup_cmd_lun(struct se_cmd *, u32); 133sense_reason_t transport_lookup_cmd_lun(struct se_cmd *, u32);
107sense_reason_t target_setup_cmd_from_cdb(struct se_cmd *, unsigned char *); 134sense_reason_t target_setup_cmd_from_cdb(struct se_cmd *, unsigned char *);
@@ -153,8 +180,8 @@ int core_tpg_set_initiator_node_queue_depth(struct se_portal_group *,
153 unsigned char *, u32, int); 180 unsigned char *, u32, int);
154int core_tpg_set_initiator_node_tag(struct se_portal_group *, 181int core_tpg_set_initiator_node_tag(struct se_portal_group *,
155 struct se_node_acl *, const char *); 182 struct se_node_acl *, const char *);
156int core_tpg_register(struct target_core_fabric_ops *, struct se_wwn *, 183int core_tpg_register(const struct target_core_fabric_ops *,
157 struct se_portal_group *, void *, int); 184 struct se_wwn *, struct se_portal_group *, void *, int);
158int core_tpg_deregister(struct se_portal_group *); 185int core_tpg_deregister(struct se_portal_group *);
159 186
160/* SAS helpers */ 187/* SAS helpers */
diff --git a/include/target/target_core_fabric_configfs.h b/include/target/target_core_fabric_configfs.h
index b32a14905cfa..7a0649c09e79 100644
--- a/include/target/target_core_fabric_configfs.h
+++ b/include/target/target_core_fabric_configfs.h
@@ -90,6 +90,11 @@ static struct target_fabric_tpg_attribute _fabric##_tpg_##_name = \
90 _fabric##_tpg_store_##_name); 90 _fabric##_tpg_store_##_name);
91 91
92 92
93#define TF_TPG_BASE_ATTR_RO(_fabric, _name) \
94static struct target_fabric_tpg_attribute _fabric##_tpg_##_name = \
95 __CONFIGFS_EATTR_RO(_name, \
96 _fabric##_tpg_show_##_name);
97
93CONFIGFS_EATTR_STRUCT(target_fabric_wwn, target_fabric_configfs); 98CONFIGFS_EATTR_STRUCT(target_fabric_wwn, target_fabric_configfs);
94#define TF_WWN_ATTR(_fabric, _name, _mode) \ 99#define TF_WWN_ATTR(_fabric, _name, _mode) \
95static struct target_fabric_wwn_attribute _fabric##_wwn_##_name = \ 100static struct target_fabric_wwn_attribute _fabric##_wwn_##_name = \