[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250214081818.81658-2-kuniyu@amazon.com>
Date: Fri, 14 Feb 2025 17:18:16 +0900
From: Kuniyuki Iwashima <kuniyu@...zon.com>
To: Andrew Lunn <andrew+netdev@...n.ch>, "David S. Miller"
<davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski
<kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, Simon Horman
<horms@...nel.org>
CC: Kuniyuki Iwashima <kuniyu@...zon.com>, Kuniyuki Iwashima
<kuni1840@...il.com>, <netdev@...r.kernel.org>
Subject: [PATCH v1 net-next 1/3] pfcp: Convert pfcp_net_exit() to ->exit_batch_rtnl().
pfcp_net_exit() holds RTNL and calls unregister_netdevice_queue() for
dev in the netns.
Let's convert pfcp_net_exit() to ->exit_batch_rtnl to save RTNL dances
for each netns.
Signed-off-by: Kuniyuki Iwashima <kuniyu@...zon.com>
---
drivers/net/pfcp.c | 27 ++++++++++++++++-----------
1 file changed, 16 insertions(+), 11 deletions(-)
diff --git a/drivers/net/pfcp.c b/drivers/net/pfcp.c
index 68d0d9e92a22..5cb8635ada20 100644
--- a/drivers/net/pfcp.c
+++ b/drivers/net/pfcp.c
@@ -244,30 +244,35 @@ static int __net_init pfcp_net_init(struct net *net)
return 0;
}
-static void __net_exit pfcp_net_exit(struct net *net)
+static void __net_exit pfcp_destroy_links(struct net *net,
+ struct list_head *dev_kill_list)
{
struct pfcp_net *pn = net_generic(net, pfcp_net_id);
struct pfcp_dev *pfcp, *pfcp_next;
struct net_device *dev;
- LIST_HEAD(list);
- rtnl_lock();
for_each_netdev(net, dev)
if (dev->rtnl_link_ops == &pfcp_link_ops)
- pfcp_dellink(dev, &list);
+ pfcp_dellink(dev, dev_kill_list);
list_for_each_entry_safe(pfcp, pfcp_next, &pn->pfcp_dev_list, list)
- pfcp_dellink(pfcp->dev, &list);
+ pfcp_dellink(pfcp->dev, dev_kill_list);
+}
+
+static void __net_exit pfcp_net_exit_batch_rtnl(struct list_head *net_exit_list,
+ struct list_head *dev_kill_list)
+{
+ struct net *net;
- unregister_netdevice_many(&list);
- rtnl_unlock();
+ list_for_each_entry(net, net_exit_list, exit_list)
+ pfcp_destroy_links(net, dev_kill_list);
}
static struct pernet_operations pfcp_net_ops = {
- .init = pfcp_net_init,
- .exit = pfcp_net_exit,
- .id = &pfcp_net_id,
- .size = sizeof(struct pfcp_net),
+ .init = pfcp_net_init,
+ .exit_batch_rtnl = pfcp_net_exit_batch_rtnl,
+ .id = &pfcp_net_id,
+ .size = sizeof(struct pfcp_net),
};
static int __init pfcp_init(void)
--
2.39.5 (Apple Git-154)
Powered by blists - more mailing lists