Add a flag, passed to pru_send routines, PRUS_MORETOCOME. This

flag means that there is more data to be put into the socket buffer.
Use it in TCP to reduce the interaction between mbuf sizes and the
Nagle algorithm.

Based on:	"Justin C. Walker" <justin@apple.com>'s description of Apple's
		fix for this problem.
This commit is contained in:
Bill Fenner 1999-01-20 17:32:01 +00:00
parent 50d5db08d0
commit b0acefa8d4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=42902
5 changed files with 34 additions and 24 deletions

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)uipc_socket.c 8.3 (Berkeley) 4/15/94
* $Id: uipc_socket.c,v 1.48 1999/01/08 17:31:13 eivind Exp $
* $Id: uipc_socket.c,v 1.49 1999/01/10 01:58:25 eivind Exp $
*/
#include <sys/param.h>
@ -529,7 +529,9 @@ sosend(so, addr, uio, top, control, flags, p)
((flags & MSG_EOF) &&
(so->so_proto->pr_flags & PR_IMPLOPCL) &&
(resid <= 0)) ?
PRUS_EOF : 0,
PRUS_EOF :
/* If there is more to send set PRUS_MORETOCOME */
(resid > 0) ? PRUS_MORETOCOME : 0,
top, addr, control, p);
splx(s);
if (dontroute)

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)tcp_output.c 8.4 (Berkeley) 5/24/95
* $Id: tcp_output.c,v 1.30 1998/05/24 18:41:04 fenner Exp $
* $Id: tcp_output.c,v 1.31 1998/07/13 11:53:59 bde Exp $
*/
#include "opt_tcpdebug.h"
@ -223,7 +223,8 @@ tcp_output(tp)
if (len) {
if (len == tp->t_maxseg)
goto send;
if ((idle || tp->t_flags & TF_NODELAY) &&
if (!(tp->t_flags & TF_MORETOCOME) &&
(idle || tp->t_flags & TF_NODELAY) &&
(tp->t_flags & TF_NOPUSH) == 0 &&
len + off >= so->so_snd.sb_cc)
goto send;

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* From: @(#)tcp_usrreq.c 8.2 (Berkeley) 1/3/94
* $Id: tcp_usrreq.c,v 1.38 1998/08/23 03:07:15 wollman Exp $
* $Id: tcp_usrreq.c,v 1.39 1998/12/07 21:58:42 archie Exp $
*/
#include "opt_tcpdebug.h"
@ -368,8 +368,13 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf *m,
socantsendmore(so);
tp = tcp_usrclosed(tp);
}
if (tp != NULL)
if (tp != NULL) {
if (flags & PRUS_MORETOCOME)
tp->t_flags |= TF_MORETOCOME;
error = tcp_output(tp);
if (flags & PRUS_MORETOCOME)
tp->t_flags &= ~TF_MORETOCOME;
}
} else {
if (sbspace(&so->so_snd) < -512) {
m_freem(m);

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)tcp_var.h 8.4 (Berkeley) 5/24/95
* $Id: tcp_var.h,v 1.47 1998/08/23 03:07:15 wollman Exp $
* $Id: tcp_var.h,v 1.48 1998/08/24 07:47:39 dfr Exp $
*/
#ifndef _NETINET_TCP_VAR_H_
@ -54,22 +54,23 @@ struct tcpcb {
struct inpcb *t_inpcb; /* back pointer to internet pcb */
int t_state; /* state of this connection */
u_int t_flags;
#define TF_ACKNOW 0x0001 /* ack peer immediately */
#define TF_DELACK 0x0002 /* ack, but try to delay it */
#define TF_NODELAY 0x0004 /* don't delay packets to coalesce */
#define TF_NOOPT 0x0008 /* don't use tcp options */
#define TF_SENTFIN 0x0010 /* have sent FIN */
#define TF_REQ_SCALE 0x0020 /* have/will request window scaling */
#define TF_RCVD_SCALE 0x0040 /* other side has requested scaling */
#define TF_REQ_TSTMP 0x0080 /* have/will request timestamps */
#define TF_RCVD_TSTMP 0x0100 /* a timestamp was received in SYN */
#define TF_SACK_PERMIT 0x0200 /* other side said I could SACK */
#define TF_NEEDSYN 0x0400 /* send SYN (implicit state) */
#define TF_NEEDFIN 0x0800 /* send FIN (implicit state) */
#define TF_NOPUSH 0x1000 /* don't push */
#define TF_REQ_CC 0x2000 /* have/will request CC */
#define TF_RCVD_CC 0x4000 /* a CC was received in SYN */
#define TF_SENDCCNEW 0x8000 /* send CCnew instead of CC in SYN */
#define TF_ACKNOW 0x00001 /* ack peer immediately */
#define TF_DELACK 0x00002 /* ack, but try to delay it */
#define TF_NODELAY 0x00004 /* don't delay packets to coalesce */
#define TF_NOOPT 0x00008 /* don't use tcp options */
#define TF_SENTFIN 0x00010 /* have sent FIN */
#define TF_REQ_SCALE 0x00020 /* have/will request window scaling */
#define TF_RCVD_SCALE 0x00040 /* other side has requested scaling */
#define TF_REQ_TSTMP 0x00080 /* have/will request timestamps */
#define TF_RCVD_TSTMP 0x00100 /* a timestamp was received in SYN */
#define TF_SACK_PERMIT 0x00200 /* other side said I could SACK */
#define TF_NEEDSYN 0x00400 /* send SYN (implicit state) */
#define TF_NEEDFIN 0x00800 /* send FIN (implicit state) */
#define TF_NOPUSH 0x01000 /* don't push */
#define TF_REQ_CC 0x02000 /* have/will request CC */
#define TF_RCVD_CC 0x04000 /* a CC was received in SYN */
#define TF_SENDCCNEW 0x08000 /* send CCnew instead of CC in SYN */
#define TF_MORETOCOME 0x10000 /* More data to be appended to sock */
int t_force; /* 1 if forcing out a byte */
tcp_seq snd_una; /* send unacknowledged */

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)protosw.h 8.1 (Berkeley) 6/2/93
* $Id: protosw.h,v 1.24 1998/06/07 17:13:03 dfr Exp $
* $Id: protosw.h,v 1.25 1998/08/23 03:07:17 wollman Exp $
*/
#ifndef _SYS_PROTOSW_H_
@ -203,6 +203,7 @@ struct pr_usrreqs {
struct proc *p));
#define PRUS_OOB 0x1
#define PRUS_EOF 0x2
#define PRUS_MORETOCOME 0x4
int (*pru_sense) __P((struct socket *so, struct stat *sb));
int (*pru_shutdown) __P((struct socket *so));
int (*pru_sockaddr) __P((struct socket *so,