Skip to content

Commit

Permalink
selftests: mlxsw: qos_mc_aware: Add a test for UC awareness
Browse files Browse the repository at this point in the history
In a previous patch, mlxsw was updated to configure a minimum bandwidth
allowance on MC TCs. Test that this indeed fixes the problem of UC
traffic overload pushing out all MC traffic.

Fixes: b5638d4 ("selftests: mlxsw: Add a test for UC behavior under MC flood")
Signed-off-by: Petr Machata <[email protected]>
Signed-off-by: Ido Schimmel <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
pmachata authored and davem330 committed Oct 31, 2018
1 parent 8f3f093 commit a5ee171
Showing 1 changed file with 70 additions and 23 deletions.
93 changes: 70 additions & 23 deletions tools/testing/selftests/drivers/net/mlxsw/qos_mc_aware.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,24 @@
# Thus we set MTU to 10K on all involved interfaces. Then both unicast and
# multicast traffic uses 8K frames.
#
# +-----------------------+ +----------------------------------+
# | H1 | | H2 |
# | | | unicast --> + $h2.111 |
# | | | traffic | 192.0.2.129/28 |
# | multicast | | | e-qos-map 0:1 |
# | traffic | | | |
# | $h1 + <----- | | + $h2 |
# +-----|-----------------+ +--------------|-------------------+
# | |
# +-----|-------------------------------------------------|-------------------+
# | + $swp1 + $swp2 |
# | | >1Gbps | >1Gbps |
# | +---|----------------+ +----------|----------------+ |
# | | + $swp1.1 | | + $swp2.111 | |
# +---------------------------+ +----------------------------------+
# | 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.1 + | | + $swp3.111 | |
# | +-------------|------+ +----------|----------------+ |
# | \_______________________________________/ |
# | | |
# | + $swp3 |
# | | 1Gbps bottleneck |
Expand All @@ -51,6 +51,7 @@
# |
# +--|-----------------+
# | + $h3 H3 |
# | | 192.0.2.66/28 |
# | | |
# | + $h3.111 |
# | 192.0.2.130/28 |
Expand All @@ -59,6 +60,7 @@
ALL_TESTS="
ping_ipv4
test_mc_aware
test_uc_aware
"

lib_dir=$(dirname $0)/../../../net/forwarding
Expand All @@ -68,14 +70,14 @@ source $lib_dir/lib.sh

h1_create()
{
simple_if_init $h1
simple_if_init $h1 192.0.2.65/28
mtu_set $h1 10000
}

h1_destroy()
{
mtu_restore $h1
simple_if_fini $h1
simple_if_fini $h1 192.0.2.65/28
}

h2_create()
Expand All @@ -97,7 +99,7 @@ h2_destroy()

h3_create()
{
simple_if_init $h3
simple_if_init $h3 192.0.2.66/28
mtu_set $h3 10000

vlan_create $h3 111 v$h3 192.0.2.130/28
Expand All @@ -108,7 +110,7 @@ h3_destroy()
vlan_destroy $h3 111

mtu_restore $h3
simple_if_fini $h3
simple_if_fini $h3 192.0.2.66/28
}

switch_create()
Expand Down Expand Up @@ -251,7 +253,7 @@ measure_uc_rate()
# average ingress rate to somewhat mitigate this.
local min_ingress=2147483648

mausezahn $h2.111 -p 8000 -A 192.0.2.129 -B 192.0.2.130 -c 0 \
$MZ $h2.111 -p 8000 -A 192.0.2.129 -B 192.0.2.130 -c 0 \
-a own -b $h3mac -t udp -q &
sleep 1

Expand Down Expand Up @@ -291,7 +293,7 @@ test_mc_aware()
check_err $? "Could not get high enough UC-only ingress rate"
local ucth1=${uc_rate[1]}

mausezahn $h1 -p 8000 -c 0 -a own -b bc -t udp -q &
$MZ $h1 -p 8000 -c 0 -a own -b bc -t udp -q &

local d0=$(date +%s)
local t0=$(ethtool_stats_get $h3 rx_octets_prio_0)
Expand Down Expand Up @@ -335,6 +337,51 @@ test_mc_aware()
echo " egress UC throughput $(humanize ${uc_rate_2[1]})"
echo " ingress MC throughput $(humanize $mc_ir)"
echo " egress MC throughput $(humanize $mc_er)"
echo
}

test_uc_aware()
{
RET=0

$MZ $h2.111 -p 8000 -A 192.0.2.129 -B 192.0.2.130 -c 0 \
-a own -b $h3mac -t udp -q &

local d0=$(date +%s)
local t0=$(ethtool_stats_get $h3 rx_octets_prio_1)
local u0=$(ethtool_stats_get $swp2 rx_octets_prio_1)
sleep 1

local attempts=50
local passes=0
local i

for ((i = 0; i < attempts; ++i)); do
if $ARPING -c 1 -I $h1 -b 192.0.2.66 -q -w 0.1; then
((passes++))
fi

sleep 0.1
done

local d1=$(date +%s)
local t1=$(ethtool_stats_get $h3 rx_octets_prio_1)
local u1=$(ethtool_stats_get $swp2 rx_octets_prio_1)

local interval=$((d1 - d0))
local uc_ir=$(rate $u0 $u1 $interval)
local uc_er=$(rate $t0 $t1 $interval)

((attempts == passes))
check_err $?

# Suppress noise from killing mausezahn.
{ kill %% && wait; } 2>/dev/null

log_test "MC performace under UC overload"
echo " ingress UC throughput $(humanize ${uc_ir})"
echo " egress UC throughput $(humanize ${uc_er})"
echo " sent $attempts BC ARPs, got $passes responses"
}

trap cleanup EXIT
Expand Down

0 comments on commit a5ee171

Please sign in to comment.