CVS commit: src/usr.bin/make

2020-02-04 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Feb  4 16:28:29 UTC 2020

Modified Files:
src/usr.bin/make: make.1

Log Message:
Remove trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.278 -r1.279 src/usr.bin/make/make.1

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

Modified files:

Index: src/usr.bin/make/make.1
diff -u src/usr.bin/make/make.1:1.278 src/usr.bin/make/make.1:1.279
--- src/usr.bin/make/make.1:1.278	Mon Feb  3 22:25:17 2020
+++ src/usr.bin/make/make.1	Tue Feb  4 16:28:29 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: make.1,v 1.278 2020/02/03 22:25:17 uwe Exp $
+.\"	$NetBSD: make.1,v 1.279 2020/02/04 16:28:29 wiz Exp $
 .\"
 .\" Copyright (c) 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -1233,7 +1233,7 @@ Quotes every shell meta-character in the
 characters so that it can be passed
 safely through recursive invocations of
 .Nm .
-This is equivalent to: 
+This is equivalent to:
 .Sq \&:S/\e\&$/&&/g:Q .
 .It Cm \&:R
 Replaces each word in the variable with everything but its suffix.



CVS commit: src/lib/libc/sys

2020-02-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Feb  4 18:36:16 UTC 2020

Modified Files:
src/lib/libc/sys: mkdir.2

Log Message:
Mention that we don't honor the other mode bits.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/lib/libc/sys/mkdir.2

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/sys/mkdir.2
diff -u src/lib/libc/sys/mkdir.2:1.30 src/lib/libc/sys/mkdir.2:1.31
--- src/lib/libc/sys/mkdir.2:1.30	Sun Sep  1 15:54:04 2019
+++ src/lib/libc/sys/mkdir.2	Tue Feb  4 13:36:16 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mkdir.2,v 1.30 2019/09/01 19:54:04 sevan Exp $
+.\"	$NetBSD: mkdir.2,v 1.31 2020/02/04 18:36:16 christos Exp $
 .\"
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" @(#)mkdir.2	8.2 (Berkeley) 12/11/93
 .\"
-.Dd September 1, 2019
+.Dd February 4, 2020
 .Dt MKDIR 2
 .Os
 .Sh NAME
@@ -54,6 +54,16 @@ is created with the access permissions s
 and restricted by the
 .Xr umask 2
 of the calling process.
+On
+.Nx 
+all other mode bits 
+.Dv ( S_ISUID ,
+.Dv S_ISGID , 
+.Dv S_ISTXT )
+are ignored.
+This is implementation defined; for example on Linux
+.Dv S_ISTXT
+is honored.
 .Pp
 .Fn mkdirat
 works the same way as



CVS commit: src/bin/sh

2020-02-04 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Feb  4 16:06:59 UTC 2020

Modified Files:
src/bin/sh: eval.c options.c

Log Message:
After bug report 262 (from 2010)
https://austingroupbugs.net/view.php?id=252
the Austin Group decided to require processing of "--" by the "."
and "exec" commands to solve a problem where some shells did
option processing for those commands (permitted) and others did
not (also permitted) which left no safe way to process a file
with a name beginning with "-".

This has finally made its way into what will be the next version of
the POSIX standard.

Since this shell did no option processing at all for those commands,
we need to update.   This is that update.

The sole effect is that a "--" 'option' (to "." or "exec") is ignored.
This means that if you want to use "--" as the arg to one of those
commands, it needs to be given twice ". -- --".   Apart from that there
should be no difference at all (though the "--" can now be used in other
situations, where we did not require it before, and still do not).


To generate a diff of this commit:
cvs rdiff -u -r1.177 -r1.178 src/bin/sh/eval.c
cvs rdiff -u -r1.53 -r1.54 src/bin/sh/options.c

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

Modified files:

Index: src/bin/sh/eval.c
diff -u src/bin/sh/eval.c:1.177 src/bin/sh/eval.c:1.178
--- src/bin/sh/eval.c:1.177	Sat Dec 21 18:54:15 2019
+++ src/bin/sh/eval.c	Tue Feb  4 16:06:59 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: eval.c,v 1.177 2019/12/21 18:54:15 kre Exp $	*/
+/*	$NetBSD: eval.c,v 1.178 2020/02/04 16:06:59 kre Exp $	*/
 
 /*-
  * Copyright (c) 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)eval.c	8.9 (Berkeley) 6/8/95";
 #else
-__RCSID("$NetBSD: eval.c,v 1.177 2019/12/21 18:54:15 kre Exp $");
+__RCSID("$NetBSD: eval.c,v 1.178 2020/02/04 16:06:59 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -1493,7 +1493,9 @@ dotcmd(int argc, char **argv)
 {
 	exitstatus = 0;
 
-	if (argc >= 2) {		/* That's what SVR2 does */
+	(void) nextopt(NULL);		/* ignore a leading "--" */
+
+	if (*argptr != NULL) {		/* That's what SVR2 does */
 		char *fullname;
 		/*
 		 * dot_funcnest needs to be 0 when not in a dotcmd, so it
@@ -1503,7 +1505,7 @@ dotcmd(int argc, char **argv)
 		struct stackmark smark;
 
 		setstackmark();
-		fullname = find_dot_file(argv[1]);
+		fullname = find_dot_file(*argptr);
 		setinputfile(fullname, 1);
 		commandname = fullname;
 		dot_funcnest_old = dot_funcnest;
@@ -1649,7 +1651,9 @@ truecmd(int argc, char **argv)
 int
 execcmd(int argc, char **argv)
 {
-	if (argc > 1) {
+	(void) nextopt(NULL);		/* ignore a leading "--" */
+
+	if (*argptr) {
 		struct strlist *sp;
 
 		iflag = 0;		/* exit on error */
@@ -1657,7 +1661,7 @@ execcmd(int argc, char **argv)
 		optschanged();
 		for (sp = cmdenviron; sp; sp = sp->next)
 			setvareq(sp->text, VDOEXPORT|VEXPORT|VSTACK);
-		shellexec(argv + 1, environment(), pathval(), 0, 0);
+		shellexec(argptr, environment(), pathval(), 0, 0);
 	}
 	return 0;
 }

Index: src/bin/sh/options.c
diff -u src/bin/sh/options.c:1.53 src/bin/sh/options.c:1.54
--- src/bin/sh/options.c:1.53	Fri Jul 13 22:43:44 2018
+++ src/bin/sh/options.c	Tue Feb  4 16:06:59 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: options.c,v 1.53 2018/07/13 22:43:44 kre Exp $	*/
+/*	$NetBSD: options.c,v 1.54 2020/02/04 16:06:59 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)options.c	8.2 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: options.c,v 1.53 2018/07/13 22:43:44 kre Exp $");
+__RCSID("$NetBSD: options.c,v 1.54 2020/02/04 16:06:59 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -595,7 +595,11 @@ out:
  * Standard option processing (a la getopt) for builtin routines.  The
  * only argument that is passed to nextopt is the option string; the
  * other arguments are unnecessary.  It return the character, or '\0' on
- * end of input.
+ * end of input.  If optstring is NULL, then there are no options, and
+ * args are allowed to begin with '-', but a single leading "--" will be
+ * discarded.   This is for some POSIX special builtins that require
+ * -- processing, have no args, and we never did opt processing before
+ * and need to retain backwards compat.
  */
 
 int
@@ -613,6 +617,8 @@ nextopt(const char *optstring)
 		if (p[0] == '-' && p[1] == '\0')	/* check for "--" */
 			return '\0';
 	}
+	if (optstring == NULL)
+		return '\0';
 	c = *p++;
 	for (q = optstring ; *q != c ; ) {
 		if (*q == '\0')



CVS commit: src/sys/dev/ppbus

2020-02-04 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Feb  4 20:46:51 UTC 2020

Modified Files:
src/sys/dev/ppbus: if_plip.c

Log Message:
finish adoption of 


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/ppbus/if_plip.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/ppbus/if_plip.c
diff -u src/sys/dev/ppbus/if_plip.c:1.35 src/sys/dev/ppbus/if_plip.c:1.36
--- src/sys/dev/ppbus/if_plip.c:1.35	Tue Feb  4 07:37:06 2020
+++ src/sys/dev/ppbus/if_plip.c	Tue Feb  4 20:46:51 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_plip.c,v 1.35 2020/02/04 07:37:06 skrll Exp $ */
+/* $NetBSD: if_plip.c,v 1.36 2020/02/04 20:46:51 jdolecek Exp $ */
 
 /*-
  * Copyright (c) 1997 Poul-Henning Kamp
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_plip.c,v 1.35 2020/02/04 07:37:06 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_plip.c,v 1.36 2020/02/04 20:46:51 jdolecek Exp $");
 
 /*
  * Parallel port TCP/IP interfaces added.  I looked at the driver from
@@ -636,19 +636,19 @@ end:
 	}
 
 	if (top == NULL) {
-		ifp->if_iqdrops++;
+		if_statinc(ifp, if_iqdrops);
 		goto err;
 	}
 	if (ifp->if_bpf) {
 		lptap(ifp, top, BPF_D_IN);
 	}
 	if (__predict_false(!pktq_enqueue(ip_pktq, top, 0))) {
-		ifp->if_iqdrops++;
+		if_statinc(ifp, if_iqdrops);
 		m_freem(top);
 		goto err;
 	}
-	ifp->if_ipackets++;
-	ifp->if_ibytes += len;
+	if_statinc(ifp, if_ipackets);
+	if_statadd(ifp, if_ibytes, len);
 	sc->sc_iferrs = 0;
 
 	goto done;
@@ -724,7 +724,7 @@ lpoutput(struct ifnet *ifp, struct mbuf 
 	if (dst->sa_family != AF_INET) {
 		LP_PRINTF("%s: af%d not supported\n", ifp->if_xname,
 		dst->sa_family);
-		ifp->if_noproto++;
+		if_statinc(ifp, if_noproto);
 		err = EAFNOSUPPORT;
 		goto endoutput;
 	}



CVS commit: src/tests/lib/libc/sys

2020-02-04 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Feb  4 21:34:12 UTC 2020

Modified Files:
src/tests/lib/libc/sys: t_ptrace_wait.c

Log Message:
Add new ATF ptrace(2) test in t_ptrace_wait*

threads_and_exec - verify that the expected LWP events are reported for a
multithreaded process that calls execve(2).

Test passes.


To generate a diff of this commit:
cvs rdiff -u -r1.150 -r1.151 src/tests/lib/libc/sys/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/lib/libc/sys/t_ptrace_wait.c
diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.150 src/tests/lib/libc/sys/t_ptrace_wait.c:1.151
--- src/tests/lib/libc/sys/t_ptrace_wait.c:1.150	Tue Feb  4 15:06:27 2020
+++ src/tests/lib/libc/sys/t_ptrace_wait.c	Tue Feb  4 21:34:12 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.c,v 1.150 2020/02/04 15:06:27 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_wait.c,v 1.151 2020/02/04 21:34:12 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.150 2020/02/04 15:06:27 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.151 2020/02/04 21:34:12 kamil Exp $");
 
 #define __LEGACY_PT_LWPINFO
 
@@ -7048,6 +7048,195 @@ FORK2_TEST(vforkdone_singalignored, "vfo
 
 /// 
 
+static void *
+thread_and_exec_thread_cb(void *arg __unused)
+{
+
+	execlp("/bin/echo", "/bin/echo", NULL);
+
+	abort();
+}
+
+static void
+threads_and_exec(void)
+{
+	const int sigval = SIGSTOP;
+	pid_t child, wpid;
+#if defined(TWAIT_HAVE_STATUS)
+	int status;
+#endif
+	ptrace_state_t state;
+	const int slen = sizeof(state);
+	ptrace_event_t event;
+	const int elen = sizeof(event);
+	struct ptrace_siginfo info;
+
+	pthread_t t;
+	lwpid_t lid;
+
+	DPRINTF("Before forking process PID=%d\n", getpid());
+	SYSCALL_REQUIRE((child = fork()) != -1);
+	if (child == 0) {
+		DPRINTF("Before calling PT_TRACE_ME from child %d\n", getpid());
+		FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
+
+		DPRINTF("Before raising %s from child\n", strsignal(sigval));
+		FORKEE_ASSERT(raise(sigval) == 0);
+
+		FORKEE_ASSERT(pthread_create(, NULL,
+		thread_and_exec_thread_cb, NULL) == 0);
+
+		for (;;)
+			continue;
+
+		FORKEE_ASSERT(0 && "Not reached");
+	}
+	DPRINTF("Parent process PID=%d, child's PID=%d\n", getpid(), child);
+
+	DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME);
+	TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, , 0), child);
+
+	validate_status_stopped(status, sigval);
+
+	DPRINTF("Before calling ptrace(2) with PT_GET_SIGINFO for child\n");
+	SYSCALL_REQUIRE(
+	ptrace(PT_GET_SIGINFO, child, , sizeof(info)) != -1);
+
+	DPRINTF("Signal traced to lwpid=%d\n", info.psi_lwpid);
+	DPRINTF("Signal properties: si_signo=%#x si_code=%#x si_errno=%#x\n",
+	info.psi_siginfo.si_signo, info.psi_siginfo.si_code,
+	info.psi_siginfo.si_errno);
+
+	ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, sigval);
+	ATF_REQUIRE_EQ(info.psi_siginfo.si_code, SI_LWP);
+
+	DPRINTF("Set LWP event mask for the child %d\n", child);
+	memset(, 0, sizeof(event));
+	event.pe_set_event |= PTRACE_LWP_CREATE | PTRACE_LWP_EXIT;
+	SYSCALL_REQUIRE(ptrace(PT_SET_EVENT_MASK, child, , elen) != -1);
+
+	DPRINTF("Before resuming the child process where it left off and "
+	"without signal to be sent\n");
+	SYSCALL_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+	DPRINTF("Before calling %s() for the child - expected stopped "
+	"SIGTRAP\n", TWAIT_FNAME);
+	TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, , 0),
+	child);
+
+	validate_status_stopped(status, SIGTRAP);
+
+	DPRINTF("Before calling ptrace(2) with PT_GET_SIGINFO for "
+	"child\n");
+	SYSCALL_REQUIRE(
+	ptrace(PT_GET_SIGINFO, child, , sizeof(info)) != -1);
+
+	DPRINTF("Signal traced to lwpid=%d\n", info.psi_lwpid);
+	DPRINTF("Signal properties: si_signo=%#x si_code=%#x "
+	"si_errno=%#x\n",
+	info.psi_siginfo.si_signo, info.psi_siginfo.si_code,
+	info.psi_siginfo.si_errno);
+
+	ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, SIGTRAP);
+	ATF_REQUIRE_EQ(info.psi_siginfo.si_code, TRAP_LWP);
+
+	SYSCALL_REQUIRE(
+	ptrace(PT_GET_PROCESS_STATE, child, , slen) != -1);
+
+	ATF_REQUIRE_EQ_MSG(state.pe_report_event, PTRACE_LWP_CREATE,
+	"%d != %d", state.pe_report_event, PTRACE_LWP_CREATE);
+
+	lid = state.pe_lwp;
+	DPRINTF("Reported PTRACE_LWP_CREATE event with lid %d\n", lid);
+
+	DPRINTF("Before resuming the child process where it left off "
+	"and without signal to be sent\n");
+	SYSCALL_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+
+	DPRINTF("Before calling %s() for the child - expected stopped "
+	"SIGTRAP\n", TWAIT_FNAME);
+	TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, , 0),
+	child);
+
+	validate_status_stopped(status, SIGTRAP);
+
+	DPRINTF("Before 

CVS commit: src/sys/dev/ppbus

2020-02-04 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Feb  4 21:09:03 UTC 2020

Added Files:
src/sys/dev/ppbus: ppbusdevices.config

Log Message:
add a config fragment to include all ppbus devices to make it simpler
to compile test; right now assumes attachment of atppc(4) via acpi


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/dev/ppbus/ppbusdevices.config

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

Added files:

Index: src/sys/dev/ppbus/ppbusdevices.config
diff -u /dev/null src/sys/dev/ppbus/ppbusdevices.config:1.1
--- /dev/null	Tue Feb  4 21:09:03 2020
+++ src/sys/dev/ppbus/ppbusdevices.config	Tue Feb  4 21:09:03 2020
@@ -0,0 +1,18 @@
+#	$NetBSD: ppbusdevices.config,v 1.1 2020/02/04 21:09:03 jdolecek Exp $
+#
+# This file contains all ppbus related configuration.
+# It is suitable for inclusion in a kernel config(5) file.
+#
+
+# Driver for AT-style parallel port chip sets, replaces plain lpt(4)
+#no lpt* at acpi?	# actually lpt* at acpi? commented out in amd64 GENERIC
+atppc*	at acpi?
+
+# Parallel Port Bus system with GPIO
+ppbus*	at atppc?
+
+# Devices
+gpio*	at ppbus?	# general purpose Input/Output
+lpt*	at ppbus?	# parallel printer interfaces
+plip*	at ppbus?	# printer port Internet Protocol driver
+pps*	at ppbus?	# Pulse per second Timing Interface



CVS commit: src/tests/lib/libc/sys

2020-02-04 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Feb  4 21:34:47 UTC 2020

Modified Files:
src/tests/lib/libc/sys: t_ptrace_wait.c

Log Message:
Disable debug code


To generate a diff of this commit:
cvs rdiff -u -r1.151 -r1.152 src/tests/lib/libc/sys/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/lib/libc/sys/t_ptrace_wait.c
diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.151 src/tests/lib/libc/sys/t_ptrace_wait.c:1.152
--- src/tests/lib/libc/sys/t_ptrace_wait.c:1.151	Tue Feb  4 21:34:12 2020
+++ src/tests/lib/libc/sys/t_ptrace_wait.c	Tue Feb  4 21:34:47 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.c,v 1.151 2020/02/04 21:34:12 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_wait.c,v 1.152 2020/02/04 21:34:47 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.151 2020/02/04 21:34:12 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.152 2020/02/04 21:34:47 kamil Exp $");
 
 #define __LEGACY_PT_LWPINFO
 
@@ -116,7 +116,7 @@ static_assert(sizeof(((struct ptrace_sta
 #define SYSCALL_REQUIRE_ERRNO(res, exp) ATF_REQUIRE_MSG(res == exp, \
 "%d(%s) != %d", res, strerror(res), exp)
 
-static int debug = 1;
+static int debug = 0;
 
 #define DPRINTF(a, ...)	do  \
 	if (debug) \



CVS commit: src/sys/dev/pci/ixgbe

2020-02-04 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Feb  4 19:42:56 UTC 2020

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe.c ixgbe.h

Log Message:
- Fix locking problem with optics module interrupts: ifmedia_add()
  may block on memory allocation, and so it cannot be safely done from
  a softint nor can it be done while holding a spin lock.  Fix this by
  using a workqueue rather than a softint, and hold the IFNET_LOCK
  across the entire handler, and the CORE_LOCK only across the code that
  needs to serialize access to the hardware state.
- Use ifmedia_fini().

Tested in a variety of devices by msaitoh@.  (Thanks!)


To generate a diff of this commit:
cvs rdiff -u -r1.222 -r1.223 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.62 -r1.63 src/sys/dev/pci/ixgbe/ixgbe.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/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.222 src/sys/dev/pci/ixgbe/ixgbe.c:1.223
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.222	Sat Feb  1 12:55:22 2020
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Tue Feb  4 19:42:55 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.222 2020/02/01 12:55:22 thorpej Exp $ */
+/* $NetBSD: ixgbe.c,v 1.223 2020/02/04 19:42:55 thorpej Exp $ */
 
 /**
 
@@ -267,10 +267,11 @@ static int	ixgbe_msix_link(void *);
 /* Software interrupts for deferred work */
 static void	ixgbe_handle_que(void *);
 static void	ixgbe_handle_link(void *);
-static void	ixgbe_handle_msf(void *);
 static void	ixgbe_handle_mod(void *);
 static void	ixgbe_handle_phy(void *);
 
+static void	ixgbe_handle_msf(struct work *, void *);
+
 /* Workqueue handler for deferred work */
 static void	ixgbe_handle_que_work(struct work *, void *);
 
@@ -410,10 +411,12 @@ static int (*ixgbe_ring_empty)(struct if
 #define IXGBE_CALLOUT_FLAGS	CALLOUT_MPSAFE
 #define IXGBE_SOFTINFT_FLAGS	SOFTINT_MPSAFE
 #define IXGBE_WORKQUEUE_FLAGS	WQ_PERCPU | WQ_MPSAFE
+#define IXGBE_TASKLET_WQ_FLAGS	WQ_MPSAFE
 #else
 #define IXGBE_CALLOUT_FLAGS	0
 #define IXGBE_SOFTINFT_FLAGS	0
 #define IXGBE_WORKQUEUE_FLAGS	WQ_PERCPU
+#define IXGBE_TASKLET_WQ_FLAGS	0
 #endif
 #define IXGBE_WORKQUEUE_PRI PRI_SOFTNET
 
@@ -1099,8 +1102,6 @@ ixgbe_attach(device_t parent, device_t d
 	ixgbe_handle_link, adapter);
 	adapter->mod_si = softint_establish(SOFTINT_NET | IXGBE_SOFTINFT_FLAGS,
 	ixgbe_handle_mod, adapter);
-	adapter->msf_si = softint_establish(SOFTINT_NET | IXGBE_SOFTINFT_FLAGS,
-	ixgbe_handle_msf, adapter);
 	adapter->phy_si = softint_establish(SOFTINT_NET | IXGBE_SOFTINFT_FLAGS,
 	ixgbe_handle_phy, adapter);
 	if (adapter->feat_en & IXGBE_FEATURE_FDIR)
@@ -1108,13 +1109,23 @@ ixgbe_attach(device_t parent, device_t d
 		softint_establish(SOFTINT_NET | IXGBE_SOFTINFT_FLAGS,
 			ixgbe_reinit_fdir, adapter);
 	if ((adapter->link_si == NULL) || (adapter->mod_si == NULL)
-	|| (adapter->msf_si == NULL) || (adapter->phy_si == NULL)
+	|| (adapter->phy_si == NULL)
 	|| ((adapter->feat_en & IXGBE_FEATURE_FDIR)
 		&& (adapter->fdir_si == NULL))) {
 		aprint_error_dev(dev,
 		"could not establish software interrupts ()\n");
 		goto err_out;
 	}
+	char wqname[MAXCOMLEN];
+	snprintf(wqname, sizeof(wqname), "%s-msf", device_xname(dev));
+	error = workqueue_create(>msf_wq, wqname,
+	ixgbe_handle_msf, adapter, IXGBE_WORKQUEUE_PRI, IPL_NET,
+	IXGBE_TASKLET_WQ_FLAGS);
+	if (error) {
+		aprint_error_dev(dev,
+		"could not create MSF workqueue (%d)\n", error);
+		goto err_out;
+	}
 
 	error = ixgbe_start_hw(hw);
 	switch (error) {
@@ -1510,7 +1521,9 @@ ixgbe_config_link(struct adapter *adapte
 		if (hw->phy.multispeed_fiber) {
 			ixgbe_enable_tx_laser(hw);
 			kpreempt_disable();
-			softint_schedule(adapter->msf_si);
+			if (adapter->schedule_wqs_ok)
+workqueue_enqueue(adapter->msf_wq,
+>msf_wc, NULL);
 			kpreempt_enable();
 		}
 		kpreempt_disable();
@@ -3088,7 +3101,9 @@ ixgbe_msix_link(void *arg)
 		(eicr & IXGBE_EICR_GPI_SDP1_BY_MAC(hw))) {
 			IXGBE_WRITE_REG(hw, IXGBE_EICR,
 			IXGBE_EICR_GPI_SDP1_BY_MAC(hw));
-			softint_schedule(adapter->msf_si);
+			if (adapter->schedule_wqs_ok)
+workqueue_enqueue(adapter->msf_wq,
+>msf_wc, NULL);
 		}
 	}
 
@@ -3500,9 +3515,9 @@ ixgbe_free_softint(struct adapter *adapt
 		softint_disestablish(adapter->mod_si);
 		adapter->mod_si = NULL;
 	}
-	if (adapter->msf_si != NULL) {
-		softint_disestablish(adapter->msf_si);
-		adapter->msf_si = NULL;
+	if (adapter->msf_wq != NULL) {
+		workqueue_destroy(adapter->msf_wq);
+		adapter->msf_wq = NULL;
 	}
 	if (adapter->phy_si != NULL) {
 		softint_disestablish(adapter->phy_si);
@@ -3593,6 +3608,7 @@ ixgbe_detach(device_t dev, int flags)
 	bus_generic_detach(dev);
 #endif
 	if_detach(adapter->ifp);
+	ifmedia_fini(>media);
 	if_percpuq_destroy(adapter->ipq);
 
 	sysctl_teardown(>sysctllog);
@@ -4129,6 +4145,9 @@ 

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

2020-02-04 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Feb  4 10:59:21 UTC 2020

Modified Files:
src/sys/arch/arm/arm32: arm32_kvminit.c

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/arm/arm32/arm32_kvminit.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/arm32/arm32_kvminit.c
diff -u src/sys/arch/arm/arm32/arm32_kvminit.c:1.57 src/sys/arch/arm/arm32/arm32_kvminit.c:1.58
--- src/sys/arch/arm/arm32/arm32_kvminit.c:1.57	Tue Feb  4 10:57:32 2020
+++ src/sys/arch/arm/arm32/arm32_kvminit.c	Tue Feb  4 10:59:21 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: arm32_kvminit.c,v 1.57 2020/02/04 10:57:32 skrll Exp $	*/
+/*	$NetBSD: arm32_kvminit.c,v 1.58 2020/02/04 10:59:21 skrll Exp $	*/
 
 /*
  * Copyright (c) 2002, 2003, 2005  Genetec Corporation.  All rights reserved.
@@ -127,23 +127,23 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: arm32_kvminit.c,v 1.57 2020/02/04 10:57:32 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arm32_kvminit.c,v 1.58 2020/02/04 10:59:21 skrll Exp $");
 
 #include 
+#include 
 #include 
 #include 
 #include 
-#include 
 
 #include 
 
 #include 
 
-#include 
+#include 
+#include 
 #include 
+#include 
 #include 
-#include 
-#include 
 
 #if defined(FDT)
 #include 



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

2020-02-04 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Feb  4 10:57:33 UTC 2020

Modified Files:
src/sys/arch/arm/arm32: arm32_kvminit.c

Log Message:
grammar in a comment


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/arm/arm32/arm32_kvminit.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/arm32/arm32_kvminit.c
diff -u src/sys/arch/arm/arm32/arm32_kvminit.c:1.56 src/sys/arch/arm/arm32/arm32_kvminit.c:1.57
--- src/sys/arch/arm/arm32/arm32_kvminit.c:1.56	Sun Feb  2 09:19:48 2020
+++ src/sys/arch/arm/arm32/arm32_kvminit.c	Tue Feb  4 10:57:32 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: arm32_kvminit.c,v 1.56 2020/02/02 09:19:48 skrll Exp $	*/
+/*	$NetBSD: arm32_kvminit.c,v 1.57 2020/02/04 10:57:32 skrll Exp $	*/
 
 /*
  * Copyright (c) 2002, 2003, 2005  Genetec Corporation.  All rights reserved.
@@ -127,7 +127,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: arm32_kvminit.c,v 1.56 2020/02/02 09:19:48 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arm32_kvminit.c,v 1.57 2020/02/04 10:57:32 skrll Exp $");
 
 #include 
 #include 
@@ -655,7 +655,7 @@ arm32_kernel_vm_init(vaddr_t kernel_vm_b
 	}
 
 	/*
-	 * This enforces a alignment requirement of L2_S_SEGSIZE for kernel
+	 * This enforces an alignment requirement of L2_S_SEGSIZE for kernel
 	 * start PA
 	 */
 	const vaddr_t kernel_base =



CVS commit: src/sys/dev/usb

2020-02-04 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Feb  5 07:24:07 UTC 2020

Modified Files:
src/sys/dev/usb: if_smsc.c

Log Message:
 Cast to uint32_t to avoid undefined behavior in smsc_setmacaddress.
Found by kUBSan.


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/dev/usb/if_smsc.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/usb/if_smsc.c
diff -u src/sys/dev/usb/if_smsc.c:1.63 src/sys/dev/usb/if_smsc.c:1.64
--- src/sys/dev/usb/if_smsc.c:1.63	Wed Jan 29 06:35:28 2020
+++ src/sys/dev/usb/if_smsc.c	Wed Feb  5 07:24:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_smsc.c,v 1.63 2020/01/29 06:35:28 thorpej Exp $	*/
+/*	$NetBSD: if_smsc.c,v 1.64 2020/02/05 07:24:07 msaitoh Exp $	*/
 
 /*	$OpenBSD: if_smsc.c,v 1.4 2012/09/27 12:38:11 jsg Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/net/if_smsc.c,v 1.1 2012/08/15 04:03:55 gonzo Exp $ */
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_smsc.c,v 1.63 2020/01/29 06:35:28 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_smsc.c,v 1.64 2020/02/05 07:24:07 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -544,7 +544,8 @@ smsc_setmacaddress(struct usbnet *un, co
 
 	DPRINTF("... %02jx:%0j2x:%02jx", addr[3], addr[4], addr[5], 0);
 
-	val = (addr[3] << 24) | (addr[2] << 16) | (addr[1] << 8) | addr[0];
+	val = ((uint32_t)addr[3] << 24) | (addr[2] << 16) | (addr[1] << 8)
+	| addr[0];
 	if ((err = smsc_writereg(un, SMSC_MAC_ADDRL, val)) != 0)
 		goto done;
 



CVS commit: src/sys/arch/arm

2020-02-04 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Feb  5 07:37:36 UTC 2020

Modified Files:
src/sys/arch/arm/arm: cpufunc.c
src/sys/arch/arm/arm32: armv7_generic_space.c pmap.c
src/sys/arch/arm/conf: Makefile.arm
src/sys/arch/arm/include/arm32: pmap.h

Log Message:
Fix the armv[67] memory attributes for uncached memory.  Previously it was
mapped as strongly-ordered which meant that unaligned accesses would fault.

armv7_generic_bs_map now maps pages with PMAP_DEV which is treated as SO

bus_dma continues to use PMAP_NOCACHE as appropriate, but this now get
mapped to the correct memory attribute bits for armv[67]

DEVMAP_ENTRY usees a new flag PTE_DEV.

The workaround for the unaligned access faults is now removed.

XXX Other armv[67] boards bus_space implementations should be checked.
XXX There is scope to reduce the difference to aarch64


To generate a diff of this commit:
cvs rdiff -u -r1.175 -r1.176 src/sys/arch/arm/arm/cpufunc.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/arm32/armv7_generic_space.c
cvs rdiff -u -r1.387 -r1.388 src/sys/arch/arm/arm32/pmap.c
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/arm/conf/Makefile.arm
cvs rdiff -u -r1.160 -r1.161 src/sys/arch/arm/include/arm32/pmap.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/arm/cpufunc.c
diff -u src/sys/arch/arm/arm/cpufunc.c:1.175 src/sys/arch/arm/arm/cpufunc.c:1.176
--- src/sys/arch/arm/arm/cpufunc.c:1.175	Sat Oct 20 06:35:34 2018
+++ src/sys/arch/arm/arm/cpufunc.c	Wed Feb  5 07:37:35 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpufunc.c,v 1.175 2018/10/20 06:35:34 skrll Exp $	*/
+/*	$NetBSD: cpufunc.c,v 1.176 2020/02/05 07:37:35 skrll Exp $	*/
 
 /*
  * arm7tdmi support code Copyright (c) 2001 John Fremlin
@@ -49,7 +49,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpufunc.c,v 1.175 2018/10/20 06:35:34 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpufunc.c,v 1.176 2020/02/05 07:37:35 skrll Exp $");
 
 #include "opt_arm_start.h"
 #include "opt_compat_netbsd.h"
@@ -1776,7 +1776,7 @@ set_cpufuncs(void)
 #ifdef ARM11_CACHE_WRITE_THROUGH
 		pmap_pte_init_arm11();
 #else
-		pmap_pte_init_generic();
+		pmap_pte_init_armv6();
 #endif
 		if (arm_cache_prefer_mask)
 			uvmexp.ncolors = (arm_cache_prefer_mask >> PGSHIFT) + 1;

Index: src/sys/arch/arm/arm32/armv7_generic_space.c
diff -u src/sys/arch/arm/arm32/armv7_generic_space.c:1.10 src/sys/arch/arm/arm32/armv7_generic_space.c:1.11
--- src/sys/arch/arm/arm32/armv7_generic_space.c:1.10	Mon Nov 19 10:45:47 2018
+++ src/sys/arch/arm/arm32/armv7_generic_space.c	Wed Feb  5 07:37:35 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: armv7_generic_space.c,v 1.10 2018/11/19 10:45:47 jmcneill Exp $	*/
+/*	$NetBSD: armv7_generic_space.c,v 1.11 2020/02/05 07:37:35 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: armv7_generic_space.c,v 1.10 2018/11/19 10:45:47 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: armv7_generic_space.c,v 1.11 2020/02/05 07:37:35 skrll Exp $");
 
 #include 
 #include 
@@ -319,7 +319,7 @@ armv7_generic_bs_map(void *t, bus_addr_t
 	else if (flag & BUS_SPACE_MAP_CACHEABLE)
 		pmapflags = 0;
 	else
-		pmapflags = PMAP_NOCACHE;
+		pmapflags = PMAP_DEV;
 
 	for (pa = startpa; pa < endpa; pa += PAGE_SIZE, va += PAGE_SIZE) {
 		pmap_kenter_pa(va, pa, VM_PROT_READ | VM_PROT_WRITE, pmapflags);

Index: src/sys/arch/arm/arm32/pmap.c
diff -u src/sys/arch/arm/arm32/pmap.c:1.387 src/sys/arch/arm/arm32/pmap.c:1.388
--- src/sys/arch/arm/arm32/pmap.c:1.387	Sun Feb  2 08:56:29 2020
+++ src/sys/arch/arm/arm32/pmap.c	Wed Feb  5 07:37:35 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.387 2020/02/02 08:56:29 skrll Exp $	*/
+/*	$NetBSD: pmap.c,v 1.388 2020/02/05 07:37:35 skrll Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -198,7 +198,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.387 2020/02/02 08:56:29 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.388 2020/02/05 07:37:35 skrll Exp $");
 
 #include 
 #include 
@@ -3768,8 +3768,11 @@ pmap_kenter_pa(vaddr_t va, paddr_t pa, v
 		if (!(flags & PMAP_NOCACHE))
 			npte |= pte_l2_s_cache_mode_pt;
 	} else {
-		switch (flags & PMAP_CACHE_MASK) {
+		switch (flags & (PMAP_CACHE_MASK | PMAP_DEV_MASK)) {
+		case PMAP_DEV ... PMAP_DEV | PMAP_CACHE_MASK:
+			break;
 		case PMAP_NOCACHE:
+			npte |= pte_l2_s_nocache_mode;
 			break;
 		case PMAP_WRITE_COMBINE:
 			npte |= pte_l2_s_wc_mode;
@@ -6759,8 +6762,7 @@ pmap_map_section(vaddr_t l1pt, vaddr_t v
 
 	switch (cache) {
 	case PTE_NOCACHE:
-	default:
-		fl = 0;
+		fl = pte_l1_s_nocache_mode;
 		break;
 
 	case PTE_CACHE:
@@ -6770,6 +6772,11 @@ pmap_map_section(vaddr_t l1pt, vaddr_t v
 	case PTE_PAGETABLE:
 		fl = pte_l1_s_cache_mode_pt;
 		break;
+
+	case PTE_DEV:
+	default:
+		fl = 0;
+		break;
 	}
 
 	const pd_entry_t npde = L1_S_PROTO | pa |
@@ -6795,8 +6802,7 @@ 

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

2020-02-04 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Feb  5 07:18:16 UTC 2020

Modified Files:
src/sys/arch/usermode/dev: if_veth.c

Log Message:
Adopt 


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/usermode/dev/if_veth.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/usermode/dev/if_veth.c
diff -u src/sys/arch/usermode/dev/if_veth.c:1.13 src/sys/arch/usermode/dev/if_veth.c:1.14
--- src/sys/arch/usermode/dev/if_veth.c:1.13	Wed May 29 10:07:29 2019
+++ src/sys/arch/usermode/dev/if_veth.c	Wed Feb  5 07:18:16 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_veth.c,v 1.13 2019/05/29 10:07:29 msaitoh Exp $ */
+/* $NetBSD: if_veth.c,v 1.14 2020/02/05 07:18:16 skrll Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_veth.c,v 1.13 2019/05/29 10:07:29 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_veth.c,v 1.14 2020/02/05 07:18:16 skrll Exp $");
 
 #include 
 #include 
@@ -225,14 +225,14 @@ veth_softrx(void *priv)
 		MGETHDR(m, M_DONTWAIT, MT_DATA);
 		if (m == NULL) {
 			vethprintf("MGETHDR failed (input error)\n");
-			++ifp->if_ierrors;
+			if_statinc(ifp, if_ierrors);
 			continue;
 		}
 		if (len > MHLEN) {
 			MCLGET(m, M_DONTWAIT);
 			if ((m->m_flags & M_EXT) == 0) {
 m_freem(m);
-++ifp->if_ierrors;
+if_statinc(ifp, if_ierrors);
 vethprintf("M_EXT not set (input error)\n");
 continue;
 			}
@@ -297,9 +297,9 @@ veth_start(struct ifnet *ifp)
 		m0->m_pkthdr.len);
 		vethprintf("write returned %d\n", len);
 		if (len > 0)
-			++ifp->if_opackets;
+			if_statinc(ifp, if_opackets);
 		else
-			++ifp->if_oerrors;
+			if_statinc(ifp, if_oerrors);
 		m_freem(m0);
 	}
 }
@@ -316,7 +316,7 @@ static void
 veth_watchdog(struct ifnet *ifp)
 {
 	vethprintf("%s: %s flags=%x\n", __func__, ifp->if_xname, ifp->if_flags);
-	++ifp->if_oerrors;
+	if_statinc(ifp, if_oerrors);
 	veth_init(ifp);
 }
 



CVS commit: src/sys/dev/pci/ixgbe

2020-02-04 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Feb  5 07:45:46 UTC 2020

Modified Files:
src/sys/dev/pci/ixgbe: ix_txrx.c ixgbe.c ixgbe.h ixgbe_common.c

Log Message:
No functional change:

 - Add debug printf()s.
 - Remove unused macros.
 - Remove extra newline.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.224 -r1.225 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.63 -r1.64 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/pci/ixgbe/ixgbe_common.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/ixgbe/ix_txrx.c
diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.61 src/sys/dev/pci/ixgbe/ix_txrx.c:1.62
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.61	Thu Jan 30 14:02:14 2020
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Wed Feb  5 07:45:46 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.61 2020/01/30 14:02:14 thorpej Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.62 2020/02/05 07:45:46 msaitoh Exp $ */
 
 /**
 
@@ -1556,7 +1556,6 @@ ixgbe_setup_receive_ring(struct rx_ring 
 		rxbuf->addr = htole64(rxbuf->pmap->dm_segs[0].ds_addr);
 	}
 
-
 	/* Setup our descriptor indices */
 	rxr->next_to_check = 0;
 	rxr->next_to_refresh = 0;
@@ -1612,6 +1611,7 @@ ixgbe_setup_receive_structures(struct ad
 	struct rx_ring *rxr = adapter->rx_rings;
 	intj;
 
+	INIT_DEBUGOUT("ixgbe_setup_receive_structures");
 	for (j = 0; j < adapter->num_queues; j++, rxr++)
 		if (ixgbe_setup_receive_ring(rxr))
 			goto fail;

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.224 src/sys/dev/pci/ixgbe/ixgbe.c:1.225
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.224	Wed Feb  5 01:44:53 2020
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Wed Feb  5 07:45:46 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.224 2020/02/05 01:44:53 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.225 2020/02/05 07:45:46 msaitoh Exp $ */
 
 /**
 
@@ -677,6 +677,8 @@ ixgbe_initialize_transmit_units(struct a
 	struct ixgbe_hw	*hw = >hw;
 	int i;
 
+	INIT_DEBUGOUT("ixgbe_initialize_transmit_units");
+
 	/* Setup the Base and Length of the Tx Descriptor Ring */
 	for (i = 0; i < adapter->num_queues; i++, txr++) {
 		u64 tdba = txr->txdma.dma_paddr;

Index: src/sys/dev/pci/ixgbe/ixgbe.h
diff -u src/sys/dev/pci/ixgbe/ixgbe.h:1.63 src/sys/dev/pci/ixgbe/ixgbe.h:1.64
--- src/sys/dev/pci/ixgbe/ixgbe.h:1.63	Tue Feb  4 19:42:55 2020
+++ src/sys/dev/pci/ixgbe/ixgbe.h	Wed Feb  5 07:45:46 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.h,v 1.63 2020/02/04 19:42:55 thorpej Exp $ */
+/* $NetBSD: ixgbe.h,v 1.64 2020/02/05 07:45:46 msaitoh Exp $ */
 
 /**
   SPDX-License-Identifier: BSD-3-Clause
@@ -646,29 +646,6 @@ struct adapter {
 #define IXGBE_CORE_LOCK_ASSERT(_sc)   KASSERT(mutex_owned(&(_sc)->core_mtx))
 #define IXGBE_TX_LOCK_ASSERT(_sc) KASSERT(mutex_owned(&(_sc)->tx_mtx))
 
-/* Stats macros */
-#if __FreeBSD_version >= 1100036
-#define IXGBE_SET_IERRORS(sc, count) (sc)->ierrors = (count)
-#define IXGBE_SET_OPACKETS(sc, count)(sc)->opackets = (count)
-#define IXGBE_SET_OERRORS(sc, count) (sc)->oerrors = (count)
-#define IXGBE_SET_COLLISIONS(sc, count)
-#define IXGBE_SET_IBYTES(sc, count)  (sc)->ibytes = (count)
-#define IXGBE_SET_OBYTES(sc, count)  (sc)->obytes = (count)
-#define IXGBE_SET_IMCASTS(sc, count) (sc)->imcasts = (count)
-#define IXGBE_SET_OMCASTS(sc, count) (sc)->omcasts = (count)
-#define IXGBE_SET_IQDROPS(sc, count) (sc)->iqdrops = (count)
-#else
-#define IXGBE_SET_IERRORS(sc, count) (sc)->ifp->if_ierrors = (count)
-#define IXGBE_SET_OPACKETS(sc, count)(sc)->ifp->if_opackets = (count)
-#define IXGBE_SET_OERRORS(sc, count) (sc)->ifp->if_oerrors = (count)
-#define IXGBE_SET_COLLISIONS(sc, count)  (sc)->ifp->if_collisions = (count)
-#define IXGBE_SET_IBYTES(sc, count)  (sc)->ifp->if_ibytes = (count)
-#define IXGBE_SET_OBYTES(sc, count)  (sc)->ifp->if_obytes = (count)
-#define IXGBE_SET_IMCASTS(sc, count) (sc)->ifp->if_imcasts = (count)
-#define IXGBE_SET_OMCASTS(sc, count) (sc)->ifp->if_omcasts = (count)
-#define IXGBE_SET_IQDROPS(sc, count) (sc)->ifp->if_iqdrops = (count)
-#endif
-
 /* External PHY register addresses */
 #define IXGBE_PHY_CURRENT_TEMP		0xC820
 #define IXGBE_PHY_OVERTEMP_STATUS	0xC830

Index: src/sys/dev/pci/ixgbe/ixgbe_common.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_common.c:1.26 src/sys/dev/pci/ixgbe/ixgbe_common.c:1.27
--- src/sys/dev/pci/ixgbe/ixgbe_common.c:1.26	Mon Dec 16 02:50:54 2019
+++ src/sys/dev/pci/ixgbe/ixgbe_common.c	Wed Feb  5 07:45:46 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_common.c,v 1.26 2019/12/16 02:50:54 msaitoh Exp $ */
+/* $NetBSD: ixgbe_common.c,v 1.27 

CVS commit: src/sys/dev/pci/ixgbe

2020-02-04 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Feb  5 01:44:53 UTC 2020

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

Log Message:
 Update comment in ixgbe_update_stats_counters() to clarify why we update
if_iqdrops and if_ierrors only. No functional change.
OK'd by knakahara and thorpej.


To generate a diff of this commit:
cvs rdiff -u -r1.223 -r1.224 src/sys/dev/pci/ixgbe/ixgbe.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/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.223 src/sys/dev/pci/ixgbe/ixgbe.c:1.224
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.223	Tue Feb  4 19:42:55 2020
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Wed Feb  5 01:44:53 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.223 2020/02/04 19:42:55 thorpej Exp $ */
+/* $NetBSD: ixgbe.c,v 1.224 2020/02/05 01:44:53 msaitoh Exp $ */
 
 /**
 
@@ -1708,15 +1708,11 @@ ixgbe_update_stats_counters(struct adapt
 		stats->fcoedwtc.ev_count += IXGBE_READ_REG(hw, IXGBE_FCOEDWTC);
 	}
 
-	/* Fill out the OS statistics structure */
 	/*
-	 * NetBSD: Don't override if_{i|o}{packets|bytes|mcasts} with
-	 * adapter->stats counters. It's required to make ifconfig -z
-	 * (SOICZIFDATA) work.
+	 * Fill out the OS statistics structure. Only RX errors are required
+	 * here because all TX counters are incremented in the TX path and
+	 * normal RX counters are prepared in ether_input().
 	 */
-	/* XXX Actually, just fill in the per-cpu stats, please !!! */
-
-	/* Rx Errors */
 	net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
 	if_statadd_ref(nsr, if_iqdrops, total_missed_rx);
 	if_statadd_ref(nsr, if_ierrors, crcerrs + rlec);



CVS commit: src/sys/dev/mii

2020-02-04 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Feb  5 06:38:36 UTC 2020

Modified Files:
src/sys/dev/mii: miidevs.h miidevs_data.h

Log Message:
 Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.159 -r1.160 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.147 -r1.148 src/sys/dev/mii/miidevs_data.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/mii/miidevs.h
diff -u src/sys/dev/mii/miidevs.h:1.159 src/sys/dev/mii/miidevs.h:1.160
--- src/sys/dev/mii/miidevs.h:1.159	Wed Nov  6 16:00:33 2019
+++ src/sys/dev/mii/miidevs.h	Wed Feb  5 06:38:36 2020
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs.h,v 1.159 2019/11/06 16:00:33 msaitoh Exp $	*/
+/*	$NetBSD: miidevs.h,v 1.160 2020/02/05 06:38:36 msaitoh Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.161 2019/11/06 16:00:02 msaitoh Exp
+ *	NetBSD: miidevs,v 1.162 2020/02/05 06:38:20 msaitoh Exp
  */
 
 /*-
@@ -89,7 +89,6 @@
 #define	MII_OUI_TSC	0x00c039	/* TDK Semiconductor */
 #define	MII_OUI_MYSON	0x00c0b4	/* Myson Technology */
 #define	MII_OUI_ATTANSIC	0x00c82e	/* Attansic Technology */
-#define	MII_OUI_RDC	0x00d02d	/* RDC Semiconductor */
 #define	MII_OUI_JMICRON	0x00d831	/* JMicron */
 #define	MII_OUI_PMCSIERRA	0x00e004	/* PMC-Sierra */
 #define	MII_OUI_SIS	0x00e006	/* Silicon Integrated Systems */
@@ -122,6 +121,7 @@
 #define	MII_OUI_xxVITESSE	0x008083	/* Vitesse Semiconductor */
 #define	MII_OUI_xxPMCSIERRA2	0x009057	/* PMC-Sierra */
 #define	MII_OUI_xxCICADA	0x00c08f	/* Cicada Semiconductor */
+#define	MII_OUI_xxRDC	0x00d02d	/* RDC Semiconductor */
 #define	MII_OUI_xxNATSEMI	0x1000e8	/* National Semiconductor */
 #define	MII_OUI_xxLEVEL1	0x782000	/* Level 1 */
 #define	MII_OUI_xxXAQTI	0xace000	/* XaQti Corp. */
@@ -555,8 +555,8 @@
 #define	MII_STR_xxQUALSEMI_QS6612	"QS6612 10/100 media interface"
 
 /* RDC Semiconductor PHYs */
-#define	MII_MODEL_RDC_R6040	0x0003
-#define	MII_STR_RDC_R6040	"R6040 10/100 media interface"
+#define	MII_MODEL_xxRDC_R6040	0x0003
+#define	MII_STR_xxRDC_R6040	"R6040 10/100 media interface"
 
 /* RealTek PHYs */
 #define	MII_MODEL_xxREALTEK_RTL8169S	0x0011

Index: src/sys/dev/mii/miidevs_data.h
diff -u src/sys/dev/mii/miidevs_data.h:1.147 src/sys/dev/mii/miidevs_data.h:1.148
--- src/sys/dev/mii/miidevs_data.h:1.147	Wed Nov  6 16:00:33 2019
+++ src/sys/dev/mii/miidevs_data.h	Wed Feb  5 06:38:36 2020
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs_data.h,v 1.147 2019/11/06 16:00:33 msaitoh Exp $	*/
+/*	$NetBSD: miidevs_data.h,v 1.148 2020/02/05 06:38:36 msaitoh Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.161 2019/11/06 16:00:02 msaitoh Exp
+ *	NetBSD: miidevs,v 1.162 2020/02/05 06:38:20 msaitoh Exp
  */
 
 /*-
@@ -229,7 +229,7 @@ struct mii_knowndev mii_knowndevs[] = {
  { MII_OUI_xxPMCSIERRA2, MII_MODEL_xxPMCSIERRA2_PM8353, MII_STR_xxPMCSIERRA2_PM8353 },
  { MII_OUI_PMCSIERRA, MII_MODEL_PMCSIERRA_PM8354, MII_STR_PMCSIERRA_PM8354 },
  { MII_OUI_xxQUALSEMI, MII_MODEL_xxQUALSEMI_QS6612, MII_STR_xxQUALSEMI_QS6612 },
- { MII_OUI_RDC, MII_MODEL_RDC_R6040, MII_STR_RDC_R6040 },
+ { MII_OUI_xxRDC, MII_MODEL_xxRDC_R6040, MII_STR_xxRDC_R6040 },
  { MII_OUI_xxREALTEK, MII_MODEL_xxREALTEK_RTL8169S, MII_STR_xxREALTEK_RTL8169S },
  { MII_OUI_yyREALTEK, MII_MODEL_yyREALTEK_RTL8201L, MII_STR_yyREALTEK_RTL8201L },
  { MII_OUI_REALTEK, MII_MODEL_REALTEK_RTL8251, MII_STR_REALTEK_RTL8251 },



CVS commit: src/sys/dev/mii

2020-02-04 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Feb  5 06:39:13 UTC 2020

Modified Files:
src/sys/dev/mii: rdcphy.c

Log Message:
RDC -> xxRDC. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/mii/rdcphy.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/mii/rdcphy.c
diff -u src/sys/dev/mii/rdcphy.c:1.5 src/sys/dev/mii/rdcphy.c:1.6
--- src/sys/dev/mii/rdcphy.c:1.5	Wed Nov 27 10:19:21 2019
+++ src/sys/dev/mii/rdcphy.c	Wed Feb  5 06:39:13 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: rdcphy.c,v 1.5 2019/11/27 10:19:21 msaitoh Exp $*/
+/*  $NetBSD: rdcphy.c,v 1.6 2020/02/05 06:39:13 msaitoh Exp $*/
 
 /*-
  * Copyright (c) 2010, Pyun YongHyeon 
@@ -33,7 +33,7 @@
  * Driver for the RDC Semiconductor R6040 10/100 PHY.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rdcphy.c,v 1.5 2019/11/27 10:19:21 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rdcphy.c,v 1.6 2020/02/05 06:39:13 msaitoh Exp $");
 
 #include 
 #include 
@@ -74,7 +74,7 @@ static const struct mii_phy_funcs rdcphy
 };
 
 static const struct mii_phydesc rdcphys[] = {
-	MII_PHY_DESC(RDC, R6040),
+	MII_PHY_DESC(xxRDC, R6040),
 	MII_PHY_END,
 };
 



CVS commit: src/sys/dev/mii

2020-02-04 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Feb  5 06:38:20 UTC 2020

Modified Files:
src/sys/dev/mii: miidevs

Log Message:
 Change the OUI macro name of RDC to xxRDC. 0x00d02d is non-bitreverse value
of official 0x000bb4. From Andrius V.


To generate a diff of this commit:
cvs rdiff -u -r1.161 -r1.162 src/sys/dev/mii/miidevs

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/mii/miidevs
diff -u src/sys/dev/mii/miidevs:1.161 src/sys/dev/mii/miidevs:1.162
--- src/sys/dev/mii/miidevs:1.161	Wed Nov  6 16:00:02 2019
+++ src/sys/dev/mii/miidevs	Wed Feb  5 06:38:20 2020
@@ -1,4 +1,4 @@
-$NetBSD: miidevs,v 1.161 2019/11/06 16:00:02 msaitoh Exp $
+$NetBSD: miidevs,v 1.162 2020/02/05 06:38:20 msaitoh Exp $
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -82,7 +82,6 @@ oui INTEL			0x00aa00	Intel
 oui TSC0x00c039	TDK Semiconductor
 oui MYSON			0x00c0b4	Myson Technology
 oui ATTANSIC			0x00c82e	Attansic Technology
-oui RDC0x00d02d	RDC Semiconductor
 oui JMICRON			0x00d831	JMicron
 oui PMCSIERRA			0x00e004	PMC-Sierra
 oui SIS0x00e006	Silicon Integrated Systems
@@ -115,6 +114,7 @@ oui yyASIX			0x007063	Asix Semiconductor
 oui xxVITESSE			0x008083	Vitesse Semiconductor
 oui xxPMCSIERRA2		0x009057	PMC-Sierra
 oui xxCICADA			0x00c08f	Cicada Semiconductor
+oui xxRDC			0x00d02d	RDC Semiconductor
 oui xxNATSEMI			0x1000e8	National Semiconductor
 oui xxLEVEL1			0x782000	Level 1
 oui xxXAQTI			0xace000	XaQti Corp.
@@ -361,7 +361,7 @@ model PMCSIERRA PM8354		0x0004 PM8354 Qu
 model xxQUALSEMI QS6612		0x QS6612 10/100 media interface
 
 /* RDC Semiconductor PHYs */
-model RDC R6040			0x0003 R6040 10/100 media interface
+model xxRDC R6040		0x0003 R6040 10/100 media interface
 
 /* RealTek PHYs */
 model xxREALTEK RTL8169S	0x0011 RTL8169S/8110S/8211 1000BASE-T media interface



CVS commit: src/tests/lib/libc/sys

2020-02-04 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Feb  4 15:06:27 UTC 2020

Modified Files:
src/tests/lib/libc/sys: t_ptrace_wait.c

Log Message:
Add new ATF tests for unrelated tracer in t_ptrace_wait*

New tests:
 - unrelated_tracer_posix_spawn_detach_spawner
 - unrelated_tracer_fork_detach_forker
 - unrelated_tracer_vfork_detach_vforker
 - unrelated_tracer_vfork_detach_vforkerdone
 - unrelated_tracer_posix_spawn_kill_spawner
 - unrelated_tracer_fork_kill_forker
 - unrelated_tracer_vfork_kill_vforker
 - unrelated_tracer_vfork_kill_vforkerdone

All tests pass.


To generate a diff of this commit:
cvs rdiff -u -r1.149 -r1.150 src/tests/lib/libc/sys/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/lib/libc/sys/t_ptrace_wait.c
diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.149 src/tests/lib/libc/sys/t_ptrace_wait.c:1.150
--- src/tests/lib/libc/sys/t_ptrace_wait.c:1.149	Wed Jan 29 03:51:56 2020
+++ src/tests/lib/libc/sys/t_ptrace_wait.c	Tue Feb  4 15:06:27 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.c,v 1.149 2020/01/29 03:51:56 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_wait.c,v 1.150 2020/02/04 15:06:27 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.149 2020/01/29 03:51:56 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.150 2020/02/04 15:06:27 kamil Exp $");
 
 #define __LEGACY_PT_LWPINFO
 
@@ -116,7 +116,7 @@ static_assert(sizeof(((struct ptrace_sta
 #define SYSCALL_REQUIRE_ERRNO(res, exp) ATF_REQUIRE_MSG(res == exp, \
 "%d(%s) != %d", res, strerror(res), exp)
 
-static int debug = 0;
+static int debug = 1;
 
 #define DPRINTF(a, ...)	do  \
 	if (debug) \
@@ -3869,6 +3869,292 @@ FORK_DETACH_FORKER(vfork_kill_vforkerdon
 
 /// 
 
+#if defined(TWAIT_HAVE_PID)
+static void
+unrelated_tracer_fork_detach_forker_body(const char *fn, bool kill_process)
+{
+	const int sigval = SIGSTOP;
+	struct msg_fds parent_tracee, parent_tracer;
+	const int exitval = 10;
+	const int exitval2 = 0; /* This matched exit status from /bin/echo */
+	pid_t tracee, tracer, wpid;
+	pid_t tracee2 = 0;
+	uint8_t msg = 0xde; /* dummy message for IPC based on pipe(2) */
+#if defined(TWAIT_HAVE_STATUS)
+	int status;
+#endif
+	int op;
+
+	struct ptrace_siginfo info;
+	ptrace_state_t state;
+	const int slen = sizeof(state);
+	ptrace_event_t event;
+	const int elen = sizeof(event);
+
+	char * const arg[] = { __UNCONST("/bin/echo"), NULL };
+
+	DPRINTF("Spawn tracee\n");
+	SYSCALL_REQUIRE(msg_open(_tracee) == 0);
+	tracee = atf_utils_fork();
+	if (tracee == 0) {
+		// Wait for parent to let us crash
+		CHILD_FROM_PARENT("exit tracee", parent_tracee, msg);
+
+		DPRINTF("Before raising %s from child\n", strsignal(sigval));
+		FORKEE_ASSERT(raise(sigval) == 0);
+
+		if (strcmp(fn, "spawn") == 0) {
+			FORKEE_ASSERT_EQ(posix_spawn(,
+			arg[0], NULL, NULL, arg, NULL), 0);
+		} else  {
+			if (strcmp(fn, "fork") == 0) {
+FORKEE_ASSERT((tracee2 = fork()) != -1);
+			} else {
+FORKEE_ASSERT((tracee2 = vfork()) != -1);
+			}
+
+			if (tracee2 == 0)
+_exit(exitval2);
+		}
+
+		FORKEE_REQUIRE_SUCCESS
+		(wpid = TWAIT_GENERIC(tracee2, , 0), tracee2);
+
+		forkee_status_exited(status, exitval2);
+
+		DPRINTF("Before exiting of the child process\n");
+		_exit(exitval);
+	}
+
+	DPRINTF("Spawn debugger\n");
+	SYSCALL_REQUIRE(msg_open(_tracer) == 0);
+	tracer = atf_utils_fork();
+	if (tracer == 0) {
+		/* Fork again and drop parent to reattach to PID 1 */
+		tracer = atf_utils_fork();
+		if (tracer != 0)
+			_exit(exitval);
+
+		DPRINTF("Before calling PT_ATTACH from tracee %d\n", getpid());
+		FORKEE_ASSERT(ptrace(PT_ATTACH, tracee, NULL, 0) != -1);
+
+		/* Wait for tracee and assert that it was stopped w/ SIGSTOP */
+		FORKEE_REQUIRE_SUCCESS(
+		wpid = TWAIT_GENERIC(tracee, , 0), tracee);
+
+		forkee_status_stopped(status, SIGSTOP);
+
+		DPRINTF("Before calling ptrace(2) with PT_GET_SIGINFO for the "
+		"traced process\n");
+		SYSCALL_REQUIRE(
+		ptrace(PT_GET_SIGINFO, tracee, , sizeof(info)) != -1);
+
+		DPRINTF("Signal traced to lwpid=%d\n", info.psi_lwpid);
+		DPRINTF("Signal properties: si_signo=%#x si_code=%#x "
+		"si_errno=%#x\n", info.psi_siginfo.si_signo,
+		info.psi_siginfo.si_code, info.psi_siginfo.si_errno);
+
+		FORKEE_ASSERT_EQ(info.psi_siginfo.si_signo, SIGSTOP);
+		FORKEE_ASSERT_EQ(info.psi_siginfo.si_code, SI_USER);
+
+		/* Resume tracee with PT_CONTINUE */
+		FORKEE_ASSERT(ptrace(PT_CONTINUE, tracee, (void *)1, 0) != -1);
+
+		/* Inform parent that tracer has attached to tracee */
+		CHILD_TO_PARENT("tracer ready", parent_tracer, msg);
+
+		/* Wait for parent to tell use that tracee should have exited */
+		CHILD_FROM_PARENT("wait for tracee exit", parent_tracer, msg);

CVS commit: src/sys/arch/emips/ebus

2020-02-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Feb  4 13:53:07 UTC 2020

Modified Files:
src/sys/arch/emips/ebus: if_le_ebus.c

Log Message:
Fix oversight


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/emips/ebus/if_le_ebus.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/emips/ebus/if_le_ebus.c
diff -u src/sys/arch/emips/ebus/if_le_ebus.c:1.22 src/sys/arch/emips/ebus/if_le_ebus.c:1.23
--- src/sys/arch/emips/ebus/if_le_ebus.c:1.22	Tue Feb  4 07:35:45 2020
+++ src/sys/arch/emips/ebus/if_le_ebus.c	Tue Feb  4 13:53:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_le_ebus.c,v 1.22 2020/02/04 07:35:45 skrll Exp $	*/
+/*	$NetBSD: if_le_ebus.c,v 1.23 2020/02/04 13:53:07 martin Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_le_ebus.c,v 1.22 2020/02/04 07:35:45 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_le_ebus.c,v 1.23 2020/02/04 13:53:07 martin Exp $");
 
 #include "opt_inet.h"
 
@@ -554,7 +554,7 @@ enic_watchdog(struct ifnet *ifp)
 	printf("enic_watch ctl=%x\n", sc->sc_regs->Control);
 #endif
 	log(LOG_ERR, "%s: device timeout\n", device_xname(sc->sc_dev));
-	++ifp->if_oerrors;
+	if_statinc(ifp, if_oerrors);
 
 	enic_reset(ifp);
 }



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

2020-02-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Feb  4 13:47:34 UTC 2020

Modified Files:
src/sys/arch/macppc/dev: am79c950.c if_bm.c

Log Message:
Convert a few more drivers to the if_stats interface


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/macppc/dev/am79c950.c
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/macppc/dev/if_bm.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/macppc/dev/am79c950.c
diff -u src/sys/arch/macppc/dev/am79c950.c:1.48 src/sys/arch/macppc/dev/am79c950.c:1.49
--- src/sys/arch/macppc/dev/am79c950.c:1.48	Tue Feb  4 07:36:36 2020
+++ src/sys/arch/macppc/dev/am79c950.c	Tue Feb  4 13:47:34 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: am79c950.c,v 1.48 2020/02/04 07:36:36 skrll Exp $	*/
+/*	$NetBSD: am79c950.c,v 1.49 2020/02/04 13:47:34 martin Exp $	*/
 
 /*-
  * Copyright (c) 1997 David Huang 
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: am79c950.c,v 1.48 2020/02/04 07:36:36 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: am79c950.c,v 1.49 2020/02/04 13:47:34 martin Exp $");
 
 #include "opt_inet.h"
 
@@ -439,19 +439,19 @@ mcintr(void *arg)
 #ifdef MCDEBUG
 		printf("%s: jabber error\n", device_xname(sc->sc_dev));
 #endif
-		sc->sc_if.if_oerrors++;
+		if_statinc(>sc_if, if_oerrors);
 	}
 
 	if (ir & BABL) {
 #ifdef MCDEBUG
 		printf("%s: babble\n", device_xname(sc->sc_dev));
 #endif
-		sc->sc_if.if_oerrors++;
+		if_statinc(>sc_if, if_oerrors);
 	}
 
 	if (ir & CERR) {
 		printf("%s: collision error\n", device_xname(sc->sc_dev));
-		sc->sc_if.if_collisions++;
+		if_statinc(>sc_if, if_collisions);
 	}
 
 	/*
@@ -486,27 +486,29 @@ mc_tint(struct mc_softc *sc)
 		return;
 	}
 
+	net_stat_ref_t nsr = IF_STAT_GETREF(>sc_if);
 	if (xmtfs & LCOL) {
 		printf("%s: late collision\n", device_xname(sc->sc_dev));
-		sc->sc_if.if_oerrors++;
-		sc->sc_if.if_collisions++;
+		if_statinc_ref(nsr, if_oerrors);
+		if_statinc_ref(nsr, if_collisions);
 	}
 
 	if (xmtfs & MORE)
 		/* Real number is unknown. */
-		sc->sc_if.if_collisions += 2;
+		if_statadd_ref(nsr, if_collisions, 2);
 	else if (xmtfs & ONE)
-		sc->sc_if.if_collisions++;
+		if_statinc_ref(nsr, if_collisions);
 	else if (xmtfs & RTRY) {
-		sc->sc_if.if_collisions += 16;
-		sc->sc_if.if_oerrors++;
+		if_statadd_ref(nsr, if_collisions, 16);
+		if_statinc_ref(nsr, if_oerrors);
 	}
 
 	if (xmtfs & LCAR) {
 		sc->sc_havecarrier = 0;
 		printf("%s: lost carrier\n", device_xname(sc->sc_dev));
-		sc->sc_if.if_oerrors++;
+		if_statinc_ref(nsr, if_oerrors);
 	}
+	IF_STAT_PUTREF(>sc_if);
 
 	sc->sc_if.if_flags &= ~IFF_OACTIVE;
 	sc->sc_if.if_timer = 0;
@@ -530,18 +532,18 @@ mc_rint(struct mc_softc *sc)
 
 	if (rxf.rx_rcvsts & OFLO) {
 		printf("%s: receive FIFO overflow\n", device_xname(sc->sc_dev));
-		sc->sc_if.if_ierrors++;
+		if_statinc(>sc_if, if_ierrors);
 		return;
 	}
 
 	if (rxf.rx_rcvsts & CLSN)
-		sc->sc_if.if_collisions++;
+		if_statinc(>sc_if, if_collisions);
 
 	if (rxf.rx_rcvsts & FRAM) {
 #ifdef MCDEBUG
 		printf("%s: framing error\n", device_xname(sc->sc_dev));
 #endif
-		sc->sc_if.if_ierrors++;
+		if_statinc(>sc_if, if_ierrors);
 		return;
 	}
 
@@ -550,7 +552,7 @@ mc_rint(struct mc_softc *sc)
 		printf("%s: frame control checksum error\n",
 		device_xname(sc->sc_dev));
 #endif
-		sc->sc_if.if_ierrors++;
+		if_statinc(>sc_if, if_ierrors);
 		return;
 	}
 

Index: src/sys/arch/macppc/dev/if_bm.c
diff -u src/sys/arch/macppc/dev/if_bm.c:1.62 src/sys/arch/macppc/dev/if_bm.c:1.63
--- src/sys/arch/macppc/dev/if_bm.c:1.62	Tue Feb  4 07:36:36 2020
+++ src/sys/arch/macppc/dev/if_bm.c	Tue Feb  4 13:47:34 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bm.c,v 1.62 2020/02/04 07:36:36 skrll Exp $	*/
+/*	$NetBSD: if_bm.c,v 1.63 2020/02/04 13:47:34 martin Exp $	*/
 
 /*-
  * Copyright (C) 1998, 1999, 2000 Tsubai Masanari.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bm.c,v 1.62 2020/02/04 07:36:36 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bm.c,v 1.63 2020/02/04 13:47:34 martin Exp $");
 
 #include "opt_inet.h"
 
@@ -436,7 +436,7 @@ bmac_intr(void *v)
 	if (stat & IntFrameSent) {
 		sc->sc_if.if_flags &= ~IFF_OACTIVE;
 		sc->sc_if.if_timer = 0;
-		sc->sc_if.if_opackets++;
+		if_statinc(>sc_if, if_opackets);
 		if_schedule_deferred_start(>sc_if);
 	}