Target/configfs: Expose iSCSI network portal group T10-PI support
authorSagi Grimberg <sagig@mellanox.com>
Wed, 19 Feb 2014 15:50:20 +0000 (17:50 +0200)
committerNicholas Bellinger <nab@linux-iscsi.org>
Mon, 7 Apr 2014 08:48:44 +0000 (01:48 -0700)
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>
drivers/target/iscsi/iscsi_target_configfs.c
drivers/target/iscsi/iscsi_target_tpg.c
drivers/target/iscsi/iscsi_target_tpg.h

index 1c0088fe9e99368c2dfb50b378dee6033cd42cab..fe35dcbacb1464cdd97a027457a5f9139270b85c 100644 (file)
@@ -1052,6 +1052,11 @@ TPG_ATTR(demo_mode_discovery, S_IRUGO | S_IWUSR);
  */
 DEF_TPG_ATTRIB(default_erl);
 TPG_ATTR(default_erl, S_IRUGO | S_IWUSR);
+/*
+ * Define iscsi_tpg_attrib_s_t10_pi
+ */
+DEF_TPG_ATTRIB(t10_pi);
+TPG_ATTR(t10_pi, S_IRUGO | S_IWUSR);
 
 static struct configfs_attribute *lio_target_tpg_attrib_attrs[] = {
        &iscsi_tpg_attrib_authentication.attr,
@@ -1064,6 +1069,7 @@ static struct configfs_attribute *lio_target_tpg_attrib_attrs[] = {
        &iscsi_tpg_attrib_prod_mode_write_protect.attr,
        &iscsi_tpg_attrib_demo_mode_discovery.attr,
        &iscsi_tpg_attrib_default_erl.attr,
+       &iscsi_tpg_attrib_t10_pi.attr,
        NULL,
 };
 
index 76c2b2403ed6ae6e1937009e840d4f99d5b5d2bd..eb96b20dc09e13ffe32e226df38b73241f176a63 100644 (file)
@@ -860,3 +860,22 @@ int iscsit_ta_default_erl(
 
        return 0;
 }
+
+int iscsit_ta_t10_pi(
+       struct iscsi_portal_group *tpg,
+       u32 flag)
+{
+       struct iscsi_tpg_attrib *a = &tpg->tpg_attrib;
+
+       if ((flag != 0) && (flag != 1)) {
+               pr_err("Illegal value %d\n", flag);
+               return -EINVAL;
+       }
+
+       a->t10_pi = flag;
+       pr_debug("iSCSI_TPG[%hu] - T10 Protection information bit:"
+               " %s\n", tpg->tpgt, (a->t10_pi) ?
+               "ON" : "OFF");
+
+       return 0;
+}
index 213c0fc7fdc9058913bc3b0da38a7d7ef20455e2..0a182f2aa8a25ea07cad39ac58a0d954010abd8b 100644 (file)
@@ -39,5 +39,6 @@ extern int iscsit_ta_demo_mode_write_protect(struct iscsi_portal_group *, u32);
 extern int iscsit_ta_prod_mode_write_protect(struct iscsi_portal_group *, u32);
 extern int iscsit_ta_demo_mode_discovery(struct iscsi_portal_group *, u32);
 extern int iscsit_ta_default_erl(struct iscsi_portal_group *, u32);
+extern int iscsit_ta_t10_pi(struct iscsi_portal_group *, u32);
 
 #endif /* ISCSI_TARGET_TPG_H */