PERFORCE change 118226 for review

Marko Zec zec at FreeBSD.org
Mon Apr 16 10:52:00 UTC 2007


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

Change 118226 by zec at zec_tca51 on 2007/04/16 10:51:52

	Integrate offline changes:
	
	- s/vnet_base/vnet/ s/vnetb/vnet/ s/VNETB/VNET/;
	
	- do not compile in any of the expensive sanity checks
	  in sys/sys/vimage.h if INVARIANTS are not configured;
	
	- minor adjustments to allow the entire tree to be compiled
	  without INVARIANTS and with VIMAGE defined;
	
	- virtualize a large percentage of the remaining "global"
	  net.inet.tcp sysctls.  This is not to preclude discussions
	  whether virtualizing those knobs makes much sense, but
	  serves as an experiment to increase the overhead of
	  resolving virtualized symbols before engaging in any
	  serious performance measurements (clean vs. virtualized);
	
	- add support for VLAN virtualization that seems to never
	  have hit the p4; vlan devices can now be reassigned from
	  one stack instance to another even if the "base" ifnet
	  resides in a different stack instance;
	
	- pf can now be kldloaded, but is not virtualized (yet)

Affected files ...

.. //depot/projects/vimage/src/sys/compat/linprocfs/linprocfs.c#5 edit
.. //depot/projects/vimage/src/sys/compat/linux/linux_ioctl.c#3 edit
.. //depot/projects/vimage/src/sys/contrib/pf/net/pf.c#3 edit
.. //depot/projects/vimage/src/sys/contrib/pf/net/pf_if.c#2 edit
.. //depot/projects/vimage/src/sys/contrib/pf/net/pf_ioctl.c#3 edit
.. //depot/projects/vimage/src/sys/kern/kern_linker.c#5 edit
.. //depot/projects/vimage/src/sys/kern/kern_synch.c#6 edit
.. //depot/projects/vimage/src/sys/kern/kern_sysctl.c#5 edit
.. //depot/projects/vimage/src/sys/kern/kern_uuid.c#4 edit
.. //depot/projects/vimage/src/sys/kern/kern_vimage.c#16 edit
.. //depot/projects/vimage/src/sys/kern/sys_socket.c#5 edit
.. //depot/projects/vimage/src/sys/kern/tty.c#5 edit
.. //depot/projects/vimage/src/sys/kern/uipc_socket.c#8 edit
.. //depot/projects/vimage/src/sys/kern/uipc_syscalls.c#6 edit
.. //depot/projects/vimage/src/sys/kern/vfs_export.c#6 edit
.. //depot/projects/vimage/src/sys/net/bpf.c#7 edit
.. //depot/projects/vimage/src/sys/net/if.c#9 edit
.. //depot/projects/vimage/src/sys/net/if_clone.c#5 edit
.. //depot/projects/vimage/src/sys/net/if_ethersubr.c#8 edit
.. //depot/projects/vimage/src/sys/net/if_gif.c#4 edit
.. //depot/projects/vimage/src/sys/net/if_gif.h#3 edit
.. //depot/projects/vimage/src/sys/net/if_gre.c#2 edit
.. //depot/projects/vimage/src/sys/net/if_loop.c#9 edit
.. //depot/projects/vimage/src/sys/net/if_mib.c#3 edit
.. //depot/projects/vimage/src/sys/net/if_ppp.c#5 edit
.. //depot/projects/vimage/src/sys/net/if_spppsubr.c#4 edit
.. //depot/projects/vimage/src/sys/net/if_stf.c#5 edit
.. //depot/projects/vimage/src/sys/net/if_vlan.c#4 edit
.. //depot/projects/vimage/src/sys/net/netisr.c#3 edit
.. //depot/projects/vimage/src/sys/net/raw_cb.c#3 edit
.. //depot/projects/vimage/src/sys/net/raw_usrreq.c#3 edit
.. //depot/projects/vimage/src/sys/net/route.c#5 edit
.. //depot/projects/vimage/src/sys/net/rtsock.c#7 edit
.. //depot/projects/vimage/src/sys/net/vnet.h#4 edit
.. //depot/projects/vimage/src/sys/netgraph/ng_base.c#6 edit
.. //depot/projects/vimage/src/sys/netgraph/ng_ether.c#6 edit
.. //depot/projects/vimage/src/sys/netgraph/vnetgraph.h#3 edit
.. //depot/projects/vimage/src/sys/netinet/if_ether.c#9 edit
.. //depot/projects/vimage/src/sys/netinet/igmp.c#8 edit
.. //depot/projects/vimage/src/sys/netinet/in.c#6 edit
.. //depot/projects/vimage/src/sys/netinet/in_gif.c#5 edit
.. //depot/projects/vimage/src/sys/netinet/in_pcb.c#7 edit
.. //depot/projects/vimage/src/sys/netinet/in_rmx.c#5 edit
.. //depot/projects/vimage/src/sys/netinet/ip_fastfwd.c#6 edit
.. //depot/projects/vimage/src/sys/netinet/ip_fw.h#4 edit
.. //depot/projects/vimage/src/sys/netinet/ip_fw2.c#11 edit
.. //depot/projects/vimage/src/sys/netinet/ip_fw_pfil.c#5 edit
.. //depot/projects/vimage/src/sys/netinet/ip_icmp.c#4 edit
.. //depot/projects/vimage/src/sys/netinet/ip_input.c#10 edit
.. //depot/projects/vimage/src/sys/netinet/ip_mroute.c#3 edit
.. //depot/projects/vimage/src/sys/netinet/ip_options.c#4 edit
.. //depot/projects/vimage/src/sys/netinet/ip_output.c#6 edit
.. //depot/projects/vimage/src/sys/netinet/raw_ip.c#7 edit
.. //depot/projects/vimage/src/sys/netinet/tcp_hostcache.c#10 edit
.. //depot/projects/vimage/src/sys/netinet/tcp_input.c#8 edit
.. //depot/projects/vimage/src/sys/netinet/tcp_output.c#6 edit
.. //depot/projects/vimage/src/sys/netinet/tcp_sack.c#5 edit
.. //depot/projects/vimage/src/sys/netinet/tcp_subr.c#12 edit
.. //depot/projects/vimage/src/sys/netinet/tcp_syncache.c#7 edit
.. //depot/projects/vimage/src/sys/netinet/tcp_timer.c#8 edit
.. //depot/projects/vimage/src/sys/netinet/tcp_usrreq.c#6 edit
.. //depot/projects/vimage/src/sys/netinet/udp_usrreq.c#8 edit
.. //depot/projects/vimage/src/sys/netinet/vinet.h#12 edit
.. //depot/projects/vimage/src/sys/netinet6/dest6.c#3 edit
.. //depot/projects/vimage/src/sys/netinet6/frag6.c#4 edit
.. //depot/projects/vimage/src/sys/netinet6/icmp6.c#7 edit
.. //depot/projects/vimage/src/sys/netinet6/in6.c#6 edit
.. //depot/projects/vimage/src/sys/netinet6/in6_gif.c#5 edit
.. //depot/projects/vimage/src/sys/netinet6/in6_ifattach.c#7 edit
.. //depot/projects/vimage/src/sys/netinet6/in6_pcb.c#6 edit
.. //depot/projects/vimage/src/sys/netinet6/in6_rmx.c#5 edit
.. //depot/projects/vimage/src/sys/netinet6/in6_src.c#6 edit
.. //depot/projects/vimage/src/sys/netinet6/ip6_forward.c#4 edit
.. //depot/projects/vimage/src/sys/netinet6/ip6_input.c#8 edit
.. //depot/projects/vimage/src/sys/netinet6/ip6_mroute.c#6 edit
.. //depot/projects/vimage/src/sys/netinet6/ip6_output.c#5 edit
.. //depot/projects/vimage/src/sys/netinet6/mld6.c#6 edit
.. //depot/projects/vimage/src/sys/netinet6/nd6.c#9 edit
.. //depot/projects/vimage/src/sys/netinet6/nd6_nbr.c#5 edit
.. //depot/projects/vimage/src/sys/netinet6/nd6_rtr.c#5 edit
.. //depot/projects/vimage/src/sys/netinet6/raw_ip6.c#7 edit
.. //depot/projects/vimage/src/sys/netinet6/route6.c#3 edit
.. //depot/projects/vimage/src/sys/netinet6/scope6.c#7 edit
.. //depot/projects/vimage/src/sys/netinet6/udp6_output.c#4 edit
.. //depot/projects/vimage/src/sys/netinet6/udp6_usrreq.c#8 edit
.. //depot/projects/vimage/src/sys/netinet6/vinet6.h#5 edit
.. //depot/projects/vimage/src/sys/nfsclient/nfs_diskless.c#4 edit
.. //depot/projects/vimage/src/sys/nfsclient/nfs_vnops.c#4 edit
.. //depot/projects/vimage/src/sys/sys/vimage.h#16 edit

Differences ...

==== //depot/projects/vimage/src/sys/compat/linprocfs/linprocfs.c#5 (text+ko) ====

@@ -969,7 +969,7 @@
 static int
 linprocfs_donetdev(PFS_FILL_ARGS)
 {
-	INIT_VNET_NET(curthread->td_vimage->v_vnetb);
+	INIT_VNET_NET(curthread->td_vimage->v_vnet);
 	char ifname[16]; /* XXX LINUX_IFNAMSIZ */
 	struct ifnet *ifp;
 

==== //depot/projects/vimage/src/sys/compat/linux/linux_ioctl.c#3 (text+ko) ====

@@ -2032,7 +2032,7 @@
 int
 linux_ifname(struct ifnet *ifp, char *buffer, size_t buflen)
 {
-	INIT_VNET_NET(ifp->if_vnetb);
+	INIT_VNET_NET(ifp->if_vnet);
 	struct ifnet *ifscan;
 	int ethno;
 
@@ -2066,7 +2066,7 @@
 static struct ifnet *
 ifname_linux_to_bsd(const char *lxname, char *bsdname)
 {
-	INIT_VNET_NET(curthread->td_vimage->v_vnetb);
+	INIT_VNET_NET(curthread->td_vimage->v_vnet);
 	struct ifnet *ifp;
 	int len, unit;
 	char *ep;
@@ -2107,7 +2107,7 @@
 static int
 linux_ifconf(struct thread *td, struct ifconf *uifc)
 {
-	INIT_VNET_NET(td->td_vimage->v_vnetb);
+	INIT_VNET_NET(td->td_vimage->v_vnet);
 #ifdef COMPAT_LINUX32
 	struct l_ifconf ifc;
 #else

==== //depot/projects/vimage/src/sys/contrib/pf/net/pf.c#3 (text+ko) ====

@@ -39,6 +39,7 @@
 #ifdef __FreeBSD__
 #include "opt_inet.h"
 #include "opt_inet6.h"
+#include "opt_vimage.h"
 #endif
 
 #ifdef __FreeBSD__
@@ -81,15 +82,18 @@
 #ifdef __FreeBSD__
 #include <sys/sysctl.h>
 #include <sys/endian.h>
+#include <sys/vimage.h>
 #else
 #include <sys/pool.h>
 #endif
 
+#include <net/vnet.h>
 #include <net/if.h>
 #include <net/if_types.h>
 #include <net/bpf.h>
 #include <net/route.h>
 
+#include <netinet/vinet.h>
 #include <netinet/in.h>
 #include <netinet/in_var.h>
 #include <netinet/in_systm.h>
@@ -122,6 +126,7 @@
 #include <netinet/icmp6.h>
 #include <netinet6/nd6.h>
 #ifdef __FreeBSD__
+#include <netinet6/vinet6.h>
 #include <netinet6/ip6_var.h>
 #include <netinet6/in6_pcb.h>
 #endif
@@ -1595,6 +1600,7 @@
     u_int8_t flags, u_int16_t win, u_int16_t mss, u_int8_t ttl, int tag,
     struct ether_header *eh, struct ifnet *ifp)
 {
+	INIT_VNET_INET(curvnet);
 	struct mbuf	*m;
 	int		 len = 0, tlen;		/* make the compiler happy */
 #ifdef INET
@@ -1729,13 +1735,13 @@
 		h->ip_hl = sizeof(*h) >> 2;
 		h->ip_tos = IPTOS_LOWDELAY;
 #ifdef __FreeBSD__
-		h->ip_off = path_mtu_discovery ? IP_DF : 0;
+		h->ip_off = V_path_mtu_discovery ? IP_DF : 0;
 		h->ip_len = len;
 #else
 		h->ip_off = htons(ip_mtudisc ? IP_DF : 0);
 		h->ip_len = htons(len);
 #endif
-		h->ip_ttl = ttl ? ttl : ip_defttl;
+		h->ip_ttl = ttl ? ttl : V_ip_defttl;
 		h->ip_sum = 0;
 		if (eh == NULL) {
 #ifdef __FreeBSD__
@@ -2697,6 +2703,7 @@
 pf_socket_lookup(uid_t *uid, gid_t *gid, int direction, struct pf_pdesc *pd)
 #endif
 {
+	INIT_VNET_INET(curvnet);
 	struct pf_addr		*saddr, *daddr;
 	u_int16_t		 sport, dport;
 #ifdef __FreeBSD__
@@ -2724,7 +2731,7 @@
 		sport = pd->hdr.tcp->th_sport;
 		dport = pd->hdr.tcp->th_dport;
 #ifdef __FreeBSD__
-		pi = &tcbinfo;
+		pi = &V_tcbinfo;
 #else
 		tb = &tcbtable;
 #endif
@@ -2733,7 +2740,7 @@
 		sport = pd->hdr.udp->uh_sport;
 		dport = pd->hdr.udp->uh_dport;
 #ifdef __FreeBSD__
-		pi = &udbinfo;
+		pi = &V_udbinfo;
 #else
 		tb = &udbtable;
 #endif
@@ -2868,10 +2875,11 @@
 u_int16_t
 pf_get_mss(struct mbuf *m, int off, u_int16_t th_off, sa_family_t af)
 {
+	INIT_VNET_INET(curvnet);
 	int		 hlen;
 	u_int8_t	 hdr[60];
 	u_int8_t	*opt, optlen;
-	u_int16_t	 mss = tcp_mssdflt;
+	u_int16_t	 mss = V_tcp_mssdflt;
 
 	hlen = th_off << 2;	/* hlen <= sizeof(hdr) */
 	if (hlen <= sizeof(struct tcphdr))
@@ -2906,6 +2914,7 @@
 u_int16_t
 pf_calc_mss(struct pf_addr *addr, sa_family_t af, u_int16_t offer)
 {
+	INIT_VNET_INET(curvnet);
 #ifdef INET
 	struct sockaddr_in	*dst;
 	struct route		 ro;
@@ -2916,7 +2925,7 @@
 #endif /* INET6 */
 	struct rtentry		*rt = NULL;
 	int			 hlen = 0;	/* make the compiler happy */
-	u_int16_t		 mss = tcp_mssdflt;
+	u_int16_t		 mss = V_tcp_mssdflt;
 
 	switch (af) {
 #ifdef INET
@@ -2964,7 +2973,7 @@
 
 	if (rt && rt->rt_ifp) {
 		mss = rt->rt_ifp->if_mtu - hlen - sizeof(struct tcphdr);
-		mss = max(tcp_mssdflt, mss);
+		mss = max(V_tcp_mssdflt, mss);
 		RTFREE(rt);
 	}
 	mss = min(mss, offer);
@@ -3009,6 +3018,7 @@
     struct ifqueue *ifq)
 #endif
 {
+	INIT_VNET_INET(curvnet);
 	struct pf_rule		*nr = NULL;
 	struct pf_addr		*saddr = pd->src, *daddr = pd->dst;
 	struct tcphdr		*th = pd->hdr.tcp;
@@ -3024,7 +3034,7 @@
 	int			 rewrite = 0;
 	struct pf_tag		*pftag = NULL;
 	int			 tag = -1;
-	u_int16_t		 mss = tcp_mssdflt;
+	u_int16_t		 mss = V_tcp_mssdflt;
 	int			 asd = 0;
 
 	if (pf_check_congestion(ifq)) {
@@ -5700,6 +5710,7 @@
 pf_route(struct mbuf **m, struct pf_rule *r, int dir, struct ifnet *oifp,
     struct pf_state *s)
 {
+	INIT_VNET_INET(curvnet);
 	struct mbuf		*m0, *m1;
 	struct m_tag		*mtag;
 	struct route		 iproute;
@@ -5767,7 +5778,7 @@
 	if (r->rt == PF_FASTROUTE) {
 		rtalloc(ro);
 		if (ro->ro_rt == 0) {
-			ipstat.ips_noroute++;
+			V_ipstat.ips_noroute++;
 			goto bad;
 		}
 
@@ -5898,14 +5909,14 @@
 		if ((ifp->if_capabilities & IFCAP_CSUM_IPv4) &&
 		    ifp->if_bridge == NULL) {
 			m0->m_pkthdr.csum |= M_IPV4_CSUM_OUT;
-			ipstat.ips_outhwcsum++;
+			V_ipstat.ips_outhwcsum++;
 		} else {
 			ip->ip_sum = 0;
 			ip->ip_sum = in_cksum(m0, ip->ip_hl << 2);
 		}
 		/* Update relevant hardware checksum stats for TCP/UDP */
 		if (m0->m_pkthdr.csum & M_TCPV4_CSUM_OUT)
-			tcpstat.tcps_outhwcsum++;
+			V_tcpstat.tcps_outhwcsum++;
 		else if (m0->m_pkthdr.csum & M_UDPV4_CSUM_OUT)
 			udpstat.udps_outhwcsum++;
 		error = (*ifp->if_output)(ifp, m0, sintosa(dst), NULL);
@@ -5917,7 +5928,7 @@
 	 * Must be able to put at least 8 bytes per fragment.
 	 */
 	if (ip->ip_off & htons(IP_DF)) {
-		ipstat.ips_cantfrag++;
+		V_ipstat.ips_cantfrag++;
 		if (r->rt != PF_DUPTO) {
 #ifdef __FreeBSD__
 			/* icmp_error() expects host byte ordering */
@@ -5974,7 +5985,7 @@
 	}
 
 	if (error == 0)
-		ipstat.ips_fragmented++;
+		V_ipstat.ips_fragmented++;
 
 done:
 	if (r->rt != PF_DUPTO)
@@ -6181,6 +6192,8 @@
 int
 pf_check_proto_cksum(struct mbuf *m, int off, int len, u_int8_t p, sa_family_t af)
 {
+	INIT_VNET_INET(curvnet);
+	INIT_VNET_INET6(curvnet);
 	u_int16_t sum = 0;
 	int hw_assist = 0;
 	struct ip *ip;
@@ -6259,17 +6272,17 @@
 	if (sum) {
 		switch (p) {
 		case IPPROTO_TCP:
-			tcpstat.tcps_rcvbadsum++;
+			V_tcpstat.tcps_rcvbadsum++;
 			break;
 		case IPPROTO_UDP:
-			udpstat.udps_badsum++;
+			V_udpstat.udps_badsum++;
 			break;
 		case IPPROTO_ICMP:
-			icmpstat.icps_checksum++;
+			V_icmpstat.icps_checksum++;
 			break;
 #ifdef INET6
 		case IPPROTO_ICMPV6:
-			icmp6stat.icp6s_checksum++;
+			V_icmp6stat.icp6s_checksum++;
 			break;
 #endif /* INET6 */
 		}
@@ -6355,17 +6368,17 @@
 		m->m_pkthdr.csum |= flag_bad;
 		switch (p) {
 		case IPPROTO_TCP:
-			tcpstat.tcps_rcvbadsum++;
+			V_tcpstat.tcps_rcvbadsum++;
 			break;
 		case IPPROTO_UDP:
-			udpstat.udps_badsum++;
+			V_udpstat.udps_badsum++;
 			break;
 		case IPPROTO_ICMP:
-			icmpstat.icps_checksum++;
+			V_icmpstat.icps_checksum++;
 			break;
 #ifdef INET6
 		case IPPROTO_ICMPV6:
-			icmp6stat.icp6s_checksum++;
+			V_icmp6stat.icp6s_checksum++;
 			break;
 #endif /* INET6 */
 		}

==== //depot/projects/vimage/src/sys/contrib/pf/net/pf_if.c#2 (text+ko) ====

@@ -34,6 +34,7 @@
 #if defined(__FreeBSD__)
 #include "opt_inet.h"
 #include "opt_inet6.h"
+#include "opt_vimage.h"
 #endif
 
 #include <sys/param.h>
@@ -50,7 +51,9 @@
 #include <sys/device.h>
 #endif
 #include <sys/time.h>
+#include <sys/vimage.h>
 
+#include <net/vnet.h>
 #include <net/if.h>
 #include <net/if_types.h>
 
@@ -130,6 +133,7 @@
 pfi_initialize(void)
 {
 #ifdef __FreeBSD__
+	INIT_VNET_NET(curvnet);
 	struct ifnet	*ifp;
 #endif
 
@@ -149,7 +153,7 @@
 	/* XXX_IMPORT */
 	PF_LOCK();
 	IFNET_RLOCK();
-	TAILQ_FOREACH(ifp, &ifnet, if_link) {
+	TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
 		IFNET_RUNLOCK();
 		pfi_attach_ifnet(ifp);
 		IFNET_RLOCK();
@@ -171,6 +175,7 @@
 void
 pfi_cleanup(void)
 {
+	INIT_VNET_NET(curvnet);
 	struct pfi_kif *p, key;
 	struct ifnet *ifp;
 
@@ -184,7 +189,7 @@
 
 	IFNET_RLOCK();
 	/* release PFI_IFLAG_INSTANCE */
-	TAILQ_FOREACH(ifp, &ifnet, if_link) {
+	TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
 		strlcpy(key.pfik_name, ifp->if_xname, sizeof(key.pfik_name));
 		p = RB_FIND(pfi_ifhead, &pfi_ifs, &key);
 		if (p != NULL) {

==== //depot/projects/vimage/src/sys/contrib/pf/net/pf_ioctl.c#3 (text+ko) ====

@@ -40,6 +40,7 @@
 #ifdef __FreeBSD__
 #include "opt_inet.h"
 #include "opt_inet6.h"
+#include "opt_vimage.h"
 #endif
 
 #ifdef __FreeBSD__
@@ -84,11 +85,13 @@
 #include <sys/module.h>
 #include <sys/conf.h>
 #include <sys/proc.h>
+#include <sys/vimage.h>
 #else
 #include <sys/timeout.h>
 #include <sys/pool.h>
 #endif
 
+#include <net/vnet.h>
 #include <net/if.h>
 #include <net/if_types.h>
 #include <net/route.h>
@@ -3438,6 +3441,7 @@
 pf_check6_in(void *arg, struct mbuf **m, struct ifnet *ifp, int dir,
     struct inpcb *inp)
 {
+	INIT_VNET_NET(curvnet);
 	/*
 	 * IPv6 is not affected by ip_len/ip_off byte order changes.
 	 */
@@ -3448,7 +3452,7 @@
 	 * order to support scoped addresses. In order to support stateful
 	 * filtering we have change this to lo0 as it is the case in IPv4.
 	 */
-	chk = pf_test6(PF_IN, (*m)->m_flags & M_LOOP ? &loif[0] : ifp, m,
+	chk = pf_test6(PF_IN, (*m)->m_flags & M_LOOP ? &V_loif[0] : ifp, m,
 	    NULL, inp);
 	if (chk && *m) {
 		m_freem(*m);

==== //depot/projects/vimage/src/sys/kern/kern_linker.c#5 (text+ko) ====

@@ -866,7 +866,7 @@
 		return (EPERM);
 #endif
 
-	CURVNETB_SET(td->td_vimage->v_vnetb);
+	CURVNET_SET(td->td_vimage->v_vnet);
 
 	/*
 	 * If file does not contain a qualified name or any dot in it
@@ -895,7 +895,7 @@
 		*fileid = lf->id;
 unlock:
 	KLD_UNLOCK();
-	CURVNETB_RESTORE();
+	CURVNET_RESTORE();
 	return (error);
 }
 
@@ -937,7 +937,7 @@
 	VNET_ASSERT(td->td_vimage == &vimage_0);
 	/* XXX is this necessary at all? */
 	VNET_ASSERT(td == curthread);
-	CURVNETB_SET(td->td_vimage->v_vnetb);
+	CURVNET_SET(td->td_vimage->v_vnet);
 
 	KLD_LOCK();
 	lf = linker_find_file_by_id(fileid);
@@ -969,7 +969,7 @@
 		PMC_CALL_HOOK(td, PMC_FN_KLD_UNLOAD, (void *) &pkm);
 #endif
 	KLD_UNLOCK();
-	CURVNETB_RESTORE();
+	CURVNET_RESTORE();
 	return (error);
 }
 
@@ -1182,9 +1182,9 @@
 		}
 #ifdef VIMAGE
 		if (lf == NULL) {
-			CURVNETB_SET(td->td_vimage->v_vnetb);
+			CURVNET_SET(td->td_vimage->v_vnet);
 			error = vi_symlookup(&lookup, symstr);
-			CURVNETB_RESTORE();
+			CURVNET_RESTORE();
 			if (error == 0) {
 				error = copyout(&lookup, uap->data,
 						sizeof(lookup));

==== //depot/projects/vimage/src/sys/kern/kern_synch.c#6 (text+ko) ====


==== //depot/projects/vimage/src/sys/kern/kern_sysctl.c#5 (text+ko) ====

@@ -1437,7 +1437,7 @@
 	req.lock = REQ_LOCKED;
 
 	SYSCTL_LOCK();
-	CURVNETB_SET(curthread->td_vimage->v_vnetb);
+	CURVNET_SET(curthread->td_vimage->v_vnet);
 	VNET_ASSERT(td == curthread);
 
 	do {
@@ -1449,7 +1449,7 @@
 	if (req.lock == REQ_WIRED && req.validlen > 0)
 		vsunlock(req.oldptr, req.validlen);
 
-	CURVNETB_RESTORE();
+	CURVNET_RESTORE();
 	SYSCTL_UNLOCK();
 
 	if (error && error != ENOMEM)

==== //depot/projects/vimage/src/sys/kern/kern_uuid.c#4 (text+ko) ====

@@ -91,7 +91,7 @@
 static void
 uuid_node(uint16_t *node)
 {
-	INIT_VNET_NET(curvnetb);
+	INIT_VNET_NET(curvnet);
 	struct ifnet *ifp;
 	struct ifaddr *ifa;
 	struct sockaddr_dl *sdl;

==== //depot/projects/vimage/src/sys/kern/kern_vimage.c#16 (text+ko) ====

@@ -66,10 +66,10 @@
 struct vimage vimage_0;
 struct vprocg vprocg_0;
 struct vcpu vcpu_0;
-struct vnet_base vnetb_0;
+struct vnet vnet_0;
 
 struct vimage_list_head vimage_head;
-struct vnetb_list_head vnetb_head;
+struct vnet_list_head vnet_head;
 struct vprocg_list_head vprocg_head;
 struct vcpu_list_head vcpu_head;
 
@@ -98,9 +98,9 @@
 			  &vnet_modules[modinfo->id], mod_le);
 
 	if (modinfo->i_attach) {
-		VNETB_ITERLOOP_BEGIN_QUIET();
+		VNET_ITERLOOP_BEGIN_QUIET();
 			modinfo->i_attach();
-		VNETB_ITERLOOP_END();
+		VNET_ITERLOOP_END();
 	}
 }
 
@@ -110,9 +110,9 @@
 	VNET_ASSERT(vnet_modules[modinfo->id].modinfo == modinfo)
 
 	if (modinfo->i_detach) {
-		VNETB_ITERLOOP_BEGIN_QUIET();
+		VNET_ITERLOOP_BEGIN_QUIET();
 			modinfo->i_detach();
-		VNETB_ITERLOOP_END();
+		VNET_ITERLOOP_END();
 	}
 
 	vnet_modules[modinfo->id].modinfo = NULL;
@@ -120,22 +120,22 @@
 		     &vnet_modules[modinfo->id], mod_le);
 }
 
-struct vimage *vnetb2vimage(vnetb)
-	struct vnet_base *vnetb;	
+struct vimage *vnet2vimage(vnet)
+	struct vnet *vnet;	
 {
 	struct vimage *vip;
 
 	LIST_FOREACH(vip, &vimage_head, vi_le)
-		if (vip->v_vnetb == vnetb)
+		if (vip->v_vnet == vnet)
 			return(vip);
 
-	panic("vnetb2vimage");	/* must never happen */
+	panic("vnet2vimage");	/* must never happen */
 }
 
-char *vnetb_name(vnetb)
-	struct vnet_base *vnetb;	
+char *vnet_name(vnet)
+	struct vnet *vnet;	
 {
-	return(vnetb2vimage(vnetb)->vi_name);
+	return(vnet2vimage(vnet)->vi_name);
 }
 
 
@@ -164,24 +164,24 @@
 	struct vimage *vip;
 {
 	struct vimage *new_vip;
-	struct vnet_base *new_vnetb = NULL;
+	struct vnet *new_vnet = NULL;
 	u_char eaddr[6];
 
 	if (vi_req == NULL || strcmp(vi_req->vi_name, "-") == 0) {
 		if (vip == &vimage_0)
 			return (ENXIO);
-		new_vnetb = vip->vi_parent->v_vnetb;
+		new_vnet = vip->vi_parent->v_vnet;
 	} else
 		LIST_FOREACH(new_vip, &vimage_head, vi_le) {
 			if (!vi_child_of(vip, new_vip))
 				continue;
 			if (strcmp(vi_req->vi_name, new_vip->vi_name) == 0) {
-				new_vnetb = new_vip->v_vnetb;
+				new_vnet = new_vip->v_vnet;
 				break;
 			}
 		}
 
-	if (new_vnetb == NULL)
+	if (new_vnet == NULL)
 		return (ENXIO);
 
 	if (ifp == NULL)
@@ -192,9 +192,9 @@
 	if (vi_req != NULL) {
 		struct ifnet *t_ifp;
 
-		CURVNETB_SET_QUIET(new_vnetb);
+		CURVNET_SET_QUIET(new_vnet);
 		t_ifp = ifunit(vi_req->vi_parent_name);
-		CURVNETB_RESTORE();
+		CURVNET_RESTORE();
 		if (t_ifp != NULL)
 			return (EEXIST);
 	}
@@ -207,10 +207,11 @@
 	 * This is tricky. First we have to detach the interface,
 	 * and then reattach it to the target vnet. Before doing
 	 * that, we reassing the interface unit number to look nice
-	 * in the target vnetb.
+	 * in the target vnet.
 	 */
 	switch (ifp->if_type) {
 	case IFT_ETHER:
+	case IFT_L2VLAN:
 		bcopy(IF_LLADDR(ifp), eaddr, 6);
 		ether_ifdetach(ifp);
 		break;
@@ -220,8 +221,8 @@
 	}
 	ifp->if_bpf = NULL;
 
-	CURVNETB_SET_QUIET(new_vnetb);
-	INIT_VNET_NET(new_vnetb);
+	CURVNET_SET_QUIET(new_vnet);
+	INIT_VNET_NET(new_vnet);
 	/*
 	 * Try to find an empty slot below if_index.  If we fail, take 
 	 * the next slot.
@@ -244,6 +245,7 @@
 
 	switch (ifp->if_type) {
 	case IFT_ETHER:
+	case IFT_L2VLAN:
 		ether_ifattach(ifp, eaddr);
 		break;
 	default:
@@ -256,7 +258,7 @@
 		sprintf(vi_req->vi_chroot, "%s%d",
 			ifp->if_dname, ifp->if_dunit);
 
-	CURVNETB_RESTORE();
+	CURVNET_RESTORE();
 	return (0);
 }
 
@@ -318,8 +320,8 @@
 				sizeof (vi_req->vi_parent_name));
 		else
 			vi_req->vi_parent_name[0] = 0;
-		vi_req->vi_if_count = vip_r->v_vnetb->ifccnt;
-		vi_req->vi_sock_count = vip_r->v_vnetb->sockcnt;
+		vi_req->vi_if_count = vip_r->v_vnet->ifccnt;
+		vi_req->vi_sock_count = vip_r->v_vnet->sockcnt;
 		break;
 
 	case SIOCSPVIMAGE:
@@ -370,7 +372,7 @@
 		     mapentry->name != NULL; mapentry++) {
 			if (strcmp(symstr, mapentry->name) == 0) {
 				lookup->symvalue =
-					(int) curvnetb->mod_data[i];
+					(int) curvnet->mod_data[i];
 				lookup->symvalue += mapentry->offset;
 				lookup->symsize = mapentry->size;
 				return 0;
@@ -388,7 +390,7 @@
 	int maxsock, tsc_hashs, tsc_buckl;
 {
 	struct vimage *vip;
-	struct vnet_base *vnetb;
+	struct vnet *vnet;
 	struct vprocg *vprocg;
 	struct vcpu *vcpu;
 	struct domain *dp;
@@ -408,12 +410,12 @@
 	bzero(vip, sizeof(struct vimage));
 	vip->vi_id = last_vi_id++;
 
-	vnetb = malloc(sizeof(struct vnet_base), M_VNET, M_NOWAIT);
-	if (vnetb == NULL)
-		panic("vi_alloc: malloc failed for vnetb \"%s\"\n", name);
-	bzero(vnetb, sizeof(struct vnet_base));
-	vip->v_vnetb = vnetb;
-	vnetb->vnet_magic_n = VNET_MAGIC_N;
+	vnet = malloc(sizeof(struct vnet), M_VNET, M_NOWAIT);
+	if (vnet == NULL)
+		panic("vi_alloc: malloc failed for vnet \"%s\"\n", name);
+	bzero(vnet, sizeof(struct vnet));
+	vip->v_vnet = vnet;
+	vnet->vnet_magic_n = VNET_MAGIC_N;
 
 	vprocg = malloc(sizeof(struct vprocg), M_VPROCG, M_NOWAIT);
 	if (vprocg == NULL)
@@ -430,7 +432,7 @@
 	/* Some initialization stuff... */
 	sprintf(vip->vi_name, "%s", name);
 
-	CURVNETB_SET_QUIET(vnetb);
+	CURVNET_SET_QUIET(vnet);
 
 	/*
 	 * Initialize modules with ORDER_1ST flag set
@@ -471,10 +473,10 @@
 			modlnk_i->modinfo->i_attach();
 		}
 
-	CURVNETB_RESTORE();
+	CURVNET_RESTORE();
 
 	LIST_INSERT_HEAD(&vimage_head, vip, vi_le);
-	LIST_INSERT_HEAD(&vnetb_head, vnetb, vnetb_le);
+	LIST_INSERT_HEAD(&vnet_head, vnet, vnet_le);
 	LIST_INSERT_HEAD(&vprocg_head, vprocg, vprocg_le);
 	LIST_INSERT_HEAD(&vcpu_head, vcpu, vcpu_le);
 
@@ -484,22 +486,22 @@
 
 
 /*
- * Destroy a vnetb - unlink all linked lists, free all the memory, stop all
+ * Destroy a vnet - unlink all linked lists, free all the memory, stop all
  * the timers... How can one ever be sure to have done *all* the necessary
  * steps?
  */
 static void
 vi_destroy(struct vimage *vip)
 {
-	struct vnet_base *vnetb = vip->v_vnetb;
+	struct vnet *vnet = vip->v_vnet;
 	struct vprocg *vprocg = vip->v_procg;
 	struct vcpu *vcpu = vip->v_cpu;
 	struct ifnet *ifp;
 
-	CURVNETB_SET_QUIET(vnetb);
-	INIT_VNET_NET(vnetb);
+	CURVNET_SET_QUIET(vnet);
+	INIT_VNET_NET(vnet);
 
-	/* return all interfaces to the parent vnetb */
+	/* return all interfaces to the parent vnet */
 	while ((ifp = TAILQ_FIRST(&V_ifnet)) != NULL) {
 		if (ifp->if_flags & IFF_LOOPBACK) {
 			bpfdetach(ifp);
@@ -516,18 +518,18 @@
 	for (dp = domains; dp; dp = dp->dom_next)
 		for (pr = dp->dom_protoswNPROTOSW; pr > dp->dom_protosw;)
 			if ((--pr)->pr_destroy)
-				(*pr->pr_destroy)(vnetb);
+				(*pr->pr_destroy)(vnet);
 
-	free((caddr_t)vnetb->ifnet_addrs, M_IFADDR);
-	free((caddr_t)vnetb->ifindex2ifnet, M_IFADDR);
+	free((caddr_t)vnet->ifnet_addrs, M_IFADDR);
+	free((caddr_t)vnet->ifindex2ifnet, M_IFADDR);
 #endif
 
-	CURVNETB_RESTORE();
+	CURVNET_RESTORE();
 
-	/* hopefully, we are finally OK to free the vnetb container itself! */
-	LIST_REMOVE(vnetb, vnetb_le);
-	vnetb->vnet_magic_n = -1;
-	free(vnetb, M_VNET);
+	/* hopefully, we are finally OK to free the vnet container itself! */
+	LIST_REMOVE(vnet, vnet_le);
+	vnet->vnet_magic_n = -1;
+	free(vnet, M_VNET);
 
 	LIST_REMOVE(vprocg, vprocg_le);
 	free(vprocg, M_VPROCG);
@@ -544,34 +546,34 @@
 vi_init(void *unused)
 {
 	LIST_INIT(&vimage_head);
-	LIST_INIT(&vnetb_head);
+	LIST_INIT(&vnet_head);
 	LIST_INIT(&vprocg_head);
 	LIST_INIT(&vcpu_head);
 
 	LIST_INSERT_HEAD(&vimage_head, &vimage_0, vi_le);
-	LIST_INSERT_HEAD(&vnetb_head, &vnetb_0, vnetb_le);
+	LIST_INSERT_HEAD(&vnet_head, &vnet_0, vnet_le);
 	LIST_INSERT_HEAD(&vprocg_head, &vprocg_0, vprocg_le);
 	LIST_INSERT_HEAD(&vcpu_head, &vcpu_0, vcpu_le);
 
 	sprintf(vimage_0.vi_name, "default");
-	vimage_0.v_vnetb = &vnetb_0;
+	vimage_0.v_vnet = &vnet_0;
 	vimage_0.v_procg = &vprocg_0;
 	vimage_0.v_cpu = &vcpu_0;
 
-	vnetb_0.vnet_magic_n = VNET_MAGIC_N;
+	vnet_0.vnet_magic_n = VNET_MAGIC_N;
 
 	TAILQ_INIT(&vnet_modlink_head);
 
 	/*
-	 * We MUST clear curvnetb in vi_init_done before going SMP.
+	 * We MUST clear curvnet in vi_init_done before going SMP.
 	 */
-	curvnetb = &vnetb_0;
+	curvnet = &vnet_0;
 }
 
 static void
 vi_init_done(void *unused)
 {
-	curvnetb = NULL;
+	curvnet = NULL;
 }
 
 SYSINIT(vimage, SI_SUB_VIMAGE, SI_ORDER_FIRST, vi_init, NULL)

==== //depot/projects/vimage/src/sys/kern/sys_socket.c#5 (text+ko) ====

@@ -88,9 +88,9 @@
 		return (error);
 	}
 #endif
-	CURVNETB_SET(so->so_vnetb);
+	CURVNET_SET(so->so_vnet);
 	error = soreceive(so, 0, uio, 0, 0, 0);
-	CURVNETB_RESTORE();
+	CURVNET_RESTORE();
 	NET_UNLOCK_GIANT();
 	return (error);
 }
@@ -131,7 +131,7 @@
 	int error = 0;
 
 	NET_LOCK_GIANT();
-	CURVNETB_SET(so->so_vnetb);
+	CURVNET_SET(so->so_vnet);
 	switch (cmd) {
 
 	case FIONBIO:
@@ -213,7 +213,7 @@
 			    (so, cmd, data, 0, td));
 		break;
 	}
-	CURVNETB_RESTORE();
+	CURVNET_RESTORE();
 	NET_UNLOCK_GIANT();
 	return(error);
 }

==== //depot/projects/vimage/src/sys/kern/tty.c#5 (text+ko) ====

@@ -1141,7 +1141,7 @@
 		if (t == tp->t_line)
 			return (0);
 		s = spltty();
-		CURVNETB_SET(curthread->td_vimage->v_vnetb); /* XXX */
+		CURVNET_SET(curthread->td_vimage->v_vnet); /* XXX */
 		ttyld_close(tp, flag);
 		tp->t_line = t;
 		/* XXX: we should use the correct cdev here */
@@ -1157,7 +1157,7 @@
 			tp->t_line = TTYDISC;
 			(void)ttyld_open(tp, tp->t_dev);
 		}
-		CURVNETB_RESTORE();
+		CURVNET_RESTORE();
 		splx(s);
 		return (error);
 		break;
@@ -3131,9 +3131,9 @@
 			goto out;
 		goto open_top;
 	}
-	CURVNETB_SET(curthread->td_vimage->v_vnetb); /* XXX */
+	CURVNET_SET(curthread->td_vimage->v_vnet); /* XXX */
 	error =	ttyld_open(tp, dev);
-	CURVNETB_RESTORE();
+	CURVNET_RESTORE();
 	ttyldoptim(tp);
 	if (tp->t_state & TS_ISOPEN && ISCALLOUT(dev))
 		tp->t_actout = TRUE;
@@ -3150,9 +3150,9 @@
 	struct tty *tp;
 
 	tp = dev->si_tty;
-	CURVNETB_SET(curthread->td_vimage->v_vnetb); /* XXX */
+	CURVNET_SET(curthread->td_vimage->v_vnet); /* XXX */
 	ttyld_close(tp, flag);
-	CURVNETB_RESTORE();
+	CURVNET_RESTORE();
 	ttyldoptim(tp);
 	tt_close(tp);
 	tp->t_do_timestamp = 0;

==== //depot/projects/vimage/src/sys/kern/uipc_socket.c#8 (text+ko) ====

@@ -262,7 +262,7 @@
  * soalloc() returns a socket with a ref count of 0.
  */
 static struct socket *
-soalloc(struct vnet_base *vnetb)
+soalloc(struct vnet *vnet)

>>> TRUNCATED FOR MAIL (1000 lines) <<<


More information about the p4-projects mailing list