8.7. Linux SockRaw - emllSockRaw

emllSockRaw is part of EC-Monitor for Linux. emllSockRaw uses the network interface of the native driver, e.g., eth0, eth1, etc. The network adapter must be exclusively used for EtherCAT® and cannot be used for LAN (local area network) at the same time. Because the native Linux driver for the network adapter type is typically not fully real-time capable, it cannot be used for real time applications. If possible, an acontis Real-time Ethernet Driver, e.g. emllIntelGbe, should be used instead. emllSockRaw does not need the atemsys driver.

Note

Root privileges are required. A cycle time of 4 ms or higher may be needed.

To run the application without root privileges, set the Linux capability ‘cap_net_raw’ to the application.
sudo setcap 'cap_net_raw+pe' ./EcMasterDemo
To run python scripts without root privileges, create a Python environment and set the Linux capability ‘cap_net_raw’ to the python interpreter.
cd Bin/Linux
python3 -m venv --copies PyEnv/
source PyEnv/bin/activate
sudo setcap 'cap_net_raw+pe' PyEnv/bin/python3

The parameters to emllSockRaw are setup-specific. The function CreateLinkParmsFromCmdLineSockRaw() in EcSelectLinkLayer.cpp demonstrates how to initialize the parameters.

Public Members

Common link parameters. Signature must be set to EC_LINK_PARMS_SIGNATURE_SOCKRAW.

Native ETH device name, e.g. “eth0” (zero terminated)

Don’t change target MAC address to FF:FF:FF:FF:FF:FF

Prevent adding Ethernet padding to work-around EtherCAT corruption bugs from native Linux driver(s)

Use PACKET_MMAP PACKET_RX_RING for receive

Set Coalescing parameters to enhance the link layer performance

Enable promiscuous mode at network adapter