diff options
| author | Eric Dumazet <dada1@cosmosbay.com> | 2007-02-09 19:25:52 -0500 |
|---|---|---|
| committer | David S. Miller <davem@sunset.davemloft.net> | 2007-02-11 02:20:43 -0500 |
| commit | 0c195c3fc4e95a06b0c0017506f074c94af99c35 (patch) | |
| tree | dbe840f236a5c67a6ffd02f70ce62102f4a86345 | |
| parent | 7cc482634f1f1e1db5401007658c8e8d6cf1617d (diff) | |
[DECNET]: Convert decnet route to use the new dst_entry 'next' pointer
This patch removes the next pointer from 'struct dn_route.u' union,
and renames u.rt_next to u.dst.dn_next.
It also moves 'struct flowi' right after 'struct dst_entry' to prepare
speedup lookups.
Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
| -rw-r--r-- | include/net/dn_route.h | 5 | ||||
| -rw-r--r-- | net/decnet/dn_route.c | 32 |
2 files changed, 18 insertions, 19 deletions
diff --git a/include/net/dn_route.h b/include/net/dn_route.h index 76f957e258b0..a566944c4962 100644 --- a/include/net/dn_route.h +++ b/include/net/dn_route.h | |||
| @@ -68,9 +68,10 @@ extern void dn_rt_cache_flush(int delay); | |||
| 68 | struct dn_route { | 68 | struct dn_route { |
| 69 | union { | 69 | union { |
| 70 | struct dst_entry dst; | 70 | struct dst_entry dst; |
| 71 | struct dn_route *rt_next; | ||
| 72 | } u; | 71 | } u; |
| 73 | 72 | ||
| 73 | struct flowi fl; | ||
| 74 | |||
| 74 | __le16 rt_saddr; | 75 | __le16 rt_saddr; |
| 75 | __le16 rt_daddr; | 76 | __le16 rt_daddr; |
| 76 | __le16 rt_gateway; | 77 | __le16 rt_gateway; |
| @@ -80,8 +81,6 @@ struct dn_route { | |||
| 80 | 81 | ||
| 81 | unsigned rt_flags; | 82 | unsigned rt_flags; |
| 82 | unsigned rt_type; | 83 | unsigned rt_type; |
| 83 | |||
| 84 | struct flowi fl; | ||
| 85 | }; | 84 | }; |
| 86 | 85 | ||
| 87 | extern void dn_route_init(void); | 86 | extern void dn_route_init(void); |
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c index 49b27a477e89..efccc42ff1c6 100644 --- a/net/decnet/dn_route.c +++ b/net/decnet/dn_route.c | |||
| @@ -167,11 +167,11 @@ static void dn_dst_check_expire(unsigned long dummy) | |||
| 167 | while((rt=*rtp) != NULL) { | 167 | while((rt=*rtp) != NULL) { |
| 168 | if (atomic_read(&rt->u.dst.__refcnt) || | 168 | if (atomic_read(&rt->u.dst.__refcnt) || |
| 169 | (now - rt->u.dst.lastuse) < expire) { | 169 | (now - rt->u.dst.lastuse) < expire) { |
| 170 | rtp = &rt->u.rt_next; | 170 | rtp = &rt->u.dst.dn_next; |
| 171 | continue; | 171 | continue; |
| 172 | } | 172 | } |
| 173 | *rtp = rt->u.rt_next; | 173 | *rtp = rt->u.dst.dn_next; |
| 174 | rt->u.rt_next = NULL; | 174 | rt->u.dst.dn_next = NULL; |
| 175 | dnrt_free(rt); | 175 | dnrt_free(rt); |
| 176 | } | 176 | } |
| 177 | spin_unlock(&dn_rt_hash_table[i].lock); | 177 | spin_unlock(&dn_rt_hash_table[i].lock); |
| @@ -198,11 +198,11 @@ static int dn_dst_gc(void) | |||
| 198 | while((rt=*rtp) != NULL) { | 198 | while((rt=*rtp) != NULL) { |
| 199 | if (atomic_read(&rt->u.dst.__refcnt) || | 199 | if (atomic_read(&rt->u.dst.__refcnt) || |
| 200 | (now - rt->u.dst.lastuse) < expire) { | 200 | (now - rt->u.dst.lastuse) < expire) { |
| 201 | rtp = &rt->u.rt_next; | 201 | rtp = &rt->u.dst.dn_next; |
| 202 | continue; | 202 | continue; |
| 203 | } | 203 | } |
| 204 | *rtp = rt->u.rt_next; | 204 | *rtp = rt->u.dst.dn_next; |
| 205 | rt->u.rt_next = NULL; | 205 | rt->u.dst.dn_next = NULL; |
| 206 | dnrt_drop(rt); | 206 | dnrt_drop(rt); |
| 207 | break; | 207 | break; |
| 208 | } | 208 | } |
| @@ -286,8 +286,8 @@ static int dn_insert_route(struct dn_route *rt, unsigned hash, struct dn_route * | |||
| 286 | while((rth = *rthp) != NULL) { | 286 | while((rth = *rthp) != NULL) { |
| 287 | if (compare_keys(&rth->fl, &rt->fl)) { | 287 | if (compare_keys(&rth->fl, &rt->fl)) { |
| 288 | /* Put it first */ | 288 | /* Put it first */ |
| 289 | *rthp = rth->u.rt_next; | 289 | *rthp = rth->u.dst.dn_next; |
| 290 | rcu_assign_pointer(rth->u.rt_next, | 290 | rcu_assign_pointer(rth->u.dst.dn_next, |
| 291 | dn_rt_hash_table[hash].chain); | 291 | dn_rt_hash_table[hash].chain); |
| 292 | rcu_assign_pointer(dn_rt_hash_table[hash].chain, rth); | 292 | rcu_assign_pointer(dn_rt_hash_table[hash].chain, rth); |
| 293 | 293 | ||
| @@ -300,10 +300,10 @@ static int dn_insert_route(struct dn_route *rt, unsigned hash, struct dn_route * | |||
| 300 | *rp = rth; | 300 | *rp = rth; |
| 301 | return 0; | 301 | return 0; |
| 302 | } | 302 | } |
| 303 | rthp = &rth->u.rt_next; | 303 | rthp = &rth->u.dst.dn_next; |
| 304 | } | 304 | } |
| 305 | 305 | ||
| 306 | rcu_assign_pointer(rt->u.rt_next, dn_rt_hash_table[hash].chain); | 306 | rcu_assign_pointer(rt->u.dst.dn_next, dn_rt_hash_table[hash].chain); |
| 307 | rcu_assign_pointer(dn_rt_hash_table[hash].chain, rt); | 307 | rcu_assign_pointer(dn_rt_hash_table[hash].chain, rt); |
| 308 | 308 | ||
| 309 | dst_hold(&rt->u.dst); | 309 | dst_hold(&rt->u.dst); |
| @@ -326,8 +326,8 @@ void dn_run_flush(unsigned long dummy) | |||
| 326 | goto nothing_to_declare; | 326 | goto nothing_to_declare; |
| 327 | 327 | ||
| 328 | for(; rt; rt=next) { | 328 | for(; rt; rt=next) { |
| 329 | next = rt->u.rt_next; | 329 | next = rt->u.dst.dn_next; |
| 330 | rt->u.rt_next = NULL; | 330 | rt->u.dst.dn_next = NULL; |
| 331 | dst_free((struct dst_entry *)rt); | 331 | dst_free((struct dst_entry *)rt); |
| 332 | } | 332 | } |
| 333 | 333 | ||
| @@ -1169,7 +1169,7 @@ static int __dn_route_output_key(struct dst_entry **pprt, const struct flowi *fl | |||
| 1169 | if (!(flags & MSG_TRYHARD)) { | 1169 | if (!(flags & MSG_TRYHARD)) { |
| 1170 | rcu_read_lock_bh(); | 1170 | rcu_read_lock_bh(); |
| 1171 | for(rt = rcu_dereference(dn_rt_hash_table[hash].chain); rt; | 1171 | for(rt = rcu_dereference(dn_rt_hash_table[hash].chain); rt; |
| 1172 | rt = rcu_dereference(rt->u.rt_next)) { | 1172 | rt = rcu_dereference(rt->u.dst.dn_next)) { |
| 1173 | if ((flp->fld_dst == rt->fl.fld_dst) && | 1173 | if ((flp->fld_dst == rt->fl.fld_dst) && |
| 1174 | (flp->fld_src == rt->fl.fld_src) && | 1174 | (flp->fld_src == rt->fl.fld_src) && |
| 1175 | (flp->mark == rt->fl.mark) && | 1175 | (flp->mark == rt->fl.mark) && |
| @@ -1443,7 +1443,7 @@ int dn_route_input(struct sk_buff *skb) | |||
| 1443 | 1443 | ||
| 1444 | rcu_read_lock(); | 1444 | rcu_read_lock(); |
| 1445 | for(rt = rcu_dereference(dn_rt_hash_table[hash].chain); rt != NULL; | 1445 | for(rt = rcu_dereference(dn_rt_hash_table[hash].chain); rt != NULL; |
| 1446 | rt = rcu_dereference(rt->u.rt_next)) { | 1446 | rt = rcu_dereference(rt->u.dst.dn_next)) { |
| 1447 | if ((rt->fl.fld_src == cb->src) && | 1447 | if ((rt->fl.fld_src == cb->src) && |
| 1448 | (rt->fl.fld_dst == cb->dst) && | 1448 | (rt->fl.fld_dst == cb->dst) && |
| 1449 | (rt->fl.oif == 0) && | 1449 | (rt->fl.oif == 0) && |
| @@ -1627,7 +1627,7 @@ int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb) | |||
| 1627 | rcu_read_lock_bh(); | 1627 | rcu_read_lock_bh(); |
| 1628 | for(rt = rcu_dereference(dn_rt_hash_table[h].chain), idx = 0; | 1628 | for(rt = rcu_dereference(dn_rt_hash_table[h].chain), idx = 0; |
| 1629 | rt; | 1629 | rt; |
| 1630 | rt = rcu_dereference(rt->u.rt_next), idx++) { | 1630 | rt = rcu_dereference(rt->u.dst.dn_next), idx++) { |
| 1631 | if (idx < s_idx) | 1631 | if (idx < s_idx) |
| 1632 | continue; | 1632 | continue; |
| 1633 | skb->dst = dst_clone(&rt->u.dst); | 1633 | skb->dst = dst_clone(&rt->u.dst); |
| @@ -1673,7 +1673,7 @@ static struct dn_route *dn_rt_cache_get_next(struct seq_file *seq, struct dn_rou | |||
| 1673 | { | 1673 | { |
| 1674 | struct dn_rt_cache_iter_state *s = rcu_dereference(seq->private); | 1674 | struct dn_rt_cache_iter_state *s = rcu_dereference(seq->private); |
| 1675 | 1675 | ||
| 1676 | rt = rt->u.rt_next; | 1676 | rt = rt->u.dst.dn_next; |
| 1677 | while(!rt) { | 1677 | while(!rt) { |
| 1678 | rcu_read_unlock_bh(); | 1678 | rcu_read_unlock_bh(); |
| 1679 | if (--s->bucket < 0) | 1679 | if (--s->bucket < 0) |
