Files
Chris Ward 54a31ceabc Take off the XDP_ZEROCOPY flag from port_params_default.xsk_cfg.bind_flags
Fix for issue 78; veth does not support zerocopy in bind flags
Take off the XDP_ZEROCOPY flag in the setting of
port_params_default.xsk_cfg.bind_flags in AF_XDP-forwarding/xsk_fwd.c

With this change, libxdp first tries to set up zerocopy, and when it finds
that this is not available it sets up an implementation which copies the
data. So performance will not be impactes for eths which support zerocopy.

Signed-off-by: Chris Ward <tjcw@uk.ibm.com>
2023-01-05 13:56:52 +01:00
..

AF_XDP socket multi-threaded forwarding sample application

This sample code could originally be found in the Linux source code tree under samples/bpf. It illustrates the packet forwarding between multiple AF_XDP sockets in multi-threading environment. All the threads and sockets are sharing a common buffer pool, with each socket having its own private buffer cache. The sockets are created with the xsk_socket__create_shared() function, which allows multiple AF_XDP sockets to share the same UMEM object.

Example 1: Single thread handling two sockets. Packets received from socket A (on top of interface IFA, queue QA) are forwarded to socket B (on top of interface IFB, queue QB) and vice-versa. The thread is affinitized to CPU core C:

./xsk_fwd -i IFA -q QA -i IFB -q QB -c C

Example 2: Two threads, each handling two sockets. Packets from socket A are sent to socket B (by thread X), packets from socket B are sent to socket A (by thread X); packets from socket C are sent to socket D (by thread Y), packets from socket D are sent to socket C (by thread Y). The two threads are bound to CPU cores CX and CY:

./xdp_fwd -i IFA -q QA -i IFB -q QB -i IFC -q QC -i IFD -q QD -c CX -c CY