target: remove the task_sg_bidi field se_task and pSCSI BIDI support
[linux-block.git] / include / target / target_core_base.h
index 27040653005e42f8d4babb506b7badd209cca014..132266b15b7cd97bf7373d7686d9e9b980311ced 100644 (file)
 #include <net/tcp.h>
 
 #define TARGET_CORE_MOD_VERSION                "v4.1.0-rc1-ml"
-#define SHUTDOWN_SIGS  (sigmask(SIGKILL)|sigmask(SIGINT)|sigmask(SIGABRT))
 
-/* Used by transport_generic_allocate_iovecs() */
-#define TRANSPORT_IOV_DATA_BUFFER              5
 /* Maximum Number of LUNs per Target Portal Group */
 /* Don't raise above 511 or REPORT_LUNS needs to handle >1 page */
 #define TRANSPORT_MAX_LUNS_PER_TPG             256
@@ -75,32 +72,27 @@ enum transport_tpg_type_table {
 };
 
 /* Used for generate timer flags */
-enum timer_flags_table {
-       TF_RUNNING      = 0x01,
-       TF_STOP         = 0x02,
+enum se_task_flags {
+       TF_ACTIVE               = (1 << 0),
+       TF_SENT                 = (1 << 1),
+       TF_TIMEOUT              = (1 << 2),
+       TF_REQUEST_STOP         = (1 << 3),
 };
 
 /* Special transport agnostic struct se_cmd->t_states */
 enum transport_state_table {
        TRANSPORT_NO_STATE      = 0,
        TRANSPORT_NEW_CMD       = 1,
-       TRANSPORT_DEFERRED_CMD  = 2,
        TRANSPORT_WRITE_PENDING = 3,
        TRANSPORT_PROCESS_WRITE = 4,
        TRANSPORT_PROCESSING    = 5,
-       TRANSPORT_COMPLETE_OK   = 6,
-       TRANSPORT_COMPLETE_FAILURE = 7,
-       TRANSPORT_COMPLETE_TIMEOUT = 8,
+       TRANSPORT_COMPLETE      = 6,
        TRANSPORT_PROCESS_TMR   = 9,
-       TRANSPORT_TMR_COMPLETE  = 10,
        TRANSPORT_ISTATE_PROCESSING = 11,
-       TRANSPORT_ISTATE_PROCESSED = 12,
-       TRANSPORT_KILL          = 13,
-       TRANSPORT_REMOVE        = 14,
-       TRANSPORT_FREE          = 15,
        TRANSPORT_NEW_CMD_MAP   = 16,
        TRANSPORT_FREE_CMD_INTR = 17,
        TRANSPORT_COMPLETE_QF_WP = 18,
+       TRANSPORT_COMPLETE_QF_OK = 19,
 };
 
 /* Used for struct se_cmd->se_cmd_flags */
@@ -125,7 +117,6 @@ enum se_cmd_flags_table {
        SCF_UNUSED                      = 0x00100000,
        SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC = 0x00400000,
        SCF_EMULATE_CDB_ASYNC           = 0x01000000,
-       SCF_EMULATE_QUEUE_FULL          = 0x02000000,
 };
 
 /* struct se_dev_entry->lun_flags and struct se_lun->lun_access */
@@ -401,34 +392,23 @@ struct se_queue_obj {
 } ____cacheline_aligned;
 
 struct se_task {
-       unsigned char   task_sense;
-       struct scatterlist *task_sg;
-       u32             task_sg_nents;
-       struct scatterlist *task_sg_bidi;
-       u8              task_scsi_status;
-       u8              task_flags;
-       int             task_error_status;
-       int             task_state_flags;
-       bool            task_padded_sg;
        unsigned long long      task_lba;
-       u32             task_no;
-       u32             task_sectors;
-       u32             task_size;
+       u32                     task_sectors;
+       u32                     task_size;
+       struct se_cmd           *task_se_cmd;
+       struct scatterlist      *task_sg;
+       u32                     task_sg_nents;
+       u16                     task_flags;
+       u8                      task_sense;
+       u8                      task_scsi_status;
+       int                     task_error_status;
        enum dma_data_direction task_data_direction;
-       struct se_cmd *task_se_cmd;
-       struct se_device        *se_dev;
-       struct completion       task_stop_comp;
-       atomic_t        task_active;
-       atomic_t        task_execute_queue;
-       atomic_t        task_timeout;
-       atomic_t        task_sent;
-       atomic_t        task_stop;
-       atomic_t        task_state_active;
+       atomic_t                task_state_active;
        struct timer_list       task_timer;
-       struct se_device *se_obj_ptr;
-       struct list_head t_list;
-       struct list_head t_execute_list;
-       struct list_head t_state_list;
+       struct list_head        t_list;
+       struct list_head        t_execute_list;
+       struct list_head        t_state_list;
+       struct completion       task_stop_comp;
 } ____cacheline_aligned;
 
 struct se_cmd {
@@ -446,8 +426,6 @@ struct se_cmd {
        int                     sam_task_attr;
        /* Transport protocol dependent state, see transport_state_table */
        enum transport_state_table t_state;
-       /* Transport protocol dependent state for out of order CmdSNs */
-       int                     deferred_t_state;
        /* Transport specific error status */
        int                     transport_error_status;
        /* See se_cmd_flags_table */
@@ -479,10 +457,7 @@ struct se_cmd {
        struct list_head        se_queue_node;
        struct target_core_fabric_ops *se_tfo;
        int (*transport_emulate_cdb)(struct se_cmd *);
-       void (*transport_split_cdb)(unsigned long long, u32, unsigned char *);
-       void (*transport_wait_for_tasks)(struct se_cmd *, int, int);
        void (*transport_complete_callback)(struct se_cmd *);
-       int (*transport_qf_callback)(struct se_cmd *);
 
        unsigned char           *t_task_cdb;
        unsigned char           __t_task_cdb[TCM_MAX_COMMAND_SIZE];
@@ -514,6 +489,8 @@ struct se_cmd {
        struct completion       transport_lun_stop_comp;
        struct scatterlist      *t_tasks_sg_chained;
 
+       struct work_struct      work;
+
        /*
         * Used for pre-registered fabric SGL passthrough WRITE and READ
         * with the special SCF_PASSTHROUGH_CONTIG_TO_SG case for TCM_Loop