PERFORCE change 75623 for review

David Xu davidxu at FreeBSD.org
Wed Apr 20 06:40:05 PDT 2005


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

Change 75623 by davidxu at davidxu_alona on 2005/04/20 13:39:06

	IFC.

Affected files ...

.. //depot/projects/davidxu_thread/src/lib/libpmc/libpmc.c#2 integrate
.. //depot/projects/davidxu_thread/src/share/man/man4/ohci.4#2 integrate
.. //depot/projects/davidxu_thread/src/share/man/man4/twe.4#4 integrate
.. //depot/projects/davidxu_thread/src/share/man/man4/uhci.4#3 integrate
.. //depot/projects/davidxu_thread/src/share/man/man4/usb.4#2 integrate
.. //depot/projects/davidxu_thread/src/sys/conf/files.pc98#7 integrate
.. //depot/projects/davidxu_thread/src/sys/dev/ata/ata-all.c#8 integrate
.. //depot/projects/davidxu_thread/src/sys/dev/ata/ata-all.h#9 integrate
.. //depot/projects/davidxu_thread/src/sys/dev/ata/ata-chipset.c#10 integrate
.. //depot/projects/davidxu_thread/src/sys/hwpmc/hwpmc_mod.c#2 integrate
.. //depot/projects/davidxu_thread/src/sys/kern/kern_fork.c#7 integrate
.. //depot/projects/davidxu_thread/src/sys/modules/Makefile#12 integrate
.. //depot/projects/davidxu_thread/src/sys/modules/apm/Makefile#3 integrate
.. //depot/projects/davidxu_thread/src/sys/net/if.c#9 integrate
.. //depot/projects/davidxu_thread/src/sys/net/if_var.h#7 integrate
.. //depot/projects/davidxu_thread/src/sys/net/if_vlan.c#4 integrate
.. //depot/projects/davidxu_thread/src/sys/netgraph/ng_eiface.c#5 integrate
.. //depot/projects/davidxu_thread/src/sys/netgraph/ng_message.h#3 integrate
.. //depot/projects/davidxu_thread/src/sys/netinet/ip_carp.c#5 integrate
.. //depot/projects/davidxu_thread/src/sys/pc98/apm/apm_bioscall.S#1 branch
.. //depot/projects/davidxu_thread/src/sys/pc98/apm/apm_bioscall.s#3 delete

Differences ...

==== //depot/projects/davidxu_thread/src/lib/libpmc/libpmc.c#2 (text+ko) ====

@@ -22,12 +22,10 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- *
- * $FreeBSD: src/lib/libpmc/libpmc.c,v 1.1 2005/04/19 04:01:21 jkoshy Exp $
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libpmc/libpmc.c,v 1.1 2005/04/19 04:01:21 jkoshy Exp $");
+__FBSDID("$FreeBSD: src/lib/libpmc/libpmc.c,v 1.2 2005/04/20 05:36:43 jkoshy Exp $");
 
 #include <sys/types.h>
 #include <sys/module.h>

==== //depot/projects/davidxu_thread/src/share/man/man4/ohci.4#2 (text+ko) ====

@@ -25,9 +25,9 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 .\" THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $FreeBSD: src/share/man/man4/ohci.4,v 1.17 2004/09/05 22:31:03 simon Exp $
+.\" $FreeBSD: src/share/man/man4/ohci.4,v 1.18 2005/04/20 07:33:09 simon Exp $
 .\"
-.Dd September 6, 2004
+.Dd April 20, 2005
 .Dt OHCI 4
 .Os
 .Sh NAME
@@ -62,6 +62,7 @@
 .El
 .Pp
 .Sh SEE ALSO
+.Xr ehci 4 ,
 .Xr uhci 4
 .Sh HISTORY
 The

==== //depot/projects/davidxu_thread/src/share/man/man4/twe.4#4 (text+ko) ====

@@ -22,7 +22,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $FreeBSD: src/share/man/man4/twe.4,v 1.13 2005/02/27 13:15:51 brueffer Exp $
+.\" $FreeBSD: src/share/man/man4/twe.4,v 1.14 2005/04/20 10:41:09 brueffer Exp $
 .\"
 .Dd August 15, 2004
 .Dt TWE 4
@@ -38,7 +38,7 @@
 .Nm
 driver provides support for AMCC's 3ware 5000/6000/7000/8000 series
 PATA/SATA RAID adapters.
-These adapters were formerly know as
+These adapters were formerly known as
 .Dq 3ware Escalade .
 .Pp
 These devices support 2, 4, 8, or 12 ATA disk drives

==== //depot/projects/davidxu_thread/src/share/man/man4/uhci.4#3 (text+ko) ====

@@ -25,9 +25,9 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 .\" THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $FreeBSD: src/share/man/man4/uhci.4,v 1.17 2005/02/09 18:07:16 ru Exp $
+.\" $FreeBSD: src/share/man/man4/uhci.4,v 1.18 2005/04/20 07:33:09 simon Exp $
 .\"
-.Dd September 6, 2004
+.Dd April 20, 2005
 .Dt UHCI 4
 .Os
 .Sh NAME
@@ -53,6 +53,7 @@
 VIA 83C572
 .El
 .Sh SEE ALSO
+.Xr ehci 4 ,
 .Xr ohci 4
 .Sh HISTORY
 The

==== //depot/projects/davidxu_thread/src/share/man/man4/usb.4#2 (text+ko) ====

@@ -25,9 +25,9 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 .\" THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $FreeBSD: src/share/man/man4/usb.4,v 1.31 2004/06/23 23:25:58 markus Exp $
+.\" $FreeBSD: src/share/man/man4/usb.4,v 1.32 2005/04/20 07:33:09 simon Exp $
 .\"
-.Dd February 21, 1999
+.Dd April 20, 2005
 .Dt USB 4
 .Os
 .Sh NAME
@@ -393,6 +393,7 @@
 .Pp
 .Xr aue 4 ,
 .Xr cue 4 ,
+.Xr ehci 4 ,
 .Xr kue 4 ,
 .Xr ohci 4 ,
 .Xr pci 4 ,

==== //depot/projects/davidxu_thread/src/sys/conf/files.pc98#7 (text+ko) ====

@@ -3,7 +3,7 @@
 #
 # modified for PC-9801/PC-9821
 #
-# $FreeBSD: src/sys/conf/files.pc98,v 1.319 2005/04/19 21:40:07 imp Exp $
+# $FreeBSD: src/sys/conf/files.pc98,v 1.320 2005/04/20 12:28:19 nyan Exp $
 #
 # The long compile-with and dependency lines are required because of
 # limitations in config: backslash-newline doesn't work in strings, and
@@ -346,7 +346,7 @@
 libkern/ucmpdi2.c		standard
 libkern/udivdi3.c		standard
 libkern/umoddi3.c		standard
-pc98/apm/apm_bioscall.s		optional apm
+pc98/apm/apm_bioscall.S		optional apm
 pc98/i386/busio.s		standard
 pc98/i386/busiosubr.c		standard
 pc98/i386/machdep.c		standard

==== //depot/projects/davidxu_thread/src/sys/dev/ata/ata-all.c#8 (text+ko) ====

@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ata/ata-all.c,v 1.243 2005/04/18 21:21:26 phk Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ata/ata-all.c,v 1.244 2005/04/20 12:51:54 sos Exp $");
 
 #include "opt_ata.h"
 #include <sys/param.h>
@@ -69,7 +69,6 @@
 static void ata_interrupt(void *);
 static void ata_boot_attach(void);
 device_t ata_add_child(device_t parent, struct ata_device *atadev, int unit);
-static int ata_identify(device_t dev);
 
 /* global vars */
 MALLOC_DEFINE(M_ATA, "ATA generic", "ATA driver generic layer");
@@ -597,7 +596,7 @@
     return child;
 }
 
-static int
+int
 ata_identify(device_t dev)
 {
     struct ata_channel *ch = device_get_softc(dev);

==== //depot/projects/davidxu_thread/src/sys/dev/ata/ata-all.h#9 (text+ko) ====

@@ -25,7 +25,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/dev/ata/ata-all.h,v 1.95 2005/04/19 12:33:26 sos Exp $
+ * $FreeBSD: src/sys/dev/ata/ata-all.h,v 1.96 2005/04/20 12:51:54 sos Exp $
  */
 
 /* ATA register defines */
@@ -453,6 +453,7 @@
 int ata_reinit(device_t dev);
 int ata_suspend(device_t dev);
 int ata_resume(device_t dev);
+int ata_identify(device_t dev);
 void ata_default_registers(struct ata_channel *ch);
 void ata_udelay(int interval);
 char *ata_mode2str(int mode);

==== //depot/projects/davidxu_thread/src/sys/dev/ata/ata-chipset.c#10 (text+ko) ====

@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ata/ata-chipset.c,v 1.110 2005/04/17 13:37:57 sos Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ata/ata-chipset.c,v 1.111 2005/04/20 12:51:54 sos Exp $");
 
 #include "opt_ata.h"
 #include <sys/param.h>
@@ -294,8 +294,7 @@
 
 	device_printf(tp->dev, "CONNECTED\n");
 	ata_sata_connect(ch);
-	bus_generic_probe(tp->dev);
-	bus_generic_attach(tp->dev);
+	ata_identify(tp->dev);
     }
     if (tp->action == ATA_C_DETACH) {
 	if (!device_get_children(tp->dev, &children, &nchildren)) {

==== //depot/projects/davidxu_thread/src/sys/hwpmc/hwpmc_mod.c#2 (text+ko) ====

@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/hwpmc/hwpmc_mod.c,v 1.2 2005/04/19 21:12:57 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/hwpmc/hwpmc_mod.c,v 1.3 2005/04/20 04:43:30 jkoshy Exp $");
 
 #include <sys/param.h>
 #include <sys/eventhandler.h>
@@ -303,7 +303,7 @@
 static int
 pmc_debugflags_parse(char *newstr, char *fence)
 {
-	char c, *e, *p, *q;
+	char c, *p, *q;
 	unsigned int tmpflags;
 	int level;
 	char tmpbuf[4];		/* 3 character keyword + '\0' */
@@ -312,7 +312,6 @@
 	level = 0xF;	/* max verbosity */
 
 	p = newstr;
-	e = newstr + strlen(p);
 
 	for (; p < fence && (c = *p);) {
 
@@ -331,7 +330,7 @@
 		else if (strncmp(tmpbuf, S, 3) == 0)		\
 			tmpflags |= __PMCDFMIN(F)
 
-		if (e - p > 6 && strncmp(p, "level=", 6) == 0) {
+		if (fence - p > 6 && strncmp(p, "level=", 6) == 0) {
 			p += 6;	/* skip over keyword */
 			level = strtoul(p, &q, 16);
 		}

==== //depot/projects/davidxu_thread/src/sys/kern/kern_fork.c#7 (text+ko) ====

@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_fork.c,v 1.250 2005/04/04 21:53:54 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_fork.c,v 1.251 2005/04/20 13:14:52 davidxu Exp $");
 
 #include "opt_ktrace.h"
 #include "opt_mac.h"
@@ -471,6 +471,7 @@
 	    __rangeof(struct ksegrp, kg_startcopy, kg_endcopy));
 
 	td2->td_sigstk = td->td_sigstk;
+	td2->td_sigmask = td->td_sigmask;
 
 	/*
 	 * Duplicate sub-structures as needed.

==== //depot/projects/davidxu_thread/src/sys/modules/Makefile#12 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/modules/Makefile,v 1.440 2005/04/19 04:01:24 jkoshy Exp $
+# $FreeBSD: src/sys/modules/Makefile,v 1.441 2005/04/20 04:57:38 jkoshy Exp $
 
 # oldcard -- specialized use for debugging only.
 # owi -- totally unsupported for debugging only.
@@ -91,7 +91,7 @@
 	hifn \
 	hme \
 	${_hptmv} \
-	hwpmc \
+	${_hwpmc} \
 	${_i2c} \
 	${_ibcs2} \
 	${_ichwd} \
@@ -328,6 +328,7 @@
 _ext2fs=	ext2fs
 _fe=		fe
 _hfa=		hfa
+_hwpmc=		hwpmc
 _i2c=		i2c
 _ibcs2=		ibcs2
 _ie=		ie
@@ -420,6 +421,7 @@
 _drm=		drm
 _em=		em
 _ext2fs=	ext2fs
+_hwpmc=		hwpmc
 _i2c=		i2c
 _ida=		ida
 _iir=		iir

==== //depot/projects/davidxu_thread/src/sys/modules/apm/Makefile#3 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/modules/apm/Makefile,v 1.8 2005/04/17 10:41:59 nyan Exp $
+# $FreeBSD: src/sys/modules/apm/Makefile,v 1.9 2005/04/20 12:28:20 nyan Exp $
 
 .PATH: ${.CURDIR}/../../i386/bios
 .if ${MACHINE} == "pc98"
@@ -8,16 +8,11 @@
 KMOD=	apm
 SRCS=	apm.c apm.h
 .if ${MACHINE} == "pc98"
-SRCS+=	apm_bioscall.s
+SRCS+=	apm_bioscall.S
 .endif
 SRCS+=	device_if.h bus_if.h
 
 EXPORT_SYMS=	apm_display	\
 		apm_softc
 
-.if ${MACHINE} == "pc98"
-apm_bioscall.o: apm_bioscall.s
-	${CC} -x assembler-with-cpp -DLOCORE ${CFLAGS} -c ${.IMPSRC}
-.endif
-
 .include <bsd.kmod.mk>

==== //depot/projects/davidxu_thread/src/sys/net/if.c#9 (text+ko) ====

@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)if.c	8.5 (Berkeley) 1/9/95
- * $FreeBSD: src/sys/net/if.c,v 1.226 2005/04/15 01:51:26 cperciva Exp $
+ * $FreeBSD: src/sys/net/if.c,v 1.227 2005/04/20 09:30:54 glebius Exp $
  */
 
 #include "opt_compat.h"
@@ -112,6 +112,7 @@
 static int	if_rtdel(struct radix_node *, void *);
 static int	ifhwioctl(u_long, struct ifnet *, caddr_t, struct thread *);
 static void	if_start_deferred(void *context, int pending);
+static void	do_link_state_change(void *, int);
 #ifdef INET6
 /*
  * XXX: declare here to avoid to include many inet6 related files..
@@ -385,6 +386,7 @@
 	struct ifaddr *ifa;
 
 	TASK_INIT(&ifp->if_starttask, 0, if_start_deferred, ifp);
+	TASK_INIT(&ifp->if_linktask, 0, do_link_state_change, ifp);
 	IF_AFDATA_LOCK_INIT(ifp);
 	ifp->if_afdata_initialized = 0;
 	IFNET_WLOCK();
@@ -542,6 +544,11 @@
  	struct ifnet *iter;
  	int found;
 
+	/*
+	 * Remove/wait for pending events.
+	 */
+	taskqueue_drain(taskqueue_swi, &ifp->if_linktask);
+
 	EVENTHANDLER_INVOKE(ifnet_departure_event, ifp);
 #ifdef DEV_CARP
 	/* Maybe hook to the generalized departure handler above?!? */
@@ -988,19 +995,30 @@
 void	(*vlan_link_state_p)(struct ifnet *, int);	/* XXX: private from if_vlan */
 
 /*
- * Handle a change in the interface link state.
+ * Handle a change in the interface link state. To avoid LORs
+ * between driver lock and upper layer locks, as well as possible
+ * recursions, we post event to taskqueue, and all job
+ * is done in static do_link_state_change().
  */
 void
 if_link_state_change(struct ifnet *ifp, int link_state)
 {
-	int link;
-
 	/* Return if state hasn't changed. */
 	if (ifp->if_link_state == link_state)
 		return;
 
 	ifp->if_link_state = link_state;
 
+	taskqueue_enqueue(taskqueue_swi, &ifp->if_linktask);
+}
+
+static void
+do_link_state_change(void *arg, int pending)
+{
+	struct ifnet *ifp = (struct ifnet *)arg;
+	int link_state = ifp->if_link_state;
+	int link;
+
 	/* Notify that the link state has changed. */
 	rt_ifmsg(ifp);
 	if (link_state == LINK_STATE_UP)
@@ -1020,6 +1038,8 @@
 	if (ifp->if_carp)
 		carp_carpdev_state(ifp->if_carp);
 #endif
+	if (pending > 1)
+		if_printf(ifp, "%d link states coalesced\n", pending);
 	if (log_link_state_change)
 		log(LOG_NOTICE, "%s: link state changed to %s\n", ifp->if_xname,
 		    (link_state == LINK_STATE_UP) ? "UP" : "DOWN" );

==== //depot/projects/davidxu_thread/src/sys/net/if_var.h#7 (text+ko) ====

@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	From: @(#)if.h	8.1 (Berkeley) 6/10/93
- * $FreeBSD: src/sys/net/if_var.h,v 1.94 2005/03/01 10:59:14 glebius Exp $
+ * $FreeBSD: src/sys/net/if_var.h,v 1.95 2005/04/20 09:30:54 glebius Exp $
  */
 
 #ifndef	_NET_IF_VAR_H_
@@ -194,6 +194,7 @@
 	int	if_afdata_initialized;
 	struct	mtx if_afdata_mtx;
 	struct	task if_starttask;	/* task for IFF_NEEDSGIANT */
+	struct	task if_linktask;	/* task for link change events */
 };
 
 typedef void if_init_f_t(void *);

==== //depot/projects/davidxu_thread/src/sys/net/if_vlan.c#4 (text+ko) ====

@@ -26,7 +26,7 @@
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/net/if_vlan.c,v 1.77 2005/02/18 22:31:19 ru Exp $
+ * $FreeBSD: src/sys/net/if_vlan.c,v 1.78 2005/04/20 12:16:41 glebius Exp $
  */
 
 /*
@@ -62,7 +62,6 @@
 #include <net/if_dl.h>
 #include <net/if_types.h>
 #include <net/if_vlan_var.h>
-#include <net/route.h>
 
 #ifdef INET
 #include <netinet/in.h>
@@ -224,7 +223,7 @@
  */
 extern	void (*vlan_input_p)(struct ifnet *, struct mbuf *);
 
-/* For MII eyes only... */
+/* For if_link_state_change() eyes only... */
 extern	void (*vlan_link_state_p)(struct ifnet *, int);
 
 static int
@@ -819,11 +818,9 @@
 
 	VLAN_LOCK();
 	LIST_FOREACH(ifv, &ifv_list, ifv_list) {
-		if (ifv->ifv_p == ifp) {
-			ifv->ifv_if.if_link_state = ifv->ifv_p->if_link_state;
-			rt_ifmsg(&(ifv->ifv_if));
-			KNOTE_UNLOCKED(&ifp->if_klist, link);
-		}
+		if (ifv->ifv_p == ifp)
+			if_link_state_change(&ifv->ifv_if,
+			    ifv->ifv_p->if_link_state);
 	}
 	VLAN_UNLOCK();
 }

==== //depot/projects/davidxu_thread/src/sys/netgraph/ng_eiface.c#5 (text+ko) ====

@@ -25,7 +25,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/netgraph/ng_eiface.c,v 1.29 2005/03/14 20:49:48 glebius Exp $
+ * $FreeBSD: src/sys/netgraph/ng_eiface.c,v 1.30 2005/04/20 12:22:33 glebius Exp $
  */
 
 #include <sys/param.h>
@@ -74,7 +74,7 @@
 /* Node private data */
 struct ng_eiface_private {
 	struct arpcom	arpcom;		/* per-interface network data */
-	struct ifnet	*ifp;		/* This interface */
+#define	sc_ifp		arpcom.ac_if
 	int		unit;		/* Interface unit number */
 	node_p		node;		/* Our netgraph node */
 	hook_p		ether;		/* Hook for ethernet stream */
@@ -188,7 +188,7 @@
 ng_eiface_init(void *xsc)
 {
 	priv_p sc = xsc;
-	struct ifnet *ifp = sc->ifp;
+	struct ifnet *ifp = &sc->sc_ifp;
 	int s;
 
 	s = splimp();
@@ -339,7 +339,6 @@
 
 	/* Link them together */
 	ifp->if_softc = priv;
-	priv->ifp = ifp;
 
 	/* Get an interface unit number */
 	priv->unit = alloc_unr(ng_eiface_unit);
@@ -397,7 +396,7 @@
 ng_eiface_rcvmsg(node_p node, item_p item, hook_p lasthook)
 {
 	const priv_p priv = NG_NODE_PRIVATE(node);
-	struct ifnet *const ifp = priv->ifp;
+	struct ifnet *const ifp = &priv->sc_ifp;
 	struct ng_mesg *resp = NULL;
 	int error = 0;
 	struct ng_mesg *msg;
@@ -510,7 +509,7 @@
 ng_eiface_rcvdata(hook_p hook, item_p item)
 {
 	const priv_p priv = NG_NODE_PRIVATE(NG_HOOK_NODE(hook));
-	struct ifnet *const ifp = priv->ifp;
+	struct ifnet *const ifp = &priv->sc_ifp;
 	struct mbuf *m;
 
 	NGI_GET_M(item, m);
@@ -547,7 +546,7 @@
 ng_eiface_rmnode(node_p node)
 {
 	const priv_p priv = NG_NODE_PRIVATE(node);
-	struct ifnet *const ifp = priv->ifp;
+	struct ifnet *const ifp = &priv->sc_ifp;
 
 	ether_ifdetach(ifp);
 	free_unr(ng_eiface_unit, priv->unit);

==== //depot/projects/davidxu_thread/src/sys/netgraph/ng_message.h#3 (text+ko) ====

@@ -37,7 +37,7 @@
  *
  * Author: Julian Elischer <julian at freebsd.org>
  *
- * $FreeBSD: src/sys/netgraph/ng_message.h,v 1.26 2005/02/05 23:23:14 glebius Exp $
+ * $FreeBSD: src/sys/netgraph/ng_message.h,v 1.27 2005/04/20 12:18:22 glebius Exp $
  * $Whistle: ng_message.h,v 1.12 1999/01/25 01:17:44 archie Exp $
  */
 
@@ -405,7 +405,28 @@
 	    sizeof((rsp)->header.cmdstr));				\
 	  (rsp)->header.flags |= NGF_RESP;				\
 	} while (0)
+
+/*
+ * Make a copy of message. Sets "copy" to NULL if fails.
+ */
+#define	NG_COPYMESSAGE(copy, msg, how)					\
+	do {								\
+	  MALLOC((copy), struct ng_mesg *, sizeof(struct ng_mesg) +	\
+	    (msg)->header.arglen, M_NETGRAPH_MSG, (how) | M_ZERO);	\
+	  if ((copy) == NULL)						\
+	    break;							\
+	  (copy)->header.version = NG_VERSION;				\
+	  (copy)->header.arglen = (msg)->header.arglen;			\
+	  (copy)->header.token = (msg)->header.token;			\
+	  (copy)->header.typecookie = (msg)->header.typecookie;		\
+	  (copy)->header.cmd = (msg)->header.cmd;			\
+	  (copy)->header.flags = (msg)->header.flags;			\
+	  bcopy((msg)->header.cmdstr, (copy)->header.cmdstr,		\
+	    sizeof((copy)->header.cmdstr));				\
+	  if ((msg)->header.arglen > 0)					\
+	    bcopy((msg)->data, (copy)->data, (msg)->header.arglen);	\
+	} while (0)
+
 #endif /* _KERNEL */
 
 #endif /* _NETGRAPH_NG_MESSAGE_H_ */
-

==== //depot/projects/davidxu_thread/src/sys/netinet/ip_carp.c#5 (text+ko) ====

@@ -1,4 +1,4 @@
-/* 	$FreeBSD: src/sys/netinet/ip_carp.c,v 1.22 2005/03/30 11:44:43 glebius Exp $ */
+/* 	$FreeBSD: src/sys/netinet/ip_carp.c,v 1.23 2005/04/20 09:32:05 glebius Exp $ */
 
 /*
  * Copyright (c) 2002 Michael Shalayeff. All rights reserved.
@@ -150,7 +150,6 @@
 	TAILQ_HEAD(, carp_softc) vhif_vrs;
 	int vhif_nvrs;
 
-	struct callout	 cif_tmo;
 	struct ifnet 	*vhif_ifp;
 	struct mtx	 vhif_mtx;
 };
@@ -209,7 +208,6 @@
 
 static int	carp_set_addr(struct carp_softc *, struct sockaddr_in *);
 static int	carp_del_addr(struct carp_softc *, struct sockaddr_in *);
-static void	carp_carpdev_state1(void *);
 static void	carp_carpdev_state_locked(struct carp_if *);
 static void	carp_sc_state_locked(struct carp_softc *);
 #ifdef INET6
@@ -426,7 +424,6 @@
 		CARP_LOCK(cif);
 		TAILQ_REMOVE(&cif->vhif_vrs, sc, sc_list);
 		if (!--cif->vhif_nvrs) {
-			callout_drain(&cif->cif_tmo);
 			sc->sc_carpdev->if_carp = NULL;
 			CARP_LOCK_DESTROY(cif);
 			FREE(cif, M_CARP);
@@ -1428,7 +1425,6 @@
 		CARP_LOCK(cif);
 		cif->vhif_ifp = ifp;
 		TAILQ_INIT(&cif->vhif_vrs);
-		callout_init(&cif->cif_tmo, NET_CALLOUT_MPSAFE);
 		ifp->if_carp = cif;
 
 	} else {
@@ -1505,7 +1501,6 @@
 		imo->imo_multicast_ifp = NULL;
 		TAILQ_REMOVE(&cif->vhif_vrs, sc, sc_list);
 		if (!--cif->vhif_nvrs) {
-			callout_drain(&cif->cif_tmo);
 			sc->sc_carpdev->if_carp = NULL;
 			CARP_LOCK_DESTROY(cif);
 			FREE(cif, M_IFADDR);
@@ -1614,7 +1609,6 @@
 		CARP_LOCK(cif);
 		cif->vhif_ifp = ifp;
 		TAILQ_INIT(&cif->vhif_vrs);
-		callout_init(&cif->cif_tmo, NET_CALLOUT_MPSAFE);
 		ifp->if_carp = cif;
 
 	} else {
@@ -1702,7 +1696,6 @@
 		im6o->im6o_multicast_ifp = NULL;
 		TAILQ_REMOVE(&cif->vhif_vrs, sc, sc_list);
 		if (!--cif->vhif_nvrs) {
-			callout_drain(&cif->cif_tmo);
 			CARP_LOCK_DESTROY(cif);
 			sc->sc_carpdev->if_carp = NULL;
 			FREE(cif, M_IFADDR);
@@ -2056,20 +2049,6 @@
 {
 	struct carp_if *cif = v;
 
-	/*
-	 * We came here from interrupt handler of network
-	 * card. To avoid multiple LORs, we will queue function
-	 * for later.
-	 */
-
-	callout_reset(&cif->cif_tmo, 1, carp_carpdev_state1, v);
-}
-
-void
-carp_carpdev_state1(void *v)
-{
-	struct carp_if *cif = v;
-
 	CARP_LOCK(cif);
 	carp_carpdev_state_locked(cif);
 	CARP_UNLOCK(cif);


More information about the p4-projects mailing list