netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: [PATCH 5/5] ipv6: icmp6_dst_gc return change
Date: Tue, 22 Jul 2008 14:29:32 -0700	[thread overview]
Message-ID: <20080722212951.875449888@vyatta.com> (raw)
In-Reply-To: 20080722212927.937523165@vyatta.com

[-- Attachment #1: ipv6-icmp-dst.patch --]
[-- Type: text/plain, Size: 1732 bytes --]

Change icmp6_dst_gc to return the one value the caller cares about rather
than using call by reference.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>


--- a/include/net/ip6_route.h	2008-07-21 12:15:35.000000000 -0700
+++ b/include/net/ip6_route.h	2008-07-21 12:15:41.000000000 -0700
@@ -68,7 +68,7 @@ extern struct rt6_info		*rt6_lookup(stru
 extern struct dst_entry *icmp6_dst_alloc(struct net_device *dev,
 					 struct neighbour *neigh,
 					 const struct in6_addr *addr);
-extern int icmp6_dst_gc(int *more);
+extern int icmp6_dst_gc(void);
 
 extern void fib6_force_start_gc(struct net *net);
 
--- a/net/ipv6/ip6_fib.c	2008-07-21 12:13:41.000000000 -0700
+++ b/net/ipv6/ip6_fib.c	2008-07-21 12:14:35.000000000 -0700
@@ -1453,9 +1453,8 @@ void fib6_run_gc(unsigned long expires, 
 		}
 		gc_args.timeout = net->ipv6.sysctl.ip6_rt_gc_interval;
 	}
-	gc_args.more = 0;
 
-	icmp6_dst_gc(&gc_args.more);
+	gc_args.more = icmp6_dst_gc();
 
 	fib6_clean_all(net, fib6_age, 0, NULL);
 
--- a/net/ipv6/route.c	2008-07-21 12:14:06.000000000 -0700
+++ b/net/ipv6/route.c	2008-07-21 12:15:14.000000000 -0700
@@ -978,13 +978,12 @@ out:
 	return &rt->u.dst;
 }
 
-int icmp6_dst_gc(int *more)
+int icmp6_dst_gc(void)
 {
 	struct dst_entry *dst, *next, **pprev;
-	int freed;
+	int more = 0;
 
 	next = NULL;
-	freed = 0;
 
 	spin_lock_bh(&icmp6_dst_lock);
 	pprev = &icmp6_dst_gc_list;
@@ -993,16 +992,15 @@ int icmp6_dst_gc(int *more)
 		if (!atomic_read(&dst->__refcnt)) {
 			*pprev = dst->next;
 			dst_free(dst);
-			freed++;
 		} else {
 			pprev = &dst->next;
-			(*more)++;
+			++more;
 		}
 	}
 
 	spin_unlock_bh(&icmp6_dst_lock);
 
-	return freed;
+	return more;
 }
 
 static int ip6_dst_gc(struct dst_ops *ops)

-- 


  parent reply	other threads:[~2008-07-22 21:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20080722212927.937523165@vyatta.com>
2008-07-22 21:29 ` [PATCH 1/5] netns: dont alloc ipv6 fib timer list Stephen Hemminger
2008-07-22 21:33   ` David Miller
2008-07-22 21:29 ` [PATCH 2/5] ipv6: use round_jiffies Stephen Hemminger
2008-07-22 21:34   ` David Miller
2008-07-22 21:29 ` [PATCH 3/5] ipv6: use spin_trylock_bh Stephen Hemminger
2008-07-22 21:34   ` David Miller
2008-07-28  2:46   ` [PATCH] IPv6:Fix the return value of Set Hop-by-Hop options header with NULL data pointer Yang Hongyang
2008-07-22 21:29 ` [PATCH 4/5] ipv6: use kcalloc Stephen Hemminger
2008-07-22 21:35   ` David Miller
2008-07-22 21:29 ` Stephen Hemminger [this message]
2008-07-22 21:35   ` [PATCH 5/5] ipv6: icmp6_dst_gc return change David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080722212951.875449888@vyatta.com \
    --to=shemminger@vyatta.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).