diff options
author | Tejun Heo <tj@kernel.org> | 2011-11-28 12:46:22 -0500 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2011-11-28 12:46:22 -0500 |
commit | d4bbf7e7759afc172e2bfbc5c416324590049cdd (patch) | |
tree | 7eab5ee5481cd3dcf1162329fec827177640018a /include/target | |
parent | a150439c4a97db379f0ed6faa46fbbb6e7bf3cb2 (diff) | |
parent | 401d0069cb344f401bc9d264c31db55876ff78c0 (diff) |
Merge branch 'master' into x86/memblock
Conflicts & resolutions:
* arch/x86/xen/setup.c
dc91c728fd "xen: allow extra memory to be in multiple regions"
24aa07882b "memblock, x86: Replace memblock_x86_reserve/free..."
conflicted on xen_add_extra_mem() updates. The resolution is
trivial as the latter just want to replace
memblock_x86_reserve_range() with memblock_reserve().
* drivers/pci/intel-iommu.c
166e9278a3f "x86/ia64: intel-iommu: move to drivers/iommu/"
5dfe8660a3d "bootmem: Replace work_with_active_regions() with..."
conflicted as the former moved the file under drivers/iommu/.
Resolved by applying the chnages from the latter on the moved
file.
* mm/Kconfig
6661672053a "memblock: add NO_BOOTMEM config symbol"
c378ddd53f9 "memblock, x86: Make ARCH_DISCARD_MEMBLOCK a config option"
conflicted trivially. Both added config options. Just
letting both add their own options resolves the conflict.
* mm/memblock.c
d1f0ece6cdc "mm/memblock.c: small function definition fixes"
ed7b56a799c "memblock: Remove memblock_memory_can_coalesce()"
confliected. The former updates function removed by the
latter. Resolution is trivial.
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'include/target')
-rw-r--r-- | include/target/configfs_macros.h | 4 | ||||
-rw-r--r-- | include/target/target_core_base.h | 300 | ||||
-rw-r--r-- | include/target/target_core_device.h | 8 | ||||
-rw-r--r-- | include/target/target_core_fabric_ops.h | 24 | ||||
-rw-r--r-- | include/target/target_core_tmr.h | 2 | ||||
-rw-r--r-- | include/target/target_core_transport.h | 109 |
6 files changed, 158 insertions, 289 deletions
diff --git a/include/target/configfs_macros.h b/include/target/configfs_macros.h index 7fe74608b437..a0fc85bbe2da 100644 --- a/include/target/configfs_macros.h +++ b/include/target/configfs_macros.h | |||
@@ -30,8 +30,8 @@ | |||
30 | * Added CONFIGFS_EATTR() macros from original configfs.h macros | 30 | * Added CONFIGFS_EATTR() macros from original configfs.h macros |
31 | * Copright (C) 2008-2009 Nicholas A. Bellinger <nab@linux-iscsi.org> | 31 | * Copright (C) 2008-2009 Nicholas A. Bellinger <nab@linux-iscsi.org> |
32 | * | 32 | * |
33 | * Please read Documentation/filesystems/configfs.txt before using the | 33 | * Please read Documentation/filesystems/configfs/configfs.txt before using |
34 | * configfs interface, ESPECIALLY the parts about reference counts and | 34 | * the configfs interface, ESPECIALLY the parts about reference counts and |
35 | * item destructors. | 35 | * item destructors. |
36 | */ | 36 | */ |
37 | 37 | ||
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index 561ac99def5a..7f5fed3c89e1 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h | |||
@@ -9,12 +9,10 @@ | |||
9 | #include <net/sock.h> | 9 | #include <net/sock.h> |
10 | #include <net/tcp.h> | 10 | #include <net/tcp.h> |
11 | 11 | ||
12 | #define TARGET_CORE_MOD_VERSION "v4.0.0-rc7-ml" | 12 | #define TARGET_CORE_MOD_VERSION "v4.1.0-rc1-ml" |
13 | #define SHUTDOWN_SIGS (sigmask(SIGKILL)|sigmask(SIGINT)|sigmask(SIGABRT)) | ||
14 | 13 | ||
15 | /* Used by transport_generic_allocate_iovecs() */ | ||
16 | #define TRANSPORT_IOV_DATA_BUFFER 5 | ||
17 | /* Maximum Number of LUNs per Target Portal Group */ | 14 | /* Maximum Number of LUNs per Target Portal Group */ |
15 | /* Don't raise above 511 or REPORT_LUNS needs to handle >1 page */ | ||
18 | #define TRANSPORT_MAX_LUNS_PER_TPG 256 | 16 | #define TRANSPORT_MAX_LUNS_PER_TPG 256 |
19 | /* | 17 | /* |
20 | * By default we use 32-byte CDBs in TCM Core and subsystem plugin code. | 18 | * By default we use 32-byte CDBs in TCM Core and subsystem plugin code. |
@@ -74,31 +72,25 @@ enum transport_tpg_type_table { | |||
74 | }; | 72 | }; |
75 | 73 | ||
76 | /* Used for generate timer flags */ | 74 | /* Used for generate timer flags */ |
77 | enum timer_flags_table { | 75 | enum se_task_flags { |
78 | TF_RUNNING = 0x01, | 76 | TF_ACTIVE = (1 << 0), |
79 | TF_STOP = 0x02, | 77 | TF_SENT = (1 << 1), |
78 | TF_REQUEST_STOP = (1 << 2), | ||
80 | }; | 79 | }; |
81 | 80 | ||
82 | /* Special transport agnostic struct se_cmd->t_states */ | 81 | /* Special transport agnostic struct se_cmd->t_states */ |
83 | enum transport_state_table { | 82 | enum transport_state_table { |
84 | TRANSPORT_NO_STATE = 0, | 83 | TRANSPORT_NO_STATE = 0, |
85 | TRANSPORT_NEW_CMD = 1, | 84 | TRANSPORT_NEW_CMD = 1, |
86 | TRANSPORT_DEFERRED_CMD = 2, | ||
87 | TRANSPORT_WRITE_PENDING = 3, | 85 | TRANSPORT_WRITE_PENDING = 3, |
88 | TRANSPORT_PROCESS_WRITE = 4, | 86 | TRANSPORT_PROCESS_WRITE = 4, |
89 | TRANSPORT_PROCESSING = 5, | 87 | TRANSPORT_PROCESSING = 5, |
90 | TRANSPORT_COMPLETE_OK = 6, | 88 | TRANSPORT_COMPLETE = 6, |
91 | TRANSPORT_COMPLETE_FAILURE = 7, | ||
92 | TRANSPORT_COMPLETE_TIMEOUT = 8, | ||
93 | TRANSPORT_PROCESS_TMR = 9, | 89 | TRANSPORT_PROCESS_TMR = 9, |
94 | TRANSPORT_TMR_COMPLETE = 10, | ||
95 | TRANSPORT_ISTATE_PROCESSING = 11, | 90 | TRANSPORT_ISTATE_PROCESSING = 11, |
96 | TRANSPORT_ISTATE_PROCESSED = 12, | ||
97 | TRANSPORT_KILL = 13, | ||
98 | TRANSPORT_REMOVE = 14, | ||
99 | TRANSPORT_FREE = 15, | ||
100 | TRANSPORT_NEW_CMD_MAP = 16, | 91 | TRANSPORT_NEW_CMD_MAP = 16, |
101 | TRANSPORT_FREE_CMD_INTR = 17, | 92 | TRANSPORT_COMPLETE_QF_WP = 18, |
93 | TRANSPORT_COMPLETE_QF_OK = 19, | ||
102 | }; | 94 | }; |
103 | 95 | ||
104 | /* Used for struct se_cmd->se_cmd_flags */ | 96 | /* Used for struct se_cmd->se_cmd_flags */ |
@@ -108,27 +100,20 @@ enum se_cmd_flags_table { | |||
108 | SCF_EMULATED_TASK_SENSE = 0x00000004, | 100 | SCF_EMULATED_TASK_SENSE = 0x00000004, |
109 | SCF_SCSI_DATA_SG_IO_CDB = 0x00000008, | 101 | SCF_SCSI_DATA_SG_IO_CDB = 0x00000008, |
110 | SCF_SCSI_CONTROL_SG_IO_CDB = 0x00000010, | 102 | SCF_SCSI_CONTROL_SG_IO_CDB = 0x00000010, |
111 | SCF_SCSI_CONTROL_NONSG_IO_CDB = 0x00000020, | ||
112 | SCF_SCSI_NON_DATA_CDB = 0x00000040, | 103 | SCF_SCSI_NON_DATA_CDB = 0x00000040, |
113 | SCF_SCSI_CDB_EXCEPTION = 0x00000080, | 104 | SCF_SCSI_CDB_EXCEPTION = 0x00000080, |
114 | SCF_SCSI_RESERVATION_CONFLICT = 0x00000100, | 105 | SCF_SCSI_RESERVATION_CONFLICT = 0x00000100, |
115 | SCF_CMD_PASSTHROUGH_NOALLOC = 0x00000200, | ||
116 | SCF_SE_CMD_FAILED = 0x00000400, | 106 | SCF_SE_CMD_FAILED = 0x00000400, |
117 | SCF_SE_LUN_CMD = 0x00000800, | 107 | SCF_SE_LUN_CMD = 0x00000800, |
118 | SCF_SE_ALLOW_EOO = 0x00001000, | 108 | SCF_SE_ALLOW_EOO = 0x00001000, |
119 | SCF_SE_DISABLE_ONLINE_CHECK = 0x00002000, | ||
120 | SCF_SENT_CHECK_CONDITION = 0x00004000, | 109 | SCF_SENT_CHECK_CONDITION = 0x00004000, |
121 | SCF_OVERFLOW_BIT = 0x00008000, | 110 | SCF_OVERFLOW_BIT = 0x00008000, |
122 | SCF_UNDERFLOW_BIT = 0x00010000, | 111 | SCF_UNDERFLOW_BIT = 0x00010000, |
123 | SCF_SENT_DELAYED_TAS = 0x00020000, | 112 | SCF_SENT_DELAYED_TAS = 0x00020000, |
124 | SCF_ALUA_NON_OPTIMIZED = 0x00040000, | 113 | SCF_ALUA_NON_OPTIMIZED = 0x00040000, |
125 | SCF_DELAYED_CMD_FROM_SAM_ATTR = 0x00080000, | 114 | SCF_DELAYED_CMD_FROM_SAM_ATTR = 0x00080000, |
126 | SCF_PASSTHROUGH_SG_TO_MEM = 0x00100000, | 115 | SCF_UNUSED = 0x00100000, |
127 | SCF_PASSTHROUGH_CONTIG_TO_SG = 0x00200000, | ||
128 | SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC = 0x00400000, | 116 | SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC = 0x00400000, |
129 | SCF_EMULATE_SYNC_CACHE = 0x00800000, | ||
130 | SCF_EMULATE_CDB_ASYNC = 0x01000000, | ||
131 | SCF_EMULATE_SYNC_UNMAP = 0x02000000 | ||
132 | }; | 117 | }; |
133 | 118 | ||
134 | /* struct se_dev_entry->lun_flags and struct se_lun->lun_access */ | 119 | /* struct se_dev_entry->lun_flags and struct se_lun->lun_access */ |
@@ -205,11 +190,6 @@ typedef enum { | |||
205 | SCSI_INDEX_TYPE_MAX | 190 | SCSI_INDEX_TYPE_MAX |
206 | } scsi_index_t; | 191 | } scsi_index_t; |
207 | 192 | ||
208 | struct scsi_index_table { | ||
209 | spinlock_t lock; | ||
210 | u32 scsi_mib_index[SCSI_INDEX_TYPE_MAX]; | ||
211 | } ____cacheline_aligned; | ||
212 | |||
213 | struct se_cmd; | 193 | struct se_cmd; |
214 | 194 | ||
215 | struct t10_alua { | 195 | struct t10_alua { |
@@ -235,7 +215,7 @@ struct t10_alua_lu_gp { | |||
235 | atomic_t lu_gp_ref_cnt; | 215 | atomic_t lu_gp_ref_cnt; |
236 | spinlock_t lu_gp_lock; | 216 | spinlock_t lu_gp_lock; |
237 | struct config_group lu_gp_group; | 217 | struct config_group lu_gp_group; |
238 | struct list_head lu_gp_list; | 218 | struct list_head lu_gp_node; |
239 | struct list_head lu_gp_mem_list; | 219 | struct list_head lu_gp_mem_list; |
240 | } ____cacheline_aligned; | 220 | } ____cacheline_aligned; |
241 | 221 | ||
@@ -291,10 +271,10 @@ struct t10_vpd { | |||
291 | } ____cacheline_aligned; | 271 | } ____cacheline_aligned; |
292 | 272 | ||
293 | struct t10_wwn { | 273 | struct t10_wwn { |
294 | unsigned char vendor[8]; | 274 | char vendor[8]; |
295 | unsigned char model[16]; | 275 | char model[16]; |
296 | unsigned char revision[4]; | 276 | char revision[4]; |
297 | unsigned char unit_serial[INQUIRY_VPD_SERIAL_LEN]; | 277 | char unit_serial[INQUIRY_VPD_SERIAL_LEN]; |
298 | spinlock_t t10_vpd_lock; | 278 | spinlock_t t10_vpd_lock; |
299 | struct se_subsystem_dev *t10_sub_dev; | 279 | struct se_subsystem_dev *t10_sub_dev; |
300 | struct config_group t10_wwn_group; | 280 | struct config_group t10_wwn_group; |
@@ -366,13 +346,13 @@ struct t10_reservation_ops { | |||
366 | int (*t10_pr_clear)(struct se_cmd *); | 346 | int (*t10_pr_clear)(struct se_cmd *); |
367 | }; | 347 | }; |
368 | 348 | ||
369 | struct t10_reservation_template { | 349 | struct t10_reservation { |
370 | /* Reservation effects all target ports */ | 350 | /* Reservation effects all target ports */ |
371 | int pr_all_tg_pt; | 351 | int pr_all_tg_pt; |
372 | /* Activate Persistence across Target Power Loss enabled | 352 | /* Activate Persistence across Target Power Loss enabled |
373 | * for SCSI device */ | 353 | * for SCSI device */ |
374 | int pr_aptpl_active; | 354 | int pr_aptpl_active; |
375 | /* Used by struct t10_reservation_template->pr_aptpl_buf_len */ | 355 | /* Used by struct t10_reservation->pr_aptpl_buf_len */ |
376 | #define PR_APTPL_BUF_LEN 8192 | 356 | #define PR_APTPL_BUF_LEN 8192 |
377 | u32 pr_aptpl_buf_len; | 357 | u32 pr_aptpl_buf_len; |
378 | u32 pr_generation; | 358 | u32 pr_generation; |
@@ -397,7 +377,7 @@ struct t10_reservation_template { | |||
397 | 377 | ||
398 | struct se_queue_req { | 378 | struct se_queue_req { |
399 | int state; | 379 | int state; |
400 | void *cmd; | 380 | struct se_cmd *cmd; |
401 | struct list_head qr_list; | 381 | struct list_head qr_list; |
402 | } ____cacheline_aligned; | 382 | } ____cacheline_aligned; |
403 | 383 | ||
@@ -408,96 +388,25 @@ struct se_queue_obj { | |||
408 | wait_queue_head_t thread_wq; | 388 | wait_queue_head_t thread_wq; |
409 | } ____cacheline_aligned; | 389 | } ____cacheline_aligned; |
410 | 390 | ||
411 | /* | ||
412 | * Used one per struct se_cmd to hold all extra struct se_task | ||
413 | * metadata. This structure is setup and allocated in | ||
414 | * drivers/target/target_core_transport.c:__transport_alloc_se_cmd() | ||
415 | */ | ||
416 | struct se_transport_task { | ||
417 | unsigned char *t_task_cdb; | ||
418 | unsigned char __t_task_cdb[TCM_MAX_COMMAND_SIZE]; | ||
419 | unsigned long long t_task_lba; | ||
420 | int t_tasks_failed; | ||
421 | int t_tasks_fua; | ||
422 | bool t_tasks_bidi; | ||
423 | u32 t_task_cdbs; | ||
424 | u32 t_tasks_check; | ||
425 | u32 t_tasks_no; | ||
426 | u32 t_tasks_sectors; | ||
427 | u32 t_tasks_se_num; | ||
428 | u32 t_tasks_se_bidi_num; | ||
429 | u32 t_tasks_sg_chained_no; | ||
430 | atomic_t t_fe_count; | ||
431 | atomic_t t_se_count; | ||
432 | atomic_t t_task_cdbs_left; | ||
433 | atomic_t t_task_cdbs_ex_left; | ||
434 | atomic_t t_task_cdbs_timeout_left; | ||
435 | atomic_t t_task_cdbs_sent; | ||
436 | atomic_t t_transport_aborted; | ||
437 | atomic_t t_transport_active; | ||
438 | atomic_t t_transport_complete; | ||
439 | atomic_t t_transport_queue_active; | ||
440 | atomic_t t_transport_sent; | ||
441 | atomic_t t_transport_stop; | ||
442 | atomic_t t_transport_timeout; | ||
443 | atomic_t transport_dev_active; | ||
444 | atomic_t transport_lun_active; | ||
445 | atomic_t transport_lun_fe_stop; | ||
446 | atomic_t transport_lun_stop; | ||
447 | spinlock_t t_state_lock; | ||
448 | struct completion t_transport_stop_comp; | ||
449 | struct completion transport_lun_fe_stop_comp; | ||
450 | struct completion transport_lun_stop_comp; | ||
451 | struct scatterlist *t_tasks_sg_chained; | ||
452 | struct scatterlist t_tasks_sg_bounce; | ||
453 | void *t_task_buf; | ||
454 | /* | ||
455 | * Used for pre-registered fabric SGL passthrough WRITE and READ | ||
456 | * with the special SCF_PASSTHROUGH_CONTIG_TO_SG case for TCM_Loop | ||
457 | * and other HW target mode fabric modules. | ||
458 | */ | ||
459 | struct scatterlist *t_task_pt_sgl; | ||
460 | struct list_head *t_mem_list; | ||
461 | /* Used for BIDI READ */ | ||
462 | struct list_head *t_mem_bidi_list; | ||
463 | struct list_head t_task_list; | ||
464 | } ____cacheline_aligned; | ||
465 | |||
466 | struct se_task { | 391 | struct se_task { |
467 | unsigned char task_sense; | ||
468 | struct scatterlist *task_sg; | ||
469 | struct scatterlist *task_sg_bidi; | ||
470 | u8 task_scsi_status; | ||
471 | u8 task_flags; | ||
472 | int task_error_status; | ||
473 | int task_state_flags; | ||
474 | bool task_padded_sg; | ||
475 | unsigned long long task_lba; | 392 | unsigned long long task_lba; |
476 | u32 task_no; | 393 | u32 task_sectors; |
477 | u32 task_sectors; | 394 | u32 task_size; |
478 | u32 task_size; | 395 | struct se_cmd *task_se_cmd; |
479 | u32 task_sg_num; | 396 | struct scatterlist *task_sg; |
480 | u32 task_sg_offset; | 397 | u32 task_sg_nents; |
398 | u16 task_flags; | ||
399 | u8 task_sense; | ||
400 | u8 task_scsi_status; | ||
401 | int task_error_status; | ||
481 | enum dma_data_direction task_data_direction; | 402 | enum dma_data_direction task_data_direction; |
482 | struct se_cmd *task_se_cmd; | 403 | atomic_t task_state_active; |
483 | struct se_device *se_dev; | 404 | struct list_head t_list; |
405 | struct list_head t_execute_list; | ||
406 | struct list_head t_state_list; | ||
484 | struct completion task_stop_comp; | 407 | struct completion task_stop_comp; |
485 | atomic_t task_active; | ||
486 | atomic_t task_execute_queue; | ||
487 | atomic_t task_timeout; | ||
488 | atomic_t task_sent; | ||
489 | atomic_t task_stop; | ||
490 | atomic_t task_state_active; | ||
491 | struct timer_list task_timer; | ||
492 | struct se_device *se_obj_ptr; | ||
493 | struct list_head t_list; | ||
494 | struct list_head t_execute_list; | ||
495 | struct list_head t_state_list; | ||
496 | } ____cacheline_aligned; | 408 | } ____cacheline_aligned; |
497 | 409 | ||
498 | #define TASK_CMD(task) ((task)->task_se_cmd) | ||
499 | #define TASK_DEV(task) ((task)->se_dev) | ||
500 | |||
501 | struct se_cmd { | 410 | struct se_cmd { |
502 | /* SAM response code being sent to initiator */ | 411 | /* SAM response code being sent to initiator */ |
503 | u8 scsi_status; | 412 | u8 scsi_status; |
@@ -513,10 +422,11 @@ struct se_cmd { | |||
513 | int sam_task_attr; | 422 | int sam_task_attr; |
514 | /* Transport protocol dependent state, see transport_state_table */ | 423 | /* Transport protocol dependent state, see transport_state_table */ |
515 | enum transport_state_table t_state; | 424 | enum transport_state_table t_state; |
516 | /* Transport protocol dependent state for out of order CmdSNs */ | ||
517 | int deferred_t_state; | ||
518 | /* Transport specific error status */ | 425 | /* Transport specific error status */ |
519 | int transport_error_status; | 426 | int transport_error_status; |
427 | /* Used to signal cmd->se_tfo->check_release_cmd() usage per cmd */ | ||
428 | int check_release:1; | ||
429 | int cmd_wait_set:1; | ||
520 | /* See se_cmd_flags_table */ | 430 | /* See se_cmd_flags_table */ |
521 | u32 se_cmd_flags; | 431 | u32 se_cmd_flags; |
522 | u32 se_ordered_id; | 432 | u32 se_ordered_id; |
@@ -528,12 +438,12 @@ struct se_cmd { | |||
528 | u32 orig_fe_lun; | 438 | u32 orig_fe_lun; |
529 | /* Persistent Reservation key */ | 439 | /* Persistent Reservation key */ |
530 | u64 pr_res_key; | 440 | u64 pr_res_key; |
531 | atomic_t transport_sent; | ||
532 | /* Used for sense data */ | 441 | /* Used for sense data */ |
533 | void *sense_buffer; | 442 | void *sense_buffer; |
534 | struct list_head se_delayed_list; | 443 | struct list_head se_delayed_node; |
535 | struct list_head se_ordered_list; | 444 | struct list_head se_ordered_node; |
536 | struct list_head se_lun_list; | 445 | struct list_head se_lun_node; |
446 | struct list_head se_qf_node; | ||
537 | struct se_device *se_dev; | 447 | struct se_device *se_dev; |
538 | struct se_dev_entry *se_deve; | 448 | struct se_dev_entry *se_deve; |
539 | struct se_device *se_obj_ptr; | 449 | struct se_device *se_obj_ptr; |
@@ -542,18 +452,61 @@ struct se_cmd { | |||
542 | /* Only used for internal passthrough and legacy TCM fabric modules */ | 452 | /* Only used for internal passthrough and legacy TCM fabric modules */ |
543 | struct se_session *se_sess; | 453 | struct se_session *se_sess; |
544 | struct se_tmr_req *se_tmr_req; | 454 | struct se_tmr_req *se_tmr_req; |
545 | /* t_task is setup to t_task_backstore in transport_init_se_cmd() */ | 455 | struct list_head se_queue_node; |
546 | struct se_transport_task *t_task; | 456 | struct list_head se_cmd_list; |
547 | struct se_transport_task t_task_backstore; | 457 | struct completion cmd_wait_comp; |
548 | struct target_core_fabric_ops *se_tfo; | 458 | struct target_core_fabric_ops *se_tfo; |
549 | int (*transport_emulate_cdb)(struct se_cmd *); | 459 | int (*execute_task)(struct se_task *); |
550 | void (*transport_split_cdb)(unsigned long long, u32 *, unsigned char *); | ||
551 | void (*transport_wait_for_tasks)(struct se_cmd *, int, int); | ||
552 | void (*transport_complete_callback)(struct se_cmd *); | 460 | void (*transport_complete_callback)(struct se_cmd *); |
553 | } ____cacheline_aligned; | ||
554 | 461 | ||
555 | #define T_TASK(cmd) ((cmd)->t_task) | 462 | unsigned char *t_task_cdb; |
556 | #define CMD_TFO(cmd) ((cmd)->se_tfo) | 463 | unsigned char __t_task_cdb[TCM_MAX_COMMAND_SIZE]; |
464 | unsigned long long t_task_lba; | ||
465 | int t_tasks_failed; | ||
466 | int t_tasks_fua; | ||
467 | bool t_tasks_bidi; | ||
468 | u32 t_tasks_sg_chained_no; | ||
469 | atomic_t t_fe_count; | ||
470 | atomic_t t_se_count; | ||
471 | atomic_t t_task_cdbs_left; | ||
472 | atomic_t t_task_cdbs_ex_left; | ||
473 | atomic_t t_task_cdbs_sent; | ||
474 | atomic_t t_transport_aborted; | ||
475 | atomic_t t_transport_active; | ||
476 | atomic_t t_transport_complete; | ||
477 | atomic_t t_transport_queue_active; | ||
478 | atomic_t t_transport_sent; | ||
479 | atomic_t t_transport_stop; | ||
480 | atomic_t transport_dev_active; | ||
481 | atomic_t transport_lun_active; | ||
482 | atomic_t transport_lun_fe_stop; | ||
483 | atomic_t transport_lun_stop; | ||
484 | spinlock_t t_state_lock; | ||
485 | struct completion t_transport_stop_comp; | ||
486 | struct completion transport_lun_fe_stop_comp; | ||
487 | struct completion transport_lun_stop_comp; | ||
488 | struct scatterlist *t_tasks_sg_chained; | ||
489 | |||
490 | struct work_struct work; | ||
491 | |||
492 | /* | ||
493 | * Used for pre-registered fabric SGL passthrough WRITE and READ | ||
494 | * with the special SCF_PASSTHROUGH_CONTIG_TO_SG case for TCM_Loop | ||
495 | * and other HW target mode fabric modules. | ||
496 | */ | ||
497 | struct scatterlist *t_task_pt_sgl; | ||
498 | u32 t_task_pt_sgl_num; | ||
499 | |||
500 | struct scatterlist *t_data_sg; | ||
501 | unsigned int t_data_nents; | ||
502 | struct scatterlist *t_bidi_data_sg; | ||
503 | unsigned int t_bidi_data_nents; | ||
504 | |||
505 | /* Used for BIDI READ */ | ||
506 | struct list_head t_task_list; | ||
507 | u32 t_task_list_num; | ||
508 | |||
509 | } ____cacheline_aligned; | ||
557 | 510 | ||
558 | struct se_tmr_req { | 511 | struct se_tmr_req { |
559 | /* Task Management function to be preformed */ | 512 | /* Task Management function to be preformed */ |
@@ -609,17 +562,18 @@ struct se_node_acl { | |||
609 | } ____cacheline_aligned; | 562 | } ____cacheline_aligned; |
610 | 563 | ||
611 | struct se_session { | 564 | struct se_session { |
565 | int sess_tearing_down:1; | ||
612 | u64 sess_bin_isid; | 566 | u64 sess_bin_isid; |
613 | struct se_node_acl *se_node_acl; | 567 | struct se_node_acl *se_node_acl; |
614 | struct se_portal_group *se_tpg; | 568 | struct se_portal_group *se_tpg; |
615 | void *fabric_sess_ptr; | 569 | void *fabric_sess_ptr; |
616 | struct list_head sess_list; | 570 | struct list_head sess_list; |
617 | struct list_head sess_acl_list; | 571 | struct list_head sess_acl_list; |
572 | struct list_head sess_cmd_list; | ||
573 | struct list_head sess_wait_list; | ||
574 | spinlock_t sess_cmd_lock; | ||
618 | } ____cacheline_aligned; | 575 | } ____cacheline_aligned; |
619 | 576 | ||
620 | #define SE_SESS(cmd) ((cmd)->se_sess) | ||
621 | #define SE_NODE_ACL(sess) ((sess)->se_node_acl) | ||
622 | |||
623 | struct se_device; | 577 | struct se_device; |
624 | struct se_transform_info; | 578 | struct se_transform_info; |
625 | struct scatterlist; | 579 | struct scatterlist; |
@@ -640,8 +594,6 @@ struct se_lun_acl { | |||
640 | struct se_ml_stat_grps ml_stat_grps; | 594 | struct se_ml_stat_grps ml_stat_grps; |
641 | } ____cacheline_aligned; | 595 | } ____cacheline_aligned; |
642 | 596 | ||
643 | #define ML_STAT_GRPS(lacl) (&(lacl)->ml_stat_grps) | ||
644 | |||
645 | struct se_dev_entry { | 597 | struct se_dev_entry { |
646 | bool def_pr_registered; | 598 | bool def_pr_registered; |
647 | /* See transport_lunflags_table */ | 599 | /* See transport_lunflags_table */ |
@@ -688,6 +640,8 @@ struct se_dev_attrib { | |||
688 | int emulate_reservations; | 640 | int emulate_reservations; |
689 | int emulate_alua; | 641 | int emulate_alua; |
690 | int enforce_pr_isids; | 642 | int enforce_pr_isids; |
643 | int is_nonrot; | ||
644 | int emulate_rest_reord; | ||
691 | u32 hw_block_size; | 645 | u32 hw_block_size; |
692 | u32 block_size; | 646 | u32 block_size; |
693 | u32 hw_max_sectors; | 647 | u32 hw_max_sectors; |
@@ -695,7 +649,6 @@ struct se_dev_attrib { | |||
695 | u32 optimal_sectors; | 649 | u32 optimal_sectors; |
696 | u32 hw_queue_depth; | 650 | u32 hw_queue_depth; |
697 | u32 queue_depth; | 651 | u32 queue_depth; |
698 | u32 task_timeout; | ||
699 | u32 max_unmap_lba_count; | 652 | u32 max_unmap_lba_count; |
700 | u32 max_unmap_block_desc_count; | 653 | u32 max_unmap_block_desc_count; |
701 | u32 unmap_granularity; | 654 | u32 unmap_granularity; |
@@ -727,10 +680,10 @@ struct se_subsystem_dev { | |||
727 | /* T10 Inquiry and VPD WWN Information */ | 680 | /* T10 Inquiry and VPD WWN Information */ |
728 | struct t10_wwn t10_wwn; | 681 | struct t10_wwn t10_wwn; |
729 | /* T10 SPC-2 + SPC-3 Reservations */ | 682 | /* T10 SPC-2 + SPC-3 Reservations */ |
730 | struct t10_reservation_template t10_reservation; | 683 | struct t10_reservation t10_pr; |
731 | spinlock_t se_dev_lock; | 684 | spinlock_t se_dev_lock; |
732 | void *se_dev_su_ptr; | 685 | void *se_dev_su_ptr; |
733 | struct list_head g_se_dev_list; | 686 | struct list_head se_dev_node; |
734 | struct config_group se_dev_group; | 687 | struct config_group se_dev_group; |
735 | /* For T10 Reservations */ | 688 | /* For T10 Reservations */ |
736 | struct config_group se_dev_pr_group; | 689 | struct config_group se_dev_pr_group; |
@@ -738,11 +691,6 @@ struct se_subsystem_dev { | |||
738 | struct se_dev_stat_grps dev_stat_grps; | 691 | struct se_dev_stat_grps dev_stat_grps; |
739 | } ____cacheline_aligned; | 692 | } ____cacheline_aligned; |
740 | 693 | ||
741 | #define T10_ALUA(su_dev) (&(su_dev)->t10_alua) | ||
742 | #define T10_RES(su_dev) (&(su_dev)->t10_reservation) | ||
743 | #define T10_PR_OPS(su_dev) (&(su_dev)->t10_reservation.pr_ops) | ||
744 | #define DEV_STAT_GRP(dev) (&(dev)->dev_stat_grps) | ||
745 | |||
746 | struct se_device { | 694 | struct se_device { |
747 | /* Set to 1 if thread is NOT sleeping on thread_sem */ | 695 | /* Set to 1 if thread is NOT sleeping on thread_sem */ |
748 | u8 thread_active; | 696 | u8 thread_active; |
@@ -780,11 +728,11 @@ struct se_device { | |||
780 | atomic_t dev_status_thr_count; | 728 | atomic_t dev_status_thr_count; |
781 | atomic_t dev_hoq_count; | 729 | atomic_t dev_hoq_count; |
782 | atomic_t dev_ordered_sync; | 730 | atomic_t dev_ordered_sync; |
731 | atomic_t dev_qf_count; | ||
783 | struct se_obj dev_obj; | 732 | struct se_obj dev_obj; |
784 | struct se_obj dev_access_obj; | 733 | struct se_obj dev_access_obj; |
785 | struct se_obj dev_export_obj; | 734 | struct se_obj dev_export_obj; |
786 | struct se_queue_obj *dev_queue_obj; | 735 | struct se_queue_obj dev_queue_obj; |
787 | struct se_queue_obj *dev_status_queue_obj; | ||
788 | spinlock_t delayed_cmd_lock; | 736 | spinlock_t delayed_cmd_lock; |
789 | spinlock_t ordered_cmd_lock; | 737 | spinlock_t ordered_cmd_lock; |
790 | spinlock_t execute_task_lock; | 738 | spinlock_t execute_task_lock; |
@@ -796,6 +744,7 @@ struct se_device { | |||
796 | spinlock_t dev_status_thr_lock; | 744 | spinlock_t dev_status_thr_lock; |
797 | spinlock_t se_port_lock; | 745 | spinlock_t se_port_lock; |
798 | spinlock_t se_tmr_lock; | 746 | spinlock_t se_tmr_lock; |
747 | spinlock_t qf_cmd_lock; | ||
799 | /* Used for legacy SPC-2 reservationsa */ | 748 | /* Used for legacy SPC-2 reservationsa */ |
800 | struct se_node_acl *dev_reserved_node_acl; | 749 | struct se_node_acl *dev_reserved_node_acl; |
801 | /* Used for ALUA Logical Unit Group membership */ | 750 | /* Used for ALUA Logical Unit Group membership */ |
@@ -809,10 +758,12 @@ struct se_device { | |||
809 | struct task_struct *process_thread; | 758 | struct task_struct *process_thread; |
810 | pid_t process_thread_pid; | 759 | pid_t process_thread_pid; |
811 | struct task_struct *dev_mgmt_thread; | 760 | struct task_struct *dev_mgmt_thread; |
761 | struct work_struct qf_work_queue; | ||
812 | struct list_head delayed_cmd_list; | 762 | struct list_head delayed_cmd_list; |
813 | struct list_head ordered_cmd_list; | 763 | struct list_head ordered_cmd_list; |
814 | struct list_head execute_task_list; | 764 | struct list_head execute_task_list; |
815 | struct list_head state_task_list; | 765 | struct list_head state_task_list; |
766 | struct list_head qf_cmd_list; | ||
816 | /* Pointer to associated SE HBA */ | 767 | /* Pointer to associated SE HBA */ |
817 | struct se_hba *se_hba; | 768 | struct se_hba *se_hba; |
818 | struct se_subsystem_dev *se_sub_dev; | 769 | struct se_subsystem_dev *se_sub_dev; |
@@ -824,11 +775,6 @@ struct se_device { | |||
824 | struct list_head g_se_dev_list; | 775 | struct list_head g_se_dev_list; |
825 | } ____cacheline_aligned; | 776 | } ____cacheline_aligned; |
826 | 777 | ||
827 | #define SE_DEV(cmd) ((cmd)->se_lun->lun_se_dev) | ||
828 | #define SU_DEV(dev) ((dev)->se_sub_dev) | ||
829 | #define DEV_ATTRIB(dev) (&(dev)->se_sub_dev->se_dev_attrib) | ||
830 | #define DEV_T10_WWN(dev) (&(dev)->se_sub_dev->t10_wwn) | ||
831 | |||
832 | struct se_hba { | 778 | struct se_hba { |
833 | u16 hba_tpgt; | 779 | u16 hba_tpgt; |
834 | u32 hba_id; | 780 | u32 hba_id; |
@@ -837,24 +783,17 @@ struct se_hba { | |||
837 | /* Virtual iSCSI devices attached. */ | 783 | /* Virtual iSCSI devices attached. */ |
838 | u32 dev_count; | 784 | u32 dev_count; |
839 | u32 hba_index; | 785 | u32 hba_index; |
840 | atomic_t load_balance_queue; | ||
841 | atomic_t left_queue_depth; | ||
842 | /* Maximum queue depth the HBA can handle. */ | ||
843 | atomic_t max_queue_depth; | ||
844 | /* Pointer to transport specific host structure. */ | 786 | /* Pointer to transport specific host structure. */ |
845 | void *hba_ptr; | 787 | void *hba_ptr; |
846 | /* Linked list for struct se_device */ | 788 | /* Linked list for struct se_device */ |
847 | struct list_head hba_dev_list; | 789 | struct list_head hba_dev_list; |
848 | struct list_head hba_list; | 790 | struct list_head hba_node; |
849 | spinlock_t device_lock; | 791 | spinlock_t device_lock; |
850 | spinlock_t hba_queue_lock; | ||
851 | struct config_group hba_group; | 792 | struct config_group hba_group; |
852 | struct mutex hba_access_mutex; | 793 | struct mutex hba_access_mutex; |
853 | struct se_subsystem_api *transport; | 794 | struct se_subsystem_api *transport; |
854 | } ____cacheline_aligned; | 795 | } ____cacheline_aligned; |
855 | 796 | ||
856 | #define SE_HBA(dev) ((dev)->se_hba) | ||
857 | |||
858 | struct se_port_stat_grps { | 797 | struct se_port_stat_grps { |
859 | struct config_group stat_group; | 798 | struct config_group stat_group; |
860 | struct config_group scsi_port_group; | 799 | struct config_group scsi_port_group; |
@@ -881,9 +820,6 @@ struct se_lun { | |||
881 | struct se_port_stat_grps port_stat_grps; | 820 | struct se_port_stat_grps port_stat_grps; |
882 | } ____cacheline_aligned; | 821 | } ____cacheline_aligned; |
883 | 822 | ||
884 | #define SE_LUN(cmd) ((cmd)->se_lun) | ||
885 | #define PORT_STAT_GRP(lun) (&(lun)->port_stat_grps) | ||
886 | |||
887 | struct scsi_port_stats { | 823 | struct scsi_port_stats { |
888 | u64 cmd_pdus; | 824 | u64 cmd_pdus; |
889 | u64 tx_data_octets; | 825 | u64 tx_data_octets; |
@@ -930,7 +866,7 @@ struct se_portal_group { | |||
930 | spinlock_t tpg_lun_lock; | 866 | spinlock_t tpg_lun_lock; |
931 | /* Pointer to $FABRIC_MOD portal group */ | 867 | /* Pointer to $FABRIC_MOD portal group */ |
932 | void *se_tpg_fabric_ptr; | 868 | void *se_tpg_fabric_ptr; |
933 | struct list_head se_tpg_list; | 869 | struct list_head se_tpg_node; |
934 | /* linked list for initiator ACL list */ | 870 | /* linked list for initiator ACL list */ |
935 | struct list_head acl_node_list; | 871 | struct list_head acl_node_list; |
936 | struct se_lun *tpg_lun_list; | 872 | struct se_lun *tpg_lun_list; |
@@ -949,8 +885,6 @@ struct se_portal_group { | |||
949 | struct config_group tpg_param_group; | 885 | struct config_group tpg_param_group; |
950 | } ____cacheline_aligned; | 886 | } ____cacheline_aligned; |
951 | 887 | ||
952 | #define TPG_TFO(se_tpg) ((se_tpg)->se_tpg_tfo) | ||
953 | |||
954 | struct se_wwn { | 888 | struct se_wwn { |
955 | struct target_fabric_configfs *wwn_tf; | 889 | struct target_fabric_configfs *wwn_tf; |
956 | struct config_group wwn_group; | 890 | struct config_group wwn_group; |
@@ -958,28 +892,4 @@ struct se_wwn { | |||
958 | struct config_group fabric_stat_group; | 892 | struct config_group fabric_stat_group; |
959 | } ____cacheline_aligned; | 893 | } ____cacheline_aligned; |
960 | 894 | ||
961 | struct se_global { | ||
962 | u16 alua_lu_gps_counter; | ||
963 | int g_sub_api_initialized; | ||
964 | u32 in_shutdown; | ||
965 | u32 alua_lu_gps_count; | ||
966 | u32 g_hba_id_counter; | ||
967 | struct config_group target_core_hbagroup; | ||
968 | struct config_group alua_group; | ||
969 | struct config_group alua_lu_gps_group; | ||
970 | struct list_head g_lu_gps_list; | ||
971 | struct list_head g_se_tpg_list; | ||
972 | struct list_head g_hba_list; | ||
973 | struct list_head g_se_dev_list; | ||
974 | struct se_hba *g_lun0_hba; | ||
975 | struct se_subsystem_dev *g_lun0_su_dev; | ||
976 | struct se_device *g_lun0_dev; | ||
977 | struct t10_alua_lu_gp *default_lu_gp; | ||
978 | spinlock_t g_device_lock; | ||
979 | spinlock_t hba_lock; | ||
980 | spinlock_t se_tpg_lock; | ||
981 | spinlock_t lu_gps_lock; | ||
982 | spinlock_t plugin_class_lock; | ||
983 | } ____cacheline_aligned; | ||
984 | |||
985 | #endif /* TARGET_CORE_BASE_H */ | 895 | #endif /* TARGET_CORE_BASE_H */ |
diff --git a/include/target/target_core_device.h b/include/target/target_core_device.h index 52b18a5752c9..2be31ff8763b 100644 --- a/include/target/target_core_device.h +++ b/include/target/target_core_device.h | |||
@@ -1,8 +1,8 @@ | |||
1 | #ifndef TARGET_CORE_DEVICE_H | 1 | #ifndef TARGET_CORE_DEVICE_H |
2 | #define TARGET_CORE_DEVICE_H | 2 | #define TARGET_CORE_DEVICE_H |
3 | 3 | ||
4 | extern int transport_get_lun_for_cmd(struct se_cmd *, unsigned char *, u32); | 4 | extern int transport_lookup_cmd_lun(struct se_cmd *, u32); |
5 | extern int transport_get_lun_for_tmr(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( | 6 | extern struct se_dev_entry *core_get_se_deve_from_rtpi( |
7 | struct se_node_acl *, u16); | 7 | struct se_node_acl *, u16); |
8 | extern int core_free_device_list_for_node(struct se_node_acl *, | 8 | extern int core_free_device_list_for_node(struct se_node_acl *, |
@@ -17,7 +17,7 @@ extern int core_dev_export(struct se_device *, struct se_portal_group *, | |||
17 | struct se_lun *); | 17 | struct se_lun *); |
18 | extern void core_dev_unexport(struct se_device *, struct se_portal_group *, | 18 | extern void core_dev_unexport(struct se_device *, struct se_portal_group *, |
19 | struct se_lun *); | 19 | struct se_lun *); |
20 | extern int transport_core_report_lun_response(struct se_cmd *); | 20 | extern int target_report_luns(struct se_task *); |
21 | extern void se_release_device_for_hba(struct se_device *); | 21 | extern void se_release_device_for_hba(struct se_device *); |
22 | extern void se_release_vpd_for_dev(struct se_device *); | 22 | extern void se_release_vpd_for_dev(struct se_device *); |
23 | extern void se_clear_dev_ports(struct se_device *); | 23 | extern void se_clear_dev_ports(struct se_device *); |
@@ -39,6 +39,8 @@ extern int se_dev_set_emulate_tas(struct se_device *, int); | |||
39 | extern int se_dev_set_emulate_tpu(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); | 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); | 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); | ||
42 | extern int se_dev_set_queue_depth(struct se_device *, u32); | 44 | extern int se_dev_set_queue_depth(struct se_device *, u32); |
43 | extern int se_dev_set_max_sectors(struct se_device *, u32); | 45 | extern int se_dev_set_max_sectors(struct se_device *, u32); |
44 | extern int se_dev_set_optimal_sectors(struct se_device *, u32); | 46 | extern int se_dev_set_optimal_sectors(struct se_device *, u32); |
diff --git a/include/target/target_core_fabric_ops.h b/include/target/target_core_fabric_ops.h index 747e1404dca0..0256825f923d 100644 --- a/include/target/target_core_fabric_ops.h +++ b/include/target/target_core_fabric_ops.h | |||
@@ -27,6 +27,12 @@ struct target_core_fabric_ops { | |||
27 | int (*tpg_check_demo_mode_cache)(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 *); | 28 | int (*tpg_check_demo_mode_write_protect)(struct se_portal_group *); |
29 | int (*tpg_check_prod_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 *); | ||
30 | struct se_node_acl *(*tpg_alloc_fabric_acl)( | 36 | struct se_node_acl *(*tpg_alloc_fabric_acl)( |
31 | struct se_portal_group *); | 37 | struct se_portal_group *); |
32 | void (*tpg_release_fabric_acl)(struct se_portal_group *, | 38 | void (*tpg_release_fabric_acl)(struct se_portal_group *, |
@@ -39,17 +45,18 @@ struct target_core_fabric_ops { | |||
39 | */ | 45 | */ |
40 | int (*new_cmd_map)(struct se_cmd *); | 46 | int (*new_cmd_map)(struct se_cmd *); |
41 | /* | 47 | /* |
42 | * Optional function pointer for TCM fabric modules that use | 48 | * Optional to release struct se_cmd and fabric dependent allocated |
43 | * Linux/NET sockets to allocate struct iovec array to struct se_cmd | 49 | * I/O descriptor in transport_cmd_check_stop(). |
50 | * | ||
51 | * Returning 1 will signal a descriptor has been released. | ||
52 | * Returning 0 will signal a descriptor has not been released. | ||
44 | */ | 53 | */ |
45 | int (*alloc_cmd_iovecs)(struct se_cmd *); | 54 | int (*check_stop_free)(struct se_cmd *); |
46 | /* | 55 | /* |
47 | * Optional to release struct se_cmd and fabric dependent allocated | 56 | * Optional check for active I/O shutdown |
48 | * I/O descriptor in transport_cmd_check_stop() | ||
49 | */ | 57 | */ |
50 | void (*check_stop_free)(struct se_cmd *); | 58 | int (*check_release_cmd)(struct se_cmd *); |
51 | void (*release_cmd_to_pool)(struct se_cmd *); | 59 | void (*release_cmd)(struct se_cmd *); |
52 | void (*release_cmd_direct)(struct se_cmd *); | ||
53 | /* | 60 | /* |
54 | * Called with spin_lock_bh(struct se_portal_group->session_lock held. | 61 | * Called with spin_lock_bh(struct se_portal_group->session_lock held. |
55 | */ | 62 | */ |
@@ -70,7 +77,6 @@ struct target_core_fabric_ops { | |||
70 | void (*set_default_node_attributes)(struct se_node_acl *); | 77 | void (*set_default_node_attributes)(struct se_node_acl *); |
71 | u32 (*get_task_tag)(struct se_cmd *); | 78 | u32 (*get_task_tag)(struct se_cmd *); |
72 | int (*get_cmd_state)(struct se_cmd *); | 79 | int (*get_cmd_state)(struct se_cmd *); |
73 | void (*new_cmd_failure)(struct se_cmd *); | ||
74 | int (*queue_data_in)(struct se_cmd *); | 80 | int (*queue_data_in)(struct se_cmd *); |
75 | int (*queue_status)(struct se_cmd *); | 81 | int (*queue_status)(struct se_cmd *); |
76 | int (*queue_tm_rsp)(struct se_cmd *); | 82 | int (*queue_tm_rsp)(struct se_cmd *); |
diff --git a/include/target/target_core_tmr.h b/include/target/target_core_tmr.h index bd5596807478..d5876e17d3fb 100644 --- a/include/target/target_core_tmr.h +++ b/include/target/target_core_tmr.h | |||
@@ -27,7 +27,7 @@ enum tcm_tmrsp_table { | |||
27 | 27 | ||
28 | extern struct kmem_cache *se_tmr_req_cache; | 28 | extern struct kmem_cache *se_tmr_req_cache; |
29 | 29 | ||
30 | extern struct se_tmr_req *core_tmr_alloc_req(struct se_cmd *, void *, u8); | 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 *); | 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 *, | 32 | extern int core_tmr_lun_reset(struct se_device *, struct se_tmr_req *, |
33 | struct list_head *, struct se_cmd *); | 33 | struct list_head *, struct se_cmd *); |
diff --git a/include/target/target_core_transport.h b/include/target/target_core_transport.h index 24a1c6cb83c3..c16e9431dd01 100644 --- a/include/target/target_core_transport.h +++ b/include/target/target_core_transport.h | |||
@@ -22,10 +22,9 @@ | |||
22 | #define PYX_TRANSPORT_LU_COMM_FAILURE -7 | 22 | #define PYX_TRANSPORT_LU_COMM_FAILURE -7 |
23 | #define PYX_TRANSPORT_UNKNOWN_MODE_PAGE -8 | 23 | #define PYX_TRANSPORT_UNKNOWN_MODE_PAGE -8 |
24 | #define PYX_TRANSPORT_WRITE_PROTECTED -9 | 24 | #define PYX_TRANSPORT_WRITE_PROTECTED -9 |
25 | #define PYX_TRANSPORT_TASK_TIMEOUT -10 | 25 | #define PYX_TRANSPORT_RESERVATION_CONFLICT -10 |
26 | #define PYX_TRANSPORT_RESERVATION_CONFLICT -11 | 26 | #define PYX_TRANSPORT_ILLEGAL_REQUEST -11 |
27 | #define PYX_TRANSPORT_ILLEGAL_REQUEST -12 | 27 | #define PYX_TRANSPORT_USE_SENSE_REASON -12 |
28 | #define PYX_TRANSPORT_USE_SENSE_REASON -13 | ||
29 | 28 | ||
30 | #ifndef SAM_STAT_RESERVATION_CONFLICT | 29 | #ifndef SAM_STAT_RESERVATION_CONFLICT |
31 | #define SAM_STAT_RESERVATION_CONFLICT 0x18 | 30 | #define SAM_STAT_RESERVATION_CONFLICT 0x18 |
@@ -38,16 +37,6 @@ | |||
38 | #define TRANSPORT_PLUGIN_VHBA_PDEV 2 | 37 | #define TRANSPORT_PLUGIN_VHBA_PDEV 2 |
39 | #define TRANSPORT_PLUGIN_VHBA_VDEV 3 | 38 | #define TRANSPORT_PLUGIN_VHBA_VDEV 3 |
40 | 39 | ||
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 | /* | 40 | /* |
52 | * struct se_subsystem_dev->su_dev_flags | 41 | * struct se_subsystem_dev->su_dev_flags |
53 | */ | 42 | */ |
@@ -64,8 +53,6 @@ | |||
64 | #define DF_SPC2_RESERVATIONS_WITH_ISID 0x00000004 | 53 | #define DF_SPC2_RESERVATIONS_WITH_ISID 0x00000004 |
65 | 54 | ||
66 | /* struct se_dev_attrib sanity values */ | 55 | /* struct se_dev_attrib sanity values */ |
67 | /* 10 Minutes */ | ||
68 | #define DA_TASK_TIMEOUT_MAX 600 | ||
69 | /* Default max_unmap_lba_count */ | 56 | /* Default max_unmap_lba_count */ |
70 | #define DA_MAX_UNMAP_LBA_COUNT 0 | 57 | #define DA_MAX_UNMAP_LBA_COUNT 0 |
71 | /* Default max_unmap_block_desc_count */ | 58 | /* Default max_unmap_block_desc_count */ |
@@ -101,22 +88,22 @@ | |||
101 | #define DA_ENFORCE_PR_ISIDS 1 | 88 | #define DA_ENFORCE_PR_ISIDS 1 |
102 | #define DA_STATUS_MAX_SECTORS_MIN 16 | 89 | #define DA_STATUS_MAX_SECTORS_MIN 16 |
103 | #define DA_STATUS_MAX_SECTORS_MAX 8192 | 90 | #define DA_STATUS_MAX_SECTORS_MAX 8192 |
91 | /* By default don't report non-rotating (solid state) medium */ | ||
92 | #define DA_IS_NONROT 0 | ||
93 | /* Queue Algorithm Modifier default for restricted reordering in control mode page */ | ||
94 | #define DA_EMULATE_REST_REORD 0 | ||
104 | 95 | ||
105 | #define SE_MODE_PAGE_BUF 512 | 96 | #define SE_MODE_PAGE_BUF 512 |
106 | 97 | ||
107 | #define MOD_MAX_SECTORS(ms, bs) (ms % (PAGE_SIZE / bs)) | 98 | #define MOD_MAX_SECTORS(ms, bs) (ms % (PAGE_SIZE / bs)) |
108 | 99 | ||
109 | struct se_mem; | ||
110 | struct se_subsystem_api; | 100 | struct se_subsystem_api; |
111 | 101 | ||
112 | extern struct kmem_cache *se_mem_cache; | 102 | extern int init_se_kmem_caches(void); |
113 | 103 | extern void release_se_kmem_caches(void); | |
114 | extern int init_se_global(void); | ||
115 | extern void release_se_global(void); | ||
116 | extern void init_scsi_index_table(void); | ||
117 | extern u32 scsi_get_new_index(scsi_index_t); | 104 | extern u32 scsi_get_new_index(scsi_index_t); |
118 | extern void transport_init_queue_obj(struct se_queue_obj *); | 105 | extern void transport_init_queue_obj(struct se_queue_obj *); |
119 | extern int transport_subsystem_check_init(void); | 106 | extern void transport_subsystem_check_init(void); |
120 | extern int transport_subsystem_register(struct se_subsystem_api *); | 107 | extern int transport_subsystem_register(struct se_subsystem_api *); |
121 | extern void transport_subsystem_release(struct se_subsystem_api *); | 108 | extern void transport_subsystem_release(struct se_subsystem_api *); |
122 | extern void transport_load_plugins(void); | 109 | extern void transport_load_plugins(void); |
@@ -131,7 +118,6 @@ extern void transport_free_session(struct se_session *); | |||
131 | extern void transport_deregister_session_configfs(struct se_session *); | 118 | extern void transport_deregister_session_configfs(struct se_session *); |
132 | extern void transport_deregister_session(struct se_session *); | 119 | extern void transport_deregister_session(struct se_session *); |
133 | extern void transport_cmd_finish_abort(struct se_cmd *, int); | 120 | extern void transport_cmd_finish_abort(struct se_cmd *, int); |
134 | extern void transport_cmd_finish_abort_tmr(struct se_cmd *); | ||
135 | extern void transport_complete_sync_cache(struct se_cmd *, int); | 121 | extern void transport_complete_sync_cache(struct se_cmd *, int); |
136 | extern void transport_complete_task(struct se_task *, int); | 122 | extern void transport_complete_task(struct se_task *, int); |
137 | extern void transport_add_task_to_execute_queue(struct se_task *, | 123 | extern void transport_add_task_to_execute_queue(struct se_task *, |
@@ -139,6 +125,8 @@ extern void transport_add_task_to_execute_queue(struct se_task *, | |||
139 | struct se_device *); | 125 | struct se_device *); |
140 | extern void transport_remove_task_from_execute_queue(struct se_task *, | 126 | extern void transport_remove_task_from_execute_queue(struct se_task *, |
141 | struct se_device *); | 127 | struct se_device *); |
128 | extern void __transport_remove_task_from_execute_queue(struct se_task *, | ||
129 | struct se_device *); | ||
142 | unsigned char *transport_dump_cmd_direction(struct se_cmd *); | 130 | unsigned char *transport_dump_cmd_direction(struct se_cmd *); |
143 | extern void transport_dump_dev_state(struct se_device *, char *, int *); | 131 | extern void transport_dump_dev_state(struct se_device *, char *, int *); |
144 | extern void transport_dump_dev_info(struct se_device *, struct se_lun *, | 132 | extern void transport_dump_dev_info(struct se_device *, struct se_lun *, |
@@ -160,41 +148,42 @@ extern struct se_device *transport_add_device_to_core_hba(struct se_hba *, | |||
160 | struct se_subsystem_dev *, u32, | 148 | struct se_subsystem_dev *, u32, |
161 | void *, struct se_dev_limits *, | 149 | void *, struct se_dev_limits *, |
162 | const char *, const char *); | 150 | const char *, const char *); |
163 | extern void transport_device_setup_cmd(struct se_cmd *); | ||
164 | extern void transport_init_se_cmd(struct se_cmd *, | 151 | extern void transport_init_se_cmd(struct se_cmd *, |
165 | struct target_core_fabric_ops *, | 152 | struct target_core_fabric_ops *, |
166 | struct se_session *, u32, int, int, | 153 | struct se_session *, u32, int, int, |
167 | unsigned char *); | 154 | unsigned char *); |
168 | extern void transport_free_se_cmd(struct se_cmd *); | 155 | void *transport_kmap_first_data_page(struct se_cmd *cmd); |
156 | void transport_kunmap_first_data_page(struct se_cmd *cmd); | ||
169 | extern int transport_generic_allocate_tasks(struct se_cmd *, unsigned char *); | 157 | extern int transport_generic_allocate_tasks(struct se_cmd *, unsigned char *); |
170 | extern int transport_generic_handle_cdb(struct se_cmd *); | 158 | extern int transport_handle_cdb_direct(struct se_cmd *); |
171 | extern int transport_generic_handle_cdb_map(struct se_cmd *); | 159 | extern int transport_generic_handle_cdb_map(struct se_cmd *); |
172 | extern int transport_generic_handle_data(struct se_cmd *); | 160 | extern int transport_generic_handle_data(struct se_cmd *); |
173 | extern void transport_new_cmd_failure(struct se_cmd *); | 161 | extern void transport_new_cmd_failure(struct se_cmd *); |
174 | extern int transport_generic_handle_tmr(struct se_cmd *); | 162 | extern int transport_generic_handle_tmr(struct se_cmd *); |
175 | extern void transport_generic_free_cmd_intr(struct se_cmd *); | 163 | extern bool target_stop_task(struct se_task *task, unsigned long *flags); |
176 | extern void __transport_stop_task_timer(struct se_task *, unsigned long *); | ||
177 | extern unsigned char transport_asciihex_to_binaryhex(unsigned char val[2]); | ||
178 | extern int transport_generic_map_mem_to_cmd(struct se_cmd *cmd, struct scatterlist *, u32, | 164 | extern int transport_generic_map_mem_to_cmd(struct se_cmd *cmd, struct scatterlist *, u32, |
179 | struct scatterlist *, u32); | 165 | struct scatterlist *, u32); |
180 | extern int transport_clear_lun_from_sessions(struct se_lun *); | 166 | extern int transport_clear_lun_from_sessions(struct se_lun *); |
167 | extern bool transport_wait_for_tasks(struct se_cmd *); | ||
181 | extern int transport_check_aborted_status(struct se_cmd *, int); | 168 | extern int transport_check_aborted_status(struct se_cmd *, int); |
182 | extern int transport_send_check_condition_and_sense(struct se_cmd *, u8, int); | 169 | extern int transport_send_check_condition_and_sense(struct se_cmd *, u8, int); |
183 | extern void transport_send_task_abort(struct se_cmd *); | 170 | extern void transport_send_task_abort(struct se_cmd *); |
184 | extern void transport_release_cmd_to_pool(struct se_cmd *); | 171 | extern void transport_release_cmd(struct se_cmd *); |
185 | extern void transport_generic_free_cmd(struct se_cmd *, int, int, int); | 172 | extern void transport_generic_free_cmd(struct se_cmd *, int); |
173 | extern void target_get_sess_cmd(struct se_session *, struct se_cmd *); | ||
174 | extern int target_put_sess_cmd(struct se_session *, struct se_cmd *); | ||
175 | extern void target_splice_sess_cmd_list(struct se_session *); | ||
176 | extern void target_wait_for_sess_cmds(struct se_session *, int); | ||
186 | extern void transport_generic_wait_for_cmds(struct se_cmd *, int); | 177 | extern void transport_generic_wait_for_cmds(struct se_cmd *, int); |
187 | extern u32 transport_calc_sg_num(struct se_task *, struct se_mem *, u32); | ||
188 | extern int transport_map_mem_to_sg(struct se_task *, struct list_head *, | ||
189 | void *, struct se_mem *, | ||
190 | struct se_mem **, u32 *, u32 *); | ||
191 | extern void transport_do_task_sg_chain(struct se_cmd *); | 178 | extern void transport_do_task_sg_chain(struct se_cmd *); |
192 | extern void transport_generic_process_write(struct se_cmd *); | 179 | extern void transport_generic_process_write(struct se_cmd *); |
180 | extern int transport_generic_new_cmd(struct se_cmd *); | ||
193 | extern int transport_generic_do_tmr(struct se_cmd *); | 181 | extern int transport_generic_do_tmr(struct se_cmd *); |
194 | /* From target_core_alua.c */ | 182 | /* From target_core_alua.c */ |
195 | extern int core_alua_check_nonop_delay(struct se_cmd *); | 183 | extern int core_alua_check_nonop_delay(struct se_cmd *); |
196 | /* From target_core_cdb.c */ | 184 | /* From target_core_cdb.c */ |
197 | extern int transport_emulate_control_cdb(struct se_task *); | 185 | extern int transport_emulate_control_cdb(struct se_task *); |
186 | extern void target_get_task_cdb(struct se_task *task, unsigned char *cdb); | ||
198 | 187 | ||
199 | /* | 188 | /* |
200 | * Each se_transport_task_t can have N number of possible struct se_task's | 189 | * Each se_transport_task_t can have N number of possible struct se_task's |
@@ -222,6 +211,10 @@ struct se_subsystem_api { | |||
222 | * Transport Type. | 211 | * Transport Type. |
223 | */ | 212 | */ |
224 | u8 transport_type; | 213 | u8 transport_type; |
214 | |||
215 | unsigned int fua_write_emulated : 1; | ||
216 | unsigned int write_cache_emulated : 1; | ||
217 | |||
225 | /* | 218 | /* |
226 | * struct module for struct se_hba references | 219 | * struct module for struct se_hba references |
227 | */ | 220 | */ |
@@ -231,18 +224,6 @@ struct se_subsystem_api { | |||
231 | */ | 224 | */ |
232 | struct list_head sub_api_list; | 225 | struct list_head sub_api_list; |
233 | /* | 226 | /* |
234 | * For SCF_SCSI_NON_DATA_CDB | ||
235 | */ | ||
236 | int (*cdb_none)(struct se_task *); | ||
237 | /* | ||
238 | * For SCF_SCSI_CONTROL_NONSG_IO_CDB | ||
239 | */ | ||
240 | int (*map_task_non_SG)(struct se_task *); | ||
241 | /* | ||
242 | * For SCF_SCSI_DATA_SG_IO_CDB and SCF_SCSI_CONTROL_SG_IO_CDB | ||
243 | */ | ||
244 | int (*map_task_SG)(struct se_task *); | ||
245 | /* | ||
246 | * attach_hba(): | 227 | * attach_hba(): |
247 | */ | 228 | */ |
248 | int (*attach_hba)(struct se_hba *, u32); | 229 | int (*attach_hba)(struct se_hba *, u32); |
@@ -270,29 +251,13 @@ struct se_subsystem_api { | |||
270 | void (*free_device)(void *); | 251 | void (*free_device)(void *); |
271 | 252 | ||
272 | /* | 253 | /* |
273 | * dpo_emulated(): | ||
274 | */ | ||
275 | int (*dpo_emulated)(struct se_device *); | ||
276 | /* | ||
277 | * fua_write_emulated(): | ||
278 | */ | ||
279 | int (*fua_write_emulated)(struct se_device *); | ||
280 | /* | ||
281 | * fua_read_emulated(): | ||
282 | */ | ||
283 | int (*fua_read_emulated)(struct se_device *); | ||
284 | /* | ||
285 | * write_cache_emulated(): | ||
286 | */ | ||
287 | int (*write_cache_emulated)(struct se_device *); | ||
288 | /* | ||
289 | * transport_complete(): | 254 | * transport_complete(): |
290 | * | 255 | * |
291 | * Use transport_generic_complete() for majority of DAS transport | 256 | * Use transport_generic_complete() for majority of DAS transport |
292 | * drivers. Provided out of convenience. | 257 | * drivers. Provided out of convenience. |
293 | */ | 258 | */ |
294 | int (*transport_complete)(struct se_task *task); | 259 | int (*transport_complete)(struct se_task *task); |
295 | struct se_task *(*alloc_task)(struct se_cmd *); | 260 | struct se_task *(*alloc_task)(unsigned char *cdb); |
296 | /* | 261 | /* |
297 | * do_task(): | 262 | * do_task(): |
298 | */ | 263 | */ |
@@ -326,10 +291,6 @@ struct se_subsystem_api { | |||
326 | ssize_t (*show_configfs_dev_params)(struct se_hba *, struct se_subsystem_dev *, | 291 | ssize_t (*show_configfs_dev_params)(struct se_hba *, struct se_subsystem_dev *, |
327 | char *); | 292 | char *); |
328 | /* | 293 | /* |
329 | * get_cdb(): | ||
330 | */ | ||
331 | unsigned char *(*get_cdb)(struct se_task *); | ||
332 | /* | ||
333 | * get_device_rev(): | 294 | * get_device_rev(): |
334 | */ | 295 | */ |
335 | u32 (*get_device_rev)(struct se_device *); | 296 | u32 (*get_device_rev)(struct se_device *); |
@@ -342,19 +303,9 @@ struct se_subsystem_api { | |||
342 | */ | 303 | */ |
343 | sector_t (*get_blocks)(struct se_device *); | 304 | sector_t (*get_blocks)(struct se_device *); |
344 | /* | 305 | /* |
345 | * do_se_mem_map(): | ||
346 | */ | ||
347 | int (*do_se_mem_map)(struct se_task *, struct list_head *, void *, | ||
348 | struct se_mem *, struct se_mem **, u32 *, u32 *); | ||
349 | /* | ||
350 | * get_sense_buffer(): | 306 | * get_sense_buffer(): |
351 | */ | 307 | */ |
352 | unsigned char *(*get_sense_buffer)(struct se_task *); | 308 | unsigned char *(*get_sense_buffer)(struct se_task *); |
353 | } ____cacheline_aligned; | 309 | } ____cacheline_aligned; |
354 | 310 | ||
355 | #define TRANSPORT(dev) ((dev)->transport) | ||
356 | #define HBA_TRANSPORT(hba) ((hba)->transport) | ||
357 | |||
358 | extern struct se_global *se_global; | ||
359 | |||
360 | #endif /* TARGET_CORE_TRANSPORT_H */ | 311 | #endif /* TARGET_CORE_TRANSPORT_H */ |