-
Notifications
You must be signed in to change notification settings - Fork 5
selftests/bpf: Integrate test_xsk.c to test_progs framework #6246
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
Closed
kernel-patches-daemon-bpf-rc
wants to merge
15
commits into
bpf-next_base
from
series/1017284=>bpf-next
Closed
selftests/bpf: Integrate test_xsk.c to test_progs framework #6246
kernel-patches-daemon-bpf-rc
wants to merge
15
commits into
bpf-next_base
from
series/1017284=>bpf-next
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Move ksft_test_result_*() calls to xskxceiver.c to keep the kselftest's
report valid
Reviewed-by: Maciej Fijalkowski <[email protected]>
Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
bitmap is used before being initialized. Initialize it to zero before using it. Reviewed-by: Maciej Fijalkowski <[email protected]> Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
__testapp_validate_traffic is supposed to return an integer value that tells if the test passed (0), failed (-1) or was skiped (2). It actually returns a boolean in the end. This doesn't harm when the test is successful but can lead to misinterpretation in case of failure as 1 will be returned instead of -1. Return TEST_FAILURE (-1) in case of failure, TEST_PASS (0) otherwise. Reviewed-by: Maciej Fijalkowski <[email protected]> Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
testapp_stats_rx_dropped() generates pkt_stream twice. The last generated is released by pkt_stream_restore_default() at the end of the test but we lose the pointer of the first pkt_stream. Release the 'middle' pkt_stream when it's getting replaced to prevent memory leaks. Reviewed-by: Maciej Fijalkowski <[email protected]> Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
testapp_xdp_shared_umem() generates pkt_stream on each xsk from xsk_arr, where normally xsk_arr[0] gets pkt_streams and xsk_arr[1] have them NULLed. At the end of the test pkt_stream_restore_default() only releases xsk_arr[0] which leads to memory leaks. Release the missing pkt_stream at the end of testapp_xdp_shared_umem() Reviewed-by: Maciej Fijalkowski <[email protected]> Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
The clean-up done at the end of a test in __testapp_validate_traffic() isn't wrapped in a function. It isn't convenient if we want to use it somewhere else in the code. Wrap the clean-up in two new functions : the first deletes the sockets, the second releases the umem. Reviewed-by: Maciej Fijalkowski <[email protected]> Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
testapp_validate_traffic() doesn't release the sockets and the umem created by the threads if the test isn't currently in its last step. Thus, if the swap_xsk_resources() fails before the last step, the created resources aren't cleaned up. Clean the sockets and the umem in case of swap_xsk_resources() failure. Reviewed-by: Maciej Fijalkowski <[email protected]> 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 exits the application immediately. This prevents the following tests from being run and isn't compliant with the CI Add a return value to init_iface() so errors can be handled more smoothly. Reviewed-by: Maciej Fijalkowski <[email protected]> Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
xsk_reattach_xdp calls exit_with_error() on failures. This exits the program immediately. It prevents the following tests from being run and isn't compliant with the CI. Add a return value to the functions handling XDP attachments to handle errors more smoothly. Reviewed-by: Maciej Fijalkowski <[email protected]> Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
exit_with_error() is called when gettimeofday() fails. This exits the program immediately. It prevents the following tests from being run and isn't compliant with the CI. Return TEST_FAILURE instead of calling exit_on_error(). Reviewed-by: Maciej Fijalkowski <[email protected]> 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_with_error() which exits the program immediately. It prevents the following tests from running and isn't compliant with the CI. Add return value to functions that can fail. Handle failures more smoothly through report_failure(). Reviewed-by: Maciej Fijalkowski <[email protected]> Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
…ails __testapp_validate_traffic() calls exit_with_error() on failures. This exits the program immediately. It prevents the following tests from running and isn't compliant with the CI. Return TEST_FAILURE instead of calling exit_with_error(). Release the resource of the 1st thread if a failure happens between its creation and the creation of the second thread. Reviewed-by: Maciej Fijalkowski <[email protected]> Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
If any allocation in the pkt_stream_*() helpers fail, exit_with_error() is called. This terminates the program immediately. It prevents the following tests from running and isn't compliant with the CI. Return NULL in case of allocation failure. Return TEST_FAILURE when something goes wrong in the packet generation. Clean up the resources if a failure happens between two steps of a test. Move exit_with_error()'s definition into xskxceiver.c as it isn't used anywhere else now. Reviewed-by: Maciej Fijalkowski <[email protected]> Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
Following tests won't fit in the CI: - XDP_ADJUST_TAIL_* and SEND_RECEIVE_9K_PACKETS because of their flakyness - UNALIGNED_* because they depend on huge page allocations - *_RING_SIZE because they depend on HW rings - TEARDOWN because it's too long Remove these tests from the nominal tests table so they won't be run by the CI in upcoming patch. Create a skip_ci_tests table to hold them. Use this skip_ci table in xskxceiver.c to keep all the tests available from the test_xsk.sh script. Reviewed-by: Maciej Fijalkowski <[email protected]> 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
Reviewed-by: Maciej Fijalkowski <[email protected]>
Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
Author
|
Upstream branch: 54c134f |
Author
|
At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=1017284 expired. Closing PR. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull request for series with
subject: selftests/bpf: Integrate test_xsk.c to test_progs framework
version: 6
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1017284