diff options
Diffstat (limited to 'sys/netinet/sctp_structs.h')
-rw-r--r-- | sys/netinet/sctp_structs.h | 160 |
1 files changed, 127 insertions, 33 deletions
diff --git a/sys/netinet/sctp_structs.h b/sys/netinet/sctp_structs.h index 94d0395..d5cade7 100644 --- a/sys/netinet/sctp_structs.h +++ b/sys/netinet/sctp_structs.h @@ -1,5 +1,7 @@ /*- * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved. + * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -106,6 +108,31 @@ typedef void (*asoc_func) (struct sctp_inpcb *, struct sctp_tcb *, void *ptr, typedef int (*inp_func) (struct sctp_inpcb *, void *ptr, uint32_t val); typedef void (*end_func) (void *ptr, uint32_t val); +#if defined(__FreeBSD__) && defined(SCTP_MCORE_INPUT) && defined(SMP) +/* whats on the mcore control struct */ +struct sctp_mcore_queue { + TAILQ_ENTRY(sctp_mcore_queue) next; + struct vnet *vn; + struct mbuf *m; + int off; + int v6; +}; + +TAILQ_HEAD(sctp_mcore_qhead, sctp_mcore_queue); + +struct sctp_mcore_ctrl { + SCTP_PROCESS_STRUCT thread_proc; + struct sctp_mcore_qhead que; + struct mtx core_mtx; + struct mtx que_mtx; + int running; + int cpuid; +}; + + +#endif + + struct sctp_iterator { TAILQ_ENTRY(sctp_iterator) sctp_nxt_itr; struct vnet *vn; @@ -211,7 +238,10 @@ struct sctp_nets { /* mtu discovered so far */ uint32_t mtu; uint32_t ssthresh; /* not sure about this one for split */ - + uint32_t last_cwr_tsn; + uint32_t cwr_window_tsn; + uint32_t ecn_ce_pkt_cnt; + uint32_t lost_cnt; /* smoothed average things for RTT and RTO itself */ int lastsa; int lastsv; @@ -234,6 +264,8 @@ struct sctp_nets { uint32_t flight_size; uint32_t cwnd; /* actual cwnd */ uint32_t prev_cwnd; /* cwnd before any processing */ + uint32_t ecn_prev_cwnd; /* ECN prev cwnd at first ecn_echo seen in new + * window */ uint32_t partial_bytes_acked; /* in CA tracks when to incr a MTU */ uint32_t prev_rtt; /* tracking variables to avoid the aloc/free in sack processing */ @@ -266,7 +298,7 @@ struct sctp_nets { uint32_t tos_flowlabel; struct timeval start_time; /* time when this net was created */ - + struct timeval last_measured_rtt; uint32_t marked_retrans;/* number or DATA chunks marked for timer * based retransmissions */ uint32_t marked_fastretrans; @@ -315,8 +347,13 @@ struct sctp_nets { uint8_t window_probe; /* Doing a window probe? */ uint8_t RTO_measured; /* Have we done the first measure */ uint8_t last_hs_used; /* index into the last HS table entry we used */ + uint8_t lan_type; /* JRS - struct used in HTCP algorithm */ struct htcp htcp_ca; + uint32_t flowid; +#ifdef INVARIANTS + uint8_t flowidset; +#endif }; @@ -326,10 +363,7 @@ struct sctp_data_chunkrec { uint16_t stream_number; /* the stream number of this guy */ uint32_t payloadtype; uint32_t context; /* from send */ - - /* ECN Nonce: Nonce Value for this chunk */ - uint8_t ect_nonce; - uint8_t fwd_tsn_cnt; + uint32_t cwnd_at_send; /* * part of the Highest sacked algorithm to be able to stroke counts * on ones that are FR'd. @@ -341,6 +375,7 @@ struct sctp_data_chunkrec { * outbound holds sending flags for PR-SCTP. */ uint8_t state_flags; uint8_t chunk_was_revoked; + uint8_t fwd_tsn_cnt; }; TAILQ_HEAD(sctpchunk_listhead, sctp_tmit_chunk); @@ -446,6 +481,7 @@ struct sctp_stream_queue_pending { struct timeval ts; struct sctp_nets *net; TAILQ_ENTRY(sctp_stream_queue_pending) next; + TAILQ_ENTRY(sctp_stream_queue_pending) ss_next; uint32_t length; uint32_t timetolive; uint32_t ppid; @@ -476,11 +512,54 @@ struct sctp_stream_in { uint8_t delivery_started; }; -/* This struct is used to track the traffic on outbound streams */ TAILQ_HEAD(sctpwheel_listhead, sctp_stream_out); +TAILQ_HEAD(sctplist_listhead, sctp_stream_queue_pending); + +/* Round-robin schedulers */ +struct ss_rr { + /* next link in wheel */ + TAILQ_ENTRY(sctp_stream_out) next_spoke; +}; + +/* Priority scheduler */ +struct ss_prio { + /* next link in wheel */ + TAILQ_ENTRY(sctp_stream_out) next_spoke; + /* priority id */ + uint16_t priority; +}; + +/* Fair Bandwidth scheduler */ +struct ss_fb { + /* next link in wheel */ + TAILQ_ENTRY(sctp_stream_out) next_spoke; + /* stores message size */ + int32_t rounds; +}; + +/* + * This union holds all data necessary for + * different stream schedulers. + */ +union scheduling_data { + struct sctpwheel_listhead out_wheel; + struct sctplist_listhead out_list; +}; + +/* + * This union holds all parameters per stream + * necessary for different stream schedulers. + */ +union scheduling_parameters { + struct ss_rr rr; + struct ss_prio prio; + struct ss_fb fb; +}; + +/* This struct is used to track the traffic on outbound streams */ struct sctp_stream_out { struct sctp_streamhead outqueue; - TAILQ_ENTRY(sctp_stream_out) next_spoke; /* next link in wheel */ + union scheduling_parameters ss_params; uint16_t stream_no; uint16_t next_sequence_sent; /* next one I expect to send out */ uint8_t last_msg_incomplete; @@ -561,7 +640,7 @@ struct sctp_cc_functions { void (*sctp_cwnd_update_after_timeout) (struct sctp_tcb *stcb, struct sctp_nets *net); void (*sctp_cwnd_update_after_ecn_echo) (struct sctp_tcb *stcb, - struct sctp_nets *net); + struct sctp_nets *net, int in_window, int num_pkt_lost); void (*sctp_cwnd_update_after_packet_dropped) (struct sctp_tcb *stcb, struct sctp_nets *net, struct sctp_pktdrop_chunk *cp, uint32_t * bottle_bw, uint32_t * on_queue); @@ -571,6 +650,33 @@ struct sctp_cc_functions { struct sctp_tcb *stcb, struct sctp_nets *net); }; +/* + * RS - Structure to hold function pointers to the functions responsible + * for stream scheduling. + */ +struct sctp_ss_functions { + void (*sctp_ss_init) (struct sctp_tcb *stcb, struct sctp_association *asoc, + int holds_lock); + void (*sctp_ss_clear) (struct sctp_tcb *stcb, struct sctp_association *asoc, + int clear_values, int holds_lock); + void (*sctp_ss_init_stream) (struct sctp_stream_out *strq, struct sctp_stream_out *with_strq); + void (*sctp_ss_add_to_stream) (struct sctp_tcb *stcb, struct sctp_association *asoc, + struct sctp_stream_out *strq, struct sctp_stream_queue_pending *sp, int holds_lock); + int (*sctp_ss_is_empty) (struct sctp_tcb *stcb, struct sctp_association *asoc); + void (*sctp_ss_remove_from_stream) (struct sctp_tcb *stcb, struct sctp_association *asoc, + struct sctp_stream_out *strq, struct sctp_stream_queue_pending *sp, int holds_lock); + struct sctp_stream_out *(*sctp_ss_select_stream) (struct sctp_tcb *stcb, + struct sctp_nets *net, struct sctp_association *asoc); + void (*sctp_ss_scheduled) (struct sctp_tcb *stcb, struct sctp_nets *net, + struct sctp_association *asoc, struct sctp_stream_out *strq, int moved_how_much); + void (*sctp_ss_packet_done) (struct sctp_tcb *stcb, struct sctp_nets *net, + struct sctp_association *asoc); + int (*sctp_ss_get_value) (struct sctp_tcb *stcb, struct sctp_association *asoc, + struct sctp_stream_out *strq, uint16_t * value); + int (*sctp_ss_set_value) (struct sctp_tcb *stcb, struct sctp_association *asoc, + struct sctp_stream_out *strq, uint16_t value); +}; + /* used to save ASCONF chunks for retransmission */ TAILQ_HEAD(sctp_asconf_head, sctp_asconf); struct sctp_asconf { @@ -652,13 +758,8 @@ struct sctp_association { /* re-assembly queue for fragmented chunks on the inbound path */ struct sctpchunk_listhead reasmqueue; - /* - * this queue is used when we reach a condition that we can NOT put - * data into the socket buffer. We track the size of this queue and - * set our rwnd to the space in the socket minus also the - * size_on_delivery_queue. - */ - struct sctpwheel_listhead out_wheel; + /* Scheduling queues */ + union scheduling_data ss_data; /* * This pointer will be set to NULL most of the time. But when we @@ -717,6 +818,10 @@ struct sctp_association { * module */ uint32_t congestion_control_module; + /* RS - the stream scheduling functions are in this struct */ + struct sctp_ss_functions ss_functions; + /* RS - value to store the currently loaded stream scheduling module */ + uint32_t stream_scheduling_module; uint32_t vrf_id; @@ -789,8 +894,6 @@ struct sctp_association { uint8_t *nr_mapping_array; uint32_t highest_tsn_inside_nr_map; - uint32_t last_echo_tsn; - uint32_t last_cwr_tsn; uint32_t fast_recovery_tsn; uint32_t sat_t3_recovery_tsn; uint32_t tsn_last_delivered; @@ -845,12 +948,9 @@ struct sctp_association { uint32_t sb_send_resv; /* amount reserved on a send */ uint32_t my_rwnd_control_len; /* shadow of sb_mbcnt used for rwnd * control */ - /* 32 bit nonce stuff */ - uint32_t nonce_resync_tsn; - uint32_t nonce_wait_tsn; uint32_t default_flowlabel; uint32_t pr_sctp_cnt; - int ctrl_queue_cnt; /* could be removed REM */ + int ctrl_queue_cnt; /* could be removed REM - NO IT CAN'T!! RRS */ /* * All outbound datagrams queue into this list from the individual * stream queue. Here they get assigned a TSN and then await @@ -974,7 +1074,6 @@ struct sctp_association { uint16_t ecn_echo_cnt_onq; uint16_t free_chunk_cnt; - uint8_t stream_locked; uint8_t authenticated; /* packet authenticated ok */ /* @@ -983,8 +1082,10 @@ struct sctp_association { */ uint8_t send_sack; - /* max burst after fast retransmit completes */ - uint8_t max_burst; + /* max burst of new packets into the network */ + uint32_t max_burst; + /* max burst of fast retransmit packets */ + uint32_t fr_max_burst; uint8_t sat_network; /* RTT is in range of sat net or greater */ uint8_t sat_network_lockout; /* lockout code */ @@ -1000,20 +1101,13 @@ struct sctp_association { uint8_t default_tos; uint8_t asconf_del_pending; /* asconf delete last addr pending */ - /* ECN Nonce stuff */ - uint8_t receiver_nonce_sum; /* nonce I sum and put in my sack */ - uint8_t ecn_nonce_allowed; /* Tells us if ECN nonce is on */ - uint8_t nonce_sum_check;/* On off switch used during re-sync */ - uint8_t nonce_wait_for_ecne; /* flag when we expect a ECN */ - uint8_t peer_supports_ecn_nonce; - /* * This value, plus all other ack'd but above cum-ack is added * together to cross check against the bit that we have yet to * define (probably in the SACK). When the cum-ack is updated, this * sum is updated as well. */ - uint8_t nonce_sum_expect_base; + /* Flag to tell if ECN is allowed */ uint8_t ecn_allowed; |