Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ip6_tunnel: use generic for_each_ip_tunnel_rcu macro

Remove the locally defined for_each_ip6_tunnel_rcu macro and use
the generic for_each_ip_tunnel_rcu from linux/if_tunnel.h instead.

This eliminates code duplication and ensures consistency across
the kernel tunnel implementations.

Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20260403084619.4107978-1-yuehaibing@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Yue Haibing and committed by
Jakub Kicinski
2f60df9e 8a4e3ab6

+3 -6
+3 -6
net/ipv6/ip6_tunnel.c
··· 96 96 return IS_ENABLED(CONFIG_MPLS); 97 97 } 98 98 99 - #define for_each_ip6_tunnel_rcu(start) \ 100 - for (t = rcu_dereference(start); t; t = rcu_dereference(t->next)) 101 - 102 99 /** 103 100 * ip6_tnl_lookup - fetch tunnel matching the end-point addresses 104 101 * @net: network namespace ··· 118 121 struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id); 119 122 struct in6_addr any; 120 123 121 - for_each_ip6_tunnel_rcu(ip6n->tnls_r_l[hash]) { 124 + for_each_ip_tunnel_rcu(t, ip6n->tnls_r_l[hash]) { 122 125 if (!ipv6_addr_equal(local, &t->parms.laddr) || 123 126 !ipv6_addr_equal(remote, &t->parms.raddr) || 124 127 !(t->dev->flags & IFF_UP)) ··· 132 135 133 136 memset(&any, 0, sizeof(any)); 134 137 hash = HASH(&any, local); 135 - for_each_ip6_tunnel_rcu(ip6n->tnls_r_l[hash]) { 138 + for_each_ip_tunnel_rcu(t, ip6n->tnls_r_l[hash]) { 136 139 if (!ipv6_addr_equal(local, &t->parms.laddr) || 137 140 !ipv6_addr_any(&t->parms.raddr) || 138 141 !(t->dev->flags & IFF_UP)) ··· 145 148 } 146 149 147 150 hash = HASH(remote, &any); 148 - for_each_ip6_tunnel_rcu(ip6n->tnls_r_l[hash]) { 151 + for_each_ip_tunnel_rcu(t, ip6n->tnls_r_l[hash]) { 149 152 if (!ipv6_addr_equal(remote, &t->parms.raddr) || 150 153 !ipv6_addr_any(&t->parms.laddr) || 151 154 !(t->dev->flags & IFF_UP))