Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netinet Never send more than half a socket buffer of dat...
details: https://anonhg.NetBSD.org/src/rev/1fc00c41001b
branches: trunk
changeset: 535512:1fc00c41001b
user: thorpej <thorpej%NetBSD.org@localhost>
date: Tue Aug 20 16:29:42 2002 +0000
description:
Never send more than half a socket buffer of data. 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. The problem is quite easy to tickle when the MTU of the
outgoing interface is larger than the socket buffer size (e.g. loopback).
Fix from Charles Hannum.
diffstat:
sys/netinet/tcp_output.c | 22 ++++++++++++++++++----
1 files changed, 18 insertions(+), 4 deletions(-)
diffs (61 lines):
diff -r 8fa8889237a6 -r 1fc00c41001b sys/netinet/tcp_output.c
--- a/sys/netinet/tcp_output.c Tue Aug 20 16:25:51 2002 +0000
+++ b/sys/netinet/tcp_output.c Tue Aug 20 16:29:42 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tcp_output.c,v 1.84 2002/08/14 00:23:34 itojun Exp $ */
+/* $NetBSD: tcp_output.c,v 1.85 2002/08/20 16:29:42 thorpej 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.84 2002/08/14 00:23:34 itojun Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_output.c,v 1.85 2002/08/20 16:29:42 thorpej Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@@ -230,6 +230,7 @@
#ifdef INET6
struct in6pcb *in6p = tp->t_in6pcb;
#endif
+ struct socket *so;
struct rtentry *rt;
struct ifnet *ifp;
int size;
@@ -258,12 +259,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;
@@ -350,6 +355,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