aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2006-08-04 06:37:36 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2006-09-22 17:53:38 -0400
commit5d0bbeeb144f631150881712607345c532e38e7e (patch)
tree379a9e7bd63ecc3a4b3886aa297ba8cf282b273e
parent8161327311fe4da1684ed08015e141feb9a0a737 (diff)
[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: Thomas Graf <tgraf@suug.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/ipv6/route.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index d9baca062d24..ce1f49b595b0 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -747,8 +747,6 @@ static void ip6_rt_update_pmtu(struct dst_entry *dst, u32 mtu)
747 } 747 }
748} 748}
749 749
750/* Protected by rt6_lock. */
751static struct dst_entry *ndisc_dst_gc_list;
752static int ipv6_get_mtu(struct net_device *dev); 750static int ipv6_get_mtu(struct net_device *dev);
753 751
754static inline unsigned int ipv6_advmss(unsigned int mtu) 752static inline unsigned int ipv6_advmss(unsigned int mtu)
@@ -769,6 +767,9 @@ static inline unsigned int ipv6_advmss(unsigned int mtu)
769 return mtu; 767 return mtu;
770} 768}
771 769
770static struct dst_entry *ndisc_dst_gc_list;
771DEFINE_SPINLOCK(ndisc_lock);
772
772struct dst_entry *ndisc_dst_alloc(struct net_device *dev, 773struct dst_entry *ndisc_dst_alloc(struct net_device *dev,
773 struct neighbour *neigh, 774 struct neighbour *neigh,
774 struct in6_addr *addr, 775 struct in6_addr *addr,
@@ -809,10 +810,10 @@ struct dst_entry *ndisc_dst_alloc(struct net_device *dev,
809 rt->rt6i_dst.plen = 128; 810 rt->rt6i_dst.plen = 128;
810#endif 811#endif
811 812
812 write_lock_bh(&rt6_lock); 813 spin_lock_bh(&ndisc_lock);
813 rt->u.dst.next = ndisc_dst_gc_list; 814 rt->u.dst.next = ndisc_dst_gc_list;
814 ndisc_dst_gc_list = &rt->u.dst; 815 ndisc_dst_gc_list = &rt->u.dst;
815 write_unlock_bh(&rt6_lock); 816 spin_unlock_bh(&ndisc_lock);
816 817
817 fib6_force_start_gc(); 818 fib6_force_start_gc();
818 819
@@ -826,8 +827,11 @@ int ndisc_dst_gc(int *more)
826 int freed; 827 int freed;
827 828
828 next = NULL; 829 next = NULL;
830 freed = 0;
831
832 spin_lock_bh(&ndisc_lock);
829 pprev = &ndisc_dst_gc_list; 833 pprev = &ndisc_dst_gc_list;
830 freed = 0; 834
831 while ((dst = *pprev) != NULL) { 835 while ((dst = *pprev) != NULL) {
832 if (!atomic_read(&dst->__refcnt)) { 836 if (!atomic_read(&dst->__refcnt)) {
833 *pprev = dst->next; 837 *pprev = dst->next;
@@ -839,6 +843,8 @@ int ndisc_dst_gc(int *more)
839 } 843 }
840 } 844 }
841 845
846 spin_unlock_bh(&ndisc_lock);
847
842 return freed; 848 return freed;
843} 849}
844 850