How to configure Ethernet switch

Revision as of 11:51, 1 December 2023 by Registered User
Applicable for STM32MP25x lines

1. Purpose[edit source]

This article describes how to configure the Ethernet switch.

2. Switch configuration[edit source]

Boot sequence is: ETH1 -> Stm32-deip glue -> edge-lkml (-> ACM)

File describing the probe scheme are located on board in:

 /etc/modprobe.d/edgx_sw_modprobe.cnf
 /etc/modprobe.d/acm_modprobe.cnf

During edge-lkml probe, the interface on which the switch internal port is connected is given as parameter:

 Ex: edgx_pfm_lkm netif="end1:0"
 In: /etc/modprobe.d/edgx_sw_core.conf

2.1. Ethernet switch interface[edit source]

Alternate text
Ethernet Switch interfaces

Use ifconfig to list interfaces:

end0: standalone GMAC interface.

end1: SW interface for ETH1 GMAC. Connected to switch internal port. Will not have IP address!

Sw0p1: Internal port interface. Will not have IP address!

Sw0p2: External port interface connected to ETH3 port. Will not have IP address!

Sw0p3: External port interface connected to ETH1 port. Will not have IP address!

Sw0ep: « endpoint » interface Used to communicate to/from the MP25 through external ports.

Those interfaces are set during boot thanks to this script: /usr/sbin/ttt-ip-init-systemd.sh

2.1.1. more details about /usr/sbin/ttt-ip-init-systemd.sh[edit source]

Bridge setup (as described above)

Services startup:

  • Start deptp: proprietary PTP stack provided by TTTech used for gPTP synchronization
  • Start LLDP (Link Layer Discovery Protocol): Use to exchange informations (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 adress 5 is affected to sw0p3 port
-> Here Phy adress 4 is affected to sw0p2 port
Warning white.png Warning
This has to be updated for customer PHY


  • Add phy delays:
   Used by the switch to compute his 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
Warning white.png Warning
Value to be found in PHY datasheet


Warning white.png Warning
100 Mbps values are currently missing


  • Configure IP address of sw0ep interface by default: ip addr add 192.168.0.10 dev sw0ep

3. References[edit source]