mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yunsheng Lin <linyunsheng@huawei.com>
To: Dima Tisnek <dimaqq@gmail.com>
Cc: <davem@davemloft.net>, <kuba@kernel.org>, <pabeni@redhat.com>,
	<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Lorenzo Bianconi <lorenzo@kernel.org>,
	Alexander Duyck <alexander.duyck@gmail.com>,
	Liang Chen <liangchen.linux@gmail.com>,
	Alexander Lobakin <aleksander.lobakin@intel.com>,
	Jesper Dangaard Brouer <hawk@kernel.org>,
	Ilias Apalodimas <ilias.apalodimas@linaro.org>,
	Eric Dumazet <edumazet@google.com>,
	Jonathan Corbet <corbet@lwn.net>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	John Fastabend <john.fastabend@gmail.com>,
	<linux-doc@vger.kernel.org>, <bpf@vger.kernel.org>
Subject: Re: [PATCH net-next v9 5/6] page_pool: update document about frag API
Date: Thu, 21 Sep 2023 19:59:23 +0800	[thread overview]
Message-ID: <addf5abe-1683-d432-bf4b-e011ceba134c@huawei.com> (raw)
In-Reply-To: <CAGGBzXLu7rO4bTet0wqb2Z7FmqsSu0BVuVw_LprcJcPKO1vXEg@mail.gmail.com>

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@huawei.com> 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;
}

> 
> .
> 

  parent reply	other threads:[~2023-09-21 22:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-20 11:58 [PATCH net-next v9 0/6] introduce page_pool_alloc() related API Yunsheng Lin
2023-09-20 11:58 ` [PATCH net-next v9 1/6] page_pool: frag API support for 32-bit arch with 64-bit DMA Yunsheng Lin
2023-09-20 11:58 ` [PATCH net-next v9 2/6] page_pool: unify frag_count handling in page_pool_is_last_frag() Yunsheng Lin
2023-09-20 11:58 ` [PATCH net-next v9 3/6] page_pool: remove PP_FLAG_PAGE_FRAG Yunsheng Lin
2023-09-20 11:58 ` [PATCH net-next v9 4/6] page_pool: introduce page_pool[_cache]_alloc() API Yunsheng Lin
2023-09-20 11:58 ` [PATCH net-next v9 5/6] page_pool: update document about frag API Yunsheng Lin
2023-09-21  1:02   ` Dima Tisnek
2023-09-21 10:46     ` Yunsheng Lin
2023-09-21 11:59     ` Yunsheng Lin [this message]
2023-09-20 11:58 ` [PATCH net-next v9 6/6] net: veth: use newly added page pool API for veth with xdp Yunsheng Lin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=addf5abe-1683-d432-bf4b-e011ceba134c@huawei.com \
    --to=linyunsheng@huawei.com \
    --cc=aleksander.lobakin@intel.com \
    --cc=alexander.duyck@gmail.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=corbet@lwn.net \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=dimaqq@gmail.com \
    --cc=edumazet@google.com \
    --cc=hawk@kernel.org \
    --cc=ilias.apalodimas@linaro.org \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=liangchen.linux@gmail.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lorenzo@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®