Skip to content

net: netmem: document design principles and intended direction

Mina Almasry bpf linux-doc lkml netdev sashiko-reviews 3 versions – Applied

Status from this message: This series was applied to netdev/net-next.git (main)

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest2 patches 1 replyApplied 2/2
  2. v22 patches 3 repliesSuperseded
  3. v12 patches 6 repliesSuperseded

Changes in v3 from the cover letter

- Collect Reviewed-by/Acked-by tags from Björn, Pavel, and Stanislav.
- Clarify skb fragment homogeneity rule: all frags in an skb must either
be struct page-backed or belong to the same memory provider instance
(Pavel Begunkov).
- Link to v2: https://lore.kernel.org/netdev/[email protected]/

Patches in v3 All 2 applied

#Subject and filesSizeRepliesApplied
1/2net: netmem: document netmem and memory provider design in commentsinclude/linux/skbuff.h include/net/netmem.h include/net/page_pool/helpers.h +3 more+56 -181 replyApplied
2/2docs: netmem: document netmem and memory provider design principlesDocumentation/networking/netmem.rst+53 -00 repliesApplied

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchJesper Dangaard BrouerBjörn TöpelStanislav FomichevPavel Begunkov
1/2A-b R-b A-b
2/2R-b A-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v3 thread

Cover letter [PATCH net-next v3 0/2] net: netmem: document design principles and intended direction

Because the networking stack and drivers are only partially converted to netmem_ref and current memory providers only supply unreadable net_iovs, automated code review and analysis tools (such as LLMs) frequently infer the wrong architectural invariants from existing code. Specifically, they often assume that page_pool's struct page APIs are primary rather than legacy wrappers, that memory providers always imply net_iov, that net_iov is inherently unreadable, or that callers should branch on or downcast netmem_ref directly.

Document the intended netmem, memory provider, page_pool, and skb fragment design principles concisely in the relevant headers, code comments, and netmem documentation so both developers and automated tools follow the intended abstractions. This series adds comments and documentation rather than performing a large refactor all at once, so that future incremental changes nudge the codebase in the intended direction.

This reflects my mental model of the netmem, page_pool, and memory provider architecture; I welcome feedback and disagreements, particularly from major contributors to page_pool and memory providers.

Cc Luigi Rizzo <[email protected]>
Cc Björn Töpel <[email protected]>
Cc Stanislav Fomichev <[email protected]>
Cc Pavel Begunkov <[email protected]>

---
v3:
- Collect Reviewed-by/Acked-by tags from Björn, Pavel, and Stanislav.
- Clarify skb fragment homogeneity rule: all frags in an skb must either
be struct page-backed or belong to the same memory provider instance
(Pavel Begunkov).
- Link to v2: https://lore.kernel.org/netdev/[email protected]/
v2:
- Document both current implementation status (memory providers currently supply net_iov, and net_iov is currently unreadable) and target design principles, and clarify that new code should generalize existing
limitations as much as possible (Stanislav Fomichev).
- Link to v1: https://lore.kernel.org/netdev/[email protected]/

Mina Almasry (2):
net: netmem: document netmem and memory provider design in comments
docs: netmem: document netmem and memory provider design principles

 Documentation/networking/netmem.rst     | 53 +++++++++++++++++++++++++
 include/linux/skbuff.h                  |  6 +++
 include/net/netmem.h                    | 30 +++++++++-----
 include/net/page_pool/helpers.h         | 18 ++++++---
 include/net/page_pool/memory_provider.h | 10 +++++
 include/net/page_pool/types.h           |  6 +--
 net/core/skbuff.c                       |  4 ++
 7 files changed, 109 insertions(+), 18 deletions(-)

base-commit: d8674294aefef02266c4d47ad10131f1bffbe534

Signature · 1 line
2.56.0.385.gd3acb90ef8-goog