xref: /xnu-10002.81.5/bsd/netinet/tcp_cc.h (revision 5e3eaea39dcf651e66cb99ba7d70e32cc4a99587)
1*5e3eaea3SApple OSS Distributions /*
2*5e3eaea3SApple OSS Distributions  * Copyright (c) 2010-2021 Apple Inc. All rights reserved.
3*5e3eaea3SApple OSS Distributions  *
4*5e3eaea3SApple OSS Distributions  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5*5e3eaea3SApple OSS Distributions  *
6*5e3eaea3SApple OSS Distributions  * This file contains Original Code and/or Modifications of Original Code
7*5e3eaea3SApple OSS Distributions  * as defined in and that are subject to the Apple Public Source License
8*5e3eaea3SApple OSS Distributions  * Version 2.0 (the 'License'). You may not use this file except in
9*5e3eaea3SApple OSS Distributions  * compliance with the License. The rights granted to you under the License
10*5e3eaea3SApple OSS Distributions  * may not be used to create, or enable the creation or redistribution of,
11*5e3eaea3SApple OSS Distributions  * unlawful or unlicensed copies of an Apple operating system, or to
12*5e3eaea3SApple OSS Distributions  * circumvent, violate, or enable the circumvention or violation of, any
13*5e3eaea3SApple OSS Distributions  * terms of an Apple operating system software license agreement.
14*5e3eaea3SApple OSS Distributions  *
15*5e3eaea3SApple OSS Distributions  * Please obtain a copy of the License at
16*5e3eaea3SApple OSS Distributions  * http://www.opensource.apple.com/apsl/ and read it before using this file.
17*5e3eaea3SApple OSS Distributions  *
18*5e3eaea3SApple OSS Distributions  * The Original Code and all software distributed under the License are
19*5e3eaea3SApple OSS Distributions  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20*5e3eaea3SApple OSS Distributions  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21*5e3eaea3SApple OSS Distributions  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22*5e3eaea3SApple OSS Distributions  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23*5e3eaea3SApple OSS Distributions  * Please see the License for the specific language governing rights and
24*5e3eaea3SApple OSS Distributions  * limitations under the License.
25*5e3eaea3SApple OSS Distributions  *
26*5e3eaea3SApple OSS Distributions  * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27*5e3eaea3SApple OSS Distributions  */
28*5e3eaea3SApple OSS Distributions /*-
29*5e3eaea3SApple OSS Distributions  * Copyright (c) 2008 Swinburne University of Technology, Melbourne, Australia
30*5e3eaea3SApple OSS Distributions  * All rights reserved.
31*5e3eaea3SApple OSS Distributions  *
32*5e3eaea3SApple OSS Distributions  * This software was developed at the Centre for Advanced Internet
33*5e3eaea3SApple OSS Distributions  * Architectures, Swinburne University, by Lawrence Stewart and James Healy,
34*5e3eaea3SApple OSS Distributions  * made possible in part by a grant from the Cisco University Research Program
35*5e3eaea3SApple OSS Distributions  * Fund at Community Foundation Silicon Valley.
36*5e3eaea3SApple OSS Distributions  *
37*5e3eaea3SApple OSS Distributions  * Redistribution and use in source and binary forms, with or without
38*5e3eaea3SApple OSS Distributions  * modification, are permitted provided that the following conditions
39*5e3eaea3SApple OSS Distributions  * are met:
40*5e3eaea3SApple OSS Distributions  * 1. Redistributions of source code must retain the above copyright
41*5e3eaea3SApple OSS Distributions  *    notice, this list of conditions and the following disclaimer.
42*5e3eaea3SApple OSS Distributions  * 2. Redistributions in binary form must reproduce the above copyright
43*5e3eaea3SApple OSS Distributions  *    notice, this list of conditions and the following disclaimer in the
44*5e3eaea3SApple OSS Distributions  *    documentation and/or other materials provided with the distribution.
45*5e3eaea3SApple OSS Distributions  *
46*5e3eaea3SApple OSS Distributions  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
47*5e3eaea3SApple OSS Distributions  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
48*5e3eaea3SApple OSS Distributions  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
49*5e3eaea3SApple OSS Distributions  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
50*5e3eaea3SApple OSS Distributions  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
51*5e3eaea3SApple OSS Distributions  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
52*5e3eaea3SApple OSS Distributions  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
53*5e3eaea3SApple OSS Distributions  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
54*5e3eaea3SApple OSS Distributions  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
55*5e3eaea3SApple OSS Distributions  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
56*5e3eaea3SApple OSS Distributions  * SUCH DAMAGE.
57*5e3eaea3SApple OSS Distributions  *
58*5e3eaea3SApple OSS Distributions  * $FreeBSD$
59*5e3eaea3SApple OSS Distributions  */
60*5e3eaea3SApple OSS Distributions 
61*5e3eaea3SApple OSS Distributions #ifndef _NETINET_CC_H_
62*5e3eaea3SApple OSS Distributions #define _NETINET_CC_H_
63*5e3eaea3SApple OSS Distributions 
64*5e3eaea3SApple OSS Distributions #ifdef PRIVATE
65*5e3eaea3SApple OSS Distributions 
66*5e3eaea3SApple OSS Distributions #include <netinet/in.h>
67*5e3eaea3SApple OSS Distributions 
68*5e3eaea3SApple OSS Distributions /*
69*5e3eaea3SApple OSS Distributions  * Data structure to collect and display congestion control debug information
70*5e3eaea3SApple OSS Distributions  */
71*5e3eaea3SApple OSS Distributions struct tcp_cc_debug_state {
72*5e3eaea3SApple OSS Distributions 	u_int64_t ccd_tsns;
73*5e3eaea3SApple OSS Distributions 	char ccd_srcaddr[INET6_ADDRSTRLEN];
74*5e3eaea3SApple OSS Distributions 	uint16_t ccd_srcport;
75*5e3eaea3SApple OSS Distributions 	char ccd_destaddr[INET6_ADDRSTRLEN];
76*5e3eaea3SApple OSS Distributions 	uint16_t ccd_destport;
77*5e3eaea3SApple OSS Distributions 	uint32_t ccd_snd_cwnd;
78*5e3eaea3SApple OSS Distributions 	uint32_t ccd_snd_wnd;
79*5e3eaea3SApple OSS Distributions 	uint32_t ccd_snd_ssthresh;
80*5e3eaea3SApple OSS Distributions 	uint32_t ccd_pipeack;
81*5e3eaea3SApple OSS Distributions 	uint32_t ccd_rttcur;
82*5e3eaea3SApple OSS Distributions 	uint32_t ccd_rxtcur;
83*5e3eaea3SApple OSS Distributions 	uint32_t ccd_srtt;
84*5e3eaea3SApple OSS Distributions 	uint32_t ccd_event;
85*5e3eaea3SApple OSS Distributions 	uint32_t ccd_sndcc;
86*5e3eaea3SApple OSS Distributions 	uint32_t ccd_sndhiwat;
87*5e3eaea3SApple OSS Distributions 	uint32_t ccd_bytes_acked;
88*5e3eaea3SApple OSS Distributions 	u_int8_t ccd_cc_index;
89*5e3eaea3SApple OSS Distributions 	u_int8_t ccd_unused_1__;
90*5e3eaea3SApple OSS Distributions 	u_int16_t ccd_unused_2__;
91*5e3eaea3SApple OSS Distributions 	union {
92*5e3eaea3SApple OSS Distributions 		struct {
93*5e3eaea3SApple OSS Distributions 			uint32_t ccd_last_max;
94*5e3eaea3SApple OSS Distributions 			uint32_t ccd_tcp_win;
95*5e3eaea3SApple OSS Distributions 			uint32_t ccd_target_win;
96*5e3eaea3SApple OSS Distributions 			uint32_t ccd_avg_lastmax;
97*5e3eaea3SApple OSS Distributions 			uint32_t ccd_mean_deviation;
98*5e3eaea3SApple OSS Distributions 		} cubic_state;
99*5e3eaea3SApple OSS Distributions 		struct {
100*5e3eaea3SApple OSS Distributions 			u_int32_t led_base_rtt;
101*5e3eaea3SApple OSS Distributions 		} ledbat_state;
102*5e3eaea3SApple OSS Distributions 	} u;
103*5e3eaea3SApple OSS Distributions };
104*5e3eaea3SApple OSS Distributions 
105*5e3eaea3SApple OSS Distributions /*
106*5e3eaea3SApple OSS Distributions  * Values of ccd_cc_index
107*5e3eaea3SApple OSS Distributions  */
108*5e3eaea3SApple OSS Distributions #define TCP_CC_ALGO_NONE                0
109*5e3eaea3SApple OSS Distributions #define TCP_CC_ALGO_NEWRENO_INDEX       1
110*5e3eaea3SApple OSS Distributions #define TCP_CC_ALGO_BACKGROUND_INDEX    2 /* CC for background transport */
111*5e3eaea3SApple OSS Distributions #define TCP_CC_ALGO_CUBIC_INDEX         3 /* default CC algorithm */
112*5e3eaea3SApple OSS Distributions #define TCP_CC_ALGO_COUNT               4 /* Count of CC algorithms */
113*5e3eaea3SApple OSS Distributions 
114*5e3eaea3SApple OSS Distributions /*
115*5e3eaea3SApple OSS Distributions  * Values of ccd_event
116*5e3eaea3SApple OSS Distributions  */
117*5e3eaea3SApple OSS Distributions #define TCP_CC_EVENT_LIST                       \
118*5e3eaea3SApple OSS Distributions 	X(TCP_CC_CWND_INIT)                     \
119*5e3eaea3SApple OSS Distributions 	X(TCP_CC_INSEQ_ACK_RCVD)                \
120*5e3eaea3SApple OSS Distributions 	X(TCP_CC_ACK_RCVD)                      \
121*5e3eaea3SApple OSS Distributions 	X(TCP_CC_ENTER_FASTRECOVERY)            \
122*5e3eaea3SApple OSS Distributions 	X(TCP_CC_IN_FASTRECOVERY)               \
123*5e3eaea3SApple OSS Distributions 	X(TCP_CC_EXIT_FASTRECOVERY)             \
124*5e3eaea3SApple OSS Distributions 	X(TCP_CC_PARTIAL_ACK)                   \
125*5e3eaea3SApple OSS Distributions 	X(TCP_CC_IDLE_TIMEOUT)                  \
126*5e3eaea3SApple OSS Distributions 	X(TCP_CC_REXMT_TIMEOUT)                 \
127*5e3eaea3SApple OSS Distributions 	X(TCP_CC_ECN_RCVD)                      \
128*5e3eaea3SApple OSS Distributions 	X(TCP_CC_BAD_REXMT_RECOVERY)            \
129*5e3eaea3SApple OSS Distributions 	X(TCP_CC_OUTPUT_ERROR)                  \
130*5e3eaea3SApple OSS Distributions 	X(TCP_CC_CHANGE_ALGO)                   \
131*5e3eaea3SApple OSS Distributions 	X(TCP_CC_FLOW_CONTROL)                  \
132*5e3eaea3SApple OSS Distributions 	X(TCP_CC_SUSPEND)                       \
133*5e3eaea3SApple OSS Distributions 	X(TCP_CC_LIMITED_TRANSMIT)              \
134*5e3eaea3SApple OSS Distributions 	X(TCP_CC_EARLY_RETRANSMIT)              \
135*5e3eaea3SApple OSS Distributions 	X(TCP_CC_TLP_RECOVERY)                  \
136*5e3eaea3SApple OSS Distributions 	X(TCP_CC_TLP_RECOVER_LASTPACKET)        \
137*5e3eaea3SApple OSS Distributions 	X(TCP_CC_DELAY_FASTRECOVERY)            \
138*5e3eaea3SApple OSS Distributions 	X(TCP_CC_TLP_IN_FASTRECOVERY)           \
139*5e3eaea3SApple OSS Distributions 	X(TCP_CC_DSACK_BAD_REXMT)               \
140*5e3eaea3SApple OSS Distributions 	X(TCP_CC_FIRST_REXMT)                   \
141*5e3eaea3SApple OSS Distributions 	X(MAX_TCP_CC_EVENTS)
142*5e3eaea3SApple OSS Distributions 
143*5e3eaea3SApple OSS Distributions enum tcp_cc_event {
144*5e3eaea3SApple OSS Distributions #define X(name, ...) name,
145*5e3eaea3SApple OSS Distributions 	TCP_CC_EVENT_LIST
146*5e3eaea3SApple OSS Distributions #undef X
147*5e3eaea3SApple OSS Distributions };
148*5e3eaea3SApple OSS Distributions 
149*5e3eaea3SApple OSS Distributions /*
150*5e3eaea3SApple OSS Distributions  * Kernel control ID
151*5e3eaea3SApple OSS Distributions  */
152*5e3eaea3SApple OSS Distributions #define TCP_CC_CONTROL_NAME     "com.apple.network.tcp_ccdebug"
153*5e3eaea3SApple OSS Distributions 
154*5e3eaea3SApple OSS Distributions #endif /* PRIVATE */
155*5e3eaea3SApple OSS Distributions 
156*5e3eaea3SApple OSS Distributions #ifdef KERNEL_PRIVATE
157*5e3eaea3SApple OSS Distributions 
158*5e3eaea3SApple OSS Distributions #include <netinet/tcp.h>
159*5e3eaea3SApple OSS Distributions #include <netinet/tcp_var.h>
160*5e3eaea3SApple OSS Distributions #include <kern/zalloc.h>
161*5e3eaea3SApple OSS Distributions 
162*5e3eaea3SApple OSS Distributions /*
163*5e3eaea3SApple OSS Distributions  * Maximum characters in the name of a CC algorithm
164*5e3eaea3SApple OSS Distributions  */
165*5e3eaea3SApple OSS Distributions #define TCP_CA_NAME_MAX 16
166*5e3eaea3SApple OSS Distributions 
167*5e3eaea3SApple OSS Distributions extern int tcp_recv_bg;
168*5e3eaea3SApple OSS Distributions extern uint32_t bg_ss_fltsz;
169*5e3eaea3SApple OSS Distributions 
170*5e3eaea3SApple OSS Distributions /*
171*5e3eaea3SApple OSS Distributions  * Structure to hold definition various actions defined by a congestion
172*5e3eaea3SApple OSS Distributions  * control algorithm for TCP. This can be used to change the congestion
173*5e3eaea3SApple OSS Distributions  * control on a connection based on the user settings of priority of a
174*5e3eaea3SApple OSS Distributions  * connection.
175*5e3eaea3SApple OSS Distributions  */
176*5e3eaea3SApple OSS Distributions struct tcp_cc_algo {
177*5e3eaea3SApple OSS Distributions 	char name[TCP_CA_NAME_MAX];
178*5e3eaea3SApple OSS Distributions 	_Atomic uint32_t num_sockets;
179*5e3eaea3SApple OSS Distributions 	uint32_t flags;
180*5e3eaea3SApple OSS Distributions 
181*5e3eaea3SApple OSS Distributions 	/* init the congestion algorithm for the specified control block */
182*5e3eaea3SApple OSS Distributions 	int (*init) (struct tcpcb *tp);
183*5e3eaea3SApple OSS Distributions 
184*5e3eaea3SApple OSS Distributions 	/*
185*5e3eaea3SApple OSS Distributions 	 * cleanup any state that is stored in the connection
186*5e3eaea3SApple OSS Distributions 	 * related to the algorithm
187*5e3eaea3SApple OSS Distributions 	 */
188*5e3eaea3SApple OSS Distributions 	int (*cleanup) (struct tcpcb *tp);
189*5e3eaea3SApple OSS Distributions 
190*5e3eaea3SApple OSS Distributions 	/* initialize cwnd at the start of a connection */
191*5e3eaea3SApple OSS Distributions 	void (*cwnd_init) (struct tcpcb *tp);
192*5e3eaea3SApple OSS Distributions 
193*5e3eaea3SApple OSS Distributions 	/*
194*5e3eaea3SApple OSS Distributions 	 * called on the receipt of in-sequence ack during congestion
195*5e3eaea3SApple OSS Distributions 	 * avoidance phase
196*5e3eaea3SApple OSS Distributions 	 */
197*5e3eaea3SApple OSS Distributions 	void (*congestion_avd) (struct tcpcb *tp, struct tcphdr *th);
198*5e3eaea3SApple OSS Distributions 
199*5e3eaea3SApple OSS Distributions 	/* called on the receipt of a valid ack */
200*5e3eaea3SApple OSS Distributions 	void (*ack_rcvd) (struct tcpcb *tp, struct tcphdr *th);
201*5e3eaea3SApple OSS Distributions 
202*5e3eaea3SApple OSS Distributions 	/* called before entering FR */
203*5e3eaea3SApple OSS Distributions 	void (*pre_fr) (struct tcpcb *tp);
204*5e3eaea3SApple OSS Distributions 
205*5e3eaea3SApple OSS Distributions 	/*  after exiting FR */
206*5e3eaea3SApple OSS Distributions 	void (*post_fr) (struct tcpcb *tp, struct tcphdr *th);
207*5e3eaea3SApple OSS Distributions 
208*5e3eaea3SApple OSS Distributions 	/* perform tasks when data transfer resumes after an idle period */
209*5e3eaea3SApple OSS Distributions 	void (*after_idle) (struct tcpcb *tp);
210*5e3eaea3SApple OSS Distributions 
211*5e3eaea3SApple OSS Distributions 	/* perform tasks when the connection's retransmit timer expires */
212*5e3eaea3SApple OSS Distributions 	void (*after_timeout) (struct tcpcb *tp);
213*5e3eaea3SApple OSS Distributions 
214*5e3eaea3SApple OSS Distributions 	/* Whether or not to delay the ack */
215*5e3eaea3SApple OSS Distributions 	int (*delay_ack)(struct tcpcb *tp, struct tcphdr *th);
216*5e3eaea3SApple OSS Distributions 
217*5e3eaea3SApple OSS Distributions 	/* Switch a connection to this CC algorithm after sending some packets */
218*5e3eaea3SApple OSS Distributions 	void (*switch_to)(struct tcpcb *tp);
219*5e3eaea3SApple OSS Distributions } __attribute__((aligned(4)));
220*5e3eaea3SApple OSS Distributions 
221*5e3eaea3SApple OSS Distributions extern struct tcp_cc_algo* tcp_cc_algo_list[TCP_CC_ALGO_COUNT];
222*5e3eaea3SApple OSS Distributions 
223*5e3eaea3SApple OSS Distributions #define CC_ALGO(tp) (tcp_cc_algo_list[tp->tcp_cc_index])
224*5e3eaea3SApple OSS Distributions #define TCP_CC_CWND_INIT_PKTS 10
225*5e3eaea3SApple OSS Distributions #define TCP_CC_CWND_INIT_BYTES  4380
226*5e3eaea3SApple OSS Distributions /*
227*5e3eaea3SApple OSS Distributions  * The congestion window will have to be reset after a
228*5e3eaea3SApple OSS Distributions  * non-validated period -- currently set to 3 minutes
229*5e3eaea3SApple OSS Distributions  */
230*5e3eaea3SApple OSS Distributions #define TCP_CC_CWND_NONVALIDATED_PERIOD (3 * 60 * TCP_RETRANSHZ)
231*5e3eaea3SApple OSS Distributions 
232*5e3eaea3SApple OSS Distributions /* Less than BE congestion control algo for receive window */
233*5e3eaea3SApple OSS Distributions struct tcp_rcv_cc_algo {
234*5e3eaea3SApple OSS Distributions 	char name[TCP_CA_NAME_MAX];
235*5e3eaea3SApple OSS Distributions 	_Atomic uint32_t num_sockets;
236*5e3eaea3SApple OSS Distributions 	uint32_t flags;
237*5e3eaea3SApple OSS Distributions 
238*5e3eaea3SApple OSS Distributions 	/* init the congestion algorithm for the specified control block */
239*5e3eaea3SApple OSS Distributions 	void (*init) (struct tcpcb *tp);
240*5e3eaea3SApple OSS Distributions 
241*5e3eaea3SApple OSS Distributions 	/*
242*5e3eaea3SApple OSS Distributions 	 * cleanup any state that is stored in the connection
243*5e3eaea3SApple OSS Distributions 	 * related to the algorithm
244*5e3eaea3SApple OSS Distributions 	 */
245*5e3eaea3SApple OSS Distributions 	void (*cleanup) (struct tcpcb *tp);
246*5e3eaea3SApple OSS Distributions 
247*5e3eaea3SApple OSS Distributions 	/* initialize rwnd at the start of a connection */
248*5e3eaea3SApple OSS Distributions 	void (*rwnd_init) (struct tcpcb *tp);
249*5e3eaea3SApple OSS Distributions 
250*5e3eaea3SApple OSS Distributions 	/* called on the receipt of valid data */
251*5e3eaea3SApple OSS Distributions 	void (*data_rcvd) (struct tcpcb *tp, struct tcphdr *th,
252*5e3eaea3SApple OSS Distributions 	    struct tcpopt *to, uint32_t segment_len);
253*5e3eaea3SApple OSS Distributions 
254*5e3eaea3SApple OSS Distributions 	uint32_t (*get_rlwin) (struct tcpcb *tp);
255*5e3eaea3SApple OSS Distributions 
256*5e3eaea3SApple OSS Distributions 	/* perform tasks when data transfer resumes after an idle period */
257*5e3eaea3SApple OSS Distributions 	void (*after_idle) (struct tcpcb *tp);
258*5e3eaea3SApple OSS Distributions 
259*5e3eaea3SApple OSS Distributions 	/* called when we switch from foreground to background */
260*5e3eaea3SApple OSS Distributions 	void (*switch_to) (struct tcpcb *tp);
261*5e3eaea3SApple OSS Distributions } __attribute__((aligned(4)));
262*5e3eaea3SApple OSS Distributions 
263*5e3eaea3SApple OSS Distributions extern struct tcp_rcv_cc_algo tcp_cc_rledbat;
264*5e3eaea3SApple OSS Distributions 
265*5e3eaea3SApple OSS Distributions extern void tcp_cc_init(void);
266*5e3eaea3SApple OSS Distributions extern void tcp_cc_resize_sndbuf(struct tcpcb *tp);
267*5e3eaea3SApple OSS Distributions extern void tcp_bad_rexmt_fix_sndbuf(struct tcpcb *tp);
268*5e3eaea3SApple OSS Distributions extern void tcp_cc_cwnd_init_or_reset(struct tcpcb *tp);
269*5e3eaea3SApple OSS Distributions extern int tcp_cc_delay_ack(struct tcpcb *tp, struct tcphdr *th);
270*5e3eaea3SApple OSS Distributions extern void tcp_cc_allocate_state(struct tcpcb *tp);
271*5e3eaea3SApple OSS Distributions extern void tcp_cc_after_idle_stretchack(struct tcpcb *tp);
272*5e3eaea3SApple OSS Distributions extern uint32_t tcp_cc_is_cwnd_nonvalidated(struct tcpcb *tp);
273*5e3eaea3SApple OSS Distributions extern void tcp_cc_adjust_nonvalidated_cwnd(struct tcpcb *tp);
274*5e3eaea3SApple OSS Distributions extern u_int32_t tcp_get_max_pipeack(struct tcpcb *tp);
275*5e3eaea3SApple OSS Distributions extern void tcp_clear_pipeack_state(struct tcpcb *tp);
276*5e3eaea3SApple OSS Distributions 
277*5e3eaea3SApple OSS Distributions static inline uint32_t
tcp_initial_cwnd(struct tcpcb * tp)278*5e3eaea3SApple OSS Distributions tcp_initial_cwnd(struct tcpcb *tp)
279*5e3eaea3SApple OSS Distributions {
280*5e3eaea3SApple OSS Distributions 	if (tcp_cubic_minor_fixes) {
281*5e3eaea3SApple OSS Distributions 		return TCP_CC_CWND_INIT_PKTS * tp->t_maxseg;
282*5e3eaea3SApple OSS Distributions 	} else {
283*5e3eaea3SApple OSS Distributions 		return TCP_CC_CWND_INIT_BYTES;
284*5e3eaea3SApple OSS Distributions 	}
285*5e3eaea3SApple OSS Distributions }
286*5e3eaea3SApple OSS Distributions 
287*5e3eaea3SApple OSS Distributions #endif /* KERNEL_PRIVATE */
288*5e3eaea3SApple OSS Distributions #endif /* _NETINET_CC_H_ */
289