aboutsummaryrefslogtreecommitdiffstats
path: root/include/target
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-01-31 18:31:23 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-01-31 18:31:23 -0500
commit4e13c5d0212f25d69a97606b9d5a85edb52a7737 (patch)
tree002f59b9151f42a6388656762f0e7963d08b89ef /include/target
parentdeb2a1d29bf0168ff2575e714e5c1f156be663fb (diff)
parent5259a06ef97068b710f45d092a587e8d740f750f (diff)
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending
Pull SCSI target updates from Nicholas Bellinger: "The highlights this round include: - add support for SCSI Referrals (Hannes) - add support for T10 DIF into target core (nab + mkp) - add support for T10 DIF emulation in FILEIO + RAMDISK backends (Sagi + nab) - add support for T10 DIF -> bio_integrity passthrough in IBLOCK backend (nab) - prep changes to iser-target for >= v3.15 T10 DIF support (Sagi) - add support for qla2xxx N_Port ID Virtualization - NPIV (Saurav + Quinn) - allow percpu_ida_alloc() to receive task state bitmask (Kent) - fix >= v3.12 iscsi-target session reset hung task regression (nab) - fix >= v3.13 percpu_ref se_lun->lun_ref_active race (nab) - fix a long-standing network portal creation race (Andy)" * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (51 commits) target: Fix percpu_ref_put race in transport_lun_remove_cmd target/iscsi: Fix network portal creation race target: Report bad sector in sense data for DIF errors iscsi-target: Convert gfp_t parameter to task state bitmask iscsi-target: Fix connection reset hang with percpu_ida_alloc percpu_ida: Make percpu_ida_alloc + callers accept task state bitmask iscsi-target: Pre-allocate more tags to avoid ack starvation qla2xxx: Configure NPIV fc_vport via tcm_qla2xxx_npiv_make_lport qla2xxx: Enhancements to enable NPIV support for QLOGIC ISPs with TCM/LIO. qla2xxx: Fix scsi_host leak on qlt_lport_register callback failure IB/isert: pass scatterlist instead of cmd to fast_reg_mr routine IB/isert: Move fastreg descriptor creation to a function IB/isert: Avoid frwr notation, user fastreg IB/isert: seperate connection protection domains and dma MRs tcm_loop: Enable DIF/DIX modes in SCSI host LLD target/rd: Add DIF protection into rd_execute_rw target/rd: Add support for protection SGL setup + release target/rd: Refactor rd_build_device_space + rd_release_device_space target/file: Add DIF protection support to fd_execute_rw target/file: Add DIF protection init/format support ...
Diffstat (limited to 'include/target')
-rw-r--r--include/target/iscsi/iscsi_transport.h2
-rw-r--r--include/target/target_core_backend.h7
-rw-r--r--include/target/target_core_base.h82
-rw-r--r--include/target/target_core_fabric.h3
4 files changed, 86 insertions, 8 deletions
diff --git a/include/target/iscsi/iscsi_transport.h b/include/target/iscsi/iscsi_transport.h
index a12589c4ee92..ae5a17111968 100644
--- a/include/target/iscsi/iscsi_transport.h
+++ b/include/target/iscsi/iscsi_transport.h
@@ -94,7 +94,7 @@ extern int iscsit_tmr_post_handler(struct iscsi_cmd *, struct iscsi_conn *);
94/* 94/*
95 * From iscsi_target_util.c 95 * From iscsi_target_util.c
96 */ 96 */
97extern struct iscsi_cmd *iscsit_allocate_cmd(struct iscsi_conn *, gfp_t); 97extern struct iscsi_cmd *iscsit_allocate_cmd(struct iscsi_conn *, int);
98extern int iscsit_sequence_cmd(struct iscsi_conn *, struct iscsi_cmd *, 98extern int iscsit_sequence_cmd(struct iscsi_conn *, struct iscsi_cmd *,
99 unsigned char *, __be32); 99 unsigned char *, __be32);
100extern void iscsit_release_cmd(struct iscsi_cmd *); 100extern void iscsit_release_cmd(struct iscsi_cmd *);
diff --git a/include/target/target_core_backend.h b/include/target/target_core_backend.h
index 39e0114d70c5..7020e33e742e 100644
--- a/include/target/target_core_backend.h
+++ b/include/target/target_core_backend.h
@@ -41,6 +41,9 @@ struct se_subsystem_api {
41 unsigned int (*get_io_opt)(struct se_device *); 41 unsigned int (*get_io_opt)(struct se_device *);
42 unsigned char *(*get_sense_buffer)(struct se_cmd *); 42 unsigned char *(*get_sense_buffer)(struct se_cmd *);
43 bool (*get_write_cache)(struct se_device *); 43 bool (*get_write_cache)(struct se_device *);
44 int (*init_prot)(struct se_device *);
45 int (*format_prot)(struct se_device *);
46 void (*free_prot)(struct se_device *);
44}; 47};
45 48
46struct sbc_ops { 49struct sbc_ops {
@@ -70,6 +73,10 @@ sense_reason_t sbc_execute_unmap(struct se_cmd *cmd,
70 sense_reason_t (*do_unmap_fn)(struct se_cmd *cmd, void *priv, 73 sense_reason_t (*do_unmap_fn)(struct se_cmd *cmd, void *priv,
71 sector_t lba, sector_t nolb), 74 sector_t lba, sector_t nolb),
72 void *priv); 75 void *priv);
76sense_reason_t sbc_dif_verify_write(struct se_cmd *, sector_t, unsigned int,
77 unsigned int, struct scatterlist *, int);
78sense_reason_t sbc_dif_verify_read(struct se_cmd *, sector_t, unsigned int,
79 unsigned int, struct scatterlist *, int);
73 80
74void transport_set_vpd_proto_id(struct t10_vpd *, unsigned char *); 81void transport_set_vpd_proto_id(struct t10_vpd *, unsigned char *);
75int transport_set_vpd_assoc(struct t10_vpd *, unsigned char *); 82int transport_set_vpd_assoc(struct t10_vpd *, unsigned char *);
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 {
diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h
index 4cf4fda404a3..0218d689b3d7 100644
--- a/include/target/target_core_fabric.h
+++ b/include/target/target_core_fabric.h
@@ -105,7 +105,8 @@ sense_reason_t transport_lookup_cmd_lun(struct se_cmd *, u32);
105sense_reason_t target_setup_cmd_from_cdb(struct se_cmd *, unsigned char *); 105sense_reason_t target_setup_cmd_from_cdb(struct se_cmd *, unsigned char *);
106int target_submit_cmd_map_sgls(struct se_cmd *, struct se_session *, 106int target_submit_cmd_map_sgls(struct se_cmd *, struct se_session *,
107 unsigned char *, unsigned char *, u32, u32, int, int, int, 107 unsigned char *, unsigned char *, u32, u32, int, int, int,
108 struct scatterlist *, u32, struct scatterlist *, u32); 108 struct scatterlist *, u32, struct scatterlist *, u32,
109 struct scatterlist *, u32);
109int target_submit_cmd(struct se_cmd *, struct se_session *, unsigned char *, 110int target_submit_cmd(struct se_cmd *, struct se_session *, unsigned char *,
110 unsigned char *, u32, u32, int, int, int); 111 unsigned char *, u32, u32, int, int, int);
111int target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess, 112int target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess,