diff options
author | Stanislav Fomichev <[email protected]> | 2024-11-07 10:12:06 -0800 |
---|---|---|
committer | Jakub Kicinski <[email protected]> | 2024-11-11 17:01:04 -0800 |
commit | e3c09623a53b8d11ff9e3c0f435ce1e8f52134ba (patch) | |
tree | 5a8e694f92964baddb37aa83642c43ec64c66d60 | |
parent | 933056357a8cf0c9b3fb2ecc4d2d8d142614f0a3 (diff) |
selftests: ncdevmem: Properly reset flow steering
ntuple off/on might be not enough to do it on all NICs.
Add a bunch of shell crap to explicitly remove the rules.
Reviewed-by: Mina Almasry <[email protected]>
Reviewed-by: Joe Damato <[email protected]>
Signed-off-by: Stanislav Fomichev <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
-rw-r--r-- | tools/testing/selftests/net/ncdevmem.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/tools/testing/selftests/net/ncdevmem.c b/tools/testing/selftests/net/ncdevmem.c index 645ef0bb63ec..ad6de8e0e97b 100644 --- a/tools/testing/selftests/net/ncdevmem.c +++ b/tools/testing/selftests/net/ncdevmem.c @@ -217,13 +217,18 @@ void validate_buffer(void *line, size_t size) static int reset_flow_steering(void) { - int ret = 0; - - ret = run_command("sudo ethtool -K %s ntuple off >&2", ifname); - if (ret) - return ret; - - return run_command("sudo ethtool -K %s ntuple on >&2", ifname); + /* Depending on the NIC, toggling ntuple off and on might not + * be allowed. Additionally, attempting to delete existing filters + * will fail if no filters are present. Therefore, do not enforce + * the exit status. + */ + + run_command("sudo ethtool -K %s ntuple off >&2", ifname); + run_command("sudo ethtool -K %s ntuple on >&2", ifname); + run_command( + "sudo ethtool -n %s | grep 'Filter:' | awk '{print $2}' | xargs -n1 ethtool -N %s delete >&2", + ifname, ifname); + return 0; } static int configure_headersplit(bool on) |