Skip to content
  • Jesper Dangaard Brouer's avatar
    samples/bpf: xdp_monitor tool based on tracepoints · 3ffab546
    Jesper Dangaard Brouer authored
    
    
    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: default avatarJesper Dangaard Brouer <brouer@redhat.com>
    Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    3ffab546