Index: sys/dev/hyperv/hvsock/hv_sock.c =================================================================== --- sys/dev/hyperv/hvsock/hv_sock.c +++ sys/dev/hyperv/hvsock/hv_sock.c @@ -130,7 +130,7 @@ .dom_protoswNPROTOSW = &hv_socket_protosw[nitems(hv_socket_protosw)] }; -VNET_DOMAIN_SET(hv_socket_); +DOMAIN_SET(hv_socket_); #define MAX_PORT ((uint32_t)0xFFFFFFFF) #define MIN_PORT ((uint32_t)0x0) Index: sys/kern/uipc_domain.c =================================================================== --- sys/kern/uipc_domain.c +++ sys/kern/uipc_domain.c @@ -183,29 +183,21 @@ struct protosw *pr; int flags; + MPASS(IS_DEFAULT_VNET(curvnet)); + flags = atomic_load_acq_int(&dp->dom_flags); if ((flags & DOMF_SUPPORTED) == 0) return; - KASSERT((flags & DOMF_INITED) == 0 || !IS_DEFAULT_VNET(curvnet), - ("Premature initialization of domain in non-default vnet")); + MPASS((flags & DOMF_INITED) == 0); + for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) { - /* - * Note that with VIMAGE enabled, domain_init() will be - * re-invoked for each new vnet that's created. The below lists - * are intended to be system-wide, so avoid altering global - * state for non-default vnets. - */ - if (IS_DEFAULT_VNET(curvnet)) { - pr_usrreqs_init(pr); - rm_wlock(&pftimo_lock); - if (pr->pr_fasttimo != NULL) - LIST_INSERT_HEAD(&pffast_list, pr, - pr_fasttimos); - if (pr->pr_slowtimo != NULL) - LIST_INSERT_HEAD(&pfslow_list, pr, - pr_slowtimos); - rm_wunlock(&pftimo_lock); - } + pr_usrreqs_init(pr); + rm_wlock(&pftimo_lock); + if (pr->pr_fasttimo != NULL) + LIST_INSERT_HEAD(&pffast_list, pr, pr_fasttimos); + if (pr->pr_slowtimo != NULL) + LIST_INSERT_HEAD(&pfslow_list, pr, pr_slowtimos); + rm_wunlock(&pftimo_lock); } /* @@ -215,29 +207,9 @@ max_datalen = MHLEN - max_hdr; if (max_datalen < 1) panic("%s: max_datalen < 1", __func__); - if (IS_DEFAULT_VNET(curvnet)) - atomic_set_rel_int(&dp->dom_flags, DOMF_INITED); -} - -#ifdef VIMAGE -void -vnet_domain_init(void *arg) -{ - - /* Virtualized case is no different -- call init functions. */ - domain_init(arg); + atomic_set_rel_int(&dp->dom_flags, DOMF_INITED); } -void -vnet_domain_uninit(void *arg) -{ - struct domain *dp = arg; - - if ((atomic_load_acq_int(&dp->dom_flags) & DOMF_SUPPORTED) == 0) - return; -} -#endif - /* * Add a new protocol domain to the list of supported domains * Note: you cant unload it again because a socket may be using it. Index: sys/net/rtsock.c =================================================================== --- sys/net/rtsock.c +++ sys/net/rtsock.c @@ -2702,4 +2702,4 @@ .dom_protoswNPROTOSW = &routesw[nitems(routesw)] }; -VNET_DOMAIN_SET(route); +DOMAIN_SET(route); Index: sys/netgraph/bluetooth/socket/ng_btsocket.c =================================================================== --- sys/netgraph/bluetooth/socket/ng_btsocket.c +++ sys/netgraph/bluetooth/socket/ng_btsocket.c @@ -287,4 +287,4 @@ return (error); } /* ng_btsocket_modevent */ -VNET_DOMAIN_SET(ng_btsocket_); +DOMAIN_SET(ng_btsocket_); Index: sys/netgraph/ng_socket.c =================================================================== --- sys/netgraph/ng_socket.c +++ sys/netgraph/ng_socket.c @@ -1223,7 +1223,7 @@ return (error); } -VNET_DOMAIN_SET(ng); +DOMAIN_SET(ng); SYSCTL_INT(_net_graph, OID_AUTO, family, CTLFLAG_RD, SYSCTL_NULL_INT_PTR, AF_NETGRAPH, ""); static SYSCTL_NODE(_net_graph, OID_AUTO, data, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, Index: sys/netinet/in_proto.c =================================================================== --- sys/netinet/in_proto.c +++ sys/netinet/in_proto.c @@ -302,7 +302,7 @@ .dom_ifdetach = in_domifdetach }; -VNET_DOMAIN_SET(inet); +DOMAIN_SET(inet); #endif /* INET */ SYSCTL_NODE(_net, PF_INET, inet, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, Index: sys/netinet6/in6_proto.c =================================================================== --- sys/netinet6/in6_proto.c +++ sys/netinet6/in6_proto.c @@ -345,7 +345,7 @@ .dom_ifmtu = in6_domifmtu }; -VNET_DOMAIN_SET(inet6); +DOMAIN_SET(inet6); /* * Internet configuration info Index: sys/sys/domain.h =================================================================== --- sys/sys/domain.h +++ sys/sys/domain.h @@ -87,19 +87,6 @@ SI_ORDER_FIRST, domain_add, & name ## domain); \ SYSINIT(domain_init_ ## name, SI_SUB_PROTO_DOMAIN, \ SI_ORDER_SECOND, domain_init, & name ## domain); -#ifdef VIMAGE -#define VNET_DOMAIN_SET(name) \ - SYSINIT(domain_add_ ## name, SI_SUB_PROTO_DOMAIN, \ - SI_ORDER_FIRST, domain_add, & name ## domain); \ - VNET_SYSINIT(vnet_domain_init_ ## name, SI_SUB_PROTO_DOMAIN, \ - SI_ORDER_SECOND, vnet_domain_init, & name ## domain); \ - VNET_SYSUNINIT(vnet_domain_uninit_ ## name, \ - SI_SUB_PROTO_DOMAIN, SI_ORDER_SECOND, vnet_domain_uninit, \ - & name ## domain) -#else /* !VIMAGE */ -#define VNET_DOMAIN_SET(name) DOMAIN_SET(name) -#endif /* VIMAGE */ - #endif /* _KERNEL */ #endif /* !_SYS_DOMAIN_H_ */