# Re: \[PATCH net-next v7 1/7\] netmem: introduce struct netmem\_desc mirroring struct page

- From: Pavel Begunkov \<asml.silence@gmail.com\>
- Date: 2025-07-15 10:22:22 
- List: netdev
- Page: https://ratatoskr.run/netdev/2025/07/3135160
- Thread: https://ratatoskr.run/netdev/2025/06/3106297/t.md

```text
On 7/15/25 02:47, Jakub Kicinski wrote:
> On Mon, 14 Jul 2025 22:58:31 +0900 Harry Yoo wrote:
>>>> Could you please share your thoughts on why it's hard to judge them and
>>>> what's missing from the series, such as in the comments, changelog, or
>>>> the cover letter?
>
> My main concern (as shared on earlier revisions) is the type hierarchy

Quick overview. struct netmem_desc is a common denominator b/w pp pages
and net_iov, and contains fields used by the pp generic path, e.g.
refcount, dma_addr. Before, pp was using type casting hacks to keep
code generic with some overhead on bit masking, now it'll be able to
look up netmem_desc from a netmem and use it directly.

That's pretty much what I was suggesting niov / page aliasing to be
1+ years ago, but unfortunately that didn't happen. It definitely
removes some type casting hackiness.

> exposed to the drivers.

v10 adds a bunch of "pp_page_to_nmdesc(page)->pp" in the drivers,
Not sure I have a strong opinion, but it can be turned into a helper.

Converting things back and forth or blindly
> downcasting to netmem and upcasting back to the CPU-readable type is
> no good.

-- 
Pavel Begunkov

```
