diff options
author | Cristian Dumitrescu <cristian.dumitrescu@intel.com> | 2020-08-28 10:26:28 +0200 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2020-08-31 21:17:55 +0200 |
commit | 35149b2c048e43562a598fd8ff91467d429bc666 (patch) | |
tree | 6e471740d2a7060b7eb95c3df771597817136a4c /Kbuild | |
parent | 2f6324a3937f8517967d94daef2ba0bdceceece1 (diff) | |
download | lwn-35149b2c048e43562a598fd8ff91467d429bc666.tar.gz lwn-35149b2c048e43562a598fd8ff91467d429bc666.zip |
samples/bpf: Add new sample xsk_fwd.c
This sample code 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
Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Björn Töpel <bjorn.topel@intel.com>
Link: https://lore.kernel.org/bpf/1598603189-32145-15-git-send-email-magnus.karlsson@intel.com
Diffstat (limited to 'Kbuild')
0 files changed, 0 insertions, 0 deletions