Blob Blame History Raw
From: Yuchung Cheng <ycheng@google.com>
Date: Thu, 17 Jan 2019 08:51:01 -0800
Subject: bpf: fix SO_MAX_PACING_RATE to support TCP internal pacing
Patch-mainline: v5.0-rc3
Git-commit: e224c390a6259c529f7b2a6bd215a087b3344f5c
References: bsc#1109837

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: 8c4b4c7e9ff0 ("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>
Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
---
 net/core/filter.c |    4 ++++
 1 file changed, 4 insertions(+)

--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -3759,6 +3759,10 @@ BPF_CALL_5(bpf_setsockopt, struct bpf_so
 			sk->sk_sndbuf = max_t(int, val * 2, SOCK_MIN_SNDBUF);
 			break;
 		case SO_MAX_PACING_RATE:
+			if (val != ~0U)
+				cmpxchg(&sk->sk_pacing_status,
+					SK_PACING_NONE,
+					SK_PACING_NEEDED);
 			sk->sk_max_pacing_rate = val;
 			sk->sk_pacing_rate = min(sk->sk_pacing_rate,
 						 sk->sk_max_pacing_rate);