summaryrefslogtreecommitdiffstats
path: root/net/core/filter.c
diff options
context:
space:
mode:
authorLawrence Brakmo2017-07-01 05:02:53 +0200
committerDavid S. Miller2017-07-02 01:15:14 +0200
commit13bf96411ad2bd162a4f9470d58c6bb579c96e21 (patch)
tree33d5d9ecfa19d4cc4752a888abf0b03ff42881c4 /net/core/filter.c
parentbpf: Sample BPF program to set initial cwnd (diff)
downloadkernel-qcow2-linux-13bf96411ad2bd162a4f9470d58c6bb579c96e21.tar.gz
kernel-qcow2-linux-13bf96411ad2bd162a4f9470d58c6bb579c96e21.tar.xz
kernel-qcow2-linux-13bf96411ad2bd162a4f9470d58c6bb579c96e21.zip
bpf: Adds support for setting sndcwnd clamp
Adds a new bpf_setsockopt for TCP sockets, TCP_BPF_SNDCWND_CLAMP, which sets the initial congestion window. It is useful to limit the sndcwnd when the host are close to each other (small RTT). Signed-off-by: Lawrence Brakmo <brakmo@fb.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/filter.c')
-rw-r--r--net/core/filter.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/net/core/filter.c b/net/core/filter.c
index 794be0a454f5..523b91d25025 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -2746,6 +2746,13 @@ BPF_CALL_5(bpf_setsockopt, struct bpf_sock_ops_kern *, bpf_sock,
else
tp->snd_cwnd = val;
break;
+ case TCP_BPF_SNDCWND_CLAMP:
+ if (val <= 0) {
+ ret = -EINVAL;
+ } else {
+ tp->snd_cwnd_clamp = val;
+ tp->snd_ssthresh = val;
+ }
default:
ret = -EINVAL;
}