summaryrefslogtreecommitdiff
path: root/samples/bpf/xdp_sample_user.h
diff options
context:
space:
mode:
authorKumar Kartikeya Dwivedi <memxor@gmail.com>2021-08-21 05:49:57 +0530
committerAlexei Starovoitov <ast@kernel.org>2021-08-24 14:48:41 -0700
commitd771e217506adcfbfb08c693fb9332ee4859d61d (patch)
tree5b3053b3f52d3719c98b319a34416ca1ac9dabc6 /samples/bpf/xdp_sample_user.h
parent0cf3c2fc4b1afbd8d9c376754af34c1d2bd56de7 (diff)
downloadlwn-d771e217506adcfbfb08c693fb9332ee4859d61d.tar.gz
lwn-d771e217506adcfbfb08c693fb9332ee4859d61d.zip
samples: bpf: Add cpumap tracepoint statistics support
This consolidates retrieval and printing into the XDP sample helper. For the kthread stats, it expands xdp_stats separately with its own per-CPU stats. For cpumap enqueue, we display FROM->TO stats also with its per-CPU stats. The help out explains in detail the various aspects of the output. Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20210821002010.845777-10-memxor@gmail.com
Diffstat (limited to 'samples/bpf/xdp_sample_user.h')
-rw-r--r--samples/bpf/xdp_sample_user.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/samples/bpf/xdp_sample_user.h b/samples/bpf/xdp_sample_user.h
index aa28e4bdd628..203732615fee 100644
--- a/samples/bpf/xdp_sample_user.h
+++ b/samples/bpf/xdp_sample_user.h
@@ -11,6 +11,8 @@ enum stats_mask {
_SAMPLE_REDIRECT_MAP = 1U << 0,
SAMPLE_RX_CNT = 1U << 1,
SAMPLE_REDIRECT_ERR_CNT = 1U << 2,
+ SAMPLE_CPUMAP_ENQUEUE_CNT = 1U << 3,
+ SAMPLE_CPUMAP_KTHREAD_CNT = 1U << 4,
SAMPLE_EXCEPTION_CNT = 1U << 5,
SAMPLE_REDIRECT_CNT = 1U << 7,
SAMPLE_REDIRECT_MAP_CNT = SAMPLE_REDIRECT_CNT | _SAMPLE_REDIRECT_MAP,
@@ -76,6 +78,10 @@ static inline char *safe_strncpy(char *dst, const char *src, size_t size)
__attach_tp(tp_xdp_redirect_map_err); \
if (mask & SAMPLE_REDIRECT_ERR_CNT) \
__attach_tp(tp_xdp_redirect_err); \
+ if (mask & SAMPLE_CPUMAP_ENQUEUE_CNT) \
+ __attach_tp(tp_xdp_cpumap_enqueue); \
+ if (mask & SAMPLE_CPUMAP_KTHREAD_CNT) \
+ __attach_tp(tp_xdp_cpumap_kthread); \
if (mask & SAMPLE_EXCEPTION_CNT) \
__attach_tp(tp_xdp_exception); \
return 0; \