Registered User |
Registered User mNo edit summary Tag: 2017 source edit |
||
(8 intermediate revisions by 4 users not shown) | |||
Line 4: | Line 4: | ||
}} | }} | ||
</noinclude> | </noinclude> | ||
== Article purpose == | == Article purpose == | ||
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 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 == | |||
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 13: | Line 19: | ||
# Stm32-deip glue | # Stm32-deip glue | ||
# edge-lkml | # edge-lkml | ||
# ACM (if | # 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 {{Board | type=MP2}}, in directories: | The files, describing the process of detecting and initializing hardware devices during system boot-up, are located, on {{Board | type=MP2}}, in directories: | ||
* /etc/modprobe.d/edgx_sw_modprobe.conf | * /etc/modprobe.d/edgx_sw_modprobe.conf | ||
* /etc/modprobe.d/acm_modprobe.conf (if ACM | * /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: | 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 | * /etc/modprobe.d/edgx_sw_core.conf | ||
{{Board$}}cat /etc/modprobe.d/edgx_sw_core.conf | {{Board$}}cat /etc/modprobe.d/edgx_sw_core.conf | ||
Here internal port of switch is connected on end1 interface | options edgx_pfm_lkm netif="end1:0" | ||
Here, the internal port of switch is connected on end1 interface: | |||
=== Ethernet switch interface === | === Ethernet switch interface === | ||
[[File:switch_interfaces.png|thumb|center|766px|link=|alt=Alternate text|Ethernet switch interfaces]] | [[File:switch_interfaces.png|thumb|center|766px|link=|alt=Alternate text|Ethernet switch interfaces]] | ||
All available interfaces can be listed using ''ifconfig''command: | All available interfaces can be listed using ''ifconfig'' command: | ||
*'''end0''': | *'''end0''': | ||
**standalone GMAC interface. | **standalone GMAC interface. | ||
*'''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 48: | Line 55: | ||
Those interfaces are set during boot thanks to this script: | Those interfaces are set during boot thanks to this script: | ||
* /usr/sbin/ttt-ip-init-systemd.sh | * [https://github.com/STMicroelectronics/meta-st-stm32mp-tsn-swch/blob/mickledore/recipes-ttt-rootfs/init/files/ttt-ip-init-systemd.sh /usr/sbin/ttt-ip-init-systemd.sh] | ||
This script is launch thanks to service systemd: | This script is launch thanks to service systemd: | ||
{{Board$}}cat lib/systemd/system/st-tsn.service | {{Board$}}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 | |||
==== More details about /usr/sbin/ttt-ip-init-systemd.sh ==== | ==== More details about /usr/sbin/ttt-ip-init-systemd.sh ==== | ||
Line 70: | Line 78: | ||
* Configure '''MSTP''' (through « mstpctl »): Used for spanning tree management (to avoid loop in a network) | * Configure '''MSTP''' (through « mstpctl »): Used for spanning tree management (to avoid loop in a network) | ||
'''PHY configuration:''' | '''PHY configuration:''' | ||
* Affect PHY to the | * 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:'''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 | echo -n stmmac-1:'''04''' > /sys/devices/platform/soc/$IP_REF_NAME/net/'''sw0p2'''/phy/mdiobus | ||
Line 92: | Line 100: | ||
* '''Configure IP address''' by default for sw0ep interface:{{Highlight| ip addr add '''192.168.0.10''' dev sw0ep}} | * '''Configure IP address''' by default for sw0ep interface:{{Highlight| ip addr add '''192.168.0.10''' dev sw0ep}} | ||
<br>''Do not hesitate to open this script by yourself, it contains all the necessary commentaries to understand each step of the configuration.''<br/> | |||
==References== | ==References== | ||
Line 97: | 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]