This patch adds a new socket option TCP_DELACK, which
disables the sending of delayed acks altogether on
that socket connection. Built against 2.4.9.
This was to test with and play with, more than anything
else, but figured others might be interested. Possibly
useful in improving performance in the small packet and
highly interactive app environment.
Arguments to include it in the source tree:
- possibly better performance in certain environments
- _very_ convenient for academic, benchmarking, and certain
other environments to use
- portability: its available on some other OS's, and
so some apps that make use of it might want to continue
to use it on Linux when ported here..
- makes the tcp engine more configurable based on what the
user wants to do, and the easier it is to fiddle with things,
the more learning, innovation that happens on the OS, and
I'd like to encourage that happening on Linux ;)
- somewhat the same rationale behind allowing the users to
to disable delayed sends (TCP_NODELAY)
Cons:
- feature bloat (but its small, minimized diffs)
- makes the tcp engine more configurable based on what the
user wants to do, but the user needs to know what they're
doing, given extra ack load (but ditto with other options, really)
I'd be interested in hearing if others found it useful,
or have any comments or feedback..
thanks,
Nivedita
-----
diff -urN linux-2.4.9/include/linux/tcp.h linux-2.4.9-da2/include/linux/tcp.h
--- linux-2.4.9/include/linux/tcp.h Wed Aug 15 14:21:32 2001
+++ linux-2.4.9-da2/include/linux/tcp.h Sat Aug 25 10:44:01 2001
@@ -127,6 +127,7 @@
#define TCP_WINDOW_CLAMP 10 /* Bound advertised window */
#define TCP_INFO 11 /* Information about this connection. */
#define TCP_QUICKACK 12 /* Block/reenable quick acks */
+#define TCP_NODELACK 13 /* Disable delayed acks */
#define TCPI_OPT_TIMESTAMPS 1
#define TCPI_OPT_SACK 2
diff -urN linux-2.4.9/include/net/sock.h linux-2.4.9-da2/include/net/sock.h
--- linux-2.4.9/include/net/sock.h Wed Aug 15 14:21:32 2001
+++ linux-2.4.9-da2/include/net/sock.h Sat Aug 25 10:44:01 2001
@@ -278,6 +278,7 @@
__u32 lrcvtime; /* timestamp of last received data
packet*/
__u16 last_seg_size; /* Size of last incoming segment
*/
__u16 rcv_mss; /* MSS used for delayed ACK decisions
*/
+ __u8 no_delack; /* no delayed acks at all */
} ack;
/* Data for direct copy to user */
diff -urN linux-2.4.9/net/ipv4/tcp.c linux-2.4.9-da2/net/ipv4/tcp.c
--- linux-2.4.9/net/ipv4/tcp.c Wed Aug 15 01:22:17 2001
+++ linux-2.4.9-da2/net/ipv4/tcp.c Sat Aug 25 11:11:48 2001
@@ -2305,6 +2305,10 @@
}
break;
+ case TCP_NODELACK:
+ tp->ack.no_delack = val > 0;
+ break;
+
default:
err = -ENOPROTOOPT;
break;
@@ -2431,6 +2435,10 @@
case TCP_QUICKACK:
val = !tp->ack.pingpong;
break;
+ case TCP_NODELACK:
+ val = tp->ack.no_delack;
+ break;
+
default:
return -ENOPROTOOPT;
};
diff -urN linux-2.4.9/net/ipv4/tcp_input.c linux-2.4.9-da2/net/ipv4/tcp_input.c
--- linux-2.4.9/net/ipv4/tcp_input.c Wed Aug 15 01:22:17 2001
+++ linux-2.4.9-da2/net/ipv4/tcp_input.c Sat Aug 25 10:44:01 2001
@@ -3015,7 +3015,8 @@
struct tcp_opt *tp = &(sk->tp_pinfo.af_tcp);
/* More than one full frame received... */
- if (((tp->rcv_nxt - tp->rcv_wup) > tp->ack.rcv_mss
+ if (tp->ack.no_delack ||
+ ((tp->rcv_nxt - tp->rcv_wup) > tp->ack.rcv_mss
/* ... and right edge of window advances far enough.
* (tcp_recvmsg() will send ACK otherwise). Or...
*/
@@ -3351,7 +3352,8 @@
}
if (eaten) {
- if (tcp_in_quickack_mode(tp)) {
+ if (tp->ack.no_delack ||
+ tcp_in_quickack_mode(tp)) {
tcp_send_ack(sk);
} else {
tcp_send_delayed_ack(sk);
|