Skip to content

Commit 071fb37

Browse files
committed
ipv6: Move rt6_next from dst_entry into ipv6 route structure.
Signed-off-by: David S. Miller <[email protected]> Reviewed-by: Eric Dumazet <[email protected]>
1 parent fe736e7 commit 071fb37

File tree

4 files changed

+21
-21
lines changed

4 files changed

+21
-21
lines changed

include/net/dst.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ struct dst_entry {
101101
struct lwtunnel_state *lwtstate;
102102
union {
103103
struct dst_entry *next;
104-
struct rt6_info __rcu *rt6_next;
105104
};
106105
};
107106

include/net/ip6_fib.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ struct rt6_exception {
129129

130130
struct rt6_info {
131131
struct dst_entry dst;
132+
struct rt6_info __rcu *rt6_next;
132133

133134
/*
134135
* Tail elements of dst_entry (__refcnt etc.)
@@ -176,11 +177,11 @@ struct rt6_info {
176177

177178
#define for_each_fib6_node_rt_rcu(fn) \
178179
for (rt = rcu_dereference((fn)->leaf); rt; \
179-
rt = rcu_dereference(rt->dst.rt6_next))
180+
rt = rcu_dereference(rt->rt6_next))
180181

181182
#define for_each_fib6_walker_rt(w) \
182183
for (rt = (w)->leaf; rt; \
183-
rt = rcu_dereference_protected(rt->dst.rt6_next, 1))
184+
rt = rcu_dereference_protected(rt->rt6_next, 1))
184185

185186
static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst)
186187
{

net/ipv6/ip6_fib.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -893,7 +893,7 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt,
893893
ins = &fn->leaf;
894894

895895
for (iter = leaf; iter;
896-
iter = rcu_dereference_protected(iter->dst.rt6_next,
896+
iter = rcu_dereference_protected(iter->rt6_next,
897897
lockdep_is_held(&rt->rt6i_table->tb6_lock))) {
898898
/*
899899
* Search for duplicates
@@ -950,7 +950,7 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt,
950950
break;
951951

952952
next_iter:
953-
ins = &iter->dst.rt6_next;
953+
ins = &iter->rt6_next;
954954
}
955955

956956
if (fallback_ins && !found) {
@@ -979,7 +979,7 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt,
979979
&sibling->rt6i_siblings);
980980
break;
981981
}
982-
sibling = rcu_dereference_protected(sibling->dst.rt6_next,
982+
sibling = rcu_dereference_protected(sibling->rt6_next,
983983
lockdep_is_held(&rt->rt6i_table->tb6_lock));
984984
}
985985
/* For each sibling in the list, increment the counter of
@@ -1009,7 +1009,7 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt,
10091009
if (err)
10101010
return err;
10111011

1012-
rcu_assign_pointer(rt->dst.rt6_next, iter);
1012+
rcu_assign_pointer(rt->rt6_next, iter);
10131013
atomic_inc(&rt->rt6i_ref);
10141014
rcu_assign_pointer(rt->rt6i_node, fn);
10151015
rcu_assign_pointer(*ins, rt);
@@ -1040,7 +1040,7 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt,
10401040

10411041
atomic_inc(&rt->rt6i_ref);
10421042
rcu_assign_pointer(rt->rt6i_node, fn);
1043-
rt->dst.rt6_next = iter->dst.rt6_next;
1043+
rt->rt6_next = iter->rt6_next;
10441044
rcu_assign_pointer(*ins, rt);
10451045
call_fib6_entry_notifiers(info->nl_net, FIB_EVENT_ENTRY_REPLACE,
10461046
rt, extack);
@@ -1059,14 +1059,14 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt,
10591059

10601060
if (nsiblings) {
10611061
/* Replacing an ECMP route, remove all siblings */
1062-
ins = &rt->dst.rt6_next;
1062+
ins = &rt->rt6_next;
10631063
iter = rcu_dereference_protected(*ins,
10641064
lockdep_is_held(&rt->rt6i_table->tb6_lock));
10651065
while (iter) {
10661066
if (iter->rt6i_metric > rt->rt6i_metric)
10671067
break;
10681068
if (rt6_qualify_for_ecmp(iter)) {
1069-
*ins = iter->dst.rt6_next;
1069+
*ins = iter->rt6_next;
10701070
iter->rt6i_node = NULL;
10711071
fib6_purge_rt(iter, fn, info->nl_net);
10721072
if (rcu_access_pointer(fn->rr_ptr) == iter)
@@ -1075,7 +1075,7 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt,
10751075
nsiblings--;
10761076
info->nl_net->ipv6.rt6_stats->fib_rt_entries--;
10771077
} else {
1078-
ins = &iter->dst.rt6_next;
1078+
ins = &iter->rt6_next;
10791079
}
10801080
iter = rcu_dereference_protected(*ins,
10811081
lockdep_is_held(&rt->rt6i_table->tb6_lock));
@@ -1644,7 +1644,7 @@ static void fib6_del_route(struct fib6_table *table, struct fib6_node *fn,
16441644
WARN_ON_ONCE(rt->rt6i_flags & RTF_CACHE);
16451645

16461646
/* Unlink it */
1647-
*rtp = rt->dst.rt6_next;
1647+
*rtp = rt->rt6_next;
16481648
rt->rt6i_node = NULL;
16491649
net->ipv6.rt6_stats->fib_rt_entries--;
16501650
net->ipv6.rt6_stats->fib_discarded_routes++;
@@ -1672,7 +1672,7 @@ static void fib6_del_route(struct fib6_table *table, struct fib6_node *fn,
16721672
FOR_WALKERS(net, w) {
16731673
if (w->state == FWS_C && w->leaf == rt) {
16741674
RT6_TRACE("walker %p adjusted by delroute\n", w);
1675-
w->leaf = rcu_dereference_protected(rt->dst.rt6_next,
1675+
w->leaf = rcu_dereference_protected(rt->rt6_next,
16761676
lockdep_is_held(&table->tb6_lock));
16771677
if (!w->leaf)
16781678
w->state = FWS_U;
@@ -1731,7 +1731,7 @@ int fib6_del(struct rt6_info *rt, struct nl_info *info)
17311731
fib6_del_route(table, fn, rtp, info);
17321732
return 0;
17331733
}
1734-
rtp_next = &cur->dst.rt6_next;
1734+
rtp_next = &cur->rt6_next;
17351735
}
17361736
return -ENOENT;
17371737
}
@@ -2208,7 +2208,7 @@ static int ipv6_route_yield(struct fib6_walker *w)
22082208

22092209
do {
22102210
iter->w.leaf = rcu_dereference_protected(
2211-
iter->w.leaf->dst.rt6_next,
2211+
iter->w.leaf->rt6_next,
22122212
lockdep_is_held(&iter->tbl->tb6_lock));
22132213
iter->skip--;
22142214
if (!iter->skip && iter->w.leaf)
@@ -2274,7 +2274,7 @@ static void *ipv6_route_seq_next(struct seq_file *seq, void *v, loff_t *pos)
22742274
if (!v)
22752275
goto iter_table;
22762276

2277-
n = rcu_dereference_bh(((struct rt6_info *)v)->dst.rt6_next);
2277+
n = rcu_dereference_bh(((struct rt6_info *)v)->rt6_next);
22782278
if (n) {
22792279
++*pos;
22802280
return n;

net/ipv6/route.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ static inline struct rt6_info *rt6_device_match(struct net *net,
502502
if (!oif && ipv6_addr_any(saddr))
503503
goto out;
504504

505-
for (sprt = rt; sprt; sprt = rcu_dereference(sprt->dst.rt6_next)) {
505+
for (sprt = rt; sprt; sprt = rcu_dereference(sprt->rt6_next)) {
506506
struct net_device *dev = sprt->dst.dev;
507507

508508
if (oif) {
@@ -721,7 +721,7 @@ static struct rt6_info *find_rr_leaf(struct fib6_node *fn,
721721

722722
match = NULL;
723723
cont = NULL;
724-
for (rt = rr_head; rt; rt = rcu_dereference(rt->dst.rt6_next)) {
724+
for (rt = rr_head; rt; rt = rcu_dereference(rt->rt6_next)) {
725725
if (rt->rt6i_metric != metric) {
726726
cont = rt;
727727
break;
@@ -731,7 +731,7 @@ static struct rt6_info *find_rr_leaf(struct fib6_node *fn,
731731
}
732732

733733
for (rt = leaf; rt && rt != rr_head;
734-
rt = rcu_dereference(rt->dst.rt6_next)) {
734+
rt = rcu_dereference(rt->rt6_next)) {
735735
if (rt->rt6i_metric != metric) {
736736
cont = rt;
737737
break;
@@ -743,7 +743,7 @@ static struct rt6_info *find_rr_leaf(struct fib6_node *fn,
743743
if (match || !cont)
744744
return match;
745745

746-
for (rt = cont; rt; rt = rcu_dereference(rt->dst.rt6_next))
746+
for (rt = cont; rt; rt = rcu_dereference(rt->rt6_next))
747747
match = find_match(rt, oif, strict, &mpri, match, do_rr);
748748

749749
return match;
@@ -781,7 +781,7 @@ static struct rt6_info *rt6_select(struct net *net, struct fib6_node *fn,
781781
&do_rr);
782782

783783
if (do_rr) {
784-
struct rt6_info *next = rcu_dereference(rt0->dst.rt6_next);
784+
struct rt6_info *next = rcu_dereference(rt0->rt6_next);
785785

786786
/* no entries matched; do round-robin */
787787
if (!next || next->rt6i_metric != rt0->rt6i_metric)

0 commit comments

Comments
 (0)