]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
bpf: Adds support for setting sndcwnd clamp
authorLawrence Brakmo <brakmo@fb.com>
Sat, 1 Jul 2017 03:02:53 +0000 (20:02 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sat, 1 Jul 2017 23:15:14 +0000 (16:15 -0700)
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>
include/uapi/linux/bpf.h
net/core/filter.c

index 32755b538652d0e3614f81fbbe47a157dc9220bf..a6a91e5e96fcae9810e9af9abf8c5b857fcd2abf 100644 (file)
@@ -784,5 +784,6 @@ enum {
 };
 
 #define TCP_BPF_IW             1001    /* Set TCP initial congestion window */
+#define TCP_BPF_SNDCWND_CLAMP  1002    /* Set sndcwnd_clamp */
 
 #endif /* _UAPI__LINUX_BPF_H__ */
index 794be0a454f54cdf52c8fec80d72923900b172da..523b91d2502552d092cbb90e348fa7e9a1f12ca1 100644 (file)
@@ -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;
                        }