The LS1021A-TSN device tree (arch/arm/boot/dts/ls1021a-tsn.dts) defines the sja1105 port names as swp2, swp3, swp4 and
swp5. The numbers have a direct correspondence with the chassis labels ETH2, ETH3, ETH4 and ETH5. The ETH2 chassis
label (represented in Linux by the swp2 net device) should not be confused with the eth2 net device, which represents the
LS1021A host port for this switch (called DSA master).
On the LS1021A-TSN board, network management is done by the systemd-networkd daemon, whose configuration files are
located in /etc/systemd/network/. On this board, the following configuration files for systemd-networkd are present by default:
• br0.netdev: Creates a bridge net device with VLAN filtering disabled, STP disabled and MVRP disabled
• br0.network: Configures the net devices enslaved to br0 to request an IPv4 address via DHCP
• eth0.network, eth1.network, swp.network: Configures all 6 ports of the LS1021A-TSN board to be part of the same br0 bridge
(4 ports are bridged in hardware, 2 ports are bridged in software)
• eth2.network: Configures the DSA master port to come up automatically, and assigns it a dummy link-local IP address. Having
the DSA master interface up is a requirement for using the switch net devices.
Although all ports are configured for L2 forwarding by default (and therefore the only IP address for this board should be assigned
to br0), this can be changed by removing the "Bridge=br0" line from the files in /etc/systemd/network/ and then running "systemctl
restart systemd-networkd".
In standalone mode, each SJA1105 port is able of acquiring an IP address and transferring general purpose packets to/from the
kernel. This is internally supported by the kernel driver by repurposing the VLAN tagging functionality for switch port separation
and identification. Therefore the ability to support general purpose traffic I/O only works as long as the user does not request
VLAN tagging, via the bridge vlan_filtering option. When this happens, the switch driver goes to a reduced functionality mode,
where the swpN net devices are no longer capable of sending and receiving general packets to/from the kernel. This is a hardware
limitation which can be somewhat mitigated by enabling the best_effort_vlan_filtering devlink parameter (by following the steps
in the kernel documentation).
Actually there is a second mechanism of frame tagging, which works for STP and PTP traffic and does not rely on VLAN tagging.
Therefore, the STP and PTP protocols remain operational on the sja1105 driver even when the ports are enslaved to a bridge
with vlan_filtering=1.
When VLAN awareness is disabled, the sja1105 ports perform no checks on VLAN port membership or PCP, and performs no
alteration to the VLAN tags. For these operations, the following command is necessary:
ip link set dev br0 type bridge vlan_filtering 1
Once VLAN filtering is enabled, the VLAN table of each switch port can be inspected and modified using the "bridge vlan"
commands from the iproute2 package.
The STP state machine can be started on the bridge using the following command:
ip link set dev br0 type bridge stp_state 1
ip link set dev br0 down
ip link set dev br0 up
The switch L2 address forwarding database (FDB) can be inspected and modified using the "bridge fdb" set of commands.
Port statistics counters can be inspected using the ethtool -S swpN command.
The sja1105 port MTU can be configured up to a maximum of 2021 using the following command:
ip link set dev swp2 mtu 2000
Port mirroring on a sja1105 port (mirroring of ingress and/or egress packets) can be configured via the following set of commands:
tc qdisc add dev swp2 clsact
tc filter add dev swp2 ingress matchall skip_sw \
action mirred egress mirror dev swp3
NXP Semiconductors
TSN
Open Industrial User Guide, Rev. 1.8, 05/2020
User's Guide
132 / 199