Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F111143640
D36160.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
5 KB
Referenced Files
None
Subscribers
None
D36160.diff
View Options
diff --git a/sys/netinet/igmp.c b/sys/netinet/igmp.c
--- a/sys/netinet/igmp.c
+++ b/sys/netinet/igmp.c
@@ -60,7 +60,6 @@
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/socket.h>
-#include <sys/protosw.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/sysctl.h>
@@ -93,6 +92,10 @@
#define KTR_IGMPV3 KTR_INET
#endif
+#define IGMP_SLOWHZ 2 /* 2 slow timeouts per second */
+#define IGMP_FASTHZ 5 /* 5 fast timeouts per second */
+#define IGMP_RESPONSE_BURST_INTERVAL (IGMP_FASTHZ / 2)
+
static struct igmp_ifsoftc *
igi_alloc_locked(struct ifnet *);
static void igi_delete_locked(const struct ifnet *);
@@ -201,8 +204,8 @@
/*
* VIMAGE-wide globals.
*
- * The IGMPv3 timers themselves need to run per-image, however,
- * protosw timers run globally (see tcp).
+ * The IGMPv3 timers themselves need to run per-image, however, for
+ * historical reasons, timers run globally. This needs to be improved.
* An ifnet can only be in one vimage at a time, and the loopback
* ifnet, loif, is itself virtualized.
* It would otherwise be possible to seriously hose IGMP state,
@@ -816,7 +819,7 @@
case IGMP_AWAKENING_MEMBER:
inm->inm_state = IGMP_REPORTING_MEMBER;
inm->inm_timer = IGMP_RANDOM_DELAY(
- IGMP_V1V2_MAX_RI * PR_FASTHZ);
+ IGMP_V1V2_MAX_RI * IGMP_FASTHZ);
V_current_state_timers_running = 1;
break;
case IGMP_LEAVING_MEMBER:
@@ -886,7 +889,7 @@
igmp_set_version(igi, IGMP_VERSION_2);
- timer = igmp->igmp_code * PR_FASTHZ / IGMP_TIMER_SCALE;
+ timer = igmp->igmp_code * IGMP_FASTHZ / IGMP_TIMER_SCALE;
if (timer == 0)
timer = 1;
@@ -1026,7 +1029,7 @@
(IGMP_EXP(igmpv3->igmp_qqi) + 3);
}
- timer = maxresp * PR_FASTHZ / IGMP_TIMER_SCALE;
+ timer = maxresp * IGMP_FASTHZ / IGMP_TIMER_SCALE;
if (timer == 0)
timer = 1;
@@ -1655,11 +1658,14 @@
* Fast timeout handler (global).
* VIMAGE: Timeout handlers are expected to service all vimages.
*/
-void
-igmp_fasttimo(void)
+static struct callout igmpfast_callout;
+static void
+igmp_fasttimo(void *arg __unused)
{
+ struct epoch_tracker et;
VNET_ITERATOR_DECL(vnet_iter);
+ NET_EPOCH_ENTER(et);
VNET_LIST_RLOCK_NOSLEEP();
VNET_FOREACH(vnet_iter) {
CURVNET_SET(vnet_iter);
@@ -1667,6 +1673,9 @@
CURVNET_RESTORE();
}
VNET_LIST_RUNLOCK_NOSLEEP();
+ NET_EPOCH_EXIT(et);
+
+ callout_reset(&igmpfast_callout, hz / IGMP_FASTHZ, igmp_fasttimo, NULL);
}
/*
@@ -1741,7 +1750,7 @@
if (igi->igi_version == IGMP_VERSION_3) {
loop = (igi->igi_flags & IGIF_LOOPBACK) ? 1 : 0;
uri_fasthz = IGMP_RANDOM_DELAY(igi->igi_uri *
- PR_FASTHZ);
+ IGMP_FASTHZ);
mbufq_init(&qrq, IGMP_MAX_G_GS_PACKETS);
mbufq_init(&scq, IGMP_MAX_STATE_CHANGE_PACKETS);
}
@@ -2000,7 +2009,7 @@
* Section 8.12.
*/
old_version_timer = igi->igi_rv * igi->igi_qi + igi->igi_qri;
- old_version_timer *= PR_SLOWHZ;
+ old_version_timer *= IGMP_SLOWHZ;
if (version == IGMP_VERSION_1) {
igi->igi_v1_timer = old_version_timer;
@@ -2193,11 +2202,14 @@
* Global slowtimo handler.
* VIMAGE: Timeout handlers are expected to service all vimages.
*/
-void
-igmp_slowtimo(void)
+static struct callout igmpslow_callout;
+static void
+igmp_slowtimo(void *arg __unused)
{
+ struct epoch_tracker et;
VNET_ITERATOR_DECL(vnet_iter);
+ NET_EPOCH_ENTER(et);
VNET_LIST_RLOCK_NOSLEEP();
VNET_FOREACH(vnet_iter) {
CURVNET_SET(vnet_iter);
@@ -2205,6 +2217,9 @@
CURVNET_RESTORE();
}
VNET_LIST_RUNLOCK_NOSLEEP();
+ NET_EPOCH_EXIT(et);
+
+ callout_reset(&igmpslow_callout, hz / IGMP_SLOWHZ, igmp_slowtimo, NULL);
}
/*
@@ -2433,7 +2448,7 @@
IGMP_v1_HOST_MEMBERSHIP_REPORT);
if (error == 0) {
inm->inm_timer = IGMP_RANDOM_DELAY(
- IGMP_V1V2_MAX_RI * PR_FASTHZ);
+ IGMP_V1V2_MAX_RI * IGMP_FASTHZ);
V_current_state_timers_running = 1;
}
break;
@@ -3688,6 +3703,12 @@
IGMP_LOCK_INIT();
m_raopt = igmp_ra_alloc();
netisr_register(&igmp_nh);
+ callout_init(&igmpslow_callout, 1);
+ callout_reset(&igmpslow_callout, hz / IGMP_SLOWHZ,
+ igmp_slowtimo, NULL);
+ callout_init(&igmpfast_callout, 1);
+ callout_reset(&igmpfast_callout, hz / IGMP_FASTHZ,
+ igmp_fasttimo, NULL);
break;
case MOD_UNLOAD:
CTR1(KTR_IGMPV3, "%s: tearing down", __func__);
diff --git a/sys/netinet/igmp_var.h b/sys/netinet/igmp_var.h
--- a/sys/netinet/igmp_var.h
+++ b/sys/netinet/igmp_var.h
@@ -148,7 +148,6 @@
#define IGMP_MAX_STATE_CHANGE_PACKETS 8 /* # of packets per state change */
#define IGMP_MAX_RESPONSE_PACKETS 16 /* # of packets for general query */
#define IGMP_MAX_RESPONSE_BURST 4 /* # of responses to send at once */
-#define IGMP_RESPONSE_BURST_INTERVAL (PR_FASTHZ / 2) /* 500ms */
/*
* IGMP-specific mbuf flags.
@@ -223,13 +222,11 @@
};
int igmp_change_state(struct in_multi *);
-void igmp_fasttimo(void);
struct igmp_ifsoftc *
igmp_domifattach(struct ifnet *);
void igmp_domifdetach(struct ifnet *);
void igmp_ifdetach(struct ifnet *);
int igmp_input(struct mbuf **, int *, int);
-void igmp_slowtimo(void);
SYSCTL_DECL(_net_inet_igmp);
diff --git a/sys/netinet/in_proto.c b/sys/netinet/in_proto.c
--- a/sys/netinet/in_proto.c
+++ b/sys/netinet/in_proto.c
@@ -184,8 +184,6 @@
.pr_protocol = IPPROTO_IGMP,
.pr_flags = PR_ATOMIC|PR_ADDR,
.pr_ctloutput = rip_ctloutput,
- .pr_fasttimo = igmp_fasttimo,
- .pr_slowtimo = igmp_slowtimo,
.pr_usrreqs = &rip_usrreqs
},
{
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Mar 1, 12:35 AM (17 h, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16894679
Default Alt Text
D36160.diff (5 KB)
Attached To
Mode
D36160: igmp: use callout(9) directly instead of pr_slowtimo, pr_fasttimo
Attached
Detach File
Event Timeline
Log In to Comment