summaryrefslogtreecommitdiffstats
path: root/net/core/filter.c
diff options
context:
space:
mode:
authorMartin KaFai Lau <kafai@fb.com>2020-08-20 12:00:27 -0700
committerAlexei Starovoitov <ast@kernel.org>2020-08-24 14:35:00 -0700
commitca584ba070864c606f3a54faaafe774726d5b4a1 (patch)
treeb3288fe9d41eb22da482f526b897e561afab3bdc /net/core/filter.c
parent2b8ee4f05d4f6a6c427ad30dd6c1bb49eb2efd3b (diff)
downloadlinux-stable-ca584ba070864c606f3a54faaafe774726d5b4a1.tar.gz
linux-stable-ca584ba070864c606f3a54faaafe774726d5b4a1.tar.bz2
linux-stable-ca584ba070864c606f3a54faaafe774726d5b4a1.zip
tcp: bpf: Add TCP_BPF_RTO_MIN for bpf_setsockopt
This patch adds bpf_setsockopt(TCP_BPF_RTO_MIN) to allow bpf prog to set the min rto of a connection. It could be used together with the earlier patch which has added bpf_setsockopt(TCP_BPF_DELACK_MAX). A later selftest patch will communicate the max delay ack in a bpf tcp header option and then the receiving side can use bpf_setsockopt(TCP_BPF_RTO_MIN) to set a shorter rto. Signed-off-by: Martin KaFai Lau <kafai@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Reviewed-by: Eric Dumazet <edumazet@google.com> Acked-by: John Fastabend <john.fastabend@gmail.com> Link: https://lore.kernel.org/bpf/20200820190027.2884170-1-kafai@fb.com
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 80fe7420f609..075ab71b985c 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -4488,6 +4488,13 @@ static int _bpf_setsockopt(struct sock *sk, int level, int optname,
return -EINVAL;
inet_csk(sk)->icsk_delack_max = timeout;
break;
+ case TCP_BPF_RTO_MIN:
+ timeout = usecs_to_jiffies(val);
+ if (timeout > TCP_RTO_MIN ||
+ timeout < TCP_TIMEOUT_MIN)
+ return -EINVAL;
+ inet_csk(sk)->icsk_rto_min = timeout;
+ break;
case TCP_SAVE_SYN:
if (val < 0 || val > 1)
ret = -EINVAL;