Repository navigation
feat: hardware VLAN offload for NIC-assisted 802.1Q tag insert/strip - #37
Conversation
Add hardware VLAN offload support following the existing checksum offload pattern. When the NIC supports it (e.g., ENA on AWS), VLAN tags are inserted on TX and stripped on RX in hardware, eliminating the ~10% CPU overhead of software tag manipulation on tagged frames. TX path: build untagged frame, set mbuf.vlan_tci + RTE_MBUF_F_TX_VLAN RX path: NIC strips tag into mbuf.vlan_tci, software re-inserts for uniform VLAN filtering. Falls back to software on unsupported NICs. New public API: - VlanConfig::with_force_software(bool) - force software mode - UdpSocket::has_tx_vlan_offload() / has_rx_vlan_offload() - PortConfig::with_vlan_offload() https://claude.ai/code/session_01WRu2gZPeAMT14C5met7oqL
Integration Test Failure (Run 24320287292)Branch: failure-summary.json{
"failed_step": "deploy_infrastructure",
"error": "Infrastructure deployment failed",
"exit_code": 2,
"timestamp": "2026-04-13T00:42:30.348269Z",
"sender_instance_id": "",
"receiver_instance_id": "",
"commit": "2fdb0143a76be9b6bbd3c2a56bfdcaca226cb1b0",
"run_url": "https://github.com/gspivey/dpdk-stdlib-rust/actions/runs/24320287292"
}```
### instance-0-user-data.log (8683 bytes, last 80 lines)Compiling either v1.15.0 Compiling clap_derive v4.6.0 error[E0277]: no implementation for Compiling clap v4.6.0 Compiling bindgen v0.70.1 warning: error[E0277]: no implementation for Compiling tokio-macros v2.7.0 [ 159.808323] cloud-init[1851]: Downloaded async-trait v0.1.89 [ 179.654258] cloud-init[1813]: Compiling is_terminal_polyfill v1.70.2 total 116 |
❌ Integration Tests Failed (Run 24320287292)Branch: Test ResultsApplication Logs (last 20 lines)Full Application Logs (last 200 lines each)Network & PCI Stateinstance-0-network-interfaces.loginstance-1-network-interfaces.log
|
When building with real DPDK, bindgen may generate RTE_MBUF_F_RX_VLAN_STRIPPED and similar offload constants as u32 (from anonymous C enums), while ol_flags and offload capability fields are u64. Adding explicit `as u64` casts at all usage sites ensures the code compiles correctly with both stubs and real DPDK. https://claude.ai/code/session_01WRu2gZPeAMT14C5met7oqL
[CI] Stage: DeployInfrastructure ready.
|
[CI] Stage: SummaryAll tests PASSED. ARP seeding: kernel /proc/net/arp (automatic)
|
[Perf] Stage: DeployDeploying |
✅ Integration Tests Passed (Run 24320661951)Branch: Test Results
Application Logs (last 20 lines)receiver-echo-server.log sender-echo-server.log sender-test-client.log receiver-test-client-iperf.log sender-test-client-iperf.log Full Application Logs (last 200 lines each)receiver-echo-server.logsender-echo-server.logsender-test-client.logreceiver-test-client-iperf.logsender-test-client-iperf.log
|
[Perf] Stage: Instances Ready
|
[Perf] Stage: TRex ConfigStarting TRex configuration (MAC discovery + NIC binding)... |
[Perf] Stage: TRex Config OK
|
[Perf] Stage: TRex StartedTRex server running. Beginning benchmarks... |
[Perf] DUT ReadyDUT instance |
[Perf] Stage: Benchmark (1/4)Running |
[Perf] Benchmark Diag:
|
[Perf] Benchmark Diag:
|
[Perf] Stage: Benchmark (2/4)Running |
[Perf] Benchmark Diag:
|
[Perf] Benchmark Diag:
|
[Perf] Stage: Benchmark (3/4)Running |
[Perf] Benchmark Diag:
|
[Perf] Benchmark Diag:
|
[Perf] Stage: Benchmark (4/4)Running |
[Perf] Benchmark Diag:
|
[Perf] Benchmark Diag:
|
[Perf] Diag: testpmd logtestpmd output (last 30 lines) |
[Perf] Stage: Results[02:18:20] INFO Generating markdown summary... Performance Test Results — unknownCommit: 64B packets
512B packets
1400B packets
8500B packets
NIC Drops Instrumentation Self-CheckCompares
plain-rust Kernel NIC Drops (ethtool -S delta)ethtool snapshots not available — baseline or final file missing in |
No regression from hardware VLAN offload changes. At 700K PPS with 64B packets: rust-dpdk 665K RX (4.9% drop) vs native-dpdk 685K (2.1% drop) vs kernel 344K (50.8% drop). 1.93x throughput advantage over kernel. https://claude.ai/code/session_01WRu2gZPeAMT14C5met7oqL
[CI] Stage: DeployInfrastructure ready.
|
[CI] Stage: SummaryAll tests PASSED. ARP seeding: kernel /proc/net/arp (automatic)
|
✅ Integration Tests Passed (Run 24322652114)Branch: Test Results
Application Logs (last 20 lines)receiver-echo-server.log sender-echo-server.log sender-test-client.log receiver-test-client-iperf.log sender-test-client-iperf.log Full Application Logs (last 200 lines each)receiver-echo-server.logsender-echo-server.logsender-test-client.logreceiver-test-client-iperf.logsender-test-client-iperf.log
|
Adds hw_vlan_strip_benchmark test that measures the performance difference between reconstructing tagged frames (current approach) and passing hw_vlan_tci directly to detect_vlan (proposed approach). Results show 18x speedup by eliminating the per-packet Vec allocation. https://claude.ai/code/session_01WRu2gZPeAMT14C5met7oqL
[CI] Stage: DeployInfrastructure ready.
|
Replace per-packet frame reconstruction with direct hw_vlan_tci passthrough. When the NIC strips VLAN tags, recv_frames() no longer rebuilds tagged frames from untagged bytes + mbuf metadata. Instead, detect_vlan() accepts an optional hw_vlan_tci parameter that carries the hardware-provided TCI directly to VLAN filtering. Changes: - detect_vlan(frame, hw_vlan_tci) - new parameter overrides vlan_tci in FrameLayout for NIC-stripped frames without modifying frame bytes - process_frame_zerocopy() threads hw_vlan_tci from mbuf to detect_vlan - recv_frames() simplified: no more Vec allocation + memcpy per packet - New test: process_frame_zerocopy_hw_vlan_tci_filters_correctly - Updated test: test_rx_hw_vlan_strip_direct_tci (was reconstruction) - HW VLAN strip benchmark added as standard perf regression guard Benchmark: 1.26x speedup (980K vs 780K PPS), 262 ns saved per packet. https://claude.ai/code/session_01WRu2gZPeAMT14C5met7oqL
Explains how DPDK mbuf metadata drives hardware offloads for both checksum and VLAN operations. Covers the rte_mbuf layout, TX checksum offload (ol_flags + tx_offload bit-fields), TX VLAN insert (vlan_tci), and RX VLAN strip with direct TCI passthrough. Updates the HW VLAN offload roadmap entry to reflect the zero-allocation approach. https://claude.ai/code/session_01WRu2gZPeAMT14C5met7oqL
[CI] Stage: SummaryAll tests PASSED. ARP seeding: kernel /proc/net/arp (automatic)
|
✅ Integration Tests Passed (Run 24341884663)Branch: Test Results
Application Logs (last 20 lines)receiver-echo-server.log sender-echo-server.log sender-test-client.log receiver-test-client-iperf.log sender-test-client-iperf.log Full Application Logs (last 200 lines each)receiver-echo-server.logsender-echo-server.logsender-test-client.logreceiver-test-client-iperf.logsender-test-client-iperf.log
|
[CI] Stage: DeployInfrastructure ready.
|
[CI] Stage: SummaryAll tests PASSED. ARP seeding: kernel /proc/net/arp (automatic)
|
✅ Integration Tests Passed (Run 24342480342)Branch: Test Results
Application Logs (last 20 lines)receiver-echo-server.log sender-echo-server.log sender-test-client.log receiver-test-client-iperf.log sender-test-client-iperf.log Full Application Logs (last 200 lines each)receiver-echo-server.logsender-echo-server.logsender-test-client.logreceiver-test-client-iperf.logsender-test-client-iperf.log
|
Summary
mbuf.vlan_tci) and RX (NIC strips tag intombuf.vlan_tci, software re-inserts for uniform VLAN filtering)VlanConfig::with_force_software(bool),UdpSocket::has_tx_vlan_offload()/has_rx_vlan_offload(),PortConfig::with_vlan_offload()Changes by crate
stubs.rs,shim.rsRTE_MBUF_F_TX_VLAN,RTE_MBUF_F_RX_VLAN,RTE_MBUF_F_RX_VLAN_STRIPPEDconstants; stubs now report VLAN offload capabilitiesmbuf.rs,port.rsvlan_tci()/set_vlan_tci()on Mbuf; addedwith_vlan_offload()on PortConfiglib.rs,topology.rsVlanConfiggainsforce_softwarefield;send_frameaccepts optional VLAN TCIREADME.mdTest plan
cargo buildpasses with no new errorscargo test— all 358 tests pass (8 new)https://claude.ai/code/session_01WRu2gZPeAMT14C5met7oqL