Skip to content

Commit e224c39

Browse files
yuchungchengborkmann
authored andcommitted
bpf: fix SO_MAX_PACING_RATE to support TCP internal pacing
If sch_fq packet scheduler is not used, TCP can fallback to internal pacing, but this requires sk_pacing_status to be properly set. Fixes: 8c4b4c7 ("bpf: Add setsockopt helper function to bpf") Signed-off-by: Yuchung Cheng <ycheng@google.com> Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Lawrence Brakmo <brakmo@fb.com> Acked-by: Martin KaFai Lau <kafai@fb.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
1 parent f4924f2 commit e224c39

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

net/core/filter.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4119,6 +4119,10 @@ BPF_CALL_5(bpf_setsockopt, struct bpf_sock_ops_kern *, bpf_sock,
41194119
sk->sk_sndbuf = max_t(int, val * 2, SOCK_MIN_SNDBUF);
41204120
break;
41214121
case SO_MAX_PACING_RATE: /* 32bit version */
4122+
if (val != ~0U)
4123+
cmpxchg(&sk->sk_pacing_status,
4124+
SK_PACING_NONE,
4125+
SK_PACING_NEEDED);
41224126
sk->sk_max_pacing_rate = (val == ~0U) ? ~0UL : val;
41234127
sk->sk_pacing_rate = min(sk->sk_pacing_rate,
41244128
sk->sk_max_pacing_rate);

0 commit comments

Comments
 (0)