xref: /titanic_44/usr/src/cmd/isns/isnsd/isns_esi.h (revision 0bd81b6f8fb7804214192b87b0aa3f03fcf87c45)
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 /*
23  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_ISNS_ESI_H
28 #define	_ISNS_ESI_H
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 typedef enum {
35 	EV_ESI = 1,
36 	EV_REG_EXP
37 } ev_type_t;
38 
39 #define	EV_FLAG_INIT	(0x01)
40 #define	EV_FLAG_AGAIN	(0x02)
41 #define	EV_FLAG_WAKEUP	(0x04)
42 #define	EV_FLAG_REMOVE	(0x08)
43 #define	EV_FLAG_REM_P1	(0x10)
44 #define	EV_FLAG_REM_P2	(0x20)
45 #define	EV_FLAG_REM_P3	(0x40)
46 #define	EV_FLAG_REM_P4	(0x80)
47 
48 #define	EV_FLAG_REM_P	(0xF0)
49 
50 typedef struct esi_portal {
51 	int sz;
52 	in_addr_t ip4;
53 	in6_addr_t *ip6;
54 	uint32_t port;
55 	uint32_t esip;
56 	uint32_t ref;
57 	int so;
58 	struct esi_portal *next;
59 } esi_portal_t;
60 
61 typedef struct ev {
62 	ev_type_t type;
63 	uint32_t uid;
64 	uint32_t intval;
65 	int flags;
66 	uchar_t *eid;
67 	uint32_t eid_len;
68 	esi_portal_t *portal;
69 	pthread_mutex_t mtx;
70 	struct ev *next;
71 } ev_t;
72 
73 /* function prototypes */
74 int esi_load(uint32_t, uchar_t *, uint32_t);
75 int esi_add(uint32_t, uchar_t *, uint32_t);
76 int esi_remove(uint32_t);
77 int esi_remove_obj(const isns_obj_t *, int);
78 int verify_esi_portal();
79 uint32_t get_stopwatch(int);
80 uint32_t ev_intval(void *);
81 int ev_match(void *, uint32_t);
82 int ev_remove(void *, uint32_t, int, int);
83 void ev_free(void *);
84 int evf_init(void *);
85 int evf_again(void *);
86 int evf_wakeup(void *);
87 int evf_rem(void *);
88 int evf_rem_pending(void *);
89 void evf_zero(void *);
90 
91 void evl_append(void *);
92 void evl_strip(void *);
93 int evl_remove(uint32_t, uint32_t, int);
94 
95 void *esi_proc(void *);
96 
97 void portal_dies(uint32_t);
98 void reg_expiring(void *);
99 
100 #ifdef __cplusplus
101 }
102 #endif
103 
104 #endif /* _ISNS_ESI_H */
105