Lines Matching +full:no +full:- +full:unaligned +full:- +full:direct +full:- +full:access
1 .. SPDX-License-Identifier: GPL-2.0
20 XDP programs to redirect frames to a memory buffer in a user-space
64 single-consumer / single-producer (for performance reasons), the new
72 user-space application can place an XSK at an arbitrary place in this
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
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
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.
189 If no frames have been passed to kernel via the FILL ring, no
215 plane to access the rings safely and quickly. To see an example on how
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 -------------------------
274 ring, or at least one of them, but no FILL or COMPLETION rings as the
283 round-robin example of distributing packets is shown below:
285 .. code-block:: c
303 rr = (rr + 1) & (MAX_SOCKS - 1);
311 concurrently. There are no synchronization primitives in the
317 xsk_socket__create calls and load your own XDP program as there is no
332 There is no need to supply an XDP program like the one in the previous
351 -----------------------------
358 zero, no syscall is needed.
362 can happen, for example, when the kernel has detected that there are no
363 more buffers on the FILL ring and no buffers left on the RX HW ring of
365 receive any packets (as there are no buffers to put them in), and the
379 .. code-block:: c
393 ------------------------------------------------------
405 be used. Note, that the rings are single-producer single-consumer, so
406 do not try to access them from multiple processes at the same
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 -----------------------
437 -------------------------
442 .. code-block:: c
451 ----------------------
454 XDP_OPTIONS_ZEROCOPY which tells you if zero-copy is on or not.
460 user-space application and the XDP program. For a complete setup and
461 usage example, please refer to the sample application. The user-space
466 .. code-block:: c
470 int index = ctx->rx_queue_index;
483 .. code-block:: c
505 __u32 entries = *ring->producer - *ring->consumer;
508 return -1;
510 // read-barrier!
512 *item = ring->desc[*ring->consumer & (RING_SIZE - 1)];
513 (*ring->consumer)++;
519 u32 free_entries = RING_SIZE - (*ring->producer - *ring->consumer);
522 return -1;
524 ring->desc[*ring->producer & (RING_SIZE - 1)] = *item;
526 // write-barrier!
528 (*ring->producer)++;
543 ethtool -N p3p2 rx-flow-hash udp4 fn
544 ethtool -N p3p2 flow-type udp4 src-port 4242 dst-port 4242 \
550 samples/bpf/xdpsock -i p3p2 -q 16 -r -N
552 For XDP_SKB mode, use the switch "-S" instead of "-N" and all options
553 can be displayed with "-h", as usual.
581 sudo ethtool -L <interface> combined 1
588 sudo ethtool -N <interface> rx-flow-hash udp4 fn
589 sudo ethtool -N <interface> flow-type udp4 src-port 4242 dst-port \
598 A: The short answer is no, that is not supported at the moment. The
603 to the same queue id Y. In zero-copy mode, you should use the
604 switch, or other distribution mechanism, in your NIC to direct
621 - Björn Töpel (AF_XDP core)
622 - Magnus Karlsson (AF_XDP core)
623 - Alexander Duyck
624 - Alexei Starovoitov
625 - Daniel Borkmann
626 - Jesper Dangaard Brouer
627 - John Fastabend
628 - Jonathan Corbet (LWN coverage)
629 - Michael S. Tsirkin
630 - Qi Z Zhang
631 - Willem de Bruijn