CVS commit: src/sys/arch/shark/ofw

2017-03-03 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat Mar  4 01:29:27 UTC 2017

Modified Files:
src/sys/arch/shark/ofw: ofw.c

Log Message:
Fix up OFW_DEBUG printfs, particularly regarding newlines and error cases.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/shark/ofw/ofw.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/shark/ofw/ofw.c
diff -u src/sys/arch/shark/ofw/ofw.c:1.66 src/sys/arch/shark/ofw/ofw.c:1.67
--- src/sys/arch/shark/ofw/ofw.c:1.66	Thu Dec 22 14:47:59 2016
+++ src/sys/arch/shark/ofw/ofw.c	Sat Mar  4 01:29:27 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofw.c,v 1.66 2016/12/22 14:47:59 cherry Exp $	*/
+/*	$NetBSD: ofw.c,v 1.67 2017/03/04 01:29:27 jakllsch Exp $	*/
 
 /*
  * Copyright 1997
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofw.c,v 1.66 2016/12/22 14:47:59 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw.c,v 1.67 2017/03/04 01:29:27 jakllsch Exp $");
 
 #include 
 #include 
@@ -1755,8 +1755,12 @@ ofw_gettranslation(vaddr_t va)
 #endif
 	exists = 0;	/* gets set to true if translation exists */
 	if (OF_call_method("translate", mmu_ihandle, 1, 3, va, , ,
-	) != 0)
+	) != 0) {
+#ifdef OFW_DEBUG
+		printf("(failed)\n");
+#endif
 		return(-1);
+	}
 
 #ifdef OFW_DEBUG
 	printf("%d %x\n", exists, (uint32_t)pa);
@@ -1771,7 +1775,7 @@ ofw_settranslation(vaddr_t va, paddr_t p
 	int mmu_ihandle = ofw_mmu_ihandle();
 
 #ifdef OFW_DEBUG
-	printf("ofw_settranslation (%x, %x, %x, %x) --> void", (uint32_t)va,
+	printf("ofw_settranslation (%x, %x, %x, %x) --> void\n", (uint32_t)va,
 	(uint32_t)pa, (uint32_t)size, (uint32_t)mode);
 #endif
 	if (OF_call_method("map", mmu_ihandle, 4, 0, pa, va, size, mode) != 0)



CVS commit: src/sys/arch/sparc64/dev

2017-03-03 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Fri Mar  3 21:09:25 UTC 2017

Modified Files:
src/sys/arch/sparc64/dev: ldc.c vdsk.c

Log Message:
sun4v: Fixed PR 51554 - Avoid unsafe allocation in ldc/vdsk


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/sparc64/dev/ldc.c \
src/sys/arch/sparc64/dev/vdsk.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/sparc64/dev/ldc.c
diff -u src/sys/arch/sparc64/dev/ldc.c:1.2 src/sys/arch/sparc64/dev/ldc.c:1.3
--- src/sys/arch/sparc64/dev/ldc.c:1.2	Sat Aug 20 18:21:18 2016
+++ src/sys/arch/sparc64/dev/ldc.c	Fri Mar  3 21:09:25 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ldc.c,v 1.2 2016/08/20 18:21:18 nakayama Exp $	*/
+/*	$NetBSD: ldc.c,v 1.3 2017/03/03 21:09:25 palle Exp $	*/
 /*	$OpenBSD: ldc.c,v 1.12 2015/03/21 18:02:58 kettenis Exp $	*/
 /*
  * Copyright (c) 2009 Mark Kettenis
@@ -554,6 +554,8 @@ ldc_queue_alloc(int nentries)
 		goto unmap;
 #else
 	 va = (vaddr_t)kmem_zalloc(size, KM_NOSLEEP);
+	 if (va == 0)
+		goto free;
 #endif
 	lq->lq_va = (vaddr_t)va;
 	lq->lq_nentries = nentries;
@@ -565,6 +567,9 @@ free:
 	bus_dmamem_free(t, >lq_seg, 1);
 destroy:
 	bus_dmamap_destroy(t, lq->lq_map);
+#else
+free:
+	kmem_free(lq, sizeof(struct ldc_queue));
 #endif
 	return (NULL);
 }
@@ -637,6 +642,8 @@ ldc_map_alloc(int nentries)
 	}
 #else
 	va = (vaddr_t)kmem_zalloc(size, KM_NOSLEEP);
+	if (va == 0)
+		goto free;
 #endif
 	lm->lm_slot = (struct ldc_map_slot *)va;
 	lm->lm_nentries = nentries;
@@ -650,6 +657,9 @@ free:
 	bus_dmamem_free(t, >lm_seg, 1);
 destroy:
 	bus_dmamap_destroy(t, lm->lm_map);
+#else
+free:
+	kmem_free(lm, sizeof(struct ldc_map));
 #endif
 	return (NULL);
 }
Index: src/sys/arch/sparc64/dev/vdsk.c
diff -u src/sys/arch/sparc64/dev/vdsk.c:1.2 src/sys/arch/sparc64/dev/vdsk.c:1.3
--- src/sys/arch/sparc64/dev/vdsk.c:1.2	Sat Aug 20 18:21:18 2016
+++ src/sys/arch/sparc64/dev/vdsk.c	Fri Mar  3 21:09:25 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vdsk.c,v 1.2 2016/08/20 18:21:18 nakayama Exp $	*/
+/*	$NetBSD: vdsk.c,v 1.3 2017/03/03 21:09:25 palle Exp $	*/
 /*	$OpenBSD: vdsk.c,v 1.46 2015/01/25 21:42:13 kettenis Exp $	*/
 /*
  * Copyright (c) 2009, 2011 Mark Kettenis
@@ -969,6 +969,8 @@ vdsk_dring_alloc(int nentries)
 		goto unmap;
 #else
 	va = (vaddr_t)kmem_zalloc(size, KM_NOSLEEP);
+	if (va == 0)
+		goto free;
 #endif
 	vd->vd_desc = (struct vd_desc *)va;
 	vd->vd_nentries = nentries;
@@ -984,6 +986,9 @@ free:
 	bus_dmamem_free(t, >vd_seg, 1);
 destroy:
 	bus_dmamap_destroy(t, vd->vd_map);
+#else
+free:
+	kmem_free(vd, sizeof(struct vdsk_dring));
 #endif
 	return (NULL);
 }



CVS commit: src/external/mit/xorg/lib/libICE

2017-03-03 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Mar  3 20:48:02 UTC 2017

Modified Files:
src/external/mit/xorg/lib/libICE: Makefile

Log Message:
define HAVE_ARC4RANDOM_BUF.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/mit/xorg/lib/libICE/Makefile

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

Modified files:

Index: src/external/mit/xorg/lib/libICE/Makefile
diff -u src/external/mit/xorg/lib/libICE/Makefile:1.5 src/external/mit/xorg/lib/libICE/Makefile:1.6
--- src/external/mit/xorg/lib/libICE/Makefile:1.5	Fri May 31 08:18:41 2013
+++ src/external/mit/xorg/lib/libICE/Makefile	Fri Mar  3 20:48:02 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.5 2013/05/31 08:18:41 mrg Exp $
+#	$NetBSD: Makefile,v 1.6 2017/03/03 20:48:02 mrg Exp $
 
 .include 
 
@@ -16,7 +16,7 @@ INCSDIR=${X11INCDIR}/X11/ICE
 CONN_DEFINES=	${X11FLAGS.CONNECTION} -DICE_t=1 -DTRANS_CLIENT -DTRANS_SERVER
 SOCK_DEFINES=	-DBSD44SOCKETS
 
-CPPFLAGS+=	-DHAVE_ASPRINTF
+CPPFLAGS+=	-DHAVE_ASPRINTF -DHAVE_ARC4RANDOM_BUF
 
 CPPFLAGS+=	$(TRANS_INCLUDES) $(CONN_DEFINES) $(SOCK_DEFINES)
 



CVS commit: src/sys/dev/marvell

2017-03-03 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Fri Mar  3 16:52:08 UTC 2017

Modified Files:
src/sys/dev/marvell: mvsdio.c

Log Message:
Add check during mvsdio_attach that CMD line is in idle state.

If the CMD line is not in idle state, the interrupt handler routine will
misbehave causing an endless interrupt handler loop.  This would prevent
the the kernel from getting to mountroot.

On my Pogoplug POGO-V4-A3-01, this was caused by U-Boot routing com1's TX
and RX signals to the SD card slot's CMD and DAT[0] lines respectively.

We should probably grow Marvell SoC MPP (pinmux) configuration frobs.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/marvell/mvsdio.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/marvell/mvsdio.c
diff -u src/sys/dev/marvell/mvsdio.c:1.5 src/sys/dev/marvell/mvsdio.c:1.6
--- src/sys/dev/marvell/mvsdio.c:1.5	Sat Mar 15 13:33:48 2014
+++ src/sys/dev/marvell/mvsdio.c	Fri Mar  3 16:52:08 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvsdio.c,v 1.5 2014/03/15 13:33:48 kiyohara Exp $	*/
+/*	$NetBSD: mvsdio.c,v 1.6 2017/03/03 16:52:08 jakllsch Exp $	*/
 /*
  * Copyright (c) 2010 KIYOHARA Takashi
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mvsdio.c,v 1.5 2014/03/15 13:33:48 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mvsdio.c,v 1.6 2017/03/03 16:52:08 jakllsch Exp $");
 
 #include "opt_mvsdio.h"
 
@@ -157,6 +157,7 @@ mvsdio_attach(device_t parent, device_t 
 	struct marvell_attach_args *mva = aux;
 	struct sdmmcbus_attach_args saa;
 	uint32_t nis, eis;
+	uint32_t hps;
 
 	aprint_naive("\n");
 	aprint_normal(": Marvell Secure Digital Input/Output Interface\n");
@@ -227,6 +228,13 @@ mvsdio_attach(device_t parent, device_t 
 	bus_space_write_4(sc->sc_iot, sc->sc_ioh, MVSDIO_EISE, eis);
 	bus_space_write_4(sc->sc_iot, sc->sc_ioh, MVSDIO_EISIE, eis);
 
+	hps = bus_space_read_4(sc->sc_iot, sc->sc_ioh, MVSDIO_HPS16LSB);
+	if ((hps & HPS16LSB_CMDLEVEL) == 0) {
+		aprint_error_dev(sc->sc_dev,
+		"CMD line not idle, HPS 0x%x (bad MPP config?)\n", hps);
+		return;
+	}
+
 /*
 	 * Attach the generic SD/MMC bus driver.  (The bus driver must
 	 * not invoke any chipset functions before it is attached.)



CVS commit: src/sys/dev/pci

2017-03-03 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Fri Mar  3 16:48:55 UTC 2017

Modified Files:
src/sys/dev/pci: if_wm.c

Log Message:
fix r1.492 bug, sorry


To generate a diff of this commit:
cvs rdiff -u -r1.495 -r1.496 src/sys/dev/pci/if_wm.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/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.495 src/sys/dev/pci/if_wm.c:1.496
--- src/sys/dev/pci/if_wm.c:1.495	Fri Mar  3 07:57:49 2017
+++ src/sys/dev/pci/if_wm.c	Fri Mar  3 16:48:55 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.495 2017/03/03 07:57:49 knakahara Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.496 2017/03/03 16:48:55 knakahara Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -84,7 +84,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.495 2017/03/03 07:57:49 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.496 2017/03/03 16:48:55 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -6619,8 +6619,9 @@ wm_start(struct ifnet *ifp)
 	struct wm_softc *sc = ifp->if_softc;
 	struct wm_txqueue *txq = >sc_queue[0].wmq_txq;
 
+#ifdef WM_MPSAFE
 	KASSERT(ifp->if_extflags & IFEF_START_MPSAFE);
-
+#endif
 	/*
 	 * ifp->if_obytes and ifp->if_omcasts are added in if_transmit()@if.c.
 	 */
@@ -7205,8 +7206,9 @@ wm_nq_start(struct ifnet *ifp)
 	struct wm_softc *sc = ifp->if_softc;
 	struct wm_txqueue *txq = >sc_queue[0].wmq_txq;
 
+#ifdef WM_MPSAFE
 	KASSERT(ifp->if_extflags & IFEF_START_MPSAFE);
-
+#endif
 	/*
 	 * ifp->if_obytes and ifp->if_omcasts are added in if_transmit()@if.c.
 	 */



CVS commit: src/tests/kernel

2017-03-03 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Mar  3 12:23:26 UTC 2017

Modified Files:
src/tests/kernel: t_ptrace_wait.c

Log Message:
Since it is unlikely that any of this really wants to test whether
[v]fork() produces pid==1 (init) (if it were useful to test that, an
entirely different test would be appropriate) change the tests so
they check for [v]fork() failure, as probably intended, instead.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/tests/kernel/t_ptrace_wait.c

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

Modified files:

Index: src/tests/kernel/t_ptrace_wait.c
diff -u src/tests/kernel/t_ptrace_wait.c:1.76 src/tests/kernel/t_ptrace_wait.c:1.77
--- src/tests/kernel/t_ptrace_wait.c:1.76	Wed Mar  1 08:05:15 2017
+++ src/tests/kernel/t_ptrace_wait.c	Fri Mar  3 12:23:26 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.c,v 1.76 2017/03/01 08:05:15 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_wait.c,v 1.77 2017/03/03 12:23:26 kre Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.76 2017/03/01 08:05:15 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.77 2017/03/03 12:23:26 kre Exp $");
 
 #include 
 #include 
@@ -1329,7 +1329,7 @@ ATF_TC_BODY(fork1, tc)
 		printf("Before raising %s from child\n", strsignal(sigval));
 		FORKEE_ASSERT(raise(sigval) == 0);
 
-		FORKEE_ASSERT((child2 = fork()) != 1);
+		FORKEE_ASSERT((child2 = fork()) != -1);
 
 		if (child2 == 0)
 			_exit(exitval2);
@@ -1450,7 +1450,7 @@ ATF_TC_BODY(fork2, tc)
 		printf("Before raising %s from child\n", strsignal(sigval));
 		FORKEE_ASSERT(raise(sigval) == 0);
 
-		FORKEE_ASSERT((child2 = fork()) != 1);
+		FORKEE_ASSERT((child2 = fork()) != -1);
 
 		if (child2 == 0)
 			_exit(exitval2);
@@ -1533,7 +1533,7 @@ ATF_TC_BODY(vfork1, tc)
 		printf("Before raising %s from child\n", strsignal(sigval));
 		FORKEE_ASSERT(raise(sigval) == 0);
 
-		FORKEE_ASSERT((child2 = vfork()) != 1);
+		FORKEE_ASSERT((child2 = vfork()) != -1);
 
 		if (child2 == 0)
 			_exit(exitval2);
@@ -1654,7 +1654,7 @@ ATF_TC_BODY(vfork2, tc)
 		printf("Before raising %s from child\n", strsignal(sigval));
 		FORKEE_ASSERT(raise(sigval) == 0);
 
-		FORKEE_ASSERT((child2 = vfork()) != 1);
+		FORKEE_ASSERT((child2 = vfork()) != -1);
 
 		if (child2 == 0)
 			_exit(exitval2);
@@ -1734,7 +1734,7 @@ ATF_TC_BODY(vforkdone1, tc)
 		printf("Before raising %s from child\n", strsignal(sigval));
 		FORKEE_ASSERT(raise(sigval) == 0);
 
-		FORKEE_ASSERT((child2 = vfork()) != 1);
+		FORKEE_ASSERT((child2 = vfork()) != -1);
 
 		if (child2 == 0)
 			_exit(exitval2);
@@ -1830,7 +1830,7 @@ ATF_TC_BODY(vforkdone2, tc)
 		printf("Before raising %s from child\n", strsignal(sigval));
 		FORKEE_ASSERT(raise(sigval) == 0);
 
-		FORKEE_ASSERT((child2 = vfork()) != 1);
+		FORKEE_ASSERT((child2 = vfork()) != -1);
 
 		if (child2 == 0)
 			_exit(exitval2);
@@ -5265,7 +5265,7 @@ ATF_TC_BODY(siginfo5, tc)
 		printf("Before raising %s from child\n", strsignal(sigval));
 		FORKEE_ASSERT(raise(sigval) == 0);
 
-		FORKEE_ASSERT((child2 = fork()) != 1);
+		FORKEE_ASSERT((child2 = fork()) != -1);
 
 		if (child2 == 0)
 			_exit(exitval2);
@@ -6050,7 +6050,7 @@ ATF_TC_BODY(signal6, tc)
 		printf("Before raising %s from child\n", strsignal(sigval));
 		FORKEE_ASSERT(raise(sigval) == 0);
 
-		FORKEE_ASSERT((child2 = fork()) != 1);
+		FORKEE_ASSERT((child2 = fork()) != -1);
 
 		if (child2 == 0)
 			_exit(exitval2);
@@ -6181,7 +6181,7 @@ ATF_TC_BODY(signal7, tc)
 		printf("Before raising %s from child\n", strsignal(sigval));
 		FORKEE_ASSERT(raise(sigval) == 0);
 
-		FORKEE_ASSERT((child2 = fork()) != 1);
+		FORKEE_ASSERT((child2 = fork()) != -1);
 
 		if (child2 == 0)
 			_exit(exitval2);
@@ -6311,7 +6311,7 @@ ATF_TC_BODY(signal8, tc)
 		printf("Before raising %s from child\n", strsignal(sigval));
 		FORKEE_ASSERT(raise(sigval) == 0);
 
-		FORKEE_ASSERT((child2 = vfork()) != 1);
+		FORKEE_ASSERT((child2 = vfork()) != -1);
 
 		if (child2 == 0)
 			_exit(exitval2);



CVS commit: src/share/man/man4

2017-03-03 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Fri Mar  3 11:36:20 UTC 2017

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

Log Message:
Improve wording and formatting.
New sentence, new line.
Fix typo.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/share/man/man4/wm.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/wm.4
diff -u src/share/man/man4/wm.4:1.32 src/share/man/man4/wm.4:1.33
--- src/share/man/man4/wm.4:1.32	Fri Mar  3 10:44:25 2017
+++ src/share/man/man4/wm.4	Fri Mar  3 11:36:20 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: wm.4,v 1.32 2017/03/03 10:44:25 knakahara Exp $
+.\"	$NetBSD: wm.4,v 1.33 2017/03/03 11:36:20 wiz Exp $
 .\"
 .\" Copyright 2002, 2003 Wasabi Systems, Inc.
 .\" All rights reserved.
@@ -173,34 +173,41 @@ for information on how to enable this fe
 .Sh OPTIONS
 .Bl -tag -width WM_RX_INTR_PROCESS_LIMIT_DEFAULT -offset 3n
 .It Dv WM_RX_PROCESS_LIMIT_DEFAULT
-The maxinum number of received packets which processed in each
+The maximum number of received packets processed in each
 .Xr softint 9
-context. This option only effects for multiqueue. The value range
-is between zero to UINT_MAX. The default value is 100.
-When you increase this value, receive latency would increase and
-receive throughput would increase.
+context.
+This option only affects multiqueue.
+The value range is from zero to
+.Dv UINT_MAX .
+The default value is 100.
+When you increase this value, both the receive latency and
+the receive throughput will increase.
 .It Dv WM_RX_INTR_PROCESS_LIMIT_DEFAULT
-The maxinum number of received packets which processed in each
-hardware interrupt context. This option only effects for multiqueue.
-The value range is between zero to UINT_MAX. The default value is 0.
-When you increase this value, receive latency would decrease and
-receive throughput would decrease.
+The maximum number of received packets processed in each
+hardware interrupt context.
+This option only affects multiqueue.
+The value range is from zero to
+.Dv UINT_MAX .
+The default value is 0.
+When you increase this value, both the receive latency and
+the receive throughput will decrease.
 .El
 .Pp
 Setting
-.Em WM_RX_INTR_PROCESS_LIMIT_DEFAULT
+.Dv WM_RX_INTR_PROCESS_LIMIT_DEFAULT
 to zero means so-called polling mode, that is, once an interrupt occurs,
 the driver keep processing received packets until
-.Em WM_RX_PROCESS_LIMIT_DEFAULT .
+.Dv WM_RX_PROCESS_LIMIT_DEFAULT .
 Polling mode increases latency a little, however it supresses
 performance degration at high load very well.
 .Pp
 If you want to disable polling mode (to use traditional interrupt
 driven mode), you should set
-.Em WM_RX_PROCESS_LIMIT_DEFAULT
-zero and set
-.Em WM_RX_INTR_PROCESS_LIMIT_DEFAULT
-UINT_MAX.
+.Dv WM_RX_PROCESS_LIMIT_DEFAULT
+to zero and set
+.Dv WM_RX_INTR_PROCESS_LIMIT_DEFAULT
+to
+.Dv UINT_MAX .
 .Sh SEE ALSO
 .Xr arp 4 ,
 .Xr ifmedia 4 ,



CVS commit: src/share/man/man4

2017-03-03 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Fri Mar  3 10:44:25 UTC 2017

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

Log Message:
add WM_RX_PROCESS_LIMIT_DEFAULT and WM_RX_INTR_PROCESS_LIMIT_DEFAULT description

pointed out by pgoyette@n.o, thanks.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/share/man/man4/wm.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/wm.4
diff -u src/share/man/man4/wm.4:1.31 src/share/man/man4/wm.4:1.32
--- src/share/man/man4/wm.4:1.31	Wed Sep  3 14:36:45 2014
+++ src/share/man/man4/wm.4	Fri Mar  3 10:44:25 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: wm.4,v 1.31 2014/09/03 14:36:45 msaitoh Exp $
+.\"	$NetBSD: wm.4,v 1.32 2017/03/03 10:44:25 knakahara Exp $
 .\"
 .\" Copyright 2002, 2003 Wasabi Systems, Inc.
 .\" All rights reserved.
@@ -33,7 +33,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd September 3, 2014
+.Dd March 3, 2017
 .Dt WM 4
 .Os
 .Sh NAME
@@ -42,6 +42,9 @@
 .Sh SYNOPSIS
 .Cd "wm* at pci? dev ? function ?"
 .Pp
+.Cd options WM_RX_PROCESS_LIMIT_DEFAULT
+.Cd options WM_RX_INTR_PROCESS_LIMIT_DEFAULT
+.Pp
 Configuration of PHYs may also be necessary.
 See
 .Xr mii 4 .
@@ -167,6 +170,37 @@ See
 for information on how to enable this feature.
 .\" .Sh DIAGNOSTICS
 .\" XXX to be done.
+.Sh OPTIONS
+.Bl -tag -width WM_RX_INTR_PROCESS_LIMIT_DEFAULT -offset 3n
+.It Dv WM_RX_PROCESS_LIMIT_DEFAULT
+The maxinum number of received packets which processed in each
+.Xr softint 9
+context. This option only effects for multiqueue. The value range
+is between zero to UINT_MAX. The default value is 100.
+When you increase this value, receive latency would increase and
+receive throughput would increase.
+.It Dv WM_RX_INTR_PROCESS_LIMIT_DEFAULT
+The maxinum number of received packets which processed in each
+hardware interrupt context. This option only effects for multiqueue.
+The value range is between zero to UINT_MAX. The default value is 0.
+When you increase this value, receive latency would decrease and
+receive throughput would decrease.
+.El
+.Pp
+Setting
+.Em WM_RX_INTR_PROCESS_LIMIT_DEFAULT
+to zero means so-called polling mode, that is, once an interrupt occurs,
+the driver keep processing received packets until
+.Em WM_RX_PROCESS_LIMIT_DEFAULT .
+Polling mode increases latency a little, however it supresses
+performance degration at high load very well.
+.Pp
+If you want to disable polling mode (to use traditional interrupt
+driven mode), you should set
+.Em WM_RX_PROCESS_LIMIT_DEFAULT
+zero and set
+.Em WM_RX_INTR_PROCESS_LIMIT_DEFAULT
+UINT_MAX.
 .Sh SEE ALSO
 .Xr arp 4 ,
 .Xr ifmedia 4 ,



CVS commit: src/sys/arch/i386/stand/efiboot

2017-03-03 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri Mar  3 09:29:57 UTC 2017

Modified Files:
src/sys/arch/i386/stand/efiboot: boot.c

Log Message:
efiboot: fix efivar command.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/stand/efiboot/boot.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/i386/stand/efiboot/boot.c
diff -u src/sys/arch/i386/stand/efiboot/boot.c:1.2 src/sys/arch/i386/stand/efiboot/boot.c:1.3
--- src/sys/arch/i386/stand/efiboot/boot.c:1.2	Fri Feb  3 16:42:26 2017
+++ src/sys/arch/i386/stand/efiboot/boot.c	Fri Mar  3 09:29:57 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.c,v 1.2 2017/02/03 16:42:26 roy Exp $	*/
+/*	$NetBSD: boot.c,v 1.3 2017/03/03 09:29:57 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -557,7 +557,7 @@ command_efivar(char *arg)
 	 L"GUIDVariable NameValue\n"
 	 L"===  \n";
 	EFI_STATUS status;
-	UINTN sz = 64;
+	UINTN sz = 64, osz;
 	CHAR16 *name = NULL, *tmp, *val;
 	EFI_GUID vendor;
 	UINTN cols, rows, row = 0;
@@ -576,11 +576,12 @@ command_efivar(char *arg)
 		return;
 	}
 
-	name[0] = 0;
+	SetMem(name, sz, 0);
 	vendor = NullGuid;
 
 	Print(L"%s", header);
 	for (;;) {
+		osz = sz;
 		status = uefi_call_wrapper(RT->GetNextVariableName, 3,
 		, name, );
 		if (EFI_ERROR(status)) {
@@ -598,8 +599,11 @@ command_efivar(char *arg)
 (UINT64)sz);
 break;
 			}
+			SetMem(tmp, sz, 0);
+			CopyMem(tmp, name, osz);
 			FreePool(name);
 			name = tmp;
+			continue;
 		}
 
 		val = LibGetVariable(name, );