xref: /freebsd/sys/netinet/khelp/h_ertt.h (revision 405c3050f102b8c74782f0366c8ead927bd07b68)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3  *
4  * Copyright (c) 2009-2010
5  * 	Swinburne University of Technology, Melbourne, Australia
6  * Copyright (c) 2010 Lawrence Stewart <lstewart@freebsd.org>
7  * All rights reserved.
8  *
9  * This software was developed at the Centre for Advanced Internet
10  * Architectures, Swinburne University of Technology, by David Hayes, made
11  * possible in part by a grant from the Cisco University Research Program Fund
12  * at Community Foundation Silicon Valley.
13  *
14  * Redistribution and use in source and binary forms, with or without
15  * modification, are permitted provided that the following conditions
16  * are met:
17  * 1. Redistributions of source code must retain the above copyright
18  *    notice, this list of conditions and the following disclaimer.
19  * 2. Redistributions in binary form must reproduce the above copyright
20  *    notice, this list of conditions and the following disclaimer in the
21  *    documentation and/or other materials provided with the distribution.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
24  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
27  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33  * SUCH DAMAGE.
34  *
35  * $FreeBSD$
36  */
37 
38 /*
39  * The ERTT (Enhanced Round Trip Time) Khelp module calculates an estimate of
40  * the instantaneous TCP RTT which, for example, is used by delay-based
41  * congestion control schemes. When the module is loaded, ERTT data is
42  * calculated for each active TCP connection and encapsulated within a
43  * "struct ertt".
44  *
45  * This software was first released in 2010 by David Hayes and Lawrence Stewart
46  * whilst working on the NewTCP research project at Swinburne University of
47  * Technology's Centre for Advanced Internet Architectures, Melbourne,
48  * Australia, which was made possible in part by a grant from the Cisco
49  * University Research Program Fund at Community Foundation Silicon Valley.
50  * Testing and development was further assisted by a grant from the FreeBSD
51  * Foundation. More details are available at:
52  *   http://caia.swin.edu.au/urp/newtcp/
53  */
54 
55 #ifndef	_NETINET_KHELP_H_ERTT_
56 #define	_NETINET_KHELP_H_ERTT_
57 
58 struct txseginfo;
59 
60 /* Structure used as the ertt data block. */
61 struct ertt {
62 	/* Information about transmitted segments to aid in RTT calculation. */
63 	TAILQ_HEAD(txseginfo_head, txseginfo) txsegi_q;
64 	/* Bytes TX so far in marked RTT. */
65 	long		bytes_tx_in_rtt;
66 	/* Final version of above. */
67 	long		bytes_tx_in_marked_rtt;
68 	/* cwnd for marked RTT. */
69 	unsigned long	marked_snd_cwnd;
70 	/* Per-packet measured RTT. */
71 	int		rtt;
72 	/* Maximum RTT measured. */
73 	int		maxrtt;
74 	/* Minimum RTT measured. */
75 	int		minrtt;
76 	/* Guess if the receiver is using delayed ack. */
77 	int		dlyack_rx;
78 	/* Keep track of inconsistencies in packet timestamps. */
79 	int		timestamp_errors;
80 	/* RTT for a marked packet. */
81 	int		markedpkt_rtt;
82 	/* Flags to signal conditions between hook function calls. */
83 	uint32_t	flags;
84 };
85 
86 /* Flags for struct ertt. */
87 #define	ERTT_NEW_MEASUREMENT		0x01
88 #define	ERTT_MEASUREMENT_IN_PROGRESS	0x02
89 #define	ERTT_TSO_DISABLED		0x04
90 
91 #endif /* _NETINET_KHELP_H_ERTT_ */
92