Skip to content

Commit fe736e7

Browse files
committed
decnet: Move dn_next into decnet route structure.
Signed-off-by: David S. Miller <[email protected]> Reviewed-by: Eric Dumazet <[email protected]>
1 parent ca2c374 commit fe736e7

File tree

3 files changed

+19
-17
lines changed

3 files changed

+19
-17
lines changed

include/net/dn_route.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ int dn_route_rcv(struct sk_buff *skb, struct net_device *dev,
6969
*/
7070
struct dn_route {
7171
struct dst_entry dst;
72+
struct dn_route __rcu *dn_next;
7273

7374
struct neighbour *n;
7475

include/net/dst.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ struct dst_entry {
102102
union {
103103
struct dst_entry *next;
104104
struct rt6_info __rcu *rt6_next;
105-
struct dn_route __rcu *dn_next;
106105
};
107106
};
108107

net/decnet/dn_route.c

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,11 @@ static void dn_dst_check_expire(struct timer_list *unused)
199199
lockdep_is_held(&dn_rt_hash_table[i].lock))) != NULL) {
200200
if (atomic_read(&rt->dst.__refcnt) > 1 ||
201201
(now - rt->dst.lastuse) < expire) {
202-
rtp = &rt->dst.dn_next;
202+
rtp = &rt->dn_next;
203203
continue;
204204
}
205-
*rtp = rt->dst.dn_next;
206-
rt->dst.dn_next = NULL;
205+
*rtp = rt->dn_next;
206+
rt->dn_next = NULL;
207207
dst_dev_put(&rt->dst);
208208
dst_release(&rt->dst);
209209
}
@@ -233,11 +233,11 @@ static int dn_dst_gc(struct dst_ops *ops)
233233
lockdep_is_held(&dn_rt_hash_table[i].lock))) != NULL) {
234234
if (atomic_read(&rt->dst.__refcnt) > 1 ||
235235
(now - rt->dst.lastuse) < expire) {
236-
rtp = &rt->dst.dn_next;
236+
rtp = &rt->dn_next;
237237
continue;
238238
}
239-
*rtp = rt->dst.dn_next;
240-
rt->dst.dn_next = NULL;
239+
*rtp = rt->dn_next;
240+
rt->dn_next = NULL;
241241
dst_dev_put(&rt->dst);
242242
dst_release(&rt->dst);
243243
break;
@@ -333,8 +333,8 @@ static int dn_insert_route(struct dn_route *rt, unsigned int hash, struct dn_rou
333333
lockdep_is_held(&dn_rt_hash_table[hash].lock))) != NULL) {
334334
if (compare_keys(&rth->fld, &rt->fld)) {
335335
/* Put it first */
336-
*rthp = rth->dst.dn_next;
337-
rcu_assign_pointer(rth->dst.dn_next,
336+
*rthp = rth->dn_next;
337+
rcu_assign_pointer(rth->dn_next,
338338
dn_rt_hash_table[hash].chain);
339339
rcu_assign_pointer(dn_rt_hash_table[hash].chain, rth);
340340

@@ -345,10 +345,10 @@ static int dn_insert_route(struct dn_route *rt, unsigned int hash, struct dn_rou
345345
*rp = rth;
346346
return 0;
347347
}
348-
rthp = &rth->dst.dn_next;
348+
rthp = &rth->dn_next;
349349
}
350350

351-
rcu_assign_pointer(rt->dst.dn_next, dn_rt_hash_table[hash].chain);
351+
rcu_assign_pointer(rt->dn_next, dn_rt_hash_table[hash].chain);
352352
rcu_assign_pointer(dn_rt_hash_table[hash].chain, rt);
353353

354354
dst_hold_and_use(&rt->dst, now);
@@ -369,8 +369,8 @@ static void dn_run_flush(struct timer_list *unused)
369369
goto nothing_to_declare;
370370

371371
for(; rt; rt = next) {
372-
next = rcu_dereference_raw(rt->dst.dn_next);
373-
RCU_INIT_POINTER(rt->dst.dn_next, NULL);
372+
next = rcu_dereference_raw(rt->dn_next);
373+
RCU_INIT_POINTER(rt->dn_next, NULL);
374374
dst_dev_put(&rt->dst);
375375
dst_release(&rt->dst);
376376
}
@@ -1183,6 +1183,7 @@ static int dn_route_output_slow(struct dst_entry **pprt, const struct flowidn *o
11831183
if (rt == NULL)
11841184
goto e_nobufs;
11851185

1186+
rt->dn_next = NULL;
11861187
memset(&rt->fld, 0, sizeof(rt->fld));
11871188
rt->fld.saddr = oldflp->saddr;
11881189
rt->fld.daddr = oldflp->daddr;
@@ -1252,7 +1253,7 @@ static int __dn_route_output_key(struct dst_entry **pprt, const struct flowidn *
12521253
if (!(flags & MSG_TRYHARD)) {
12531254
rcu_read_lock_bh();
12541255
for (rt = rcu_dereference_bh(dn_rt_hash_table[hash].chain); rt;
1255-
rt = rcu_dereference_bh(rt->dst.dn_next)) {
1256+
rt = rcu_dereference_bh(rt->dn_next)) {
12561257
if ((flp->daddr == rt->fld.daddr) &&
12571258
(flp->saddr == rt->fld.saddr) &&
12581259
(flp->flowidn_mark == rt->fld.flowidn_mark) &&
@@ -1448,6 +1449,7 @@ static int dn_route_input_slow(struct sk_buff *skb)
14481449
if (rt == NULL)
14491450
goto e_nobufs;
14501451

1452+
rt->dn_next = NULL;
14511453
memset(&rt->fld, 0, sizeof(rt->fld));
14521454
rt->rt_saddr = fld.saddr;
14531455
rt->rt_daddr = fld.daddr;
@@ -1529,7 +1531,7 @@ static int dn_route_input(struct sk_buff *skb)
15291531

15301532
rcu_read_lock();
15311533
for(rt = rcu_dereference(dn_rt_hash_table[hash].chain); rt != NULL;
1532-
rt = rcu_dereference(rt->dst.dn_next)) {
1534+
rt = rcu_dereference(rt->dn_next)) {
15331535
if ((rt->fld.saddr == cb->src) &&
15341536
(rt->fld.daddr == cb->dst) &&
15351537
(rt->fld.flowidn_oif == 0) &&
@@ -1749,7 +1751,7 @@ int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb)
17491751
rcu_read_lock_bh();
17501752
for(rt = rcu_dereference_bh(dn_rt_hash_table[h].chain), idx = 0;
17511753
rt;
1752-
rt = rcu_dereference_bh(rt->dst.dn_next), idx++) {
1754+
rt = rcu_dereference_bh(rt->dn_next), idx++) {
17531755
if (idx < s_idx)
17541756
continue;
17551757
skb_dst_set(skb, dst_clone(&rt->dst));
@@ -1795,7 +1797,7 @@ static struct dn_route *dn_rt_cache_get_next(struct seq_file *seq, struct dn_rou
17951797
{
17961798
struct dn_rt_cache_iter_state *s = seq->private;
17971799

1798-
rt = rcu_dereference_bh(rt->dst.dn_next);
1800+
rt = rcu_dereference_bh(rt->dn_next);
17991801
while (!rt) {
18001802
rcu_read_unlock_bh();
18011803
if (--s->bucket < 0)

0 commit comments

Comments
 (0)