Skip to content

Commit 13bf964

Browse files
Lawrence Brakmodavem330
authored andcommitted
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 7bc62e2 commit 13bf964

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

include/uapi/linux/bpf.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -784,5 +784,6 @@ enum {
784784
};
785785

786786
#define TCP_BPF_IW 1001 /* Set TCP initial congestion window */
787+
#define TCP_BPF_SNDCWND_CLAMP 1002 /* Set sndcwnd_clamp */
787788

788789
#endif /* _UAPI__LINUX_BPF_H__ */

net/core/filter.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2746,6 +2746,13 @@ BPF_CALL_5(bpf_setsockopt, struct bpf_sock_ops_kern *, bpf_sock,
27462746
else
27472747
tp->snd_cwnd = val;
27482748
break;
2749+
case TCP_BPF_SNDCWND_CLAMP:
2750+
if (val <= 0) {
2751+
ret = -EINVAL;
2752+
} else {
2753+
tp->snd_cwnd_clamp = val;
2754+
tp->snd_ssthresh = val;
2755+
}
27492756
default:
27502757
ret = -EINVAL;
27512758
}

0 commit comments

Comments
 (0)