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.h82
1 files changed, 76 insertions, 6 deletions
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index 321301c0a643..c9c791209cd1 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -37,6 +37,9 @@
37/* Used by transport_send_check_condition_and_sense() */ 37/* Used by transport_send_check_condition_and_sense() */
38#define SPC_SENSE_KEY_OFFSET 2 38#define SPC_SENSE_KEY_OFFSET 2
39#define SPC_ADD_SENSE_LEN_OFFSET 7 39#define SPC_ADD_SENSE_LEN_OFFSET 7
40#define SPC_DESC_TYPE_OFFSET 8
41#define SPC_ADDITIONAL_DESC_LEN_OFFSET 9
42#define SPC_VALIDITY_OFFSET 10
40#define SPC_ASC_KEY_OFFSET 12 43#define SPC_ASC_KEY_OFFSET 12
41#define SPC_ASCQ_KEY_OFFSET 13 44#define SPC_ASCQ_KEY_OFFSET 13
42#define TRANSPORT_IQN_LEN 224 45#define TRANSPORT_IQN_LEN 224
@@ -112,7 +115,7 @@
112/* Queue Algorithm Modifier default for restricted reordering in control mode page */ 115/* Queue Algorithm Modifier default for restricted reordering in control mode page */
113#define DA_EMULATE_REST_REORD 0 116#define DA_EMULATE_REST_REORD 0
114 117
115#define SE_INQUIRY_BUF 512 118#define SE_INQUIRY_BUF 1024
116#define SE_MODE_PAGE_BUF 512 119#define SE_MODE_PAGE_BUF 512
117#define SE_SENSE_BUF 96 120#define SE_SENSE_BUF 96
118 121
@@ -205,6 +208,9 @@ enum tcm_sense_reason_table {
205 TCM_OUT_OF_RESOURCES = R(0x12), 208 TCM_OUT_OF_RESOURCES = R(0x12),
206 TCM_PARAMETER_LIST_LENGTH_ERROR = R(0x13), 209 TCM_PARAMETER_LIST_LENGTH_ERROR = R(0x13),
207 TCM_MISCOMPARE_VERIFY = R(0x14), 210 TCM_MISCOMPARE_VERIFY = R(0x14),
211 TCM_LOGICAL_BLOCK_GUARD_CHECK_FAILED = R(0x15),
212 TCM_LOGICAL_BLOCK_APP_TAG_CHECK_FAILED = R(0x16),
213 TCM_LOGICAL_BLOCK_REF_TAG_CHECK_FAILED = R(0x17),
208#undef R 214#undef R
209}; 215};
210 216
@@ -247,10 +253,28 @@ typedef enum {
247 253
248struct se_cmd; 254struct se_cmd;
249 255
256struct t10_alua_lba_map_member {
257 struct list_head lba_map_mem_list;
258 int lba_map_mem_alua_state;
259 int lba_map_mem_alua_pg_id;
260};
261
262struct t10_alua_lba_map {
263 u64 lba_map_first_lba;
264 u64 lba_map_last_lba;
265 struct list_head lba_map_list;
266 struct list_head lba_map_mem_list;
267};
268
250struct t10_alua { 269struct t10_alua {
251 /* ALUA Target Port Group ID */ 270 /* ALUA Target Port Group ID */
252 u16 alua_tg_pt_gps_counter; 271 u16 alua_tg_pt_gps_counter;
253 u32 alua_tg_pt_gps_count; 272 u32 alua_tg_pt_gps_count;
273 /* Referrals support */
274 spinlock_t lba_map_lock;
275 u32 lba_map_segment_size;
276 u32 lba_map_segment_multiplier;
277 struct list_head lba_map_list;
254 spinlock_t tg_pt_gps_lock; 278 spinlock_t tg_pt_gps_lock;
255 struct se_device *t10_dev; 279 struct se_device *t10_dev;
256 /* Used for default ALUA Target Port Group */ 280 /* Used for default ALUA Target Port Group */
@@ -284,6 +308,8 @@ struct t10_alua_tg_pt_gp {
284 u16 tg_pt_gp_id; 308 u16 tg_pt_gp_id;
285 int tg_pt_gp_valid_id; 309 int tg_pt_gp_valid_id;
286 int tg_pt_gp_alua_supported_states; 310 int tg_pt_gp_alua_supported_states;
311 int tg_pt_gp_alua_pending_state;
312 int tg_pt_gp_alua_previous_state;
287 int tg_pt_gp_alua_access_status; 313 int tg_pt_gp_alua_access_status;
288 int tg_pt_gp_alua_access_type; 314 int tg_pt_gp_alua_access_type;
289 int tg_pt_gp_nonop_delay_msecs; 315 int tg_pt_gp_nonop_delay_msecs;
@@ -291,9 +317,6 @@ struct t10_alua_tg_pt_gp {
291 int tg_pt_gp_implicit_trans_secs; 317 int tg_pt_gp_implicit_trans_secs;
292 int tg_pt_gp_pref; 318 int tg_pt_gp_pref;
293 int tg_pt_gp_write_metadata; 319 int tg_pt_gp_write_metadata;
294 /* Used by struct t10_alua_tg_pt_gp->tg_pt_gp_md_buf_len */
295#define ALUA_MD_BUF_LEN 1024
296 u32 tg_pt_gp_md_buf_len;
297 u32 tg_pt_gp_members; 320 u32 tg_pt_gp_members;
298 atomic_t tg_pt_gp_alua_access_state; 321 atomic_t tg_pt_gp_alua_access_state;
299 atomic_t tg_pt_gp_ref_cnt; 322 atomic_t tg_pt_gp_ref_cnt;
@@ -303,6 +326,10 @@ struct t10_alua_tg_pt_gp {
303 struct config_group tg_pt_gp_group; 326 struct config_group tg_pt_gp_group;
304 struct list_head tg_pt_gp_list; 327 struct list_head tg_pt_gp_list;
305 struct list_head tg_pt_gp_mem_list; 328 struct list_head tg_pt_gp_mem_list;
329 struct se_port *tg_pt_gp_alua_port;
330 struct se_node_acl *tg_pt_gp_alua_nacl;
331 struct delayed_work tg_pt_gp_transition_work;
332 struct completion *tg_pt_gp_transition_complete;
306}; 333};
307 334
308struct t10_alua_tg_pt_gp_member { 335struct t10_alua_tg_pt_gp_member {
@@ -414,6 +441,34 @@ struct se_tmr_req {
414 struct list_head tmr_list; 441 struct list_head tmr_list;
415}; 442};
416 443
444enum target_prot_op {
445 TARGET_PROT_NORMAL = 0,
446 TARGET_PROT_DIN_INSERT,
447 TARGET_PROT_DOUT_INSERT,
448 TARGET_PROT_DIN_STRIP,
449 TARGET_PROT_DOUT_STRIP,
450 TARGET_PROT_DIN_PASS,
451 TARGET_PROT_DOUT_PASS,
452};
453
454enum target_prot_ho {
455 PROT_SEPERATED,
456 PROT_INTERLEAVED,
457};
458
459enum target_prot_type {
460 TARGET_DIF_TYPE0_PROT,
461 TARGET_DIF_TYPE1_PROT,
462 TARGET_DIF_TYPE2_PROT,
463 TARGET_DIF_TYPE3_PROT,
464};
465
466struct se_dif_v1_tuple {
467 __be16 guard_tag;
468 __be16 app_tag;
469 __be32 ref_tag;
470};
471
417struct se_cmd { 472struct se_cmd {
418 /* SAM response code being sent to initiator */ 473 /* SAM response code being sent to initiator */
419 u8 scsi_status; 474 u8 scsi_status;
@@ -497,14 +552,24 @@ struct se_cmd {
497 void *priv; 552 void *priv;
498 553
499 /* Used for lun->lun_ref counting */ 554 /* Used for lun->lun_ref counting */
500 bool lun_ref_active; 555 int lun_ref_active;
556
557 /* DIF related members */
558 enum target_prot_op prot_op;
559 enum target_prot_type prot_type;
560 u32 prot_length;
561 u32 reftag_seed;
562 struct scatterlist *t_prot_sg;
563 unsigned int t_prot_nents;
564 enum target_prot_ho prot_handover;
565 sense_reason_t pi_err;
566 sector_t bad_sector;
501}; 567};
502 568
503struct se_ua { 569struct se_ua {
504 u8 ua_asc; 570 u8 ua_asc;
505 u8 ua_ascq; 571 u8 ua_ascq;
506 struct se_node_acl *ua_nacl; 572 struct se_node_acl *ua_nacl;
507 struct list_head ua_dev_list;
508 struct list_head ua_nacl_list; 573 struct list_head ua_nacl_list;
509}; 574};
510 575
@@ -605,6 +670,9 @@ struct se_dev_attrib {
605 int emulate_tpws; 670 int emulate_tpws;
606 int emulate_caw; 671 int emulate_caw;
607 int emulate_3pc; 672 int emulate_3pc;
673 int pi_prot_format;
674 enum target_prot_type pi_prot_type;
675 enum target_prot_type hw_pi_prot_type;
608 int enforce_pr_isids; 676 int enforce_pr_isids;
609 int is_nonrot; 677 int is_nonrot;
610 int emulate_rest_reord; 678 int emulate_rest_reord;
@@ -736,6 +804,8 @@ struct se_device {
736 /* Linked list for struct se_hba struct se_device list */ 804 /* Linked list for struct se_hba struct se_device list */
737 struct list_head dev_list; 805 struct list_head dev_list;
738 struct se_lun xcopy_lun; 806 struct se_lun xcopy_lun;
807 /* Protection Information */
808 int prot_length;
739}; 809};
740 810
741struct se_hba { 811struct se_hba {