Commit | Line | Data |
---|---|---|
e276cfb9 VR |
1 | .. SPDX-License-Identifier: GPL-2.0 |
2 | ||
3 | =================================================================== | |
4 | Texas Instruments K3 AM65 CPSW NUSS switchdev based ethernet driver | |
5 | =================================================================== | |
6 | ||
7 | :Version: 1.0 | |
8 | ||
9 | Port renaming | |
10 | ============= | |
11 | ||
12 | In order to rename via udev:: | |
13 | ||
14 | ip -d link show dev sw0p1 | grep switchid | |
15 | ||
16 | SUBSYSTEM=="net", ACTION=="add", ATTR{phys_switch_id}==<switchid>, \ | |
17 | ATTR{phys_port_name}!="", NAME="sw0$attr{phys_port_name}" | |
18 | ||
19 | ||
20 | Multi mac mode | |
21 | ============== | |
22 | ||
23 | - The driver is operating in multi-mac mode by default, thus | |
24 | working as N individual network interfaces. | |
25 | ||
26 | Devlink configuration parameters | |
27 | ================================ | |
28 | ||
29 | See Documentation/networking/devlink/am65-nuss-cpsw-switch.rst | |
30 | ||
31 | Enabling "switch" | |
32 | ================= | |
33 | ||
34 | The Switch mode can be enabled by configuring devlink driver parameter | |
35 | "switch_mode" to 1/true:: | |
36 | ||
37 | devlink dev param set platform/c000000.ethernet \ | |
38 | name switch_mode value true cmode runtime | |
39 | ||
40 | This can be done regardless of the state of Port's netdev devices - UP/DOWN, but | |
41 | Port's netdev devices have to be in UP before joining to the bridge to avoid | |
42 | overwriting of bridge configuration as CPSW switch driver completely reloads its | |
43 | configuration when first port changes its state to UP. | |
44 | ||
45 | When the both interfaces joined the bridge - CPSW switch driver will enable | |
46 | marking packets with offload_fwd_mark flag. | |
47 | ||
48 | All configuration is implemented via switchdev API. | |
49 | ||
50 | Bridge setup | |
51 | ============ | |
52 | ||
53 | :: | |
54 | ||
55 | devlink dev param set platform/c000000.ethernet \ | |
56 | name switch_mode value true cmode runtime | |
57 | ||
58 | ip link add name br0 type bridge | |
59 | ip link set dev br0 type bridge ageing_time 1000 | |
60 | ip link set dev sw0p1 up | |
61 | ip link set dev sw0p2 up | |
62 | ip link set dev sw0p1 master br0 | |
63 | ip link set dev sw0p2 master br0 | |
64 | ||
65 | [*] bridge vlan add dev br0 vid 1 pvid untagged self | |
66 | ||
67 | [*] if vlan_filtering=1. where default_pvid=1 | |
68 | ||
69 | Note. Steps [*] are mandatory. | |
70 | ||
71 | ||
72 | On/off STP | |
73 | ========== | |
74 | ||
75 | :: | |
76 | ||
77 | ip link set dev BRDEV type bridge stp_state 1/0 | |
78 | ||
79 | VLAN configuration | |
80 | ================== | |
81 | ||
82 | :: | |
83 | ||
84 | bridge vlan add dev br0 vid 1 pvid untagged self <---- add cpu port to VLAN 1 | |
85 | ||
86 | Note. This step is mandatory for bridge/default_pvid. | |
87 | ||
88 | Add extra VLANs | |
89 | =============== | |
90 | ||
91 | 1. untagged:: | |
92 | ||
93 | bridge vlan add dev sw0p1 vid 100 pvid untagged master | |
94 | bridge vlan add dev sw0p2 vid 100 pvid untagged master | |
95 | bridge vlan add dev br0 vid 100 pvid untagged self <---- Add cpu port to VLAN100 | |
96 | ||
97 | 2. tagged:: | |
98 | ||
99 | bridge vlan add dev sw0p1 vid 100 master | |
100 | bridge vlan add dev sw0p2 vid 100 master | |
101 | bridge vlan add dev br0 vid 100 pvid tagged self <---- Add cpu port to VLAN100 | |
102 | ||
103 | FDBs | |
104 | ---- | |
105 | ||
106 | FDBs are automatically added on the appropriate switch port upon detection | |
107 | ||
108 | Manually adding FDBs:: | |
109 | ||
110 | bridge fdb add aa:bb:cc:dd:ee:ff dev sw0p1 master vlan 100 | |
111 | bridge fdb add aa:bb:cc:dd:ee:fe dev sw0p2 master <---- Add on all VLANs | |
112 | ||
113 | MDBs | |
114 | ---- | |
115 | ||
116 | MDBs are automatically added on the appropriate switch port upon detection | |
117 | ||
118 | Manually adding MDBs:: | |
119 | ||
120 | bridge mdb add dev br0 port sw0p1 grp 239.1.1.1 permanent vid 100 | |
121 | bridge mdb add dev br0 port sw0p1 grp 239.1.1.1 permanent <---- Add on all VLANs | |
122 | ||
123 | Multicast flooding | |
124 | ================== | |
125 | CPU port mcast_flooding is always on | |
126 | ||
a266ef69 | 127 | Turning flooding on/off on switch ports: |
e276cfb9 VR |
128 | bridge link set dev sw0p1 mcast_flood on/off |
129 | ||
130 | Access and Trunk port | |
131 | ===================== | |
132 | ||
133 | :: | |
134 | ||
135 | bridge vlan add dev sw0p1 vid 100 pvid untagged master | |
136 | bridge vlan add dev sw0p2 vid 100 master | |
137 | ||
138 | ||
139 | bridge vlan add dev br0 vid 100 self | |
140 | ip link add link br0 name br0.100 type vlan id 100 | |
141 | ||
142 | Note. Setting PVID on Bridge device itself works only for | |
143 | default VLAN (default_pvid). |