[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89iKPhGtC6wgThpoe7DmMkowNSbOQehcpDVnOayF42Uqk2g@mail.gmail.com>
Date: Wed, 22 Nov 2023 09:55:34 +0100
From: Eric Dumazet <edumazet@...gle.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: davem@...emloft.net, netdev@...r.kernel.org, pabeni@...hat.com,
almasrymina@...gle.com, hawk@...nel.org, ilias.apalodimas@...aro.org,
dsahern@...il.com, dtatulea@...dia.com, willemb@...gle.com
Subject: Re: [PATCH net-next v3 03/13] net: page_pool: record pools per netdev
On Wed, Nov 22, 2023 at 4:44 AM Jakub Kicinski <kuba@...nel.org> wrote:
>
> Link the page pools with netdevs. This needs to be netns compatible
> so we have two options. Either we record the pools per netns and
> have to worry about moving them as the netdev gets moved.
> Or we record them directly on the netdev so they move with the netdev
> without any extra work.
>
> Implement the latter option. Since pools may outlast netdev we need
> a place to store orphans. In time honored tradition use loopback
> for this purpose.
>
> Reviewed-by: Mina Almasry <almasrymina@...gle.com>
> Signed-off-by: Jakub Kicinski <kuba@...nel.org>
> ---
> v1: fix race between page pool and netdev disappearing (Simon)
> ---
> include/linux/list.h | 20 ++++++++
> include/linux/netdevice.h | 4 ++
> include/linux/poison.h | 2 +
> include/net/page_pool/types.h | 4 ++
> net/core/page_pool_user.c | 90 +++++++++++++++++++++++++++++++++++
> 5 files changed, 120 insertions(+)
>
> diff --git a/include/linux/list.h b/include/linux/list.h
> index 1837caedf723..059aa1fff41e 100644
> --- a/include/linux/list.h
> +++ b/include/linux/list.h
> @@ -1119,6 +1119,26 @@ static inline void hlist_move_list(struct hlist_head *old,
> old->first = NULL;
> }
>
>
> +static void page_pool_unreg_netdev(struct net_device *netdev)
> +{
> + struct page_pool *pool, *last;
> + struct net_device *lo;
> +
> + lo = __dev_get_by_index(dev_net(netdev), 1);
Any reason for not using dev_net(netdev)->loopback_dev ?
> + if (!lo) {
> + netdev_err_once(netdev,
> + "can't get lo to store orphan page pools\n");
> + page_pool_unreg_netdev_wipe(netdev);
> + return;
> + }
> +
Either way :
Reviewed-by: Eric Dumazet <edumazet@...gle.com>
Powered by blists - more mailing lists