Re: [PATCH net-next v3 03/13] net: page_pool: record pools per netdev
From: Eric Dumazet <edumazet@google.com>
Date: 2023-11-22 08:55:47
On Wed, Nov 22, 2023 at 4:44 AM Jakub Kicinski [off-list ref] wrote:
quoted hunk ↗ jump to hunk
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 <redacted> Signed-off-by: Jakub Kicinski <kuba@kernel.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@google.com>