summaryrefslogtreecommitdiff
path: root/include/net/page_pool.h
diff options
context:
space:
mode:
authorYunsheng Lin <linyunsheng@huawei.com>2021-08-06 10:46:21 +0800
committerJakub Kicinski <kuba@kernel.org>2021-08-09 15:49:00 -0700
commit53e0961da1c7bbdabd1abebb20de403ec237ec09 (patch)
tree32a5a011887e125b82ea63aa960028f307c1d2e2 /include/net/page_pool.h
parent0e9d2a0a3a836c37528899010e73b5be8111753e (diff)
page_pool: add frag page recycling support in page pool
Currently page pool only support page recycling when there is only one user of the page, and the split page reusing implemented in the most driver can not use the page pool as bing-pong way of reusing requires the multi user support in page pool. Those reusing or recycling has below limitations: 1. page from page pool can only be used be one user in order for the page recycling to happen. 2. Bing-pong way of reusing in most driver does not support multi desc using different part of the same page in order to save memory. So add multi-users support and frag page recycling in page pool to overcome the above limitation. Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include/net/page_pool.h')
-rw-r--r--include/net/page_pool.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/net/page_pool.h b/include/net/page_pool.h
index 42e6997e637d..a4082406a003 100644
--- a/include/net/page_pool.h
+++ b/include/net/page_pool.h
@@ -91,6 +91,9 @@ struct page_pool {
unsigned long defer_warn;
u32 pages_state_hold_cnt;
+ unsigned int frag_offset;
+ struct page *frag_page;
+ long frag_users;
/*
* Data structure for allocation side
@@ -140,6 +143,18 @@ static inline struct page *page_pool_dev_alloc_pages(struct page_pool *pool)
return page_pool_alloc_pages(pool, gfp);
}
+struct page *page_pool_alloc_frag(struct page_pool *pool, unsigned int *offset,
+ unsigned int size, gfp_t gfp);
+
+static inline struct page *page_pool_dev_alloc_frag(struct page_pool *pool,
+ unsigned int *offset,
+ unsigned int size)
+{
+ gfp_t gfp = (GFP_ATOMIC | __GFP_NOWARN);
+
+ return page_pool_alloc_frag(pool, offset, size, gfp);
+}
+
/* get the stored dma direction. A driver might decide to treat this locally and
* avoid the extra cache line from page_pool to determine the direction
*/