Skip to content

(14) dpdk: RX metadata - #1877

Open
daniel-noland wants to merge 1 commit into
pr/daniel-noland/dataplane-perffrom
split/dpdk-core/04-rx-metadata
Open

daniel-noland wants to merge 1 commit into
pr/daniel-noland/dataplane-perffrom
split/dpdk-core/04-rx-metadata

Conversation

@daniel-noland

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

Copy link
Copy Markdown
Collaborator

Expose mbuf offload flags and optional RSS, MARK and META values. Register META during EAL startup, before pools or workers become available, and fail startup if registration fails. All binding mechanics remain inside dpdk.

Preserve the distinction between an absent value and a reported zero. Document RSS/MARK coexistence, mlx5 META zero semantics, and device-dependent widths and TAG availability.

Validation: native DPDK tests pass (148 unit tests, the lifecycle integration test, and doctests). New tests cover validity flags, zero values, simultaneous RSS/MARK delivery, deep copies, and recycled buffers. Clippy passes for dpdk and the dataplane with warnings denied. Physical-NIC metadata delivery remains untested.

@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 Fredi-raspall and removed request for a team October 3, 2026 05:32
@coderabbitai

coderabbitai Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 37264ef6-6c3c-4a59-956d-8fa9a404c019

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 8b8fd3f7-be76-4604-b02f-d0df4b35e2b7
📥 Commits

Reviewing files that changed from the base of the PR and between bc9de15 and 113667a.

📒 Files selected for processing (1)
  • dpdk/src/mem.rs

Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.

📝 Walkthrough

Mbuf gains public accessors for receive offload flags, RSS hashes, flow marks, and dynamic metadata. RSS hashes, flow marks, and metadata are returned only when their respective validity conditions are met.

Changes: Mbuf receive accessors

Layer / File(s) Summary
Receive flag and metadata accessors
dpdk/src/mem.rs
Adds ol_flags and accessors for RSS hashes, flow marks, and dynamic metadata. The value accessors return None when their validity conditions are not met.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 11366

This PR adds read-only accessors for receive flags, RSS hashes, flow marks and flow metadata on Mbuf. Each accessor returns a value only when its validity condition is met. No merge-blocking risk was found.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 83.33% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 1 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the DPDK receive metadata change, which is the main focus of the pull request.
Description check ✅ Passed The description explains the exposed mbuf receive values, metadata registration, and validation related to the changeset.
  • 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/mem.rs
Comment on lines +502 to +505
pub fn ol_flags(&self) -> u64 {
// SAFETY: `self.raw` is a live mbuf for the lifetime of `&self`.
unsafe { self.raw.as_ref() }.ol_flags
}

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.

this should likely return a stronger type. A bitfield enum or some such

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.

yeah, was going to ask. That's fine for now.

@codecov

codecov Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Codecov Report

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

Files with missing lines Patch % Lines
dpdk/src/eal.rs 40.00% 2 Missing and 1 partial ⚠️

📢 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 force-pushed the split/dpdk-core/03-buffers branch from bc9de15 to 56039b8 Compare October 3, 2026 20:12
@daniel-noland
daniel-noland removed this pull request from stack #1882 October 3, 2026 21:41
@daniel-noland
daniel-noland force-pushed the split/dpdk-core/03-buffers branch from 56039b8 to 996c9bc Compare October 3, 2026 21:45
@daniel-noland
daniel-noland force-pushed the split/dpdk-core/04-rx-metadata branch from 113667a to 2163a66 Compare October 3, 2026 23:39
@daniel-noland
daniel-noland changed the base branch from split/dpdk-core/03-buffers to split/dpdk-core/03b-segments October 3, 2026 23:39
@daniel-noland
daniel-noland force-pushed the split/dpdk-core/03b-segments branch from ab54519 to 4d77831 Compare October 4, 2026 06:05
@daniel-noland
daniel-noland force-pushed the split/dpdk-core/04-rx-metadata branch from 2163a66 to 984402b Compare October 4, 2026 06:05
@daniel-noland
daniel-noland changed the base branch from split/dpdk-core/03b-segments to pr/daniel-noland/dataplane-perf October 4, 2026 06:07
@daniel-noland daniel-noland changed the title (05) dpdk: RX metadata (14) dpdk: RX metadata Oct 4, 2026
@daniel-noland
daniel-noland force-pushed the pr/daniel-noland/dataplane-perf branch 3 times, most recently from afe8502 to d420126 Compare October 6, 2026 05:09
@daniel-noland
daniel-noland force-pushed the split/dpdk-core/04-rx-metadata branch 2 times, most recently from c498514 to b4ef0da Compare October 6, 2026 06:23

@Fredi-raspall Fredi-raspall 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.

I can't spot any issue with this PR, other than the lack for a type to keep the metadata flags and hash. My main question is how we're going to use this info, but that's out of the scope of the PR.

Comment thread dpdk/src/mem.rs
Comment on lines +502 to +505
pub fn ol_flags(&self) -> u64 {
// SAFETY: `self.raw` is a live mbuf for the lifetime of `&self`.
unsafe { self.raw.as_ref() }.ol_flags
}

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.

yeah, was going to ask. That's fine for now.

@daniel-noland
daniel-noland force-pushed the pr/daniel-noland/dataplane-perf branch from d420126 to f4e8ced Compare October 7, 2026 03:09
@daniel-noland
daniel-noland force-pushed the split/dpdk-core/04-rx-metadata branch 2 times, most recently from bb4fb47 to 6ae5b96 Compare October 8, 2026 00:41
@daniel-noland
daniel-noland force-pushed the pr/daniel-noland/dataplane-perf branch 2 times, most recently from 1c6c248 to cba901d Compare October 8, 2026 01:53
@daniel-noland
daniel-noland force-pushed the split/dpdk-core/04-rx-metadata branch 2 times, most recently from 77e730c to 9c442cd Compare October 8, 2026 03:32
@daniel-noland
daniel-noland force-pushed the pr/daniel-noland/dataplane-perf branch from cba901d to f071e76 Compare October 8, 2026 03:32
Comment thread dpdk/src/mem.rs
Comment on lines +5 to +19
//!
//! RSS, MARK and META have independent validity flags:
//!
//! | Value | Storage | Software access |
//! | --- | --- | --- |
//! | RSS | `hash.rss`, overlapping `hash.fdir.lo` | [`Mbuf::rss_hash`] |
//! | MARK | `hash.fdir.hi` | [`Mbuf::rx_mark`] |
//! | META | Registered dynamic `u32` field | [`Mbuf::rx_meta`] |
//! | TAG | Indexed hardware steering registers | No mbuf field |
//!
//! [RSS and MARK can coexist](https://doc.dpdk.org/api/structrte__flow__action__rss.html).
//! META uses separate mbuf storage. Supported combinations, widths and cross-domain propagation
//! still depend on the PMD and its configuration. TAG has a 32-bit API value; usable indices and
//! register availability are device-specific. It is not delivered to software, and applications
//! must not assume it survives a software queue round trip or a hardware hairpin boundary.

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.

reformat table

@daniel-noland
daniel-noland force-pushed the split/dpdk-core/04-rx-metadata branch from 9c442cd to 5349632 Compare October 8, 2026 07:16
@daniel-noland
daniel-noland force-pushed the pr/daniel-noland/dataplane-perf branch from f071e76 to 65a9eae Compare October 8, 2026 07:16
@daniel-noland
daniel-noland force-pushed the pr/daniel-noland/dataplane-perf branch from 65a9eae to aed90ca Compare October 16, 2026 05:47
@daniel-noland
daniel-noland force-pushed the split/dpdk-core/04-rx-metadata branch from 5349632 to 7e10438 Compare October 16, 2026 05:47
@daniel-noland
daniel-noland force-pushed the pr/daniel-noland/dataplane-perf branch from aed90ca to 6c9cf2a Compare October 16, 2026 08:43
@daniel-noland
daniel-noland force-pushed the split/dpdk-core/04-rx-metadata branch from 7e10438 to 0c8e642 Compare October 16, 2026 08:43
@daniel-noland
daniel-noland force-pushed the pr/daniel-noland/dataplane-perf branch from 6c9cf2a to de95cd8 Compare October 17, 2026 03:26
@daniel-noland
daniel-noland force-pushed the split/dpdk-core/04-rx-metadata branch from 0c8e642 to dfa429f Compare October 17, 2026 03:26
@daniel-noland
daniel-noland force-pushed the pr/daniel-noland/dataplane-perf branch from de95cd8 to 68605fa Compare October 17, 2026 05:59
@daniel-noland
daniel-noland force-pushed the split/dpdk-core/04-rx-metadata branch 2 times, most recently from b1b5db5 to 6cb84ce Compare October 17, 2026 06:17
@daniel-noland
daniel-noland force-pushed the pr/daniel-noland/dataplane-perf branch from 68605fa to 8321a55 Compare October 17, 2026 06:17
Expose optional RSS, MARK and META values using their validity flags.
Register META during EAL initialization, before exposing pools or queues;
terminate startup if registration fails.

Document field coexistence and PMD limits. Test metadata against native
DPDK mbufs, including zero values, copies and recycled buffers.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Daniel Noland <daniel@githedgehog.com>
@daniel-noland
daniel-noland force-pushed the pr/daniel-noland/dataplane-perf branch from 8321a55 to 8a76f6d Compare October 17, 2026 22:06
@daniel-noland
daniel-noland force-pushed the split/dpdk-core/04-rx-metadata branch from 6cb84ce to 85d5b3e Compare October 17, 2026 22:06
Comment thread dpdk/src/eal.rs
if ret != 0 {
Eal::fatal_error(format!(
"failed to register RX metadata: {}",
errno::ErrorCode::parse_i32(ret)

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.

Note

AI-assisted review: This comment was drafted with Claude and reviewed by @mvachhar.

Small one: rte_flow_dynf_metadata_register returns -rte_errno on failure (lib/ethdev/rte_flow.c), so ret is negative here and ErrorCode::parse_i32 reports it as an unknown errno (e.g. -12) rather than ENOMEM. Negating it gives the readable error:

Suggested change
errno::ErrorCode::parse_i32(ret)
errno::ErrorCode::parse_i32(-ret)

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.

3 participants