summaryrefslogtreecommitdiff
path: root/sys/netinet/tcp_usrreq.c
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2013-08-12 21:57:17 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2013-08-12 21:57:17 +0000
commitbee789b12305f3c5e594fe03c965e0786969eeb7 (patch)
tree3aa5e06c1aab733f0373558f3ea8e66cc18a011e /sys/netinet/tcp_usrreq.c
parent260fc866468e3fb9f8f739d0c67b72fe8f1c91ac (diff)
Add the TCP socket option TCP_NOPUSH to delay sending the stream.
This is useful to aggregate data in the kernel from multiple sources like writes and socket splicing. It avoids sending small packets. From FreeBSD via David Hill; OK mikeb@ henning@
Diffstat (limited to 'sys/netinet/tcp_usrreq.c')
-rw-r--r--sys/netinet/tcp_usrreq.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
index 4e108d144fe..9fd519615ab 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_usrreq.c,v 1.113 2013/08/06 07:31:48 bluhm Exp $ */
+/* $OpenBSD: tcp_usrreq.c,v 1.114 2013/08/12 21:57:16 bluhm Exp $ */
/* $NetBSD: tcp_usrreq.c,v 1.20 1996/02/13 23:44:16 christos Exp $ */
/*
@@ -532,6 +532,18 @@ tcp_ctloutput(op, so, level, optname, mp)
tp->t_flags &= ~TF_NODELAY;
break;
+ case TCP_NOPUSH:
+ if (m == NULL || m->m_len < sizeof (int))
+ error = EINVAL;
+ else if (*mtod(m, int *))
+ tp->t_flags |= TF_NOPUSH;
+ else if (tp->t_flags & TF_NOPUSH) {
+ tp->t_flags &= ~TF_NOPUSH;
+ if (TCPS_HAVEESTABLISHED(tp->t_state))
+ error = tcp_output(tp);
+ }
+ break;
+
case TCP_MAXSEG:
if (m == NULL || m->m_len < sizeof (int)) {
error = EINVAL;
@@ -605,6 +617,9 @@ tcp_ctloutput(op, so, level, optname, mp)
case TCP_NODELAY:
*mtod(m, int *) = tp->t_flags & TF_NODELAY;
break;
+ case TCP_NOPUSH:
+ *mtod(m, int *) = tp->t_flags & TF_NOPUSH;
+ break;
case TCP_MAXSEG:
*mtod(m, int *) = tp->t_maxseg;
break;