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 BPF test facility to test skb->cb #24181
Merged
YutaroHayakawa
merged 2 commits into
cilium:master
from
YutaroHayakawa:yutaro/oss/bpf-test-metadata
Mar 7, 2023
Merged
Add BPF test facility to test skb->cb #24181
YutaroHayakawa
merged 2 commits into
cilium:master
from
YutaroHayakawa:yutaro/oss/bpf-test-metadata
Mar 7, 2023
Conversation
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
When we write BPF unit test, sometimes we want to overwrite the macro value in node_config.h by undef it and define it again. A typical code for that looks like below. ``` /* Include node_config.h before including bpf_overlay.h */ #include "node_config.h" /* Overwrite some config */ #undef NODEPORT_PORT_MIN #define NODEPORT_PORT_MIN 65000 /* Include bpf_overlay.h (includes node_config.h internally) * and use above overwritten value. */ #include "bpf_overlay.h" ``` However, currently node_config.h misses the include guard. Because of that, when we include bpf_overlay.h, we redefine the same macro again. Introduce a proper include guard to node_config.h to prevent that. Signed-off-by: Yutaro Hayakawa <yutaro.hayakawa@isovalent.com>
maintainer-s-little-helper
bot
added
the
dont-merge/needs-release-note-label
The author needs to describe the release impact of these changes.
label
Mar 6, 2023
YutaroHayakawa
added
the
release-note/misc
This PR makes changes that have no direct user impact.
label
Mar 6, 2023
maintainer-s-little-helper
bot
removed
the
dont-merge/needs-release-note-label
The author needs to describe the release impact of these changes.
label
Mar 6, 2023
YutaroHayakawa
added
dont-merge/needs-release-note-label
The author needs to describe the release impact of these changes.
needs-backport/1.13
This PR / issue needs backporting to the v1.13 branch
labels
Mar 6, 2023
maintainer-s-little-helper
bot
removed
the
dont-merge/needs-release-note-label
The author needs to describe the release impact of these changes.
label
Mar 6, 2023
YutaroHayakawa
force-pushed
the
yutaro/oss/bpf-test-metadata
branch
5 times, most recently
from
March 6, 2023 11:16
94c95dc
to
182aeb8
Compare
Add common facility to mock out skb metadata. Users can include mock_skb_metadata.h then it automatically changes ctx_store_meta and ctx_load_meta call to mock functions that read/write data to map. The userspace program is aware of the map and clears the value after each test. So that the value won't be leaked among tests. This commit also adds a new test case to test above behavior. I considered writing this feature using ctx_in attribute of the BPF_PROG_TEST_RUN, but I didn't do that since it only works after 5.2 and currently, Cilium supports 4.19 or later. Signed-off-by: Yutaro Hayakawa <yutaro.hayakawa@isovalent.com>
YutaroHayakawa
force-pushed
the
yutaro/oss/bpf-test-metadata
branch
from
March 6, 2023 11:26
182aeb8
to
6588ba2
Compare
YutaroHayakawa
added
the
sig/datapath
Impacts bpf/ or low-level forwarding details, including map management and monitor messages.
label
Mar 6, 2023
dylandreimerink
approved these changes
Mar 6, 2023
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.
Seem like a nice addition
/test |
ConformanceIngress shouldn't be related to this change. Let me make this ready-to-merge. |
YutaroHayakawa
added
the
ready-to-merge
This PR has passed all tests and received consensus from code owners to merge.
label
Mar 7, 2023
YutaroHayakawa
removed
the
needs-backport/1.13
This PR / issue needs backporting to the v1.13 branch
label
Mar 18, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
ready-to-merge
This PR has passed all tests and received consensus from code owners to merge.
release-note/misc
This PR makes changes that have no direct user impact.
sig/datapath
Impacts bpf/ or low-level forwarding details, including map management and monitor messages.
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.
Please see commit message for more details. I piggybacked one small bug fix (node_config.h include guard).