svn commit: r252835 - stable/9/sys/netinet

Andre Oppermann andre at FreeBSD.org
Fri Jul 5 20:11:28 UTC 2013


Author: andre
Date: Fri Jul  5 20:11:27 2013
New Revision: 252835
URL: http://svnweb.freebsd.org/changeset/base/252835

Log:
  MFC r226433:
  
   Update the comment and description of tcp_sendspace and tcp_recvspace
   to better reflect their purpose.
  
  MFC r226437:
  
   VNET virtualize tcp_sendspace/tcp_recvspace and change the
   type to INT.  A long is not necessary as the TCP window is
   limited to 2**30.  A larger initial window isn't useful.
  
  MFC r226448:
  
   Move the tcp_sendspace and tcp_recvspace sysctl's from
   the middle of tcp_usrreq.c to the top of tcp_output.c
   and tcp_input.c respectively next to the socket buffer
   autosizing controls.
  
  MFC r227034:
  
   Restore sysctl names for tcp_sendspace/tcp_recvspace.
  
   They seem to be changed unintentionally in r226437, and there were no
   any mentions of renaming in commit log message.
  
   Reported by:	Anton Yuzhaninov <citrin citrin ru>

Modified:
  stable/9/sys/netinet/tcp_input.c
  stable/9/sys/netinet/tcp_output.c
  stable/9/sys/netinet/tcp_usrreq.c
  stable/9/sys/netinet/tcp_var.h
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/netinet/tcp_input.c
==============================================================================
--- stable/9/sys/netinet/tcp_input.c	Fri Jul  5 20:01:07 2013	(r252834)
+++ stable/9/sys/netinet/tcp_input.c	Fri Jul  5 20:11:27 2013	(r252835)
@@ -194,6 +194,11 @@ SYSCTL_VNET_INT(_net_inet_tcp, OID_AUTO,
     &VNET_NAME(tcp_insecure_rst), 0,
     "Follow the old (insecure) criteria for accepting RST packets");
 
+VNET_DEFINE(int, tcp_recvspace) = 1024*64
+#define	V_tcp_recvspace	VNET(tcp_recvspace)
+SYSCTL_VNET_INT(_net_inet_tcp, TCPCTL_RECVSPACE, recvspace, CTLFLAG_RW,
+    &VNET_NAME(tcp_recvspace), 0, "Initial receive socket buffer size");
+
 VNET_DEFINE(int, tcp_do_autorcvbuf) = 1;
 #define	V_tcp_do_autorcvbuf	VNET(tcp_do_autorcvbuf)
 SYSCTL_VNET_INT(_net_inet_tcp, OID_AUTO, recvbuf_auto, CTLFLAG_RW,
@@ -3590,7 +3595,7 @@ tcp_mss(struct tcpcb *tp, int offer)
 	 */
 	so = inp->inp_socket;
 	SOCKBUF_LOCK(&so->so_snd);
-	if ((so->so_snd.sb_hiwat == tcp_sendspace) && metrics.rmx_sendpipe)
+	if ((so->so_snd.sb_hiwat == V_tcp_sendspace) && metrics.rmx_sendpipe)
 		bufsize = metrics.rmx_sendpipe;
 	else
 		bufsize = so->so_snd.sb_hiwat;
@@ -3607,7 +3612,7 @@ tcp_mss(struct tcpcb *tp, int offer)
 	tp->t_maxseg = mss;
 
 	SOCKBUF_LOCK(&so->so_rcv);
-	if ((so->so_rcv.sb_hiwat == tcp_recvspace) && metrics.rmx_recvpipe)
+	if ((so->so_rcv.sb_hiwat == V_tcp_recvspace) && metrics.rmx_recvpipe)
 		bufsize = metrics.rmx_recvpipe;
 	else
 		bufsize = so->so_rcv.sb_hiwat;

Modified: stable/9/sys/netinet/tcp_output.c
==============================================================================
--- stable/9/sys/netinet/tcp_output.c	Fri Jul  5 20:01:07 2013	(r252834)
+++ stable/9/sys/netinet/tcp_output.c	Fri Jul  5 20:11:27 2013	(r252835)
@@ -98,6 +98,11 @@ SYSCTL_VNET_INT(_net_inet_tcp, OID_AUTO,
 	&VNET_NAME(tcp_do_tso), 0,
 	"Enable TCP Segmentation Offload");
 
+VNET_DEFINE(int, tcp_sendspace) = 1024*32;
+#define	V_tcp_sendspace	VNET(tcp_sendspace)
+SYSCTL_VNET_INT(_net_inet_tcp, TCPCTL_SENDSPACE, sendspace, CTLFLAG_RW,
+	&VNET_NAME(tcp_sendspace), 0, "Initial send socket buffer size");
+
 VNET_DEFINE(int, tcp_do_autosndbuf) = 1;
 #define	V_tcp_do_autosndbuf	VNET(tcp_do_autosndbuf)
 SYSCTL_VNET_INT(_net_inet_tcp, OID_AUTO, sendbuf_auto, CTLFLAG_RW,

Modified: stable/9/sys/netinet/tcp_usrreq.c
==============================================================================
--- stable/9/sys/netinet/tcp_usrreq.c	Fri Jul  5 20:01:07 2013	(r252834)
+++ stable/9/sys/netinet/tcp_usrreq.c	Fri Jul  5 20:11:27 2013	(r252835)
@@ -1597,18 +1597,6 @@ unlock_and_done:
 #undef INP_WLOCK_RECHECK
 
 /*
- * tcp_sendspace and tcp_recvspace are the default send and receive window
- * sizes, respectively.  These are obsolescent (this information should
- * be set by the route).
- */
-u_long	tcp_sendspace = 1024*32;
-SYSCTL_ULONG(_net_inet_tcp, TCPCTL_SENDSPACE, sendspace, CTLFLAG_RW,
-    &tcp_sendspace , 0, "Maximum outgoing TCP datagram size");
-u_long	tcp_recvspace = 1024*64;
-SYSCTL_ULONG(_net_inet_tcp, TCPCTL_RECVSPACE, recvspace, CTLFLAG_RW,
-    &tcp_recvspace , 0, "Maximum incoming TCP datagram size");
-
-/*
  * Attach TCP protocol to socket, allocating
  * internet protocol control block, tcp control block,
  * bufer space, and entering LISTEN state if to accept connections.
@@ -1621,7 +1609,7 @@ tcp_attach(struct socket *so)
 	int error;
 
 	if (so->so_snd.sb_hiwat == 0 || so->so_rcv.sb_hiwat == 0) {
-		error = soreserve(so, tcp_sendspace, tcp_recvspace);
+		error = soreserve(so, V_tcp_sendspace, V_tcp_recvspace);
 		if (error)
 			return (error);
 	}

Modified: stable/9/sys/netinet/tcp_var.h
==============================================================================
--- stable/9/sys/netinet/tcp_var.h	Fri Jul  5 20:01:07 2013	(r252834)
+++ stable/9/sys/netinet/tcp_var.h	Fri Jul  5 20:11:27 2013	(r252835)
@@ -623,6 +623,8 @@ VNET_DECLARE(int, tcp_minmss);
 VNET_DECLARE(int, tcp_delack_enabled);
 VNET_DECLARE(int, tcp_do_rfc3390);
 VNET_DECLARE(int, tcp_do_initcwnd10);
+VNET_DECLARE(int, tcp_sendspace);
+VNET_DECLARE(int, tcp_recvspace);
 VNET_DECLARE(int, path_mtu_discovery);
 VNET_DECLARE(int, tcp_do_rfc3465);
 VNET_DECLARE(int, tcp_abc_l_var);
@@ -634,6 +636,8 @@ VNET_DECLARE(int, tcp_abc_l_var);
 #define	V_tcp_delack_enabled	VNET(tcp_delack_enabled)
 #define	V_tcp_do_rfc3390	VNET(tcp_do_rfc3390)
 #define	V_tcp_do_initcwnd10	VNET(tcp_do_initcwnd10)
+#define	V_tcp_sendspace		VNET(tcp_sendspace)
+#define	V_tcp_recvspace		VNET(tcp_recvspace)
 #define	V_path_mtu_discovery	VNET(path_mtu_discovery)
 #define	V_tcp_do_rfc3465	VNET(tcp_do_rfc3465)
 #define	V_tcp_abc_l_var		VNET(tcp_abc_l_var)
@@ -731,8 +735,6 @@ void	 tcp_hc_updatemtu(struct in_conninf
 void	 tcp_hc_update(struct in_conninfo *, struct hc_metrics_lite *);
 
 extern	struct pr_usrreqs tcp_usrreqs;
-extern	u_long tcp_sendspace;
-extern	u_long tcp_recvspace;
 tcp_seq tcp_new_isn(struct tcpcb *);
 
 void	 tcp_sack_doack(struct tcpcb *, struct tcpopt *, tcp_seq);


More information about the svn-src-stable-9 mailing list