From: chendotjs Date: Tue, 4 Jan 2022 19:26:15 +0000 (+0800) Subject: libbpf-tools: fix fentry prog in tcprtt (#3757) X-Git-Tag: v0.24.0~23 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d859879d2a61dfd5b601a2196fe7f46811f9ba6b;p=platform%2Fupstream%2Fbcc.git libbpf-tools: fix fentry prog in tcprtt (#3757) This commit fixes judgement if tcp_rcv_established fentry exists and fentry prog by introducing BPF_CORE_READ. Signed-off-by: chendotjs --- diff --git a/libbpf-tools/tcprtt.bpf.c b/libbpf-tools/tcprtt.bpf.c index 52afad0a..0b332e4e 100644 --- a/libbpf-tools/tcprtt.bpf.c +++ b/libbpf-tools/tcprtt.bpf.c @@ -2,6 +2,7 @@ // Copyright (c) 2021 Wenbo Zhang #include #include +#include #include #include #include "tcprtt.h" @@ -56,7 +57,7 @@ int BPF_PROG(tcp_rcv, struct sock *sk) if (!histp) return 0; ts = (struct tcp_sock *)(sk); - srtt = ts->srtt_us >> 3; + srtt = BPF_CORE_READ(ts, srtt_us) >> 3; if (targ_ms) srtt /= 1000U; slot = log2l(srtt); diff --git a/libbpf-tools/tcprtt.c b/libbpf-tools/tcprtt.c index e847b8d2..bed6efa7 100644 --- a/libbpf-tools/tcprtt.c +++ b/libbpf-tools/tcprtt.c @@ -243,7 +243,7 @@ int main(int argc, char **argv) obj->rodata->targ_daddr = env.raddr; obj->rodata->targ_ms = env.milliseconds; - if (!fentry_exists("tcp_rcv_established", NULL)) + if (fentry_exists("tcp_rcv_established", NULL)) bpf_program__set_autoload(obj->progs.tcp_rcv_kprobe, false); else bpf_program__set_autoload(obj->progs.tcp_rcv, false);