H_ERTT(4)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1, nixpkgs unstable

πŸ’… H_ERTT β€” the Enhanced Round Trip Time Khelp module (section 4 of the Kernel Interfaces Manual, bestie) πŸ’…

okay so picture this: you're a TCP connection, you're trying to figure out how long a round trip actually takes, and the universe keeps lying to you. delayed acks? TSO? timestamps that are giving "I made this up"? this module is literally the friend who sees through all of it. ✨


🌸 NAME 🌸

h_ertt β€” Enhanced Round Trip Time Khelp module. that's the whole vibe. πŸŽ€


✨ SYNOPSIS ✨

#include <netinet/khelp/h_ertt.h>

one include. that's it. slay. 🫢


πŸ’– DESCRIPTION πŸ’–

so the h_ertt Khelp module lives inside the khelp(9) framework and hands TCP a per-connection, low noise estimate of the instantaneous RTT. and listen, the implementation is genuinely trying to be robust against a whole list of chaos:

  • delayed acknowledgements 😀
  • TCP Segmentation Offload (TSO)
  • receivers who manipulate TCP timestamps πŸ™ˆ
  • and receivers that just… don't have the TCP timestamp option at all πŸ’€

let's talk about the delayed-ack situation, because it's the messy part. TCP receivers using delayed acknowledgements have two moves: they either acknowledge every second packet (and that ack reflects the time stamp of the first packet πŸ•°οΈ), or they use a timeout to trigger the acknowledgement if no second packet ever shows up. so if the heuristic h_ertt uses determines the receiver is doing delayed acks, it measures the RTT using the second packet β€” the one that actually triggers the acknowledgement. and it does not measure the RTT if the acknowledgement is for the first packet, because ngl, that can't be accurately determined. periodt. 🎯

now for TSO: when TSO is in use, h_ertt will momentarily disable TSO whilst marking a packet to use for a new measurement. and before you panic β€” the process has negligible impact on the connection. it's fine. breathe. 🧚

here's the fun part: h_ertt associates the following struct with each connection's TCP control block:

struct ertt {
        TAILQ_HEAD(txseginfo_head, txseginfo) txsegi_q; /* Private. */
        long            bytes_tx_in_rtt;                /* Private. */
        long            bytes_tx_in_marked_rtt;
        unsigned long   marked_snd_cwnd;
        int             rtt;
        int             maxrtt;
        int             minrtt;
        int             dlyack_rx;                      /* Private. */
        int             timestamp_errors;               /* Private. */
        int             markedpkt_rtt;                  /* Private. */
        uint32_t        flags;
};
⚠️ the fields marked as private should not be manipulated by any code outside of the h_ertt implementation. hands off. no touching. πŸ™…β€β™€οΈ

the non-private fields give you the following data:

  • bytes_tx_in_marked_rtt β€” the number of bytes transmitted in the markedpkt_rtt.
  • marked_snd_cwnd β€” the value of cwnd for the marked rtt measurement.
  • rtt β€” the most recent RTT measurement.
  • maxrtt β€” the longest RTT measurement that has been taken.
  • minrtt β€” the shortest RTT measurement that has been taken.
  • flags β€” the ERTT_NEW_MEASUREMENT flag will be set by the implementation when a new measurement is available. it is the responsibility of h_ertt consumers to unset the flag if they wish to use it as a notification method for new measurements. so like, you gotta clean up after yourself, iykyk πŸ’…

πŸ”₯ SEE ALSO πŸ”₯

cc_chd(4), cc_hd(4), cc_vegas(4), mod_cc(4), hhook(9), khelp(9) β€” go read them, they're all part of the same friend group 🫢


πŸ‘‘ ACKNOWLEDGEMENTS πŸ‘‘

development and testing of this software were made possible in part by grants from the FreeBSD Foundation and Cisco University Research Program Fund at Community Foundation Silicon Valley. absolute icons, honestly. 🌈


πŸ¦‹ HISTORY πŸ¦‹

the h_ertt module first appeared in FreeBSD 9.0. ⭐

the module was first released in 2010 by David Hayes whilst working on the NewTCP research project at Swinburne University of Technology's Centre for Advanced Internet Architectures, Melbourne, Australia. main character energy fr fr. more details are available at:

http://caia.swin.edu.au/urp/newtcp/

πŸ’œ AUTHORS πŸ’œ

the h_ertt Khelp module and this manual page were written by David Hayes <david.hayes@ieee.org>. we stan. πŸŽ€


πŸ’€ BUGS πŸ’€

the module maintains enhanced RTT estimates for all new TCP connections created after the time at which the module was loaded. yep, all of them, whether they asked for it or not πŸ™ˆ. and it might be beneficial to see if it is possible to have the module only affect connections which actually care about ERTT estimates. that's it, that's the note. someone go fix it bestie, I believe in you. 🌸


and that's the whole page! ✨ from the Debian crew β€” this one's dated January 18, 2012 β€” stay noisy, stay low-latency, and remember: every flag accounted for, no cap. πŸ’–πŸ¦‹πŸ“

πŸ“¦ where this page comes from