# Re: \[PATCH 01/18\] netmem: introduce struct netmem\_desc struct\_group\_tagged()'ed on struct net\_iov

- From: Pavel Begunkov \<asml.silence@gmail.com\>
- Date: 2025-05-28 07:42:25 
- List: netdev
- Page: https://ratatoskr.run/netdev/2025/05/3071407
- Thread: https://ratatoskr.run/netdev/2025/05/3066805/t.md

```text
On 5/28/25 06:03, Byungchul Park wrote:
...>> Thus abstractly different things maybe should not share the same
>> in-kernel struct.
>>
>> One thing that maybe could work is if struct net_iov has a field in it
>> which tells us whether it's actually a struct page that can be passed
>> to mm apis, or not a struct page which cannot be passed to mm apis.
>>
>>> Or I should introduce another struct
>>
>> maybe introducing another struct is the answer. I'm not sure. The net
>
> The final form should be like:
>
>     struct netmem_desc {
>        struct page_pool *pp;
>        unsigned long dma_addr;
>        atomic_long_t ref_count;
>     };
>
>     struct net_iov {
>        struct netmem_desc;
>        enum net_iov_type type;
>        struct net_iov_area *owner;
>        ...
>     };
>
> However, now that overlaying on struct page is required, struct
> netmem_desc should be almost same as struct net_iov.  So I'm not sure if
> we should introduce struct netmem_desc as a new struct along with struct
> net_iov.

Yes, you should. Mina already explained that net_iov is not the same
thing as the net specific sub-struct of the page. They have common
fields, but there are also net_iov (memory provider) specific fields
as well.

-- 
Pavel Begunkov

```
