Re: [Intel-wired-lan] [PATCH net-next v11 12/12] libeth: xdp: access ->pp through netmem_desc instead of page

From: Pavel Begunkov
Date: Fri Jul 18 2025 - 05:17:31 EST


On 7/18/25 02:14, Byungchul Park wrote:
...>>>
In file included from include/linux/container_of.h:5,
from include/linux/list.h:5,
from include/linux/timer.h:5,
from include/linux/netdevice.h:24,
from include/trace/events/xdp.h:8,
from include/linux/bpf_trace.h:5,
from include/net/libeth/xdp.h:7,
from drivers/net/ethernet/intel/libeth/tx.c:6:
include/net/libeth/xdp.h: In function 'libeth_xdp_prepare_buff':
include/net/libeth/xdp.h:1295:23: warning: passing argument 1 of 'page_pool_page_is_pp' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
pp_page_to_nmdesc(page)->pp->p.offset, len, true);
^~~~
include/linux/build_bug.h:30:63: note: in definition of macro 'BUILD_BUG_ON_INVALID'
#define BUILD_BUG_ON_INVALID(e) ((void)(sizeof((__force long)(e))))
^
include/net/netmem.h:301:2: note: in expansion of macro 'DEBUG_NET_WARN_ON_ONCE'
DEBUG_NET_WARN_ON_ONCE(!page_pool_page_is_pp(p)); \
^~~~~~~~~~~~~~~~~~~~~~
include/net/libeth/xdp.h:1295:5: note: in expansion of macro 'pp_page_to_nmdesc'
pp_page_to_nmdesc(page)->pp->p.offset, len, true);
^~~~~~~~~~~~~~~~~
In file included from arch/arm/include/asm/cacheflush.h:10,
from include/linux/cacheflush.h:5,
from include/linux/highmem.h:8,
from include/linux/bvec.h:10,
from include/linux/skbuff.h:17,
from include/net/net_namespace.h:43,
from include/linux/netdevice.h:38,
from include/trace/events/xdp.h:8,
from include/linux/bpf_trace.h:5,
from include/net/libeth/xdp.h:7,
from drivers/net/ethernet/intel/libeth/tx.c:6:
include/linux/mm.h:4176:54: note: expected 'struct page *' but argument is of type 'const struct page *'
static inline bool page_pool_page_is_pp(struct page *page)
~~~~~~~~~~~~~^~~~

Oh. page_pool_page_is_pp() in the mainline code already has this issue
that the helper cannot take const struct page * as argument.

Probably not, and probably for wrong reasons. netmem_ref is define
as an integer, compilers cast away such const unlike const pointers.

How should we resolve the issue? Changing page_pool_page_is_pp() to
macro and using _Generic again looks too much. Or should we? Any idea?

page_pool_page_is_pp() doesn't change the page, just make the
argument const.

bool page_pool_page_is_pp(const struct page *page)

--
Pavel Begunkov