All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next-2.6] ipv6: RCU changes in ipv6_get_mtu() and ip6_dst_hoplimit()
@ 2010-06-14 14:46 Eric Dumazet
  2010-06-14 15:18 ` YOSHIFUJI Hideaki
  2010-06-15  6:14 ` David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Eric Dumazet @ 2010-06-14 14:46 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

Use RCU to avoid atomic ops on idev refcnt in ipv6_get_mtu()
and ip6_dst_hoplimit() 

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
 net/ipv6/route.c |   19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index f770285..8f2d040 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1084,11 +1084,11 @@ static int ipv6_get_mtu(struct net_device *dev)
 	int mtu = IPV6_MIN_MTU;
 	struct inet6_dev *idev;
 
-	idev = in6_dev_get(dev);
-	if (idev) {
+	rcu_read_lock();
+	idev = __in6_dev_get(dev);
+	if (idev)
 		mtu = idev->cnf.mtu6;
-		in6_dev_put(idev);
-	}
+	rcu_read_unlock();
 	return mtu;
 }
 
@@ -1097,12 +1097,15 @@ int ip6_dst_hoplimit(struct dst_entry *dst)
 	int hoplimit = dst_metric(dst, RTAX_HOPLIMIT);
 	if (hoplimit < 0) {
 		struct net_device *dev = dst->dev;
-		struct inet6_dev *idev = in6_dev_get(dev);
-		if (idev) {
+		struct inet6_dev *idev;
+
+		rcu_read_lock();
+		idev = __in6_dev_get(dev);
+		if (idev)
 			hoplimit = idev->cnf.hop_limit;
-			in6_dev_put(idev);
-		} else
+		else
 			hoplimit = dev_net(dev)->ipv6.devconf_all->hop_limit;
+		rcu_read_unlock();
 	}
 	return hoplimit;
 }



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next-2.6] ipv6: RCU changes in ipv6_get_mtu() and ip6_dst_hoplimit()
  2010-06-14 14:46 [PATCH net-next-2.6] ipv6: RCU changes in ipv6_get_mtu() and ip6_dst_hoplimit() Eric Dumazet
@ 2010-06-14 15:18 ` YOSHIFUJI Hideaki
  2010-06-15  6:12   ` Eric Dumazet
  2010-06-15  6:14 ` David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: YOSHIFUJI Hideaki @ 2010-06-14 15:18 UTC (permalink / raw)
  To: David Miller, netdev; +Cc: Eric Dumazet, YOSHIFUJI Hideaki

(2010/06/14 23:46), Eric Dumazet wrote:
> Use RCU to avoid atomic ops on idev refcnt in ipv6_get_mtu()
> and ip6_dst_hoplimit()
>
> Signed-off-by: Eric Dumazet<eric.dumazet@gmail.com>
Acked-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>

--yoshfuji

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next-2.6] ipv6: RCU changes in ipv6_get_mtu() and ip6_dst_hoplimit()
  2010-06-14 15:18 ` YOSHIFUJI Hideaki
@ 2010-06-15  6:12   ` Eric Dumazet
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Dumazet @ 2010-06-15  6:12 UTC (permalink / raw)
  To: YOSHIFUJI Hideaki; +Cc: David Miller, netdev, YOSHIFUJI Hideaki

Le mardi 15 juin 2010 à 00:18 +0900, YOSHIFUJI Hideaki a écrit :
> (2010/06/14 23:46), Eric Dumazet wrote:
> > Use RCU to avoid atomic ops on idev refcnt in ipv6_get_mtu()
> > and ip6_dst_hoplimit()
> >
> > Signed-off-by: Eric Dumazet<eric.dumazet@gmail.com>
> Acked-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
> 
> --yoshfuji

Gah, sorry not having CC you at least for ipv6 stuff !

Thanks !




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next-2.6] ipv6: RCU changes in ipv6_get_mtu() and ip6_dst_hoplimit()
  2010-06-14 14:46 [PATCH net-next-2.6] ipv6: RCU changes in ipv6_get_mtu() and ip6_dst_hoplimit() Eric Dumazet
  2010-06-14 15:18 ` YOSHIFUJI Hideaki
@ 2010-06-15  6:14 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2010-06-15  6:14 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Mon, 14 Jun 2010 16:46:20 +0200

> Use RCU to avoid atomic ops on idev refcnt in ipv6_get_mtu()
> and ip6_dst_hoplimit() 
> 
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>

Applied.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-06-15  6:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-14 14:46 [PATCH net-next-2.6] ipv6: RCU changes in ipv6_get_mtu() and ip6_dst_hoplimit() Eric Dumazet
2010-06-14 15:18 ` YOSHIFUJI Hideaki
2010-06-15  6:12   ` Eric Dumazet
2010-06-15  6:14 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.