aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_output.c
diff options
context:
space:
mode:
authorLawrence Brakmo <brakmo@fb.com>2017-06-30 23:02:44 -0400
committerDavid S. Miller <davem@davemloft.net>2017-07-01 19:15:13 -0400
commit13d3b1ebe28762c79e981931a41914fae5d04386 (patch)
tree2ba5e7acc2245ff6296bc8b51e10d49559cdb928 /net/ipv4/tcp_output.c
parent61bc4d8daa7af018d7ea084ea38648828a5a90d5 (diff)
bpf: Support for setting initial receive window
This patch adds suppport for setting the initial advertized window from within a BPF_SOCK_OPS program. This can be used to support larger initial cwnd values in environments where it is known to be safe. Signed-off-by: Lawrence Brakmo <brakmo@fb.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_output.c')
-rw-r--r--net/ipv4/tcp_output.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 47fe0759a877..ef809426b538 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -3266,6 +3266,7 @@ static void tcp_connect_init(struct sock *sk)
3266 const struct dst_entry *dst = __sk_dst_get(sk); 3266 const struct dst_entry *dst = __sk_dst_get(sk);
3267 struct tcp_sock *tp = tcp_sk(sk); 3267 struct tcp_sock *tp = tcp_sk(sk);
3268 __u8 rcv_wscale; 3268 __u8 rcv_wscale;
3269 u32 rcv_wnd;
3269 3270
3270 /* We'll fix this up when we get a response from the other end. 3271 /* We'll fix this up when we get a response from the other end.
3271 * See tcp_input.c:tcp_rcv_state_process case TCP_SYN_SENT. 3272 * See tcp_input.c:tcp_rcv_state_process case TCP_SYN_SENT.
@@ -3299,13 +3300,17 @@ static void tcp_connect_init(struct sock *sk)
3299 (tp->window_clamp > tcp_full_space(sk) || tp->window_clamp == 0)) 3300 (tp->window_clamp > tcp_full_space(sk) || tp->window_clamp == 0))
3300 tp->window_clamp = tcp_full_space(sk); 3301 tp->window_clamp = tcp_full_space(sk);
3301 3302
3303 rcv_wnd = tcp_rwnd_init_bpf(sk);
3304 if (rcv_wnd == 0)
3305 rcv_wnd = dst_metric(dst, RTAX_INITRWND);
3306
3302 tcp_select_initial_window(tcp_full_space(sk), 3307 tcp_select_initial_window(tcp_full_space(sk),
3303 tp->advmss - (tp->rx_opt.ts_recent_stamp ? tp->tcp_header_len - sizeof(struct tcphdr) : 0), 3308 tp->advmss - (tp->rx_opt.ts_recent_stamp ? tp->tcp_header_len - sizeof(struct tcphdr) : 0),
3304 &tp->rcv_wnd, 3309 &tp->rcv_wnd,
3305 &tp->window_clamp, 3310 &tp->window_clamp,
3306 sock_net(sk)->ipv4.sysctl_tcp_window_scaling, 3311 sock_net(sk)->ipv4.sysctl_tcp_window_scaling,
3307 &rcv_wscale, 3312 &rcv_wscale,
3308 dst_metric(dst, RTAX_INITRWND)); 3313 rcv_wnd);
3309 3314
3310 tp->rx_opt.rcv_wscale = rcv_wscale; 3315 tp->rx_opt.rcv_wscale = rcv_wscale;
3311 tp->rcv_ssthresh = tp->rcv_wnd; 3316 tp->rcv_ssthresh = tp->rcv_wnd;