diff options
| author | Christoph Hellwig <hch@infradead.org> | 2011-11-16 09:46:48 -0500 |
|---|---|---|
| committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2011-12-14 06:26:05 -0500 |
| commit | c4795fb20edf2fe2c862c8fe9f8b681edeb79ac1 (patch) | |
| tree | 506a8cb0a12ea2b56c5ebed5e6bc2a0d842c069d /include/target | |
| parent | e26d99aed42ec6cdc9540d19c77ac5d4dd2c5b00 (diff) | |
target: header reshuffle, part2
This reorganized the headers under include/target into:
- target_core_base.h stays as is with all target-wide data stuctures and defines
- target_core_backend.h contains the whole interface to I/O backends
- target_core_fabric.h contains the whole interface to fabric modules
Except for those only the various configfs macro headers stay around.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'include/target')
| -rw-r--r-- | include/target/target_core_backend.h | 65 | ||||
| -rw-r--r-- | include/target/target_core_base.h | 91 | ||||
| -rw-r--r-- | include/target/target_core_device.h | 9 | ||||
| -rw-r--r-- | include/target/target_core_fabric.h (renamed from include/target/target_core_fabric_ops.h) | 88 | ||||
| -rw-r--r-- | include/target/target_core_fabric_lib.h | 28 | ||||
| -rw-r--r-- | include/target/target_core_tmr.h | 31 | ||||
| -rw-r--r-- | include/target/target_core_tpg.h | 22 | ||||
| -rw-r--r-- | include/target/target_core_transport.h | 256 |
8 files changed, 242 insertions, 348 deletions
diff --git a/include/target/target_core_backend.h b/include/target/target_core_backend.h new file mode 100644 index 000000000000..4866499bdeeb --- /dev/null +++ b/include/target/target_core_backend.h | |||
| @@ -0,0 +1,65 @@ | |||
| 1 | #ifndef TARGET_CORE_BACKEND_H | ||
| 2 | #define TARGET_CORE_BACKEND_H | ||
| 3 | |||
| 4 | #define TRANSPORT_PLUGIN_PHBA_PDEV 1 | ||
| 5 | #define TRANSPORT_PLUGIN_VHBA_PDEV 2 | ||
| 6 | #define TRANSPORT_PLUGIN_VHBA_VDEV 3 | ||
| 7 | |||
| 8 | struct se_subsystem_api { | ||
| 9 | struct list_head sub_api_list; | ||
| 10 | |||
| 11 | char name[16]; | ||
| 12 | struct module *owner; | ||
| 13 | |||
| 14 | u8 transport_type; | ||
| 15 | |||
| 16 | unsigned int fua_write_emulated : 1; | ||
| 17 | unsigned int write_cache_emulated : 1; | ||
| 18 | |||
| 19 | int (*attach_hba)(struct se_hba *, u32); | ||
| 20 | void (*detach_hba)(struct se_hba *); | ||
| 21 | int (*pmode_enable_hba)(struct se_hba *, unsigned long); | ||
| 22 | void *(*allocate_virtdevice)(struct se_hba *, const char *); | ||
| 23 | struct se_device *(*create_virtdevice)(struct se_hba *, | ||
| 24 | struct se_subsystem_dev *, void *); | ||
| 25 | void (*free_device)(void *); | ||
| 26 | int (*transport_complete)(struct se_task *task); | ||
| 27 | struct se_task *(*alloc_task)(unsigned char *cdb); | ||
| 28 | int (*do_task)(struct se_task *); | ||
| 29 | int (*do_discard)(struct se_device *, sector_t, u32); | ||
| 30 | void (*do_sync_cache)(struct se_task *); | ||
| 31 | void (*free_task)(struct se_task *); | ||
| 32 | ssize_t (*check_configfs_dev_params)(struct se_hba *, | ||
| 33 | struct se_subsystem_dev *); | ||
| 34 | ssize_t (*set_configfs_dev_params)(struct se_hba *, | ||
| 35 | struct se_subsystem_dev *, const char *, ssize_t); | ||
| 36 | ssize_t (*show_configfs_dev_params)(struct se_hba *, | ||
| 37 | struct se_subsystem_dev *, char *); | ||
| 38 | u32 (*get_device_rev)(struct se_device *); | ||
| 39 | u32 (*get_device_type)(struct se_device *); | ||
| 40 | sector_t (*get_blocks)(struct se_device *); | ||
| 41 | unsigned char *(*get_sense_buffer)(struct se_task *); | ||
| 42 | }; | ||
| 43 | |||
| 44 | int transport_subsystem_register(struct se_subsystem_api *); | ||
| 45 | void transport_subsystem_release(struct se_subsystem_api *); | ||
| 46 | |||
| 47 | struct se_device *transport_add_device_to_core_hba(struct se_hba *, | ||
| 48 | struct se_subsystem_api *, struct se_subsystem_dev *, u32, | ||
| 49 | void *, struct se_dev_limits *, const char *, const char *); | ||
| 50 | |||
| 51 | void transport_complete_sync_cache(struct se_cmd *, int); | ||
| 52 | void transport_complete_task(struct se_task *, int); | ||
| 53 | |||
| 54 | void target_get_task_cdb(struct se_task *, unsigned char *); | ||
| 55 | |||
| 56 | void transport_set_vpd_proto_id(struct t10_vpd *, unsigned char *); | ||
| 57 | int transport_set_vpd_assoc(struct t10_vpd *, unsigned char *); | ||
| 58 | int transport_set_vpd_ident_type(struct t10_vpd *, unsigned char *); | ||
| 59 | int transport_set_vpd_ident(struct t10_vpd *, unsigned char *); | ||
| 60 | |||
| 61 | /* core helpers also used by command snooping in pscsi */ | ||
| 62 | void *transport_kmap_first_data_page(struct se_cmd *); | ||
| 63 | void transport_kunmap_first_data_page(struct se_cmd *); | ||
| 64 | |||
| 65 | #endif /* TARGET_CORE_BACKEND_H */ | ||
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index 6873c7dd9145..1d90fb33e60b 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | #include <net/tcp.h> | 10 | #include <net/tcp.h> |
| 11 | 11 | ||
| 12 | #define TARGET_CORE_MOD_VERSION "v4.1.0-rc1-ml" | 12 | #define TARGET_CORE_MOD_VERSION "v4.1.0-rc1-ml" |
| 13 | #define TARGET_CORE_VERSION TARGET_CORE_MOD_VERSION | ||
| 13 | 14 | ||
| 14 | /* Maximum Number of LUNs per Target Portal Group */ | 15 | /* Maximum Number of LUNs per Target Portal Group */ |
| 15 | /* Don't raise above 511 or REPORT_LUNS needs to handle >1 page */ | 16 | /* Don't raise above 511 or REPORT_LUNS needs to handle >1 page */ |
| @@ -53,6 +54,72 @@ | |||
| 53 | /* Used by transport_get_inquiry_vpd_device_ident() */ | 54 | /* Used by transport_get_inquiry_vpd_device_ident() */ |
| 54 | #define INQUIRY_VPD_DEVICE_IDENTIFIER_LEN 254 | 55 | #define INQUIRY_VPD_DEVICE_IDENTIFIER_LEN 254 |
| 55 | 56 | ||
| 57 | /* Attempts before moving from SHORT to LONG */ | ||
| 58 | #define PYX_TRANSPORT_WINDOW_CLOSED_THRESHOLD 3 | ||
| 59 | #define PYX_TRANSPORT_WINDOW_CLOSED_WAIT_SHORT 3 /* In milliseconds */ | ||
| 60 | #define PYX_TRANSPORT_WINDOW_CLOSED_WAIT_LONG 10 /* In milliseconds */ | ||
| 61 | |||
| 62 | #define PYX_TRANSPORT_STATUS_INTERVAL 5 /* In seconds */ | ||
| 63 | |||
| 64 | /* | ||
| 65 | * struct se_subsystem_dev->su_dev_flags | ||
| 66 | */ | ||
| 67 | #define SDF_FIRMWARE_VPD_UNIT_SERIAL 0x00000001 | ||
| 68 | #define SDF_EMULATED_VPD_UNIT_SERIAL 0x00000002 | ||
| 69 | #define SDF_USING_UDEV_PATH 0x00000004 | ||
| 70 | #define SDF_USING_ALIAS 0x00000008 | ||
| 71 | |||
| 72 | /* | ||
| 73 | * struct se_device->dev_flags | ||
| 74 | */ | ||
| 75 | #define DF_READ_ONLY 0x00000001 | ||
| 76 | #define DF_SPC2_RESERVATIONS 0x00000002 | ||
| 77 | #define DF_SPC2_RESERVATIONS_WITH_ISID 0x00000004 | ||
| 78 | |||
| 79 | /* struct se_dev_attrib sanity values */ | ||
| 80 | /* Default max_unmap_lba_count */ | ||
| 81 | #define DA_MAX_UNMAP_LBA_COUNT 0 | ||
| 82 | /* Default max_unmap_block_desc_count */ | ||
| 83 | #define DA_MAX_UNMAP_BLOCK_DESC_COUNT 0 | ||
| 84 | /* Default unmap_granularity */ | ||
| 85 | #define DA_UNMAP_GRANULARITY_DEFAULT 0 | ||
| 86 | /* Default unmap_granularity_alignment */ | ||
| 87 | #define DA_UNMAP_GRANULARITY_ALIGNMENT_DEFAULT 0 | ||
| 88 | /* Emulation for Direct Page Out */ | ||
| 89 | #define DA_EMULATE_DPO 0 | ||
| 90 | /* Emulation for Forced Unit Access WRITEs */ | ||
| 91 | #define DA_EMULATE_FUA_WRITE 1 | ||
| 92 | /* Emulation for Forced Unit Access READs */ | ||
| 93 | #define DA_EMULATE_FUA_READ 0 | ||
| 94 | /* Emulation for WriteCache and SYNCHRONIZE_CACHE */ | ||
| 95 | #define DA_EMULATE_WRITE_CACHE 0 | ||
| 96 | /* Emulation for UNIT ATTENTION Interlock Control */ | ||
| 97 | #define DA_EMULATE_UA_INTLLCK_CTRL 0 | ||
| 98 | /* Emulation for TASK_ABORTED status (TAS) by default */ | ||
| 99 | #define DA_EMULATE_TAS 1 | ||
| 100 | /* Emulation for Thin Provisioning UNMAP using block/blk-lib.c:blkdev_issue_discard() */ | ||
| 101 | #define DA_EMULATE_TPU 0 | ||
| 102 | /* | ||
| 103 | * Emulation for Thin Provisioning WRITE_SAME w/ UNMAP=1 bit using | ||
| 104 | * block/blk-lib.c:blkdev_issue_discard() | ||
| 105 | */ | ||
| 106 | #define DA_EMULATE_TPWS 0 | ||
| 107 | /* No Emulation for PSCSI by default */ | ||
| 108 | #define DA_EMULATE_RESERVATIONS 0 | ||
| 109 | /* No Emulation for PSCSI by default */ | ||
| 110 | #define DA_EMULATE_ALUA 0 | ||
| 111 | /* Enforce SCSI Initiator Port TransportID with 'ISID' for PR */ | ||
| 112 | #define DA_ENFORCE_PR_ISIDS 1 | ||
| 113 | #define DA_STATUS_MAX_SECTORS_MIN 16 | ||
| 114 | #define DA_STATUS_MAX_SECTORS_MAX 8192 | ||
| 115 | /* By default don't report non-rotating (solid state) medium */ | ||
| 116 | #define DA_IS_NONROT 0 | ||
| 117 | /* Queue Algorithm Modifier default for restricted reordering in control mode page */ | ||
| 118 | #define DA_EMULATE_REST_REORD 0 | ||
| 119 | |||
| 120 | #define SE_MODE_PAGE_BUF 512 | ||
| 121 | |||
| 122 | |||
| 56 | /* struct se_hba->hba_flags */ | 123 | /* struct se_hba->hba_flags */ |
| 57 | enum hba_flags_table { | 124 | enum hba_flags_table { |
| 58 | HBA_FLAGS_INTERNAL_USE = 0x01, | 125 | HBA_FLAGS_INTERNAL_USE = 0x01, |
| @@ -158,6 +225,30 @@ enum tcm_sense_reason_table { | |||
| 158 | TCM_RESERVATION_CONFLICT = 0x10, | 225 | TCM_RESERVATION_CONFLICT = 0x10, |
| 159 | }; | 226 | }; |
| 160 | 227 | ||
| 228 | /* fabric independent task management function values */ | ||
| 229 | enum tcm_tmreq_table { | ||
| 230 | TMR_ABORT_TASK = 1, | ||
| 231 | TMR_ABORT_TASK_SET = 2, | ||
| 232 | TMR_CLEAR_ACA = 3, | ||
| 233 | TMR_CLEAR_TASK_SET = 4, | ||
| 234 | TMR_LUN_RESET = 5, | ||
| 235 | TMR_TARGET_WARM_RESET = 6, | ||
| 236 | TMR_TARGET_COLD_RESET = 7, | ||
| 237 | TMR_FABRIC_TMR = 255, | ||
| 238 | }; | ||
| 239 | |||
| 240 | /* fabric independent task management response values */ | ||
| 241 | enum tcm_tmrsp_table { | ||
| 242 | TMR_FUNCTION_COMPLETE = 0, | ||
| 243 | TMR_TASK_DOES_NOT_EXIST = 1, | ||
| 244 | TMR_LUN_DOES_NOT_EXIST = 2, | ||
| 245 | TMR_TASK_STILL_ALLEGIANT = 3, | ||
| 246 | TMR_TASK_FAILOVER_NOT_SUPPORTED = 4, | ||
| 247 | TMR_TASK_MGMT_FUNCTION_NOT_SUPPORTED = 5, | ||
| 248 | TMR_FUNCTION_AUTHORIZATION_FAILED = 6, | ||
| 249 | TMR_FUNCTION_REJECTED = 255, | ||
| 250 | }; | ||
| 251 | |||
| 161 | struct se_obj { | 252 | struct se_obj { |
| 162 | atomic_t obj_access_count; | 253 | atomic_t obj_access_count; |
| 163 | } ____cacheline_aligned; | 254 | } ____cacheline_aligned; |
diff --git a/include/target/target_core_device.h b/include/target/target_core_device.h deleted file mode 100644 index c6123a49014d..000000000000 --- a/include/target/target_core_device.h +++ /dev/null | |||
| @@ -1,9 +0,0 @@ | |||
| 1 | #ifndef TARGET_CORE_DEVICE_H | ||
| 2 | #define TARGET_CORE_DEVICE_H | ||
| 3 | |||
| 4 | |||
| 5 | // external | ||
| 6 | extern int transport_lookup_cmd_lun(struct se_cmd *, u32); | ||
| 7 | extern int transport_lookup_tmr_lun(struct se_cmd *, u32); | ||
| 8 | |||
| 9 | #endif /* TARGET_CORE_DEVICE_H */ | ||
diff --git a/include/target/target_core_fabric_ops.h b/include/target/target_core_fabric.h index 0256825f923d..d035d865dbef 100644 --- a/include/target/target_core_fabric_ops.h +++ b/include/target/target_core_fabric.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* Defined in target_core_configfs.h */ | 1 | #ifndef TARGET_CORE_FABRIC_H |
| 2 | struct target_fabric_configfs; | 2 | #define TARGET_CORE_FABRIC_H |
| 3 | 3 | ||
| 4 | struct target_core_fabric_ops { | 4 | struct target_core_fabric_ops { |
| 5 | struct configfs_subsystem *tf_subsys; | 5 | struct configfs_subsystem *tf_subsys; |
| @@ -103,3 +103,87 @@ struct target_core_fabric_ops { | |||
| 103 | struct config_group *, const char *); | 103 | struct config_group *, const char *); |
| 104 | void (*fabric_drop_nodeacl)(struct se_node_acl *); | 104 | void (*fabric_drop_nodeacl)(struct se_node_acl *); |
| 105 | }; | 105 | }; |
| 106 | |||
| 107 | struct se_session *transport_init_session(void); | ||
| 108 | void __transport_register_session(struct se_portal_group *, | ||
| 109 | struct se_node_acl *, struct se_session *, void *); | ||
| 110 | void transport_register_session(struct se_portal_group *, | ||
| 111 | struct se_node_acl *, struct se_session *, void *); | ||
| 112 | void transport_free_session(struct se_session *); | ||
| 113 | void transport_deregister_session_configfs(struct se_session *); | ||
| 114 | void transport_deregister_session(struct se_session *); | ||
| 115 | |||
| 116 | |||
| 117 | void transport_init_se_cmd(struct se_cmd *, struct target_core_fabric_ops *, | ||
| 118 | struct se_session *, u32, int, int, unsigned char *); | ||
| 119 | int transport_lookup_cmd_lun(struct se_cmd *, u32); | ||
| 120 | int transport_generic_allocate_tasks(struct se_cmd *, unsigned char *); | ||
| 121 | int transport_handle_cdb_direct(struct se_cmd *); | ||
| 122 | int transport_generic_handle_cdb_map(struct se_cmd *); | ||
| 123 | int transport_generic_handle_data(struct se_cmd *); | ||
| 124 | int transport_generic_map_mem_to_cmd(struct se_cmd *cmd, | ||
| 125 | struct scatterlist *, u32, struct scatterlist *, u32); | ||
| 126 | void transport_do_task_sg_chain(struct se_cmd *); | ||
| 127 | int transport_generic_new_cmd(struct se_cmd *); | ||
| 128 | |||
| 129 | void transport_generic_process_write(struct se_cmd *); | ||
| 130 | |||
| 131 | void transport_generic_free_cmd(struct se_cmd *, int); | ||
| 132 | |||
| 133 | bool transport_wait_for_tasks(struct se_cmd *); | ||
| 134 | int transport_check_aborted_status(struct se_cmd *, int); | ||
| 135 | int transport_send_check_condition_and_sense(struct se_cmd *, u8, int); | ||
| 136 | |||
| 137 | void target_get_sess_cmd(struct se_session *, struct se_cmd *); | ||
| 138 | int target_put_sess_cmd(struct se_session *, struct se_cmd *); | ||
| 139 | void target_splice_sess_cmd_list(struct se_session *); | ||
| 140 | void target_wait_for_sess_cmds(struct se_session *, int); | ||
| 141 | |||
| 142 | int core_alua_check_nonop_delay(struct se_cmd *); | ||
| 143 | |||
| 144 | struct se_tmr_req *core_tmr_alloc_req(struct se_cmd *, void *, u8, gfp_t); | ||
| 145 | void core_tmr_release_req(struct se_tmr_req *); | ||
| 146 | int transport_generic_handle_tmr(struct se_cmd *); | ||
| 147 | int transport_lookup_tmr_lun(struct se_cmd *, u32); | ||
| 148 | |||
| 149 | struct se_node_acl *core_tpg_check_initiator_node_acl(struct se_portal_group *, | ||
| 150 | unsigned char *); | ||
| 151 | void core_tpg_clear_object_luns(struct se_portal_group *); | ||
| 152 | struct se_node_acl *core_tpg_add_initiator_node_acl(struct se_portal_group *, | ||
| 153 | struct se_node_acl *, const char *, u32); | ||
| 154 | int core_tpg_del_initiator_node_acl(struct se_portal_group *, | ||
| 155 | struct se_node_acl *, int); | ||
| 156 | int core_tpg_set_initiator_node_queue_depth(struct se_portal_group *, | ||
| 157 | unsigned char *, u32, int); | ||
| 158 | int core_tpg_register(struct target_core_fabric_ops *, struct se_wwn *, | ||
| 159 | struct se_portal_group *, void *, int); | ||
| 160 | int core_tpg_deregister(struct se_portal_group *); | ||
| 161 | |||
| 162 | /* SAS helpers */ | ||
| 163 | u8 sas_get_fabric_proto_ident(struct se_portal_group *); | ||
| 164 | u32 sas_get_pr_transport_id(struct se_portal_group *, struct se_node_acl *, | ||
| 165 | struct t10_pr_registration *, int *, unsigned char *); | ||
| 166 | u32 sas_get_pr_transport_id_len(struct se_portal_group *, struct se_node_acl *, | ||
| 167 | struct t10_pr_registration *, int *); | ||
| 168 | char *sas_parse_pr_out_transport_id(struct se_portal_group *, const char *, | ||
| 169 | u32 *, char **); | ||
| 170 | |||
| 171 | /* FC helpers */ | ||
| 172 | u8 fc_get_fabric_proto_ident(struct se_portal_group *); | ||
| 173 | u32 fc_get_pr_transport_id(struct se_portal_group *, struct se_node_acl *, | ||
| 174 | struct t10_pr_registration *, int *, unsigned char *); | ||
| 175 | u32 fc_get_pr_transport_id_len(struct se_portal_group *, struct se_node_acl *, | ||
| 176 | struct t10_pr_registration *, int *); | ||
| 177 | char *fc_parse_pr_out_transport_id(struct se_portal_group *, const char *, | ||
| 178 | u32 *, char **); | ||
| 179 | |||
| 180 | /* iSCSI helpers */ | ||
| 181 | u8 iscsi_get_fabric_proto_ident(struct se_portal_group *); | ||
| 182 | u32 iscsi_get_pr_transport_id(struct se_portal_group *, struct se_node_acl *, | ||
| 183 | struct t10_pr_registration *, int *, unsigned char *); | ||
| 184 | u32 iscsi_get_pr_transport_id_len(struct se_portal_group *, struct se_node_acl *, | ||
| 185 | struct t10_pr_registration *, int *); | ||
| 186 | char *iscsi_parse_pr_out_transport_id(struct se_portal_group *, const char *, | ||
| 187 | u32 *, char **); | ||
| 188 | |||
| 189 | #endif /* TARGET_CORE_FABRICH */ | ||
diff --git a/include/target/target_core_fabric_lib.h b/include/target/target_core_fabric_lib.h deleted file mode 100644 index c2f8d0e3a03b..000000000000 --- a/include/target/target_core_fabric_lib.h +++ /dev/null | |||
| @@ -1,28 +0,0 @@ | |||
| 1 | #ifndef TARGET_CORE_FABRIC_LIB_H | ||
| 2 | #define TARGET_CORE_FABRIC_LIB_H | ||
| 3 | |||
| 4 | extern u8 sas_get_fabric_proto_ident(struct se_portal_group *); | ||
| 5 | extern u32 sas_get_pr_transport_id(struct se_portal_group *, struct se_node_acl *, | ||
| 6 | struct t10_pr_registration *, int *, unsigned char *); | ||
| 7 | extern u32 sas_get_pr_transport_id_len(struct se_portal_group *, struct se_node_acl *, | ||
| 8 | struct t10_pr_registration *, int *); | ||
| 9 | extern char *sas_parse_pr_out_transport_id(struct se_portal_group *, | ||
| 10 | const char *, u32 *, char **); | ||
| 11 | |||
| 12 | extern u8 fc_get_fabric_proto_ident(struct se_portal_group *); | ||
| 13 | extern u32 fc_get_pr_transport_id(struct se_portal_group *, struct se_node_acl *, | ||
| 14 | struct t10_pr_registration *, int *, unsigned char *); | ||
| 15 | extern u32 fc_get_pr_transport_id_len(struct se_portal_group *, struct se_node_acl *, | ||
| 16 | struct t10_pr_registration *, int *); | ||
| 17 | extern char *fc_parse_pr_out_transport_id(struct se_portal_group *, | ||
| 18 | const char *, u32 *, char **); | ||
| 19 | |||
| 20 | extern u8 iscsi_get_fabric_proto_ident(struct se_portal_group *); | ||
| 21 | extern u32 iscsi_get_pr_transport_id(struct se_portal_group *, struct se_node_acl *, | ||
| 22 | struct t10_pr_registration *, int *, unsigned char *); | ||
| 23 | extern u32 iscsi_get_pr_transport_id_len(struct se_portal_group *, struct se_node_acl *, | ||
| 24 | struct t10_pr_registration *, int *); | ||
| 25 | extern 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_tmr.h b/include/target/target_core_tmr.h deleted file mode 100644 index 36b3e0de99b4..000000000000 --- a/include/target/target_core_tmr.h +++ /dev/null | |||
| @@ -1,31 +0,0 @@ | |||
| 1 | #ifndef TARGET_CORE_TMR_H | ||
| 2 | #define TARGET_CORE_TMR_H | ||
| 3 | |||
| 4 | /* fabric independent task management function values */ | ||
| 5 | enum 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 */ | ||
| 17 | enum 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 | |||
| 28 | extern struct se_tmr_req *core_tmr_alloc_req(struct se_cmd *, void *, u8, gfp_t); | ||
| 29 | extern void core_tmr_release_req(struct se_tmr_req *); | ||
| 30 | |||
| 31 | #endif /* TARGET_CORE_TMR_H */ | ||
diff --git a/include/target/target_core_tpg.h b/include/target/target_core_tpg.h deleted file mode 100644 index 80ae59fdada3..000000000000 --- a/include/target/target_core_tpg.h +++ /dev/null | |||
| @@ -1,22 +0,0 @@ | |||
| 1 | #ifndef TARGET_CORE_TPG_H | ||
| 2 | #define TARGET_CORE_TPG_H | ||
| 3 | |||
| 4 | extern struct se_node_acl *core_tpg_check_initiator_node_acl( | ||
| 5 | struct se_portal_group *, | ||
| 6 | unsigned char *); | ||
| 7 | extern void core_tpg_clear_object_luns(struct se_portal_group *); | ||
| 8 | extern struct se_node_acl *core_tpg_add_initiator_node_acl( | ||
| 9 | struct se_portal_group *, | ||
| 10 | struct se_node_acl *, | ||
| 11 | const char *, u32); | ||
| 12 | extern int core_tpg_del_initiator_node_acl(struct se_portal_group *, | ||
| 13 | struct se_node_acl *, int); | ||
| 14 | extern int core_tpg_set_initiator_node_queue_depth(struct se_portal_group *, | ||
| 15 | unsigned char *, u32, int); | ||
| 16 | extern int core_tpg_register(struct target_core_fabric_ops *, | ||
| 17 | struct se_wwn *, | ||
| 18 | struct se_portal_group *, void *, | ||
| 19 | int); | ||
| 20 | extern int core_tpg_deregister(struct se_portal_group *); | ||
| 21 | |||
| 22 | #endif /* TARGET_CORE_TPG_H */ | ||
diff --git a/include/target/target_core_transport.h b/include/target/target_core_transport.h deleted file mode 100644 index 68fe1f2c081c..000000000000 --- a/include/target/target_core_transport.h +++ /dev/null | |||
| @@ -1,256 +0,0 @@ | |||
| 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 TRANSPORT_PLUGIN_PHBA_PDEV 1 | ||
| 14 | #define TRANSPORT_PLUGIN_VHBA_PDEV 2 | ||
| 15 | #define TRANSPORT_PLUGIN_VHBA_VDEV 3 | ||
| 16 | |||
| 17 | /* | ||
| 18 | * struct se_subsystem_dev->su_dev_flags | ||
| 19 | */ | ||
| 20 | #define SDF_FIRMWARE_VPD_UNIT_SERIAL 0x00000001 | ||
| 21 | #define SDF_EMULATED_VPD_UNIT_SERIAL 0x00000002 | ||
| 22 | #define SDF_USING_UDEV_PATH 0x00000004 | ||
| 23 | #define SDF_USING_ALIAS 0x00000008 | ||
| 24 | |||
| 25 | /* | ||
| 26 | * struct se_device->dev_flags | ||
| 27 | */ | ||
| 28 | #define DF_READ_ONLY 0x00000001 | ||
| 29 | #define DF_SPC2_RESERVATIONS 0x00000002 | ||
| 30 | #define DF_SPC2_RESERVATIONS_WITH_ISID 0x00000004 | ||
| 31 | |||
| 32 | /* struct se_dev_attrib sanity values */ | ||
| 33 | /* Default max_unmap_lba_count */ | ||
| 34 | #define DA_MAX_UNMAP_LBA_COUNT 0 | ||
| 35 | /* Default max_unmap_block_desc_count */ | ||
| 36 | #define DA_MAX_UNMAP_BLOCK_DESC_COUNT 0 | ||
| 37 | /* Default unmap_granularity */ | ||
| 38 | #define DA_UNMAP_GRANULARITY_DEFAULT 0 | ||
| 39 | /* Default unmap_granularity_alignment */ | ||
| 40 | #define DA_UNMAP_GRANULARITY_ALIGNMENT_DEFAULT 0 | ||
| 41 | /* Emulation for Direct Page Out */ | ||
| 42 | #define DA_EMULATE_DPO 0 | ||
| 43 | /* Emulation for Forced Unit Access WRITEs */ | ||
| 44 | #define DA_EMULATE_FUA_WRITE 1 | ||
| 45 | /* Emulation for Forced Unit Access READs */ | ||
| 46 | #define DA_EMULATE_FUA_READ 0 | ||
| 47 | /* Emulation for WriteCache and SYNCHRONIZE_CACHE */ | ||
| 48 | #define DA_EMULATE_WRITE_CACHE 0 | ||
| 49 | /* Emulation for UNIT ATTENTION Interlock Control */ | ||
| 50 | #define DA_EMULATE_UA_INTLLCK_CTRL 0 | ||
| 51 | /* Emulation for TASK_ABORTED status (TAS) by default */ | ||
| 52 | #define DA_EMULATE_TAS 1 | ||
| 53 | /* Emulation for Thin Provisioning UNMAP using block/blk-lib.c:blkdev_issue_discard() */ | ||
| 54 | #define DA_EMULATE_TPU 0 | ||
| 55 | /* | ||
| 56 | * Emulation for Thin Provisioning WRITE_SAME w/ UNMAP=1 bit using | ||
| 57 | * block/blk-lib.c:blkdev_issue_discard() | ||
| 58 | */ | ||
| 59 | #define DA_EMULATE_TPWS 0 | ||
| 60 | /* No Emulation for PSCSI by default */ | ||
| 61 | #define DA_EMULATE_RESERVATIONS 0 | ||
| 62 | /* No Emulation for PSCSI by default */ | ||
| 63 | #define DA_EMULATE_ALUA 0 | ||
| 64 | /* Enforce SCSI Initiator Port TransportID with 'ISID' for PR */ | ||
| 65 | #define DA_ENFORCE_PR_ISIDS 1 | ||
| 66 | #define DA_STATUS_MAX_SECTORS_MIN 16 | ||
| 67 | #define DA_STATUS_MAX_SECTORS_MAX 8192 | ||
| 68 | /* By default don't report non-rotating (solid state) medium */ | ||
| 69 | #define DA_IS_NONROT 0 | ||
| 70 | /* Queue Algorithm Modifier default for restricted reordering in control mode page */ | ||
| 71 | #define DA_EMULATE_REST_REORD 0 | ||
| 72 | |||
| 73 | #define SE_MODE_PAGE_BUF 512 | ||
| 74 | |||
| 75 | #define MOD_MAX_SECTORS(ms, bs) (ms % (PAGE_SIZE / bs)) | ||
| 76 | |||
| 77 | struct se_subsystem_api; | ||
| 78 | |||
| 79 | extern int transport_subsystem_register(struct se_subsystem_api *); | ||
| 80 | extern void transport_subsystem_release(struct se_subsystem_api *); | ||
| 81 | extern struct se_session *transport_init_session(void); | ||
| 82 | extern void __transport_register_session(struct se_portal_group *, | ||
| 83 | struct se_node_acl *, | ||
| 84 | struct se_session *, void *); | ||
| 85 | extern void transport_register_session(struct se_portal_group *, | ||
| 86 | struct se_node_acl *, | ||
| 87 | struct se_session *, void *); | ||
| 88 | extern void transport_free_session(struct se_session *); | ||
| 89 | extern void transport_deregister_session_configfs(struct se_session *); | ||
| 90 | extern void transport_deregister_session(struct se_session *); | ||
| 91 | extern void transport_complete_sync_cache(struct se_cmd *, int); | ||
| 92 | extern void transport_complete_task(struct se_task *, int); | ||
| 93 | |||
| 94 | extern void transport_set_vpd_proto_id(struct t10_vpd *, unsigned char *); | ||
| 95 | extern int transport_set_vpd_assoc(struct t10_vpd *, unsigned char *); | ||
| 96 | extern int transport_set_vpd_ident_type(struct t10_vpd *, unsigned char *); | ||
| 97 | extern int transport_set_vpd_ident(struct t10_vpd *, unsigned char *); | ||
| 98 | |||
| 99 | extern struct se_device *transport_add_device_to_core_hba(struct se_hba *, | ||
| 100 | struct se_subsystem_api *, | ||
| 101 | struct se_subsystem_dev *, u32, | ||
| 102 | void *, struct se_dev_limits *, | ||
| 103 | const char *, const char *); | ||
| 104 | extern void transport_init_se_cmd(struct se_cmd *, | ||
| 105 | struct target_core_fabric_ops *, | ||
| 106 | struct se_session *, u32, int, int, | ||
| 107 | unsigned char *); | ||
| 108 | void *transport_kmap_first_data_page(struct se_cmd *cmd); | ||
| 109 | void transport_kunmap_first_data_page(struct se_cmd *cmd); | ||
| 110 | extern int transport_generic_allocate_tasks(struct se_cmd *, unsigned char *); | ||
| 111 | extern int transport_handle_cdb_direct(struct se_cmd *); | ||
| 112 | extern int transport_generic_handle_cdb_map(struct se_cmd *); | ||
| 113 | extern int transport_generic_handle_data(struct se_cmd *); | ||
| 114 | extern int transport_generic_handle_tmr(struct se_cmd *); | ||
| 115 | extern int transport_generic_map_mem_to_cmd(struct se_cmd *cmd, struct scatterlist *, u32, | ||
| 116 | struct scatterlist *, u32); | ||
| 117 | extern bool transport_wait_for_tasks(struct se_cmd *); | ||
| 118 | extern int transport_check_aborted_status(struct se_cmd *, int); | ||
| 119 | extern int transport_send_check_condition_and_sense(struct se_cmd *, u8, int); | ||
| 120 | extern void transport_generic_free_cmd(struct se_cmd *, int); | ||
| 121 | extern void target_get_sess_cmd(struct se_session *, struct se_cmd *); | ||
| 122 | extern int target_put_sess_cmd(struct se_session *, struct se_cmd *); | ||
| 123 | extern void target_splice_sess_cmd_list(struct se_session *); | ||
| 124 | extern void target_wait_for_sess_cmds(struct se_session *, int); | ||
| 125 | extern void transport_do_task_sg_chain(struct se_cmd *); | ||
| 126 | extern void transport_generic_process_write(struct se_cmd *); | ||
| 127 | extern int transport_generic_new_cmd(struct se_cmd *); | ||
| 128 | /* From target_core_alua.c */ | ||
| 129 | extern int core_alua_check_nonop_delay(struct se_cmd *); | ||
| 130 | /* From target_core_cdb.c */ | ||
| 131 | extern void target_get_task_cdb(struct se_task *task, unsigned char *cdb); | ||
| 132 | |||
| 133 | /* | ||
| 134 | * Each se_transport_task_t can have N number of possible struct se_task's | ||
| 135 | * for the storage transport(s) to possibly execute. | ||
| 136 | * Used primarily for splitting up CDBs that exceed the physical storage | ||
| 137 | * HBA's maximum sector count per task. | ||
| 138 | */ | ||
| 139 | struct se_mem { | ||
| 140 | struct page *se_page; | ||
| 141 | u32 se_len; | ||
| 142 | u32 se_off; | ||
| 143 | struct list_head se_list; | ||
| 144 | } ____cacheline_aligned; | ||
| 145 | |||
| 146 | /* | ||
| 147 | * Each type of disk transport supported MUST have a template defined | ||
| 148 | * within its .h file. | ||
| 149 | */ | ||
| 150 | struct se_subsystem_api { | ||
| 151 | /* | ||
| 152 | * The Name. :-) | ||
| 153 | */ | ||
| 154 | char name[16]; | ||
| 155 | /* | ||
| 156 | * Transport Type. | ||
| 157 | */ | ||
| 158 | u8 transport_type; | ||
| 159 | |||
| 160 | unsigned int fua_write_emulated : 1; | ||
| 161 | unsigned int write_cache_emulated : 1; | ||
| 162 | |||
| 163 | /* | ||
| 164 | * struct module for struct se_hba references | ||
| 165 | */ | ||
| 166 | struct module *owner; | ||
| 167 | /* | ||
| 168 | * Used for global se_subsystem_api list_head | ||
| 169 | */ | ||
| 170 | struct list_head sub_api_list; | ||
| 171 | /* | ||
| 172 | * attach_hba(): | ||
| 173 | */ | ||
| 174 | int (*attach_hba)(struct se_hba *, u32); | ||
| 175 | /* | ||
| 176 | * detach_hba(): | ||
| 177 | */ | ||
| 178 | void (*detach_hba)(struct se_hba *); | ||
| 179 | /* | ||
| 180 | * pmode_hba(): Used for TCM/pSCSI subsystem plugin HBA -> | ||
| 181 | * Linux/SCSI struct Scsi_Host passthrough | ||
| 182 | */ | ||
| 183 | int (*pmode_enable_hba)(struct se_hba *, unsigned long); | ||
| 184 | /* | ||
| 185 | * allocate_virtdevice(): | ||
| 186 | */ | ||
| 187 | void *(*allocate_virtdevice)(struct se_hba *, const char *); | ||
| 188 | /* | ||
| 189 | * create_virtdevice(): Only for Virtual HBAs | ||
| 190 | */ | ||
| 191 | struct se_device *(*create_virtdevice)(struct se_hba *, | ||
| 192 | struct se_subsystem_dev *, void *); | ||
| 193 | /* | ||
| 194 | * free_device(): | ||
| 195 | */ | ||
| 196 | void (*free_device)(void *); | ||
| 197 | |||
| 198 | /* | ||
| 199 | * transport_complete(): | ||
| 200 | * | ||
| 201 | * Use transport_generic_complete() for majority of DAS transport | ||
| 202 | * drivers. Provided out of convenience. | ||
| 203 | */ | ||
| 204 | int (*transport_complete)(struct se_task *task); | ||
| 205 | struct se_task *(*alloc_task)(unsigned char *cdb); | ||
| 206 | /* | ||
| 207 | * do_task(): | ||
| 208 | */ | ||
| 209 | int (*do_task)(struct se_task *); | ||
| 210 | /* | ||
| 211 | * Used by virtual subsystem plugins IBLOCK and FILEIO to emulate | ||
| 212 | * UNMAP and WRITE_SAME_* w/ UNMAP=1 <-> Linux/Block Discard | ||
| 213 | */ | ||
| 214 | int (*do_discard)(struct se_device *, sector_t, u32); | ||
| 215 | /* | ||
| 216 | * Used by virtual subsystem plugins IBLOCK and FILEIO to emulate | ||
| 217 | * SYNCHRONIZE_CACHE_* <-> Linux/Block blkdev_issue_flush() | ||
| 218 | */ | ||
| 219 | void (*do_sync_cache)(struct se_task *); | ||
| 220 | /* | ||
| 221 | * free_task(): | ||
| 222 | */ | ||
| 223 | void (*free_task)(struct se_task *); | ||
| 224 | /* | ||
| 225 | * check_configfs_dev_params(): | ||
| 226 | */ | ||
| 227 | ssize_t (*check_configfs_dev_params)(struct se_hba *, struct se_subsystem_dev *); | ||
| 228 | /* | ||
| 229 | * set_configfs_dev_params(): | ||
| 230 | */ | ||
| 231 | ssize_t (*set_configfs_dev_params)(struct se_hba *, struct se_subsystem_dev *, | ||
| 232 | const char *, ssize_t); | ||
| 233 | /* | ||
| 234 | * show_configfs_dev_params(): | ||
| 235 | */ | ||
| 236 | ssize_t (*show_configfs_dev_params)(struct se_hba *, struct se_subsystem_dev *, | ||
| 237 | char *); | ||
| 238 | /* | ||
| 239 | * get_device_rev(): | ||
| 240 | */ | ||
| 241 | u32 (*get_device_rev)(struct se_device *); | ||
| 242 | /* | ||
| 243 | * get_device_type(): | ||
| 244 | */ | ||
| 245 | u32 (*get_device_type)(struct se_device *); | ||
| 246 | /* | ||
| 247 | * Get the sector_t from a subsystem backstore.. | ||
| 248 | */ | ||
| 249 | sector_t (*get_blocks)(struct se_device *); | ||
| 250 | /* | ||
| 251 | * get_sense_buffer(): | ||
| 252 | */ | ||
| 253 | unsigned char *(*get_sense_buffer)(struct se_task *); | ||
| 254 | } ____cacheline_aligned; | ||
| 255 | |||
| 256 | #endif /* TARGET_CORE_TRANSPORT_H */ | ||
