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