1.. SPDX-License-Identifier: GPL-2.0 2 3=================================================================== 4Texas Instruments K3 AM65 CPSW NUSS switchdev based ethernet driver 5=================================================================== 6 7:Version: 1.0 8 9Port renaming 10============= 11 12In 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 20Multi mac mode 21============== 22 23- The driver is operating in multi-mac mode by default, thus 24 working as N individual network interfaces. 25 26Devlink configuration parameters 27================================ 28 29See Documentation/networking/devlink/am65-nuss-cpsw-switch.rst 30 31Enabling "switch" 32================= 33 34The 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 40This can be done regardless of the state of Port's netdev devices - UP/DOWN, but 41Port's netdev devices have to be in UP before joining to the bridge to avoid 42overwriting of bridge configuration as CPSW switch driver completely reloads its 43configuration when first port changes its state to UP. 44 45When the both interfaces joined the bridge - CPSW switch driver will enable 46marking packets with offload_fwd_mark flag. 47 48All configuration is implemented via switchdev API. 49 50Bridge 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 72On/off STP 73========== 74 75:: 76 77 ip link set dev BRDEV type bridge stp_state 1/0 78 79VLAN configuration 80================== 81 82:: 83 84 bridge vlan add dev br0 vid 1 pvid untagged self <---- add cpu port to VLAN 1 85 86Note. This step is mandatory for bridge/default_pvid. 87 88Add 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 103FDBs 104---- 105 106FDBs are automatically added on the appropriate switch port upon detection 107 108Manually 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 113MDBs 114---- 115 116MDBs are automatically added on the appropriate switch port upon detection 117 118Manually 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 123Multicast flooding 124================== 125CPU port mcast_flooding is always on 126 127Turning flooding on/off on switch ports: 128bridge link set dev sw0p1 mcast_flood on/off 129 130Access 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 142Note. Setting PVID on Bridge device itself works only for 143default VLAN (default_pvid). 144