Re: [PATCH net-next v2 4/7] selftests: drv-net: probe for AF_XDP sockets more explicitly

Joe Damato
2025-02-20T18:16:07Z

On Wed, Feb 19, 2025 at 03:49:53PM -0800, Jakub Kicinski wrote:
> Separate the support check from socket binding for easier refactoring.
> Use: ./helper - - just to probe if we can open the socket.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> v2: new
> ---
> tools/testing/selftests/drivers/net/xdp_helper.c | 7 +++++++
> tools/testing/selftests/drivers/net/queues.py | 12 +++++++-----
> 2 files changed, 14 insertions(+), 5 deletions(-)
>

I've tested this on a kernel with XDP enabled and also a kernel with
XDP disabled and the change appears to work as intended.

Here's what it looks like on a kernel with XDP disabled:

KTAP version 1
1..4
ok 1 queues.get_queues
2ok 2 queues.addremove_queues
ok 3 queues.check_down
# Exception| Traceback (most recent call last):
# Exception| File "/home/jdamato/code/net-next/tools/testing/selftests/net/lib/py/ksft.py", line 223, in ksft_run
# Exception| case(*args)
# Exception| File "/home/jdamato/code/net-next/./tools/testing/selftests/drivers/net/queues.py", line 33, in check_xsk
# Exception| raise KsftFailEx('unable to create AF_XDP socket')
# Exception| net.lib.py.ksft.KsftFailEx: unable to create AF_XDP socket
not ok 4 queues.check_xsk
# Totals: pass:3 fail:1 xfail:0 xpass:0 skip:0 error:0

Reviewed-by: Joe Damato <jdamato@fastly.com>