📜 ⬆️ ⬇️

Introduction to the capabilities of the Realtek RTL 8332M switch processor



We are continuing a series of publications about Taiwanese company Realtek electronic components that can be used to develop multimedia and network electronics.

The other day at our disposal was a demo board of a multiport switch RTL_8332M_DDR3_DEMO_P2L_V1.0 based on the Realtek 8332M switch processor, as well as a proprietary set of development tools. Under the cat, we will describe what this board is, describe the process of assembling and downloading the firmware based on the Realtek SDK, and also test the throughput of the resulting switch with the QoS health check.

The demo board is designed to develop and debug software for a managed multiport switch with 24 Fast Ethernet ports and 4 Gigabit Ethernet ports. The basis of the used switch processors is CPU MIPS-4KEc 32bit @ 500MHz, they allow you to manage all the functions of the switch.
')
Perhaps the reader will have a question: why in our time, “when space ships travel through the universe” may require the development of a Fast Ethernet switch. In our opinion, this low-cost solution may be required in systems where high data transfer rates are not required. For example, connecting IP-telephony and surveillance cameras.

First, let's give a brief description of the switch processor:

The chip provides the basic functions of the switch.
L2 VLAN functionality

Maximum number of VLANs 4096
Supports up to 64 independent processes for MSTP (IEEE 802.1s), RSTP and STP
Tagging Q-in-Q and VLAN

L2 MAC Function

Network packet length up to 10 KB
8K L2 MAC Address Table
Table for 512 multicast addresses
Supports IGMPv1 / 2/3 and MLDv1 / 2 snooping

Other L2 Functionality

Control traffic broadcast, multicast, unknown-multicast and unknown-unicast
Traffic mirroring support
Channel Aggregation Support (IEEE 802.3ad)
Support loopback recognition and isolation (RLPP / RLDP)

Access Control List Functionality (ACL)

L2 / L3 / L4 format support (DMAC, SMAC and Ether-Type)
IPv6 ACL

QoS features

8 queues per port
Processing queues using Strict Priority (SP), Weighted Fair Queue (WFQ) and Weighted Round Robin (WRR) algorithms



RTL_8332M_DDR3_DEMO_P2L_V1.0 delivery set


The fee includes:

Block diagram of the device:



The photo below shows the side view of the board, it clearly shows the ports:



The development tools we received include a toolchain, a Linux source and u-boot SDK, as well as some documentation.

Build firmware from Realtek SDK


We unpack the toolchain and immediately set the paths to it in the PATH so that bash knows where to find it:
$ tar -zxf 01_toolchain/linux/v2.6.32.58/msdk-4.3.6-mips-EB-2.6.32-0.9.30.3-m32-120424.tar.bz2 $ export PATH=$PATH:<project dir>/msdk-4.3.6-mips-EB-2.6.32-0.9.30.3-m32-120424/bin/ 

Unpack the SDK, as well as the u-boot and uClinux sources:
  $ cd 02_SDK/V2.1.2.41872/Package $ tar zxf rtk-ms-sdk-src-2.1.2.41872.tar.gz $ tar zxf rtk-ms-uboot-2011.12-src-svn41872.tar.gz $ tar zxf rtk-ms-uboot-src-1.3.0.41872.tar.gz $ tar zxf rtk-ms-uClinux-src-2.6.19-2.6.32.58-svn41872.tar.gz 

Select the version of linux and uClibc:
The SDK had 2 versions of the Linux kernel - 2.6.19 and 2.6.32.58. With the kernel version 2.6.19, uClibc 0.9.28 is used, and with version 2.6.32.58 - uClibc 0.9.30. We used the latest version.
  $ make menuconfig 



With the kernel version 2.6.19, uClibc 0.9.28 is used, and with version 2.6.32.58 - uClibc 0.9.30.

In the SDK settings, we include support for the 8332M switch processor:
  $ make sdkconfig 

In the Chip Support and SDK Driver options, specify the chip 8380:



In the kernel menuconfig, you need to change the boot parameters to "debug console = ttyS0,115200 mem = 128M", because we use a chip with 128M memory:

  $ make -C kernel/uClinux/linux-2.6.32.x menuconfig 



Build (build succeeds only with root rights, so you need to export the above paths also to PATH root):
  # export PATH=$PATH:<project dir>/msdk-4.3.6-mips-EB-2.6.32-0.9.30.3-m32-120424/bin/ # make 

During the build, in spite of the configuration carried out in the menuconfig, a couple of questions on setting up the RTK BSP are poured into the console. Specify the chip 8380:
 * * Restart config... * * * RTK Universal BSP selection * Realtek RTL8390/50 Board (RTL8390_SERIES) [N/y/?] (NEW) n Realtek RTL8380/30 Board (RTL8380_SERIES) [N/y/?] (NEW) y Realtek RTL8328 Board (RTL8328_SERIES) [N/y/?] (NEW) n 

If everything worked, information about the collected image is displayed on the screen, the build results are put into image /:
 Image Name: 3.0.0.beta Created: Fri Mar 13 15:06:27 2015 Image Type: MIPS Linux Kernel Image (gzip compressed) Data Size: 2787086 Bytes = 2721.76 kB = 2.66 MB Load Address: 80000000 Entry Point: 80003a70 

Loading the assembled kernel


1) A tftp server must be installed on the host. Installation and configuration for example under Ubuntu is described here: http://askubuntu.com/questions/201505/how-do-i-install-and-run-a-tftp-server .

2) In the folder shared via tftp, drop the assembled kernel image:
 # cp images/vmlinux.bix /tftpboot 

3) Connect to the board via UART, the settings for minicom are as follows:
 A - Serial Device : /dev/ttyUSB0 B - Lockfile Location : /var/lock C - Callin Program : D - Callout Program : E – Bps/Par/Bits : 115200 8N1 F - Hardware Flow Control : No G - Software Flow Control : No 

4) The u-boot is loaded on the board, you need to load the assembled kernel from it via tftp:
 Hit any key to stop autoboot: 0 RTL838x# # RTL838x# # setnenv ipaddr 192.168.1.1 ← IP  RTL838x# # setenv serverip 192.168.1.111 ← IP  RTL838x# # rtk network on RTL838x# # tftp 0x81000000 vmlinux.bix RTL838x# # bootm 0x81000000 

After loading Linux, we launch DiagShell - the command line interface to manage the switch settings.
We include the necessary ports (or all) in it:
  # diag RTK.0> port set port all state enable 

The firmware is running, the switch is working.

Speed ​​testing


We carried out speed measurements by connecting 2 PCs to the board using the iperf program in two modes, LAN and VLAN connection of the switch.

Via DiagShell, the VLAN was configured as follows (for example, the setting for ports 25, 26, 27 and vlan id = 20):
 RTK.0> vlan create vlan-table vid 20 RTK.0> vlan set pvid inner port 25-27 20 RTK.0> vlan set vlan-table vid 20 member 25-27 RTK.0> vlan set vlan-table vid 20 untag-port 25-27 

When testing a VLAN, there is an interesting effect: if the VLAN is configured for a port range that includes 100M and 1000M ports, then the speed will be limited to 100 Mbps, even if both PCs are connected to gigabit ports.

These are the test results:
PortTest modeMeasured Speed ​​(Mbps)
100MLAN96.2
1000MLAN936
100MVLAN95.7
1000MVLAN936

We can say that the bandwidth corresponds to the stated.

Now we will try to configure QoS. This feature is very useful when setting up office IP-telephony.

As we already said, the switch supports two queue processing algorithms: Strict Priority and WFQ.
We limited ourselves to checking Strict Priority. For testing, three PCs were connected to the board. On one of the PCs launched iperf-server:
 $ iperf –s 

On the other two PCs, clients are:
 $ iperf -c server_ip -i 1 -t 300 

At the same time, on one of the clients, the value DS in the IP packets in the DS field was set to 0x20 (DSCP 0x8), using the not very documented option -S:
 $ iperf -c server_ip -i 1 -t 300 –S 0x20 

The results of the bandwidth measurements showed that the traffic was distributed approximately equally.
Now we will try to configure QoS. To do this, set the maximum priority value (7) for DSCP 0x8.
 RTK.0> qos set remapping dscp system dscp 8 internal-priority 7 

As a result, tagged traffic took up all the bandwidth. Well, it looks like QoS really works.

Add a few words about DiagShell. In our opinion, this CLI is quite functional and may well be used in the development of the finished device. Of course, ideally, I would like to have some intuitive web interface, which is currently not available in the SDK. For the final device will have to develop.

In general, we can say that as a result we received a test board of a multiport switch with the possibility of software development. Such a hardware and software platform can be used to develop low-cost managed Fast Ethernet switches for connecting to the core network via Gigabit Ethernet ports.

Thanks for attention!

Another good article on this topic is Launching Linux on the Realtek RTL-1185 media processor .

Source: https://habr.com/ru/post/254781/


All Articles