From: Stanislav Fomichev <stfomichev@gmail.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: davem@davemloft.net, netdev@vger.kernel.org, edumazet@google.com,
pabeni@redhat.com, andrew+netdev@lunn.ch, horms@kernel.org,
almasrymina@google.com, sdf@fomichev.me, joe@dama.to,
linux-kselftest@vger.kernel.org
Subject: Re: [PATCH net-next 4/4] selftests: drv-net: ncdevmem: configure and restore HDS threshold
Date: Fri, 22 Aug 2025 15:26:37 -0700 [thread overview]
Message-ID: <aKjunRT-rmsd8tLH@mini-arch> (raw)
In-Reply-To: <20250822200052.1675613-5-kuba@kernel.org>
On 08/22, Jakub Kicinski wrote:
> Improve HDS handling. Make sure we set threshold to 0.
> Restore the previous settings before exiting.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> .../selftests/drivers/net/hw/ncdevmem.c | 96 +++++++++++++++++--
> 1 file changed, 87 insertions(+), 9 deletions(-)
>
> diff --git a/tools/testing/selftests/drivers/net/hw/ncdevmem.c b/tools/testing/selftests/drivers/net/hw/ncdevmem.c
> index 580b4459a840..aa2904d1a3e1 100644
> --- a/tools/testing/selftests/drivers/net/hw/ncdevmem.c
> +++ b/tools/testing/selftests/drivers/net/hw/ncdevmem.c
> @@ -419,6 +419,60 @@ static const char *tcp_data_split_str(int val)
> }
> }
>
> +static struct ethtool_rings_get_rsp *get_ring_config(void)
> +{
> + struct ethtool_rings_get_req *get_req;
> + struct ethtool_rings_get_rsp *get_rsp;
> + struct ynl_error yerr;
> + struct ynl_sock *ys;
> +
> + ys = ynl_sock_create(&ynl_ethtool_family, &yerr);
> + if (!ys) {
> + fprintf(stderr, "YNL: %s\n", yerr.msg);
> + return NULL;
> + }
> +
> + get_req = ethtool_rings_get_req_alloc();
> + ethtool_rings_get_req_set_header_dev_index(get_req, ifindex);
> + get_rsp = ethtool_rings_get(ys, get_req);
> + ethtool_rings_get_req_free(get_req);
> +
> + ynl_sock_destroy(ys);
> +
> + return get_rsp;
> +}
> +
> +static void restore_ring_config(const struct ethtool_rings_get_rsp *config)
> +{
> + struct ethtool_rings_set_req *req;
> + struct ynl_error yerr;
> + struct ynl_sock *ys;
> + int ret;
> +
> + if (!config)
> + return;
> +
> + ys = ynl_sock_create(&ynl_ethtool_family, &yerr);
> + if (!ys) {
> + fprintf(stderr, "YNL: %s\n", yerr.msg);
> + return;
> + }
> +
> + req = ethtool_rings_set_req_alloc();
> + ethtool_rings_set_req_set_header_dev_index(req, ifindex);
> + ethtool_rings_set_req_set_tcp_data_split(req,
> + ETHTOOL_TCP_DATA_SPLIT_UNKNOWN);
> + if (config->_present.hds_thresh)
> + ethtool_rings_set_req_set_hds_thresh(req, config->hds_thresh);
> +
> + ret = ethtool_rings_set(ys, req);
> + if (ret < 0)
> + fprintf(stderr, "YNL failed: %s\n", ys->err.msg);
> + ethtool_rings_set_req_free(req);
> +
> + ynl_sock_destroy(ys);
> +}
> +
> static int configure_headersplit(bool on)
> {
> struct ethtool_rings_get_req *get_req;
> @@ -436,8 +490,14 @@ static int configure_headersplit(bool on)
>
> req = ethtool_rings_set_req_alloc();
> ethtool_rings_set_req_set_header_dev_index(req, ifindex);
> - /* 0 - off, 1 - auto, 2 - on */
> - ethtool_rings_set_req_set_tcp_data_split(req, on ? 2 : 0);
> + if (on) {
> + ethtool_rings_set_req_set_tcp_data_split(req,
> + ETHTOOL_TCP_DATA_SPLIT_ENABLED);
> + ethtool_rings_set_req_set_hds_thresh(req, 0);
From talking to Taehee awhile ago it seemed like unconditionally
setting 0 will fail on the devices that don't support it.
Is it not the case anymore with ethnl_set_rings_validate?
next prev parent reply other threads:[~2025-08-22 22:26 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-22 20:00 [PATCH net-next 0/4] selftests: drv-net: ncdevmem: fix error paths Jakub Kicinski
2025-08-22 20:00 ` [PATCH net-next 1/4] selftests: drv-net: ncdevmem: remove use of error() Jakub Kicinski
2025-08-22 21:25 ` Stanislav Fomichev
2025-08-22 20:00 ` [PATCH net-next 2/4] selftests: drv-net: ncdevmem: save IDs of flow rules we added Jakub Kicinski
2025-08-22 21:27 ` Stanislav Fomichev
2025-08-22 22:15 ` Jakub Kicinski
2025-08-22 20:00 ` [PATCH net-next 3/4] selftests: drv-net: ncdevmem: restore old channel config Jakub Kicinski
2025-08-22 22:14 ` Stanislav Fomichev
2025-08-22 20:00 ` [PATCH net-next 4/4] selftests: drv-net: ncdevmem: configure and restore HDS threshold Jakub Kicinski
2025-08-22 22:26 ` Stanislav Fomichev [this message]
2025-08-22 22:34 ` Jakub Kicinski
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=aKjunRT-rmsd8tLH@mini-arch \
--to=stfomichev@gmail.com \
--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=kuba@kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sdf@fomichev.me \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).