summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbz <bz@FreeBSD.org>2009-06-22 17:48:16 +0000
committerbz <bz@FreeBSD.org>2009-06-22 17:48:16 +0000
commit309ab541f2459967517418064abfdf4a506e8a6f (patch)
treec21bbe3b3caec3df904094416659b8661ea86397
parentd05c6432a78b010e5a1cafd8330110c63350a8b4 (diff)
downloadFreeBSD-src-309ab541f2459967517418064abfdf4a506e8a6f.zip
FreeBSD-src-309ab541f2459967517418064abfdf4a506e8a6f.tar.gz
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
-rw-r--r--UPDATING5
-rw-r--r--sys/net/if.c3
-rw-r--r--sys/net/route.c55
-rw-r--r--sys/net/vnet.h5
-rw-r--r--sys/sys/param.h2
-rw-r--r--sys/sys/vimage.h4
6 files changed, 56 insertions, 18 deletions
diff --git a/UPDATING b/UPDATING
index adc63ea..58aeb55 100644
--- a/UPDATING
+++ b/UPDATING
@@ -22,6 +22,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8.x IS SLOW:
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
diff --git a/sys/net/if.c b/sys/net/if.c
index eb5e519..3990e3f 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -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
};
diff --git a/sys/net/route.c b/sys/net/route.c
index 2a15a41..6efc176 100644
--- a/sys/net/route.c
+++ b/sys/net/route.c
@@ -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 but not freed */
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, CTLTYPE_INT|CTLFLAG_RD,
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, u_int fibnum)
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_addrinfo *info,
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;
diff --git a/sys/net/vnet.h b/sys/net/vnet.h
index 696e472..74e5b59 100644
--- a/sys/net/vnet.h
+++ b/sys/net/vnet.h
@@ -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;
diff --git a/sys/sys/param.h b/sys/sys/param.h
index 06745f8..31c8112 100644
--- a/sys/sys/param.h
+++ b/sys/sys/param.h
@@ -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>
diff --git a/sys/sys/vimage.h b/sys/sys/vimage.h
index 943d1a7..21df8a7 100644
--- a/sys/sys/vimage.h
+++ b/sys/sys/vimage.h
@@ -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 */
OpenPOWER on IntegriCloud