RFC: ANDROID: net: ipv4: sysfs_net_ipv4: Fix TCP window size controlling knobs
Refactor /sys/kernel/ipv4/tcp_* send/receive window size controlling
knobs to align with the changes of upstream commit 356d1833b6
("tcp: Namespace-ify sysctl_tcp_rmem and sysctl_tcp_wmem").
Fixes: ("ANDROID: net: ipv4: sysfs_net_ipv4: Add sysfs-based knobs for controlling TCP window size")
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
This commit is contained in:
parent
1e9a9ffbbd
commit
c6bc8ac9c5
4 changed files with 11 additions and 11 deletions
|
@ -1315,7 +1315,7 @@ static inline void tcp_sack_reset(struct tcp_options_received *rx_opt)
|
|||
rx_opt->num_sacks = 0;
|
||||
}
|
||||
|
||||
u32 tcp_default_init_rwnd(u32 mss);
|
||||
u32 tcp_default_init_rwnd(const struct sock *sk, u32 mss);
|
||||
void tcp_cwnd_restart(struct sock *sk, s32 delta);
|
||||
|
||||
static inline void tcp_slow_start_after_idle_check(struct sock *sk)
|
||||
|
|
|
@ -45,13 +45,13 @@ static ssize_t _name##_store(struct kobject *kobj, \
|
|||
static struct kobj_attribute _name##_attr = \
|
||||
__ATTR(_name, 0644, _name##_show, _name##_store)
|
||||
|
||||
CREATE_IPV4_FILE(tcp_wmem_min, sysctl_tcp_wmem[0]);
|
||||
CREATE_IPV4_FILE(tcp_wmem_def, sysctl_tcp_wmem[1]);
|
||||
CREATE_IPV4_FILE(tcp_wmem_max, sysctl_tcp_wmem[2]);
|
||||
CREATE_IPV4_FILE(tcp_wmem_min, init_net.ipv4.sysctl_tcp_wmem[0]);
|
||||
CREATE_IPV4_FILE(tcp_wmem_def, init_net.ipv4.sysctl_tcp_wmem[1]);
|
||||
CREATE_IPV4_FILE(tcp_wmem_max, init_net.ipv4.sysctl_tcp_wmem[2]);
|
||||
|
||||
CREATE_IPV4_FILE(tcp_rmem_min, sysctl_tcp_rmem[0]);
|
||||
CREATE_IPV4_FILE(tcp_rmem_def, sysctl_tcp_rmem[1]);
|
||||
CREATE_IPV4_FILE(tcp_rmem_max, sysctl_tcp_rmem[2]);
|
||||
CREATE_IPV4_FILE(tcp_rmem_min, init_net.ipv4.sysctl_tcp_rmem[0]);
|
||||
CREATE_IPV4_FILE(tcp_rmem_def, init_net.ipv4.sysctl_tcp_rmem[1]);
|
||||
CREATE_IPV4_FILE(tcp_rmem_max, init_net.ipv4.sysctl_tcp_rmem[2]);
|
||||
|
||||
static struct attribute *ipv4_attrs[] = {
|
||||
&tcp_wmem_min_attr.attr,
|
||||
|
|
|
@ -433,7 +433,7 @@ static void tcp_fixup_rcvbuf(struct sock *sk)
|
|||
int rcvmem;
|
||||
|
||||
rcvmem = 2 * SKB_TRUESIZE(mss + MAX_TCP_HEADER) *
|
||||
tcp_default_init_rwnd(mss);
|
||||
tcp_default_init_rwnd(sk, mss);
|
||||
|
||||
/* Dynamic Right Sizing (DRS) has 2 to 3 RTT latency
|
||||
* Allow enough cushion so that sender is not limited by our window
|
||||
|
|
|
@ -180,14 +180,14 @@ static inline void tcp_event_ack_sent(struct sock *sk, unsigned int pkts,
|
|||
}
|
||||
|
||||
|
||||
u32 tcp_default_init_rwnd(u32 mss)
|
||||
u32 tcp_default_init_rwnd(const struct sock *sk, u32 mss)
|
||||
{
|
||||
/* Initial receive window should be twice of TCP_INIT_CWND to
|
||||
* enable proper sending of new unsent data during fast recovery
|
||||
* (RFC 3517, Section 4, NextSeg() rule (2)). Further place a
|
||||
* limit when mss is larger than 1460.
|
||||
*/
|
||||
u32 init_rwnd = sysctl_tcp_default_init_rwnd;
|
||||
u32 init_rwnd = sock_net(sk)->ipv4.sysctl_tcp_default_init_rwnd;
|
||||
|
||||
if (mss > 1460)
|
||||
init_rwnd = max((1460 * init_rwnd) / mss, 2U);
|
||||
|
@ -243,7 +243,7 @@ void tcp_select_initial_window(const struct sock *sk, int __space, __u32 mss,
|
|||
}
|
||||
|
||||
if (!init_rcv_wnd) /* Use default unless specified otherwise */
|
||||
init_rcv_wnd = tcp_default_init_rwnd(mss);
|
||||
init_rcv_wnd = tcp_default_init_rwnd(sk, mss);
|
||||
*rcv_wnd = min(*rcv_wnd, init_rcv_wnd * mss);
|
||||
|
||||
/* Set the clamp no higher than max representable value */
|
||||
|
|
Loading…
Reference in a new issue