CVS commit: [netbsd-6] src/sys/arch/powerpc

2015-11-19 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Thu Nov 19 08:50:05 UTC 2015

Modified Files:
src/sys/arch/powerpc/include [netbsd-6]: psl.h userret.h
src/sys/arch/powerpc/oea [netbsd-6]: altivec.c oea_machdep.c
src/sys/arch/powerpc/powerpc [netbsd-6]: fpu.c

Log Message:
Revert ticket 1310 (second try):
> sys/arch/powerpc/include/psl.h1.20
> sys/arch/powerpc/include/userret.h1.29, 1.30
> sys/arch/powerpc/oea/altivec.c1.30
> sys/arch/powerpc/oea/oea_machdep.c1.72
> sys/arch/powerpc/powerpc/fpu.c1.36
>
>   powerpc PCU fixes

because it breaks the build:
http://releng.netbsd.org/builds/netbsd-6/201511152000Z/


To generate a diff of this commit:
cvs rdiff -u -r1.18.8.2 -r1.18.8.3 src/sys/arch/powerpc/include/psl.h
cvs rdiff -u -r1.22.8.3 -r1.22.8.4 src/sys/arch/powerpc/include/userret.h
cvs rdiff -u -r1.25.8.2 -r1.25.8.3 src/sys/arch/powerpc/oea/altivec.c
cvs rdiff -u -r1.63.2.2 -r1.63.2.3 src/sys/arch/powerpc/oea/oea_machdep.c
cvs rdiff -u -r1.31.8.2 -r1.31.8.3 src/sys/arch/powerpc/powerpc/fpu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/powerpc/include/psl.h
diff -u src/sys/arch/powerpc/include/psl.h:1.18.8.2 src/sys/arch/powerpc/include/psl.h:1.18.8.3
--- src/sys/arch/powerpc/include/psl.h:1.18.8.2	Mon Nov 16 09:00:01 2015
+++ src/sys/arch/powerpc/include/psl.h	Thu Nov 19 08:50:05 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: psl.h,v 1.18.8.2 2015/11/16 09:00:01 bouyer Exp $	*/
+/*	$NetBSD: psl.h,v 1.18.8.3 2015/11/19 08:50:05 bouyer Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -102,8 +102,7 @@
 #include "opt_ppcarch.h"
 #endif /* _KERNEL_OPT */
 
-#if defined(PPC_OEA) || defined (PPC_OEA64_BRIDGE) || defined (PPC_OEA64) \
-|| defined(_MODULE)
+#if defined(PPC_OEA) || defined (PPC_OEA64_BRIDGE) || defined(_MODULE)
 extern register_t cpu_psluserset, cpu_pslusermod, cpu_pslusermask;
 
 #define	PSL_USERSET		cpu_psluserset
@@ -112,7 +111,7 @@ extern register_t cpu_psluserset, cpu_ps
 #elif defined(PPC_BOOKE)
 #define	PSL_USERSET		(PSL_EE | PSL_PR | PSL_IS | PSL_DS | PSL_ME | PSL_CE | PSL_DE)
 #define	PSL_USERMASK		(PSL_SPV | PSL_CE | 0x)
-#define	PSL_USERMOD		(0)
+#define	PSL_USERMOD		(PSL_SPV)
 #else /* PPC_IBM4XX */
 #ifdef PPC_IBM403
 #define	PSL_USERSET		(PSL_EE | PSL_PR | PSL_IR | PSL_DR | PSL_ME)

Index: src/sys/arch/powerpc/include/userret.h
diff -u src/sys/arch/powerpc/include/userret.h:1.22.8.3 src/sys/arch/powerpc/include/userret.h:1.22.8.4
--- src/sys/arch/powerpc/include/userret.h:1.22.8.3	Mon Nov 16 09:00:01 2015
+++ src/sys/arch/powerpc/include/userret.h	Thu Nov 19 08:50:05 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: userret.h,v 1.22.8.3 2015/11/16 09:00:01 bouyer Exp $	*/
+/*	$NetBSD: userret.h,v 1.22.8.4 2015/11/19 08:50:05 bouyer Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -58,16 +58,7 @@ userret(struct lwp *l, struct trapframe 
 	/* Invoke MI userret code */
 	mi_userret(l);
 
-	KASSERTMSG((tf->tf_srr1 & PSL_PR) != 0,
-	"tf=%p: srr1 (%#lx): PSL_PR isn't set!",
-	tf, tf->tf_srr1);
-	KASSERTMSG((tf->tf_srr1 & PSL_FP) == 0
-	|| l->l_cpu->ci_data.cpu_pcu_curlwp[PCU_FPU] == l,
-	"tf=%p: srr1 (%#lx): PSL_FP set but FPU curlwp %p is not curlwp %p!",
-	tf, tf->tf_srr1, l->l_cpu->ci_data.cpu_pcu_curlwp[PCU_FPU], l);
-
-	/* clear SRR1 status bits */
-	tf->tf_srr1 &= (PSL_USERSRR1|PSL_FP|PSL_VEC);
+	tf->tf_srr1 &= PSL_USERSRR1;	/* clear SRR1 status bits */
 
 #ifdef ALTIVEC
 	/*
@@ -79,12 +70,12 @@ userret(struct lwp *l, struct trapframe 
 #endif
 #ifdef PPC_BOOKE
 	/*
-	 * BookE doesn't have PSL_SE but it does have a debug instruction
-	 * completion exception but it needs PSL_DE to fire.  Instead we
-	 * use IAC1/IAC2 to match the next PC.
+	 * BookE doesn't PSL_SE but it does have a debug instruction completion
+	 * exception but it needs PSL_DE to fire.  Since we don't want it to
+	 * happen in the kernel, we must disable PSL_DE and let it get
+	 * restored by rfi/rfci.
 	 */
 	if (__predict_false(tf->tf_srr1 & PSL_SE)) {
-		tf->tf_srr1 &= ~PSL_SE;
 		extern void booke_sstep(struct trapframe *); /* ugly */
 		booke_sstep(tf);
 	}

Index: src/sys/arch/powerpc/oea/altivec.c
diff -u src/sys/arch/powerpc/oea/altivec.c:1.25.8.2 src/sys/arch/powerpc/oea/altivec.c:1.25.8.3
--- src/sys/arch/powerpc/oea/altivec.c:1.25.8.2	Mon Nov 16 09:00:01 2015
+++ src/sys/arch/powerpc/oea/altivec.c	Thu Nov 19 08:50:05 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: altivec.c,v 1.25.8.2 2015/11/16 09:00:01 bouyer Exp $	*/
+/*	$NetBSD: altivec.c,v 1.25.8.3 2015/11/19 08:50:05 bouyer Exp $	*/
 
 /*
  * Copyright (C) 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: altivec.c,v 1.25.8.2 2015/11/16 09:00:01 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: altivec.c,v 1.25.8.3 2015/11/19 08:50:05 bouyer Exp $");
 
 

CVS commit: src/lib/libc/stdio

2015-11-19 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Nov 19 10:03:26 UTC 2015

Modified Files:
src/lib/libc/stdio: printf.3

Log Message:
Remove duplicated 'i' from list of numeric formats


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/lib/libc/stdio/printf.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/stdio/printf.3
diff -u src/lib/libc/stdio/printf.3:1.64 src/lib/libc/stdio/printf.3:1.65
--- src/lib/libc/stdio/printf.3:1.64	Mon Sep 29 14:58:33 2014
+++ src/lib/libc/stdio/printf.3	Thu Nov 19 10:03:26 2015
@@ -1,4 +1,4 @@
-.\"	$NetBSD: printf.3,v 1.64 2014/09/29 14:58:33 christos Exp $
+.\"	$NetBSD: printf.3,v 1.65 2015/11/19 10:03:26 pgoyette Exp $
 .\"
 .\" Copyright (c) 1990, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -33,7 +33,7 @@
 .\"
 .\" @(#)printf.3	8.1 (Berkeley) 6/4/93
 .\"
-.Dd September 29, 2014
+.Dd November 19, 2015
 .Dt PRINTF 3
 .Os
 .Sh NAME
@@ -279,7 +279,6 @@ If a precision is given with a numeric c
 .Cm i ,
 .Cm o ,
 .Cm u ,
-.Cm i ,
 .Cm x ,
 and
 .Cm X ) ,



CVS commit: src/sys/dev/isapnp

2015-11-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov 19 19:16:10 UTC 2015

Modified Files:
src/sys/dev/isapnp: isapnpdevs

Log Message:
Add another le board.


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/dev/isapnp/isapnpdevs

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/isapnp/isapnpdevs
diff -u src/sys/dev/isapnp/isapnpdevs:1.68 src/sys/dev/isapnp/isapnpdevs:1.69
--- src/sys/dev/isapnp/isapnpdevs:1.68	Wed Jan 21 09:22:46 2009
+++ src/sys/dev/isapnp/isapnpdevs	Thu Nov 19 14:16:10 2015
@@ -1,4 +1,4 @@
-$NetBSD: isapnpdevs,v 1.68 2009/01/21 14:22:46 jnemeth Exp $
+$NetBSD: isapnpdevs,v 1.69 2015/11/19 19:16:10 christos Exp $
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -184,6 +184,7 @@ devlogic	le	TKN0010		0	Lance Ethernet on
 devlogic	le	ATK1500		0	Lance Ethernet on Allied Telesyn board
 devlogic	le	CSI2203		0	Cabletron E22xx
 devlogic	le	BUF0001		0	Melco Inc. LGY-IV
+devlogic	le	SKD8000		0	SysKonnect SK-NET Flash
 
 /*
  * mpu



CVS commit: src/sys/arch/arm/allwinner

2015-11-19 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Thu Nov 19 18:48:22 UTC 2015

Modified Files:
src/sys/arch/arm/allwinner: awin_debe.c awin_hdmi.c awin_hdmiaudio.c
awin_tcon.c awin_var.h

Log Message:
Turn off video output on WSDISPLAYIO_SVIDEO.
For LCD/LVDS, just stop the tcon0.
For HDMI, turn off tcon and hdmi (so that the monitor goes to sleeo)
if the audio output is inactive.
For this, add a lock-protected refcount in awin_hdmi, incremented when
audio and/or video is active.
Tested with an audio-enabled HDMI display.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/arm/allwinner/awin_debe.c \
src/sys/arch/arm/allwinner/awin_hdmi.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/allwinner/awin_hdmiaudio.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/allwinner/awin_tcon.c
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/arm/allwinner/awin_var.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/allwinner/awin_debe.c
diff -u src/sys/arch/arm/allwinner/awin_debe.c:1.18 src/sys/arch/arm/allwinner/awin_debe.c:1.19
--- src/sys/arch/arm/allwinner/awin_debe.c:1.18	Tue Nov  3 18:38:03 2015
+++ src/sys/arch/arm/allwinner/awin_debe.c	Thu Nov 19 18:48:22 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: awin_debe.c,v 1.18 2015/11/03 18:38:03 bouyer Exp $ */
+/* $NetBSD: awin_debe.c,v 1.19 2015/11/19 18:48:22 bouyer Exp $ */
 
 /*-
  * Copyright (c) 2014 Jared D. McNeill 
@@ -37,7 +37,7 @@
 #define AWIN_DEBE_CURMAX	64
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: awin_debe.c,v 1.18 2015/11/03 18:38:03 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: awin_debe.c,v 1.19 2015/11/19 18:48:22 bouyer Exp $");
 
 #include 
 #include 
@@ -583,6 +583,10 @@ awin_debe_ioctl(device_t self, u_long cm
 		enable = *(int *)data;
 		val = DEBE_READ(sc, AWIN_DEBE_MODCTL_REG);
 		if (enable) {
+			if (val & AWIN_DEBE_MODCTL_LAY0_EN) {
+/* already enabled */
+return 0;
+			}
 			val |= AWIN_DEBE_MODCTL_LAY0_EN;
 			if (sc->sc_cursor_enable) {
 val |= AWIN_DEBE_MODCTL_HWC_EN;
@@ -590,10 +594,16 @@ awin_debe_ioctl(device_t self, u_long cm
 val &= ~AWIN_DEBE_MODCTL_HWC_EN;
 			}
 		} else {
+			if ((val & AWIN_DEBE_MODCTL_LAY0_EN) == 0) {
+/* already disabled */
+return 0;
+			}
 			val &= ~AWIN_DEBE_MODCTL_LAY0_EN;
 			val &= ~AWIN_DEBE_MODCTL_HWC_EN;
 		}
 		DEBE_WRITE(sc, AWIN_DEBE_MODCTL_REG, val);
+		/* debe0 always connected to tcon0, debe1 to tcon1*/
+		awin_tcon_setvideo(device_unit(sc->sc_dev), enable);
 		return 0;
 	case WSDISPLAYIO_GVIDEO:
 		val = DEBE_READ(sc, AWIN_DEBE_MODCTL_REG);
Index: src/sys/arch/arm/allwinner/awin_hdmi.c
diff -u src/sys/arch/arm/allwinner/awin_hdmi.c:1.18 src/sys/arch/arm/allwinner/awin_hdmi.c:1.19
--- src/sys/arch/arm/allwinner/awin_hdmi.c:1.18	Sun Nov 15 21:28:54 2015
+++ src/sys/arch/arm/allwinner/awin_hdmi.c	Thu Nov 19 18:48:22 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: awin_hdmi.c,v 1.18 2015/11/15 21:28:54 bouyer Exp $ */
+/* $NetBSD: awin_hdmi.c,v 1.19 2015/11/19 18:48:22 bouyer Exp $ */
 
 /*-
  * Copyright (c) 2014 Jared D. McNeill 
@@ -30,7 +30,7 @@
 #include "opt_ddb.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: awin_hdmi.c,v 1.18 2015/11/15 21:28:54 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: awin_hdmi.c,v 1.19 2015/11/19 18:48:22 bouyer Exp $");
 
 #include 
 #include 
@@ -74,6 +74,9 @@ struct awin_hdmi_softc {
 	int   sc_tcon_unit;
 	unsigned int sc_tcon_pll;
 
+	kmutex_t sc_pwr_lock;
+	int	sc_pwr_refcount; /* reference who needs HDMI */
+
 	uint32_t sc_ver;
 	unsigned int sc_i2c_blklen;
 };
@@ -219,6 +222,9 @@ awin_hdmi_attach(device_t parent, device
 	aprint_normal_dev(self, "interrupting on irq %d\n", loc->loc_intr);
 #endif
 
+	mutex_init(>sc_pwr_lock, MUTEX_DEFAULT, IPL_NONE);
+	sc->sc_pwr_refcount = 1; /* we start with video powered on */
+
 	awin_hdmi_i2c_init(sc);
 
 	awin_hdmi_enable(sc);
@@ -990,6 +996,36 @@ awin_hdmi_get_info(struct awin_hdmi_info
 	}
 }
 
+void
+awin_hdmi_poweron(bool enable)
+{
+	struct awin_hdmi_softc *sc;
+	device_t dev;
+
+	dev = device_find_by_driver_unit("awinhdmi", 0);
+	if (dev == NULL) {
+		return;
+	}
+	sc = device_private(dev);
+	mutex_enter(>sc_pwr_lock);
+	if (enable) {
+		KASSERT(sc->sc_pwr_refcount >= 0);
+		if (sc->sc_pwr_refcount == 0) {
+			awin_tcon1_enable(sc->sc_tcon_unit, true);
+			awin_hdmi_video_enable(sc, true);
+		}
+		sc->sc_pwr_refcount++;
+	} else {
+		sc->sc_pwr_refcount--;
+		KASSERT(sc->sc_pwr_refcount >= 0);
+		if (sc->sc_pwr_refcount == 0) {
+			awin_hdmi_video_enable(sc, false);
+			awin_tcon1_enable(sc->sc_tcon_unit, false);
+		}
+	}
+	mutex_exit(>sc_pwr_lock);
+}
+
 #if defined(DDB)
 void
 awin_hdmi_dump_regs(void)

Index: src/sys/arch/arm/allwinner/awin_hdmiaudio.c
diff -u src/sys/arch/arm/allwinner/awin_hdmiaudio.c:1.5 src/sys/arch/arm/allwinner/awin_hdmiaudio.c:1.6
--- src/sys/arch/arm/allwinner/awin_hdmiaudio.c:1.5	Tue Nov 18 01:53:53 

CVS commit: src/sys/dev/isapnp

2015-11-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov 19 19:16:28 UTC 2015

Modified Files:
src/sys/dev/isapnp: isapnpdevs.c isapnpdevs.h

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/dev/isapnp/isapnpdevs.c
cvs rdiff -u -r1.66 -r1.67 src/sys/dev/isapnp/isapnpdevs.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/isapnp/isapnpdevs.c
diff -u src/sys/dev/isapnp/isapnpdevs.c:1.71 src/sys/dev/isapnp/isapnpdevs.c:1.72
--- src/sys/dev/isapnp/isapnpdevs.c:1.71	Mon Apr 28 16:23:53 2008
+++ src/sys/dev/isapnp/isapnpdevs.c	Thu Nov 19 14:16:28 2015
@@ -1,10 +1,10 @@
-/*	$NetBSD: isapnpdevs.c,v 1.71 2008/04/28 20:23:53 martin Exp $	*/
+/*	$NetBSD: isapnpdevs.c,v 1.72 2015/11/19 19:16:28 christos Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: isapnpdevs,v 1.66 2008/04/20 13:24:34 tsutsui Exp
+ *	NetBSD: isapnpdevs,v 1.69 2015/11/19 19:16:10 christos Exp
  */
 
 /*-
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: isapnpdevs.c,v 1.71 2008/04/28 20:23:53 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isapnpdevs.c,v 1.72 2015/11/19 19:16:28 christos Exp $");
 
 #include 
 #include 
@@ -224,9 +224,10 @@ static const struct isapnp_matchinfo isa
 	{"ATK1500", 0},	/* Lance Ethernet on Allied Telesyn board */
 	{"CSI2203", 0},	/* Cabletron E22xx */
 	{"BUF0001", 0},	/* Melco Inc. LGY-IV */
+	{"SKD8000", 0},	/* SysKonnect SK-NET Flash */
 };
 const struct isapnp_devinfo isapnp_le_devinfo = {
-	isapnp_le_devlogic, 4,
+	isapnp_le_devlogic, 5,
 	NULL, 0,
 };
 

Index: src/sys/dev/isapnp/isapnpdevs.h
diff -u src/sys/dev/isapnp/isapnpdevs.h:1.66 src/sys/dev/isapnp/isapnpdevs.h:1.67
--- src/sys/dev/isapnp/isapnpdevs.h:1.66	Mon Apr 28 16:23:53 2008
+++ src/sys/dev/isapnp/isapnpdevs.h	Thu Nov 19 14:16:28 2015
@@ -1,10 +1,10 @@
-/*	$NetBSD: isapnpdevs.h,v 1.66 2008/04/28 20:23:53 martin Exp $	*/
+/*	$NetBSD: isapnpdevs.h,v 1.67 2015/11/19 19:16:28 christos Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: isapnpdevs,v 1.66 2008/04/20 13:24:34 tsutsui Exp
+ *	NetBSD: isapnpdevs,v 1.69 2015/11/19 19:16:10 christos Exp
  */
 
 
@@ -38,6 +38,11 @@
  */
 
 /*
+ * Use "make -f Makefile.isapnpdevs" to regenerate isapnpdevs.h and
+ * isapnpdevs.c
+ */
+
+/*
  * List of known drivers
  */
 struct isapnp_matchinfo {



CVS commit: src/share/man/man4

2015-11-19 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Nov 20 00:40:18 UTC 2015

Modified Files:
src/share/man/man4: filemon.4

Log Message:
Minor cleanup in example code - use FD_CLOEXEC instead of magic number


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/share/man/man4/filemon.4

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/man/man4/filemon.4
diff -u src/share/man/man4/filemon.4:1.8 src/share/man/man4/filemon.4:1.9
--- src/share/man/man4/filemon.4:1.8	Sat Apr 21 12:27:28 2012
+++ src/share/man/man4/filemon.4	Fri Nov 20 00:40:18 2015
@@ -1,4 +1,4 @@
-.\"	$NetBSD: filemon.4,v 1.8 2012/04/21 12:27:28 roy Exp $
+.\"	$NetBSD: filemon.4,v 1.9 2015/11/20 00:40:18 pgoyette Exp $
 .\"
 .\" Copyright (c) 2011, Juniper Networks, Inc.
 .\"
@@ -23,7 +23,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.
 .\"
-.Dd April 5, 2012
+.Dd November 20, 2015
 .Dt FILEMON 4
 .Os
 .Sh NAME
@@ -150,8 +150,8 @@ temp_fd = mkstemp("/tmp/filemon.XXX"
 /* give filemon the temp file to use */
 ioctl(filemon_fd, FILEMON_SET_FD, _fd);
 /* children do not need these once they exec */
-fcntl(filemon_fd, F_SETFD, 1);
-fcntl(temp_fd, F_SETFD, 1);
+fcntl(filemon_fd, F_SETFD, FD_CLOEXEC);
+fcntl(temp_fd, F_SETFD, FD_CLOEXEC);
 
 pid = fork();
 switch(pid) {



CVS commit: src/sys/dev/filemon

2015-11-19 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Nov 20 01:21:05 UTC 2015

Modified Files:
src/sys/dev/filemon: filemon.c

Log Message:
Don't allow setting the PID-to-trace if the target has a non-native
emulation.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/filemon/filemon.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/filemon/filemon.c
diff -u src/sys/dev/filemon/filemon.c:1.12 src/sys/dev/filemon/filemon.c:1.13
--- src/sys/dev/filemon/filemon.c:1.12	Fri Nov 20 01:12:38 2015
+++ src/sys/dev/filemon/filemon.c	Fri Nov 20 01:21:05 2015
@@ -24,7 +24,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: filemon.c,v 1.12 2015/11/20 01:12:38 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: filemon.c,v 1.13 2015/11/20 01:21:05 pgoyette Exp $");
 
 #include 
 #include 
@@ -308,7 +308,8 @@ filemon_ioctl(struct file * fp, u_long c
 		mutex_enter(proc_lock);
 		tp = proc_find(*((pid_t *) data));
 		mutex_exit(proc_lock);
-		if (tp == NULL) {
+		if (tp == NULL ||
+		tp->p_emul != _netbsd)) {
 			error = ESRCH;
 			break;
 		}



CVS commit: src/sys/dev/filemon

2015-11-19 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Nov 20 01:12:38 UTC 2015

Modified Files:
src/sys/dev/filemon: filemon.c

Log Message:
Don't initialize twice.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/filemon/filemon.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/filemon/filemon.c
diff -u src/sys/dev/filemon/filemon.c:1.11 src/sys/dev/filemon/filemon.c:1.12
--- src/sys/dev/filemon/filemon.c:1.11	Thu Aug 20 14:40:17 2015
+++ src/sys/dev/filemon/filemon.c	Fri Nov 20 01:12:38 2015
@@ -24,7 +24,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: filemon.c,v 1.11 2015/08/20 14:40:17 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: filemon.c,v 1.12 2015/11/20 01:12:38 pgoyette Exp $");
 
 #include 
 #include 
@@ -344,7 +344,14 @@ filemon_load(void *dummy __unused)
 void
 filemonattach(int num)
 {
-filemon_load(NULL);
+
+	/*
+	 * Don't call filemon_load() here - it will be called from
+	 * filemon_modcmd() during module initialization.
+	 */
+#if 0
+	filemon_load(NULL);
+#endif
 }
 
 



CVS commit: src/sys/dev/filemon

2015-11-19 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Nov 20 01:16:04 UTC 2015

Modified Files:
src/sys/dev/filemon: filemon_wrapper.c

Log Message:
Install wrapper functions only in native emulation.

(This also removes the dependency on curproc, which may not be available
at the time that built-in kernel modules are initialized.)


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/filemon/filemon_wrapper.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/filemon/filemon_wrapper.c
diff -u src/sys/dev/filemon/filemon_wrapper.c:1.7 src/sys/dev/filemon/filemon_wrapper.c:1.8
--- src/sys/dev/filemon/filemon_wrapper.c:1.7	Mon Jun 15 19:45:31 2015
+++ src/sys/dev/filemon/filemon_wrapper.c	Fri Nov 20 01:16:04 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: filemon_wrapper.c,v 1.7 2015/06/15 19:45:31 christos Exp $	*/
+/*	$NetBSD: filemon_wrapper.c,v 1.8 2015/11/20 01:16:04 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 2010, Juniper Networks, Inc.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: filemon_wrapper.c,v 1.7 2015/06/15 19:45:31 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: filemon_wrapper.c,v 1.8 2015/11/20 01:16:04 pgoyette Exp $");
 
 #include 
 #include 
@@ -354,7 +354,7 @@ out:
 void
 filemon_wrapper_install(void)
 {
-	struct sysent *sv_table = curproc->p_emul->e_sysent;
+	struct sysent *sv_table = emul_netbsd.e_sysent;
 
 	sv_table[SYS_chdir].sy_call = (sy_call_t *) filemon_wrapper_chdir;
 	sv_table[SYS_execve].sy_call = (sy_call_t *) filemon_wrapper_execve;
@@ -372,7 +372,7 @@ filemon_wrapper_install(void)
 int
 filemon_wrapper_deinstall(void)
 {
-	struct sysent *sv_table = curproc->p_emul->e_sysent;
+	struct sysent *sv_table = emul_netbsd.e_sysent;
 
 	if (sv_table[SYS_chdir].sy_call != (sy_call_t *) filemon_wrapper_chdir)
 	return EBUSY;



CVS commit: src/sys/dev/filemon

2015-11-19 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Nov 20 01:33:59 UTC 2015

Modified Files:
src/sys/dev/filemon: filemon.c

Log Message:
Remove extra ')' (bad cut)


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/filemon/filemon.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/filemon/filemon.c
diff -u src/sys/dev/filemon/filemon.c:1.13 src/sys/dev/filemon/filemon.c:1.14
--- src/sys/dev/filemon/filemon.c:1.13	Fri Nov 20 01:21:05 2015
+++ src/sys/dev/filemon/filemon.c	Fri Nov 20 01:33:59 2015
@@ -24,7 +24,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: filemon.c,v 1.13 2015/11/20 01:21:05 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: filemon.c,v 1.14 2015/11/20 01:33:59 pgoyette Exp $");
 
 #include 
 #include 
@@ -309,7 +309,7 @@ filemon_ioctl(struct file * fp, u_long c
 		tp = proc_find(*((pid_t *) data));
 		mutex_exit(proc_lock);
 		if (tp == NULL ||
-		tp->p_emul != _netbsd)) {
+		tp->p_emul != _netbsd) {
 			error = ESRCH;
 			break;
 		}



CVS commit: src/include

2015-11-19 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Thu Nov 19 20:34:47 UTC 2015

Modified Files:
src/include: ucontext.h

Log Message:
Fix ANSI-C prototype error


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/include/ucontext.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/include/ucontext.h
diff -u src/include/ucontext.h:1.7 src/include/ucontext.h:1.8
--- src/include/ucontext.h:1.7	Sat Nov  5 09:27:06 2011
+++ src/include/ucontext.h	Thu Nov 19 20:34:47 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: ucontext.h,v 1.7 2011/11/05 09:27:06 joerg Exp $	*/
+/*	$NetBSD: ucontext.h,v 1.8 2015/11/19 20:34:47 reinoud Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 __BEGIN_DECLS
 int	getcontext(ucontext_t *) __returns_twice;
 int	setcontext(const ucontext_t *);
-void	makecontext(ucontext_t *, void (*)(), int, ...);
+void	makecontext(ucontext_t *, void (*)(void), int, ...);
 int	swapcontext(ucontext_t * __restrict, const ucontext_t * __restrict);
 __END_DECLS
 



CVS commit: src/include

2015-11-19 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Thu Nov 19 20:57:49 UTC 2015

Modified Files:
src/include: ucontext.h

Log Message:
Revert


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/include/ucontext.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/include/ucontext.h
diff -u src/include/ucontext.h:1.8 src/include/ucontext.h:1.9
--- src/include/ucontext.h:1.8	Thu Nov 19 20:34:47 2015
+++ src/include/ucontext.h	Thu Nov 19 20:57:49 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: ucontext.h,v 1.8 2015/11/19 20:34:47 reinoud Exp $	*/
+/*	$NetBSD: ucontext.h,v 1.9 2015/11/19 20:57:49 reinoud Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 __BEGIN_DECLS
 int	getcontext(ucontext_t *) __returns_twice;
 int	setcontext(const ucontext_t *);
-void	makecontext(ucontext_t *, void (*)(void), int, ...);
+void	makecontext(ucontext_t *, void (*)(), int, ...);
 int	swapcontext(ucontext_t * __restrict, const ucontext_t * __restrict);
 __END_DECLS
 



CVS commit: src/sys/arch

2015-11-19 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Nov 19 22:09:16 UTC 2015

Modified Files:
src/sys/arch/arm/nvidia: files.tegra tegra_ehci.c tegra_io.c
tegra_pcie.c tegra_reg.h tegra_soc.c tegra_usbphy.c tegra_var.h
src/sys/arch/evbarm/conf: JETSONTK1
src/sys/arch/evbarm/tegra: tegra_machdep.c

Log Message:
Remove HOST1X and AHB_A2 from pmap_devmap


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/arm/nvidia/files.tegra
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/nvidia/tegra_ehci.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/arm/nvidia/tegra_io.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/nvidia/tegra_pcie.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/arm/nvidia/tegra_reg.h
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/nvidia/tegra_soc.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/nvidia/tegra_usbphy.c
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/arm/nvidia/tegra_var.h
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/evbarm/conf/JETSONTK1
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/evbarm/tegra/tegra_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/nvidia/files.tegra
diff -u src/sys/arch/arm/nvidia/files.tegra:1.21 src/sys/arch/arm/nvidia/files.tegra:1.22
--- src/sys/arch/arm/nvidia/files.tegra:1.21	Thu Nov 12 00:43:52 2015
+++ src/sys/arch/arm/nvidia/files.tegra	Thu Nov 19 22:09:16 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: files.tegra,v 1.21 2015/11/12 00:43:52 jmcneill Exp $
+#	$NetBSD: files.tegra,v 1.22 2015/11/19 22:09:16 jmcneill Exp $
 #
 # Configuration info for NVIDIA Tegra ARM Peripherals
 #
@@ -72,12 +72,14 @@ attach	tegrartc at tegraio with tegra_rt
 file	arch/arm/nvidia/tegra_rtc.c		tegra_rtc
 
 # USB PHY
+define	tegrausbphybus { }
 device	tegrausbphy
-attach	tegrausbphy at tegraio with tegra_usbphy
+attach	tegrausbphy at tegrausbphybus with tegra_usbphy
 file	arch/arm/nvidia/tegra_usbphy.c		tegra_usbphy
 
 # USB 2.0
-attach	ehci at tegraio with tegra_ehci
+device	tegraehci: usbus, usbroothub, usb_dma, ehci, tegrausbphybus
+attach	tegraehci at tegraio with tegra_ehci
 file	arch/arm/nvidia/tegra_ehci.c		tegra_ehci
 
 # SDMMC

Index: src/sys/arch/arm/nvidia/tegra_ehci.c
diff -u src/sys/arch/arm/nvidia/tegra_ehci.c:1.9 src/sys/arch/arm/nvidia/tegra_ehci.c:1.10
--- src/sys/arch/arm/nvidia/tegra_ehci.c:1.9	Wed Oct 21 20:02:12 2015
+++ src/sys/arch/arm/nvidia/tegra_ehci.c	Thu Nov 19 22:09:16 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_ehci.c,v 1.9 2015/10/21 20:02:12 jmcneill Exp $ */
+/* $NetBSD: tegra_ehci.c,v 1.10 2015/11/19 22:09:16 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -29,7 +29,7 @@
 #include "locators.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tegra_ehci.c,v 1.9 2015/10/21 20:02:12 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra_ehci.c,v 1.10 2015/11/19 22:09:16 jmcneill Exp $");
 
 #include 
 #include 
@@ -45,6 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: tegra_ehci.c
 #include 
 #include 
 
+#include 
 #include 
 #include 
 
@@ -61,6 +62,8 @@ struct tegra_ehci_softc {
 	bus_space_handle_t	sc_bsh;
 	void			*sc_ih;
 	u_int			sc_port;
+
+	device_t		sc_usbphydev;
 };
 
 static int	tegra_ehci_port_status(struct ehci_softc *sc, uint32_t v,
@@ -82,11 +85,16 @@ tegra_ehci_attach(device_t parent, devic
 	struct tegra_ehci_softc * const sc = device_private(self);
 	struct tegraio_attach_args * const tio = aux;
 	const struct tegra_locators * const loc = >tio_loc;
+	struct tegrausbphy_attach_args tup;
 	int error;
 
 	sc->sc_bst = tio->tio_bst;
-	bus_space_subregion(tio->tio_bst, tio->tio_bsh,
-	loc->loc_offset, loc->loc_size, >sc_bsh);
+	error = bus_space_map(sc->sc_bst, TEGRA_AHB_A2_BASE + loc->loc_offset,
+	loc->loc_size, 0, >sc_bsh);
+	if (error) {
+		aprint_error(": couldn't map USB%d\n", loc->loc_port + 1);
+		return;
+	}
 	sc->sc_port = loc->loc_port;
 
 	sc->sc.sc_dev = self;
@@ -97,11 +105,10 @@ tegra_ehci_attach(device_t parent, devic
 	sc->sc.sc_flags = EHCIF_ETTF;
 	sc->sc.sc_id_vendor = 0x10de;
 	strlcpy(sc->sc.sc_vendor, "Tegra", sizeof(sc->sc.sc_vendor));
-	sc->sc.sc_size = loc->loc_size;
-	sc->sc.iot = tio->tio_bst;
-	bus_space_subregion(tio->tio_bst, tio->tio_bsh,
-	loc->loc_offset + TEGRA_EHCI_REG_OFFSET,
-	loc->loc_size - TEGRA_EHCI_REG_OFFSET, >sc.ioh);
+	sc->sc.sc_size = loc->loc_size - TEGRA_EHCI_REG_OFFSET;
+	sc->sc.iot = sc->sc_bst;
+	bus_space_subregion(sc->sc_bst, sc->sc_bsh, TEGRA_EHCI_REG_OFFSET,
+	sc->sc.sc_size, >sc.ioh);
 	sc->sc.sc_vendor_init = tegra_ehci_init;
 	sc->sc.sc_vendor_port_status = tegra_ehci_port_status;
 
@@ -119,6 +126,11 @@ tegra_ehci_attach(device_t parent, devic
 	}
 	aprint_normal_dev(self, "interrupting on irq %d\n", loc->loc_intr);
 
+	tup.tup_bst = sc->sc_bst;
+	tup.tup_bsh = sc->sc_bsh;
+	tup.tup_port = sc->sc_port;
+	sc->sc_usbphydev = config_found_ia(self, "tegrausbphybus", , NULL);
+
 	error = ehci_init(>sc);
 	if (error != 

CVS commit: src/sys/arch/arm/nvidia

2015-11-19 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Nov 19 22:26:48 UTC 2015

Modified Files:
src/sys/arch/arm/nvidia: tegra_car.c

Log Message:
aprint_verbose_dev -> aprint_debug_dev


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/arm/nvidia/tegra_car.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/nvidia/tegra_car.c
diff -u src/sys/arch/arm/nvidia/tegra_car.c:1.27 src/sys/arch/arm/nvidia/tegra_car.c:1.28
--- src/sys/arch/arm/nvidia/tegra_car.c:1.27	Sat Oct 17 21:16:09 2015
+++ src/sys/arch/arm/nvidia/tegra_car.c	Thu Nov 19 22:26:48 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_car.c,v 1.27 2015/10/17 21:16:09 jmcneill Exp $ */
+/* $NetBSD: tegra_car.c,v 1.28 2015/11/19 22:26:48 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -29,7 +29,7 @@
 #include "locators.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tegra_car.c,v 1.27 2015/10/17 21:16:09 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra_car.c,v 1.28 2015/11/19 22:26:48 jmcneill Exp $");
 
 #include 
 #include 
@@ -96,12 +96,12 @@ tegra_car_attach(device_t parent, device
 
 	tegra_car_init(sc);
 
-	aprint_verbose_dev(self, "PLLX = %u Hz\n", tegra_car_pllx_rate());
-	aprint_verbose_dev(self, "PLLC = %u Hz\n", tegra_car_pllc_rate());
-	aprint_verbose_dev(self, "PLLE = %u Hz\n", tegra_car_plle_rate());
-	aprint_verbose_dev(self, "PLLU = %u Hz\n", tegra_car_pllu_rate());
-	aprint_verbose_dev(self, "PLLP0 = %u Hz\n", tegra_car_pllp0_rate());
-	aprint_verbose_dev(self, "PLLD2 = %u Hz\n", tegra_car_plld2_rate());
+	aprint_debug_dev(self, "PLLX = %u Hz\n", tegra_car_pllx_rate());
+	aprint_debug_dev(self, "PLLC = %u Hz\n", tegra_car_pllc_rate());
+	aprint_debug_dev(self, "PLLE = %u Hz\n", tegra_car_plle_rate());
+	aprint_debug_dev(self, "PLLU = %u Hz\n", tegra_car_pllu_rate());
+	aprint_debug_dev(self, "PLLP0 = %u Hz\n", tegra_car_pllp0_rate());
+	aprint_debug_dev(self, "PLLD2 = %u Hz\n", tegra_car_plld2_rate());
 
 	config_interrupts(self, tegra_car_rnd_attach);
 }



CVS commit: src/tests/net/net

2015-11-19 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Thu Nov 19 10:45:10 UTC 2015

Modified Files:
src/tests/net/net: t_ipv6address.sh

Log Message:
Set timeout of ping6 to reduce execution time


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/net/net/t_ipv6address.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/net/t_ipv6address.sh
diff -u src/tests/net/net/t_ipv6address.sh:1.1 src/tests/net/net/t_ipv6address.sh:1.2
--- src/tests/net/net/t_ipv6address.sh:1.1	Thu Nov 12 05:05:25 2015
+++ src/tests/net/net/t_ipv6address.sh	Thu Nov 19 10:45:09 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ipv6address.sh,v 1.1 2015/11/12 05:05:25 ozaki-r Exp $
+#	$NetBSD: t_ipv6address.sh,v 1.2 2015/11/19 10:45:09 ozaki-r Exp $
 #
 # Copyright (c) 2015 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -41,6 +41,7 @@ BUSSRC=bus_src
 BUSDST=bus_dst
 
 DEBUG=false
+TIMEOUT=3
 
 atf_test_case linklocal cleanup
 
@@ -227,10 +228,10 @@ linklocal_body()
 	# link local address to link local address
 
 	atf_check -s not-exit:0 -e match:"No route to host" \
-		rump.ping6 -c 1 -n ${fwd_if0_lladdr}
+	rump.ping6 -c 1 -X $TIMEOUT -n ${fwd_if0_lladdr}
 
 	atf_check -s exit:0 -o match:"0.0% packet loss" \
-	rump.ping6 -c 1 -n ${fwd_if0_lladdr}%shmif0
+	rump.ping6 -c 1 -X $TIMEOUT -n ${fwd_if0_lladdr}%shmif0
 
 	atf_check -s ignore -o empty -e ignore \
 	-x "shmif_dumpbus -p - ${BUSSRC} | tcpdump -r - -n -p icmp6"
@@ -240,7 +241,8 @@ linklocal_body()
 	cleanup_bus
 
 	atf_check -s not-exit:0 -o ignore -e ignore \
-	rump.ping6 -c 1 -n -S ${src_if1_lladdr}%shmif1 ${fwd_if0_lladdr}%shmif0
+	rump.ping6 -c 1 -X $TIMEOUT -n -S ${src_if1_lladdr}%shmif1 \
+	${fwd_if0_lladdr}%shmif0
 	atf_check -s ignore -o not-match:"${src_if1_lladdr}" -e ignore \
 	-x "shmif_dumpbus -p - ${BUS1} | tcpdump -r - -n -p icmp6"
 	$DEBUG && shmif_dumpbus -p - ${BUS1} | tcpdump -r - -n -p icmp6
@@ -259,15 +261,15 @@ linklocal_body()
 
 	$DEBUG && rump.ifconfig shmif0
 	atf_check -s exit:0 -o match:"0.0% packet loss" \
-	rump.ping6 -c 1 -n -S ${src_if0_lladdr}%shmif0 ${IP6FWD0}
+	rump.ping6 -c 1 -X $TIMEOUT -n -S ${src_if0_lladdr}%shmif0 ${IP6FWD0}
 	unset RUMP_SERVER
 
 	export RUMP_SERVER=${SOCKFWD}
 	# host address to link local address
 	atf_check -s exit:0 -o match:"0.0% packet loss" \
-	rump.ping6 -c 1 -n ${src_if0_lladdr}%shmif0
+	rump.ping6 -c 1 -X $TIMEOUT -n ${src_if0_lladdr}%shmif0
 	atf_check -s not-exit:0 -o match:"100.0% packet loss" \
-	rump.ping6 -c 1 -n ${src_if1_lladdr}%shmif0
+	rump.ping6 -c 1 -X $TIMEOUT -n ${src_if1_lladdr}%shmif0
 
 	atf_check -s exit:0 rump.ifconfig shmif0 inet6 ${IP6FWD0} delete
 
@@ -277,19 +279,19 @@ linklocal_body()
 	setup_route
 
 	export RUMP_SERVER=${SOCKSRC}
-	atf_check -s exit:0 -o match:"0.0% packet loss" rump.ping6 -c 1 -n \
-	-S ${IP6SRC} ${IP6DST}
+	atf_check -s exit:0 -o match:"0.0% packet loss" rump.ping6 -c 1 \
+	-X $TIMEOUT -n -S ${IP6SRC} ${IP6DST}
 
 	cleanup_bus
 	$DEBUG && rump.ifconfig shmif0
-	atf_check -s not-exit:0 -o match:"100.0% packet loss" rump.ping6 -c 1 -n \
-	-S ${src_if0_lladdr}%shmif0 ${IP6DST}
+	atf_check -s not-exit:0 -o match:"100.0% packet loss" rump.ping6 -c 1 \
+	-X $TIMEOUT -n -S ${src_if0_lladdr}%shmif0 ${IP6DST}
 	atf_check -s ignore -o not-match:"${src_if0_lladdr}" -e ignore \
 	-x "shmif_dumpbus -p - ${BUS2} | tcpdump -r - -n -p icmp6"
 
 	cleanup_bus
-	atf_check -s not-exit:0 -o match:"100.0% packet loss" rump.ping6 -c 1 -n \
-	-S ${IP6SRC} ${dst_if0_lladdr}%shmif0
+	atf_check -s not-exit:0 -o match:"100.0% packet loss" rump.ping6 -c 1 \
+	-X $TIMEOUT -n -S ${IP6SRC} ${dst_if0_lladdr}%shmif0
 	atf_check -s ignore -o not-empty -e ignore \
 	-x "shmif_dumpbus -p - ${BUS2} | tcpdump -r - -n -p icmp6"
 



CVS commit: src/sys/dev/filemon

2015-11-19 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Nov 20 02:58:19 UTC 2015

Modified Files:
src/sys/dev/filemon: filemon.c

Log Message:
Ensure that the PID specified in the FILEMON_SET_PID ioctl() call
belongs to the caller or one of its descendants.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/filemon/filemon.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/filemon/filemon.c
diff -u src/sys/dev/filemon/filemon.c:1.14 src/sys/dev/filemon/filemon.c:1.15
--- src/sys/dev/filemon/filemon.c:1.14	Fri Nov 20 01:33:59 2015
+++ src/sys/dev/filemon/filemon.c	Fri Nov 20 02:58:19 2015
@@ -24,7 +24,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: filemon.c,v 1.14 2015/11/20 01:33:59 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: filemon.c,v 1.15 2015/11/20 02:58:19 pgoyette Exp $");
 
 #include 
 #include 
@@ -278,7 +278,7 @@ filemon_ioctl(struct file * fp, u_long c
 {
 	int error = 0;
 	struct filemon *filemon;
-	struct proc *tp;
+	struct proc *tp, *lp, *p;
 
 #ifdef DEBUG
 	log(logLevel, "filemon_ioctl(%lu)", cmd);;
@@ -313,6 +313,26 @@ filemon_ioctl(struct file * fp, u_long c
 			error = ESRCH;
 			break;
 		}
+
+		/* Ensure that target proc is a descendant of curproc */
+		p = tp;
+		while (p) {
+			/*
+			 * make sure p cannot exit
+			 * until we have moved on to p_pptr
+			 */
+			rw_enter(>p_reflock, RW_READER);
+			if (p == curproc) {
+rw_exit(>p_reflock);
+break;
+			}
+			lp = p;
+			p = p->p_pptr;
+			rw_exit(>p_reflock);
+		}
+		if (p == NULL)
+			return EPERM;
+
 		error = kauth_authorize_process(curproc->p_cred,
 		KAUTH_PROCESS_CANSEE, tp,
 		KAUTH_ARG(KAUTH_REQ_PROCESS_CANSEE_ENTRY), NULL, NULL);



CVS commit: src/share/man/man4

2015-11-19 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Nov 20 03:13:35 UTC 2015

Modified Files:
src/share/man/man4: filemon.4

Log Message:
Update for recent filemon(4) changes, and add additional information on
invoking filemon.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/share/man/man4/filemon.4

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/man/man4/filemon.4
diff -u src/share/man/man4/filemon.4:1.9 src/share/man/man4/filemon.4:1.10
--- src/share/man/man4/filemon.4:1.9	Fri Nov 20 00:40:18 2015
+++ src/share/man/man4/filemon.4	Fri Nov 20 03:13:35 2015
@@ -1,4 +1,4 @@
-.\"	$NetBSD: filemon.4,v 1.9 2015/11/20 00:40:18 pgoyette Exp $
+.\"	$NetBSD: filemon.4,v 1.10 2015/11/20 03:13:35 pgoyette Exp $
 .\"
 .\" Copyright (c) 2011, Juniper Networks, Inc.
 .\"
@@ -30,10 +30,29 @@
 .Nm filemon
 .Nd track interesting system calls
 .Sh SYNOPSIS
-.In filemon.h
+.Cd "pseudo-device filemon"
 .Sh DESCRIPTION
+In normal situations,
 .Nm
-provides a means for tracking the successful system calls performed by a process.
+is not built-in to the kernel, and a call to open /dev/filemon will
+auto-load the
+.Nm
+module (see
+.Xr module 7
+for more details).
+.Pp
+(Although not recommended, the
+.Nm
+facility can be included in a kernel build by adding
+.Bd -literal -offset indent
+pseudo-device filemon
+.Ed
+.Pp
+to the kernel configuration file.)
+.Pp
+.Nm
+provides a means for tracking the successful system calls performed by
+a process and its descendants.
 It is used by
 .Xr make 1
 to track the activities of build scripts, for the purpose of automatically
@@ -188,3 +207,13 @@ successful, and is thus more complex to 
 .Sh HISTORY
 .Nm
 was contributed by Juniper Networks.
+.Sh RESTRICTIONS
+The
+.Nm
+facility can only be used to track processes running in the system's
+native emulation.
+Neither processes using any of the COMPAT_xxx compatability layers nor
+any descendants of such processes can be tracked.
+.Pp
+Additionally, the procces_id specified with FILEMON_SET_PID must refer to
+a descendant of the calling process.



CVS commit: src/tests/net/if

2015-11-19 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Nov 20 05:05:40 UTC 2015

Modified Files:
src/tests/net/if: t_ifconfig.sh

Log Message:
Set timeout of ping to reduce execution time


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/net/if/t_ifconfig.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/if/t_ifconfig.sh
diff -u src/tests/net/if/t_ifconfig.sh:1.5 src/tests/net/if/t_ifconfig.sh:1.6
--- src/tests/net/if/t_ifconfig.sh:1.5	Fri Nov  6 02:54:37 2015
+++ src/tests/net/if/t_ifconfig.sh	Fri Nov 20 05:05:40 2015
@@ -1,4 +1,4 @@
-# $NetBSD: t_ifconfig.sh,v 1.5 2015/11/06 02:54:37 ozaki-r Exp $
+# $NetBSD: t_ifconfig.sh,v 1.6 2015/11/20 05:05:40 ozaki-r Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -31,6 +31,8 @@ RUMP_SERVER2=unix://./r2
 RUMP_FLAGS=\
 "-lrumpnet -lrumpnet_net -lrumpnet_netinet -lrumpnet_netinet6 -lrumpnet_shmif"
 
+TIMEOUT=3
+
 atf_test_case create_destroy cleanup
 create_destroy_head()
 {
@@ -119,7 +121,7 @@ options_body()
 	atf_check -s exit:0 -o ignore rump.ifconfig -m shmif0
 	atf_check -s exit:0 -o match:'localhost' rump.ifconfig -N lo0
 	atf_check -s exit:0 -o match:'0 packets' rump.ifconfig -v lo0
-	atf_check -s exit:0 -o ignore rump.ping -c 1 localhost
+	atf_check -s exit:0 -o ignore rump.ping -c 1 -w $TIMEOUT localhost
 	#   -z clears and shows statistics at that point
 	atf_check -s exit:0 -o match:'2 packets' rump.ifconfig -z lo0
 	atf_check -s exit:0 -o match:'0 packets' rump.ifconfig -v lo0
@@ -149,7 +151,7 @@ options_body()
 	atf_check -s exit:0 -o not-match:'shmif0' rump.ifconfig -a -u
 	atf_check -s exit:0 -o ignore rump.ifconfig shmif0 up
 	atf_check -s exit:0 -o match:'0 packets' rump.ifconfig -a -v
-	atf_check -s exit:0 -o ignore rump.ping -c 1 localhost
+	atf_check -s exit:0 -o ignore rump.ping -c 1 -w $TIMEOUT localhost
 	atf_check -s exit:0 -o ignore rump.ifconfig shmif0 down
 	atf_check -s exit:0 -o match:'2 packets' rump.ifconfig -a -z
 	atf_check -s exit:0 -o not-match:'2 packets' rump.ifconfig -a -v
@@ -220,9 +222,10 @@ parameters_body()
 	rump.ifconfig shmif0
 	# down, up
 	atf_check -s exit:0 rump.ifconfig shmif0 down
-	atf_check -s ignore -o ignore -e match:'down' rump.ping -c 1 -n 192.168.0.2
+	atf_check -s ignore -o ignore -e match:'down' rump.ping -c 1 \
+	-w $TIMEOUT -n 192.168.0.2
 	atf_check -s exit:0 rump.ifconfig shmif0 up
-	atf_check -s exit:0 -o ignore rump.ping -c 1 -n 192.168.0.2
+	atf_check -s exit:0 -o ignore rump.ping -c 1 -w $TIMEOUT -n 192.168.0.2
 
 	# alias
 	atf_check -s exit:0 rump.ifconfig shmif0 inet 192.168.1.1/24 alias
@@ -250,7 +253,7 @@ parameters_body()
 	# arp
 	atf_check -s exit:0 rump.ifconfig shmif0 -arp
 	atf_check -s not-exit:0 -o ignore -e ignore \
-	rump.ping -c 1 -n 192.168.0.3
+	rump.ping -c 1 -w $TIMEOUT -n 192.168.0.3
 	atf_check -s exit:0 -o not-match:'192.168.0.3' rump.arp -an
 
 	# netmask



CVS commit: src/sys/net

2015-11-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov 19 16:23:54 UTC 2015

Modified Files:
src/sys/net: if_bridge.c if_ether.h if_ethersubr.c if_vlan.c

Log Message:
Add handling of VLAN packets in if_bridge where the parent interface supports
them (jean-jacques.p...@espci.fr). Factor out the vlan_mtu enabling and
disabling code.


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.105 src/sys/net/if_bridge.c
cvs rdiff -u -r1.64 -r1.65 src/sys/net/if_ether.h
cvs rdiff -u -r1.214 -r1.215 src/sys/net/if_ethersubr.c
cvs rdiff -u -r1.82 -r1.83 src/sys/net/if_vlan.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/net/if_bridge.c
diff -u src/sys/net/if_bridge.c:1.104 src/sys/net/if_bridge.c:1.105
--- src/sys/net/if_bridge.c:1.104	Tue Oct 20 10:46:45 2015
+++ src/sys/net/if_bridge.c	Thu Nov 19 11:23:54 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bridge.c,v 1.104 2015/10/20 14:46:45 maxv Exp $	*/
+/*	$NetBSD: if_bridge.c,v 1.105 2015/11/19 16:23:54 christos Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -80,7 +80,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.104 2015/10/20 14:46:45 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.105 2015/11/19 16:23:54 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_bridge_ipf.h"
@@ -893,6 +893,8 @@ bridge_ioctl_add(struct bridge_softc *sc
 
 	switch (ifs->if_type) {
 	case IFT_ETHER:
+		if ((error = ether_enable_vlan_mtu(ifs)) > 0)
+			goto out;
 		/*
 		 * Place the interface into promiscuous mode.
 		 */
@@ -970,6 +972,7 @@ bridge_ioctl_del(struct bridge_softc *sc
 		 * Don't call it with holding a spin lock.
 		 */
 		(void) ifpromisc(ifs, 0);
+		(void) ether_disable_vlan_mtu(ifs);
 		break;
 	default:
 #ifdef DIAGNOSTIC

Index: src/sys/net/if_ether.h
diff -u src/sys/net/if_ether.h:1.64 src/sys/net/if_ether.h:1.65
--- src/sys/net/if_ether.h:1.64	Mon Jul 28 10:24:48 2014
+++ src/sys/net/if_ether.h	Thu Nov 19 11:23:54 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ether.h,v 1.64 2014/07/28 14:24:48 ozaki-r Exp $	*/
+/*	$NetBSD: if_ether.h,v 1.65 2015/11/19 16:23:54 christos Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -337,6 +337,8 @@ uint32_t ether_crc32_le(const uint8_t *,
 uint32_t ether_crc32_be(const uint8_t *, size_t);
 
 int	ether_aton_r(u_char *, size_t, const char *);
+int	ether_enable_vlan_mtu(struct ifnet *);
+int	ether_disable_vlan_mtu(struct ifnet *);
 #else
 /*
  * Prototype ethers(3) functions.

Index: src/sys/net/if_ethersubr.c
diff -u src/sys/net/if_ethersubr.c:1.214 src/sys/net/if_ethersubr.c:1.215
--- src/sys/net/if_ethersubr.c:1.214	Tue Oct 13 08:33:07 2015
+++ src/sys/net/if_ethersubr.c	Thu Nov 19 11:23:54 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ethersubr.c,v 1.214 2015/10/13 12:33:07 roy Exp $	*/
+/*	$NetBSD: if_ethersubr.c,v 1.215 2015/11/19 16:23:54 christos Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.214 2015/10/13 12:33:07 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.215 2015/11/19 16:23:54 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1416,6 +1416,75 @@ ether_ioctl(struct ifnet *ifp, u_long cm
 	return 0;
 }
 
+/*
+ * Enable/disable passing VLAN packets if the parent interface supports it.
+ * Return:
+ * 	 0: Ok
+ *	-1: Parent interface does not support vlans
+ *	>0: Error
+ */
+int
+ether_enable_vlan_mtu(struct ifnet *ifp)
+{
+	int error;
+	struct ethercom *ec = (void *)ifp;
+
+	/* Already have VLAN's do nothing. */
+	if (ec->ec_nvlans != 0)
+		return 0;
+
+	/* Parent does not support VLAN's */
+	if ((ec->ec_capabilities & ETHERCAP_VLAN_MTU) == 0)
+		return -1;
+
+	/*
+	 * Parent supports the VLAN_MTU capability,
+	 * i.e. can Tx/Rx larger than ETHER_MAX_LEN frames;
+	 * enable it.
+	 */
+	ec->ec_capenable |= ETHERCAP_VLAN_MTU;
+
+	/* Interface is down, defer for later */
+	if ((ifp->if_flags & IFF_UP) == 0)
+		return 0;
+
+	if ((error = if_flags_set(ifp, ifp->if_flags)) == 0)
+		return 0;
+
+	ec->ec_capenable &= ~ETHERCAP_VLAN_MTU;
+	return error;
+}
+
+int
+ether_disable_vlan_mtu(struct ifnet *ifp)
+{
+	int error;
+	struct ethercom *ec = (void *)ifp;
+
+	/* We still have VLAN's, defer for later */
+	if (ec->ec_nvlans != 0)
+		return 0;
+
+	/* Parent does not support VLAB's, nothing to do. */
+	if ((ec->ec_capenable & ETHERCAP_VLAN_MTU) == 0)
+		return -1;
+
+	/*
+	 * Disable Tx/Rx of VLAN-sized frames.
+	 */
+	ec->ec_capenable &= ~ETHERCAP_VLAN_MTU;
+	
+	/* Interface is down, defer for later */
+	if ((ifp->if_flags & IFF_UP) == 0)
+		return 0;
+
+	if ((error = if_flags_set(ifp, ifp->if_flags)) == 0)
+		return 0;
+
+	ec->ec_capenable |= ETHERCAP_VLAN_MTU;
+	return error;
+}
+
 static int
 ether_multicast_sysctl(SYSCTLFN_ARGS)
 {

Index: src/sys/net/if_vlan.c
diff -u src/sys/net/if_vlan.c:1.82 src/sys/net/if_vlan.c:1.83
--- 

CVS commit: src/doc/roadmaps

2015-11-19 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Fri Nov 20 07:20:21 UTC 2015

Modified Files:
src/doc/roadmaps: storage

Log Message:
Update the storage roadmap. Please review/comment...


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/doc/roadmaps/storage

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/roadmaps/storage
diff -u src/doc/roadmaps/storage:1.9 src/doc/roadmaps/storage:1.10
--- src/doc/roadmaps/storage:1.9	Sat Jan 14 22:06:16 2012
+++ src/doc/roadmaps/storage	Fri Nov 20 07:20:21 2015
@@ -1,174 +1,358 @@
-$NetBSD: storage,v 1.9 2012/01/14 22:06:16 agc Exp $
+$NetBSD: storage,v 1.10 2015/11/20 07:20:21 dholland Exp $
 
 NetBSD Storage Roadmap
 ==
 
 This is a small roadmap document, and deals with the storage and file
-systems side of the operating system.
+systems side of the operating system. It discusses elements, projects,
+and goals that are under development or under discussion; and it is
+divided into three categories based on perceived priority.
+
+The following elements, projects, and goals are considered strategic
+priorities for the project:
+
+ 1. Improving iscsi
+ 2. nfsv4 support
+ 3. A better journaling file system solution
+ 4. Getting zfs working for real
+ 5. Seamless full-disk encryption
+
+The following elements, projects, and goals are not strategic
+priorities but are still important undertakings worth doing:
+
+ 6. lfs64
+ 7. Per-process namespaces
+ 8. lvm tidyup
+ 9. Flash translation layer
+ 10. Shingled disk support
+ 11. ext3/ext4 support
+ 12. Port hammer from Dragonfly
+ 13. afs maintenance
+ 14. execute-in-place
+
+The following elements, projects, and goals are perhaps less pressing;
+this doesn't mean one shouldn't work on them but the expected payoff
+is perhaps less than for other things:
 
-The following elements and projects are pencilled in for 6.0, but
-please do not rely on them being there.
+ 15. coda maintenance
 
-Features that will be in 6.0:
-2. logical volume management
-3. a native port of Sun's ZFS
-4. ReFUSE, perfuse and pud
-6. Support for flash devices - NAND, and flash file system
-7. rump extensions
-9. in-kernel iSCSI initiator
-10. RAIDframe parity map
-11. quota system re-work
 
-Features that are planned for future releases:
-1. devfs/udevfsd
-5. web-based management tools for storage subsystems
-8. virtualised disks in userland
-12. lfs renovation
+Explanations
+
 
-We'll continue to update this roadmap as features and dates get firmed up.
-
-Some explanations
-=
-
-1. udevfsd
---
-
-There has always been discussion over devfs, and experience with it
-seems mixed (to be kind). At the same time, carrying around a whole
-populated /dev seems quite possible and effective, but maybe a bit
-unwieldy. jmcneill's udevfsd addresses this in a different way, and
-is currently in othersrc/external/bsd/udevfsd. Not planned for 6.0
-right now.
-
-Responsible: jmcneill
-
-2. Logical Volume Management
-
-
-Based on the Linux lvm2 and devmapper software, with a new kernel component
-for NetBSD written. Merged in 5.99.5 sources, will be in 6.0.
-
-Responsible: haad, martin
-
-3. Native port of Sun's ZFS

-
-Two Summer of Code projects have been held, concentrating on the
-provision of ZFS support for NetBSD.  Mostly completed by haad, and
-building on ver's work, this is the port of Sun's ZFS, with
-modifications to make it compile on NetBSD by ad@, and based on the
-Sun code for the block layer. Discussions are still taking place to
-get the design right for support for the openat(2) system call family,
-and the correct architecture for reclaiming vnodes.
-
-The ZFS source code has been committed to the repository.
-
-Responsible: haad, ad, ver
-
-4. ReFUSE, perfuse and pud
---
-
-FUSE has two interfaces, the normal high-level one, and a lower-level
-interface which is closer to the way standard file systems operate. 
-manu's perfuse adds the low-level functionality in the same way that
-ReFUSE adds the high-level functionality.  In addition, there is the
-"pass to userspace device" framework added by pooka as part of rump. 
-All 3 will be in 6.0.
-
-Responsible: pooka, manu, agc
-
-5. Web-based Management tools for Storage Subsystems
-
-
-Standard tools for managing the storage subsystems that NetBSD
-provides, using a standard web-server as the basic user interface on
-the storage device, allowing remote management by a standard web
-browser.  CIM and related functinoality are interesting datapoints in
-this space, although credentials and authentication are always
-challenges in this space. Will not make it into 6.0
-
-Responsible: agc
-
-6. Support for flash devices - NAND, and flash file system

CVS commit: src/sys/sys

2015-11-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov 19 17:04:01 UTC 2015

Modified Files:
src/sys/sys: cdefs.h

Log Message:
long line police


To generate a diff of this commit:
cvs rdiff -u -r1.127 -r1.128 src/sys/sys/cdefs.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/sys/cdefs.h
diff -u src/sys/sys/cdefs.h:1.127 src/sys/sys/cdefs.h:1.128
--- src/sys/sys/cdefs.h:1.127	Wed Oct 14 11:52:40 2015
+++ src/sys/sys/cdefs.h	Thu Nov 19 12:04:01 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: cdefs.h,v 1.127 2015/10/14 15:52:40 christos Exp $	*/
+/*	$NetBSD: cdefs.h,v 1.128 2015/11/19 17:04:01 christos Exp $	*/
 
 /* * Copyright (c) 1991, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -560,7 +560,8 @@
 #ifndef __ASSEMBLER__
 /* __BIT(n): nth bit, where __BIT(0) == 0x1. */
 #define	__BIT(__n)	\
-(((uintmax_t)(__n) >= NBBY * sizeof(uintmax_t)) ? 0 : ((uintmax_t)1 << (uintmax_t)((__n) & (NBBY * sizeof(uintmax_t) - 1
+(((uintmax_t)(__n) >= NBBY * sizeof(uintmax_t)) ? 0 : \
+((uintmax_t)1 << (uintmax_t)((__n) & (NBBY * sizeof(uintmax_t) - 1
 
 /* __BITS(m, n): bits m through n, m < n. */
 #define	__BITS(__m, __n)	\



CVS commit: src/sys/arch/xen/xen

2015-11-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov 19 17:01:40 UTC 2015

Modified Files:
src/sys/arch/xen/xen: if_xennet_xenbus.c xennetback_xenbus.c

Log Message:
Enable the VLAN mtu capability and check for the adjusted packet size
(Jean-Jacques.Puig at espci.fr).
Factor out the packet-size checking function for clarity.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/xen/xen/if_xennet_xenbus.c
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/xen/xen/xennetback_xenbus.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/xen/xen/if_xennet_xenbus.c
diff -u src/sys/arch/xen/xen/if_xennet_xenbus.c:1.64 src/sys/arch/xen/xen/if_xennet_xenbus.c:1.65
--- src/sys/arch/xen/xen/if_xennet_xenbus.c:1.64	Mon Apr 13 17:18:40 2015
+++ src/sys/arch/xen/xen/if_xennet_xenbus.c	Thu Nov 19 12:01:40 2015
@@ -1,4 +1,4 @@
-/*  $NetBSD: if_xennet_xenbus.c,v 1.64 2015/04/13 21:18:40 riastradh Exp $  */
+/*  $NetBSD: if_xennet_xenbus.c,v 1.65 2015/11/19 17:01:40 christos Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -85,7 +85,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.64 2015/04/13 21:18:40 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.65 2015/11/19 17:01:40 christos Exp $");
 
 #include "opt_xen.h"
 #include "opt_nfs_boot.h"
@@ -362,6 +362,7 @@ xennet_xenbus_attach(device_t parent, de
 	ether_sprintf(sc->sc_enaddr));
 	/* Initialize ifnet structure and attach interface */
 	strlcpy(ifp->if_xname, device_xname(self), IFNAMSIZ);
+	sc->sc_ethercom.ec_capabilities |= ETHERCAP_VLAN_MTU;
 	ifp->if_softc = sc;
 	ifp->if_start = xennet_start;
 	ifp->if_ioctl = xennet_ioctl;

Index: src/sys/arch/xen/xen/xennetback_xenbus.c
diff -u src/sys/arch/xen/xen/xennetback_xenbus.c:1.52 src/sys/arch/xen/xen/xennetback_xenbus.c:1.53
--- src/sys/arch/xen/xen/xennetback_xenbus.c:1.52	Sun Oct 20 07:37:53 2013
+++ src/sys/arch/xen/xen/xennetback_xenbus.c	Thu Nov 19 12:01:40 2015
@@ -1,4 +1,4 @@
-/*  $NetBSD: xennetback_xenbus.c,v 1.52 2013/10/20 11:37:53 bouyer Exp $  */
+/*  $NetBSD: xennetback_xenbus.c,v 1.53 2015/11/19 17:01:40 christos Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xennetback_xenbus.c,v 1.52 2013/10/20 11:37:53 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xennetback_xenbus.c,v 1.53 2015/11/19 17:01:40 christos Exp $");
 
 #include "opt_xen.h"
 
@@ -301,6 +301,7 @@ xennetback_xenbus_create(struct xenbus_d
 	/* create pseudo-interface */
 	aprint_verbose_ifnet(ifp, "Ethernet address %s\n",
 	ether_sprintf(xneti->xni_enaddr));
+	xneti->xni_ec.ec_capabilities |= ETHERCAP_VLAN_MTU;
 	ifp->if_flags =
 	IFF_BROADCAST|IFF_SIMPLEX|IFF_NOTRAILERS|IFF_MULTICAST;
 	ifp->if_snd.ifq_maxlen =
@@ -710,6 +711,23 @@ xennetback_tx_response(struct xnetback_i
 	}
 }
 
+static inline const char *
+xennetback_tx_check_packet(const netif_tx_request_t *txreq, int vlan)
+{
+	if (__predict_false(txreq->size < ETHER_HDR_LEN))
+		return "too small";
+
+	if (__predict_false(txreq->offset + txreq->size > PAGE_SIZE))
+		return "crossing a page boundary";
+
+	const int maxlen =
+	vlan ? (ETHER_VLAN_ENCAP_LEN + ETHER_MAX_LEN) : ETHER_MAX_LEN;
+	if (__predict_false(txreq->size > maxlen))
+		return "too big";
+
+	return NULL;
+}
+
 static int
 xennetback_evthandler(void *arg)
 {
@@ -745,28 +763,21 @@ xennetback_evthandler(void *arg)
 			NETIF_RSP_DROPPED);
 			continue;
 		}
+
 		/*
 		 * Do some sanity checks, and map the packet's page.
 		 */
-		if (__predict_false(txreq->size < ETHER_HDR_LEN ||
-		   txreq->size > (ETHER_MAX_LEN - ETHER_CRC_LEN))) {
-			printf("%s: packet size %d too big\n",
-			ifp->if_xname, txreq->size);
-			xennetback_tx_response(xneti, txreq->id,
-			NETIF_RSP_ERROR);
-			ifp->if_ierrors++;
-			continue;
-		}
-		/* don't cross page boundaries */
-		if (__predict_false(
-		txreq->offset + txreq->size > PAGE_SIZE)) {
-			printf("%s: packet cross page boundary\n",
-			ifp->if_xname);
+		const char *msg = xennetback_tx_check_packet(txreq,
+		xneti->xni_ec.ec_capenable & ETHERCAP_VLAN_MTU);
+		if (msg) {
+			printf("%s: packet with size %d is %s\n",
+			ifp->if_xname, txreq->size, msg);
 			xennetback_tx_response(xneti, txreq->id,
 			NETIF_RSP_ERROR);
 			ifp->if_ierrors++;
 			continue;
 		}
+
 		/* get a mbuf for this packet */
 		MGETHDR(m, M_DONTWAIT, MT_DATA);
 		if (__predict_false(m == NULL)) {