CODESYS Control with Linux XDP
eXpress Data Path (XDP) is an extension of the Linux kernel to send and receive network packages with very high performance directly at the input of the network stack.
XDP can be used with CODESYS Control under specific conditions.
Supported devices
CODESYS Control​ for Linux SL
CODESYS Control for Linux ARM SL
CODESYS Control for Linux ARM64 SL
CODESYS Virtual Control for Linux SL
CODESYS Virtual Control for Linux ARM SL
CODESYS Virtual Control for Linux ARM64 SL
Requirement
The CODESYS Control SL Runtime version must be greater than or equal to version V4.21.0.0.
The Linux kernel version must be greater than or equal to version V6.1 with the following configuration flags:
CONFIG_BPF=yCONFIG_BPF_SYSCALL=yCONFIG_BPF_JIT=yCONFIG_HAVE_EBPF_JIT=yCONFIG_XDP_SOCKETS=y
The packages
libxdp1andlibbpf1must be installed.An XDP-capable network card and a corresponding driver (e.g. Intel i226 with igc) must exist in the system.
The XDP driver must support Zero Copy.
For more information regarding the technologies XDP and eBPF, see the following:
Caution
The operating system has the following limitation: The use of XDP requires that the runtime be run with root privileges.
Using Linux XDP
Query the current XDP configuration:
ethernet-xdp-get <interface>Example:
ethernet-xdp-get enp1s0
Enable XDP separately for each network adapter:
ethernet-xdp-set <interface> onExample:
ethernet-xdp-set enp1s0 on
Disable XDP separately for each network adapter:
ethernet-xdp-set <interface> offExample:
ethernet-xdp-set enp1s0 off
Tip
Check if enabling XDP improves performance for your use case. While the cycle time is reduced in many cases, there are also scenarios where XDP can have a negative impact on performance.
For more information on how to improve performance, see the following: Performance Optimization.
Included eBPF
In version 4.21.0.0 and higher, an eBPF program is installed with the corresponding CODESYS Control SL products.
The eBPF program is used to decide whether incoming packages should take the normal route through the Linux network stack or whether they should be forwarded directly to the CODESYS Runtime via XDP.
CODESYS is responsible for the use of this program at runtime.
After installation, you will find the program in the following location: ../opt/codesys/lib/bpfprog.o.
The source code and instructions can be found in the following location: ../usr/share/doc/codesyscontrol/bpfprog.