All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net 0/2] selftests: mlxsw: A couple of fixes
@ 2022-03-02 16:14 Ido Schimmel
  2022-03-02 16:14 ` [PATCH net 1/2] selftests: mlxsw: tc_police_scale: Make test more robust Ido Schimmel
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ido Schimmel @ 2022-03-02 16:14 UTC (permalink / raw)
  To: netdev; +Cc: davem, kuba, petrm, amcohen, danieller, mlxsw, Ido Schimmel

Patch #1 fixes a breakage due to a change in iproute2 output. The real
problem is not iproute2, but the fact that the check was not strict
enough. Fixed by using JSON output instead. Targeting at net so that the
test will pass as part of old and new kernels regardless of iproute2
version.

Patch #2 fixes an issue uncovered by the first one.

Amit Cohen (2):
  selftests: mlxsw: tc_police_scale: Make test more robust
  selftests: mlxsw: resource_scale: Fix return value

 .../selftests/drivers/net/mlxsw/spectrum/resource_scale.sh     | 2 +-
 tools/testing/selftests/drivers/net/mlxsw/tc_police_scale.sh   | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

-- 
2.33.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH net 1/2] selftests: mlxsw: tc_police_scale: Make test more robust
  2022-03-02 16:14 [PATCH net 0/2] selftests: mlxsw: A couple of fixes Ido Schimmel
@ 2022-03-02 16:14 ` Ido Schimmel
  2022-03-02 16:14 ` [PATCH net 2/2] selftests: mlxsw: resource_scale: Fix return value Ido Schimmel
  2022-03-03 16:20 ` [PATCH net 0/2] selftests: mlxsw: A couple of fixes patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Ido Schimmel @ 2022-03-02 16:14 UTC (permalink / raw)
  To: netdev; +Cc: davem, kuba, petrm, amcohen, danieller, mlxsw, Ido Schimmel

From: Amit Cohen <amcohen@nvidia.com>

The test adds tc filters and checks how many of them were offloaded by
grepping for 'in_hw'.

iproute2 commit f4cd4f127047 ("tc: add skip_hw and skip_sw to control
action offload") added offload indication to tc actions, producing the
following output:

 $ tc filter show dev swp2 ingress
 ...
 filter protocol ipv6 pref 1000 flower chain 0 handle 0x7c0
   eth_type ipv6
   dst_ip 2001:db8:1::7bf
   skip_sw
   in_hw in_hw_count 1
         action order 1:  police 0x7c0 rate 10Mbit burst 100Kb mtu 2Kb action drop overhead 0b
         ref 1 bind 1
         not_in_hw
         used_hw_stats immediate

The current grep expression matches on both 'in_hw' and 'not_in_hw',
resulting in incorrect results.

Fix that by using JSON output instead.

Fixes: 5061e773264b ("selftests: mlxsw: Add scale test for tc-police")
Signed-off-by: Amit Cohen <amcohen@nvidia.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
---
 tools/testing/selftests/drivers/net/mlxsw/tc_police_scale.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/drivers/net/mlxsw/tc_police_scale.sh b/tools/testing/selftests/drivers/net/mlxsw/tc_police_scale.sh
index 3e3e06ea5703..86e787895f78 100644
--- a/tools/testing/selftests/drivers/net/mlxsw/tc_police_scale.sh
+++ b/tools/testing/selftests/drivers/net/mlxsw/tc_police_scale.sh
@@ -60,7 +60,8 @@ __tc_police_test()
 
 	tc_police_rules_create $count $should_fail
 
-	offload_count=$(tc filter show dev $swp1 ingress | grep in_hw | wc -l)
+	offload_count=$(tc -j filter show dev $swp1 ingress |
+			jq "[.[] | select(.options.in_hw == true)] | length")
 	((offload_count == count))
 	check_err_fail $should_fail $? "tc police offload count"
 }
-- 
2.33.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH net 2/2] selftests: mlxsw: resource_scale: Fix return value
  2022-03-02 16:14 [PATCH net 0/2] selftests: mlxsw: A couple of fixes Ido Schimmel
  2022-03-02 16:14 ` [PATCH net 1/2] selftests: mlxsw: tc_police_scale: Make test more robust Ido Schimmel
@ 2022-03-02 16:14 ` Ido Schimmel
  2022-03-03 16:20 ` [PATCH net 0/2] selftests: mlxsw: A couple of fixes patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Ido Schimmel @ 2022-03-02 16:14 UTC (permalink / raw)
  To: netdev; +Cc: davem, kuba, petrm, amcohen, danieller, mlxsw, Ido Schimmel

From: Amit Cohen <amcohen@nvidia.com>

The test runs several test cases and is supposed to return an error in
case at least one of them failed.

Currently, the check of the return value of each test case is in the
wrong place, which can result in the wrong return value. For example:

 # TESTS='tc_police' ./resource_scale.sh
 TEST: 'tc_police' [default] 968                                     [FAIL]
         tc police offload count failed
 Error: mlxsw_spectrum: Failed to allocate policer index.
 We have an error talking to the kernel
 Command failed /tmp/tmp.i7Oc5HwmXY:969
 TEST: 'tc_police' [default] overflow 969                            [ OK ]
 ...
 TEST: 'tc_police' [ipv4_max] overflow 969                           [ OK ]

 $ echo $?
 0

Fix this by moving the check to be done after each test case.

Fixes: 059b18e21c63 ("selftests: mlxsw: Return correct error code in resource scale test")
Signed-off-by: Amit Cohen <amcohen@nvidia.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
---
 .../selftests/drivers/net/mlxsw/spectrum/resource_scale.sh      | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/drivers/net/mlxsw/spectrum/resource_scale.sh b/tools/testing/selftests/drivers/net/mlxsw/spectrum/resource_scale.sh
index bcb110e830ce..dea33dc93790 100755
--- a/tools/testing/selftests/drivers/net/mlxsw/spectrum/resource_scale.sh
+++ b/tools/testing/selftests/drivers/net/mlxsw/spectrum/resource_scale.sh
@@ -50,8 +50,8 @@ for current_test in ${TESTS:-$ALL_TESTS}; do
 			else
 				log_test "'$current_test' [$profile] overflow $target"
 			fi
+			RET_FIN=$(( RET_FIN || RET ))
 		done
-		RET_FIN=$(( RET_FIN || RET ))
 	done
 done
 current_test=""
-- 
2.33.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net 0/2] selftests: mlxsw: A couple of fixes
  2022-03-02 16:14 [PATCH net 0/2] selftests: mlxsw: A couple of fixes Ido Schimmel
  2022-03-02 16:14 ` [PATCH net 1/2] selftests: mlxsw: tc_police_scale: Make test more robust Ido Schimmel
  2022-03-02 16:14 ` [PATCH net 2/2] selftests: mlxsw: resource_scale: Fix return value Ido Schimmel
@ 2022-03-03 16:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-03-03 16:20 UTC (permalink / raw)
  To: Ido Schimmel; +Cc: netdev, davem, kuba, petrm, amcohen, danieller, mlxsw

Hello:

This series was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Wed,  2 Mar 2022 18:14:45 +0200 you wrote:
> Patch #1 fixes a breakage due to a change in iproute2 output. The real
> problem is not iproute2, but the fact that the check was not strict
> enough. Fixed by using JSON output instead. Targeting at net so that the
> test will pass as part of old and new kernels regardless of iproute2
> version.
> 
> Patch #2 fixes an issue uncovered by the first one.
> 
> [...]

Here is the summary with links:
  - [net,1/2] selftests: mlxsw: tc_police_scale: Make test more robust
    https://git.kernel.org/netdev/net/c/dc9752075341
  - [net,2/2] selftests: mlxsw: resource_scale: Fix return value
    https://git.kernel.org/netdev/net/c/196f9bc050cb

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-03-03 16:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-02 16:14 [PATCH net 0/2] selftests: mlxsw: A couple of fixes Ido Schimmel
2022-03-02 16:14 ` [PATCH net 1/2] selftests: mlxsw: tc_police_scale: Make test more robust Ido Schimmel
2022-03-02 16:14 ` [PATCH net 2/2] selftests: mlxsw: resource_scale: Fix return value Ido Schimmel
2022-03-03 16:20 ` [PATCH net 0/2] selftests: mlxsw: A couple of fixes patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.