Skip to content

Commit 3d0f24a

Browse files
Stephen Hemmingerdavem330
authored andcommitted
ipv6: icmp6_dst_gc return change
Change icmp6_dst_gc to return the one value the caller cares about rather than using call by reference. Signed-off-by: Stephen Hemminger <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 75307c0 commit 3d0f24a

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

include/net/ip6_route.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ extern struct rt6_info *rt6_lookup(struct net *net,
6868
extern struct dst_entry *icmp6_dst_alloc(struct net_device *dev,
6969
struct neighbour *neigh,
7070
const struct in6_addr *addr);
71-
extern int icmp6_dst_gc(int *more);
71+
extern int icmp6_dst_gc(void);
7272

7373
extern void fib6_force_start_gc(struct net *net);
7474

net/ipv6/ip6_fib.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1453,9 +1453,8 @@ void fib6_run_gc(unsigned long expires, struct net *net)
14531453
}
14541454
gc_args.timeout = net->ipv6.sysctl.ip6_rt_gc_interval;
14551455
}
1456-
gc_args.more = 0;
14571456

1458-
icmp6_dst_gc(&gc_args.more);
1457+
gc_args.more = icmp6_dst_gc();
14591458

14601459
fib6_clean_all(net, fib6_age, 0, NULL);
14611460

net/ipv6/route.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -978,13 +978,12 @@ struct dst_entry *icmp6_dst_alloc(struct net_device *dev,
978978
return &rt->u.dst;
979979
}
980980

981-
int icmp6_dst_gc(int *more)
981+
int icmp6_dst_gc(void)
982982
{
983983
struct dst_entry *dst, *next, **pprev;
984-
int freed;
984+
int more = 0;
985985

986986
next = NULL;
987-
freed = 0;
988987

989988
spin_lock_bh(&icmp6_dst_lock);
990989
pprev = &icmp6_dst_gc_list;
@@ -993,16 +992,15 @@ int icmp6_dst_gc(int *more)
993992
if (!atomic_read(&dst->__refcnt)) {
994993
*pprev = dst->next;
995994
dst_free(dst);
996-
freed++;
997995
} else {
998996
pprev = &dst->next;
999-
(*more)++;
997+
++more;
1000998
}
1001999
}
10021000

10031001
spin_unlock_bh(&icmp6_dst_lock);
10041002

1005-
return freed;
1003+
return more;
10061004
}
10071005

10081006
static int ip6_dst_gc(struct dst_ops *ops)

0 commit comments

Comments
 (0)