Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F146529691
D33537.id100224.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
26 KB
Referenced Files
None
Subscribers
None
D33537.id100224.diff
View Options
Index: sys/dev/hyperv/hvsock/hv_sock.h
===================================================================
--- sys/dev/hyperv/hvsock/hv_sock.h
+++ sys/dev/hyperv/hvsock/hv_sock.h
@@ -96,7 +96,6 @@
((struct socket *)((hvspcb)->so))
void hvs_addr_init(struct sockaddr_hvs *, const struct hyperv_guid *);
-void hvs_trans_init(void);
void hvs_trans_close(struct socket *);
void hvs_trans_detach(struct socket *);
void hvs_trans_abort(struct socket *);
Index: sys/dev/hyperv/hvsock/hv_sock.c
===================================================================
--- sys/dev/hyperv/hvsock/hv_sock.c
+++ sys/dev/hyperv/hvsock/hv_sock.c
@@ -118,7 +118,6 @@
.pr_domain = &hv_socket_domain,
.pr_protocol = HYPERV_SOCK_PROTO_TRANS,
.pr_flags = PR_CONNREQUIRED,
- .pr_init = hvs_trans_init,
.pr_usrreqs = &hvs_trans_usrreqs,
},
};
@@ -336,12 +335,9 @@
return (0);
}
-void
-hvs_trans_init(void)
+static void
+hvs_trans_init(void *arg __unused)
{
- /* Skip initialization of globals for non-default instances. */
- if (!IS_DEFAULT_VNET(curvnet))
- return;
HVSOCK_DBG(HVSOCK_DBG_VERBOSE,
"%s: HyperV Socket hvs_trans_init called\n", __func__);
@@ -354,6 +350,8 @@
LIST_INIT(&hvs_trans_bound_socks);
LIST_INIT(&hvs_trans_connected_socks);
}
+SYSINIT(hvs_trans_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD,
+ hvs_trans_init, NULL);
/*
* Called in two cases:
Index: sys/kern/uipc_debug.c
===================================================================
--- sys/kern/uipc_debug.c
+++ sys/kern/uipc_debug.c
@@ -330,10 +330,7 @@
db_printf("pr_input: %p ", pr->pr_input);
db_printf("pr_output: %p ", pr->pr_output);
db_printf("pr_ctlinput: %p\n", pr->pr_ctlinput);
-
- db_print_indent(indent);
db_printf("pr_ctloutput: %p ", pr->pr_ctloutput);
- db_printf("pr_init: %p\n", pr->pr_init);
db_print_indent(indent);
db_printf("pr_fasttimo: %p ", pr->pr_fasttimo);
Index: sys/kern/uipc_domain.c
===================================================================
--- sys/kern/uipc_domain.c
+++ sys/kern/uipc_domain.c
@@ -169,8 +169,6 @@
DEFAULT(pu->pru_sopoll, sopoll_generic);
DEFAULT(pu->pru_ready, pru_ready_notsupp);
#undef DEFAULT
- if (pr->pr_init)
- (*pr->pr_init)();
}
/*
@@ -365,7 +363,6 @@
int
pf_proto_register(int family, struct protosw *npr)
{
- VNET_ITERATOR_DECL(vnet_iter);
struct domain *dp;
struct protosw *pr, *fpr;
@@ -425,15 +422,6 @@
/* Job is done, no more protection required. */
mtx_unlock(&dom_mtx);
- /* Initialize and activate the protocol. */
- VNET_LIST_RLOCK();
- VNET_FOREACH(vnet_iter) {
- CURVNET_SET_QUIET(vnet_iter);
- protosw_init(fpr);
- CURVNET_RESTORE();
- }
- VNET_LIST_RUNLOCK();
-
return (0);
}
@@ -498,7 +486,6 @@
dpr->pr_output = NULL;
dpr->pr_ctlinput = NULL;
dpr->pr_ctloutput = NULL;
- dpr->pr_init = NULL;
dpr->pr_fasttimo = NULL;
dpr->pr_slowtimo = NULL;
dpr->pr_drain = NULL;
Index: sys/net/raw_cb.h
===================================================================
--- sys/net/raw_cb.h
+++ sys/net/raw_cb.h
@@ -66,7 +66,6 @@
* Generic protosw entries for raw socket protocols.
*/
pr_ctlinput_t raw_ctlinput;
-pr_init_t raw_init;
/*
* Library routines for raw socket usrreq functions; will always be wrapped
Index: sys/net/raw_usrreq.c
===================================================================
--- sys/net/raw_usrreq.c
+++ sys/net/raw_usrreq.c
@@ -56,12 +56,13 @@
/*
* Initialize raw connection block q.
*/
-void
-raw_init(void)
+static void
+raw_init(void *arg __unused)
{
LIST_INIT(&V_rawcb_list);
}
+VNET_SYSINIT(raw_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, raw_init, NULL);
/*
* Raw protocol input routine. Find the socket associated with the packet(s)
Index: sys/net/rtsock.c
===================================================================
--- sys/net/rtsock.c
+++ sys/net/rtsock.c
@@ -2691,7 +2691,6 @@
.pr_flags = PR_ATOMIC|PR_ADDR,
.pr_output = route_output,
.pr_ctlinput = raw_ctlinput,
- .pr_init = raw_init,
.pr_usrreqs = &route_usrreqs
}
};
Index: sys/netgraph/bluetooth/include/ng_btsocket_hci_raw.h
===================================================================
--- sys/netgraph/bluetooth/include/ng_btsocket_hci_raw.h
+++ sys/netgraph/bluetooth/include/ng_btsocket_hci_raw.h
@@ -67,7 +67,6 @@
#ifdef _KERNEL
-void ng_btsocket_hci_raw_init (void);
void ng_btsocket_hci_raw_abort (struct socket *);
void ng_btsocket_hci_raw_close (struct socket *);
int ng_btsocket_hci_raw_attach (struct socket *, int, struct thread *);
Index: sys/netgraph/bluetooth/include/ng_btsocket_l2cap.h
===================================================================
--- sys/netgraph/bluetooth/include/ng_btsocket_l2cap.h
+++ sys/netgraph/bluetooth/include/ng_btsocket_l2cap.h
@@ -95,7 +95,6 @@
#ifdef _KERNEL
-void ng_btsocket_l2cap_raw_init (void);
void ng_btsocket_l2cap_raw_abort (struct socket *);
void ng_btsocket_l2cap_raw_close (struct socket *);
int ng_btsocket_l2cap_raw_attach (struct socket *, int, struct thread *);
@@ -191,7 +190,6 @@
#ifdef _KERNEL
-void ng_btsocket_l2cap_init (void);
void ng_btsocket_l2cap_abort (struct socket *);
void ng_btsocket_l2cap_close (struct socket *);
int ng_btsocket_l2cap_accept (struct socket *, struct sockaddr **);
Index: sys/netgraph/bluetooth/include/ng_btsocket_rfcomm.h
===================================================================
--- sys/netgraph/bluetooth/include/ng_btsocket_rfcomm.h
+++ sys/netgraph/bluetooth/include/ng_btsocket_rfcomm.h
@@ -315,7 +315,6 @@
#ifdef _KERNEL
-void ng_btsocket_rfcomm_init (void);
void ng_btsocket_rfcomm_abort (struct socket *);
void ng_btsocket_rfcomm_close (struct socket *);
int ng_btsocket_rfcomm_accept (struct socket *, struct sockaddr **);
Index: sys/netgraph/bluetooth/include/ng_btsocket_sco.h
===================================================================
--- sys/netgraph/bluetooth/include/ng_btsocket_sco.h
+++ sys/netgraph/bluetooth/include/ng_btsocket_sco.h
@@ -105,7 +105,6 @@
#ifdef _KERNEL
-void ng_btsocket_sco_init (void);
void ng_btsocket_sco_abort (struct socket *);
void ng_btsocket_sco_close (struct socket *);
int ng_btsocket_sco_accept (struct socket *, struct sockaddr **);
Index: sys/netgraph/bluetooth/socket/ng_btsocket.c
===================================================================
--- sys/netgraph/bluetooth/socket/ng_btsocket.c
+++ sys/netgraph/bluetooth/socket/ng_btsocket.c
@@ -176,7 +176,6 @@
.pr_protocol = BLUETOOTH_PROTO_HCI,
.pr_flags = PR_ATOMIC|PR_ADDR,
.pr_ctloutput = ng_btsocket_hci_raw_ctloutput,
- .pr_init = ng_btsocket_hci_raw_init,
.pr_usrreqs = &ng_btsocket_hci_raw_usrreqs,
},
{
@@ -184,7 +183,6 @@
.pr_domain = &ng_btsocket_domain,
.pr_protocol = BLUETOOTH_PROTO_L2CAP,
.pr_flags = PR_ATOMIC|PR_ADDR,
- .pr_init = ng_btsocket_l2cap_raw_init,
.pr_usrreqs = &ng_btsocket_l2cap_raw_usrreqs,
},
{
@@ -193,7 +191,6 @@
.pr_protocol = BLUETOOTH_PROTO_L2CAP,
.pr_flags = PR_ATOMIC|PR_CONNREQUIRED,
.pr_ctloutput = ng_btsocket_l2cap_ctloutput,
- .pr_init = ng_btsocket_l2cap_init,
.pr_usrreqs = &ng_btsocket_l2cap_usrreqs,
},
{
@@ -202,7 +199,6 @@
.pr_protocol = BLUETOOTH_PROTO_RFCOMM,
.pr_flags = PR_CONNREQUIRED,
.pr_ctloutput = ng_btsocket_rfcomm_ctloutput,
- .pr_init = ng_btsocket_rfcomm_init,
.pr_usrreqs = &ng_btsocket_rfcomm_usrreqs,
},
{
@@ -211,7 +207,6 @@
.pr_protocol = BLUETOOTH_PROTO_SCO,
.pr_flags = PR_ATOMIC|PR_CONNREQUIRED,
.pr_ctloutput = ng_btsocket_sco_ctloutput,
- .pr_init = ng_btsocket_sco_init,
.pr_usrreqs = &ng_btsocket_sco_usrreqs,
},
};
Index: sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c
===================================================================
--- sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c
+++ sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c
@@ -728,16 +728,12 @@
* Initialize everything
*/
-void
-ng_btsocket_hci_raw_init(void)
+static void
+ng_btsocket_hci_raw_init(void *arg __unused)
{
bitstr_t *f = NULL;
int error = 0;
- /* Skip initialization of globals for non-default instances. */
- if (!IS_DEFAULT_VNET(curvnet))
- return;
-
ng_btsocket_hci_raw_node = NULL;
ng_btsocket_hci_raw_debug_level = NG_BTSOCKET_WARN_LEVEL;
ng_btsocket_hci_raw_ioctl_timeout = 5;
@@ -889,6 +885,8 @@
bit_set(f, NG_HCI_OCF_LE_READ_WHITE_LIST_SIZE - 1);
} /* ng_btsocket_hci_raw_init */
+SYSINIT(ng_btsocket_hci_raw_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD,
+ ng_btsocket_hci_raw_init, NULL);
/*
* Abort connection on socket
Index: sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c
===================================================================
--- sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c
+++ sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c
@@ -1887,15 +1887,11 @@
* Initialize everything
*/
-void
-ng_btsocket_l2cap_init(void)
+static void
+ng_btsocket_l2cap_init(void *arg __unused)
{
int error = 0;
- /* Skip initialization of globals for non-default instances. */
- if (!IS_DEFAULT_VNET(curvnet))
- return;
-
ng_btsocket_l2cap_node = NULL;
ng_btsocket_l2cap_debug_level = NG_BTSOCKET_WARN_LEVEL;
@@ -1950,6 +1946,8 @@
TASK_INIT(&ng_btsocket_l2cap_rt_task, 0,
ng_btsocket_l2cap_rtclean, NULL);
} /* ng_btsocket_l2cap_init */
+SYSINIT(ng_btsocket_l2cap_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD,
+ ng_btsocket_l2cap_init, NULL);
/*
* Abort connection on socket
Index: sys/netgraph/bluetooth/socket/ng_btsocket_l2cap_raw.c
===================================================================
--- sys/netgraph/bluetooth/socket/ng_btsocket_l2cap_raw.c
+++ sys/netgraph/bluetooth/socket/ng_btsocket_l2cap_raw.c
@@ -513,15 +513,11 @@
* Initialize everything
*/
-void
-ng_btsocket_l2cap_raw_init(void)
+static void
+ng_btsocket_l2cap_raw_init(void *arg __unused)
{
int error = 0;
- /* Skip initialization of globals for non-default instances. */
- if (!IS_DEFAULT_VNET(curvnet))
- return;
-
ng_btsocket_l2cap_raw_node = NULL;
ng_btsocket_l2cap_raw_debug_level = NG_BTSOCKET_WARN_LEVEL;
ng_btsocket_l2cap_raw_ioctl_timeout = 5;
@@ -582,6 +578,8 @@
TASK_INIT(&ng_btsocket_l2cap_raw_rt_task, 0,
ng_btsocket_l2cap_raw_rtclean, NULL);
} /* ng_btsocket_l2cap_raw_init */
+SYSINIT(ng_btsocket_l2cap_raw_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD,
+ ng_btsocket_l2cap_raw_init, NULL);
/*
* Abort connection on socket
Index: sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c
===================================================================
--- sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c
+++ sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c
@@ -328,14 +328,10 @@
* Initialize everything
*/
-void
-ng_btsocket_rfcomm_init(void)
+static void
+ng_btsocket_rfcomm_init(void *arg __unused)
{
- /* Skip initialization of globals for non-default instances. */
- if (!IS_DEFAULT_VNET(curvnet))
- return;
-
ng_btsocket_rfcomm_debug_level = NG_BTSOCKET_WARN_LEVEL;
ng_btsocket_rfcomm_timo = 60;
@@ -353,6 +349,8 @@
mtx_init(&ng_btsocket_rfcomm_sockets_mtx,
"btsocks_rfcomm_sockets_mtx", NULL, MTX_DEF);
} /* ng_btsocket_rfcomm_init */
+SYSINIT(ng_btsocket_rfcomm_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD,
+ ng_btsocket_rfcomm_init, NULL);
/*
* Abort connection on socket
Index: sys/netgraph/bluetooth/socket/ng_btsocket_sco.c
===================================================================
--- sys/netgraph/bluetooth/socket/ng_btsocket_sco.c
+++ sys/netgraph/bluetooth/socket/ng_btsocket_sco.c
@@ -1098,15 +1098,11 @@
* Initialize everything
*/
-void
-ng_btsocket_sco_init(void)
+static void
+ng_btsocket_sco_init(void *arg __unused)
{
int error = 0;
- /* Skip initialization of globals for non-default instances. */
- if (!IS_DEFAULT_VNET(curvnet))
- return;
-
ng_btsocket_sco_node = NULL;
ng_btsocket_sco_debug_level = NG_BTSOCKET_WARN_LEVEL;
@@ -1160,6 +1156,8 @@
TASK_INIT(&ng_btsocket_sco_rt_task, 0,
ng_btsocket_sco_rtclean, NULL);
} /* ng_btsocket_sco_init */
+SYSINIT(ng_btsocket_sco_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD,
+ ng_btsocket_sco_init, NULL);
/*
* Abort connection on socket
Index: sys/netinet/in_proto.c
===================================================================
--- sys/netinet/in_proto.c
+++ sys/netinet/in_proto.c
@@ -113,7 +113,6 @@
.pr_domain = &inetdomain,
.pr_protocol = IPPROTO_IP,
.pr_flags = PR_CAPATTACH,
- .pr_init = ip_init,
.pr_slowtimo = ip_slowtimo,
.pr_drain = ip_drain,
.pr_usrreqs = &nousrreqs
@@ -126,7 +125,6 @@
.pr_input = udp_input,
.pr_ctlinput = udp_ctlinput,
.pr_ctloutput = udp_ctloutput,
- .pr_init = udp_init,
.pr_usrreqs = &udp_usrreqs
},
{
@@ -138,7 +136,6 @@
.pr_input = tcp_input,
.pr_ctlinput = tcp_ctlinput,
.pr_ctloutput = tcp_ctloutput,
- .pr_init = tcp_init,
.pr_slowtimo = tcp_slowtimo,
.pr_drain = tcp_drain,
.pr_usrreqs = &tcp_usrreqs
@@ -152,7 +149,6 @@
.pr_input = sctp_input,
.pr_ctlinput = sctp_ctlinput,
.pr_ctloutput = sctp_ctloutput,
- .pr_init = sctp_init,
.pr_drain = sctp_drain,
.pr_usrreqs = &sctp_usrreqs
},
@@ -176,7 +172,6 @@
.pr_input = udp_input,
.pr_ctlinput = udplite_ctlinput,
.pr_ctloutput = udp_ctloutput,
- .pr_init = udplite_init,
.pr_usrreqs = &udp_usrreqs
},
{
@@ -290,7 +285,6 @@
.pr_flags = PR_ATOMIC|PR_ADDR,
.pr_input = rip_input,
.pr_ctloutput = rip_ctloutput,
- .pr_init = rip_init,
.pr_usrreqs = &rip_usrreqs
},
};
Index: sys/netinet/ip_divert.c
===================================================================
--- sys/netinet/ip_divert.c
+++ sys/netinet/ip_divert.c
@@ -143,7 +143,7 @@
}
static void
-div_init(void)
+div_init(void *arg __unused)
{
/*
@@ -153,6 +153,7 @@
*/
in_pcbinfo_init(&V_divcbinfo, "div", 1, 1, "divcb", div_inpcb_init);
}
+VNET_SYSINIT(div_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, div_init, NULL);
static void
div_destroy(void *unused __unused)
@@ -160,8 +161,7 @@
in_pcbinfo_destroy(&V_divcbinfo);
}
-VNET_SYSUNINIT(divert, SI_SUB_PROTO_DOMAININIT, SI_ORDER_ANY,
- div_destroy, NULL);
+VNET_SYSUNINIT(divert, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, div_destroy, NULL);
/*
* IPPROTO_DIVERT is not in the real IP protocol number space; this
@@ -775,7 +775,6 @@
.pr_protocol = IPPROTO_DIVERT,
.pr_flags = PR_ATOMIC|PR_ADDR,
.pr_input = div_input,
- .pr_init = div_init,
.pr_usrreqs = &div_usrreqs
};
Index: sys/netinet/ip_input.c
===================================================================
--- sys/netinet/ip_input.c
+++ sys/netinet/ip_input.c
@@ -301,12 +301,10 @@
* IP initialization: fill in IP protocol switch table.
* All protocols not implemented in kernel go to raw IP protocol handler.
*/
-void
-ip_init(void)
+static void
+ip_vnet_init(void *arg __unused)
{
struct pfil_head_args args;
- struct protosw *pr;
- int i;
CK_STAILQ_INIT(&V_in_ifaddrhead);
V_in_ifaddrhashtbl = hashinit(INADDR_NHASH, M_IFADDR, &V_in_ifaddrhmask);
@@ -332,23 +330,27 @@
printf("%s: WARNING: unable to register output helper hook\n",
__func__);
- /* Skip initialization of globals for non-default instances. */
#ifdef VIMAGE
- if (!IS_DEFAULT_VNET(curvnet)) {
- netisr_register_vnet(&ip_nh);
+ netisr_register_vnet(&ip_nh);
#ifdef RSS
- netisr_register_vnet(&ip_direct_nh);
+ netisr_register_vnet(&ip_direct_nh);
#endif
- return;
- }
#endif
+}
+VNET_SYSINIT(ip_vnet_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_FOURTH,
+ ip_vnet_init, NULL);
+
+
+static void
+ip_init(const void *unused __unused)
+{
+ struct protosw *pr;
pr = pffindproto(PF_INET, IPPROTO_RAW, SOCK_RAW);
- if (pr == NULL)
- panic("ip_init: PF_INET not found");
+ KASSERT(pr, ("%s: PF_INET not found", __func__));
/* Initialize the entire ip_protox[] array to IPPROTO_RAW. */
- for (i = 0; i < IPPROTO_MAX; i++)
+ for (int i = 0; i < IPPROTO_MAX; i++)
ip_protox[i] = pr - inetsw;
/*
* Cycle through IP protocols and put them into the appropriate place
@@ -368,6 +370,7 @@
netisr_register(&ip_direct_nh);
#endif
}
+SYSINIT(ip_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, ip_init, NULL);
#ifdef VIMAGE
static void
Index: sys/netinet/ip_var.h
===================================================================
--- sys/netinet/ip_var.h
+++ sys/netinet/ip_var.h
@@ -216,7 +216,6 @@
int ip_fragment(struct ip *ip, struct mbuf **m_frag, int mtu,
u_long if_hwassist_flags);
void ip_forward(struct mbuf *m, int srcrt);
-void ip_init(void);
extern int
(*ip_mforward)(struct ip *, struct ifnet *, struct mbuf *,
struct ip_moptions *);
@@ -233,7 +232,6 @@
void ip_fillid(struct ip *);
int rip_ctloutput(struct socket *, struct sockopt *);
void rip_ctlinput(int, struct sockaddr *, void *);
-void rip_init(void);
int rip_input(struct mbuf **, int *, int);
int rip_output(struct mbuf *, struct socket *, ...);
int ipip_input(struct mbuf **, int *, int);
Index: sys/netinet/raw_ip.c
===================================================================
--- sys/netinet/raw_ip.c
+++ sys/netinet/raw_ip.c
@@ -205,8 +205,8 @@
return (0);
}
-void
-rip_init(void)
+static void
+rip_init(void *arg __unused)
{
in_pcbinfo_init(&V_ripcbinfo, "rip", INP_PCBHASH_RAW_SIZE, 1, "ripcb",
@@ -214,6 +214,7 @@
EVENTHANDLER_REGISTER(maxsockets_change, rip_zone_change, NULL,
EVENTHANDLER_PRI_ANY);
}
+VNET_SYSINIT(rip_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, rip_init, NULL);
#ifdef VIMAGE
static void
Index: sys/netinet/sctp_module.c
===================================================================
--- sys/netinet/sctp_module.c
+++ sys/netinet/sctp_module.c
@@ -91,7 +91,6 @@
.pr_input = sctp6_input,
.pr_ctlinput = sctp6_ctlinput,
.pr_ctloutput = sctp_ctloutput,
- .pr_init = sctp_init,
.pr_drain = sctp_drain,
.pr_usrreqs = &sctp6_usrreqs,
};
@@ -105,7 +104,6 @@
.pr_ctlinput = sctp6_ctlinput,
.pr_ctloutput = sctp_ctloutput,
#ifndef INET /* Do not call initialization and drain routines twice. */
- .pr_init = sctp_init,
.pr_drain = sctp_drain,
#endif
.pr_usrreqs = &sctp6_usrreqs,
Index: sys/netinet/sctp_usrreq.c
===================================================================
--- sys/netinet/sctp_usrreq.c
+++ sys/netinet/sctp_usrreq.c
@@ -58,8 +58,8 @@
extern const struct sctp_cc_functions sctp_cc_functions[];
extern const struct sctp_ss_functions sctp_ss_functions[];
-void
-sctp_init(void)
+static void
+sctp_init(void *arg __unused)
{
u_long sb_max_adj;
@@ -91,6 +91,7 @@
SCTP_BASE_VAR(eh_tag) = EVENTHANDLER_REGISTER(rt_addrmsg,
sctp_addr_change_event_handler, NULL, EVENTHANDLER_PRI_FIRST);
}
+VNET_SYSINIT(sctp_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, sctp_init, NULL);
#ifdef VIMAGE
static void
Index: sys/netinet/sctp_var.h
===================================================================
--- sys/netinet/sctp_var.h
+++ sys/netinet/sctp_var.h
@@ -330,7 +330,6 @@
#endif
void sctp_pathmtu_adjustment(struct sctp_tcb *, uint16_t);
void sctp_drain(void);
-void sctp_init(void);
void
sctp_notify(struct sctp_inpcb *, struct sctp_tcb *, struct sctp_nets *,
uint8_t, uint8_t, uint16_t, uint32_t);
Index: sys/netinet/tcp_subr.c
===================================================================
--- sys/netinet/tcp_subr.c
+++ sys/netinet/tcp_subr.c
@@ -1422,8 +1422,8 @@
return (0);
}
-void
-tcp_init(void)
+static void
+tcp_vnet_init(void *arg __unused)
{
const char *tcbhash_tuneable;
int hashsize;
@@ -1482,6 +1482,7 @@
"clipped from %d to %d.\n", __func__, oldhashsize,
hashsize);
}
+ tcp_tcbhashsize = hashsize;
in_pcbinfo_init(&V_tcbinfo, "tcp", hashsize, hashsize,
"tcp_inpcb", tcp_inpcb_init);
@@ -1505,10 +1506,13 @@
COUNTER_ARRAY_ALLOC(V_tcps_states, TCP_NSTATES, M_WAITOK);
VNET_PCPUSTAT_ALLOC(tcpstat, M_WAITOK);
+}
+VNET_SYSINIT(tcp_vnet_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD,
+ tcp_vnet_init, NULL);
- /* Skip initialization of globals for non-default instances. */
- if (!IS_DEFAULT_VNET(curvnet))
- return;
+static void
+tcp_init(void *arg __unused)
+{
tcp_reass_global_init();
@@ -1529,7 +1533,6 @@
tcp_persmax = TCPTV_PERSMAX;
tcp_rexmit_slop = TCPTV_CPU_VAR;
tcp_finwait2_timeout = TCPTV_FINWAIT2_TIMEOUT;
- tcp_tcbhashsize = hashsize;
/* Setup the tcp function block list */
TAILQ_INIT(&t_functions);
@@ -1580,6 +1583,7 @@
tcp_pcap_init();
#endif
}
+SYSINIT(tcp_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, tcp_init, NULL);
#ifdef VIMAGE
static void
Index: sys/netinet/tcp_var.h
===================================================================
--- sys/netinet/tcp_var.h
+++ sys/netinet/tcp_var.h
@@ -974,7 +974,6 @@
struct tcpcb *
tcp_drop(struct tcpcb *, int);
void tcp_drain(void);
-void tcp_init(void);
void tcp_fini(void *);
char *tcp_log_addrs(struct in_conninfo *, struct tcphdr *, void *,
const void *);
Index: sys/netinet/udp_usrreq.c
===================================================================
--- sys/netinet/udp_usrreq.c
+++ sys/netinet/udp_usrreq.c
@@ -198,8 +198,8 @@
return (0);
}
-void
-udp_init(void)
+static void
+udp_init(void *arg __unused)
{
/*
@@ -217,15 +217,12 @@
uma_zone_set_warning(V_udpcb_zone, "kern.ipc.maxsockets limit reached");
EVENTHANDLER_REGISTER(maxsockets_change, udp_zone_change, NULL,
EVENTHANDLER_PRI_ANY);
-}
-
-void
-udplite_init(void)
-{
+ /* Additional pcbinfo for UDP-Lite */
in_pcbinfo_init(&V_ulitecbinfo, "udplite", UDBHASHSIZE,
UDBHASHSIZE, "udplite_inpcb", udplite_inpcb_init);
}
+VNET_SYSINIT(udp_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, udp_init, NULL);
/*
* Kernel module interface for updating udpstat. The argument is an index
Index: sys/netinet/udp_var.h
===================================================================
--- sys/netinet/udp_var.h
+++ sys/netinet/udp_var.h
@@ -167,8 +167,6 @@
void udp_ctlinput(int, struct sockaddr *, void *);
void udplite_ctlinput(int, struct sockaddr *, void *);
int udp_ctloutput(struct socket *, struct sockopt *);
-void udp_init(void);
-void udplite_init(void);
int udp_input(struct mbuf **, int *, int);
void udplite_input(struct mbuf *, int);
struct inpcb *udp_notify(struct inpcb *inp, int errno);
Index: sys/netinet6/in6_proto.c
===================================================================
--- sys/netinet6/in6_proto.c
+++ sys/netinet6/in6_proto.c
@@ -146,7 +146,6 @@
.pr_domain = &inet6domain,
.pr_protocol = IPPROTO_IPV6,
.pr_flags = PR_CAPATTACH,
- .pr_init = ip6_init,
.pr_slowtimo = frag6_slowtimo,
.pr_drain = frag6_drain,
.pr_usrreqs = &nousrreqs,
@@ -159,9 +158,6 @@
.pr_input = udp6_input,
.pr_ctlinput = udp6_ctlinput,
.pr_ctloutput = ip6_ctloutput,
-#ifndef INET /* Do not call initialization twice. */
- .pr_init = udp_init,
-#endif
.pr_usrreqs = &udp6_usrreqs,
},
{
@@ -174,7 +170,6 @@
.pr_ctlinput = tcp6_ctlinput,
.pr_ctloutput = tcp_ctloutput,
#ifndef INET /* don't call initialization, timeout, and drain routines twice */
- .pr_init = tcp_init,
.pr_slowtimo = tcp_slowtimo,
.pr_drain = tcp_drain,
#endif
@@ -191,7 +186,6 @@
.pr_ctloutput = sctp_ctloutput,
#ifndef INET /* Do not call initialization and drain routines twice. */
.pr_drain = sctp_drain,
- .pr_init = sctp_init,
#endif
.pr_usrreqs = &sctp6_usrreqs
},
@@ -215,9 +209,6 @@
.pr_input = udp6_input,
.pr_ctlinput = udplite6_ctlinput,
.pr_ctloutput = udp_ctloutput,
-#ifndef INET /* Do not call initialization twice. */
- .pr_init = udplite_init,
-#endif
.pr_usrreqs = &udp6_usrreqs,
},
{
@@ -229,9 +220,6 @@
.pr_output = rip6_output,
.pr_ctlinput = rip6_ctlinput,
.pr_ctloutput = rip6_ctloutput,
-#ifndef INET /* Do not call initialization twice. */
- .pr_init = rip_init,
-#endif
.pr_usrreqs = &rip6_usrreqs
},
{
Index: sys/netinet6/ip6_input.c
===================================================================
--- sys/netinet6/ip6_input.c
+++ sys/netinet6/ip6_input.c
@@ -216,12 +216,10 @@
* IP6 initialization: fill in IP6 protocol switch table.
* All protocols not implemented in kernel go to raw IP6 protocol handler.
*/
-void
-ip6_init(void)
+static void
+ip6_vnet_init(void *arg __unused)
{
struct pfil_head_args args;
- struct protosw *pr;
- int i;
TUNABLE_INT_FETCH("net.inet6.ip6.auto_linklocal",
&V_ip6_auto_linklocal);
@@ -259,21 +257,25 @@
/* Skip global initialization stuff for non-default instances. */
#ifdef VIMAGE
- if (!IS_DEFAULT_VNET(curvnet)) {
- netisr_register_vnet(&ip6_nh);
+ netisr_register_vnet(&ip6_nh);
#ifdef RSS
- netisr_register_vnet(&ip6_direct_nh);
+ netisr_register_vnet(&ip6_direct_nh);
#endif
- return;
- }
#endif
+}
+VNET_SYSINIT(ip6_vnet_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_FOURTH,
+ ip6_vnet_init, NULL);
+
+static void
+ip6_init(void *arg __unused)
+{
+ struct protosw *pr;
pr = pffindproto(PF_INET6, IPPROTO_RAW, SOCK_RAW);
- if (pr == NULL)
- panic("ip6_init");
+ KASSERT(pr, ("%s: PF_INET6 not found", __func__));
/* Initialize the entire ip6_protox[] array to IPPROTO_RAW. */
- for (i = 0; i < IPPROTO_MAX; i++)
+ for (int i = 0; i < IPPROTO_MAX; i++)
ip6_protox[i] = pr - inet6sw;
/*
* Cycle through IP protocols and put them into the appropriate place
@@ -293,6 +295,7 @@
netisr_register(&ip6_direct_nh);
#endif
}
+SYSINIT(ip6_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, ip6_init, NULL);
/*
* The protocol to be inserted into ip6_protox[] must be already registered
Index: sys/netinet6/ip6_var.h
===================================================================
--- sys/netinet6/ip6_var.h
+++ sys/netinet6/ip6_var.h
@@ -347,7 +347,6 @@
int icmp6_ctloutput(struct socket *, struct sockopt *sopt);
struct in6_ifaddr;
-void ip6_init(void);
int ip6proto_register(short);
int ip6proto_unregister(short);
Index: sys/netipsec/keysock.c
===================================================================
--- sys/netipsec/keysock.c
+++ sys/netipsec/keysock.c
@@ -448,7 +448,6 @@
.pr_flags = PR_ATOMIC|PR_ADDR,
.pr_output = key_output,
.pr_ctlinput = raw_ctlinput,
- .pr_init = raw_init,
.pr_usrreqs = &key_usrreqs
}
};
Index: sys/sys/protosw.h
===================================================================
--- sys/sys/protosw.h
+++ sys/sys/protosw.h
@@ -52,7 +52,6 @@
* Each protocol has a handle initializing one of these structures,
* which is used for protocol-protocol and system-protocol communication.
*
- * A protocol is called through the pr_init entry before any other.
* Thereafter it is called every 200ms through the pr_fasttimo entry and
* every 500ms through the pr_slowtimo for timer based actions.
* The system will call the pr_drain entry if it is low on space and
@@ -73,7 +72,6 @@
typedef int pr_output_t (struct mbuf *, struct socket *, ...);
typedef void pr_ctlinput_t (int, struct sockaddr *, void *);
typedef int pr_ctloutput_t (struct socket *, struct sockopt *);
-typedef void pr_init_t (void);
typedef void pr_fasttimo_t (void);
typedef void pr_slowtimo_t (void);
typedef void pr_drain_t (void);
@@ -89,7 +87,6 @@
pr_ctlinput_t *pr_ctlinput; /* control input (from below) */
pr_ctloutput_t *pr_ctloutput; /* control output (from above) */
/* utility hooks */
- pr_init_t *pr_init;
pr_fasttimo_t *pr_fasttimo; /* fast timeout (200ms) */
pr_slowtimo_t *pr_slowtimo; /* slow timeout (500ms) */
pr_drain_t *pr_drain; /* flush any excess space possible */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Mar 4, 10:18 AM (20 h, 51 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29238603
Default Alt Text
D33537.id100224.diff (26 KB)
Attached To
Mode
D33537: protocols: init with standard SYSINIT(9) or VNET_SYSINIT
Attached
Detach File
Event Timeline
Log In to Comment