1. Article purpose[edit | edit source]
This article describes how to configure the Ethernet switch. It is highly recommended to read the Ethernet switch overview article.
Note that by adding the software expansion package mentioned below, the Ethernet switch is automatically configured at startup of the board. Through this article, we will so explain the different steps that are processed by the Ethernet switch package, so then you can adapt it for your own purpose.
2. Prerequisites[edit | edit source]
This article necessarily needs the X-LINUX-TSNSWCH expansion package installed on top of OpenSTLinux distribution. In this article explanations, we assume that you have this software expansion package installed.
3. Ethernet switch configuration[edit | edit source]
The order of initialization in process of loading and initializing sequence is:
- GMAC ETH1 driver
- Stm32-deip glue
- edge-lkml
- ACM (if ACM expansion package is installed)
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 expansion package is installed)
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
3.1. Ethernet switch interface[edit | edit source]
All available interfaces can be listed using ifconfig command:
- 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:
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
3.1.1. More details about /usr/sbin/ttt-ip-init-systemd.sh[edit | 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 right 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
Do not hesitate to open this script by yourself, it contains all the necessary commentaries to understand each step of the configuration.
4. References[edit | edit source]