PERFORCE change 167260 for review
Julian Elischer
julian at elischer.org
Thu Aug 13 00:57:38 UTC 2009
Julian Elischer wrote:
ok I think I have worked it out.
>
> AND for example:
> in ./netinet/in_proto.c
> VNET_DOMAIN_SET(inet);
> includes
> VNET_SYSINIT ##### --> called for every vnet as created #### (dubious)
##### --> and existing vnets.....on load
> calls
> vnet_domain_init()
> calls
> domain_init()
> calls
> protosw_init()
> which includes
> if (pr->pr_init)
> (*pr->pr_init)();
>
> so, robert is calling the init routine from each protocol
> not the modevent.
but you now do:
pf_proto_register(int family, struct protosw *npr)
{
+ VNET_ITERATOR_DECL(vnet_iter);
struct domain *dp;
struct protosw *pr, *fpr;
@@ -391,7 +392,13 @@
mtx_unlock(&dom_mtx);
/* Initialize and activate the protocol. */
- protosw_init(fpr);
+ VNET_LIST_RLOCK();
+ VNET_FOREACH(vnet_iter) {
+ CURVNET_SET_QUIET(vnet_iter);
+ protosw_init(fpr);
+ CURVNET_RESTORE();
+ }
+ VNET_LIST_RUNLOCK();
but that only dets called for existing domains at load time.
so, who calls protosw_init on new domains? Robert does, and you don't.
so there is no duplication. by design or luck...
if we load a new domain (like netgraph sockets) then we need to just
call the domain stuff which will get called every time a new
vnet is made via VNET_SYSINIT and the module code does nothing.
however I'm not totally convinced about running the
domain code N times...
the following code has references to dom_init calls
./kern/uipc_usrreq.c: .dom_init = unp_init,
./netipsec/keysock.c: .dom_init = key_init0,
./netnatm/natm_proto.c: .dom_init = natm_init,
Of these only natm looks like it will go wierd if called multiple times..
I'd like to add a protocol flag that we set on protocols that it was
ok to call the inti routine for on non-default vnets.
3rd party domains wouldn't ever have it set.
More information about the p4-projects
mailing list