]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
bpf: tcp: Allow to write tp->snd_cwnd_stamp in bpf_tcp_ca
authorMiao Xu <miaxu@meta.com>
Thu, 2 May 2024 04:23:17 +0000 (21:23 -0700)
committerMartin KaFai Lau <martin.lau@kernel.org>
Thu, 2 May 2024 23:26:56 +0000 (16:26 -0700)
This patch allows the write of tp->snd_cwnd_stamp in a bpf tcp
ca program. An use case of writing this field is to keep track
of the time whenever tp->snd_cwnd is raised or reduced inside
the `cong_control` callback.

Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Miao Xu <miaxu@meta.com>
Link: https://lore.kernel.org/r/20240502042318.801932-3-miaxu@meta.com
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
net/ipv4/bpf_tcp_ca.c

index 6bd7f8db189a96e5da54e4aa2864358318c2483a..18227757ec0cebea5847bb636733445580a1385d 100644 (file)
@@ -107,6 +107,9 @@ static int bpf_tcp_ca_btf_struct_access(struct bpf_verifier_log *log,
        case offsetof(struct tcp_sock, snd_cwnd_cnt):
                end = offsetofend(struct tcp_sock, snd_cwnd_cnt);
                break;
+       case offsetof(struct tcp_sock, snd_cwnd_stamp):
+               end = offsetofend(struct tcp_sock, snd_cwnd_stamp);
+               break;
        case offsetof(struct tcp_sock, snd_ssthresh):
                end = offsetofend(struct tcp_sock, snd_ssthresh);
                break;