summaryrefslogtreecommitdiff
path: root/net/ipv6/ip6_fib.c
diff options
context:
space:
mode:
authorDavid Ahern <dsahern@gmail.com>2018-04-21 01:38:01 +0300
committerDavid S. Miller <davem@davemloft.net>2018-04-21 23:06:13 +0300
commit5bcaa41b964ba2cda6dde64a126bfb7da1bd88f8 (patch)
treed398e3182e1b26cb43f762b400493f48fdf47a5e /net/ipv6/ip6_fib.c
parenta87b7dc9f7fa7c87cbd575361553e8e9e4ab4473 (diff)
downloadlinux-5bcaa41b964ba2cda6dde64a126bfb7da1bd88f8.tar.xz
net/ipv6: Move release of fib6_info from pcpu routes to helper
Code move only; no functional change intended. Signed-off-by: David Ahern <dsahern@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/ip6_fib.c')
-rw-r--r--net/ipv6/ip6_fib.c41
1 files changed, 23 insertions, 18 deletions
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index f936e91a8c65..64ca02b7745f 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -860,6 +860,27 @@ insert_above:
return ln;
}
+static void fib6_drop_pcpu_from(struct fib6_info *f6i,
+ const struct fib6_table *table)
+{
+ int cpu;
+
+ /* release the reference to this fib entry from
+ * all of its cached pcpu routes
+ */
+ for_each_possible_cpu(cpu) {
+ struct rt6_info **ppcpu_rt;
+ struct rt6_info *pcpu_rt;
+
+ ppcpu_rt = per_cpu_ptr(f6i->rt6i_pcpu, cpu);
+ pcpu_rt = *ppcpu_rt;
+ if (pcpu_rt) {
+ fib6_info_release(pcpu_rt->from);
+ pcpu_rt->from = NULL;
+ }
+ }
+}
+
static void fib6_purge_rt(struct fib6_info *rt, struct fib6_node *fn,
struct net *net)
{
@@ -887,24 +908,8 @@ static void fib6_purge_rt(struct fib6_info *rt, struct fib6_node *fn,
lockdep_is_held(&table->tb6_lock));
}
- if (rt->rt6i_pcpu) {
- int cpu;
-
- /* release the reference to this fib entry from
- * all of its cached pcpu routes
- */
- for_each_possible_cpu(cpu) {
- struct rt6_info **ppcpu_rt;
- struct rt6_info *pcpu_rt;
-
- ppcpu_rt = per_cpu_ptr(rt->rt6i_pcpu, cpu);
- pcpu_rt = *ppcpu_rt;
- if (pcpu_rt) {
- fib6_info_release(pcpu_rt->from);
- pcpu_rt->from = NULL;
- }
- }
- }
+ if (rt->rt6i_pcpu)
+ fib6_drop_pcpu_from(rt, table);
}
}