On 5/8/25 14:40, Jakub Kicinski wrote:
The ping test flips checksum offload on and off.
Make sure the original value is restored if test fails.

Signed-off-by: Jakub Kicinski <[email protected]>
---
CC: [email protected]
CC: [email protected]
---
  tools/testing/selftests/drivers/net/ping.py | 16 ++++++++++++++++
  1 file changed, 16 insertions(+)

diff --git a/tools/testing/selftests/drivers/net/ping.py 
b/tools/testing/selftests/drivers/net/ping.py
index af8df2313a3b..e0f114612c1a 100755
--- a/tools/testing/selftests/drivers/net/ping.py
+++ b/tools/testing/selftests/drivers/net/ping.py
@@ -50,6 +50,16 @@ no_sleep=False
          cmd(f"echo {test_string} | socat -t 2 -u STDIN 
TCP:{cfg.remote_baddr}:{port}", shell=True)
      ksft_eq(nc.stdout.strip(), test_string)
+def _schedule_checksum_reset(cfg, netnl) -> None:
+    features = ethtool(f"-k {cfg.ifname}", json=True)
+    setting = ""
+    for side in ["tx", "rx"]:
+        f = features[0][side + "-checksumming"]
+        if not f["fixed"]:

I checked and found that "fixed" is a ternary:

        "rx-checksumming": {
            "active": true,
            "fixed": false,
            "requested": true
        },
        "tx-checksumming": {
            "active": true,
            "fixed": null,
            "requested": null
        },

Python loads this JSON as False and None types respectively, and `not
f["fixed"]` is true for both False and None. Maybe this doesn't matter
but flagging it.

+            setting += " " + side
+            setting += " " + ("on" if f["requested"] or f["active"] else "off")
+    defer(ethtool, f" -K {cfg.ifname} " + setting)

This does rx/tx-gro too even if not explicitly requested. I assume that
is okay?

Reply via email to