lkml.org 
[lkml]   [2024]   [Apr]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH net-next v5 2/3] net: mirror skb frag ref/unref helpers
On Mon,  8 Apr 2024 08:29:57 -0700 Mina Almasry wrote:
> +#ifdef CONFIG_PAGE_POOL
> +static inline bool is_pp_page(struct page *page)
> +{
> + return (page->pp_magic & ~0x3UL) == PP_SIGNATURE;
> +}
> +
> +/* page_pool_unref_page() lives in net/page_pool/helpers.h */
> +static inline void page_pool_ref_page(struct page *page)
> +{
> + atomic_long_inc(&page->pp_ref_count);
> +}
> +
> +static inline bool napi_pp_get_page(struct page *page)
> +{
> + page = compound_head(page);
> +
> + if (!is_pp_page(page))
> + return false;
> +
> + page_pool_ref_page(page);
> + return true;
> +}
> +#endif
> +
> +static inline void skb_page_ref(struct page *page, bool recycle)
> +{
> +#ifdef CONFIG_PAGE_POOL
> + if (recycle && napi_pp_get_page(page))
> + return;
> +#endif
> + get_page(page);
> +}

Shifting of all this code from pp to skbuff catches the eye.
There aren't that many callers to these, can we start a new header?
We can then include page pool headers in the without worry.

I'll apply the other patches, they look independent.

\
 
 \ /
  Last update: 2024-05-27 16:32    [W:0.053 / U:3.200 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site