Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

bpf: correctly set initial window on active Fast Open sender

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 <ycheng@google.com>
Reviewed-by: Neal Cardwell <ncardwell@google.com>
Acked-by: Lawrence Brakmo <brakmo@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>

authored by

Yuchung Cheng and committed by
Alexei Starovoitov
31aa6503 d972f3dc

+1 -1
+1 -1
net/core/filter.c
··· 4203 4203 /* Only some options are supported */ 4204 4204 switch (optname) { 4205 4205 case TCP_BPF_IW: 4206 - if (val <= 0 || tp->data_segs_out > 0) 4206 + if (val <= 0 || tp->data_segs_out > tp->syn_data) 4207 4207 ret = -EINVAL; 4208 4208 else 4209 4209 tp->snd_cwnd = val;