[PATCH net-next v10 02/12] netmem: use netmem_desc instead of page to access ->pp in __netmem_get_pp()
Pavel Begunkov
asml.silence at gmail.com
Thu Jul 17 02:17:17 PDT 2025
On 7/16/25 20:41, Mina Almasry wrote:
...>> I will kill __netmem_get_pp() as you and I prefer. However,
>> __netmem_get_pp() users e.i. libeth_xdp_return_va() and
>> libeth_xdp_tx_fill_buf() should be altered. I will modify the code like:
>>
>> as is: __netmem_get_pp(netmem)
>> to be: __netmem_nmdesc(netmem)->pp
>>
>> Is it okay with you?
>>
>
> When Pavel and I were saying 'remove __netmem_get_pp', I think we
> meant to remove the entire concept of unsafe netmem -> page
> conversions. I think we both don't like them. From this perspective,
> __netmem_nmdesc(netmem)->pp is just as bad as __netmem_get_pp(netmem).
Yes. It'd great to have all of them gone. IMHO it's much better
to let the caller do the casting so at least it's explicit and
assumptions are not hidden. E.g. instead of
pp = __netmem_nmdesc(netmem)->pp;
It'd be
struct page *page = __netmem_to_page(netmem);
page_to_nmdesc(page)->pp;
// or page_get_pp(page), or whatever the helper is
That might be easier as well.
--
Pavel Begunkov
More information about the Linux-mediatek
mailing list