#!/bin/bash # SPDX-License-Identifier: GPL-2.0 # # A test for switch behavior under MC overload. An issue in Spectrum chips # causes throughput of UC traffic to drop severely when a switch is under heavy # MC load. This issue can be overcome by putting the switch to MC-aware mode. # This test verifies that UC performance stays intact even as the switch is # under MC flood, and therefore that the MC-aware mode is enabled and correctly # configured. # # Because mlxsw throttles CPU port, the traffic can't actually reach userspace # at full speed. That makes it impossible to use iperf3 to simply measure the # throughput, because many packets (that reach $h3) don't get to the kernel at # all even in UDP mode (the situation is even worse in TCP mode, where one can't # hope to see more than a couple Mbps). # # So instead we send traffic with mausezahn and use RX ethtool counters at $h3. # Multicast traffic is untagged, unicast traffic is tagged with PCP 1. Therefore # each gets a different priority and we can use per-prio ethtool counters to # measure the throughput. In order to avoid prioritizing unicast traffic, prio # qdisc is installed on $swp3 and maps all priorities to the same band #7 (and # thus TC 0). # # Mausezahn can't actually saturate the links unless it's using large frames. # Thus we set MTU to 10K on all involved interfaces. Then both unicast and # multicast traffic uses 8K frames. # # +---------------------------+ +----------------------------------+ # | H1 | | H2 | # | | | unicast --> + $h2.111 | # | multicast | | traffic | 192.0.2.129/28 | # | traffic | | | e-qos-map 0:1 | # | $h1 + <----- | | | | # | 192.0.2.65/28 | | | + $h2 | # +---------------|-----------+ +--------------|-------------------+ # | | # +---------------|---------------------------------------|-------------------+ # | $swp1 + + $swp2 | # | >1Gbps | | >1Gbps | # | +-------------|------+ +----------|----------------+ | # | | $swp1.1 + | | + $swp2.111 | | # | | BR1 | SW | BR111 | | # | | $swp3.1 + | | + $swp3.111 | | # | +-------------|------+ +----------|----------------+ | # | \_______________________________________/ | # | | | # | + $swp3 | # | | 1Gbps bottleneck | # | | prio qdisc: {0..7} -> 7 | # +------------------------------------|--------------------------------------+ # | # +--|-----------------+ # | + $h3 H3 | # | | 192.0.2.66/28 | # | | | # | + $h3.111 | # | 192.0.2.130/28 | # +--------------------+
ip link add name br1 type bridge vlan_filtering 0
defer ip link del dev br1
ip link set dev br1 addrgenmode none
ip link set dev br1 up
ip link set dev $swp1 master br1
defer ip link set dev $swp1 nomaster
ip link set dev $swp3 master br1
defer ip link set dev $swp3 nomaster
ip link add name br111 type bridge vlan_filtering 0
defer ip link del dev br111
ip link set dev br111 addrgenmode none
ip link set dev br111 up
ip link set dev $swp2.111 master br111
defer ip link set dev $swp2.111 nomaster
ip link set dev $swp3.111 master br111
defer ip link set dev $swp3.111 nomaster
# Make sure that ingress quotas are smaller than egress so that there is # room for both streams of traffic to be admitted to shared buffer.
devlink_port_pool_th_save $swp1 0
devlink_port_pool_th_set $swp1 0 5
defer devlink_port_pool_th_restore $swp1 0
local -a uc_rate=($(run_uc_measure_rate "UC-only"))
local ucth1=${uc_rate[1]}
start_traffic $h1 192.0.2.65 bc bc
defer stop_traffic $!
local d0=$(date +%s)
local t0=$(ethtool_stats_get $h3 rx_octets_prio_0)
local u0=$(ethtool_stats_get $swp1 rx_octets_prio_0)
local -a uc_rate_2=($(run_uc_measure_rate "UC+MC"))
local ucth2=${uc_rate_2[1]}
local d1=$(date +%s)
local t1=$(ethtool_stats_get $h3 rx_octets_prio_0)
local u1=$(ethtool_stats_get $swp1 rx_octets_prio_0)
local deg=$(bc <<< "
scale=2
ret = 100 * ($ucth1 - $ucth2) / $ucth1 if (ret > 0) { ret } else { 0 } ")
# Minimum shaper of 200Mbps on MC TCs should cause about 20% of # degradation on 1Gbps link.
check_err $(bc <<< "$deg < 15") "Minimum shaper not in effect"
check_err $(bc <<< "$deg > 25") "MC traffic degrades UC performance too much"
local interval=$((d1 - d0))
local mc_ir=$(rate $u0 $u1 $interval)
local mc_er=$(rate $t0 $t1 $interval)
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.