Search by Tags

Ethernet/Network (Linux)

 

Article updated at 10 Jun 2021
Compare with Revision




Introduction

The Toradex Yocto BSP reference images currently provide two utilities for network configuration: connman and systemd-networkd. By default, the Ethernet port is managed by connman, and the USB RNDIS interface by systemd-networkd. Depending on the application, it might make sense to use one of those utilities over the other.

By default, connman will try to configure any available network interfaces and tries to keep only (the best) connection connected at any time. The design is targeted towards interactive, wireless devices such as tablets, etc.

The systemd provided utility systemd-networkd, on the other hand, emphasizes headless server systems with static configuration.

Below are instructions on how to use connman and/or systemd-networkd, or how to replace connman with NetworkManager on Yocto.

TorizonCore

TorizonCore uses NetworkManager. Even though this article has some information about it, it's meant for people using the Yocto BSP reference images, not people using TorizonCore.

If you are using TorizonCore, go directly to Networking with TorizonCore.

Connman

Our latest V2.x images use connman as the overall connection management framework. The GUI management tool can be started with connman-properties or by starting the taskbar applet connman-applet.

The command-line interface tool connmanctl can be used in an interactive shell mode or as a single command using arguments.

root@apalis-t30:~# connmanctl services
*AO Wired                { ethernet_00142d269dfd_cable }
root@apalis-t30:~# connmanctl services ethernet_00142d269dfd_cable
[ ethernet_00142d269dfd_cable ]

  Type = ethernet
  Security = [ ]
  State = online
  Favorite = True
  Immutable = False
  AutoConnect = True
  Name = Wired
  Ethernet = { Method=auto Interface=enp7s0 Address=00:14:2D:26:9D:FD MTU=1500 }
  IPv4 = { Method=dhcp Address=192.168.10.162 Netmask=255.255.255.0 Gateway=192.168.10.1 }
  IPv4.Configuration = { Method=dhcp }
  IPv6 = { }
  IPv6.Configuration = { Method=auto Privacy=disabled }
  Nameservers = [ 8.8.8.8 ]
  Nameservers.Configuration = [ ]
  Timeservers = [ 192.168.10.1 ]
  Timeservers.Configuration = [ ]
  Domains = [ colibri.net ]
  Domains.Configuration = [ ]
  Proxy = { URL=http://wpad.colibri.net/wpad.dat Method=auto }
  Proxy.Configuration = { }
  Provider = { }

Using the interactive mode to configure a static Ethernet address

root@colibri-t30:~# connmanctl
connmanctl> config ethernet_00142d259a48_cable --ipv4 manual 192.168.10.2 255.255.255.0 192.168.10.1
connmanctl> exit

Using the interactive mode to configure the nameservers (DNS)

root@colibri-t30:~# connmanctl config ethernet_00142d259a48_cable --nameservers 8.8.8.8

Using the interactive mode to get an IP automatically via DHCP

root@colibri-t30:~# connmanctl
connmanctl> config ethernet_00142d259a48_cable --ipv4 dhcp
connmanctl> exit

Tethering

Connman can be used for tethering which allows sharing a connection of a device for another locally connected device. The Toradex module running Connman would be the device sharing the connection.

Tethering puts some requirements on the kernel. The README in the Connman source tree holds more information on these requirements.

USB gadget tethering

Note: Since image V2.4 systemd-networkd has control over the USB gadget Ethernet interface (RNDIS). Remove the rndis.network file under /etc/systemd/networkd and make sure usb/rndis is not part of NetworkInterfaceBlacklist in /etc/connman/main.conf.

To enable tethering on the USB gadget interface make sure the USB gadget driver is loaded/enabled first (see USB Device Mode (Linux)). Then Connman can be used to enable tethering mode:

# connmanctl 
connmanctl> tether gadget on
connmanctl> [  194.725436] device usb0 entered promiscuous mode
[  194.737525] tether: port 1(usb0) entered forwarding state
[  194.743077] tether: port 1(usb0) entered forwarding state
Enabled tethering for gadget

To preconfigure Connman to automatically start Gadget interfaces upon start-up two configuration files are needed:

The main.conf under /etc/connman/main.conf

[General]
PersistentTetheringMode=true
TetheringTechnologies=gadget

The service settings file under /var/lib/connman/settings

[global]
OfflineMode=false

[Wired]
Enable=true
Tethering=false

[Gadget]
Enable=true
Tethering=true

For other configuration options, the Python interface documentation has some useful configuration examples: https://pythonhosted.org/pyconnman/config.html

Multiple active connections

By default, ConnMan is configured to only have one connected technology. This means it will connect only to one interface after boot, even if there are multiply available and configured to auto-connect. But sometimes one wants to have two or more interfaces to be auto connected, e.g. ethernet and WiFi. To achieve this, one can change the ConnMan configuration file at /etc/connman/main.conf, e.g. to enable auto-connect for both ethernet and WiFi, change the following entries accordingly in the configuration file:

/etc/connman/main.conf
PreferredTechnologies=wifi,ethernet
SingleConnectedTechnology=false

Check the man-page of the ConnMan configuration file for more details.

NetworkManager

If you want to use NetworkManager, remove connman and add NetworkManager on a custom OpenEmbedded build. See an example below:

local.conf
# Remove connman
IMAGE_INSTALL_remove = " connman"
IMAGE_INSTALL_remove = " connman-client"
IMAGE_INSTALL_remove = " connman-gnome"
IMAGE_INSTALL_remove = " connman-plugin-wifi"
IMAGE_INSTALL_remove = " connman-plugin-ethernet"
IMAGE_INSTALL_remove = " connman-plugin-loopback"
# Add NetworkManager
IMAGE_INSTALL_append = " networkmanager"
IMAGE_INSTALL_append = " modemmanager"

Check out the OpenEmbedded (core) article to learn how to build and customize a sample Linux image with OpenEmbedded.

systemd-networkd

If you plan to use systemd-networkd as the primary network configuration utility, you should remove connman first (when using a console-only image, you won't need to remove connman-gnome). You can use the package manager to remove the package from pre-built images by invoking

opkg remove connman-gnome connman

To remove connman when building an image using OpenEmbedded remove CONMANPKGS from IMAGE_INSTALL in the image recipe recipes/images/angstrom-lxde-image.bb in the meta-toradex layer (see OpenEmbedded (core) how to build a complete image).

Manual Configuration for Wired Connections

Warning: if you are using TorizonCore, go directly to Networking with TorizonCore - Static Network Configuration.

Create a file named 'wired.network' under /etc/systemd/network/

root@colibri-vf:~# vi /etc/systemd/network/wired.network

For dynamic IP connection fill in the file with the following content:

[Match]
Name=eth0

[Network]
DHCP=ipv4

For static IP connection:

[Match]
Name=eth0

[Network]
Address=192.168.0.1/24
Gateway=192.168.0.254
DNS=8.8.8.8

Bridge

Using systemd-networkd one can easily setup a network bridge between two Ethernet interfaces:

/etc/systemd/network/eth.network

[Match]
Name=eth*

[Network]
Bridge=br0

/etc/systemd/network/bridged.network

[Match]
Name=br0

[Network]
DHCP=ipv4

VLAN

This example configures a dynamic IP configuration on the ethernet device (untagged) and also creates a new Ethernet interface associated with VLAN 100 (tagged). The example uses a dynamic IP configuration on VLAN 100 too.

/etc/systemd/network/wired.network

[Match]
Name=eth0

[Network]
DHCP=ipv4
VLAN=eth0.100

/etc/systemd/network/eth0.100.netdev

[NetDev]
Name=eth0.100
Kind=vlan

[VLAN]
Id=100

/etc/systemd/network/vlan100.network

[Match]
Name=eth0.100

[Network]
DHCP=v4

Integrating Network Files Into an OpenEmbedded/Yocto Image

The integration should be done similarly to the existing rndis.network file, see bbappend and files subdirectory of our systemd configuration:

First place the above file 'wired.network' inside systemd folder:

~/oe-core/stuff/meta-toradex/recipes-core/systemd/systemd

Than edit the bbappend file adding the 'wired.network' file like bellow:

vi ~/oe-core/stuff/meta-toradex/recipes-core/systemd/systemd_%.bbappend
FILESEXTRAPATHS_prepend := "${THISDIR}/systemd:"

SRC_URI += " \
    file://wired.network \
    file://rndis.network \
    file://0001-systemd-udevd.service.in-set-MountFlags-shared.patch \
"

PACKAGECONFIG_append = " networkd"

do_install_append() {
    # The network files need to be in /usr/lib/systemd, not ${systemd_unitdir}...
    install -d ${D}${prefix}/lib/systemd/network/
    install -d ${D}/etc/systemd/network/
    install -m 0644 ${WORKDIR}/rndis.network ${D}${prefix}/lib/systemd/network/
    install -m 0644 ${WORKDIR}/wired.network ${D}/etc/systemd/network/
}

FILES_${PN} += " \
    ${nonarch_base_libdir}/systemd/network \
"

Manual Network Configuration

For testing and debugging purposes, one can use iproute2 utilities to manually set up a static IP and BusyBox's udhcpc utility to explicitly request an IP address using DHCP. Note that such a configuration will not be persistent across reboots.

Make sure to disable the networking management daemons to avoid interference:

systemctl stop connman.service
systemctl stop systemd-networkd.socket
systemctl stop systemd-networkd.service

Get a list of interfaces using ip link:

# ip link
1: lo:  mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0:  mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 1000
    link/ether 00:14:2d:59:ca:81 brd ff:ff:ff:ff:ff:ff
3: sit0@NONE:  mtu 1480 qdisc noop state DOWN mode DEFAULT group default 
    link/sit 0.0.0.0 brd 0.0.0.0
4: can0:  mtu 16 qdisc noop state DOWN mode DEFAULT group default qlen 10
    link/can

Static Network Configuration

Enable the network interface (e.g. eth0):

# ip link set $interface up

Assign a static IP address:

# ip addr add $IP_address/$subnet_mask broadcast $broadcast_address dev $interface

Then add your gateway IP address:

# ip route add default via $default_gateway

For example:

# ip link set eth0 up
$ ip addr add 192.168.10.2/24 broadcast 192.168.10.255 dev eth0
$ ip route add default via 192.168.10.1

To undo these configurations (e.g. before switching to a dynamic IP), first remove any assigned IP address:

# ip addr flush dev $interface

Then remove any assigned gateway:

# ip route flush dev $interface

And finally disable the interface:

# ip link set $interface down

Dynamic Network Configuration

The utility udhcpc can be used to get a one time lease for an IP address from the DHCP server serving the local network:

# udhcpc -i eth0
udhcpc (v1.23.2) started
...
Sending discover...
Sending select for 192.168.10.108...
Lease of 192.168.10.108 obtained, lease time 86400
...

Ethernet/Network interfaces

Apalis iMX6

The Apalis iMX6 modules provide a Gigabit Ethernet network connection using an internal Ethernet controller communicating via the RGMII interface.

[    1.447124] fec 2188000.ethernet eth0: registered PHC device 0
[    6.725715] fec 2188000.ethernet eth0: Freescale FEC PHY driver [Micrel KSZ9031 Gigabit PHY] (mii_bus:phy_addr=2188000.ethernet:07, irq=70)
[    6.744126] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[  300.899121] fec 2188000.ethernet eth0: Link is Up - 1Gbps/Full - flow control off
[  300.907002] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready

The IEEE 1588 main clock required to provide accurate timestamps is routed through an external SoC Pad GPIO16 (SPDIF1_IN). This is a hardware limitation, for details refer to the Apalis iMX6 Datasheet Chapter 5.3 Ethernet. The following device tree changes make sure the time stamping clock is properly routed to the IEEE 1588 block:

 --- a/arch/arm/boot/dts/imx6qdl-apalis.dtsi
 +++ b/arch/arm/boot/dts/imx6qdl-apalis.dtsi
 @@ -688,6 +688,7 @@
                                 MX6QDL_PAD_RGMII_RD2__RGMII_RD2       0x1b0b0
                                 MX6QDL_PAD_RGMII_RD3__RGMII_RD3       0x1b0b0
                                 MX6QDL_PAD_RGMII_RX_CTL__RGMII_RX_CTL 0x1b0b0
 +                               MX6QDL_PAD_GPIO_16__ENET_REF_CLK      ((1<<30) | 0x1b0b0)
                         >;
                 };
                 pinctrl_enet_ctrl: enet_ctrlgrp {
 @@ -871,7 +872,6 @@
         spdif {
                 pinctrl_spdif: spdifgrp {
                         fsl,pins = <
 -                               MX6QDL_PAD_GPIO_16__SPDIF_IN  0x1b0b0
                                 MX6QDL_PAD_GPIO_17__SPDIF_OUT 0x1b0b0
                         >;
                 };

Apalis iMX8 / iMX8X

The Apalis iMX8 / iMX8X modules provide a Gigabit Ethernet network connection using an internal Ethernet controller communicating via RGMII interface.

root@apalis-imx8:~# dmesg | grep fec
[    2.753007] fec 5b040000.ethernet: 5b040000.ethernet supply phy not found, using dummy regulator
[    2.783775] libphy: fec_enet_mii_bus: probed
[    2.791087] fec 5b040000.ethernet eth0: registered PHC device 0
[   13.962747] fec 5b040000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx

Disconnect and reconnect the network cable:

[   42.626377] fec 5b040000.ethernet eth0: Link is Down
[   42.644164] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[   44.674417] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[   44.682705] fec 5b040000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx

Apalis TK1 / T30

The Apalis TK1 and T30 modules provide an Ethernet network connection through an Intel I210-AT Gigabit Ethernet Controller Chip

[    5.541133] igb 0000:01:00.0: added PHC on eth0
[    5.547812] igb 0000:01:00.0: Intel(R) Gigabit Ethernet Network Connection
[    5.556847] igb 0000:01:00.0: eth0: (PCIe:2.5GT/s:Width x1) 
[    5.564655] igb 0000:01:00.0 eth0: MAC: 00:14:2d:2b:13:23
[    5.572149] igb 0000:01:00.0: eth0: PBA No: Unknown
[    5.579107] igb 0000:01:00.0: LRO is disabled
[    5.585458] igb 0000:01:00.0: Using MSI-X interrupts. 1 rx queue(s), 1 tx queue(s)
[   11.123624] IPv6: ADDRCONF(NETDEV_UP): rndis0: link is not ready
[   13.817577] igb 0000:01:00.0 enp1s0: igb: enp1s0 NIC Link is Up 100 Mbps Full Duplex, Flow Control: RX/TX
[   13.838881] IPv6: ADDRCONF(NETDEV_CHANGE): enp1s0: link becomes ready

Colibri T20/T30

The Colibri T20/T30 modules provide an Ethernet network connection through an AX88772B chip connected to the second EHCI USB 2.0 controller.

[    4.193401] usb 1-1: new high speed USB device using tegra-ehci and address 2
[    4.443757] usb 1-1: New USB device found, idVendor=0b95, idProduct=772b
[    4.450451] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[    4.457589] usb 1-1: Product: AX88772B
[    4.461332] usb 1-1: Manufacturer: ASIX Elec. Corp.
[    4.466219] usb 1-1: SerialNumber: 000001
...
[    5.314474] ASIX USB Ethernet Adapter:v4.1.0 09:33:56 Jul  4 2011
[    5.314479] <6>    http://www.asix.com.tw
...
[    5.337205] eth%d: status ep1in, 8 bytes period 11
[    5.342226] eth0: register 'asix' at usb-tegra-ehci.1-1, ASIX AX88772B USB 2.0 Ethernet, 00:0e:c6:87:72:01
...
[    5.674034] Netfilter messages via NETLINK v0.30.
[    5.678773] nf_conntrack version 0.5.0 (2227 buckets, 8908 max)
[    5.684918] ctnetlink v0.93: registering with nfnetlink.
[    5.690323] xt_time: kernel timezone is -0000
[    5.694915] ip_tables: (C) 2000-2006 Netfilter Core Team
[    5.700294] arp_tables: (C) 2002 David S. Miller
[    5.704950] TCP cubic registered
[    5.708173] NET: Registered protocol family 17
[    5.712623] NET: Registered protocol family 15
...
[    9.958314] eth0: rxqlen 0 --> 5
[   10.032823] eth0: ax88772b - Link status is: 0

Colibri VF50/VF61

The Colibri VF50/VF61 modules provide an Ethernet network connection using an internal Ethernet controller communicating via the RMII interface.

[   20.417573] fec 400d1000.ethernet eth0: NXP/Freescale FEC PHY driver [Micrel KSZ8041] (mii_bus:phy_addr=400d1000.etherne:00, irq=-1)
[   20.569406] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[  160.418064] fec 400d1000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx
[  160.426085] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready

Using Second Ethernet Controller on Colibri VFxx

Vybrid has two on-chip Ethernet controllers available via two independent RMII interfaces. One controller is connected to the on-module PHY which is used according to the standard Colibri Ethernet pin-out. To use the second on-chip Ethernet controller an external PHY (on the carrier board) needs to be connected to the RMII interface. Refer to the Colibri Vybrid datasheet. Please use the link below to download the reference schematics and CAE data for RMII based Ethernet:

Note: The RMII pin-out of the second Ethernet controller is not compatible with other modules in the Colibri family.

To enable software support for the second Ethernet controller, a custom device tree is required. Our Kernel tree contains a custom device tree for the dual Ethernet Colibri Carrier Board: Device trees for dual Ethernet Board

To make sure U-Boot selects the device tree automatically, you can make use of the fdt_board variable:

setenv fdt_board dual-eth
saveenv

For more details on how to customize the device tree refer to the article Device Tree Customization.

Note: The second instance of the internal Ethernet controller (FEC1) is the default/on-module Ethernet controller on Colibri VFxx while the first instance of the internal Ethernet controller (FEC0) is the additional Ethernet controller. However, currently, the native order of the FEC instances is used to assign the interface names (eth0 for FEC0, eth1 for FEC1). The device tree alias is used by U-Boot to assign the primary MAC address (ethaddr) to the device behind the alias ethernet0 and the secondary MAC address (eth1addr) to the device behind the alias ethernet1. However, the Linux kernel does not name interfaces according to those aliases. A method to work around this limitation is to use a udev rule file which renames the network interfaces (/etc/udev/rules.d/20-ethernet.rules):

/etc/udev/rules.d/20-ethernet.rules
# Ethernet network device rules file
#
# Do not assign ethX names, since they might be already in use.
# Use udevadm to get possible selectors.
# udevadm info -a -p /sys/class/net/eth0
 
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", KERNELS=="400d0000.ethernet", NAME="fec1"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", KERNELS=="400d1000.ethernet", NAME="fec0"

Using Hardware Switch on Colibri VFxx

The NXP Vybrid SoC provides a hardware Ethernet Switch controller which can control the two network interfaces (MACs). This allows Ethernet frames to pass through without any intervention by the CPU.

Our BSP V2.6 Beta 2 and later provide the driver as a configuration option CONFIG_FSL_L2_SWITCH. Apply the following device tree changes to enable the driver:

diff --git a/arch/arm/boot/dts/vf-colibri-dual-eth.dtsi b/arch/arm/boot/dts/vf-colibri-dual-eth.dtsi
index 8fed730..4cc2421 100644
--- a/arch/arm/boot/dts/vf-colibri-dual-eth.dtsi
+++ b/arch/arm/boot/dts/vf-colibri-dual-eth.dtsi
@@ -14,20 +14,15 @@
        };
 
        aliases {
-               ethernet0 = &fec0;
-               ethernet1 = &fec1;
+               ethernet0 = &esw;
        };
 };
 
-&fec0 {
-       phy-mode = "rmii";
-       pinctrl-names = "default";
-       pinctrl-0 = <&pinctrl_fec0>;
-       status = "okay";
-};
-
-&fec1 {
-       status = "okay";
+&esw {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_fec0 &pinctrl_fec1>;
+       status = "okay";
 };

The boot log should show the assignment of the two PHYs:

[    0.856500] libphy: fsl l2 switch MII Bus: probed
[    0.861269] fsl l2 switch MII Bus mdiobus(0) register ok.
[    0.867796] eth-switch 400e8000.l2-switch eth0: eth0: Ethernet switch 00:14:2d:49:ca:81

Note: With the L2 switch driver the Ethernet physical layer transceiver (PHY's) is no longer connected to the Linux Ethernet port. This means that the Linux port will always appear to be UP, even when both Ethernet ports are disconnected. Earlier versions of the driver did connect only the PHY of port 0 to the Ethernet interface, which added a dependency between PHY0 and the Ethernet interface (see net: fsl_l2_switch: drop registering phy in switch mode).

Colibri iMX6 / iMX6ULL / iMX7 / iMX8X

The Colibri iMX6, iMX6ULL, iMX7, and iMX8X modules provide an Ethernet network connection through Microchip/Micrel KSZ8041NL Ethernet PHY

[    0.669871] fec 30be0000.ethernet: Linked as a consumer to regulator.12
[    0.681626] libphy: fec_enet_mii_bus: probed
[    0.682447] fec 30be0000.ethernet eth0: registered PHC device 0
...
[    5.140230] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[    5.152342] Micrel KSZ8041 30be0000.ethernet-1:00: attached PHY driver [Micrel KSZ8041] (mii_bus:phy_addr=30be0000.ethernet-1:00, irq=POLL)
[    5.152698] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
...
[    7.273061] fec 30be0000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx

Verdin

According to the Verdin Family Specification, one Gigabit Ethernet port is Always Compatible. It is a 10/100/1000 Mbit media-dependent interface, with the Ethernet PHY on the module.

Another gigabit media independent interface (RGMII) may be available on Reserved pins. To use it, you must place an Ethernet PHY on your carrier board. Our open-source Verdin Development Board can be used as a reference design.

Learn more about the pin-compatibility concepts of Always Compatible, Reserved and Module-specific in the Verdin Family Specification.

Verdin iMX8M Mini

Since the i.MX 8M Mini SoC features only a single Ethernet MAC, only the Always Compatible Verdin Ethernet is available on a module. The standard SKU versions of the Verdin iMX8M Mini feature an on-module Microchip KSZ9131 Gigabit Ethernet PHY and therefore provide the media-dependent interface.

Modules with RGMII output are available as build-to-order assembly variants.

root@verdin-imx8mm:~# dmesg | grep fec
[    3.621159] libphy: fec_enet_mii_bus: probed
[    3.626634] fec 30be0000.ethernet eth0: registered PHC device 0
[   11.267886] fec 30be0000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx

Disconnect and reconnect the network cable:

[  220.094536] fec 30be0000.ethernet eth0: Link is Down
[  220.113357] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[  225.941052] fec 30be0000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx
[  225.948853] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready

Early samples of the Verdin iMX8M Mini modules such as V1.0A and V1.0B are using the KSZ9031 PHY which works on BSP 3.0, however, adding the correct skew settings are recommended. Refer to Example of Device Tree customization to add support for KSZ9131 for correct settings.

Verdin iMX8M Plus

The two Ethernet MAC that the i.MX 8M Plus SoC provides are slightly different from the i.MX 8M Mini. Both Ethernet controllers support Energy Efficient Ethernet (EEE), Ethernet AVB, and IEEE 1588. Only one Ethernet controller features additional Time-Sensitive Networking (TSN). This controller is used for the Always Compatible on-module Gigabit Ethernet PHY, the Microchip KSZ9131.

root@verdin-imx8mp:~# dmesg | grep imx-dwmac
[    1.302554] imx-dwmac 30bf0000.ethernet: IRQ eth_lpi not found
[    1.308468] imx-dwmac 30bf0000.ethernet: no reset control found
[    3.284332] imx-dwmac 30bf0000.ethernet: IRQ eth_lpi not found
[    3.290382] imx-dwmac 30bf0000.ethernet: no reset control found
[    3.308229] imx-dwmac 30bf0000.ethernet: User ID: 0x10, Synopsys ID: 0x51
[    3.315157] imx-dwmac 30bf0000.ethernet:     DWMAC4/5
[    3.320046] imx-dwmac 30bf0000.ethernet: DMA HW capability register supported
[    3.327315] imx-dwmac 30bf0000.ethernet: RX Checksum Offload Engine supported
[    3.334582] imx-dwmac 30bf0000.ethernet: TX Checksum insertion supported
[    3.341410] imx-dwmac 30bf0000.ethernet: Wake-Up On Lan supported
[    3.347650] imx-dwmac 30bf0000.ethernet: Enable RX Mitigation via HW Watchdog Timer
[    3.355452] imx-dwmac 30bf0000.ethernet: Enabled Flow TC (entries=8)
[    3.361930] imx-dwmac 30bf0000.ethernet: Enabling HW TC (entries=256, max_off=256)
[    5.947505] imx-dwmac 30bf0000.ethernet eth0: PHY [stmmac-1:07] driver [Microchip KSZ9131 Gigabit PHY]
[    5.986512] imx-dwmac 30bf0000.ethernet eth0: No Safety Features support found
[    5.986532] imx-dwmac 30bf0000.ethernet eth0: IEEE 1588-2008 Advanced Timestamp supported
[    5.990368] imx-dwmac 30bf0000.ethernet eth0: registered PTP clock
[    6.040561] imx-dwmac 30bf0000.ethernet eth0: configuring for phy/rgmii-id link mode

Connect, disconnect and reconnect the network cable:

 
[ 2335.143057] imx-dwmac 30bf0000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx
[ 2335.151363] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[ 2348.452145] imx-dwmac 30bf0000.ethernet eth0: Link is Down
[ 2366.886638] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[ 2366.893330] imx-dwmac 30bf0000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx

The second Ethernet controller (without TSN) is available as an RGMII interface on Reserved pins of the module edge connector pins.

root@verdin-imx8mp:~# dmesg | grep fec
[    1.224395] libphy: fec_enet_mii_bus: probed
[    1.229590] fec 30be0000.ethernet eth1: registered PHC device 0
[    5.428439] fec 30be0000.ethernet eth1: Link is Up - 100Mbps/Full - flow control rx/tx

Connect, disconnect and reconnect the network cable:

 
[ 2191.837002] IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready
[ 2191.843574] fec 30be0000.ethernet eth1: Link is Up - 1Gbps/Full - flow control rx/tx
[ 2198.461504] fec 30be0000.ethernet eth1: Link is Down
[ 2205.465840] IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready
[ 2205.469285] fec 30be0000.ethernet eth1: Link is Up - 1Gbps/Full - flow control rx/tx

The Gigabit Ethernet MAC in the i.MX8M Plus SoC integrates an accurate IEEE 1588 compliant timer for clock synchronization for distributed control nodes used in industrial automation applications. The interface features external IEEE 1588 synchronization pins on alternate functions. The Ethernet interface supports Audio Video Bridging (AVB) and Time-Sensitive Networking (TSN).

Ethernet Benchmark (iperf3)

The Colibri SoMs provide a sustained data rate of around 95 Mbits/sec for a 100Base-T connection while the Apalis and Verdin SoMs provide a sustained data rate of around 700-900 Mbits/sec for a 1000Base-T connection. The CPU utilization usually stays well below 25 % on one single core.
Note that the i.MX6 bandwidth is limited to around 400 Mbits/sec, see NXP's Errata ERR004512.
Note that the CPU's DVFS in combination with TCP's flow control may negatively impact throughput.

Ethernet Benchmark, SoM as Client

Start server on Host:

[user@host ~]$ iperf3 -s
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
Accepted connection from 192.168.10.215, port 52568
[  5] local 192.168.10.1 port 5201 connected to 192.168.10.215 port 52570
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-1.00   sec   102 MBytes   852 Mbits/sec
[  5]   1.00-2.00   sec   112 MBytes   939 Mbits/sec
[  5]   2.00-3.00   sec   112 MBytes   941 Mbits/sec
[  5]   3.00-4.00   sec   112 MBytes   940 Mbits/sec
[  5]   4.00-5.00   sec   112 MBytes   941 Mbits/sec
[  5]   5.00-6.00   sec   112 MBytes   941 Mbits/sec
[  5]   6.00-7.00   sec   112 MBytes   940 Mbits/sec
[  5]   7.00-8.00   sec   112 MBytes   941 Mbits/sec
[  5]   8.00-9.00   sec   112 MBytes   940 Mbits/sec
[  5]   9.00-10.00  sec   112 MBytes   942 Mbits/sec
[  5]  10.00-10.04  sec  4.51 MBytes   935 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-10.04  sec  1.09 GBytes   932 Mbits/sec                  receiver
-

Start client on SoM

root@verdin-imx8mm:~# iperf3 -c 192.168.10.1
Connecting to host 192.168.10.1, port 5201
[  5] local 192.168.10.215 port 52570 connected to 192.168.10.1 port 5201
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec   108 MBytes   905 Mbits/sec    0    508 KBytes
[  5]   1.00-2.00   sec   113 MBytes   947 Mbits/sec    0    508 KBytes
[  5]   2.00-3.00   sec   112 MBytes   937 Mbits/sec    0    508 KBytes
[  5]   3.00-4.00   sec   113 MBytes   944 Mbits/sec    0    508 KBytes
[  5]   4.00-5.00   sec   112 MBytes   939 Mbits/sec    0    508 KBytes
[  5]   5.00-6.00   sec   112 MBytes   937 Mbits/sec    0    508 KBytes
[  5]   6.00-7.00   sec   112 MBytes   939 Mbits/sec    0    508 KBytes
[  5]   7.00-8.00   sec   113 MBytes   944 Mbits/sec    0    508 KBytes
[  5]   8.00-9.00   sec   112 MBytes   938 Mbits/sec    0    508 KBytes
[  5]   9.00-10.00  sec   112 MBytes   939 Mbits/sec    0    508 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec  1.09 GBytes   937 Mbits/sec    0             sender
[  5]   0.00-10.04  sec  1.09 GBytes   932 Mbits/sec                  receiver

iperf Done.

CPU Utilisation during the test, start top over an SSH connection and observe during bandwidth test:

root@verdin-imx8mm:~# top
...
  PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
 4341 root      20   0    6484   3640   3192 R   6.0   0.2   0:00.40 iperf3

Ethernet Benchmark, SoM as Server

Start server on SoM:

root@verdin-imx8mm:~# iperf3 -s
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
Accepted connection from 192.168.10.1, port 36318
[  5] local 192.168.10.215 port 5201 connected to 192.168.10.1 port 36320
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-1.00   sec  82.0 MBytes   688 Mbits/sec
[  5]   1.00-2.00   sec  83.9 MBytes   704 Mbits/sec
[  5]   2.00-3.00   sec  82.6 MBytes   693 Mbits/sec
[  5]   3.00-4.00   sec  81.4 MBytes   683 Mbits/sec
[  5]   4.00-5.00   sec  80.4 MBytes   674 Mbits/sec
[  5]   5.00-6.00   sec  82.9 MBytes   696 Mbits/sec
[  5]   6.00-7.00   sec  80.8 MBytes   678 Mbits/sec
[  5]   7.00-8.00   sec  81.5 MBytes   684 Mbits/sec
[  5]   8.00-9.00   sec  83.0 MBytes   696 Mbits/sec
[  5]   9.00-10.00  sec  82.5 MBytes   692 Mbits/sec
[  5]  10.00-10.00  sec   249 KBytes   536 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-10.00  sec   821 MBytes   689 Mbits/sec                  receiver

Start client on host:

[user@host ~]$ iperf3 -c 192.168.10.215
Connecting to host 192.168.10.215, port 5201
[  5] local 192.168.10.1 port 36320 connected to 192.168.10.215 port 5201
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec  83.8 MBytes   703 Mbits/sec    0    379 KBytes
[  5]   1.00-2.00   sec  84.0 MBytes   705 Mbits/sec    0    455 KBytes
[  5]   2.00-3.00   sec  83.0 MBytes   696 Mbits/sec    0    455 KBytes
[  5]   3.00-4.00   sec  81.5 MBytes   684 Mbits/sec    0    455 KBytes
[  5]   4.00-5.00   sec  80.3 MBytes   674 Mbits/sec    0    455 KBytes
[  5]   5.00-6.00   sec  82.5 MBytes   692 Mbits/sec    0    455 KBytes
[  5]   6.00-7.00   sec  81.1 MBytes   680 Mbits/sec    0    455 KBytes
[  5]   7.00-8.00   sec  81.8 MBytes   687 Mbits/sec    0    455 KBytes
[  5]   8.00-9.00   sec  82.5 MBytes   692 Mbits/sec    0    455 KBytes
[  5]   9.00-10.00  sec  83.0 MBytes   696 Mbits/sec    0    455 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec   824 MBytes   691 Mbits/sec    0             sender
[  5]   0.00-10.00  sec   821 MBytes   689 Mbits/sec                  receiver

CPU Utilisation during the test, start top over an SSH connection and observe during bandwidth test:

root@verdin-imx8mm:~# top
...
  PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
 4036 root      20   0    6484   3616   3160 S  10.3   0.2   0:00.45 iperf3

Raw Network Stack Bandwidth

Start server on SoM

root@verdin-imx8mm:~# iperf3 -s
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
Accepted connection from ::1, port 53888
[  5] local ::1 port 5201 connected to ::1 port 53890
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-1.00   sec   790 MBytes  6.63 Gbits/sec
[  5]   1.00-2.00   sec   816 MBytes  6.84 Gbits/sec
[  5]   2.00-3.00   sec   815 MBytes  6.84 Gbits/sec
[  5]   3.00-4.00   sec   818 MBytes  6.87 Gbits/sec
[  5]   4.00-5.00   sec   819 MBytes  6.87 Gbits/sec
[  5]   5.00-6.00   sec   825 MBytes  6.92 Gbits/sec
[  5]   6.00-7.00   sec   822 MBytes  6.89 Gbits/sec
[  5]   7.00-8.00   sec   822 MBytes  6.90 Gbits/sec
[  5]   8.00-9.00   sec   819 MBytes  6.87 Gbits/sec
[  5]   9.00-10.00  sec   815 MBytes  6.83 Gbits/sec
[  5]  10.00-10.04  sec  31.4 MBytes  6.87 Gbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-10.04  sec  8.00 GBytes  6.85 Gbits/sec                  receiver

Start client on SoM, e.g. over ssh:

root@verdin-imx8mm:~# iperf3 -c localhost
Connecting to host localhost, port 5201
[  5] local ::1 port 53890 connected to ::1 port 5201
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec   830 MBytes  6.96 Gbits/sec    0   2.06 MBytes
[  5]   1.00-2.00   sec   816 MBytes  6.84 Gbits/sec    0   2.06 MBytes
[  5]   2.00-3.00   sec   815 MBytes  6.84 Gbits/sec    0   2.06 MBytes
[  5]   3.00-4.00   sec   819 MBytes  6.87 Gbits/sec    0   2.06 MBytes
[  5]   4.00-5.00   sec   819 MBytes  6.87 Gbits/sec    0   2.06 MBytes
[  5]   5.00-6.00   sec   825 MBytes  6.92 Gbits/sec    0   2.06 MBytes
[  5]   6.00-7.00   sec   822 MBytes  6.90 Gbits/sec    0   2.06 MBytes
[  5]   7.00-8.00   sec   821 MBytes  6.89 Gbits/sec    0   2.06 MBytes
[  5]   8.00-9.00   sec   819 MBytes  6.87 Gbits/sec    0   2.06 MBytes
[  5]   9.00-10.00  sec   815 MBytes  6.84 Gbits/sec    0   2.06 MBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec  8.01 GBytes  6.88 Gbits/sec    0             sender
[  5]   0.00-10.04  sec  8.00 GBytes  6.85 Gbits/sec                  receiver

iperf Done.