diff options
author | Nicholas Bellinger <nab@linux-iscsi.org> | 2013-12-23 15:28:13 -0500 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2014-01-18 04:52:34 -0500 |
commit | ce65e5b97b19446ff91e9ee0bbcd9f8b8e87ae5a (patch) | |
tree | 2e012ea91fb9d43db317ff0ee1b1cd82f6a4cc67 | |
parent | f82f320edc1e26320bd7e58b347d5616e6a23ff2 (diff) |
target: Add DIF related base definitions
This patch adds DIF related definitions to target_core_base.h
that includes enums for target_prot_op + target_prot_type +
target_prot_version + target_guard_type + target_pi_error.
Also included is struct se_dif_v1_tuple, along with changes
to struct se_cmd, struct se_dev_attrib, and struct se_device.
Also, add new se_subsystem_api->[init,format,free]_prot() callers
used by target core code to setup backend specific protection
information after the device has been configured.
Enums taken from Sagi Grimberg's original patch.
v2 changes:
- Drop guard_type related definitions
- Update target_prot_op + target_prot_ho definitions (Sagi)
- Drop SCF_PROT + pi_prot_version flag
- Add se_subsystem_api->format_prot() (Sagi)
- Add hw_pi_prot_type device attribute
Cc: Martin K. Petersen <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Sagi Grimberg <sagig@mellanox.com>
Cc: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-rw-r--r-- | include/target/target_core_backend.h | 3 | ||||
-rw-r--r-- | include/target/target_core_base.h | 44 |
2 files changed, 47 insertions, 0 deletions
diff --git a/include/target/target_core_backend.h b/include/target/target_core_backend.h index 39e0114d70c5..0dc2745b9b18 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 | ||
46 | struct sbc_ops { | 49 | struct sbc_ops { |
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index dd87ab46ce21..d98048b97fe3 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h | |||
@@ -435,6 +435,34 @@ struct se_tmr_req { | |||
435 | struct list_head tmr_list; | 435 | struct list_head tmr_list; |
436 | }; | 436 | }; |
437 | 437 | ||
438 | enum target_prot_op { | ||
439 | TARGET_PROT_NORMAL = 0, | ||
440 | TARGET_PROT_DIN_INSERT, | ||
441 | TARGET_PROT_DOUT_INSERT, | ||
442 | TARGET_PROT_DIN_STRIP, | ||
443 | TARGET_PROT_DOUT_STRIP, | ||
444 | TARGET_PROT_DIN_PASS, | ||
445 | TARGET_PROT_DOUT_PASS, | ||
446 | }; | ||
447 | |||
448 | enum target_prot_ho { | ||
449 | PROT_SEPERATED, | ||
450 | PROT_INTERLEAVED, | ||
451 | }; | ||
452 | |||
453 | enum target_prot_type { | ||
454 | TARGET_DIF_TYPE0_PROT, | ||
455 | TARGET_DIF_TYPE1_PROT, | ||
456 | TARGET_DIF_TYPE2_PROT, | ||
457 | TARGET_DIF_TYPE3_PROT, | ||
458 | }; | ||
459 | |||
460 | struct se_dif_v1_tuple { | ||
461 | __be16 guard_tag; | ||
462 | __be16 app_tag; | ||
463 | __be32 ref_tag; | ||
464 | }; | ||
465 | |||
438 | struct se_cmd { | 466 | struct se_cmd { |
439 | /* SAM response code being sent to initiator */ | 467 | /* SAM response code being sent to initiator */ |
440 | u8 scsi_status; | 468 | u8 scsi_status; |
@@ -519,6 +547,17 @@ struct se_cmd { | |||
519 | 547 | ||
520 | /* Used for lun->lun_ref counting */ | 548 | /* Used for lun->lun_ref counting */ |
521 | bool lun_ref_active; | 549 | bool lun_ref_active; |
550 | |||
551 | /* DIF related members */ | ||
552 | enum target_prot_op prot_op; | ||
553 | enum target_prot_type prot_type; | ||
554 | u32 prot_length; | ||
555 | u32 reftag_seed; | ||
556 | struct scatterlist *t_prot_sg; | ||
557 | unsigned int t_prot_nents; | ||
558 | enum target_prot_ho prot_handover; | ||
559 | sense_reason_t pi_err; | ||
560 | u32 block_num; | ||
522 | }; | 561 | }; |
523 | 562 | ||
524 | struct se_ua { | 563 | struct se_ua { |
@@ -629,6 +668,9 @@ struct se_dev_attrib { | |||
629 | int emulate_tpws; | 668 | int emulate_tpws; |
630 | int emulate_caw; | 669 | int emulate_caw; |
631 | int emulate_3pc; | 670 | int emulate_3pc; |
671 | int pi_prot_format; | ||
672 | enum target_prot_type pi_prot_type; | ||
673 | enum target_prot_type hw_pi_prot_type; | ||
632 | int enforce_pr_isids; | 674 | int enforce_pr_isids; |
633 | int is_nonrot; | 675 | int is_nonrot; |
634 | int emulate_rest_reord; | 676 | int emulate_rest_reord; |
@@ -759,6 +801,8 @@ struct se_device { | |||
759 | /* Linked list for struct se_hba struct se_device list */ | 801 | /* Linked list for struct se_hba struct se_device list */ |
760 | struct list_head dev_list; | 802 | struct list_head dev_list; |
761 | struct se_lun xcopy_lun; | 803 | struct se_lun xcopy_lun; |
804 | /* Protection Information */ | ||
805 | int prot_length; | ||
762 | }; | 806 | }; |
763 | 807 | ||
764 | struct se_hba { | 808 | struct se_hba { |