xfrm: Convert xfrmi_exit_batch_rtnl() to ->exit_rtnl().

xfrmi_exit_batch_rtnl() iterates the dying netns list and
performs the same operations for each.

Let's use ->exit_rtnl().

Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Reviewed-by: Sabrina Dubroca <sd@queasysnail.net>
Link: https://patch.msgid.link/20250411205258.63164-9-kuniyu@amazon.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Kuniyuki Iwashima 2025-04-11 13:52:37 -07:00 committed by Jakub Kicinski
parent f76758f18f
commit 9571ab5a98

View File

@ -952,32 +952,28 @@ static struct rtnl_link_ops xfrmi_link_ops __read_mostly = {
.get_link_net = xfrmi_get_link_net,
};
static void __net_exit xfrmi_exit_batch_rtnl(struct list_head *net_exit_list,
struct list_head *dev_to_kill)
static void __net_exit xfrmi_exit_rtnl(struct net *net,
struct list_head *dev_to_kill)
{
struct net *net;
struct xfrmi_net *xfrmn = net_generic(net, xfrmi_net_id);
struct xfrm_if __rcu **xip;
struct xfrm_if *xi;
int i;
ASSERT_RTNL();
list_for_each_entry(net, net_exit_list, exit_list) {
struct xfrmi_net *xfrmn = net_generic(net, xfrmi_net_id);
struct xfrm_if __rcu **xip;
struct xfrm_if *xi;
int i;
for (i = 0; i < XFRMI_HASH_SIZE; i++) {
for (xip = &xfrmn->xfrmi[i];
(xi = rtnl_dereference(*xip)) != NULL;
xip = &xi->next)
unregister_netdevice_queue(xi->dev, dev_to_kill);
}
xi = rtnl_dereference(xfrmn->collect_md_xfrmi);
if (xi)
for (i = 0; i < XFRMI_HASH_SIZE; i++) {
for (xip = &xfrmn->xfrmi[i];
(xi = rtnl_net_dereference(net, *xip)) != NULL;
xip = &xi->next)
unregister_netdevice_queue(xi->dev, dev_to_kill);
}
xi = rtnl_net_dereference(net, xfrmn->collect_md_xfrmi);
if (xi)
unregister_netdevice_queue(xi->dev, dev_to_kill);
}
static struct pernet_operations xfrmi_net_ops = {
.exit_batch_rtnl = xfrmi_exit_batch_rtnl,
.exit_rtnl = xfrmi_exit_rtnl,
.id = &xfrmi_net_id,
.size = sizeof(struct xfrmi_net),
};