Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c51a744a authored by Yuval Mintz's avatar Yuval Mintz Committed by David S. Miller
Browse files

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: default avatarYuval Mintz <yuvalm@mellanox.com>
Reviewed-by: default avatarPetr Machata <petrm@mellanox.com>
[petrm@mellanox.com: Drop shebang.]
Signed-off-by: default avatarPetr Machata <petrm@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d98307c5
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
# 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
}