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.
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.
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]
22 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
24 #ifndef _ISNS_CLIENT_H_
25 #define _ISNS_CLIENT_H_
30 * List of iSNS servers with which we register.
35 struct sockaddr_storage svr_sa
;
38 uint32_t svr_registered
:1,
41 svr_targets_changed
:1,
43 uint32_t svr_last_target_index
;
44 uint32_t svr_esi_interval
;
45 avl_tree_t svr_target_list
;
49 * Type of registration to perform (deregister, register, update)
52 ISNS_DEREGISTER_TARGET
= 0,
60 * This structure is used to keep state with regard to the RX threads used
66 kthread_t
*esi_thread
;
67 kt_did_t esi_thread_did
;
72 boolean_t esi_enabled
;
74 boolean_t esi_thread_running
;
79 * Portal list - both default portals from idm_get_ipaddr and portals
80 * defined in target port groups.
83 typedef struct isns_portal_s
{
84 struct sockaddr_storage portal_addr
;
85 avl_node_t portal_node
;
86 timespec_t portal_esi_timestamp
;
87 iscsit_portal_t
*portal_iscsit
; /* if in TPG */
88 boolean_t portal_default
; /* if in default */
92 typedef struct isns_tpgt_addr_s
{
93 list_node_t portal_ln
;
94 struct sockaddr_storage portal_addr
;
97 typedef struct isns_tpgt_s
{
98 list_node_t ti_tpgt_ln
;
100 list_t ti_portal_list
;
103 typedef struct isns_target_info_s
{
104 idm_refcnt_t ti_refcnt
;
105 char ti_tgt_name
[MAX_ISCSI_NODENAMELEN
];
106 char ti_tgt_alias
[MAX_ISCSI_NODENAMELEN
];
108 } isns_target_info_t
;
110 /* Contents of isns_target_list and svr->svr_target_list */
111 typedef struct isns_target_s
{
112 iscsit_tgt_t
*target
;
113 avl_node_t target_node
;
114 boolean_t target_registered
;
115 boolean_t target_update_needed
;
116 boolean_t target_delete_needed
;
117 isns_target_info_t
*target_info
;
121 * If no ESI request is received within this number of intervals, we'll
122 * try to re-register with the server.
124 #define MAX_ESI_INTERVALS 3
127 * Interval to ask the server to send us ESI probes, in seconds.
129 #define ISNS_DEFAULT_ESI_INTERVAL 20
132 * Registration Period (when not using ESI), in seconds. (15 min)
134 #define ISNS_DEFAULT_REGISTRATION_PERIOD 900
137 * Initial delay before sending first DevAttrReg message.
139 #define ISNS_INITIAL_DELAY 5
142 isnst_config_merge(it_config_t
*cfg
);
144 int iscsit_isns_init(iscsit_hostinfo_t
*hostinfo
);
145 void iscsit_isns_fini();
146 int iscsit_isns_register(iscsit_tgt_t
*target
);
147 int iscsit_isns_deregister(iscsit_tgt_t
*target
);
148 void iscsit_isns_target_update(iscsit_tgt_t
*target
);
149 void iscsit_isns_portal_online(iscsit_portal_t
*portal
);
150 void iscsit_isns_portal_offline(iscsit_portal_t
*portal
);
152 #endif /* _ISNS_CLIENT_H_ */