^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) .. SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) ==========================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) Broadcom RoboSwitch Ethernet switch driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) ==========================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) The Broadcom RoboSwitch Ethernet switch family is used in quite a range of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) xDSL router, cable modems and other multimedia devices.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) The actual implementation supports the devices BCM5325E, BCM5365, BCM539x,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) BCM53115 and BCM53125 as well as BCM63XX.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) Implementation details
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) ======================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) The driver is located in ``drivers/net/dsa/b53/`` and is implemented as a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) DSA driver; see ``Documentation/networking/dsa/dsa.rst`` for details on the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) subsystem and what it provides.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) The switch is, if possible, configured to enable a Broadcom specific 4-bytes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) switch tag which gets inserted by the switch for every packet forwarded to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) CPU interface, conversely, the CPU network interface should insert a similar
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) tag for packets entering the CPU port. The tag format is described in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) ``net/dsa/tag_brcm.c``.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) The configuration of the device depends on whether or not tagging is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) supported.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) The interface names and example network configuration are used according the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) configuration described in the :ref:`dsa-config-showcases`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) Configuration with tagging support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) ----------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) The tagging based configuration is desired. It is not specific to the b53
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) DSA driver and will work like all DSA drivers which supports tagging.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) See :ref:`dsa-tagged-configuration`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) Configuration without tagging support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) -------------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) Older models (5325, 5365) support a different tag format that is not supported
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) yet. 539x and 531x5 require managed mode and some special handling, which is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) also not yet supported. The tagging support is disabled in these cases and the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) switch need a different configuration.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) The configuration slightly differ from the :ref:`dsa-vlan-configuration`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) The b53 tags the CPU port in all VLANs, since otherwise any PVID untagged
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) VLAN programming would basically change the CPU port's default PVID and make
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) it untagged, undesirable.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) In difference to the configuration described in :ref:`dsa-vlan-configuration`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) the default VLAN 1 has to be removed from the slave interface configuration in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) single port and gateway configuration, while there is no need to add an extra
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) VLAN configuration in the bridge showcase.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) single port
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) ~~~~~~~~~~~
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) The configuration can only be set up via VLAN tagging and bridge setup.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) By default packages are tagged with vid 1:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) .. code-block:: sh
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) # tag traffic on CPU port
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) ip link add link eth0 name eth0.1 type vlan id 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) ip link add link eth0 name eth0.2 type vlan id 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) ip link add link eth0 name eth0.3 type vlan id 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) # The master interface needs to be brought up before the slave ports.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) ip link set eth0 up
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) ip link set eth0.1 up
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) ip link set eth0.2 up
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) ip link set eth0.3 up
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) # bring up the slave interfaces
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) ip link set wan up
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) ip link set lan1 up
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) ip link set lan2 up
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) # create bridge
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) ip link add name br0 type bridge
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) # activate VLAN filtering
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) ip link set dev br0 type bridge vlan_filtering 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) # add ports to bridges
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) ip link set dev wan master br0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) ip link set dev lan1 master br0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) ip link set dev lan2 master br0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) # tag traffic on ports
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) bridge vlan add dev lan1 vid 2 pvid untagged
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) bridge vlan del dev lan1 vid 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) bridge vlan add dev lan2 vid 3 pvid untagged
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) bridge vlan del dev lan2 vid 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) # configure the VLANs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) ip addr add 192.0.2.1/30 dev eth0.1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) ip addr add 192.0.2.5/30 dev eth0.2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) ip addr add 192.0.2.9/30 dev eth0.3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) # bring up the bridge devices
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) ip link set br0 up
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) bridge
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) ~~~~~~
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) .. code-block:: sh
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) # tag traffic on CPU port
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) ip link add link eth0 name eth0.1 type vlan id 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) # The master interface needs to be brought up before the slave ports.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) ip link set eth0 up
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) ip link set eth0.1 up
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) # bring up the slave interfaces
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) ip link set wan up
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) ip link set lan1 up
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) ip link set lan2 up
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) # create bridge
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) ip link add name br0 type bridge
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) # activate VLAN filtering
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) ip link set dev br0 type bridge vlan_filtering 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) # add ports to bridge
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) ip link set dev wan master br0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) ip link set dev lan1 master br0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) ip link set dev lan2 master br0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) ip link set eth0.1 master br0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) # configure the bridge
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) ip addr add 192.0.2.129/25 dev br0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) # bring up the bridge
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) ip link set dev br0 up
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) gateway
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) ~~~~~~~
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) .. code-block:: sh
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) # tag traffic on CPU port
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) ip link add link eth0 name eth0.1 type vlan id 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) ip link add link eth0 name eth0.2 type vlan id 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) # The master interface needs to be brought up before the slave ports.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) ip link set eth0 up
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) ip link set eth0.1 up
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) ip link set eth0.2 up
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) # bring up the slave interfaces
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) ip link set wan up
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) ip link set lan1 up
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) ip link set lan2 up
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) # create bridge
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) ip link add name br0 type bridge
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) # activate VLAN filtering
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) ip link set dev br0 type bridge vlan_filtering 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) # add ports to bridges
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) ip link set dev wan master br0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) ip link set eth0.1 master br0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) ip link set dev lan1 master br0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) ip link set dev lan2 master br0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) # tag traffic on ports
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) bridge vlan add dev wan vid 2 pvid untagged
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) bridge vlan del dev wan vid 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) # configure the VLANs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) ip addr add 192.0.2.1/30 dev eth0.2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) ip addr add 192.0.2.129/25 dev br0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) # bring up the bridge devices
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) ip link set br0 up