This repository has been archived by the owner on Nov 21, 2022. It is now read-only.
forked from microsoft/WSL2-Linux-Kernel
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'mlxsw-L3-HW-stats-improvements'
Ido Schimmel says: ==================== mlxsw: L3 HW stats improvements While testing L3 HW stats [1] on top of mlxsw, two issues were found: 1. Stats cannot be enabled for more than 205 netdevs. This was fixed in commit 4b7a632 ("mlxsw: spectrum_cnt: Reorder counter pools"). 2. ARP packets are counted as errors. Patch #1 takes care of that. See the commit message for details. The goal of the majority of the rest of the patches is to add selftests that would have discovered that only about 205 netdevs can have L3 HW stats supported, despite the HW supporting much more. The obvious place to plug this in is the scale test framework. The scale tests are currently testing two things: that some number of instances of a given resource can actually be created; and that when an attempt is made to create more than the supported amount, the failures are noted and handled gracefully. However the ability to allocate the resource does not mean that the resource actually works when passing traffic. For that, make it possible for a given scale to also test traffic. To that end, this patchset adds traffic tests. The goal of these is to run traffic and observe whether a sample of the allocated resource instances actually perform their task. Traffic tests are only run on the positive leg of the scale test (no point trying to pass traffic when the expected outcome is that the resource will not be allocated). They are opt-in, if a given test does not expose it, it is not run. The patchset proceeds as follows: - Patches #2 and #3 add to "devlink resource" support for number of allocated RIFs, and the capacity. This is necessary, because when evaluating how many L3 HW stats instances it should be possible to allocate, the limiting resource on Spectrum-2 and above currently is not the counters themselves, but actually the RIFs. - Patch #6 adds support for invocation of a traffic test, if a given scale tests exposes it. - Patch #7 adds support for skipping a given scale test. Because on Spectrum-2 and above, the limiting factor to L3 HW stats instances is actually the number of RIFs, there is no point in running the failing leg of a scale tests, because it would test exhaustion of RIFs, not of RIF counters. - With patch #8, the scale tests drivers pass the target number to the cleanup function of a scale test. - In patch #9, add a traffic test to the tc_flower selftests. This makes sure that the flow counters installed with the ACLs actually do count as they are supposed to. - In patch #10, add a new scale selftest for RIF counter scale, including a traffic test. - In patch #11, the scale target for the tc_flower selftest is dynamically set instead of being hard coded. [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ca0a53dcec9495d1dc5bbc369c810c520d728373 ==================== Signed-off-by: David S. Miller <[email protected]>
- Loading branch information
Showing
14 changed files
with
283 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
107 changes: 107 additions & 0 deletions
107
tools/testing/selftests/drivers/net/mlxsw/rif_counter_scale.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
# SPDX-License-Identifier: GPL-2.0 | ||
|
||
RIF_COUNTER_NUM_NETIFS=2 | ||
|
||
rif_counter_addr4() | ||
{ | ||
local i=$1; shift | ||
local p=$1; shift | ||
|
||
printf 192.0.%d.%d $((i / 64)) $(((4 * i % 256) + p)) | ||
} | ||
|
||
rif_counter_addr4pfx() | ||
{ | ||
rif_counter_addr4 $@ | ||
printf /30 | ||
} | ||
|
||
rif_counter_h1_create() | ||
{ | ||
simple_if_init $h1 | ||
} | ||
|
||
rif_counter_h1_destroy() | ||
{ | ||
simple_if_fini $h1 | ||
} | ||
|
||
rif_counter_h2_create() | ||
{ | ||
simple_if_init $h2 | ||
} | ||
|
||
rif_counter_h2_destroy() | ||
{ | ||
simple_if_fini $h2 | ||
} | ||
|
||
rif_counter_setup_prepare() | ||
{ | ||
h1=${NETIFS[p1]} | ||
h2=${NETIFS[p2]} | ||
|
||
vrf_prepare | ||
|
||
rif_counter_h1_create | ||
rif_counter_h2_create | ||
} | ||
|
||
rif_counter_cleanup() | ||
{ | ||
local count=$1; shift | ||
|
||
pre_cleanup | ||
|
||
for ((i = 1; i <= count; i++)); do | ||
vlan_destroy $h2 $i | ||
done | ||
|
||
rif_counter_h2_destroy | ||
rif_counter_h1_destroy | ||
|
||
vrf_cleanup | ||
|
||
if [[ -v RIF_COUNTER_BATCH_FILE ]]; then | ||
rm -f $RIF_COUNTER_BATCH_FILE | ||
fi | ||
} | ||
|
||
|
||
rif_counter_test() | ||
{ | ||
local count=$1; shift | ||
local should_fail=$1; shift | ||
|
||
RIF_COUNTER_BATCH_FILE="$(mktemp)" | ||
|
||
for ((i = 1; i <= count; i++)); do | ||
vlan_create $h2 $i v$h2 $(rif_counter_addr4pfx $i 2) | ||
done | ||
for ((i = 1; i <= count; i++)); do | ||
cat >> $RIF_COUNTER_BATCH_FILE <<-EOF | ||
stats set dev $h2.$i l3_stats on | ||
EOF | ||
done | ||
|
||
ip -b $RIF_COUNTER_BATCH_FILE | ||
check_err_fail $should_fail $? "RIF counter enablement" | ||
} | ||
|
||
rif_counter_traffic_test() | ||
{ | ||
local count=$1; shift | ||
local i; | ||
|
||
for ((i = count; i > 0; i /= 2)); do | ||
$MZ $h1 -Q $i -c 1 -d 20msec -p 100 -a own -b $(mac_get $h2) \ | ||
-A $(rif_counter_addr4 $i 1) \ | ||
-B $(rif_counter_addr4 $i 2) \ | ||
-q -t udp sp=54321,dp=12345 | ||
done | ||
for ((i = count; i > 0; i /= 2)); do | ||
busywait "$TC_HIT_TIMEOUT" until_counter_is "== 1" \ | ||
hw_stats_get l3_stats $h2.$i rx packets > /dev/null | ||
check_err $? "Traffic not seen at RIF $h2.$i" | ||
done | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
tools/testing/selftests/drivers/net/mlxsw/spectrum-2/rif_counter_scale.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../spectrum/rif_counter_scale.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.