1 .. SPDX-License-Identifier: GPL-2.0-only
2 .. Copyright (C) 2022 Red Hat, Inc.
12 XDP_REDIRECT works with the following map types:
14 - ``BPF_MAP_TYPE_DEVMAP``
15 - ``BPF_MAP_TYPE_DEVMAP_HASH``
16 - ``BPF_MAP_TYPE_CPUMAP``
17 - ``BPF_MAP_TYPE_XSKMAP``
19 For more information on these maps, please see the specific map documentation.
24 .. kernel-doc:: net/core/filter.c
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.
32 Debugging packet drops
33 ----------------------
34 Silent packet drops for XDP_REDIRECT can be debugged using:
41 The following bpftrace command can be used to capture and count all XDP tracepoints:
45 sudo bpftrace -e 'tracepoint:xdp:* { @cnt[probe] = count(); }'
46 Attaching 12 probes...
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
56 The various xdp tracepoints can be found in ``source/include/trace/events/xdp.h``
58 The following bpftrace command can be used to extract the ``ERRNO`` being returned as
59 part of the err parameter:
64 'tracepoint:xdp:xdp_redirect*_err {@redir_errno[-args->err] = count();}
65 tracepoint:xdp:xdp_devmap_xmit {@devmap_errno[-args->err] = count();}'
69 The perf tool also supports recording tracepoints:
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
81 - https://github.com/xdp-project/xdp-tutorial/tree/master/tracing02-xdp-monitor