Date: Sun, 26 Apr 2009 22:06:42 +0000 (UTC) From: Marko Zec <zec@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r191548 - in head/sys: compat/linux contrib/ipfilter/netinet net netinet netinet6 Message-ID: <200904262206.n3QM6g4g096299@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: zec Date: Sun Apr 26 22:06:42 2009 New Revision: 191548 URL: http://svn.freebsd.org/changeset/base/191548 Log: In preparation for turning on options VIMAGE in next commits, rearrange / replace / adjust several INIT_VNET_* initializer macros, all of which currently resolve to whitespace. Reviewed by: bz (an older version of the patch) Approved by: julian (mentor) Modified: head/sys/compat/linux/linux_socket.c head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c head/sys/net/if_loop.c head/sys/net/route.c head/sys/net/rtsock.c head/sys/netinet/igmp.c head/sys/netinet/in.c head/sys/netinet/in_mcast.c head/sys/netinet/in_rmx.c head/sys/netinet/ip_divert.c head/sys/netinet/ip_fw2.c head/sys/netinet/ip_mroute.c head/sys/netinet/tcp_subr.c head/sys/netinet/tcp_timewait.c head/sys/netinet/udp_usrreq.c head/sys/netinet6/in6_rmx.c head/sys/netinet6/nd6_rtr.c Modified: head/sys/compat/linux/linux_socket.c ============================================================================== --- head/sys/compat/linux/linux_socket.c Sun Apr 26 21:50:21 2009 (r191547) +++ head/sys/compat/linux/linux_socket.c Sun Apr 26 22:06:42 2009 (r191548) @@ -584,8 +584,10 @@ static int linux_socket(struct thread *td, struct linux_socket_args *args) { #ifdef INET6 +#ifndef KLD_MODULE INIT_VNET_INET6(curvnet); #endif +#endif struct socket_args /* { int domain; int type; Modified: head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c ============================================================================== --- head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Sun Apr 26 21:50:21 2009 (r191547) +++ head/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Sun Apr 26 22:06:42 2009 (r191548) @@ -213,6 +213,7 @@ char *s; int ipfattach() { + INIT_VNET_INET(curvnet); #ifdef USE_SPL int s; #endif @@ -264,6 +265,7 @@ int ipfattach() */ int ipfdetach() { + INIT_VNET_INET(curvnet); #ifdef USE_SPL int s; #endif @@ -646,6 +648,7 @@ static int fr_send_ip(fin, m, mpp) fr_info_t *fin; mb_t *m, **mpp; { + INIT_VNET_INET(curvnet); fr_info_t fnew; ip_t *ip, *oip; int hlen; Modified: head/sys/net/if_loop.c ============================================================================== --- head/sys/net/if_loop.c Sun Apr 26 21:50:21 2009 (r191547) +++ head/sys/net/if_loop.c Sun Apr 26 22:06:42 2009 (r191548) @@ -174,7 +174,6 @@ static int vnet_loif_iattach(const void static int loop_modevent(module_t mod, int type, void *data) { - INIT_VNET_NET(curvnet); switch (type) { case MOD_LOAD: Modified: head/sys/net/route.c ============================================================================== --- head/sys/net/route.c Sun Apr 26 21:50:21 2009 (r191547) +++ head/sys/net/route.c Sun Apr 26 22:06:42 2009 (r191548) @@ -178,7 +178,7 @@ route_init(void) static int vnet_route_iattach(const void *unused __unused) { - INIT_VNET_INET(curvnet); + INIT_VNET_NET(curvnet); int table; struct domain *dom; int fam; Modified: head/sys/net/rtsock.c ============================================================================== --- head/sys/net/rtsock.c Sun Apr 26 21:50:21 2009 (r191547) +++ head/sys/net/rtsock.c Sun Apr 26 22:06:42 2009 (r191548) @@ -1206,7 +1206,6 @@ rt_ifannouncemsg(struct ifnet *ifp, int static void rt_dispatch(struct mbuf *m, const struct sockaddr *sa) { - INIT_VNET_NET(curvnet); struct m_tag *tag; /* Modified: head/sys/netinet/igmp.c ============================================================================== --- head/sys/netinet/igmp.c Sun Apr 26 21:50:21 2009 (r191547) +++ head/sys/netinet/igmp.c Sun Apr 26 22:06:42 2009 (r191548) @@ -141,13 +141,8 @@ static int sysctl_igmp_default_version(S static int sysctl_igmp_gsr(SYSCTL_HANDLER_ARGS); static int sysctl_igmp_ifinfo(SYSCTL_HANDLER_ARGS); -#ifdef VIMAGE static vnet_attach_fn vnet_igmp_iattach; static vnet_detach_fn vnet_igmp_idetach; -#else -static int vnet_igmp_iattach(const void *); -static int vnet_igmp_idetach(const void *); -#endif /* VIMAGE */ /* * System-wide globals. @@ -333,6 +328,7 @@ igmp_restore_context(struct mbuf *m) static int sysctl_igmp_default_version(SYSCTL_HANDLER_ARGS) { + INIT_VNET_INET(curvnet); int error; int new; @@ -372,6 +368,7 @@ out_locked: static int sysctl_igmp_gsr(SYSCTL_HANDLER_ARGS) { + INIT_VNET_INET(curvnet); int error; int i; @@ -413,6 +410,7 @@ static int sysctl_igmp_ifinfo(SYSCTL_HANDLER_ARGS) { INIT_VNET_NET(curvnet); + INIT_VNET_INET(curvnet); int *name; int error; u_int namelen; @@ -498,6 +496,7 @@ igmp_dispatch_queue(struct ifqueue *ifq, static __inline int igmp_isgroupreported(const struct in_addr addr) { + INIT_VNET_INET(curvnet); if (in_allhosts(addr) || ((!V_igmp_sendlocal && IN_LOCAL_GROUP(ntohl(addr.s_addr))))) @@ -560,6 +559,7 @@ igmp_domifattach(struct ifnet *ifp) static struct igmp_ifinfo * igi_alloc_locked(/*const*/ struct ifnet *ifp) { + INIT_VNET_INET(ifp->if_vnet); struct igmp_ifinfo *igi; IGMP_LOCK_ASSERT(); @@ -679,6 +679,7 @@ igmp_domifdetach(struct ifnet *ifp) static void igi_delete_locked(const struct ifnet *ifp) { + INIT_VNET_INET(ifp->if_vnet); struct igmp_ifinfo *igi, *tigi; CTR3(KTR_IGMPV3, "%s: freeing igmp_ifinfo for ifp %p(%s)", @@ -803,6 +804,7 @@ static int igmp_input_v2_query(struct ifnet *ifp, const struct ip *ip, const struct igmp *igmp) { + INIT_VNET_INET(ifp->if_vnet); struct ifmultiaddr *ifma; struct igmp_ifinfo *igi; struct in_multi *inm; @@ -895,6 +897,7 @@ out_locked: static void igmp_v2_update_group(struct in_multi *inm, const int timer) { + INIT_VNET_INET(curvnet); CTR4(KTR_IGMPV3, "%s: %s/%s timer=%d", __func__, inet_ntoa(inm->inm_addr), inm->inm_ifp->if_xname, timer); @@ -942,6 +945,7 @@ static int igmp_input_v3_query(struct ifnet *ifp, const struct ip *ip, /*const*/ struct igmpv3 *igmpv3) { + INIT_VNET_INET(ifp->if_vnet); struct igmp_ifinfo *igi; struct in_multi *inm; uint32_t maxresp, nsrc, qqi; @@ -1086,6 +1090,7 @@ static int igmp_input_v3_group_query(struct in_multi *inm, struct igmp_ifinfo *igi, int timer, /*const*/ struct igmpv3 *igmpv3) { + INIT_VNET_INET(curvnet); int retval; uint16_t nsrc; @@ -1188,6 +1193,7 @@ static int igmp_input_v1_report(struct ifnet *ifp, /*const*/ struct ip *ip, /*const*/ struct igmp *igmp) { + INIT_VNET_INET(ifp->if_vnet); struct in_ifaddr *ia; struct in_multi *inm; @@ -1294,6 +1300,7 @@ static int igmp_input_v2_report(struct ifnet *ifp, /*const*/ struct ip *ip, /*const*/ struct igmp *igmp) { + INIT_VNET_INET(ifp->if_vnet); struct in_ifaddr *ia; struct in_multi *inm; @@ -1579,21 +1586,15 @@ igmp_input(struct mbuf *m, int off) void igmp_fasttimo(void) { -#ifdef VIMAGE VNET_ITERATOR_DECL(vnet_iter); VNET_LIST_RLOCK(); VNET_FOREACH(vnet_iter) { CURVNET_SET(vnet_iter); - INIT_VNET_INET(vnet_iter); igmp_fasttimo_vnet(); CURVNET_RESTORE(); } VNET_LIST_RUNLOCK(); -#else /* !VIMAGE */ - - igmp_fasttimo_vnet(); -#endif /* VIMAGE */ } /* @@ -1605,6 +1606,7 @@ igmp_fasttimo(void) static void igmp_fasttimo_vnet(void) { + INIT_VNET_INET(curvnet); struct ifqueue scq; /* State-change packets */ struct ifqueue qrq; /* Query response packets */ struct ifnet *ifp; @@ -1727,6 +1729,7 @@ out_locked: static void igmp_v1v2_process_group_timer(struct in_multi *inm, const int version) { + INIT_VNET_INET(curvnet); int report_timer_expired; IN_MULTI_LOCK_ASSERT(); @@ -1775,6 +1778,7 @@ igmp_v3_process_group_timers(struct igmp struct ifqueue *qrq, struct ifqueue *scq, struct in_multi *inm, const int uri_fasthz) { + INIT_VNET_INET(curvnet); int query_response_timer_expired; int state_change_retransmit_timer_expired; @@ -1964,6 +1968,7 @@ igmp_set_version(struct igmp_ifinfo *igi static void igmp_v3_cancel_link_timers(struct igmp_ifinfo *igi) { + INIT_VNET_INET(curvnet); struct ifmultiaddr *ifma; struct ifnet *ifp; struct in_multi *inm; @@ -2039,6 +2044,7 @@ igmp_v3_cancel_link_timers(struct igmp_i static void igmp_v1v2_process_querier_timers(struct igmp_ifinfo *igi) { + INIT_VNET_INET(curvnet); IGMP_LOCK_ASSERT(); @@ -2115,20 +2121,15 @@ igmp_v1v2_process_querier_timers(struct void igmp_slowtimo(void) { -#ifdef VIMAGE VNET_ITERATOR_DECL(vnet_iter); VNET_LIST_RLOCK(); VNET_FOREACH(vnet_iter) { CURVNET_SET(vnet_iter); - INIT_VNET_INET(vnet_iter); igmp_slowtimo_vnet(); CURVNET_RESTORE(); } VNET_LIST_RUNLOCK(); -#else /* !VIMAGE */ - igmp_slowtimo_vnet(); -#endif /* VIMAGE */ } /* @@ -2137,6 +2138,7 @@ igmp_slowtimo(void) static void igmp_slowtimo_vnet(void) { + INIT_VNET_INET(curvnet); struct igmp_ifinfo *igi; IGMP_LOCK(); @@ -2164,9 +2166,6 @@ igmp_v1v2_queue_report(struct in_multi * IGMP_LOCK_ASSERT(); ifp = inm->inm_ifp; - /* XXX are these needed ? */ - INIT_VNET_NET(ifp->if_vnet); - INIT_VNET_INET(ifp->if_vnet); MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) @@ -2304,6 +2303,7 @@ out_locked: static int igmp_initial_join(struct in_multi *inm, struct igmp_ifinfo *igi) { + INIT_VNET_INET(curvnet); struct ifnet *ifp; struct ifqueue *ifq; int error, retval, syncstates; @@ -2432,6 +2432,7 @@ igmp_initial_join(struct in_multi *inm, static int igmp_handle_state_change(struct in_multi *inm, struct igmp_ifinfo *igi) { + INIT_VNET_INET(curvnet); struct ifnet *ifp; int retval; @@ -2491,6 +2492,7 @@ igmp_handle_state_change(struct in_multi static void igmp_final_leave(struct in_multi *inm, struct igmp_ifinfo *igi) { + INIT_VNET_INET(curvnet); int syncstates; syncstates = 1; @@ -3276,6 +3278,7 @@ igmp_v3_merge_state_changes(struct in_mu static void igmp_v3_dispatch_general_query(struct igmp_ifinfo *igi) { + INIT_VNET_INET(curvnet); struct ifmultiaddr *ifma, *tifma; struct ifnet *ifp; struct in_multi *inm; @@ -3357,12 +3360,14 @@ igmp_intr(struct mbuf *m) CTR2(KTR_IGMPV3, "%s: transmit %p", __func__, m); /* - * Restore VNET image pointer from enqueued mbuf chain + * Set VNET image pointer from enqueued mbuf chain * before doing anything else. Whilst we use interface * indexes to guard against interface detach, they are * unique to each VIMAGE and must be retrieved. */ CURVNET_SET(m->m_pkthdr.header); + INIT_VNET_NET(curvnet); + INIT_VNET_INET(curvnet); ifindex = igmp_restore_context(m); /* @@ -3444,7 +3449,6 @@ out: static struct mbuf * igmp_v3_encap_report(struct ifnet *ifp, struct mbuf *m) { - INIT_VNET_NET(curvnet); INIT_VNET_INET(curvnet); struct igmp_report *igmp; struct ip *ip; @@ -3616,15 +3620,15 @@ vnet_igmp_idetach(const void *unused __u return (0); } -#ifdef VIMAGE -static struct vnet_symmap vnet_igmp_symmap[] = { - VNET_SYMMAP(igmp, igi_head), - VNET_SYMMAP(igmp, igmpstat), - VNET_SYMMAP_END +#ifndef VIMAGE_GLOBALS +static vnet_modinfo_t vnet_igmp_modinfo = { + .vmi_id = VNET_MOD_IGMP, + .vmi_name = "igmp", + .vmi_dependson = VNET_MOD_INET, + .vmi_iattach = vnet_igmp_iattach, + .vmi_idetach = vnet_igmp_idetach }; -VNET_MOD_DECLARE(IGMP, igmp, vnet_igmp_iattach, vnet_igmp_idetach, - vnet_igmp_symmap); -#endif /* VIMAGE */ +#endif static int igmp_modevent(module_t mod, int type, void *unused __unused) @@ -3633,22 +3637,20 @@ igmp_modevent(module_t mod, int type, vo switch (type) { case MOD_LOAD: igmp_sysinit(); -#ifdef VIMAGE +#ifndef VIMAGE_GLOBALS vnet_mod_register(&vnet_igmp_modinfo); #else - (void)vnet_igmp_iattach(NULL); -#endif /* VIMAGE */ + vnet_igmp_iattach(NULL); +#endif break; case MOD_UNLOAD: -#ifdef VIMAGE - /* - * TODO: Allow module unload if any VIMAGE instances - * are using this module. - */ - return (EBUSY); +#ifndef VIMAGE_GLOBALS +#ifdef NOTYET + vnet_mod_deregister(&vnet_igmp_modinfo); +#endif #else - (void)vnet_igmp_idetach(NULL); -#endif /* VIMAGE */ + vnet_igmp_idetach(NULL); +#endif igmp_sysuninit(); break; default: Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Sun Apr 26 21:50:21 2009 (r191547) +++ head/sys/netinet/in.c Sun Apr 26 22:06:42 2009 (r191548) @@ -1100,7 +1100,6 @@ in_ifdetach(struct ifnet *ifp) static void in_purgemaddrs(struct ifnet *ifp) { - INIT_VNET_INET(ifp->if_vnet); LIST_HEAD(,in_multi) purgeinms; struct in_multi *inm, *tinm; struct ifmultiaddr *ifma; Modified: head/sys/netinet/in_mcast.c ============================================================================== --- head/sys/netinet/in_mcast.c Sun Apr 26 21:50:21 2009 (r191547) +++ head/sys/netinet/in_mcast.c Sun Apr 26 22:06:42 2009 (r191548) @@ -392,7 +392,6 @@ static int in_getmulti(struct ifnet *ifp, const struct in_addr *group, struct in_multi **pinm) { - INIT_VNET_INET(ifp->if_vnet); struct sockaddr_in gsin; struct ifmultiaddr *ifma; struct in_ifinfo *ii; @@ -1808,6 +1807,7 @@ static struct ifnet * inp_lookup_mcast_ifp(const struct inpcb *inp, const struct sockaddr_in *gsin, const struct in_addr ina) { + INIT_VNET_INET(curvnet); struct ifnet *ifp; KASSERT(gsin->sin_family == AF_INET, ("%s: not AF_INET", __func__)); @@ -1853,7 +1853,6 @@ static int inp_join_group(struct inpcb *inp, struct sockopt *sopt) { INIT_VNET_NET(curvnet); - INIT_VNET_INET(curvnet); struct group_source_req gsr; sockunion_t *gsa, *ssa; struct ifnet *ifp; @@ -2306,6 +2305,7 @@ static int inp_set_multicast_if(struct inpcb *inp, struct sockopt *sopt) { INIT_VNET_NET(curvnet); + INIT_VNET_INET(curvnet); struct in_addr addr; struct ip_mreqn mreqn; struct ifnet *ifp; Modified: head/sys/netinet/in_rmx.c ============================================================================== --- head/sys/netinet/in_rmx.c Sun Apr 26 21:50:21 2009 (r191547) +++ head/sys/netinet/in_rmx.c Sun Apr 26 22:06:42 2009 (r191548) @@ -250,6 +250,8 @@ static void in_rtqtimo_one(void *rock); static void in_rtqtimo(void *rock) { + INIT_VNET_NET(curvnet); + INIT_VNET_INET(curvnet); int fibnum; void *newrock; struct timeval atv; Modified: head/sys/netinet/ip_divert.c ============================================================================== --- head/sys/netinet/ip_divert.c Sun Apr 26 21:50:21 2009 (r191547) +++ head/sys/netinet/ip_divert.c Sun Apr 26 22:06:42 2009 (r191548) @@ -132,6 +132,7 @@ static u_long div_recvspace = DIVRCVQ; / static void div_zone_change(void *tag) { + INIT_VNET_INET(curvnet); uma_zone_set_max(V_divcbinfo.ipi_zone, maxsockets); } @@ -723,6 +724,7 @@ struct protosw div_protosw = { static int div_modevent(module_t mod, int type, void *unused) { + INIT_VNET_INET(curvnet); /* XXX move to iattach - revisit!!! */ int err = 0; int n; Modified: head/sys/netinet/ip_fw2.c ============================================================================== --- head/sys/netinet/ip_fw2.c Sun Apr 26 21:50:21 2009 (r191547) +++ head/sys/netinet/ip_fw2.c Sun Apr 26 22:06:42 2009 (r191548) @@ -1818,7 +1818,6 @@ static int add_table_entry(struct ip_fw_chain *ch, uint16_t tbl, in_addr_t addr, uint8_t mlen, uint32_t value) { - INIT_VNET_IPFW(curvnet); struct radix_node_head *rnh; struct table_entry *ent; struct radix_node *rn; @@ -4535,6 +4534,7 @@ struct ip_fw *ip_fw_default_rule; static void ipfw_tick(void * __unused unused) { + INIT_VNET_IPFW(curvnet); struct mbuf *m0, *m, *mnext, **mtailp; int i; ipfw_dyn_rule *q; @@ -4718,6 +4718,7 @@ ipfw_init(void) void ipfw_destroy(void) { + INIT_VNET_IPFW(curvnet); struct ip_fw *reap; ip_fw_chk_ptr = NULL; Modified: head/sys/netinet/ip_mroute.c ============================================================================== --- head/sys/netinet/ip_mroute.c Sun Apr 26 21:50:21 2009 (r191547) +++ head/sys/netinet/ip_mroute.c Sun Apr 26 22:06:42 2009 (r191548) @@ -1709,6 +1709,7 @@ X_ip_rsvp_force_done(struct socket *so _ static void X_rsvp_input(struct mbuf *m, int off __unused) { + INIT_VNET_INET(curvnet); if (!V_rsvp_on) m_freem(m); Modified: head/sys/netinet/tcp_subr.c ============================================================================== --- head/sys/netinet/tcp_subr.c Sun Apr 26 21:50:21 2009 (r191547) +++ head/sys/netinet/tcp_subr.c Sun Apr 26 22:06:42 2009 (r191548) @@ -288,6 +288,7 @@ static struct mtx isn_mtx; static void tcp_zone_change(void *tag) { + INIT_VNET_INET(curvnet); uma_zone_set_max(V_tcbinfo.ipi_zone, maxsockets); uma_zone_set_max(V_tcpcb_zone, maxsockets); Modified: head/sys/netinet/tcp_timewait.c ============================================================================== --- head/sys/netinet/tcp_timewait.c Sun Apr 26 21:50:21 2009 (r191547) +++ head/sys/netinet/tcp_timewait.c Sun Apr 26 22:06:42 2009 (r191548) @@ -132,6 +132,7 @@ tcptw_auto_size(void) static int sysctl_maxtcptw(SYSCTL_HANDLER_ARGS) { + INIT_VNET_INET(curvnet); int error, new; if (maxtcptw == 0) @@ -158,6 +159,7 @@ SYSCTL_V_INT(V_NET, vnet_inet, _net_inet void tcp_tw_zone_change(void) { + INIT_VNET_INET(curvnet); if (maxtcptw == 0) uma_zone_set_max(V_tcptw_zone, tcptw_auto_size()); Modified: head/sys/netinet/udp_usrreq.c ============================================================================== --- head/sys/netinet/udp_usrreq.c Sun Apr 26 21:50:21 2009 (r191547) +++ head/sys/netinet/udp_usrreq.c Sun Apr 26 22:06:42 2009 (r191548) @@ -155,6 +155,7 @@ static int udp_output(struct inpcb *, st static void udp_zone_change(void *tag) { + INIT_VNET_INET(curvnet); uma_zone_set_max(V_udbinfo.ipi_zone, maxsockets); } Modified: head/sys/netinet6/in6_rmx.c ============================================================================== --- head/sys/netinet6/in6_rmx.c Sun Apr 26 21:50:21 2009 (r191547) +++ head/sys/netinet6/in6_rmx.c Sun Apr 26 22:06:42 2009 (r191548) @@ -289,8 +289,7 @@ static void in6_rtqtimo(void *rock) { CURVNET_SET_QUIET((struct vnet *) rock); - INIT_VNET_NET((struct vnet *) rock); - INIT_VNET_INET6((struct vnet *) rock); + INIT_VNET_INET6(curvnet); struct radix_node_head *rnh = rock; struct rtqk_arg arg; struct timeval atv; @@ -377,8 +376,7 @@ static void in6_mtutimo(void *rock) { CURVNET_SET_QUIET((struct vnet *) rock); - INIT_VNET_NET((struct vnet *) rock); - INIT_VNET_INET6((struct vnet *) rock); + INIT_VNET_INET6(curvnet); struct radix_node_head *rnh = rock; struct mtuex_arg arg; struct timeval atv; Modified: head/sys/netinet6/nd6_rtr.c ============================================================================== --- head/sys/netinet6/nd6_rtr.c Sun Apr 26 21:50:21 2009 (r191547) +++ head/sys/netinet6/nd6_rtr.c Sun Apr 26 22:06:42 2009 (r191548) @@ -1549,6 +1549,7 @@ pfxlist_onlink_check() int nd6_prefix_onlink(struct nd_prefix *pr) { + INIT_VNET_NET(curvnet); INIT_VNET_INET6(curvnet); struct ifaddr *ifa; struct ifnet *ifp = pr->ndpr_ifp;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200904262206.n3QM6g4g096299>