From: "Toke Høiland-Jørgensen" <toke@redhat.com>
To: John Fastabend <john.fastabend@gmail.com>,
Jesper Dangaard Brouer <hawk@kernel.org>,
Ilias Apalodimas <ilias.apalodimas@linaro.org>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
Yonghong Song <yhs@fb.com>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@kernel.org>
Cc: netdev@vger.kernel.org, bpf@vger.kernel.org
Subject: RE: [PATCH bpf-next 1/8] page_pool: Add callback to init pages when they are allocated
Date: Thu, 09 Dec 2021 17:01:59 +0100 [thread overview]
Message-ID: <87zgp9wyvc.fsf@toke.dk> (raw)
In-Reply-To: <61b131f0a4c18_97957208ad@john.notmuch>
John Fastabend <john.fastabend@gmail.com> writes:
> Toke Høiland-Jørgensen wrote:
>> Add a new callback function to page_pool that, if set, will be called every
>> time a new page is allocated. This will be used from bpf_test_run() to
>> initialise the page data with the data provided by userspace when running
>> XDP programs with redirect turned on.
>>
>> Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
>> ---
>
> LGTM.
>
> Acked-by: John Fastabend <john.fastabend@gmail.com>
>
>> include/net/page_pool.h | 2 ++
>> net/core/page_pool.c | 2 ++
>> 2 files changed, 4 insertions(+)
>>
>> diff --git a/include/net/page_pool.h b/include/net/page_pool.h
>> index 3855f069627f..a71201854c41 100644
>> --- a/include/net/page_pool.h
>> +++ b/include/net/page_pool.h
>> @@ -80,6 +80,8 @@ struct page_pool_params {
>> enum dma_data_direction dma_dir; /* DMA mapping direction */
>> unsigned int max_len; /* max DMA sync memory size */
>> unsigned int offset; /* DMA addr offset */
>> + void (*init_callback)(struct page *page, void *arg);
>> + void *init_arg;
>> };
>>
>> struct page_pool {
>> diff --git a/net/core/page_pool.c b/net/core/page_pool.c
>> index 9b60e4301a44..fb5a90b9d574 100644
>> --- a/net/core/page_pool.c
>> +++ b/net/core/page_pool.c
>> @@ -219,6 +219,8 @@ static void page_pool_set_pp_info(struct page_pool *pool,
>> {
>> page->pp = pool;
>> page->pp_magic |= PP_SIGNATURE;
>> + if (unlikely(pool->p.init_callback))
>> + pool->p.init_callback(page, pool->p.init_arg);
>
> already in slow path right? So unlikely in a slow path should not
> have any impact on performance is my reading.
Yeah, fair point, may have gone a little overboard on the "minimise
impact to existing code" here - will drop.
-Toke
next prev parent reply other threads:[~2021-12-09 16:02 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-02 0:02 [PATCH bpf-next 0/8] Add support for transmitting packets using XDP in bpf_prog_run() Toke Høiland-Jørgensen
2021-12-02 0:02 ` [PATCH bpf-next 1/8] page_pool: Add callback to init pages when they are allocated Toke Høiland-Jørgensen
2021-12-08 22:30 ` John Fastabend
2021-12-09 16:01 ` Toke Høiland-Jørgensen [this message]
2021-12-02 0:02 ` [PATCH bpf-next 2/8] page_pool: Store the XDP mem id Toke Høiland-Jørgensen
2021-12-02 0:02 ` [PATCH bpf-next 3/8] xdp: Allow registering memory model without rxq reference Toke Høiland-Jørgensen
2021-12-02 0:02 ` [PATCH bpf-next 4/8] xdp: Move conversion to xdp_frame out of map functions Toke Høiland-Jørgensen
2021-12-02 0:02 ` [PATCH bpf-next 5/8] xdp: add xdp_do_redirect_frame() for pre-computed xdp_frames Toke Høiland-Jørgensen
2021-12-09 0:31 ` John Fastabend
2021-12-09 16:05 ` Toke Høiland-Jørgensen
2021-12-02 0:02 ` [PATCH bpf-next 6/8] bpf: Add XDP_REDIRECT support to XDP for bpf_prog_run() Toke Høiland-Jørgensen
2021-12-09 0:53 ` John Fastabend
2021-12-09 16:10 ` Toke Høiland-Jørgensen
2021-12-09 16:51 ` Toke Høiland-Jørgensen
2021-12-09 18:56 ` John Fastabend
2021-12-09 19:49 ` Toke Høiland-Jørgensen
2021-12-09 18:53 ` John Fastabend
2021-12-02 0:02 ` [PATCH bpf-next 7/8] selftests/bpf: Add selftest for XDP_REDIRECT in bpf_prog_run() Toke Høiland-Jørgensen
2021-12-02 0:02 ` [PATCH bpf-next 8/8] samples/bpf: Add xdp_trafficgen sample Toke Høiland-Jørgensen
2021-12-09 0:54 ` [PATCH bpf-next 0/8] Add support for transmitting packets using XDP in bpf_prog_run() John Fastabend
2021-12-09 16:01 ` Toke Høiland-Jørgensen
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=87zgp9wyvc.fsf@toke.dk \
--to=toke@redhat.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=hawk@kernel.org \
--cc=ilias.apalodimas@linaro.org \
--cc=john.fastabend@gmail.com \
--cc=kafai@fb.com \
--cc=kpsingh@kernel.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=songliubraving@fb.com \
--cc=yhs@fb.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;
as well as URLs for NNTP newsgroup(s).