Skip to content

⚡ Bolt: Use napi_alloc_skb in NAPI polling context - #25

Merged
maxugly merged 1 commit into
mainfrom
bolt/napi-alloc-skb-4844776403328240317
Jul 28, 2026
Merged

⚡ Bolt: Use napi_alloc_skb in NAPI polling context#25
maxugly merged 1 commit into
mainfrom
bolt/napi-alloc-skb-4844776403328240317

Conversation

@maxugly

@maxugly maxugly commented Jul 27, 2026

Copy link
Copy Markdown
Owner

💡 What: Replaced the generic dev_alloc_skb with the NAPI-specific napi_alloc_skb in the high-frequency packet receive path (sim_rx_dequeue). Also removed the redundant skb_reserve(skb, 2) call, as napi_alloc_skb naturally handles payload alignment to NET_IP_ALIGN.

🎯 Why: sim_rx_dequeue operates entirely within a NAPI polling softirq context. Using the generic dev_alloc_skb accesses global SLUB caches which incurs greater overhead and potential lock contention. Switching to napi_alloc_skb utilizes per-CPU cache mechanisms designed specifically to accelerate NAPI packet reception, making allocations faster and reducing fragmentation during packet floods.

📊 Impact: Reduces memory allocation overhead in the critical receive data path, lowering CPU utilization and improving peak packet ingestion rates on high-speed hardware or concurrent simulated workloads. Code is also slightly cleaner due to built-in alignment handling.

🔬 Measurement: Validate functionality by running the NATA loopback latency and throughput benchmark using sudo ./scripts/nata-bench-once.sh. Watch for an increase in RX throughput or decrease in CPU utilization via tools like perf or observing host load under flood.


PR created automatically by Jules for task 4844776403328240317 started by @maxugly

Summary by CodeRabbit

  • Performance

    • Improved packet receive processing efficiency by using the network polling context for buffer allocation.
    • Removed unnecessary manual buffer headroom handling while preserving existing packet processing and error behavior.
  • Documentation

    • Added documentation describing the optimized receive-path allocation approach.

Co-authored-by: maxugly <64644401+maxugly@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: ae84cd6f-aa04-4e7c-ab00-8d08156b0699

📥 Commits

Reviewing files that changed from the base of the PR and between 514361c and 16fd8dc.

📒 Files selected for processing (2)
  • .jules/bolt.md
  • module/nata_blk.c

📝 Walkthrough

Walkthrough

The RX dequeue path now uses NAPI-aware SKB allocation with exact payload sizing and removes manual headroom reservation. A dated guidance entry documents this allocation pattern.

Changes

NAPI RX allocation

Layer / File(s) Summary
Update RX skb allocation
.jules/bolt.md, module/nata_blk.c
sim_rx_dequeue uses napi_alloc_skb with the selected NAPI instance and hdr.len, while retaining existing failure cleanup; documentation describes avoiding manual alignment reserves.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • maxugly/nata#7: Updates the same RX path to use NAPI-aware allocation and adds NAPI plumbing.
  • maxugly/nata#23: Applies the same allocation and manual-alignment removal with related documentation.
  • maxugly/nata#21: Makes the corresponding sim_rx_dequeue allocation change and adds related guidance.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the primary change: switching to napi_alloc_skb in a NAPI polling receive path.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bolt/napi-alloc-skb-4844776403328240317

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@maxugly
maxugly merged commit f46a56e into main Jul 28, 2026
1 check passed
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.

1 participant