brintos

brintos / linux-shallow public Read only

0
0
Text · 2.0 KiB · 2fa2b0b Raw
82 lines · plain
1.. SPDX-License-Identifier: GPL-2.0-only2.. Copyright (C) 2022 Red Hat, Inc.3 4========5Redirect6========7XDP_REDIRECT8############9Supported maps10--------------11 12XDP_REDIRECT works with the following map types:13 14- ``BPF_MAP_TYPE_DEVMAP``15- ``BPF_MAP_TYPE_DEVMAP_HASH``16- ``BPF_MAP_TYPE_CPUMAP``17- ``BPF_MAP_TYPE_XSKMAP``18 19For more information on these maps, please see the specific map documentation.20 21Process22-------23 24.. kernel-doc:: net/core/filter.c25   :doc: xdp redirect26 27.. note::28    Not all drivers support transmitting frames after a redirect, and for29    those that do, not all of them support non-linear frames. Non-linear xdp30    bufs/frames are bufs/frames that contain more than one fragment.31 32Debugging packet drops33----------------------34Silent packet drops for XDP_REDIRECT can be debugged using:35 36- bpf_trace37- perf_record38 39bpf_trace40^^^^^^^^^41The following bpftrace command can be used to capture and count all XDP tracepoints:42 43.. code-block:: none44 45    sudo bpftrace -e 'tracepoint:xdp:* { @cnt[probe] = count(); }'46    Attaching 12 probes...47    ^C48 49    @cnt[tracepoint:xdp:mem_connect]: 1850    @cnt[tracepoint:xdp:mem_disconnect]: 1851    @cnt[tracepoint:xdp:xdp_exception]: 1960552    @cnt[tracepoint:xdp:xdp_devmap_xmit]: 139360453    @cnt[tracepoint:xdp:xdp_redirect]: 2229220054 55.. note::56    The various xdp tracepoints can be found in ``source/include/trace/events/xdp.h``57 58The following bpftrace command can be used to extract the ``ERRNO`` being returned as59part of the err parameter:60 61.. code-block:: none62 63    sudo bpftrace -e \64    'tracepoint:xdp:xdp_redirect*_err {@redir_errno[-args->err] = count();}65    tracepoint:xdp:xdp_devmap_xmit {@devmap_errno[-args->err] = count();}'66 67perf record68^^^^^^^^^^^69The perf tool also supports recording tracepoints:70 71.. code-block:: none72 73    perf record -a -e xdp:xdp_redirect_err \74        -e xdp:xdp_redirect_map_err \75        -e xdp:xdp_exception \76        -e xdp:xdp_devmap_xmit77 78References79===========80 81- https://github.com/xdp-project/xdp-tutorial/tree/master/tracing02-xdp-monitor82