-
Notifications
You must be signed in to change notification settings - Fork 3.4k
bpf: fib: stream-line fib_do_redirect() #39490
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
Merged
Merged
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
We expect all supported kernels to offer HAVE_FIB_INDEX, and there's no code that would still use the `ifindex` field. Reclaim these two bytes for the future. Note that in particular there's no downgrade concerns here - even if we go back to v1.17, the underlying kernel is still the same and provides HAVE_FIB_INDEX. And thus Cilium v1.17 doesn't expect us to provide CT entries with a valid `ifindex`. Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
/test |
Move the selection of the egress interface into fib_do_redirect()'s callers, and provide it through a single `oif` parameter (which now becomes read-only). The callers know much better what information is available (FIB lookup result, DIRECT_ROUTING_DEV_IFINDEX, ...) and what outcome they want. And some of them already look at `fib_params->l.ifindex` anyway. Note that is just a cleanup, there shouldn't be any change in behavior. While at it also update the big code comment to reflect current reality. Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
XDP programs have no business using redirect_neigh(). This turns a dormant runtime error into an immediate build-time bug. Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
91d6864
to
7a5933e
Compare
/test |
ldelossa
approved these changes
May 12, 2025
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.
A very welcomed LGTM :-D.
YutaroHayakawa
approved these changes
May 12, 2025
pippolo84
approved these changes
May 13, 2025
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.
LGTM 💯
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area/datapath
Impacts bpf/ or low-level forwarding details, including map management and monitor messages.
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.
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.
#38308 helped to simplify the BPF-redirect logic, as we can now assume support for
HAVE_FIB_IFINDEX
. Therefore let's lift the remaining processing of the FIB result from the low-level redirect helper, and make it the caller's responsibility to select the egress interface.While at it also free up some related space in the CT entry thanks to #38308, and clarify the use of
redirect_neigh()
in XDP context.