]> git.hungrycats.org Git - linux/commitdiff
[TCP]: More sysctl tweakings for rcvbuf stuff.
authorDavid S. Miller <davem@nuts.davemloft.net>
Sat, 29 May 2004 05:06:39 +0000 (22:06 -0700)
committerDavid S. Miller <davem@nuts.davemloft.net>
Sat, 29 May 2004 05:06:39 +0000 (22:06 -0700)
1) Add sysctl to control rcvbuf moderation, off for now.
2) Set default winscale to zero.

include/linux/sysctl.h
include/net/tcp.h
net/ipv4/sysctl_net_ipv4.c
net/ipv4/tcp.c
net/ipv4/tcp_input.c

index 1303452c2839ac1f63305e4d5a21e84bafc32f0d..f70f7fc14498dd7e5b4a0dd7a6b085cc636c9782 100644 (file)
@@ -337,6 +337,7 @@ enum
        NET_TCP_BIC_FAST_CONVERGENCE=103,
        NET_TCP_BIC_LOW_WINDOW=104,
        NET_TCP_DEFAULT_WIN_SCALE=105,
+       NET_TCP_MODERATE_RCVBUF=106,
 };
 
 enum {
index e9c4098453d305bff6a41a6b0146a9cb0658caa1..e1195b261f7048178e40b62737e5e34d9cdfa7c9 100644 (file)
@@ -611,6 +611,7 @@ extern int sysctl_tcp_bic;
 extern int sysctl_tcp_bic_fast_convergence;
 extern int sysctl_tcp_bic_low_window;
 extern int sysctl_tcp_default_win_scale;
+extern int sysctl_tcp_moderate_rcvbuf;
 
 extern atomic_t tcp_memory_allocated;
 extern atomic_t tcp_sockets_allocated;
index 23744e18237a17ca1ac4801df9fed0ad4722c45f..e9d83120c516d96edb31b72b4205278579ec204c 100644 (file)
@@ -673,6 +673,14 @@ ctl_table ipv4_table[] = {
                .mode           = 0644,
                .proc_handler   = &proc_dointvec,
        },
+       {
+               .ctl_name       = NET_TCP_MODERATE_RCVBUF,
+               .procname       = "tcp_moderate_rcvbuf",
+               .data           = &sysctl_tcp_moderate_rcvbuf,
+               .maxlen         = sizeof(int),
+               .mode           = 0644,
+               .proc_handler   = &proc_dointvec,
+       },
        { .ctl_name = 0 }
 };
 
index 66cc77c3edeb8e0609f499c8c6befa959ec376aa..3ef8e3e7f7c6cfa41a8a51e2c76d67adbc2e4990 100644 (file)
@@ -276,7 +276,7 @@ kmem_cache_t *tcp_timewait_cachep;
 
 atomic_t tcp_orphan_count = ATOMIC_INIT(0);
 
-int sysctl_tcp_default_win_scale = 7;
+int sysctl_tcp_default_win_scale;
 
 int sysctl_tcp_mem[3];
 int sysctl_tcp_wmem[3] = { 4 * 1024, 16 * 1024, 128 * 1024 };
index 62d516bcd7619d958584da7a00a0c88185bb1e3e..708005f0d0b0c324354ea46ffc68db3edd0ac838 100644 (file)
@@ -90,6 +90,8 @@ int sysctl_tcp_nometrics_save;
 int sysctl_tcp_westwood;
 int sysctl_tcp_vegas_cong_avoid;
 
+int sysctl_tcp_moderate_rcvbuf;
+
 /* Default values of the Vegas variables, in fixed-point representation
  * with V_PARAM_SHIFT bits to the right of the binary point.
  */
@@ -460,19 +462,21 @@ void tcp_rcv_space_adjust(struct sock *sk)
 
                tp->rcvq_space.space = space;
 
-               /* Receive space grows, normalize in order to
-                * take into account packet headers and sk_buff
-                * structure overhead.
-                */
-               space /= tp->advmss;
-               if (!space)
-                       space = 1;
-               rcvmem = (tp->advmss + MAX_TCP_HEADER +
-                         16 + sizeof(struct sk_buff));
-               space *= rcvmem;
-               space = min(space, sysctl_tcp_rmem[2]);
-               if (space > sk->sk_rcvbuf)
-                       sk->sk_rcvbuf = space;
+               if (sysctl_tcp_moderate_rcvbuf) {
+                       /* Receive space grows, normalize in order to
+                        * take into account packet headers and sk_buff
+                        * structure overhead.
+                        */
+                       space /= tp->advmss;
+                       if (!space)
+                               space = 1;
+                       rcvmem = (tp->advmss + MAX_TCP_HEADER +
+                                 16 + sizeof(struct sk_buff));
+                       space *= rcvmem;
+                       space = min(space, sysctl_tcp_rmem[2]);
+                       if (space > sk->sk_rcvbuf)
+                               sk->sk_rcvbuf = space;
+               }
        }
        
 new_measure: