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 2010 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #ifndef _INET_SCTP_SCTP_STACK_H 28 #define _INET_SCTP_SCTP_STACK_H 29 30 #include <sys/netstack.h> 31 #include <sys/taskq.h> 32 33 #ifdef __cplusplus 34 extern "C" { 35 #endif 36 37 /* SCTP kstat */ 38 typedef struct sctp_kstat_s { 39 kstat_named_t sctp_add_faddr; 40 kstat_named_t sctp_add_timer; 41 kstat_named_t sctp_conn_create; 42 kstat_named_t sctp_find_next_tq; 43 kstat_named_t sctp_fr_add_hdr; 44 kstat_named_t sctp_fr_not_found; 45 kstat_named_t sctp_output_failed; 46 kstat_named_t sctp_rexmit_failed; 47 kstat_named_t sctp_send_init_failed; 48 kstat_named_t sctp_send_cookie_failed; 49 kstat_named_t sctp_send_cookie_ack_failed; 50 kstat_named_t sctp_send_err_failed; 51 kstat_named_t sctp_send_sack_failed; 52 kstat_named_t sctp_send_shutdown_failed; 53 kstat_named_t sctp_send_shutdown_ack_failed; 54 kstat_named_t sctp_send_shutdown_comp_failed; 55 kstat_named_t sctp_send_user_abort_failed; 56 kstat_named_t sctp_send_asconf_failed; 57 kstat_named_t sctp_send_asconf_ack_failed; 58 kstat_named_t sctp_send_ftsn_failed; 59 kstat_named_t sctp_send_hb_failed; 60 kstat_named_t sctp_return_hb_failed; 61 kstat_named_t sctp_ss_rexmit_failed; 62 kstat_named_t sctp_cl_connect; 63 kstat_named_t sctp_cl_assoc_change; 64 kstat_named_t sctp_cl_check_addrs; 65 } sctp_kstat_t; 66 67 #define SCTP_KSTAT(sctps, x) ((sctps)->sctps_statistics.x.value.ui64++) 68 69 /* 70 * SCTP stack instances 71 */ 72 struct sctp_stack { 73 netstack_t *sctps_netstack; /* Common netstack */ 74 75 mib2_sctp_t sctps_mib; 76 77 /* Protected by sctps_g_lock */ 78 struct list sctps_g_list; /* SCTP instance data chain */ 79 kmutex_t sctps_g_lock; 80 81 #define SCTP_NUM_EPRIV_PORTS 64 82 int sctps_g_num_epriv_ports; 83 in_port_t sctps_g_epriv_ports[SCTP_NUM_EPRIV_PORTS]; 84 kmutex_t sctps_epriv_port_lock; 85 uint_t sctps_next_port_to_try; 86 87 /* SCTP bind hash list - all sctp_t with state >= BOUND. */ 88 struct sctp_tf_s *sctps_bind_fanout; 89 /* SCTP listen hash list - all sctp_t with state == LISTEN. */ 90 struct sctp_tf_s *sctps_listen_fanout; 91 struct sctp_tf_s *sctps_conn_fanout; 92 uint_t sctps_conn_hash_size; 93 94 /* holds sctp tunables */ 95 struct mod_prop_info_s *sctps_propinfo_tbl; 96 97 /* This lock protects the SCTP recvq_tq_list array and recvq_tq_list_cur_sz. */ 98 kmutex_t sctps_rq_tq_lock; 99 int sctps_recvq_tq_list_max_sz; 100 taskq_t **sctps_recvq_tq_list; 101 102 /* Current number of recvq taskq. At least 1 for the default taskq. */ 103 uint32_t sctps_recvq_tq_list_cur_sz; 104 uint32_t sctps_recvq_tq_list_cur; 105 106 /* Global list of SCTP ILLs */ 107 struct sctp_ill_hash_s *sctps_g_ills; 108 uint32_t sctps_ills_count; 109 krwlock_t sctps_g_ills_lock; 110 111 /* Global list of SCTP IPIFs */ 112 struct sctp_ipif_hash_s *sctps_g_ipifs; 113 uint32_t sctps_g_ipifs_count; 114 krwlock_t sctps_g_ipifs_lock; 115 116 /* kstat exporting sctp_mib data */ 117 kstat_t *sctps_mibkp; 118 kstat_t *sctps_kstat; 119 sctp_kstat_t sctps_statistics; 120 }; 121 typedef struct sctp_stack sctp_stack_t; 122 123 #ifdef __cplusplus 124 } 125 #endif 126 127 #endif /* _INET_SCTP_SCTP_STACK_H */ 128