Re: [RFC PATCH v3 01/20] net: page_pool: add ppiov mangling helper
From: Mina Almasry <hidden>
Date: 2023-12-19 23:22:20
Also in:
io-uring
On Tue, Dec 19, 2023 at 1:04 PM David Wei [off-list ref] wrote:
From: Pavel Begunkov <asml.silence@gmail.com> NOT FOR UPSTREAM The final version will depend on how ppiov looks like, but add a convenience helper for now.
Thanks, this patch becomes unnecessary once you pull in the latest version of our changes; you could use net_iov_to_netmem() added here: https://patchwork.kernel.org/project/netdevbpf/patch/20231218024024.3516870-9-almasrymina@google.com/ Not any kind of objection from me, just an FYI.
quoted hunk ↗ jump to hunk
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: David Wei <redacted> --- include/net/page_pool/helpers.h | 5 +++++ net/core/page_pool.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-)diff --git a/include/net/page_pool/helpers.h b/include/net/page_pool/helpers.h index 95f4d579cbc4..92804c499833 100644 --- a/include/net/page_pool/helpers.h +++ b/include/net/page_pool/helpers.h@@ -86,6 +86,11 @@ static inline u64 *page_pool_ethtool_stats_get(u64 *data, void *stats) /* page_pool_iov support */ +static inline struct page *page_pool_mangle_ppiov(struct page_pool_iov *ppiov) +{ + return (struct page *)((unsigned long)ppiov | PP_DEVMEM); +} + static inline struct dmabuf_genpool_chunk_owner * page_pool_iov_owner(const struct page_pool_iov *ppiov) {diff --git a/net/core/page_pool.c b/net/core/page_pool.c index c0bc62ee77c6..38eff947f679 100644 --- a/net/core/page_pool.c +++ b/net/core/page_pool.c@@ -1074,7 +1074,7 @@ static struct page *mp_dmabuf_devmem_alloc_pages(struct page_pool *pool, pool->pages_state_hold_cnt++; trace_page_pool_state_hold(pool, (struct page *)ppiov, pool->pages_state_hold_cnt); - return (struct page *)((unsigned long)ppiov | PP_DEVMEM); + return page_pool_mangle_ppiov(ppiov); } static void mp_dmabuf_devmem_destroy(struct page_pool *pool) --2.39.3
-- Thanks, Mina