From: Jakub Kicinski <kuba@kernel.org>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com,
andrew+netdev@lunn.ch, horms@kernel.org, shuah@kernel.org,
almasrymina@google.com, sdf@fomichev.me, joe@dama.to,
linux-kselftest@vger.kernel.org, Jakub Kicinski <kuba@kernel.org>
Subject: [PATCH net-next v2 3/5] selftests: drv-net: ncdevmem: restore old channel config
Date: Mon, 25 Aug 2025 11:04:45 -0700 [thread overview]
Message-ID: <20250825180447.2252977-4-kuba@kernel.org> (raw)
In-Reply-To: <20250825180447.2252977-1-kuba@kernel.org>
In case changing channel count with provider bound succeeds
unexpectedly - make sure we return to original settings.
Acked-by: Stanislav Fomichev <sdf@fomichev.me>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
.../selftests/drivers/net/hw/ncdevmem.c | 34 ++++++++++++-------
1 file changed, 22 insertions(+), 12 deletions(-)
diff --git a/tools/testing/selftests/drivers/net/hw/ncdevmem.c b/tools/testing/selftests/drivers/net/hw/ncdevmem.c
index 8d9d579834b1..580b4459a840 100644
--- a/tools/testing/selftests/drivers/net/hw/ncdevmem.c
+++ b/tools/testing/selftests/drivers/net/hw/ncdevmem.c
@@ -469,7 +469,7 @@ static void reset_rss(void)
run_command("ethtool -X %s default >&2", ifname, start_queue);
}
-static int configure_channels(unsigned int rx, unsigned int tx)
+static int check_changing_channels(unsigned int rx, unsigned int tx)
{
struct ethtool_channels_get_req *gchan;
struct ethtool_channels_set_req *schan;
@@ -525,20 +525,32 @@ static int configure_channels(unsigned int rx, unsigned int tx)
ethtool_channels_set_req_set_tx_count(schan, tx - rx);
}
- ret = ethtool_channels_set(ys, schan);
- if (ret)
- fprintf(stderr, "YNL set channels: %s\n", ys->err.msg);
} else if (chan->_present.rx_count) {
ethtool_channels_set_req_set_rx_count(schan, rx);
ethtool_channels_set_req_set_tx_count(schan, tx);
-
- ret = ethtool_channels_set(ys, schan);
- if (ret)
- fprintf(stderr, "YNL set channels: %s\n", ys->err.msg);
} else {
fprintf(stderr, "Error: device has neither combined nor rx channels\n");
ret = -1;
+ goto exit_free_schan;
}
+
+ ret = ethtool_channels_set(ys, schan);
+ if (ret) {
+ fprintf(stderr, "YNL set channels: %s\n", ys->err.msg);
+ } else {
+ /* We were expecting a failure, go back to previous settings */
+ ethtool_channels_set_req_set_combined_count(schan,
+ chan->combined_count);
+ ethtool_channels_set_req_set_rx_count(schan, chan->rx_count);
+ ethtool_channels_set_req_set_tx_count(schan, chan->tx_count);
+
+ ret = ethtool_channels_set(ys, schan);
+ if (ret)
+ fprintf(stderr, "YNL un-setting channels: %s\n",
+ ys->err.msg);
+ }
+
+exit_free_schan:
ethtool_channels_set_req_free(schan);
exit_free_chan:
ethtool_channels_get_rsp_free(chan);
@@ -1019,16 +1031,14 @@ int run_devmem_tests(void)
}
/* Deactivating a bound queue should not be legal */
- if (!configure_channels(num_queues, num_queues)) {
+ if (!check_changing_channels(num_queues, num_queues)) {
pr_err("Deactivating a bound queue should be illegal");
- goto err_reset_channels;
+ goto err_unbind;
}
err = 0;
goto err_unbind;
-err_reset_channels:
- /* TODO */
err_unbind:
ynl_sock_destroy(ys);
err_reset_headersplit:
--
2.51.0
next prev parent reply other threads:[~2025-08-25 18:04 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-25 18:04 [PATCH net-next v2 0/5] selftests: drv-net: ncdevmem: fix error paths Jakub Kicinski
2025-08-25 18:04 ` [PATCH net-next v2 1/5] selftests: drv-net: ncdevmem: remove use of error() Jakub Kicinski
2025-08-25 18:04 ` [PATCH net-next v2 2/5] selftests: drv-net: ncdevmem: save IDs of flow rules we added Jakub Kicinski
2025-08-25 18:04 ` Jakub Kicinski [this message]
2025-08-25 18:04 ` [PATCH net-next v2 4/5] selftests: drv-net: ncdevmem: restore original HDS setting before exiting Jakub Kicinski
2025-08-25 19:53 ` Stanislav Fomichev
2025-08-25 18:04 ` [PATCH net-next v2 5/5] selftests: drv-net: ncdevmem: explicitly set HDS threshold to 0 Jakub Kicinski
2025-08-25 19:54 ` Stanislav Fomichev
2025-08-27 1:00 ` [PATCH net-next v2 0/5] selftests: drv-net: ncdevmem: fix error paths patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250825180447.2252977-4-kuba@kernel.org \
--to=kuba@kernel.org \
--cc=almasrymina@google.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=joe@dama.to \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sdf@fomichev.me \
--cc=shuah@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.