diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-18 18:59:18 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-18 18:59:18 -0500 |
commit | 4ba3069fea9f0771dad3f4906b305ab50d5a1b30 (patch) | |
tree | 3f75f2c0a320a6f38538c5e63f46ef79b0b3f1d1 /include | |
parent | 507a03c1cba0e32309223d23d19a1bfc0916c140 (diff) | |
parent | 895f3022523361e9b383cf48f51feb1f7d5e7e53 (diff) |
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending
* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (26 commits)
target: Set additional sense length field in sense data
target: Remove legacy device status check from transport_execute_tasks
target: Remove __transport_execute_tasks() for each processing context
target: Remove extra se_device->execute_task_lock access in fast path
target: Drop se_device TCQ queue_depth usage from I/O path
target: Fix possible NULL pointer with __transport_execute_tasks
target: Remove TFO->check_release_cmd() fabric API caller
tcm_fc: Convert ft_send_work to use target_submit_cmd
target: Add target_submit_cmd() for process context fabric submission
target: Make target_put_sess_cmd use target_release_cmd_kref
target: Set response format in INQUIRY response
target: tcm_mod_builder: small fixups
Documentation/target: Fix tcm_mod_builder.py build breakage
target: remove overagressive ____cacheline_aligned annoations
tcm_loop: bump max_sectors
target/configs: remove trailing newline from udev_path and alias
iscsi-target: fix chap identifier simple_strtoul usage
target: remove useless casts
target: simplify target_check_cdb_and_preempt
target: Move core_scsi3_check_cdb_abort_and_preempt
...
Diffstat (limited to 'include')
-rw-r--r-- | include/target/target_core_backend.h | 65 | ||||
-rw-r--r-- | include/target/target_core_base.h | 169 | ||||
-rw-r--r-- | include/target/target_core_device.h | 63 | ||||
-rw-r--r-- | include/target/target_core_fabric.h (renamed from include/target/target_core_fabric_ops.h) | 94 | ||||
-rw-r--r-- | include/target/target_core_fabric_lib.h | 28 | ||||
-rw-r--r-- | include/target/target_core_tmr.h | 35 | ||||
-rw-r--r-- | include/target/target_core_tpg.h | 35 | ||||
-rw-r--r-- | include/target/target_core_transport.h | 287 |
8 files changed, 285 insertions, 491 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..daf532bc721a 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 */ |
@@ -34,6 +35,7 @@ | |||
34 | #define TRANSPORT_SENSE_BUFFER SCSI_SENSE_BUFFERSIZE | 35 | #define TRANSPORT_SENSE_BUFFER SCSI_SENSE_BUFFERSIZE |
35 | /* Used by transport_send_check_condition_and_sense() */ | 36 | /* Used by transport_send_check_condition_and_sense() */ |
36 | #define SPC_SENSE_KEY_OFFSET 2 | 37 | #define SPC_SENSE_KEY_OFFSET 2 |
38 | #define SPC_ADD_SENSE_LEN_OFFSET 7 | ||
37 | #define SPC_ASC_KEY_OFFSET 12 | 39 | #define SPC_ASC_KEY_OFFSET 12 |
38 | #define SPC_ASCQ_KEY_OFFSET 13 | 40 | #define SPC_ASCQ_KEY_OFFSET 13 |
39 | #define TRANSPORT_IQN_LEN 224 | 41 | #define TRANSPORT_IQN_LEN 224 |
@@ -53,6 +55,72 @@ | |||
53 | /* Used by transport_get_inquiry_vpd_device_ident() */ | 55 | /* Used by transport_get_inquiry_vpd_device_ident() */ |
54 | #define INQUIRY_VPD_DEVICE_IDENTIFIER_LEN 254 | 56 | #define INQUIRY_VPD_DEVICE_IDENTIFIER_LEN 254 |
55 | 57 | ||
58 | /* Attempts before moving from SHORT to LONG */ | ||
59 | #define PYX_TRANSPORT_WINDOW_CLOSED_THRESHOLD 3 | ||
60 | #define PYX_TRANSPORT_WINDOW_CLOSED_WAIT_SHORT 3 /* In milliseconds */ | ||
61 | #define PYX_TRANSPORT_WINDOW_CLOSED_WAIT_LONG 10 /* In milliseconds */ | ||
62 | |||
63 | #define PYX_TRANSPORT_STATUS_INTERVAL 5 /* In seconds */ | ||
64 | |||
65 | /* | ||
66 | * struct se_subsystem_dev->su_dev_flags | ||
67 | */ | ||
68 | #define SDF_FIRMWARE_VPD_UNIT_SERIAL 0x00000001 | ||
69 | #define SDF_EMULATED_VPD_UNIT_SERIAL 0x00000002 | ||
70 | #define SDF_USING_UDEV_PATH 0x00000004 | ||
71 | #define SDF_USING_ALIAS 0x00000008 | ||
72 | |||
73 | /* | ||
74 | * struct se_device->dev_flags | ||
75 | */ | ||
76 | #define DF_READ_ONLY 0x00000001 | ||
77 | #define DF_SPC2_RESERVATIONS 0x00000002 | ||
78 | #define DF_SPC2_RESERVATIONS_WITH_ISID 0x00000004 | ||
79 | |||
80 | /* struct se_dev_attrib sanity values */ | ||
81 | /* Default max_unmap_lba_count */ | ||
82 | #define DA_MAX_UNMAP_LBA_COUNT 0 | ||
83 | /* Default max_unmap_block_desc_count */ | ||
84 | #define DA_MAX_UNMAP_BLOCK_DESC_COUNT 0 | ||
85 | /* Default unmap_granularity */ | ||
86 | #define DA_UNMAP_GRANULARITY_DEFAULT 0 | ||
87 | /* Default unmap_granularity_alignment */ | ||
88 | #define DA_UNMAP_GRANULARITY_ALIGNMENT_DEFAULT 0 | ||
89 | /* Emulation for Direct Page Out */ | ||
90 | #define DA_EMULATE_DPO 0 | ||
91 | /* Emulation for Forced Unit Access WRITEs */ | ||
92 | #define DA_EMULATE_FUA_WRITE 1 | ||
93 | /* Emulation for Forced Unit Access READs */ | ||
94 | #define DA_EMULATE_FUA_READ 0 | ||
95 | /* Emulation for WriteCache and SYNCHRONIZE_CACHE */ | ||
96 | #define DA_EMULATE_WRITE_CACHE 0 | ||
97 | /* Emulation for UNIT ATTENTION Interlock Control */ | ||
98 | #define DA_EMULATE_UA_INTLLCK_CTRL 0 | ||
99 | /* Emulation for TASK_ABORTED status (TAS) by default */ | ||
100 | #define DA_EMULATE_TAS 1 | ||
101 | /* Emulation for Thin Provisioning UNMAP using block/blk-lib.c:blkdev_issue_discard() */ | ||
102 | #define DA_EMULATE_TPU 0 | ||
103 | /* | ||
104 | * Emulation for Thin Provisioning WRITE_SAME w/ UNMAP=1 bit using | ||
105 | * block/blk-lib.c:blkdev_issue_discard() | ||
106 | */ | ||
107 | #define DA_EMULATE_TPWS 0 | ||
108 | /* No Emulation for PSCSI by default */ | ||
109 | #define DA_EMULATE_RESERVATIONS 0 | ||
110 | /* No Emulation for PSCSI by default */ | ||
111 | #define DA_EMULATE_ALUA 0 | ||
112 | /* Enforce SCSI Initiator Port TransportID with 'ISID' for PR */ | ||
113 | #define DA_ENFORCE_PR_ISIDS 1 | ||
114 | #define DA_STATUS_MAX_SECTORS_MIN 16 | ||
115 | #define DA_STATUS_MAX_SECTORS_MAX 8192 | ||
116 | /* By default don't report non-rotating (solid state) medium */ | ||
117 | #define DA_IS_NONROT 0 | ||
118 | /* Queue Algorithm Modifier default for restricted reordering in control mode page */ | ||
119 | #define DA_EMULATE_REST_REORD 0 | ||
120 | |||
121 | #define SE_MODE_PAGE_BUF 512 | ||
122 | |||
123 | |||
56 | /* struct se_hba->hba_flags */ | 124 | /* struct se_hba->hba_flags */ |
57 | enum hba_flags_table { | 125 | enum hba_flags_table { |
58 | HBA_FLAGS_INTERNAL_USE = 0x01, | 126 | HBA_FLAGS_INTERNAL_USE = 0x01, |
@@ -71,11 +139,12 @@ enum transport_tpg_type_table { | |||
71 | TRANSPORT_TPG_TYPE_DISCOVERY = 1, | 139 | TRANSPORT_TPG_TYPE_DISCOVERY = 1, |
72 | }; | 140 | }; |
73 | 141 | ||
74 | /* Used for generate timer flags */ | 142 | /* struct se_task->task_flags */ |
75 | enum se_task_flags { | 143 | enum se_task_flags { |
76 | TF_ACTIVE = (1 << 0), | 144 | TF_ACTIVE = (1 << 0), |
77 | TF_SENT = (1 << 1), | 145 | TF_SENT = (1 << 1), |
78 | TF_REQUEST_STOP = (1 << 2), | 146 | TF_REQUEST_STOP = (1 << 2), |
147 | TF_HAS_SENSE = (1 << 3), | ||
79 | }; | 148 | }; |
80 | 149 | ||
81 | /* Special transport agnostic struct se_cmd->t_states */ | 150 | /* Special transport agnostic struct se_cmd->t_states */ |
@@ -158,9 +227,38 @@ enum tcm_sense_reason_table { | |||
158 | TCM_RESERVATION_CONFLICT = 0x10, | 227 | TCM_RESERVATION_CONFLICT = 0x10, |
159 | }; | 228 | }; |
160 | 229 | ||
230 | enum target_sc_flags_table { | ||
231 | TARGET_SCF_BIDI_OP = 0x01, | ||
232 | TARGET_SCF_ACK_KREF = 0x02, | ||
233 | }; | ||
234 | |||
235 | /* fabric independent task management function values */ | ||
236 | enum tcm_tmreq_table { | ||
237 | TMR_ABORT_TASK = 1, | ||
238 | TMR_ABORT_TASK_SET = 2, | ||
239 | TMR_CLEAR_ACA = 3, | ||
240 | TMR_CLEAR_TASK_SET = 4, | ||
241 | TMR_LUN_RESET = 5, | ||
242 | TMR_TARGET_WARM_RESET = 6, | ||
243 | TMR_TARGET_COLD_RESET = 7, | ||
244 | TMR_FABRIC_TMR = 255, | ||
245 | }; | ||
246 | |||
247 | /* fabric independent task management response values */ | ||
248 | enum tcm_tmrsp_table { | ||
249 | TMR_FUNCTION_COMPLETE = 0, | ||
250 | TMR_TASK_DOES_NOT_EXIST = 1, | ||
251 | TMR_LUN_DOES_NOT_EXIST = 2, | ||
252 | TMR_TASK_STILL_ALLEGIANT = 3, | ||
253 | TMR_TASK_FAILOVER_NOT_SUPPORTED = 4, | ||
254 | TMR_TASK_MGMT_FUNCTION_NOT_SUPPORTED = 5, | ||
255 | TMR_FUNCTION_AUTHORIZATION_FAILED = 6, | ||
256 | TMR_FUNCTION_REJECTED = 255, | ||
257 | }; | ||
258 | |||
161 | struct se_obj { | 259 | struct se_obj { |
162 | atomic_t obj_access_count; | 260 | atomic_t obj_access_count; |
163 | } ____cacheline_aligned; | 261 | }; |
164 | 262 | ||
165 | /* | 263 | /* |
166 | * Used by TCM Core internally to signal if ALUA emulation is enabled or | 264 | * Used by TCM Core internally to signal if ALUA emulation is enabled or |
@@ -207,7 +305,7 @@ struct t10_alua { | |||
207 | struct config_group alua_tg_pt_gps_group; | 305 | struct config_group alua_tg_pt_gps_group; |
208 | int (*alua_state_check)(struct se_cmd *, unsigned char *, u8 *); | 306 | int (*alua_state_check)(struct se_cmd *, unsigned char *, u8 *); |
209 | struct list_head tg_pt_gps_list; | 307 | struct list_head tg_pt_gps_list; |
210 | } ____cacheline_aligned; | 308 | }; |
211 | 309 | ||
212 | struct t10_alua_lu_gp { | 310 | struct t10_alua_lu_gp { |
213 | u16 lu_gp_id; | 311 | u16 lu_gp_id; |
@@ -218,7 +316,7 @@ struct t10_alua_lu_gp { | |||
218 | struct config_group lu_gp_group; | 316 | struct config_group lu_gp_group; |
219 | struct list_head lu_gp_node; | 317 | struct list_head lu_gp_node; |
220 | struct list_head lu_gp_mem_list; | 318 | struct list_head lu_gp_mem_list; |
221 | } ____cacheline_aligned; | 319 | }; |
222 | 320 | ||
223 | struct t10_alua_lu_gp_member { | 321 | struct t10_alua_lu_gp_member { |
224 | bool lu_gp_assoc; | 322 | bool lu_gp_assoc; |
@@ -227,7 +325,7 @@ struct t10_alua_lu_gp_member { | |||
227 | struct t10_alua_lu_gp *lu_gp; | 325 | struct t10_alua_lu_gp *lu_gp; |
228 | struct se_device *lu_gp_mem_dev; | 326 | struct se_device *lu_gp_mem_dev; |
229 | struct list_head lu_gp_mem_list; | 327 | struct list_head lu_gp_mem_list; |
230 | } ____cacheline_aligned; | 328 | }; |
231 | 329 | ||
232 | struct t10_alua_tg_pt_gp { | 330 | struct t10_alua_tg_pt_gp { |
233 | u16 tg_pt_gp_id; | 331 | u16 tg_pt_gp_id; |
@@ -250,7 +348,7 @@ struct t10_alua_tg_pt_gp { | |||
250 | struct config_group tg_pt_gp_group; | 348 | struct config_group tg_pt_gp_group; |
251 | struct list_head tg_pt_gp_list; | 349 | struct list_head tg_pt_gp_list; |
252 | struct list_head tg_pt_gp_mem_list; | 350 | struct list_head tg_pt_gp_mem_list; |
253 | } ____cacheline_aligned; | 351 | }; |
254 | 352 | ||
255 | struct t10_alua_tg_pt_gp_member { | 353 | struct t10_alua_tg_pt_gp_member { |
256 | bool tg_pt_gp_assoc; | 354 | bool tg_pt_gp_assoc; |
@@ -259,7 +357,7 @@ struct t10_alua_tg_pt_gp_member { | |||
259 | struct t10_alua_tg_pt_gp *tg_pt_gp; | 357 | struct t10_alua_tg_pt_gp *tg_pt_gp; |
260 | struct se_port *tg_pt; | 358 | struct se_port *tg_pt; |
261 | struct list_head tg_pt_gp_mem_list; | 359 | struct list_head tg_pt_gp_mem_list; |
262 | } ____cacheline_aligned; | 360 | }; |
263 | 361 | ||
264 | struct t10_vpd { | 362 | struct t10_vpd { |
265 | unsigned char device_identifier[INQUIRY_VPD_DEVICE_IDENTIFIER_LEN]; | 363 | unsigned char device_identifier[INQUIRY_VPD_DEVICE_IDENTIFIER_LEN]; |
@@ -269,7 +367,7 @@ struct t10_vpd { | |||
269 | u32 association; | 367 | u32 association; |
270 | u32 device_identifier_type; | 368 | u32 device_identifier_type; |
271 | struct list_head vpd_list; | 369 | struct list_head vpd_list; |
272 | } ____cacheline_aligned; | 370 | }; |
273 | 371 | ||
274 | struct t10_wwn { | 372 | struct t10_wwn { |
275 | char vendor[8]; | 373 | char vendor[8]; |
@@ -280,7 +378,7 @@ struct t10_wwn { | |||
280 | struct se_subsystem_dev *t10_sub_dev; | 378 | struct se_subsystem_dev *t10_sub_dev; |
281 | struct config_group t10_wwn_group; | 379 | struct config_group t10_wwn_group; |
282 | struct list_head t10_vpd_list; | 380 | struct list_head t10_vpd_list; |
283 | } ____cacheline_aligned; | 381 | }; |
284 | 382 | ||
285 | 383 | ||
286 | /* | 384 | /* |
@@ -333,7 +431,7 @@ struct t10_pr_registration { | |||
333 | struct list_head pr_reg_aptpl_list; | 431 | struct list_head pr_reg_aptpl_list; |
334 | struct list_head pr_reg_atp_list; | 432 | struct list_head pr_reg_atp_list; |
335 | struct list_head pr_reg_atp_mem_list; | 433 | struct list_head pr_reg_atp_mem_list; |
336 | } ____cacheline_aligned; | 434 | }; |
337 | 435 | ||
338 | /* | 436 | /* |
339 | * This set of function pointer ops is set based upon SPC3_PERSISTENT_RESERVATIONS, | 437 | * This set of function pointer ops is set based upon SPC3_PERSISTENT_RESERVATIONS, |
@@ -374,20 +472,20 @@ struct t10_reservation { | |||
374 | struct list_head registration_list; | 472 | struct list_head registration_list; |
375 | struct list_head aptpl_reg_list; | 473 | struct list_head aptpl_reg_list; |
376 | struct t10_reservation_ops pr_ops; | 474 | struct t10_reservation_ops pr_ops; |
377 | } ____cacheline_aligned; | 475 | }; |
378 | 476 | ||
379 | struct se_queue_req { | 477 | struct se_queue_req { |
380 | int state; | 478 | int state; |
381 | struct se_cmd *cmd; | 479 | struct se_cmd *cmd; |
382 | struct list_head qr_list; | 480 | struct list_head qr_list; |
383 | } ____cacheline_aligned; | 481 | }; |
384 | 482 | ||
385 | struct se_queue_obj { | 483 | struct se_queue_obj { |
386 | atomic_t queue_cnt; | 484 | atomic_t queue_cnt; |
387 | spinlock_t cmd_queue_lock; | 485 | spinlock_t cmd_queue_lock; |
388 | struct list_head qobj_list; | 486 | struct list_head qobj_list; |
389 | wait_queue_head_t thread_wq; | 487 | wait_queue_head_t thread_wq; |
390 | } ____cacheline_aligned; | 488 | }; |
391 | 489 | ||
392 | struct se_task { | 490 | struct se_task { |
393 | unsigned long long task_lba; | 491 | unsigned long long task_lba; |
@@ -397,16 +495,14 @@ struct se_task { | |||
397 | struct scatterlist *task_sg; | 495 | struct scatterlist *task_sg; |
398 | u32 task_sg_nents; | 496 | u32 task_sg_nents; |
399 | u16 task_flags; | 497 | u16 task_flags; |
400 | u8 task_sense; | ||
401 | u8 task_scsi_status; | 498 | u8 task_scsi_status; |
402 | int task_error_status; | ||
403 | enum dma_data_direction task_data_direction; | 499 | enum dma_data_direction task_data_direction; |
404 | atomic_t task_state_active; | ||
405 | struct list_head t_list; | 500 | struct list_head t_list; |
406 | struct list_head t_execute_list; | 501 | struct list_head t_execute_list; |
407 | struct list_head t_state_list; | 502 | struct list_head t_state_list; |
503 | bool t_state_active; | ||
408 | struct completion task_stop_comp; | 504 | struct completion task_stop_comp; |
409 | } ____cacheline_aligned; | 505 | }; |
410 | 506 | ||
411 | struct se_cmd { | 507 | struct se_cmd { |
412 | /* SAM response code being sent to initiator */ | 508 | /* SAM response code being sent to initiator */ |
@@ -451,6 +547,7 @@ struct se_cmd { | |||
451 | struct list_head se_queue_node; | 547 | struct list_head se_queue_node; |
452 | struct list_head se_cmd_list; | 548 | struct list_head se_cmd_list; |
453 | struct completion cmd_wait_comp; | 549 | struct completion cmd_wait_comp; |
550 | struct kref cmd_kref; | ||
454 | struct target_core_fabric_ops *se_tfo; | 551 | struct target_core_fabric_ops *se_tfo; |
455 | int (*execute_task)(struct se_task *); | 552 | int (*execute_task)(struct se_task *); |
456 | void (*transport_complete_callback)(struct se_cmd *); | 553 | void (*transport_complete_callback)(struct se_cmd *); |
@@ -492,7 +589,7 @@ struct se_cmd { | |||
492 | struct list_head t_task_list; | 589 | struct list_head t_task_list; |
493 | u32 t_task_list_num; | 590 | u32 t_task_list_num; |
494 | 591 | ||
495 | } ____cacheline_aligned; | 592 | }; |
496 | 593 | ||
497 | struct se_tmr_req { | 594 | struct se_tmr_req { |
498 | /* Task Management function to be preformed */ | 595 | /* Task Management function to be preformed */ |
@@ -510,7 +607,7 @@ struct se_tmr_req { | |||
510 | struct se_device *tmr_dev; | 607 | struct se_device *tmr_dev; |
511 | struct se_lun *tmr_lun; | 608 | struct se_lun *tmr_lun; |
512 | struct list_head tmr_list; | 609 | struct list_head tmr_list; |
513 | } ____cacheline_aligned; | 610 | }; |
514 | 611 | ||
515 | struct se_ua { | 612 | struct se_ua { |
516 | u8 ua_asc; | 613 | u8 ua_asc; |
@@ -518,7 +615,7 @@ struct se_ua { | |||
518 | struct se_node_acl *ua_nacl; | 615 | struct se_node_acl *ua_nacl; |
519 | struct list_head ua_dev_list; | 616 | struct list_head ua_dev_list; |
520 | struct list_head ua_nacl_list; | 617 | struct list_head ua_nacl_list; |
521 | } ____cacheline_aligned; | 618 | }; |
522 | 619 | ||
523 | struct se_node_acl { | 620 | struct se_node_acl { |
524 | char initiatorname[TRANSPORT_IQN_LEN]; | 621 | char initiatorname[TRANSPORT_IQN_LEN]; |
@@ -545,7 +642,7 @@ struct se_node_acl { | |||
545 | struct config_group *acl_default_groups[5]; | 642 | struct config_group *acl_default_groups[5]; |
546 | struct list_head acl_list; | 643 | struct list_head acl_list; |
547 | struct list_head acl_sess_list; | 644 | struct list_head acl_sess_list; |
548 | } ____cacheline_aligned; | 645 | }; |
549 | 646 | ||
550 | struct se_session { | 647 | struct se_session { |
551 | unsigned sess_tearing_down:1; | 648 | unsigned sess_tearing_down:1; |
@@ -558,7 +655,7 @@ struct se_session { | |||
558 | struct list_head sess_cmd_list; | 655 | struct list_head sess_cmd_list; |
559 | struct list_head sess_wait_list; | 656 | struct list_head sess_wait_list; |
560 | spinlock_t sess_cmd_lock; | 657 | spinlock_t sess_cmd_lock; |
561 | } ____cacheline_aligned; | 658 | }; |
562 | 659 | ||
563 | struct se_device; | 660 | struct se_device; |
564 | struct se_transform_info; | 661 | struct se_transform_info; |
@@ -578,7 +675,7 @@ struct se_lun_acl { | |||
578 | struct list_head lacl_list; | 675 | struct list_head lacl_list; |
579 | struct config_group se_lun_group; | 676 | struct config_group se_lun_group; |
580 | struct se_ml_stat_grps ml_stat_grps; | 677 | struct se_ml_stat_grps ml_stat_grps; |
581 | } ____cacheline_aligned; | 678 | }; |
582 | 679 | ||
583 | struct se_dev_entry { | 680 | struct se_dev_entry { |
584 | bool def_pr_registered; | 681 | bool def_pr_registered; |
@@ -603,7 +700,7 @@ struct se_dev_entry { | |||
603 | struct se_lun *se_lun; | 700 | struct se_lun *se_lun; |
604 | struct list_head alua_port_list; | 701 | struct list_head alua_port_list; |
605 | struct list_head ua_list; | 702 | struct list_head ua_list; |
606 | } ____cacheline_aligned; | 703 | }; |
607 | 704 | ||
608 | struct se_dev_limits { | 705 | struct se_dev_limits { |
609 | /* Max supported HW queue depth */ | 706 | /* Max supported HW queue depth */ |
@@ -612,7 +709,7 @@ struct se_dev_limits { | |||
612 | u32 queue_depth; | 709 | u32 queue_depth; |
613 | /* From include/linux/blkdev.h for the other HW/SW limits. */ | 710 | /* From include/linux/blkdev.h for the other HW/SW limits. */ |
614 | struct queue_limits limits; | 711 | struct queue_limits limits; |
615 | } ____cacheline_aligned; | 712 | }; |
616 | 713 | ||
617 | struct se_dev_attrib { | 714 | struct se_dev_attrib { |
618 | int emulate_dpo; | 715 | int emulate_dpo; |
@@ -641,7 +738,7 @@ struct se_dev_attrib { | |||
641 | u32 unmap_granularity_alignment; | 738 | u32 unmap_granularity_alignment; |
642 | struct se_subsystem_dev *da_sub_dev; | 739 | struct se_subsystem_dev *da_sub_dev; |
643 | struct config_group da_group; | 740 | struct config_group da_group; |
644 | } ____cacheline_aligned; | 741 | }; |
645 | 742 | ||
646 | struct se_dev_stat_grps { | 743 | struct se_dev_stat_grps { |
647 | struct config_group stat_group; | 744 | struct config_group stat_group; |
@@ -674,7 +771,7 @@ struct se_subsystem_dev { | |||
674 | struct config_group se_dev_pr_group; | 771 | struct config_group se_dev_pr_group; |
675 | /* For target_core_stat.c groups */ | 772 | /* For target_core_stat.c groups */ |
676 | struct se_dev_stat_grps dev_stat_grps; | 773 | struct se_dev_stat_grps dev_stat_grps; |
677 | } ____cacheline_aligned; | 774 | }; |
678 | 775 | ||
679 | struct se_device { | 776 | struct se_device { |
680 | /* RELATIVE TARGET PORT IDENTIFER Counter */ | 777 | /* RELATIVE TARGET PORT IDENTIFER Counter */ |
@@ -685,7 +782,6 @@ struct se_device { | |||
685 | u32 dev_port_count; | 782 | u32 dev_port_count; |
686 | /* See transport_device_status_table */ | 783 | /* See transport_device_status_table */ |
687 | u32 dev_status; | 784 | u32 dev_status; |
688 | u32 dev_tcq_window_closed; | ||
689 | /* Physical device queue depth */ | 785 | /* Physical device queue depth */ |
690 | u32 queue_depth; | 786 | u32 queue_depth; |
691 | /* Used for SPC-2 reservations enforce of ISIDs */ | 787 | /* Used for SPC-2 reservations enforce of ISIDs */ |
@@ -702,7 +798,6 @@ struct se_device { | |||
702 | spinlock_t stats_lock; | 798 | spinlock_t stats_lock; |
703 | /* Active commands on this virtual SE device */ | 799 | /* Active commands on this virtual SE device */ |
704 | atomic_t simple_cmds; | 800 | atomic_t simple_cmds; |
705 | atomic_t depth_left; | ||
706 | atomic_t dev_ordered_id; | 801 | atomic_t dev_ordered_id; |
707 | atomic_t execute_tasks; | 802 | atomic_t execute_tasks; |
708 | atomic_t dev_ordered_sync; | 803 | atomic_t dev_ordered_sync; |
@@ -740,7 +835,7 @@ struct se_device { | |||
740 | struct se_subsystem_api *transport; | 835 | struct se_subsystem_api *transport; |
741 | /* Linked list for struct se_hba struct se_device list */ | 836 | /* Linked list for struct se_hba struct se_device list */ |
742 | struct list_head dev_list; | 837 | struct list_head dev_list; |
743 | } ____cacheline_aligned; | 838 | }; |
744 | 839 | ||
745 | struct se_hba { | 840 | struct se_hba { |
746 | u16 hba_tpgt; | 841 | u16 hba_tpgt; |
@@ -759,7 +854,7 @@ struct se_hba { | |||
759 | struct config_group hba_group; | 854 | struct config_group hba_group; |
760 | struct mutex hba_access_mutex; | 855 | struct mutex hba_access_mutex; |
761 | struct se_subsystem_api *transport; | 856 | struct se_subsystem_api *transport; |
762 | } ____cacheline_aligned; | 857 | }; |
763 | 858 | ||
764 | struct se_port_stat_grps { | 859 | struct se_port_stat_grps { |
765 | struct config_group stat_group; | 860 | struct config_group stat_group; |
@@ -785,13 +880,13 @@ struct se_lun { | |||
785 | struct se_port *lun_sep; | 880 | struct se_port *lun_sep; |
786 | struct config_group lun_group; | 881 | struct config_group lun_group; |
787 | struct se_port_stat_grps port_stat_grps; | 882 | struct se_port_stat_grps port_stat_grps; |
788 | } ____cacheline_aligned; | 883 | }; |
789 | 884 | ||
790 | struct scsi_port_stats { | 885 | struct scsi_port_stats { |
791 | u64 cmd_pdus; | 886 | u64 cmd_pdus; |
792 | u64 tx_data_octets; | 887 | u64 tx_data_octets; |
793 | u64 rx_data_octets; | 888 | u64 rx_data_octets; |
794 | } ____cacheline_aligned; | 889 | }; |
795 | 890 | ||
796 | struct se_port { | 891 | struct se_port { |
797 | /* RELATIVE TARGET PORT IDENTIFER */ | 892 | /* RELATIVE TARGET PORT IDENTIFER */ |
@@ -811,12 +906,12 @@ struct se_port { | |||
811 | struct se_portal_group *sep_tpg; | 906 | struct se_portal_group *sep_tpg; |
812 | struct list_head sep_alua_list; | 907 | struct list_head sep_alua_list; |
813 | struct list_head sep_list; | 908 | struct list_head sep_list; |
814 | } ____cacheline_aligned; | 909 | }; |
815 | 910 | ||
816 | struct se_tpg_np { | 911 | struct se_tpg_np { |
817 | struct se_portal_group *tpg_np_parent; | 912 | struct se_portal_group *tpg_np_parent; |
818 | struct config_group tpg_np_group; | 913 | struct config_group tpg_np_group; |
819 | } ____cacheline_aligned; | 914 | }; |
820 | 915 | ||
821 | struct se_portal_group { | 916 | struct se_portal_group { |
822 | /* Type of target portal group, see transport_tpg_type_table */ | 917 | /* Type of target portal group, see transport_tpg_type_table */ |
@@ -849,13 +944,13 @@ struct se_portal_group { | |||
849 | struct config_group tpg_acl_group; | 944 | struct config_group tpg_acl_group; |
850 | struct config_group tpg_attrib_group; | 945 | struct config_group tpg_attrib_group; |
851 | struct config_group tpg_param_group; | 946 | struct config_group tpg_param_group; |
852 | } ____cacheline_aligned; | 947 | }; |
853 | 948 | ||
854 | struct se_wwn { | 949 | struct se_wwn { |
855 | struct target_fabric_configfs *wwn_tf; | 950 | struct target_fabric_configfs *wwn_tf; |
856 | struct config_group wwn_group; | 951 | struct config_group wwn_group; |
857 | struct config_group *wwn_default_groups[2]; | 952 | struct config_group *wwn_default_groups[2]; |
858 | struct config_group fabric_stat_group; | 953 | struct config_group fabric_stat_group; |
859 | } ____cacheline_aligned; | 954 | }; |
860 | 955 | ||
861 | #endif /* TARGET_CORE_BASE_H */ | 956 | #endif /* TARGET_CORE_BASE_H */ |
diff --git a/include/target/target_core_device.h b/include/target/target_core_device.h deleted file mode 100644 index 2be31ff8763b..000000000000 --- a/include/target/target_core_device.h +++ /dev/null | |||
@@ -1,63 +0,0 @@ | |||
1 | #ifndef TARGET_CORE_DEVICE_H | ||
2 | #define TARGET_CORE_DEVICE_H | ||
3 | |||
4 | extern int transport_lookup_cmd_lun(struct se_cmd *, u32); | ||
5 | extern int transport_lookup_tmr_lun(struct se_cmd *, u32); | ||
6 | extern struct se_dev_entry *core_get_se_deve_from_rtpi( | ||
7 | struct se_node_acl *, u16); | ||
8 | extern int core_free_device_list_for_node(struct se_node_acl *, | ||
9 | struct se_portal_group *); | ||
10 | extern void core_dec_lacl_count(struct se_node_acl *, struct se_cmd *); | ||
11 | extern void core_update_device_list_access(u32, u32, struct se_node_acl *); | ||
12 | extern 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); | ||
15 | extern void core_clear_lun_from_tpg(struct se_lun *, struct se_portal_group *); | ||
16 | extern int core_dev_export(struct se_device *, struct se_portal_group *, | ||
17 | struct se_lun *); | ||
18 | extern void core_dev_unexport(struct se_device *, struct se_portal_group *, | ||
19 | struct se_lun *); | ||
20 | extern int target_report_luns(struct se_task *); | ||
21 | extern void se_release_device_for_hba(struct se_device *); | ||
22 | extern void se_release_vpd_for_dev(struct se_device *); | ||
23 | extern void se_clear_dev_ports(struct se_device *); | ||
24 | extern int se_free_virtual_device(struct se_device *, struct se_hba *); | ||
25 | extern int se_dev_check_online(struct se_device *); | ||
26 | extern int se_dev_check_shutdown(struct se_device *); | ||
27 | extern void se_dev_set_default_attribs(struct se_device *, struct se_dev_limits *); | ||
28 | extern int se_dev_set_task_timeout(struct se_device *, u32); | ||
29 | extern int se_dev_set_max_unmap_lba_count(struct se_device *, u32); | ||
30 | extern int se_dev_set_max_unmap_block_desc_count(struct se_device *, u32); | ||
31 | extern int se_dev_set_unmap_granularity(struct se_device *, u32); | ||
32 | extern int se_dev_set_unmap_granularity_alignment(struct se_device *, u32); | ||
33 | extern int se_dev_set_emulate_dpo(struct se_device *, int); | ||
34 | extern int se_dev_set_emulate_fua_write(struct se_device *, int); | ||
35 | extern int se_dev_set_emulate_fua_read(struct se_device *, int); | ||
36 | extern int se_dev_set_emulate_write_cache(struct se_device *, int); | ||
37 | extern int se_dev_set_emulate_ua_intlck_ctrl(struct se_device *, int); | ||
38 | extern int se_dev_set_emulate_tas(struct se_device *, int); | ||
39 | extern int se_dev_set_emulate_tpu(struct se_device *, int); | ||
40 | extern int se_dev_set_emulate_tpws(struct se_device *, int); | ||
41 | extern int se_dev_set_enforce_pr_isids(struct se_device *, int); | ||
42 | extern int se_dev_set_is_nonrot(struct se_device *, int); | ||
43 | extern int se_dev_set_emulate_rest_reord(struct se_device *dev, int); | ||
44 | extern int se_dev_set_queue_depth(struct se_device *, u32); | ||
45 | extern int se_dev_set_max_sectors(struct se_device *, u32); | ||
46 | extern int se_dev_set_optimal_sectors(struct se_device *, u32); | ||
47 | extern int se_dev_set_block_size(struct se_device *, u32); | ||
48 | extern struct se_lun *core_dev_add_lun(struct se_portal_group *, struct se_hba *, | ||
49 | struct se_device *, u32); | ||
50 | extern int core_dev_del_lun(struct se_portal_group *, u32); | ||
51 | extern struct se_lun *core_get_lun_from_tpg(struct se_portal_group *, u32); | ||
52 | extern struct se_lun_acl *core_dev_init_initiator_node_lun_acl(struct se_portal_group *, | ||
53 | u32, char *, int *); | ||
54 | extern int core_dev_add_initiator_node_lun_acl(struct se_portal_group *, | ||
55 | struct se_lun_acl *, u32, u32); | ||
56 | extern int core_dev_del_initiator_node_lun_acl(struct se_portal_group *, | ||
57 | struct se_lun *, struct se_lun_acl *); | ||
58 | extern void core_dev_free_initiator_node_lun_acl(struct se_portal_group *, | ||
59 | struct se_lun_acl *lacl); | ||
60 | extern int core_dev_setup_virtual_lun0(void); | ||
61 | extern void core_dev_release_virtual_lun0(void); | ||
62 | |||
63 | #endif /* TARGET_CORE_DEVICE_H */ | ||
diff --git a/include/target/target_core_fabric_ops.h b/include/target/target_core_fabric.h index 0256825f923d..523e8bc104d4 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; |
@@ -52,10 +52,6 @@ struct target_core_fabric_ops { | |||
52 | * Returning 0 will signal a descriptor has not been released. | 52 | * Returning 0 will signal a descriptor has not been released. |
53 | */ | 53 | */ |
54 | int (*check_stop_free)(struct se_cmd *); | 54 | int (*check_stop_free)(struct se_cmd *); |
55 | /* | ||
56 | * Optional check for active I/O shutdown | ||
57 | */ | ||
58 | int (*check_release_cmd)(struct se_cmd *); | ||
59 | void (*release_cmd)(struct se_cmd *); | 55 | void (*release_cmd)(struct se_cmd *); |
60 | /* | 56 | /* |
61 | * Called with spin_lock_bh(struct se_portal_group->session_lock held. | 57 | * Called with spin_lock_bh(struct se_portal_group->session_lock held. |
@@ -103,3 +99,89 @@ struct target_core_fabric_ops { | |||
103 | struct config_group *, const char *); | 99 | struct config_group *, const char *); |
104 | void (*fabric_drop_nodeacl)(struct se_node_acl *); | 100 | void (*fabric_drop_nodeacl)(struct se_node_acl *); |
105 | }; | 101 | }; |
102 | |||
103 | struct se_session *transport_init_session(void); | ||
104 | void __transport_register_session(struct se_portal_group *, | ||
105 | struct se_node_acl *, struct se_session *, void *); | ||
106 | void transport_register_session(struct se_portal_group *, | ||
107 | struct se_node_acl *, struct se_session *, void *); | ||
108 | void transport_free_session(struct se_session *); | ||
109 | void transport_deregister_session_configfs(struct se_session *); | ||
110 | void transport_deregister_session(struct se_session *); | ||
111 | |||
112 | |||
113 | void transport_init_se_cmd(struct se_cmd *, struct target_core_fabric_ops *, | ||
114 | struct se_session *, u32, int, int, unsigned char *); | ||
115 | int transport_lookup_cmd_lun(struct se_cmd *, u32); | ||
116 | int transport_generic_allocate_tasks(struct se_cmd *, unsigned char *); | ||
117 | int target_submit_cmd(struct se_cmd *, struct se_session *, unsigned char *, | ||
118 | unsigned char *, u32, u32, int, int, int); | ||
119 | int transport_handle_cdb_direct(struct se_cmd *); | ||
120 | int transport_generic_handle_cdb_map(struct se_cmd *); | ||
121 | int transport_generic_handle_data(struct se_cmd *); | ||
122 | int transport_generic_map_mem_to_cmd(struct se_cmd *cmd, | ||
123 | struct scatterlist *, u32, struct scatterlist *, u32); | ||
124 | void transport_do_task_sg_chain(struct se_cmd *); | ||
125 | int transport_generic_new_cmd(struct se_cmd *); | ||
126 | |||
127 | void transport_generic_process_write(struct se_cmd *); | ||
128 | |||
129 | void transport_generic_free_cmd(struct se_cmd *, int); | ||
130 | |||
131 | bool transport_wait_for_tasks(struct se_cmd *); | ||
132 | int transport_check_aborted_status(struct se_cmd *, int); | ||
133 | int transport_send_check_condition_and_sense(struct se_cmd *, u8, int); | ||
134 | |||
135 | void target_get_sess_cmd(struct se_session *, struct se_cmd *, bool); | ||
136 | int target_put_sess_cmd(struct se_session *, struct se_cmd *); | ||
137 | void target_splice_sess_cmd_list(struct se_session *); | ||
138 | void target_wait_for_sess_cmds(struct se_session *, int); | ||
139 | |||
140 | int core_alua_check_nonop_delay(struct se_cmd *); | ||
141 | |||
142 | struct se_tmr_req *core_tmr_alloc_req(struct se_cmd *, void *, u8, gfp_t); | ||
143 | void core_tmr_release_req(struct se_tmr_req *); | ||
144 | int transport_generic_handle_tmr(struct se_cmd *); | ||
145 | int transport_lookup_tmr_lun(struct se_cmd *, u32); | ||
146 | |||
147 | struct se_node_acl *core_tpg_check_initiator_node_acl(struct se_portal_group *, | ||
148 | unsigned char *); | ||
149 | void core_tpg_clear_object_luns(struct se_portal_group *); | ||
150 | struct se_node_acl *core_tpg_add_initiator_node_acl(struct se_portal_group *, | ||
151 | struct se_node_acl *, const char *, u32); | ||
152 | int core_tpg_del_initiator_node_acl(struct se_portal_group *, | ||
153 | struct se_node_acl *, int); | ||
154 | int core_tpg_set_initiator_node_queue_depth(struct se_portal_group *, | ||
155 | unsigned char *, u32, int); | ||
156 | int core_tpg_register(struct target_core_fabric_ops *, struct se_wwn *, | ||
157 | struct se_portal_group *, void *, int); | ||
158 | int core_tpg_deregister(struct se_portal_group *); | ||
159 | |||
160 | /* SAS helpers */ | ||
161 | u8 sas_get_fabric_proto_ident(struct se_portal_group *); | ||
162 | u32 sas_get_pr_transport_id(struct se_portal_group *, struct se_node_acl *, | ||
163 | struct t10_pr_registration *, int *, unsigned char *); | ||
164 | u32 sas_get_pr_transport_id_len(struct se_portal_group *, struct se_node_acl *, | ||
165 | struct t10_pr_registration *, int *); | ||
166 | char *sas_parse_pr_out_transport_id(struct se_portal_group *, const char *, | ||
167 | u32 *, char **); | ||
168 | |||
169 | /* FC helpers */ | ||
170 | u8 fc_get_fabric_proto_ident(struct se_portal_group *); | ||
171 | u32 fc_get_pr_transport_id(struct se_portal_group *, struct se_node_acl *, | ||
172 | struct t10_pr_registration *, int *, unsigned char *); | ||
173 | u32 fc_get_pr_transport_id_len(struct se_portal_group *, struct se_node_acl *, | ||
174 | struct t10_pr_registration *, int *); | ||
175 | char *fc_parse_pr_out_transport_id(struct se_portal_group *, const char *, | ||
176 | u32 *, char **); | ||
177 | |||
178 | /* iSCSI helpers */ | ||
179 | u8 iscsi_get_fabric_proto_ident(struct se_portal_group *); | ||
180 | u32 iscsi_get_pr_transport_id(struct se_portal_group *, struct se_node_acl *, | ||
181 | struct t10_pr_registration *, int *, unsigned char *); | ||
182 | u32 iscsi_get_pr_transport_id_len(struct se_portal_group *, struct se_node_acl *, | ||
183 | struct t10_pr_registration *, int *); | ||
184 | char *iscsi_parse_pr_out_transport_id(struct se_portal_group *, const char *, | ||
185 | u32 *, char **); | ||
186 | |||
187 | #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 d5876e17d3fb..000000000000 --- a/include/target/target_core_tmr.h +++ /dev/null | |||
@@ -1,35 +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 kmem_cache *se_tmr_req_cache; | ||
29 | |||
30 | extern struct se_tmr_req *core_tmr_alloc_req(struct se_cmd *, void *, u8, gfp_t); | ||
31 | extern void core_tmr_release_req(struct se_tmr_req *); | ||
32 | extern 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 deleted file mode 100644 index 77e18729c4c1..000000000000 --- a/include/target/target_core_tpg.h +++ /dev/null | |||
@@ -1,35 +0,0 @@ | |||
1 | #ifndef TARGET_CORE_TPG_H | ||
2 | #define TARGET_CORE_TPG_H | ||
3 | |||
4 | extern struct se_node_acl *__core_tpg_get_initiator_node_acl(struct se_portal_group *tpg, | ||
5 | const char *); | ||
6 | extern struct se_node_acl *core_tpg_get_initiator_node_acl(struct se_portal_group *tpg, | ||
7 | unsigned char *); | ||
8 | extern void core_tpg_add_node_to_devs(struct se_node_acl *, | ||
9 | struct se_portal_group *); | ||
10 | extern struct se_node_acl *core_tpg_check_initiator_node_acl( | ||
11 | struct se_portal_group *, | ||
12 | unsigned char *); | ||
13 | extern void core_tpg_wait_for_nacl_pr_ref(struct se_node_acl *); | ||
14 | extern void core_tpg_wait_for_mib_ref(struct se_node_acl *); | ||
15 | extern void core_tpg_clear_object_luns(struct se_portal_group *); | ||
16 | extern struct se_node_acl *core_tpg_add_initiator_node_acl( | ||
17 | struct se_portal_group *, | ||
18 | struct se_node_acl *, | ||
19 | const char *, u32); | ||
20 | extern int core_tpg_del_initiator_node_acl(struct se_portal_group *, | ||
21 | struct se_node_acl *, int); | ||
22 | extern int core_tpg_set_initiator_node_queue_depth(struct se_portal_group *, | ||
23 | unsigned char *, u32, int); | ||
24 | extern int core_tpg_register(struct target_core_fabric_ops *, | ||
25 | struct se_wwn *, | ||
26 | struct se_portal_group *, void *, | ||
27 | int); | ||
28 | extern int core_tpg_deregister(struct se_portal_group *); | ||
29 | extern struct se_lun *core_tpg_pre_addlun(struct se_portal_group *, u32); | ||
30 | extern int core_tpg_post_addlun(struct se_portal_group *, struct se_lun *, u32, | ||
31 | void *); | ||
32 | extern struct se_lun *core_tpg_pre_dellun(struct se_portal_group *, u32, int *); | ||
33 | extern 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 deleted file mode 100644 index dac4f2d859fd..000000000000 --- a/include/target/target_core_transport.h +++ /dev/null | |||
@@ -1,287 +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 init_se_kmem_caches(void); | ||
80 | extern void release_se_kmem_caches(void); | ||
81 | extern u32 scsi_get_new_index(scsi_index_t); | ||
82 | extern void transport_init_queue_obj(struct se_queue_obj *); | ||
83 | extern void transport_subsystem_check_init(void); | ||
84 | extern int transport_subsystem_register(struct se_subsystem_api *); | ||
85 | extern void transport_subsystem_release(struct se_subsystem_api *); | ||
86 | extern void transport_load_plugins(void); | ||
87 | extern struct se_session *transport_init_session(void); | ||
88 | extern void __transport_register_session(struct se_portal_group *, | ||
89 | struct se_node_acl *, | ||
90 | struct se_session *, void *); | ||
91 | extern void transport_register_session(struct se_portal_group *, | ||
92 | struct se_node_acl *, | ||
93 | struct se_session *, void *); | ||
94 | extern void transport_free_session(struct se_session *); | ||
95 | extern void transport_deregister_session_configfs(struct se_session *); | ||
96 | extern void transport_deregister_session(struct se_session *); | ||
97 | extern void transport_cmd_finish_abort(struct se_cmd *, int); | ||
98 | extern void transport_complete_sync_cache(struct se_cmd *, int); | ||
99 | extern void transport_complete_task(struct se_task *, int); | ||
100 | extern void transport_add_task_to_execute_queue(struct se_task *, | ||
101 | struct se_task *, | ||
102 | struct se_device *); | ||
103 | extern void transport_remove_task_from_execute_queue(struct se_task *, | ||
104 | struct se_device *); | ||
105 | extern void __transport_remove_task_from_execute_queue(struct se_task *, | ||
106 | struct se_device *); | ||
107 | unsigned char *transport_dump_cmd_direction(struct se_cmd *); | ||
108 | extern void transport_dump_dev_state(struct se_device *, char *, int *); | ||
109 | extern void transport_dump_dev_info(struct se_device *, struct se_lun *, | ||
110 | unsigned long long, char *, int *); | ||
111 | extern void transport_dump_vpd_proto_id(struct t10_vpd *, | ||
112 | unsigned char *, int); | ||
113 | extern void transport_set_vpd_proto_id(struct t10_vpd *, unsigned char *); | ||
114 | extern int transport_dump_vpd_assoc(struct t10_vpd *, | ||
115 | unsigned char *, int); | ||
116 | extern int transport_set_vpd_assoc(struct t10_vpd *, unsigned char *); | ||
117 | extern int transport_dump_vpd_ident_type(struct t10_vpd *, | ||
118 | unsigned char *, int); | ||
119 | extern int transport_set_vpd_ident_type(struct t10_vpd *, unsigned char *); | ||
120 | extern int transport_dump_vpd_ident(struct t10_vpd *, | ||
121 | unsigned char *, int); | ||
122 | extern int transport_set_vpd_ident(struct t10_vpd *, unsigned char *); | ||
123 | extern struct se_device *transport_add_device_to_core_hba(struct se_hba *, | ||
124 | struct se_subsystem_api *, | ||
125 | struct se_subsystem_dev *, u32, | ||
126 | void *, struct se_dev_limits *, | ||
127 | const char *, const char *); | ||
128 | extern void transport_init_se_cmd(struct se_cmd *, | ||
129 | struct target_core_fabric_ops *, | ||
130 | struct se_session *, u32, int, int, | ||
131 | unsigned char *); | ||
132 | void *transport_kmap_first_data_page(struct se_cmd *cmd); | ||
133 | void transport_kunmap_first_data_page(struct se_cmd *cmd); | ||
134 | extern int transport_generic_allocate_tasks(struct se_cmd *, unsigned char *); | ||
135 | extern int transport_handle_cdb_direct(struct se_cmd *); | ||
136 | extern int transport_generic_handle_cdb_map(struct se_cmd *); | ||
137 | extern int transport_generic_handle_data(struct se_cmd *); | ||
138 | extern int transport_generic_handle_tmr(struct se_cmd *); | ||
139 | extern bool target_stop_task(struct se_task *task, unsigned long *flags); | ||
140 | extern int transport_generic_map_mem_to_cmd(struct se_cmd *cmd, struct scatterlist *, u32, | ||
141 | struct scatterlist *, u32); | ||
142 | extern int transport_clear_lun_from_sessions(struct se_lun *); | ||
143 | extern bool transport_wait_for_tasks(struct se_cmd *); | ||
144 | extern int transport_check_aborted_status(struct se_cmd *, int); | ||
145 | extern int transport_send_check_condition_and_sense(struct se_cmd *, u8, int); | ||
146 | extern void transport_send_task_abort(struct se_cmd *); | ||
147 | extern void transport_release_cmd(struct se_cmd *); | ||
148 | extern void transport_generic_free_cmd(struct se_cmd *, int); | ||
149 | extern void target_get_sess_cmd(struct se_session *, struct se_cmd *); | ||
150 | extern int target_put_sess_cmd(struct se_session *, struct se_cmd *); | ||
151 | extern void target_splice_sess_cmd_list(struct se_session *); | ||
152 | extern void target_wait_for_sess_cmds(struct se_session *, int); | ||
153 | extern void transport_generic_wait_for_cmds(struct se_cmd *, int); | ||
154 | extern void transport_do_task_sg_chain(struct se_cmd *); | ||
155 | extern void transport_generic_process_write(struct se_cmd *); | ||
156 | extern int transport_generic_new_cmd(struct se_cmd *); | ||
157 | extern int transport_generic_do_tmr(struct se_cmd *); | ||
158 | /* From target_core_alua.c */ | ||
159 | extern int core_alua_check_nonop_delay(struct se_cmd *); | ||
160 | /* From target_core_cdb.c */ | ||
161 | extern int transport_emulate_control_cdb(struct se_task *); | ||
162 | extern void target_get_task_cdb(struct se_task *task, unsigned char *cdb); | ||
163 | |||
164 | /* | ||
165 | * Each se_transport_task_t can have N number of possible struct se_task's | ||
166 | * for the storage transport(s) to possibly execute. | ||
167 | * Used primarily for splitting up CDBs that exceed the physical storage | ||
168 | * HBA's maximum sector count per task. | ||
169 | */ | ||
170 | struct se_mem { | ||
171 | struct page *se_page; | ||
172 | u32 se_len; | ||
173 | u32 se_off; | ||
174 | struct list_head se_list; | ||
175 | } ____cacheline_aligned; | ||
176 | |||
177 | /* | ||
178 | * Each type of disk transport supported MUST have a template defined | ||
179 | * within its .h file. | ||
180 | */ | ||
181 | struct se_subsystem_api { | ||
182 | /* | ||
183 | * The Name. :-) | ||
184 | */ | ||
185 | char name[16]; | ||
186 | /* | ||
187 | * Transport Type. | ||
188 | */ | ||
189 | u8 transport_type; | ||
190 | |||
191 | unsigned int fua_write_emulated : 1; | ||
192 | unsigned int write_cache_emulated : 1; | ||
193 | |||
194 | /* | ||
195 | * struct module for struct se_hba references | ||
196 | */ | ||
197 | struct module *owner; | ||
198 | /* | ||
199 | * Used for global se_subsystem_api list_head | ||
200 | */ | ||
201 | struct list_head sub_api_list; | ||
202 | /* | ||
203 | * attach_hba(): | ||
204 | */ | ||
205 | int (*attach_hba)(struct se_hba *, u32); | ||
206 | /* | ||
207 | * detach_hba(): | ||
208 | */ | ||
209 | void (*detach_hba)(struct se_hba *); | ||
210 | /* | ||
211 | * pmode_hba(): Used for TCM/pSCSI subsystem plugin HBA -> | ||
212 | * Linux/SCSI struct Scsi_Host passthrough | ||
213 | */ | ||
214 | int (*pmode_enable_hba)(struct se_hba *, unsigned long); | ||
215 | /* | ||
216 | * allocate_virtdevice(): | ||
217 | */ | ||
218 | void *(*allocate_virtdevice)(struct se_hba *, const char *); | ||
219 | /* | ||
220 | * create_virtdevice(): Only for Virtual HBAs | ||
221 | */ | ||
222 | struct se_device *(*create_virtdevice)(struct se_hba *, | ||
223 | struct se_subsystem_dev *, void *); | ||
224 | /* | ||
225 | * free_device(): | ||
226 | */ | ||
227 | void (*free_device)(void *); | ||
228 | |||
229 | /* | ||
230 | * transport_complete(): | ||
231 | * | ||
232 | * Use transport_generic_complete() for majority of DAS transport | ||
233 | * drivers. Provided out of convenience. | ||
234 | */ | ||
235 | int (*transport_complete)(struct se_task *task); | ||
236 | struct se_task *(*alloc_task)(unsigned char *cdb); | ||
237 | /* | ||
238 | * do_task(): | ||
239 | */ | ||
240 | int (*do_task)(struct se_task *); | ||
241 | /* | ||
242 | * Used by virtual subsystem plugins IBLOCK and FILEIO to emulate | ||
243 | * UNMAP and WRITE_SAME_* w/ UNMAP=1 <-> Linux/Block Discard | ||
244 | */ | ||
245 | int (*do_discard)(struct se_device *, sector_t, u32); | ||
246 | /* | ||
247 | * Used by virtual subsystem plugins IBLOCK and FILEIO to emulate | ||
248 | * SYNCHRONIZE_CACHE_* <-> Linux/Block blkdev_issue_flush() | ||
249 | */ | ||
250 | void (*do_sync_cache)(struct se_task *); | ||
251 | /* | ||
252 | * free_task(): | ||
253 | */ | ||
254 | void (*free_task)(struct se_task *); | ||
255 | /* | ||
256 | * check_configfs_dev_params(): | ||
257 | */ | ||
258 | ssize_t (*check_configfs_dev_params)(struct se_hba *, struct se_subsystem_dev *); | ||
259 | /* | ||
260 | * set_configfs_dev_params(): | ||
261 | */ | ||
262 | ssize_t (*set_configfs_dev_params)(struct se_hba *, struct se_subsystem_dev *, | ||
263 | const char *, ssize_t); | ||
264 | /* | ||
265 | * show_configfs_dev_params(): | ||
266 | */ | ||
267 | ssize_t (*show_configfs_dev_params)(struct se_hba *, struct se_subsystem_dev *, | ||
268 | char *); | ||
269 | /* | ||
270 | * get_device_rev(): | ||
271 | */ | ||
272 | u32 (*get_device_rev)(struct se_device *); | ||
273 | /* | ||
274 | * get_device_type(): | ||
275 | */ | ||
276 | u32 (*get_device_type)(struct se_device *); | ||
277 | /* | ||
278 | * Get the sector_t from a subsystem backstore.. | ||
279 | */ | ||
280 | sector_t (*get_blocks)(struct se_device *); | ||
281 | /* | ||
282 | * get_sense_buffer(): | ||
283 | */ | ||
284 | unsigned char *(*get_sense_buffer)(struct se_task *); | ||
285 | } ____cacheline_aligned; | ||
286 | |||
287 | #endif /* TARGET_CORE_TRANSPORT_H */ | ||