Commit bbef49da authored by Alexey Dobriyan's avatar Alexey Dobriyan Committed by David S. Miller

ipv6: use standard lists for FIB walks

Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent bc417d99
...@@ -124,7 +124,7 @@ static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst) ...@@ -124,7 +124,7 @@ static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst)
} }
struct fib6_walker_t { struct fib6_walker_t {
struct fib6_walker_t *prev, *next; struct list_head lh;
struct fib6_node *root, *node; struct fib6_node *root, *node;
struct rt6_info *leaf; struct rt6_info *leaf;
unsigned char state; unsigned char state;
......
...@@ -93,29 +93,20 @@ static __u32 rt_sernum; ...@@ -93,29 +93,20 @@ static __u32 rt_sernum;
static void fib6_gc_timer_cb(unsigned long arg); static void fib6_gc_timer_cb(unsigned long arg);
static struct fib6_walker_t fib6_walker_list = { static LIST_HEAD(fib6_walkers);
.prev = &fib6_walker_list, #define FOR_WALKERS(w) list_for_each_entry(w, &fib6_walkers, lh)
.next = &fib6_walker_list,
};
#define FOR_WALKERS(w) for ((w)=fib6_walker_list.next; (w) != &fib6_walker_list; (w)=(w)->next)
static inline void fib6_walker_link(struct fib6_walker_t *w) static inline void fib6_walker_link(struct fib6_walker_t *w)
{ {
write_lock_bh(&fib6_walker_lock); write_lock_bh(&fib6_walker_lock);
w->next = fib6_walker_list.next; list_add(&w->lh, &fib6_walkers);
w->prev = &fib6_walker_list;
w->next->prev = w;
w->prev->next = w;
write_unlock_bh(&fib6_walker_lock); write_unlock_bh(&fib6_walker_lock);
} }
static inline void fib6_walker_unlink(struct fib6_walker_t *w) static inline void fib6_walker_unlink(struct fib6_walker_t *w)
{ {
write_lock_bh(&fib6_walker_lock); write_lock_bh(&fib6_walker_lock);
w->next->prev = w->prev; list_del(&w->lh);
w->prev->next = w->next;
w->prev = w->next = w;
write_unlock_bh(&fib6_walker_lock); write_unlock_bh(&fib6_walker_lock);
} }
static __inline__ u32 fib6_new_sernum(void) static __inline__ u32 fib6_new_sernum(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment