mirror of
https://github.com/openbsd/src.git
synced 2026-04-29 16:47:15 +00:00
Remove useless memory barriers in igmp and mld6 timer.
Multicast timers are protected by poper locks. The shortcut that avoids locking when no timers are scheduled, does not need an additional membar. OK mvs@
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: igmp.c,v 1.97 2026/03/22 23:14:00 bluhm Exp $ */
|
||||
/* $OpenBSD: igmp.c,v 1.98 2026/03/29 18:08:07 bluhm Exp $ */
|
||||
/* $NetBSD: igmp.c,v 1.15 1996/02/13 23:41:25 christos Exp $ */
|
||||
|
||||
/*
|
||||
@@ -532,10 +532,8 @@ igmp_input_if(struct ifnet *ifp, struct mbuf **mp, int *offp, int proto,
|
||||
|
||||
}
|
||||
|
||||
if (running) {
|
||||
membar_producer();
|
||||
atomic_store_int(&igmp_timers_are_running, running);
|
||||
}
|
||||
if (running)
|
||||
atomic_store_int(&igmp_timers_are_running, 1);
|
||||
|
||||
/*
|
||||
* Pass all valid IGMP packets up to any process(es) listening
|
||||
@@ -567,10 +565,8 @@ igmp_joingroup(struct in_multi *inm, struct ifnet *ifp,
|
||||
} else
|
||||
inm->inm_timer = 0;
|
||||
|
||||
if (running) {
|
||||
membar_producer();
|
||||
atomic_store_int(&igmp_timers_are_running, running);
|
||||
}
|
||||
if (running)
|
||||
atomic_store_int(&igmp_timers_are_running, 1);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -614,7 +610,7 @@ igmp_fasttimo(void)
|
||||
*/
|
||||
if (!atomic_load_int(&igmp_timers_are_running))
|
||||
return;
|
||||
membar_consumer();
|
||||
atomic_store_int(&igmp_timers_are_running, 0);
|
||||
|
||||
NET_LOCK_SHARED();
|
||||
|
||||
@@ -624,9 +620,6 @@ igmp_fasttimo(void)
|
||||
running = 1;
|
||||
}
|
||||
|
||||
membar_producer();
|
||||
atomic_store_int(&igmp_timers_are_running, running);
|
||||
|
||||
while (!STAILQ_EMPTY(&pktlist)) {
|
||||
struct igmp_pktinfo *pkt;
|
||||
|
||||
@@ -637,6 +630,9 @@ igmp_fasttimo(void)
|
||||
}
|
||||
|
||||
NET_UNLOCK_SHARED();
|
||||
|
||||
if (running)
|
||||
atomic_store_int(&igmp_timers_are_running, 1);
|
||||
}
|
||||
|
||||
int
|
||||
@@ -684,6 +680,9 @@ igmp_slowtimo(void)
|
||||
{
|
||||
struct router_info *rti;
|
||||
|
||||
if (LIST_EMPTY(&rti_head))
|
||||
return;
|
||||
|
||||
mtx_enter(&igmp_mtx);
|
||||
LIST_FOREACH(rti, &rti_head, rti_list) {
|
||||
if (rti->rti_type == IGMP_v1_ROUTER &&
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: mld6.c,v 1.74 2026/03/22 23:14:00 bluhm Exp $ */
|
||||
/* $OpenBSD: mld6.c,v 1.75 2026/03/29 18:08:07 bluhm Exp $ */
|
||||
/* $KAME: mld6.c,v 1.26 2001/02/16 14:50:35 itojun Exp $ */
|
||||
|
||||
/*
|
||||
@@ -144,10 +144,8 @@ mld6_start_listening(struct in6_multi *in6m, struct ifnet *ifp,
|
||||
running = 1;
|
||||
}
|
||||
|
||||
if (running) {
|
||||
membar_producer();
|
||||
atomic_store_int(&mld6_timers_are_running, running);
|
||||
}
|
||||
if (running)
|
||||
atomic_store_int(&mld6_timers_are_running, 1);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -367,10 +365,8 @@ mld6_input(struct mbuf *m, int off)
|
||||
break;
|
||||
}
|
||||
|
||||
if (running) {
|
||||
membar_producer();
|
||||
atomic_store_int(&mld6_timers_are_running, running);
|
||||
}
|
||||
if (running)
|
||||
atomic_store_int(&mld6_timers_are_running, 1);
|
||||
|
||||
if_put(ifp);
|
||||
m_freem(m);
|
||||
@@ -392,7 +388,7 @@ mld6_fasttimo(void)
|
||||
*/
|
||||
if (!atomic_load_int(&mld6_timers_are_running))
|
||||
return;
|
||||
membar_consumer();
|
||||
atomic_store_int(&mld6_timers_are_running, 0);
|
||||
|
||||
NET_LOCK_SHARED();
|
||||
|
||||
@@ -402,9 +398,6 @@ mld6_fasttimo(void)
|
||||
running = 1;
|
||||
}
|
||||
|
||||
membar_producer();
|
||||
atomic_store_int(&mld6_timers_are_running, running);
|
||||
|
||||
while (!STAILQ_EMPTY(&pktlist)) {
|
||||
struct mld6_pktinfo *pkt;
|
||||
|
||||
@@ -415,6 +408,9 @@ mld6_fasttimo(void)
|
||||
}
|
||||
|
||||
NET_UNLOCK_SHARED();
|
||||
|
||||
if (running)
|
||||
atomic_store_int(&mld6_timers_are_running, 1);
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
Reference in New Issue
Block a user