summaryrefslogtreecommitdiff
path: root/sys/netinet/tcp_input.c
diff options
context:
space:
mode:
authorNiels Provos <provos@cvs.openbsd.org>2002-08-08 17:07:33 +0000
committerNiels Provos <provos@cvs.openbsd.org>2002-08-08 17:07:33 +0000
commit645bfcfc7a44cb3eef794f55a0f348cdbb48b20c (patch)
tree65348cbbc69a068876bfe2a31a3287f71b482d02 /sys/netinet/tcp_input.c
parent3ab868adf3b73fcb169a2f03c12e12d299f6f672 (diff)
socket buf speedup from thorpej@netbsd, okay art@ ericj@:
Make insertion of data into socket buffers O(C): * Keep pointers to the first and last mbufs of the last record in the socket buffer. * Use the sb_lastrecord pointer in the sbappend*() family of functions to avoid traversing the packet chain to find the last record. * Add a new sbappend_stream() function for stream protocols which guarantee that there will never be more than one record in the socket buffer. This function uses the sb_mbtail pointer to perform the data insertion. Make TCP use sbappend_stream(). On a profiling run, this makes sbappend of a TCP transmission using a 1M socket buffer go from 50% of the time to .02% of the time. Thanks to Bill Sommerfeld and YAMAMOTO Takashi for their debugging assistance!
Diffstat (limited to 'sys/netinet/tcp_input.c')
-rw-r--r--sys/netinet/tcp_input.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
index 5b1e2bb9e33..6bdc83992d0 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_input.c,v 1.117 2002/06/09 16:26:11 itojun Exp $ */
+/* $OpenBSD: tcp_input.c,v 1.118 2002/08/08 17:07:32 provos Exp $ */
/* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */
/*
@@ -300,7 +300,7 @@ present:
if (so->so_state & SS_CANTRCVMORE)
m_freem(q->ipqe_m);
else
- sbappend(&so->so_rcv, q->ipqe_m);
+ sbappendstream(&so->so_rcv, q->ipqe_m);
pool_put(&ipqent_pool, q);
q = nq;
} while (q != NULL && q->ipqe_tcp->th_seq == tp->rcv_nxt);
@@ -1036,7 +1036,7 @@ findpcb:
* to socket buffer.
*/
m_adj(m, iphlen + off);
- sbappend(&so->so_rcv, m);
+ sbappendstream(&so->so_rcv, m);
sorwakeup(so);
TCP_SETUP_ACK(tp, tiflags);
if (tp->t_flags & TF_ACKNOW)
@@ -2115,7 +2115,7 @@ dodata: /* XXX */
tcpstat.tcps_rcvbyte += tlen;
ND6_HINT(tp);
m_adj(m, hdroptlen);
- sbappend(&so->so_rcv, m);
+ sbappendstream(&so->so_rcv, m);
sorwakeup(so);
} else {
m_adj(m, hdroptlen);