diff options
Diffstat (limited to 'sys/netinet')
-rw-r--r-- | sys/netinet/tcp_input.c | 29 | ||||
-rw-r--r-- | sys/netinet/tcp_subr.c | 7 | ||||
-rw-r--r-- | sys/netinet/tcp_usrreq.c | 5 | ||||
-rw-r--r-- | sys/netinet/tcp_var.h | 7 |
4 files changed, 33 insertions, 15 deletions
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 85074de4cd5..60394196464 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_input.c,v 1.105 2002/03/01 22:29:29 provos Exp $ */ +/* $OpenBSD: tcp_input.c,v 1.106 2002/03/02 00:44:52 provos Exp $ */ /* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */ /* @@ -142,6 +142,21 @@ 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). + * We also ACK immediately if we received a PUSH and the ACK-on-PUSH + * option is enabled. + */ +#define TCP_SETUP_ACK(tp, th) \ +do { \ + if ((tp)->t_flags & TF_DELACK || \ + (tcp_ack_on_push && (th)->th_flags & TH_PUSH)) \ + tp->t_flags |= TF_ACKNOW; \ + else \ + TCP_SET_DELACK(tp); \ +} while (0) + +/* * Insert segment ti into reassembly queue of tcp with * control block tp. Return TH_FIN if reassembly now includes * a segment with FIN. The macro form does the common case inline @@ -992,13 +1007,12 @@ findpcb: * Drop TCP, IP headers and TCP options then add data * to socket buffer. */ - if (th->th_flags & TH_PUSH) - tp->t_flags |= TF_ACKNOW; - else - TCP_SET_DELACK(tp); m_adj(m, iphlen + off); sbappend(&so->so_rcv, m); sorwakeup(so); + TCP_SETUP_ACK(tp, th); + if (tp->t_flags & TF_ACKNOW) + (void) tcp_output(tp); return; } } @@ -1978,10 +1992,7 @@ dodata: /* XXX */ TCPS_HAVERCVDFIN(tp->t_state) == 0) { if (th->th_seq == tp->rcv_nxt && tp->segq.lh_first == NULL && tp->t_state == TCPS_ESTABLISHED) { - if (th->th_flags & TH_PUSH) - tp->t_flags |= TF_ACKNOW; - else - TCP_SET_DELACK(tp); + TCP_SETUP_ACK(tp, th); tp->rcv_nxt += tlen; tiflags = th->th_flags & TH_FIN; tcpstat.tcps_rcvpack++; diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 16b87a19c38..77e5d4def27 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_subr.c,v 1.58 2002/03/01 22:29:29 provos Exp $ */ +/* $OpenBSD: tcp_subr.c,v 1.59 2002/03/02 00:44:52 provos Exp $ */ /* $NetBSD: tcp_subr.c,v 1.22 1996/02/13 23:44:00 christos Exp $ */ /* @@ -123,7 +123,7 @@ int tcp_rttdflt = TCPTV_SRTTDFLT / PR_SLOWHZ; #ifndef TCP_DO_RFC1323 #define TCP_DO_RFC1323 1 #endif -int tcp_do_rfc1323 = TCP_DO_RFC1323; +int tcp_do_rfc1323 = TCP_DO_RFC1323; #ifndef TCP_DO_SACK #ifdef TCP_SACK @@ -132,7 +132,8 @@ int tcp_do_rfc1323 = TCP_DO_RFC1323; #define TCP_DO_SACK 0 #endif #endif -int tcp_do_sack = TCP_DO_SACK; /* RFC 2018 selective ACKs */ +int tcp_do_sack = TCP_DO_SACK; /* RFC 2018 selective ACKs */ +int tcp_ack_on_push = 0; /* set to enable immediate ACK-on-PUSH */ #ifndef TCBHASHSIZE #define TCBHASHSIZE 128 diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index fa505bba5ab..d461a000965 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_usrreq.c,v 1.56 2002/02/15 20:45:32 nordin Exp $ */ +/* $OpenBSD: tcp_usrreq.c,v 1.57 2002/03/02 00:44:52 provos Exp $ */ /* $NetBSD: tcp_usrreq.c,v 1.20 1996/02/13 23:44:16 christos Exp $ */ /* @@ -929,6 +929,9 @@ tcp_sysctl(name, namelen, oldp, oldlenp, newp, newlen) case TCPCTL_RSTPPSLIMIT: return (sysctl_int(oldp, oldlenp, newp, newlen, &tcp_rst_ppslim)); + case TCPCTL_ACK_ON_PUSH: + return (sysctl_int(oldp, oldlenp, newp, newlen, + &tcp_ack_on_push)); default: return (ENOPROTOOPT); } diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index f77f3ab0eb9..fd919eb3116 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_var.h,v 1.39 2002/03/01 22:29:29 provos Exp $ */ +/* $OpenBSD: tcp_var.h,v 1.40 2002/03/02 00:44:52 provos Exp $ */ /* $NetBSD: tcp_var.h,v 1.17 1996/02/13 23:44:24 christos Exp $ */ /* @@ -323,7 +323,8 @@ struct tcpstat { #define TCPCTL_SACK 10 /* selective acknowledgement, rfc 2018 */ #define TCPCTL_MSSDFLT 11 /* Default maximum segment size */ #define TCPCTL_RSTPPSLIMIT 12 /* RST pps limit */ -#define TCPCTL_MAXID 13 +#define TCPCTL_ACK_ON_PUSH 13 /* ACK immediately on PUSH */ +#define TCPCTL_MAXID 14 #define TCPCTL_NAMES { \ { 0, 0 }, \ @@ -339,6 +340,7 @@ struct tcpstat { { "sack", CTLTYPE_INT }, \ { "mssdflt", CTLTYPE_INT }, \ { "rstppslimit", CTLTYPE_INT }, \ + { "ackonpush", CTLTYPE_INT }, \ } struct tcp_ident_mapping { @@ -352,6 +354,7 @@ extern struct tcpstat tcpstat; /* tcp statistics */ u_int32_t tcp_now; /* for RFC 1323 timestamps */ extern int tcp_do_rfc1323; /* enabled/disabled? */ extern int tcp_mssdflt; /* default maximum segment size */ +extern int tcp_ack_on_push; /* ACK immediately on PUSH */ #ifdef TCP_SACK extern int tcp_do_sack; /* SACK enabled/disabled */ extern struct pool sackhl_pool; |