From 6b067b07449e88aa8cf3bad1a80b370baf544b3c Mon Sep 17 00:00:00 2001 From: David Greenman Date: Thu, 11 May 1995 01:41:06 +0000 Subject: [PATCH] #ifdef'd my Nagel/ACK hack with "TCP_ACK_HACK", disabled by default. I'm currently considering reducing the TCP fasttimo to 100ms to help improve things, but this would be done as a seperate step at some point in the future. This was done because it was causing some sometimes serious performance problems with T/TCP. --- sys/netinet/tcp_input.c | 25 ++++++++++++++++++++++++- sys/netinet/tcp_reass.c | 25 ++++++++++++++++++++++++- 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index c074d4f6a183..47fd0188ecab 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * From: @(#)tcp_input.c 8.5 (Berkeley) 4/10/94 - * $Id: tcp_input.c,v 1.22 1995/05/03 07:16:52 davidg Exp $ + * $Id: tcp_input.c,v 1.23 1995/05/09 12:32:06 olah Exp $ */ #ifndef TUBA_INCLUDE @@ -84,6 +84,7 @@ struct inpcbinfo tcbinfo; * Set DELACK for segments received in order, but ack immediately * when segments are out of order (so fast retransmit can work). */ +#ifdef TCP_ACK_HACK #define TCP_REASS(tp, ti, m, so, flags) { \ if ((ti)->ti_seq == (tp)->rcv_nxt && \ (tp)->seg_next == (struct tcpiphdr *)(tp) && \ @@ -103,6 +104,24 @@ struct inpcbinfo tcbinfo; tp->t_flags |= TF_ACKNOW; \ } \ } +#else +#define TCP_REASS(tp, ti, m, so, flags) { \ + if ((ti)->ti_seq == (tp)->rcv_nxt && \ + (tp)->seg_next == (struct tcpiphdr *)(tp) && \ + (tp)->t_state == TCPS_ESTABLISHED) { \ + tp->t_flags |= TF_DELACK; \ + (tp)->rcv_nxt += (ti)->ti_len; \ + flags = (ti)->ti_flags & TH_FIN; \ + tcpstat.tcps_rcvpack++;\ + tcpstat.tcps_rcvbyte += (ti)->ti_len;\ + sbappend(&(so)->so_rcv, (m)); \ + sorwakeup(so); \ + } else { \ + (flags) = tcp_reass((tp), (ti), (m)); \ + tp->t_flags |= TF_ACKNOW; \ + } \ +} +#endif #ifndef TUBA_INCLUDE int @@ -531,6 +550,7 @@ findpcb: */ sbappend(&so->so_rcv, m); sorwakeup(so); +#ifdef TCP_ACK_HACK /* * If this is a short packet, then ACK now - with Nagel * congestion avoidance sender won't send more until @@ -542,6 +562,9 @@ findpcb: } else { tp->t_flags |= TF_DELACK; } +#else + tp->t_flags |= TF_DELACK; +#endif return; } } diff --git a/sys/netinet/tcp_reass.c b/sys/netinet/tcp_reass.c index c074d4f6a183..47fd0188ecab 100644 --- a/sys/netinet/tcp_reass.c +++ b/sys/netinet/tcp_reass.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * From: @(#)tcp_input.c 8.5 (Berkeley) 4/10/94 - * $Id: tcp_input.c,v 1.22 1995/05/03 07:16:52 davidg Exp $ + * $Id: tcp_input.c,v 1.23 1995/05/09 12:32:06 olah Exp $ */ #ifndef TUBA_INCLUDE @@ -84,6 +84,7 @@ struct inpcbinfo tcbinfo; * Set DELACK for segments received in order, but ack immediately * when segments are out of order (so fast retransmit can work). */ +#ifdef TCP_ACK_HACK #define TCP_REASS(tp, ti, m, so, flags) { \ if ((ti)->ti_seq == (tp)->rcv_nxt && \ (tp)->seg_next == (struct tcpiphdr *)(tp) && \ @@ -103,6 +104,24 @@ struct inpcbinfo tcbinfo; tp->t_flags |= TF_ACKNOW; \ } \ } +#else +#define TCP_REASS(tp, ti, m, so, flags) { \ + if ((ti)->ti_seq == (tp)->rcv_nxt && \ + (tp)->seg_next == (struct tcpiphdr *)(tp) && \ + (tp)->t_state == TCPS_ESTABLISHED) { \ + tp->t_flags |= TF_DELACK; \ + (tp)->rcv_nxt += (ti)->ti_len; \ + flags = (ti)->ti_flags & TH_FIN; \ + tcpstat.tcps_rcvpack++;\ + tcpstat.tcps_rcvbyte += (ti)->ti_len;\ + sbappend(&(so)->so_rcv, (m)); \ + sorwakeup(so); \ + } else { \ + (flags) = tcp_reass((tp), (ti), (m)); \ + tp->t_flags |= TF_ACKNOW; \ + } \ +} +#endif #ifndef TUBA_INCLUDE int @@ -531,6 +550,7 @@ findpcb: */ sbappend(&so->so_rcv, m); sorwakeup(so); +#ifdef TCP_ACK_HACK /* * If this is a short packet, then ACK now - with Nagel * congestion avoidance sender won't send more until @@ -542,6 +562,9 @@ findpcb: } else { tp->t_flags |= TF_DELACK; } +#else + tp->t_flags |= TF_DELACK; +#endif return; } }