dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / kernel / comstar / port / iscsit / iscsit_isns.h
blob9c1b638fafd9a9f04c21fe2295079dbf7b4dd8c5
1 /*
2 * CDDL HEADER START
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]
19 * CDDL HEADER END
22 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
24 #ifndef _ISNS_CLIENT_H_
25 #define _ISNS_CLIENT_H_
27 #include "iscsit.h"
30 * List of iSNS servers with which we register.
33 typedef struct {
34 int svr_retry_count;
35 struct sockaddr_storage svr_sa;
36 clock_t svr_last_msg;
37 list_node_t svr_ln;
38 uint32_t svr_registered:1,
39 svr_reset_needed:1,
40 svr_delete_needed:1,
41 svr_targets_changed:1,
42 svr_monitor_hold:1;
43 uint32_t svr_last_target_index;
44 uint32_t svr_esi_interval;
45 avl_tree_t svr_target_list;
46 } iscsit_isns_svr_t;
49 * Type of registration to perform (deregister, register, update)
51 typedef enum {
52 ISNS_DEREGISTER_TARGET = 0,
53 ISNS_DEREGISTER_ALL,
54 ISNS_REGISTER_TARGET,
55 ISNS_REGISTER_ALL,
56 ISNS_MODIFY_TARGET
57 } isns_reg_type_t;
60 * This structure is used to keep state with regard to the RX threads used
61 * for ESI.
65 typedef struct {
66 kthread_t *esi_thread;
67 kt_did_t esi_thread_did;
68 ksocket_t esi_so;
69 kmutex_t esi_mutex;
70 kcondvar_t esi_cv;
71 uint16_t esi_port;
72 boolean_t esi_enabled;
73 boolean_t esi_valid;
74 boolean_t esi_thread_running;
75 } isns_esi_tinfo_t;
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 */
89 } isns_portal_t;
92 typedef struct isns_tpgt_addr_s {
93 list_node_t portal_ln;
94 struct sockaddr_storage portal_addr;
95 } isns_tpgt_addr_t;
97 typedef struct isns_tpgt_s {
98 list_node_t ti_tpgt_ln;
99 uint16_t ti_tpgt_tag;
100 list_t ti_portal_list;
101 } isns_tpgt_t;
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];
107 list_t ti_tpgt_list;
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;
118 } isns_target_t;
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
141 it_cfg_status_t
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_ */