[PATCH 1/5] [IPV6]: Remove ndiscs rt6_lock dependency

2006-08-04 Thread Thomas Graf
(Ab)using rt6_lock wouldn't work anymore if rt6_lock is
converted into a per table lock.

Signed-off-by: Thomas Graf <[EMAIL PROTECTED]>

Index: net-2.6.19/net/ipv6/route.c
===
--- net-2.6.19.orig/net/ipv6/route.c
+++ net-2.6.19/net/ipv6/route.c
@@ -745,8 +745,6 @@ static void ip6_rt_update_pmtu(struct ds
}
 }
 
-/* Protected by rt6_lock.  */
-static struct dst_entry *ndisc_dst_gc_list;
 static int ipv6_get_mtu(struct net_device *dev);
 
 static inline unsigned int ipv6_advmss(unsigned int mtu)
@@ -767,6 +765,9 @@ static inline unsigned int ipv6_advmss(u
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 neighbour *neigh,
  struct in6_addr *addr,
@@ -807,10 +808,10 @@ struct dst_entry *ndisc_dst_alloc(struct
rt->rt6i_dst.plen = 128;
 #endif
 
-   write_lock_bh(&rt6_lock);
+   spin_lock_bh(&ndisc_lock);
rt->u.dst.next = ndisc_dst_gc_list;
ndisc_dst_gc_list = &rt->u.dst;
-   write_unlock_bh(&rt6_lock);
+   spin_unlock_bh(&ndisc_lock);
 
fib6_force_start_gc();
 
@@ -824,8 +825,11 @@ int ndisc_dst_gc(int *more)
int freed;
 
next = NULL;
+   freed = 0;
+
+   spin_lock_bh(&ndisc_lock);
pprev = &ndisc_dst_gc_list;
-   freed = 0;
+
while ((dst = *pprev) != NULL) {
if (!atomic_read(&dst->__refcnt)) {
*pprev = dst->next;
@@ -837,6 +841,8 @@ int ndisc_dst_gc(int *more)
}
}
 
+   spin_unlock_bh(&ndisc_lock);
+
return freed;
 }
 

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/5] [IPV6]: Remove ndiscs rt6_lock dependency

2006-07-31 Thread Ville Nuorvala
David Miller wrote:
> From: Thomas Graf <[EMAIL PROTECTED]>
> Date: Thu, 27 Jul 2006 00:00:01 +0200
> 
>> (Ab)using rt6_lock wouldn't work anymore if rt6_lock is
>> converted into a per table lock.
>>
>> Signed-off-by: Thomas Graf <[EMAIL PROTECTED]>
> 
> This one looks great.
> 
> Signed-off-by: David S. Miller <[EMAIL PROTECTED]>

Ditto.
Signed-off-by: Ville Nuorvala <[EMAIL PROTECTED]>

> -
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to [EMAIL PROTECTED]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/5] [IPV6]: Remove ndiscs rt6_lock dependency

2006-07-26 Thread David Miller
From: Tushar Gohad <[EMAIL PROTECTED]>
Date: Wed, 26 Jul 2006 16:34:03 -0700

> Are these changes scheduled to go into 2.6.18-rcX or 2.6.19?

Since the feature freeze is frozen, net-2.6.19 is where it
will likely go.
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/5] [IPV6]: Remove ndiscs rt6_lock dependency

2006-07-26 Thread Tushar Gohad

Are these changes scheduled to go into 2.6.18-rcX or 2.6.19?

Thanks.
- Tushar

David Miller wrote:

From: Thomas Graf <[EMAIL PROTECTED]>
Date: Thu, 27 Jul 2006 00:00:01 +0200



(Ab)using rt6_lock wouldn't work anymore if rt6_lock is
converted into a per table lock.

Signed-off-by: Thomas Graf <[EMAIL PROTECTED]>



This one looks great.

Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/5] [IPV6]: Remove ndiscs rt6_lock dependency

2006-07-26 Thread David Miller
From: Thomas Graf <[EMAIL PROTECTED]>
Date: Thu, 27 Jul 2006 00:00:01 +0200

> (Ab)using rt6_lock wouldn't work anymore if rt6_lock is
> converted into a per table lock.
> 
> Signed-off-by: Thomas Graf <[EMAIL PROTECTED]>

This one looks great.

Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/5] [IPV6]: Remove ndiscs rt6_lock dependency

2006-07-26 Thread Thomas Graf
(Ab)using rt6_lock wouldn't work anymore if rt6_lock is
converted into a per table lock.

Signed-off-by: Thomas Graf <[EMAIL PROTECTED]>

Index: net-2.6.git/net/ipv6/route.c
===
--- net-2.6.git.orig/net/ipv6/route.c
+++ net-2.6.git/net/ipv6/route.c
@@ -745,8 +745,6 @@ static void ip6_rt_update_pmtu(struct ds
}
 }
 
-/* Protected by rt6_lock.  */
-static struct dst_entry *ndisc_dst_gc_list;
 static int ipv6_get_mtu(struct net_device *dev);
 
 static inline unsigned int ipv6_advmss(unsigned int mtu)
@@ -767,6 +765,9 @@ static inline unsigned int ipv6_advmss(u
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 neighbour *neigh,
  struct in6_addr *addr,
@@ -807,10 +808,10 @@ struct dst_entry *ndisc_dst_alloc(struct
rt->rt6i_dst.plen = 128;
 #endif
 
-   write_lock_bh(&rt6_lock);
+   spin_lock_bh(&ndisc_lock);
rt->u.dst.next = ndisc_dst_gc_list;
ndisc_dst_gc_list = &rt->u.dst;
-   write_unlock_bh(&rt6_lock);
+   spin_unlock_bh(&ndisc_lock);
 
fib6_force_start_gc();
 
@@ -824,8 +825,11 @@ int ndisc_dst_gc(int *more)
int freed;
 
next = NULL;
+   freed = 0;
+
+   spin_lock_bh(&ndisc_lock);
pprev = &ndisc_dst_gc_list;
-   freed = 0;
+
while ((dst = *pprev) != NULL) {
if (!atomic_read(&dst->__refcnt)) {
*pprev = dst->next;
@@ -837,6 +841,8 @@ int ndisc_dst_gc(int *more)
}
}
 
+   spin_unlock_bh(&ndisc_lock);
+
return freed;
 }
 

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html