diff options
author | Nicholas Bellinger <nab@linux-iscsi.org> | 2014-04-02 15:52:38 -0400 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2014-04-07 04:48:54 -0400 |
commit | e70beee783d6977d80eede88a3394f02eabddad1 (patch) | |
tree | 225d10e36bf031e9c4eab3de537699b60bb48f1b /include/target | |
parent | d84287bcfe624697cd4f3c1df746beb53b86d9c4 (diff) |
target: Pass in transport supported PI at session initialization
In order to support local WRITE_INSERT + READ_STRIP operations for
non PI enabled fabrics, the fabric driver needs to be able signal
what protection offload operations are supported.
This is done at session initialization time so the modes can be
signaled by individual se_wwn + se_portal_group endpoints, as well
as optionally across different transports on the same endpoint.
For iser-target, set TARGET_PROT_ALL if the underlying ib_device
has already signaled PI offload support, and allow this to be
exposed via a new iscsit_transport->iscsit_get_sup_prot_ops()
callback.
For loopback, set TARGET_PROT_ALL to signal SCSI initiator mode
operation.
For all other drivers, set TARGET_PROT_NORMAL to disable fabric
level PI.
Cc: Martin K. Petersen <martin.petersen@oracle.com>
Cc: Sagi Grimberg <sagig@mellanox.com>
Cc: Or Gerlitz <ogerlitz@mellanox.com>
Cc: Quinn Tran <quinn.tran@qlogic.com>
Cc: Giridhar Malavali <giridhar.malavali@qlogic.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'include/target')
-rw-r--r-- | include/target/iscsi/iscsi_transport.h | 1 | ||||
-rw-r--r-- | include/target/target_core_base.h | 19 | ||||
-rw-r--r-- | include/target/target_core_fabric.h | 5 |
3 files changed, 16 insertions, 9 deletions
diff --git a/include/target/iscsi/iscsi_transport.h b/include/target/iscsi/iscsi_transport.h index 8d19339292b8..33b487b5da92 100644 --- a/include/target/iscsi/iscsi_transport.h +++ b/include/target/iscsi/iscsi_transport.h | |||
@@ -22,6 +22,7 @@ struct iscsit_transport { | |||
22 | int (*iscsit_queue_data_in)(struct iscsi_conn *, struct iscsi_cmd *); | 22 | int (*iscsit_queue_data_in)(struct iscsi_conn *, struct iscsi_cmd *); |
23 | int (*iscsit_queue_status)(struct iscsi_conn *, struct iscsi_cmd *); | 23 | int (*iscsit_queue_status)(struct iscsi_conn *, struct iscsi_cmd *); |
24 | void (*iscsit_aborted_task)(struct iscsi_conn *, struct iscsi_cmd *); | 24 | void (*iscsit_aborted_task)(struct iscsi_conn *, struct iscsi_cmd *); |
25 | enum target_prot_op (*iscsit_get_sup_prot_ops)(struct iscsi_conn *); | ||
25 | }; | 26 | }; |
26 | 27 | ||
27 | static inline void *iscsit_priv_cmd(struct iscsi_cmd *cmd) | 28 | static inline void *iscsit_priv_cmd(struct iscsi_cmd *cmd) |
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index ec3e3a3ff4f6..9ec9864ecf38 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h | |||
@@ -442,15 +442,19 @@ struct se_tmr_req { | |||
442 | }; | 442 | }; |
443 | 443 | ||
444 | enum target_prot_op { | 444 | enum target_prot_op { |
445 | TARGET_PROT_NORMAL = 0, | 445 | TARGET_PROT_NORMAL = 0, |
446 | TARGET_PROT_DIN_INSERT, | 446 | TARGET_PROT_DIN_INSERT = (1 << 0), |
447 | TARGET_PROT_DOUT_INSERT, | 447 | TARGET_PROT_DOUT_INSERT = (1 << 1), |
448 | TARGET_PROT_DIN_STRIP, | 448 | TARGET_PROT_DIN_STRIP = (1 << 2), |
449 | TARGET_PROT_DOUT_STRIP, | 449 | TARGET_PROT_DOUT_STRIP = (1 << 3), |
450 | TARGET_PROT_DIN_PASS, | 450 | TARGET_PROT_DIN_PASS = (1 << 4), |
451 | TARGET_PROT_DOUT_PASS, | 451 | TARGET_PROT_DOUT_PASS = (1 << 5), |
452 | }; | 452 | }; |
453 | 453 | ||
454 | #define TARGET_PROT_ALL TARGET_PROT_DIN_INSERT | TARGET_PROT_DOUT_INSERT | \ | ||
455 | TARGET_PROT_DIN_STRIP | TARGET_PROT_DOUT_STRIP | \ | ||
456 | TARGET_PROT_DIN_PASS | TARGET_PROT_DOUT_PASS | ||
457 | |||
454 | enum target_prot_type { | 458 | enum target_prot_type { |
455 | TARGET_DIF_TYPE0_PROT, | 459 | TARGET_DIF_TYPE0_PROT, |
456 | TARGET_DIF_TYPE1_PROT, | 460 | TARGET_DIF_TYPE1_PROT, |
@@ -605,6 +609,7 @@ struct se_node_acl { | |||
605 | struct se_session { | 609 | struct se_session { |
606 | unsigned sess_tearing_down:1; | 610 | unsigned sess_tearing_down:1; |
607 | u64 sess_bin_isid; | 611 | u64 sess_bin_isid; |
612 | enum target_prot_op sup_prot_ops; | ||
608 | struct se_node_acl *se_node_acl; | 613 | struct se_node_acl *se_node_acl; |
609 | struct se_portal_group *se_tpg; | 614 | struct se_portal_group *se_tpg; |
610 | void *fabric_sess_ptr; | 615 | void *fabric_sess_ptr; |
diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h index 1d1043644b9b..22a4e98eec80 100644 --- a/include/target/target_core_fabric.h +++ b/include/target/target_core_fabric.h | |||
@@ -84,10 +84,11 @@ struct target_core_fabric_ops { | |||
84 | void (*fabric_drop_nodeacl)(struct se_node_acl *); | 84 | void (*fabric_drop_nodeacl)(struct se_node_acl *); |
85 | }; | 85 | }; |
86 | 86 | ||
87 | struct se_session *transport_init_session(void); | 87 | struct se_session *transport_init_session(enum target_prot_op); |
88 | int transport_alloc_session_tags(struct se_session *, unsigned int, | 88 | int transport_alloc_session_tags(struct se_session *, unsigned int, |
89 | unsigned int); | 89 | unsigned int); |
90 | struct se_session *transport_init_session_tags(unsigned int, unsigned int); | 90 | struct se_session *transport_init_session_tags(unsigned int, unsigned int, |
91 | enum target_prot_op); | ||
91 | void __transport_register_session(struct se_portal_group *, | 92 | void __transport_register_session(struct se_portal_group *, |
92 | struct se_node_acl *, struct se_session *, void *); | 93 | struct se_node_acl *, struct se_session *, void *); |
93 | void transport_register_session(struct se_portal_group *, | 94 | void transport_register_session(struct se_portal_group *, |