aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target/iscsi/iscsi_target_tpg.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/target/iscsi/iscsi_target_tpg.c')
-rw-r--r--drivers/target/iscsi/iscsi_target_tpg.c42
1 files changed, 40 insertions, 2 deletions
diff --git a/drivers/target/iscsi/iscsi_target_tpg.c b/drivers/target/iscsi/iscsi_target_tpg.c
index 4faeb47fa5e1..39761837608d 100644
--- a/drivers/target/iscsi/iscsi_target_tpg.c
+++ b/drivers/target/iscsi/iscsi_target_tpg.c
@@ -223,6 +223,8 @@ static void iscsit_set_default_tpg_attribs(struct iscsi_portal_group *tpg)
223 a->cache_dynamic_acls = TA_CACHE_DYNAMIC_ACLS; 223 a->cache_dynamic_acls = TA_CACHE_DYNAMIC_ACLS;
224 a->demo_mode_write_protect = TA_DEMO_MODE_WRITE_PROTECT; 224 a->demo_mode_write_protect = TA_DEMO_MODE_WRITE_PROTECT;
225 a->prod_mode_write_protect = TA_PROD_MODE_WRITE_PROTECT; 225 a->prod_mode_write_protect = TA_PROD_MODE_WRITE_PROTECT;
226 a->demo_mode_discovery = TA_DEMO_MODE_DISCOVERY;
227 a->default_erl = TA_DEFAULT_ERL;
226} 228}
227 229
228int iscsit_tpg_add_portal_group(struct iscsi_tiqn *tiqn, struct iscsi_portal_group *tpg) 230int iscsit_tpg_add_portal_group(struct iscsi_tiqn *tiqn, struct iscsi_portal_group *tpg)
@@ -237,7 +239,7 @@ int iscsit_tpg_add_portal_group(struct iscsi_tiqn *tiqn, struct iscsi_portal_gro
237 if (iscsi_create_default_params(&tpg->param_list) < 0) 239 if (iscsi_create_default_params(&tpg->param_list) < 0)
238 goto err_out; 240 goto err_out;
239 241
240 ISCSI_TPG_ATTRIB(tpg)->tpg = tpg; 242 tpg->tpg_attrib.tpg = tpg;
241 243
242 spin_lock(&tpg->tpg_state_lock); 244 spin_lock(&tpg->tpg_state_lock);
243 tpg->tpg_state = TPG_STATE_INACTIVE; 245 tpg->tpg_state = TPG_STATE_INACTIVE;
@@ -330,7 +332,7 @@ int iscsit_tpg_enable_portal_group(struct iscsi_portal_group *tpg)
330 return -EINVAL; 332 return -EINVAL;
331 } 333 }
332 334
333 if (ISCSI_TPG_ATTRIB(tpg)->authentication) { 335 if (tpg->tpg_attrib.authentication) {
334 if (!strcmp(param->value, NONE)) { 336 if (!strcmp(param->value, NONE)) {
335 ret = iscsi_update_param_value(param, CHAP); 337 ret = iscsi_update_param_value(param, CHAP);
336 if (ret) 338 if (ret)
@@ -820,3 +822,39 @@ int iscsit_ta_prod_mode_write_protect(
820 822
821 return 0; 823 return 0;
822} 824}
825
826int iscsit_ta_demo_mode_discovery(
827 struct iscsi_portal_group *tpg,
828 u32 flag)
829{
830 struct iscsi_tpg_attrib *a = &tpg->tpg_attrib;
831
832 if ((flag != 0) && (flag != 1)) {
833 pr_err("Illegal value %d\n", flag);
834 return -EINVAL;
835 }
836
837 a->demo_mode_discovery = flag;
838 pr_debug("iSCSI_TPG[%hu] - Demo Mode Discovery bit:"
839 " %s\n", tpg->tpgt, (a->demo_mode_discovery) ?
840 "ON" : "OFF");
841
842 return 0;
843}
844
845int iscsit_ta_default_erl(
846 struct iscsi_portal_group *tpg,
847 u32 default_erl)
848{
849 struct iscsi_tpg_attrib *a = &tpg->tpg_attrib;
850
851 if ((default_erl != 0) && (default_erl != 1) && (default_erl != 2)) {
852 pr_err("Illegal value for default_erl: %u\n", default_erl);
853 return -EINVAL;
854 }
855
856 a->default_erl = default_erl;
857 pr_debug("iSCSI_TPG[%hu] - DefaultERL: %u\n", tpg->tpgt, a->default_erl);
858
859 return 0;
860}