Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet6/mld6.c
Show First 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | |||||
#include "opt_inet.h" | #include "opt_inet.h" | ||||
#include "opt_inet6.h" | #include "opt_inet6.h" | ||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <sys/systm.h> | #include <sys/systm.h> | ||||
#include <sys/mbuf.h> | #include <sys/mbuf.h> | ||||
#include <sys/socket.h> | #include <sys/socket.h> | ||||
#include <sys/protosw.h> | |||||
#include <sys/sysctl.h> | #include <sys/sysctl.h> | ||||
#include <sys/kernel.h> | #include <sys/kernel.h> | ||||
#include <sys/callout.h> | #include <sys/callout.h> | ||||
#include <sys/malloc.h> | #include <sys/malloc.h> | ||||
#include <sys/module.h> | #include <sys/module.h> | ||||
#include <sys/ktr.h> | #include <sys/ktr.h> | ||||
#include <net/if.h> | #include <net/if.h> | ||||
▲ Show 20 Lines • Show All 1,202 Lines • ▼ Show 20 Lines | mld_input(struct mbuf **mp, int off, int icmp6len) | ||||
return (0); | return (0); | ||||
} | } | ||||
/* | /* | ||||
* Fast timeout handler (global). | * Fast timeout handler (global). | ||||
* VIMAGE: Timeout handlers are expected to service all vimages. | * VIMAGE: Timeout handlers are expected to service all vimages. | ||||
*/ | */ | ||||
void | static struct callout mldfast_callout; | ||||
mld_fasttimo(void) | static void | ||||
mld_fasttimo(void *arg __unused) | |||||
melifaro: We need to enter epoch here.
mld_fasttimo_vnet() calls mld_v2_dispatch_general_query() which… | |||||
glebiusAuthorUnsubmitted Done Inline ActionsThanks! Will do. glebius: Thanks! Will do. | |||||
{ | { | ||||
struct in6_multi_head inmh; | struct in6_multi_head inmh; | ||||
VNET_ITERATOR_DECL(vnet_iter); | VNET_ITERATOR_DECL(vnet_iter); | ||||
SLIST_INIT(&inmh); | SLIST_INIT(&inmh); | ||||
VNET_LIST_RLOCK_NOSLEEP(); | VNET_LIST_RLOCK_NOSLEEP(); | ||||
VNET_FOREACH(vnet_iter) { | VNET_FOREACH(vnet_iter) { | ||||
CURVNET_SET(vnet_iter); | CURVNET_SET(vnet_iter); | ||||
mld_fasttimo_vnet(&inmh); | mld_fasttimo_vnet(&inmh); | ||||
CURVNET_RESTORE(); | CURVNET_RESTORE(); | ||||
} | } | ||||
VNET_LIST_RUNLOCK_NOSLEEP(); | VNET_LIST_RUNLOCK_NOSLEEP(); | ||||
in6m_release_list_deferred(&inmh); | in6m_release_list_deferred(&inmh); | ||||
callout_reset(&mldfast_callout, hz / PR_FASTHZ, mld_fasttimo, NULL); | |||||
} | } | ||||
/* | /* | ||||
* Fast timeout handler (per-vnet). | * Fast timeout handler (per-vnet). | ||||
* | * | ||||
* VIMAGE: Assume caller has set up our curvnet. | * VIMAGE: Assume caller has set up our curvnet. | ||||
*/ | */ | ||||
static void | static void | ||||
▲ Show 20 Lines • Show All 381 Lines • ▼ Show 20 Lines | mld_v2_cancel_link_timers(struct mld_ifsoftc *mli) | ||||
IF_ADDR_WUNLOCK(ifp); | IF_ADDR_WUNLOCK(ifp); | ||||
in6m_release_list_deferred(&inmh); | in6m_release_list_deferred(&inmh); | ||||
} | } | ||||
/* | /* | ||||
* Global slowtimo handler. | * Global slowtimo handler. | ||||
* VIMAGE: Timeout handlers are expected to service all vimages. | * VIMAGE: Timeout handlers are expected to service all vimages. | ||||
*/ | */ | ||||
void | static struct callout mldslow_callout; | ||||
mld_slowtimo(void) | static void | ||||
mld_slowtimo(void *arg __unused) | |||||
{ | { | ||||
VNET_ITERATOR_DECL(vnet_iter); | VNET_ITERATOR_DECL(vnet_iter); | ||||
VNET_LIST_RLOCK_NOSLEEP(); | VNET_LIST_RLOCK_NOSLEEP(); | ||||
VNET_FOREACH(vnet_iter) { | VNET_FOREACH(vnet_iter) { | ||||
CURVNET_SET(vnet_iter); | CURVNET_SET(vnet_iter); | ||||
mld_slowtimo_vnet(); | mld_slowtimo_vnet(); | ||||
CURVNET_RESTORE(); | CURVNET_RESTORE(); | ||||
} | } | ||||
VNET_LIST_RUNLOCK_NOSLEEP(); | VNET_LIST_RUNLOCK_NOSLEEP(); | ||||
callout_reset(&mldslow_callout, hz / PR_SLOWHZ, mld_slowtimo, NULL); | |||||
melifaroUnsubmitted Not Done Inline ActionsProbably worth using callout_reset_sbt() to indicate absolute timeout. melifaro: Probably worth using `callout_reset_sbt()` to indicate absolute timeout. | |||||
glebiusAuthorUnsubmitted Done Inline ActionsI'd better leave functional improvements for future, not in this changeset. glebius: I'd better leave functional improvements for future, not in this changeset. | |||||
} | } | ||||
/* | /* | ||||
* Per-vnet slowtimo handler. | * Per-vnet slowtimo handler. | ||||
*/ | */ | ||||
static void | static void | ||||
mld_slowtimo_vnet(void) | mld_slowtimo_vnet(void) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 1,533 Lines • ▼ Show 20 Lines | mld_init(void *unused __unused) | ||||
CTR1(KTR_MLD, "%s: initializing", __func__); | CTR1(KTR_MLD, "%s: initializing", __func__); | ||||
MLD_LOCK_INIT(); | MLD_LOCK_INIT(); | ||||
ip6_initpktopts(&mld_po); | ip6_initpktopts(&mld_po); | ||||
mld_po.ip6po_hlim = 1; | mld_po.ip6po_hlim = 1; | ||||
mld_po.ip6po_hbh = &mld_ra.hbh; | mld_po.ip6po_hbh = &mld_ra.hbh; | ||||
mld_po.ip6po_prefer_tempaddr = IP6PO_TEMPADDR_NOTPREFER; | mld_po.ip6po_prefer_tempaddr = IP6PO_TEMPADDR_NOTPREFER; | ||||
mld_po.ip6po_flags = IP6PO_DONTFRAG; | mld_po.ip6po_flags = IP6PO_DONTFRAG; | ||||
callout_init(&mldslow_callout, 1); | |||||
callout_reset(&mldslow_callout, hz / PR_SLOWHZ, mld_slowtimo, NULL); | |||||
callout_init(&mldfast_callout, 1); | |||||
callout_reset(&mldfast_callout, hz / PR_FASTHZ, mld_fasttimo, NULL); | |||||
} | } | ||||
SYSINIT(mld_init, SI_SUB_PROTO_MC, SI_ORDER_MIDDLE, mld_init, NULL); | SYSINIT(mld_init, SI_SUB_PROTO_MC, SI_ORDER_MIDDLE, mld_init, NULL); | ||||
static void | static void | ||||
mld_uninit(void *unused __unused) | mld_uninit(void *unused __unused) | ||||
{ | { | ||||
CTR1(KTR_MLD, "%s: tearing down", __func__); | CTR1(KTR_MLD, "%s: tearing down", __func__); | ||||
callout_drain(&mldslow_callout); | |||||
callout_drain(&mldfast_callout); | |||||
MLD_LOCK_DESTROY(); | MLD_LOCK_DESTROY(); | ||||
} | } | ||||
SYSUNINIT(mld_uninit, SI_SUB_PROTO_MC, SI_ORDER_MIDDLE, mld_uninit, NULL); | SYSUNINIT(mld_uninit, SI_SUB_PROTO_MC, SI_ORDER_MIDDLE, mld_uninit, NULL); | ||||
static void | static void | ||||
vnet_mld_init(const void *unused __unused) | vnet_mld_init(const void *unused __unused) | ||||
{ | { | ||||
Show All 37 Lines |
We need to enter epoch here.
mld_fasttimo_vnet() calls mld_v2_dispatch_general_query() which requires epoch to be present.