summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorYuval Mintz <yuvalm@mellanox.com>2018-06-30 02:50:28 +0200
committerDavid S. Miller <davem@davemloft.net>2018-06-30 22:06:15 +0900
commitc51a744a28bad6faec696b56c176519bea0e73bc (patch)
tree58b61411d2dfb1bd1dec5887da8be56dd8109ce6 /tools
parentd98307c52b19354830af205a1a8346d13e2b1fa7 (diff)
selftests: mlxsw: Add target for router test on spectrum
IPv4 routes in Spectrum are based on the kvd single-hash, but as it's a hash we need to assume we cannot reach 100% of its capacity. Add a wrapper that provides us with good/bad target numbers for the Spectrum ASIC. Signed-off-by: Yuval Mintz <yuvalm@mellanox.com> Reviewed-by: Petr Machata <petrm@mellanox.com> [petrm@mellanox.com: Drop shebang.] Signed-off-by: Petr Machata <petrm@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/selftests/drivers/net/mlxsw/spectrum/router_scale.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/tools/testing/selftests/drivers/net/mlxsw/spectrum/router_scale.sh b/tools/testing/selftests/drivers/net/mlxsw/spectrum/router_scale.sh
new file mode 100644
index 000000000000..21c4697d5bab
--- /dev/null
+++ b/tools/testing/selftests/drivers/net/mlxsw/spectrum/router_scale.sh
@@ -0,0 +1,18 @@
+# SPDX-License-Identifier: GPL-2.0
+source ../router_scale.sh
+
+router_get_target()
+{
+ local should_fail=$1
+ local target
+
+ target=$(devlink_resource_size_get kvd hash_single)
+
+ if [[ $should_fail -eq 0 ]]; then
+ target=$((target * 85 / 100))
+ else
+ target=$((target + 1))
+ fi
+
+ echo $target
+}