Message ID | 20230105214631.3939268-10-willy@infradead.org (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | Split netmem from struct page | expand |
On 05/01/2023 22.46, Matthew Wilcox (Oracle) wrote: > Add a page_pool_defrag_page() wrapper. > > Signed-off-by: Matthew Wilcox (Oracle)<willy@infradead.org> > --- > include/net/page_pool.h | 11 ++++++++--- > 1 file changed, 8 insertions(+), 3 deletions(-) Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
On Thu, Jan 05, 2023 at 09:46:16PM +0000, Matthew Wilcox (Oracle) wrote: > Add a page_pool_defrag_page() wrapper. > > Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> > --- > include/net/page_pool.h | 11 ++++++++--- > 1 file changed, 8 insertions(+), 3 deletions(-) > > diff --git a/include/net/page_pool.h b/include/net/page_pool.h > index 63aa530922de..8fe494166427 100644 > --- a/include/net/page_pool.h > +++ b/include/net/page_pool.h > @@ -393,7 +393,7 @@ static inline void page_pool_fragment_page(struct page *page, long nr) > atomic_long_set(&page->pp_frag_count, nr); > } > > -static inline long page_pool_defrag_page(struct page *page, long nr) > +static inline long page_pool_defrag_netmem(struct netmem *nmem, long nr) > { > long ret; > > @@ -406,14 +406,19 @@ static inline long page_pool_defrag_page(struct page *page, long nr) > * especially when dealing with a page that may be partitioned > * into only 2 or 3 pieces. > */ > - if (atomic_long_read(&page->pp_frag_count) == nr) > + if (atomic_long_read(&nmem->pp_frag_count) == nr) > return 0; > > - ret = atomic_long_sub_return(nr, &page->pp_frag_count); > + ret = atomic_long_sub_return(nr, &nmem->pp_frag_count); > WARN_ON(ret < 0); > return ret; > } > > +static inline long page_pool_defrag_page(struct page *page, long nr) > +{ > + return page_pool_defrag_netmem(page_netmem(page), nr); > +} > + > static inline bool page_pool_is_last_frag(struct page_pool *pool, > struct page *page) > { > -- > 2.35.1 > Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
diff --git a/include/net/page_pool.h b/include/net/page_pool.h index 63aa530922de..8fe494166427 100644 --- a/include/net/page_pool.h +++ b/include/net/page_pool.h @@ -393,7 +393,7 @@ static inline void page_pool_fragment_page(struct page *page, long nr) atomic_long_set(&page->pp_frag_count, nr); } -static inline long page_pool_defrag_page(struct page *page, long nr) +static inline long page_pool_defrag_netmem(struct netmem *nmem, long nr) { long ret; @@ -406,14 +406,19 @@ static inline long page_pool_defrag_page(struct page *page, long nr) * especially when dealing with a page that may be partitioned * into only 2 or 3 pieces. */ - if (atomic_long_read(&page->pp_frag_count) == nr) + if (atomic_long_read(&nmem->pp_frag_count) == nr) return 0; - ret = atomic_long_sub_return(nr, &page->pp_frag_count); + ret = atomic_long_sub_return(nr, &nmem->pp_frag_count); WARN_ON(ret < 0); return ret; } +static inline long page_pool_defrag_page(struct page *page, long nr) +{ + return page_pool_defrag_netmem(page_netmem(page), nr); +} + static inline bool page_pool_is_last_frag(struct page_pool *pool, struct page *page) {
Add a page_pool_defrag_page() wrapper. Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> --- include/net/page_pool.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)