1/*-
2 * Copyright (c) 2009-2010
3 * 	Swinburne University of Technology, Melbourne, Australia
4 * Copyright (c) 2010 Lawrence Stewart <lstewart@freebsd.org>
5 * All rights reserved.
6 *
7 * This software was developed at the Centre for Advanced Internet
8 * Architectures, Swinburne University of Technology, by David Hayes, made
9 * possible in part by a grant from the Cisco University Research Program Fund
10 * at Community Foundation Silicon Valley.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 *    notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 *    notice, this list of conditions and the following disclaimer in the
19 *    documentation and/or other materials provided with the distribution.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * $FreeBSD$
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
56struct txseginfo;
57
58/* Structure used as the ertt data block. */
59struct 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