Patchwork [RFC(v2),net-next,12/13] ipv6: Remove temporary dst for icmpv6.

login
register
mail settings
Submitter YOSHIFUJI Hideaki / 吉藤英明
Date Jan. 15, 2013, 4:46 p.m.
Message ID <50F587E8.1060308@linux-ipv6.org>
Download mbox | patch
Permalink /patch/212238/
State RFC
Delegated to: David Miller
Headers show

Comments

YOSHIFUJI Hideaki / 吉藤英明 - Jan. 15, 2013, 4:46 p.m.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
---
 net/ipv6/ip6_fib.c |    2 +-
 net/ipv6/route.c   |   98 ----------------------------------------------------
 2 files changed, 1 insertion(+), 99 deletions(-)
WANG Cong - Jan. 16, 2013, 7:02 a.m.
On 01/16/2013 12:46 AM, YOSHIFUJI Hideaki wrote:
> Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
> ---
>   net/ipv6/ip6_fib.c |    2 +-
>   net/ipv6/route.c   |   98 ----------------------------------------------------
>   2 files changed, 1 insertion(+), 99 deletions(-)
[...]
> -
> -int icmp6_dst_gc(void)
> -{

Please remove its declaration too:
include/net/ip6_route.h:extern int icmp6_dst_gc(void);

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
YOSHIFUJI Hideaki / 吉藤英明 - Jan. 16, 2013, 2:26 p.m.
Cong Wang wrote:
> On 01/16/2013 12:46 AM, YOSHIFUJI Hideaki wrote:
>> Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
>> ---
>>   net/ipv6/ip6_fib.c |    2 +-
>>   net/ipv6/route.c   |   98 ----------------------------------------------------
>>   2 files changed, 1 insertion(+), 99 deletions(-)
> [...]
>> -
>> -int icmp6_dst_gc(void)
>> -{
> 
> Please remove its declaration too:
> include/net/ip6_route.h:extern int icmp6_dst_gc(void);

Agreed.  Also removed icmp6_dst_alloc().

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

Patch

diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index 710cafd..1d7c448 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -1643,7 +1643,7 @@  void fib6_run_gc(unsigned long expires, struct net *net)
 		gc_args.timeout = net->ipv6.sysctl.ip6_rt_gc_interval;
 	}
 
-	gc_args.more = icmp6_dst_gc();
+	gc_args.more = 0;
 
 	fib6_clean_all(net, fib6_age, 0, NULL);
 
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index e30a2aa..9605658 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1252,103 +1252,6 @@  static unsigned int ip6_mtu(const struct dst_entry *dst)
 	return mtu;
 }
 
-static struct dst_entry *icmp6_dst_gc_list;
-static DEFINE_SPINLOCK(icmp6_dst_lock);
-
-struct dst_entry *icmp6_dst_alloc(struct net_device *dev,
-				  struct neighbour *neigh,
-				  struct flowi6 *fl6)
-{
-	struct dst_entry *dst;
-	struct rt6_info *rt;
-	struct inet6_dev *idev = in6_dev_get(dev);
-	struct net *net = dev_net(dev);
-
-	if (unlikely(!idev))
-		return ERR_PTR(-ENODEV);
-
-	rt = ip6_dst_alloc(net, dev, 0, NULL);
-	if (unlikely(!rt)) {
-		in6_dev_put(idev);
-		dst = ERR_PTR(-ENOMEM);
-		goto out;
-	}
-
-	if (neigh)
-		neigh_hold(neigh);
-	else {
-		neigh = ip6_neigh_lookup(&rt->dst, NULL, &fl6->daddr);
-		if (IS_ERR(neigh)) {
-			in6_dev_put(idev);
-			dst_free(&rt->dst);
-			return ERR_CAST(neigh);
-		}
-	}
-
-	rt->dst.flags |= DST_HOST;
-	rt->dst.output  = ip6_output;
-	rt->n = neigh;
-	atomic_set(&rt->dst.__refcnt, 1);
-	rt->rt6i_dst.addr = fl6->daddr;
-	rt->rt6i_dst.plen = 128;
-	rt->rt6i_idev     = idev;
-	dst_metric_set(&rt->dst, RTAX_HOPLIMIT, 0);
-
-	spin_lock_bh(&icmp6_dst_lock);
-	rt->dst.next = icmp6_dst_gc_list;
-	icmp6_dst_gc_list = &rt->dst;
-	spin_unlock_bh(&icmp6_dst_lock);
-
-	fib6_force_start_gc(net);
-
-	dst = xfrm_lookup(net, &rt->dst, flowi6_to_flowi(fl6), NULL, 0);
-
-out:
-	return dst;
-}
-
-int icmp6_dst_gc(void)
-{
-	struct dst_entry *dst, **pprev;
-	int more = 0;
-
-	spin_lock_bh(&icmp6_dst_lock);
-	pprev = &icmp6_dst_gc_list;
-
-	while ((dst = *pprev) != NULL) {
-		if (!atomic_read(&dst->__refcnt)) {
-			*pprev = dst->next;
-			dst_free(dst);
-		} else {
-			pprev = &dst->next;
-			++more;
-		}
-	}
-
-	spin_unlock_bh(&icmp6_dst_lock);
-
-	return more;
-}
-
-static void icmp6_clean_all(int (*func)(struct rt6_info *rt, void *arg),
-			    void *arg)
-{
-	struct dst_entry *dst, **pprev;
-
-	spin_lock_bh(&icmp6_dst_lock);
-	pprev = &icmp6_dst_gc_list;
-	while ((dst = *pprev) != NULL) {
-		struct rt6_info *rt = (struct rt6_info *) dst;
-		if (func(rt, arg)) {
-			*pprev = dst->next;
-			dst_free(dst);
-		} else {
-			pprev = &dst->next;
-		}
-	}
-	spin_unlock_bh(&icmp6_dst_lock);
-}
-
 static int ip6_dst_gc(struct dst_ops *ops)
 {
 	unsigned long now = jiffies;
@@ -2235,7 +2138,6 @@  void rt6_ifdown(struct net *net, struct net_device *dev)
 	};
 
 	fib6_clean_all(net, fib6_ifdown, 0, &adn);
-	icmp6_clean_all(fib6_ifdown, &adn);
 }
 
 struct rt6_mtu_change_arg {