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