Skip to content

nftables flowtable support#9458

Open
caseydavenport wants to merge 3 commits intoprojectcalico:masterfrom
caseydavenport:casey-flowtables
Open

nftables flowtable support#9458
caseydavenport wants to merge 3 commits intoprojectcalico:masterfrom
caseydavenport:casey-flowtables

Conversation

@caseydavenport
Copy link
Member

@caseydavenport caseydavenport commented Nov 8, 2024

Description

This is a proof-of-concept PR for implementing nftables flowtable support in Calico. flowtables allow bypassing of large parts of the Linux networking stack for established connections, which should theoretically substantially improve the performance especially for longer lived connections.

Some key things to consider here:

  • How does this interact with a potential equivalent implemention in kube-proxy?
  • How does this perform in clusters with larger numbers of short-lived connections?
    • Does flowtable overhead actually hurt those environments?
    • Do we need to be able to include / exclude certain endpoints or flows from this optimization?
    • Should it be configurable via e.g., policy?

Related issues/PRs

Kube-proxy implementation: kubernetes/kubernetes#128392

Todos

  • Tests
  • Documentation
  • Release note

Release Note

Support for flowtables in nftables data plane for improved connection performance. 

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.

@caseydavenport caseydavenport requested a review from a team as a code owner November 8, 2024 18:04
@marvin-tigera marvin-tigera added this to the Calico v3.30.0 milestone Nov 8, 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 Nov 8, 2024
@github-actions
Copy link

This PR is stale because it has been open for 60 days with no activity.

@github-actions github-actions bot added the stale Issues without recent activity label Nov 15, 2025
@caseydavenport caseydavenport removed the stale Issues without recent activity label Nov 17, 2025
@github-actions
Copy link

This PR is stale because it has been open for 60 days with no activity.

@github-actions github-actions bot added the stale Issues without recent activity label Jan 17, 2026
Copilot AI review requested due to automatic review settings March 3, 2026 03:50
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Proof-of-concept implementation to explore nftables flowtable offload in Felix, aiming to speed up established connections by offloading them from parts of the Linux networking stack.

Changes:

  • Add a new generic FlowOffload() action and nftables fragment rendering for flow offload @<flowtable>.
  • Add prototype wiring to update an nftables flowtable’s device list from the dataplane.
  • Prototype nftables VMAP-based workload dispatch chain rendering.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
felix/rules/static.go Adds a FORWARD-chain rule intended to offload established flows to a flowtable (nftables-only).
felix/rules/dispatch.go Switches workload dispatch chain rendering toward an nftables VMAP approach (prototype).
felix/nftables/table.go Introduces an interface/device handler to program a knftables.Flowtable based on interface updates.
felix/nftables/actions.go Implements nftables FlowOffloadAction rendering (flow offload @...).
felix/iptables/actions.go Adds an iptables FlowOffload() stub implementation to satisfy the action factory interface.
felix/generictables/actions.go Extends ActionFactory with FlowOffload(table string).
felix/dataplane/linux/int_dataplane.go Wires an InterfaceHandler from the nftables root table into the endpoint manager.
felix/dataplane/linux/endpoint_mgr.go Updates nftables dispatch maps and (prototype) pushes an interface list into the flowtable handler.

@github-actions github-actions bot removed the stale Issues without recent activity label Mar 3, 2026
@caseydavenport caseydavenport changed the title [Prototype] nftables flowtable support nftables flowtable support Mar 4, 2026
caseydavenport and others added 3 commits March 11, 2026 17:14
- Fix compile errors: r.NFTables -> r.nft, add missing test parameter
- Revert WorkloadDispatchChains to use existing vmap dispatch (correct
  map names, works for both iptables and nftables)
- Replace hardcoded interface names with dynamic overlay device detection
  from encapsulation config (VXLAN, IPIP, WireGuard) and workload
  interface tracking from endpoint manager
- Move flowtable programming into Apply() transaction instead of running
  a separate transaction with log.Fatal on failure
- Scope flowtable offload rule to only Calico-accepted traffic by
  checking the accept mark bit, and move it to the forward append rules
- Remove unused chainExists method

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs-pr-required Change is not yet documented hold-merge release-note-required Change has user-facing impact (no matter how small)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants