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] always use bpf_redir_neigh after FIB lookup #9423

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

tomastigera
Copy link
Contributor

@tomastigera tomastigera commented Oct 30, 2024

[BPF] use dst as nh when redirecting to workload

When redirecting to a workload when NAt is required, usually from HEP
because of node port, us the destination IP as the next hop in
bpf_redir_neigh() to avoid FIB lookup.

[BPF] if you know where to, skip explicit FIB lookup

bpf_redirect_neigh() will do it.

[BPF] skip neigh table lookup in fib lookup

bpf_redir_neigh will do it

[BPF] split fib.h into co-re and legacy

Going forward, we will maintain co-re and will eventually deprecate and
remove the legacy one. That will get us back to a single fib.h.

[BPF] always use bpf_redir_neigh after FIB lookup

There is not need to copy and fill in the mac addresses, bpf_redir_neigh
will do that for us.

Description

Related issues/PRs

Todos

  • Tests
  • Documentation
  • Release note

Release Note

ebpf: alwyas use bpf_redirect_neigh when possible - reduce FIB lookups to minimum

Reminder for the reviewer

Make sure that this PR has the correct labels and milestone set.

Every PR needs one docs-* label.

  • docs-pr-required: This change requires a change to the documentation that has not been completed yet.
  • docs-completed: This change has all necessary documentation completed.
  • docs-not-required: This change has no user-facing impact and requires no docs.

Every PR needs one release-note-* label.

  • release-note-required: This PR has user-facing changes. Most PRs should have this label.
  • release-note-not-required: This PR has no user-facing changes.

Other optional labels:

  • cherry-pick-candidate: This PR should be cherry-picked to an earlier release. For bug fixes only.
  • needs-operator-pr: This PR is related to install and requires a corresponding change to the operator.

@marvin-tigera marvin-tigera added this to the Calico v3.30.0 milestone Oct 30, 2024
@marvin-tigera marvin-tigera added release-note-required Change has user-facing impact (no matter how small) docs-pr-required Change is not yet documented labels Oct 30, 2024
@tomastigera tomastigera added docs-not-required Docs not required for this change and removed docs-pr-required Change is not yet documented labels Oct 30, 2024
@tomastigera tomastigera added release-note-not-required Change has no user-facing impact and removed release-note-required Change has user-facing impact (no matter how small) labels Oct 31, 2024
@tomastigera tomastigera force-pushed the tomas-bpf-redir-neigh branch 3 times, most recently from d285d3d to 2f15c59 Compare November 1, 2024 19:21
There is not need to copy and fill in the mac addresses, bpf_redir_neigh
will do that for us.
Going forward, we will maintain co-re and will eventually deprecate and
remove the legacy one. That will get us back to a single fib.h.
When redirecting to a workload when NAt is required, usually from HEP
because of node port, us the destination IP as the next hop in
bpf_redir_neigh() to avoid FIB lookup.
@tomastigera tomastigera marked this pull request as ready for review November 5, 2024 22:53
@tomastigera tomastigera requested a review from a team as a code owner November 5, 2024 22:53
Copy link
Member

@fasaxc fasaxc left a comment

Choose a reason for hiding this comment

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

Few small nits but great to see the code getting modernised!

There's still quite a lot of shared logic between the two fib impls (I diffed them locally to get a better feel for it) but happy to go with your judgement on the split. Not like we can't roll it back if we find the duplication awkward.

state->ct_result.ifindex_fwd);
goto no_fib_redirect;
}
CALI_DEBUG("Fall through to redirct without fib lookupi rc %d", rc);
Copy link
Member

Choose a reason for hiding this comment

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

Typos

case 0:
case BPF_FIB_LKUP_RET_NO_NEIGH:
#ifdef IPVER6
CALI_DEBUG("FIB lookup succeeded - gw");
Copy link
Member

Choose a reason for hiding this comment

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

Could use IP_FMT?

@@ -53,6 +53,8 @@ struct calico_ct_leg {

__u32 opener:1;

__u32 workload:1;
Copy link
Member

Choose a reason for hiding this comment

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

Can imagine forgetting that this means "the source of this leg is a local workload iface" at some point. Worth a comment just to make ti really clear?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs-not-required Docs not required for this change release-note-not-required Change has no user-facing impact
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants