Lines Matching refs:tpg
27 struct iscsi_portal_group *tpg; in iscsit_alloc_portal_group() local
29 tpg = kzalloc(sizeof(struct iscsi_portal_group), GFP_KERNEL); in iscsit_alloc_portal_group()
30 if (!tpg) { in iscsit_alloc_portal_group()
35 tpg->tpgt = tpgt; in iscsit_alloc_portal_group()
36 tpg->tpg_state = TPG_STATE_FREE; in iscsit_alloc_portal_group()
37 tpg->tpg_tiqn = tiqn; in iscsit_alloc_portal_group()
38 INIT_LIST_HEAD(&tpg->tpg_gnp_list); in iscsit_alloc_portal_group()
39 INIT_LIST_HEAD(&tpg->tpg_list); in iscsit_alloc_portal_group()
40 mutex_init(&tpg->tpg_access_lock); in iscsit_alloc_portal_group()
41 sema_init(&tpg->np_login_sem, 1); in iscsit_alloc_portal_group()
42 spin_lock_init(&tpg->tpg_state_lock); in iscsit_alloc_portal_group()
43 spin_lock_init(&tpg->tpg_np_lock); in iscsit_alloc_portal_group()
45 return tpg; in iscsit_alloc_portal_group()
53 struct iscsi_portal_group *tpg; in iscsit_load_discovery_tpg() local
56 tpg = iscsit_alloc_portal_group(NULL, 1); in iscsit_load_discovery_tpg()
57 if (!tpg) { in iscsit_load_discovery_tpg()
65 tpg->tpg_se_tpg.se_tpg_tfo = &iscsi_ops; in iscsit_load_discovery_tpg()
66 ret = core_tpg_register(NULL, &tpg->tpg_se_tpg, -1); in iscsit_load_discovery_tpg()
68 kfree(tpg); in iscsit_load_discovery_tpg()
72 tpg->sid = 1; /* First Assigned LIO Session ID */ in iscsit_load_discovery_tpg()
73 iscsit_set_default_tpg_attribs(tpg); in iscsit_load_discovery_tpg()
75 if (iscsi_create_default_params(&tpg->param_list) < 0) in iscsit_load_discovery_tpg()
83 param = iscsi_find_param_from_key(AUTHMETHOD, tpg->param_list); in iscsit_load_discovery_tpg()
90 tpg->tpg_attrib.authentication = 0; in iscsit_load_discovery_tpg()
92 spin_lock(&tpg->tpg_state_lock); in iscsit_load_discovery_tpg()
93 tpg->tpg_state = TPG_STATE_ACTIVE; in iscsit_load_discovery_tpg()
94 spin_unlock(&tpg->tpg_state_lock); in iscsit_load_discovery_tpg()
96 iscsit_global->discovery_tpg = tpg; in iscsit_load_discovery_tpg()
101 iscsi_release_param_list(tpg->param_list); in iscsit_load_discovery_tpg()
103 if (tpg->sid == 1) in iscsit_load_discovery_tpg()
104 core_tpg_deregister(&tpg->tpg_se_tpg); in iscsit_load_discovery_tpg()
105 kfree(tpg); in iscsit_load_discovery_tpg()
111 struct iscsi_portal_group *tpg = iscsit_global->discovery_tpg; in iscsit_release_discovery_tpg() local
113 if (!tpg) in iscsit_release_discovery_tpg()
116 iscsi_release_param_list(tpg->param_list); in iscsit_release_discovery_tpg()
117 core_tpg_deregister(&tpg->tpg_se_tpg); in iscsit_release_discovery_tpg()
119 kfree(tpg); in iscsit_release_discovery_tpg()
128 struct iscsi_portal_group *tpg = NULL; in iscsit_get_tpg_from_np() local
132 list_for_each_entry(tpg, &tiqn->tiqn_tpg_list, tpg_list) { in iscsit_get_tpg_from_np()
134 spin_lock(&tpg->tpg_state_lock); in iscsit_get_tpg_from_np()
135 if (tpg->tpg_state != TPG_STATE_ACTIVE) { in iscsit_get_tpg_from_np()
136 spin_unlock(&tpg->tpg_state_lock); in iscsit_get_tpg_from_np()
139 spin_unlock(&tpg->tpg_state_lock); in iscsit_get_tpg_from_np()
141 spin_lock(&tpg->tpg_np_lock); in iscsit_get_tpg_from_np()
142 list_for_each_entry(tpg_np, &tpg->tpg_gnp_list, tpg_np_list) { in iscsit_get_tpg_from_np()
146 spin_unlock(&tpg->tpg_np_lock); in iscsit_get_tpg_from_np()
148 return tpg; in iscsit_get_tpg_from_np()
151 spin_unlock(&tpg->tpg_np_lock); in iscsit_get_tpg_from_np()
159 struct iscsi_portal_group *tpg) in iscsit_get_tpg() argument
161 return mutex_lock_interruptible(&tpg->tpg_access_lock); in iscsit_get_tpg()
164 void iscsit_put_tpg(struct iscsi_portal_group *tpg) in iscsit_put_tpg() argument
166 mutex_unlock(&tpg->tpg_access_lock); in iscsit_put_tpg()
171 struct iscsi_portal_group *tpg, in iscsit_clear_tpg_np_login_thread() argument
181 iscsit_reset_np_thread(tpg_np->tpg_np, tpg_np, tpg, shutdown); in iscsit_clear_tpg_np_login_thread()
185 struct iscsi_portal_group *tpg, in iscsit_clear_tpg_np_login_threads() argument
190 spin_lock(&tpg->tpg_np_lock); in iscsit_clear_tpg_np_login_threads()
191 list_for_each_entry(tpg_np, &tpg->tpg_gnp_list, tpg_np_list) { in iscsit_clear_tpg_np_login_threads()
196 spin_unlock(&tpg->tpg_np_lock); in iscsit_clear_tpg_np_login_threads()
197 iscsit_clear_tpg_np_login_thread(tpg_np, tpg, shutdown); in iscsit_clear_tpg_np_login_threads()
198 spin_lock(&tpg->tpg_np_lock); in iscsit_clear_tpg_np_login_threads()
200 spin_unlock(&tpg->tpg_np_lock); in iscsit_clear_tpg_np_login_threads()
203 void iscsit_tpg_dump_params(struct iscsi_portal_group *tpg) in iscsit_tpg_dump_params() argument
205 iscsi_print_params(tpg->param_list); in iscsit_tpg_dump_params()
208 static void iscsit_set_default_tpg_attribs(struct iscsi_portal_group *tpg) in iscsit_set_default_tpg_attribs() argument
210 struct iscsi_tpg_attrib *a = &tpg->tpg_attrib; in iscsit_set_default_tpg_attribs()
228 int iscsit_tpg_add_portal_group(struct iscsi_tiqn *tiqn, struct iscsi_portal_group *tpg) in iscsit_tpg_add_portal_group() argument
230 if (tpg->tpg_state != TPG_STATE_FREE) { in iscsit_tpg_add_portal_group()
232 " while not in TPG_STATE_FREE state.\n", tpg->tpgt); in iscsit_tpg_add_portal_group()
235 iscsit_set_default_tpg_attribs(tpg); in iscsit_tpg_add_portal_group()
237 if (iscsi_create_default_params(&tpg->param_list) < 0) in iscsit_tpg_add_portal_group()
240 tpg->tpg_attrib.tpg = tpg; in iscsit_tpg_add_portal_group()
242 spin_lock(&tpg->tpg_state_lock); in iscsit_tpg_add_portal_group()
243 tpg->tpg_state = TPG_STATE_INACTIVE; in iscsit_tpg_add_portal_group()
244 spin_unlock(&tpg->tpg_state_lock); in iscsit_tpg_add_portal_group()
247 list_add_tail(&tpg->tpg_list, &tiqn->tiqn_tpg_list); in iscsit_tpg_add_portal_group()
250 tiqn->tiqn, tpg->tpgt); in iscsit_tpg_add_portal_group()
255 if (tpg->param_list) { in iscsit_tpg_add_portal_group()
256 iscsi_release_param_list(tpg->param_list); in iscsit_tpg_add_portal_group()
257 tpg->param_list = NULL; in iscsit_tpg_add_portal_group()
264 struct iscsi_portal_group *tpg, in iscsit_tpg_del_portal_group() argument
267 u8 old_state = tpg->tpg_state; in iscsit_tpg_del_portal_group()
269 spin_lock(&tpg->tpg_state_lock); in iscsit_tpg_del_portal_group()
270 tpg->tpg_state = TPG_STATE_INACTIVE; in iscsit_tpg_del_portal_group()
271 spin_unlock(&tpg->tpg_state_lock); in iscsit_tpg_del_portal_group()
273 if (iscsit_release_sessions_for_tpg(tpg, force) < 0) { in iscsit_tpg_del_portal_group()
276 tpg->tpgt); in iscsit_tpg_del_portal_group()
277 tpg->tpg_state = old_state; in iscsit_tpg_del_portal_group()
281 if (tpg->param_list) { in iscsit_tpg_del_portal_group()
282 iscsi_release_param_list(tpg->param_list); in iscsit_tpg_del_portal_group()
283 tpg->param_list = NULL; in iscsit_tpg_del_portal_group()
286 core_tpg_deregister(&tpg->tpg_se_tpg); in iscsit_tpg_del_portal_group()
288 spin_lock(&tpg->tpg_state_lock); in iscsit_tpg_del_portal_group()
289 tpg->tpg_state = TPG_STATE_FREE; in iscsit_tpg_del_portal_group()
290 spin_unlock(&tpg->tpg_state_lock); in iscsit_tpg_del_portal_group()
294 list_del(&tpg->tpg_list); in iscsit_tpg_del_portal_group()
298 tiqn->tiqn, tpg->tpgt); in iscsit_tpg_del_portal_group()
300 kfree(tpg); in iscsit_tpg_del_portal_group()
304 int iscsit_tpg_enable_portal_group(struct iscsi_portal_group *tpg) in iscsit_tpg_enable_portal_group() argument
307 struct iscsi_tiqn *tiqn = tpg->tpg_tiqn; in iscsit_tpg_enable_portal_group()
310 if (tpg->tpg_state == TPG_STATE_ACTIVE) { in iscsit_tpg_enable_portal_group()
312 " active, ignoring request.\n", tpg->tpgt); in iscsit_tpg_enable_portal_group()
320 param = iscsi_find_param_from_key(AUTHMETHOD, tpg->param_list); in iscsit_tpg_enable_portal_group()
324 if (tpg->tpg_attrib.authentication) { in iscsit_tpg_enable_portal_group()
331 ret = iscsit_ta_authentication(tpg, 1); in iscsit_tpg_enable_portal_group()
336 spin_lock(&tpg->tpg_state_lock); in iscsit_tpg_enable_portal_group()
337 tpg->tpg_state = TPG_STATE_ACTIVE; in iscsit_tpg_enable_portal_group()
338 spin_unlock(&tpg->tpg_state_lock); in iscsit_tpg_enable_portal_group()
343 tpg->tpgt); in iscsit_tpg_enable_portal_group()
352 int iscsit_tpg_disable_portal_group(struct iscsi_portal_group *tpg, int force) in iscsit_tpg_disable_portal_group() argument
355 u8 old_state = tpg->tpg_state; in iscsit_tpg_disable_portal_group()
357 spin_lock(&tpg->tpg_state_lock); in iscsit_tpg_disable_portal_group()
358 if (tpg->tpg_state == TPG_STATE_INACTIVE) { in iscsit_tpg_disable_portal_group()
360 " inactive, ignoring request.\n", tpg->tpgt); in iscsit_tpg_disable_portal_group()
361 spin_unlock(&tpg->tpg_state_lock); in iscsit_tpg_disable_portal_group()
364 tpg->tpg_state = TPG_STATE_INACTIVE; in iscsit_tpg_disable_portal_group()
365 spin_unlock(&tpg->tpg_state_lock); in iscsit_tpg_disable_portal_group()
367 iscsit_clear_tpg_np_login_threads(tpg, false); in iscsit_tpg_disable_portal_group()
369 if (iscsit_release_sessions_for_tpg(tpg, force) < 0) { in iscsit_tpg_disable_portal_group()
370 spin_lock(&tpg->tpg_state_lock); in iscsit_tpg_disable_portal_group()
371 tpg->tpg_state = old_state; in iscsit_tpg_disable_portal_group()
372 spin_unlock(&tpg->tpg_state_lock); in iscsit_tpg_disable_portal_group()
375 tpg->tpgt); in iscsit_tpg_disable_portal_group()
379 tiqn = tpg->tpg_tiqn; in iscsit_tpg_disable_portal_group()
380 if (!tiqn || (tpg == iscsit_global->discovery_tpg)) in iscsit_tpg_disable_portal_group()
386 tpg->tpgt); in iscsit_tpg_disable_portal_group()
427 struct iscsi_portal_group *tpg; in iscsit_tpg_check_network_portal() local
433 list_for_each_entry(tpg, &tiqn->tiqn_tpg_list, tpg_list) { in iscsit_tpg_check_network_portal()
435 spin_lock(&tpg->tpg_np_lock); in iscsit_tpg_check_network_portal()
436 list_for_each_entry(tpg_np, &tpg->tpg_gnp_list, tpg_np_list) { in iscsit_tpg_check_network_portal()
444 spin_unlock(&tpg->tpg_np_lock); in iscsit_tpg_check_network_portal()
455 struct iscsi_portal_group *tpg, in iscsit_tpg_add_network_portal() argument
464 if (iscsit_tpg_check_network_portal(tpg->tpg_tiqn, sockaddr, in iscsit_tpg_add_network_portal()
468 tpg->tpg_tiqn->tiqn); in iscsit_tpg_add_network_portal()
493 tpg_np->tpg = tpg; in iscsit_tpg_add_network_portal()
495 spin_lock(&tpg->tpg_np_lock); in iscsit_tpg_add_network_portal()
496 list_add_tail(&tpg_np->tpg_np_list, &tpg->tpg_gnp_list); in iscsit_tpg_add_network_portal()
497 tpg->num_tpg_nps++; in iscsit_tpg_add_network_portal()
498 if (tpg->tpg_tiqn) in iscsit_tpg_add_network_portal()
499 tpg->tpg_tiqn->tiqn_num_tpg_nps++; in iscsit_tpg_add_network_portal()
500 spin_unlock(&tpg->tpg_np_lock); in iscsit_tpg_add_network_portal()
511 tpg->tpg_tiqn->tiqn, &np->np_sockaddr, tpg->tpgt, in iscsit_tpg_add_network_portal()
519 struct iscsi_portal_group *tpg, in iscsit_tpg_release_np() argument
522 iscsit_clear_tpg_np_login_thread(tpg_np, tpg, true); in iscsit_tpg_release_np()
525 tpg->tpg_tiqn->tiqn, &np->np_sockaddr, tpg->tpgt, in iscsit_tpg_release_np()
529 tpg_np->tpg = NULL; in iscsit_tpg_release_np()
538 struct iscsi_portal_group *tpg, in iscsit_tpg_del_network_portal() argument
561 ret = iscsit_tpg_del_network_portal(tpg, tpg_np_child); in iscsit_tpg_del_network_portal()
576 spin_lock(&tpg->tpg_np_lock); in iscsit_tpg_del_network_portal()
578 tpg->num_tpg_nps--; in iscsit_tpg_del_network_portal()
579 if (tpg->tpg_tiqn) in iscsit_tpg_del_network_portal()
580 tpg->tpg_tiqn->tiqn_num_tpg_nps--; in iscsit_tpg_del_network_portal()
581 spin_unlock(&tpg->tpg_np_lock); in iscsit_tpg_del_network_portal()
583 return iscsit_tpg_release_np(tpg_np, tpg, np); in iscsit_tpg_del_network_portal()
586 int iscsit_ta_authentication(struct iscsi_portal_group *tpg, u32 authentication) in iscsit_ta_authentication() argument
591 struct iscsi_tpg_attrib *a = &tpg->tpg_attrib; in iscsit_ta_authentication()
602 param = iscsi_find_param_from_key(AUTHMETHOD, tpg->param_list); in iscsit_ta_authentication()
641 a->authentication ? "Enforcing" : "Disabling", tpg->tpgt); in iscsit_ta_authentication()
647 struct iscsi_portal_group *tpg, in iscsit_ta_login_timeout() argument
650 struct iscsi_tpg_attrib *a = &tpg->tpg_attrib; in iscsit_ta_login_timeout()
664 " %hu\n", a->login_timeout, tpg->tpgt); in iscsit_ta_login_timeout()
670 struct iscsi_portal_group *tpg, in iscsit_ta_netif_timeout() argument
673 struct iscsi_tpg_attrib *a = &tpg->tpg_attrib; in iscsit_ta_netif_timeout()
689 " Target Portal Group %hu\n", a->netif_timeout, tpg->tpgt); in iscsit_ta_netif_timeout()
695 struct iscsi_portal_group *tpg, in iscsit_ta_generate_node_acls() argument
698 struct iscsi_tpg_attrib *a = &tpg->tpg_attrib; in iscsit_ta_generate_node_acls()
707 tpg->tpgt, (a->generate_node_acls) ? "Enabled" : "Disabled"); in iscsit_ta_generate_node_acls()
719 struct iscsi_portal_group *tpg, in iscsit_ta_default_cmdsn_depth() argument
722 struct iscsi_tpg_attrib *a = &tpg->tpg_attrib; in iscsit_ta_default_cmdsn_depth()
738 tpg->tpgt, a->default_cmdsn_depth); in iscsit_ta_default_cmdsn_depth()
744 struct iscsi_portal_group *tpg, in iscsit_ta_cache_dynamic_acls() argument
747 struct iscsi_tpg_attrib *a = &tpg->tpg_attrib; in iscsit_ta_cache_dynamic_acls()
762 " ACLs %s\n", tpg->tpgt, (a->cache_dynamic_acls) ? in iscsit_ta_cache_dynamic_acls()
769 struct iscsi_portal_group *tpg, in iscsit_ta_demo_mode_write_protect() argument
772 struct iscsi_tpg_attrib *a = &tpg->tpg_attrib; in iscsit_ta_demo_mode_write_protect()
781 tpg->tpgt, (a->demo_mode_write_protect) ? "ON" : "OFF"); in iscsit_ta_demo_mode_write_protect()
787 struct iscsi_portal_group *tpg, in iscsit_ta_prod_mode_write_protect() argument
790 struct iscsi_tpg_attrib *a = &tpg->tpg_attrib; in iscsit_ta_prod_mode_write_protect()
799 " %s\n", tpg->tpgt, (a->prod_mode_write_protect) ? in iscsit_ta_prod_mode_write_protect()
806 struct iscsi_portal_group *tpg, in iscsit_ta_demo_mode_discovery() argument
809 struct iscsi_tpg_attrib *a = &tpg->tpg_attrib; in iscsit_ta_demo_mode_discovery()
818 " %s\n", tpg->tpgt, (a->demo_mode_discovery) ? in iscsit_ta_demo_mode_discovery()
825 struct iscsi_portal_group *tpg, in iscsit_ta_default_erl() argument
828 struct iscsi_tpg_attrib *a = &tpg->tpg_attrib; in iscsit_ta_default_erl()
836 pr_debug("iSCSI_TPG[%hu] - DefaultERL: %u\n", tpg->tpgt, a->default_erl); in iscsit_ta_default_erl()
842 struct iscsi_portal_group *tpg, in iscsit_ta_t10_pi() argument
845 struct iscsi_tpg_attrib *a = &tpg->tpg_attrib; in iscsit_ta_t10_pi()
854 " %s\n", tpg->tpgt, (a->t10_pi) ? in iscsit_ta_t10_pi()
861 struct iscsi_portal_group *tpg, in iscsit_ta_fabric_prot_type() argument
864 struct iscsi_tpg_attrib *a = &tpg->tpg_attrib; in iscsit_ta_fabric_prot_type()
873 tpg->tpgt, prot_type); in iscsit_ta_fabric_prot_type()
879 struct iscsi_portal_group *tpg, in iscsit_ta_tpg_enabled_sendtargets() argument
882 struct iscsi_tpg_attrib *a = &tpg->tpg_attrib; in iscsit_ta_tpg_enabled_sendtargets()
891 " %s\n", tpg->tpgt, (a->tpg_enabled_sendtargets) ? "ON" : "OFF"); in iscsit_ta_tpg_enabled_sendtargets()
897 struct iscsi_portal_group *tpg, in iscsit_ta_login_keys_workaround() argument
900 struct iscsi_tpg_attrib *a = &tpg->tpg_attrib; in iscsit_ta_login_keys_workaround()
909 tpg->tpgt, (a->login_keys_workaround) ? "ON" : "OFF"); in iscsit_ta_login_keys_workaround()