mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-21 04:53:46 -04:00
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 <sdf@fomichev.me> Reviewed-by: Joe Damato <jdamato@fastly.com> Tested-by: Joe Damato <jdamato@fastly.com> Link: https://patch.msgid.link/20250219234956.520599-5-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user