0001 .. SPDX-License-Identifier: GPL-2.0
0002 .. include:: <isonum.txt>
0003
0004 ===================
0005 DPAA2 Switch driver
0006 ===================
0007
0008 :Copyright: |copy| 2021 NXP
0009
0010 The DPAA2 Switch driver probes on the Datapath Switch (DPSW) object which can
0011 be instantiated on the following DPAA2 SoCs and their variants: LS2088A and
0012 LX2160A.
0013
0014 The driver uses the switch device driver model and exposes each switch port as
0015 a network interface, which can be included in a bridge or used as a standalone
0016 interface. Traffic switched between ports is offloaded into the hardware.
0017
0018 The DPSW can have ports connected to DPNIs or to DPMACs for external access.
0019 ::
0020
0021 [ethA] [ethB] [ethC] [ethD] [ethE] [ethF]
0022 : : : : : :
0023 : : : : : :
0024 [dpaa2-eth] [dpaa2-eth] [ dpaa2-switch ]
0025 : : : : : : kernel
0026 =============================================================================
0027 : : : : : : hardware
0028 [DPNI] [DPNI] [============= DPSW =================]
0029 | | | | | |
0030 | ---------- | [DPMAC] [DPMAC]
0031 ------------------------------- | |
0032 | |
0033 [PHY] [PHY]
0034
0035 Creating an Ethernet Switch
0036 ===========================
0037
0038 The dpaa2-switch driver probes on DPSW devices found on the fsl-mc bus. These
0039 devices can be either created statically through the boot time configuration
0040 file - DataPath Layout (DPL) - or at runtime using the DPAA2 object APIs
0041 (incorporated already into the restool userspace tool).
0042
0043 At the moment, the dpaa2-switch driver imposes the following restrictions on
0044 the DPSW object that it will probe:
0045
0046 * The minimum number of FDBs should be at least equal to the number of switch
0047 interfaces. This is necessary so that separation of switch ports can be
0048 done, ie when not under a bridge, each switch port will have its own FDB.
0049 ::
0050
0051 fsl_dpaa2_switch dpsw.0: The number of FDBs is lower than the number of ports, cannot probe
0052
0053 * Both the broadcast and flooding configuration should be per FDB. This
0054 enables the driver to restrict the broadcast and flooding domains of each
0055 FDB depending on the switch ports that are sharing it (aka are under the
0056 same bridge).
0057 ::
0058
0059 fsl_dpaa2_switch dpsw.0: Flooding domain is not per FDB, cannot probe
0060 fsl_dpaa2_switch dpsw.0: Broadcast domain is not per FDB, cannot probe
0061
0062 * The control interface of the switch should not be disabled
0063 (DPSW_OPT_CTRL_IF_DIS not passed as a create time option). Without the
0064 control interface, the driver is not capable to provide proper Rx/Tx traffic
0065 support on the switch port netdevices.
0066 ::
0067
0068 fsl_dpaa2_switch dpsw.0: Control Interface is disabled, cannot probe
0069
0070 Besides the configuration of the actual DPSW object, the dpaa2-switch driver
0071 will need the following DPAA2 objects:
0072
0073 * 1 DPMCP - A Management Command Portal object is needed for any interraction
0074 with the MC firmware.
0075
0076 * 1 DPBP - A Buffer Pool is used for seeding buffers intended for the Rx path
0077 on the control interface.
0078
0079 * Access to at least one DPIO object (Software Portal) is needed for any
0080 enqueue/dequeue operation to be performed on the control interface queues.
0081 The DPIO object will be shared, no need for a private one.
0082
0083 Switching features
0084 ==================
0085
0086 The driver supports the configuration of L2 forwarding rules in hardware for
0087 port bridging as well as standalone usage of the independent switch interfaces.
0088
0089 The hardware is not configurable with respect to VLAN awareness, thus any DPAA2
0090 switch port should be used only in usecases with a VLAN aware bridge::
0091
0092 $ ip link add dev br0 type bridge vlan_filtering 1
0093
0094 $ ip link add dev br1 type bridge
0095 $ ip link set dev ethX master br1
0096 Error: fsl_dpaa2_switch: Cannot join a VLAN-unaware bridge
0097
0098 Topology and loop detection through STP is supported when ``stp_state 1`` is
0099 used at bridge create ::
0100
0101 $ ip link add dev br0 type bridge vlan_filtering 1 stp_state 1
0102
0103 L2 FDB manipulation (add/delete/dump) is supported.
0104
0105 HW FDB learning can be configured on each switch port independently through
0106 bridge commands. When the HW learning is disabled, a fast age procedure will be
0107 run and any previously learnt addresses will be removed.
0108 ::
0109
0110 $ bridge link set dev ethX learning off
0111 $ bridge link set dev ethX learning on
0112
0113 Restricting the unknown unicast and multicast flooding domain is supported, but
0114 not independently of each other::
0115
0116 $ ip link set dev ethX type bridge_slave flood off mcast_flood off
0117 $ ip link set dev ethX type bridge_slave flood off mcast_flood on
0118 Error: fsl_dpaa2_switch: Cannot configure multicast flooding independently of unicast.
0119
0120 Broadcast flooding on a switch port can be disabled/enabled through the brport sysfs::
0121
0122 $ echo 0 > /sys/bus/fsl-mc/devices/dpsw.Y/net/ethX/brport/broadcast_flood
0123
0124 Offloads
0125 ========
0126
0127 Routing actions (redirect, trap, drop)
0128 --------------------------------------
0129
0130 The DPAA2 switch is able to offload flow-based redirection of packets making
0131 use of ACL tables. Shared filter blocks are supported by sharing a single ACL
0132 table between multiple ports.
0133
0134 The following flow keys are supported:
0135
0136 * Ethernet: dst_mac/src_mac
0137 * IPv4: dst_ip/src_ip/ip_proto/tos
0138 * VLAN: vlan_id/vlan_prio/vlan_tpid/vlan_dei
0139 * L4: dst_port/src_port
0140
0141 Also, the matchall filter can be used to redirect the entire traffic received
0142 on a port.
0143
0144 As per flow actions, the following are supported:
0145
0146 * drop
0147 * mirred egress redirect
0148 * trap
0149
0150 Each ACL entry (filter) can be setup with only one of the listed
0151 actions.
0152
0153 Example 1: send frames received on eth4 with a SA of 00:01:02:03:04:05 to the
0154 CPU::
0155
0156 $ tc qdisc add dev eth4 clsact
0157 $ tc filter add dev eth4 ingress flower src_mac 00:01:02:03:04:05 skip_sw action trap
0158
0159 Example 2: drop frames received on eth4 with VID 100 and PCP of 3::
0160
0161 $ tc filter add dev eth4 ingress protocol 802.1q flower skip_sw vlan_id 100 vlan_prio 3 action drop
0162
0163 Example 3: redirect all frames received on eth4 to eth1::
0164
0165 $ tc filter add dev eth4 ingress matchall action mirred egress redirect dev eth1
0166
0167 Example 4: Use a single shared filter block on both eth5 and eth6::
0168
0169 $ tc qdisc add dev eth5 ingress_block 1 clsact
0170 $ tc qdisc add dev eth6 ingress_block 1 clsact
0171 $ tc filter add block 1 ingress flower dst_mac 00:01:02:03:04:04 skip_sw \
0172 action trap
0173 $ tc filter add block 1 ingress protocol ipv4 flower src_ip 192.168.1.1 skip_sw \
0174 action mirred egress redirect dev eth3
0175
0176 Mirroring
0177 ~~~~~~~~~
0178
0179 The DPAA2 switch supports only per port mirroring and per VLAN mirroring.
0180 Adding mirroring filters in shared blocks is also supported.
0181
0182 When using the tc-flower classifier with the 802.1q protocol, only the
0183 ''vlan_id'' key will be accepted. Mirroring based on any other fields from the
0184 802.1q protocol will be rejected::
0185
0186 $ tc qdisc add dev eth8 ingress_block 1 clsact
0187 $ tc filter add block 1 ingress protocol 802.1q flower skip_sw vlan_prio 3 action mirred egress mirror dev eth6
0188 Error: fsl_dpaa2_switch: Only matching on VLAN ID supported.
0189 We have an error talking to the kernel
0190
0191 If a mirroring VLAN filter is requested on a port, the VLAN must to be
0192 installed on the switch port in question either using ''bridge'' or by creating
0193 a VLAN upper device if the switch port is used as a standalone interface::
0194
0195 $ tc qdisc add dev eth8 ingress_block 1 clsact
0196 $ tc filter add block 1 ingress protocol 802.1q flower skip_sw vlan_id 200 action mirred egress mirror dev eth6
0197 Error: VLAN must be installed on the switch port.
0198 We have an error talking to the kernel
0199
0200 $ bridge vlan add vid 200 dev eth8
0201 $ tc filter add block 1 ingress protocol 802.1q flower skip_sw vlan_id 200 action mirred egress mirror dev eth6
0202
0203 $ ip link add link eth8 name eth8.200 type vlan id 200
0204 $ tc filter add block 1 ingress protocol 802.1q flower skip_sw vlan_id 200 action mirred egress mirror dev eth6
0205
0206 Also, it should be noted that the mirrored traffic will be subject to the same
0207 egress restrictions as any other traffic. This means that when a mirrored
0208 packet will reach the mirror port, if the VLAN found in the packet is not
0209 installed on the port it will get dropped.
0210
0211 The DPAA2 switch supports only a single mirroring destination, thus multiple
0212 mirror rules can be installed but their ''to'' port has to be the same::
0213
0214 $ tc filter add block 1 ingress protocol 802.1q flower skip_sw vlan_id 200 action mirred egress mirror dev eth6
0215 $ tc filter add block 1 ingress protocol 802.1q flower skip_sw vlan_id 100 action mirred egress mirror dev eth7
0216 Error: fsl_dpaa2_switch: Multiple mirror ports not supported.
0217 We have an error talking to the kernel