| da87caba | 24-Feb-2025 |
Gal Pressman <[email protected]> |
selftests: drv-net-hw: Add a test for symmetric RSS hash
Add a selftest that verifies symmetric RSS hash is working as intended. The test runs iterations of traffic, swapping the src/dst UDP ports,
selftests: drv-net-hw: Add a test for symmetric RSS hash
Add a selftest that verifies symmetric RSS hash is working as intended. The test runs iterations of traffic, swapping the src/dst UDP ports, and verifies that the same RX queue is receiving the traffic in both cases.
Reviewed-by: Nimrod Oren <[email protected]> Signed-off-by: Gal Pressman <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
show more ...
|
| 4fde8398 | 19-Feb-2025 |
Jakub Kicinski <[email protected]> |
selftests: drv-net: improve the use of ksft helpers in XSK queue test
Avoid exceptions when xsk attr is not present, and add a proper ksft helper for "not in" condition.
Acked-by: Stanislav Fomiche
selftests: drv-net: improve the use of ksft helpers in XSK queue test
Avoid exceptions when xsk attr is not present, and add a proper ksft helper for "not in" condition.
Acked-by: Stanislav Fomichev <[email protected]> Reviewed-by: Joe Damato <[email protected]> Tested-by: Kurt Kanzenbach <[email protected]> Tested-by: Joe Damato <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
show more ...
|
| a6e263f1 | 17-Oct-2024 |
Petr Machata <[email protected]> |
selftests: net: lib: Introduce deferred commands
In commit 8510801a9dbd ("selftests: drv-net: add ability to schedule cleanup with defer()"), a defer helper was added to Python selftests. The idea i
selftests: net: lib: Introduce deferred commands
In commit 8510801a9dbd ("selftests: drv-net: add ability to schedule cleanup with defer()"), a defer helper was added to Python selftests. The idea is to keep cleanup commands close to their dirtying counterparts, thereby making it more transparent what is cleaning up what, making it harder to miss a cleanup, and make the whole cleanup business exception safe. All these benefits are applicable to bash as well, exception safety can be interpreted in terms of safety vs. a SIGINT.
This patch therefore introduces a framework of several helpers that serve to schedule cleanups in bash selftests:
- defer_scope_push(), defer_scope_pop(): Deferred statements can be batched together in scopes. When a scope is popped, the deferred commands scheduled in that scope are executed in the order opposite to order of their scheduling.
- defer(): Schedules a defer to the most recently pushed scope (or the default scope if none was pushed.)
- defer_prio(): Schedules a defer on the priority track. The priority defer queue is run before the default defer queue when scope is popped.
The issue that this is addressing is specifically the one of restoring devlink shared buffer threshold type. When setting up static thresholds, one has to first change the threshold type to static, then override the individual thresholds. When cleaning up, it would be natural to reset the threshold values first, then change the threshold type. But the values that are valid for dynamic thresholds are generally invalid for static thresholds and vice versa. Attempts to restore the values first would be bounced. Thus one has to first reset the threshold type, then adjust the thresholds.
(You could argue that the shared buffer threshold type API is broken and you would be right, but here we are.)
This cannot be solved by pure defers easily. I considered making it possible to disable an existing defer, so that one could then schedule a new defer and disable the original. But this forward-shifting of the defer job would have to take place after every threshold-adjusting command, which would make it very awkward to schedule these jobs.
- defer_scopes_cleanup(): Pops any unpopped scopes, including the default one. The selftests that use defer should run this in their exit trap. This is important to get cleanups of interrupted scripts.
- in_defer_scope(): Sometimes a function would like to introduce a new defer scope, then run whatever it is that it wants to run, and then pop the scope to run the deferred cleanups. The helper in_defer_scope() can be used to run another command within such environment, such that any scheduled defers run after the command finishes.
The framework is added as a separate file lib/sh/defer.sh so that it can be used by all bash selftests, including those that do not currently use lib.sh. lib.sh however includes the file by default, because ideally all tests would use these helpers instead of hand-rolling their cleanups.
Signed-off-by: Petr Machata <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
show more ...
|
| 46619175 | 01-Aug-2024 |
Jakub Kicinski <[email protected]> |
selftests: net: ksft: print more of the stack for checks
Print more stack frames and the failing line when check fails. This helps when tests use helpers to do the checks.
Before:
# At ./ksft/dr
selftests: net: ksft: print more of the stack for checks
Print more stack frames and the failing line when check fails. This helps when tests use helpers to do the checks.
Before:
# At ./ksft/drivers/net/hw/rss_ctx.py line 92: # Check failed 1037698 >= 396893.0 traffic on other queues:[344612, 462380, 233020, 449174, 342298] not ok 8 rss_ctx.test_rss_context_queue_reconfigure
After:
# Check| At ./ksft/drivers/net/hw/rss_ctx.py, line 387, in test_rss_context_queue_reconfigure: # Check| test_rss_queue_reconfigure(cfg, main_ctx=False) # Check| At ./ksft/drivers/net/hw/rss_ctx.py, line 230, in test_rss_queue_reconfigure: # Check| _send_traffic_check(cfg, port, ctx_ref, { 'target': (0, 3), # Check| At ./ksft/drivers/net/hw/rss_ctx.py, line 92, in _send_traffic_check: # Check| ksft_lt(sum(cnts[i] for i in params['noise']), directed / 2, # Check failed 1045235 >= 405823.5 traffic on other queues (context 1)':[460068, 351995, 565970, 351579, 127270] not ok 8 rss_ctx.test_rss_context_queue_reconfigure
Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
show more ...
|
| 8510801a | 27-Jun-2024 |
Jakub Kicinski <[email protected]> |
selftests: drv-net: add ability to schedule cleanup with defer()
This implements what I was describing in [1]. When writing a test author can schedule cleanup / undo actions right after the creation
selftests: drv-net: add ability to schedule cleanup with defer()
This implements what I was describing in [1]. When writing a test author can schedule cleanup / undo actions right after the creation completes, eg:
cmd("touch /tmp/file") defer(cmd, "rm /tmp/file")
defer() takes the function name as first argument, and the rest are arguments for that function. defer()red functions are called in inverse order after test exits. It's also possible to capture them and execute earlier (in which case they get automatically de-queued).
undo = defer(cmd, "rm /tmp/file") # ... some unsafe code ... undo.exec()
As a nice safety all exceptions from defer()ed calls are captured, printed, and ignored (they do make the test fail, however). This addresses the common problem of exceptions in cleanup paths often being unhandled, leading to potential leaks.
There is a global action queue, flushed by ksft_run(). We could support function level defers too, I guess, but there's no immediate need..
Link: https://lore.kernel.org/all/[email protected]/ # [1] Reviewed-by: Przemek Kitszel <[email protected]> Reviewed-by: Petr Machata <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
show more ...
|