]> git.baikalelectronics.ru Git - kernel.git/commit
samples: bpf: Add basic infrastructure for XDP samples
authorKumar Kartikeya Dwivedi <memxor@gmail.com>
Sat, 21 Aug 2021 00:19:51 +0000 (05:49 +0530)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 24 Aug 2021 21:48:40 +0000 (14:48 -0700)
commitd1b70ef5f45368933223b8a07882b4f67bd9d9f4
treeb34dbe4fdc453124dfea1671b44db6dfcac54e7d
parent2e696eca8428e28e9f4cddf29449e8bacea61417
samples: bpf: Add basic infrastructure for XDP samples

This file implements some common helpers to consolidate differences in
features and functionality between the various XDP samples and give them
a consistent look, feel, and reporting capabilities.

This commit only adds support for receive statistics, which does not
rely on any tracepoint, but on the XDP program installed on the device
by each XDP redirect sample.

Some of the key features are:
 * A concise output format accompanied by helpful text explaining its
   fields.
 * An elaborate output format building upon the concise one, and folding
   out details in case of errors and staying out of view otherwise.
 * Printing driver names for devices redirecting packets.
 * Getting mac address for interface.
 * Printing summarized total statistics for the entire session.
 * Ability to dynamically switch between concise and verbose mode, using
   SIGQUIT (Ctrl + \).

In later patches, the support will be extended for each tracepoint with
its own custom output in concise and verbose mode.

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-4-memxor@gmail.com
samples/bpf/xdp_sample_shared.h [new file with mode: 0644]
samples/bpf/xdp_sample_user.c [new file with mode: 0644]
samples/bpf/xdp_sample_user.h [new file with mode: 0644]