Skip to contentSkip to conversation

selftests: net: fix rps_default_mask with >32 CPUs

PATCH Applied Jakub Kicinski 3 participants 3 messages Jan 22, 2024 – Jan 24, 2024

Subsystems (3)
lore
Share & tools
lore

Jakub Kicinski

author maintainer
#0 lore raw

PATCH v3 1/1 selftests: net: fix rps_default_mask with >32 CPUs

If there is more than 32 cpus the bitmask will start to contain commas, leading to:

./rps_default_mask.sh: line 36: [: 00000000,00000000: integer expression expected

Remove the commas, bash doesn't interpret leading zeroes as oct so that should be good enough. Switch to bash, Simon reports that not all shells support this type of substitution.

Fixes c12e0d5f267d ("self-tests: introduce self-tests for RPS default mask")

---
v3:
- switch to bash
v2: https://lore.kernel.org/all/[email protected]/
- remove all commas
v1: https://lore.kernel.org/all/[email protected]/

---
 tools/testing/selftests/net/rps_default_mask.sh | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
tools/testing/selftests/net/rps_default_mask.sh +5 -1
index a26c5624429f..4287a8529890 100755
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 # SPDX-License-Identifier: GPL-2.0
 
 readonly ksft_skip=4
@@ -33,6 +33,10 @@ chk_rps() {
 
 	rps_mask=$($cmd /sys/class/net/$dev_name/queues/rx-0/rps_cpus)
 	printf "%-60s" "$msg"
+
+	# In case there is more than 32 CPUs we need to remove commas from masks
+	rps_mask=${rps_mask//,}
+	expected_rps_mask=${expected_rps_mask//,}
 	if [ $rps_mask -eq $expected_rps_mask ]; then
 		echo "[ ok ]"
 	else
Signature · 1 line
2.43.0
reviewer Reviewed-by on v3 1/1
#1 lore raw
Quoted 11 lines · Jakub Kicinski

If there is more than 32 cpus the bitmask will start to contain commas, leading to:

./rps_default_mask.sh: line 36: [: 00000000,00000000: integer expression expected

Remove the commas, bash doesn't interpret leading zeroes as oct so that should be good enough. Switch to bash, Simon reports that not all shells support this type of substitution.

Fixes c12e0d5f267d ("self-tests: introduce self-tests for RPS default mask")
#2 lore raw
In reply to Jakub Kicinski
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 10 lines · On Mon, 22 Jan 2024 11:58:15 -0800 you wrote:

If there is more than 32 cpus the bitmask will start to contain commas, leading to:

./rps_default_mask.sh: line 36: [: 00000000,00000000: integer expression expected

Remove the commas, bash doesn't interpret leading zeroes as oct so that should be good enough. Switch to bash, Simon reports that not all shells support this type of substitution.

[...]

Here is the summary with links:
- [net,v3] selftests: net: fix rps_default_mask with >32 CPUs

    https://git.kernel.org/netdev/net/c/0719b5338a0c

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html