[PATCH net-next v3] selftests: drv-net: devmem: fix 5-tuple flow steering

Mina Almasry <[email protected]>
Newsgroups org.kernel.vger.netdev,org.kernel.vger.linux-kernel,org.kernel.vger.linux-kselftest
Message-ID <[email protected]>
`check_rx` sets the `flow_steer=not hasattr(cfg, 'netns')` kwarg,
which signals `ncdevmem` to attach the client IP as a param (enabling
5-tuple flow steering) when running on the host. However,
`check_rx_hds` currently omits this kwarg, forcing `ncdevmem` to only
support 3-tuple flow steering.

If tests are run on a real NIC that requires 5-tuple steering (e.g.
`gve`), `check_rx_hds` unconditionally fails because `ethtool` rejects
the 3-tuple rule.

Testing on `gve` with `devmem` enabled shows the failure is rectified
when parity is restored to `check_rx_hds`.

Test results before this change:
 # ./devmem.py
 ok 1 devmem.check_rx
 ok 2 devmem.check_tx
 ok 3 devmem.check_tx_chunks
 # Exception| CMD: /usr/src/kernel/tools/testing/selftests/drivers/net/hw/ncdevmem -l -f eth1 -s 192.168.1.89 -p 39105 -L
 # Exception|           Running: ethtool -N eth1 flow-type tcp4 dst-ip 192.168.1.89 dst-port 39105 queue 15
 # Exception|           rmgr: Cannot insert RX class rule: Invalid argument
 # Exception|           ncdevmem: Failed to configure flow steering
 not ok 4 devmem.check_rx_hds

Test results after this change:
 # ./devmem.py
 ok 1 devmem.check_rx
 ok 2 devmem.check_tx
 ok 3 devmem.check_tx_chunks
 ok 4 devmem.check_rx_hds

Signed-off-by: Mina Almasry <[email protected]>
---
v3:
- Sent as a standalone patch. Dropped Patch 2 (gracefully retry bind)
  from the series as it is no longer needed.
- Dropped the 'extras = [f"-c {cfg.addr}"]' addition to ncdevmem_tx
  as it was unnecessary.
v2: https://lore.kernel.org/all/[email protected]/
---
 tools/testing/selftests/drivers/net/hw/devmem_lib.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/drivers/net/hw/devmem_lib.py b/tools/testing/selftests/drivers/net/hw/devmem_lib.py
index 3554954a6691b..5a519713b2769 100644
--- a/tools/testing/selftests/drivers/net/hw/devmem_lib.py
+++ b/tools/testing/selftests/drivers/net/hw/devmem_lib.py
@@ -306,7 +306,7 @@ def run_rx_hds(cfg):
         port = rand_port()
 
         listen_cmd = ncdevmem_rx(cfg, port, verify=False,
-                                 fail_on_linear=True)
+                                 fail_on_linear=True, flow_steer=not hasattr(cfg, 'netns'))
         socat = socat_send(cfg, port, buf_size=size)
 
         with bkg(listen_cmd, exit_wait=True, ns=netns) as ncdevmem:

base-commit: 9958e69b98930834a576e156f6458166d1db1c02
-- 
2.55.0.691.gc56d675ccc-goog
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.