diff options
author | Nikolay Aleksandrov <nikolay@nvidia.com> | 2021-11-29 17:44:11 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-11-30 11:59:53 +0000 |
commit | 6130805066659cda3d685fc4c8d912c72a005ef5 (patch) | |
tree | c34d5c1b8254e5872dddde5e14e6944baebace58 /net/ipv6 | |
parent | 7709efa62c4fd2a79d154579ea19be34f9fa9a31 (diff) |
net: ipv6: use the new fib6_nh_release_dsts helper in fib6_nh_release
We can remove a bit of code duplication by reusing the new
fib6_nh_release_dsts helper in fib6_nh_release. Their only difference is
that fib6_nh_release's version doesn't use atomic operation to swap the
pointers because it assumes the fib6_nh is no longer visible, while
fib6_nh_release_dsts can be used anywhere.
Suggested-by: David Ahern <dsahern@gmail.com>
Signed-off-by: Nikolay Aleksandrov <nikolay@nvidia.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/route.c | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 62f1e16eea2b..f0d29fcb2094 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -3656,24 +3656,8 @@ void fib6_nh_release(struct fib6_nh *fib6_nh) rcu_read_unlock(); - if (fib6_nh->rt6i_pcpu) { - int cpu; - - for_each_possible_cpu(cpu) { - struct rt6_info **ppcpu_rt; - struct rt6_info *pcpu_rt; - - ppcpu_rt = per_cpu_ptr(fib6_nh->rt6i_pcpu, cpu); - pcpu_rt = *ppcpu_rt; - if (pcpu_rt) { - dst_dev_put(&pcpu_rt->dst); - dst_release(&pcpu_rt->dst); - *ppcpu_rt = NULL; - } - } - - free_percpu(fib6_nh->rt6i_pcpu); - } + fib6_nh_release_dsts(fib6_nh); + free_percpu(fib6_nh->rt6i_pcpu); fib_nh_common_release(&fib6_nh->nh_common); } |