xref: /freebsd/sys/netinet/khelp/h_ertt.h (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause
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 
36 /*
37  * The ERTT (Enhanced Round Trip Time) Khelp module calculates an estimate of
38  * the instantaneous TCP RTT which, for example, is used by delay-based
39  * congestion control schemes. When the module is loaded, ERTT data is
40  * calculated for each active TCP connection and encapsulated within a
41  * "struct ertt".
42  *
43  * This software was first released in 2010 by David Hayes and Lawrence Stewart
44  * whilst working on the NewTCP research project at Swinburne University of
45  * Technology's Centre for Advanced Internet Architectures, Melbourne,
46  * Australia, which was made possible in part by a grant from the Cisco
47  * University Research Program Fund at Community Foundation Silicon Valley.
48  * Testing and development was further assisted by a grant from the FreeBSD
49  * Foundation. More details are available at:
50  *   http://caia.swin.edu.au/urp/newtcp/
51  */
52 
53 #ifndef	_NETINET_KHELP_H_ERTT_
54 #define	_NETINET_KHELP_H_ERTT_
55 
56 struct txseginfo;
57 
58 /* Structure used as the ertt data block. */
59 struct ertt {
60 	/* Information about transmitted segments to aid in RTT calculation. */
61 	TAILQ_HEAD(txseginfo_head, txseginfo) txsegi_q;
62 	/* Bytes TX so far in marked RTT. */
63 	long		bytes_tx_in_rtt;
64 	/* Final version of above. */
65 	long		bytes_tx_in_marked_rtt;
66 	/* cwnd for marked RTT. */
67 	unsigned long	marked_snd_cwnd;
68 	/* Per-packet measured RTT. */
69 	int		rtt;
70 	/* Maximum RTT measured. */
71 	int		maxrtt;
72 	/* Minimum RTT measured. */
73 	int		minrtt;
74 	/* Guess if the receiver is using delayed ack. */
75 	int		dlyack_rx;
76 	/* Keep track of inconsistencies in packet timestamps. */
77 	int		timestamp_errors;
78 	/* RTT for a marked packet. */
79 	int		markedpkt_rtt;
80 	/* Flags to signal conditions between hook function calls. */
81 	uint32_t	flags;
82 };
83 
84 /* Flags for struct ertt. */
85 #define	ERTT_NEW_MEASUREMENT		0x01
86 #define	ERTT_MEASUREMENT_IN_PROGRESS	0x02
87 #define	ERTT_TSO_DISABLED		0x04
88 
89 #endif /* _NETINET_KHELP_H_ERTT_ */
90