Last edited 3 weeks ago

How to configure Ethernet switch: Difference between revisions

Registered User
m (Add link to the Github script)
Tag: 2017 source edit
Registered User
mNo edit summary
Tag: 2017 source edit
 
(3 intermediate revisions by 3 users not shown)
Line 9: Line 9:
This article describes how to configure the [[Ethernet switch overview|Ethernet switch]]. It is highly recommended to read the [[Ethernet switch overview]] article.
This article describes how to configure the [[Ethernet switch overview|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.  
Note that by adding the software expansion package mentioned below, '''the Ethernet switch is automatically configured at the startup of the board'''. Through this article, the different steps, processed by the Ethernet switch package, are introduced, the user can then adapt to his own purpose.  


== Prerequisites ==
== Prerequisites ==
This article necessarily needs the [[X-LINUX-TSNSWCH Expansion Package]] installed on top of [[STM32MPU Distribution Package | OpenSTLinux]] distribution. In this article explanations, we assume that you have this software expansion package installed.
This article necessarily needs and assumes that the [[X-LINUX-TSNSWCH expansion package]] is installed on top of a[[STM32MPU Distribution Package | OpenSTLinux]] distribution.


== Ethernet switch configuration==
== Ethernet switch configuration==
Line 30: Line 30:
   
   
  options edgx_pfm_lkm netif="end1:0"
  options edgx_pfm_lkm netif="end1:0"
Here internal port of switch is connected on end1 interface
Here, the internal port of switch is connected on end1 interface:


=== Ethernet switch interface ===
=== Ethernet switch interface ===
Line 40: Line 40:
*'''end1''':  
*'''end1''':  
**software interface for ETH1 GMAC,
**software interface for ETH1 GMAC,
**will not have an IP address.
**does not have an IP address.
*'''Sw0p1''':
*'''Sw0p1''':
**internal port interface,
**internal port interface,
**will not have an IP address.
**does not have an IP address.
*'''Sw0p2''':
*'''Sw0p2''':
**external port interface connected to ETH3 port,
**external port interface connected to ETH3 port,
**will not have an IP address.
**does not have an IP address.
*'''Sw0p3''':
*'''Sw0p3''':
**external port interface connected to ETH1 port,
**external port interface connected to ETH1 port,
**will not have an IP address.
**does not have an IP address.
*'''Sw0ep''':
*'''Sw0ep''':
**« endpoint » interface,
**« endpoint » interface,
Line 107: Line 107:
<references />
<references />
<noinclude>
<noinclude>
{{ReviewsComments|-- [[User:Roullier Christophe|Roullier Christophe]] ([[User talk:Roullier Christophe|talk]]) 10:51, 1 December 2023 (CET)<br />{{ToBeReviewedByTW}}}}
{{PublicationRequestId | 33590 | 2025-01-10 | }}
 
[[Category:Ethernet]]
[[Category:Ethernet]]
</noinclude>
</noinclude>

Latest revision as of 11:03, 14 April 2025

Applicable for STM32MP25x lines


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 the startup of the board. Through this article, the different steps, processed by the Ethernet switch package, are introduced, the user can then adapt to his own purpose.

2. Prerequisites[edit | edit source]

This article necessarily needs and assumes that the X-LINUX-TSNSWCH expansion package is installed on top of a OpenSTLinux distribution.

3. Ethernet switch configuration[edit | edit source]

The order of initialization in process of loading and initializing sequence is:

  1. GMAC ETH1 driver
  2. Stm32-deip glue
  3. edge-lkml
  4. 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 More info green.png, 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, the internal port of switch is connected on end1 interface:

3.1. Ethernet switch interface[edit | edit source]

Alternate text
Ethernet switch interfaces

All available interfaces can be listed using ifconfig command:

  • end0:
    • standalone GMAC interface.
  • end1:
    • software interface for ETH1 GMAC,
    • does not have an IP address.
  • Sw0p1:
    • internal port interface,
    • does not have an IP address.
  • Sw0p2:
    • external port interface connected to ETH3 port,
    • does not have an IP address.
  • Sw0p3:
    • external port interface connected to ETH1 port,
    • does not have an IP address.
  • Sw0ep:
    • « endpoint » interface,
    • used to communicate to/from the STM32MP2 series' boards More info green.png through external ports.

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
Warning white.png Warning
Phy address has to be updated for customer's PHY


  • 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
Warning white.png Warning
Values can be found in the customer's PHY datasheet
Warning white.png Warning
100 Mbps values are currently missing
  • 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]