Skip to contentSkip to conversation

selftests: devmem: configure HDS threshold

PATCH In review Taehee Yoo 4 participants 8 messages Jul 2, 2025 – Jul 7, 2025

Subsystems (3)
lore
Share & tools
lore

Taehee Yoo

author
#0 lore raw

PATCH v2 1/1 selftests: devmem: configure HDS threshold

The devmem TCP requires the hds-thresh value to be 0, but it doesn't change it automatically.
Therefore, make configure_headersplit() sets hds-thresh value to 0.

---

v2:
- Do not implement configure_hds_thresh().
- Make configure_headersplit() sets hds-thresh to 0.

 tools/testing/selftests/drivers/net/hw/ncdevmem.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
tools/testing/selftests/drivers/net/hw/ncdevmem.c +10 -1
index cc9b40d9c5d5..52b72de11e3b 100644
@@ -331,6 +331,12 @@ static int configure_headersplit(bool on)
 	ret = ethtool_rings_set(ys, req);
 	if (ret < 0)
 		fprintf(stderr, "YNL failed: %s\n", ys->err.msg);
+	if (on) {
+		ethtool_rings_set_req_set_hds_thresh(req, 0);
+		ret = ethtool_rings_set(ys, req);
+		if (ret < 0)
+			fprintf(stderr, "YNL failed: %s\n", ys->err.msg);
+	}
 	ethtool_rings_set_req_free(req);
 
 	if (ret == 0) {
@@ -338,9 +344,12 @@ static int configure_headersplit(bool on)
 		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);
-		if (get_rsp)
+		if (get_rsp) {
 			fprintf(stderr, "TCP header split: %s\n",
 				tcp_data_split_str(get_rsp->tcp_data_split));
+			fprintf(stderr, "HDS threshold: %u\n",
+				get_rsp->hds_thresh);
+		}
 		ethtool_rings_get_rsp_free(get_rsp);
 	}
 
Signature · 1 line
2.34.1
#1 lore raw
Quoted 19 lines · Taehee Yoo

The devmem TCP requires the hds-thresh value to be 0, but it doesn't change it automatically.
Therefore, make configure_headersplit() sets hds-thresh value to 0.

---

v2:
- Do not implement configure_hds_thresh().
- Make configure_headersplit() sets hds-thresh to 0.

 tools/testing/selftests/drivers/net/hw/ncdevmem.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
tools/testing/selftests/drivers/net/hw/ncdevmem.c +0 -0
index cc9b40d9c5d5..52b72de11e3b 100644

tools/testing/selftests/drivers/net/hw/ncdevmem.c static int configure_headersplit(bool on) · line 336

Quoted 6 lines
tools/testing/selftests/drivers/net/hw/ncdevmem.c +3 -0
@@ -331,6 +331,12 @@ static int configure_headersplit(bool on)
 	ret = ethtool_rings_set(ys, req);
 	if (ret < 0)
 		fprintf(stderr, "YNL failed: %s\n", ys->err.msg);
+	if (on) {
+		ethtool_rings_set_req_set_hds_thresh(req, 0);
+		ret = ethtool_rings_set(ys, req);

Why call ethtool_rings_set again here? Can we move ethtool_rings_set_req_set_hds_thresh to be after ethtool_rings_set_req_set_tcp_data_split ?

author
#2 lore raw
Quoted 1 line · Stanislav Fomichev

Hi Stanislav,
Thanks a lot for your review!

Quoted 15 lines · Taehee Yoo
Quoted 14 lines

The devmem TCP requires the hds-thresh value to be 0, but it doesn't change it automatically.
Therefore, make configure_headersplit() sets hds-thresh value to 0.

---

v2:
- Do not implement configure_hds_thresh().
- Make configure_headersplit() sets hds-thresh to 0.

 tools/testing/selftests/drivers/net/hw/ncdevmem.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
Quoted 14 lines

tools/testing/selftests/drivers/net/hw/ncdevmem.c static int configure_headersplit(bool on) · line 336

Quoted 11 lines
tools/testing/selftests/drivers/net/hw/ncdevmem.c +3 -0
index cc9b40d9c5d5..52b72de11e3b 100644
@@ -331,6 +331,12 @@ static int configure_headersplit(bool on)
      ret = ethtool_rings_set(ys, req);
      if (ret < 0)
              fprintf(stderr, "YNL failed: %s\n", ys->err.msg);
+     if (on) {
+             ethtool_rings_set_req_set_hds_thresh(req, 0);
+             ret = ethtool_rings_set(ys, req);

Why call ethtool_rings_set again here? Can we move ethtool_rings_set_req_set_hds_thresh to be after ethtool_rings_set_req_set_tcp_data_split ?

I think tcp-data-split will fail if a driver doesn't support hds-thresh, even if it supports tcp-data-split. So, I separated them.

#3 lore raw
Quoted 36 lines · Taehee Yoo
Quoted 1 line · Stanislav Fomichev

Hi Stanislav,
Thanks a lot for your review!

Quoted 15 lines · Taehee Yoo
Quoted 14 lines

The devmem TCP requires the hds-thresh value to be 0, but it doesn't change it automatically.
Therefore, make configure_headersplit() sets hds-thresh value to 0.

---

v2:
- Do not implement configure_hds_thresh().
- Make configure_headersplit() sets hds-thresh to 0.

 tools/testing/selftests/drivers/net/hw/ncdevmem.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
Quoted 14 lines

tools/testing/selftests/drivers/net/hw/ncdevmem.c static int configure_headersplit(bool on) · line 336

Quoted 11 lines
tools/testing/selftests/drivers/net/hw/ncdevmem.c +3 -0
index cc9b40d9c5d5..52b72de11e3b 100644
@@ -331,6 +331,12 @@ static int configure_headersplit(bool on)
      ret = ethtool_rings_set(ys, req);
      if (ret < 0)
              fprintf(stderr, "YNL failed: %s\n", ys->err.msg);
+     if (on) {
+             ethtool_rings_set_req_set_hds_thresh(req, 0);
+             ret = ethtool_rings_set(ys, req);

Why call ethtool_rings_set again here? Can we move ethtool_rings_set_req_set_hds_thresh to be after ethtool_rings_set_req_set_tcp_data_split ?

Quoted 3 lines

I think tcp-data-split will fail if a driver doesn't support hds-thresh, even if it supports tcp-data-split. So, I separated them.

Sorry for going back and forth on this, but in this case your v1 is better (maybe improve it by not printing an error for 'not supported' errno). And will probably better be suited for Jakub's suggestion of adding undo.

maintainer
#4 lore raw
In reply to Taehee Yoo
Quoted 3 lines · On Wed, 2 Jul 2025 10:42:49 +0000 Taehee Yoo wrote:

The devmem TCP requires the hds-thresh value to be 0, but it doesn't change it automatically.
Therefore, make configure_headersplit() sets hds-thresh value to 0.

I don't see any undoing of the configuration :(
The selftest should leave the system in the state that it started. We should either add some code to undo at shutdown or (preferably) move the logic to the Python script where we can handle this more cleanly with defer().

Signature · 1 line
pw-bot: cr
author
#5 lore raw
Quoted 1 line · Jakub Kicinski

Hi Jakub,
Thanks a lot for your review!

Quoted 10 lines · On Wed, 2 Jul 2025 10:42:49 +0000 Taehee Yoo wrote:
Quoted 3 lines

The devmem TCP requires the hds-thresh value to be 0, but it doesn't change it automatically.
Therefore, make configure_headersplit() sets hds-thresh value to 0.

I don't see any undoing of the configuration :(
The selftest should leave the system in the state that it started. We should either add some code to undo at shutdown or (preferably) move the logic to the Python script where we can handle this more cleanly with defer().

Okay, I understand it.
I will fix this in the next version.

Thanks a lot!
Taehee Yoo

Quoted 2 lines

--
pw-bot: cr

#6 lore raw
In reply to Jakub Kicinski
Quoted 11 lines · Jakub Kicinski
Quoted 3 lines · On Wed, 2 Jul 2025 10:42:49 +0000 Taehee Yoo wrote:

The devmem TCP requires the hds-thresh value to be 0, but it doesn't change it automatically.
Therefore, make configure_headersplit() sets hds-thresh value to 0.

I don't see any undoing of the configuration :(
The selftest should leave the system in the state that it started. We should either add some code to undo at shutdown or (preferably) move the logic to the Python script where we can handle this more cleanly with defer().

I'm sure you're aware but this test in general doesn't aim to undo any of it's configuration AFAIR :( that includes ethtool tcp-data-split, -X, -N and -L. Sorry about that.

I wonder if you want this series to clean that up completely such that all configurations are cleaned up, or if you're asking Taehee to only clean up the hds-thres configuration for now.

Also, sorry for the late reply, but FWIW, I prefer the configuration cleanup to be in ncdevmem itself. We use it outside of the ksft to run stress tests, and folks are going to copy-paste ncdevmem for their applications, so having it be as nice as possible is a plus. But if you feel strongly about doing this outside of ncdevmem.c itself I don't mind that much.

--
Thanks,
Mina

maintainer
#7 lore raw
Quoted 11 lines · On Mon, 7 Jul 2025 11:48:53 -0700 Mina Almasry wrote:
Quoted 10 lines · On Wed, 2 Jul 2025 10:42:49 +0000 Taehee Yoo wrote:
Quoted 3 lines

The devmem TCP requires the hds-thresh value to be 0, but it doesn't change it automatically.
Therefore, make configure_headersplit() sets hds-thresh value to 0.

I don't see any undoing of the configuration :(
The selftest should leave the system in the state that it started. We should either add some code to undo at shutdown or (preferably) move the logic to the Python script where we can handle this more cleanly with defer().

Quoted 7 lines

I'm sure you're aware but this test in general doesn't aim to undo any of it's configuration AFAIR :( that includes ethtool tcp-data-split, -X, -N and -L. Sorry about that.

I wonder if you want this series to clean that up completely such that all configurations are cleaned up, or if you're asking Taehee to only clean up the hds-thres configuration for now.

Just the hds-thrs config for now. Avoid adding more problems.

Quoted 6 lines

Also, sorry for the late reply, but FWIW, I prefer the configuration cleanup to be in ncdevmem itself. We use it outside of the ksft to run stress tests, and folks are going to copy-paste ncdevmem for their applications, so having it be as nice as possible is a plus. But if you feel strongly about doing this outside of ncdevmem.c itself I don't mind that much.

Stan & Bobby added devmem support to kperf I think that's a better choice for stress testing: https://github.com/facebookexperimental/kperf
selftests are for testing the kernel, in the context of upstream CIs. The experience with netdevsim teaches me that having "out of tree" use cases as an explicit goal is a road to nowhere.