PERFORCE change 163600 for review

Marko Zec zec at FreeBSD.org
Fri Jun 5 20:01:16 UTC 2009


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

Change 163600 by zec at zec_tpx32 on 2009/06/05 20:01:01

	A crude hack aiming at providing each vnet with completely
	independent copy of if_clone descriptor for loif interface
	class.  Until now loif's ifc_simple_data struct was shared 
	among all vnets, which resulted in its ifcs_minifs field
	being reset from 1 to 0 on first vimage -d invocation.  In
	turn, this resulted in all subsequent new vnets being created
	without lo0 instance.  This patch restores correct behavior,
	i.e. vimage -c will now always automatically create a lo0
	instance in a new vnet, regardless on whether vimage -d was
	previously called on another vnet.

Affected files ...

.. //depot/projects/vimage-commit2/src/sys/net/if_loop.c#35 edit
.. //depot/projects/vimage-commit2/src/sys/net/vnet.h#21 edit

Differences ...

==== //depot/projects/vimage-commit2/src/sys/net/if_loop.c#35 (text+ko) ====

@@ -182,7 +182,11 @@
 #ifdef VIMAGE
 	V_lo_cloner = malloc(sizeof(*V_lo_cloner), M_LO_CLONER,
 	    M_WAITOK | M_ZERO);
+	V_lo_cloner_data = malloc(sizeof(*V_lo_cloner_data), M_LO_CLONER,
+	    M_WAITOK | M_ZERO);
 	bcopy(&lo_cloner, V_lo_cloner, sizeof(*V_lo_cloner));
+	bcopy(lo_cloner.ifc_data, V_lo_cloner_data, sizeof(*V_lo_cloner_data));
+	V_lo_cloner->ifc_data = V_lo_cloner_data;
 	if_clone_attach(V_lo_cloner);
 #else
 	if_clone_attach(&lo_cloner);
@@ -197,6 +201,8 @@
 	INIT_VNET_NET(curvnet);
 
 	if_clone_detach(V_lo_cloner);
+	free(V_lo_cloner, M_LO_CLONER);
+	free(V_lo_cloner_data, M_LO_CLONER);
 	V_loif = NULL;
 
 	return (0);

==== //depot/projects/vimage-commit2/src/sys/net/vnet.h#21 (text+ko) ====

@@ -51,6 +51,7 @@
 
 	struct ifnet *		_loif;
 	struct if_clone *	_lo_cloner;
+	struct ifc_simple_data *_lo_cloner_data;
 
 	LIST_HEAD(, rawcb)	_rawcb_list;
 
@@ -87,6 +88,7 @@
 #define	V_ifklist		VNET_NET(ifklist)
 #define	V_ifnet			VNET_NET(ifnet)
 #define	V_lo_cloner		VNET_NET(lo_cloner)
+#define	V_lo_cloner_data	VNET_NET(lo_cloner_data)
 #define	V_loif			VNET_NET(loif)
 #define	V_rawcb_list		VNET_NET(rawcb_list)
 #define	V_rt_tables		VNET_NET(rt_tables)


More information about the p4-projects mailing list