€•@Œsphinx.addnodes”Œdocument”“”)”}”(Œ rawsource”Œ”Œchildren”]”(Œ translations”Œ LanguagesNode”“”)”}”(hhh]”(hŒ pending_xref”“”)”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…””}”Œparent”hsbaŒ attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”Œ refdomain”Œstd”Œreftype”Œdoc”Œ reftarget”Œ /translations/zh_CN/bpf/redirect”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)”}”(hhh]”hŒChinese (Traditional)”…””}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ /translations/zh_TW/bpf/redirect”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒItalian”…””}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ /translations/it_IT/bpf/redirect”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒJapanese”…””}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ /translations/ja_JP/bpf/redirect”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒKorean”…””}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ /translations/ko_KR/bpf/redirect”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒPortuguese (Brazilian)”…””}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ /translations/pt_BR/bpf/redirect”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒSpanish”…””}”hh–sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ /translations/sp_SP/bpf/redirect”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒcomment”“”)”}”(hŒ%SPDX-License-Identifier: GPL-2.0-only”h]”hŒ%SPDX-License-Identifier: GPL-2.0-only”…””}”hh·sbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1hµhhh²hh³Œ:/var/lib/git/docbuild/linux/Documentation/bpf/redirect.rst”h´Kubh¶)”}”(hŒ Copyright (C) 2022 Red Hat, Inc.”h]”hŒ Copyright (C) 2022 Red Hat, Inc.”…””}”hhÈsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1hµhhh²hh³hÇh´KubhŒsection”“”)”}”(hhh]”(hŒtitle”“”)”}”(hŒRedirect”h]”hŒRedirect”…””}”(hhÝh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhhØh²hh³hÇh´Kubh×)”}”(hhh]”(hÜ)”}”(hŒ XDP_REDIRECT”h]”hŒ XDP_REDIRECT”…””}”(hhîh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhhëh²hh³hÇh´Kubh×)”}”(hhh]”(hÜ)”}”(hŒSupported maps”h]”hŒSupported maps”…””}”(hhÿh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhhüh²hh³hÇh´K ubhŒ paragraph”“”)”}”(hŒ0XDP_REDIRECT works with the following map types:”h]”hŒ0XDP_REDIRECT works with the following map types:”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j h³hÇh´K hhüh²hubhŒ bullet_list”“”)”}”(hhh]”(hŒ list_item”“”)”}”(hŒ``BPF_MAP_TYPE_DEVMAP``”h]”j)”}”(hj&h]”hŒliteral”“”)”}”(hj&h]”hŒBPF_MAP_TYPE_DEVMAP”…””}”(hj-h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j+hj(ubah}”(h]”h ]”h"]”h$]”h&]”uh1j h³hÇh´Khj$ubah}”(h]”h ]”h"]”h$]”h&]”uh1j"hjh²hh³hÇh´Nubj#)”}”(hŒ``BPF_MAP_TYPE_DEVMAP_HASH``”h]”j)”}”(hjHh]”j,)”}”(hjHh]”hŒBPF_MAP_TYPE_DEVMAP_HASH”…””}”(hjMh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j+hjJubah}”(h]”h ]”h"]”h$]”h&]”uh1j h³hÇh´KhjFubah}”(h]”h ]”h"]”h$]”h&]”uh1j"hjh²hh³hÇh´Nubj#)”}”(hŒ``BPF_MAP_TYPE_CPUMAP``”h]”j)”}”(hjhh]”j,)”}”(hjhh]”hŒBPF_MAP_TYPE_CPUMAP”…””}”(hjmh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j+hjjubah}”(h]”h ]”h"]”h$]”h&]”uh1j h³hÇh´Khjfubah}”(h]”h ]”h"]”h$]”h&]”uh1j"hjh²hh³hÇh´Nubj#)”}”(hŒ``BPF_MAP_TYPE_XSKMAP`` ”h]”j)”}”(hŒ``BPF_MAP_TYPE_XSKMAP``”h]”j,)”}”(hjŒh]”hŒBPF_MAP_TYPE_XSKMAP”…””}”(hjŽh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j+hjŠubah}”(h]”h ]”h"]”h$]”h&]”uh1j h³hÇh´Khj†ubah}”(h]”h ]”h"]”h$]”h&]”uh1j"hjh²hh³hÇh´Nubeh}”(h]”h ]”h"]”h$]”h&]”Œbullet”Œ-”uh1jh³hÇh´Khhüh²hubj)”}”(hŒNFor more information on these maps, please see the specific map documentation.”h]”hŒNFor more information on these maps, please see the specific map documentation.”…””}”(hj¯h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j h³hÇh´Khhüh²hubeh}”(h]”Œsupported-maps”ah ]”h"]”Œsupported maps”ah$]”h&]”uh1hÖhhëh²hh³hÇh´K ubh×)”}”(hhh]”(hÜ)”}”(hŒProcess”h]”hŒProcess”…””}”(hjÈh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhjÅh²hh³hÇh´Kubj)”}”(hŒOXDP_REDIRECT works by a three-step process, implemented in the functions below:”h]”hŒOXDP_REDIRECT works by a three-step process, implemented in the functions below:”…””}”(hjÖh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j h³ŒN/var/lib/git/docbuild/linux/Documentation/bpf/redirect:24: ./net/core/filter.c”h´MãhjÅh²hubhŒenumerated_list”“”)”}”(hhh]”(j#)”}”(hŒ®The bpf_redirect() and bpf_redirect_map() helpers will lookup the target of the redirect and store it (along with some other metadata) in a per-CPU struct bpf_redirect_info. ”h]”j)”}”(hŒ­The bpf_redirect() and bpf_redirect_map() helpers will lookup the target of the redirect and store it (along with some other metadata) in a per-CPU struct bpf_redirect_info.”h]”hŒ­The bpf_redirect() and bpf_redirect_map() helpers will lookup the target of the redirect and store it (along with some other metadata) in a per-CPU struct bpf_redirect_info.”…””}”(hjîh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j h³ŒN/var/lib/git/docbuild/linux/Documentation/bpf/redirect:24: ./net/core/filter.c”h´Mæhjêubah}”(h]”h ]”h"]”h$]”h&]”uh1j"hjçubj#)”}”(hŒæWhen the program returns the XDP_REDIRECT return code, the driver will call xdp_do_redirect() which will use the information in struct bpf_redirect_info to actually enqueue the frame into a map type-specific bulk queue structure. ”h]”j)”}”(hŒåWhen the program returns the XDP_REDIRECT return code, the driver will call xdp_do_redirect() which will use the information in struct bpf_redirect_info to actually enqueue the frame into a map type-specific bulk queue structure.”h]”hŒåWhen the program returns the XDP_REDIRECT return code, the driver will call xdp_do_redirect() which will use the information in struct bpf_redirect_info to actually enqueue the frame into a map type-specific bulk queue structure.”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j h³ŒN/var/lib/git/docbuild/linux/Documentation/bpf/redirect:24: ./net/core/filter.c”h´Mêhjubah}”(h]”h ]”h"]”h$]”h&]”uh1j"hjçubj#)”}”(hXŠBefore exiting its NAPI poll loop, the driver will call xdp_do_flush(), which will flush all the different bulk queues, thus completing the redirect. Note that xdp_do_flush() must be called before napi_complete_done() in the driver, as the XDP_REDIRECT logic relies on being inside a single NAPI instance through to the xdp_do_flush() call for RCU protection of all in-kernel data structures. ”h]”j)”}”(hXˆBefore exiting its NAPI poll loop, the driver will call xdp_do_flush(), which will flush all the different bulk queues, thus completing the redirect. Note that xdp_do_flush() must be called before napi_complete_done() in the driver, as the XDP_REDIRECT logic relies on being inside a single NAPI instance through to the xdp_do_flush() call for RCU protection of all in-kernel data structures.”h]”hXˆBefore exiting its NAPI poll loop, the driver will call xdp_do_flush(), which will flush all the different bulk queues, thus completing the redirect. Note that xdp_do_flush() must be called before napi_complete_done() in the driver, as the XDP_REDIRECT logic relies on being inside a single NAPI instance through to the xdp_do_flush() call for RCU protection of all in-kernel data structures.”…””}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j h³ŒN/var/lib/git/docbuild/linux/Documentation/bpf/redirect:24: ./net/core/filter.c”h´Mïhjubah}”(h]”h ]”h"]”h$]”h&]”uh1j"hjçubeh}”(h]”h ]”h"]”h$]”h&]”Œenumtype”Œarabic”Œprefix”hŒsuffix”Œ.”uh1jåhjÅh²hh³Nh´NubhŒnote”“”)”}”(hŒÏNot all drivers support transmitting frames after a redirect, and for those that do, not all of them support non-linear frames. Non-linear xdp bufs/frames are bufs/frames that contain more than one fragment.”h]”j)”}”(hŒÏNot all drivers support transmitting frames after a redirect, and for those that do, not all of them support non-linear frames. Non-linear xdp bufs/frames are bufs/frames that contain more than one fragment.”h]”hŒÏNot all drivers support transmitting frames after a redirect, and for those that do, not all of them support non-linear frames. Non-linear xdp bufs/frames are bufs/frames that contain more than one fragment.”…””}”(hjFh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j h³hÇh´KhjBubah}”(h]”h ]”h"]”h$]”h&]”uh1j@hjÅh²hh³hÇh´Nubeh}”(h]”Œprocess”ah ]”h"]”Œprocess”ah$]”h&]”uh1hÖhhëh²hh³hÇh´Kubh×)”}”(hhh]”(hÜ)”}”(hŒDebugging packet drops”h]”hŒDebugging packet drops”…””}”(hjeh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhjbh²hh³hÇh´K!ubj)”}”(hŒ;Silent packet drops for XDP_REDIRECT can be debugged using:”h]”hŒ;Silent packet drops for XDP_REDIRECT can be debugged using:”…””}”(hjsh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j h³hÇh´K"hjbh²hubj)”}”(hhh]”(j#)”}”(hŒ bpf_trace”h]”j)”}”(hj†h]”hŒ bpf_trace”…””}”(hjˆh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j h³hÇh´K$hj„ubah}”(h]”h ]”h"]”h$]”h&]”uh1j"hjh²hh³hÇh´Nubj#)”}”(hŒ perf_record ”h]”j)”}”(hŒ perf_record”h]”hŒ perf_record”…””}”(hjŸh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j h³hÇh´K%hj›ubah}”(h]”h ]”h"]”h$]”h&]”uh1j"hjh²hh³hÇh´Nubeh}”(h]”h ]”h"]”h$]”h&]”j­j®uh1jh³hÇh´K$hjbh²hubh×)”}”(hhh]”(hÜ)”}”(hŒ bpf_trace”h]”hŒ bpf_trace”…””}”(hj¼h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhj¹h²hh³hÇh´K(ubj)”}”(hŒTThe following bpftrace command can be used to capture and count all XDP tracepoints:”h]”hŒTThe following bpftrace command can be used to capture and count all XDP tracepoints:”…””}”(hjÊh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j h³hÇh´K)hj¹h²hubhŒ literal_block”“”)”}”(hX*sudo bpftrace -e 'tracepoint:xdp:* { @cnt[probe] = count(); }' Attaching 12 probes... ^C @cnt[tracepoint:xdp:mem_connect]: 18 @cnt[tracepoint:xdp:mem_disconnect]: 18 @cnt[tracepoint:xdp:xdp_exception]: 19605 @cnt[tracepoint:xdp:xdp_devmap_xmit]: 1393604 @cnt[tracepoint:xdp:xdp_redirect]: 22292200”h]”hX*sudo bpftrace -e 'tracepoint:xdp:* { @cnt[probe] = count(); }' Attaching 12 probes... ^C @cnt[tracepoint:xdp:mem_connect]: 18 @cnt[tracepoint:xdp:mem_disconnect]: 18 @cnt[tracepoint:xdp:xdp_exception]: 19605 @cnt[tracepoint:xdp:xdp_devmap_xmit]: 1393604 @cnt[tracepoint:xdp:xdp_redirect]: 22292200”…””}”hjÚsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆŒforce”‰Œlanguage”Œnone”Œhighlight_args”}”uh1jØh³hÇh´K+hj¹h²hubjA)”}”(hŒQThe various xdp tracepoints can be found in ``source/include/trace/events/xdp.h``”h]”j)”}”(hjïh]”(hŒ,The various xdp tracepoints can be found in ”…””}”(hjñh²hh³Nh´Nubj,)”}”(hŒ%``source/include/trace/events/xdp.h``”h]”hŒ!source/include/trace/events/xdp.h”…””}”(hjøh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j+hjñubeh}”(h]”h ]”h"]”h$]”h&]”uh1j h³hÇh´K8hjíubah}”(h]”h ]”h"]”h$]”h&]”uh1j@hj¹h²hh³hÇh´Nubj)”}”(hŒpThe following bpftrace command can be used to extract the ``ERRNO`` being returned as part of the err parameter:”h]”(hŒ:The following bpftrace command can be used to extract the ”…””}”(hjh²hh³Nh´Nubj,)”}”(hŒ ``ERRNO``”h]”hŒERRNO”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j+hjubhŒ- being returned as part of the err parameter:”…””}”(hjh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1j h³hÇh´K:hj¹h²hubjÙ)”}”(hŒ¡sudo bpftrace -e \ 'tracepoint:xdp:xdp_redirect*_err {@redir_errno[-args->err] = count();} tracepoint:xdp:xdp_devmap_xmit {@devmap_errno[-args->err] = count();}'”h]”hŒ¡sudo bpftrace -e \ 'tracepoint:xdp:xdp_redirect*_err {@redir_errno[-args->err] = count();} tracepoint:xdp:xdp_devmap_xmit {@devmap_errno[-args->err] = count();}'”…””}”hj2sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆjè‰jéŒnone”jë}”uh1jØh³hÇh´K=hj¹h²hubeh}”(h]”Œ bpf-trace”ah ]”h"]”Œ bpf_trace”ah$]”h&]”uh1hÖhjbh²hh³hÇh´K(ubh×)”}”(hhh]”(hÜ)”}”(hŒ perf record”h]”hŒ perf record”…””}”(hjMh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhjJh²hh³hÇh´KDubj)”}”(hŒ2The perf tool also supports recording tracepoints:”h]”hŒ2The perf tool also supports recording tracepoints:”…””}”(hj[h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j h³hÇh´KEhjJh²hubjÙ)”}”(hŒ€perf record -a -e xdp:xdp_redirect_err \ -e xdp:xdp_redirect_map_err \ -e xdp:xdp_exception \ -e xdp:xdp_devmap_xmit”h]”hŒ€perf record -a -e xdp:xdp_redirect_err \ -e xdp:xdp_redirect_map_err \ -e xdp:xdp_exception \ -e xdp:xdp_devmap_xmit”…””}”hjisbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆjè‰jéŒnone”jë}”uh1jØh³hÇh´KGhjJh²hubh×)”}”(hhh]”(hÜ)”}”(hŒ References”h]”hŒ References”…””}”(hj|h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛhjyh²hh³hÇh´KOubj)”}”(hhh]”j#)”}”(hŒMhttps://github.com/xdp-project/xdp-tutorial/tree/master/tracing02-xdp-monitor”h]”j)”}”(hjh]”hŒ reference”“”)”}”(hjh]”hŒMhttps://github.com/xdp-project/xdp-tutorial/tree/master/tracing02-xdp-monitor”…””}”(hj–h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”juh1j”hj‘ubah}”(h]”h ]”h"]”h$]”h&]”uh1j h³hÇh´KQhjubah}”(h]”h ]”h"]”h$]”h&]”uh1j"hjŠh²hh³hÇh´Nubah}”(h]”h ]”h"]”h$]”h&]”j­j®uh1jh³hÇh´KQhjyh²hubeh}”(h]”Œ references”ah ]”h"]”Œ references”ah$]”h&]”uh1hÖhjJh²hh³hÇh´KOubeh}”(h]”Œ perf-record”ah ]”h"]”Œ perf record”ah$]”h&]”uh1hÖhjbh²hh³hÇh´KDubeh}”(h]”Œdebugging-packet-drops”ah ]”h"]”Œdebugging packet drops”ah$]”h&]”uh1hÖhhëh²hh³hÇh´K!ubeh}”(h]”Œ xdp-redirect”ah ]”h"]”Œ xdp_redirect”ah$]”h&]”uh1hÖhhØh²hh³hÇh´Kubeh}”(h]”Œredirect”ah ]”h"]”Œredirect”ah$]”h&]”uh1hÖhhh²hh³hÇh´Kubeh}”(h]”h ]”h"]”h$]”h&]”Œsource”hÇuh1hŒcurrent_source”NŒ current_line”NŒsettings”Œdocutils.frontend”ŒValues”“”)”}”(hÛNŒ generator”NŒ datestamp”NŒ source_link”NŒ source_url”NŒ toc_backlinks”Œentry”Œfootnote_backlinks”KŒ sectnum_xform”KŒstrip_comments”NŒstrip_elements_with_classes”NŒ strip_classes”NŒ report_level”KŒ halt_level”KŒexit_status_level”KŒdebug”NŒwarning_stream”NŒ traceback”ˆŒinput_encoding”Œ utf-8-sig”Œinput_encoding_error_handler”Œstrict”Œoutput_encoding”Œutf-8”Œoutput_encoding_error_handler”jŒerror_encoding”Œutf-8”Œerror_encoding_error_handler”Œbackslashreplace”Œ language_code”Œen”Œrecord_dependencies”NŒconfig”NŒ id_prefix”hŒauto_id_prefix”Œid”Œ dump_settings”NŒdump_internals”NŒdump_transforms”NŒdump_pseudo_xml”NŒexpose_internals”NŒstrict_visitor”NŒ_disable_config”NŒ_source”hÇŒ _destination”NŒ _config_files”]”Œ7/var/lib/git/docbuild/linux/Documentation/docutils.conf”aŒfile_insertion_enabled”ˆŒ raw_enabled”KŒline_length_limit”M'Œpep_references”NŒ pep_base_url”Œhttps://peps.python.org/”Œpep_file_url_template”Œpep-%04d”Œrfc_references”NŒ rfc_base_url”Œ&https://datatracker.ietf.org/doc/html/”Œ tab_width”KŒtrim_footnote_reference_space”‰Œsyntax_highlight”Œlong”Œ smart_quotes”ˆŒsmartquotes_locales”]”Œcharacter_level_inline_markup”‰Œdoctitle_xform”‰Œ docinfo_xform”KŒsectsubtitle_xform”‰Œ image_loading”Œlink”Œembed_stylesheet”‰Œcloak_email_addresses”ˆŒsection_self_link”‰Œenv”NubŒreporter”NŒindirect_targets”]”Œsubstitution_defs”}”Œsubstitution_names”}”Œrefnames”}”Œrefids”}”Œnameids”}”(jÛjØjÓjÐjÂj¿j_j\jËjÈjGjDjÃjÀj»j¸uŒ nametypes”}”(jÛ‰jÓ‰j‰j_‰jˉjG‰jÉj»‰uh}”(jØhØjÐhëj¿hüj\jÅjÈjbjDj¹jÀjJj¸jyuŒ footnote_refs”}”Œ citation_refs”}”Œ autofootnotes”]”Œautofootnote_refs”]”Œsymbol_footnotes”]”Œsymbol_footnote_refs”]”Œ footnotes”]”Œ citations”]”Œautofootnote_start”KŒsymbol_footnote_start”KŒ id_counter”Œ collections”ŒCounter”“”}”…”R”Œparse_messages”]”Œtransform_messages”]”Œ transformer”NŒ include_log”]”Œ decoration”Nh²hub.