Re: [PATCH 01/18] netmem: introduce struct netmem_desc struct_group_tagged()'ed on struct net_iov

Byungchul Park
2025-05-28T08:17:43Z

On Wed, May 28, 2025 at 08:43:34AM +0100, Pavel Begunkov wrote:
> 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.

Okay then. I will introduce a separate struct, netmem_desc, that has
similar fields to net_iov, and related static assert for the offsets.

Byungchul

>
> --
> Pavel Begunkov