aboutsummaryrefslogtreecommitdiffstats
path: root/include/target
diff options
context:
space:
mode:
Diffstat (limited to 'include/target')
-rw-r--r--include/target/target_core_device.h63
-rw-r--r--include/target/target_core_fabric_lib.h28
-rw-r--r--include/target/target_core_fabric_ops.h98
-rw-r--r--include/target/target_core_tmr.h35
-rw-r--r--include/target/target_core_tpg.h35
-rw-r--r--include/target/target_core_transport.h355
6 files changed, 614 insertions, 0 deletions
diff --git a/include/target/target_core_device.h b/include/target/target_core_device.h
new file mode 100644
index 00000000000..46571912086
--- /dev/null
+++ b/include/target/target_core_device.h
@@ -0,0 +1,63 @@
1#ifndef TARGET_CORE_DEVICE_H
2#define TARGET_CORE_DEVICE_H
3
4extern int transport_lookup_cmd_lun(struct se_cmd *, u32);
5extern int transport_lookup_tmr_lun(struct se_cmd *, u32);
6extern struct se_dev_entry *core_get_se_deve_from_rtpi(
7 struct se_node_acl *, u16);
8extern int core_free_device_list_for_node(struct se_node_acl *,
9 struct se_portal_group *);
10extern void core_dec_lacl_count(struct se_node_acl *, struct se_cmd *);
11extern void core_update_device_list_access(u32, u32, struct se_node_acl *);
12extern int core_update_device_list_for_node(struct se_lun *, struct se_lun_acl *, u32,
13 u32, struct se_node_acl *,
14 struct se_portal_group *, int);
15extern void core_clear_lun_from_tpg(struct se_lun *, struct se_portal_group *);
16extern int core_dev_export(struct se_device *, struct se_portal_group *,
17 struct se_lun *);
18extern void core_dev_unexport(struct se_device *, struct se_portal_group *,
19 struct se_lun *);
20extern int transport_core_report_lun_response(struct se_cmd *);
21extern void se_release_device_for_hba(struct se_device *);
22extern void se_release_vpd_for_dev(struct se_device *);
23extern void se_clear_dev_ports(struct se_device *);
24extern int se_free_virtual_device(struct se_device *, struct se_hba *);
25extern int se_dev_check_online(struct se_device *);
26extern int se_dev_check_shutdown(struct se_device *);
27extern void se_dev_set_default_attribs(struct se_device *, struct se_dev_limits *);
28extern int se_dev_set_task_timeout(struct se_device *, u32);
29extern int se_dev_set_max_unmap_lba_count(struct se_device *, u32);
30extern int se_dev_set_max_unmap_block_desc_count(struct se_device *, u32);
31extern int se_dev_set_unmap_granularity(struct se_device *, u32);
32extern int se_dev_set_unmap_granularity_alignment(struct se_device *, u32);
33extern int se_dev_set_emulate_dpo(struct se_device *, int);
34extern int se_dev_set_emulate_fua_write(struct se_device *, int);
35extern int se_dev_set_emulate_fua_read(struct se_device *, int);
36extern int se_dev_set_emulate_write_cache(struct se_device *, int);
37extern int se_dev_set_emulate_ua_intlck_ctrl(struct se_device *, int);
38extern int se_dev_set_emulate_tas(struct se_device *, int);
39extern int se_dev_set_emulate_tpu(struct se_device *, int);
40extern int se_dev_set_emulate_tpws(struct se_device *, int);
41extern int se_dev_set_enforce_pr_isids(struct se_device *, int);
42extern int se_dev_set_is_nonrot(struct se_device *, int);
43extern int se_dev_set_emulate_rest_reord(struct se_device *dev, int);
44extern int se_dev_set_queue_depth(struct se_device *, u32);
45extern int se_dev_set_max_sectors(struct se_device *, u32);
46extern int se_dev_set_optimal_sectors(struct se_device *, u32);
47extern int se_dev_set_block_size(struct se_device *, u32);
48extern struct se_lun *core_dev_add_lun(struct se_portal_group *, struct se_hba *,
49 struct se_device *, u32);
50extern int core_dev_del_lun(struct se_portal_group *, u32);
51extern struct se_lun *core_get_lun_from_tpg(struct se_portal_group *, u32);
52extern struct se_lun_acl *core_dev_init_initiator_node_lun_acl(struct se_portal_group *,
53 u32, char *, int *);
54extern int core_dev_add_initiator_node_lun_acl(struct se_portal_group *,
55 struct se_lun_acl *, u32, u32);
56extern int core_dev_del_initiator_node_lun_acl(struct se_portal_group *,
57 struct se_lun *, struct se_lun_acl *);
58extern void core_dev_free_initiator_node_lun_acl(struct se_portal_group *,
59 struct se_lun_acl *lacl);
60extern int core_dev_setup_virtual_lun0(void);
61extern void core_dev_release_virtual_lun0(void);
62
63#endif /* TARGET_CORE_DEVICE_H */
diff --git a/include/target/target_core_fabric_lib.h b/include/target/target_core_fabric_lib.h
new file mode 100644
index 00000000000..c2f8d0e3a03
--- /dev/null
+++ b/include/target/target_core_fabric_lib.h
@@ -0,0 +1,28 @@
1#ifndef TARGET_CORE_FABRIC_LIB_H
2#define TARGET_CORE_FABRIC_LIB_H
3
4extern u8 sas_get_fabric_proto_ident(struct se_portal_group *);
5extern u32 sas_get_pr_transport_id(struct se_portal_group *, struct se_node_acl *,
6 struct t10_pr_registration *, int *, unsigned char *);
7extern u32 sas_get_pr_transport_id_len(struct se_portal_group *, struct se_node_acl *,
8 struct t10_pr_registration *, int *);
9extern char *sas_parse_pr_out_transport_id(struct se_portal_group *,
10 const char *, u32 *, char **);
11
12extern u8 fc_get_fabric_proto_ident(struct se_portal_group *);
13extern u32 fc_get_pr_transport_id(struct se_portal_group *, struct se_node_acl *,
14 struct t10_pr_registration *, int *, unsigned char *);
15extern u32 fc_get_pr_transport_id_len(struct se_portal_group *, struct se_node_acl *,
16 struct t10_pr_registration *, int *);
17extern char *fc_parse_pr_out_transport_id(struct se_portal_group *,
18 const char *, u32 *, char **);
19
20extern u8 iscsi_get_fabric_proto_ident(struct se_portal_group *);
21extern u32 iscsi_get_pr_transport_id(struct se_portal_group *, struct se_node_acl *,
22 struct t10_pr_registration *, int *, unsigned char *);
23extern u32 iscsi_get_pr_transport_id_len(struct se_portal_group *, struct se_node_acl *,
24 struct t10_pr_registration *, int *);
25extern char *iscsi_parse_pr_out_transport_id(struct se_portal_group *,
26 const char *, u32 *, char **);
27
28#endif /* TARGET_CORE_FABRIC_LIB_H */
diff --git a/include/target/target_core_fabric_ops.h b/include/target/target_core_fabric_ops.h
new file mode 100644
index 00000000000..126c675f4f1
--- /dev/null
+++ b/include/target/target_core_fabric_ops.h
@@ -0,0 +1,98 @@
1/* Defined in target_core_configfs.h */
2struct target_fabric_configfs;
3
4struct target_core_fabric_ops {
5 struct configfs_subsystem *tf_subsys;
6 /*
7 * Optional to signal struct se_task->task_sg[] padding entries
8 * for scatterlist chaining using transport_do_task_sg_link(),
9 * disabled by default
10 */
11 bool task_sg_chaining;
12 char *(*get_fabric_name)(void);
13 u8 (*get_fabric_proto_ident)(struct se_portal_group *);
14 char *(*tpg_get_wwn)(struct se_portal_group *);
15 u16 (*tpg_get_tag)(struct se_portal_group *);
16 u32 (*tpg_get_default_depth)(struct se_portal_group *);
17 u32 (*tpg_get_pr_transport_id)(struct se_portal_group *,
18 struct se_node_acl *,
19 struct t10_pr_registration *, int *,
20 unsigned char *);
21 u32 (*tpg_get_pr_transport_id_len)(struct se_portal_group *,
22 struct se_node_acl *,
23 struct t10_pr_registration *, int *);
24 char *(*tpg_parse_pr_out_transport_id)(struct se_portal_group *,
25 const char *, u32 *, char **);
26 int (*tpg_check_demo_mode)(struct se_portal_group *);
27 int (*tpg_check_demo_mode_cache)(struct se_portal_group *);
28 int (*tpg_check_demo_mode_write_protect)(struct se_portal_group *);
29 int (*tpg_check_prod_mode_write_protect)(struct se_portal_group *);
30 /*
31 * Optionally used by fabrics to allow demo-mode login, but not
32 * expose any TPG LUNs, and return 'not connected' in standard
33 * inquiry response
34 */
35 int (*tpg_check_demo_mode_login_only)(struct se_portal_group *);
36 struct se_node_acl *(*tpg_alloc_fabric_acl)(
37 struct se_portal_group *);
38 void (*tpg_release_fabric_acl)(struct se_portal_group *,
39 struct se_node_acl *);
40 u32 (*tpg_get_inst_index)(struct se_portal_group *);
41 /*
42 * Optional function pointer for TCM to perform command map
43 * from TCM processing thread context, for those struct se_cmd
44 * initially allocated in interrupt context.
45 */
46 int (*new_cmd_map)(struct se_cmd *);
47 /*
48 * Optional to release struct se_cmd and fabric dependent allocated
49 * I/O descriptor in transport_cmd_check_stop()
50 */
51 void (*check_stop_free)(struct se_cmd *);
52 void (*release_cmd)(struct se_cmd *);
53 /*
54 * Called with spin_lock_bh(struct se_portal_group->session_lock held.
55 */
56 int (*shutdown_session)(struct se_session *);
57 void (*close_session)(struct se_session *);
58 void (*stop_session)(struct se_session *, int, int);
59 void (*fall_back_to_erl0)(struct se_session *);
60 int (*sess_logged_in)(struct se_session *);
61 u32 (*sess_get_index)(struct se_session *);
62 /*
63 * Used only for SCSI fabrics that contain multi-value TransportIDs
64 * (like iSCSI). All other SCSI fabrics should set this to NULL.
65 */
66 u32 (*sess_get_initiator_sid)(struct se_session *,
67 unsigned char *, u32);
68 int (*write_pending)(struct se_cmd *);
69 int (*write_pending_status)(struct se_cmd *);
70 void (*set_default_node_attributes)(struct se_node_acl *);
71 u32 (*get_task_tag)(struct se_cmd *);
72 int (*get_cmd_state)(struct se_cmd *);
73 int (*queue_data_in)(struct se_cmd *);
74 int (*queue_status)(struct se_cmd *);
75 int (*queue_tm_rsp)(struct se_cmd *);
76 u16 (*set_fabric_sense_len)(struct se_cmd *, u32);
77 u16 (*get_fabric_sense_len)(void);
78 int (*is_state_remove)(struct se_cmd *);
79 /*
80 * fabric module calls for target_core_fabric_configfs.c
81 */
82 struct se_wwn *(*fabric_make_wwn)(struct target_fabric_configfs *,
83 struct config_group *, const char *);
84 void (*fabric_drop_wwn)(struct se_wwn *);
85 struct se_portal_group *(*fabric_make_tpg)(struct se_wwn *,
86 struct config_group *, const char *);
87 void (*fabric_drop_tpg)(struct se_portal_group *);
88 int (*fabric_post_link)(struct se_portal_group *,
89 struct se_lun *);
90 void (*fabric_pre_unlink)(struct se_portal_group *,
91 struct se_lun *);
92 struct se_tpg_np *(*fabric_make_np)(struct se_portal_group *,
93 struct config_group *, const char *);
94 void (*fabric_drop_np)(struct se_tpg_np *);
95 struct se_node_acl *(*fabric_make_nodeacl)(struct se_portal_group *,
96 struct config_group *, const char *);
97 void (*fabric_drop_nodeacl)(struct se_node_acl *);
98};
diff --git a/include/target/target_core_tmr.h b/include/target/target_core_tmr.h
new file mode 100644
index 00000000000..bd559680747
--- /dev/null
+++ b/include/target/target_core_tmr.h
@@ -0,0 +1,35 @@
1#ifndef TARGET_CORE_TMR_H
2#define TARGET_CORE_TMR_H
3
4/* fabric independent task management function values */
5enum tcm_tmreq_table {
6 TMR_ABORT_TASK = 1,
7 TMR_ABORT_TASK_SET = 2,
8 TMR_CLEAR_ACA = 3,
9 TMR_CLEAR_TASK_SET = 4,
10 TMR_LUN_RESET = 5,
11 TMR_TARGET_WARM_RESET = 6,
12 TMR_TARGET_COLD_RESET = 7,
13 TMR_FABRIC_TMR = 255,
14};
15
16/* fabric independent task management response values */
17enum tcm_tmrsp_table {
18 TMR_FUNCTION_COMPLETE = 0,
19 TMR_TASK_DOES_NOT_EXIST = 1,
20 TMR_LUN_DOES_NOT_EXIST = 2,
21 TMR_TASK_STILL_ALLEGIANT = 3,
22 TMR_TASK_FAILOVER_NOT_SUPPORTED = 4,
23 TMR_TASK_MGMT_FUNCTION_NOT_SUPPORTED = 5,
24 TMR_FUNCTION_AUTHORIZATION_FAILED = 6,
25 TMR_FUNCTION_REJECTED = 255,
26};
27
28extern struct kmem_cache *se_tmr_req_cache;
29
30extern struct se_tmr_req *core_tmr_alloc_req(struct se_cmd *, void *, u8);
31extern void core_tmr_release_req(struct se_tmr_req *);
32extern int core_tmr_lun_reset(struct se_device *, struct se_tmr_req *,
33 struct list_head *, struct se_cmd *);
34
35#endif /* TARGET_CORE_TMR_H */
diff --git a/include/target/target_core_tpg.h b/include/target/target_core_tpg.h
new file mode 100644
index 00000000000..77e18729c4c
--- /dev/null
+++ b/include/target/target_core_tpg.h
@@ -0,0 +1,35 @@
1#ifndef TARGET_CORE_TPG_H
2#define TARGET_CORE_TPG_H
3
4extern struct se_node_acl *__core_tpg_get_initiator_node_acl(struct se_portal_group *tpg,
5 const char *);
6extern struct se_node_acl *core_tpg_get_initiator_node_acl(struct se_portal_group *tpg,
7 unsigned char *);
8extern void core_tpg_add_node_to_devs(struct se_node_acl *,
9 struct se_portal_group *);
10extern struct se_node_acl *core_tpg_check_initiator_node_acl(
11 struct se_portal_group *,
12 unsigned char *);
13extern void core_tpg_wait_for_nacl_pr_ref(struct se_node_acl *);
14extern void core_tpg_wait_for_mib_ref(struct se_node_acl *);
15extern void core_tpg_clear_object_luns(struct se_portal_group *);
16extern struct se_node_acl *core_tpg_add_initiator_node_acl(
17 struct se_portal_group *,
18 struct se_node_acl *,
19 const char *, u32);
20extern int core_tpg_del_initiator_node_acl(struct se_portal_group *,
21 struct se_node_acl *, int);
22extern int core_tpg_set_initiator_node_queue_depth(struct se_portal_group *,
23 unsigned char *, u32, int);
24extern int core_tpg_register(struct target_core_fabric_ops *,
25 struct se_wwn *,
26 struct se_portal_group *, void *,
27 int);
28extern int core_tpg_deregister(struct se_portal_group *);
29extern struct se_lun *core_tpg_pre_addlun(struct se_portal_group *, u32);
30extern int core_tpg_post_addlun(struct se_portal_group *, struct se_lun *, u32,
31 void *);
32extern struct se_lun *core_tpg_pre_dellun(struct se_portal_group *, u32, int *);
33extern int core_tpg_post_dellun(struct se_portal_group *, struct se_lun *);
34
35#endif /* TARGET_CORE_TPG_H */
diff --git a/include/target/target_core_transport.h b/include/target/target_core_transport.h
new file mode 100644
index 00000000000..46aae4f94ed
--- /dev/null
+++ b/include/target/target_core_transport.h
@@ -0,0 +1,355 @@
1#ifndef TARGET_CORE_TRANSPORT_H
2#define TARGET_CORE_TRANSPORT_H
3
4#define TARGET_CORE_VERSION TARGET_CORE_MOD_VERSION
5
6/* Attempts before moving from SHORT to LONG */
7#define PYX_TRANSPORT_WINDOW_CLOSED_THRESHOLD 3
8#define PYX_TRANSPORT_WINDOW_CLOSED_WAIT_SHORT 3 /* In milliseconds */
9#define PYX_TRANSPORT_WINDOW_CLOSED_WAIT_LONG 10 /* In milliseconds */
10
11#define PYX_TRANSPORT_STATUS_INTERVAL 5 /* In seconds */
12
13#define PYX_TRANSPORT_SENT_TO_TRANSPORT 0
14#define PYX_TRANSPORT_WRITE_PENDING 1
15
16#define PYX_TRANSPORT_UNKNOWN_SAM_OPCODE -1
17#define PYX_TRANSPORT_HBA_QUEUE_FULL -2
18#define PYX_TRANSPORT_REQ_TOO_MANY_SECTORS -3
19#define PYX_TRANSPORT_OUT_OF_MEMORY_RESOURCES -4
20#define PYX_TRANSPORT_INVALID_CDB_FIELD -5
21#define PYX_TRANSPORT_INVALID_PARAMETER_LIST -6
22#define PYX_TRANSPORT_LU_COMM_FAILURE -7
23#define PYX_TRANSPORT_UNKNOWN_MODE_PAGE -8
24#define PYX_TRANSPORT_WRITE_PROTECTED -9
25#define PYX_TRANSPORT_TASK_TIMEOUT -10
26#define PYX_TRANSPORT_RESERVATION_CONFLICT -11
27#define PYX_TRANSPORT_ILLEGAL_REQUEST -12
28#define PYX_TRANSPORT_USE_SENSE_REASON -13
29
30#ifndef SAM_STAT_RESERVATION_CONFLICT
31#define SAM_STAT_RESERVATION_CONFLICT 0x18
32#endif
33
34#define TRANSPORT_PLUGIN_FREE 0
35#define TRANSPORT_PLUGIN_REGISTERED 1
36
37#define TRANSPORT_PLUGIN_PHBA_PDEV 1
38#define TRANSPORT_PLUGIN_VHBA_PDEV 2
39#define TRANSPORT_PLUGIN_VHBA_VDEV 3
40
41/* For SE OBJ Plugins, in seconds */
42#define TRANSPORT_TIMEOUT_TUR 10
43#define TRANSPORT_TIMEOUT_TYPE_DISK 60
44#define TRANSPORT_TIMEOUT_TYPE_ROM 120
45#define TRANSPORT_TIMEOUT_TYPE_TAPE 600
46#define TRANSPORT_TIMEOUT_TYPE_OTHER 300
47
48/* For se_task->task_state_flags */
49#define TSF_EXCEPTION_CLEARED 0x01
50
51/*
52 * struct se_subsystem_dev->su_dev_flags
53*/
54#define SDF_FIRMWARE_VPD_UNIT_SERIAL 0x00000001
55#define SDF_EMULATED_VPD_UNIT_SERIAL 0x00000002
56#define SDF_USING_UDEV_PATH 0x00000004
57#define SDF_USING_ALIAS 0x00000008
58
59/*
60 * struct se_device->dev_flags
61 */
62#define DF_READ_ONLY 0x00000001
63#define DF_SPC2_RESERVATIONS 0x00000002
64#define DF_SPC2_RESERVATIONS_WITH_ISID 0x00000004
65
66/* struct se_dev_attrib sanity values */
67/* 10 Minutes */
68#define DA_TASK_TIMEOUT_MAX 600
69/* Default max_unmap_lba_count */
70#define DA_MAX_UNMAP_LBA_COUNT 0
71/* Default max_unmap_block_desc_count */
72#define DA_MAX_UNMAP_BLOCK_DESC_COUNT 0
73/* Default unmap_granularity */
74#define DA_UNMAP_GRANULARITY_DEFAULT 0
75/* Default unmap_granularity_alignment */
76#define DA_UNMAP_GRANULARITY_ALIGNMENT_DEFAULT 0
77/* Emulation for Direct Page Out */
78#define DA_EMULATE_DPO 0
79/* Emulation for Forced Unit Access WRITEs */
80#define DA_EMULATE_FUA_WRITE 1
81/* Emulation for Forced Unit Access READs */
82#define DA_EMULATE_FUA_READ 0
83/* Emulation for WriteCache and SYNCHRONIZE_CACHE */
84#define DA_EMULATE_WRITE_CACHE 0
85/* Emulation for UNIT ATTENTION Interlock Control */
86#define DA_EMULATE_UA_INTLLCK_CTRL 0
87/* Emulation for TASK_ABORTED status (TAS) by default */
88#define DA_EMULATE_TAS 1
89/* Emulation for Thin Provisioning UNMAP using block/blk-lib.c:blkdev_issue_discard() */
90#define DA_EMULATE_TPU 0
91/*
92 * Emulation for Thin Provisioning WRITE_SAME w/ UNMAP=1 bit using
93 * block/blk-lib.c:blkdev_issue_discard()
94 */
95#define DA_EMULATE_TPWS 0
96/* No Emulation for PSCSI by default */
97#define DA_EMULATE_RESERVATIONS 0
98/* No Emulation for PSCSI by default */
99#define DA_EMULATE_ALUA 0
100/* Enforce SCSI Initiator Port TransportID with 'ISID' for PR */
101#define DA_ENFORCE_PR_ISIDS 1
102#define DA_STATUS_MAX_SECTORS_MIN 16
103#define DA_STATUS_MAX_SECTORS_MAX 8192
104/* By default don't report non-rotating (solid state) medium */
105#define DA_IS_NONROT 0
106/* Queue Algorithm Modifier default for restricted reordering in control mode page */
107#define DA_EMULATE_REST_REORD 0
108
109#define SE_MODE_PAGE_BUF 512
110
111#define MOD_MAX_SECTORS(ms, bs) (ms % (PAGE_SIZE / bs))
112
113struct se_mem;
114struct se_subsystem_api;
115
116extern struct kmem_cache *se_mem_cache;
117
118extern int init_se_kmem_caches(void);
119extern void release_se_kmem_caches(void);
120extern u32 scsi_get_new_index(scsi_index_t);
121extern void transport_init_queue_obj(struct se_queue_obj *);
122extern int transport_subsystem_check_init(void);
123extern int transport_subsystem_register(struct se_subsystem_api *);
124extern void transport_subsystem_release(struct se_subsystem_api *);
125extern void transport_load_plugins(void);
126extern struct se_session *transport_init_session(void);
127extern void __transport_register_session(struct se_portal_group *,
128 struct se_node_acl *,
129 struct se_session *, void *);
130extern void transport_register_session(struct se_portal_group *,
131 struct se_node_acl *,
132 struct se_session *, void *);
133extern void transport_free_session(struct se_session *);
134extern void transport_deregister_session_configfs(struct se_session *);
135extern void transport_deregister_session(struct se_session *);
136extern void transport_cmd_finish_abort(struct se_cmd *, int);
137extern void transport_cmd_finish_abort_tmr(struct se_cmd *);
138extern void transport_complete_sync_cache(struct se_cmd *, int);
139extern void transport_complete_task(struct se_task *, int);
140extern void transport_add_task_to_execute_queue(struct se_task *,
141 struct se_task *,
142 struct se_device *);
143extern void transport_remove_task_from_execute_queue(struct se_task *,
144 struct se_device *);
145unsigned char *transport_dump_cmd_direction(struct se_cmd *);
146extern void transport_dump_dev_state(struct se_device *, char *, int *);
147extern void transport_dump_dev_info(struct se_device *, struct se_lun *,
148 unsigned long long, char *, int *);
149extern void transport_dump_vpd_proto_id(struct t10_vpd *,
150 unsigned char *, int);
151extern void transport_set_vpd_proto_id(struct t10_vpd *, unsigned char *);
152extern int transport_dump_vpd_assoc(struct t10_vpd *,
153 unsigned char *, int);
154extern int transport_set_vpd_assoc(struct t10_vpd *, unsigned char *);
155extern int transport_dump_vpd_ident_type(struct t10_vpd *,
156 unsigned char *, int);
157extern int transport_set_vpd_ident_type(struct t10_vpd *, unsigned char *);
158extern int transport_dump_vpd_ident(struct t10_vpd *,
159 unsigned char *, int);
160extern int transport_set_vpd_ident(struct t10_vpd *, unsigned char *);
161extern struct se_device *transport_add_device_to_core_hba(struct se_hba *,
162 struct se_subsystem_api *,
163 struct se_subsystem_dev *, u32,
164 void *, struct se_dev_limits *,
165 const char *, const char *);
166extern void transport_init_se_cmd(struct se_cmd *,
167 struct target_core_fabric_ops *,
168 struct se_session *, u32, int, int,
169 unsigned char *);
170void *transport_kmap_first_data_page(struct se_cmd *cmd);
171void transport_kunmap_first_data_page(struct se_cmd *cmd);
172extern void transport_free_se_cmd(struct se_cmd *);
173extern int transport_generic_allocate_tasks(struct se_cmd *, unsigned char *);
174extern int transport_generic_handle_cdb(struct se_cmd *);
175extern int transport_handle_cdb_direct(struct se_cmd *);
176extern int transport_generic_handle_cdb_map(struct se_cmd *);
177extern int transport_generic_handle_data(struct se_cmd *);
178extern void transport_new_cmd_failure(struct se_cmd *);
179extern int transport_generic_handle_tmr(struct se_cmd *);
180extern void transport_generic_free_cmd_intr(struct se_cmd *);
181extern void __transport_stop_task_timer(struct se_task *, unsigned long *);
182extern int transport_generic_map_mem_to_cmd(struct se_cmd *cmd, struct scatterlist *, u32,
183 struct scatterlist *, u32);
184extern int transport_clear_lun_from_sessions(struct se_lun *);
185extern int transport_check_aborted_status(struct se_cmd *, int);
186extern int transport_send_check_condition_and_sense(struct se_cmd *, u8, int);
187extern void transport_send_task_abort(struct se_cmd *);
188extern void transport_release_cmd(struct se_cmd *);
189extern void transport_generic_free_cmd(struct se_cmd *, int, int);
190extern void transport_generic_wait_for_cmds(struct se_cmd *, int);
191extern int transport_init_task_sg(struct se_task *, struct se_mem *, u32);
192extern int transport_map_mem_to_sg(struct se_task *, struct list_head *,
193 struct scatterlist *, struct se_mem *,
194 struct se_mem **, u32 *, u32 *);
195extern void transport_do_task_sg_chain(struct se_cmd *);
196extern void transport_generic_process_write(struct se_cmd *);
197extern int transport_generic_new_cmd(struct se_cmd *);
198extern int transport_generic_do_tmr(struct se_cmd *);
199/* From target_core_alua.c */
200extern int core_alua_check_nonop_delay(struct se_cmd *);
201/* From target_core_cdb.c */
202extern int transport_emulate_control_cdb(struct se_task *);
203
204/*
205 * Each se_transport_task_t can have N number of possible struct se_task's
206 * for the storage transport(s) to possibly execute.
207 * Used primarily for splitting up CDBs that exceed the physical storage
208 * HBA's maximum sector count per task.
209 */
210struct se_mem {
211 struct page *se_page;
212 u32 se_len;
213 u32 se_off;
214 struct list_head se_list;
215} ____cacheline_aligned;
216
217/*
218 * Each type of disk transport supported MUST have a template defined
219 * within its .h file.
220 */
221struct se_subsystem_api {
222 /*
223 * The Name. :-)
224 */
225 char name[16];
226 /*
227 * Transport Type.
228 */
229 u8 transport_type;
230 /*
231 * struct module for struct se_hba references
232 */
233 struct module *owner;
234 /*
235 * Used for global se_subsystem_api list_head
236 */
237 struct list_head sub_api_list;
238 /*
239 * For SCF_SCSI_NON_DATA_CDB
240 */
241 int (*cdb_none)(struct se_task *);
242 /*
243 * For SCF_SCSI_DATA_SG_IO_CDB
244 */
245 int (*map_data_SG)(struct se_task *);
246 /*
247 * For SCF_SCSI_CONTROL_SG_IO_CDB
248 */
249 int (*map_control_SG)(struct se_task *);
250 /*
251 * attach_hba():
252 */
253 int (*attach_hba)(struct se_hba *, u32);
254 /*
255 * detach_hba():
256 */
257 void (*detach_hba)(struct se_hba *);
258 /*
259 * pmode_hba(): Used for TCM/pSCSI subsystem plugin HBA ->
260 * Linux/SCSI struct Scsi_Host passthrough
261 */
262 int (*pmode_enable_hba)(struct se_hba *, unsigned long);
263 /*
264 * allocate_virtdevice():
265 */
266 void *(*allocate_virtdevice)(struct se_hba *, const char *);
267 /*
268 * create_virtdevice(): Only for Virtual HBAs
269 */
270 struct se_device *(*create_virtdevice)(struct se_hba *,
271 struct se_subsystem_dev *, void *);
272 /*
273 * free_device():
274 */
275 void (*free_device)(void *);
276
277 /*
278 * dpo_emulated():
279 */
280 int (*dpo_emulated)(struct se_device *);
281 /*
282 * fua_write_emulated():
283 */
284 int (*fua_write_emulated)(struct se_device *);
285 /*
286 * fua_read_emulated():
287 */
288 int (*fua_read_emulated)(struct se_device *);
289 /*
290 * write_cache_emulated():
291 */
292 int (*write_cache_emulated)(struct se_device *);
293 /*
294 * transport_complete():
295 *
296 * Use transport_generic_complete() for majority of DAS transport
297 * drivers. Provided out of convenience.
298 */
299 int (*transport_complete)(struct se_task *task);
300 struct se_task *(*alloc_task)(unsigned char *cdb);
301 /*
302 * do_task():
303 */
304 int (*do_task)(struct se_task *);
305 /*
306 * Used by virtual subsystem plugins IBLOCK and FILEIO to emulate
307 * UNMAP and WRITE_SAME_* w/ UNMAP=1 <-> Linux/Block Discard
308 */
309 int (*do_discard)(struct se_device *, sector_t, u32);
310 /*
311 * Used by virtual subsystem plugins IBLOCK and FILEIO to emulate
312 * SYNCHRONIZE_CACHE_* <-> Linux/Block blkdev_issue_flush()
313 */
314 void (*do_sync_cache)(struct se_task *);
315 /*
316 * free_task():
317 */
318 void (*free_task)(struct se_task *);
319 /*
320 * check_configfs_dev_params():
321 */
322 ssize_t (*check_configfs_dev_params)(struct se_hba *, struct se_subsystem_dev *);
323 /*
324 * set_configfs_dev_params():
325 */
326 ssize_t (*set_configfs_dev_params)(struct se_hba *, struct se_subsystem_dev *,
327 const char *, ssize_t);
328 /*
329 * show_configfs_dev_params():
330 */
331 ssize_t (*show_configfs_dev_params)(struct se_hba *, struct se_subsystem_dev *,
332 char *);
333 /*
334 * get_cdb():
335 */
336 unsigned char *(*get_cdb)(struct se_task *);
337 /*
338 * get_device_rev():
339 */
340 u32 (*get_device_rev)(struct se_device *);
341 /*
342 * get_device_type():
343 */
344 u32 (*get_device_type)(struct se_device *);
345 /*
346 * Get the sector_t from a subsystem backstore..
347 */
348 sector_t (*get_blocks)(struct se_device *);
349 /*
350 * get_sense_buffer():
351 */
352 unsigned char *(*get_sense_buffer)(struct se_task *);
353} ____cacheline_aligned;
354
355#endif /* TARGET_CORE_TRANSPORT_H */