autofs: disable by default
[unleashed.git] / include / inet / sctp / sctp_stack.h
blob5f9e63dbd3a861c0b062f9a3b020d41bf62addf3
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
23 * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
26 #ifndef _INET_SCTP_SCTP_STACK_H
27 #define _INET_SCTP_SCTP_STACK_H
29 #include <sys/netstack.h>
30 #include <sys/taskq.h>
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
36 /* SCTP kstat */
37 typedef struct sctp_kstat_s {
38 kstat_named_t sctp_add_faddr;
39 kstat_named_t sctp_add_timer;
40 kstat_named_t sctp_conn_create;
41 kstat_named_t sctp_find_next_tq;
42 kstat_named_t sctp_fr_add_hdr;
43 kstat_named_t sctp_fr_not_found;
44 kstat_named_t sctp_output_failed;
45 kstat_named_t sctp_rexmit_failed;
46 kstat_named_t sctp_send_init_failed;
47 kstat_named_t sctp_send_cookie_failed;
48 kstat_named_t sctp_send_cookie_ack_failed;
49 kstat_named_t sctp_send_err_failed;
50 kstat_named_t sctp_send_sack_failed;
51 kstat_named_t sctp_send_shutdown_failed;
52 kstat_named_t sctp_send_shutdown_ack_failed;
53 kstat_named_t sctp_send_shutdown_comp_failed;
54 kstat_named_t sctp_send_user_abort_failed;
55 kstat_named_t sctp_send_asconf_failed;
56 kstat_named_t sctp_send_asconf_ack_failed;
57 kstat_named_t sctp_send_ftsn_failed;
58 kstat_named_t sctp_send_hb_failed;
59 kstat_named_t sctp_return_hb_failed;
60 kstat_named_t sctp_ss_rexmit_failed;
61 kstat_named_t sctp_reclaim_cnt;
62 kstat_named_t sctp_listen_cnt_drop;
63 } sctp_kstat_t;
66 * This struct contains only the counter part of sctp_kstat_t. It is used
67 * in sctp_stats_cpu_t instead of sctp_kstat_t to save memory space.
69 typedef struct sctp_kstat_counter_s {
70 uint64_t sctp_add_faddr;
71 uint64_t sctp_add_timer;
72 uint64_t sctp_conn_create;
73 uint64_t sctp_find_next_tq;
74 uint64_t sctp_fr_add_hdr;
75 uint64_t sctp_fr_not_found;
76 uint64_t sctp_output_failed;
77 uint64_t sctp_rexmit_failed;
78 uint64_t sctp_send_init_failed;
79 uint64_t sctp_send_cookie_failed;
80 uint64_t sctp_send_cookie_ack_failed;
81 uint64_t sctp_send_err_failed;
82 uint64_t sctp_send_sack_failed;
83 uint64_t sctp_send_shutdown_failed;
84 uint64_t sctp_send_shutdown_ack_failed;
85 uint64_t sctp_send_shutdown_comp_failed;
86 uint64_t sctp_send_user_abort_failed;
87 uint64_t sctp_send_asconf_failed;
88 uint64_t sctp_send_asconf_ack_failed;
89 uint64_t sctp_send_ftsn_failed;
90 uint64_t sctp_send_hb_failed;
91 uint64_t sctp_return_hb_failed;
92 uint64_t sctp_ss_rexmit_failed;
93 uint64_t sctp_reclaim_cnt;
94 uint64_t sctp_listen_cnt_drop;
95 } sctp_kstat_counter_t;
97 /* Per CPU SCTP statistics counters. */
98 typedef struct {
99 int64_t sctp_sc_assoc_cnt;
100 mib2_sctp_t sctp_sc_mib;
101 sctp_kstat_counter_t sctp_sc_stats;
102 } sctp_stats_cpu_t;
104 #define SCTP_KSTAT(sctps, x) \
105 ((sctps)->sctps_sc[CPU->cpu_seqid]->sctp_sc_stats.x++)
107 #define SCTPS_BUMP_MIB(sctps, x) \
108 BUMP_MIB(&(sctps)->sctps_sc[CPU->cpu_seqid]->sctp_sc_mib, x)
110 #define SCTPS_UPDATE_MIB(sctps, x, y) \
111 UPDATE_MIB(&(sctps)->sctps_sc[CPU->cpu_seqid]->sctp_sc_mib, x, y)
114 * SCTP stack instances
116 struct sctp_stack {
117 netstack_t *sctps_netstack; /* Common netstack */
119 /* Protected by sctps_g_lock */
120 struct list sctps_g_list; /* SCTP instance data chain */
121 kmutex_t sctps_g_lock;
123 #define SCTP_NUM_EPRIV_PORTS 64
124 int sctps_g_num_epriv_ports;
125 in_port_t sctps_g_epriv_ports[SCTP_NUM_EPRIV_PORTS];
126 kmutex_t sctps_epriv_port_lock;
127 uint_t sctps_next_port_to_try;
129 /* SCTP bind hash list - all sctp_t with state >= BOUND. */
130 struct sctp_tf_s *sctps_bind_fanout;
131 /* SCTP listen hash list - all sctp_t with state == LISTEN. */
132 struct sctp_tf_s *sctps_listen_fanout;
133 struct sctp_tf_s *sctps_conn_fanout;
134 uint_t sctps_conn_hash_size;
136 /* holds sctp tunables */
137 struct mod_prop_info_s *sctps_propinfo_tbl;
140 * This lock protects the SCTP recvq_tq_list array and
141 * recvq_tq_list_cur_sz.
143 kmutex_t sctps_rq_tq_lock;
144 int sctps_recvq_tq_list_max_sz;
145 taskq_t **sctps_recvq_tq_list;
147 /* Current number of recvq taskq. At least 1 for the default taskq. */
148 uint32_t sctps_recvq_tq_list_cur_sz;
149 uint32_t sctps_recvq_tq_list_cur;
151 /* Global list of SCTP ILLs */
152 struct sctp_ill_hash_s *sctps_g_ills;
153 uint32_t sctps_ills_count;
154 krwlock_t sctps_g_ills_lock;
156 /* Global list of SCTP IPIFs */
157 struct sctp_ipif_hash_s *sctps_g_ipifs;
158 uint32_t sctps_g_ipifs_count;
159 krwlock_t sctps_g_ipifs_lock;
161 /* kstat exporting mib2_sctp_t and sctp_kstat_t data */
162 kstat_t *sctps_mibkp;
163 kstat_t *sctps_kstat;
165 /* Variables for handling kmem reclaim call back. */
166 kmutex_t sctps_reclaim_lock;
167 boolean_t sctps_reclaim;
168 timeout_id_t sctps_reclaim_tid;
169 uint32_t sctps_reclaim_period;
171 /* Listener association limit configuration. */
172 kmutex_t sctps_listener_conf_lock;
173 list_t sctps_listener_conf;
176 * Per CPU stats
178 * sctps_sc: array of pointer to per CPU stats. The i-th element in
179 * the array represents the stats of the CPU with cpu_seqid.
180 * sctps_sc_cnt: number of CPU stats in the sctps_sc array.
182 sctp_stats_cpu_t **sctps_sc;
183 int sctps_sc_cnt;
186 typedef struct sctp_stack sctp_stack_t;
188 #ifdef __cplusplus
190 #endif
192 #endif /* _INET_SCTP_SCTP_STACK_H */