1f8829a4aSRandall Stewart /*- 2830d754dSRandall Stewart * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved. 35d40cf5dSRandall Stewart * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved. 45d40cf5dSRandall Stewart * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved. 5f8829a4aSRandall Stewart * 6f8829a4aSRandall Stewart * Redistribution and use in source and binary forms, with or without 7f8829a4aSRandall Stewart * modification, are permitted provided that the following conditions are met: 8f8829a4aSRandall Stewart * 9f8829a4aSRandall Stewart * a) Redistributions of source code must retain the above copyright notice, 10f8829a4aSRandall Stewart * this list of conditions and the following disclaimer. 11f8829a4aSRandall Stewart * 12f8829a4aSRandall Stewart * b) Redistributions in binary form must reproduce the above copyright 13f8829a4aSRandall Stewart * notice, this list of conditions and the following disclaimer in 14f8829a4aSRandall Stewart * the documentation and/or other materials provided with the distribution. 15f8829a4aSRandall Stewart * 16f8829a4aSRandall Stewart * c) Neither the name of Cisco Systems, Inc. nor the names of its 17f8829a4aSRandall Stewart * contributors may be used to endorse or promote products derived 18f8829a4aSRandall Stewart * from this software without specific prior written permission. 19f8829a4aSRandall Stewart * 20f8829a4aSRandall Stewart * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21f8829a4aSRandall Stewart * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 22f8829a4aSRandall Stewart * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23f8829a4aSRandall Stewart * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 24f8829a4aSRandall Stewart * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25f8829a4aSRandall Stewart * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26f8829a4aSRandall Stewart * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27f8829a4aSRandall Stewart * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28f8829a4aSRandall Stewart * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29f8829a4aSRandall Stewart * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 30f8829a4aSRandall Stewart * THE POSSIBILITY OF SUCH DAMAGE. 31f8829a4aSRandall Stewart */ 32f8829a4aSRandall Stewart 33f8829a4aSRandall Stewart /* $KAME: sctp_structs.h,v 1.13 2005/03/06 16:04:18 itojun Exp $ */ 34f8829a4aSRandall Stewart 35f8829a4aSRandall Stewart #include <sys/cdefs.h> 36f8829a4aSRandall Stewart __FBSDID("$FreeBSD$"); 37f8829a4aSRandall Stewart 38f8829a4aSRandall Stewart #ifndef __sctp_structs_h__ 39f8829a4aSRandall Stewart #define __sctp_structs_h__ 40f8829a4aSRandall Stewart 41139bc87fSRandall Stewart #include <netinet/sctp_os.h> 42f8829a4aSRandall Stewart #include <netinet/sctp_header.h> 43f8829a4aSRandall Stewart #include <netinet/sctp_auth.h> 44f8829a4aSRandall Stewart 45f8829a4aSRandall Stewart struct sctp_timer { 46139bc87fSRandall Stewart sctp_os_timer_t timer; 47139bc87fSRandall Stewart 48f8829a4aSRandall Stewart int type; 49f8829a4aSRandall Stewart /* 50f8829a4aSRandall Stewart * Depending on the timer type these will be setup and cast with the 51f8829a4aSRandall Stewart * appropriate entity. 52f8829a4aSRandall Stewart */ 53f8829a4aSRandall Stewart void *ep; 54f8829a4aSRandall Stewart void *tcb; 55f8829a4aSRandall Stewart void *net; 568518270eSMichael Tuexen void *vnet; 57f8829a4aSRandall Stewart 58f8829a4aSRandall Stewart /* for sanity checking */ 59f8829a4aSRandall Stewart void *self; 60f8829a4aSRandall Stewart uint32_t ticks; 61a5d547adSRandall Stewart uint32_t stopped_from; 62f8829a4aSRandall Stewart }; 63f8829a4aSRandall Stewart 64f8829a4aSRandall Stewart 65a5d547adSRandall Stewart struct sctp_foo_stuff { 66a5d547adSRandall Stewart struct sctp_inpcb *inp; 67a5d547adSRandall Stewart uint32_t lineno; 68a5d547adSRandall Stewart uint32_t ticks; 69a5d547adSRandall Stewart int updown; 70a5d547adSRandall Stewart }; 71a5d547adSRandall Stewart 72f8829a4aSRandall Stewart 73f8829a4aSRandall Stewart /* 74f8829a4aSRandall Stewart * This is the information we track on each interface that we know about from 75f8829a4aSRandall Stewart * the distant end. 76f8829a4aSRandall Stewart */ 77f8829a4aSRandall Stewart TAILQ_HEAD(sctpnetlisthead, sctp_nets); 78f8829a4aSRandall Stewart 79f8829a4aSRandall Stewart struct sctp_stream_reset_list { 80f8829a4aSRandall Stewart TAILQ_ENTRY(sctp_stream_reset_list) next_resp; 81f8829a4aSRandall Stewart uint32_t tsn; 82f8829a4aSRandall Stewart int number_entries; 83f8829a4aSRandall Stewart struct sctp_stream_reset_out_request req; 84f8829a4aSRandall Stewart }; 85f8829a4aSRandall Stewart 86f8829a4aSRandall Stewart TAILQ_HEAD(sctp_resethead, sctp_stream_reset_list); 87f8829a4aSRandall Stewart 88f8829a4aSRandall Stewart /* 89f8829a4aSRandall Stewart * Users of the iterator need to malloc a iterator with a call to 9042551e99SRandall Stewart * sctp_initiate_iterator(inp_func, assoc_func, inp_func, pcb_flags, pcb_features, 91f8829a4aSRandall Stewart * asoc_state, void-ptr-arg, uint32-arg, end_func, inp); 92f8829a4aSRandall Stewart * 93f8829a4aSRandall Stewart * Use the following two defines if you don't care what pcb flags are on the EP 94f8829a4aSRandall Stewart * and/or you don't care what state the association is in. 95f8829a4aSRandall Stewart * 96f8829a4aSRandall Stewart * Note that if you specify an INP as the last argument then ONLY each 97f8829a4aSRandall Stewart * association of that single INP will be executed upon. Note that the pcb 98f8829a4aSRandall Stewart * flags STILL apply so if the inp you specify has different pcb_flags then 99f8829a4aSRandall Stewart * what you put in pcb_flags nothing will happen. use SCTP_PCB_ANY_FLAGS to 100f8829a4aSRandall Stewart * assure the inp you specify gets treated. 101f8829a4aSRandall Stewart */ 102f8829a4aSRandall Stewart #define SCTP_PCB_ANY_FLAGS 0x00000000 103f8829a4aSRandall Stewart #define SCTP_PCB_ANY_FEATURES 0x00000000 104f8829a4aSRandall Stewart #define SCTP_ASOC_ANY_STATE 0x00000000 105f8829a4aSRandall Stewart 106f8829a4aSRandall Stewart typedef void (*asoc_func) (struct sctp_inpcb *, struct sctp_tcb *, void *ptr, 107f8829a4aSRandall Stewart uint32_t val); 10842551e99SRandall Stewart typedef int (*inp_func) (struct sctp_inpcb *, void *ptr, uint32_t val); 109f8829a4aSRandall Stewart typedef void (*end_func) (void *ptr, uint32_t val); 110f8829a4aSRandall Stewart 111bfc46083SRandall Stewart #if defined(__FreeBSD__) && defined(SCTP_MCORE_INPUT) && defined(SMP) 112bfc46083SRandall Stewart /* whats on the mcore control struct */ 113bfc46083SRandall Stewart struct sctp_mcore_queue { 114bfc46083SRandall Stewart TAILQ_ENTRY(sctp_mcore_queue) next; 115bfc46083SRandall Stewart struct vnet *vn; 116bfc46083SRandall Stewart struct mbuf *m; 117bfc46083SRandall Stewart int off; 118bfc46083SRandall Stewart int v6; 119bfc46083SRandall Stewart }; 120bfc46083SRandall Stewart 121bfc46083SRandall Stewart TAILQ_HEAD(sctp_mcore_qhead, sctp_mcore_queue); 122bfc46083SRandall Stewart 123bfc46083SRandall Stewart struct sctp_mcore_ctrl { 124bfc46083SRandall Stewart SCTP_PROCESS_STRUCT thread_proc; 125bfc46083SRandall Stewart struct sctp_mcore_qhead que; 126bfc46083SRandall Stewart struct mtx core_mtx; 127bfc46083SRandall Stewart struct mtx que_mtx; 128bfc46083SRandall Stewart int running; 129bfc46083SRandall Stewart int cpuid; 130bfc46083SRandall Stewart }; 131bfc46083SRandall Stewart 132bfc46083SRandall Stewart 133bfc46083SRandall Stewart #endif 134bfc46083SRandall Stewart 135bfc46083SRandall Stewart 136f8829a4aSRandall Stewart struct sctp_iterator { 13742551e99SRandall Stewart TAILQ_ENTRY(sctp_iterator) sctp_nxt_itr; 138f7517433SRandall Stewart struct vnet *vn; 139f8829a4aSRandall Stewart struct sctp_timer tmr; 140f8829a4aSRandall Stewart struct sctp_inpcb *inp; /* current endpoint */ 141f8829a4aSRandall Stewart struct sctp_tcb *stcb; /* current* assoc */ 142f7517433SRandall Stewart struct sctp_inpcb *next_inp; /* special hook to skip to */ 143f8829a4aSRandall Stewart asoc_func function_assoc; /* per assoc function */ 144f8829a4aSRandall Stewart inp_func function_inp; /* per endpoint function */ 14542551e99SRandall Stewart inp_func function_inp_end; /* end INP function */ 146f8829a4aSRandall Stewart end_func function_atend;/* iterator completion function */ 147f8829a4aSRandall Stewart void *pointer; /* pointer for apply func to use */ 148f8829a4aSRandall Stewart uint32_t val; /* value for apply func to use */ 149f8829a4aSRandall Stewart uint32_t pcb_flags; /* endpoint flags being checked */ 150f8829a4aSRandall Stewart uint32_t pcb_features; /* endpoint features being checked */ 151f8829a4aSRandall Stewart uint32_t asoc_state; /* assoc state being checked */ 152f8829a4aSRandall Stewart uint32_t iterator_flags; 153f8829a4aSRandall Stewart uint8_t no_chunk_output; 15442551e99SRandall Stewart uint8_t done_current_ep; 155f8829a4aSRandall Stewart }; 156f8829a4aSRandall Stewart 157f8829a4aSRandall Stewart /* iterator_flags values */ 158f8829a4aSRandall Stewart #define SCTP_ITERATOR_DO_ALL_INP 0x00000001 159f8829a4aSRandall Stewart #define SCTP_ITERATOR_DO_SINGLE_INP 0x00000002 160f8829a4aSRandall Stewart 161f7517433SRandall Stewart 16242551e99SRandall Stewart TAILQ_HEAD(sctpiterators, sctp_iterator); 163f8829a4aSRandall Stewart 164f8829a4aSRandall Stewart struct sctp_copy_all { 165f8829a4aSRandall Stewart struct sctp_inpcb *inp; /* ep */ 166f8829a4aSRandall Stewart struct mbuf *m; 167f8829a4aSRandall Stewart struct sctp_sndrcvinfo sndrcv; 168f8829a4aSRandall Stewart int sndlen; 169f8829a4aSRandall Stewart int cnt_sent; 170f8829a4aSRandall Stewart int cnt_failed; 171f8829a4aSRandall Stewart }; 172f8829a4aSRandall Stewart 17342551e99SRandall Stewart struct sctp_asconf_iterator { 17442551e99SRandall Stewart struct sctpladdr list_of_work; 17542551e99SRandall Stewart int cnt; 17642551e99SRandall Stewart }; 17742551e99SRandall Stewart 178f7517433SRandall Stewart struct iterator_control { 179f7517433SRandall Stewart struct mtx ipi_iterator_wq_mtx; 180f7517433SRandall Stewart struct mtx it_mtx; 181f7517433SRandall Stewart SCTP_PROCESS_STRUCT thread_proc; 182f7517433SRandall Stewart struct sctpiterators iteratorhead; 183f7517433SRandall Stewart struct sctp_iterator *cur_it; 184f7517433SRandall Stewart uint32_t iterator_running; 185f7517433SRandall Stewart uint32_t iterator_flags; 186f7517433SRandall Stewart }; 187f7517433SRandall Stewart 188f7517433SRandall Stewart #define SCTP_ITERATOR_MUST_EXIT 0x00000001 189f7517433SRandall Stewart #define SCTP_ITERATOR_STOP_CUR_IT 0x00000002 190f7517433SRandall Stewart #define SCTP_ITERATOR_STOP_CUR_INP 0x00000004 191f7517433SRandall Stewart 19217205eccSRandall Stewart struct sctp_net_route { 19317205eccSRandall Stewart sctp_rtentry_t *ro_rt; 194de4ab55eSKip Macy void *ro_lle; 19517205eccSRandall Stewart union sctp_sockstore _l_addr; /* remote peer addr */ 19617205eccSRandall Stewart struct sctp_ifa *_s_addr; /* our selected src addr */ 19717205eccSRandall Stewart }; 19817205eccSRandall Stewart 199b54d3a6cSRandall Stewart struct htcp { 200b54d3a6cSRandall Stewart uint16_t alpha; /* Fixed point arith, << 7 */ 201b54d3a6cSRandall Stewart uint8_t beta; /* Fixed point arith, << 7 */ 202b54d3a6cSRandall Stewart uint8_t modeswitch; /* Delay modeswitch until we had at least one 203b54d3a6cSRandall Stewart * congestion event */ 204b54d3a6cSRandall Stewart uint32_t last_cong; /* Time since last congestion event end */ 205b54d3a6cSRandall Stewart uint32_t undo_last_cong; 206b54d3a6cSRandall Stewart uint16_t bytes_acked; 207b54d3a6cSRandall Stewart uint32_t bytecount; 208b54d3a6cSRandall Stewart uint32_t minRTT; 209b54d3a6cSRandall Stewart uint32_t maxRTT; 210b54d3a6cSRandall Stewart 211b54d3a6cSRandall Stewart uint32_t undo_maxRTT; 212b54d3a6cSRandall Stewart uint32_t undo_old_maxB; 213b54d3a6cSRandall Stewart 214b54d3a6cSRandall Stewart /* Bandwidth estimation */ 215b54d3a6cSRandall Stewart uint32_t minB; 216b54d3a6cSRandall Stewart uint32_t maxB; 217b54d3a6cSRandall Stewart uint32_t old_maxB; 218b54d3a6cSRandall Stewart uint32_t Bi; 219b54d3a6cSRandall Stewart uint32_t lasttime; 220b54d3a6cSRandall Stewart }; 221b54d3a6cSRandall Stewart 222b54d3a6cSRandall Stewart 223f8829a4aSRandall Stewart struct sctp_nets { 224f8829a4aSRandall Stewart TAILQ_ENTRY(sctp_nets) sctp_next; /* next link */ 225f8829a4aSRandall Stewart 226f8829a4aSRandall Stewart /* 227f8829a4aSRandall Stewart * Things on the top half may be able to be split into a common 228f8829a4aSRandall Stewart * structure shared by all. 229f8829a4aSRandall Stewart */ 230f8829a4aSRandall Stewart struct sctp_timer pmtu_timer; 231f8829a4aSRandall Stewart 232f8829a4aSRandall Stewart /* 233f8829a4aSRandall Stewart * The following two in combination equate to a route entry for v6 234f8829a4aSRandall Stewart * or v4. 235f8829a4aSRandall Stewart */ 23617205eccSRandall Stewart struct sctp_net_route ro; 23717205eccSRandall Stewart 238f8829a4aSRandall Stewart /* mtu discovered so far */ 239f8829a4aSRandall Stewart uint32_t mtu; 240f8829a4aSRandall Stewart uint32_t ssthresh; /* not sure about this one for split */ 241a21779f0SRandall Stewart uint32_t last_cwr_tsn; 242a21779f0SRandall Stewart uint32_t cwr_window_tsn; 243a21779f0SRandall Stewart uint32_t ecn_ce_pkt_cnt; 244a21779f0SRandall Stewart uint32_t lost_cnt; 245f8829a4aSRandall Stewart /* smoothed average things for RTT and RTO itself */ 246f8829a4aSRandall Stewart int lastsa; 247f8829a4aSRandall Stewart int lastsv; 2488933fa13SRandall Stewart int rtt; /* last measured rtt value in ms */ 249f8829a4aSRandall Stewart unsigned int RTO; 250f8829a4aSRandall Stewart 251f8829a4aSRandall Stewart /* This is used for SHUTDOWN/SHUTDOWN-ACK/SEND or INIT timers */ 252f8829a4aSRandall Stewart struct sctp_timer rxt_timer; 253f8829a4aSRandall Stewart struct sctp_timer fr_timer; /* for early fr */ 254f8829a4aSRandall Stewart 255f8829a4aSRandall Stewart /* last time in seconds I sent to it */ 256f8829a4aSRandall Stewart struct timeval last_sent_time; 257f8829a4aSRandall Stewart int ref_count; 258f8829a4aSRandall Stewart 259f8829a4aSRandall Stewart /* Congestion stats per destination */ 260f8829a4aSRandall Stewart /* 261f8829a4aSRandall Stewart * flight size variables and such, sorry Vern, I could not avoid 262f8829a4aSRandall Stewart * this if I wanted performance :> 263f8829a4aSRandall Stewart */ 264f8829a4aSRandall Stewart uint32_t flight_size; 265f8829a4aSRandall Stewart uint32_t cwnd; /* actual cwnd */ 266f8829a4aSRandall Stewart uint32_t prev_cwnd; /* cwnd before any processing */ 267899288aeSRandall Stewart uint32_t ecn_prev_cwnd; /* ECN prev cwnd at first ecn_echo seen in new 268899288aeSRandall Stewart * window */ 269f8829a4aSRandall Stewart uint32_t partial_bytes_acked; /* in CA tracks when to incr a MTU */ 270f8829a4aSRandall Stewart uint32_t prev_rtt; 271f8829a4aSRandall Stewart /* tracking variables to avoid the aloc/free in sack processing */ 272f8829a4aSRandall Stewart unsigned int net_ack; 273f8829a4aSRandall Stewart unsigned int net_ack2; 274f8829a4aSRandall Stewart 275f8829a4aSRandall Stewart /* 276b54d3a6cSRandall Stewart * JRS - 5/8/07 - Variable to track last time a destination was 277b54d3a6cSRandall Stewart * active for CMT PF 278b54d3a6cSRandall Stewart */ 279b54d3a6cSRandall Stewart uint32_t last_active; 280b54d3a6cSRandall Stewart 281b54d3a6cSRandall Stewart /* 282f8829a4aSRandall Stewart * CMT variables (iyengar@cis.udel.edu) 283f8829a4aSRandall Stewart */ 284f8829a4aSRandall Stewart uint32_t this_sack_highest_newack; /* tracks highest TSN newly 285f8829a4aSRandall Stewart * acked for a given dest in 286f8829a4aSRandall Stewart * the current SACK. Used in 287f8829a4aSRandall Stewart * SFR and HTNA algos */ 288f8829a4aSRandall Stewart uint32_t pseudo_cumack; /* CMT CUC algorithm. Maintains next expected 289f8829a4aSRandall Stewart * pseudo-cumack for this destination */ 290f8829a4aSRandall Stewart uint32_t rtx_pseudo_cumack; /* CMT CUC algorithm. Maintains next 291f8829a4aSRandall Stewart * expected pseudo-cumack for this 292f8829a4aSRandall Stewart * destination */ 293f8829a4aSRandall Stewart 294f8829a4aSRandall Stewart /* CMT fast recovery variables */ 295f8829a4aSRandall Stewart uint32_t fast_recovery_tsn; 296f8829a4aSRandall Stewart uint32_t heartbeat_random1; 297f8829a4aSRandall Stewart uint32_t heartbeat_random2; 298f8829a4aSRandall Stewart uint32_t tos_flowlabel; 299f8829a4aSRandall Stewart 3005e54f665SRandall Stewart struct timeval start_time; /* time when this net was created */ 301410bcbefSRandall Stewart struct timeval last_measured_rtt; 3025e54f665SRandall Stewart uint32_t marked_retrans;/* number or DATA chunks marked for timer 3035e54f665SRandall Stewart * based retransmissions */ 3045e54f665SRandall Stewart uint32_t marked_fastretrans; 3055e54f665SRandall Stewart 306f8829a4aSRandall Stewart /* if this guy is ok or not ... status */ 307f8829a4aSRandall Stewart uint16_t dest_state; 308f8829a4aSRandall Stewart /* number of transmit failures to down this guy */ 309f8829a4aSRandall Stewart uint16_t failure_threshold; 310f8829a4aSRandall Stewart /* error stats on destination */ 311f8829a4aSRandall Stewart uint16_t error_count; 312c54a18d2SRandall Stewart /* UDP port number in case of UDP tunneling */ 313c54a18d2SRandall Stewart uint16_t port; 314f8829a4aSRandall Stewart 315f8829a4aSRandall Stewart uint8_t fast_retran_loss_recovery; 316f8829a4aSRandall Stewart uint8_t will_exit_fast_recovery; 317f8829a4aSRandall Stewart /* Flags that probably can be combined into dest_state */ 318f8829a4aSRandall Stewart uint8_t fast_retran_ip; /* fast retransmit in progress */ 319f8829a4aSRandall Stewart uint8_t hb_responded; 320f8829a4aSRandall Stewart uint8_t saw_newack; /* CMT's SFR algorithm flag */ 321f8829a4aSRandall Stewart uint8_t src_addr_selected; /* if we split we move */ 322f8829a4aSRandall Stewart uint8_t indx_of_eligible_next_to_use; 323f8829a4aSRandall Stewart uint8_t addr_is_local; /* its a local address (if known) could move 324f8829a4aSRandall Stewart * in split */ 325f8829a4aSRandall Stewart 326f8829a4aSRandall Stewart /* 327f8829a4aSRandall Stewart * CMT variables (iyengar@cis.udel.edu) 328f8829a4aSRandall Stewart */ 329f8829a4aSRandall Stewart uint8_t find_pseudo_cumack; /* CMT CUC algorithm. Flag used to 330f8829a4aSRandall Stewart * find a new pseudocumack. This flag 331f8829a4aSRandall Stewart * is set after a new pseudo-cumack 332f8829a4aSRandall Stewart * has been received and indicates 333f8829a4aSRandall Stewart * that the sender should find the 334f8829a4aSRandall Stewart * next pseudo-cumack expected for 335f8829a4aSRandall Stewart * this destination */ 336f8829a4aSRandall Stewart uint8_t find_rtx_pseudo_cumack; /* CMT CUCv2 algorithm. Flag used to 337f8829a4aSRandall Stewart * find a new rtx-pseudocumack. This 338f8829a4aSRandall Stewart * flag is set after a new 339f8829a4aSRandall Stewart * rtx-pseudo-cumack has been received 340f8829a4aSRandall Stewart * and indicates that the sender 341f8829a4aSRandall Stewart * should find the next 342f8829a4aSRandall Stewart * rtx-pseudo-cumack expected for this 343f8829a4aSRandall Stewart * destination */ 344f8829a4aSRandall Stewart uint8_t new_pseudo_cumack; /* CMT CUC algorithm. Flag used to 345f8829a4aSRandall Stewart * indicate if a new pseudo-cumack or 346f8829a4aSRandall Stewart * rtx-pseudo-cumack has been received */ 3475e54f665SRandall Stewart uint8_t window_probe; /* Doing a window probe? */ 3489a972525SRandall Stewart uint8_t RTO_measured; /* Have we done the first measure */ 349f8829a4aSRandall Stewart uint8_t last_hs_used; /* index into the last HS table entry we used */ 350899288aeSRandall Stewart uint8_t lan_type; 351b54d3a6cSRandall Stewart /* JRS - struct used in HTCP algorithm */ 352b54d3a6cSRandall Stewart struct htcp htcp_ca; 353*a4ae38f1SMichael Tuexen uint32_t flowid; 354f8829a4aSRandall Stewart }; 355f8829a4aSRandall Stewart 356f8829a4aSRandall Stewart 357f8829a4aSRandall Stewart struct sctp_data_chunkrec { 358f8829a4aSRandall Stewart uint32_t TSN_seq; /* the TSN of this transmit */ 359f8829a4aSRandall Stewart uint16_t stream_seq; /* the stream sequence number of this transmit */ 360f8829a4aSRandall Stewart uint16_t stream_number; /* the stream number of this guy */ 361f8829a4aSRandall Stewart uint32_t payloadtype; 362f8829a4aSRandall Stewart uint32_t context; /* from send */ 363899288aeSRandall Stewart uint32_t cwnd_at_send; 364f8829a4aSRandall Stewart /* 365f8829a4aSRandall Stewart * part of the Highest sacked algorithm to be able to stroke counts 366f8829a4aSRandall Stewart * on ones that are FR'd. 367f8829a4aSRandall Stewart */ 368f8829a4aSRandall Stewart uint32_t fast_retran_tsn; /* sending_seq at the time of FR */ 369f8829a4aSRandall Stewart struct timeval timetodrop; /* time we drop it from queue */ 370f8829a4aSRandall Stewart uint8_t doing_fast_retransmit; 371f8829a4aSRandall Stewart uint8_t rcv_flags; /* flags pulled from data chunk on inbound for 372a5d547adSRandall Stewart * outbound holds sending flags for PR-SCTP. */ 373f8829a4aSRandall Stewart uint8_t state_flags; 374f8829a4aSRandall Stewart uint8_t chunk_was_revoked; 375899288aeSRandall Stewart uint8_t fwd_tsn_cnt; 376f8829a4aSRandall Stewart }; 377f8829a4aSRandall Stewart 378f8829a4aSRandall Stewart TAILQ_HEAD(sctpchunk_listhead, sctp_tmit_chunk); 379f8829a4aSRandall Stewart 380f8829a4aSRandall Stewart /* The lower byte is used to enumerate PR_SCTP policies */ 381f8829a4aSRandall Stewart #define CHUNK_FLAGS_PR_SCTP_TTL SCTP_PR_SCTP_TTL 382f8829a4aSRandall Stewart #define CHUNK_FLAGS_PR_SCTP_BUF SCTP_PR_SCTP_BUF 383f8829a4aSRandall Stewart #define CHUNK_FLAGS_PR_SCTP_RTX SCTP_PR_SCTP_RTX 384f8829a4aSRandall Stewart 385f8829a4aSRandall Stewart /* The upper byte is used a a bit mask */ 386f8829a4aSRandall Stewart #define CHUNK_FLAGS_FRAGMENT_OK 0x0100 387f8829a4aSRandall Stewart 388f8829a4aSRandall Stewart struct chk_id { 389f8829a4aSRandall Stewart uint16_t id; 390f8829a4aSRandall Stewart uint16_t can_take_data; 391f8829a4aSRandall Stewart }; 392f8829a4aSRandall Stewart 393f8829a4aSRandall Stewart 394f8829a4aSRandall Stewart struct sctp_tmit_chunk { 395f8829a4aSRandall Stewart union { 396f8829a4aSRandall Stewart struct sctp_data_chunkrec data; 397f8829a4aSRandall Stewart struct chk_id chunk_id; 398f8829a4aSRandall Stewart } rec; 399f8829a4aSRandall Stewart struct sctp_association *asoc; /* bp to asoc this belongs to */ 400f8829a4aSRandall Stewart struct timeval sent_rcv_time; /* filled in if RTT being calculated */ 401f8829a4aSRandall Stewart struct mbuf *data; /* pointer to mbuf chain of data */ 402f8829a4aSRandall Stewart struct mbuf *last_mbuf; /* pointer to last mbuf in chain */ 403f8829a4aSRandall Stewart struct sctp_nets *whoTo; 404f8829a4aSRandall Stewart TAILQ_ENTRY(sctp_tmit_chunk) sctp_next; /* next link */ 405f8829a4aSRandall Stewart int32_t sent; /* the send status */ 406f8829a4aSRandall Stewart uint16_t snd_count; /* number of times I sent */ 407f8829a4aSRandall Stewart uint16_t flags; /* flags, such as FRAGMENT_OK */ 408f8829a4aSRandall Stewart uint16_t send_size; 409f8829a4aSRandall Stewart uint16_t book_size; 410f8829a4aSRandall Stewart uint16_t mbcnt; 411830d754dSRandall Stewart uint16_t auth_keyid; 412830d754dSRandall Stewart uint8_t holds_key_ref; /* flag if auth keyid refcount is held */ 413f8829a4aSRandall Stewart uint8_t pad_inplace; 414f8829a4aSRandall Stewart uint8_t do_rtt; 415f8829a4aSRandall Stewart uint8_t book_size_scale; 416f8829a4aSRandall Stewart uint8_t no_fr_allowed; 417f8829a4aSRandall Stewart uint8_t pr_sctp_on; 418f8829a4aSRandall Stewart uint8_t copy_by_ref; 4195e54f665SRandall Stewart uint8_t window_probe; 420f8829a4aSRandall Stewart }; 421f8829a4aSRandall Stewart 422f8829a4aSRandall Stewart /* 423f8829a4aSRandall Stewart * The first part of this structure MUST be the entire sinfo structure. Maybe 424f8829a4aSRandall Stewart * I should have made it a sub structure... we can circle back later and do 425f8829a4aSRandall Stewart * that if we want. 426f8829a4aSRandall Stewart */ 427f8829a4aSRandall Stewart struct sctp_queued_to_read { /* sinfo structure Pluse more */ 428f8829a4aSRandall Stewart uint16_t sinfo_stream; /* off the wire */ 429f8829a4aSRandall Stewart uint16_t sinfo_ssn; /* off the wire */ 430f8829a4aSRandall Stewart uint16_t sinfo_flags; /* SCTP_UNORDERED from wire use SCTP_EOF for 431f8829a4aSRandall Stewart * EOR */ 432f8829a4aSRandall Stewart uint32_t sinfo_ppid; /* off the wire */ 433f8829a4aSRandall Stewart uint32_t sinfo_context; /* pick this up from assoc def context? */ 434f8829a4aSRandall Stewart uint32_t sinfo_timetolive; /* not used by kernel */ 435f8829a4aSRandall Stewart uint32_t sinfo_tsn; /* Use this in reassembly as first TSN */ 436f8829a4aSRandall Stewart uint32_t sinfo_cumtsn; /* Use this in reassembly as last TSN */ 437f8829a4aSRandall Stewart sctp_assoc_t sinfo_assoc_id; /* our assoc id */ 438f8829a4aSRandall Stewart /* Non sinfo stuff */ 439f8829a4aSRandall Stewart uint32_t length; /* length of data */ 440f8829a4aSRandall Stewart uint32_t held_length; /* length held in sb */ 441f8829a4aSRandall Stewart struct sctp_nets *whoFrom; /* where it came from */ 442f8829a4aSRandall Stewart struct mbuf *data; /* front of the mbuf chain of data with 443f8829a4aSRandall Stewart * PKT_HDR */ 444f8829a4aSRandall Stewart struct mbuf *tail_mbuf; /* used for multi-part data */ 44517205eccSRandall Stewart struct mbuf *aux_data; /* used to hold/cache control if o/s does not 44617205eccSRandall Stewart * take it from us */ 447f8829a4aSRandall Stewart struct sctp_tcb *stcb; /* assoc, used for window update */ 448f8829a4aSRandall Stewart TAILQ_ENTRY(sctp_queued_to_read) next; 449f8829a4aSRandall Stewart uint16_t port_from; 450139bc87fSRandall Stewart uint16_t spec_flags; /* Flags to hold the notification field */ 451f8829a4aSRandall Stewart uint8_t do_not_ref_stcb; 452f8829a4aSRandall Stewart uint8_t end_added; 45303b0b021SRandall Stewart uint8_t pdapi_aborted; 4549a6142d8SRandall Stewart uint8_t some_taken; 455f8829a4aSRandall Stewart }; 456f8829a4aSRandall Stewart 457f8829a4aSRandall Stewart /* This data structure will be on the outbound 458f8829a4aSRandall Stewart * stream queues. Data will be pulled off from 459f8829a4aSRandall Stewart * the front of the mbuf data and chunk-ified 460f8829a4aSRandall Stewart * by the output routines. We will custom 461f8829a4aSRandall Stewart * fit every chunk we pull to the send/sent 462f8829a4aSRandall Stewart * queue to make up the next full packet 463f8829a4aSRandall Stewart * if we can. An entry cannot be removed 464f8829a4aSRandall Stewart * from the stream_out queue until 465f8829a4aSRandall Stewart * the msg_is_complete flag is set. This 466f8829a4aSRandall Stewart * means at times data/tail_mbuf MIGHT 467f8829a4aSRandall Stewart * be NULL.. If that occurs it happens 468f8829a4aSRandall Stewart * for one of two reasons. Either the user 469f8829a4aSRandall Stewart * is blocked on a send() call and has not 470f8829a4aSRandall Stewart * awoken to copy more data down... OR 471f8829a4aSRandall Stewart * the user is in the explict MSG_EOR mode 472f8829a4aSRandall Stewart * and wrote some data, but has not completed 473f8829a4aSRandall Stewart * sending. 474f8829a4aSRandall Stewart */ 475f8829a4aSRandall Stewart struct sctp_stream_queue_pending { 476f8829a4aSRandall Stewart struct mbuf *data; 477f8829a4aSRandall Stewart struct mbuf *tail_mbuf; 478f8829a4aSRandall Stewart struct timeval ts; 479f8829a4aSRandall Stewart struct sctp_nets *net; 480f8829a4aSRandall Stewart TAILQ_ENTRY(sctp_stream_queue_pending) next; 481252f7f93SMichael Tuexen TAILQ_ENTRY(sctp_stream_queue_pending) ss_next; 482f8829a4aSRandall Stewart uint32_t length; 483f8829a4aSRandall Stewart uint32_t timetolive; 484f8829a4aSRandall Stewart uint32_t ppid; 485f8829a4aSRandall Stewart uint32_t context; 486f8829a4aSRandall Stewart uint16_t sinfo_flags; 487f8829a4aSRandall Stewart uint16_t stream; 488f8829a4aSRandall Stewart uint16_t strseq; 489a5d547adSRandall Stewart uint16_t act_flags; 490830d754dSRandall Stewart uint16_t auth_keyid; 491830d754dSRandall Stewart uint8_t holds_key_ref; 492f8829a4aSRandall Stewart uint8_t msg_is_complete; 493f8829a4aSRandall Stewart uint8_t some_taken; 494f8829a4aSRandall Stewart uint8_t pr_sctp_on; 495478d3f09SRandall Stewart uint8_t sender_all_done; 496f1f73e57SRandall Stewart uint8_t put_last_out; 49749633f4bSRandall Stewart uint8_t discard_rest; 498f8829a4aSRandall Stewart }; 499f8829a4aSRandall Stewart 500f8829a4aSRandall Stewart /* 501f8829a4aSRandall Stewart * this struct contains info that is used to track inbound stream data and 502f8829a4aSRandall Stewart * help with ordering. 503f8829a4aSRandall Stewart */ 504f8829a4aSRandall Stewart TAILQ_HEAD(sctpwheelunrel_listhead, sctp_stream_in); 505f8829a4aSRandall Stewart struct sctp_stream_in { 506f8829a4aSRandall Stewart struct sctp_readhead inqueue; 507f8829a4aSRandall Stewart uint16_t stream_no; 508f8829a4aSRandall Stewart uint16_t last_sequence_delivered; /* used for re-order */ 5099a6142d8SRandall Stewart uint8_t delivery_started; 510f8829a4aSRandall Stewart }; 511f8829a4aSRandall Stewart 512f8829a4aSRandall Stewart TAILQ_HEAD(sctpwheel_listhead, sctp_stream_out); 513f7a77f6fSMichael Tuexen TAILQ_HEAD(sctplist_listhead, sctp_stream_queue_pending); 514f7a77f6fSMichael Tuexen 515f7a77f6fSMichael Tuexen /* Round-robin schedulers */ 516f7a77f6fSMichael Tuexen struct ss_rr { 517f7a77f6fSMichael Tuexen /* next link in wheel */ 518f7a77f6fSMichael Tuexen TAILQ_ENTRY(sctp_stream_out) next_spoke; 519f7a77f6fSMichael Tuexen }; 520f7a77f6fSMichael Tuexen 521f7a77f6fSMichael Tuexen /* Priority scheduler */ 522f7a77f6fSMichael Tuexen struct ss_prio { 523f7a77f6fSMichael Tuexen /* next link in wheel */ 524f7a77f6fSMichael Tuexen TAILQ_ENTRY(sctp_stream_out) next_spoke; 525f7a77f6fSMichael Tuexen /* priority id */ 526f7a77f6fSMichael Tuexen uint16_t priority; 527f7a77f6fSMichael Tuexen }; 528f7a77f6fSMichael Tuexen 529f7a77f6fSMichael Tuexen /* Fair Bandwidth scheduler */ 530f7a77f6fSMichael Tuexen struct ss_fb { 531f7a77f6fSMichael Tuexen /* next link in wheel */ 532f7a77f6fSMichael Tuexen TAILQ_ENTRY(sctp_stream_out) next_spoke; 533f7a77f6fSMichael Tuexen /* stores message size */ 534f7a77f6fSMichael Tuexen int32_t rounds; 535f7a77f6fSMichael Tuexen }; 536f7a77f6fSMichael Tuexen 537f7a77f6fSMichael Tuexen /* 538f7a77f6fSMichael Tuexen * This union holds all data necessary for 539f7a77f6fSMichael Tuexen * different stream schedulers. 540f7a77f6fSMichael Tuexen */ 541f7a77f6fSMichael Tuexen union scheduling_data { 542f7a77f6fSMichael Tuexen struct sctpwheel_listhead out_wheel; 543f7a77f6fSMichael Tuexen struct sctplist_listhead out_list; 544f7a77f6fSMichael Tuexen }; 545f7a77f6fSMichael Tuexen 546f7a77f6fSMichael Tuexen /* 547f7a77f6fSMichael Tuexen * This union holds all parameters per stream 548f7a77f6fSMichael Tuexen * necessary for different stream schedulers. 549f7a77f6fSMichael Tuexen */ 550f7a77f6fSMichael Tuexen union scheduling_parameters { 551f7a77f6fSMichael Tuexen struct ss_rr rr; 552f7a77f6fSMichael Tuexen struct ss_prio prio; 553f7a77f6fSMichael Tuexen struct ss_fb fb; 554f7a77f6fSMichael Tuexen }; 555f7a77f6fSMichael Tuexen 556f7a77f6fSMichael Tuexen /* This struct is used to track the traffic on outbound streams */ 557f8829a4aSRandall Stewart struct sctp_stream_out { 558f8829a4aSRandall Stewart struct sctp_streamhead outqueue; 559f7a77f6fSMichael Tuexen union scheduling_parameters ss_params; 560f8829a4aSRandall Stewart uint16_t stream_no; 561f8829a4aSRandall Stewart uint16_t next_sequence_sent; /* next one I expect to send out */ 562f8829a4aSRandall Stewart uint8_t last_msg_incomplete; 563f8829a4aSRandall Stewart }; 564f8829a4aSRandall Stewart 565f8829a4aSRandall Stewart /* used to keep track of the addresses yet to try to add/delete */ 566f8829a4aSRandall Stewart TAILQ_HEAD(sctp_asconf_addrhead, sctp_asconf_addr); 567f8829a4aSRandall Stewart struct sctp_asconf_addr { 568f8829a4aSRandall Stewart TAILQ_ENTRY(sctp_asconf_addr) next; 569f8829a4aSRandall Stewart struct sctp_asconf_addr_param ap; 57042551e99SRandall Stewart struct sctp_ifa *ifa; /* save the ifa for add/del ip */ 571f8829a4aSRandall Stewart uint8_t sent; /* has this been sent yet? */ 572830d754dSRandall Stewart uint8_t special_del; /* not to be used in lookup */ 573f8829a4aSRandall Stewart }; 574f8829a4aSRandall Stewart 575f8829a4aSRandall Stewart struct sctp_scoping { 576f8829a4aSRandall Stewart uint8_t ipv4_addr_legal; 577f8829a4aSRandall Stewart uint8_t ipv6_addr_legal; 578f8829a4aSRandall Stewart uint8_t loopback_scope; 579f8829a4aSRandall Stewart uint8_t ipv4_local_scope; 580f8829a4aSRandall Stewart uint8_t local_scope; 581f8829a4aSRandall Stewart uint8_t site_scope; 582f8829a4aSRandall Stewart }; 583f8829a4aSRandall Stewart 584f42a358aSRandall Stewart #define SCTP_TSN_LOG_SIZE 40 585f42a358aSRandall Stewart 586f42a358aSRandall Stewart struct sctp_tsn_log { 58718e198d3SRandall Stewart void *stcb; 588f42a358aSRandall Stewart uint32_t tsn; 589f42a358aSRandall Stewart uint16_t strm; 590f42a358aSRandall Stewart uint16_t seq; 591f1f73e57SRandall Stewart uint16_t sz; 592f1f73e57SRandall Stewart uint16_t flgs; 59318e198d3SRandall Stewart uint16_t in_pos; 59418e198d3SRandall Stewart uint16_t in_out; 595f42a358aSRandall Stewart }; 596f42a358aSRandall Stewart 597b54d3a6cSRandall Stewart #define SCTP_FS_SPEC_LOG_SIZE 200 598b54d3a6cSRandall Stewart struct sctp_fs_spec_log { 599b54d3a6cSRandall Stewart uint32_t sent; 600b54d3a6cSRandall Stewart uint32_t total_flight; 601b54d3a6cSRandall Stewart uint32_t tsn; 602b54d3a6cSRandall Stewart uint16_t book; 603b54d3a6cSRandall Stewart uint8_t incr; 604b54d3a6cSRandall Stewart uint8_t decr; 605b54d3a6cSRandall Stewart }; 606d61a0ae0SRandall Stewart 607d61a0ae0SRandall Stewart /* This struct is here to cut out the compatiabilty 608d61a0ae0SRandall Stewart * pad that bulks up both the inp and stcb. The non 609d61a0ae0SRandall Stewart * pad portion MUST stay in complete sync with 610d61a0ae0SRandall Stewart * sctp_sndrcvinfo... i.e. if sinfo_xxxx is added 611d61a0ae0SRandall Stewart * this must be done here too. 612d61a0ae0SRandall Stewart */ 613d61a0ae0SRandall Stewart struct sctp_nonpad_sndrcvinfo { 614d61a0ae0SRandall Stewart uint16_t sinfo_stream; 615d61a0ae0SRandall Stewart uint16_t sinfo_ssn; 616d61a0ae0SRandall Stewart uint16_t sinfo_flags; 617d61a0ae0SRandall Stewart uint32_t sinfo_ppid; 618d61a0ae0SRandall Stewart uint32_t sinfo_context; 619d61a0ae0SRandall Stewart uint32_t sinfo_timetolive; 620d61a0ae0SRandall Stewart uint32_t sinfo_tsn; 621d61a0ae0SRandall Stewart uint32_t sinfo_cumtsn; 622d61a0ae0SRandall Stewart sctp_assoc_t sinfo_assoc_id; 623d61a0ae0SRandall Stewart }; 624d61a0ae0SRandall Stewart 625f8829a4aSRandall Stewart /* 626b54d3a6cSRandall Stewart * JRS - Structure to hold function pointers to the functions responsible 627b54d3a6cSRandall Stewart * for congestion control. 628b54d3a6cSRandall Stewart */ 629b54d3a6cSRandall Stewart 630b54d3a6cSRandall Stewart struct sctp_cc_functions { 631b54d3a6cSRandall Stewart void (*sctp_set_initial_cc_param) (struct sctp_tcb *stcb, struct sctp_nets *net); 632b54d3a6cSRandall Stewart void (*sctp_cwnd_update_after_sack) (struct sctp_tcb *stcb, 633b54d3a6cSRandall Stewart struct sctp_association *asoc, 634b54d3a6cSRandall Stewart int accum_moved, int reneged_all, int will_exit); 635b54d3a6cSRandall Stewart void (*sctp_cwnd_update_after_fr) (struct sctp_tcb *stcb, 636b54d3a6cSRandall Stewart struct sctp_association *asoc); 637b54d3a6cSRandall Stewart void (*sctp_cwnd_update_after_timeout) (struct sctp_tcb *stcb, 638b54d3a6cSRandall Stewart struct sctp_nets *net); 639b54d3a6cSRandall Stewart void (*sctp_cwnd_update_after_ecn_echo) (struct sctp_tcb *stcb, 640493d8e5aSRandall Stewart struct sctp_nets *net, int in_window, int num_pkt_lost); 641b54d3a6cSRandall Stewart void (*sctp_cwnd_update_after_packet_dropped) (struct sctp_tcb *stcb, 642b54d3a6cSRandall Stewart struct sctp_nets *net, struct sctp_pktdrop_chunk *cp, 643b54d3a6cSRandall Stewart uint32_t * bottle_bw, uint32_t * on_queue); 644b54d3a6cSRandall Stewart void (*sctp_cwnd_update_after_output) (struct sctp_tcb *stcb, 645b54d3a6cSRandall Stewart struct sctp_nets *net, int burst_limit); 646b54d3a6cSRandall Stewart void (*sctp_cwnd_update_after_fr_timer) (struct sctp_inpcb *inp, 647b54d3a6cSRandall Stewart struct sctp_tcb *stcb, struct sctp_nets *net); 648b54d3a6cSRandall Stewart }; 649b54d3a6cSRandall Stewart 650f7a77f6fSMichael Tuexen /* 651f7a77f6fSMichael Tuexen * RS - Structure to hold function pointers to the functions responsible 652f7a77f6fSMichael Tuexen * for stream scheduling. 653f7a77f6fSMichael Tuexen */ 654f7a77f6fSMichael Tuexen struct sctp_ss_functions { 655f7a77f6fSMichael Tuexen void (*sctp_ss_init) (struct sctp_tcb *stcb, struct sctp_association *asoc, 656f7a77f6fSMichael Tuexen int holds_lock); 657f7a77f6fSMichael Tuexen void (*sctp_ss_clear) (struct sctp_tcb *stcb, struct sctp_association *asoc, 658f7a77f6fSMichael Tuexen int clear_values, int holds_lock); 659252f7f93SMichael Tuexen void (*sctp_ss_init_stream) (struct sctp_stream_out *strq, struct sctp_stream_out *with_strq); 660f7a77f6fSMichael Tuexen void (*sctp_ss_add_to_stream) (struct sctp_tcb *stcb, struct sctp_association *asoc, 661f7a77f6fSMichael Tuexen struct sctp_stream_out *strq, struct sctp_stream_queue_pending *sp, int holds_lock); 662f7a77f6fSMichael Tuexen int (*sctp_ss_is_empty) (struct sctp_tcb *stcb, struct sctp_association *asoc); 663f7a77f6fSMichael Tuexen void (*sctp_ss_remove_from_stream) (struct sctp_tcb *stcb, struct sctp_association *asoc, 664f7a77f6fSMichael Tuexen struct sctp_stream_out *strq, struct sctp_stream_queue_pending *sp, int holds_lock); 665f7a77f6fSMichael Tuexen struct sctp_stream_out *(*sctp_ss_select_stream) (struct sctp_tcb *stcb, 666f7a77f6fSMichael Tuexen struct sctp_nets *net, struct sctp_association *asoc); 667f7a77f6fSMichael Tuexen void (*sctp_ss_scheduled) (struct sctp_tcb *stcb, struct sctp_nets *net, 668f7a77f6fSMichael Tuexen struct sctp_association *asoc, struct sctp_stream_out *strq, int moved_how_much); 669f7a77f6fSMichael Tuexen void (*sctp_ss_packet_done) (struct sctp_tcb *stcb, struct sctp_nets *net, 670f7a77f6fSMichael Tuexen struct sctp_association *asoc); 671f7a77f6fSMichael Tuexen int (*sctp_ss_get_value) (struct sctp_tcb *stcb, struct sctp_association *asoc, 672f7a77f6fSMichael Tuexen struct sctp_stream_out *strq, uint16_t * value); 673f7a77f6fSMichael Tuexen int (*sctp_ss_set_value) (struct sctp_tcb *stcb, struct sctp_association *asoc, 674f7a77f6fSMichael Tuexen struct sctp_stream_out *strq, uint16_t value); 675f7a77f6fSMichael Tuexen }; 676f7a77f6fSMichael Tuexen 677c54a18d2SRandall Stewart /* used to save ASCONF chunks for retransmission */ 678c54a18d2SRandall Stewart TAILQ_HEAD(sctp_asconf_head, sctp_asconf); 679c54a18d2SRandall Stewart struct sctp_asconf { 680c54a18d2SRandall Stewart TAILQ_ENTRY(sctp_asconf) next; 681c54a18d2SRandall Stewart uint32_t serial_number; 682c54a18d2SRandall Stewart uint16_t snd_count; 683c54a18d2SRandall Stewart struct mbuf *data; 684c54a18d2SRandall Stewart uint16_t len; 685c54a18d2SRandall Stewart }; 686c54a18d2SRandall Stewart 6872afb3e84SRandall Stewart /* used to save ASCONF-ACK chunks for retransmission */ 6882afb3e84SRandall Stewart TAILQ_HEAD(sctp_asconf_ackhead, sctp_asconf_ack); 6892afb3e84SRandall Stewart struct sctp_asconf_ack { 6902afb3e84SRandall Stewart TAILQ_ENTRY(sctp_asconf_ack) next; 6912afb3e84SRandall Stewart uint32_t serial_number; 6922afb3e84SRandall Stewart struct sctp_nets *last_sent_to; 6932afb3e84SRandall Stewart struct mbuf *data; 6942afb3e84SRandall Stewart uint16_t len; 6952afb3e84SRandall Stewart }; 6962afb3e84SRandall Stewart 697b54d3a6cSRandall Stewart /* 698f8829a4aSRandall Stewart * Here we have information about each individual association that we track. 699f8829a4aSRandall Stewart * We probably in production would be more dynamic. But for ease of 700f8829a4aSRandall Stewart * implementation we will have a fixed array that we hunt for in a linear 701f8829a4aSRandall Stewart * fashion. 702f8829a4aSRandall Stewart */ 703f8829a4aSRandall Stewart struct sctp_association { 704f8829a4aSRandall Stewart /* association state */ 705f8829a4aSRandall Stewart int state; 7061b649582SRandall Stewart 707f8829a4aSRandall Stewart /* queue of pending addrs to add/delete */ 708f8829a4aSRandall Stewart struct sctp_asconf_addrhead asconf_queue; 7091b649582SRandall Stewart 710f8829a4aSRandall Stewart struct timeval time_entered; /* time we entered state */ 711f8829a4aSRandall Stewart struct timeval time_last_rcvd; 712f8829a4aSRandall Stewart struct timeval time_last_sent; 713f8829a4aSRandall Stewart struct timeval time_last_sat_advance; 714d61a0ae0SRandall Stewart struct sctp_nonpad_sndrcvinfo def_send; 715f8829a4aSRandall Stewart 716f8829a4aSRandall Stewart /* timers and such */ 717f8829a4aSRandall Stewart struct sctp_timer hb_timer; /* hb timer */ 718f8829a4aSRandall Stewart struct sctp_timer dack_timer; /* Delayed ack timer */ 7191b649582SRandall Stewart struct sctp_timer asconf_timer; /* asconf */ 720f8829a4aSRandall Stewart struct sctp_timer strreset_timer; /* stream reset */ 7211b649582SRandall Stewart struct sctp_timer shut_guard_timer; /* shutdown guard */ 722f8829a4aSRandall Stewart struct sctp_timer autoclose_timer; /* automatic close timer */ 723f8829a4aSRandall Stewart struct sctp_timer delayed_event_timer; /* timer for delayed events */ 724851b7298SRandall Stewart struct sctp_timer delete_prim_timer; /* deleting primary dst */ 725f8829a4aSRandall Stewart 7261b649582SRandall Stewart /* list of restricted local addresses */ 72742551e99SRandall Stewart struct sctpladdr sctp_restricted_addrs; 72842551e99SRandall Stewart 7291b649582SRandall Stewart /* last local address pending deletion (waiting for an address add) */ 7301b649582SRandall Stewart struct sctp_ifa *asconf_addr_del_pending; 731851b7298SRandall Stewart /* Deleted primary destination (used to stop timer) */ 732851b7298SRandall Stewart struct sctp_nets *deleted_primary; 7331b649582SRandall Stewart 7341b649582SRandall Stewart struct sctpnetlisthead nets; /* remote address list */ 735f8829a4aSRandall Stewart 736f8829a4aSRandall Stewart /* Free chunk list */ 737f8829a4aSRandall Stewart struct sctpchunk_listhead free_chunks; 738f8829a4aSRandall Stewart 739f8829a4aSRandall Stewart /* Control chunk queue */ 740f8829a4aSRandall Stewart struct sctpchunk_listhead control_send_queue; 741f8829a4aSRandall Stewart 742c54a18d2SRandall Stewart /* ASCONF chunk queue */ 743c54a18d2SRandall Stewart struct sctpchunk_listhead asconf_send_queue; 744c54a18d2SRandall Stewart 745f8829a4aSRandall Stewart /* 746f8829a4aSRandall Stewart * Once a TSN hits the wire it is moved to the sent_queue. We 747f8829a4aSRandall Stewart * maintain two counts here (don't know if any but retran_cnt is 748f8829a4aSRandall Stewart * needed). The idea is that the sent_queue_retran_cnt reflects how 749f8829a4aSRandall Stewart * many chunks have been marked for retranmission by either T3-rxt 750f8829a4aSRandall Stewart * or FR. 751f8829a4aSRandall Stewart */ 752f8829a4aSRandall Stewart struct sctpchunk_listhead sent_queue; 753f8829a4aSRandall Stewart struct sctpchunk_listhead send_queue; 754f8829a4aSRandall Stewart 755f8829a4aSRandall Stewart /* re-assembly queue for fragmented chunks on the inbound path */ 756f8829a4aSRandall Stewart struct sctpchunk_listhead reasmqueue; 757f8829a4aSRandall Stewart 758252f7f93SMichael Tuexen /* Scheduling queues */ 759f7a77f6fSMichael Tuexen union scheduling_data ss_data; 760f8829a4aSRandall Stewart 761f8829a4aSRandall Stewart /* 762f8829a4aSRandall Stewart * This pointer will be set to NULL most of the time. But when we 763f8829a4aSRandall Stewart * have a fragmented message, where we could not get out all of the 764f8829a4aSRandall Stewart * message at the last send then this will point to the stream to go 765f8829a4aSRandall Stewart * get data from. 766f8829a4aSRandall Stewart */ 767f8829a4aSRandall Stewart struct sctp_stream_out *locked_on_sending; 768f8829a4aSRandall Stewart 769f8829a4aSRandall Stewart /* If an iterator is looking at me, this is it */ 770f8829a4aSRandall Stewart struct sctp_iterator *stcb_starting_point_for_iterator; 771f8829a4aSRandall Stewart 772f8829a4aSRandall Stewart /* ASCONF save the last ASCONF-ACK so we can resend it if necessary */ 7732afb3e84SRandall Stewart struct sctp_asconf_ackhead asconf_ack_sent; 774f8829a4aSRandall Stewart 775f8829a4aSRandall Stewart /* 776f8829a4aSRandall Stewart * pointer to last stream reset queued to control queue by us with 777f8829a4aSRandall Stewart * requests. 778f8829a4aSRandall Stewart */ 779f8829a4aSRandall Stewart struct sctp_tmit_chunk *str_reset; 780f8829a4aSRandall Stewart /* 781f8829a4aSRandall Stewart * if Source Address Selection happening, this will rotate through 782f8829a4aSRandall Stewart * the link list. 783f8829a4aSRandall Stewart */ 784f8829a4aSRandall Stewart struct sctp_laddr *last_used_address; 785f8829a4aSRandall Stewart 786f8829a4aSRandall Stewart /* stream arrays */ 787f8829a4aSRandall Stewart struct sctp_stream_in *strmin; 788f8829a4aSRandall Stewart struct sctp_stream_out *strmout; 789f8829a4aSRandall Stewart uint8_t *mapping_array; 790f8829a4aSRandall Stewart /* primary destination to use */ 791f8829a4aSRandall Stewart struct sctp_nets *primary_destination; 792f8829a4aSRandall Stewart /* For CMT */ 7938933fa13SRandall Stewart struct sctp_nets *last_net_cmt_send_started; 794f8829a4aSRandall Stewart /* last place I got a data chunk from */ 795f8829a4aSRandall Stewart struct sctp_nets *last_data_chunk_from; 796f8829a4aSRandall Stewart /* last place I got a control from */ 797f8829a4aSRandall Stewart struct sctp_nets *last_control_chunk_from; 798f8829a4aSRandall Stewart 799f8829a4aSRandall Stewart /* circular looking for output selection */ 800f8829a4aSRandall Stewart struct sctp_stream_out *last_out_stream; 801f8829a4aSRandall Stewart 802f8829a4aSRandall Stewart /* 803f8829a4aSRandall Stewart * wait to the point the cum-ack passes req->send_reset_at_tsn for 804f8829a4aSRandall Stewart * any req on the list. 805f8829a4aSRandall Stewart */ 806f8829a4aSRandall Stewart struct sctp_resethead resetHead; 807f8829a4aSRandall Stewart 808f8829a4aSRandall Stewart /* queue of chunks waiting to be sent into the local stack */ 809f8829a4aSRandall Stewart struct sctp_readhead pending_reply_queue; 810f8829a4aSRandall Stewart 811b54d3a6cSRandall Stewart /* JRS - the congestion control functions are in this struct */ 812b54d3a6cSRandall Stewart struct sctp_cc_functions cc_functions; 813b54d3a6cSRandall Stewart /* 814b54d3a6cSRandall Stewart * JRS - value to store the currently loaded congestion control 815b54d3a6cSRandall Stewart * module 816b54d3a6cSRandall Stewart */ 817b54d3a6cSRandall Stewart uint32_t congestion_control_module; 818f7a77f6fSMichael Tuexen /* RS - the stream scheduling functions are in this struct */ 819f7a77f6fSMichael Tuexen struct sctp_ss_functions ss_functions; 820f7a77f6fSMichael Tuexen /* RS - value to store the currently loaded stream scheduling module */ 821f7a77f6fSMichael Tuexen uint32_t stream_scheduling_module; 822b54d3a6cSRandall Stewart 82342551e99SRandall Stewart uint32_t vrf_id; 82442551e99SRandall Stewart 825f8829a4aSRandall Stewart uint32_t cookie_preserve_req; 826f8829a4aSRandall Stewart /* ASCONF next seq I am sending out, inits at init-tsn */ 827f8829a4aSRandall Stewart uint32_t asconf_seq_out; 828c54a18d2SRandall Stewart uint32_t asconf_seq_out_acked; 829f8829a4aSRandall Stewart /* ASCONF last received ASCONF from peer, starts at peer's TSN-1 */ 830f8829a4aSRandall Stewart uint32_t asconf_seq_in; 831f8829a4aSRandall Stewart 832f8829a4aSRandall Stewart /* next seq I am sending in str reset messages */ 833f8829a4aSRandall Stewart uint32_t str_reset_seq_out; 834f8829a4aSRandall Stewart /* next seq I am expecting in str reset messages */ 835f8829a4aSRandall Stewart uint32_t str_reset_seq_in; 836f8829a4aSRandall Stewart 837f8829a4aSRandall Stewart /* various verification tag information */ 838f8829a4aSRandall Stewart uint32_t my_vtag; /* The tag to be used. if assoc is re-initited 839f8829a4aSRandall Stewart * by remote end, and I have unlocked this 840f8829a4aSRandall Stewart * will be regenerated to a new random value. */ 841f8829a4aSRandall Stewart uint32_t peer_vtag; /* The peers last tag */ 842f8829a4aSRandall Stewart 843f8829a4aSRandall Stewart uint32_t my_vtag_nonce; 844f8829a4aSRandall Stewart uint32_t peer_vtag_nonce; 845f8829a4aSRandall Stewart 846f8829a4aSRandall Stewart uint32_t assoc_id; 847f8829a4aSRandall Stewart 848f8829a4aSRandall Stewart /* This is the SCTP fragmentation threshold */ 849f8829a4aSRandall Stewart uint32_t smallest_mtu; 850f8829a4aSRandall Stewart 851f8829a4aSRandall Stewart /* 852f8829a4aSRandall Stewart * Special hook for Fast retransmit, allows us to track the highest 853f8829a4aSRandall Stewart * TSN that is NEW in this SACK if gap ack blocks are present. 854f8829a4aSRandall Stewart */ 855f8829a4aSRandall Stewart uint32_t this_sack_highest_gap; 856f8829a4aSRandall Stewart 857f8829a4aSRandall Stewart /* 858f8829a4aSRandall Stewart * The highest consecutive TSN that has been acked by peer on my 859f8829a4aSRandall Stewart * sends 860f8829a4aSRandall Stewart */ 861f8829a4aSRandall Stewart uint32_t last_acked_seq; 862f8829a4aSRandall Stewart 863f8829a4aSRandall Stewart /* The next TSN that I will use in sending. */ 864f8829a4aSRandall Stewart uint32_t sending_seq; 865f8829a4aSRandall Stewart 866f8829a4aSRandall Stewart /* Original seq number I used ??questionable to keep?? */ 867f8829a4aSRandall Stewart uint32_t init_seq_number; 868f8829a4aSRandall Stewart 869f8829a4aSRandall Stewart 870f8829a4aSRandall Stewart /* The Advanced Peer Ack Point, as required by the PR-SCTP */ 871f8829a4aSRandall Stewart /* (A1 in Section 4.2) */ 872f8829a4aSRandall Stewart uint32_t advanced_peer_ack_point; 873f8829a4aSRandall Stewart 874f8829a4aSRandall Stewart /* 875f8829a4aSRandall Stewart * The highest consequetive TSN at the bottom of the mapping array 876f8829a4aSRandall Stewart * (for his sends). 877f8829a4aSRandall Stewart */ 878f8829a4aSRandall Stewart uint32_t cumulative_tsn; 879f8829a4aSRandall Stewart /* 880f8829a4aSRandall Stewart * Used to track the mapping array and its offset bits. This MAY be 881f8829a4aSRandall Stewart * lower then cumulative_tsn. 882f8829a4aSRandall Stewart */ 883f8829a4aSRandall Stewart uint32_t mapping_array_base_tsn; 884f8829a4aSRandall Stewart /* 885f8829a4aSRandall Stewart * used to track highest TSN we have received and is listed in the 886f8829a4aSRandall Stewart * mapping array. 887f8829a4aSRandall Stewart */ 888f8829a4aSRandall Stewart uint32_t highest_tsn_inside_map; 889f8829a4aSRandall Stewart 890830d754dSRandall Stewart /* EY - new NR variables used for nr_sack based on mapping_array */ 891830d754dSRandall Stewart uint8_t *nr_mapping_array; 892830d754dSRandall Stewart uint32_t highest_tsn_inside_nr_map; 893830d754dSRandall Stewart 894f8829a4aSRandall Stewart uint32_t fast_recovery_tsn; 895f8829a4aSRandall Stewart uint32_t sat_t3_recovery_tsn; 896f8829a4aSRandall Stewart uint32_t tsn_last_delivered; 897f8829a4aSRandall Stewart /* 898f8829a4aSRandall Stewart * For the pd-api we should re-write this a bit more efficent. We 899f8829a4aSRandall Stewart * could have multiple sctp_queued_to_read's that we are building at 900f8829a4aSRandall Stewart * once. Now we only do this when we get ready to deliver to the 901f8829a4aSRandall Stewart * socket buffer. Note that we depend on the fact that the struct is 902f8829a4aSRandall Stewart * "stuck" on the read queue until we finish all the pd-api. 903f8829a4aSRandall Stewart */ 904f8829a4aSRandall Stewart struct sctp_queued_to_read *control_pdapi; 905f8829a4aSRandall Stewart 906f8829a4aSRandall Stewart uint32_t tsn_of_pdapi_last_delivered; 907f8829a4aSRandall Stewart uint32_t pdapi_ppid; 908f8829a4aSRandall Stewart uint32_t context; 909f8829a4aSRandall Stewart uint32_t last_reset_action[SCTP_MAX_RESET_PARAMS]; 910f8829a4aSRandall Stewart uint32_t last_sending_seq[SCTP_MAX_RESET_PARAMS]; 911f8829a4aSRandall Stewart uint32_t last_base_tsnsent[SCTP_MAX_RESET_PARAMS]; 912f42a358aSRandall Stewart #ifdef SCTP_ASOCLOG_OF_TSNS 913f42a358aSRandall Stewart /* 914f42a358aSRandall Stewart * special log - This adds considerable size to the asoc, but 915f42a358aSRandall Stewart * provides a log that you can use to detect problems via kgdb. 916f42a358aSRandall Stewart */ 917f42a358aSRandall Stewart struct sctp_tsn_log in_tsnlog[SCTP_TSN_LOG_SIZE]; 918f42a358aSRandall Stewart struct sctp_tsn_log out_tsnlog[SCTP_TSN_LOG_SIZE]; 91918e198d3SRandall Stewart uint32_t cumack_log[SCTP_TSN_LOG_SIZE]; 920b201f536SRandall Stewart uint32_t cumack_logsnt[SCTP_TSN_LOG_SIZE]; 921f42a358aSRandall Stewart uint16_t tsn_in_at; 922f42a358aSRandall Stewart uint16_t tsn_out_at; 923f1f73e57SRandall Stewart uint16_t tsn_in_wrapped; 924f1f73e57SRandall Stewart uint16_t tsn_out_wrapped; 92518e198d3SRandall Stewart uint16_t cumack_log_at; 926b201f536SRandall Stewart uint16_t cumack_log_atsnt; 927f42a358aSRandall Stewart #endif /* SCTP_ASOCLOG_OF_TSNS */ 928b54d3a6cSRandall Stewart #ifdef SCTP_FS_SPEC_LOG 929b54d3a6cSRandall Stewart struct sctp_fs_spec_log fslog[SCTP_FS_SPEC_LOG_SIZE]; 930b54d3a6cSRandall Stewart uint16_t fs_index; 931b54d3a6cSRandall Stewart #endif 932b54d3a6cSRandall Stewart 933f8829a4aSRandall Stewart /* 934f8829a4aSRandall Stewart * window state information and smallest MTU that I use to bound 935f8829a4aSRandall Stewart * segmentation 936f8829a4aSRandall Stewart */ 937f8829a4aSRandall Stewart uint32_t peers_rwnd; 938f8829a4aSRandall Stewart uint32_t my_rwnd; 939f8829a4aSRandall Stewart uint32_t my_last_reported_rwnd; 940d61a0ae0SRandall Stewart uint32_t sctp_frag_point; 941f8829a4aSRandall Stewart 942f8829a4aSRandall Stewart uint32_t total_output_queue_size; 943f8829a4aSRandall Stewart 944c4739e2fSRandall Stewart uint32_t sb_cc; /* shadow of sb_cc */ 9459f22f500SRandall Stewart uint32_t sb_send_resv; /* amount reserved on a send */ 946c4739e2fSRandall Stewart uint32_t my_rwnd_control_len; /* shadow of sb_mbcnt used for rwnd 947c4739e2fSRandall Stewart * control */ 948f8829a4aSRandall Stewart uint32_t default_flowlabel; 949f8829a4aSRandall Stewart uint32_t pr_sctp_cnt; 950493d8e5aSRandall Stewart int ctrl_queue_cnt; /* could be removed REM - NO IT CAN'T!! RRS */ 951f8829a4aSRandall Stewart /* 952f8829a4aSRandall Stewart * All outbound datagrams queue into this list from the individual 953f8829a4aSRandall Stewart * stream queue. Here they get assigned a TSN and then await 954f8829a4aSRandall Stewart * sending. The stream seq comes when it is first put in the 955f8829a4aSRandall Stewart * individual str queue 956f8829a4aSRandall Stewart */ 957f8829a4aSRandall Stewart unsigned int stream_queue_cnt; 958f8829a4aSRandall Stewart unsigned int send_queue_cnt; 959f8829a4aSRandall Stewart unsigned int sent_queue_cnt; 960f8829a4aSRandall Stewart unsigned int sent_queue_cnt_removeable; 961f8829a4aSRandall Stewart /* 962f8829a4aSRandall Stewart * Number on sent queue that are marked for retran until this value 963f8829a4aSRandall Stewart * is 0 we only send one packet of retran'ed data. 964f8829a4aSRandall Stewart */ 965f8829a4aSRandall Stewart unsigned int sent_queue_retran_cnt; 966f8829a4aSRandall Stewart 967f8829a4aSRandall Stewart unsigned int size_on_reasm_queue; 968f8829a4aSRandall Stewart unsigned int cnt_on_reasm_queue; 96944fbe462SRandall Stewart unsigned int fwd_tsn_cnt; 970f8829a4aSRandall Stewart /* amount of data (bytes) currently in flight (on all destinations) */ 971f8829a4aSRandall Stewart unsigned int total_flight; 972f8829a4aSRandall Stewart /* Total book size in flight */ 973f8829a4aSRandall Stewart unsigned int total_flight_count; /* count of chunks used with 974f8829a4aSRandall Stewart * book total */ 975f8829a4aSRandall Stewart /* count of destinaton nets and list of destination nets */ 976f8829a4aSRandall Stewart unsigned int numnets; 977f8829a4aSRandall Stewart 978f8829a4aSRandall Stewart /* Total error count on this association */ 979f8829a4aSRandall Stewart unsigned int overall_error_count; 980f8829a4aSRandall Stewart 981f8829a4aSRandall Stewart unsigned int cnt_msg_on_sb; 982f8829a4aSRandall Stewart 983f8829a4aSRandall Stewart /* All stream count of chunks for delivery */ 984f8829a4aSRandall Stewart unsigned int size_on_all_streams; 985f8829a4aSRandall Stewart unsigned int cnt_on_all_streams; 986f8829a4aSRandall Stewart 987f8829a4aSRandall Stewart /* Heart Beat delay in ticks */ 988f8829a4aSRandall Stewart unsigned int heart_beat_delay; 989f8829a4aSRandall Stewart 990f8829a4aSRandall Stewart /* autoclose */ 991f8829a4aSRandall Stewart unsigned int sctp_autoclose_ticks; 992f8829a4aSRandall Stewart 993f8829a4aSRandall Stewart /* how many preopen streams we have */ 994f8829a4aSRandall Stewart unsigned int pre_open_streams; 995f8829a4aSRandall Stewart 996f8829a4aSRandall Stewart /* How many streams I support coming into me */ 997f8829a4aSRandall Stewart unsigned int max_inbound_streams; 998f8829a4aSRandall Stewart 999f8829a4aSRandall Stewart /* the cookie life I award for any cookie, in seconds */ 1000f8829a4aSRandall Stewart unsigned int cookie_life; 1001f8829a4aSRandall Stewart /* time to delay acks for */ 1002f8829a4aSRandall Stewart unsigned int delayed_ack; 100342551e99SRandall Stewart unsigned int old_delayed_ack; 100442551e99SRandall Stewart unsigned int sack_freq; 100542551e99SRandall Stewart unsigned int data_pkts_seen; 1006f8829a4aSRandall Stewart 1007f8829a4aSRandall Stewart unsigned int numduptsns; 1008f8829a4aSRandall Stewart int dup_tsns[SCTP_MAX_DUP_TSNS]; 1009f8829a4aSRandall Stewart unsigned int initial_init_rto_max; /* initial RTO for INIT's */ 1010f8829a4aSRandall Stewart unsigned int initial_rto; /* initial send RTO */ 1011f8829a4aSRandall Stewart unsigned int minrto; /* per assoc RTO-MIN */ 1012f8829a4aSRandall Stewart unsigned int maxrto; /* per assoc RTO-MAX */ 1013f8829a4aSRandall Stewart 1014f8829a4aSRandall Stewart /* authentication fields */ 1015f8829a4aSRandall Stewart sctp_auth_chklist_t *local_auth_chunks; 1016f8829a4aSRandall Stewart sctp_auth_chklist_t *peer_auth_chunks; 1017f8829a4aSRandall Stewart sctp_hmaclist_t *local_hmacs; /* local HMACs supported */ 1018f8829a4aSRandall Stewart sctp_hmaclist_t *peer_hmacs; /* peer HMACs supported */ 1019f8829a4aSRandall Stewart struct sctp_keyhead shared_keys; /* assoc's shared keys */ 1020f8829a4aSRandall Stewart sctp_authinfo_t authinfo; /* randoms, cached keys */ 1021f8829a4aSRandall Stewart /* 1022f8829a4aSRandall Stewart * refcnt to block freeing when a sender or receiver is off coping 1023f8829a4aSRandall Stewart * user data in. 1024f8829a4aSRandall Stewart */ 102550cec919SRandall Stewart uint32_t refcnt; 102650cec919SRandall Stewart uint32_t chunks_on_out_queue; /* total chunks floating around, 102750cec919SRandall Stewart * locked by send socket buffer */ 10282afb3e84SRandall Stewart uint32_t peers_adaptation; 102950cec919SRandall Stewart uint16_t peer_hmac_id; /* peer HMAC id to send */ 1030f8829a4aSRandall Stewart 1031f8829a4aSRandall Stewart /* 1032f8829a4aSRandall Stewart * Being that we have no bag to collect stale cookies, and that we 1033f8829a4aSRandall Stewart * really would not want to anyway.. we will count them in this 1034f8829a4aSRandall Stewart * counter. We of course feed them to the pigeons right away (I have 1035f8829a4aSRandall Stewart * always thought of pigeons as flying rats). 1036f8829a4aSRandall Stewart */ 1037f8829a4aSRandall Stewart uint16_t stale_cookie_count; 1038f8829a4aSRandall Stewart 1039f8829a4aSRandall Stewart /* 1040f8829a4aSRandall Stewart * For the partial delivery API, if up, invoked this is what last 1041f8829a4aSRandall Stewart * TSN I delivered 1042f8829a4aSRandall Stewart */ 1043f8829a4aSRandall Stewart uint16_t str_of_pdapi; 1044f8829a4aSRandall Stewart uint16_t ssn_of_pdapi; 1045f8829a4aSRandall Stewart 1046f8829a4aSRandall Stewart /* counts of actual built streams. Allocation may be more however */ 1047f8829a4aSRandall Stewart /* could re-arrange to optimize space here. */ 1048f8829a4aSRandall Stewart uint16_t streamincnt; 1049f8829a4aSRandall Stewart uint16_t streamoutcnt; 1050ea44232bSRandall Stewart uint16_t strm_realoutsize; 1051f8829a4aSRandall Stewart /* my maximum number of retrans of INIT and SEND */ 1052f8829a4aSRandall Stewart /* copied from SCTP but should be individually setable */ 1053f8829a4aSRandall Stewart uint16_t max_init_times; 1054f8829a4aSRandall Stewart uint16_t max_send_times; 1055f8829a4aSRandall Stewart 1056f8829a4aSRandall Stewart uint16_t def_net_failure; 1057f8829a4aSRandall Stewart 1058f8829a4aSRandall Stewart /* 1059f8829a4aSRandall Stewart * lock flag: 0 is ok to send, 1+ (duals as a retran count) is 1060f8829a4aSRandall Stewart * awaiting ACK 1061f8829a4aSRandall Stewart */ 1062f8829a4aSRandall Stewart uint16_t mapping_array_size; 1063f8829a4aSRandall Stewart 1064f8829a4aSRandall Stewart uint16_t last_strm_seq_delivered; 1065f8829a4aSRandall Stewart uint16_t last_strm_no_delivered; 1066f8829a4aSRandall Stewart 1067f8829a4aSRandall Stewart uint16_t last_revoke_count; 1068f8829a4aSRandall Stewart int16_t num_send_timers_up; 1069f8829a4aSRandall Stewart 1070f8829a4aSRandall Stewart uint16_t stream_locked_on; 1071f8829a4aSRandall Stewart uint16_t ecn_echo_cnt_onq; 1072f8829a4aSRandall Stewart 1073f8829a4aSRandall Stewart uint16_t free_chunk_cnt; 1074f8829a4aSRandall Stewart uint8_t stream_locked; 1075f8829a4aSRandall Stewart uint8_t authenticated; /* packet authenticated ok */ 1076f8829a4aSRandall Stewart /* 107742551e99SRandall Stewart * This flag indicates that a SACK need to be sent. Initially this 107842551e99SRandall Stewart * is 1 to send the first sACK immediately. 1079f8829a4aSRandall Stewart */ 108042551e99SRandall Stewart uint8_t send_sack; 1081f8829a4aSRandall Stewart 1082899288aeSRandall Stewart /* max burst of new packets into the network */ 108390fed1d8SMichael Tuexen uint32_t max_burst; 1084899288aeSRandall Stewart /* max burst of fast retransmit packets */ 1085899288aeSRandall Stewart uint32_t fr_max_burst; 1086f8829a4aSRandall Stewart 1087f8829a4aSRandall Stewart uint8_t sat_network; /* RTT is in range of sat net or greater */ 1088f8829a4aSRandall Stewart uint8_t sat_network_lockout; /* lockout code */ 1089f8829a4aSRandall Stewart uint8_t burst_limit_applied; /* Burst limit in effect at last send? */ 1090f8829a4aSRandall Stewart /* flag goes on when we are doing a partial delivery api */ 1091f8829a4aSRandall Stewart uint8_t hb_random_values[4]; 1092f8829a4aSRandall Stewart uint8_t fragmented_delivery_inprogress; 1093f8829a4aSRandall Stewart uint8_t fragment_flags; 1094f8829a4aSRandall Stewart uint8_t last_flags_delivered; 1095f8829a4aSRandall Stewart uint8_t hb_ect_randombit; 1096f8829a4aSRandall Stewart uint8_t hb_random_idx; 1097f8829a4aSRandall Stewart uint8_t hb_is_disabled; /* is the hb disabled? */ 1098f8829a4aSRandall Stewart uint8_t default_tos; 10991b649582SRandall Stewart uint8_t asconf_del_pending; /* asconf delete last addr pending */ 1100f8829a4aSRandall Stewart 1101f8829a4aSRandall Stewart /* 1102f8829a4aSRandall Stewart * This value, plus all other ack'd but above cum-ack is added 1103f8829a4aSRandall Stewart * together to cross check against the bit that we have yet to 1104f8829a4aSRandall Stewart * define (probably in the SACK). When the cum-ack is updated, this 1105f8829a4aSRandall Stewart * sum is updated as well. 1106f8829a4aSRandall Stewart */ 1107493d8e5aSRandall Stewart 1108f8829a4aSRandall Stewart /* Flag to tell if ECN is allowed */ 1109f8829a4aSRandall Stewart uint8_t ecn_allowed; 1110f8829a4aSRandall Stewart 1111f8829a4aSRandall Stewart /* flag to indicate if peer can do asconf */ 1112f8829a4aSRandall Stewart uint8_t peer_supports_asconf; 1113830d754dSRandall Stewart /* EY - flag to indicate if peer can do nr_sack */ 1114830d754dSRandall Stewart uint8_t peer_supports_nr_sack; 1115f8829a4aSRandall Stewart /* pr-sctp support flag */ 1116f8829a4aSRandall Stewart uint8_t peer_supports_prsctp; 1117f8829a4aSRandall Stewart /* peer authentication support flag */ 1118f8829a4aSRandall Stewart uint8_t peer_supports_auth; 1119f8829a4aSRandall Stewart /* stream resets are supported by the peer */ 1120f8829a4aSRandall Stewart uint8_t peer_supports_strreset; 1121f8829a4aSRandall Stewart 1122830d754dSRandall Stewart uint8_t peer_supports_nat; 1123f8829a4aSRandall Stewart /* 1124f8829a4aSRandall Stewart * packet drop's are supported by the peer, we don't really care 1125f8829a4aSRandall Stewart * about this but we bookkeep it anyway. 1126f8829a4aSRandall Stewart */ 1127f8829a4aSRandall Stewart uint8_t peer_supports_pktdrop; 1128f8829a4aSRandall Stewart 1129f8829a4aSRandall Stewart /* Do we allow V6/V4? */ 1130f8829a4aSRandall Stewart uint8_t ipv4_addr_legal; 1131f8829a4aSRandall Stewart uint8_t ipv6_addr_legal; 1132f8829a4aSRandall Stewart /* Address scoping flags */ 1133f8829a4aSRandall Stewart /* scope value for IPv4 */ 1134f8829a4aSRandall Stewart uint8_t ipv4_local_scope; 1135f8829a4aSRandall Stewart /* scope values for IPv6 */ 1136f8829a4aSRandall Stewart uint8_t local_scope; 1137f8829a4aSRandall Stewart uint8_t site_scope; 1138f8829a4aSRandall Stewart /* loopback scope */ 1139f8829a4aSRandall Stewart uint8_t loopback_scope; 1140f8829a4aSRandall Stewart /* flags to handle send alternate net tracking */ 1141f8829a4aSRandall Stewart uint8_t used_alt_onsack; 1142f8829a4aSRandall Stewart uint8_t used_alt_asconfack; 1143f8829a4aSRandall Stewart uint8_t fast_retran_loss_recovery; 1144f8829a4aSRandall Stewart uint8_t sat_t3_loss_recovery; 1145f8829a4aSRandall Stewart uint8_t dropped_special_cnt; 1146f8829a4aSRandall Stewart uint8_t seen_a_sack_this_pkt; 1147f8829a4aSRandall Stewart uint8_t stream_reset_outstanding; 1148f8829a4aSRandall Stewart uint8_t stream_reset_out_is_outstanding; 1149f8829a4aSRandall Stewart uint8_t delayed_connection; 1150f8829a4aSRandall Stewart uint8_t ifp_had_enobuf; 1151f8829a4aSRandall Stewart uint8_t saw_sack_with_frags; 1152d9c5cfeaSMichael Tuexen uint8_t saw_sack_with_nr_frags; 1153830d754dSRandall Stewart uint8_t in_asocid_hash; 1154f8829a4aSRandall Stewart uint8_t assoc_up_sent; 11552afb3e84SRandall Stewart uint8_t adaptation_needed; 11562afb3e84SRandall Stewart uint8_t adaptation_sent; 1157f8829a4aSRandall Stewart /* CMT variables */ 1158f8829a4aSRandall Stewart uint8_t cmt_dac_pkts_rcvd; 1159f8829a4aSRandall Stewart uint8_t sctp_cmt_on_off; 1160f8829a4aSRandall Stewart uint8_t iam_blocking; 116144b7479bSRandall Stewart uint8_t cookie_how[8]; 1162830d754dSRandall Stewart /* EY 05/05/08 - NR_SACK variable */ 1163830d754dSRandall Stewart uint8_t sctp_nr_sack_on_off; 1164b54d3a6cSRandall Stewart /* JRS 5/21/07 - CMT PF variable */ 1165b54d3a6cSRandall Stewart uint8_t sctp_cmt_pf; 1166f8829a4aSRandall Stewart /* 1167f8829a4aSRandall Stewart * The mapping array is used to track out of order sequences above 1168f8829a4aSRandall Stewart * last_acked_seq. 0 indicates packet missing 1 indicates packet 1169f8829a4aSRandall Stewart * rec'd. We slide it up every time we raise last_acked_seq and 0 1170f8829a4aSRandall Stewart * trailing locactions out. If I get a TSN above the array 1171f8829a4aSRandall Stewart * mappingArraySz, I discard the datagram and let retransmit happen. 1172f8829a4aSRandall Stewart */ 1173f42a358aSRandall Stewart uint32_t marked_retrans; 1174f42a358aSRandall Stewart uint32_t timoinit; 1175f42a358aSRandall Stewart uint32_t timodata; 1176f42a358aSRandall Stewart uint32_t timosack; 1177f42a358aSRandall Stewart uint32_t timoshutdown; 1178f42a358aSRandall Stewart uint32_t timoheartbeat; 1179f42a358aSRandall Stewart uint32_t timocookie; 1180f42a358aSRandall Stewart uint32_t timoshutdownack; 1181f42a358aSRandall Stewart struct timeval start_time; 1182f42a358aSRandall Stewart struct timeval discontinuity_time; 1183f8829a4aSRandall Stewart }; 1184f8829a4aSRandall Stewart 1185f8829a4aSRandall Stewart #endif 1186