From: bluhm Date: Mon, 22 Aug 2022 21:02:44 +0000 (+0000) Subject: Document that igmp_timers_are_running and mld6_timers_are_running X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=679bdce925df26b69c4f44c8038c19b7ea755af0;p=openbsd 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@ --- 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 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; } } }