summaryrefslogtreecommitdiff
path: root/sys/netinet
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
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')
-rw-r--r--sys/netinet/tcp_input.c8
-rw-r--r--sys/netinet/tcp_usrreq.c6
2 files changed, 7 insertions, 7 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);
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
index 48704cb5a35..c18409f60bf 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_usrreq.c,v 1.63 2002/06/09 16:26:11 itojun Exp $ */
+/* $OpenBSD: tcp_usrreq.c,v 1.64 2002/08/08 17:07:32 provos Exp $ */
/* $NetBSD: tcp_usrreq.c,v 1.20 1996/02/13 23:44:16 christos Exp $ */
/*
@@ -409,7 +409,7 @@ tcp_usrreq(so, req, m, nam, control)
* marker if URG set. Possibly send more data.
*/
case PRU_SEND:
- sbappend(&so->so_snd, m);
+ sbappendstream(&so->so_snd, m);
error = tcp_output(tp);
break;
@@ -457,7 +457,7 @@ tcp_usrreq(so, req, m, nam, control)
* of data past the urgent section.
* Otherwise, snd_up should be one lower.
*/
- sbappend(&so->so_snd, m);
+ sbappendstream(&so->so_snd, m);
tp->snd_up = tp->snd_una + so->so_snd.sb_cc;
tp->t_force = 1;
error = tcp_output(tp);