[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <99cf79b6-d056-4006-9d40-a1fc02169e82@gmail.com>
Date: Wed, 6 Nov 2024 01:08:12 +0000
From: Pavel Begunkov <asml.silence@...il.com>
To: Alexander Lobakin <aleksander.lobakin@...el.com>,
David Wei <dw@...idwei.uk>
Cc: io-uring@...r.kernel.org, netdev@...r.kernel.org,
Jens Axboe <axboe@...nel.dk>, Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Jesper Dangaard Brouer
<hawk@...nel.org>, David Ahern <dsahern@...nel.org>,
Mina Almasry <almasrymina@...gle.com>,
Stanislav Fomichev <stfomichev@...il.com>, Joe Damato <jdamato@...tly.com>,
Pedro Tammela <pctammela@...atatu.com>
Subject: Re: [PATCH v7 03/15] net: page_pool: create hooks for custom page
providers
On 11/5/24 16:28, Alexander Lobakin wrote:
...
>> diff --git a/net/core/page_pool.c b/net/core/page_pool.c
>> index a813d30d2135..c21c5b9edc68 100644
>> --- a/net/core/page_pool.c
>> +++ b/net/core/page_pool.c
>> @@ -284,10 +284,11 @@ static int page_pool_init(struct page_pool *pool,
>> rxq = __netif_get_rx_queue(pool->slow.netdev,
>> pool->slow.queue_idx);
>> pool->mp_priv = rxq->mp_params.mp_priv;
>> + pool->mp_ops = rxq->mp_params.mp_ops;
>> }
>>
>> - if (pool->mp_priv) {
>> - err = mp_dmabuf_devmem_init(pool);
>> + if (pool->mp_ops) {
>> + err = pool->mp_ops->init(pool);
>
> Can't we just switch-case instead of indirect calls?
> IO_URING is bool, it can't be a module, which means its functions will
> be available here when it's enabled. These ops are easy to predict (no
> ops, dmabuf, io_uring), so this really looks like an enum with 3 entries
> + switch-case ("regular" path is out if this switch-case under likely etc).
Because it better frames the provider api and doesn't require
io_uring calls sticking off the net code, i.e. decouples subsystems
better, that's while these calls are not in the hot path (in case of
io_uring it's ammortised). But you're right that it can be turned into
a switch, I just don't think it's better, and that's how it was done
in the original patch.
>> if (err) {
>> pr_warn("%s() mem-provider init failed %d\n", __func__,
>> err);
>> @@ -584,8 +585,8 @@ netmem_ref page_pool_alloc_netmem(struct page_pool *pool, gfp_t gfp)
>> return netmem;
>
> Thanks,
> Olek
--
Pavel Begunkov
Powered by blists - more mailing lists