1 /*******************************************************************************
2 * This file contains iSCSI Target Portal Group related functions.
4 * \u00a9 Copyright 2007-2011 RisingTide Systems LLC.
6 * Licensed to the Linux Foundation under the General Public License (GPL) version 2.
8 * Author: Nicholas A. Bellinger <nab@linux-iscsi.org>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 ******************************************************************************/
21 #include <target/target_core_base.h>
22 #include <target/target_core_fabric.h>
23 #include <target/target_core_configfs.h>
25 #include "iscsi_target_core.h"
26 #include "iscsi_target_erl0.h"
27 #include "iscsi_target_login.h"
28 #include "iscsi_target_nodeattrib.h"
29 #include "iscsi_target_tpg.h"
30 #include "iscsi_target_util.h"
31 #include "iscsi_target.h"
32 #include "iscsi_target_parameters.h"
34 struct iscsi_portal_group
*iscsit_alloc_portal_group(struct iscsi_tiqn
*tiqn
, u16 tpgt
)
36 struct iscsi_portal_group
*tpg
;
38 tpg
= kzalloc(sizeof(struct iscsi_portal_group
), GFP_KERNEL
);
40 pr_err("Unable to allocate struct iscsi_portal_group\n");
45 tpg
->tpg_state
= TPG_STATE_FREE
;
47 INIT_LIST_HEAD(&tpg
->tpg_gnp_list
);
48 INIT_LIST_HEAD(&tpg
->tpg_list
);
49 mutex_init(&tpg
->tpg_access_lock
);
50 mutex_init(&tpg
->np_login_lock
);
51 spin_lock_init(&tpg
->tpg_state_lock
);
52 spin_lock_init(&tpg
->tpg_np_lock
);
57 static void iscsit_set_default_tpg_attribs(struct iscsi_portal_group
*);
59 int iscsit_load_discovery_tpg(void)
61 struct iscsi_param
*param
;
62 struct iscsi_portal_group
*tpg
;
65 tpg
= iscsit_alloc_portal_group(NULL
, 1);
67 pr_err("Unable to allocate struct iscsi_portal_group\n");
71 ret
= core_tpg_register(
72 &lio_target_fabric_configfs
->tf_ops
,
73 NULL
, &tpg
->tpg_se_tpg
, tpg
,
74 TRANSPORT_TPG_TYPE_DISCOVERY
);
80 tpg
->sid
= 1; /* First Assigned LIO Session ID */
81 iscsit_set_default_tpg_attribs(tpg
);
83 if (iscsi_create_default_params(&tpg
->param_list
) < 0)
86 * By default we disable authentication for discovery sessions,
87 * this can be changed with:
89 * /sys/kernel/config/target/iscsi/discovery_auth/enforce_discovery_auth
91 param
= iscsi_find_param_from_key(AUTHMETHOD
, tpg
->param_list
);
95 if (iscsi_update_param_value(param
, "CHAP,None") < 0)
98 tpg
->tpg_attrib
.authentication
= 0;
100 spin_lock(&tpg
->tpg_state_lock
);
101 tpg
->tpg_state
= TPG_STATE_ACTIVE
;
102 spin_unlock(&tpg
->tpg_state_lock
);
104 iscsit_global
->discovery_tpg
= tpg
;
105 pr_debug("CORE[0] - Allocated Discovery TPG\n");
110 core_tpg_deregister(&tpg
->tpg_se_tpg
);
115 void iscsit_release_discovery_tpg(void)
117 struct iscsi_portal_group
*tpg
= iscsit_global
->discovery_tpg
;
122 core_tpg_deregister(&tpg
->tpg_se_tpg
);
125 iscsit_global
->discovery_tpg
= NULL
;
128 struct iscsi_portal_group
*iscsit_get_tpg_from_np(
129 struct iscsi_tiqn
*tiqn
,
132 struct iscsi_portal_group
*tpg
= NULL
;
133 struct iscsi_tpg_np
*tpg_np
;
135 spin_lock(&tiqn
->tiqn_tpg_lock
);
136 list_for_each_entry(tpg
, &tiqn
->tiqn_tpg_list
, tpg_list
) {
138 spin_lock(&tpg
->tpg_state_lock
);
139 if (tpg
->tpg_state
== TPG_STATE_FREE
) {
140 spin_unlock(&tpg
->tpg_state_lock
);
143 spin_unlock(&tpg
->tpg_state_lock
);
145 spin_lock(&tpg
->tpg_np_lock
);
146 list_for_each_entry(tpg_np
, &tpg
->tpg_gnp_list
, tpg_np_list
) {
147 if (tpg_np
->tpg_np
== np
) {
148 spin_unlock(&tpg
->tpg_np_lock
);
149 spin_unlock(&tiqn
->tiqn_tpg_lock
);
153 spin_unlock(&tpg
->tpg_np_lock
);
155 spin_unlock(&tiqn
->tiqn_tpg_lock
);
161 struct iscsi_portal_group
*tpg
)
165 ret
= mutex_lock_interruptible(&tpg
->tpg_access_lock
);
166 return ((ret
!= 0) || signal_pending(current
)) ? -1 : 0;
169 void iscsit_put_tpg(struct iscsi_portal_group
*tpg
)
171 mutex_unlock(&tpg
->tpg_access_lock
);
174 static void iscsit_clear_tpg_np_login_thread(
175 struct iscsi_tpg_np
*tpg_np
,
176 struct iscsi_portal_group
*tpg
)
178 if (!tpg_np
->tpg_np
) {
179 pr_err("struct iscsi_tpg_np->tpg_np is NULL!\n");
183 iscsit_reset_np_thread(tpg_np
->tpg_np
, tpg_np
, tpg
);
186 void iscsit_clear_tpg_np_login_threads(
187 struct iscsi_portal_group
*tpg
)
189 struct iscsi_tpg_np
*tpg_np
;
191 spin_lock(&tpg
->tpg_np_lock
);
192 list_for_each_entry(tpg_np
, &tpg
->tpg_gnp_list
, tpg_np_list
) {
193 if (!tpg_np
->tpg_np
) {
194 pr_err("struct iscsi_tpg_np->tpg_np is NULL!\n");
197 spin_unlock(&tpg
->tpg_np_lock
);
198 iscsit_clear_tpg_np_login_thread(tpg_np
, tpg
);
199 spin_lock(&tpg
->tpg_np_lock
);
201 spin_unlock(&tpg
->tpg_np_lock
);
204 void iscsit_tpg_dump_params(struct iscsi_portal_group
*tpg
)
206 iscsi_print_params(tpg
->param_list
);
209 static void iscsit_set_default_tpg_attribs(struct iscsi_portal_group
*tpg
)
211 struct iscsi_tpg_attrib
*a
= &tpg
->tpg_attrib
;
213 a
->authentication
= TA_AUTHENTICATION
;
214 a
->login_timeout
= TA_LOGIN_TIMEOUT
;
215 a
->netif_timeout
= TA_NETIF_TIMEOUT
;
216 a
->default_cmdsn_depth
= TA_DEFAULT_CMDSN_DEPTH
;
217 a
->generate_node_acls
= TA_GENERATE_NODE_ACLS
;
218 a
->cache_dynamic_acls
= TA_CACHE_DYNAMIC_ACLS
;
219 a
->demo_mode_write_protect
= TA_DEMO_MODE_WRITE_PROTECT
;
220 a
->prod_mode_write_protect
= TA_PROD_MODE_WRITE_PROTECT
;
223 int iscsit_tpg_add_portal_group(struct iscsi_tiqn
*tiqn
, struct iscsi_portal_group
*tpg
)
225 if (tpg
->tpg_state
!= TPG_STATE_FREE
) {
226 pr_err("Unable to add iSCSI Target Portal Group: %d"
227 " while not in TPG_STATE_FREE state.\n", tpg
->tpgt
);
230 iscsit_set_default_tpg_attribs(tpg
);
232 if (iscsi_create_default_params(&tpg
->param_list
) < 0)
235 ISCSI_TPG_ATTRIB(tpg
)->tpg
= tpg
;
237 spin_lock(&tpg
->tpg_state_lock
);
238 tpg
->tpg_state
= TPG_STATE_INACTIVE
;
239 spin_unlock(&tpg
->tpg_state_lock
);
241 spin_lock(&tiqn
->tiqn_tpg_lock
);
242 list_add_tail(&tpg
->tpg_list
, &tiqn
->tiqn_tpg_list
);
244 pr_debug("CORE[%s]_TPG[%hu] - Added iSCSI Target Portal Group\n",
245 tiqn
->tiqn
, tpg
->tpgt
);
246 spin_unlock(&tiqn
->tiqn_tpg_lock
);
250 if (tpg
->param_list
) {
251 iscsi_release_param_list(tpg
->param_list
);
252 tpg
->param_list
= NULL
;
258 int iscsit_tpg_del_portal_group(
259 struct iscsi_tiqn
*tiqn
,
260 struct iscsi_portal_group
*tpg
,
263 u8 old_state
= tpg
->tpg_state
;
265 spin_lock(&tpg
->tpg_state_lock
);
266 tpg
->tpg_state
= TPG_STATE_INACTIVE
;
267 spin_unlock(&tpg
->tpg_state_lock
);
269 if (iscsit_release_sessions_for_tpg(tpg
, force
) < 0) {
270 pr_err("Unable to delete iSCSI Target Portal Group:"
271 " %hu while active sessions exist, and force=0\n",
273 tpg
->tpg_state
= old_state
;
277 core_tpg_clear_object_luns(&tpg
->tpg_se_tpg
);
279 if (tpg
->param_list
) {
280 iscsi_release_param_list(tpg
->param_list
);
281 tpg
->param_list
= NULL
;
284 core_tpg_deregister(&tpg
->tpg_se_tpg
);
286 spin_lock(&tpg
->tpg_state_lock
);
287 tpg
->tpg_state
= TPG_STATE_FREE
;
288 spin_unlock(&tpg
->tpg_state_lock
);
290 spin_lock(&tiqn
->tiqn_tpg_lock
);
292 list_del(&tpg
->tpg_list
);
293 spin_unlock(&tiqn
->tiqn_tpg_lock
);
295 pr_debug("CORE[%s]_TPG[%hu] - Deleted iSCSI Target Portal Group\n",
296 tiqn
->tiqn
, tpg
->tpgt
);
302 int iscsit_tpg_enable_portal_group(struct iscsi_portal_group
*tpg
)
304 struct iscsi_param
*param
;
305 struct iscsi_tiqn
*tiqn
= tpg
->tpg_tiqn
;
307 spin_lock(&tpg
->tpg_state_lock
);
308 if (tpg
->tpg_state
== TPG_STATE_ACTIVE
) {
309 pr_err("iSCSI target portal group: %hu is already"
310 " active, ignoring request.\n", tpg
->tpgt
);
311 spin_unlock(&tpg
->tpg_state_lock
);
315 * Make sure that AuthMethod does not contain None as an option
316 * unless explictly disabled. Set the default to CHAP if authentication
317 * is enforced (as per default), and remove the NONE option.
319 param
= iscsi_find_param_from_key(AUTHMETHOD
, tpg
->param_list
);
321 spin_unlock(&tpg
->tpg_state_lock
);
325 if (ISCSI_TPG_ATTRIB(tpg
)->authentication
) {
326 if (!strcmp(param
->value
, NONE
))
327 if (iscsi_update_param_value(param
, CHAP
) < 0) {
328 spin_unlock(&tpg
->tpg_state_lock
);
331 if (iscsit_ta_authentication(tpg
, 1) < 0) {
332 spin_unlock(&tpg
->tpg_state_lock
);
337 tpg
->tpg_state
= TPG_STATE_ACTIVE
;
338 spin_unlock(&tpg
->tpg_state_lock
);
340 spin_lock(&tiqn
->tiqn_tpg_lock
);
341 tiqn
->tiqn_active_tpgs
++;
342 pr_debug("iSCSI_TPG[%hu] - Enabled iSCSI Target Portal Group\n",
344 spin_unlock(&tiqn
->tiqn_tpg_lock
);
349 int iscsit_tpg_disable_portal_group(struct iscsi_portal_group
*tpg
, int force
)
351 struct iscsi_tiqn
*tiqn
;
352 u8 old_state
= tpg
->tpg_state
;
354 spin_lock(&tpg
->tpg_state_lock
);
355 if (tpg
->tpg_state
== TPG_STATE_INACTIVE
) {
356 pr_err("iSCSI Target Portal Group: %hu is already"
357 " inactive, ignoring request.\n", tpg
->tpgt
);
358 spin_unlock(&tpg
->tpg_state_lock
);
361 tpg
->tpg_state
= TPG_STATE_INACTIVE
;
362 spin_unlock(&tpg
->tpg_state_lock
);
364 iscsit_clear_tpg_np_login_threads(tpg
);
366 if (iscsit_release_sessions_for_tpg(tpg
, force
) < 0) {
367 spin_lock(&tpg
->tpg_state_lock
);
368 tpg
->tpg_state
= old_state
;
369 spin_unlock(&tpg
->tpg_state_lock
);
370 pr_err("Unable to disable iSCSI Target Portal Group:"
371 " %hu while active sessions exist, and force=0\n",
376 tiqn
= tpg
->tpg_tiqn
;
377 if (!tiqn
|| (tpg
== iscsit_global
->discovery_tpg
))
380 spin_lock(&tiqn
->tiqn_tpg_lock
);
381 tiqn
->tiqn_active_tpgs
--;
382 pr_debug("iSCSI_TPG[%hu] - Disabled iSCSI Target Portal Group\n",
384 spin_unlock(&tiqn
->tiqn_tpg_lock
);
389 struct iscsi_node_attrib
*iscsit_tpg_get_node_attrib(
390 struct iscsi_session
*sess
)
392 struct se_session
*se_sess
= sess
->se_sess
;
393 struct se_node_acl
*se_nacl
= se_sess
->se_node_acl
;
394 struct iscsi_node_acl
*acl
= container_of(se_nacl
, struct iscsi_node_acl
,
397 return &acl
->node_attrib
;
400 struct iscsi_tpg_np
*iscsit_tpg_locate_child_np(
401 struct iscsi_tpg_np
*tpg_np
,
402 int network_transport
)
404 struct iscsi_tpg_np
*tpg_np_child
, *tpg_np_child_tmp
;
406 spin_lock(&tpg_np
->tpg_np_parent_lock
);
407 list_for_each_entry_safe(tpg_np_child
, tpg_np_child_tmp
,
408 &tpg_np
->tpg_np_parent_list
, tpg_np_child_list
) {
409 if (tpg_np_child
->tpg_np
->np_network_transport
==
411 spin_unlock(&tpg_np
->tpg_np_parent_lock
);
415 spin_unlock(&tpg_np
->tpg_np_parent_lock
);
420 struct iscsi_tpg_np
*iscsit_tpg_add_network_portal(
421 struct iscsi_portal_group
*tpg
,
422 struct __kernel_sockaddr_storage
*sockaddr
,
424 struct iscsi_tpg_np
*tpg_np_parent
,
425 int network_transport
)
428 struct iscsi_tpg_np
*tpg_np
;
430 tpg_np
= kzalloc(sizeof(struct iscsi_tpg_np
), GFP_KERNEL
);
432 pr_err("Unable to allocate memory for"
433 " struct iscsi_tpg_np.\n");
434 return ERR_PTR(-ENOMEM
);
437 np
= iscsit_add_np(sockaddr
, ip_str
, network_transport
);
443 INIT_LIST_HEAD(&tpg_np
->tpg_np_list
);
444 INIT_LIST_HEAD(&tpg_np
->tpg_np_child_list
);
445 INIT_LIST_HEAD(&tpg_np
->tpg_np_parent_list
);
446 spin_lock_init(&tpg_np
->tpg_np_parent_lock
);
450 spin_lock(&tpg
->tpg_np_lock
);
451 list_add_tail(&tpg_np
->tpg_np_list
, &tpg
->tpg_gnp_list
);
454 tpg
->tpg_tiqn
->tiqn_num_tpg_nps
++;
455 spin_unlock(&tpg
->tpg_np_lock
);
458 tpg_np
->tpg_np_parent
= tpg_np_parent
;
459 spin_lock(&tpg_np_parent
->tpg_np_parent_lock
);
460 list_add_tail(&tpg_np
->tpg_np_child_list
,
461 &tpg_np_parent
->tpg_np_parent_list
);
462 spin_unlock(&tpg_np_parent
->tpg_np_parent_lock
);
465 pr_debug("CORE[%s] - Added Network Portal: %s:%hu,%hu on %s\n",
466 tpg
->tpg_tiqn
->tiqn
, np
->np_ip
, np
->np_port
, tpg
->tpgt
,
467 (np
->np_network_transport
== ISCSI_TCP
) ? "TCP" : "SCTP");
472 static int iscsit_tpg_release_np(
473 struct iscsi_tpg_np
*tpg_np
,
474 struct iscsi_portal_group
*tpg
,
477 iscsit_clear_tpg_np_login_thread(tpg_np
, tpg
);
479 pr_debug("CORE[%s] - Removed Network Portal: %s:%hu,%hu on %s\n",
480 tpg
->tpg_tiqn
->tiqn
, np
->np_ip
, np
->np_port
, tpg
->tpgt
,
481 (np
->np_network_transport
== ISCSI_TCP
) ? "TCP" : "SCTP");
483 tpg_np
->tpg_np
= NULL
;
487 * iscsit_del_np() will shutdown struct iscsi_np when last TPG reference is released.
489 return iscsit_del_np(np
);
492 int iscsit_tpg_del_network_portal(
493 struct iscsi_portal_group
*tpg
,
494 struct iscsi_tpg_np
*tpg_np
)
497 struct iscsi_tpg_np
*tpg_np_child
, *tpg_np_child_tmp
;
502 pr_err("Unable to locate struct iscsi_np from"
503 " struct iscsi_tpg_np\n");
507 if (!tpg_np
->tpg_np_parent
) {
509 * We are the parent tpg network portal. Release all of the
510 * child tpg_np's (eg: the non ISCSI_TCP ones) on our parent
513 list_for_each_entry_safe(tpg_np_child
, tpg_np_child_tmp
,
514 &tpg_np
->tpg_np_parent_list
,
516 ret
= iscsit_tpg_del_network_portal(tpg
, tpg_np_child
);
518 pr_err("iscsit_tpg_del_network_portal()"
519 " failed: %d\n", ret
);
523 * We are not the parent ISCSI_TCP tpg network portal. Release
524 * our own network portals from the child list.
526 spin_lock(&tpg_np
->tpg_np_parent
->tpg_np_parent_lock
);
527 list_del(&tpg_np
->tpg_np_child_list
);
528 spin_unlock(&tpg_np
->tpg_np_parent
->tpg_np_parent_lock
);
531 spin_lock(&tpg
->tpg_np_lock
);
532 list_del(&tpg_np
->tpg_np_list
);
535 tpg
->tpg_tiqn
->tiqn_num_tpg_nps
--;
536 spin_unlock(&tpg
->tpg_np_lock
);
538 return iscsit_tpg_release_np(tpg_np
, tpg
, np
);
541 int iscsit_tpg_set_initiator_node_queue_depth(
542 struct iscsi_portal_group
*tpg
,
543 unsigned char *initiatorname
,
547 return core_tpg_set_initiator_node_queue_depth(&tpg
->tpg_se_tpg
,
548 initiatorname
, queue_depth
, force
);
551 int iscsit_ta_authentication(struct iscsi_portal_group
*tpg
, u32 authentication
)
553 unsigned char buf1
[256], buf2
[256], *none
= NULL
;
555 struct iscsi_param
*param
;
556 struct iscsi_tpg_attrib
*a
= &tpg
->tpg_attrib
;
558 if ((authentication
!= 1) && (authentication
!= 0)) {
559 pr_err("Illegal value for authentication parameter:"
560 " %u, ignoring request.\n", authentication
);
564 memset(buf1
, 0, sizeof(buf1
));
565 memset(buf2
, 0, sizeof(buf2
));
567 param
= iscsi_find_param_from_key(AUTHMETHOD
, tpg
->param_list
);
571 if (authentication
) {
572 snprintf(buf1
, sizeof(buf1
), "%s", param
->value
);
573 none
= strstr(buf1
, NONE
);
576 if (!strncmp(none
+ 4, ",", 1)) {
577 if (!strcmp(buf1
, none
))
578 sprintf(buf2
, "%s", none
+5);
582 len
= sprintf(buf2
, "%s", buf1
);
584 sprintf(buf2
+ len
, "%s", none
);
589 sprintf(buf2
, "%s", buf1
);
591 if (iscsi_update_param_value(param
, buf2
) < 0)
594 snprintf(buf1
, sizeof(buf1
), "%s", param
->value
);
595 none
= strstr(buf1
, NONE
);
598 strncat(buf1
, ",", strlen(","));
599 strncat(buf1
, NONE
, strlen(NONE
));
600 if (iscsi_update_param_value(param
, buf1
) < 0)
605 a
->authentication
= authentication
;
606 pr_debug("%s iSCSI Authentication Methods for TPG: %hu.\n",
607 a
->authentication
? "Enforcing" : "Disabling", tpg
->tpgt
);
612 int iscsit_ta_login_timeout(
613 struct iscsi_portal_group
*tpg
,
616 struct iscsi_tpg_attrib
*a
= &tpg
->tpg_attrib
;
618 if (login_timeout
> TA_LOGIN_TIMEOUT_MAX
) {
619 pr_err("Requested Login Timeout %u larger than maximum"
620 " %u\n", login_timeout
, TA_LOGIN_TIMEOUT_MAX
);
622 } else if (login_timeout
< TA_LOGIN_TIMEOUT_MIN
) {
623 pr_err("Requested Logout Timeout %u smaller than"
624 " minimum %u\n", login_timeout
, TA_LOGIN_TIMEOUT_MIN
);
628 a
->login_timeout
= login_timeout
;
629 pr_debug("Set Logout Timeout to %u for Target Portal Group"
630 " %hu\n", a
->login_timeout
, tpg
->tpgt
);
635 int iscsit_ta_netif_timeout(
636 struct iscsi_portal_group
*tpg
,
639 struct iscsi_tpg_attrib
*a
= &tpg
->tpg_attrib
;
641 if (netif_timeout
> TA_NETIF_TIMEOUT_MAX
) {
642 pr_err("Requested Network Interface Timeout %u larger"
643 " than maximum %u\n", netif_timeout
,
644 TA_NETIF_TIMEOUT_MAX
);
646 } else if (netif_timeout
< TA_NETIF_TIMEOUT_MIN
) {
647 pr_err("Requested Network Interface Timeout %u smaller"
648 " than minimum %u\n", netif_timeout
,
649 TA_NETIF_TIMEOUT_MIN
);
653 a
->netif_timeout
= netif_timeout
;
654 pr_debug("Set Network Interface Timeout to %u for"
655 " Target Portal Group %hu\n", a
->netif_timeout
, tpg
->tpgt
);
660 int iscsit_ta_generate_node_acls(
661 struct iscsi_portal_group
*tpg
,
664 struct iscsi_tpg_attrib
*a
= &tpg
->tpg_attrib
;
666 if ((flag
!= 0) && (flag
!= 1)) {
667 pr_err("Illegal value %d\n", flag
);
671 a
->generate_node_acls
= flag
;
672 pr_debug("iSCSI_TPG[%hu] - Generate Initiator Portal Group ACLs: %s\n",
673 tpg
->tpgt
, (a
->generate_node_acls
) ? "Enabled" : "Disabled");
678 int iscsit_ta_default_cmdsn_depth(
679 struct iscsi_portal_group
*tpg
,
682 struct iscsi_tpg_attrib
*a
= &tpg
->tpg_attrib
;
684 if (tcq_depth
> TA_DEFAULT_CMDSN_DEPTH_MAX
) {
685 pr_err("Requested Default Queue Depth: %u larger"
686 " than maximum %u\n", tcq_depth
,
687 TA_DEFAULT_CMDSN_DEPTH_MAX
);
689 } else if (tcq_depth
< TA_DEFAULT_CMDSN_DEPTH_MIN
) {
690 pr_err("Requested Default Queue Depth: %u smaller"
691 " than minimum %u\n", tcq_depth
,
692 TA_DEFAULT_CMDSN_DEPTH_MIN
);
696 a
->default_cmdsn_depth
= tcq_depth
;
697 pr_debug("iSCSI_TPG[%hu] - Set Default CmdSN TCQ Depth to %u\n",
698 tpg
->tpgt
, a
->default_cmdsn_depth
);
703 int iscsit_ta_cache_dynamic_acls(
704 struct iscsi_portal_group
*tpg
,
707 struct iscsi_tpg_attrib
*a
= &tpg
->tpg_attrib
;
709 if ((flag
!= 0) && (flag
!= 1)) {
710 pr_err("Illegal value %d\n", flag
);
714 a
->cache_dynamic_acls
= flag
;
715 pr_debug("iSCSI_TPG[%hu] - Cache Dynamic Initiator Portal Group"
716 " ACLs %s\n", tpg
->tpgt
, (a
->cache_dynamic_acls
) ?
717 "Enabled" : "Disabled");
722 int iscsit_ta_demo_mode_write_protect(
723 struct iscsi_portal_group
*tpg
,
726 struct iscsi_tpg_attrib
*a
= &tpg
->tpg_attrib
;
728 if ((flag
!= 0) && (flag
!= 1)) {
729 pr_err("Illegal value %d\n", flag
);
733 a
->demo_mode_write_protect
= flag
;
734 pr_debug("iSCSI_TPG[%hu] - Demo Mode Write Protect bit: %s\n",
735 tpg
->tpgt
, (a
->demo_mode_write_protect
) ? "ON" : "OFF");
740 int iscsit_ta_prod_mode_write_protect(
741 struct iscsi_portal_group
*tpg
,
744 struct iscsi_tpg_attrib
*a
= &tpg
->tpg_attrib
;
746 if ((flag
!= 0) && (flag
!= 1)) {
747 pr_err("Illegal value %d\n", flag
);
751 a
->prod_mode_write_protect
= flag
;
752 pr_debug("iSCSI_TPG[%hu] - Production Mode Write Protect bit:"
753 " %s\n", tpg
->tpgt
, (a
->prod_mode_write_protect
) ?