4.4. RSTP

This is a simple demonstration example to setup a RSTP network which is a mode of the mstpd daemon that is provided in the Processors Linux SDK file system. This example setup is done from the Linux command line. Users that require automatic interface, bridge and msptd daemon setup at system initialization will need to do the steps necessary to implement this initialization method.


If you need a background in the bridge utility that Linux supports please refer to this link.

https://wiki.linuxfoundation.org/networking/bridge


The link above documents the kernel brctl utility that creates network bridges and the spanning tree protocol (STP) support provided by the kernel. To go beyond STP requires a user level daemon that will manage the tree topology and changes to that topology. The pre-built kernel binaries and file system do not require changes to use the mstpd daemon. RSTP mode of the mstpd daemon was tested on TI EVMs that have multiple CPSW or PRU ports. Multi-port boards will have dual mac mode enabled for the CPSW as out of the box configurations for TI EVMs. There are additional PRU-ICSS Ethernet ports available on the AM57x class IDK boards. This diagram shows one of the topologies used to test the setup.

../_images/Cpsw_rstp_mstpd_topology_1.jpg

3 node ring demonstrating port blocking on low cost link


Please note that the topology was tested across CPSW only ports, PRU-ICSS Ethernet only ports and a one CPSW and one PRU-ICSS port.


To set up the environment shown above, first on each board bring up the interfaces that will be used for the bridge with the ifconfig command. Next on each board a bridge must be created and then add in the two interfaces to the bridge. The bridge is then enabled in STP mode. Then as a last configuration step use the mstpctl utility to transition the bridge from STP to RSTP mode.

Setup the ports, IP addresses are not used for the Ethernet ports in a bridge.


ifconfig eth0 up

ifconfig eth1 up


Now create and setup bridge br0 using the brctl application.

brctl create br0

brctl addif br0 eth0

brctl addif br0 eth1

ifconfig br0 up


Now switch the bridge mode from stp to rstp using the mstpctl application

mstpctl setforcevers br0 rstp

Now look on each platform to verify where the root node is with these commands

mstpctl showbridge


4.4.1. RSTP with ICSS Switch Firmware

With ICSS switch firmware, RSTP can be supported with L2 forwarding offload on the ICSSs in AM57x IDK platforms.

Briefly, in this case, the PRU ethernet driver together with the switch firmware are responsible for creating a forwarding database (FDB) table. MAC address in a frame received on a physical port is learned dynamically and a corresponding entry is created in the FDB table. When frames with a learned MAC address as the destination address is received, it will be cut-through forwarded to the port indicated in the FDB entry directly without involving the host.

To set up a RSTP network with ICSS switch firmware, connect 3 AM571x-IDK as follows:

../_images/rstp_with_switch_firmware.jpg
Example: 3 node ring demonstrating RSTP with switch firmware

Boot up the IDKs as follows:

  1. Boot into uboot prompt.
  2. Modify args_mmc as follows:

=> setenv args_mmc ‘run finduuid;setenv bootargs console=${console} ${optargs} root=PARTUUID=${uuid} rw rootfstype=${mmcrootfstype} ti_prueth.pruss1_ethtype=3 ti_prueth.pruss2_ethtype=3’

=> saveenv

  1. Boot IDKs into linux prompt.
  2. Make sure the following lines appear in the boot log:
[   30.617491] prueth pruss1_eth: TI PRU ethernet (type 3) driver initialized
[   31.207474] prueth pruss2_eth: TI PRU ethernet (type 3) driver initialized

Note: timing is for reference only.

  1. Run the following script rstp.sh on each IDK.
#!/bin/bash
# rstp.sh

echo "mstpd"
mstpd
sleep 1

echo "ifconfig eth2 up"
ifconfig eth2 up
sleep 1

echo "ifconfig eth3 up"
ifconfig eth3 up
sleep 1

echo "brctl addbr br0"
brctl addbr br0
sleep 1

echo "brctl addif br0 eth2"
brctl addif br0 eth2
sleep 1
echo "brctl addif br0 eth3"
brctl addif br0 eth3
sleep 1

echo "brctl stp br0 on"
brctl stp br0 on
sleep 1

echo "mstpctl setforcevers br0 rstp"
mstpctl setforcevers br0 rstp
sleep 1

echo "ifconfig br0 up"
ifconfig br0 up
sleep 1

echo "mstpctl showbridge"
mstpctl showbridge

The script

  1. starts mstpd daemon
  2. crates a bridge interface br0 on eth2 and eth3
  3. enables rstp on the bridge br0
  4. shows some information about the bridge
  1. Issue command to show port information on each IDK:
$ mstpctl showport br0 eth2
$ mstpctl showport br0 eth3

sample output:

eth2  8.001 forw 8.000.70:FF:76:1C:16:EF 8.000.70:FF:76:1C:16:EF 8.001 Desg

where

forw is the port state

Desg is the port role

Note 1: In the test setup shown above , the port state and port role are shown in (state, role), eg. (f,R) - port state is forwarding and port role is Root.

Note 2: The (state, role) pairs may show on different DUTs but there must be a discard state appears. This discard state is a result of the RSTP protocol which breaks the cyclic connection into a tree (in this case, a serial connection.

  1. In step 6, make sure the cyclic connection is broken by a discard state in one of the ports of one of the DUTs.

    In setup in step 1, it is Dut2.eth2.

  2. configure an IP address on br0 on any one DUT and another IP address of the same subnet on another DUT. E.g.

    on Dut1: $ ifconfig br0 192.168.2.72

    on Dut3: $ ifconfig br0 192.168.2.71

  3. Make sure ping works fron Dut1 to Dut3.

  4. Unplug any of the 3 cables and make sure the ping continues to work each time.