Skip to content
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

bpf: lb: misc cleanups #25372

Merged
merged 4 commits into from May 12, 2023
Merged

Conversation

julianwiedmann
Copy link
Member

@julianwiedmann julianwiedmann commented May 11, 2023

Some more cleanups to untangle lib/lb.h. #24757 might help as background.

Pull the code that only applies to CT_REPLY into the switch statement, so
that CT_NEW doesn't need to jump over it.

The diff looks massive, but that's only because all the indentation
changes. It's really just copy & paste and adjusting the goto's.

Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
Don't require the callers to pass in a full ct_state struct.

Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
lb*_local() gets called with a ct_state struct. This struct gets used for
the internal ct_lookup() [with CT_SERVICE scope], and is also updated with
the selected backend_id and rev_nat_index.

lb_local()'s caller then either uses the same ct_state struct for its own
CT handling (in case of nodeport_lb()), or transports some fields across a
tail-call and plumbs them into a new ct_state struct (in case of bpf_lxc).

But both callers create their own CT entries with non-CT_SERVICE scope.
So ct_create() simply ignores the ct_state->backend_id field, and doesn't
copy it into the actual CT entry.

Therefore lb*_local() doesn't need to bother with passing the selected
backend_id back. We just need to store/update it in the CT_SERVICE entry.

Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
ct_update_backend_id() and ct_update_rev_nat_index() typically come in
pairs. Add a helper that applies the updates with a single map lookup.

Suggested-by: Maxim Mikityanskiy <maxim@isovalent.com>
Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
@julianwiedmann julianwiedmann added sig/datapath Impacts bpf/ or low-level forwarding details, including map management and monitor messages. release-note/misc This PR makes changes that have no direct user impact. labels May 11, 2023
@julianwiedmann
Copy link
Member Author

/test

@julianwiedmann julianwiedmann marked this pull request as ready for review May 11, 2023 14:12
@julianwiedmann julianwiedmann requested a review from a team as a code owner May 11, 2023 14:12
Copy link
Contributor

@gentoo-root gentoo-root left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

@maintainer-s-little-helper maintainer-s-little-helper bot added the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label May 12, 2023
@julianwiedmann julianwiedmann merged commit ad600e6 into cilium:main May 12, 2023
58 checks passed
@julianwiedmann julianwiedmann deleted the 1.14-bpf-lb-cleanups branch May 12, 2023 11:17
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants