Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-6]: src/sys/netinet Pull up revision 1.85 (requested by thorpej...



details:   https://anonhg.NetBSD.org/src/rev/f4b76f33bdf2
branches:  netbsd-1-6
changeset: 529419:f4b76f33bdf2
user:      he <he%NetBSD.org@localhost>
date:      Thu Nov 21 17:48:00 2002 +0000

description:
Pull up revision 1.85 (requested by thorpej in ticket #707):
  Never send more than half a socket buffer of data in a
  segment.  This ensures that we can always keep 2 packets
  on the wire, and we will therefore not cause any delayed
  ACKs.  Otherwise, this causes performance problems when
  using large-MTU interfaces, such as the loopback interface.

diffstat:

 sys/netinet/tcp_output.c |  22 ++++++++++++++++++----
 1 files changed, 18 insertions(+), 4 deletions(-)

diffs (61 lines):

diff -r 404795bd2b47 -r f4b76f33bdf2 sys/netinet/tcp_output.c
--- a/sys/netinet/tcp_output.c  Tue Nov 19 21:45:13 2002 +0000
+++ b/sys/netinet/tcp_output.c  Thu Nov 21 17:48:00 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tcp_output.c,v 1.79.4.1 2002/06/14 17:32:59 lukem Exp $        */
+/*     $NetBSD: tcp_output.c,v 1.79.4.2 2002/11/21 17:48:00 he Exp $   */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -142,7 +142,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcp_output.c,v 1.79.4.1 2002/06/14 17:32:59 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_output.c,v 1.79.4.2 2002/11/21 17:48:00 he Exp $");
 
 #include "opt_inet.h"
 #include "opt_ipsec.h"
@@ -228,6 +228,7 @@
 #ifdef INET6
        struct in6pcb *in6p = tp->t_in6pcb;
 #endif
+       struct socket *so;
        struct rtentry *rt;
        struct ifnet *ifp;
        int size;
@@ -256,12 +257,16 @@
 
        rt = NULL;
 #ifdef INET
-       if (inp)
+       if (inp) {
                rt = in_pcbrtentry(inp);
+               so = inp->inp_socket;
+       }
 #endif
 #ifdef INET6
-       if (in6p)
+       if (in6p) {
                rt = in6_pcbrtentry(in6p);
+               so = in6p->in6p_socket;
+       }
 #endif
        if (rt == NULL) {
                size = tcp_mssdflt;
@@ -347,6 +352,15 @@
         * I'm not quite sure about this (could someone comment).
         */
        *txsegsizep = min(tp->t_peermss - optlen, size);
+       /*
+        * Never send more than half a buffer full.  This insures that we can
+        * always keep 2 packets on the wire, no matter what SO_SNDBUF is, and
+        * therefore ACKs will never be delayed unless we run out of data to
+        * transmit.
+        */
+       if (so)
+               *txsegsizep = min((so->so_snd.sb_hiwat >> 1) - optlen,
+                   *txsegsizep);
        *rxsegsizep = min(tp->t_ourmss - optlen, size);
 
        if (*txsegsizep != tp->t_segsz) {



Home | Main Index | Thread Index | Old Index