From: Yuchung Cheng Date: Wed, 9 Jan 2019 02:12:24 +0000 (-0800) Subject: bpf: correctly set initial window on active Fast Open sender X-Git-Tag: v4.14.104~42 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=b1bf951df56775f4401ece4101470936b47c27c1;p=users%2Fjedix%2Flinux-maple.git bpf: correctly set initial window on active Fast Open sender [ Upstream commit 31aa6503a15ba00182ea6dbbf51afb63bf9e851d ] The existing BPF TCP initial congestion window (TCP_BPF_IW) does not to work on (active) Fast Open sender. This is because it changes the (initial) window only if data_segs_out is zero -- but data_segs_out is also incremented on SYN-data. This patch fixes the issue by proerly accounting for SYN-data additionally. Fixes: fc7478103c84 ("bpf: Adds support for setting initial cwnd") Signed-off-by: Yuchung Cheng Reviewed-by: Neal Cardwell Acked-by: Lawrence Brakmo Signed-off-by: Alexei Starovoitov Signed-off-by: Sasha Levin --- diff --git a/net/core/filter.c b/net/core/filter.c index 542fd04bc44d..a8a9ff0568b9 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -3128,7 +3128,7 @@ BPF_CALL_5(bpf_setsockopt, struct bpf_sock_ops_kern *, bpf_sock, /* Only some options are supported */ switch (optname) { case TCP_BPF_IW: - if (val <= 0 || tp->data_segs_out > 0) + if (val <= 0 || tp->data_segs_out > tp->syn_data) ret = -EINVAL; else tp->snd_cwnd = val;