Registered User mNo edit summary Tag: 2017 source edit |
Registered User mNo edit summary Tag: 2017 source edit |
||
(2 intermediate revisions by 2 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, | 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 | 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, | ||
** | **does not have an IP address. | ||
*'''Sw0p1''': | *'''Sw0p1''': | ||
**internal port interface, | **internal port interface, | ||
** | **does not have an IP address. | ||
*'''Sw0p2''': | *'''Sw0p2''': | ||
**external port interface connected to ETH3 port, | **external port interface connected to ETH3 port, | ||
** | **does not have an IP address. | ||
*'''Sw0p3''': | *'''Sw0p3''': | ||
**external port interface connected to ETH1 port, | **external port interface connected to ETH1 port, | ||
** | **does not have an IP address. | ||
*'''Sw0ep''': | *'''Sw0ep''': | ||
**« endpoint » interface, | **« endpoint » interface, | ||
Line 107: | Line 107: | ||
<references /> | <references /> | ||
<noinclude> | <noinclude> | ||
{{ | {{PublicationRequestId | 33590 | 2025-01-10 | }} | ||
[[Category:Ethernet]] | [[Category:Ethernet]] | ||
</noinclude> | </noinclude> |
Latest revision as of 11:03, 14 April 2025
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:
- 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, the 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,
- 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:
Those interfaces are set during boot thanks to this script:
This script is launch thanks to service systemd:
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.targetcat lib/systemd/system/st-tsn.service [Unit] Description=
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]