diff options
author | jan <jan@cvs.openbsd.org> | 2021-02-03 13:40:07 +0000 |
---|---|---|
committer | jan <jan@cvs.openbsd.org> | 2021-02-03 13:40:07 +0000 |
commit | 8c9ccb871c1734cbd3ae22b67b78c3628b9d927f (patch) | |
tree | f707138436cc653009fc4ff6006e8088234c7a2b /sys/netinet | |
parent | 62474d96e54c0bf9d66ba8fdd80e24674d362f50 (diff) |
Turns off the direct ACK on every other segment
The kernel uses a huge amount of processing time for sending ACKs to the sender
on the receiving interface. After receiving a data segment, we send out two
ACKs. The first one in tcp_input() direct after receiving. The second ACK is
send out, after the userland or the sosplice task read some data out of the
socket buffer. Thus, we save some processing time and improve network
performance.
Longer tested by sthen@
OK claudio@
Diffstat (limited to 'sys/netinet')
-rw-r--r-- | sys/netinet/tcp_input.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 1d8fae4c560..d0a02807520 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_input.c,v 1.365 2020/06/19 22:47:22 procter Exp $ */ +/* $OpenBSD: tcp_input.c,v 1.366 2021/02/03 13:40:06 jan Exp $ */ /* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */ /* @@ -165,8 +165,8 @@ do { \ #endif /* - * Macro to compute ACK transmission behavior. Delay the ACK unless - * we have already delayed an ACK (must send an ACK every two segments). + * Macro to compute ACK transmission behavior. Delay the ACK until + * a read from the socket buffer or the delayed ACK timer causes one. * We also ACK immediately if we received a PUSH and the ACK-on-PUSH * option is enabled or when the packet is coming from a loopback * interface. @@ -176,8 +176,7 @@ do { \ struct ifnet *ifp = NULL; \ if (m && (m->m_flags & M_PKTHDR)) \ ifp = if_get(m->m_pkthdr.ph_ifidx); \ - if (TCP_TIMER_ISARMED(tp, TCPT_DELACK) || \ - (tcp_ack_on_push && (tiflags) & TH_PUSH) || \ + if ((tcp_ack_on_push && (tiflags) & TH_PUSH) || \ (ifp && (ifp->if_flags & IFF_LOOPBACK))) \ tp->t_flags |= TF_ACKNOW; \ else \ |