diff options
| author | Jakub Kicinski <[email protected]> | 2025-02-19 23:49:53 +0000 |
|---|---|---|
| committer | Jakub Kicinski <[email protected]> | 2025-02-21 01:58:25 +0000 |
| commit | d3726ab45c57d0ba26234e3b9e4d19903b740f97 (patch) | |
| tree | a34722ffa8e6d70bec233bfe40c04937c5c9fd57 /tools/testing/selftests/drivers/net/queues.py | |
| parent | selftests: drv-net: add missing new line in xdp_helper (diff) | |
| download | kernel-d3726ab45c57d0ba26234e3b9e4d19903b740f97.tar.gz kernel-d3726ab45c57d0ba26234e3b9e4d19903b740f97.zip | |
selftests: drv-net: probe for AF_XDP sockets more explicitly
Separate the support check from socket binding for easier refactoring.
Use: ./helper - - just to probe if we can open the socket.
Acked-by: Stanislav Fomichev <[email protected]>
Reviewed-by: Joe Damato <[email protected]>
Tested-by: Joe Damato <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
Diffstat (limited to 'tools/testing/selftests/drivers/net/queues.py')
| -rwxr-xr-x | tools/testing/selftests/drivers/net/queues.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/tools/testing/selftests/drivers/net/queues.py b/tools/testing/selftests/drivers/net/queues.py index b6896a57a5fd..0c959b2eb618 100755 --- a/tools/testing/selftests/drivers/net/queues.py +++ b/tools/testing/selftests/drivers/net/queues.py @@ -25,6 +25,13 @@ def nl_get_queues(cfg, nl, qtype='rx'): return None def check_xdp(cfg, nl, xdp_queue_id=0) -> None: + # Probe for support + xdp = cmd(cfg.rpath("xdp_helper") + ' - -', fail=False) + if xdp.ret == 255: + raise KsftSkipEx('AF_XDP unsupported') + elif xdp.ret > 0: + raise KsftFailEx('unable to create AF_XDP socket') + xdp = subprocess.Popen([cfg.rpath("xdp_helper"), f"{cfg.ifindex}", f"{xdp_queue_id}"], stdin=subprocess.PIPE, stdout=subprocess.PIPE, bufsize=1, text=True) @@ -33,11 +40,6 @@ def check_xdp(cfg, nl, xdp_queue_id=0) -> None: stdout, stderr = xdp.communicate(timeout=10) rx = tx = False - if xdp.returncode == 255: - raise KsftSkipEx('AF_XDP unsupported') - elif xdp.returncode > 0: - raise KsftFailEx('unable to create AF_XDP socket') - queues = nl.queue_get({'ifindex': cfg.ifindex}, dump=True) if not queues: raise KsftSkipEx("Netlink reports no queues") |
