-
Notifications
You must be signed in to change notification settings - Fork 579
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
Add vagrant VM support and XDP_USE_NEED_WAKEUP for advanced03 #70
Open
chaudron
wants to merge
4
commits into
xdp-project:master
Choose a base branch
from
chaudron:master
base: master
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.
Open
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
d3c1045
vagrant: add vagrant support to build latest bpf-next in VM
chaudron eaf1e96
advanced03: add support for the XDP_USE_NEED_WAKEUP API
chaudron ce93ed3
advanced03: add some basic kernel version checking for AF_XDP support
chaudron 3f89b0e
advanced03: fix compilation of custom xdp program on older kernels
chaudron File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 */ | ||
|
||
#include <linux/bpf.h> | ||
#include <linux/version.h> | ||
|
||
#include "bpf_helpers.h" | ||
|
||
|
@@ -18,6 +19,17 @@ struct bpf_map_def SEC("maps") xdp_stats_map = { | |
.max_entries = 64, | ||
}; | ||
|
||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5,3,0) | ||
|
||
/* Kernel version before 5.3 needed an additional map */ | ||
struct bpf_map_def SEC("maps") qidconf_map = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see this map referred to anywhere; how is it actually used on those old kernels? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Think this is part of the older libbpf installing int |
||
.type = BPF_MAP_TYPE_ARRAY, | ||
.key_size = sizeof(int), | ||
.value_size = sizeof(int), | ||
.max_entries = 64, | ||
}; | ||
#endif | ||
|
||
SEC("xdp_sock") | ||
int xdp_sock_prog(struct xdp_md *ctx) | ||
{ | ||
|
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not the right approach to check against a kernel version.
(Because distros will backport changes)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know, but due to the lack of any run-time checks, what would you suggest?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead we have to write a bpf probe that can detect this (like bpftool does).
@tohojo have added a configure script in his XDP-tools repo.
In this case, we likely need to confine the check to the
advanced03-AF_XDP/
directory, and we can likely add it as part of the Makefile.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The configure script just sets some variables; so we can do that in the top-level and only react to them in advanced03. I've been meaning to port over some of the build stuff I did in xdp-tools to this repo anyway, so this sounds like a way forward :)