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