Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

selftests/bpf: Integrate test_xsk.c to test_progs framework #8670

Open
wants to merge 13 commits into
base: bpf-next_base
Choose a base branch
from

Conversation

kernel-patches-daemon-bpf[bot]
Copy link

Pull request for series with
subject: selftests/bpf: Integrate test_xsk.c to test_progs framework
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=943477

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 46d38f4
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=943477
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 956e816
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=943477
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 2d7597d
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=943477
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 2d7597d
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=943477
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 8c10109
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=943477
version: 1

bitmap is used before being initialized.

Initialize it to zero before using it.

Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
Some tests introduce memory leaks by not freeing all the pkt_stream
objects they're creating.

Fix these memory leaks.

Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
xskxceiver depends on kselftests which prevent from integrating it into
the test_progs framework.

Wrap the ksft_*() calls behind macros to ease the future integration into
test_progs.

Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
init_iface() doesn't have any return value while it can fail. In case of
failure it calls exit_on_error() which will terminate the test
immediately.

Add a return value to init_iface() so errors can be handled more
smoothly.

Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
xsk_reattach_xdp calls exit_on_error() on failures. This exits the
program immediately and can lead to memory leaks.

Add a return value to the functions handling XDP attachments to handle
errors more smoothly.

Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
exit_on_error() is called when gettimeofday() fails. This exits the
program immediately and can lead to memory leaks.

Return TEST_FAILURE instead of calling exit_on_error()

Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
TX and RX workers can fail in many places. These failures trigger a call
to exit_on_error() which exits the program immediately and can lead to
memory leak.

Add return value to functions that can fail.
Handle failures more smoothly through report_failure().

Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
…ails

__testapp_validate_traffic() calls exit_on_error() on failures. This
exits the program immediately and can lead to memory leaks.

Return TEST_FAILURE instead of calling exit_on_error().

Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
If any allocation in the pkt_stream_*() helpers fail, exit_on_error() is
called. This terminates the program immediately and can lead to memory
leaks.

Return NULL in case of allocation failure.
Return TEST_FAILURE when something goes wrong in the packet generation.

Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
AF_XDP features are tested by the test_xsk.sh script but not by the
test_progs framework. The tests used by the script are defined in
xksxceiver.c which can't be integrated in the test_progs framework as is.

Extract these test definitions from xskxceiver{.c/.h} to put them in new
test_xsk{.c/.h} files.
Keep the main() function and its unshared dependencies in xksxceiver to
avoid impacting the test_xsk.sh script which is often used to test real
hardware.

Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
test_xsk.c uses the kselftest framework. This isn't compatible with the
test_progs framework.

Add a XSK_SELTFEST define that allows to enable/disable the kselftest
usage.

Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
Some tests are flaky (especially on s390). So they don't fit in the CI.

Remove flaky tests from the tests table so they won't be run by the CI
in upcoming patch.
Create a flaky_tests table to hold them.
Use the flaky table in xskxceiver.c so the tests remain available for HW
in test_xsk.sh.

Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
test_xsk.c isn't part of the test_progs framework.

Integrate the tests defined by test_xsk.c into the test_progs framework
through a new file : prog_tests/xsk.c. ZeroCopy mode isn't tested in it
as veth peers don't support it.
Move test_xsk{.c/.h} to prog_tests/.
Add the find_bit library to test_progs sources in the Makefile as it is
is used by test_xsk.c

Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: bb2243f
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=943477
version: 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant