Date: Mon, 22 Jun 2009 17:48:16 +0000 (UTC) From: "Bjoern A. Zeeb" <bz@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r194640 - in head: . sys/net sys/sys Message-ID: <200906221748.n5MHmGMB047984@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: bz Date: Mon Jun 22 17:48:16 2009 New Revision: 194640 URL: http://svn.freebsd.org/changeset/base/194640 Log: Move virtualization of routing related variables into their own Vimage module, which had been there already but now is stateful. All variables are now file local; so this further limits the global spreading of routing related things throughout the kernel. Add a missing function local variable in case of MPATHing. Reviewed by: zec Modified: head/UPDATING head/sys/net/if.c head/sys/net/route.c head/sys/net/vnet.h head/sys/sys/param.h head/sys/sys/vimage.h Modified: head/UPDATING ============================================================================== --- head/UPDATING Mon Jun 22 17:46:55 2009 (r194639) +++ head/UPDATING Mon Jun 22 17:48:16 2009 (r194640) @@ -22,6 +22,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. to maximize performance. (To disable malloc debugging, run ln -s aj /etc/malloc.conf.) +20090622: + Layout of struct vnet has changed as routing related variables + were moved to their own Vimage module. Modules need to be + recompiled. Bump __FreeBSD_version to 800099. + 20090619: NGROUPS_MAX and NGROUPS have been increased from 16 to 1023 and 1024 respectively. As long as no more than 16 groups per Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Mon Jun 22 17:46:55 2009 (r194639) +++ head/sys/net/if.c Mon Jun 22 17:48:16 2009 (r194640) @@ -182,9 +182,6 @@ static struct filterops netdev_filtops = #ifndef VIMAGE_GLOBALS static struct vnet_symmap vnet_net_symmap[] = { VNET_SYMMAP(net, ifnet), - VNET_SYMMAP(net, rt_tables), - VNET_SYMMAP(net, rtstat), - VNET_SYMMAP(net, rttrash), VNET_SYMMAP_END }; Modified: head/sys/net/route.c ============================================================================== --- head/sys/net/route.c Mon Jun 22 17:46:55 2009 (r194639) +++ head/sys/net/route.c Mon Jun 22 17:48:16 2009 (r194640) @@ -60,7 +60,6 @@ #ifdef RADIX_MPATH #include <net/radix_mpath.h> #endif -#include <net/vnet.h> #include <netinet/in.h> #include <netinet/ip_mroute.h> @@ -96,6 +95,35 @@ int rttrash; /* routes not in table bu struct rtstat rtstat; #endif +#ifndef VIMAGE_GLOBALS +struct vnet_rtable { + struct radix_node_head *_rt_tables; + uma_zone_t _rtzone; + int _rttrash; + struct rtstat _rtstat; +}; + +/* Size guard. See sys/vimage.h. */ +VIMAGE_CTASSERT(SIZEOF_vnet_rtable, sizeof(struct vnet_rtable)); + +#ifndef VIMAGE +static struct vnet_rtable vnet_rtable_0; +#endif +#endif + +/* + * Symbol translation macros + */ +#define INIT_VNET_RTABLE(vnet) \ + INIT_FROM_VNET(vnet, VNET_MOD_RTABLE, struct vnet_rtable, vnet_rtable) + +#define VNET_RTABLE(sym) VSYM(vnet_rtable, sym) + +#define V_rt_tables VNET_RTABLE(rt_tables) +#define V_rtstat VNET_RTABLE(rtstat) +#define V_rttrash VNET_RTABLE(rttrash) +#define V_rtzone VNET_RTABLE(rtzone) + static void rt_maskedcopy(struct sockaddr *, struct sockaddr *, struct sockaddr *); static int vnet_route_iattach(const void *); @@ -104,9 +132,18 @@ static int vnet_route_idetach(const void #endif #ifndef VIMAGE_GLOBALS +static struct vnet_symmap vnet_rtable_symmap[] = { + VNET_SYMMAP(rtable, rt_tables), + VNET_SYMMAP(rtable, rtstat), + VNET_SYMMAP(rtable, rttrash), + VNET_SYMMAP_END +}; + static const vnet_modinfo_t vnet_rtable_modinfo = { .vmi_id = VNET_MOD_RTABLE, .vmi_name = "rtable", + .vmi_size = sizeof(struct vnet_rtable), + .vmi_symmap = vnet_rtable_symmap, .vmi_iattach = vnet_route_iattach, #ifdef VIMAGE .vmi_idetach = vnet_route_idetach @@ -155,7 +192,7 @@ SYSCTL_PROC(_net, OID_AUTO, my_fibnum, C static __inline struct radix_node_head ** rt_tables_get_rnh_ptr(int table, int fam) { - INIT_VNET_NET(curvnet); + INIT_VNET_RTABLE(curvnet); struct radix_node_head **rnh; KASSERT(table >= 0 && table < rt_numfibs, ("%s: table out of bounds.", @@ -199,7 +236,7 @@ route_init(void) static int vnet_route_iattach(const void *unused __unused) { - INIT_VNET_NET(curvnet); + INIT_VNET_RTABLE(curvnet); struct domain *dom; struct radix_node_head **rnh; int table; @@ -345,7 +382,7 @@ struct rtentry * rtalloc1_fib(struct sockaddr *dst, int report, u_long ignflags, u_int fibnum) { - INIT_VNET_NET(curvnet); + INIT_VNET_RTABLE(curvnet); struct radix_node_head *rnh; struct rtentry *rt; struct radix_node *rn; @@ -415,7 +452,7 @@ done: void rtfree(struct rtentry *rt) { - INIT_VNET_NET(curvnet); + INIT_VNET_RTABLE(curvnet); struct radix_node_head *rnh; KASSERT(rt != NULL,("%s: NULL rt", __func__)); @@ -514,7 +551,7 @@ rtredirect_fib(struct sockaddr *dst, struct sockaddr *src, u_int fibnum) { - INIT_VNET_NET(curvnet); + INIT_VNET_RTABLE(curvnet); struct rtentry *rt, *rt0 = NULL; int error = 0; short *stat = NULL; @@ -827,7 +864,7 @@ rt_getifa_fib(struct rt_addrinfo *info, int rtexpunge(struct rtentry *rt) { - INIT_VNET_NET(curvnet); + INIT_VNET_RTABLE(curvnet); struct radix_node *rn; struct radix_node_head *rnh; struct ifaddr *ifa; @@ -955,6 +992,8 @@ rn_mpath_update(int req, struct rt_addri RT_LOCK(rt); RT_ADDREF(rt); if (req == RTM_DELETE) { + INIT_VNET_RTABLE(curvnet); + rt->rt_flags &= ~RTF_UP; /* * One more rtentry floating around that is not @@ -989,7 +1028,7 @@ int rtrequest1_fib(int req, struct rt_addrinfo *info, struct rtentry **ret_nrt, u_int fibnum) { - INIT_VNET_NET(curvnet); + INIT_VNET_RTABLE(curvnet); int error = 0, needlock = 0; register struct rtentry *rt; register struct radix_node *rn; Modified: head/sys/net/vnet.h ============================================================================== --- head/sys/net/vnet.h Mon Jun 22 17:46:55 2009 (r194639) +++ head/sys/net/vnet.h Mon Jun 22 17:48:16 2009 (r194640) @@ -44,11 +44,6 @@ struct vnet_net { int _if_indexlim; struct knlist _ifklist; - struct rtstat _rtstat; - struct radix_node_head *_rt_tables; - int _rttrash; - uma_zone_t _rtzone; - struct ifnet * _loif; struct if_clone * _lo_cloner; struct ifc_simple_data *_lo_cloner_data; Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Mon Jun 22 17:46:55 2009 (r194639) +++ head/sys/sys/param.h Mon Jun 22 17:48:16 2009 (r194640) @@ -57,7 +57,7 @@ * is created, otherwise 1. */ #undef __FreeBSD_version -#define __FreeBSD_version 800098 /* Master, propagated to newvers */ +#define __FreeBSD_version 800099 /* Master, propagated to newvers */ #ifndef LOCORE #include <sys/types.h> Modified: head/sys/sys/vimage.h ============================================================================== --- head/sys/sys/vimage.h Mon Jun 22 17:46:55 2009 (r194639) +++ head/sys/sys/vimage.h Mon Jun 22 17:48:16 2009 (r194640) @@ -122,6 +122,7 @@ struct vnet_modlink { #define VNET_MOD_ACCF_HTTP 11 #define VNET_MOD_IGMP 12 #define VNET_MOD_MLD 13 +#define VNET_MOD_RTABLE 14 /* Stateless modules. */ #define VNET_MOD_IF_CLONE 19 @@ -134,7 +135,7 @@ struct vnet_modlink { #define VNET_MOD_IPCOMP 26 #define VNET_MOD_GIF 27 #define VNET_MOD_ARP 28 -#define VNET_MOD_RTABLE 29 + /* 29 */ #define VNET_MOD_LOIF 30 #define VNET_MOD_DOMAIN 31 #define VNET_MOD_DYNAMIC_START 32 @@ -154,6 +155,7 @@ struct vnet_modlink { #define V_MOD_vnet_pf VNET_MOD_PF #define V_MOD_vnet_gif VNET_MOD_GIF #define V_MOD_vnet_ipsec VNET_MOD_IPSEC +#define V_MOD_vnet_rtable VNET_MOD_RTABLE #define V_MOD_vprocg 0 /* no minor module ids like in vnet */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906221748.n5MHmGMB047984>