Author: andre
Date: Sun Oct 16 15:08:43 2011
New Revision: 226437
URL: http://svn.freebsd.org/changeset/base/226437

Log:
  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 after:    1 week

Modified:
  head/sys/netinet/tcp_input.c
  head/sys/netinet/tcp_usrreq.c
  head/sys/netinet/tcp_var.h

Modified: head/sys/netinet/tcp_input.c
==============================================================================
--- head/sys/netinet/tcp_input.c        Sun Oct 16 14:30:28 2011        
(r226436)
+++ head/sys/netinet/tcp_input.c        Sun Oct 16 15:08:43 2011        
(r226437)
@@ -3517,7 +3517,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;
@@ -3534,7 +3534,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: head/sys/netinet/tcp_usrreq.c
==============================================================================
--- head/sys/netinet/tcp_usrreq.c       Sun Oct 16 14:30:28 2011        
(r226436)
+++ head/sys/netinet/tcp_usrreq.c       Sun Oct 16 15:08:43 2011        
(r226437)
@@ -1501,12 +1501,15 @@ tcp_ctloutput(struct socket *so, struct 
  * Set the initial send and receive socket buffer sizes for
  * newly created TCP sockets.
  */
-u_long tcp_sendspace = 1024*32;
-SYSCTL_ULONG(_net_inet_tcp, TCPCTL_SENDSPACE, sendspace, CTLFLAG_RW,
-    &tcp_sendspace , 0, "Initial send socket buffer size");
-u_long tcp_recvspace = 1024*64;
-SYSCTL_ULONG(_net_inet_tcp, TCPCTL_RECVSPACE, recvspace, CTLFLAG_RW,
-    &tcp_recvspace , 0, "Initial receive socket buffer size");
+VNET_DEFINE(int, tcp_sendspace) = 1024*32;
+#define        V_tcp_sendspace VNET(tcp_sendspace)
+SYSCTL_VNET_INT(_net_inet_tcp, TCPCTL_SENDSPACE, tcp_sendspace, CTLFLAG_RW,
+    &VNET_NAME(tcp_sendspace), 0, "Initial send socket buffer size");
+
+VNET_DEFINE(int, tcp_recvspace) = 1024*64
+#define        V_tcp_recvspace VNET(tcp_recvspace)
+SYSCTL_VNET_INT(_net_inet_tcp, TCPCTL_RECVSPACE, tcp_recvspace, CTLFLAG_RW,
+    &VNET_NAME(tcp_recvspace), 0, "Initial receive socket buffer size");
 
 /*
  * Attach TCP protocol to socket, allocating
@@ -1521,7 +1524,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: head/sys/netinet/tcp_var.h
==============================================================================
--- head/sys/netinet/tcp_var.h  Sun Oct 16 14:30:28 2011        (r226436)
+++ head/sys/netinet/tcp_var.h  Sun Oct 16 15:08:43 2011        (r226437)
@@ -606,6 +606,8 @@ VNET_DECLARE(int, tcp_mssdflt);     /* XXX *
 VNET_DECLARE(int, tcp_minmss);
 VNET_DECLARE(int, tcp_delack_enabled);
 VNET_DECLARE(int, tcp_do_rfc3390);
+VNET_DECLARE(int, tcp_sendspace);
+VNET_DECLARE(int, tcp_recvspace);
 VNET_DECLARE(int, path_mtu_discovery);
 VNET_DECLARE(int, ss_fltsz);
 VNET_DECLARE(int, ss_fltsz_local);
@@ -618,6 +620,8 @@ VNET_DECLARE(int, tcp_abc_l_var);
 #define        V_tcp_minmss            VNET(tcp_minmss)
 #define        V_tcp_delack_enabled    VNET(tcp_delack_enabled)
 #define        V_tcp_do_rfc3390        VNET(tcp_do_rfc3390)
+#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_ss_fltsz              VNET(ss_fltsz)
 #define        V_ss_fltsz_local        VNET(ss_fltsz_local)
@@ -716,8 +720,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);
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to