Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Documentation: xsk: correct the obsolete references and examples

The modified lines are mainly related to the following commits[1][2]
which remove those tests and examples. Since samples/bpf has been
deprecated, we can refer to more examples that are easily searched
in the various xdp-projects, like the following link:
https://github.com/xdp-project/bpf-examples/tree/main/AF_XDP-example

[1]
commit f36600634282 ("libbpf: move xsk.{c,h} into selftests/bpf")
[2]
commit cfb5a2dbf141 ("bpf, samples: Remove AF_XDP samples")

Signed-off-by: Jason Xing <kernelxing@tencent.com>
Reviewed-by: Toke Høiland-Jørgensen <toke@redhat.com>
Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Acked-by: Stanislav Fomichev <sdf@fomichev.me>
Link: https://patch.msgid.link/20250708062907.11557-1-kerneljasonxing@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Jason Xing and committed by
Jakub Kicinski
819802e2 76d727ae

+18 -21
+18 -21
Documentation/networking/af_xdp.rst
··· 209 209 210 210 Libbpf is a helper library for eBPF and XDP that makes using these 211 211 technologies a lot simpler. It also contains specific helper functions 212 - in tools/lib/bpf/xsk.h for facilitating the use of AF_XDP. It 213 - contains two types of functions: those that can be used to make the 214 - setup of AF_XDP socket easier and ones that can be used in the data 215 - plane to access the rings safely and quickly. To see an example on how 216 - to use this API, please take a look at the sample application in 217 - samples/bpf/xdpsock_usr.c which uses libbpf for both setup and data 218 - plane operations. 212 + in tools/testing/selftests/bpf/xsk.h for facilitating the use of 213 + AF_XDP. It contains two types of functions: those that can be used to 214 + make the setup of AF_XDP socket easier and ones that can be used in the 215 + data plane to access the rings safely and quickly. 219 216 220 217 We recommend that you use this library unless you have become a power 221 218 user. It will make your program a lot simpler. ··· 369 372 TX ring. This can be accomplished either by a poll() call, as in the 370 373 RX path, or by calling sendto(). 371 374 372 - An example of how to use this flag can be found in 373 - samples/bpf/xdpsock_user.c. An example with the use of libbpf helpers 374 - would look like this for the TX path: 375 + An example with the use of libbpf helpers would look like this for the 376 + TX path: 375 377 376 378 .. code-block:: c 377 379 ··· 545 549 Usage 546 550 ----- 547 551 548 - In order to use AF_XDP sockets two parts are needed. The 549 - user-space application and the XDP program. For a complete setup and 550 - usage example, please refer to the sample application. The user-space 551 - side is xdpsock_user.c and the XDP side is part of libbpf. 552 + In order to use AF_XDP sockets two parts are needed. The user-space 553 + application and the XDP program. For a complete setup and usage example, 554 + please refer to the xdp-project at 555 + https://github.com/xdp-project/bpf-examples/tree/main/AF_XDP-example. 552 556 553 - The XDP code sample included in tools/lib/bpf/xsk.c is the following: 557 + The XDP code sample is the following: 554 558 555 559 .. code-block:: c 556 560 ··· 748 752 749 753 Sample application 750 754 ================== 751 - 752 - There is a xdpsock benchmarking/test application included that 753 - demonstrates how to use AF_XDP sockets with private UMEMs. Say that 754 - you would like your UDP traffic from port 4242 to end up in queue 16, 755 - that we will enable AF_XDP on. Here, we use ethtool for this:: 755 + There is a xdpsock benchmarking/test application that can be found at 756 + https://github.com/xdp-project/bpf-examples/tree/main/AF_XDP-example 757 + that demonstrates how to use AF_XDP sockets with private 758 + UMEMs. Say that you would like your UDP traffic from port 4242 to end 759 + up in queue 16, that we will enable AF_XDP on. Here, we use ethtool 760 + for this:: 756 761 757 762 ethtool -N p3p2 rx-flow-hash udp4 fn 758 763 ethtool -N p3p2 flow-type udp4 src-port 4242 dst-port 4242 \ ··· 770 773 This sample application uses libbpf to make the setup and usage of 771 774 AF_XDP simpler. If you want to know how the raw uapi of AF_XDP is 772 775 really used to make something more advanced, take a look at the libbpf 773 - code in tools/lib/bpf/xsk.[ch]. 776 + code in tools/testing/selftests/bpf/xsk.[ch]. 774 777 775 778 FAQ 776 779 =======