Commit 5d0bbeeb authored by Thomas Graf's avatar Thomas Graf Committed by David S. Miller

[IPV6]: Remove ndiscs rt6_lock dependency

(Ab)using rt6_lock wouldn't work anymore if rt6_lock is
converted into a per table lock.
Signed-off-by: default avatarThomas Graf <tgraf@suug.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 81613273
...@@ -747,8 +747,6 @@ static void ip6_rt_update_pmtu(struct dst_entry *dst, u32 mtu) ...@@ -747,8 +747,6 @@ static void ip6_rt_update_pmtu(struct dst_entry *dst, u32 mtu)
} }
} }
/* Protected by rt6_lock. */
static struct dst_entry *ndisc_dst_gc_list;
static int ipv6_get_mtu(struct net_device *dev); static int ipv6_get_mtu(struct net_device *dev);
static inline unsigned int ipv6_advmss(unsigned int mtu) static inline unsigned int ipv6_advmss(unsigned int mtu)
...@@ -769,6 +767,9 @@ static inline unsigned int ipv6_advmss(unsigned int mtu) ...@@ -769,6 +767,9 @@ static inline unsigned int ipv6_advmss(unsigned int mtu)
return mtu; return mtu;
} }
static struct dst_entry *ndisc_dst_gc_list;
DEFINE_SPINLOCK(ndisc_lock);
struct dst_entry *ndisc_dst_alloc(struct net_device *dev, struct dst_entry *ndisc_dst_alloc(struct net_device *dev,
struct neighbour *neigh, struct neighbour *neigh,
struct in6_addr *addr, struct in6_addr *addr,
...@@ -809,10 +810,10 @@ struct dst_entry *ndisc_dst_alloc(struct net_device *dev, ...@@ -809,10 +810,10 @@ struct dst_entry *ndisc_dst_alloc(struct net_device *dev,
rt->rt6i_dst.plen = 128; rt->rt6i_dst.plen = 128;
#endif #endif
write_lock_bh(&rt6_lock); spin_lock_bh(&ndisc_lock);
rt->u.dst.next = ndisc_dst_gc_list; rt->u.dst.next = ndisc_dst_gc_list;
ndisc_dst_gc_list = &rt->u.dst; ndisc_dst_gc_list = &rt->u.dst;
write_unlock_bh(&rt6_lock); spin_unlock_bh(&ndisc_lock);
fib6_force_start_gc(); fib6_force_start_gc();
...@@ -826,8 +827,11 @@ int ndisc_dst_gc(int *more) ...@@ -826,8 +827,11 @@ int ndisc_dst_gc(int *more)
int freed; int freed;
next = NULL; next = NULL;
freed = 0;
spin_lock_bh(&ndisc_lock);
pprev = &ndisc_dst_gc_list; pprev = &ndisc_dst_gc_list;
freed = 0;
while ((dst = *pprev) != NULL) { while ((dst = *pprev) != NULL) {
if (!atomic_read(&dst->__refcnt)) { if (!atomic_read(&dst->__refcnt)) {
*pprev = dst->next; *pprev = dst->next;
...@@ -839,6 +843,8 @@ int ndisc_dst_gc(int *more) ...@@ -839,6 +843,8 @@ int ndisc_dst_gc(int *more)
} }
} }
spin_unlock_bh(&ndisc_lock);
return freed; return freed;
} }
......
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