xref: /freebsd/sys/netinet/tcp_stacks/tcp_rack.h (revision 4f3addd94be5e02e6e425f6119f5409972ab5d14)
189e560f4SRandall Stewart /*-
2963fb2adSRandall Stewart  * Copyright (c) 2016-2020 Netflix, Inc.
389e560f4SRandall Stewart  *
489e560f4SRandall Stewart  * Redistribution and use in source and binary forms, with or without
589e560f4SRandall Stewart  * modification, are permitted provided that the following conditions
689e560f4SRandall Stewart  * are met:
789e560f4SRandall Stewart  * 1. Redistributions of source code must retain the above copyright
889e560f4SRandall Stewart  *    notice, this list of conditions and the following disclaimer.
989e560f4SRandall Stewart  * 2. Redistributions in binary form must reproduce the above copyright
1089e560f4SRandall Stewart  *    notice, this list of conditions and the following disclaimer in the
1189e560f4SRandall Stewart  *    documentation and/or other materials provided with the distribution.
1289e560f4SRandall Stewart  *
1389e560f4SRandall Stewart  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1489e560f4SRandall Stewart  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1589e560f4SRandall Stewart  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1689e560f4SRandall Stewart  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1789e560f4SRandall Stewart  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1889e560f4SRandall Stewart  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1989e560f4SRandall Stewart  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2089e560f4SRandall Stewart  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2189e560f4SRandall Stewart  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2289e560f4SRandall Stewart  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2389e560f4SRandall Stewart  * SUCH DAMAGE.
2489e560f4SRandall Stewart  *
2589e560f4SRandall Stewart  * $FreeBSD$
2689e560f4SRandall Stewart  */
2789e560f4SRandall Stewart 
2889e560f4SRandall Stewart #ifndef _NETINET_TCP_RACK_H_
2989e560f4SRandall Stewart #define _NETINET_TCP_RACK_H_
3089e560f4SRandall Stewart 
3189e560f4SRandall Stewart #define RACK_ACKED	    0x0001/* The remote endpoint acked this */
325d8fd932SRandall Stewart #define RACK_TO_REXT	    0x0002/* A timeout occured on this sendmap entry */
3335c7bb34SRandall Stewart #define RACK_DEFERRED	    0x0004/* We can't use this for RTT calc - not used */
3489e560f4SRandall Stewart #define RACK_OVERMAX	    0x0008/* We have more retran's then we can fit */
3589e560f4SRandall Stewart #define RACK_SACK_PASSED    0x0010/* A sack was done above this block */
3689e560f4SRandall Stewart #define RACK_WAS_SACKPASS   0x0020/* We retransmitted due to SACK pass */
3789e560f4SRandall Stewart #define RACK_HAS_FIN	    0x0040/* segment is sent with fin */
3889e560f4SRandall Stewart #define RACK_TLP	    0x0080/* segment sent as tail-loss-probe */
3935c7bb34SRandall Stewart #define RACK_RWND_COLLAPSED 0x0100/* The peer collapsed the rwnd on the segment */
40963fb2adSRandall Stewart #define RACK_APP_LIMITED    0x0200/* We went app limited after this send */
41963fb2adSRandall Stewart #define RACK_WAS_ACKED	    0x0400/* a RTO undid the ack, but it already had a rtt calc done */
425d8fd932SRandall Stewart #define RACK_HAS_SYN	    0x0800/* SYN is on this guy */
435d8fd932SRandall Stewart #define RACK_SENT_W_DSACK   0x1000/* Sent with a dsack */
445d8fd932SRandall Stewart #define RACK_SENT_SP	    0x2000/* sent in slow path */
455d8fd932SRandall Stewart #define RACK_SENT_FP        0x4000/* sent in fast path */
465d8fd932SRandall Stewart #define RACK_HAD_PUSH	    0x8000/* Push was sent on original send */
4789e560f4SRandall Stewart #define RACK_NUM_OF_RETRANS 3
4889e560f4SRandall Stewart 
495d8fd932SRandall Stewart #define RACK_INITIAL_RTO 1000000 /* 1 second in microseconds */
5089e560f4SRandall Stewart 
515d8fd932SRandall Stewart #define RACK_REQ_AVG 3 	/* Must be less than 256 */
52963fb2adSRandall Stewart 
5389e560f4SRandall Stewart struct rack_sendmap {
545d8fd932SRandall Stewart 	TAILQ_ENTRY(rack_sendmap) r_tnext;	/* Time of transmit based next */
5589e560f4SRandall Stewart 	uint32_t r_start;	/* Sequence number of the segment */
5689e560f4SRandall Stewart 	uint32_t r_end;		/* End seq, this is 1 beyond actually */
5789e560f4SRandall Stewart 	uint32_t r_rtr_bytes;	/* How many bytes have been retransmitted */
5889e560f4SRandall Stewart 	uint16_t r_rtr_cnt;	/* Retran count, index this -1 to get time
5989e560f4SRandall Stewart 				 * sent */
6035c7bb34SRandall Stewart 	uint16_t r_flags;	/* Flags as defined above */
615d8fd932SRandall Stewart 	struct mbuf *m;
625d8fd932SRandall Stewart 	uint32_t soff;
635d8fd932SRandall Stewart 	uint32_t orig_m_len;
64963fb2adSRandall Stewart 	uint32_t r_nseq_appl;	/* If this one is app limited, this is the nxt seq limited */
6535c7bb34SRandall Stewart 	uint8_t r_dupack;	/* Dup ack count */
6689e560f4SRandall Stewart 	uint8_t r_in_tmap;	/* Flag to see if its in the r_tnext array */
675e02b277SJonathan T. Looney 	uint8_t r_limit_type;	/* is this entry counted against a limit? */
68963fb2adSRandall Stewart 	uint8_t r_just_ret : 1, /* After sending, the next pkt was just returned, i.e. limited  */
69963fb2adSRandall Stewart 		r_one_out_nr : 1,	/* Special case 1 outstanding and not in recovery */
705d8fd932SRandall Stewart 		r_no_rtt_allowed : 1, /* No rtt measurement allowed */
715d8fd932SRandall Stewart 		r_avail : 5;
725d8fd932SRandall Stewart 	uint64_t r_tim_lastsent[RACK_NUM_OF_RETRANS];
735d8fd932SRandall Stewart 	uint64_t r_ack_arrival;	/* This is the time of ack-arrival (if SACK'd) */
745d8fd932SRandall Stewart 	RB_ENTRY(rack_sendmap) r_next;		/* RB Tree next */
7589e560f4SRandall Stewart };
7689e560f4SRandall Stewart 
775d8fd932SRandall Stewart struct deferred_opt_list {
785d8fd932SRandall Stewart 	TAILQ_ENTRY(deferred_opt_list) next;
795d8fd932SRandall Stewart 	int optname;
805d8fd932SRandall Stewart 	uint64_t optval;
815d8fd932SRandall Stewart };
825d8fd932SRandall Stewart 
835d8fd932SRandall Stewart /*
845d8fd932SRandall Stewart  * Timestamps in the rack sendmap are now moving to be
855d8fd932SRandall Stewart  * uint64_t's. This means that if you want a uint32_t
865d8fd932SRandall Stewart  * usec timestamp (the old usecond timestamp) you simply have
875d8fd932SRandall Stewart  * to cast it to uint32_t. The reason we do this is not for
885d8fd932SRandall Stewart  * wrap, but we need to get back, at times, to the millisecond
895d8fd932SRandall Stewart  * timestamp that is used in the TSTMP option. To do this we
905d8fd932SRandall Stewart  * can use the rack_ts_to_msec() inline below which can take
915d8fd932SRandall Stewart  * the 64bit ts and make into the correct timestamp millisecond
925d8fd932SRandall Stewart  * wise. Thats not possible with the 32bit usecond timestamp since
935d8fd932SRandall Stewart  * the seconds wrap too quickly to cover all bases.
945d8fd932SRandall Stewart  *
955d8fd932SRandall Stewart  * There are quite a few places in rack where I simply cast
965d8fd932SRandall Stewart  * back to uint32_t and then end up using the TSTMP_XX()
975d8fd932SRandall Stewart  * macros. This is ok, but we could do simple compares if
985d8fd932SRandall Stewart  * we ever decided to move all of those variables to 64 bits
995d8fd932SRandall Stewart  * as well.
1005d8fd932SRandall Stewart  */
1015d8fd932SRandall Stewart 
1025d8fd932SRandall Stewart inline uint64_t
1035d8fd932SRandall Stewart rack_to_usec_ts(struct timeval *tv)
1045d8fd932SRandall Stewart {
1055d8fd932SRandall Stewart 	return ((tv->tv_sec * HPTS_USEC_IN_SEC) + tv->tv_usec);
1065d8fd932SRandall Stewart }
1075d8fd932SRandall Stewart 
1085d8fd932SRandall Stewart inline uint32_t
1095d8fd932SRandall Stewart rack_ts_to_msec(uint64_t ts)
1105d8fd932SRandall Stewart {
1115d8fd932SRandall Stewart 	return((uint32_t)(ts / HPTS_MSEC_IN_SEC));
1125d8fd932SRandall Stewart }
1135d8fd932SRandall Stewart 
1145d8fd932SRandall Stewart 
11535c7bb34SRandall Stewart RB_HEAD(rack_rb_tree_head, rack_sendmap);
11689e560f4SRandall Stewart TAILQ_HEAD(rack_head, rack_sendmap);
1175d8fd932SRandall Stewart TAILQ_HEAD(def_opt_head, deferred_opt_list);
1185d8fd932SRandall Stewart 
1195d8fd932SRandall Stewart /* Map change logging */
1205d8fd932SRandall Stewart #define MAP_MERGE	0x01
1215d8fd932SRandall Stewart #define MAP_SPLIT	0x02
1225d8fd932SRandall Stewart #define MAP_NEW		0x03
1235d8fd932SRandall Stewart #define MAP_SACK_M1	0x04
1245d8fd932SRandall Stewart #define MAP_SACK_M2	0x05
1255d8fd932SRandall Stewart #define MAP_SACK_M3	0x06
1265d8fd932SRandall Stewart #define MAP_SACK_M4	0x07
1275d8fd932SRandall Stewart #define MAP_SACK_M5	0x08
1285d8fd932SRandall Stewart #define MAP_FREE	0x09
1295d8fd932SRandall Stewart #define MAP_TRIM_HEAD	0x0a
13089e560f4SRandall Stewart 
13135c7bb34SRandall Stewart #define RACK_LIMIT_TYPE_SPLIT	1
13289e560f4SRandall Stewart 
13389e560f4SRandall Stewart /*
13489e560f4SRandall Stewart  * We use the rate sample structure to
13589e560f4SRandall Stewart  * assist in single sack/ack rate and rtt
13689e560f4SRandall Stewart  * calculation. In the future we will expand
13789e560f4SRandall Stewart  * this in BBR to do forward rate sample
13889e560f4SRandall Stewart  * b/w estimation.
13989e560f4SRandall Stewart  */
14089e560f4SRandall Stewart #define RACK_RTT_EMPTY 0x00000001	/* Nothing yet stored in RTT's */
14189e560f4SRandall Stewart #define RACK_RTT_VALID 0x00000002	/* We have at least one valid RTT */
14289e560f4SRandall Stewart struct rack_rtt_sample {
14389e560f4SRandall Stewart 	uint32_t rs_flags;
14489e560f4SRandall Stewart 	uint32_t rs_rtt_lowest;
14589e560f4SRandall Stewart 	uint32_t rs_rtt_highest;
14689e560f4SRandall Stewart 	uint32_t rs_rtt_cnt;
147963fb2adSRandall Stewart 	uint32_t rs_us_rtt;
148963fb2adSRandall Stewart 	int32_t  confidence;
14989e560f4SRandall Stewart 	uint64_t rs_rtt_tot;
150963fb2adSRandall Stewart 	uint16_t rs_us_rtrcnt;
15189e560f4SRandall Stewart };
15289e560f4SRandall Stewart 
15389e560f4SRandall Stewart #define RACK_LOG_TYPE_ACK	0x01
15489e560f4SRandall Stewart #define RACK_LOG_TYPE_OUT	0x02
15589e560f4SRandall Stewart #define RACK_LOG_TYPE_TO	0x03
15689e560f4SRandall Stewart #define RACK_LOG_TYPE_ALLOC     0x04
15789e560f4SRandall Stewart #define RACK_LOG_TYPE_FREE      0x05
15889e560f4SRandall Stewart 
15989e560f4SRandall Stewart struct rack_log {
16089e560f4SRandall Stewart 	union {
16189e560f4SRandall Stewart 		struct rack_sendmap *rsm;	/* For alloc/free */
16289e560f4SRandall Stewart 		uint64_t sb_acc;/* For out/ack or t-o */
16389e560f4SRandall Stewart 	};
16489e560f4SRandall Stewart 	uint32_t th_seq;
16589e560f4SRandall Stewart 	uint32_t th_ack;
16689e560f4SRandall Stewart 	uint32_t snd_una;
16789e560f4SRandall Stewart 	uint32_t snd_nxt;	/* th_win for TYPE_ACK */
16889e560f4SRandall Stewart 	uint32_t snd_max;
16989e560f4SRandall Stewart 	uint32_t blk_start[4];
17089e560f4SRandall Stewart 	uint32_t blk_end[4];
17189e560f4SRandall Stewart 	uint8_t type;
17289e560f4SRandall Stewart 	uint8_t n_sackblks;
17389e560f4SRandall Stewart 	uint16_t len;		/* Timeout T3=1, TLP=2, RACK=3 */
17489e560f4SRandall Stewart };
17589e560f4SRandall Stewart 
17689e560f4SRandall Stewart /*
17789e560f4SRandall Stewart  * Magic numbers for logging timeout events if the
17889e560f4SRandall Stewart  * logging is enabled.
17989e560f4SRandall Stewart  */
18089e560f4SRandall Stewart #define RACK_TO_FRM_TMR  1
18189e560f4SRandall Stewart #define RACK_TO_FRM_TLP  2
18289e560f4SRandall Stewart #define RACK_TO_FRM_RACK 3
18389e560f4SRandall Stewart #define RACK_TO_FRM_KEEP 4
18489e560f4SRandall Stewart #define RACK_TO_FRM_PERSIST 5
18589e560f4SRandall Stewart #define RACK_TO_FRM_DELACK 6
18689e560f4SRandall Stewart 
18789e560f4SRandall Stewart struct rack_opts_stats {
18889e560f4SRandall Stewart 	uint64_t tcp_rack_tlp_reduce;
18989e560f4SRandall Stewart 	uint64_t tcp_rack_pace_always;
19089e560f4SRandall Stewart 	uint64_t tcp_rack_pace_reduce;
19189e560f4SRandall Stewart 	uint64_t tcp_rack_max_seg;
19289e560f4SRandall Stewart 	uint64_t tcp_rack_prr_sendalot;
19389e560f4SRandall Stewart 	uint64_t tcp_rack_min_to;
19489e560f4SRandall Stewart 	uint64_t tcp_rack_early_seg;
19589e560f4SRandall Stewart 	uint64_t tcp_rack_reord_thresh;
19689e560f4SRandall Stewart 	uint64_t tcp_rack_reord_fade;
19789e560f4SRandall Stewart 	uint64_t tcp_rack_tlp_thresh;
19889e560f4SRandall Stewart 	uint64_t tcp_rack_pkt_delay;
19989e560f4SRandall Stewart 	uint64_t tcp_rack_tlp_inc_var;
20089e560f4SRandall Stewart 	uint64_t tcp_tlp_use;
20189e560f4SRandall Stewart 	uint64_t tcp_rack_idle_reduce;
20289e560f4SRandall Stewart 	uint64_t tcp_rack_idle_reduce_high;
20389e560f4SRandall Stewart 	uint64_t rack_no_timer_in_hpts;
20489e560f4SRandall Stewart 	uint64_t tcp_rack_min_pace_seg;
205963fb2adSRandall Stewart 	uint64_t tcp_rack_pace_rate_ca;
206963fb2adSRandall Stewart 	uint64_t tcp_rack_rr;
2071cf55767SRandall Stewart 	uint64_t tcp_rack_do_detection;
208963fb2adSRandall Stewart 	uint64_t tcp_rack_rrr_no_conf_rate;
209963fb2adSRandall Stewart 	uint64_t tcp_initial_rate;
210963fb2adSRandall Stewart 	uint64_t tcp_initial_win;
211963fb2adSRandall Stewart 	uint64_t tcp_hdwr_pacing;
212963fb2adSRandall Stewart 	uint64_t tcp_gp_inc_ss;
213963fb2adSRandall Stewart 	uint64_t tcp_gp_inc_ca;
214963fb2adSRandall Stewart 	uint64_t tcp_gp_inc_rec;
215963fb2adSRandall Stewart 	uint64_t tcp_rack_force_max_seg;
216963fb2adSRandall Stewart 	uint64_t tcp_rack_pace_rate_ss;
217963fb2adSRandall Stewart 	uint64_t tcp_rack_pace_rate_rec;
218963fb2adSRandall Stewart 	/* Temp counters for dsack */
219963fb2adSRandall Stewart 	uint64_t tcp_sack_path_1;
220963fb2adSRandall Stewart 	uint64_t tcp_sack_path_2a;
221963fb2adSRandall Stewart 	uint64_t tcp_sack_path_2b;
222963fb2adSRandall Stewart 	uint64_t tcp_sack_path_3;
223963fb2adSRandall Stewart 	uint64_t tcp_sack_path_4;
224963fb2adSRandall Stewart 	/* non temp counters */
225963fb2adSRandall Stewart 	uint64_t tcp_rack_scwnd;
226963fb2adSRandall Stewart 	uint64_t tcp_rack_noprr;
227963fb2adSRandall Stewart 	uint64_t tcp_rack_cfg_rate;
228963fb2adSRandall Stewart 	uint64_t tcp_timely_dyn;
229963fb2adSRandall Stewart 	uint64_t tcp_rack_mbufq;
230963fb2adSRandall Stewart 	uint64_t tcp_fillcw;
231963fb2adSRandall Stewart 	uint64_t tcp_npush;
232963fb2adSRandall Stewart 	uint64_t tcp_lscwnd;
233963fb2adSRandall Stewart 	uint64_t tcp_profile;
2345d8fd932SRandall Stewart 	uint64_t tcp_hdwr_rate_cap;
2355d8fd932SRandall Stewart 	uint64_t tcp_pacing_rate_cap;
2365d8fd932SRandall Stewart 	uint64_t tcp_pacing_up_only;
2375d8fd932SRandall Stewart 	uint64_t tcp_use_cmp_acks;
2385d8fd932SRandall Stewart 	uint64_t tcp_rack_abc_val;
2395d8fd932SRandall Stewart 	uint64_t tcp_rec_abc_val;
2405d8fd932SRandall Stewart 	uint64_t tcp_rack_measure_cnt;
2415d8fd932SRandall Stewart 	uint64_t tcp_rack_delayed_ack;
2425d8fd932SRandall Stewart 	uint64_t tcp_rack_rtt_use;
2435d8fd932SRandall Stewart 	uint64_t tcp_data_after_close;
2445d8fd932SRandall Stewart 	uint64_t tcp_defer_opt;
2455d8fd932SRandall Stewart 	uint64_t tcp_rack_fastrsm_hack;
2465d8fd932SRandall Stewart 	uint64_t tcp_rack_beta;
2475d8fd932SRandall Stewart 	uint64_t tcp_rack_beta_ecn;
248*4f3addd9SRandall Stewart 	uint64_t tcp_rack_timer_slop;
24989e560f4SRandall Stewart };
25089e560f4SRandall Stewart 
251963fb2adSRandall Stewart /* RTT shrink reasons */
252963fb2adSRandall Stewart #define RACK_RTTS_INIT     0
253963fb2adSRandall Stewart #define RACK_RTTS_NEWRTT   1
254963fb2adSRandall Stewart #define RACK_RTTS_EXITPROBE 2
255963fb2adSRandall Stewart #define RACK_RTTS_ENTERPROBE 3
256963fb2adSRandall Stewart #define RACK_RTTS_REACHTARGET 4
257963fb2adSRandall Stewart #define RACK_RTTS_SEEHBP 5
258963fb2adSRandall Stewart #define RACK_RTTS_NOBACKOFF 6
259963fb2adSRandall Stewart #define RACK_RTTS_SAFETY 7
260963fb2adSRandall Stewart 
261963fb2adSRandall Stewart #define RACK_USE_BEG 1
262963fb2adSRandall Stewart #define RACK_USE_END 2
263963fb2adSRandall Stewart #define RACK_USE_END_OR_THACK 3
264963fb2adSRandall Stewart 
26589e560f4SRandall Stewart #define TLP_USE_ID	1	/* Internet draft behavior */
26689e560f4SRandall Stewart #define TLP_USE_TWO_ONE 2	/* Use 2.1 behavior */
26789e560f4SRandall Stewart #define TLP_USE_TWO_TWO 3	/* Use 2.2 behavior */
268963fb2adSRandall Stewart #define RACK_MIN_BW 8000	/* 64kbps in Bps */
26989e560f4SRandall Stewart 
270963fb2adSRandall Stewart #define MIN_GP_WIN 6	/* We need at least 6 MSS in a GP measurement */
27189e560f4SRandall Stewart #ifdef _KERNEL
27289e560f4SRandall Stewart #define RACK_OPTS_SIZE (sizeof(struct rack_opts_stats)/sizeof(uint64_t))
27389e560f4SRandall Stewart extern counter_u64_t rack_opts_arry[RACK_OPTS_SIZE];
27489e560f4SRandall Stewart #define RACK_OPTS_ADD(name, amm) counter_u64_add(rack_opts_arry[(offsetof(struct rack_opts_stats, name)/sizeof(uint64_t))], (amm))
27589e560f4SRandall Stewart #define RACK_OPTS_INC(name) RACK_OPTS_ADD(name, 1)
27689e560f4SRandall Stewart #endif
27789e560f4SRandall Stewart /*
27889e560f4SRandall Stewart  * As we get each SACK we wade through the
27989e560f4SRandall Stewart  * rc_map and mark off what is acked.
28089e560f4SRandall Stewart  * We also increment rc_sacked as well.
28189e560f4SRandall Stewart  *
28289e560f4SRandall Stewart  * We also pay attention to missing entries
28389e560f4SRandall Stewart  * based on the time and possibly mark them
28489e560f4SRandall Stewart  * for retransmit. If we do and we are not already
28589e560f4SRandall Stewart  * in recovery we enter recovery. In doing
28689e560f4SRandall Stewart  * so we claer prr_delivered/holes_rxt and prr_sent_dur_rec.
28789e560f4SRandall Stewart  * We also setup rc_next/rc_snd_nxt/rc_send_end so
28889e560f4SRandall Stewart  * we will know where to send from. When not in
28989e560f4SRandall Stewart  * recovery rc_next will be NULL and rc_snd_nxt should
29089e560f4SRandall Stewart  * equal snd_max.
29189e560f4SRandall Stewart  *
29289e560f4SRandall Stewart  * Whenever we retransmit from recovery we increment
29389e560f4SRandall Stewart  * rc_holes_rxt as we retran a block and mark it as retransmitted
29489e560f4SRandall Stewart  * with the time it was sent. During non-recovery sending we
29589e560f4SRandall Stewart  * add to our map and note the time down of any send expanding
29689e560f4SRandall Stewart  * the rc_map at the tail and moving rc_snd_nxt up with snd_max.
29789e560f4SRandall Stewart  *
29889e560f4SRandall Stewart  * In recovery during SACK/ACK processing if a chunk has
29989e560f4SRandall Stewart  * been retransmitted and it is now acked, we decrement rc_holes_rxt.
30089e560f4SRandall Stewart  * When we retransmit from the scoreboard we use
30189e560f4SRandall Stewart  * rc_next and rc_snd_nxt/rc_send_end to help us
30289e560f4SRandall Stewart  * find what needs to be retran.
30389e560f4SRandall Stewart  *
30489e560f4SRandall Stewart  * To calculate pipe we simply take (snd_max - snd_una) + rc_holes_rxt
30589e560f4SRandall Stewart  * This gets us the effect of RFC6675 pipe, counting twice for
30689e560f4SRandall Stewart  * bytes retransmitted.
30789e560f4SRandall Stewart  */
30889e560f4SRandall Stewart 
30989e560f4SRandall Stewart #define TT_RACK_FR_TMR	0x2000
31089e560f4SRandall Stewart 
31189e560f4SRandall Stewart /*
31289e560f4SRandall Stewart  * Locking for the rack control block.
31389e560f4SRandall Stewart  * a) Locked by INP_WLOCK
31489e560f4SRandall Stewart  * b) Locked by the hpts-mutex
31589e560f4SRandall Stewart  *
31689e560f4SRandall Stewart  */
31735c7bb34SRandall Stewart #define RACK_GP_HIST 4	/* How much goodput history do we maintain? */
31889e560f4SRandall Stewart 
3195d8fd932SRandall Stewart #define RACK_NUM_FSB_DEBUG 16
3205d8fd932SRandall Stewart struct rack_fast_send_blk {
3215d8fd932SRandall Stewart 	uint32_t left_to_send;
3225d8fd932SRandall Stewart 	uint16_t tcp_ip_hdr_len;
3235d8fd932SRandall Stewart 	uint8_t tcp_flags;
3245d8fd932SRandall Stewart 	uint8_t hoplimit;
3255d8fd932SRandall Stewart 	uint8_t *tcp_ip_hdr;
3265d8fd932SRandall Stewart 	uint32_t recwin;
3275d8fd932SRandall Stewart 	uint32_t off;
3285d8fd932SRandall Stewart 	struct tcphdr *th;
3295d8fd932SRandall Stewart 	struct udphdr *udp;
3305d8fd932SRandall Stewart 	struct mbuf *m;
3315d8fd932SRandall Stewart 	uint32_t o_m_len;
3325d8fd932SRandall Stewart 	uint32_t rfo_apply_push : 1,
3335d8fd932SRandall Stewart 		unused : 31;
3345d8fd932SRandall Stewart };
3355d8fd932SRandall Stewart 
33689e560f4SRandall Stewart struct rack_control {
33789e560f4SRandall Stewart 	/* Second cache line 0x40 from tcp_rack */
33835c7bb34SRandall Stewart 	struct rack_rb_tree_head rc_mtree; /* Tree of all segments Lock(a) */
33989e560f4SRandall Stewart 	struct rack_head rc_tmap;	/* List in transmit order Lock(a) */
34089e560f4SRandall Stewart 	struct rack_sendmap *rc_tlpsend;	/* Remembered place for
34189e560f4SRandall Stewart 						 * tlp_sending Lock(a) */
34289e560f4SRandall Stewart 	struct rack_sendmap *rc_resend;	/* something we have been asked to
34389e560f4SRandall Stewart 					 * resend */
3445d8fd932SRandall Stewart 	struct rack_fast_send_blk fsb;	/* The fast-send block */
345*4f3addd9SRandall Stewart 	uint32_t timer_slop;
34635c7bb34SRandall Stewart 	uint32_t input_pkt;
34735c7bb34SRandall Stewart 	uint32_t saved_input_pkt;
34889e560f4SRandall Stewart 	uint32_t rc_hpts_flags;
349963fb2adSRandall Stewart 	uint32_t rc_fixed_pacing_rate_ca;
350963fb2adSRandall Stewart 	uint32_t rc_fixed_pacing_rate_rec;
351963fb2adSRandall Stewart 	uint32_t rc_fixed_pacing_rate_ss;
352963fb2adSRandall Stewart 	uint32_t cwnd_to_use;	/* The cwnd in use */
35389e560f4SRandall Stewart 	uint32_t rc_timer_exp;	/* If a timer ticks of expiry */
35489e560f4SRandall Stewart 	uint32_t rc_rack_min_rtt;	/* lowest RTT seen Lock(a) */
35589e560f4SRandall Stewart 	uint32_t rc_rack_largest_cwnd;	/* Largest CWND we have seen Lock(a) */
35689e560f4SRandall Stewart 
35789e560f4SRandall Stewart 	/* Third Cache line 0x80 */
35889e560f4SRandall Stewart 	struct rack_head rc_free;	/* Allocation array */
3595d8fd932SRandall Stewart 	uint64_t last_hw_bw_req;
3605d8fd932SRandall Stewart 	uint64_t crte_prev_rate;
3615d8fd932SRandall Stewart 	uint64_t bw_rate_cap;
36289e560f4SRandall Stewart 	uint32_t rc_time_last_sent;	/* Time we last sent some data and
36389e560f4SRandall Stewart 					 * logged it Lock(a). */
36489e560f4SRandall Stewart 	uint32_t rc_reorder_ts;	/* Last time we saw reordering Lock(a) */
36589e560f4SRandall Stewart 
36689e560f4SRandall Stewart 	uint32_t rc_tlp_new_data;	/* we need to send new-data on a TLP
36789e560f4SRandall Stewart 					 * Lock(a) */
36889e560f4SRandall Stewart 	uint32_t rc_prr_out;	/* bytes sent during recovery Lock(a) */
36989e560f4SRandall Stewart 
37089e560f4SRandall Stewart 	uint32_t rc_prr_recovery_fs;	/* recovery fs point Lock(a) */
37189e560f4SRandall Stewart 
37289e560f4SRandall Stewart 	uint32_t rc_prr_sndcnt;	/* Prr sndcnt Lock(a) */
37389e560f4SRandall Stewart 
37489e560f4SRandall Stewart 	uint32_t rc_sacked;	/* Tot sacked on scoreboard Lock(a) */
375963fb2adSRandall Stewart 	uint32_t xxx_rc_last_tlp_seq;	/* Last tlp sequence Lock(a) */
37689e560f4SRandall Stewart 
37789e560f4SRandall Stewart 	uint32_t rc_prr_delivered;	/* during recovery prr var Lock(a) */
378963fb2adSRandall Stewart 	uint16_t rc_tlp_cnt_out;	/* count of times we have sent a TLP without new data */
379963fb2adSRandall Stewart 	uint16_t xxx_rc_tlp_seg_send_cnt;	/* Number of times we have TLP sent
38089e560f4SRandall Stewart 					 * rc_last_tlp_seq Lock(a) */
38189e560f4SRandall Stewart 
382963fb2adSRandall Stewart 	uint32_t rc_loss_count;	/* How many bytes have been retransmitted
38389e560f4SRandall Stewart 				 * Lock(a) */
38489e560f4SRandall Stewart 	uint32_t rc_reorder_fade;	/* Socket option value Lock(a) */
38589e560f4SRandall Stewart 
38689e560f4SRandall Stewart 	/* Forth cache line 0xc0  */
38789e560f4SRandall Stewart 	/* Times */
38889e560f4SRandall Stewart 
38989e560f4SRandall Stewart 	uint32_t rc_rack_tmit_time;	/* Rack transmit time Lock(a) */
39089e560f4SRandall Stewart 	uint32_t rc_holes_rxt;	/* Tot retraned from scoreboard Lock(a) */
39189e560f4SRandall Stewart 
39289e560f4SRandall Stewart 	/* Variables to track bad retransmits and recover */
39389e560f4SRandall Stewart 	uint32_t rc_rsm_start;	/* RSM seq number we retransmitted Lock(a) */
39489e560f4SRandall Stewart 	uint32_t rc_cwnd_at;	/* cwnd at the retransmit Lock(a) */
39589e560f4SRandall Stewart 
39689e560f4SRandall Stewart 	uint32_t rc_ssthresh_at;/* ssthresh at the retransmit Lock(a) */
39789e560f4SRandall Stewart 	uint32_t rc_num_maps_alloced;	/* Number of map blocks (sacks) we
39889e560f4SRandall Stewart 					 * have allocated */
39989e560f4SRandall Stewart 	uint32_t rc_rcvtime;	/* When we last received data */
4005e02b277SJonathan T. Looney 	uint32_t rc_num_split_allocs;	/* num split map entries allocated */
40135c7bb34SRandall Stewart 
40289e560f4SRandall Stewart 	uint32_t rc_last_output_to;
40389e560f4SRandall Stewart 	uint32_t rc_went_idle_time;
40489e560f4SRandall Stewart 
40589e560f4SRandall Stewart 	struct rack_sendmap *rc_sacklast;	/* sack remembered place
40689e560f4SRandall Stewart 						 * Lock(a) */
40789e560f4SRandall Stewart 
40889e560f4SRandall Stewart 	struct rack_sendmap *rc_rsm_at_retran;	/* Debug variable kept for
40989e560f4SRandall Stewart 						 * cache line alignment
41089e560f4SRandall Stewart 						 * Lock(a) */
411963fb2adSRandall Stewart 	struct rack_sendmap *rc_first_appl;	/* Pointer to first app limited */
412963fb2adSRandall Stewart 	struct rack_sendmap *rc_end_appl;	/* Pointer to last app limited */
41389e560f4SRandall Stewart 	/* Cache line split 0x100 */
41489e560f4SRandall Stewart 	struct sack_filter rack_sf;
41589e560f4SRandall Stewart 	/* Cache line split 0x140 */
41689e560f4SRandall Stewart 	/* Flags for various things */
417963fb2adSRandall Stewart 	uint32_t last_pacing_time;
41835c7bb34SRandall Stewart 	uint32_t rc_pace_max_segs;
41935c7bb34SRandall Stewart 	uint32_t rc_pace_min_segs;
420963fb2adSRandall Stewart 	uint32_t rc_app_limited_cnt;
421963fb2adSRandall Stewart 	uint16_t rack_per_of_gp_ss; /* 100 = 100%, so from 65536 = 655 x bw  */
422963fb2adSRandall Stewart 	uint16_t rack_per_of_gp_ca; /* 100 = 100%, so from 65536 = 655 x bw  */
423963fb2adSRandall Stewart 	uint16_t rack_per_of_gp_rec; /* 100 = 100%, so from 65536 = 655 x bw, 0=off */
424963fb2adSRandall Stewart 	uint16_t rack_per_of_gp_probertt; /* 100 = 100%, so from 65536 = 655 x bw, 0=off */
42535c7bb34SRandall Stewart 	uint32_t rc_high_rwnd;
42635c7bb34SRandall Stewart 	uint32_t ack_count;
42735c7bb34SRandall Stewart 	uint32_t sack_count;
42835c7bb34SRandall Stewart 	uint32_t sack_noextra_move;
42935c7bb34SRandall Stewart 	uint32_t sack_moved_extra;
43089e560f4SRandall Stewart 	struct rack_rtt_sample rack_rs;
431963fb2adSRandall Stewart 	const struct tcp_hwrate_limit_table *crte;
432963fb2adSRandall Stewart 	uint32_t rc_agg_early;
433963fb2adSRandall Stewart 	uint32_t rc_agg_delayed;
43435c7bb34SRandall Stewart 	uint32_t rc_tlp_rxt_last_time;
43535c7bb34SRandall Stewart 	uint32_t rc_saved_cwnd;
4365d8fd932SRandall Stewart 	uint64_t rc_gp_output_ts; /* chg*/
4375d8fd932SRandall Stewart 	uint64_t rc_gp_cumack_ts; /* chg*/
438963fb2adSRandall Stewart 	struct timeval act_rcv_time;
439963fb2adSRandall Stewart 	struct timeval rc_last_time_decay;	/* SAD time decay happened here */
440963fb2adSRandall Stewart 	uint64_t gp_bw;
441963fb2adSRandall Stewart 	uint64_t init_rate;
442963fb2adSRandall Stewart #ifdef NETFLIX_SHARED_CWND
443963fb2adSRandall Stewart 	struct shared_cwnd *rc_scw;
444963fb2adSRandall Stewart #endif
445963fb2adSRandall Stewart 	uint64_t last_gp_comp_bw;
446963fb2adSRandall Stewart 	uint64_t last_max_bw;	/* Our calculated max b/w last */
447963fb2adSRandall Stewart 	struct time_filter_small rc_gp_min_rtt;
4485d8fd932SRandall Stewart 	struct def_opt_head opt_list;
449963fb2adSRandall Stewart 	int32_t rc_rtt_diff;		/* Timely style rtt diff of our gp_srtt */
450963fb2adSRandall Stewart 	uint32_t rc_gp_srtt;		/* Current GP srtt */
451963fb2adSRandall Stewart 	uint32_t rc_prev_gp_srtt;	/* Previous RTT */
452963fb2adSRandall Stewart 	uint32_t rc_entry_gp_rtt;	/* Entry to PRTT gp-rtt */
453963fb2adSRandall Stewart 	uint32_t rc_loss_at_start;	/* At measurement window where was our lost value */
454963fb2adSRandall Stewart 
455963fb2adSRandall Stewart 	uint32_t forced_ack_ts;
456963fb2adSRandall Stewart 	uint32_t rc_lower_rtt_us_cts;	/* Time our GP rtt was last lowered */
457963fb2adSRandall Stewart 	uint32_t rc_time_probertt_entered;
458963fb2adSRandall Stewart 	uint32_t rc_time_probertt_starts;
459963fb2adSRandall Stewart 	uint32_t rc_lowest_us_rtt;
460963fb2adSRandall Stewart 	uint32_t rc_highest_us_rtt;
461963fb2adSRandall Stewart 	uint32_t rc_last_us_rtt;
462963fb2adSRandall Stewart 	uint32_t rc_time_of_last_probertt;
463963fb2adSRandall Stewart 	uint32_t rc_target_probertt_flight;
464963fb2adSRandall Stewart 	uint32_t rc_probertt_sndmax_atexit;	/* Highest sent to in probe-rtt */
4655d8fd932SRandall Stewart 	uint32_t rc_cwnd_at_erec;
4665d8fd932SRandall Stewart 	uint32_t rc_ssthresh_at_erec;
4675d8fd932SRandall Stewart 	uint32_t dsack_byte_cnt;
4685d8fd932SRandall Stewart 	uint32_t retran_during_recovery;
469963fb2adSRandall Stewart 	uint32_t rc_gp_lowrtt;			/* Lowest rtt seen during GPUT measurement */
470963fb2adSRandall Stewart 	uint32_t rc_gp_high_rwnd;		/* Highest rwnd seen during GPUT measurement */
4715d8fd932SRandall Stewart 	uint32_t rc_snd_max_at_rto;	/* For non-sack when the RTO occured what was snd-max */
4725d8fd932SRandall Stewart 	uint32_t rc_out_at_rto;
473963fb2adSRandall Stewart 	int32_t rc_scw_index;
47489e560f4SRandall Stewart 	uint32_t rc_tlp_threshold;	/* Socket option value Lock(a) */
4755d8fd932SRandall Stewart 	uint32_t rc_last_timeout_snduna;
4765d8fd932SRandall Stewart 	uint32_t challenge_ack_ts;
4775d8fd932SRandall Stewart 	uint32_t challenge_ack_cnt;
4785d8fd932SRandall Stewart 	uint32_t rc_min_to;	/* Socket option value Lock(a) */
4795d8fd932SRandall Stewart 	uint32_t rc_pkt_delay;	/* Socket option value Lock(a) */
4805d8fd932SRandall Stewart 	struct newreno rc_saved_beta;	/*
4815d8fd932SRandall Stewart 					 * For newreno cc:
4825d8fd932SRandall Stewart 					 * rc_saved_cc are the values we have had
4835d8fd932SRandall Stewart 					 * set by the user, if pacing is not happening
4845d8fd932SRandall Stewart 					 * (i.e. its early and we have not turned on yet
4855d8fd932SRandall Stewart 					 *  or it was turned off). The minute pacing
4865d8fd932SRandall Stewart 					 * is turned on we pull out the values currently
4875d8fd932SRandall Stewart 					 * being used by newreno and replace them with
4885d8fd932SRandall Stewart 					 * these values, then save off the old values here,
4895d8fd932SRandall Stewart 					 * we also set the flag (if ecn_beta is set) to make
4905d8fd932SRandall Stewart 					 * new_reno do less of a backoff for ecn (think abe).
4915d8fd932SRandall Stewart 					 */
49289e560f4SRandall Stewart 	uint16_t rc_early_recovery_segs;	/* Socket option value Lock(a) */
49389e560f4SRandall Stewart 	uint16_t rc_reorder_shift;	/* Socket option value Lock(a) */
494963fb2adSRandall Stewart 	uint8_t rc_no_push_at_mrtt;	/* No push when we exceed max rtt */
4955d8fd932SRandall Stewart 	uint8_t num_measurements;	/* Number of measurements (up to 0xff, we freeze at 0xff)  */
4965d8fd932SRandall Stewart 	uint8_t req_measurements;	/* How many measurements are required? */
49789e560f4SRandall Stewart 	uint8_t rc_tlp_cwnd_reduce;	/* Socket option value Lock(a) */
49889e560f4SRandall Stewart 	uint8_t rc_prr_sendalot;/* Socket option value Lock(a) */
49989e560f4SRandall Stewart 	uint8_t rc_rate_sample_method;
500963fb2adSRandall Stewart 	uint8_t rc_gp_hist_idx;
50189e560f4SRandall Stewart };
50289e560f4SRandall Stewart 
503963fb2adSRandall Stewart #define RACK_TIMELY_CNT_BOOST 5	/* At 5th increase boost */
504963fb2adSRandall Stewart #define RACK_MINRTT_FILTER_TIM 10 /* Seconds */
505963fb2adSRandall Stewart 
50689e560f4SRandall Stewart #ifdef _KERNEL
50789e560f4SRandall Stewart 
50889e560f4SRandall Stewart struct tcp_rack {
50989e560f4SRandall Stewart 	/* First cache line 0x00 */
51089e560f4SRandall Stewart 	TAILQ_ENTRY(tcp_rack) r_hpts;	/* hptsi queue next Lock(b) */
51189e560f4SRandall Stewart 	int32_t(*r_substate) (struct mbuf *, struct tcphdr *,
51289e560f4SRandall Stewart 	    struct socket *, struct tcpcb *, struct tcpopt *,
5138df12ffcSMichael Tuexen 	    int32_t, int32_t, uint32_t, int, int, uint8_t);	/* Lock(a) */
51489e560f4SRandall Stewart 	struct tcpcb *rc_tp;	/* The tcpcb Lock(a) */
51589e560f4SRandall Stewart 	struct inpcb *rc_inp;	/* The inpcb Lock(a) */
5165d8fd932SRandall Stewart 	uint8_t rc_free_cnt;	/* Number of free entries on the rc_free list
51789e560f4SRandall Stewart 				 * Lock(a) */
5185d8fd932SRandall Stewart 	uint8_t client_bufferlvl;	/* 0 - 5 normaly, less than or at 2 means its real low */
5195d8fd932SRandall Stewart 	uint8_t no_prr_addback : 1,
5205d8fd932SRandall Stewart 		gp_ready : 1,
5215d8fd932SRandall Stewart 		defer_options: 1,
5225d8fd932SRandall Stewart 		fast_rsm_hack: 1,
5235d8fd932SRandall Stewart 		rc_ack_can_sendout_data: 1, /*
5245d8fd932SRandall Stewart 					     * If set it will override pacing restrictions on not sending
5255d8fd932SRandall Stewart 					     * data when the pacing timer is running. I.e. you set this
5265d8fd932SRandall Stewart 					     * and an ACK will send data. Default is off and its only used
5275d8fd932SRandall Stewart 					     * without pacing when we are doing 5G speed up for there
5285d8fd932SRandall Stewart 					     * ack filtering.
5295d8fd932SRandall Stewart 					     */
5305d8fd932SRandall Stewart 		rc_pacing_cc_set: 1,	     /*
5315d8fd932SRandall Stewart 					      * If we are pacing (pace_always=1) and we have reached the
5325d8fd932SRandall Stewart 					      * point where we start pacing (fixed or gp has reached its
5335d8fd932SRandall Stewart 					      * magic gp_ready state) this flag indicates we have set in
5345d8fd932SRandall Stewart 					      * values to effect CC's backoff's. If pacing is turned off
5355d8fd932SRandall Stewart 					      * then we must restore the values saved in rc_saved_beta,
5365d8fd932SRandall Stewart 					      * if its going to gp_ready we need to copy the values into
5375d8fd932SRandall Stewart 					      * the CC module and set our flags.
5385d8fd932SRandall Stewart 					      *
5395d8fd932SRandall Stewart 					      * Note this only happens if the cc name is newreno (CCALGONAME_NEWRENO).
5405d8fd932SRandall Stewart 					      */
5415d8fd932SRandall Stewart 
5425d8fd932SRandall Stewart 		avail :2;
5435d8fd932SRandall Stewart 	uint8_t avail_bytes;
54489e560f4SRandall Stewart 	uint32_t rc_rack_rtt;	/* RACK-RTT Lock(a) */
545963fb2adSRandall Stewart 	uint16_t r_mbuf_queue : 1,	/* Do we do mbuf queue for non-paced */
546963fb2adSRandall Stewart 		 rtt_limit_mul : 4,	/* muliply this by low rtt */
547963fb2adSRandall Stewart 		 r_limit_scw : 1,
5485d8fd932SRandall Stewart 		 r_must_retran : 1,	/* For non-sack customers we hit an RTO and new data should be resends */
5495d8fd932SRandall Stewart 		 r_use_cmp_ack: 1,	/* Do we use compressed acks */
5505d8fd932SRandall Stewart 		 r_ent_rec_ns: 1,	/* We entered recovery and have not sent */
5515d8fd932SRandall Stewart 		 r_might_revert: 1,	/* Flag to find out if we might need to revert */
5525d8fd932SRandall Stewart 		 r_fast_output: 1, 	/* Fast output is in progress we can skip the bulk of rack_output */
5535d8fd932SRandall Stewart 		 r_fsb_inited: 1,
5545d8fd932SRandall Stewart 		 r_rack_hw_rate_caps: 1,
5555d8fd932SRandall Stewart 		 r_up_only: 1,
5565d8fd932SRandall Stewart 		 r_via_fill_cw : 1,
5575d8fd932SRandall Stewart 		 r_fill_less_agg : 1;
55889e560f4SRandall Stewart 
5595d8fd932SRandall Stewart 	uint8_t rc_user_set_max_segs;	/* Socket option value Lock(a) */
5605d8fd932SRandall Stewart 	uint8_t rc_labc;		/* Appropriate Byte Counting Value */
561963fb2adSRandall Stewart 	uint16_t forced_ack : 1,
562963fb2adSRandall Stewart 		rc_gp_incr : 1,
563963fb2adSRandall Stewart 		rc_gp_bwred : 1,
564963fb2adSRandall Stewart 		rc_gp_timely_inc_cnt : 3,
565963fb2adSRandall Stewart 		rc_gp_timely_dec_cnt : 3,
5665d8fd932SRandall Stewart 		r_use_labc_for_rec: 1,
567963fb2adSRandall Stewart 		rc_highly_buffered: 1,		/* The path is highly buffered */
568963fb2adSRandall Stewart 		rc_dragged_bottom: 1,
569963fb2adSRandall Stewart 		rc_dack_mode : 1,		/* Mac O/S emulation of d-ack */
570963fb2adSRandall Stewart 		rc_dack_toggle : 1,		/* For Mac O/S emulation of d-ack */
571963fb2adSRandall Stewart 		pacing_longer_than_rtt : 1,
572963fb2adSRandall Stewart 		rc_gp_filled : 1;
57389e560f4SRandall Stewart 	uint8_t r_state;	/* Current rack state Lock(a) */
57489e560f4SRandall Stewart 	uint8_t rc_tmr_stopped : 7,
57589e560f4SRandall Stewart 		t_timers_stopped : 1;
576963fb2adSRandall Stewart 	uint8_t rc_enobuf : 7,	/* count of enobufs on connection provides */
577963fb2adSRandall Stewart 		rc_on_min_to : 1;
57889e560f4SRandall Stewart 	uint8_t r_timer_override : 1,	/* hpts override Lock(a) */
57989e560f4SRandall Stewart 		r_is_v6 : 1,	/* V6 pcb Lock(a)  */
58089e560f4SRandall Stewart 		rc_in_persist : 1,
58189e560f4SRandall Stewart 		rc_tlp_in_progress : 1,
58289e560f4SRandall Stewart 		rc_always_pace : 1,	/* Socket option value Lock(a) */
583963fb2adSRandall Stewart 		rc_pace_to_cwnd : 1,
584963fb2adSRandall Stewart 		rc_pace_fill_if_rttin_range : 1,
5855d8fd932SRandall Stewart 		rc_srtt_measure_made : 1;
586963fb2adSRandall Stewart 	uint8_t app_limited_needs_set : 1,
587963fb2adSRandall Stewart 		use_fixed_rate : 1,
58835c7bb34SRandall Stewart 		rc_has_collapsed : 1,
58935c7bb34SRandall Stewart 		r_rep_attack : 1,
59035c7bb34SRandall Stewart 		r_rep_reverse : 1,
591963fb2adSRandall Stewart 		rack_hdrw_pacing : 1,  /* We are doing Hardware pacing */
592963fb2adSRandall Stewart 		rack_hdw_pace_ena : 1, /* Is hardware pacing enabled? */
593963fb2adSRandall Stewart 		rack_attempt_hdwr_pace : 1; /* Did we attempt hdwr pacing (if allowed) */
594963fb2adSRandall Stewart 	uint8_t rack_tlp_threshold_use : 3,	/* only 1, 2 and 3 used so far */
595963fb2adSRandall Stewart 		rack_rec_nonrxt_use_cr : 1,
596963fb2adSRandall Stewart 		rack_enable_scwnd : 1,
597963fb2adSRandall Stewart 		rack_attempted_scwnd : 1,
598963fb2adSRandall Stewart 		rack_no_prr : 1,
599963fb2adSRandall Stewart 		rack_scwnd_is_idle : 1;
60089e560f4SRandall Stewart 	uint8_t rc_allow_data_af_clo: 1,
60189e560f4SRandall Stewart 		delayed_ack : 1,
60235c7bb34SRandall Stewart 		set_pacing_done_a_iw : 1,
603963fb2adSRandall Stewart 		use_rack_rr : 1,
6045e02b277SJonathan T. Looney 		alloc_limit_reported : 1,
60535c7bb34SRandall Stewart 		sack_attack_disable : 1,
60635c7bb34SRandall Stewart 		do_detection : 1,
607963fb2adSRandall Stewart 		rc_force_max_seg : 1;
608963fb2adSRandall Stewart 	uint8_t rack_cwnd_limited : 1,
609963fb2adSRandall Stewart 		r_early : 1,
610963fb2adSRandall Stewart 		r_late : 1,
611963fb2adSRandall Stewart 		r_running_early : 1,
612963fb2adSRandall Stewart 		r_running_late : 1,
613963fb2adSRandall Stewart 		r_wanted_output: 1,
614963fb2adSRandall Stewart 		r_rr_config : 2;
615963fb2adSRandall Stewart 	uint16_t rc_init_win : 8,
616963fb2adSRandall Stewart 		rc_gp_rtt_set : 1,
617963fb2adSRandall Stewart 		rc_gp_dyn_mul : 1,
618963fb2adSRandall Stewart 		rc_gp_saw_rec : 1,
619963fb2adSRandall Stewart 		rc_gp_saw_ca : 1,
620963fb2adSRandall Stewart 		rc_gp_saw_ss : 1,
621963fb2adSRandall Stewart 		rc_gp_no_rec_chg : 1,
622963fb2adSRandall Stewart 		in_probe_rtt : 1,
623963fb2adSRandall Stewart 		measure_saw_probe_rtt : 1;
62489e560f4SRandall Stewart 	/* Cache line 2 0x40 */
62589e560f4SRandall Stewart 	struct rack_control r_ctl;
62689e560f4SRandall Stewart }        __aligned(CACHE_LINE_SIZE);
62789e560f4SRandall Stewart 
62889e560f4SRandall Stewart #endif
62989e560f4SRandall Stewart #endif
630