* [PATCH net-next] Documentation: xsk: correct the obsolete references and examples
@ 2025-06-28 12:08 Jason Xing
2025-06-30 11:44 ` Maciej Fijalkowski
0 siblings, 1 reply; 3+ messages in thread
From: Jason Xing @ 2025-06-28 12:08 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni, bjorn, magnus.karlsson,
maciej.fijalkowski, jonathan.lemon, sdf, ast, daniel, hawk,
john.fastabend, joe, willemdebruijn.kernel
Cc: bpf, netdev, Jason Xing
From: Jason Xing <kernelxing@tencent.com>
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.
[1]: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=f36600634
[2]: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=cfb5a2dbf14
Signed-off-by: Jason Xing <kernelxing@tencent.com>
---
Documentation/networking/af_xdp.rst | 45 ++++++++---------------------
1 file changed, 12 insertions(+), 33 deletions(-)
diff --git a/Documentation/networking/af_xdp.rst b/Documentation/networking/af_xdp.rst
index dceeb0d763aa..37711619e89e 100644
--- a/Documentation/networking/af_xdp.rst
+++ b/Documentation/networking/af_xdp.rst
@@ -209,13 +209,10 @@ Libbpf
Libbpf is a helper library for eBPF and XDP that makes using these
technologies a lot simpler. It also contains specific helper functions
-in tools/lib/bpf/xsk.h for facilitating the use of AF_XDP. It
-contains two types of functions: those that can be used to make the
-setup of AF_XDP socket easier and ones that can be used in the data
-plane to access the rings safely and quickly. To see an example on how
-to use this API, please take a look at the sample application in
-samples/bpf/xdpsock_usr.c which uses libbpf for both setup and data
-plane operations.
+in ./tools/testing/selftests/bpf/xsk.h for facilitating the use of
+AF_XDP. It contains two types of functions: those that can be used to
+make the setup of AF_XDP socket easier and ones that can be used in the
+data plane to access the rings safely and quickly.
We recommend that you use this library unless you have become a power
user. It will make your program a lot simpler.
@@ -372,8 +369,7 @@ needs to explicitly notify the kernel to send any packets put on the
TX ring. This can be accomplished either by a poll() call, as in the
RX path, or by calling sendto().
-An example of how to use this flag can be found in
-samples/bpf/xdpsock_user.c. An example with the use of libbpf helpers
+An example with the use of libbpf helpers
would look like this for the TX path:
.. code-block:: c
@@ -551,10 +547,9 @@ Usage
In order to use AF_XDP sockets two parts are needed. The
user-space application and the XDP program. For a complete setup and
-usage example, please refer to the sample application. The user-space
-side is xdpsock_user.c and the XDP side is part of libbpf.
+usage example, please refer to the xdp-project.
-The XDP code sample included in tools/lib/bpf/xsk.c is the following:
+The XDP code sample is the following:
.. code-block:: c
@@ -753,27 +748,11 @@ to facilitate extending a zero-copy driver with multi-buffer support.
Sample application
==================
-There is a xdpsock benchmarking/test application included that
-demonstrates how to use AF_XDP sockets with private UMEMs. Say that
-you would like your UDP traffic from port 4242 to end up in queue 16,
-that we will enable AF_XDP on. Here, we use ethtool for this::
-
- ethtool -N p3p2 rx-flow-hash udp4 fn
- ethtool -N p3p2 flow-type udp4 src-port 4242 dst-port 4242 \
- action 16
-
-Running the rxdrop benchmark in XDP_DRV mode can then be done
-using::
-
- samples/bpf/xdpsock -i p3p2 -q 16 -r -N
-
-For XDP_SKB mode, use the switch "-S" instead of "-N" and all options
-can be displayed with "-h", as usual.
-
-This sample application uses libbpf to make the setup and usage of
-AF_XDP simpler. If you want to know how the raw uapi of AF_XDP is
-really used to make something more advanced, take a look at the libbpf
-code in tools/lib/bpf/xsk.[ch].
+Xdpsock benchmarking/test application can be found through googling
+the various xdp-project repositories connected to libxdp. If you want
+to know how the raw uapi of AF_XDP is really used to make something
+more advanced, take a look at the libbpf code in
+tools/testing/selftests/bpf/xsk.[ch].
FAQ
=======
--
2.41.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] Documentation: xsk: correct the obsolete references and examples
2025-06-28 12:08 [PATCH net-next] Documentation: xsk: correct the obsolete references and examples Jason Xing
@ 2025-06-30 11:44 ` Maciej Fijalkowski
2025-06-30 11:50 ` Jason Xing
0 siblings, 1 reply; 3+ messages in thread
From: Maciej Fijalkowski @ 2025-06-30 11:44 UTC (permalink / raw)
To: Jason Xing
Cc: davem, edumazet, kuba, pabeni, bjorn, magnus.karlsson,
jonathan.lemon, sdf, ast, daniel, hawk, john.fastabend, joe,
willemdebruijn.kernel, bpf, netdev, Jason Xing
On Sat, Jun 28, 2025 at 08:08:40PM +0800, Jason Xing wrote:
> From: Jason Xing <kernelxing@tencent.com>
>
> 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.
>
> [1]: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=f36600634
> [2]: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=cfb5a2dbf14
>
> Signed-off-by: Jason Xing <kernelxing@tencent.com>
> ---
> Documentation/networking/af_xdp.rst | 45 ++++++++---------------------
> 1 file changed, 12 insertions(+), 33 deletions(-)
>
> diff --git a/Documentation/networking/af_xdp.rst b/Documentation/networking/af_xdp.rst
> index dceeb0d763aa..37711619e89e 100644
> --- a/Documentation/networking/af_xdp.rst
> +++ b/Documentation/networking/af_xdp.rst
> @@ -209,13 +209,10 @@ Libbpf
>
> Libbpf is a helper library for eBPF and XDP that makes using these
> technologies a lot simpler. It also contains specific helper functions
> -in tools/lib/bpf/xsk.h for facilitating the use of AF_XDP. It
> -contains two types of functions: those that can be used to make the
> -setup of AF_XDP socket easier and ones that can be used in the data
> -plane to access the rings safely and quickly. To see an example on how
> -to use this API, please take a look at the sample application in
> -samples/bpf/xdpsock_usr.c which uses libbpf for both setup and data
> -plane operations.
> +in ./tools/testing/selftests/bpf/xsk.h for facilitating the use of
> +AF_XDP. It contains two types of functions: those that can be used to
> +make the setup of AF_XDP socket easier and ones that can be used in the
> +data plane to access the rings safely and quickly.
>
> We recommend that you use this library unless you have become a power
> user. It will make your program a lot simpler.
> @@ -372,8 +369,7 @@ needs to explicitly notify the kernel to send any packets put on the
> TX ring. This can be accomplished either by a poll() call, as in the
> RX path, or by calling sendto().
>
> -An example of how to use this flag can be found in
> -samples/bpf/xdpsock_user.c. An example with the use of libbpf helpers
> +An example with the use of libbpf helpers
> would look like this for the TX path:
>
> .. code-block:: c
> @@ -551,10 +547,9 @@ Usage
>
> In order to use AF_XDP sockets two parts are needed. The
> user-space application and the XDP program. For a complete setup and
> -usage example, please refer to the sample application. The user-space
> -side is xdpsock_user.c and the XDP side is part of libbpf.
> +usage example, please refer to the xdp-project.
>
> -The XDP code sample included in tools/lib/bpf/xsk.c is the following:
> +The XDP code sample is the following:
>
> .. code-block:: c
>
> @@ -753,27 +748,11 @@ to facilitate extending a zero-copy driver with multi-buffer support.
> Sample application
> ==================
>
> -There is a xdpsock benchmarking/test application included that
> -demonstrates how to use AF_XDP sockets with private UMEMs. Say that
> -you would like your UDP traffic from port 4242 to end up in queue 16,
> -that we will enable AF_XDP on. Here, we use ethtool for this::
> -
> - ethtool -N p3p2 rx-flow-hash udp4 fn
> - ethtool -N p3p2 flow-type udp4 src-port 4242 dst-port 4242 \
> - action 16
> -
> -Running the rxdrop benchmark in XDP_DRV mode can then be done
> -using::
> -
> - samples/bpf/xdpsock -i p3p2 -q 16 -r -N
> -
> -For XDP_SKB mode, use the switch "-S" instead of "-N" and all options
> -can be displayed with "-h", as usual.
Hi Jason,
these commands above should be kept as-is imho and we should point users
to new xdpsock's location:
https://github.com/xdp-project/bpf-examples/tree/main/AF_XDP-example
> -
> -This sample application uses libbpf to make the setup and usage of
> -AF_XDP simpler. If you want to know how the raw uapi of AF_XDP is
> -really used to make something more advanced, take a look at the libbpf
> -code in tools/lib/bpf/xsk.[ch].
> +Xdpsock benchmarking/test application can be found through googling
> +the various xdp-project repositories connected to libxdp. If you want
> +to know how the raw uapi of AF_XDP is really used to make something
> +more advanced, take a look at the libbpf code in
> +tools/testing/selftests/bpf/xsk.[ch].
>
> FAQ
> =======
> --
> 2.41.3
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] Documentation: xsk: correct the obsolete references and examples
2025-06-30 11:44 ` Maciej Fijalkowski
@ 2025-06-30 11:50 ` Jason Xing
0 siblings, 0 replies; 3+ messages in thread
From: Jason Xing @ 2025-06-30 11:50 UTC (permalink / raw)
To: Maciej Fijalkowski
Cc: davem, edumazet, kuba, pabeni, bjorn, magnus.karlsson,
jonathan.lemon, sdf, ast, daniel, hawk, john.fastabend, joe,
willemdebruijn.kernel, bpf, netdev, Jason Xing
On Mon, Jun 30, 2025 at 7:44 PM Maciej Fijalkowski
<maciej.fijalkowski@intel.com> wrote:
>
> On Sat, Jun 28, 2025 at 08:08:40PM +0800, Jason Xing wrote:
> > From: Jason Xing <kernelxing@tencent.com>
> >
> > 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.
> >
> > [1]: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=f36600634
> > [2]: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=cfb5a2dbf14
> >
> > Signed-off-by: Jason Xing <kernelxing@tencent.com>
> > ---
> > Documentation/networking/af_xdp.rst | 45 ++++++++---------------------
> > 1 file changed, 12 insertions(+), 33 deletions(-)
> >
> > diff --git a/Documentation/networking/af_xdp.rst b/Documentation/networking/af_xdp.rst
> > index dceeb0d763aa..37711619e89e 100644
> > --- a/Documentation/networking/af_xdp.rst
> > +++ b/Documentation/networking/af_xdp.rst
> > @@ -209,13 +209,10 @@ Libbpf
> >
> > Libbpf is a helper library for eBPF and XDP that makes using these
> > technologies a lot simpler. It also contains specific helper functions
> > -in tools/lib/bpf/xsk.h for facilitating the use of AF_XDP. It
> > -contains two types of functions: those that can be used to make the
> > -setup of AF_XDP socket easier and ones that can be used in the data
> > -plane to access the rings safely and quickly. To see an example on how
> > -to use this API, please take a look at the sample application in
> > -samples/bpf/xdpsock_usr.c which uses libbpf for both setup and data
> > -plane operations.
> > +in ./tools/testing/selftests/bpf/xsk.h for facilitating the use of
> > +AF_XDP. It contains two types of functions: those that can be used to
> > +make the setup of AF_XDP socket easier and ones that can be used in the
> > +data plane to access the rings safely and quickly.
> >
> > We recommend that you use this library unless you have become a power
> > user. It will make your program a lot simpler.
> > @@ -372,8 +369,7 @@ needs to explicitly notify the kernel to send any packets put on the
> > TX ring. This can be accomplished either by a poll() call, as in the
> > RX path, or by calling sendto().
> >
> > -An example of how to use this flag can be found in
> > -samples/bpf/xdpsock_user.c. An example with the use of libbpf helpers
> > +An example with the use of libbpf helpers
> > would look like this for the TX path:
> >
> > .. code-block:: c
> > @@ -551,10 +547,9 @@ Usage
> >
> > In order to use AF_XDP sockets two parts are needed. The
> > user-space application and the XDP program. For a complete setup and
> > -usage example, please refer to the sample application. The user-space
> > -side is xdpsock_user.c and the XDP side is part of libbpf.
> > +usage example, please refer to the xdp-project.
> >
> > -The XDP code sample included in tools/lib/bpf/xsk.c is the following:
> > +The XDP code sample is the following:
> >
> > .. code-block:: c
> >
> > @@ -753,27 +748,11 @@ to facilitate extending a zero-copy driver with multi-buffer support.
> > Sample application
> > ==================
> >
> > -There is a xdpsock benchmarking/test application included that
> > -demonstrates how to use AF_XDP sockets with private UMEMs. Say that
> > -you would like your UDP traffic from port 4242 to end up in queue 16,
> > -that we will enable AF_XDP on. Here, we use ethtool for this::
> > -
> > - ethtool -N p3p2 rx-flow-hash udp4 fn
> > - ethtool -N p3p2 flow-type udp4 src-port 4242 dst-port 4242 \
> > - action 16
> > -
> > -Running the rxdrop benchmark in XDP_DRV mode can then be done
> > -using::
> > -
> > - samples/bpf/xdpsock -i p3p2 -q 16 -r -N
> > -
> > -For XDP_SKB mode, use the switch "-S" instead of "-N" and all options
> > -can be displayed with "-h", as usual.
>
> Hi Jason,
>
> these commands above should be kept as-is imho and we should point users
> to new xdpsock's location:
>
> https://github.com/xdp-project/bpf-examples/tree/main/AF_XDP-example
I thought we'd better not refer to an external link that might be
unreliable in the future. It turns out I was wrong.
No problem. I will revise them because for now it's still working well.
Thanks,
Jason
>
> > -
> > -This sample application uses libbpf to make the setup and usage of
> > -AF_XDP simpler. If you want to know how the raw uapi of AF_XDP is
> > -really used to make something more advanced, take a look at the libbpf
> > -code in tools/lib/bpf/xsk.[ch].
> > +Xdpsock benchmarking/test application can be found through googling
> > +the various xdp-project repositories connected to libxdp. If you want
> > +to know how the raw uapi of AF_XDP is really used to make something
> > +more advanced, take a look at the libbpf code in
> > +tools/testing/selftests/bpf/xsk.[ch].
> >
> > FAQ
> > =======
> > --
> > 2.41.3
> >
> >
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-06-30 11:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-28 12:08 [PATCH net-next] Documentation: xsk: correct the obsolete references and examples Jason Xing
2025-06-30 11:44 ` Maciej Fijalkowski
2025-06-30 11:50 ` Jason Xing
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).