Re: [PATCH net-next V2 06/11] net/mlx5e: SHAMPO: Separate pool for headers

Saeed Mahameed
2025-05-22T23:08:49Z

On 22 May 15:30, Jakub Kicinski wrote:
>On Fri, 23 May 2025 00:41:21 +0300 Tariq Toukan wrote:
>> Allocate a separate page pool for headers when SHAMPO is enabled.
>> This will be useful for adding support to zc page pool, which has to be
>> different from the headers page pool.
>
>Could you explain why always allocate a separate pool?

Better flow management, 0 conditional code on data path to alloc/return
header buffers, since in mlx5 we already have separate paths to handle
header, we don't have/need bnxt_separate_head_pool() and
rxr->need_head_pool spread across the code..

Since we alloc and return pages in bulks, it makes more sense to manage
headers and data in separate pools if we are going to do it anyway for
"undreadable_pools", and when there's no performance impact.

>For bnxt we do it only if ZC is enabled (or system pages are large),
>see bnxt_separate_head_pool() and page_pool_is_unreadable().
>
>Not sure if page_pool_is_unreadable() existed when this code
>was written.
>
>> - wq_size = BIT(MLX5_GET(wq, wqc, log_wq_sz));
>> - *pool_size += (rq->mpwqe.shampo->hd_per_wqe * wq_size) /
>> - MLX5E_SHAMPO_WQ_HEADER_PER_PAGE;
>> +
>> + /* separate page pool for shampo headers */
>> + {
>> + int wq_size = BIT(MLX5_GET(wq, wqc, log_wq_sz));
>> + struct page_pool_params pp_params = { };
>> + u32 pool_size;
>
>A free standing code block? I this it's universally understood
>to be very poor coding style..
>

Sure if used excessively and incorrectly. Here it's only used for temporary
variable scoping. I don't think there is anything wrong with free-standing
blocks when used in the proper situations.