brintos

brintos / linux-shallow public Read only

0
0
Text · 9.1 KiB · 8bf411b Raw
218 lines · plain
1.. SPDX-License-Identifier: GPL-2.02.. include:: <isonum.txt>3 4===================5DPAA2 Switch driver6===================7 8:Copyright: |copy| 2021 NXP9 10The DPAA2 Switch driver probes on the Datapath Switch (DPSW) object which can11be instantiated on the following DPAA2 SoCs and their variants: LS2088A and12LX2160A.13 14The driver uses the switch device driver model and exposes each switch port as15a network interface, which can be included in a bridge or used as a standalone16interface. Traffic switched between ports is offloaded into the hardware.17 18The DPSW can have ports connected to DPNIs or to DPMACs for external access.19::20 21         [ethA]     [ethB]      [ethC]     [ethD]     [ethE]     [ethF]22            :          :          :          :          :          :23            :          :          :          :          :          :24       [dpaa2-eth]  [dpaa2-eth]  [              dpaa2-switch              ]25            :          :          :          :          :          :        kernel26       =============================================================================27            :          :          :          :          :          :        hardware28         [DPNI]      [DPNI]     [============= DPSW =================]29            |          |          |          |          |          |30            |           ----------           |       [DPMAC]    [DPMAC]31             -------------------------------            |          |32                                                        |          |33                                                      [PHY]      [PHY]34 35Creating an Ethernet Switch36===========================37 38The dpaa2-switch driver probes on DPSW devices found on the fsl-mc bus. These39devices can be either created statically through the boot time configuration40file - DataPath Layout (DPL) - or at runtime using the DPAA2 object APIs41(incorporated already into the restool userspace tool).42 43At the moment, the dpaa2-switch driver imposes the following restrictions on44the DPSW object that it will probe:45 46 * The minimum number of FDBs should be at least equal to the number of switch47   interfaces. This is necessary so that separation of switch ports can be48   done, ie when not under a bridge, each switch port will have its own FDB.49   ::50 51        fsl_dpaa2_switch dpsw.0: The number of FDBs is lower than the number of ports, cannot probe52 53 * Both the broadcast and flooding configuration should be per FDB. This54   enables the driver to restrict the broadcast and flooding domains of each55   FDB depending on the switch ports that are sharing it (aka are under the56   same bridge).57   ::58 59        fsl_dpaa2_switch dpsw.0: Flooding domain is not per FDB, cannot probe60        fsl_dpaa2_switch dpsw.0: Broadcast domain is not per FDB, cannot probe61 62 * The control interface of the switch should not be disabled63   (DPSW_OPT_CTRL_IF_DIS not passed as a create time option). Without the64   control interface, the driver is not capable to provide proper Rx/Tx traffic65   support on the switch port netdevices.66   ::67 68        fsl_dpaa2_switch dpsw.0: Control Interface is disabled, cannot probe69 70Besides the configuration of the actual DPSW object, the dpaa2-switch driver71will need the following DPAA2 objects:72 73 * 1 DPMCP - A Management Command Portal object is needed for any interraction74   with the MC firmware.75 76 * 1 DPBP - A Buffer Pool is used for seeding buffers intended for the Rx path77   on the control interface.78 79 * Access to at least one DPIO object (Software Portal) is needed for any80   enqueue/dequeue operation to be performed on the control interface queues.81   The DPIO object will be shared, no need for a private one.82 83Switching features84==================85 86The driver supports the configuration of L2 forwarding rules in hardware for87port bridging as well as standalone usage of the independent switch interfaces.88 89The hardware is not configurable with respect to VLAN awareness, thus any DPAA290switch port should be used only in usecases with a VLAN aware bridge::91 92        $ ip link add dev br0 type bridge vlan_filtering 193 94        $ ip link add dev br1 type bridge95        $ ip link set dev ethX master br196        Error: fsl_dpaa2_switch: Cannot join a VLAN-unaware bridge97 98Topology and loop detection through STP is supported when ``stp_state 1`` is99used at bridge create ::100 101        $ ip link add dev br0 type bridge vlan_filtering 1 stp_state 1102 103L2 FDB manipulation (add/delete/dump) is supported.104 105HW FDB learning can be configured on each switch port independently through106bridge commands. When the HW learning is disabled, a fast age procedure will be107run and any previously learnt addresses will be removed.108::109 110        $ bridge link set dev ethX learning off111        $ bridge link set dev ethX learning on112 113Restricting the unknown unicast and multicast flooding domain is supported, but114not independently of each other::115 116        $ ip link set dev ethX type bridge_slave flood off mcast_flood off117        $ ip link set dev ethX type bridge_slave flood off mcast_flood on118        Error: fsl_dpaa2_switch: Cannot configure multicast flooding independently of unicast.119 120Broadcast flooding on a switch port can be disabled/enabled through the brport sysfs::121 122        $ echo 0 > /sys/bus/fsl-mc/devices/dpsw.Y/net/ethX/brport/broadcast_flood123 124Offloads125========126 127Routing actions (redirect, trap, drop)128--------------------------------------129 130The DPAA2 switch is able to offload flow-based redirection of packets making131use of ACL tables. Shared filter blocks are supported by sharing a single ACL132table between multiple ports.133 134The following flow keys are supported:135 136 * Ethernet: dst_mac/src_mac137 * IPv4: dst_ip/src_ip/ip_proto/tos138 * VLAN: vlan_id/vlan_prio/vlan_tpid/vlan_dei139 * L4: dst_port/src_port140 141Also, the matchall filter can be used to redirect the entire traffic received142on a port.143 144As per flow actions, the following are supported:145 146 * drop147 * mirred egress redirect148 * trap149 150Each ACL entry (filter) can be setup with only one of the listed151actions.152 153Example 1: send frames received on eth4 with a SA of 00:01:02:03:04:05 to the154CPU::155 156        $ tc qdisc add dev eth4 clsact157        $ tc filter add dev eth4 ingress flower src_mac 00:01:02:03:04:05 skip_sw action trap158 159Example 2: drop frames received on eth4 with VID 100 and PCP of 3::160 161        $ tc filter add dev eth4 ingress protocol 802.1q flower skip_sw vlan_id 100 vlan_prio 3 action drop162 163Example 3: redirect all frames received on eth4 to eth1::164 165        $ tc filter add dev eth4 ingress matchall action mirred egress redirect dev eth1166 167Example 4: Use a single shared filter block on both eth5 and eth6::168 169        $ tc qdisc add dev eth5 ingress_block 1 clsact170        $ tc qdisc add dev eth6 ingress_block 1 clsact171        $ tc filter add block 1 ingress flower dst_mac 00:01:02:03:04:04 skip_sw \172                action trap173        $ tc filter add block 1 ingress protocol ipv4 flower src_ip 192.168.1.1 skip_sw \174                action mirred egress redirect dev eth3175 176Mirroring177~~~~~~~~~178 179The DPAA2 switch supports only per port mirroring and per VLAN mirroring.180Adding mirroring filters in shared blocks is also supported.181 182When using the tc-flower classifier with the 802.1q protocol, only the183''vlan_id'' key will be accepted. Mirroring based on any other fields from the184802.1q protocol will be rejected::185 186        $ tc qdisc add dev eth8 ingress_block 1 clsact187        $ tc filter add block 1 ingress protocol 802.1q flower skip_sw vlan_prio 3 action mirred egress mirror dev eth6188        Error: fsl_dpaa2_switch: Only matching on VLAN ID supported.189        We have an error talking to the kernel190 191If a mirroring VLAN filter is requested on a port, the VLAN must to be192installed on the switch port in question either using ''bridge'' or by creating193a VLAN upper device if the switch port is used as a standalone interface::194 195        $ tc qdisc add dev eth8 ingress_block 1 clsact196        $ tc filter add block 1 ingress protocol 802.1q flower skip_sw vlan_id 200 action mirred egress mirror dev eth6197        Error: VLAN must be installed on the switch port.198        We have an error talking to the kernel199 200        $ bridge vlan add vid 200 dev eth8201        $ tc filter add block 1 ingress protocol 802.1q flower skip_sw vlan_id 200 action mirred egress mirror dev eth6202 203        $ ip link add link eth8 name eth8.200 type vlan id 200204        $ tc filter add block 1 ingress protocol 802.1q flower skip_sw vlan_id 200 action mirred egress mirror dev eth6205 206Also, it should be noted that the mirrored traffic will be subject to the same207egress restrictions as any other traffic. This means that when a mirrored208packet will reach the mirror port, if the VLAN found in the packet is not209installed on the port it will get dropped.210 211The DPAA2 switch supports only a single mirroring destination, thus multiple212mirror rules can be installed but their ''to'' port has to be the same::213 214        $ tc filter add block 1 ingress protocol 802.1q flower skip_sw vlan_id 200 action mirred egress mirror dev eth6215        $ tc filter add block 1 ingress protocol 802.1q flower skip_sw vlan_id 100 action mirred egress mirror dev eth7216        Error: fsl_dpaa2_switch: Multiple mirror ports not supported.217        We have an error talking to the kernel218