€•Ö>Œ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Œ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:”…””}”(hhûhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hùhŸh³h K hhèhžhubhŒ bullet_list”“”)”}”(hhh]”(hŒ list_item”“”)”}”(hŒ``BPF_MAP_TYPE_DEVMAP``”h]”hú)”}”(hjh]”hŒliteral”“”)”}”(hjh]”hŒBPF_MAP_TYPE_DEVMAP”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjubah}”(h]”h ]”h"]”h$]”h&]”uh1hùhŸh³h Khjubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj hžhhŸh³h Nubj)”}”(hŒ``BPF_MAP_TYPE_DEVMAP_HASH``”h]”hú)”}”(hj4h]”j)”}”(hj4h]”hŒBPF_MAP_TYPE_DEVMAP_HASH”…””}”(hj9hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj6ubah}”(h]”h ]”h"]”h$]”h&]”uh1hùhŸh³h Khj2ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj hžhhŸh³h Nubj)”}”(hŒ``BPF_MAP_TYPE_CPUMAP``”h]”hú)”}”(hjTh]”j)”}”(hjTh]”hŒBPF_MAP_TYPE_CPUMAP”…””}”(hjYhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjVubah}”(h]”h ]”h"]”h$]”h&]”uh1hùhŸh³h KhjRubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj hžhhŸh³h Nubj)”}”(hŒ``BPF_MAP_TYPE_XSKMAP`` ”h]”hú)”}”(hŒ``BPF_MAP_TYPE_XSKMAP``”h]”j)”}”(hjxh]”hŒBPF_MAP_TYPE_XSKMAP”…””}”(hjzhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjvubah}”(h]”h ]”h"]”h$]”h&]”uh1hùhŸh³h Khjrubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj hžhhŸh³h Nubeh}”(h]”h ]”h"]”h$]”h&]”Œbullet”Œ-”uh1j hŸh³h Khhèhžhubhú)”}”(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&]”uh1hù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 Kubhú)”}”(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&]”uh1hù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]”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.”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&]”uh1hùhŸŒN/var/lib/git/docbuild/linux/Documentation/bpf/redirect:24: ./net/core/filter.c”h M¬hjÖubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjÓ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]”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.”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.”…””}”(hjóhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hùhŸŒN/var/lib/git/docbuild/linux/Documentation/bpf/redirect:24: ./net/core/filter.c”h M°hjïubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjÓ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]”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.”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&]”uh1hùhŸŒN/var/lib/git/docbuild/linux/Documentation/bpf/redirect:24: ./net/core/filter.c”h Mµhjubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjÓ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]”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.”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.”…””}”(hj2hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hùhŸh³h Khj.ubah}”(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”…””}”(hjQhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÇhjNhžhhŸh³h K!ubhú)”}”(hŒ;Silent packet drops for XDP_REDIRECT can be debugged using:”h]”hŒ;Silent packet drops for XDP_REDIRECT can be debugged using:”…””}”(hj_hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hùhŸh³h K"hjNhžhubj )”}”(hhh]”(j)”}”(hŒ bpf_trace”h]”hú)”}”(hjrh]”hŒ bpf_trace”…””}”(hjthžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hùhŸh³h K$hjpubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjmhžhhŸh³h Nubj)”}”(hŒ perf_record ”h]”hú)”}”(hŒ perf_record”h]”hŒ perf_record”…””}”(hj‹hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hùhŸh³h K%hj‡ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjmhžhhŸh³h Nubeh}”(h]”h ]”h"]”h$]”h&]”j™jšuh1j hŸh³h K$hjNhž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(ubhú)”}”(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&]”uh1hù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žhubj-)”}”(hŒQThe various xdp tracepoints can be found in ``source/include/trace/events/xdp.h``”h]”hú)”}”(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&]”uh1jhjÝubeh}”(h]”h ]”h"]”h$]”h&]”uh1hùhŸh³h K8hjÙubah}”(h]”h ]”h"]”h$]”h&]”uh1j,hj¥hžhhŸh³h Nubhú)”}”(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 ”…””}”(hjþhžhhŸNh Nubj)”}”(hŒ ``ERRNO``”h]”hŒERRNO”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjþubhŒ- being returned as part of the err parameter:”…””}”(hjþhžhhŸNh Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hù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();}'”…””}”hjsbah}”(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ÂhjNhžhhŸh³h K(ubhÃ)”}”(hhh]”(hÈ)”}”(hŒ perf record”h]”hŒ perf record”…””}”(hj9hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÇhj6hžhhŸh³h KDubhú)”}”(hŒ2The perf tool also supports recording tracepoints:”h]”hŒ2The perf tool also supports recording tracepoints:”…””}”(hjGhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hùhŸh³h KEhj6hž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”…””}”hjUsbah}”(h]”h ]”h"]”h$]”h&]”h±h²jÔ‰jÕŒnone”j×}”uh1jÄhŸh³h KGhj6hžhubhÃ)”}”(hhh]”(hÈ)”}”(hŒ References”h]”hŒ References”…””}”(hjhhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÇhjehžhhŸh³h KOubj )”}”(hhh]”j)”}”(hŒMhttps://github.com/xdp-project/xdp-tutorial/tree/master/tracing02-xdp-monitor”h]”hú)”}”(hj{h]”hŒ reference”“”)”}”(hj{h]”hŒMhttps://github.com/xdp-project/xdp-tutorial/tree/master/tracing02-xdp-monitor”…””}”(hj‚hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”j{uh1j€hj}ubah}”(h]”h ]”h"]”h$]”h&]”uh1hùhŸh³h KQhjyubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjvhžhhŸh³h Nubah}”(h]”h ]”h"]”h$]”h&]”j™jšuh1j hŸh³h KQhjehžhubeh}”(h]”Œ references”ah ]”h"]”Œ references”ah$]”h&]”uh1hÂhj6hžhhŸh³h KOubeh}”(h]”Œ perf-record”ah ]”h"]”Œ perf record”ah$]”h&]”uh1hÂhjNhž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«jKjHj·j´j3j0j¯j¬j§j¤uŒ nametypes”}”(jljj¿‰j®‰jK‰j·‰j3‰j¯‰j§‰uh}”(jÄhÄj¼h×j«hèjHj±j´jNj0j¥j¬j6j¤jeuŒ 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.