aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/qla2xxx/tcm_qla2xxx.c44
-rw-r--r--drivers/scsi/qla2xxx/tcm_qla2xxx.h1
2 files changed, 45 insertions, 0 deletions
diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
index 57346abf5662..843b53b0e9f2 100644
--- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c
+++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
@@ -336,6 +336,14 @@ static int tcm_qla2xxx_check_demo_mode_login_only(struct se_portal_group *se_tpg
336 return tpg->tpg_attrib.demo_mode_login_only; 336 return tpg->tpg_attrib.demo_mode_login_only;
337} 337}
338 338
339static int tcm_qla2xxx_check_prot_fabric_only(struct se_portal_group *se_tpg)
340{
341 struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg,
342 struct tcm_qla2xxx_tpg, se_tpg);
343
344 return tpg->tpg_attrib.fabric_prot_type;
345}
346
339static struct se_node_acl *tcm_qla2xxx_alloc_fabric_acl( 347static struct se_node_acl *tcm_qla2xxx_alloc_fabric_acl(
340 struct se_portal_group *se_tpg) 348 struct se_portal_group *se_tpg)
341{ 349{
@@ -1091,9 +1099,44 @@ static ssize_t tcm_qla2xxx_tpg_show_dynamic_sessions(
1091 1099
1092TF_TPG_BASE_ATTR_RO(tcm_qla2xxx, dynamic_sessions); 1100TF_TPG_BASE_ATTR_RO(tcm_qla2xxx, dynamic_sessions);
1093 1101
1102static ssize_t tcm_qla2xxx_tpg_store_fabric_prot_type(
1103 struct se_portal_group *se_tpg,
1104 const char *page,
1105 size_t count)
1106{
1107 struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg,
1108 struct tcm_qla2xxx_tpg, se_tpg);
1109 unsigned long val;
1110 int ret = kstrtoul(page, 0, &val);
1111
1112 if (ret) {
1113 pr_err("kstrtoul() returned %d for fabric_prot_type\n", ret);
1114 return ret;
1115 }
1116 if (val != 0 && val != 1 && val != 3) {
1117 pr_err("Invalid qla2xxx fabric_prot_type: %lu\n", val);
1118 return -EINVAL;
1119 }
1120 tpg->tpg_attrib.fabric_prot_type = val;
1121
1122 return count;
1123}
1124
1125static ssize_t tcm_qla2xxx_tpg_show_fabric_prot_type(
1126 struct se_portal_group *se_tpg,
1127 char *page)
1128{
1129 struct tcm_qla2xxx_tpg *tpg = container_of(se_tpg,
1130 struct tcm_qla2xxx_tpg, se_tpg);
1131
1132 return sprintf(page, "%d\n", tpg->tpg_attrib.fabric_prot_type);
1133}
1134TF_TPG_BASE_ATTR(tcm_qla2xxx, fabric_prot_type, S_IRUGO | S_IWUSR);
1135
1094static struct configfs_attribute *tcm_qla2xxx_tpg_attrs[] = { 1136static struct configfs_attribute *tcm_qla2xxx_tpg_attrs[] = {
1095 &tcm_qla2xxx_tpg_enable.attr, 1137 &tcm_qla2xxx_tpg_enable.attr,
1096 &tcm_qla2xxx_tpg_dynamic_sessions.attr, 1138 &tcm_qla2xxx_tpg_dynamic_sessions.attr,
1139 &tcm_qla2xxx_tpg_fabric_prot_type.attr,
1097 NULL, 1140 NULL,
1098}; 1141};
1099 1142
@@ -1959,6 +2002,7 @@ static struct target_core_fabric_ops tcm_qla2xxx_ops = {
1959 tcm_qla2xxx_check_demo_write_protect, 2002 tcm_qla2xxx_check_demo_write_protect,
1960 .tpg_check_prod_mode_write_protect = 2003 .tpg_check_prod_mode_write_protect =
1961 tcm_qla2xxx_check_prod_write_protect, 2004 tcm_qla2xxx_check_prod_write_protect,
2005 .tpg_check_prot_fabric_only = tcm_qla2xxx_check_prot_fabric_only,
1962 .tpg_check_demo_mode_login_only = tcm_qla2xxx_check_demo_mode_login_only, 2006 .tpg_check_demo_mode_login_only = tcm_qla2xxx_check_demo_mode_login_only,
1963 .tpg_alloc_fabric_acl = tcm_qla2xxx_alloc_fabric_acl, 2007 .tpg_alloc_fabric_acl = tcm_qla2xxx_alloc_fabric_acl,
1964 .tpg_release_fabric_acl = tcm_qla2xxx_release_fabric_acl, 2008 .tpg_release_fabric_acl = tcm_qla2xxx_release_fabric_acl,
diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.h b/drivers/scsi/qla2xxx/tcm_qla2xxx.h
index 10c002145648..23295115c9fc 100644
--- a/drivers/scsi/qla2xxx/tcm_qla2xxx.h
+++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.h
@@ -33,6 +33,7 @@ struct tcm_qla2xxx_tpg_attrib {
33 int demo_mode_write_protect; 33 int demo_mode_write_protect;
34 int prod_mode_write_protect; 34 int prod_mode_write_protect;
35 int demo_mode_login_only; 35 int demo_mode_login_only;
36 int fabric_prot_type;
36}; 37};
37 38
38struct tcm_qla2xxx_tpg { 39struct tcm_qla2xxx_tpg {