162306a36Sopenharmony_ci.. SPDX-License-Identifier: GPL-2.0 262306a36Sopenharmony_ci 362306a36Sopenharmony_ci========================================== 462306a36Sopenharmony_ciBroadcom RoboSwitch Ethernet switch driver 562306a36Sopenharmony_ci========================================== 662306a36Sopenharmony_ci 762306a36Sopenharmony_ciThe Broadcom RoboSwitch Ethernet switch family is used in quite a range of 862306a36Sopenharmony_cixDSL router, cable modems and other multimedia devices. 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ciThe actual implementation supports the devices BCM5325E, BCM5365, BCM539x, 1162306a36Sopenharmony_ciBCM53115 and BCM53125 as well as BCM63XX. 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ciImplementation details 1462306a36Sopenharmony_ci====================== 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_ciThe driver is located in ``drivers/net/dsa/b53/`` and is implemented as a 1762306a36Sopenharmony_ciDSA driver; see ``Documentation/networking/dsa/dsa.rst`` for details on the 1862306a36Sopenharmony_cisubsystem and what it provides. 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_ciThe switch is, if possible, configured to enable a Broadcom specific 4-bytes 2162306a36Sopenharmony_ciswitch tag which gets inserted by the switch for every packet forwarded to the 2262306a36Sopenharmony_ciCPU interface, conversely, the CPU network interface should insert a similar 2362306a36Sopenharmony_citag for packets entering the CPU port. The tag format is described in 2462306a36Sopenharmony_ci``net/dsa/tag_brcm.c``. 2562306a36Sopenharmony_ci 2662306a36Sopenharmony_ciThe configuration of the device depends on whether or not tagging is 2762306a36Sopenharmony_cisupported. 2862306a36Sopenharmony_ci 2962306a36Sopenharmony_ciThe interface names and example network configuration are used according the 3062306a36Sopenharmony_ciconfiguration described in the :ref:`dsa-config-showcases`. 3162306a36Sopenharmony_ci 3262306a36Sopenharmony_ciConfiguration with tagging support 3362306a36Sopenharmony_ci---------------------------------- 3462306a36Sopenharmony_ci 3562306a36Sopenharmony_ciThe tagging based configuration is desired. It is not specific to the b53 3662306a36Sopenharmony_ciDSA driver and will work like all DSA drivers which supports tagging. 3762306a36Sopenharmony_ci 3862306a36Sopenharmony_ciSee :ref:`dsa-tagged-configuration`. 3962306a36Sopenharmony_ci 4062306a36Sopenharmony_ciConfiguration without tagging support 4162306a36Sopenharmony_ci------------------------------------- 4262306a36Sopenharmony_ci 4362306a36Sopenharmony_ciOlder models (5325, 5365) support a different tag format that is not supported 4462306a36Sopenharmony_ciyet. 539x and 531x5 require managed mode and some special handling, which is 4562306a36Sopenharmony_cialso not yet supported. The tagging support is disabled in these cases and the 4662306a36Sopenharmony_ciswitch need a different configuration. 4762306a36Sopenharmony_ci 4862306a36Sopenharmony_ciThe configuration slightly differ from the :ref:`dsa-vlan-configuration`. 4962306a36Sopenharmony_ci 5062306a36Sopenharmony_ciThe b53 tags the CPU port in all VLANs, since otherwise any PVID untagged 5162306a36Sopenharmony_ciVLAN programming would basically change the CPU port's default PVID and make 5262306a36Sopenharmony_ciit untagged, undesirable. 5362306a36Sopenharmony_ci 5462306a36Sopenharmony_ciIn difference to the configuration described in :ref:`dsa-vlan-configuration` 5562306a36Sopenharmony_cithe default VLAN 1 has to be removed from the slave interface configuration in 5662306a36Sopenharmony_cisingle port and gateway configuration, while there is no need to add an extra 5762306a36Sopenharmony_ciVLAN configuration in the bridge showcase. 5862306a36Sopenharmony_ci 5962306a36Sopenharmony_cisingle port 6062306a36Sopenharmony_ci~~~~~~~~~~~ 6162306a36Sopenharmony_ciThe configuration can only be set up via VLAN tagging and bridge setup. 6262306a36Sopenharmony_ciBy default packages are tagged with vid 1: 6362306a36Sopenharmony_ci 6462306a36Sopenharmony_ci.. code-block:: sh 6562306a36Sopenharmony_ci 6662306a36Sopenharmony_ci # tag traffic on CPU port 6762306a36Sopenharmony_ci ip link add link eth0 name eth0.1 type vlan id 1 6862306a36Sopenharmony_ci ip link add link eth0 name eth0.2 type vlan id 2 6962306a36Sopenharmony_ci ip link add link eth0 name eth0.3 type vlan id 3 7062306a36Sopenharmony_ci 7162306a36Sopenharmony_ci # The master interface needs to be brought up before the slave ports. 7262306a36Sopenharmony_ci ip link set eth0 up 7362306a36Sopenharmony_ci ip link set eth0.1 up 7462306a36Sopenharmony_ci ip link set eth0.2 up 7562306a36Sopenharmony_ci ip link set eth0.3 up 7662306a36Sopenharmony_ci 7762306a36Sopenharmony_ci # bring up the slave interfaces 7862306a36Sopenharmony_ci ip link set wan up 7962306a36Sopenharmony_ci ip link set lan1 up 8062306a36Sopenharmony_ci ip link set lan2 up 8162306a36Sopenharmony_ci 8262306a36Sopenharmony_ci # create bridge 8362306a36Sopenharmony_ci ip link add name br0 type bridge 8462306a36Sopenharmony_ci 8562306a36Sopenharmony_ci # activate VLAN filtering 8662306a36Sopenharmony_ci ip link set dev br0 type bridge vlan_filtering 1 8762306a36Sopenharmony_ci 8862306a36Sopenharmony_ci # add ports to bridges 8962306a36Sopenharmony_ci ip link set dev wan master br0 9062306a36Sopenharmony_ci ip link set dev lan1 master br0 9162306a36Sopenharmony_ci ip link set dev lan2 master br0 9262306a36Sopenharmony_ci 9362306a36Sopenharmony_ci # tag traffic on ports 9462306a36Sopenharmony_ci bridge vlan add dev lan1 vid 2 pvid untagged 9562306a36Sopenharmony_ci bridge vlan del dev lan1 vid 1 9662306a36Sopenharmony_ci bridge vlan add dev lan2 vid 3 pvid untagged 9762306a36Sopenharmony_ci bridge vlan del dev lan2 vid 1 9862306a36Sopenharmony_ci 9962306a36Sopenharmony_ci # configure the VLANs 10062306a36Sopenharmony_ci ip addr add 192.0.2.1/30 dev eth0.1 10162306a36Sopenharmony_ci ip addr add 192.0.2.5/30 dev eth0.2 10262306a36Sopenharmony_ci ip addr add 192.0.2.9/30 dev eth0.3 10362306a36Sopenharmony_ci 10462306a36Sopenharmony_ci # bring up the bridge devices 10562306a36Sopenharmony_ci ip link set br0 up 10662306a36Sopenharmony_ci 10762306a36Sopenharmony_ci 10862306a36Sopenharmony_cibridge 10962306a36Sopenharmony_ci~~~~~~ 11062306a36Sopenharmony_ci 11162306a36Sopenharmony_ci.. code-block:: sh 11262306a36Sopenharmony_ci 11362306a36Sopenharmony_ci # tag traffic on CPU port 11462306a36Sopenharmony_ci ip link add link eth0 name eth0.1 type vlan id 1 11562306a36Sopenharmony_ci 11662306a36Sopenharmony_ci # The master interface needs to be brought up before the slave ports. 11762306a36Sopenharmony_ci ip link set eth0 up 11862306a36Sopenharmony_ci ip link set eth0.1 up 11962306a36Sopenharmony_ci 12062306a36Sopenharmony_ci # bring up the slave interfaces 12162306a36Sopenharmony_ci ip link set wan up 12262306a36Sopenharmony_ci ip link set lan1 up 12362306a36Sopenharmony_ci ip link set lan2 up 12462306a36Sopenharmony_ci 12562306a36Sopenharmony_ci # create bridge 12662306a36Sopenharmony_ci ip link add name br0 type bridge 12762306a36Sopenharmony_ci 12862306a36Sopenharmony_ci # activate VLAN filtering 12962306a36Sopenharmony_ci ip link set dev br0 type bridge vlan_filtering 1 13062306a36Sopenharmony_ci 13162306a36Sopenharmony_ci # add ports to bridge 13262306a36Sopenharmony_ci ip link set dev wan master br0 13362306a36Sopenharmony_ci ip link set dev lan1 master br0 13462306a36Sopenharmony_ci ip link set dev lan2 master br0 13562306a36Sopenharmony_ci ip link set eth0.1 master br0 13662306a36Sopenharmony_ci 13762306a36Sopenharmony_ci # configure the bridge 13862306a36Sopenharmony_ci ip addr add 192.0.2.129/25 dev br0 13962306a36Sopenharmony_ci 14062306a36Sopenharmony_ci # bring up the bridge 14162306a36Sopenharmony_ci ip link set dev br0 up 14262306a36Sopenharmony_ci 14362306a36Sopenharmony_cigateway 14462306a36Sopenharmony_ci~~~~~~~ 14562306a36Sopenharmony_ci 14662306a36Sopenharmony_ci.. code-block:: sh 14762306a36Sopenharmony_ci 14862306a36Sopenharmony_ci # tag traffic on CPU port 14962306a36Sopenharmony_ci ip link add link eth0 name eth0.1 type vlan id 1 15062306a36Sopenharmony_ci ip link add link eth0 name eth0.2 type vlan id 2 15162306a36Sopenharmony_ci 15262306a36Sopenharmony_ci # The master interface needs to be brought up before the slave ports. 15362306a36Sopenharmony_ci ip link set eth0 up 15462306a36Sopenharmony_ci ip link set eth0.1 up 15562306a36Sopenharmony_ci ip link set eth0.2 up 15662306a36Sopenharmony_ci 15762306a36Sopenharmony_ci # bring up the slave interfaces 15862306a36Sopenharmony_ci ip link set wan up 15962306a36Sopenharmony_ci ip link set lan1 up 16062306a36Sopenharmony_ci ip link set lan2 up 16162306a36Sopenharmony_ci 16262306a36Sopenharmony_ci # create bridge 16362306a36Sopenharmony_ci ip link add name br0 type bridge 16462306a36Sopenharmony_ci 16562306a36Sopenharmony_ci # activate VLAN filtering 16662306a36Sopenharmony_ci ip link set dev br0 type bridge vlan_filtering 1 16762306a36Sopenharmony_ci 16862306a36Sopenharmony_ci # add ports to bridges 16962306a36Sopenharmony_ci ip link set dev wan master br0 17062306a36Sopenharmony_ci ip link set eth0.1 master br0 17162306a36Sopenharmony_ci ip link set dev lan1 master br0 17262306a36Sopenharmony_ci ip link set dev lan2 master br0 17362306a36Sopenharmony_ci 17462306a36Sopenharmony_ci # tag traffic on ports 17562306a36Sopenharmony_ci bridge vlan add dev wan vid 2 pvid untagged 17662306a36Sopenharmony_ci bridge vlan del dev wan vid 1 17762306a36Sopenharmony_ci 17862306a36Sopenharmony_ci # configure the VLANs 17962306a36Sopenharmony_ci ip addr add 192.0.2.1/30 dev eth0.2 18062306a36Sopenharmony_ci ip addr add 192.0.2.129/25 dev br0 18162306a36Sopenharmony_ci 18262306a36Sopenharmony_ci # bring up the bridge devices 18362306a36Sopenharmony_ci ip link set br0 up 184