WLAN subsystem: Sysctl support for key TCP/IP parameters

It has been observed that default values for some of key tcp/ip
parameters are affecting the tput/performance of the system. Hence
extending configuration capabilities to TCP/Ip stack through
sysctl interface

Change-Id: Ia92fc229c0a4a8c3f7e4e02cf7e3c8849719ddff
CRs-Fixed: 507581

Signed-off-by: Kiran Kumar Lokere <klokere@codeaurora.org>
This commit is contained in:
Ravi Joshi 2013-07-25 19:04:17 -07:00 committed by Zhao Wei Liew
parent 65d9c4cc92
commit 886ccee9f7
5 changed files with 79 additions and 4 deletions

View file

@ -131,6 +131,8 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo);
* most likely due to retrans in 3WHS.
*/
#define TCP_DELACK_SEG 1 /*Number of full MSS to receive before Acking RFC2581*/
#define TCP_RESOURCE_PROBE_INTERVAL ((unsigned)(HZ/2U)) /* Maximal interval between probes
* for local resources.
*/
@ -254,6 +256,10 @@ extern int sysctl_tcp_thin_linear_timeouts;
extern int sysctl_tcp_thin_dupack;
extern int sysctl_tcp_default_init_rwnd;
/* sysctl variables for controlling various tcp parameters */
extern int sysctl_tcp_delack_seg;
extern int sysctl_tcp_use_userconfig;
extern atomic_long_t tcp_memory_allocated;
extern struct percpu_counter tcp_sockets_allocated;
extern int tcp_memory_pressure;
@ -347,6 +353,10 @@ extern ssize_t tcp_splice_read(struct socket *sk, loff_t *ppos,
struct pipe_inode_info *pipe, size_t len,
unsigned int flags);
extern int tcp_use_userconfig_sysctl_handler(struct ctl_table *, int,
void __user *, size_t *, loff_t *);
extern int tcp_proc_delayed_ack_control(struct ctl_table *, int,
void __user *, size_t *, loff_t *);
static inline void tcp_dec_quickack_mode(struct sock *sk,
const unsigned int pkts)
{

View file

@ -36,6 +36,10 @@ static int ip_ttl_min = 1;
static int ip_ttl_max = 255;
static int ip_ping_group_range_min[] = { 0, 0 };
static int ip_ping_group_range_max[] = { GID_T_MAX, GID_T_MAX };
static int tcp_delack_seg_min = TCP_DELACK_MIN;
static int tcp_delack_seg_max = 60;
static int tcp_use_userconfig_min;
static int tcp_use_userconfig_max = 1;
/* Update system visible IP port range */
static void set_local_port_range(int range[2])
@ -721,6 +725,25 @@ static struct ctl_table ipv4_table[] = {
.proc_handler = proc_dointvec_minmax,
.extra1 = &zero
},
{
.procname = "tcp_delack_seg",
.data = &sysctl_tcp_delack_seg,
.maxlen = sizeof(sysctl_tcp_delack_seg),
.mode = 0644,
.proc_handler = tcp_proc_delayed_ack_control,
.extra1 = &tcp_delack_seg_min,
.extra2 = &tcp_delack_seg_max,
},
{
.procname = "tcp_use_userconfig",
.data = &sysctl_tcp_use_userconfig,
.maxlen = sizeof(sysctl_tcp_use_userconfig),
.mode = 0644,
.proc_handler = tcp_use_userconfig_sysctl_handler,
.extra1 = &tcp_use_userconfig_min,
.extra2 = &tcp_use_userconfig_max,
},
{ }
};

View file

@ -294,6 +294,12 @@ int sysctl_tcp_rmem[3] __read_mostly;
EXPORT_SYMBOL(sysctl_tcp_rmem);
EXPORT_SYMBOL(sysctl_tcp_wmem);
int sysctl_tcp_delack_seg __read_mostly = TCP_DELACK_SEG;
EXPORT_SYMBOL(sysctl_tcp_delack_seg);
int sysctl_tcp_use_userconfig __read_mostly;
EXPORT_SYMBOL(sysctl_tcp_use_userconfig);
atomic_long_t tcp_memory_allocated; /* Current allocated memory. */
EXPORT_SYMBOL(tcp_memory_allocated);
@ -1213,8 +1219,11 @@ void tcp_cleanup_rbuf(struct sock *sk, int copied)
/* Delayed ACKs frequently hit locked sockets during bulk
* receive. */
if (icsk->icsk_ack.blocked ||
/* Once-per-two-segments ACK was not sent by tcp_input.c */
tp->rcv_nxt - tp->rcv_wup > icsk->icsk_ack.rcv_mss ||
/* Once-per-sysctl_tcp_delack_seg segments
* ACK was not sent by tcp_input.c
*/
tp->rcv_nxt - tp->rcv_wup > (icsk->icsk_ack.rcv_mss) *
sysctl_tcp_delack_seg ||
/*
* If this read emptied read buffer, we send ACK, if
* connection is not bidirectional, user drained

View file

@ -5048,7 +5048,8 @@ static void __tcp_ack_snd_check(struct sock *sk, int ofo_possible)
struct tcp_sock *tp = tcp_sk(sk);
/* More than one full frame received... */
if (((tp->rcv_nxt - tp->rcv_wup) > inet_csk(sk)->icsk_ack.rcv_mss &&
if (((tp->rcv_nxt - tp->rcv_wup) > (inet_csk(sk)->icsk_ack.rcv_mss) *
sysctl_tcp_delack_seg &&
/* ... and right edge of window advances far enough.
* (tcp_recvmsg() will send ACK otherwise). Or...
*/

View file

@ -34,7 +34,39 @@ int sysctl_tcp_thin_linear_timeouts __read_mostly;
static void tcp_write_timer(unsigned long);
static void tcp_delack_timer(unsigned long);
static void tcp_keepalive_timer (unsigned long data);
static void tcp_keepalive_timer(unsigned long data);
/*Function to reset tcp_ack related sysctl on resetting master control */
void set_tcp_default(void)
{
sysctl_tcp_delack_seg = TCP_DELACK_SEG;
}
/*sysctl handler for tcp_ack realted master control */
int tcp_proc_delayed_ack_control(ctl_table *table, int write,
void __user *buffer, size_t *length, loff_t *ppos)
{
int ret = proc_dointvec_minmax(table, write, buffer, length, ppos);
/* The ret value will be 0 if the input validation is successful
* and the values are written to sysctl table. If not, the stack
* will continue to work with currently configured values
*/
return ret;
}
/*sysctl handler for tcp_ack realted master control */
int tcp_use_userconfig_sysctl_handler(ctl_table *table, int write,
void __user *buffer, size_t *length, loff_t *ppos)
{
int ret = proc_dointvec_minmax(table, write, buffer, length, ppos);
if (write && ret == 0) {
if (!sysctl_tcp_use_userconfig)
set_tcp_default();
}
return ret;
}
void tcp_init_xmit_timers(struct sock *sk)
{