diff options
author | Sagi Grimberg <sagig@mellanox.com> | 2014-02-19 10:50:20 -0500 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2014-04-07 04:48:44 -0400 |
commit | 8085176fd9f62122aea094075d98177dac92b928 (patch) | |
tree | ef0a290f06b593db2c99215cc1358e42636b60ff | |
parent | 5b168dcd6aa69f7421a7738eada749d376dd1253 (diff) |
Target/configfs: Expose iSCSI network portal group T10-PI support
User may enable T10-PI support per network portal group. any connection
established on top of it, will be required to serve protected transactions.
Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-rw-r--r-- | drivers/target/iscsi/iscsi_target_configfs.c | 6 | ||||
-rw-r--r-- | drivers/target/iscsi/iscsi_target_tpg.c | 19 | ||||
-rw-r--r-- | drivers/target/iscsi/iscsi_target_tpg.h | 1 |
3 files changed, 26 insertions, 0 deletions
diff --git a/drivers/target/iscsi/iscsi_target_configfs.c b/drivers/target/iscsi/iscsi_target_configfs.c index 1c0088fe9e99..fe35dcbacb14 100644 --- a/drivers/target/iscsi/iscsi_target_configfs.c +++ b/drivers/target/iscsi/iscsi_target_configfs.c | |||
@@ -1052,6 +1052,11 @@ TPG_ATTR(demo_mode_discovery, S_IRUGO | S_IWUSR); | |||
1052 | */ | 1052 | */ |
1053 | DEF_TPG_ATTRIB(default_erl); | 1053 | DEF_TPG_ATTRIB(default_erl); |
1054 | TPG_ATTR(default_erl, S_IRUGO | S_IWUSR); | 1054 | TPG_ATTR(default_erl, S_IRUGO | S_IWUSR); |
1055 | /* | ||
1056 | * Define iscsi_tpg_attrib_s_t10_pi | ||
1057 | */ | ||
1058 | DEF_TPG_ATTRIB(t10_pi); | ||
1059 | TPG_ATTR(t10_pi, S_IRUGO | S_IWUSR); | ||
1055 | 1060 | ||
1056 | static struct configfs_attribute *lio_target_tpg_attrib_attrs[] = { | 1061 | static struct configfs_attribute *lio_target_tpg_attrib_attrs[] = { |
1057 | &iscsi_tpg_attrib_authentication.attr, | 1062 | &iscsi_tpg_attrib_authentication.attr, |
@@ -1064,6 +1069,7 @@ static struct configfs_attribute *lio_target_tpg_attrib_attrs[] = { | |||
1064 | &iscsi_tpg_attrib_prod_mode_write_protect.attr, | 1069 | &iscsi_tpg_attrib_prod_mode_write_protect.attr, |
1065 | &iscsi_tpg_attrib_demo_mode_discovery.attr, | 1070 | &iscsi_tpg_attrib_demo_mode_discovery.attr, |
1066 | &iscsi_tpg_attrib_default_erl.attr, | 1071 | &iscsi_tpg_attrib_default_erl.attr, |
1072 | &iscsi_tpg_attrib_t10_pi.attr, | ||
1067 | NULL, | 1073 | NULL, |
1068 | }; | 1074 | }; |
1069 | 1075 | ||
diff --git a/drivers/target/iscsi/iscsi_target_tpg.c b/drivers/target/iscsi/iscsi_target_tpg.c index 76c2b2403ed6..eb96b20dc09e 100644 --- a/drivers/target/iscsi/iscsi_target_tpg.c +++ b/drivers/target/iscsi/iscsi_target_tpg.c | |||
@@ -860,3 +860,22 @@ int iscsit_ta_default_erl( | |||
860 | 860 | ||
861 | return 0; | 861 | return 0; |
862 | } | 862 | } |
863 | |||
864 | int iscsit_ta_t10_pi( | ||
865 | struct iscsi_portal_group *tpg, | ||
866 | u32 flag) | ||
867 | { | ||
868 | struct iscsi_tpg_attrib *a = &tpg->tpg_attrib; | ||
869 | |||
870 | if ((flag != 0) && (flag != 1)) { | ||
871 | pr_err("Illegal value %d\n", flag); | ||
872 | return -EINVAL; | ||
873 | } | ||
874 | |||
875 | a->t10_pi = flag; | ||
876 | pr_debug("iSCSI_TPG[%hu] - T10 Protection information bit:" | ||
877 | " %s\n", tpg->tpgt, (a->t10_pi) ? | ||
878 | "ON" : "OFF"); | ||
879 | |||
880 | return 0; | ||
881 | } | ||
diff --git a/drivers/target/iscsi/iscsi_target_tpg.h b/drivers/target/iscsi/iscsi_target_tpg.h index 213c0fc7fdc9..0a182f2aa8a2 100644 --- a/drivers/target/iscsi/iscsi_target_tpg.h +++ b/drivers/target/iscsi/iscsi_target_tpg.h | |||
@@ -39,5 +39,6 @@ extern int iscsit_ta_demo_mode_write_protect(struct iscsi_portal_group *, u32); | |||
39 | extern int iscsit_ta_prod_mode_write_protect(struct iscsi_portal_group *, u32); | 39 | extern int iscsit_ta_prod_mode_write_protect(struct iscsi_portal_group *, u32); |
40 | extern int iscsit_ta_demo_mode_discovery(struct iscsi_portal_group *, u32); | 40 | extern int iscsit_ta_demo_mode_discovery(struct iscsi_portal_group *, u32); |
41 | extern int iscsit_ta_default_erl(struct iscsi_portal_group *, u32); | 41 | extern int iscsit_ta_default_erl(struct iscsi_portal_group *, u32); |
42 | extern int iscsit_ta_t10_pi(struct iscsi_portal_group *, u32); | ||
42 | 43 | ||
43 | #endif /* ISCSI_TARGET_TPG_H */ | 44 | #endif /* ISCSI_TARGET_TPG_H */ |