~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/Documentation/bpf/redirect.rst

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 .. SPDX-License-Identifier: GPL-2.0-only
  2 .. Copyright (C) 2022 Red Hat, Inc.
  3 
  4 ========
  5 Redirect
  6 ========
  7 XDP_REDIRECT
  8 ############
  9 Supported maps
 10 --------------
 11 
 12 XDP_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 
 19 For more information on these maps, please see the specific map documentation.
 20 
 21 Process
 22 -------
 23 
 24 .. kernel-doc:: net/core/filter.c
 25    :doc: xdp redirect
 26 
 27 .. note::
 28     Not all drivers support transmitting frames after a redirect, and for
 29     those that do, not all of them support non-linear frames. Non-linear xdp
 30     bufs/frames are bufs/frames that contain more than one fragment.
 31 
 32 Debugging packet drops
 33 ----------------------
 34 Silent packet drops for XDP_REDIRECT can be debugged using:
 35 
 36 - bpf_trace
 37 - perf_record
 38 
 39 bpf_trace
 40 ^^^^^^^^^
 41 The following bpftrace command can be used to capture and count all XDP tracepoints:
 42 
 43 .. code-block:: none
 44 
 45     sudo bpftrace -e 'tracepoint:xdp:* { @cnt[probe] = count(); }'
 46     Attaching 12 probes...
 47     ^C
 48 
 49     @cnt[tracepoint:xdp:mem_connect]: 18
 50     @cnt[tracepoint:xdp:mem_disconnect]: 18
 51     @cnt[tracepoint:xdp:xdp_exception]: 19605
 52     @cnt[tracepoint:xdp:xdp_devmap_xmit]: 1393604
 53     @cnt[tracepoint:xdp:xdp_redirect]: 22292200
 54 
 55 .. note::
 56     The various xdp tracepoints can be found in ``source/include/trace/events/xdp.h``
 57 
 58 The following bpftrace command can be used to extract the ``ERRNO`` being returned as
 59 part of the err parameter:
 60 
 61 .. code-block:: none
 62 
 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 
 67 perf record
 68 ^^^^^^^^^^^
 69 The perf tool also supports recording tracepoints:
 70 
 71 .. code-block:: none
 72 
 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_xmit
 77 
 78 References
 79 ===========
 80 
 81 - https://github.com/xdp-project/xdp-tutorial/tree/master/tracing02-xdp-monitor

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php