From: Jörn-Thorben Hinz Date: Wed, 22 Jun 2022 19:12:23 +0000 (+0200) Subject: bpf: Allow a TCP CC to write sk_pacing_rate and sk_pacing_status X-Git-Tag: v6.0-rc1~141^2~163^2~40^2~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=41c95dd6a604dc3f5fae55c99c138cc8e7fec76e;p=thirdparty%2Fkernel%2Flinux.git bpf: Allow a TCP CC to write sk_pacing_rate and sk_pacing_status A CC that implements tcp_congestion_ops.cong_control() should be able to control sk_pacing_rate and set sk_pacing_status, since tcp_update_pacing_rate() is never called in this case. A built-in CC or one from a kernel module is already able to write to both struct sock members. For a BPF program, write access has not been allowed, yet. Signed-off-by: Jörn-Thorben Hinz Reviewed-by: Martin KaFai Lau Link: https://lore.kernel.org/r/20220622191227.898118-2-jthinz@mailbox.tu-berlin.de Signed-off-by: Alexei Starovoitov --- diff --git a/net/ipv4/bpf_tcp_ca.c b/net/ipv4/bpf_tcp_ca.c index f79ab942f03b6..1f5c53ede4e59 100644 --- a/net/ipv4/bpf_tcp_ca.c +++ b/net/ipv4/bpf_tcp_ca.c @@ -111,6 +111,12 @@ static int bpf_tcp_ca_btf_struct_access(struct bpf_verifier_log *log, } switch (off) { + case offsetof(struct sock, sk_pacing_rate): + end = offsetofend(struct sock, sk_pacing_rate); + break; + case offsetof(struct sock, sk_pacing_status): + end = offsetofend(struct sock, sk_pacing_status); + break; case bpf_ctx_range(struct inet_connection_sock, icsk_ca_priv): end = offsetofend(struct inet_connection_sock, icsk_ca_priv); break;