Re: [PATCH net-next v6 1/8] page_pool: introduce page_pool_get_pp() API
From: Yunsheng Lin
Date: Wed Jan 08 2025 - 04:38:30 EST
On 2025/1/7 22:52, Jesper Dangaard Brouer wrote:
>
> On 06/01/2025 14.01, Yunsheng Lin wrote:
>> introduce page_pool_get_pp() API to avoid caller accessing
>> page->pp directly.
>>
> [...]
>
>> diff --git a/include/net/page_pool/helpers.h b/include/net/page_pool/helpers.h
>> index 543f54fa3020..9c4dbd2289b1 100644
>> --- a/include/net/page_pool/helpers.h
>> +++ b/include/net/page_pool/helpers.h
>> @@ -83,6 +83,11 @@ static inline u64 *page_pool_ethtool_stats_get(u64 *data, const void *stats)
>> }
>> #endif
>> +static inline struct page_pool *page_pool_get_pp(struct page *page)
>> +{
>> + return page->pp;
>> +}
>
> IMHO the function name "page_pool_get_pp" is problematic. As calling it "get" indicate to me that we are taking some reference on the pp object. Is this you plan in later patches?
No, this patchset is not going to taking some reference on the pp object.
>
> If it is simply a dereference of page->pp ... then we could call it page2pp ?
Before this version page_pool_to_pp() is used, this version renamed it to
page_pool_get_pp() as there is an exising netmem_get_pp() in patch 3, which
is also simply a dereference of netmem->pp, using page_pool_to_pp() does not
seem consistent with netmem from API naming point.
> ... but I'm uncertain why we need this change.
This patch is added to make patch 3 more reviewable as page->pp is renamed to
page->pp_item in patch 3. If there is no helper added in this patch, patch 3
might need to touch all the places touched in this patch too.
>
> --Jesper
>