Skip to content

(13) feat(cascade): in-memory LSM match-action store + real-shape ACL tests#1567

Draft
daniel-noland wants to merge 2 commits into
pr/daniel-noland/acl-dpdkfrom
pr/daniel-noland/acl-pat-design
Draft

(13) feat(cascade): in-memory LSM match-action store + real-shape ACL tests#1567
daniel-noland wants to merge 2 commits into
pr/daniel-noland/acl-dpdkfrom
pr/daniel-noland/acl-pat-design

Conversation

@daniel-noland
Copy link
Copy Markdown
Collaborator

@daniel-noland daniel-noland commented May 26, 2026

Stack (13), this PR (retargeted). Base: pr/daniel-noland/acl-dpdk.

In-memory LSM-shaped match-action storage primitive, plus tests that drive it
with a real ACL-shaped consumer.

  • feat(cascade): in-memory LSM-shaped match-action storage primitive.
  • test(cascade): real-shape ACL consumer + bolero + subscribe tests.

Review stack (merge bottom -> top):

@daniel-noland daniel-noland changed the base branch from main to pr/daniel-noland/threading-rewrite May 26, 2026 00:39
@daniel-noland daniel-noland force-pushed the pr/daniel-noland/acl-pat-design branch 7 times, most recently from 45262b6 to df3cbd7 Compare May 28, 2026 05:53
@daniel-noland daniel-noland self-assigned this May 28, 2026
@daniel-noland daniel-noland requested a review from Copilot May 28, 2026 06:05
Copy link
Copy Markdown
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

The PR title explicitly says "(ignore for now) acl design test" — this is a large design-exploration PR introducing a new match-action / ACL framework spanning many new workspace crates, plus supporting changes to existing crates.

Changes:

  • Introduces several new workspace crates: fixed-size, lookup, match-action, match-action-derive, cascade, acl, dpdk-test-macros, and a scratch ACL module under dpdk.
  • Adds a MatchKey derive (with #[exact]/#[prefix]/#[mask]/#[range] field attributes), parallel <Name>Rule struct emission, and lowering into a reference and DPDK rte_acl backend, plus extensive property/differential tests and Criterion benches.
  • Adds infrastructure: a dpdk::test_support EAL bootstrap + #[with_eal] attribute macro, a cascade crate (LSM-style match-action storage with Upsert/MergeInto/drain subscription), a bench-builder Nix target, and a compute_min_input_size const fn on AclBuildConfig.

Reviewed changes

Copilot reviewed 66 out of 67 changed files in this pull request and generated no comments.

Show a summary per file
File Description
Cargo.toml Registers new workspace members, deps, and per-package miri/wasm metadata
fixed-size/** New no_std crate defining FixedSize trait with primitive/IpAddr impls
lookup/** New crate with Lookup/Projection traits and BTreeMap/HashMap impls
match-action/, match-action-derive/ New backend-agnostic match-key vocabulary + #[derive(MatchKey)]
net/src/fixed_size.rs, net/src/lib.rs, net/Cargo.toml FixedSize impls for TcpPort/UdpPort/UnicastIpv4Addr/Vni
cascade/** New LSM-style cascade primitive with Upsert/MergeInto/drain subscription
dpdk/Cargo.toml, dpdk/src/lib.rs, dpdk/src/test_support.rs Optional test feature exposing shared EAL bootstrap + #[with_eal] macro
dpdk-test-macros/** New proc-macro crate providing the #[with_eal] attribute
dpdk/src/acl/config.rs Makes compute_min_input_size a public const fn; doc/spelling cleanup
dpdk/src/acl/scratch.rs Scratch/sketch file with non-compiling design notes
acl/** New crate: DPDK rte_acl backend, reference linear-scan oracle, tests, benches
default.nix, justfile New benches Nix target and just bench recipe to build/run benches

@daniel-noland daniel-noland force-pushed the pr/daniel-noland/acl-pat-design branch 5 times, most recently from 1d88968 to 5109431 Compare May 28, 2026 22:03
@daniel-noland daniel-noland changed the title (ignore for now) acl design test acl design work May 28, 2026
@daniel-noland daniel-noland requested a review from Copilot May 28, 2026 22:04
Copy link
Copy Markdown
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

Copilot reviewed 64 out of 65 changed files in this pull request and generated no new comments.

@daniel-noland daniel-noland force-pushed the pr/daniel-noland/acl-pat-design branch 2 times, most recently from 137d9d9 to af41ab0 Compare May 28, 2026 22:23
Comment thread match-action/src/lib.rs Outdated
clippy::expect_used,
clippy::panic
)]
#![allow(missing_docs)] // shape settling; doc once stable
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 no longer applies

@daniel-noland daniel-noland force-pushed the pr/daniel-noland/acl-pat-design branch 3 times, most recently from c347061 to 592cd9d Compare May 29, 2026 01:59
@daniel-noland daniel-noland force-pushed the pr/daniel-noland/threading-rewrite branch 3 times, most recently from de5a2c1 to fd80413 Compare May 31, 2026 02:03
@daniel-noland daniel-noland force-pushed the pr/daniel-noland/threading-rewrite branch 3 times, most recently from 800f5dc to 2021414 Compare May 31, 2026 03:52
Introduces dataplane-cascade.  Models a small in-memory LSM: writes
land in a concurrent multi-writer head, periodically frozen into
immutable intermediate layers, eventually compacted into an immutable
tail.  Readers walk head -> frozen[] -> tail and stop at the first
definitive answer.

The same primitive serves three problems via one Upsert trait:
match-action table updates (atomic publish under load), hardware
offload programming (drain output feeds the HW backend), and
active-active state replication (serialized drain output ships to
peer dataplanes).  freeze / fuse / compact / merge are all the same
Upsert operation applied to different operands.

Layout:

- lib.rs publishes the surface: Cascade / DrainEvent / FrozenEntry /
  Snapshot, the Upsert / MergeInto / MutableHead traits, Generation,
  and re-exports Lookup / Projection from the lookup crate.
- cascade.rs is the central type plus the rotate / drain / publish
  state machine.  Cascade::subscribe is feature-gated under
  `subscribe` (tokio broadcast).
- head.rs / merge.rs / upsert.rs are the trait definitions plus
  LastWriteWins as a stock blanket-friendly Upsert impl.
- generation.rs carries the monotonic Generation counter that orders
  layers within a cascade.
- property_tests.rs is a reusable bolero harness (under the bolero
  feature) consumer crates use to verify their own Upsert impls
  against the cascade's algebraic laws.  Exercised by a self-test
  in the next PR.

tests/smoke.rs is the trait-shape end-to-end with a trivial concrete
implementation: head shadows sealed shadows tail, tombstones in the
head suppress lower-layer hits, rotate seals and publishes.  Uses
the shared tests/common/mod.rs helpers that subsequent tests also
share.

Cascade is independent of every other PR in this stack: no acl dep,
no match-action dep.  Real-shape consumer pressure plus
bolero / subscribe integration tests land in the next PR.

just fmt; cargo check --workspace --all-targets passes.
Three integration tests that round out the cascade's test surface --
each exercises a different part of the design pressure that shaped
the trait surface in the previous PR.

tests/acl_consumer.rs is the first real-shaped consumer: a minimal
ACL classifier built on top of the cascade with no upfront ACL
crate dep -- the toy ACL is built inline using only Cascade /
MergeInto / MutableHead.

Purpose: surface design pressure on the trait surface against a use
case that is NOT exact-match-keyed.  ACL classification looks up
packets by header match expressions, not by a single key, and rules
carry their own identity (priority) separate from the lookup input.
If the cascade trait shape works for ACL it almost certainly works
for anything simpler.

Scope intentionally tight: rules install-only (no shadow-rule
removal yet), match expressions src/dst IPv4 with optional single
port, head Lookup always returns None (writes visible only after a
rotation seals the head).  Comment block at the end captures the
open question about removal under cascade semantics.

tests/upsert_properties.rs is the self-test of the property harness
landed in the previous PR.  Exercises check_upsert_order_independent
against the provided LastWriteWins -- known correct by construction.
If it fails, the harness itself is broken; if it passes, it's a
useful black-box check for downstream Upsert impls.

tests/subscribe.rs is the drain-subscription integration under tokio.
Exercises Cascade::subscribe end-to-end -- gated by the cascade
`subscribe` feature (enabled in dev-deps via the self-path override
on Cargo.toml).

just fmt; cargo check --workspace --all-targets passes.
@daniel-noland daniel-noland force-pushed the pr/daniel-noland/acl-pat-design branch from 592cd9d to 70afa5a Compare May 31, 2026 04:16
@daniel-noland daniel-noland changed the title acl design work feat(cascade): in-memory LSM match-action store + real-shape ACL tests May 31, 2026
@daniel-noland daniel-noland changed the base branch from pr/daniel-noland/threading-rewrite to pr/daniel-noland/acl-dpdk May 31, 2026 04:26
@daniel-noland daniel-noland changed the title feat(cascade): in-memory LSM match-action store + real-shape ACL tests (13) feat(cascade): in-memory LSM match-action store + real-shape ACL tests May 31, 2026
@daniel-noland daniel-noland requested a review from Copilot May 31, 2026 04:32
Copy link
Copy Markdown
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

Copilot reviewed 14 out of 15 changed files in this pull request and generated no new comments.

Copy link
Copy Markdown
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

Copilot reviewed 14 out of 15 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants