aboutsummaryrefslogtreecommitdiffstats
path: root/include/target/target_core_base.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/target/target_core_base.h')
-rw-r--r--include/target/target_core_base.h71
1 files changed, 21 insertions, 50 deletions
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index 27040653005..35aa786f93d 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -10,10 +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 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 */
18/* Don't raise above 511 or REPORT_LUNS needs to handle >1 page */ 15/* Don't raise above 511 or REPORT_LUNS needs to handle >1 page */
19#define TRANSPORT_MAX_LUNS_PER_TPG 256 16#define TRANSPORT_MAX_LUNS_PER_TPG 256
@@ -75,32 +72,26 @@ enum transport_tpg_type_table {
75}; 72};
76 73
77/* Used for generate timer flags */ 74/* Used for generate timer flags */
78enum timer_flags_table { 75enum se_task_flags {
79 TF_RUNNING = 0x01, 76 TF_ACTIVE = (1 << 0),
80 TF_STOP = 0x02, 77 TF_SENT = (1 << 1),
78 TF_REQUEST_STOP = (1 << 2),
81}; 79};
82 80
83/* Special transport agnostic struct se_cmd->t_states */ 81/* Special transport agnostic struct se_cmd->t_states */
84enum transport_state_table { 82enum transport_state_table {
85 TRANSPORT_NO_STATE = 0, 83 TRANSPORT_NO_STATE = 0,
86 TRANSPORT_NEW_CMD = 1, 84 TRANSPORT_NEW_CMD = 1,
87 TRANSPORT_DEFERRED_CMD = 2,
88 TRANSPORT_WRITE_PENDING = 3, 85 TRANSPORT_WRITE_PENDING = 3,
89 TRANSPORT_PROCESS_WRITE = 4, 86 TRANSPORT_PROCESS_WRITE = 4,
90 TRANSPORT_PROCESSING = 5, 87 TRANSPORT_PROCESSING = 5,
91 TRANSPORT_COMPLETE_OK = 6, 88 TRANSPORT_COMPLETE = 6,
92 TRANSPORT_COMPLETE_FAILURE = 7,
93 TRANSPORT_COMPLETE_TIMEOUT = 8,
94 TRANSPORT_PROCESS_TMR = 9, 89 TRANSPORT_PROCESS_TMR = 9,
95 TRANSPORT_TMR_COMPLETE = 10,
96 TRANSPORT_ISTATE_PROCESSING = 11, 90 TRANSPORT_ISTATE_PROCESSING = 11,
97 TRANSPORT_ISTATE_PROCESSED = 12,
98 TRANSPORT_KILL = 13,
99 TRANSPORT_REMOVE = 14,
100 TRANSPORT_FREE = 15,
101 TRANSPORT_NEW_CMD_MAP = 16, 91 TRANSPORT_NEW_CMD_MAP = 16,
102 TRANSPORT_FREE_CMD_INTR = 17, 92 TRANSPORT_FREE_CMD_INTR = 17,
103 TRANSPORT_COMPLETE_QF_WP = 18, 93 TRANSPORT_COMPLETE_QF_WP = 18,
94 TRANSPORT_COMPLETE_QF_OK = 19,
104}; 95};
105 96
106/* Used for struct se_cmd->se_cmd_flags */ 97/* Used for struct se_cmd->se_cmd_flags */
@@ -125,7 +116,6 @@ enum se_cmd_flags_table {
125 SCF_UNUSED = 0x00100000, 116 SCF_UNUSED = 0x00100000,
126 SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC = 0x00400000, 117 SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC = 0x00400000,
127 SCF_EMULATE_CDB_ASYNC = 0x01000000, 118 SCF_EMULATE_CDB_ASYNC = 0x01000000,
128 SCF_EMULATE_QUEUE_FULL = 0x02000000,
129}; 119};
130 120
131/* struct se_dev_entry->lun_flags and struct se_lun->lun_access */ 121/* struct se_dev_entry->lun_flags and struct se_lun->lun_access */
@@ -401,34 +391,22 @@ struct se_queue_obj {
401} ____cacheline_aligned; 391} ____cacheline_aligned;
402 392
403struct se_task { 393struct se_task {
404 unsigned char task_sense;
405 struct scatterlist *task_sg;
406 u32 task_sg_nents;
407 struct scatterlist *task_sg_bidi;
408 u8 task_scsi_status;
409 u8 task_flags;
410 int task_error_status;
411 int task_state_flags;
412 bool task_padded_sg;
413 unsigned long long task_lba; 394 unsigned long long task_lba;
414 u32 task_no; 395 u32 task_sectors;
415 u32 task_sectors; 396 u32 task_size;
416 u32 task_size; 397 struct se_cmd *task_se_cmd;
398 struct scatterlist *task_sg;
399 u32 task_sg_nents;
400 u16 task_flags;
401 u8 task_sense;
402 u8 task_scsi_status;
403 int task_error_status;
417 enum dma_data_direction task_data_direction; 404 enum dma_data_direction task_data_direction;
418 struct se_cmd *task_se_cmd; 405 atomic_t task_state_active;
419 struct se_device *se_dev; 406 struct list_head t_list;
407 struct list_head t_execute_list;
408 struct list_head t_state_list;
420 struct completion task_stop_comp; 409 struct completion task_stop_comp;
421 atomic_t task_active;
422 atomic_t task_execute_queue;
423 atomic_t task_timeout;
424 atomic_t task_sent;
425 atomic_t task_stop;
426 atomic_t task_state_active;
427 struct timer_list task_timer;
428 struct se_device *se_obj_ptr;
429 struct list_head t_list;
430 struct list_head t_execute_list;
431 struct list_head t_state_list;
432} ____cacheline_aligned; 410} ____cacheline_aligned;
433 411
434struct se_cmd { 412struct se_cmd {
@@ -446,8 +424,6 @@ struct se_cmd {
446 int sam_task_attr; 424 int sam_task_attr;
447 /* Transport protocol dependent state, see transport_state_table */ 425 /* Transport protocol dependent state, see transport_state_table */
448 enum transport_state_table t_state; 426 enum transport_state_table t_state;
449 /* Transport protocol dependent state for out of order CmdSNs */
450 int deferred_t_state;
451 /* Transport specific error status */ 427 /* Transport specific error status */
452 int transport_error_status; 428 int transport_error_status;
453 /* See se_cmd_flags_table */ 429 /* See se_cmd_flags_table */
@@ -461,7 +437,6 @@ struct se_cmd {
461 u32 orig_fe_lun; 437 u32 orig_fe_lun;
462 /* Persistent Reservation key */ 438 /* Persistent Reservation key */
463 u64 pr_res_key; 439 u64 pr_res_key;
464 atomic_t transport_sent;
465 /* Used for sense data */ 440 /* Used for sense data */
466 void *sense_buffer; 441 void *sense_buffer;
467 struct list_head se_delayed_node; 442 struct list_head se_delayed_node;
@@ -479,10 +454,7 @@ struct se_cmd {
479 struct list_head se_queue_node; 454 struct list_head se_queue_node;
480 struct target_core_fabric_ops *se_tfo; 455 struct target_core_fabric_ops *se_tfo;
481 int (*transport_emulate_cdb)(struct se_cmd *); 456 int (*transport_emulate_cdb)(struct se_cmd *);
482 void (*transport_split_cdb)(unsigned long long, u32, unsigned char *);
483 void (*transport_wait_for_tasks)(struct se_cmd *, int, int);
484 void (*transport_complete_callback)(struct se_cmd *); 457 void (*transport_complete_callback)(struct se_cmd *);
485 int (*transport_qf_callback)(struct se_cmd *);
486 458
487 unsigned char *t_task_cdb; 459 unsigned char *t_task_cdb;
488 unsigned char __t_task_cdb[TCM_MAX_COMMAND_SIZE]; 460 unsigned char __t_task_cdb[TCM_MAX_COMMAND_SIZE];
@@ -495,7 +467,6 @@ struct se_cmd {
495 atomic_t t_se_count; 467 atomic_t t_se_count;
496 atomic_t t_task_cdbs_left; 468 atomic_t t_task_cdbs_left;
497 atomic_t t_task_cdbs_ex_left; 469 atomic_t t_task_cdbs_ex_left;
498 atomic_t t_task_cdbs_timeout_left;
499 atomic_t t_task_cdbs_sent; 470 atomic_t t_task_cdbs_sent;
500 atomic_t t_transport_aborted; 471 atomic_t t_transport_aborted;
501 atomic_t t_transport_active; 472 atomic_t t_transport_active;
@@ -503,7 +474,6 @@ struct se_cmd {
503 atomic_t t_transport_queue_active; 474 atomic_t t_transport_queue_active;
504 atomic_t t_transport_sent; 475 atomic_t t_transport_sent;
505 atomic_t t_transport_stop; 476 atomic_t t_transport_stop;
506 atomic_t t_transport_timeout;
507 atomic_t transport_dev_active; 477 atomic_t transport_dev_active;
508 atomic_t transport_lun_active; 478 atomic_t transport_lun_active;
509 atomic_t transport_lun_fe_stop; 479 atomic_t transport_lun_fe_stop;
@@ -514,6 +484,8 @@ struct se_cmd {
514 struct completion transport_lun_stop_comp; 484 struct completion transport_lun_stop_comp;
515 struct scatterlist *t_tasks_sg_chained; 485 struct scatterlist *t_tasks_sg_chained;
516 486
487 struct work_struct work;
488
517 /* 489 /*
518 * Used for pre-registered fabric SGL passthrough WRITE and READ 490 * Used for pre-registered fabric SGL passthrough WRITE and READ
519 * with the special SCF_PASSTHROUGH_CONTIG_TO_SG case for TCM_Loop 491 * with the special SCF_PASSTHROUGH_CONTIG_TO_SG case for TCM_Loop
@@ -670,7 +642,6 @@ struct se_dev_attrib {
670 u32 optimal_sectors; 642 u32 optimal_sectors;
671 u32 hw_queue_depth; 643 u32 hw_queue_depth;
672 u32 queue_depth; 644 u32 queue_depth;
673 u32 task_timeout;
674 u32 max_unmap_lba_count; 645 u32 max_unmap_lba_count;
675 u32 max_unmap_block_desc_count; 646 u32 max_unmap_block_desc_count;
676 u32 unmap_granularity; 647 u32 unmap_granularity;