This article gives information about the TTTech ® Ethernet Switch, provides its composition and explains how to configure and use it.
1. Framework purpose[edit | edit source]
An Ethernet switch is a Hardware device that connects devices on a local area network (LAN) and forwards data packets between them. It operates at the data link layer (layer 2) of the OSI model and uses MAC addresses to determine the destination of each packet. Ethernet switches can improve network performance by reducing collisions and congestion, and they can also provide security features such as VLANs and port-based access control. Ethernet switches are more efficient in terms of CPU usage than Ethernet bridges. As hardware Ethernet switch is responsible of data forwarding, filtering, and prioritization, it reduces the workload on the CPU. As a result, the CPU can focus on other tasks, leading to improved network performance.
Ethernet Switch can be used in many different use cases, as mentioned in How to use Ethernet Switch section.
2. System overview[edit | edit source]
2.1. Component description[edit | edit source]
From User space to hardware
- Application (User space)
- There are a lot of applications using Ethernet: Internet Browser, Streaming applications, FTP applications etc..
- The main interface that is used between an application and the Networking protocols is a socket [1]
- Ethernet tools (User space)
- A set of utilities is available to manage and maintain networks: ethtool, ping, route, ifconfig etc..
- Linux Socket Layer and Networking Protocols (Kernel space)
- The socket layer [2] is a uniform interface
- between the user process and the network protocol [3] stacks within the :kernel
- Linux Networking Core (Kernel space)
- The kernel network layer adapts the message with the transport protocol in use. The network subsystem of the Linux kernel is designed to be :completely protocol independent.
- GMAC Driver (Stmmac) (Kernel space)
- This is the driver for the MAC 10/100/1000 on-chip Ethernet controllers (Synopsys IP blocks).
- Documentation/networking/stmmac.txt[4]
- STM32 dwmac glue (Kernel space)
- This is the driver to configure RCC clocks and Sysconfig regarding board configuration.
- Documentation/networking/stmmac.txt[5]
- ETH Switch (Hardware)
- This is the Ethernet Switch IP: Copyright TTTech Industrial Automation AG, 2021.
- Switch is composed of 2 parts, DeIP and ACM blocks
- DeIP:
- - Time synchronization (IEEE 802.1AS)
- IEEE 1588v2 profile for the synchronization of clocks in the network.
- Supports timing requirements for scheduled TSN networks
- - Forwarding and queuing enhancements for time-sensitive streams (IEEE802.1Qav)
- Time-Sensitive Streams defines traffic shaping using priority classes, which is based
- on a simple form of "leaky bucket" credit-based fair queuing.
- 802.1Qav is designed to reduce buffering in receiving bridges and endpoints.
- - Time-aware scheduler for scheduled traffic (IEEE802.1Qbv)
- Provides guaranteed communication latency for time-critical traffic over standard Ethernet
- - Frame preemption (IEEE 802.1Qbu)
- Allows for optimal bandwidth utilization of non-scheduled background traffic sent
- in parallel with scheduled traffic
- - Redundancy (frame replication and elimination for reliability) (IEEE 802.1 CB)
- - Time synchronization (IEEE 802.1AS)
- ACM:
- - Acceleration Module IP (ACM IP) provides ultra-low latency cut-through between two external ports together with
- a frame processing on the fly (extraction and insertion of data). In normal use-case, ACM IP is used together with
- a TSN Ethernet Switch
- STM32 deip glue (Kernel space)
- This is the driver to configure RCC clocks and Sysconfig when switch is used.
- Switch driver (edge-lkm) (Kernel space)
- This is the driver to control switch (DeIP) and TSN application.
- ACM driver (Kernel space)
- This is the driver to control switch registers for ACM application.
- GMACx (Hardware)
- This is the Ethernet IP: GMAC [6]
- xMII portx (Hardware)
- The Ethernet PHY is connected to a media access controller (MAC). The MAC controls the data-link-layer portion of the OSI model.
- The media-independent interface (MII) defines the interface between the MAC and the PHY.
- Variations of the MII are available (RGMII, GMII, RMII, MII) that provide minimal pin count and varied data rates depending on system :requirements.
- The MDIO bus includes two signals:
- - MDC clock: driven by the MAC device to the PHY.
- - MDIO data: bidirectional, it is driven by the PHY to provide register data at the end of a read operation.
- The connector used by Ethernet phy is RJ45.
- ETH Switch configuration only support RGMII and RMII mode.
2.2. API description[edit | edit source]
The Ethernet API is documented in the Linux Kernel[7].
3. Configuration[edit | edit source]
3.1. Kernel configuration[edit | edit source]
The Ethernet API is activated by default in ST deliveries. Nevertheless, if a specific configuration is required, one can use Linux Menuconfig tool: Menuconfig or how to configure kernel and select:
For Network features:
Enable following configs in kernel when using Linux traffic control (tc):
Symbol: NET_SCH_MQPRIO [=y] && NET_SCH_CBS [=y] && NET_SCH_TAPRIO [=y]
[*] Networking support --->
Networking options --->
[*] QoS and/or fair queueing --->
<*> Credit Based Shaper (CBS)
<*> Time Aware Priority (taprio) Scheduler
<*> Multi-queue priority scheduler (MQPRIO)
[*] Actions --->
<*> Traffic Policing
<*> Generic actions
<*> Redirecting and Mirroring
<*> SKB Editing
<*> Vlan manipulation
<*> Frame gate entry list control tc action
3.2. Device tree configuration[edit | edit source]
DT bindings documentation deals with all required or optional device tree properties.
Detailed DT configuration for STM32 internal peripherals: Ethernet switch device tree configuration.
4. How to use Ethernet Switch[edit | edit source]
4.1. How to use the Ethernet Switch user space interface[edit | edit source]
Please see examples based on the following use cases:
- How to configure Ethernet switch: How to configure switch
- How to configure TSN switch: How to configure TSN switch
5. How to trace and debug the framework[edit | edit source]
5.1. How to monitor[edit | edit source]
5.1.1. How to monitor PTP[edit | edit source]
deptp_tool can be used to have status of gPTP negotiation.
deptp_tool -t1 --get-port-dataset && deptp_tool -t2 --get-port-dataset source-clock-id 0a:8b:36:ff:fe:89:ef:01 source-port-num 1 clock-id 0a:8b:36:ff:fe:89:ef:01 port-num 1 port-state listening log-announce-interval 0 log-sync-interval -3 log-min-delay-req-interval 0 announce-receipt-timeout 3 version-number 18 delay-mechanism p2p log-min-pdelay-req-interval 0 peer-mean-path-delay-scaled 0 peer-mean-path-delay 0.000000 peer-mean-path-delay-ns 0 success source-clock-id 0a:8b:36:ff:fe:89:ef:01 source-port-num 2 clock-id 0a:8b:36:ff:fe:89:ef:01 port-num 2 port-state listening log-announce-interval 0 log-sync-interval -3 log-min-delay-req-interval 0 announce-receipt-timeout 3 version-number 18 delay-mechanism p2p log-min-pdelay-req-interval 0 peer-mean-path-delay-scaled 0 peer-mean-path-delay 0.000000 peer-mean-path-delay-ns 0 success
6. Source code location[edit | edit source]
The source files are located inside the Linux kernel.
- Ethernet driver: dwmac-stm32.c[8]
- STM32 deip glue: stm32_deip.c Available in module from Yocto TSN Image [9]
- Switch driver (edge-lkm): edge*.c Available in module from Yocto TSN Image [10]
- ACM driver: main.c Available in module from Yocto TSN Image [11]
7. References[edit | edit source]
- ↑ [1], Berkeley sockets
- ↑ [2], Socket Layer
- ↑ [3], Internet Protocol
- ↑ https://www.kernel.org/doc/Documentation/networking/stmmac.txt, More information
- ↑ https://www.kernel.org/doc/Documentation/devicetree/bindings/net/stm32-dwmac.yaml, More information
- ↑ [4], DesignWare Ethernet GMAC IP
- ↑ Linux Networking and Network Devices APIs
- ↑ [5],dwmac-stm32.c
- ↑ [meta-st-stm32mp-tsn-swch/st.stm32-deip/stm32_deip.c
- ↑ [meta-st-stm32mp-tsn-swch/tsn_sw_base.edge-lkm
- ↑ [meta-st-stm32mp-tsn-acm/ngn.ngn-dd/acm/main.c
}}