* [PATCH net-next 0/2] selftests: Couple of fixes in Toeplitz RPS cases
@ 2026-01-11 17:16 Gal Pressman
2026-01-11 17:16 ` [PATCH net-next 1/2] selftests: drv-net: fix RPS mask handling in toeplitz test Gal Pressman
2026-01-11 17:16 ` [PATCH net-next 2/2] selftests: drv-net: fix RPS mask handling for high CPU numbers Gal Pressman
0 siblings, 2 replies; 8+ messages in thread
From: Gal Pressman @ 2026-01-11 17:16 UTC (permalink / raw)
To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Andrew Lunn, netdev
Cc: Shuah Khan, Willem de Bruijn, Petr Machata, Coco Li,
linux-kselftest, Gal Pressman
Fix a couple of bugs in the RPS cases of the Toeplitz selftest.
Gal Pressman (2):
selftests: drv-net: fix RPS mask handling in toeplitz test
selftests: drv-net: fix RPS mask handling for high CPU numbers
tools/testing/selftests/drivers/net/hw/toeplitz.c | 4 ++--
tools/testing/selftests/drivers/net/hw/toeplitz.py | 9 ++++++---
2 files changed, 8 insertions(+), 5 deletions(-)
--
2.40.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH net-next 1/2] selftests: drv-net: fix RPS mask handling in toeplitz test
2026-01-11 17:16 [PATCH net-next 0/2] selftests: Couple of fixes in Toeplitz RPS cases Gal Pressman
@ 2026-01-11 17:16 ` Gal Pressman
2026-01-12 3:43 ` Willem de Bruijn
2026-01-11 17:16 ` [PATCH net-next 2/2] selftests: drv-net: fix RPS mask handling for high CPU numbers Gal Pressman
1 sibling, 1 reply; 8+ messages in thread
From: Gal Pressman @ 2026-01-11 17:16 UTC (permalink / raw)
To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Andrew Lunn, netdev
Cc: Shuah Khan, Willem de Bruijn, Petr Machata, Coco Li,
linux-kselftest, Gal Pressman, Nimrod Oren
The toeplitz.py test passed the hex mask without "0x" prefix (e.g.,
"300" for CPUs 8,9). The toeplitz.c strtoul() call wrongly parsed this
as decimal 300 (0x12c) instead of hex 0x300.
Use separate format strings for sysfs (plain hex via format()) and
command line (prefixed hex via hex()).
Fixes: 9cf9aa77a1f6 ("selftests: drv-net: hw: convert the Toeplitz test to Python")
Reviewed-by: Nimrod Oren <noren@nvidia.com>
Signed-off-by: Gal Pressman <gal@nvidia.com>
---
tools/testing/selftests/drivers/net/hw/toeplitz.py | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/drivers/net/hw/toeplitz.py b/tools/testing/selftests/drivers/net/hw/toeplitz.py
index d2db5ee9e358..7a9af4af1838 100755
--- a/tools/testing/selftests/drivers/net/hw/toeplitz.py
+++ b/tools/testing/selftests/drivers/net/hw/toeplitz.py
@@ -94,14 +94,17 @@ def _configure_rps(cfg, rps_cpus):
mask = 0
for cpu in rps_cpus:
mask |= (1 << cpu)
- mask = hex(mask)[2:]
+
+ # sysfs expect hex without '0x' prefix, toeplitz.c needs the prefix
+ mask_sysfs = format(mask, 'x')
+ mask_cmdline = hex(mask)
# Set RPS bitmap for all rx queues
for rps_file in glob.glob(f"/sys/class/net/{cfg.ifname}/queues/rx-*/rps_cpus"):
with open(rps_file, "w", encoding="utf-8") as fp:
- fp.write(mask)
+ fp.write(mask_sysfs)
- return mask
+ return mask_cmdline
def _send_traffic(cfg, proto_flag, ipver, port):
--
2.40.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH net-next 2/2] selftests: drv-net: fix RPS mask handling for high CPU numbers
2026-01-11 17:16 [PATCH net-next 0/2] selftests: Couple of fixes in Toeplitz RPS cases Gal Pressman
2026-01-11 17:16 ` [PATCH net-next 1/2] selftests: drv-net: fix RPS mask handling in toeplitz test Gal Pressman
@ 2026-01-11 17:16 ` Gal Pressman
2026-01-12 3:29 ` Willem de Bruijn
1 sibling, 1 reply; 8+ messages in thread
From: Gal Pressman @ 2026-01-11 17:16 UTC (permalink / raw)
To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Andrew Lunn, netdev
Cc: Shuah Khan, Willem de Bruijn, Petr Machata, Coco Li,
linux-kselftest, Gal Pressman, Nimrod Oren
The RPS bitmask bounds check uses ~(RPS_MAX_CPUS - 1) which equals ~15 =
0xfff0, only allowing CPUs 0-3.
Change the mask to ~((1UL << RPS_MAX_CPUS) - 1) = ~0xffff to allow CPUs
0-15.
Fixes: 5ebfb4cc3048 ("selftests/net: toeplitz test")
Reviewed-by: Nimrod Oren <noren@nvidia.com>
Signed-off-by: Gal Pressman <gal@nvidia.com>
---
tools/testing/selftests/drivers/net/hw/toeplitz.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/drivers/net/hw/toeplitz.c b/tools/testing/selftests/drivers/net/hw/toeplitz.c
index d23b3b0c20a3..285bb17df9c2 100644
--- a/tools/testing/selftests/drivers/net/hw/toeplitz.c
+++ b/tools/testing/selftests/drivers/net/hw/toeplitz.c
@@ -485,8 +485,8 @@ static void parse_rps_bitmap(const char *arg)
bitmap = strtoul(arg, NULL, 0);
- if (bitmap & ~(RPS_MAX_CPUS - 1))
- error(1, 0, "rps bitmap 0x%lx out of bounds 0..%lu",
+ if (bitmap & ~((1UL << RPS_MAX_CPUS) - 1))
+ error(1, 0, "rps bitmap 0x%lx out of bounds, max cpu %lu",
bitmap, RPS_MAX_CPUS - 1);
for (i = 0; i < RPS_MAX_CPUS; i++)
--
2.40.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH net-next 2/2] selftests: drv-net: fix RPS mask handling for high CPU numbers
2026-01-11 17:16 ` [PATCH net-next 2/2] selftests: drv-net: fix RPS mask handling for high CPU numbers Gal Pressman
@ 2026-01-12 3:29 ` Willem de Bruijn
2026-01-12 6:51 ` Gal Pressman
0 siblings, 1 reply; 8+ messages in thread
From: Willem de Bruijn @ 2026-01-12 3:29 UTC (permalink / raw)
To: Gal Pressman, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Andrew Lunn, netdev
Cc: Shuah Khan, Willem de Bruijn, Petr Machata, Coco Li,
linux-kselftest, Gal Pressman, Nimrod Oren
Gal Pressman wrote:
> The RPS bitmask bounds check uses ~(RPS_MAX_CPUS - 1) which equals ~15 =
> 0xfff0, only allowing CPUs 0-3.
>
> Change the mask to ~((1UL << RPS_MAX_CPUS) - 1) = ~0xffff to allow CPUs
> 0-15.
>
> Fixes: 5ebfb4cc3048 ("selftests/net: toeplitz test")
> Reviewed-by: Nimrod Oren <noren@nvidia.com>
> Signed-off-by: Gal Pressman <gal@nvidia.com>
Should go to net instead of net-next?
Reviewed-by: Willem de Bruijn <willemb@google.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net-next 1/2] selftests: drv-net: fix RPS mask handling in toeplitz test
2026-01-11 17:16 ` [PATCH net-next 1/2] selftests: drv-net: fix RPS mask handling in toeplitz test Gal Pressman
@ 2026-01-12 3:43 ` Willem de Bruijn
2026-01-12 7:58 ` Gal Pressman
0 siblings, 1 reply; 8+ messages in thread
From: Willem de Bruijn @ 2026-01-12 3:43 UTC (permalink / raw)
To: Gal Pressman, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Andrew Lunn, netdev
Cc: Shuah Khan, Willem de Bruijn, Petr Machata, Coco Li,
linux-kselftest, Gal Pressman, Nimrod Oren
Gal Pressman wrote:
> The toeplitz.py test passed the hex mask without "0x" prefix (e.g.,
> "300" for CPUs 8,9). The toeplitz.c strtoul() call wrongly parsed this
> as decimal 300 (0x12c) instead of hex 0x300.
>
> Use separate format strings for sysfs (plain hex via format()) and
> command line (prefixed hex via hex()).
>
> Fixes: 9cf9aa77a1f6 ("selftests: drv-net: hw: convert the Toeplitz test to Python")
> Reviewed-by: Nimrod Oren <noren@nvidia.com>
> Signed-off-by: Gal Pressman <gal@nvidia.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
> ---
> tools/testing/selftests/drivers/net/hw/toeplitz.py | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/tools/testing/selftests/drivers/net/hw/toeplitz.py b/tools/testing/selftests/drivers/net/hw/toeplitz.py
> index d2db5ee9e358..7a9af4af1838 100755
> --- a/tools/testing/selftests/drivers/net/hw/toeplitz.py
> +++ b/tools/testing/selftests/drivers/net/hw/toeplitz.py
> @@ -94,14 +94,17 @@ def _configure_rps(cfg, rps_cpus):
> mask = 0
> for cpu in rps_cpus:
> mask |= (1 << cpu)
> - mask = hex(mask)[2:]
> +
> + # sysfs expect hex without '0x' prefix, toeplitz.c needs the prefix
> + mask_sysfs = format(mask, 'x')
A particular reason not to use the existing slicing?
> + mask_cmdline = hex(mask)
>
> # Set RPS bitmap for all rx queues
> for rps_file in glob.glob(f"/sys/class/net/{cfg.ifname}/queues/rx-*/rps_cpus"):
> with open(rps_file, "w", encoding="utf-8") as fp:
> - fp.write(mask)
> + fp.write(mask_sysfs)
Alternatively
- mask = hex(mask)[2:]
+ mask = hex(mask)
- fp.write(mask)
+ fp.write(mask[2:])
The comment that sysfs and toeplitz.c expect different input is
definitely helpful.
>
> - return mask
> + return mask_cmdline
>
>
> def _send_traffic(cfg, proto_flag, ipver, port):
> --
> 2.40.1
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net-next 2/2] selftests: drv-net: fix RPS mask handling for high CPU numbers
2026-01-12 3:29 ` Willem de Bruijn
@ 2026-01-12 6:51 ` Gal Pressman
2026-01-12 16:06 ` Willem de Bruijn
0 siblings, 1 reply; 8+ messages in thread
From: Gal Pressman @ 2026-01-12 6:51 UTC (permalink / raw)
To: Willem de Bruijn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Andrew Lunn, netdev
Cc: Shuah Khan, Willem de Bruijn, Petr Machata, Coco Li,
linux-kselftest, Nimrod Oren
On 12/01/2026 5:29, Willem de Bruijn wrote:
> Gal Pressman wrote:
>> The RPS bitmask bounds check uses ~(RPS_MAX_CPUS - 1) which equals ~15 =
>> 0xfff0, only allowing CPUs 0-3.
>>
>> Change the mask to ~((1UL << RPS_MAX_CPUS) - 1) = ~0xffff to allow CPUs
>> 0-15.
>>
>> Fixes: 5ebfb4cc3048 ("selftests/net: toeplitz test")
>> Reviewed-by: Nimrod Oren <noren@nvidia.com>
>> Signed-off-by: Gal Pressman <gal@nvidia.com>
>
> Should go to net instead of net-next?
>
> Reviewed-by: Willem de Bruijn <willemb@google.com>
I usually send tests bug fixes to net-next, since it doesn't fix a bug
in the kernel.
Should I send those to net instead?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net-next 1/2] selftests: drv-net: fix RPS mask handling in toeplitz test
2026-01-12 3:43 ` Willem de Bruijn
@ 2026-01-12 7:58 ` Gal Pressman
0 siblings, 0 replies; 8+ messages in thread
From: Gal Pressman @ 2026-01-12 7:58 UTC (permalink / raw)
To: Willem de Bruijn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Andrew Lunn, netdev
Cc: Shuah Khan, Willem de Bruijn, Petr Machata, Coco Li,
linux-kselftest, Nimrod Oren
On 12/01/2026 5:43, Willem de Bruijn wrote:
> Gal Pressman wrote:
>> The toeplitz.py test passed the hex mask without "0x" prefix (e.g.,
>> "300" for CPUs 8,9). The toeplitz.c strtoul() call wrongly parsed this
>> as decimal 300 (0x12c) instead of hex 0x300.
>>
>> Use separate format strings for sysfs (plain hex via format()) and
>> command line (prefixed hex via hex()).
>>
>> Fixes: 9cf9aa77a1f6 ("selftests: drv-net: hw: convert the Toeplitz test to Python")
>> Reviewed-by: Nimrod Oren <noren@nvidia.com>
>> Signed-off-by: Gal Pressman <gal@nvidia.com>
>
> Reviewed-by: Willem de Bruijn <willemb@google.com>
>
>> ---
>> tools/testing/selftests/drivers/net/hw/toeplitz.py | 9 ++++++---
>> 1 file changed, 6 insertions(+), 3 deletions(-)
>>
>> diff --git a/tools/testing/selftests/drivers/net/hw/toeplitz.py b/tools/testing/selftests/drivers/net/hw/toeplitz.py
>> index d2db5ee9e358..7a9af4af1838 100755
>> --- a/tools/testing/selftests/drivers/net/hw/toeplitz.py
>> +++ b/tools/testing/selftests/drivers/net/hw/toeplitz.py
>> @@ -94,14 +94,17 @@ def _configure_rps(cfg, rps_cpus):
>> mask = 0
>> for cpu in rps_cpus:
>> mask |= (1 << cpu)
>> - mask = hex(mask)[2:]
>> +
>> + # sysfs expect hex without '0x' prefix, toeplitz.c needs the prefix
>> + mask_sysfs = format(mask, 'x')
>
> A particular reason not to use the existing slicing?
>
>> + mask_cmdline = hex(mask)
>>
>> # Set RPS bitmap for all rx queues
>> for rps_file in glob.glob(f"/sys/class/net/{cfg.ifname}/queues/rx-*/rps_cpus"):
>> with open(rps_file, "w", encoding="utf-8") as fp:
>> - fp.write(mask)
>> + fp.write(mask_sysfs)
>
> Alternatively
>
> - mask = hex(mask)[2:]
> + mask = hex(mask)
>
> - fp.write(mask)
> + fp.write(mask[2:])
>
> The comment that sysfs and toeplitz.c expect different input is
> definitely helpful.
Will take your suggestion, thanks.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net-next 2/2] selftests: drv-net: fix RPS mask handling for high CPU numbers
2026-01-12 6:51 ` Gal Pressman
@ 2026-01-12 16:06 ` Willem de Bruijn
0 siblings, 0 replies; 8+ messages in thread
From: Willem de Bruijn @ 2026-01-12 16:06 UTC (permalink / raw)
To: Gal Pressman, Willem de Bruijn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Andrew Lunn, netdev
Cc: Shuah Khan, Willem de Bruijn, Petr Machata, Coco Li,
linux-kselftest, Nimrod Oren
Gal Pressman wrote:
> On 12/01/2026 5:29, Willem de Bruijn wrote:
> > Gal Pressman wrote:
> >> The RPS bitmask bounds check uses ~(RPS_MAX_CPUS - 1) which equals ~15 =
> >> 0xfff0, only allowing CPUs 0-3.
> >>
> >> Change the mask to ~((1UL << RPS_MAX_CPUS) - 1) = ~0xffff to allow CPUs
> >> 0-15.
> >>
> >> Fixes: 5ebfb4cc3048 ("selftests/net: toeplitz test")
> >> Reviewed-by: Nimrod Oren <noren@nvidia.com>
> >> Signed-off-by: Gal Pressman <gal@nvidia.com>
> >
> > Should go to net instead of net-next?
> >
> > Reviewed-by: Willem de Bruijn <willemb@google.com>
>
> I usually send tests bug fixes to net-next, since it doesn't fix a bug
> in the kernel.
>
> Should I send those to net instead?
I'm not aware of a separate policy for tests. Not sure if maintainers
have a preference. Probably behavior on this is a bit inconsistent
anyway.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2026-01-12 16:06 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-11 17:16 [PATCH net-next 0/2] selftests: Couple of fixes in Toeplitz RPS cases Gal Pressman
2026-01-11 17:16 ` [PATCH net-next 1/2] selftests: drv-net: fix RPS mask handling in toeplitz test Gal Pressman
2026-01-12 3:43 ` Willem de Bruijn
2026-01-12 7:58 ` Gal Pressman
2026-01-11 17:16 ` [PATCH net-next 2/2] selftests: drv-net: fix RPS mask handling for high CPU numbers Gal Pressman
2026-01-12 3:29 ` Willem de Bruijn
2026-01-12 6:51 ` Gal Pressman
2026-01-12 16:06 ` Willem de Bruijn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox