diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2022-08-22 21:02:45 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2022-08-22 21:02:45 +0000 |
commit | ef80f24a1a93275231aab19c91bffd558c518d42 (patch) | |
tree | 5c101e684bbbb4840a8674b156956e1d76b17d76 /sys | |
parent | c45501c3d408bd3890d53536a6c05ffab7557765 (diff) |
Document that igmp_timers_are_running and mld6_timers_are_running
are protected by netlock. They are only used as shortcut in fast
timer.
Common prefix in mld6.c is mld6.
OK mvs@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/netinet/igmp.c | 9 | ||||
-rw-r--r-- | sys/netinet6/mld6.c | 21 |
2 files changed, 16 insertions, 14 deletions
diff --git a/sys/netinet/igmp.c b/sys/netinet/igmp.c index 251ad71894e..9e01ea88870 100644 --- a/sys/netinet/igmp.c +++ b/sys/netinet/igmp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: igmp.c,v 1.79 2022/08/21 23:04:45 bluhm Exp $ */ +/* $OpenBSD: igmp.c,v 1.80 2022/08/22 21:02:44 bluhm Exp $ */ /* $NetBSD: igmp.c,v 1.15 1996/02/13 23:41:25 christos Exp $ */ /* @@ -96,7 +96,7 @@ #define IP_MULTICASTOPTS 0 -int igmp_timers_are_running; +int igmp_timers_are_running; /* [N] shortcut for fast timer */ static LIST_HEAD(, router_info) rti_head; static struct mbuf *router_alert; struct cpumem *igmpcounters; @@ -529,8 +529,9 @@ igmp_fasttimo(void) /* * Quick check to see if any work needs to be done, in order * to minimize the overhead of fasttimo processing. - * Variable igmp_timers_are_running is read atomically. In case we - * miss a fast timer due to MP races, just run it next time. + * Variable igmp_timers_are_running is read atomically, but without + * lock intensionally. In case it is not set due to MP races, we may + * miss to check the timers. Then run the loop at next fast timeout. */ if (!igmp_timers_are_running) return; diff --git a/sys/netinet6/mld6.c b/sys/netinet6/mld6.c index 31c0256b7aa..a58009650f7 100644 --- a/sys/netinet6/mld6.c +++ b/sys/netinet6/mld6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mld6.c,v 1.57 2022/08/21 23:04:45 bluhm Exp $ */ +/* $OpenBSD: mld6.c,v 1.58 2022/08/22 21:02:44 bluhm Exp $ */ /* $KAME: mld6.c,v 1.26 2001/02/16 14:50:35 itojun Exp $ */ /* @@ -84,7 +84,7 @@ #include <netinet6/mld6_var.h> static struct ip6_pktopts ip6_opts; -static int mld_timers_are_running; +int mld6_timers_are_running; /* [N] shortcut for fast timer */ /* XXX: These are necessary for KAME's link-local hack */ static struct in6_addr mld_all_nodes_linklocal = IN6ADDR_LINKLOCAL_ALLNODES_INIT; static struct in6_addr mld_all_routers_linklocal = IN6ADDR_LINKLOCAL_ALLROUTERS_INIT; @@ -99,7 +99,7 @@ mld6_init(void) struct ip6_hbh *hbh = (struct ip6_hbh *)hbh_buf; u_int16_t rtalert_code = htons((u_int16_t)IP6OPT_RTALERT_MLD); - mld_timers_are_running = 0; + mld6_timers_are_running = 0; /* ip6h_nxt will be fill in later */ hbh->ip6h_len = 0; /* (8 >> 3) - 1 */ @@ -136,7 +136,7 @@ mld6_start_listening(struct in6_multi *in6m) MLD_RANDOM_DELAY(MLD_V1_MAX_RI * PR_FASTHZ); in6m->in6m_state = MLD_IREPORTEDLAST; - mld_timers_are_running = 1; + mld6_timers_are_running = 1; } } @@ -266,7 +266,7 @@ mld6_input(struct mbuf *m, int off) in6m->in6m_timer > timer) { in6m->in6m_timer = MLD_RANDOM_DELAY(timer); - mld_timers_are_running = 1; + mld6_timers_are_running = 1; } } } @@ -330,15 +330,16 @@ mld6_fasttimeo(void) /* * Quick check to see if any work needs to be done, in order * to minimize the overhead of fasttimo processing. - * Variable mld_timers_are_running is read atomically. In case we - * miss a fast timer due to MP races, just run it next time. + * Variable mld6_timers_are_running is read atomically, but without + * lock intensionally. In case it is not set due to MP races, we may + * miss to check the timers. Then run the loop at next fast timeout. */ - if (!mld_timers_are_running) + if (!mld6_timers_are_running) return; NET_LOCK(); - mld_timers_are_running = 0; + mld6_timers_are_running = 0; TAILQ_FOREACH(ifp, &ifnet, if_list) mld6_checktimer(ifp); @@ -363,7 +364,7 @@ mld6_checktimer(struct ifnet *ifp) mld6_sendpkt(in6m, MLD_LISTENER_REPORT, NULL); in6m->in6m_state = MLD_IREPORTEDLAST; } else { - mld_timers_are_running = 1; + mld6_timers_are_running = 1; } } } |