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: I4287e9103769535f43e0934bac08435a524ee6a4 CRs-Fixed: 507581 Signed-off-by: Ravi Joshi <ravij@codeaurora.org> Signed-off-by: Ganesh Babu Kumaravel <kganesh@codeaurora.org> Signed-off-by: Mohit Khanna <mkhannaqca@codeaurora.org> Signed-off-by: Manjunathappa Prakash <prakashpm@codeaurora.org> Signed-off-by: Sandeep Singh <sandsing@codeaurora.org>
This commit is contained in:
parent
dd22fab72f
commit
b7dc3b5420
5 changed files with 84 additions and 4 deletions
|
@ -148,6 +148,9 @@ void tcp_time_wait(struct sock *sk, int state, int timeo);
|
|||
* most likely due to retrans in 3WHS.
|
||||
*/
|
||||
|
||||
/* Number of full MSS to receive before Acking RFC2581 */
|
||||
#define TCP_DELACK_SEG 1
|
||||
|
||||
#define TCP_RESOURCE_PROBE_INTERVAL ((unsigned)(HZ/2U)) /* Maximal interval between probes
|
||||
* for local resources.
|
||||
*/
|
||||
|
@ -251,6 +254,11 @@ extern long sysctl_tcp_mem[3];
|
|||
#define TCP_RACK_NO_DUPTHRESH 0x4 /* Do not use DUPACK threshold in RACK */
|
||||
|
||||
extern atomic_long_t tcp_memory_allocated;
|
||||
|
||||
/* sysctl variables for controlling various tcp parameters */
|
||||
extern int sysctl_tcp_delack_seg;
|
||||
extern int sysctl_tcp_use_userconfig;
|
||||
|
||||
extern struct percpu_counter tcp_sockets_allocated;
|
||||
extern unsigned long tcp_memory_pressure;
|
||||
|
||||
|
@ -345,6 +353,14 @@ ssize_t tcp_splice_read(struct socket *sk, loff_t *ppos,
|
|||
struct pipe_inode_info *pipe, size_t len,
|
||||
unsigned int flags);
|
||||
|
||||
/* sysctl master controller */
|
||||
extern int tcp_use_userconfig_sysctl_handler(struct ctl_table *table,
|
||||
int write, void __user *buffer, size_t *length,
|
||||
loff_t *ppos);
|
||||
extern int tcp_proc_delayed_ack_control(struct ctl_table *table, int write,
|
||||
void __user *buffer, size_t *length,
|
||||
loff_t *ppos);
|
||||
|
||||
void tcp_enter_quickack_mode(struct sock *sk, unsigned int max_quickacks);
|
||||
static inline void tcp_dec_quickack_mode(struct sock *sk,
|
||||
const unsigned int pkts)
|
||||
|
|
|
@ -52,6 +52,10 @@ static int ip_ping_group_range_max[] = { GID_T_MAX, GID_T_MAX };
|
|||
static int comp_sack_nr_max = 255;
|
||||
static u32 u32_max_div_HZ = UINT_MAX / HZ;
|
||||
static int one_day_secs = 24 * 3600;
|
||||
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;
|
||||
|
||||
/* obsolete */
|
||||
static int sysctl_tcp_low_latency __read_mostly;
|
||||
|
@ -552,6 +556,25 @@ static struct ctl_table ipv4_table[] = {
|
|||
.mode = 0644,
|
||||
.proc_handler = proc_doulongvec_minmax,
|
||||
},
|
||||
{
|
||||
.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,
|
||||
},
|
||||
|
||||
{ }
|
||||
};
|
||||
|
||||
|
|
|
@ -296,6 +296,11 @@ EXPORT_SYMBOL(tcp_memory_allocated);
|
|||
DEFINE_STATIC_KEY_FALSE(tcp_have_smc);
|
||||
EXPORT_SYMBOL(tcp_have_smc);
|
||||
#endif
|
||||
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);
|
||||
|
||||
/*
|
||||
* Current number of TCP sockets.
|
||||
|
@ -1554,8 +1559,11 @@ static 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
|
||||
|
|
|
@ -5167,7 +5167,8 @@ static void __tcp_ack_snd_check(struct sock *sk, int ofo_possible)
|
|||
unsigned long rtt, delay;
|
||||
|
||||
/* 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).
|
||||
* If application uses SO_RCVLOWAT, we want send ack now if
|
||||
|
|
|
@ -51,13 +51,45 @@ static u32 tcp_clamp_rto_to_user_timeout(const struct sock *sk)
|
|||
return min_t(u32, icsk->icsk_rto, msecs_to_jiffies(icsk->icsk_user_timeout - elapsed));
|
||||
}
|
||||
|
||||
static 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(struct 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(struct 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* tcp_write_err() - close socket and save error info
|
||||
* @sk: The socket the error has appeared on.
|
||||
*
|
||||
* Returns: Nothing (void)
|
||||
*/
|
||||
|
||||
static void tcp_write_err(struct sock *sk)
|
||||
{
|
||||
sk->sk_err = sk->sk_err_soft ? : ETIMEDOUT;
|
||||
|
|
Loading…
Reference in a new issue