tcp: move 14 sysctls to namespaces
Subsystems (3)
v2 cover tcp: move 14 sysctls to namespaces
Ideally all TCP sysctls should be per netns.
This patch series takes care of 14 of sysctls.
More to come later.
Eric Dumazet (15):
tcp: Namespace-ify sysctl_tcp_early_retrans
tcp: Namespace-ify sysctl_tcp_recovery
tcp: Namespace-ify sysctl_tcp_thin_linear_timeouts
tcp: Namespace-ify sysctl_tcp_slow_start_after_idle
tcp: Namespace-ify sysctl_tcp_retrans_collapse
tcp: Namespace-ify sysctl_tcp_stdurg
tcp: Namespace-ify sysctl_tcp_rfc1337
tcp: Namespace-ify sysctl_tcp_abort_on_overflow
tcp: Namespace-ify sysctl_tcp_fack
tcp: remove stale sysctl_tcp_reordering
tcp: Namespace-ify sysctl_tcp_max_reordering
tcp: Namespace-ify sysctl_tcp_dsack
tcp: Namespace-ify sysctl_tcp_app_win
tcp: Namespace-ify sysctl_tcp_adv_win_scale
tcp: Namespace-ify sysctl_tcp_frto
include/net/netns/ipv4.h | 14 ++++ include/net/tcp.h | 27 ++---- net/ipv4/sysctl_net_ipv4.c | 204 ++++++++++++++++++++++----------------------- net/ipv4/tcp.c | 2 +- net/ipv4/tcp_input.c | 42 ++++------ net/ipv4/tcp_ipv4.c | 9 ++ net/ipv4/tcp_minisocks.c | 8 +- net/ipv4/tcp_output.c | 14 ++-- net/ipv4/tcp_recovery.c | 2 - net/ipv4/tcp_timer.c | 4 +- 10 files changed, 157 insertions(+), 169 deletions(-)
Signature · 1 line
2.15.0.rc2.357.g7e34df9404-goog
PATCH v2 1/15 tcp: Namespace-ify sysctl_tcp_early_retrans
--- include/net/netns/ipv4.h | 1 + include/net/tcp.h | 1 - net/ipv4/sysctl_net_ipv4.c | 18 +++++++++--------- net/ipv4/tcp_input.c | 1 - net/ipv4/tcp_ipv4.c | 1 + net/ipv4/tcp_output.c | 4 +++- 6 files changed, 14 insertions(+), 12 deletions(-)
include/net/netns/ipv4.h +1 -0
@@ -128,6 +128,7 @@ struct netns_ipv4 {int sysctl_tcp_sack;int sysctl_tcp_window_scaling;int sysctl_tcp_timestamps; +int sysctl_tcp_early_retrans;struct inet_timewait_death_row tcp_death_row;int sysctl_max_syn_backlog;int sysctl_tcp_fastopen;
include/net/tcp.h +0 -1
@@ -265,7 +265,6 @@ extern int sysctl_tcp_workaround_signed_windows;extern int sysctl_tcp_slow_start_after_idle;extern int sysctl_tcp_thin_linear_timeouts;extern int sysctl_tcp_thin_dupack; -extern int sysctl_tcp_early_retrans;extern int sysctl_tcp_recovery;#define TCP_RACK_LOSS_DETECTION 0x1/* Use RACK to detect losses */
net/ipv4/sysctl_net_ipv4.c +9 -9
@@ -634,15 +634,6 @@ static struct ctl_table ipv4_table[] = { .mode = 0644, .proc_handler = proc_dointvec }, - { - .procname = "tcp_early_retrans", - .data = &sysctl_tcp_early_retrans, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = proc_dointvec_minmax, - .extra1 = &zero, - .extra2 = &four, - }, { .procname = "tcp_min_tso_segs", .data = &sysctl_tcp_min_tso_segs,
@@ -1145,6 +1136,15 @@ static struct ctl_table ipv4_net_table[] = { .mode = 0644, .proc_handler = proc_dointvec }, + { + .procname = "tcp_early_retrans", + .data = &init_net.ipv4.sysctl_tcp_early_retrans, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec_minmax, + .extra1 = &zero, + .extra2 = &four, + }, { } };
net/ipv4/tcp_input.c +0 -1
@@ -95,7 +95,6 @@ int sysctl_tcp_max_orphans __read_mostly = NR_FILE;int sysctl_tcp_frto__read_mostly =2 ;int sysctl_tcp_min_rtt_wlen__read_mostly =300 ;int sysctl_tcp_moderate_rcvbuf__read_mostly =1 ; -int sysctl_tcp_early_retrans__read_mostly =3 ;int sysctl_tcp_invalid_ratelimit__read_mostly =HZ /2 ;#define FLAG_DATA 0x01/* Incoming frame contained data. */
net/ipv4/tcp_ipv4.c +1 -0
@@ -2484,6 +2484,7 @@ static int __net_init tcp_sk_init(struct net *net) net->ipv4.sysctl_tcp_sack =1 ; net->ipv4.sysctl_tcp_window_scaling =1 ; net->ipv4.sysctl_tcp_timestamps =1 ; + net->ipv4.sysctl_tcp_early_retrans =3 ; net->ipv4.sysctl_tcp_fastopen =TFO_CLIENT_ENABLE ;spin_lock_init (&net->ipv4.tcp_fastopen_ctx_lock);
net/ipv4/tcp_output.c +3 -1
@@ -2435,6 +2435,7 @@ bool tcp_schedule_loss_probe(struct sock *sk)struct inet_connection_sock *icsk =inet_csk (sk);struct tcp_sock *tp =tcp_sk (sk);u32 timeout, rto_delta_us; +int early_retrans;/* Don't do any loss probe on a Fast Open connection before 3WHS * finishes.
@@ -2442,10 +2443,11 @@ bool tcp_schedule_loss_probe(struct sock *sk)if (tp->fastopen_rsk)return false; + early_retrans =sock_net (sk)->ipv4.sysctl_tcp_early_retrans;/* Schedule a loss probe in 2*RTT for SACK capable connections * in Open state, that are either limited by cwnd or application. */ -if ((sysctl_tcp_early_retrans !=3 && sysctl_tcp_early_retrans !=4 ) || +if ((early_retrans !=3 && early_retrans !=4 ) || !tp->packets_out || !tcp_is_sack (tp) || icsk->icsk_ca_state != TCP_CA_Open)return false;
Signature · 1 line
2.15.0.rc2.357.g7e34df9404-goog
PATCH v2 2/15 tcp: Namespace-ify sysctl_tcp_recovery
In reply to Eric Dumazet--- include/net/netns/ipv4.h | 1 + include/net/tcp.h | 2 +- net/ipv4/sysctl_net_ipv4.c | 14 +++++++------- net/ipv4/tcp_input.c | 2 +- net/ipv4/tcp_ipv4.c | 1 + net/ipv4/tcp_recovery.c | 2 -- 6 files changed, 11 insertions(+), 11 deletions(-)
include/net/netns/ipv4.h +1 -0
@@ -129,6 +129,7 @@ struct netns_ipv4 {int sysctl_tcp_window_scaling;int sysctl_tcp_timestamps;int sysctl_tcp_early_retrans; +int sysctl_tcp_recovery;struct inet_timewait_death_row tcp_death_row;int sysctl_max_syn_backlog;int sysctl_tcp_fastopen;
include/net/tcp.h +1 -1
@@ -265,7 +265,7 @@ extern int sysctl_tcp_workaround_signed_windows;extern int sysctl_tcp_slow_start_after_idle;extern int sysctl_tcp_thin_linear_timeouts;extern int sysctl_tcp_thin_dupack; -extern int sysctl_tcp_recovery; +#define TCP_RACK_LOSS_DETECTION 0x1/* Use RACK to detect losses */ extern int sysctl_tcp_limit_output_bytes;
net/ipv4/sysctl_net_ipv4.c +7 -7
@@ -449,13 +449,6 @@ static struct ctl_table ipv4_table[] = { .mode = 0644, .proc_handler = proc_dointvec }, - { - .procname = "tcp_recovery", - .data = &sysctl_tcp_recovery, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = proc_dointvec, - }, { .procname = "tcp_max_reordering", .data = &sysctl_tcp_max_reordering,
@@ -1145,6 +1138,13 @@ static struct ctl_table ipv4_net_table[] = { .extra1 = &zero, .extra2 = &four, }, + { + .procname = "tcp_recovery", + .data = &init_net.ipv4.sysctl_tcp_recovery, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec, + }, { } };
net/ipv4/tcp_input.c +1 -1
@@ -2788,7 +2788,7 @@ static void tcp_rack_identify_loss(struct sock *sk, int *ack_flag)struct tcp_sock *tp =tcp_sk (sk);/* Use RACK to detect loss */ -if (sysctl_tcp_recovery &TCP_RACK_LOSS_DETECTION ) { +if (sock_net (sk)->ipv4.sysctl_tcp_recovery &TCP_RACK_LOSS_DETECTION ) {u32 prior_retrans = tp->retrans_out;tcp_rack_mark_lost (sk);
net/ipv4/tcp_ipv4.c +1 -0
@@ -2485,6 +2485,7 @@ static int __net_init tcp_sk_init(struct net *net) net->ipv4.sysctl_tcp_window_scaling =1 ; net->ipv4.sysctl_tcp_timestamps =1 ; net->ipv4.sysctl_tcp_early_retrans =3 ; + net->ipv4.sysctl_tcp_recovery =TCP_RACK_LOSS_DETECTION ; net->ipv4.sysctl_tcp_fastopen =TFO_CLIENT_ENABLE ;spin_lock_init (&net->ipv4.tcp_fastopen_ctx_lock);
net/ipv4/tcp_recovery.c +0 -2
@@ -1,8 +1,6 @@#include <linux/tcp.h> #include <net/tcp.h> -int sysctl_tcp_recovery__read_mostly =TCP_RACK_LOSS_DETECTION ; -static void tcp_rack_mark_skb_lost (struct sock *sk,struct sk_buff *skb) {struct tcp_sock *tp =tcp_sk (sk);
Signature · 1 line
2.15.0.rc2.357.g7e34df9404-goog
PATCH v2 3/15 tcp: Namespace-ify sysctl_tcp_thin_linear_timeouts
In reply to Eric DumazetNote that sysctl_tcp_thin_dupack was not used, I deleted it.
--- include/net/netns/ipv4.h | 1 + include/net/tcp.h | 2 -- net/ipv4/sysctl_net_ipv4.c | 14 +++++++------- net/ipv4/tcp_timer.c | 4 +--- 4 files changed, 9 insertions(+), 12 deletions(-)
include/net/netns/ipv4.h +1 -0
@@ -130,6 +130,7 @@ struct netns_ipv4 {int sysctl_tcp_timestamps;int sysctl_tcp_early_retrans;int sysctl_tcp_recovery; +int sysctl_tcp_thin_linear_timeouts;struct inet_timewait_death_row tcp_death_row;int sysctl_max_syn_backlog;int sysctl_tcp_fastopen;
include/net/tcp.h +0 -2
@@ -263,8 +263,6 @@ extern int sysctl_tcp_moderate_rcvbuf;extern int sysctl_tcp_tso_win_divisor;extern int sysctl_tcp_workaround_signed_windows;extern int sysctl_tcp_slow_start_after_idle; -extern int sysctl_tcp_thin_linear_timeouts; -extern int sysctl_tcp_thin_dupack;#define TCP_RACK_LOSS_DETECTION 0x1/* Use RACK to detect losses */
net/ipv4/sysctl_net_ipv4.c +7 -7
@@ -620,13 +620,6 @@ static struct ctl_table ipv4_table[] = { .mode = 0644, .proc_handler = proc_allowed_congestion_control, }, - { - .procname = "tcp_thin_linear_timeouts", - .data = &sysctl_tcp_thin_linear_timeouts, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = proc_dointvec - }, { .procname = "tcp_min_tso_segs", .data = &sysctl_tcp_min_tso_segs,
@@ -1145,6 +1138,13 @@ static struct ctl_table ipv4_net_table[] = { .mode = 0644, .proc_handler = proc_dointvec, }, + { + .procname = "tcp_thin_linear_timeouts", + .data = &init_net.ipv4.sysctl_tcp_thin_linear_timeouts, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec + }, { } };
net/ipv4/tcp_timer.c +1 -3
@@ -22,8 +22,6 @@#include <linux/gfp.h> #include <net/tcp.h> -int sysctl_tcp_thin_linear_timeouts__read_mostly ; -/** * tcp_write_err() - close socket and save error info * @sk: The socket the error has appeared on.
@@ -522,7 +520,7 @@ void tcp_retransmit_timer(struct sock *sk)* linear-timeout retransmissions into a black hole */ if (sk->sk_state ==TCP_ESTABLISHED && - (tp->thin_lto || sysctl_tcp_thin_linear_timeouts) && + (tp->thin_lto || net->ipv4.sysctl_tcp_thin_linear_timeouts) &&tcp_stream_is_thin (tp) && icsk->icsk_retransmits <=TCP_THIN_LINEAR_RETRIES ) { icsk->icsk_backoff =0 ;
Signature · 1 line
2.15.0.rc2.357.g7e34df9404-goog
PATCH v2 4/15 tcp: Namespace-ify sysctl_tcp_slow_start_after_idle
In reply to Eric Dumazet--- include/net/netns/ipv4.h | 1 + include/net/tcp.h | 3 +-- net/ipv4/sysctl_net_ipv4.c | 14 +++++++------- net/ipv4/tcp_ipv4.c | 1 + net/ipv4/tcp_output.c | 5 +---- 5 files changed, 11 insertions(+), 13 deletions(-)
include/net/netns/ipv4.h +1 -0
@@ -131,6 +131,7 @@ struct netns_ipv4 {int sysctl_tcp_early_retrans;int sysctl_tcp_recovery;int sysctl_tcp_thin_linear_timeouts; +int sysctl_tcp_slow_start_after_idle;struct inet_timewait_death_row tcp_death_row;int sysctl_max_syn_backlog;int sysctl_tcp_fastopen;
include/net/tcp.h +1 -2
@@ -262,7 +262,6 @@ extern int sysctl_tcp_nometrics_save;extern int sysctl_tcp_moderate_rcvbuf;extern int sysctl_tcp_tso_win_divisor;extern int sysctl_tcp_workaround_signed_windows; -extern int sysctl_tcp_slow_start_after_idle;#define TCP_RACK_LOSS_DETECTION 0x1/* Use RACK to detect losses */
@@ -1308,7 +1307,7 @@ static inline void tcp_slow_start_after_idle_check(struct sock *sk)struct tcp_sock *tp =tcp_sk (sk);s32 delta; -if (!sysctl_tcp_slow_start_after_idle || tp->packets_out || +if (!sock_net (sk)->ipv4.sysctl_tcp_slow_start_after_idle || tp->packets_out || ca_ops->cong_control)return ; delta = tcp_jiffies32 - tp->lsndtime;
net/ipv4/sysctl_net_ipv4.c +7 -7
@@ -571,13 +571,6 @@ static struct ctl_table ipv4_table[] = { .mode = 0644, .proc_handler = proc_dointvec }, - { - .procname = "tcp_slow_start_after_idle", - .data = &sysctl_tcp_slow_start_after_idle, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = proc_dointvec - },#ifdef CONFIG_NETLABEL { .procname = "cipso_cache_enable",
@@ -1145,6 +1138,13 @@ static struct ctl_table ipv4_net_table[] = { .mode = 0644, .proc_handler = proc_dointvec }, + { + .procname = "tcp_slow_start_after_idle", + .data = &init_net.ipv4.sysctl_tcp_slow_start_after_idle, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec + }, { } };
net/ipv4/tcp_ipv4.c +1 -0
@@ -2486,6 +2486,7 @@ static int __net_init tcp_sk_init(struct net *net) net->ipv4.sysctl_tcp_timestamps =1 ; net->ipv4.sysctl_tcp_early_retrans =3 ; net->ipv4.sysctl_tcp_recovery =TCP_RACK_LOSS_DETECTION ; + net->ipv4.sysctl_tcp_slow_start_after_idle =1 ;/* By default, RFC2861 behavior. */ net->ipv4.sysctl_tcp_fastopen =TFO_CLIENT_ENABLE ;spin_lock_init (&net->ipv4.tcp_fastopen_ctx_lock);
net/ipv4/tcp_output.c +1 -4
@@ -62,9 +62,6 @@ int sysctl_tcp_limit_output_bytes __read_mostly = 262144;*/ int sysctl_tcp_tso_win_divisor__read_mostly =3 ; -/* By default, RFC2861 behavior. */ -int sysctl_tcp_slow_start_after_idle__read_mostly =1 ; -static bool tcp_write_xmit (struct sock *sk,unsigned int mss_now,int nonagle,int push_one,gfp_t gfp);
@@ -1690,7 +1687,7 @@ static void tcp_cwnd_validate(struct sock *sk, bool is_cwnd_limited)if (tp->packets_out > tp->snd_cwnd_used) tp->snd_cwnd_used = tp->packets_out; -if (sysctl_tcp_slow_start_after_idle && +if (sock_net (sk)->ipv4.sysctl_tcp_slow_start_after_idle && (s32)(tcp_jiffies32 - tp->snd_cwnd_stamp) >=inet_csk (sk)->icsk_rto && !ca_ops->cong_control)tcp_cwnd_application_limited (sk);
Signature · 1 line
2.15.0.rc2.357.g7e34df9404-goog
PATCH v2 5/15 tcp: Namespace-ify sysctl_tcp_retrans_collapse
In reply to Eric Dumazet--- include/net/netns/ipv4.h | 1 + include/net/tcp.h | 1 - net/ipv4/sysctl_net_ipv4.c | 14 +++++++------- net/ipv4/tcp_ipv4.c | 2 +- net/ipv4/tcp_output.c | 5 +---- 5 files changed, 10 insertions(+), 13 deletions(-)
include/net/netns/ipv4.h +1 -0
@@ -132,6 +132,7 @@ struct netns_ipv4 {int sysctl_tcp_recovery;int sysctl_tcp_thin_linear_timeouts;int sysctl_tcp_slow_start_after_idle; +int sysctl_tcp_retrans_collapse;struct inet_timewait_death_row tcp_death_row;int sysctl_max_syn_backlog;int sysctl_tcp_fastopen;
include/net/tcp.h +0 -1
@@ -243,7 +243,6 @@ void tcp_time_wait(struct sock *sk, int state, int timeo);/* sysctl variables for tcp */ -extern int sysctl_tcp_retrans_collapse;extern int sysctl_tcp_stdurg;extern int sysctl_tcp_rfc1337;extern int sysctl_tcp_abort_on_overflow;
net/ipv4/sysctl_net_ipv4.c +7 -7
@@ -386,13 +386,6 @@ static int proc_tcp_available_ulp(struct ctl_table *ctl, }static struct ctl_table ipv4_table[] = { - { - .procname ="tcp_retrans_collapse" , - .data = &sysctl_tcp_retrans_collapse, - .maxlen =sizeof (int ), - .mode =0644 , - .proc_handler = proc_dointvec - }, { .procname ="tcp_max_orphans" , .data = &sysctl_tcp_max_orphans,
@@ -1145,6 +1138,13 @@ static struct ctl_table ipv4_net_table[] = { .mode = 0644, .proc_handler = proc_dointvec }, + { + .procname = "tcp_retrans_collapse", + .data = &init_net.ipv4.sysctl_tcp_retrans_collapse, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec + }, { } };
net/ipv4/tcp_ipv4.c +1 -1
@@ -2487,7 +2487,7 @@ static int __net_init tcp_sk_init(struct net *net) net->ipv4.sysctl_tcp_early_retrans =3 ; net->ipv4.sysctl_tcp_recovery =TCP_RACK_LOSS_DETECTION ; net->ipv4.sysctl_tcp_slow_start_after_idle =1 ;/* By default, RFC2861 behavior. */ - + net->ipv4.sysctl_tcp_retrans_collapse =1 ; net->ipv4.sysctl_tcp_fastopen =TFO_CLIENT_ENABLE ;spin_lock_init (&net->ipv4.tcp_fastopen_ctx_lock); net->ipv4.sysctl_tcp_fastopen_blackhole_timeout =60 *60 ;
net/ipv4/tcp_output.c +1 -4
@@ -45,9 +45,6 @@#include <trace/events/tcp.h> -/* People can turn this off for buggy TCP's found in printers etc. */ -int sysctl_tcp_retrans_collapse__read_mostly =1 ; -/* People can turn this on to work with those rare, broken TCPs that * interpret the window field as a signed quantity. */
@@ -2804,7 +2801,7 @@ static void tcp_retrans_try_collapse(struct sock *sk, struct sk_buff *to,struct sk_buff *skb = to, *tmp;bool first = true; -if (!sysctl_tcp_retrans_collapse) +if (!sock_net (sk)->ipv4.sysctl_tcp_retrans_collapse)return ;if (TCP_SKB_CB (skb)->tcp_flags &TCPHDR_SYN )return ;
Signature · 1 line
2.15.0.rc2.357.g7e34df9404-goog
PATCH v2 6/15 tcp: Namespace-ify sysctl_tcp_stdurg
In reply to Eric Dumazet--- include/net/netns/ipv4.h | 1 + include/net/tcp.h | 1 - net/ipv4/sysctl_net_ipv4.c | 14 +++++++------- net/ipv4/tcp_input.c | 3 +-- 4 files changed, 9 insertions(+), 10 deletions(-)
include/net/netns/ipv4.h +1 -0
@@ -133,6 +133,7 @@ struct netns_ipv4 {int sysctl_tcp_thin_linear_timeouts;int sysctl_tcp_slow_start_after_idle;int sysctl_tcp_retrans_collapse; +int sysctl_tcp_stdurg;struct inet_timewait_death_row tcp_death_row;int sysctl_max_syn_backlog;int sysctl_tcp_fastopen;
include/net/tcp.h +0 -1
@@ -243,7 +243,6 @@ void tcp_time_wait(struct sock *sk, int state, int timeo);/* sysctl variables for tcp */ -extern int sysctl_tcp_stdurg;extern int sysctl_tcp_rfc1337;extern int sysctl_tcp_abort_on_overflow;extern int sysctl_tcp_max_orphans;
net/ipv4/sysctl_net_ipv4.c +7 -7
@@ -400,13 +400,6 @@ static struct ctl_table ipv4_table[] = { .mode = 0644, .proc_handler = proc_dointvec }, - { - .procname = "tcp_stdurg", - .data = &sysctl_tcp_stdurg, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = proc_dointvec - }, { .procname = "tcp_rfc1337", .data = &sysctl_tcp_rfc1337,
@@ -1145,6 +1138,13 @@ static struct ctl_table ipv4_net_table[] = { .mode = 0644, .proc_handler = proc_dointvec }, + { + .procname = "tcp_stdurg", + .data = &init_net.ipv4.sysctl_tcp_stdurg, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec + }, { } };
net/ipv4/tcp_input.c +1 -2
@@ -89,7 +89,6 @@ EXPORT_SYMBOL(sysctl_tcp_adv_win_scale);/* rfc5961 challenge ack rate limiting */ int sysctl_tcp_challenge_ack_limit =1000 ; -int sysctl_tcp_stdurg__read_mostly ;int sysctl_tcp_rfc1337__read_mostly ;int sysctl_tcp_max_orphans__read_mostly =NR_FILE ;int sysctl_tcp_frto__read_mostly =2 ;
@@ -5123,7 +5122,7 @@ static void tcp_check_urg(struct sock *sk, const struct tcphdr *th)struct tcp_sock *tp =tcp_sk (sk);u32 ptr =ntohs (th->urg_ptr); -if (ptr && !sysctl_tcp_stdurg) +if (ptr && !sock_net (sk)->ipv4.sysctl_tcp_stdurg) ptr--; ptr +=ntohl (th->seq);
Signature · 1 line
2.15.0.rc2.357.g7e34df9404-goog
PATCH v2 7/15 tcp: Namespace-ify sysctl_tcp_rfc1337
In reply to Eric Dumazet--- include/net/netns/ipv4.h | 1 + include/net/tcp.h | 1 - net/ipv4/sysctl_net_ipv4.c | 14 +++++++------- net/ipv4/tcp_input.c | 1 - net/ipv4/tcp_minisocks.c | 2 +- 5 files changed, 9 insertions(+), 10 deletions(-)
include/net/netns/ipv4.h +1 -0
@@ -134,6 +134,7 @@ struct netns_ipv4 {int sysctl_tcp_slow_start_after_idle;int sysctl_tcp_retrans_collapse;int sysctl_tcp_stdurg; +int sysctl_tcp_rfc1337;struct inet_timewait_death_row tcp_death_row;int sysctl_max_syn_backlog;int sysctl_tcp_fastopen;
include/net/tcp.h +0 -1
@@ -243,7 +243,6 @@ void tcp_time_wait(struct sock *sk, int state, int timeo);/* sysctl variables for tcp */ -extern int sysctl_tcp_rfc1337;extern int sysctl_tcp_abort_on_overflow;extern int sysctl_tcp_max_orphans;extern int sysctl_tcp_fack;
net/ipv4/sysctl_net_ipv4.c +7 -7
@@ -400,13 +400,6 @@ static struct ctl_table ipv4_table[] = { .mode = 0644, .proc_handler = proc_dointvec }, - { - .procname = "tcp_rfc1337", - .data = &sysctl_tcp_rfc1337, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = proc_dointvec - }, { .procname = "inet_peer_threshold", .data = &inet_peer_threshold,
@@ -1145,6 +1138,13 @@ static struct ctl_table ipv4_net_table[] = { .mode = 0644, .proc_handler = proc_dointvec }, + { + .procname = "tcp_rfc1337", + .data = &init_net.ipv4.sysctl_tcp_rfc1337, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec + }, { } };
net/ipv4/tcp_input.c +0 -1
@@ -89,7 +89,6 @@ EXPORT_SYMBOL(sysctl_tcp_adv_win_scale);/* rfc5961 challenge ack rate limiting */ int sysctl_tcp_challenge_ack_limit =1000 ; -int sysctl_tcp_rfc1337__read_mostly ;int sysctl_tcp_max_orphans__read_mostly =NR_FILE ;int sysctl_tcp_frto__read_mostly =2 ;int sysctl_tcp_min_rtt_wlen__read_mostly =300 ;
net/ipv4/tcp_minisocks.c +1 -1
@@ -181,7 +181,7 @@ tcp_timewait_state_process(struct inet_timewait_sock *tw, struct sk_buff *skb,* Oh well... nobody has a sufficient solution to this * protocol bug yet. */ -if (sysctl_tcp_rfc1337 ==0 ) { +if (twsk_net (tw)->ipv4.sysctl_tcp_rfc1337 ==0 ) { kill:inet_twsk_deschedule_put (tw);return TCP_TW_SUCCESS ;
Signature · 1 line
2.15.0.rc2.357.g7e34df9404-goog
PATCH v2 8/15 tcp: Namespace-ify sysctl_tcp_abort_on_overflow
In reply to Eric Dumazet--- include/net/netns/ipv4.h | 1 + include/net/tcp.h | 1 - net/ipv4/sysctl_net_ipv4.c | 14 +++++++------- net/ipv4/tcp_minisocks.c | 4 +--- 4 files changed, 9 insertions(+), 11 deletions(-)
include/net/netns/ipv4.h +1 -0
@@ -135,6 +135,7 @@ struct netns_ipv4 {int sysctl_tcp_retrans_collapse;int sysctl_tcp_stdurg;int sysctl_tcp_rfc1337; +int sysctl_tcp_abort_on_overflow;struct inet_timewait_death_row tcp_death_row;int sysctl_max_syn_backlog;int sysctl_tcp_fastopen;
include/net/tcp.h +0 -1
@@ -243,7 +243,6 @@ void tcp_time_wait(struct sock *sk, int state, int timeo);/* sysctl variables for tcp */ -extern int sysctl_tcp_abort_on_overflow;extern int sysctl_tcp_max_orphans;extern int sysctl_tcp_fack;extern int sysctl_tcp_reordering;
net/ipv4/sysctl_net_ipv4.c +7 -7
@@ -393,13 +393,6 @@ static struct ctl_table ipv4_table[] = { .mode = 0644, .proc_handler = proc_dointvec }, - { - .procname = "tcp_abort_on_overflow", - .data = &sysctl_tcp_abort_on_overflow, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = proc_dointvec - }, { .procname = "inet_peer_threshold", .data = &inet_peer_threshold,
@@ -1145,6 +1138,13 @@ static struct ctl_table ipv4_net_table[] = { .mode = 0644, .proc_handler = proc_dointvec }, + { + .procname = "tcp_abort_on_overflow", + .data = &init_net.ipv4.sysctl_tcp_abort_on_overflow, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec + }, { } };
net/ipv4/tcp_minisocks.c +1 -3
@@ -29,8 +29,6 @@#include <net/xfrm.h> #include <net/busy_poll.h> -int sysctl_tcp_abort_on_overflow__read_mostly ; -static bool tcp_in_window (u32 seq,u32 end_seq,u32 s_win,u32 e_win) {if (seq == s_win)
@@ -783,7 +781,7 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,return inet_csk_complete_hashdance (sk, child, req, own_req); listen_overflow: -if (!sysctl_tcp_abort_on_overflow) { +if (!sock_net (sk)->ipv4.sysctl_tcp_abort_on_overflow) {inet_rsk (req)->acked =1 ;return NULL ; }
Signature · 1 line
2.15.0.rc2.357.g7e34df9404-goog
PATCH v2 9/15 tcp: Namespace-ify sysctl_tcp_fack
In reply to Eric Dumazet--- include/net/netns/ipv4.h | 1 + include/net/tcp.h | 1 - net/ipv4/sysctl_net_ipv4.c | 14 +++++++------- net/ipv4/tcp.c | 2 +- net/ipv4/tcp_input.c | 3 +-- net/ipv4/tcp_minisocks.c | 2 +- 6 files changed, 11 insertions(+), 12 deletions(-)
include/net/netns/ipv4.h +1 -0
@@ -136,6 +136,7 @@ struct netns_ipv4 {int sysctl_tcp_stdurg;int sysctl_tcp_rfc1337;int sysctl_tcp_abort_on_overflow; +int sysctl_tcp_fack;struct inet_timewait_death_row tcp_death_row;int sysctl_max_syn_backlog;int sysctl_tcp_fastopen;
include/net/tcp.h +0 -1
@@ -244,7 +244,6 @@ void tcp_time_wait(struct sock *sk, int state, int timeo);/* sysctl variables for tcp */ extern int sysctl_tcp_max_orphans; -extern int sysctl_tcp_fack;extern int sysctl_tcp_reordering;extern int sysctl_tcp_max_reordering;extern int sysctl_tcp_dsack;
net/ipv4/sysctl_net_ipv4.c +7 -7
@@ -414,13 +414,6 @@ static struct ctl_table ipv4_table[] = { .mode = 0644, .proc_handler = proc_dointvec_jiffies, }, - { - .procname = "tcp_fack", - .data = &sysctl_tcp_fack, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = proc_dointvec - }, { .procname = "tcp_max_reordering", .data = &sysctl_tcp_max_reordering,
@@ -1145,6 +1138,13 @@ static struct ctl_table ipv4_net_table[] = { .mode = 0644, .proc_handler = proc_dointvec }, + { + .procname = "tcp_fack", + .data = &init_net.ipv4.sysctl_tcp_fack, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec + }, { } };
net/ipv4/tcp.c +1 -1
@@ -2517,7 +2517,7 @@ static int tcp_repair_options_est(struct sock *sk,return -EINVAL ; tp->rx_opt.sack_ok |=TCP_SACK_SEEN ; -if (sysctl_tcp_fack) +if (sock_net (sk)->ipv4.sysctl_tcp_fack)tcp_enable_fack (tp);break ;case TCPOPT_TIMESTAMP :
net/ipv4/tcp_input.c +1 -2
@@ -79,7 +79,6 @@#include <linux/unaligned/access_ok.h> #include <linux/static_key.h> -int sysctl_tcp_fack__read_mostly ;int sysctl_tcp_max_reordering__read_mostly =300 ;int sysctl_tcp_dsack__read_mostly =1 ;int sysctl_tcp_app_win__read_mostly =31 ;
@@ -5720,7 +5719,7 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb, tp->tcp_header_len =sizeof (struct tcphdr ); } -if (tcp_is_sack (tp) && sysctl_tcp_fack) +if (tcp_is_sack (tp) &&sock_net (sk)->ipv4.sysctl_tcp_fack)tcp_enable_fack (tp);tcp_sync_mss (sk, icsk->icsk_pmtu_cookie);
net/ipv4/tcp_minisocks.c +1 -1
@@ -510,7 +510,7 @@ struct sock *tcp_create_openreq_child(const struct sock *sk, newtp->rx_opt.tstamp_ok = ireq->tstamp_ok;if ((newtp->rx_opt.sack_ok = ireq->sack_ok) !=0 ) { -if (sysctl_tcp_fack) +if (sock_net (sk)->ipv4.sysctl_tcp_fack)tcp_enable_fack (newtp); } newtp->window_clamp = req->rsk_window_clamp;
Signature · 1 line
2.15.0.rc2.357.g7e34df9404-goog
PATCH v2 10/15 tcp: remove stale sysctl_tcp_reordering
In reply to Eric DumazetThis extern is no longer used.
--- include/net/tcp.h | 1 - 1 file changed, 1 deletion(-)
include/net/tcp.h +0 -1
@@ -244,7 +244,6 @@ void tcp_time_wait(struct sock *sk, int state, int timeo);/* sysctl variables for tcp */ extern int sysctl_tcp_max_orphans; -extern int sysctl_tcp_reordering;extern int sysctl_tcp_max_reordering;extern int sysctl_tcp_dsack;extern long sysctl_tcp_mem[3 ];
Signature · 1 line
2.15.0.rc2.357.g7e34df9404-goog
PATCH v2 11/15 tcp: Namespace-ify sysctl_tcp_max_reordering
In reply to Eric Dumazet--- include/net/netns/ipv4.h | 1 + include/net/tcp.h | 1 - net/ipv4/sysctl_net_ipv4.c | 14 +++++++------- net/ipv4/tcp_input.c | 3 +-- net/ipv4/tcp_ipv4.c | 2 ++ 5 files changed, 11 insertions(+), 10 deletions(-)
include/net/netns/ipv4.h +1 -0
@@ -137,6 +137,7 @@ struct netns_ipv4 {int sysctl_tcp_rfc1337;int sysctl_tcp_abort_on_overflow;int sysctl_tcp_fack; +int sysctl_tcp_max_reordering;struct inet_timewait_death_row tcp_death_row;int sysctl_max_syn_backlog;int sysctl_tcp_fastopen;
include/net/tcp.h +0 -1
@@ -244,7 +244,6 @@ void tcp_time_wait(struct sock *sk, int state, int timeo);/* sysctl variables for tcp */ extern int sysctl_tcp_max_orphans; -extern int sysctl_tcp_max_reordering;extern int sysctl_tcp_dsack;extern long sysctl_tcp_mem[3 ];extern int sysctl_tcp_wmem[3 ];
net/ipv4/sysctl_net_ipv4.c +7 -7
@@ -414,13 +414,6 @@ static struct ctl_table ipv4_table[] = { .mode = 0644, .proc_handler = proc_dointvec_jiffies, }, - { - .procname = "tcp_max_reordering", - .data = &sysctl_tcp_max_reordering, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = proc_dointvec - }, { .procname = "tcp_dsack", .data = &sysctl_tcp_dsack,
@@ -1145,6 +1138,13 @@ static struct ctl_table ipv4_net_table[] = { .mode = 0644, .proc_handler = proc_dointvec }, + { + .procname = "tcp_max_reordering", + .data = &init_net.ipv4.sysctl_tcp_max_reordering, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec + }, { } };
net/ipv4/tcp_input.c +1 -2
@@ -79,7 +79,6 @@#include <linux/unaligned/access_ok.h> #include <linux/static_key.h> -int sysctl_tcp_max_reordering__read_mostly =300 ;int sysctl_tcp_dsack__read_mostly =1 ;int sysctl_tcp_app_win__read_mostly =31 ;int sysctl_tcp_adv_win_scale__read_mostly =1 ;
@@ -889,7 +888,7 @@ static void tcp_update_reordering(struct sock *sk, const int metric,return ;if (metric > tp->reordering) { - tp->reordering =min (sysctl_tcp_max_reordering, metric); + tp->reordering =min (sock_net (sk)->ipv4.sysctl_tcp_max_reordering, metric);#if FASTRETRANS_DEBUG >1 pr_debug("Disorder%d %d %u f%u s%u rr%d\n",
net/ipv4/tcp_ipv4.c +2 -0
@@ -2488,6 +2488,8 @@ static int __net_init tcp_sk_init(struct net *net) net->ipv4.sysctl_tcp_recovery =TCP_RACK_LOSS_DETECTION ; net->ipv4.sysctl_tcp_slow_start_after_idle =1 ;/* By default, RFC2861 behavior. */ net->ipv4.sysctl_tcp_retrans_collapse =1 ; + net->ipv4.sysctl_tcp_max_reordering =300 ; + net->ipv4.sysctl_tcp_fastopen =TFO_CLIENT_ENABLE ;spin_lock_init (&net->ipv4.tcp_fastopen_ctx_lock); net->ipv4.sysctl_tcp_fastopen_blackhole_timeout =60 *60 ;
Signature · 1 line
2.15.0.rc2.357.g7e34df9404-goog
PATCH v2 12/15 tcp: Namespace-ify sysctl_tcp_dsack
In reply to Eric Dumazet--- include/net/netns/ipv4.h | 1 + include/net/tcp.h | 1 - net/ipv4/sysctl_net_ipv4.c | 14 +++++++------- net/ipv4/tcp_input.c | 5 ++--- net/ipv4/tcp_ipv4.c | 1 + 5 files changed, 11 insertions(+), 11 deletions(-)
include/net/netns/ipv4.h +1 -0
@@ -138,6 +138,7 @@ struct netns_ipv4 {int sysctl_tcp_abort_on_overflow;int sysctl_tcp_fack;int sysctl_tcp_max_reordering; +int sysctl_tcp_dsack;struct inet_timewait_death_row tcp_death_row;int sysctl_max_syn_backlog;int sysctl_tcp_fastopen;
include/net/tcp.h +0 -1
@@ -244,7 +244,6 @@ void tcp_time_wait(struct sock *sk, int state, int timeo);/* sysctl variables for tcp */ extern int sysctl_tcp_max_orphans; -extern int sysctl_tcp_dsack;extern long sysctl_tcp_mem[3 ];extern int sysctl_tcp_wmem[3 ];extern int sysctl_tcp_rmem[3 ];
net/ipv4/sysctl_net_ipv4.c +7 -7
@@ -414,13 +414,6 @@ static struct ctl_table ipv4_table[] = { .mode = 0644, .proc_handler = proc_dointvec_jiffies, }, - { - .procname = "tcp_dsack", - .data = &sysctl_tcp_dsack, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = proc_dointvec - }, { .procname = "tcp_mem", .maxlen = sizeof(sysctl_tcp_mem),
@@ -1145,6 +1138,13 @@ static struct ctl_table ipv4_net_table[] = { .mode = 0644, .proc_handler = proc_dointvec }, + { + .procname = "tcp_dsack", + .data = &init_net.ipv4.sysctl_tcp_dsack, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec + }, { } };
net/ipv4/tcp_input.c +2 -3
@@ -79,7 +79,6 @@#include <linux/unaligned/access_ok.h> #include <linux/static_key.h> -int sysctl_tcp_dsack__read_mostly =1 ;int sysctl_tcp_app_win__read_mostly =31 ;int sysctl_tcp_adv_win_scale__read_mostly =1 ;EXPORT_SYMBOL (sysctl_tcp_adv_win_scale);
@@ -4150,7 +4149,7 @@ static void tcp_dsack_set(struct sock *sk, u32 seq, u32 end_seq) {struct tcp_sock *tp =tcp_sk (sk); -if (tcp_is_sack (tp) && sysctl_tcp_dsack) { +if (tcp_is_sack (tp) &&sock_net (sk)->ipv4.sysctl_tcp_dsack) {int mib_idx;if (before (seq, tp->rcv_nxt))
@@ -4185,7 +4184,7 @@ static void tcp_send_dupack(struct sock *sk, const struct sk_buff *skb)NET_INC_STATS (sock_net (sk),LINUX_MIB_DELAYEDACKLOST );tcp_enter_quickack_mode (sk); -if (tcp_is_sack (tp) && sysctl_tcp_dsack) { +if (tcp_is_sack (tp) &&sock_net (sk)->ipv4.sysctl_tcp_dsack) {u32 end_seq =TCP_SKB_CB (skb)->end_seq;if (after (TCP_SKB_CB (skb)->end_seq, tp->rcv_nxt))
net/ipv4/tcp_ipv4.c +1 -0
@@ -2489,6 +2489,7 @@ static int __net_init tcp_sk_init(struct net *net) net->ipv4.sysctl_tcp_slow_start_after_idle =1 ;/* By default, RFC2861 behavior. */ net->ipv4.sysctl_tcp_retrans_collapse =1 ; net->ipv4.sysctl_tcp_max_reordering =300 ; + net->ipv4.sysctl_tcp_dsack =1 ; net->ipv4.sysctl_tcp_fastopen =TFO_CLIENT_ENABLE ;spin_lock_init (&net->ipv4.tcp_fastopen_ctx_lock);
Signature · 1 line
2.15.0.rc2.357.g7e34df9404-goog
PATCH v2 13/15 tcp: Namespace-ify sysctl_tcp_app_win
In reply to Eric Dumazet--- include/net/netns/ipv4.h | 1 + include/net/tcp.h | 1 - net/ipv4/sysctl_net_ipv4.c | 14 +++++++------- net/ipv4/tcp_input.c | 8 ++++---- net/ipv4/tcp_ipv4.c | 1 + 5 files changed, 13 insertions(+), 12 deletions(-)
include/net/netns/ipv4.h +1 -0
@@ -139,6 +139,7 @@ struct netns_ipv4 {int sysctl_tcp_fack;int sysctl_tcp_max_reordering;int sysctl_tcp_dsack; +int sysctl_tcp_app_win;struct inet_timewait_death_row tcp_death_row;int sysctl_max_syn_backlog;int sysctl_tcp_fastopen;
include/net/tcp.h +0 -1
@@ -247,7 +247,6 @@ extern int sysctl_tcp_max_orphans;extern long sysctl_tcp_mem[3 ];extern int sysctl_tcp_wmem[3 ];extern int sysctl_tcp_rmem[3 ]; -extern int sysctl_tcp_app_win;extern int sysctl_tcp_adv_win_scale;extern int sysctl_tcp_frto;extern int sysctl_tcp_nometrics_save;
net/ipv4/sysctl_net_ipv4.c +7 -7
@@ -437,13 +437,6 @@ static struct ctl_table ipv4_table[] = { .proc_handler = proc_dointvec_minmax, .extra1 = &one, }, - { - .procname = "tcp_app_win", - .data = &sysctl_tcp_app_win, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = proc_dointvec - }, { .procname = "tcp_adv_win_scale", .data = &sysctl_tcp_adv_win_scale,
@@ -1145,6 +1138,13 @@ static struct ctl_table ipv4_net_table[] = { .mode = 0644, .proc_handler = proc_dointvec }, + { + .procname = "tcp_app_win", + .data = &init_net.ipv4.sysctl_tcp_app_win, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec + }, { } };
net/ipv4/tcp_input.c +4 -4
@@ -79,7 +79,6 @@#include <linux/unaligned/access_ok.h> #include <linux/static_key.h> -int sysctl_tcp_app_win__read_mostly =31 ;int sysctl_tcp_adv_win_scale__read_mostly =1 ;EXPORT_SYMBOL (sysctl_tcp_adv_win_scale);
@@ -428,6 +427,7 @@ static void tcp_fixup_rcvbuf(struct sock *sk)*/ void tcp_init_buffer_space (struct sock *sk) { +int tcp_app_win =sock_net (sk)->ipv4.sysctl_tcp_app_win;struct tcp_sock *tp =tcp_sk (sk);int maxwin;
@@ -446,14 +446,14 @@ void tcp_init_buffer_space(struct sock *sk)if (tp->window_clamp >= maxwin) { tp->window_clamp = maxwin; -if (sysctl_tcp_app_win && maxwin >4 * tp->advmss) +if (tcp_app_win && maxwin >4 * tp->advmss) tp->window_clamp =max (maxwin - - (maxwin >> sysctl_tcp_app_win), + (maxwin >> tcp_app_win),4 * tp->advmss); }/* Force reservation of one segment. */ -if (sysctl_tcp_app_win && +if (tcp_app_win && tp->window_clamp >2 * tp->advmss && tp->window_clamp + tp->advmss > maxwin) tp->window_clamp =max (2 * tp->advmss, maxwin - tp->advmss);
net/ipv4/tcp_ipv4.c +1 -0
@@ -2490,6 +2490,7 @@ static int __net_init tcp_sk_init(struct net *net) net->ipv4.sysctl_tcp_retrans_collapse =1 ; net->ipv4.sysctl_tcp_max_reordering =300 ; net->ipv4.sysctl_tcp_dsack =1 ; + net->ipv4.sysctl_tcp_app_win =31 ; net->ipv4.sysctl_tcp_fastopen =TFO_CLIENT_ENABLE ;spin_lock_init (&net->ipv4.tcp_fastopen_ctx_lock);
Signature · 1 line
2.15.0.rc2.357.g7e34df9404-goog
PATCH v2 14/15 tcp: Namespace-ify sysctl_tcp_adv_win_scale
In reply to Eric Dumazet--- include/net/netns/ipv4.h | 1 + include/net/tcp.h | 9 ++++----- net/ipv4/sysctl_net_ipv4.c | 18 +++++++++--------- net/ipv4/tcp_input.c | 13 +++++-------- net/ipv4/tcp_ipv4.c | 1 + 5 files changed, 20 insertions(+), 22 deletions(-)
include/net/netns/ipv4.h +1 -0
@@ -140,6 +140,7 @@ struct netns_ipv4 {int sysctl_tcp_max_reordering;int sysctl_tcp_dsack;int sysctl_tcp_app_win; +int sysctl_tcp_adv_win_scale;struct inet_timewait_death_row tcp_death_row;int sysctl_max_syn_backlog;int sysctl_tcp_fastopen;
include/net/tcp.h +4 -5
@@ -247,7 +247,6 @@ extern int sysctl_tcp_max_orphans;extern long sysctl_tcp_mem[3 ];extern int sysctl_tcp_wmem[3 ];extern int sysctl_tcp_rmem[3 ]; -extern int sysctl_tcp_adv_win_scale;extern int sysctl_tcp_frto;extern int sysctl_tcp_nometrics_save;extern int sysctl_tcp_moderate_rcvbuf;
@@ -1311,9 +1310,9 @@ void tcp_select_initial_window(int __space, __u32 mss, __u32 *rcv_wnd, __u32 *window_clamp, int wscale_ok, __u8 *rcv_wscale, __u32 init_rcv_wnd); -static inline int tcp_win_from_space (int space) +static inline int tcp_win_from_space (const struct sock *sk,int space) { -int tcp_adv_win_scale = sysctl_tcp_adv_win_scale; +int tcp_adv_win_scale =sock_net (sk)->ipv4.sysctl_tcp_adv_win_scale;return tcp_adv_win_scale <=0 ? (space>>(-tcp_adv_win_scale)) :
@@ -1323,13 +1322,13 @@ static inline int tcp_win_from_space(int space)/* Note: caller must be prepared to deal with negative returns */ static inline int tcp_space (const struct sock *sk) { -return tcp_win_from_space (sk->sk_rcvbuf - +return tcp_win_from_space (sk, sk->sk_rcvbuf -atomic_read (&sk->sk_rmem_alloc)); }static inline int tcp_full_space (const struct sock *sk) { -return tcp_win_from_space (sk->sk_rcvbuf); +return tcp_win_from_space (sk, sk->sk_rcvbuf); } extern void tcp_openreq_init_rwin(struct request_sock *req,
net/ipv4/sysctl_net_ipv4.c +9 -9
@@ -437,15 +437,6 @@ static struct ctl_table ipv4_table[] = { .proc_handler = proc_dointvec_minmax, .extra1 = &one, }, - { - .procname = "tcp_adv_win_scale", - .data = &sysctl_tcp_adv_win_scale, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = proc_dointvec_minmax, - .extra1 = &tcp_adv_win_scale_min, - .extra2 = &tcp_adv_win_scale_max, - }, { .procname = "tcp_frto", .data = &sysctl_tcp_frto,
@@ -1145,6 +1136,15 @@ static struct ctl_table ipv4_net_table[] = { .mode = 0644, .proc_handler = proc_dointvec }, + { + .procname = "tcp_adv_win_scale", + .data = &init_net.ipv4.sysctl_tcp_adv_win_scale, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec_minmax, + .extra1 = &tcp_adv_win_scale_min, + .extra2 = &tcp_adv_win_scale_max, + }, { } };
net/ipv4/tcp_input.c +5 -8
@@ -79,9 +79,6 @@#include <linux/unaligned/access_ok.h> #include <linux/static_key.h> -int sysctl_tcp_adv_win_scale__read_mostly =1 ; -EXPORT_SYMBOL (sysctl_tcp_adv_win_scale); -/* rfc5961 challenge ack rate limiting */ int sysctl_tcp_challenge_ack_limit =1000 ;
@@ -363,8 +360,8 @@ static int __tcp_grow_window(const struct sock *sk, const struct sk_buff *skb) {struct tcp_sock *tp =tcp_sk (sk);/* Optimize this! */ -int truesize =tcp_win_from_space (skb->truesize) >>1 ; -int window =tcp_win_from_space (sysctl_tcp_rmem[2 ]) >>1 ; +int truesize =tcp_win_from_space (sk, skb->truesize) >>1 ; +int window =tcp_win_from_space (sk, sysctl_tcp_rmem[2 ]) >>1 ;while (tp->rcv_ssthresh <= window) {if (truesize <= skb->len)
@@ -389,7 +386,7 @@ static void tcp_grow_window(struct sock *sk, const struct sk_buff *skb)/* Check #2. Increase window, if skb with such overhead * will fit to rcvbuf in future. */ -if (tcp_win_from_space (skb->truesize) <= skb->len) +if (tcp_win_from_space (sk, skb->truesize) <= skb->len) incr =2 * tp->advmss;else incr =__tcp_grow_window (sk, skb);
@@ -630,7 +627,7 @@ void tcp_rcv_space_adjust(struct sock *sk) } rcvmem =SKB_TRUESIZE (tp->advmss +MAX_TCP_HEADER ); -while (tcp_win_from_space (rcvmem) < tp->advmss) +while (tcp_win_from_space (sk, rcvmem) < tp->advmss) rcvmem +=128 ; rcvbuf =min (rcvwin / tp->advmss * rcvmem, sysctl_tcp_rmem[2 ]);
@@ -4809,7 +4806,7 @@ tcp_collapse(struct sock *sk, struct sk_buff_head *list, struct rb_root *root,* overlaps to the next one. */ if (!(TCP_SKB_CB (skb)->tcp_flags & (TCPHDR_SYN |TCPHDR_FIN )) && - (tcp_win_from_space (skb->truesize) > skb->len || + (tcp_win_from_space (sk, skb->truesize) > skb->len ||before (TCP_SKB_CB (skb)->seq, start))) { end_of_skbs = false;break ;
net/ipv4/tcp_ipv4.c +1 -0
@@ -2491,6 +2491,7 @@ static int __net_init tcp_sk_init(struct net *net) net->ipv4.sysctl_tcp_max_reordering =300 ; net->ipv4.sysctl_tcp_dsack =1 ; net->ipv4.sysctl_tcp_app_win =31 ; + net->ipv4.sysctl_tcp_adv_win_scale =1 ; net->ipv4.sysctl_tcp_fastopen =TFO_CLIENT_ENABLE ;spin_lock_init (&net->ipv4.tcp_fastopen_ctx_lock);
Signature · 1 line
2.15.0.rc2.357.g7e34df9404-goog
PATCH v2 15/15 tcp: Namespace-ify sysctl_tcp_frto
In reply to Eric Dumazet--- include/net/netns/ipv4.h | 1 + include/net/tcp.h | 1 - net/ipv4/sysctl_net_ipv4.c | 14 +++++++------- net/ipv4/tcp_input.c | 3 +-- net/ipv4/tcp_ipv4.c | 1 + 5 files changed, 10 insertions(+), 10 deletions(-)
include/net/netns/ipv4.h +1 -0
@@ -141,6 +141,7 @@ struct netns_ipv4 {int sysctl_tcp_dsack;int sysctl_tcp_app_win;int sysctl_tcp_adv_win_scale; +int sysctl_tcp_frto;struct inet_timewait_death_row tcp_death_row;int sysctl_max_syn_backlog;int sysctl_tcp_fastopen;
include/net/tcp.h +0 -1
@@ -247,7 +247,6 @@ extern int sysctl_tcp_max_orphans;extern long sysctl_tcp_mem[3 ];extern int sysctl_tcp_wmem[3 ];extern int sysctl_tcp_rmem[3 ]; -extern int sysctl_tcp_frto;extern int sysctl_tcp_nometrics_save;extern int sysctl_tcp_moderate_rcvbuf;extern int sysctl_tcp_tso_win_divisor;
net/ipv4/sysctl_net_ipv4.c +7 -7
@@ -437,13 +437,6 @@ static struct ctl_table ipv4_table[] = { .proc_handler = proc_dointvec_minmax, .extra1 = &one, }, - { - .procname = "tcp_frto", - .data = &sysctl_tcp_frto, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = proc_dointvec - }, { .procname = "tcp_min_rtt_wlen", .data = &sysctl_tcp_min_rtt_wlen,
@@ -1145,6 +1138,13 @@ static struct ctl_table ipv4_net_table[] = { .extra1 = &tcp_adv_win_scale_min, .extra2 = &tcp_adv_win_scale_max, }, + { + .procname = "tcp_frto", + .data = &init_net.ipv4.sysctl_tcp_frto, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec + }, { } };
net/ipv4/tcp_input.c +1 -2
@@ -83,7 +83,6 @@int sysctl_tcp_challenge_ack_limit =1000 ;int sysctl_tcp_max_orphans__read_mostly =NR_FILE ; -int sysctl_tcp_frto__read_mostly =2 ;int sysctl_tcp_min_rtt_wlen__read_mostly =300 ;int sysctl_tcp_moderate_rcvbuf__read_mostly =1 ;int sysctl_tcp_invalid_ratelimit__read_mostly =HZ /2 ;
@@ -2026,7 +2025,7 @@ void tcp_enter_loss(struct sock *sk)* falsely raise the receive window, which results in repeated * timeouts and stop-and-go behavior. */ - tp->frto = sysctl_tcp_frto && + tp->frto = net->ipv4.sysctl_tcp_frto && (new_recovery || icsk->icsk_retransmits) && !inet_csk (sk)->icsk_mtup.probe_size; }
net/ipv4/tcp_ipv4.c +1 -0
@@ -2492,6 +2492,7 @@ static int __net_init tcp_sk_init(struct net *net) net->ipv4.sysctl_tcp_dsack =1 ; net->ipv4.sysctl_tcp_app_win =31 ; net->ipv4.sysctl_tcp_adv_win_scale =1 ; + net->ipv4.sysctl_tcp_frto =2 ; net->ipv4.sysctl_tcp_fastopen =TFO_CLIENT_ENABLE ;spin_lock_init (&net->ipv4.tcp_fastopen_ctx_lock);
Signature · 1 line
2.15.0.rc2.357.g7e34df9404-goog