1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 /* 22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ 25 #ifndef _ISNS_CLIENT_H_ 26 #define _ISNS_CLIENT_H_ 27 28 #include <iscsit.h> 29 30 /* 31 * List of iSNS servers with which we register. 32 */ 33 34 typedef struct { 35 int svr_retry_count; 36 struct sockaddr_storage svr_sa; 37 clock_t svr_last_msg; 38 list_node_t svr_ln; 39 boolean_t svr_registered; 40 } iscsit_isns_svr_t; 41 42 /* 43 * Type of registration to perform (deregister, register, update) 44 */ 45 typedef enum { 46 ISNS_DEREGISTER_TARGET = 0, 47 ISNS_DEREGISTER_ALL, 48 ISNS_REGISTER_TARGET, 49 ISNS_REGISTER_ALL, 50 ISNS_UPDATE_TARGET 51 } isns_reg_type_t; 52 53 /* 54 * This structure is used to keep state with regard to the RX threads used 55 * for ESI. There must always be a 1:1 correspondence between the entries 56 * in this list and the entries in the portal_list. 57 */ 58 59 struct isns_portal_list_s; 60 61 typedef struct { 62 struct isns_portal_list_s *esi_portal; 63 kthread_t *esi_thread; 64 kt_did_t esi_thread_did; 65 ksocket_t esi_so; 66 uint16_t esi_port; 67 boolean_t esi_thread_running; 68 boolean_t esi_thread_failed; 69 boolean_t esi_registered; 70 boolean_t esi_not_available; 71 list_node_t esi_ln; 72 } isns_esi_tinfo_t; 73 74 /* 75 * Portal list - comprised of "default" portals (i.e. idm_get_ipaddr) and 76 * portals that are part of target portal groups. 77 */ 78 79 typedef struct isns_portal_list_s { 80 struct sockaddr_storage portal_addr; 81 isns_esi_tinfo_t *portal_esi; 82 iscsit_portal_t *portal_iscsit; 83 list_node_t portal_ln; 84 } isns_portal_list_t; 85 86 typedef struct isns_target_s { 87 iscsit_tgt_t *target; 88 avl_node_t target_node; 89 boolean_t target_registered; 90 } isns_target_t; 91 92 /* 93 * If no ESI request is received within this number of intervals, we'll 94 * try to re-register with the server. 95 */ 96 #define MAX_ESI_INTERVALS 3 97 98 it_cfg_status_t 99 isnst_config_merge(it_config_t *cfg); 100 101 int iscsit_isns_init(iscsit_hostinfo_t *hostinfo); 102 void iscsit_isns_fini(); 103 int iscsit_isns_register(iscsit_tgt_t *target); 104 int iscsit_isns_deregister(iscsit_tgt_t *target); 105 void iscsit_isns_target_update(iscsit_tgt_t *target); 106 void iscsit_isns_portal_online(iscsit_portal_t *portal); 107 void iscsit_isns_portal_offline(iscsit_portal_t *portal); 108 109 #endif /* _ISNS_CLIENT_H_ */ 110