Re: [RFC PATCH net-next v1 4/4] net: page_pool: use netmem_t instead of struct page in API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2023/12/14 10:05, Mina Almasry wrote:

...

> diff --git a/include/net/page_pool/types.h b/include/net/page_pool/types.h
> index ac286ea8ce2d..0faa5207a394 100644
> --- a/include/net/page_pool/types.h
> +++ b/include/net/page_pool/types.h
> @@ -6,6 +6,7 @@
>  #include <linux/dma-direction.h>
>  #include <linux/ptr_ring.h>
>  #include <linux/types.h>
> +#include <net/netmem.h>
>  
>  #define PP_FLAG_DMA_MAP		BIT(0) /* Should page_pool do the DMA
>  					* map/unmap
> @@ -199,9 +200,9 @@ struct page_pool {
>  	} user;
>  };
>  
> -struct page *page_pool_alloc_pages(struct page_pool *pool, gfp_t gfp);
> -struct page *page_pool_alloc_frag(struct page_pool *pool, unsigned int *offset,
> -				  unsigned int size, gfp_t gfp);
> +struct netmem *page_pool_alloc_pages(struct page_pool *pool, gfp_t gfp);
> +struct netmem *page_pool_alloc_frag(struct page_pool *pool, unsigned int *offset,
> +			       unsigned int size, gfp_t gfp);

Is it possible that we add a thin layer caller on top of the page_pool API?
So that the existing users can still use the old API, the new user supporting
the devmem can use the new API, something like below:

struct netmem *netmem_pool_alloc(struct netmem_pool *pool, gfp_t gfp)
or
struct devmem *devmem_pool_alloc(struct devmem_pool *pool, gfp_t gfp)

I perfer the second one personally, as devmem means that it is not
readable from cpu.
Perhaps netmem can be used in the networking core in the future to
indicate the generic type for all types of memory supported by networking
core.

As the main concern from Jason seems to be about safe type protection for
large driver facing API surface. And touching a lot of existing users does
not seem to bring a lot of benefit when we have not a clear idea how to
proceed yet.




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux