Turning Off Delayed ACKs

I found this tidbit at http://polygraph.ircache.net/Tips/FreeBSD-2.8/:
Put "options TCP_ACK_HACK" in your kernel config file, and delayed ACKs will be disabled for small packets.

For MSS-sized packets, here's a suggestion given by Mark Allman:

// tcp_output.c

  /*
   * Compare available window to amount of window
   * known to peer (as advertised window less
   * next expected input).  If the difference is at least two
   * max size segments, or at least 50% of the maximum possible
   * window, then want to send a window update to peer.
   */
  if (win > 0) {
    /*
     * "adv" is the amount we can increase the window,
     * taking into account that we are limited by
     * TCP_MAXWIN << tp->rcv_scale.
     */
    long adv = min(win, (long)TCP_MAXWIN << tp->rcv_scale) -
      (tp->rcv_adv - tp->rcv_nxt);

#ifdef NO_DELACK
    /*
     * Changed the 2 * mss to 1 * mss, so we get an ACK sent after every 
     * data packet received.
     */
    if (adv >= (long) (1 * tp->t_maxseg))
#else
    if (adv >= (long) (2 * tp->t_maxseg))
#endif
      goto send;
    if (2 * adv >= (long) so->so_rcv.sb_hiwat)
      goto send;
  }

Other DiRT documents
Author: Michele Clark