Skip to content

(08) dpdk: typed flow wrappers - #1880

Draft
daniel-noland wants to merge 8 commits into
split/dpdk-core/06-rssfrom
split/dpdk-core/07-flow
Draft

daniel-noland wants to merge 8 commits into
split/dpdk-core/06-rssfrom
split/dpdk-core/07-flow

Conversation

@daniel-noland

@daniel-noland daniel-noland commented Oct 3, 2026 •

Copy link
Copy Markdown
Collaborator

Basically all meaningful testing of this logic requires physical hardware. And expensive / fancy hardware at that.

We can validate it on the lab systems, but I can't really help you regarding testing here.

Any mock / fake I craft is just doubling or tripling the amount of code in play without actually validating anything meaningful.

daniel-noland and others added 8 commits October 2, 2026 22:58
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Daniel Noland <daniel@githedgehog.com>
FlowRule borrows a started device and destroys the rule on drop. Domain
types select ingress, egress, or transfer; FlowError classifies PMD errors.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Daniel Noland <daniel@githedgehog.com>
Async flow destruction requires queue management rather than this Drop
lifecycle.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Daniel Noland <daniel@githedgehog.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Daniel Noland <daniel@githedgehog.com>
Track the last matched header in FlowBuilder and constrain the next
match using the existing header adjacency rules.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Daniel Noland <daniel@githedgehog.com>
Sort actions by mlx5 pipeline order, preserving order within each rank.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Daniel Noland <daniel@githedgehog.com>
Use MODIFY_FIELD for immediate values. mlx5 VNI changes still require
decap and encap; per-VNI rules can stamp the VNI into META.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Daniel Noland <daniel@githedgehog.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Daniel Noland <daniel@githedgehog.com>
@daniel-noland
daniel-noland requested a review from a team as a code owner October 3, 2026 05:32
@daniel-noland
daniel-noland requested review from qmonnet and removed request for a team October 3, 2026 05:32
@coderabbitai

coderabbitai Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

Comment thread dpdk/src/flow/pattern.rs
if let Some(vni) = self.vni {
let v = vni.as_u32();
let bytes = [(v >> 16) as u8, (v >> 8) as u8, v as u8];
// Writing a union field is safe (only reads are unsafe).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

drop comment

@daniel-noland
daniel-noland marked this pull request as draft October 3, 2026 05:53
@codecov

codecov Bot commented Oct 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 6.45161% with 609 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
dpdk/src/flow/builder.rs 9.92% 381 Missing ⚠️
dpdk/src/flow/pattern.rs 0.00% 182 Missing ⚠️
dpdk/src/flow/rule.rs 0.00% 23 Missing ⚠️
dpdk/src/flow/error.rs 0.00% 17 Missing ⚠️
dpdk/src/flow/mod.rs 0.00% 6 Missing ⚠️

📢 Thoughts on this report? Let us know!

@daniel-noland
daniel-noland added this pull request to stack #1882 October 3, 2026 06:00
@daniel-noland daniel-noland self-assigned this Oct 3, 2026
@daniel-noland daniel-noland added the area/dpdk Related to DPDK (interface with or usage of the library) label Oct 3, 2026
@daniel-noland
daniel-noland requested a balanced review from Copilot October 3, 2026 17:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Flow destruction can lose live handles, mlx5 actions are reordered incorrectly, and inner VXLAN patterns cannot be constructed.

Review effort: Balanced
Findings: 3 High severity

Open (3)
What changed in this PR

Replaces the previous flow API with typed DPDK flow construction, lowering, error handling, and RAII-managed rules.

Changes:

  • Adds typestate-based flow domains and protocol ordering.
  • Adds typed match/action lowering, including VLAN and VXLAN support.
  • Adds structured PMD errors and automatic rule destruction.
File Description
dpdk/​src/​flow/​mod.rs Defines and exports the typed flow API.
dpdk/​src/​flow/​builder.rs Builds, validates, and creates hardware flow rules.
dpdk/​src/​flow/​pattern.rs Lowers typed match criteria into DPDK structures.
dpdk/​src/​flow/​error.rs Classifies PMD flow errors.
dpdk/​src/​flow/​rule.rs Manages installed rules through an RAII handle.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread dpdk/src/flow/builder.rs
Comment on lines +133 to +137
/// mlx5 action order: remove headers, mark, rewrite, push headers, forward.
/// Actions of equal rank retain their insertion order.
fn rank(&self) -> u8 {
match self {
Action::OfPopVlan | Action::VxlanDecap => 0,
Comment thread dpdk/src/flow/builder.rs
///
/// Available only after UDP (VXLAN is UDP-encapsulated). Inner (decapsulated) headers can then be
/// matched as the pattern continues, since the `net` lattice resumes at the tunnel's inner start.
pub fn match_vxlan(mut self, criteria: VxlanMatch) -> FlowBuilder<'dev, D, Vxlan>
Comment thread dpdk/src/flow/rule.rs
Comment on lines +38 to +42
// Suppress the `Drop` below so the handle is freed exactly once.
let this = ManuallyDrop::new(self);
// SAFETY: `this.flow` is a live handle for `this.port`, owned solely by `self`, and the
// `ManuallyDrop` guarantees `Drop` will not free it a second time.
unsafe { destroy(this.port, this.flow) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/dpdk Related to DPDK (interface with or usage of the library)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants