# 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® network adapters. If the main network adapter is used for both EtherCAT® network adapters and the local area network there may be a major 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`](_downloads/bf62c71a4a7e317930818b9da4a9815c/EcSelectLinkLayer.cpp) demonstrates how to initialize the Real-time Ethernet Driver instance. ### struct EC_T_LINK_PARMS_SOCKXDP ### Public Members ### [EC_T_LINK_PARMS](emll_init.html.md#_CPPv415EC_T_LINK_PARMS) linkParms Common link parameters. Signature must be set to EC_LINK_PARMS_SIGNATURE_SOCKXDP. ### [EC_T_CHAR](api.html.md#_CPPv49EC_T_CHAR) szAdapterName[EC_SOCKXDP_ADAPTER_NAME_SIZE] Native ETH device name, e.g. “eth0” (zero terminated) ### [EC_T_WORD](api.html.md#_CPPv49EC_T_WORD) wQueueId Used NIC Queue Id ### [EC_T_XDP_MODE](#_CPPv413EC_T_XDP_MODE) eXdpMode XDP mode ### [EC_T_BOOL](api.html.md#_CPPv49EC_T_BOOL) bDisableForceBroadcast Don’t change target MAC address to FF:FF:FF:FF:FF:FF ### [EC_T_BOOL](api.html.md#_CPPv49EC_T_BOOL) bReplacePaddingWithNopCmd Prevent adding Ethernet padding to work-around EtherCAT corruption bugs from native Linux driver(s) ### enum EC_T_XDP_MODE *Values:* ### enumerator eXDP_SKB_MODE Generic XDP, XDP runs in the standard network stack. This is the fallback mode if native XDP is not supported ### enumerator eXDP_DRV_MODE Native XDP, Runs XDP directly in the NIC driver. This is the recommended mode for the best performance ### enumerator eXDP_HW_MODE Offloaded XDP, XDP programs are offloaded to the network card itself, running on the NIC firmware, not tested ### enumerator eXDP_DRV_ZEROCOPY Native XDP with ZEROCOPY ## 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`. ## Getting started - Download libxdp Version 1.4.3 from [https://github.com/xdp-project/xdp-tools](https://github.com/xdp-project/xdp-tools) and install it. - Download libbpf Version 1.5.0 from [https://github.com/libbpf/libbpf](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: : ```console $ ip link set dev eth0 xdpgeneric off ``` - If the NIC have multiple queue support, use one queue instead of multiple queues: : ```console $ ethtool -L eth0 combined 1 ```