PERFORCE change 127733 for review

Marko Zec zec at FreeBSD.org
Thu Oct 18 16:49:56 PDT 2007


http://perforce.freebsd.org/chv.cgi?CH=127733

Change 127733 by zec at zec_tpx32 on 2007/10/18 23:49:36

	We most probably don't need a separate UMA zone for
	raw ip pcbs per each vnet, though I see no
	straightforward answer to the question of shared vs
	private zones for each vnet.
	
	Introduce a hook for cleaning up raw ip state.
	
	Unbreak several references to a renamed field in
	struct inpcbinfo from previous change.

Affected files ...

.. //depot/projects/vimage/src/sys/netinet/in_proto.c#11 edit
.. //depot/projects/vimage/src/sys/netinet/ip_var.h#8 edit
.. //depot/projects/vimage/src/sys/netinet/raw_ip.c#14 edit
.. //depot/projects/vimage/src/sys/netinet/tcp_hostcache.c#18 edit
.. //depot/projects/vimage/src/sys/netinet/tcp_subr.c#36 edit
.. //depot/projects/vimage/src/sys/netinet/udp_usrreq.c#21 edit

Differences ...

==== //depot/projects/vimage/src/sys/netinet/in_proto.c#11 (text+ko) ====

@@ -348,6 +348,9 @@
 	.pr_input =		rip_input,
 	.pr_ctloutput =		rip_ctloutput,
 	.pr_init =		rip_init,
+#ifdef VIMAGE
+	.pr_destroy =		rip_destroy,
+#endif
 	.pr_usrreqs =		&rip_usrreqs
 },
 };

==== //depot/projects/vimage/src/sys/netinet/ip_var.h#8 (text+ko) ====

@@ -220,6 +220,9 @@
 int	rip_ctloutput(struct socket *, struct sockopt *);
 void	rip_ctlinput(int, struct sockaddr *, void *);
 void	rip_init(void);
+#ifdef VIMAGE
+void	rip_destroy(void);
+#endif
 void	rip_input(struct mbuf *, int);
 int	rip_output(struct mbuf *, struct socket *, u_long);
 void	ipip_input(struct mbuf *, int);

==== //depot/projects/vimage/src/sys/netinet/raw_ip.c#14 (text+ko) ====

@@ -81,6 +81,8 @@
 #ifndef VIMAGE
 struct	inpcbhead ripcb;
 struct	inpcbinfo ripcbinfo;
+#else
+static struct uma_zone *ripcb_zone;
 #endif
 
 /* control hooks for ipfw and dummynet */
@@ -140,6 +142,17 @@
 {
 	INIT_VNET_INET(curvnet);
 
+#ifdef VIMAGE
+	if (IS_DEFAULT_VNET(curvnet)) {
+#endif
+	ripcb_zone = uma_zcreate("ripcb", sizeof(struct inpcb),
+	    NULL, NULL, rip_inpcb_init, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
+	uma_zone_set_max(V_ripcbinfo.ipi_zone, maxsockets);
+#ifdef VIMAGE
+	}
+	V_ripcbinfo.ipi_vnet = curvnet;
+#endif
+
 	INP_INFO_LOCK_INIT(&V_ripcbinfo, "rip");
 	LIST_INIT(&V_ripcb);
 	V_ripcbinfo.ipi_listhead = &V_ripcb;
@@ -152,15 +165,24 @@
 	    hashinit(1, M_PCB, &V_ripcbinfo.ipi_hashmask);
 	V_ripcbinfo.ipi_porthashbase =
 	    hashinit(1, M_PCB, &V_ripcbinfo.ipi_porthashmask);
-	/* XXX Marko we don't need a full zone for each stack - revisit! */
-	V_ripcbinfo.ipi_zone = uma_zcreate("ripcb", sizeof(struct inpcb),
-	    NULL, NULL, rip_inpcb_init, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
-	V_ripcbinfo.vnet = curvnet;
-	uma_zone_set_max(V_ripcbinfo.ipi_zone, maxsockets);
+	V_ripcbinfo.ipi_zone = ripcb_zone;
 	EVENTHANDLER_REGISTER(maxsockets_change, rip_zone_change,
 		NULL, EVENTHANDLER_PRI_ANY);
 }
 
+#ifdef VIMAGE
+void
+rip_destroy(void)
+{
+	INIT_VNET_INET(curvnet);
+
+	hashdestroy(V_ripcbinfo.ipi_hashbase, M_PCB,
+	    V_ripcbinfo.ipi_hashmask);
+	hashdestroy(V_ripcbinfo.ipi_porthashbase, M_PCB,
+	    V_ripcbinfo.ipi_porthashmask);
+}
+#endif
+
 static struct	sockaddr_in ripsrc = { sizeof(ripsrc), AF_INET };
 
 static int

==== //depot/projects/vimage/src/sys/netinet/tcp_hostcache.c#18 (text+ko) ====


==== //depot/projects/vimage/src/sys/netinet/tcp_subr.c#36 (text+ko) ====

@@ -358,7 +358,7 @@
 	V_tcbinfo.ipi_porthashbase = hashinit(hashsize, M_PCB,
 	    &V_tcbinfo.ipi_porthashmask);
 	V_tcbinfo.ipi_zone = tcp_ipi_zone;
-	V_tcbinfo.vnet = curvnet;
+	V_tcbinfo.ipi_vnet = curvnet;
 #ifdef INET6
 #define TCP_MINPROTOHDR (sizeof(struct ip6_hdr) + sizeof(struct tcphdr))
 #else /* INET6 */

==== //depot/projects/vimage/src/sys/netinet/udp_usrreq.c#21 (text+ko) ====

@@ -185,6 +185,7 @@
 	    EVENTHANDLER_PRI_ANY);
 #ifdef VIMAGE
 	}
+	V_udbinfo.ipi_vnet = curvnet;
 #endif
 
 	INP_INFO_LOCK_INIT(&V_udbinfo, "udp");
@@ -195,7 +196,6 @@
 	V_udbinfo.ipi_porthashbase = hashinit(UDBHASHSIZE, M_PCB,
 	    &V_udbinfo.ipi_porthashmask);
 	V_udbinfo.ipi_zone = udp_ipi_zone;
-	V_udbinfo.vnet = curvnet;
 }
 
 #ifdef VIMAGE


More information about the p4-projects mailing list