Skip to contentSkip to conversation

selftests: drv-net: hw: reset HDS mode after netkit devmem tests

PATCH Applied Jakub Kicinski 5 participants 5 messages Aug 4 – Aug 6

Subsystems (3)
lore
Share & tools
lore

Jakub Kicinski

author maintainer
#0 lore raw

PATCH 1/1 selftests: drv-net: hw: reset HDS mode after netkit devmem tests

HDS mode has confusing semantics. On GET kernel reports effective mode. On SET kernel expects explicit config. Effective mode on GET means that we know the current state, but we don't know if it's a driver default or user setting. This matter because driver default can change automatically when e.g. XDP is attached. Explicit user setting must not be lost.

With that in mind, we can't restore the HDS setting like we restore other NIC config. We should always reset to default ("unknown").

This fixes an issue with tests running after the devmem test not being able to attach XDP, e.g.

Exception| File "./xdp_metadata.py", line 105, in test_xdp_rss_hash
[...]

   Exception| net.lib.py.utils.CmdExitFailure: Command failed
   Exception| CMD: ip link set dev ens9np0 xdpdrv pinned /sys/fs/bpf/xdp_metadata_test/xdp_rss_hash
   Exception|   EXIT: 2
   Exception|   STDERR: Error: unable to install XDP to device using tcp-data-split.

not ok 1 xdp_metadata.test_xdp_rss_hash.tcp

---
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]

---
 tools/testing/selftests/drivers/net/hw/devmem_lib.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
tools/testing/selftests/drivers/net/hw/devmem_lib.py +1 -2
index 0921ff03eb81..4e6316c7de96 100644
@@ -37,14 +37,13 @@ from lib.py import (bkg, cmd, defer, ethtool, rand_port, wait_port_listen,
     rings = ethnl.rings_get({'header': {'dev-index': cfg.ifindex}})
     orig_rx_rings = rings['rx']
     orig_hds_thresh = rings.get('hds-thresh', 0)
-    orig_data_split = rings.get('tcp-data-split', 'unknown')
 
     ethnl.rings_set({'header': {'dev-index': cfg.ifindex},
                      'tcp-data-split': 'enabled',
                      'hds-thresh': 0,
                      'rx': min(64, orig_rx_rings)})
     defer(ethnl.rings_set, {'header': {'dev-index': cfg.ifindex},
-                            'tcp-data-split': orig_data_split,
+                            'tcp-data-split': 'unknown',
                             'hds-thresh': orig_hds_thresh,
                             'rx': orig_rx_rings})
 
Signature · 1 line
2.55.0
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 17 lines · Jakub Kicinski

HDS mode has confusing semantics. On GET kernel reports effective mode. On SET kernel expects explicit config. Effective mode on GET means that we know the current state, but we don't know if it's a driver default or user setting. This matter because driver default can change automatically when e.g. XDP is attached. Explicit user setting must not be lost.

With that in mind, we can't restore the HDS setting like we restore other NIC config. We should always reset to default ("unknown").

This fixes an issue with tests running after the devmem test not being able to attach XDP, e.g.

Exception| File "./xdp_metadata.py", line 105, in test_xdp_rss_hash
[...]

Quoted 7 lines
   Exception| net.lib.py.utils.CmdExitFailure: Command failed
   Exception| CMD: ip link set dev ens9np0 xdpdrv pinned /sys/fs/bpf/xdp_metadata_test/xdp_rss_hash
   Exception|   EXIT: 2
   Exception|   STDERR: Error: unable to install XDP to device using tcp-data-split.

not ok 1 xdp_metadata.test_xdp_rss_hash.tcp

Reviewed-by on v1 1/1
#2 lore raw
In reply to Jakub Kicinski
Quoted 17 lines · Jakub Kicinski

HDS mode has confusing semantics. On GET kernel reports effective mode. On SET kernel expects explicit config. Effective mode on GET means that we know the current state, but we don't know if it's a driver default or user setting. This matter because driver default can change automatically when e.g. XDP is attached. Explicit user setting must not be lost.

With that in mind, we can't restore the HDS setting like we restore other NIC config. We should always reset to default ("unknown").

This fixes an issue with tests running after the devmem test not being able to attach XDP, e.g.

Exception| File "./xdp_metadata.py", line 105, in test_xdp_rss_hash
[...]

Quoted 7 lines
   Exception| net.lib.py.utils.CmdExitFailure: Command failed
   Exception| CMD: ip link set dev ens9np0 xdpdrv pinned /sys/fs/bpf/xdp_metadata_test/xdp_rss_hash
   Exception|   EXIT: 2
   Exception|   STDERR: Error: unable to install XDP to device using tcp-data-split.

not ok 1 xdp_metadata.test_xdp_rss_hash.tcp

Reviewed-by on v1 1/1
#3 lore raw
In reply to Jakub Kicinski
Quoted 58 lines · Jakub Kicinski

HDS mode has confusing semantics. On GET kernel reports effective mode. On SET kernel expects explicit config. Effective mode on GET means that we know the current state, but we don't know if it's a driver default or user setting. This matter because driver default can change automatically when e.g. XDP is attached. Explicit user setting must not be lost.

With that in mind, we can't restore the HDS setting like we restore other NIC config. We should always reset to default ("unknown").

This fixes an issue with tests running after the devmem test not being able to attach XDP, e.g.

Exception| File "./xdp_metadata.py", line 105, in test_xdp_rss_hash
[...]

   Exception| net.lib.py.utils.CmdExitFailure: Command failed
   Exception| CMD: ip link set dev ens9np0 xdpdrv pinned /sys/fs/bpf/xdp_metadata_test/xdp_rss_hash
   Exception|   EXIT: 2
   Exception|   STDERR: Error: unable to install XDP to device using tcp-data-split.

not ok 1 xdp_metadata.test_xdp_rss_hash.tcp

---
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]

---
 tools/testing/selftests/drivers/net/hw/devmem_lib.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
tools/testing/selftests/drivers/net/hw/devmem_lib.py +1 -2
index 0921ff03eb81..4e6316c7de96 100644
@@ -37,14 +37,13 @@ from lib.py import (bkg, cmd, defer, ethtool, rand_port, wait_port_listen,
     rings = ethnl.rings_get({'header': {'dev-index': cfg.ifindex}})
     orig_rx_rings = rings['rx']
     orig_hds_thresh = rings.get('hds-thresh', 0)
-    orig_data_split = rings.get('tcp-data-split', 'unknown')
 
     ethnl.rings_set({'header': {'dev-index': cfg.ifindex},
                      'tcp-data-split': 'enabled',
                      'hds-thresh': 0,
                      'rx': min(64, orig_rx_rings)})
     defer(ethnl.rings_set, {'header': {'dev-index': cfg.ifindex},
-                            'tcp-data-split': orig_data_split,
+                            'tcp-data-split': 'unknown',
                             'hds-thresh': orig_hds_thresh,
                             'rx': orig_rx_rings})
 
Signature · 1 line
2.55.0
#4 lore raw
In reply to Jakub Kicinski
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 9 lines · On Tue, 4 Aug 2026 08:10:40 -0700 you wrote:

HDS mode has confusing semantics. On GET kernel reports effective mode. On SET kernel expects explicit config. Effective mode on GET means that we know the current state, but we don't know if it's a driver default or user setting. This matter because driver default can change automatically when e.g. XDP is attached. Explicit user setting must not be lost.

[...]

Here is the summary with links:
- [net-next] selftests: drv-net: hw: reset HDS mode after netkit devmem tests

    https://git.kernel.org/netdev/net-next/c/481e86a82219

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html