On Wed, Dec 21, 2016 at 07:51:03PM +0100, Martin Pieuchot wrote:
> > This diff replaces the nd6_timer timeout and task with a timeout
> > proc.
>
> Can we wait until the experiment is complete? Until then I'd like
> to keep timeout_set_proc() only for timeout converted because they
> need the NET_LOCK().
Fine. But let's do the other changes. Move timer initialisation
to nd6_init() and call timeout_set() only once during init. Then
I don't have to think about wether it is MP safe.
ok?
bluhm
Index: netinet6/ip6_input.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet6/ip6_input.c,v
retrieving revision 1.172
diff -u -p -r1.172 ip6_input.c
--- netinet6/ip6_input.c 20 Dec 2016 18:33:43 -0000 1.172
+++ netinet6/ip6_input.c 22 Dec 2016 12:51:04 -0000
@@ -119,7 +119,6 @@ struct niqueue ip6intrq = NIQUEUE_INITIA
struct ip6stat ip6stat;
-void ip6_init2(void *);
int ip6_check_rh0hdr(struct mbuf *, int *);
int ip6_hbhchcheck(struct mbuf *, int *, int *, int *);
@@ -157,19 +156,8 @@ ip6_init(void)
ip6_randomid_init();
nd6_init();
frag6_init();
- ip6_init2(NULL);
mq_init(&ip6send_mq, 64, IPL_SOFTNET);
-}
-
-void
-ip6_init2(void *dummy)
-{
-
- /* nd6_timer_init */
- bzero(&nd6_timer_ch, sizeof(nd6_timer_ch));
- timeout_set(&nd6_timer_ch, nd6_timer, NULL);
- timeout_add_sec(&nd6_timer_ch, 1);
}
/*
Index: netinet6/nd6.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet6/nd6.c,v
retrieving revision 1.199
diff -u -p -r1.199 nd6.c
--- netinet6/nd6.c 20 Dec 2016 18:33:43 -0000 1.199
+++ netinet6/nd6.c 22 Dec 2016 12:59:31 -0000
@@ -93,6 +93,8 @@ struct nd_prhead nd_prefix = { 0 };
int nd6_recalc_reachtm_interval = ND6_RECALC_REACHTM_INTERVAL;
void nd6_slowtimo(void *);
+void nd6_timer_work(void *);
+void nd6_timer(void *);
void nd6_invalidate(struct rtentry *);
struct llinfo_nd6 *nd6_free(struct rtentry *, int);
void nd6_llinfo_timer(void *);
@@ -100,7 +102,6 @@ void nd6_llinfo_timer(void *);
struct timeout nd6_slowtimo_ch;
struct timeout nd6_timer_ch;
struct task nd6_timer_task;
-void nd6_timer_work(void *);
int fill_drlist(void *, size_t *, size_t);
int fill_prlist(void *, size_t *, size_t);
@@ -129,6 +130,8 @@ nd6_init(void)
/* start timer */
timeout_set(&nd6_slowtimo_ch, nd6_slowtimo, NULL);
timeout_add_sec(&nd6_slowtimo_ch, ND6_SLOWTIMER_INTERVAL);
+ timeout_set(&nd6_timer_ch, nd6_timer, NULL);
+ timeout_add_sec(&nd6_timer_ch, nd6_prune);
nd6_rs_init();
}
@@ -436,7 +439,6 @@ nd6_timer_work(void *null)
struct in6_ifaddr *ia6, *nia6;
s = splsoftnet();
- timeout_set(&nd6_timer_ch, nd6_timer, NULL);
timeout_add_sec(&nd6_timer_ch, nd6_prune);
/* expire default router list */
@@ -1482,7 +1484,6 @@ nd6_slowtimo(void *ignored_arg)
struct nd_ifinfo *nd6if;
struct ifnet *ifp;
- timeout_set(&nd6_slowtimo_ch, nd6_slowtimo, NULL);
timeout_add_sec(&nd6_slowtimo_ch, ND6_SLOWTIMER_INTERVAL);
TAILQ_FOREACH(ifp, &ifnet, if_list) {
nd6if = ND_IFINFO(ifp);
Index: netinet6/nd6.h
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/netinet6/nd6.h,v
retrieving revision 1.65
diff -u -p -r1.65 nd6.h
--- netinet6/nd6.h 28 Nov 2016 13:59:51 -0000 1.65
+++ netinet6/nd6.h 22 Dec 2016 12:52:54 -0000
@@ -223,8 +223,6 @@ extern int nd6_debug;
#define nd6log(x) do { if (nd6_debug) log x; } while (0)
-extern struct timeout nd6_timer_ch;
-
union nd_opts {
struct nd_opt_hdr *nd_opt_array[9];
struct {
@@ -260,7 +258,6 @@ int nd6_options(union nd_opts *);
struct rtentry *nd6_lookup(struct in6_addr *, int, struct ifnet *, u_int);
void nd6_setmtu(struct ifnet *);
void nd6_llinfo_settimer(struct llinfo_nd6 *, int);
-void nd6_timer(void *);
void nd6_purge(struct ifnet *);
void nd6_nud_hint(struct rtentry *);
void nd6_rtrequest(struct ifnet *, int, struct rtentry *);