Re: [PATCH net-next v9 5/6] page_pool: update document about frag API
From: Yunsheng Lin
Date: Thu Sep 21 2023 - 18:26:59 EST
On 2023/9/21 9:02, Dima Tisnek wrote:
> Minor comment on natural language:
>
> On Wed, Sep 20, 2023 at 9:04 PM Yunsheng Lin <linyunsheng@xxxxxxxxxx> wrote:
>>
>> As more drivers begin to use the frag API, update the
>> document about how to decide which API to use for the
>> driver author.
>
> the fragment API
>
>> +/**
>> + * page_pool_dev_alloc_frag() - allocate a page frag.
>
> allocate a page fragment.
>
> the precedent is set in
> https://www.kernel.org/doc/html/v5.0/vm/page_frags.html
> foo_frag is used in C code, and foo fragment in English docs.
Sure.
It seems I need to respin anyway as the newly merged idpf driver
from intel is also using the frag API, and removing PP_FLAG_PAGE_FRAG
flag breaks it.
And idpf driver really should be using the new API instead of
selecting which API to use according to the buf_size as below
in drivers/net/ethernet/intel/idpf/idpf_txrx.h, as it seems to
be assuming PAGE_SIZE always being 4K, and we may be able to
enable page split for buf_size > 2048 and PAGE_SIZE > 4K if using
the new API.
static inline dma_addr_t idpf_alloc_page(struct page_pool *pool,
struct idpf_rx_buf *buf,
unsigned int buf_size)
{
if (buf_size == IDPF_RX_BUF_2048)
buf->page = page_pool_dev_alloc_frag(pool, &buf->page_offset,
buf_size);
else
buf->page = page_pool_dev_alloc_pages(pool);
if (!buf->page)
return DMA_MAPPING_ERROR;
buf->truesize = buf_size;
return page_pool_get_dma_addr(buf->page) + buf->page_offset +
pool->p.offset;
}
>
> .
>