]> git.baikalelectronics.ru Git - kernel.git/commit
samples/bpf: xdp_monitor tool based on tracepoints
authorJesper Dangaard Brouer <brouer@redhat.com>
Tue, 29 Aug 2017 14:38:11 +0000 (16:38 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 29 Aug 2017 17:51:29 +0000 (10:51 -0700)
commitde5d0e341c951470d3803fc23fc71e6c8e6884b5
treefb91db813a3b9c08d734ccffe5b19465b7274902
parent66227ee8122cdce3b8aedad704e2fe9152dc033b
samples/bpf: xdp_monitor tool based on tracepoints

This tool xdp_monitor demonstrate how to use the different xdp_redirect
tracepoints xdp_redirect{,_map}{,_err} from a BPF program.

The default mode is to only monitor the error counters, to avoid
affecting the per packet performance. Tracepoints comes with a base
overhead of 25 nanosec for an attached bpf_prog, and 48 nanosec for
using a full perf record (with non-matching filter).  Thus, default
loading the --stats mode could affect the maximum performance.

This version of the tool is very simple and count all types of errors
as one.  It will be natural to extend this later with the different
types of errors that can occur, which should help users quickly
identify common mistakes.

Because the TP_STRUCT was kept in sync all the tracepoints loads the
same BPF code.  It would also be natural to extend the map version to
demonstrate how the map information could be used.

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
samples/bpf/Makefile
samples/bpf/xdp_monitor_kern.c [new file with mode: 0644]
samples/bpf/xdp_monitor_user.c [new file with mode: 0644]