1.\" 2.\" Copyright (c) 2010-2011 The FreeBSD Foundation 3.\" 4.\" This documentation was written at the Centre for Advanced Internet 5.\" Architectures, Swinburne University of Technology, Melbourne, Australia by 6.\" David Hayes under sponsorship from the FreeBSD Foundation. 7.\" 8.\" Redistribution and use in source and binary forms, with or without 9.\" modification, are permitted provided that the following conditions 10.\" are met: 11.\" 1. Redistributions of source code must retain the above copyright 12.\" notice, this list of conditions and the following disclaimer. 13.\" 2. Redistributions in binary form must reproduce the above copyright 14.\" notice, this list of conditions and the following disclaimer in the 15.\" documentation and/or other materials provided with the distribution. 16.\" 17.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 18.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR 21.\" ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27.\" SUCH DAMAGE. 28.\" 29.\" $FreeBSD$ 30.\" 31.Dd January 18, 2012 32.Dt H_ERTT 4 33.Os 34.Sh NAME 35.Nm h_ertt 36.Nd Enhanced Round Trip Time Khelp module 37.Sh SYNOPSIS 38.In netinet/khelp/h_ertt.h 39.Sh DESCRIPTION 40The 41.Nm 42Khelp module works within the 43.Xr khelp 9 44framework to provide TCP with a per-connection, low noise estimate of the 45instantaneous RTT. 46The implementation attempts to be robust in the face of delayed 47acknowledgements, TCP Segmentation Offload (TSO), receivers who manipulate TCP 48timestamps and lack of the TCP timestamp option altogether. 49.Pp 50TCP receivers using delayed acknowledgements either acknowledge every second packet 51(reflecting the time stamp of the first) or use a timeout to trigger the 52acknowledgement if no second packet arrives. 53If the heuristic used by 54.Nm 55determines that the receiver is using delayed acknowledgements, it measures the 56RTT using the second packet (the one that triggers the acknowledgement). 57It does not measure the RTT if the acknowledgement is for the 58first packet, since it cannot be accurately determined. 59.Pp 60When TSO is in use, 61.Nm 62will momentarily disable TSO whilst marking a packet to use for a new 63measurement. 64The process has negligible impact on the connection. 65.Pp 66.Nm 67associates the following struct with each connection's TCP control block: 68.Bd -literal 69struct ertt { 70 TAILQ_HEAD(txseginfo_head, txseginfo) txsegi_q; /* Private. */ 71 long bytes_tx_in_rtt; /* Private. */ 72 long bytes_tx_in_marked_rtt; 73 unsigned long marked_snd_cwnd; 74 int rtt; 75 int maxrtt; 76 int minrtt; 77 int dlyack_rx; /* Private. */ 78 int timestamp_errors; /* Private. */ 79 int markedpkt_rtt; /* Private. */ 80 uint32_t flags; 81}; 82.Ed 83.Pp 84The fields marked as private should not be manipulated by any code outside of 85the 86.Nm 87implementation. 88The non-private fields provide the following data: 89.Bl -tag -width ".Va bytes_tx_in_marked_rtt" -offset indent 90.It Va bytes_tx_in_marked_rtt 91The number of bytes transmitted in the 92.Va markedpkt_rtt . 93.It Va marked_snd_cwnd 94The value of cwnd for the marked rtt measurement. 95.It Va rtt 96The most recent RTT measurement. 97.It Va maxrtt 98The longest RTT measurement that has been taken. 99.It Va minrtt 100The shortest RTT measurement that has been taken. 101.It Va flags 102The ERTT_NEW_MEASUREMENT flag will be set by the implementation when a new 103measurement is available. 104It is the responsibility of 105.Nm 106consumers to unset the flag if they wish to use it as a notification method for 107new measurements. 108.El 109.Sh SEE ALSO 110.Xr cc_chd 4 , 111.Xr cc_hd 4 , 112.Xr cc_vegas 4 , 113.Xr mod_cc 4 , 114.Xr hhook 9 , 115.Xr khelp 9 116.Sh ACKNOWLEDGEMENTS 117Development and testing of this software were made possible in part by grants 118from the FreeBSD Foundation and Cisco University Research Program Fund at 119Community Foundation Silicon Valley. 120.Sh HISTORY 121The 122.Nm 123module first appeared in 124.Fx 9.0 . 125.Pp 126The module was first released in 2010 by David Hayes whilst working on the 127NewTCP research project at Swinburne University of Technology's Centre for 128Advanced Internet Architectures, Melbourne, Australia. 129More details are available at: 130.Pp 131http://caia.swin.edu.au/urp/newtcp/ 132.Sh AUTHORS 133.An -nosplit 134The 135.Nm 136Khelp module and this manual page were written by 137.An David Hayes Aq Mt david.hayes@ieee.org . 138.Sh BUGS 139The module maintains enhanced RTT estimates for all new TCP connections created 140after the time at which the module was loaded. 141It might be beneficial to see if it is possible to have the module only affect 142connections which actually care about ERTT estimates. 143