5.22. Linux SockXdp - emllSockXdp
The Real-time Ethernet Driver SockXdp does not need the atemsys driver and uses already established Ethernet adapters, e.g. eth0, eth1, etc. It is strongly recommended to use a separate network adapter to connect EtherCAT devices. If the main network adapter is used for both EtherCAT devices and the local area network there may be a main impact on the local area network operation.
Note
Root privileges are required.
The parameters to the Real-time Ethernet Driver SockXdp are setup-specific. The function CreateLinkParmsFromCmdLineSockXdp()
in EcSelectLinkLayer.cpp
demonstrates how to initialize the Real-time Ethernet Driver instance.
-
struct EC_T_LINK_PARMS_SOCKXDP
Public Members
-
EC_T_LINK_PARMS linkParms
Common link parameters. Signature must be set to EC_LINK_PARMS_SIGNATURE_SOCKXDP
-
EC_T_CHAR szAdapterName[EC_SOCKXDP_ADAPTER_NAME_SIZE]
Native ETH device name, e.g. “eth0” (zero terminated)
-
EC_T_XDP_MODE eXdpMode
XDP mode
-
EC_T_LINK_PARMS linkParms
-
enum EC_T_XDP_MODE
Values:
5.22.1. Linux System Requirements
To use the XDP Real-time Ethernet Driver the following system requirements need to be met:
- Your kernel have to support XDP, check if the following entry is activated in your
.config
file. CONFIG_XDP_SOCKETS=y
If it is not activated you need to rebuild your kernel with
CONFIG_XDP_SOCKETS
.
- Your kernel have to support XDP, check if the following entry is activated in your
5.22.2. Getting started
Download libxdp Version 1.4.3 from https://github.com/xdp-project/xdp-tools and install it.
Download libbpf Version 1.5.0 from https://github.com/libbpf/libbpf and install it.
Update the linux drivers of the NIC that would be used
- If the NIC supports XDP, turn off xdp generic mode:
ip link set dev eth0 xdpgeneric off
- If the NIC have multiple queue support, use one queue instead of multiple queues:
ethtool -L eth0 combined 1