1. Article purpose[edit source]
This article describes how to configure the Ethernet switch. It is highly recommended to read the Ethernet switch overview article.
2. Ethernet switch configuration[edit source]
The order of initialization in process of loading and initializing sequence is:
- GMAC ETH1 driver
- Stm32-deip glue
- edge-lkml
- ACM (if present)
The files, describing the process of detecting and initializing hardware devices during system boot-up, are located, on STM32MP2 series' boards , in directories:
- /etc/modprobe.d/edgx_sw_modprobe.conf
- /etc/modprobe.d/acm_modprobe.conf (if ACM present)
During switch driver (edge-lkm) probe, the interface on which the switch internal port is connected is given as parameter in file:
- /etc/modprobe.d/edgx_sw_core.conf
cat /etc/modprobe.d/edgx_sw_core.conf options edgx_pfm_lkm netif="end1:0"
Here internal port of switch is connected on end1 interface
2.1. Ethernet switch interface[edit source]
All available interfaces can be listed using ifconfigcommand:
- end0:
- standalone GMAC interface.
- end1:
- software interface for ETH1 GMAC,
- will not have an IP address.
- Sw0p1:
- internal port interface,
- will not have an IP address.
- Sw0p2:
- external port interface connected to ETH3 port,
- will not have an IP address.
- Sw0p3:
- external port interface connected to ETH1 port,
- will not have an IP address.
- Sw0ep:
Those interfaces are set during boot thanks to this script:
- /usr/sbin/ttt-ip-init-systemd.sh
This script is launch thanks to service systemd:
cat lib/systemd/system/st-tsn.service [Unit] Description=TSN service After=network.target systemd-networkd.service [Service] Type=forking ExecStart=/usr/sbin/ttt-ip-init-systemd.sh start ExecStop=/usr/sbin/ttt-ip-init-systemd.sh stop [Install] WantedBy=multi-user.target
2.1.1. More details about /usr/sbin/ttt-ip-init-systemd.sh[edit source]
Services startup:
- Start deptp: proprietary PTP stack provided by TTTech used for gPTP synchronization
- Start LLDP (Link Layer Discovery Protocol): Use to exchange information (name, capabilities) with other connected devices
- Start SNMPD: Use to collect data from the switch
- Configure MSTP (through « mstpctl »): Used for spanning tree management (to avoid loop in a network)
PHY configuration:
- Affect PHY to the well switch port:
echo -n stmmac-1:05 > /sys/devices/platform/soc/$IP_REF_NAME/net/sw0p3/phy/mdiobus echo -n stmmac-1:04 > /sys/devices/platform/soc/$IP_REF_NAME/net/sw0p2/phy/mdiobus (ls –al /sys/bus/mdio_bus/devices/ to know which mdio bus refers to GMAC ETH1)
-> Here Phy address 5 is affected to sw0p3 port
-> Here Phy address 4 is affected to sw0p2 port
- Add phy delays:
Used by the switch to compute its propagation delay (used for gPTP) echo 84 > /sys/class/net/sw0p2/phy/delay1000tx_min echo 92 > /sys/class/net/sw0p2/phy/delay1000tx_max echo 84 > /sys/class/net/sw0p3/phy/delay1000tx_min echo 92 > /sys/class/net/sw0p3/phy/delay1000tx_max echo 0 > /sys/class/net/sw0p2/phy/delay1000rx_min echo 250 > /sys/class/net/sw0p2/phy/delay1000rx_max echo 0 > /sys/class/net/sw0p3/phy/delay1000rx_min echo 250 > /sys/class/net/sw0p3/phy/delay1000rx_max
- Configure IP address by default for sw0ep interface: ip addr add 192.168.0.10 dev sw0ep
3. References[edit source]