|
@@ -79,23 +79,12 @@
|
|
#include <linux/unaligned/access_ok.h>
|
|
#include <linux/unaligned/access_ok.h>
|
|
#include <linux/static_key.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;
|
|
|
|
-int sysctl_tcp_adv_win_scale __read_mostly = 1;
|
|
|
|
-EXPORT_SYMBOL(sysctl_tcp_adv_win_scale);
|
|
|
|
-
|
|
|
|
/* rfc5961 challenge ack rate limiting */
|
|
/* rfc5961 challenge ack rate limiting */
|
|
int sysctl_tcp_challenge_ack_limit = 1000;
|
|
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_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_min_rtt_wlen __read_mostly = 300;
|
|
int sysctl_tcp_moderate_rcvbuf __read_mostly = 1;
|
|
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;
|
|
int sysctl_tcp_invalid_ratelimit __read_mostly = HZ/2;
|
|
|
|
|
|
#define FLAG_DATA 0x01 /* Incoming frame contained data. */
|
|
#define FLAG_DATA 0x01 /* Incoming frame contained data. */
|
|
@@ -370,8 +359,8 @@ static int __tcp_grow_window(const struct sock *sk, const struct sk_buff *skb)
|
|
{
|
|
{
|
|
struct tcp_sock *tp = tcp_sk(sk);
|
|
struct tcp_sock *tp = tcp_sk(sk);
|
|
/* Optimize this! */
|
|
/* 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) {
|
|
while (tp->rcv_ssthresh <= window) {
|
|
if (truesize <= skb->len)
|
|
if (truesize <= skb->len)
|
|
@@ -396,7 +385,7 @@ static void tcp_grow_window(struct sock *sk, const struct sk_buff *skb)
|
|
/* Check #2. Increase window, if skb with such overhead
|
|
/* Check #2. Increase window, if skb with such overhead
|
|
* will fit to rcvbuf in future.
|
|
* 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;
|
|
incr = 2 * tp->advmss;
|
|
else
|
|
else
|
|
incr = __tcp_grow_window(sk, skb);
|
|
incr = __tcp_grow_window(sk, skb);
|
|
@@ -434,6 +423,7 @@ static void tcp_fixup_rcvbuf(struct sock *sk)
|
|
*/
|
|
*/
|
|
void tcp_init_buffer_space(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);
|
|
struct tcp_sock *tp = tcp_sk(sk);
|
|
int maxwin;
|
|
int maxwin;
|
|
|
|
|
|
@@ -452,14 +442,14 @@ void tcp_init_buffer_space(struct sock *sk)
|
|
if (tp->window_clamp >= maxwin) {
|
|
if (tp->window_clamp >= maxwin) {
|
|
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 -
|
|
tp->window_clamp = max(maxwin -
|
|
- (maxwin >> sysctl_tcp_app_win),
|
|
|
|
|
|
+ (maxwin >> tcp_app_win),
|
|
4 * tp->advmss);
|
|
4 * tp->advmss);
|
|
}
|
|
}
|
|
|
|
|
|
/* Force reservation of one segment. */
|
|
/* Force reservation of one segment. */
|
|
- if (sysctl_tcp_app_win &&
|
|
|
|
|
|
+ if (tcp_app_win &&
|
|
tp->window_clamp > 2 * tp->advmss &&
|
|
tp->window_clamp > 2 * tp->advmss &&
|
|
tp->window_clamp + tp->advmss > maxwin)
|
|
tp->window_clamp + tp->advmss > maxwin)
|
|
tp->window_clamp = max(2 * tp->advmss, maxwin - tp->advmss);
|
|
tp->window_clamp = max(2 * tp->advmss, maxwin - tp->advmss);
|
|
@@ -636,7 +626,7 @@ void tcp_rcv_space_adjust(struct sock *sk)
|
|
}
|
|
}
|
|
|
|
|
|
rcvmem = SKB_TRUESIZE(tp->advmss + MAX_TCP_HEADER);
|
|
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;
|
|
rcvmem += 128;
|
|
|
|
|
|
rcvbuf = min(rcvwin / tp->advmss * rcvmem, sysctl_tcp_rmem[2]);
|
|
rcvbuf = min(rcvwin / tp->advmss * rcvmem, sysctl_tcp_rmem[2]);
|
|
@@ -893,7 +883,7 @@ static void tcp_update_reordering(struct sock *sk, const int metric,
|
|
return;
|
|
return;
|
|
|
|
|
|
if (metric > tp->reordering) {
|
|
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
|
|
#if FASTRETRANS_DEBUG > 1
|
|
pr_debug("Disorder%d %d %u f%u s%u rr%d\n",
|
|
pr_debug("Disorder%d %d %u f%u s%u rr%d\n",
|
|
@@ -2035,7 +2025,7 @@ void tcp_enter_loss(struct sock *sk)
|
|
* falsely raise the receive window, which results in repeated
|
|
* falsely raise the receive window, which results in repeated
|
|
* timeouts and stop-and-go behavior.
|
|
* timeouts and stop-and-go behavior.
|
|
*/
|
|
*/
|
|
- tp->frto = sysctl_tcp_frto &&
|
|
|
|
|
|
+ tp->frto = net->ipv4.sysctl_tcp_frto &&
|
|
(new_recovery || icsk->icsk_retransmits) &&
|
|
(new_recovery || icsk->icsk_retransmits) &&
|
|
!inet_csk(sk)->icsk_mtup.probe_size;
|
|
!inet_csk(sk)->icsk_mtup.probe_size;
|
|
}
|
|
}
|
|
@@ -2789,7 +2779,7 @@ static void tcp_rack_identify_loss(struct sock *sk, int *ack_flag)
|
|
struct tcp_sock *tp = tcp_sk(sk);
|
|
struct tcp_sock *tp = tcp_sk(sk);
|
|
|
|
|
|
/* Use RACK to detect loss */
|
|
/* 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;
|
|
u32 prior_retrans = tp->retrans_out;
|
|
|
|
|
|
tcp_rack_mark_lost(sk);
|
|
tcp_rack_mark_lost(sk);
|
|
@@ -4155,7 +4145,7 @@ static void tcp_dsack_set(struct sock *sk, u32 seq, u32 end_seq)
|
|
{
|
|
{
|
|
struct tcp_sock *tp = tcp_sk(sk);
|
|
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;
|
|
int mib_idx;
|
|
|
|
|
|
if (before(seq, tp->rcv_nxt))
|
|
if (before(seq, tp->rcv_nxt))
|
|
@@ -4190,7 +4180,7 @@ static void tcp_send_dupack(struct sock *sk, const struct sk_buff *skb)
|
|
NET_INC_STATS(sock_net(sk), LINUX_MIB_DELAYEDACKLOST);
|
|
NET_INC_STATS(sock_net(sk), LINUX_MIB_DELAYEDACKLOST);
|
|
tcp_enter_quickack_mode(sk);
|
|
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;
|
|
u32 end_seq = TCP_SKB_CB(skb)->end_seq;
|
|
|
|
|
|
if (after(TCP_SKB_CB(skb)->end_seq, tp->rcv_nxt))
|
|
if (after(TCP_SKB_CB(skb)->end_seq, tp->rcv_nxt))
|
|
@@ -4815,7 +4805,7 @@ restart:
|
|
* overlaps to the next one.
|
|
* overlaps to the next one.
|
|
*/
|
|
*/
|
|
if (!(TCP_SKB_CB(skb)->tcp_flags & (TCPHDR_SYN | TCPHDR_FIN)) &&
|
|
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))) {
|
|
before(TCP_SKB_CB(skb)->seq, start))) {
|
|
end_of_skbs = false;
|
|
end_of_skbs = false;
|
|
break;
|
|
break;
|
|
@@ -5124,7 +5114,7 @@ static void tcp_check_urg(struct sock *sk, const struct tcphdr *th)
|
|
struct tcp_sock *tp = tcp_sk(sk);
|
|
struct tcp_sock *tp = tcp_sk(sk);
|
|
u32 ptr = ntohs(th->urg_ptr);
|
|
u32 ptr = ntohs(th->urg_ptr);
|
|
|
|
|
|
- if (ptr && !sysctl_tcp_stdurg)
|
|
|
|
|
|
+ if (ptr && !sock_net(sk)->ipv4.sysctl_tcp_stdurg)
|
|
ptr--;
|
|
ptr--;
|
|
ptr += ntohl(th->seq);
|
|
ptr += ntohl(th->seq);
|
|
|
|
|
|
@@ -5723,7 +5713,7 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb,
|
|
tp->tcp_header_len = sizeof(struct tcphdr);
|
|
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_enable_fack(tp);
|
|
|
|
|
|
tcp_sync_mss(sk, icsk->icsk_pmtu_cookie);
|
|
tcp_sync_mss(sk, icsk->icsk_pmtu_cookie);
|