Skip to content

ARP, ICMP and more - #4

Merged
gspivey merged 3 commits into
mainfrom
claude/tokio-dpdk-sample-app-wc3Om
Feb 6, 2026
Merged

gspivey merged 3 commits into
mainfrom
claude/tokio-dpdk-sample-app-wc3Om

Conversation

@gspivey

@gspivey gspivey commented Feb 6, 2026

Copy link
Copy Markdown
Owner

Phase 3: Protocol Support ✅

  • ARP request/response handling ✅
  • ICMP echo reply (ping) ✅
  • Connection tracking for connected sockets ✅

Phase 4: Advanced Features ✅

  • Multicast group management via DPDK ✅
  • Promiscuous mode integration ✅
  • Hardware offload configuration ✅
  • Device capability checking ✅

Add protocol support modules for real network communication:

- ARP module (arp.rs):
  - Request/response handling with automatic reply generation
  - Thread-safe ARP cache with TTL-based expiration
  - Opportunistic learning from all observed ARP packets
  - Support for multiple local IP addresses

- ICMP module (icmp.rs):
  - Echo request/reply (ping) support
  - Automatic ping response when enabled
  - Proper checksum calculation

- Connection tracking:
  - ConnectionState struct with packet/byte counters
  - Receive queue for buffering incoming packets
  - Statistics accessible via connection_stats()

- UdpSocket enhancements:
  - Integrated ARP resolution for destination MACs
  - Auto-response to ARP requests (configurable)
  - Auto-response to ICMP echo (configurable)
  - Methods: set_auto_arp(), set_auto_icmp(), connection_stats()

47 tests passing (14 ARP + 11 ICMP + 10 UDP API + 12 packet tests)

https://claude.ai/code/session_01UiHnsVmMyk1CJgck3cCYZQ
Plan for non-DPDK fallback using AF_PACKET raw sockets:
- Same packet building/parsing code
- Same ARP/ICMP handlers
- Abstract PacketBackend trait for runtime selection

https://claude.ai/code/session_01UiHnsVmMyk1CJgck3cCYZQ
…ffloads

Add advanced networking features to the DPDK stack:

Multicast Support:
- join_multicast_v4() / leave_multicast_v4() for group management
- set_multicast_all() for all-multicast mode
- IPv4 to multicast MAC address conversion (01:00:5e:xx:xx:xx)

Promiscuous Mode:
- set_promiscuous() / is_promiscuous() on Port
- Configurable via PortConfig at initialization

Hardware Offload Support:
- RxOffload / TxOffload configuration structs
- Device capability checking (DeviceCapabilities)
- Only enables offloads that hardware actually supports
- Active offload query methods
- Supported: IPv4/UDP/TCP checksum, VLAN strip/insert

Key safety feature: Requested offloads are AND-ed with device
capabilities, so unsupported offloads are silently disabled
with a warning, rather than causing failures.

All 47 existing tests still pass.

https://claude.ai/code/session_01UiHnsVmMyk1CJgck3cCYZQ
@gspivey
gspivey merged commit 263bb36 into main Feb 6, 2026
1 check passed
@gspivey
gspivey deleted the claude/tokio-dpdk-sample-app-wc3Om branch February 19, 2026 00:52
gspivey pushed a commit that referenced this pull request Mar 25, 2026
…m defaults

- README: replace "10-100x" claim with actual measured ~2x PPS improvement,
  remove multi-core pipeline section (experimental), fix stale --dpdk flag
- echo app: rewrite to mirror plain-echo (65 lines vs 282), demonstrating
  the drop-in replacement story (only difference is the import line)
- plain-echo: add signal handling and read timeout to match echo structure
- perf-test-log: add Run #4 entry for topology simplification PR #26
- perf-tests: remove rust-dpdk-multicore from default configs (experimental)

https://claude.ai/code/session_013kEK2d9wyTRWwmoAB4VBco
gspivey pushed a commit that referenced this pull request Mar 25, 2026
Run #5 (23548559577) had anomalous kernel numbers (78% drop at 64B/700K)
due to a bad EC2 instance. Run #6 (23567309410) shows normal kernel
performance (51% drop) consistent with Run #4. Updated both
perf-test-log.md and README performance tables with the correct data.

DPDK advantage is consistently ~2x at saturation, not the 3-4x that the
outlier suggested.

https://claude.ai/code/session_013kEK2d9wyTRWwmoAB4VBco
gspivey pushed a commit that referenced this pull request Jun 6, 2026
- Append Run #31 results to docs/perf-test-log.md (no regression)
- Mark ROADMAP item #4 (Frame building with TOS/ECN) as complete with PR #68
gspivey added a commit that referenced this pull request Jun 6, 2026
## Roadmap Item

Addresses **ROADMAP #4**: `dpdk-stdlib-quic`: Frame building with
TOS/ECN support.

Spec: `.kiro/specs/s2n-quic-provider/` tasks 4.1, 4.2, 4.3.

## Changes

### dpdk-udp (additive, non-breaking)

- Added `build_udp_frame_into_with_tos(out, src_mac, dst_mac, src_ip,
dst_ip, src_port, dst_port, payload, ttl, tos)` — identical to
`build_udp_frame_into` but sets `frame[ip+1] = tos` and recomputes the
IPv4 header checksum in software.

### dpdk-stdlib-quic

- Replaced the placeholder `frame.rs` with a proper module that
re-exports `build_udp_frame_into_with_tos` and provides a
`build_quic_frame` convenience wrapper (hardcodes TTL=64 for the typical
QUIC TX pattern).

## Tests Added

**dpdk-udp (4 tests):**
- `test_build_udp_frame_with_tos_byte_placement` — verifies TOS byte at
correct IPv4 offset
- `test_build_udp_frame_with_tos_checksum_valid` — verifies IPv4
checksum after TOS modification
- `test_build_udp_frame_with_tos_ecn_round_trip` — verifies all 4 ECN
codepoints survive
- `test_build_udp_frame_with_tos_zero_matches_original` — verifies TOS=0
produces identical frame to original function

**dpdk-stdlib-quic (3 tests):**
- `frame::tests::tos_byte_at_correct_offset`
- `frame::tests::checksum_valid_after_tos`
- `frame::tests::ecn_round_trip_through_frame`

## Validation

- `cargo build`: ✅ (warnings only from unrelated placeholder fields)
- `cargo test`: ✅ All 613 existing tests pass + 7 new tests pass
- Zero regression on existing crates' public APIs

## Tradeoffs

None — this is a purely additive change. The new function shares the
same structure as `build_udp_frame_into`, differing only in setting the
TOS byte instead of hardcoding 0x00.

---------

Co-authored-by: Agent Router <agent@agent-router.dev>
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