summaryrefslogtreecommitdiffstats
path: root/include/target
diff options
context:
space:
mode:
Diffstat (limited to 'include/target')
-rw-r--r--include/target/target_core_base.h287
-rw-r--r--include/target/target_core_device.h6
-rw-r--r--include/target/target_core_fabric_ops.h15
-rw-r--r--include/target/target_core_tmr.h2
-rw-r--r--include/target/target_core_transport.h104
5 files changed, 133 insertions, 281 deletions
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index 561ac99..35aa786f 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -9,12 +9,10 @@
#include <net/sock.h>
#include <net/tcp.h>
-#define TARGET_CORE_MOD_VERSION "v4.0.0-rc7-ml"
-#define SHUTDOWN_SIGS (sigmask(SIGKILL)|sigmask(SIGINT)|sigmask(SIGABRT))
+#define TARGET_CORE_MOD_VERSION "v4.1.0-rc1-ml"
-/* 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
/*
* By default we use 32-byte CDBs in TCM Core and subsystem plugin code.
@@ -74,31 +72,26 @@ 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_REQUEST_STOP = (1 << 2),
};
/* 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 */
@@ -108,27 +101,21 @@ enum se_cmd_flags_table {
SCF_EMULATED_TASK_SENSE = 0x00000004,
SCF_SCSI_DATA_SG_IO_CDB = 0x00000008,
SCF_SCSI_CONTROL_SG_IO_CDB = 0x00000010,
- SCF_SCSI_CONTROL_NONSG_IO_CDB = 0x00000020,
SCF_SCSI_NON_DATA_CDB = 0x00000040,
SCF_SCSI_CDB_EXCEPTION = 0x00000080,
SCF_SCSI_RESERVATION_CONFLICT = 0x00000100,
- SCF_CMD_PASSTHROUGH_NOALLOC = 0x00000200,
SCF_SE_CMD_FAILED = 0x00000400,
SCF_SE_LUN_CMD = 0x00000800,
SCF_SE_ALLOW_EOO = 0x00001000,
- SCF_SE_DISABLE_ONLINE_CHECK = 0x00002000,
SCF_SENT_CHECK_CONDITION = 0x00004000,
SCF_OVERFLOW_BIT = 0x00008000,
SCF_UNDERFLOW_BIT = 0x00010000,
SCF_SENT_DELAYED_TAS = 0x00020000,
SCF_ALUA_NON_OPTIMIZED = 0x00040000,
SCF_DELAYED_CMD_FROM_SAM_ATTR = 0x00080000,
- SCF_PASSTHROUGH_SG_TO_MEM = 0x00100000,
- SCF_PASSTHROUGH_CONTIG_TO_SG = 0x00200000,
+ SCF_UNUSED = 0x00100000,
SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC = 0x00400000,
- SCF_EMULATE_SYNC_CACHE = 0x00800000,
SCF_EMULATE_CDB_ASYNC = 0x01000000,
- SCF_EMULATE_SYNC_UNMAP = 0x02000000
};
/* struct se_dev_entry->lun_flags and struct se_lun->lun_access */
@@ -205,11 +192,6 @@ typedef enum {
SCSI_INDEX_TYPE_MAX
} scsi_index_t;
-struct scsi_index_table {
- spinlock_t lock;
- u32 scsi_mib_index[SCSI_INDEX_TYPE_MAX];
-} ____cacheline_aligned;
-
struct se_cmd;
struct t10_alua {
@@ -235,7 +217,7 @@ struct t10_alua_lu_gp {
atomic_t lu_gp_ref_cnt;
spinlock_t lu_gp_lock;
struct config_group lu_gp_group;
- struct list_head lu_gp_list;
+ struct list_head lu_gp_node;
struct list_head lu_gp_mem_list;
} ____cacheline_aligned;
@@ -291,10 +273,10 @@ struct t10_vpd {
} ____cacheline_aligned;
struct t10_wwn {
- unsigned char vendor[8];
- unsigned char model[16];
- unsigned char revision[4];
- unsigned char unit_serial[INQUIRY_VPD_SERIAL_LEN];
+ char vendor[8];
+ char model[16];
+ char revision[4];
+ char unit_serial[INQUIRY_VPD_SERIAL_LEN];
spinlock_t t10_vpd_lock;
struct se_subsystem_dev *t10_sub_dev;
struct config_group t10_wwn_group;
@@ -366,13 +348,13 @@ struct t10_reservation_ops {
int (*t10_pr_clear)(struct se_cmd *);
};
-struct t10_reservation_template {
+struct t10_reservation {
/* Reservation effects all target ports */
int pr_all_tg_pt;
/* Activate Persistence across Target Power Loss enabled
* for SCSI device */
int pr_aptpl_active;
- /* Used by struct t10_reservation_template->pr_aptpl_buf_len */
+ /* Used by struct t10_reservation->pr_aptpl_buf_len */
#define PR_APTPL_BUF_LEN 8192
u32 pr_aptpl_buf_len;
u32 pr_generation;
@@ -397,7 +379,7 @@ struct t10_reservation_template {
struct se_queue_req {
int state;
- void *cmd;
+ struct se_cmd *cmd;
struct list_head qr_list;
} ____cacheline_aligned;
@@ -408,96 +390,25 @@ struct se_queue_obj {
wait_queue_head_t thread_wq;
} ____cacheline_aligned;
-/*
- * Used one per struct se_cmd to hold all extra struct se_task
- * metadata. This structure is setup and allocated in
- * drivers/target/target_core_transport.c:__transport_alloc_se_cmd()
- */
-struct se_transport_task {
- unsigned char *t_task_cdb;
- unsigned char __t_task_cdb[TCM_MAX_COMMAND_SIZE];
- unsigned long long t_task_lba;
- int t_tasks_failed;
- int t_tasks_fua;
- bool t_tasks_bidi;
- u32 t_task_cdbs;
- u32 t_tasks_check;
- u32 t_tasks_no;
- u32 t_tasks_sectors;
- u32 t_tasks_se_num;
- u32 t_tasks_se_bidi_num;
- u32 t_tasks_sg_chained_no;
- atomic_t t_fe_count;
- atomic_t t_se_count;
- atomic_t t_task_cdbs_left;
- atomic_t t_task_cdbs_ex_left;
- atomic_t t_task_cdbs_timeout_left;
- atomic_t t_task_cdbs_sent;
- atomic_t t_transport_aborted;
- atomic_t t_transport_active;
- atomic_t t_transport_complete;
- atomic_t t_transport_queue_active;
- atomic_t t_transport_sent;
- atomic_t t_transport_stop;
- atomic_t t_transport_timeout;
- atomic_t transport_dev_active;
- atomic_t transport_lun_active;
- atomic_t transport_lun_fe_stop;
- atomic_t transport_lun_stop;
- spinlock_t t_state_lock;
- struct completion t_transport_stop_comp;
- struct completion transport_lun_fe_stop_comp;
- struct completion transport_lun_stop_comp;
- struct scatterlist *t_tasks_sg_chained;
- struct scatterlist t_tasks_sg_bounce;
- void *t_task_buf;
- /*
- * Used for pre-registered fabric SGL passthrough WRITE and READ
- * with the special SCF_PASSTHROUGH_CONTIG_TO_SG case for TCM_Loop
- * and other HW target mode fabric modules.
- */
- struct scatterlist *t_task_pt_sgl;
- struct list_head *t_mem_list;
- /* Used for BIDI READ */
- struct list_head *t_mem_bidi_list;
- struct list_head t_task_list;
-} ____cacheline_aligned;
-
struct se_task {
- unsigned char task_sense;
- struct scatterlist *task_sg;
- 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_sg_num;
- u32 task_sg_offset;
+ 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;
+ atomic_t task_state_active;
+ struct list_head t_list;
+ struct list_head t_execute_list;
+ struct list_head t_state_list;
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;
- 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;
} ____cacheline_aligned;
-#define TASK_CMD(task) ((task)->task_se_cmd)
-#define TASK_DEV(task) ((task)->se_dev)
-
struct se_cmd {
/* SAM response code being sent to initiator */
u8 scsi_status;
@@ -513,8 +424,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 */
@@ -528,12 +437,12 @@ struct se_cmd {
u32 orig_fe_lun;
/* Persistent Reservation key */
u64 pr_res_key;
- atomic_t transport_sent;
/* Used for sense data */
void *sense_buffer;
- struct list_head se_delayed_list;
- struct list_head se_ordered_list;
- struct list_head se_lun_list;
+ struct list_head se_delayed_node;
+ struct list_head se_ordered_node;
+ struct list_head se_lun_node;
+ struct list_head se_qf_node;
struct se_device *se_dev;
struct se_dev_entry *se_deve;
struct se_device *se_obj_ptr;
@@ -542,18 +451,59 @@ struct se_cmd {
/* Only used for internal passthrough and legacy TCM fabric modules */
struct se_session *se_sess;
struct se_tmr_req *se_tmr_req;
- /* t_task is setup to t_task_backstore in transport_init_se_cmd() */
- struct se_transport_task *t_task;
- struct se_transport_task t_task_backstore;
+ 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 *);
-} ____cacheline_aligned;
-#define T_TASK(cmd) ((cmd)->t_task)
-#define CMD_TFO(cmd) ((cmd)->se_tfo)
+ unsigned char *t_task_cdb;
+ unsigned char __t_task_cdb[TCM_MAX_COMMAND_SIZE];
+ unsigned long long t_task_lba;
+ int t_tasks_failed;
+ int t_tasks_fua;
+ bool t_tasks_bidi;
+ u32 t_tasks_sg_chained_no;
+ atomic_t t_fe_count;
+ atomic_t t_se_count;
+ atomic_t t_task_cdbs_left;
+ atomic_t t_task_cdbs_ex_left;
+ atomic_t t_task_cdbs_sent;
+ atomic_t t_transport_aborted;
+ atomic_t t_transport_active;
+ atomic_t t_transport_complete;
+ atomic_t t_transport_queue_active;
+ atomic_t t_transport_sent;
+ atomic_t t_transport_stop;
+ atomic_t transport_dev_active;
+ atomic_t transport_lun_active;
+ atomic_t transport_lun_fe_stop;
+ atomic_t transport_lun_stop;
+ spinlock_t t_state_lock;
+ struct completion t_transport_stop_comp;
+ struct completion transport_lun_fe_stop_comp;
+ 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
+ * and other HW target mode fabric modules.
+ */
+ struct scatterlist *t_task_pt_sgl;
+ u32 t_task_pt_sgl_num;
+
+ struct scatterlist *t_data_sg;
+ unsigned int t_data_nents;
+ struct scatterlist *t_bidi_data_sg;
+ unsigned int t_bidi_data_nents;
+
+ /* Used for BIDI READ */
+ struct list_head t_task_list;
+ u32 t_task_list_num;
+
+} ____cacheline_aligned;
struct se_tmr_req {
/* Task Management function to be preformed */
@@ -617,9 +567,6 @@ struct se_session {
struct list_head sess_acl_list;
} ____cacheline_aligned;
-#define SE_SESS(cmd) ((cmd)->se_sess)
-#define SE_NODE_ACL(sess) ((sess)->se_node_acl)
-
struct se_device;
struct se_transform_info;
struct scatterlist;
@@ -640,8 +587,6 @@ struct se_lun_acl {
struct se_ml_stat_grps ml_stat_grps;
} ____cacheline_aligned;
-#define ML_STAT_GRPS(lacl) (&(lacl)->ml_stat_grps)
-
struct se_dev_entry {
bool def_pr_registered;
/* See transport_lunflags_table */
@@ -688,6 +633,8 @@ struct se_dev_attrib {
int emulate_reservations;
int emulate_alua;
int enforce_pr_isids;
+ int is_nonrot;
+ int emulate_rest_reord;
u32 hw_block_size;
u32 block_size;
u32 hw_max_sectors;
@@ -695,7 +642,6 @@ struct se_dev_attrib {
u32 optimal_sectors;
u32 hw_queue_depth;
u32 queue_depth;
- u32 task_timeout;
u32 max_unmap_lba_count;
u32 max_unmap_block_desc_count;
u32 unmap_granularity;
@@ -727,10 +673,10 @@ struct se_subsystem_dev {
/* T10 Inquiry and VPD WWN Information */
struct t10_wwn t10_wwn;
/* T10 SPC-2 + SPC-3 Reservations */
- struct t10_reservation_template t10_reservation;
+ struct t10_reservation t10_pr;
spinlock_t se_dev_lock;
void *se_dev_su_ptr;
- struct list_head g_se_dev_list;
+ struct list_head se_dev_node;
struct config_group se_dev_group;
/* For T10 Reservations */
struct config_group se_dev_pr_group;
@@ -738,11 +684,6 @@ struct se_subsystem_dev {
struct se_dev_stat_grps dev_stat_grps;
} ____cacheline_aligned;
-#define T10_ALUA(su_dev) (&(su_dev)->t10_alua)
-#define T10_RES(su_dev) (&(su_dev)->t10_reservation)
-#define T10_PR_OPS(su_dev) (&(su_dev)->t10_reservation.pr_ops)
-#define DEV_STAT_GRP(dev) (&(dev)->dev_stat_grps)
-
struct se_device {
/* Set to 1 if thread is NOT sleeping on thread_sem */
u8 thread_active;
@@ -780,11 +721,11 @@ struct se_device {
atomic_t dev_status_thr_count;
atomic_t dev_hoq_count;
atomic_t dev_ordered_sync;
+ atomic_t dev_qf_count;
struct se_obj dev_obj;
struct se_obj dev_access_obj;
struct se_obj dev_export_obj;
- struct se_queue_obj *dev_queue_obj;
- struct se_queue_obj *dev_status_queue_obj;
+ struct se_queue_obj dev_queue_obj;
spinlock_t delayed_cmd_lock;
spinlock_t ordered_cmd_lock;
spinlock_t execute_task_lock;
@@ -796,6 +737,7 @@ struct se_device {
spinlock_t dev_status_thr_lock;
spinlock_t se_port_lock;
spinlock_t se_tmr_lock;
+ spinlock_t qf_cmd_lock;
/* Used for legacy SPC-2 reservationsa */
struct se_node_acl *dev_reserved_node_acl;
/* Used for ALUA Logical Unit Group membership */
@@ -809,10 +751,12 @@ struct se_device {
struct task_struct *process_thread;
pid_t process_thread_pid;
struct task_struct *dev_mgmt_thread;
+ struct work_struct qf_work_queue;
struct list_head delayed_cmd_list;
struct list_head ordered_cmd_list;
struct list_head execute_task_list;
struct list_head state_task_list;
+ struct list_head qf_cmd_list;
/* Pointer to associated SE HBA */
struct se_hba *se_hba;
struct se_subsystem_dev *se_sub_dev;
@@ -824,11 +768,6 @@ struct se_device {
struct list_head g_se_dev_list;
} ____cacheline_aligned;
-#define SE_DEV(cmd) ((cmd)->se_lun->lun_se_dev)
-#define SU_DEV(dev) ((dev)->se_sub_dev)
-#define DEV_ATTRIB(dev) (&(dev)->se_sub_dev->se_dev_attrib)
-#define DEV_T10_WWN(dev) (&(dev)->se_sub_dev->t10_wwn)
-
struct se_hba {
u16 hba_tpgt;
u32 hba_id;
@@ -837,24 +776,17 @@ struct se_hba {
/* Virtual iSCSI devices attached. */
u32 dev_count;
u32 hba_index;
- atomic_t load_balance_queue;
- atomic_t left_queue_depth;
- /* Maximum queue depth the HBA can handle. */
- atomic_t max_queue_depth;
/* Pointer to transport specific host structure. */
void *hba_ptr;
/* Linked list for struct se_device */
struct list_head hba_dev_list;
- struct list_head hba_list;
+ struct list_head hba_node;
spinlock_t device_lock;
- spinlock_t hba_queue_lock;
struct config_group hba_group;
struct mutex hba_access_mutex;
struct se_subsystem_api *transport;
} ____cacheline_aligned;
-#define SE_HBA(dev) ((dev)->se_hba)
-
struct se_port_stat_grps {
struct config_group stat_group;
struct config_group scsi_port_group;
@@ -881,9 +813,6 @@ struct se_lun {
struct se_port_stat_grps port_stat_grps;
} ____cacheline_aligned;
-#define SE_LUN(cmd) ((cmd)->se_lun)
-#define PORT_STAT_GRP(lun) (&(lun)->port_stat_grps)
-
struct scsi_port_stats {
u64 cmd_pdus;
u64 tx_data_octets;
@@ -930,7 +859,7 @@ struct se_portal_group {
spinlock_t tpg_lun_lock;
/* Pointer to $FABRIC_MOD portal group */
void *se_tpg_fabric_ptr;
- struct list_head se_tpg_list;
+ struct list_head se_tpg_node;
/* linked list for initiator ACL list */
struct list_head acl_node_list;
struct se_lun *tpg_lun_list;
@@ -949,8 +878,6 @@ struct se_portal_group {
struct config_group tpg_param_group;
} ____cacheline_aligned;
-#define TPG_TFO(se_tpg) ((se_tpg)->se_tpg_tfo)
-
struct se_wwn {
struct target_fabric_configfs *wwn_tf;
struct config_group wwn_group;
@@ -958,28 +885,4 @@ struct se_wwn {
struct config_group fabric_stat_group;
} ____cacheline_aligned;
-struct se_global {
- u16 alua_lu_gps_counter;
- int g_sub_api_initialized;
- u32 in_shutdown;
- u32 alua_lu_gps_count;
- u32 g_hba_id_counter;
- struct config_group target_core_hbagroup;
- struct config_group alua_group;
- struct config_group alua_lu_gps_group;
- struct list_head g_lu_gps_list;
- struct list_head g_se_tpg_list;
- struct list_head g_hba_list;
- struct list_head g_se_dev_list;
- struct se_hba *g_lun0_hba;
- struct se_subsystem_dev *g_lun0_su_dev;
- struct se_device *g_lun0_dev;
- struct t10_alua_lu_gp *default_lu_gp;
- spinlock_t g_device_lock;
- spinlock_t hba_lock;
- spinlock_t se_tpg_lock;
- spinlock_t lu_gps_lock;
- spinlock_t plugin_class_lock;
-} ____cacheline_aligned;
-
#endif /* TARGET_CORE_BASE_H */
diff --git a/include/target/target_core_device.h b/include/target/target_core_device.h
index 52b18a5..4657191 100644
--- a/include/target/target_core_device.h
+++ b/include/target/target_core_device.h
@@ -1,8 +1,8 @@
#ifndef TARGET_CORE_DEVICE_H
#define TARGET_CORE_DEVICE_H
-extern int transport_get_lun_for_cmd(struct se_cmd *, unsigned char *, u32);
-extern int transport_get_lun_for_tmr(struct se_cmd *, u32);
+extern int transport_lookup_cmd_lun(struct se_cmd *, u32);
+extern int transport_lookup_tmr_lun(struct se_cmd *, u32);
extern struct se_dev_entry *core_get_se_deve_from_rtpi(
struct se_node_acl *, u16);
extern int core_free_device_list_for_node(struct se_node_acl *,
@@ -39,6 +39,8 @@ extern int se_dev_set_emulate_tas(struct se_device *, int);
extern int se_dev_set_emulate_tpu(struct se_device *, int);
extern int se_dev_set_emulate_tpws(struct se_device *, int);
extern int se_dev_set_enforce_pr_isids(struct se_device *, int);
+extern int se_dev_set_is_nonrot(struct se_device *, int);
+extern int se_dev_set_emulate_rest_reord(struct se_device *dev, int);
extern int se_dev_set_queue_depth(struct se_device *, u32);
extern int se_dev_set_max_sectors(struct se_device *, u32);
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 747e140..126c675 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 {
int (*tpg_check_demo_mode_cache)(struct se_portal_group *);
int (*tpg_check_demo_mode_write_protect)(struct se_portal_group *);
int (*tpg_check_prod_mode_write_protect)(struct se_portal_group *);
+ /*
+ * Optionally used by fabrics to allow demo-mode login, but not
+ * expose any TPG LUNs, and return 'not connected' in standard
+ * inquiry response
+ */
+ int (*tpg_check_demo_mode_login_only)(struct se_portal_group *);
struct se_node_acl *(*tpg_alloc_fabric_acl)(
struct se_portal_group *);
void (*tpg_release_fabric_acl)(struct se_portal_group *,
@@ -39,17 +45,11 @@ struct target_core_fabric_ops {
*/
int (*new_cmd_map)(struct se_cmd *);
/*
- * Optional function pointer for TCM fabric modules that use
- * Linux/NET sockets to allocate struct iovec array to struct se_cmd
- */
- int (*alloc_cmd_iovecs)(struct se_cmd *);
- /*
* Optional to release struct se_cmd and fabric dependent allocated
* I/O descriptor in transport_cmd_check_stop()
*/
void (*check_stop_free)(struct se_cmd *);
- void (*release_cmd_to_pool)(struct se_cmd *);
- void (*release_cmd_direct)(struct se_cmd *);
+ void (*release_cmd)(struct se_cmd *);
/*
* Called with spin_lock_bh(struct se_portal_group->session_lock held.
*/
@@ -70,7 +70,6 @@ struct target_core_fabric_ops {
void (*set_default_node_attributes)(struct se_node_acl *);
u32 (*get_task_tag)(struct se_cmd *);
int (*get_cmd_state)(struct se_cmd *);
- void (*new_cmd_failure)(struct se_cmd *);
int (*queue_data_in)(struct se_cmd *);
int (*queue_status)(struct se_cmd *);
int (*queue_tm_rsp)(struct se_cmd *);
diff --git a/include/target/target_core_tmr.h b/include/target/target_core_tmr.h
index bd55968..d5876e1 100644
--- a/include/target/target_core_tmr.h
+++ b/include/target/target_core_tmr.h
@@ -27,7 +27,7 @@ enum tcm_tmrsp_table {
extern struct kmem_cache *se_tmr_req_cache;
-extern struct se_tmr_req *core_tmr_alloc_req(struct se_cmd *, void *, u8);
+extern struct se_tmr_req *core_tmr_alloc_req(struct se_cmd *, void *, u8, gfp_t);
extern void core_tmr_release_req(struct se_tmr_req *);
extern int core_tmr_lun_reset(struct se_device *, struct se_tmr_req *,
struct list_head *, struct se_cmd *);
diff --git a/include/target/target_core_transport.h b/include/target/target_core_transport.h
index 24a1c6c..a037a1a 100644
--- a/include/target/target_core_transport.h
+++ b/include/target/target_core_transport.h
@@ -22,10 +22,9 @@
#define PYX_TRANSPORT_LU_COMM_FAILURE -7
#define PYX_TRANSPORT_UNKNOWN_MODE_PAGE -8
#define PYX_TRANSPORT_WRITE_PROTECTED -9
-#define PYX_TRANSPORT_TASK_TIMEOUT -10
-#define PYX_TRANSPORT_RESERVATION_CONFLICT -11
-#define PYX_TRANSPORT_ILLEGAL_REQUEST -12
-#define PYX_TRANSPORT_USE_SENSE_REASON -13
+#define PYX_TRANSPORT_RESERVATION_CONFLICT -10
+#define PYX_TRANSPORT_ILLEGAL_REQUEST -11
+#define PYX_TRANSPORT_USE_SENSE_REASON -12
#ifndef SAM_STAT_RESERVATION_CONFLICT
#define SAM_STAT_RESERVATION_CONFLICT 0x18
@@ -38,16 +37,6 @@
#define TRANSPORT_PLUGIN_VHBA_PDEV 2
#define TRANSPORT_PLUGIN_VHBA_VDEV 3
-/* For SE OBJ Plugins, in seconds */
-#define TRANSPORT_TIMEOUT_TUR 10
-#define TRANSPORT_TIMEOUT_TYPE_DISK 60
-#define TRANSPORT_TIMEOUT_TYPE_ROM 120
-#define TRANSPORT_TIMEOUT_TYPE_TAPE 600
-#define TRANSPORT_TIMEOUT_TYPE_OTHER 300
-
-/* For se_task->task_state_flags */
-#define TSF_EXCEPTION_CLEARED 0x01
-
/*
* struct se_subsystem_dev->su_dev_flags
*/
@@ -64,8 +53,6 @@
#define DF_SPC2_RESERVATIONS_WITH_ISID 0x00000004
/* struct se_dev_attrib sanity values */
-/* 10 Minutes */
-#define DA_TASK_TIMEOUT_MAX 600
/* Default max_unmap_lba_count */
#define DA_MAX_UNMAP_LBA_COUNT 0
/* Default max_unmap_block_desc_count */
@@ -101,22 +88,22 @@
#define DA_ENFORCE_PR_ISIDS 1
#define DA_STATUS_MAX_SECTORS_MIN 16
#define DA_STATUS_MAX_SECTORS_MAX 8192
+/* By default don't report non-rotating (solid state) medium */
+#define DA_IS_NONROT 0
+/* Queue Algorithm Modifier default for restricted reordering in control mode page */
+#define DA_EMULATE_REST_REORD 0
#define SE_MODE_PAGE_BUF 512
#define MOD_MAX_SECTORS(ms, bs) (ms % (PAGE_SIZE / bs))
-struct se_mem;
struct se_subsystem_api;
-extern struct kmem_cache *se_mem_cache;
-
-extern int init_se_global(void);
-extern void release_se_global(void);
-extern void init_scsi_index_table(void);
+extern int init_se_kmem_caches(void);
+extern void release_se_kmem_caches(void);
extern u32 scsi_get_new_index(scsi_index_t);
extern void transport_init_queue_obj(struct se_queue_obj *);
-extern int transport_subsystem_check_init(void);
+extern void transport_subsystem_check_init(void);
extern int transport_subsystem_register(struct se_subsystem_api *);
extern void transport_subsystem_release(struct se_subsystem_api *);
extern void transport_load_plugins(void);
@@ -131,7 +118,6 @@ extern void transport_free_session(struct se_session *);
extern void transport_deregister_session_configfs(struct se_session *);
extern void transport_deregister_session(struct se_session *);
extern void transport_cmd_finish_abort(struct se_cmd *, int);
-extern void transport_cmd_finish_abort_tmr(struct se_cmd *);
extern void transport_complete_sync_cache(struct se_cmd *, int);
extern void transport_complete_task(struct se_task *, int);
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 *,
struct se_device *);
extern void transport_remove_task_from_execute_queue(struct se_task *,
struct se_device *);
+extern void __transport_remove_task_from_execute_queue(struct se_task *,
+ struct se_device *);
unsigned char *transport_dump_cmd_direction(struct se_cmd *);
extern void transport_dump_dev_state(struct se_device *, char *, int *);
extern void transport_dump_dev_info(struct se_device *, struct se_lun *,
@@ -160,41 +148,39 @@ extern struct se_device *transport_add_device_to_core_hba(struct se_hba *,
struct se_subsystem_dev *, u32,
void *, struct se_dev_limits *,
const char *, const char *);
-extern void transport_device_setup_cmd(struct se_cmd *);
extern void transport_init_se_cmd(struct se_cmd *,
struct target_core_fabric_ops *,
struct se_session *, u32, int, int,
unsigned char *);
-extern void transport_free_se_cmd(struct se_cmd *);
+void *transport_kmap_first_data_page(struct se_cmd *cmd);
+void transport_kunmap_first_data_page(struct se_cmd *cmd);
extern int transport_generic_allocate_tasks(struct se_cmd *, unsigned char *);
-extern int transport_generic_handle_cdb(struct se_cmd *);
+extern int transport_handle_cdb_direct(struct se_cmd *);
extern int transport_generic_handle_cdb_map(struct se_cmd *);
extern int transport_generic_handle_data(struct se_cmd *);
extern void transport_new_cmd_failure(struct se_cmd *);
extern int transport_generic_handle_tmr(struct se_cmd *);
extern void transport_generic_free_cmd_intr(struct se_cmd *);
-extern void __transport_stop_task_timer(struct se_task *, unsigned long *);
-extern unsigned char transport_asciihex_to_binaryhex(unsigned char val[2]);
+extern bool target_stop_task(struct se_task *task, unsigned long *flags);
extern int transport_generic_map_mem_to_cmd(struct se_cmd *cmd, struct scatterlist *, u32,
struct scatterlist *, u32);
extern int transport_clear_lun_from_sessions(struct se_lun *);
+extern void transport_wait_for_tasks(struct se_cmd *);
extern int transport_check_aborted_status(struct se_cmd *, int);
extern int transport_send_check_condition_and_sense(struct se_cmd *, u8, int);
extern void transport_send_task_abort(struct se_cmd *);
-extern void transport_release_cmd_to_pool(struct se_cmd *);
-extern void transport_generic_free_cmd(struct se_cmd *, int, int, int);
+extern void transport_release_cmd(struct se_cmd *);
+extern void transport_generic_free_cmd(struct se_cmd *, int);
extern void transport_generic_wait_for_cmds(struct se_cmd *, int);
-extern u32 transport_calc_sg_num(struct se_task *, struct se_mem *, u32);
-extern int transport_map_mem_to_sg(struct se_task *, struct list_head *,
- void *, struct se_mem *,
- struct se_mem **, u32 *, u32 *);
extern void transport_do_task_sg_chain(struct se_cmd *);
extern void transport_generic_process_write(struct se_cmd *);
+extern int transport_generic_new_cmd(struct se_cmd *);
extern int transport_generic_do_tmr(struct se_cmd *);
/* From target_core_alua.c */
extern int core_alua_check_nonop_delay(struct se_cmd *);
/* From target_core_cdb.c */
extern int transport_emulate_control_cdb(struct se_task *);
+extern void target_get_task_cdb(struct se_task *task, unsigned char *cdb);
/*
* Each se_transport_task_t can have N number of possible struct se_task's
@@ -222,6 +208,10 @@ struct se_subsystem_api {
* Transport Type.
*/
u8 transport_type;
+
+ unsigned int fua_write_emulated : 1;
+ unsigned int write_cache_emulated : 1;
+
/*
* struct module for struct se_hba references
*/
@@ -231,18 +221,6 @@ struct se_subsystem_api {
*/
struct list_head sub_api_list;
/*
- * For SCF_SCSI_NON_DATA_CDB
- */
- int (*cdb_none)(struct se_task *);
- /*
- * For SCF_SCSI_CONTROL_NONSG_IO_CDB
- */
- int (*map_task_non_SG)(struct se_task *);
- /*
- * For SCF_SCSI_DATA_SG_IO_CDB and SCF_SCSI_CONTROL_SG_IO_CDB
- */
- int (*map_task_SG)(struct se_task *);
- /*
* attach_hba():
*/
int (*attach_hba)(struct se_hba *, u32);
@@ -270,29 +248,13 @@ struct se_subsystem_api {
void (*free_device)(void *);
/*
- * dpo_emulated():
- */
- int (*dpo_emulated)(struct se_device *);
- /*
- * fua_write_emulated():
- */
- int (*fua_write_emulated)(struct se_device *);
- /*
- * fua_read_emulated():
- */
- int (*fua_read_emulated)(struct se_device *);
- /*
- * write_cache_emulated():
- */
- int (*write_cache_emulated)(struct se_device *);
- /*
* transport_complete():
*
* Use transport_generic_complete() for majority of DAS transport
* drivers. Provided out of convenience.
*/
int (*transport_complete)(struct se_task *task);
- struct se_task *(*alloc_task)(struct se_cmd *);
+ struct se_task *(*alloc_task)(unsigned char *cdb);
/*
* do_task():
*/
@@ -326,10 +288,6 @@ struct se_subsystem_api {
ssize_t (*show_configfs_dev_params)(struct se_hba *, struct se_subsystem_dev *,
char *);
/*
- * get_cdb():
- */
- unsigned char *(*get_cdb)(struct se_task *);
- /*
* get_device_rev():
*/
u32 (*get_device_rev)(struct se_device *);
@@ -342,19 +300,9 @@ struct se_subsystem_api {
*/
sector_t (*get_blocks)(struct se_device *);
/*
- * do_se_mem_map():
- */
- int (*do_se_mem_map)(struct se_task *, struct list_head *, void *,
- struct se_mem *, struct se_mem **, u32 *, u32 *);
- /*
* get_sense_buffer():
*/
unsigned char *(*get_sense_buffer)(struct se_task *);
} ____cacheline_aligned;
-#define TRANSPORT(dev) ((dev)->transport)
-#define HBA_TRANSPORT(hba) ((hba)->transport)
-
-extern struct se_global *se_global;
-
#endif /* TARGET_CORE_TRANSPORT_H */
OpenPOWER on IntegriCloud