Lines Matching +full:application +full:- +full:specific
1 .. SPDX-License-Identifier: GPL-2.0
20 XDP programs to redirect frames to a memory buffer in a user-space
21 application.
43 FILL ring is used by the application to send down addr for the kernel
54 specific queue id on that device, and it is not until bind is
64 single-consumer / single-producer (for performance reasons), the new
72 user-space application can place an XSK at an arbitrary place in this
73 map. The XDP program can then redirect a packet to a specific index in
99 http://vger.kernel.org/lpc_net2018_talks/lpc18_paper_af_xdp_perf-v2.pdf. Do
106 ----
109 equal-sized frames. An UMEM is associated to a netdev and a specific
121 The UMEM has two single-producer/single-consumer rings that are used
123 user-space application.
126 -----
129 TX. All rings are single-producer/single-consumer, so the user-space
130 application need explicit synchronization of multiple
145 calls and mmapped to user-space using the appropriate offset to mmap()
155 user-space to kernel-space. The UMEM addrs are passed in the ring. As
161 The user application produces UMEM addrs to this ring. Note that, if
162 running the application with aligned chunk mode, the kernel will mask
165 to the same chunk. If the user application is run in the unaligned
173 kernel-space to user-space. Just like the FILL ring, UMEM indices are
176 Frames passed from the kernel to user-space are frames that has been
177 sent (TX ring) and can be used by user-space again.
179 The user application consumes UMEM addrs from this ring.
192 The user application consumes struct xdp_desc descriptors from this
204 The user application produces struct xdp_desc descriptors to this
211 technologies a lot simpler. It also contains specific helper functions
216 to use this API, please take a look at the sample application in
230 The user application inserts the socket into the map, via the bpf()
238 application (samples/bpf/) in for an example.
247 -------------------------------------
249 When you bind to a socket, the kernel will first try to use zero-copy
250 copy. If zero-copy is not supported, it will fall back on using copy
256 socket into zero-copy mode or fail.
259 -------------------------
283 round-robin example of distributing packets is shown below:
285 .. code-block:: c
303 rr = (rr + 1) & (MAX_SOCKS - 1);
351 -----------------------------
360 If the flag is set on the FILL ring, the application needs to call
370 If the flag is set for the TX ring, it means that the application
379 .. code-block:: c
387 better performance especially if you run the application and the
389 application and the kernel driver, as it reduces the number of
393 ------------------------------------------------------
399 application, but if you only want to do one of them, you can save
405 be used. Note, that the rings are single-producer single-consumer, so
409 In libbpf, you can create Rx-only and Tx-only sockets by supplying
413 If you create a Tx-only socket, we recommend that you do not put any
419 -----------------------
433 application to use. The final option is the flags field, but it will
437 --------------------------
441 is created by a privileged process and passed to a non-privileged one.
446 -------------------------
451 .. code-block:: c
460 ----------------------
463 XDP_OPTIONS_ZEROCOPY which tells you if zero-copy is on or not.
469 user-space application and the XDP program. For a complete setup and
470 usage example, please refer to the sample application. The user-space
475 .. code-block:: c
479 int index = ctx->rx_queue_index;
492 .. code-block:: c
514 __u32 entries = *ring->producer - *ring->consumer;
517 return -1;
519 // read-barrier!
521 *item = ring->desc[*ring->consumer & (RING_SIZE - 1)];
522 (*ring->consumer)++;
528 u32 free_entries = RING_SIZE - (*ring->producer - *ring->consumer);
531 return -1;
533 ring->desc[*ring->producer & (RING_SIZE - 1)] = *item;
535 // write-barrier!
537 (*ring->producer)++;
544 Sample application
547 There is a xdpsock benchmarking/test application included that
552 ethtool -N p3p2 rx-flow-hash udp4 fn
553 ethtool -N p3p2 flow-type udp4 src-port 4242 dst-port 4242 \
559 samples/bpf/xdpsock -i p3p2 -q 16 -r -N
561 For XDP_SKB mode, use the switch "-S" instead of "-N" and all options
562 can be displayed with "-h", as usual.
564 This sample application uses libbpf to make the setup and usage of
578 specify a specific queue id to bind to and it is only the traffic
590 sudo ethtool -L <interface> combined 1
597 sudo ethtool -N <interface> rx-flow-hash udp4 fn
598 sudo ethtool -N <interface> flow-type udp4 src-port 4242 dst-port \
612 to the same queue id Y. In zero-copy mode, you should use the
630 - Björn Töpel (AF_XDP core)
631 - Magnus Karlsson (AF_XDP core)
632 - Alexander Duyck
633 - Alexei Starovoitov
634 - Daniel Borkmann
635 - Jesper Dangaard Brouer
636 - John Fastabend
637 - Jonathan Corbet (LWN coverage)
638 - Michael S. Tsirkin
639 - Qi Z Zhang
640 - Willem de Bruijn