-
Notifications
You must be signed in to change notification settings - Fork 190
Add xdpsock code to xdp-tools #535
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
Draft
tohojo
wants to merge
20
commits into
main
Choose a base branch
from
xdb-bench-xsk
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
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
08e8b85 to
f74c549
Compare
Some invocations of usage() didn't use the program name buffer that includes the command name, leading to confusing output. Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
f74c549 to
8f7fcfa
Compare
Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
Error out if the configured options contain duplicate short options, to aid with commands that take a lot of options. Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
Add a .hex value in the options definition that enables parsing integers as hexadecimal if set. Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
6411183 to
89be6b4
Compare
Add an 'xsk' command to xdp-bench which will be used to run the AF_XDP-based benchmarks from the xdpsock utility. This commit only adds the command and option parsing, in preparation for porting over the xdpsock code. Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
Update if_xdp.h to a newer version that includes the definitions for fragments in AF_XDP. Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
This includes the xdpsock code from the bpf_examples repository into lib/util. The code is included as-is, with only a couple of small changes to make the code compile (fixing "mixed-sign compare" compiler warnings). The following commits will refactor the code into a library to be re-used by xdp-bench and xdp-trafficgen. Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
Instead of typedefs, use __u8/__u16/__u32/__u64 directly everywhere. Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
89be6b4 to
48b7ab3
Compare
The options should be part of the library so they can be re-used. Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
Instead of relying on global variables to keep state while running xdpsock, move all state variables into a context object, and remove the global variables for the options in favour of an embedded options struct. Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
48b7ab3 to
a788513
Compare
Restructure the setup code of xdpsock to get rid of the main() function and instead introduce a new xsk_ctx__create() function that creates the previously introduced context object and sets everything up. Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
Wire up the xdpsock library code to implement the xsk-drop and xsk-tx commands in xdp-bench. Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
Swap the threads so that packet processing is started in a background thread and stats output is in the foreground. This makes it possible to incorporate signal processing as part of the stats output loop, adopting the signalfd/timerfd approach used by xdp_sample. Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
Make the stats output more condensed (by default) and better aligned with the output of xdp_sample used elsewhere. Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
Use the immediate exit logic from xdp_sample in xdpsock as well (exporting the function that checks the envvar), so we can use it in tests. Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
The main thread will handle signals and set ctx->benchmark_done if one is received. Make sure to check this in every loop iteration; otherwise, when using poll mode, the poller thread won't react to the exit signal because of the 'continue' inside the poll logic. Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
Exercise the different options with immediate exit in both xsk-drop and xsk-tk modes. Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
Add a test that exercises the different XSK options for xdp-trafficgen. Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
a788513 to
d6cb18e
Compare
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.
This WiP PR imports the code from the xdpsock utility in the bpf_examples
repository and incorporates the functionality into xdp-bench (drop and l2fwd)
and xdp-trafficgen (tx).
The xdpsock code is transformed into library functions that can be called from
both the xdp-bench and xdp-trafficgen binaries, and the options are converted
into the xdp-tools parameter framework.