CVS commit: src/sys/dev/imcsmb

2018-02-27 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Feb 28 06:08:14 UTC 2018

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

Log Message:
Remove extra blank line


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/imcsmb/imcsmb.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/imcsmb/imcsmb.c
diff -u src/sys/dev/imcsmb/imcsmb.c:1.16 src/sys/dev/imcsmb/imcsmb.c:1.17
--- src/sys/dev/imcsmb/imcsmb.c:1.16	Wed Feb 28 05:53:13 2018
+++ src/sys/dev/imcsmb/imcsmb.c	Wed Feb 28 06:08:14 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: imcsmb.c,v 1.16 2018/02/28 05:53:13 pgoyette Exp $/ */
+/* $NetBSD: imcsmb.c,v 1.17 2018/02/28 06:08:14 pgoyette Exp $/ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -66,8 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imcsmb.c,v 1.16 2018/02/28 05:53:13 pgoyette Exp $");
-
+__KERNEL_RCSID(0, "$NetBSD: imcsmb.c,v 1.17 2018/02/28 06:08:14 pgoyette Exp $");
 
 #include 
 #include 



CVS commit: src/sys/dev/imcsmb

2018-02-27 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Feb 28 05:53:13 UTC 2018

Modified Files:
src/sys/dev/imcsmb: imc.c imcsmb.c

Log Message:
Add RCSID and short title/synopsis


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/imcsmb/imc.c
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/imcsmb/imcsmb.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/imcsmb/imc.c
diff -u src/sys/dev/imcsmb/imc.c:1.5 src/sys/dev/imcsmb/imc.c:1.6
--- src/sys/dev/imcsmb/imc.c:1.5	Tue Feb 27 11:50:57 2018
+++ src/sys/dev/imcsmb/imc.c	Wed Feb 28 05:53:13 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: imc.c,v 1.5 2018/02/27 11:50:57 pgoyette Exp $ */
+/* $NetBSD: imc.c,v 1.6 2018/02/28 05:53:13 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -59,6 +59,14 @@
  * SUCH DAMAGE.
  */
 
+/*
+ * Driver to expose the SMBus controllers in Intel's Integrated
+ * Memory Controllers in certain CPUs.
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: imc.c,v 1.6 2018/02/28 05:53:13 pgoyette Exp $");
+
 #include 
 #include 
 #include 

Index: src/sys/dev/imcsmb/imcsmb.c
diff -u src/sys/dev/imcsmb/imcsmb.c:1.15 src/sys/dev/imcsmb/imcsmb.c:1.16
--- src/sys/dev/imcsmb/imcsmb.c:1.15	Tue Feb 27 23:33:44 2018
+++ src/sys/dev/imcsmb/imcsmb.c	Wed Feb 28 05:53:13 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: imcsmb.c,v 1.15 2018/02/27 23:33:44 pgoyette Exp $/ */
+/* $NetBSD: imcsmb.c,v 1.16 2018/02/28 05:53:13 pgoyette Exp $/ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -59,7 +59,15 @@
  * SUCH DAMAGE.
  */
 
-/* A detailed description of this device is present in imc.c */
+/* 
+ * Driver for the SMBus controllers in Intel's Integrated Memory Controllers
+ * in certain CPUs.  A more detailed description of this device is present
+ * in imc.c */
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: imcsmb.c,v 1.16 2018/02/28 05:53:13 pgoyette Exp $");
+
 
 #include 
 #include 



CVS commit: src/sys/dev

2018-02-27 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Feb 28 05:50:06 UTC 2018

Modified Files:
src/sys/dev/acpi: acpi_mcfg.c
src/sys/dev/pci: pci_quirks.c pcivar.h

Log Message:
- Add new PCI quirk PCI_QUIRK_HASEXTCNF and PCI_QUIRK_NOEXTCNF. Some devices'
  extended configuration area may be broken or violate spec. If an extended
  configuration space is strange but it really exist, use PCI_QUIRK_HASEXTCNF.
  If an extended configuration space is plausible to exist but it really
  doesn't exist, use PCI_QUIRK_NOEXTCNF.
- Add PCI_PRODUCT_INTEL_XEOND_MEM_0_TTR_1(0x6fa8) and
  PCI_PRODUCT_INTEL_COREI76K_IMC_0(0x6f68) with PCI_QUIRK_HASEXTCNF. The
  document clearly states they violate spec and it support the extended
  configuration space.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/acpi/acpi_mcfg.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/pci/pci_quirks.c
cvs rdiff -u -r1.109 -r1.110 src/sys/dev/pci/pcivar.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/acpi/acpi_mcfg.c
diff -u src/sys/dev/acpi/acpi_mcfg.c:1.4 src/sys/dev/acpi/acpi_mcfg.c:1.5
--- src/sys/dev/acpi/acpi_mcfg.c:1.4	Tue Jul 12 09:45:34 2016
+++ src/sys/dev/acpi/acpi_mcfg.c	Wed Feb 28 05:50:06 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_mcfg.c,v 1.4 2016/07/12 09:45:34 hannken Exp $	*/
+/*	$NetBSD: acpi_mcfg.c,v 1.5 2018/02/28 05:50:06 msaitoh Exp $	*/
 
 /*-
  * Copyright (C) 2015 NONAKA Kimihiro 
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_mcfg.c,v 1.4 2016/07/12 09:45:34 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_mcfg.c,v 1.5 2018/02/28 05:50:06 msaitoh Exp $");
 
 #include 
 #include 
@@ -464,6 +464,9 @@ acpimcfg_device_probe(const struct pci_a
 	int func = pa->pa_function;
 	int last_dev, last_func, end_func;
 	int alias = 0;
+	const struct pci_quirkdata *qd;
+	bool force_hasextcnf = false;
+	bool force_noextcnf = false;
 	int i, j;
 
 	seg = acpimcfg_get_segment(bus);
@@ -488,9 +491,18 @@ acpimcfg_device_probe(const struct pci_a
 	}
 	mb->last_probed = tag;
 
+	reg = pci_conf_read(pc, tag, PCI_ID_REG);
+	qd = pci_lookup_quirkdata(PCI_VENDOR(reg), PCI_PRODUCT(reg));
+	if (qd != NULL && (qd->quirks & PCI_QUIRK_HASEXTCNF) != 0)
+		force_hasextcnf = true;
+	if (qd != NULL && (qd->quirks & PCI_QUIRK_NOEXTCNF) != 0)
+		force_noextcnf = true;
+	
 	/* Probe extended configuration space. */
-	if (((reg = pci_conf_read(pc, tag, PCI_CONF_SIZE)) == (pcireg_t)-1) ||
-	(reg == 0) || (alias = acpimcfg_ext_conf_is_aliased(pc, tag))) {
+	if ((!force_hasextcnf) && ((force_noextcnf) ||
+		((reg = pci_conf_read(pc, tag, PCI_CONF_SIZE)) == (pcireg_t)-1)
+		|| (reg == 0)
+		|| (alias = acpimcfg_ext_conf_is_aliased(pc, tag {
 		aprint_debug_dev(acpi_sc->sc_dev,
 		"MCFG: %03d:%02d:%d: invalid config space "
 		"(cfg[0x%03x]=0x%08x, alias=%s)\n", bus, dev, func,

Index: src/sys/dev/pci/pci_quirks.c
diff -u src/sys/dev/pci/pci_quirks.c:1.9 src/sys/dev/pci/pci_quirks.c:1.10
--- src/sys/dev/pci/pci_quirks.c:1.9	Wed Aug 19 16:31:28 2009
+++ src/sys/dev/pci/pci_quirks.c	Wed Feb 28 05:50:06 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_quirks.c,v 1.9 2009/08/19 16:31:28 pgoyette Exp $	*/
+/*	$NetBSD: pci_quirks.c,v 1.10 2018/02/28 05:50:06 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1998 Christopher G. Demetriou.  All rights reserved.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_quirks.c,v 1.9 2009/08/19 16:31:28 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_quirks.c,v 1.10 2018/02/28 05:50:06 msaitoh Exp $");
 
 #include 
 #include 
@@ -49,6 +49,10 @@ static const struct pci_quirkdata pci_qu
 	PCI_QUIRK_MULTIFUNCTION },
 	{ PCI_VENDOR_NVIDIA, PCI_PRODUCT_NVIDIA_XBOX_PCHB,
 	PCI_QUIRK_SKIP_FUNC1 | PCI_QUIRK_SKIP_FUNC2 },
+	{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XEOND_MEM_0_TTR_1,
+	PCI_QUIRK_HASEXTCNF },
+	{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_COREI76K_IMC_0,
+	PCI_QUIRK_HASEXTCNF },
 };
 
 const struct pci_quirkdata *

Index: src/sys/dev/pci/pcivar.h
diff -u src/sys/dev/pci/pcivar.h:1.109 src/sys/dev/pci/pcivar.h:1.110
--- src/sys/dev/pci/pcivar.h:1.109	Fri Nov 25 12:10:59 2016
+++ src/sys/dev/pci/pcivar.h	Wed Feb 28 05:50:06 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcivar.h,v 1.109 2016/11/25 12:10:59 knakahara Exp $	*/
+/*	$NetBSD: pcivar.h,v 1.110 2018/02/28 05:50:06 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1996, 1997 Christopher G. Demetriou.  All rights reserved.
@@ -208,8 +208,8 @@ struct pci_quirkdata {
 	pci_product_id_t	product;	/* Product ID */
 	int			quirks;		/* quirks; see below */
 };
-#define	PCI_QUIRK_MULTIFUNCTION		1
-#define	PCI_QUIRK_MONOFUNCTION		2
+#define	PCI_QUIRK_MULTIFUNCTION		__BIT(0)
+#define	PCI_QUIRK_MONOFUNCTION		__BIT(1)
 #define	PCI_QUIRK_SKIP_FUNC(n)		(4 << n)
 #define	PCI_QUIRK_SKIP_FUNC0		PCI_QUIRK_SKIP_FUNC(0)
 #define	PCI_QUIRK_SKIP_FUNC1		PCI_QUIRK_SKIP_FUNC(1)
@@ -219,6 +219,8 @@ struct 

CVS commit: src/share/man/man4/man4.x86

2018-02-27 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Feb 28 05:47:00 UTC 2018

Modified Files:
src/share/man/man4/man4.x86: imcsmb.4

Log Message:
Note that the imc driver works on at least one ASUS motherboard, the
X99-E.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/share/man/man4/man4.x86/imcsmb.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/man4.x86/imcsmb.4
diff -u src/share/man/man4/man4.x86/imcsmb.4:1.6 src/share/man/man4/man4.x86/imcsmb.4:1.7
--- src/share/man/man4/man4.x86/imcsmb.4:1.6	Sun Feb 25 12:57:39 2018
+++ src/share/man/man4/man4.x86/imcsmb.4	Wed Feb 28 05:47:00 2018
@@ -1,4 +1,4 @@
-.\" $NetBSD: imcsmb.4,v 1.6 2018/02/25 12:57:39 uwe Exp $
+.\" $NetBSD: imcsmb.4,v 1.7 2018/02/28 05:47:00 pgoyette Exp $
 .\"
 .\" Copyright (c) 2018 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -54,7 +54,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd February 24, 2018
+.Dd February 28, 2018
 .Dt IMCSMB 4
 .Os
 .Sh NAME
@@ -132,7 +132,7 @@ modification, on certain motherboards fr
 (Unfortunately, those modifications were based on material covered under a
 non-disclosure agreement, and therefore are not included in this driver.)
 The driver has also been tested and shown to work as-is on various motherboards
-from SuperMicro.
+from SuperMicro and ASUS.
 .Pp
 Because of the above, the
 .Nm



CVS commit: src/sys/dev/imcsmb

2018-02-27 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Feb 27 23:33:44 UTC 2018

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

Log Message:
Remove extraneous space from $NetBSD$ tag


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/imcsmb/imcsmb.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/imcsmb/imcsmb.c
diff -u src/sys/dev/imcsmb/imcsmb.c:1.14 src/sys/dev/imcsmb/imcsmb.c:1.15
--- src/sys/dev/imcsmb/imcsmb.c:1.14	Tue Feb 27 11:50:57 2018
+++ src/sys/dev/imcsmb/imcsmb.c	Tue Feb 27 23:33:44 2018
@@ -1,4 +1,4 @@
-/* $NetBSD $/ */
+/* $NetBSD: imcsmb.c,v 1.15 2018/02/27 23:33:44 pgoyette Exp $/ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.



CVS commit: src/sys/sys

2018-02-27 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Feb 27 23:09:02 UTC 2018

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

Log Message:
Fix pasto in a comment.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/sys/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/sys/sys/ucontext.h
diff -u src/sys/sys/ucontext.h:1.18 src/sys/sys/ucontext.h:1.19
--- src/sys/sys/ucontext.h:1.18	Wed Mar  6 18:16:58 2013
+++ src/sys/sys/ucontext.h	Tue Feb 27 23:09:02 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ucontext.h,v 1.18 2013/03/06 18:16:58 pooka Exp $	*/
+/*	$NetBSD: ucontext.h,v 1.19 2018/02/27 23:09:02 uwe Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2003 The NetBSD Foundation, Inc.
@@ -81,7 +81,7 @@ struct __ucontext {
  *			[undefined]	alpha, powerpc and vax
  *			0x0002	other ports
  *
- *	_UC_POWERPC_VEC Context does not use signal stack
+ *	_UC_POWERPC_VEC Context contains valid AltiVec context
  *			0x0001	powerpc only
  *
  *	_UC_POWERPC_SPE	Context contains valid SPE context



CVS commit: src/tests/lib/libpthread

2018-02-27 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Feb 27 20:34:04 UTC 2018

Modified Files:
src/tests/lib/libpthread: t_swapcontext.c

Log Message:
threadfunc - we do return from swapcontext() (since revision 1.2),
so drop the NOTREACHED comment.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/lib/libpthread/t_swapcontext.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/libpthread/t_swapcontext.c
diff -u src/tests/lib/libpthread/t_swapcontext.c:1.6 src/tests/lib/libpthread/t_swapcontext.c:1.7
--- src/tests/lib/libpthread/t_swapcontext.c:1.6	Tue Feb 27 20:31:35 2018
+++ src/tests/lib/libpthread/t_swapcontext.c	Tue Feb 27 20:34:04 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: t_swapcontext.c,v 1.6 2018/02/27 20:31:35 uwe Exp $ */
+/* $NetBSD: t_swapcontext.c,v 1.7 2018/02/27 20:34:04 uwe Exp $ */
 
 /*
  * Copyright (c) 2012 Emmanuel Dreyfus. All rights reserved.
@@ -82,7 +82,6 @@ threadfunc(void *arg)
 	ATF_REQUIRE_MSG(swapcontext(, ) != -1, "swapcontext failed: %s",
 	strerror(errno));
 
-	/* NOTREACHED */
 	return NULL;
 }
 



CVS commit: src/tests/lib/libpthread

2018-02-27 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Feb 27 20:31:35 UTC 2018

Modified Files:
src/tests/lib/libpthread: t_swapcontext.c

Log Message:
swapfunc() is not passed to pthread_create, there's no need for it to
have any arguments.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/lib/libpthread/t_swapcontext.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/libpthread/t_swapcontext.c
diff -u src/tests/lib/libpthread/t_swapcontext.c:1.5 src/tests/lib/libpthread/t_swapcontext.c:1.6
--- src/tests/lib/libpthread/t_swapcontext.c:1.5	Tue Feb 27 20:24:50 2018
+++ src/tests/lib/libpthread/t_swapcontext.c	Tue Feb 27 20:31:35 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: t_swapcontext.c,v 1.5 2018/02/27 20:24:50 uwe Exp $ */
+/* $NetBSD: t_swapcontext.c,v 1.6 2018/02/27 20:31:35 uwe Exp $ */
 
 /*
  * Copyright (c) 2012 Emmanuel Dreyfus. All rights reserved.
@@ -49,9 +49,8 @@ void *oself;
 void *nself;
 int val1, val2;
 
-/* ARGSUSED0 */
 static void
-swapfunc(void *arg)
+swapfunc(void)
 {
 	/*
 	 * If the test fails, we are very likely to crash



CVS commit: src/tests/lib/libpthread

2018-02-27 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Feb 27 20:24:50 UTC 2018

Modified Files:
src/tests/lib/libpthread: t_swapcontext.c

Log Message:
Drop unnecessary cast to makecontext() argument.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libpthread/t_swapcontext.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/libpthread/t_swapcontext.c
diff -u src/tests/lib/libpthread/t_swapcontext.c:1.4 src/tests/lib/libpthread/t_swapcontext.c:1.5
--- src/tests/lib/libpthread/t_swapcontext.c:1.4	Tue Feb 27 20:22:31 2018
+++ src/tests/lib/libpthread/t_swapcontext.c	Tue Feb 27 20:24:50 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: t_swapcontext.c,v 1.4 2018/02/27 20:22:31 uwe Exp $ */
+/* $NetBSD: t_swapcontext.c,v 1.5 2018/02/27 20:24:50 uwe Exp $ */
 
 /*
  * Copyright (c) 2012 Emmanuel Dreyfus. All rights reserved.
@@ -76,7 +76,7 @@ threadfunc(void *arg)
 	nctx.uc_stack.ss_sp = stack;
 	nctx.uc_stack.ss_size = sizeof(stack);
 
-	makecontext(, (void *)*swapfunc, 0);
+	makecontext(, swapfunc, 0);
 
 	oself = (void *)pthread_self();
 	printf("before swapcontext self = %p\n", oself);



CVS commit: src/tests/lib/libpthread

2018-02-27 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Feb 27 20:22:31 UTC 2018

Modified Files:
src/tests/lib/libpthread: t_swapcontext.c

Log Message:
Cleanup trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libpthread/t_swapcontext.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/libpthread/t_swapcontext.c
diff -u src/tests/lib/libpthread/t_swapcontext.c:1.3 src/tests/lib/libpthread/t_swapcontext.c:1.4
--- src/tests/lib/libpthread/t_swapcontext.c:1.3	Mon Jan 16 16:27:06 2017
+++ src/tests/lib/libpthread/t_swapcontext.c	Tue Feb 27 20:22:31 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: t_swapcontext.c,v 1.3 2017/01/16 16:27:06 christos Exp $ */
+/* $NetBSD: t_swapcontext.c,v 1.4 2018/02/27 20:22:31 uwe Exp $ */
 
 /*
  * Copyright (c) 2012 Emmanuel Dreyfus. All rights reserved.
@@ -54,9 +54,9 @@ static void
 swapfunc(void *arg)
 {
 	/*
-	 * If the test fails, we are very likely to crash 
+	 * If the test fails, we are very likely to crash
 	 * without the opportunity to report
-	 */ 
+	 */
 	nself = (void *)pthread_self();
 	printf("after swapcontext self = %p\n", nself);
 
@@ -75,9 +75,9 @@ threadfunc(void *arg)
 {
 	nctx.uc_stack.ss_sp = stack;
 	nctx.uc_stack.ss_size = sizeof(stack);
-   
+
 	makecontext(, (void *)*swapfunc, 0);
-   
+
 	oself = (void *)pthread_self();
 	printf("before swapcontext self = %p\n", oself);
 	ATF_REQUIRE_MSG(swapcontext(, ) != -1, "swapcontext failed: %s",



CVS commit: src/sys/netipsec

2018-02-27 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Feb 27 14:52:51 UTC 2018

Modified Files:
src/sys/netipsec: ipsec.c

Log Message:
Remove duplicate checks, and no need to initialize 'newsp' in
ipsec_set_policy.


To generate a diff of this commit:
cvs rdiff -u -r1.144 -r1.145 src/sys/netipsec/ipsec.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/netipsec/ipsec.c
diff -u src/sys/netipsec/ipsec.c:1.144 src/sys/netipsec/ipsec.c:1.145
--- src/sys/netipsec/ipsec.c:1.144	Tue Feb 27 14:44:10 2018
+++ src/sys/netipsec/ipsec.c	Tue Feb 27 14:52:51 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ipsec.c,v 1.144 2018/02/27 14:44:10 maxv Exp $ */
+/* $NetBSD: ipsec.c,v 1.145 2018/02/27 14:52:51 maxv Exp $ */
 /* $FreeBSD: src/sys/netipsec/ipsec.c,v 1.2.2.2 2003/07/01 01:38:13 sam Exp $ */
 /* $KAME: ipsec.c,v 1.103 2001/05/24 07:14:18 sakane Exp $ */
 
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.144 2018/02/27 14:44:10 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.145 2018/02/27 14:52:51 maxv Exp $");
 
 /*
  * IPsec controller part.
@@ -1278,15 +1278,13 @@ ipsec_set_policy(struct secpolicy **poli
 size_t len, kauth_cred_t cred)
 {
 	const struct sadb_x_policy *xpl;
-	struct secpolicy *newsp = NULL, *oldsp;
+	struct secpolicy *newsp, *oldsp;
 	int error;
 
 	KASSERT(!cpu_softintr_p());
 
 	/* sanity check. */
-	if (policy == NULL || *policy == NULL || request == NULL)
-		return EINVAL;
-	if (len < sizeof(*xpl))
+	if (policy == NULL || *policy == NULL)
 		return EINVAL;
 	xpl = (const struct sadb_x_policy *)request;
 
@@ -1396,8 +1394,7 @@ ipsec_get_policy(void *inp, const void *
 		return EINVAL;
 	}
 
-	/* sanity check. */
-	if (policy == NULL || mp == NULL)
+	if (policy == NULL)
 		return EINVAL;
 
 	*mp = key_sp2msg(policy, M_NOWAIT);



CVS commit: src/sys/rump/librump/rumpnet

2018-02-27 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Feb 27 14:45:43 UTC 2018

Modified Files:
src/sys/rump/librump/rumpnet: net_stub.c

Log Message:
Oops, forgot this file; I just merged two IPsec functions, so adapt
the rump stubs accordingly.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/rump/librump/rumpnet/net_stub.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/rump/librump/rumpnet/net_stub.c
diff -u src/sys/rump/librump/rumpnet/net_stub.c:1.29 src/sys/rump/librump/rumpnet/net_stub.c:1.30
--- src/sys/rump/librump/rumpnet/net_stub.c:1.29	Mon Feb 26 09:04:29 2018
+++ src/sys/rump/librump/rumpnet/net_stub.c	Tue Feb 27 14:45:43 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: net_stub.c,v 1.29 2018/02/26 09:04:29 maxv Exp $	*/
+/*	$NetBSD: net_stub.c,v 1.30 2018/02/27 14:45:43 maxv Exp $	*/
 
 /*
  * Copyright (c) 2008 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: net_stub.c,v 1.29 2018/02/26 09:04:29 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: net_stub.c,v 1.30 2018/02/27 14:45:43 maxv Exp $");
 
 #include 
 #include 
@@ -89,17 +89,16 @@ __weak_alias(esp4_ctlinput,rumpnet_stub)
 __weak_alias(esp6_ctlinput,rumpnet_stub);
 __weak_alias(ipsec4_output,rumpnet_stub);
 __weak_alias(ipsec4_common_input,rumpnet_stub);
-__weak_alias(ipsec4_delete_pcbpolicy,rumpnet_stub);
 __weak_alias(ipsec4_forward,rumpnet_stub);
 __weak_alias(ipsec4_input,rumpnet_stub);
 __weak_alias(ipsec4_set_policy,rumpnet_stub);
 __weak_alias(ipsec6_common_input,rumpnet_stub);
 __weak_alias(ipsec6_input,rumpnet_stub);
 __weak_alias(ipsec6_check_policy,rumpnet_stub);
-__weak_alias(ipsec6_delete_pcbpolicy,rumpnet_stub);
-__weak_alias(ipsec6_get_policy,rumpnet_stub);
 __weak_alias(ipsec6_process_packet,rumpnet_stub);
 __weak_alias(ipsec6_set_policy,rumpnet_stub);
+__weak_alias(ipsec_get_policy,rumpnet_stub);
+__weak_alias(ipsec_delete_pcbpolicy,rumpnet_stub);
 __weak_alias(ipsec_hdrsiz,rumpnet_stub);
 __weak_alias(ipsec_in_reject,rumpnet_stub);
 __weak_alias(ipsec_init_policy,rumpnet_stub);



CVS commit: src/sys

2018-02-27 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Feb 27 14:44:10 UTC 2018

Modified Files:
src/sys/netinet: in_pcb.c ip_output.c sctp_pcb.c
src/sys/netinet6: in6_pcb.c ip6_output.c
src/sys/netipsec: ipsec.c ipsec.h ipsec6.h

Log Message:
Dedup: merge

ipsec4_get_policy and ipsec6_get_policy
ipsec4_delete_pcbpolicy and ipsec6_delete_pcbpolicy

The already-existing ipsec_get_policy() function is inlined in the new
one.


To generate a diff of this commit:
cvs rdiff -u -r1.181 -r1.182 src/sys/netinet/in_pcb.c
cvs rdiff -u -r1.295 -r1.296 src/sys/netinet/ip_output.c
cvs rdiff -u -r1.15 -r1.16 src/sys/netinet/sctp_pcb.c
cvs rdiff -u -r1.164 -r1.165 src/sys/netinet6/in6_pcb.c
cvs rdiff -u -r1.201 -r1.202 src/sys/netinet6/ip6_output.c
cvs rdiff -u -r1.143 -r1.144 src/sys/netipsec/ipsec.c
cvs rdiff -u -r1.69 -r1.70 src/sys/netipsec/ipsec.h
cvs rdiff -u -r1.24 -r1.25 src/sys/netipsec/ipsec6.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/netinet/in_pcb.c
diff -u src/sys/netinet/in_pcb.c:1.181 src/sys/netinet/in_pcb.c:1.182
--- src/sys/netinet/in_pcb.c:1.181	Mon Jan  1 00:51:36 2018
+++ src/sys/netinet/in_pcb.c	Tue Feb 27 14:44:10 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: in_pcb.c,v 1.181 2018/01/01 00:51:36 christos Exp $	*/
+/*	$NetBSD: in_pcb.c,v 1.182 2018/02/27 14:44:10 maxv Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -93,7 +93,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in_pcb.c,v 1.181 2018/01/01 00:51:36 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in_pcb.c,v 1.182 2018/02/27 14:44:10 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -628,7 +628,7 @@ in_pcbdetach(void *v)
 
 #if defined(IPSEC)
 	if (ipsec_enabled)
-		ipsec4_delete_pcbpolicy(inp);
+		ipsec_delete_pcbpolicy(inp);
 #endif
 	so->so_pcb = NULL;
 

Index: src/sys/netinet/ip_output.c
diff -u src/sys/netinet/ip_output.c:1.295 src/sys/netinet/ip_output.c:1.296
--- src/sys/netinet/ip_output.c:1.295	Mon Feb 12 18:19:12 2018
+++ src/sys/netinet/ip_output.c	Tue Feb 27 14:44:10 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_output.c,v 1.295 2018/02/12 18:19:12 christos Exp $	*/
+/*	$NetBSD: ip_output.c,v 1.296 2018/02/27 14:44:10 maxv Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.295 2018/02/12 18:19:12 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.296 2018/02/27 14:44:10 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1384,7 +1384,7 @@ ip_ctloutput(int op, struct socket *so, 
 			struct mbuf *m = NULL;
 
 			/* XXX this will return EINVAL as sopt is empty */
-			error = ipsec4_get_policy(inp, sopt->sopt_data,
+			error = ipsec_get_policy(inp, sopt->sopt_data,
 			sopt->sopt_size, );
 			if (error == 0)
 error = sockopt_setmbuf(sopt, m);

Index: src/sys/netinet/sctp_pcb.c
diff -u src/sys/netinet/sctp_pcb.c:1.15 src/sys/netinet/sctp_pcb.c:1.16
--- src/sys/netinet/sctp_pcb.c:1.15	Tue Oct 17 19:23:42 2017
+++ src/sys/netinet/sctp_pcb.c	Tue Feb 27 14:44:10 2018
@@ -1,5 +1,5 @@
 /* $KAME: sctp_pcb.c,v 1.39 2005/06/16 18:29:25 jinmei Exp $ */
-/* $NetBSD: sctp_pcb.c,v 1.15 2017/10/17 19:23:42 rjs Exp $ */
+/* $NetBSD: sctp_pcb.c,v 1.16 2018/02/27 14:44:10 maxv Exp $ */
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc.
@@ -33,7 +33,7 @@
  * SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sctp_pcb.c,v 1.15 2017/10/17 19:23:42 rjs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sctp_pcb.c,v 1.16 2018/02/27 14:44:10 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -2153,7 +2153,7 @@ sctp_inpcb_free(struct sctp_inpcb *inp, 
 	/* First take care of socket level things */
 #ifdef IPSEC
 		if (ipsec_enabled)
-			ipsec4_delete_pcbpolicy(ip_pcb);
+			ipsec_delete_pcbpolicy(ip_pcb);
 #endif /*IPSEC*/
 		so->so_pcb = 0;
 	}

Index: src/sys/netinet6/in6_pcb.c
diff -u src/sys/netinet6/in6_pcb.c:1.164 src/sys/netinet6/in6_pcb.c:1.165
--- src/sys/netinet6/in6_pcb.c:1.164	Thu Feb  8 09:05:20 2018
+++ src/sys/netinet6/in6_pcb.c	Tue Feb 27 14:44:10 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: in6_pcb.c,v 1.164 2018/02/08 09:05:20 dholland Exp $	*/
+/*	$NetBSD: in6_pcb.c,v 1.165 2018/02/27 14:44:10 maxv Exp $	*/
 /*	$KAME: in6_pcb.c,v 1.84 2001/02/08 18:02:08 itojun Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in6_pcb.c,v 1.164 2018/02/08 09:05:20 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_pcb.c,v 1.165 2018/02/27 14:44:10 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -628,7 +628,7 @@ in6_pcbdetach(struct in6pcb *in6p)
 
 #if defined(IPSEC)
 	if (ipsec_enabled)
-		ipsec6_delete_pcbpolicy(in6p);
+		ipsec_delete_pcbpolicy(in6p);
 #endif
 	so->so_pcb = NULL;
 

Index: src/sys/netinet6/ip6_output.c
diff -u src/sys/netinet6/ip6_output.c:1.201 src/sys/netinet6/ip6_output.c:1.202

CVS commit: src

2018-02-27 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Feb 27 14:28:01 UTC 2018

Modified Files:
src/doc: TODO.smpnet
src/sys/conf: files
src/sys/dev: DEVNAMES
src/sys/net: files.net
src/sys/sys: mbuf.h
Removed Files:
src/sys/net: if_eco.h if_ecosubr.c

Log Message:
Remove the Econet code. It was part of acorn26, which was removed a
month ago.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/doc/TODO.smpnet
cvs rdiff -u -r1.1195 -r1.1196 src/sys/conf/files
cvs rdiff -u -r1.301 -r1.302 src/sys/dev/DEVNAMES
cvs rdiff -u -r1.15 -r1.16 src/sys/net/files.net
cvs rdiff -u -r1.8 -r0 src/sys/net/if_eco.h
cvs rdiff -u -r1.51 -r0 src/sys/net/if_ecosubr.c
cvs rdiff -u -r1.176 -r1.177 src/sys/sys/mbuf.h

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

Modified files:

Index: src/doc/TODO.smpnet
diff -u src/doc/TODO.smpnet:1.18 src/doc/TODO.smpnet:1.19
--- src/doc/TODO.smpnet:1.18	Tue Dec  5 03:23:29 2017
+++ src/doc/TODO.smpnet	Tue Feb 27 14:28:01 2018
@@ -1,4 +1,4 @@
-$NetBSD: TODO.smpnet,v 1.18 2017/12/05 03:23:29 ozaki-r Exp $
+$NetBSD: TODO.smpnet,v 1.19 2018/02/27 14:28:01 maxv Exp $
 
 MP-safe components
 ==
@@ -40,7 +40,6 @@ Non MP-safe components and kernel option
- ARCNET (if_arcsubr.c)
- ATM (if_atmsubr.c)
- BRIDGE_IPF
-   - if_ecosubr.c
- FDDI (if_fddisubr.c)
- HIPPI (if_hippisubr.c)
- IEEE 1394 (if_ieee1394subr.c)

Index: src/sys/conf/files
diff -u src/sys/conf/files:1.1195 src/sys/conf/files:1.1196
--- src/sys/conf/files:1.1195	Thu Feb 22 07:30:43 2018
+++ src/sys/conf/files	Tue Feb 27 14:28:01 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files,v 1.1195 2018/02/22 07:30:43 mrg Exp $
+#	$NetBSD: files,v 1.1196 2018/02/27 14:28:01 maxv Exp $
 #	@(#)files.newconf	7.5 (Berkeley) 5/10/93
 
 version 	20171118
@@ -418,11 +418,10 @@ include "dev/splash/files.splash"
 include "dev/videomode/files.videomode"
 
 # net device attributes - we have generic code for arc(net), ether(net),
-# fddi, token ring, atm and eco(net).
+# fddi, token ring, and atm.
 #
 define	arcnet
 define	atm
-define	eco
 define	ether
 define	fddi
 define	hippi

Index: src/sys/dev/DEVNAMES
diff -u src/sys/dev/DEVNAMES:1.301 src/sys/dev/DEVNAMES:1.302
--- src/sys/dev/DEVNAMES:1.301	Mon Feb 26 23:09:32 2018
+++ src/sys/dev/DEVNAMES	Tue Feb 27 14:28:01 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: DEVNAMES,v 1.301 2018/02/26 23:09:32 sevan Exp $
+#	$NetBSD: DEVNAMES,v 1.302 2018/02/27 14:28:01 maxv Exp $
 #
 # This file contains all used device names and defined attributes in
 # alphabetical order. New devices added to the system somewhere should first
@@ -382,7 +382,6 @@ ec			MI
 ec			sun2
 eca			acorn26
 eccmemctl		sparc
-eco			MI		Attribute
 ed			MI (MCA)
 ed			amiga
 ed			amigappc

Index: src/sys/net/files.net
diff -u src/sys/net/files.net:1.15 src/sys/net/files.net:1.16
--- src/sys/net/files.net:1.15	Fri Feb 16 04:48:32 2018
+++ src/sys/net/files.net	Tue Feb 27 14:28:01 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.net,v 1.15 2018/02/16 04:48:32 knakahara Exp $
+#	$NetBSD: files.net,v 1.16 2018/02/27 14:28:01 maxv Exp $
 
 # XXX CLEANUP
 define	net
@@ -12,7 +12,6 @@ file	net/if_arcsubr.c		arcnet			needs-fl
 file	net/if_atmsubr.c		atm
 file	net/if_bridge.c			bridge			needs-flag
 file	net/bridgestp.c			bridge
-file	net/if_ecosubr.c		eco
 file	net/if_etherip.c		etherip			needs-flag
 file	net/if_ethersubr.c		ether | fddi | netatalk | token |
 	wlan		needs-flag

Index: src/sys/sys/mbuf.h
diff -u src/sys/sys/mbuf.h:1.176 src/sys/sys/mbuf.h:1.177
--- src/sys/sys/mbuf.h:1.176	Tue Feb 27 14:14:19 2018
+++ src/sys/sys/mbuf.h	Tue Feb 27 14:28:01 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: mbuf.h,v 1.176 2018/02/27 14:14:19 maxv Exp $	*/
+/*	$NetBSD: mbuf.h,v 1.177 2018/02/27 14:28:01 maxv Exp $	*/
 
 /*
  * Copyright (c) 1996, 1997, 1999, 2001, 2007 The NetBSD Foundation, Inc.
@@ -920,8 +920,6 @@ struct	m_tag *m_tag_next(struct mbuf *, 
 
 #define	PACKET_TAG_INET6			26 /* IPv6 info */
 
-#define	PACKET_TAG_ECO_RETRYPARMS		27 /* Econet retry parameters */
-
 #define	PACKET_TAG_TUNNEL_INFO			28 /* tunnel identification and
 		* protocol callback, for
 		* loop detection/recovery



CVS commit: src/sys/sys

2018-02-27 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Feb 27 14:14:20 UTC 2018

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

Log Message:
style and fix typo


To generate a diff of this commit:
cvs rdiff -u -r1.175 -r1.176 src/sys/sys/mbuf.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/mbuf.h
diff -u src/sys/sys/mbuf.h:1.175 src/sys/sys/mbuf.h:1.176
--- src/sys/sys/mbuf.h:1.175	Mon Jan 22 07:11:45 2018
+++ src/sys/sys/mbuf.h	Tue Feb 27 14:14:19 2018
@@ -1,6 +1,6 @@
-/*	$NetBSD: mbuf.h,v 1.175 2018/01/22 07:11:45 maxv Exp $	*/
+/*	$NetBSD: mbuf.h,v 1.176 2018/02/27 14:14:19 maxv Exp $	*/
 
-/*-
+/*
  * Copyright (c) 1996, 1997, 1999, 2001, 2007 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
@@ -130,7 +130,7 @@ enum mowner_counter_index {
 struct mowner_counter {
 	u_long mc_counter[MOWNER_COUNTER_NCOUNTERS];
 };
-#endif /* defined(_KERNEL) */
+#endif
 
 /* userland-exported version of struct mowner */
 struct mowner_user {
@@ -146,7 +146,7 @@ struct mowner_user {
  */
 #define	mtod(m, t)	((t)((m)->m_data))
 
-/* header at beginning of each mbuf: */
+/* header at beginning of each mbuf */
 struct m_hdr {
 	struct	mbuf *mh_next;		/* next buffer in chain */
 	struct	mbuf *mh_nextpkt;	/* next chain in queue/record */
@@ -177,7 +177,7 @@ struct m_hdr {
  * Size ILP32: 40
  *   LP64: 56
  */
-struct	pkthdr {
+struct pkthdr {
 	union {
 		void		*ctx;		/* for M_GETCTX/M_SETCTX */
 		if_index_t	index;		/* rcv interface index */
@@ -201,7 +201,7 @@ struct	pkthdr {
 };
 
 /*
- * Note: These bits are carefully arrange so that the compiler can have
+ * Note: These bits are carefully arranged so that the compiler can have
  * a prayer of generating a jump table.
  */
 #define	M_CSUM_TCPv4		0x0001	/* TCP header/payload */
@@ -238,7 +238,7 @@ struct	pkthdr {
  * M_CSUM_DATA_IPv6_HL: length of ip6_hdr + ext header.
  * ie. offset of UDP/TCP header in the packet.
  *
- * M_CSUM_DATA_IPv6_OFFSET: offset of the checksum field in UDP/TCP header. 
+ * M_CSUM_DATA_IPv6_OFFSET: offset of the checksum field in UDP/TCP header.
  */
 
 #define	M_CSUM_DATA_IPv6_HL(x)		((x) >> 16)
@@ -353,7 +353,7 @@ MBUF_DEFINE(mbuf, MHLEN, MLEN);
 	 * IP header */
 #define	M_DECRYPTED	0x0020	/* confidentiality */
 #define	M_LOOP		0x0040	/* for Mbuf statistics */
-#define	M_AUTHIPDGM 0x0080	/* data origin authentication */
+#define	M_AUTHIPDGM	0x0080	/* data origin authentication */
 #define	M_BCAST		0x0100	/* send/received as link-level
 	 * broadcast */
 #define	M_MCAST		0x0200	/* send/received as link-level
@@ -816,13 +816,13 @@ struct mbstat_cpu {
 
 #ifdef	_KERNEL
 extern struct mbstat mbstat;
-extern int	nmbclusters;		/* limit on the # of clusters */
-extern int	mblowat;		/* mbuf low water mark */
-extern int	mcllowat;		/* mbuf cluster low water mark */
-extern int	max_linkhdr;		/* largest link-level header */
-extern int	max_protohdr;		/* largest protocol header */
-extern int	max_hdr;		/* largest link+protocol header */
-extern int	max_datalen;		/* MHLEN - max_hdr */
+extern int nmbclusters;		/* limit on the # of clusters */
+extern int mblowat;		/* mbuf low water mark */
+extern int mcllowat;		/* mbuf cluster low water mark */
+extern int max_linkhdr;		/* largest link-level header */
+extern int max_protohdr;		/* largest protocol header */
+extern int max_hdr;		/* largest link+protocol header */
+extern int max_datalen;		/* MHLEN - max_hdr */
 extern const int msize;			/* mbuf base size */
 extern const int mclbytes;		/* mbuf cluster size */
 extern pool_cache_t mb_cache;
@@ -840,7 +840,7 @@ MALLOC_DECLARE(M_SONAME);
 struct	mbuf *m_copym(struct mbuf *, int, int, int);
 struct	mbuf *m_copypacket(struct mbuf *, int);
 struct	mbuf *m_devget(char *, int, int, struct ifnet *,
-			void (*copy)(const void *, void *, size_t));
+void (*copy)(const void *, void *, size_t));
 struct	mbuf *m_dup(struct mbuf *, int, int, int);
 struct	mbuf *m_get(int, int);
 struct	mbuf *m_getclr(int, int);
@@ -854,13 +854,13 @@ struct	mbuf *m_getptr(struct mbuf *, int
 void	m_adj(struct mbuf *, int);
 struct	mbuf *m_defrag(struct mbuf *, int);
 int	m_apply(struct mbuf *, int, int,
-		int (*)(void *, void *, unsigned int), void *);
+int (*)(void *, void *, unsigned int), void *);
 void	m_cat(struct mbuf *,struct mbuf *);
 void	m_clget(struct mbuf *, int);
 int	m_mballoc(int, int);
 void	m_copyback(struct mbuf *, int, int, const void *);
 struct	mbuf *m_copyback_cow(struct mbuf *, int, int, const void *, int);
-int 	m_makewritable(struct mbuf **, int, int, int);
+int	m_makewritable(struct mbuf **, int, int, int);
 struct	mbuf *m_getcl(int, int, int);
 void	m_copydata(struct mbuf *, int, int, void *);
 struct	mbuf *m_free(struct mbuf *);



CVS commit: src/sys/netipsec

2018-02-27 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Feb 27 13:36:21 UTC 2018

Modified Files:
src/sys/netipsec: ipsec.c

Log Message:
Use inpcb_hdr to reduce the diff between

ipsec4_set_policy and ipsec6_set_policy
ipsec4_get_policy and ipsec6_get_policy
ipsec4_delete_pcbpolicy and ipsec6_delete_pcbpolicy

No real functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.142 -r1.143 src/sys/netipsec/ipsec.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/netipsec/ipsec.c
diff -u src/sys/netipsec/ipsec.c:1.142 src/sys/netipsec/ipsec.c:1.143
--- src/sys/netipsec/ipsec.c:1.142	Tue Feb 27 08:05:19 2018
+++ src/sys/netipsec/ipsec.c	Tue Feb 27 13:36:21 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ipsec.c,v 1.142 2018/02/27 08:05:19 maxv Exp $ */
+/* $NetBSD: ipsec.c,v 1.143 2018/02/27 13:36:21 maxv Exp $ */
 /* $FreeBSD: src/sys/netipsec/ipsec.c,v 1.2.2.2 2003/07/01 01:38:13 sam Exp $ */
 /* $KAME: ipsec.c,v 1.103 2001/05/24 07:14:18 sakane Exp $ */
 
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.142 2018/02/27 08:05:19 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.143 2018/02/27 13:36:21 maxv Exp $");
 
 /*
  * IPsec controller part.
@@ -1357,27 +1357,28 @@ int
 ipsec4_set_policy(struct inpcb *inp, int optname, const void *request,
 size_t len, kauth_cred_t cred)
 {
+	struct inpcb_hdr *inph = (struct inpcb_hdr *)inp;
 	const struct sadb_x_policy *xpl;
 	struct secpolicy **policy;
 
 	KASSERT(!cpu_softintr_p());
-	KASSERT(inp != NULL);
-	KASSERT(inp_locked(inp));
+	KASSERT(inph != NULL);
+	KASSERT(inph_locked(inph));
 	KASSERT(request != NULL);
 
 	if (len < sizeof(*xpl))
 		return EINVAL;
 	xpl = (const struct sadb_x_policy *)request;
 
-	KASSERT(inp->inp_sp != NULL);
+	KASSERT(inph->inph_sp != NULL);
 
 	/* select direction */
 	switch (xpl->sadb_x_policy_dir) {
 	case IPSEC_DIR_INBOUND:
-		policy = >inp_sp->sp_in;
+		policy = >inph_sp->sp_in;
 		break;
 	case IPSEC_DIR_OUTBOUND:
-		policy = >inp_sp->sp_out;
+		policy = >inph_sp->sp_out;
 		break;
 	default:
 		IPSECLOG(LOG_ERR, "invalid direction=%u\n",
@@ -1392,13 +1393,14 @@ int
 ipsec4_get_policy(struct inpcb *inp, const void *request, size_t len,
 struct mbuf **mp)
 {
+	struct inpcb_hdr *inph = (struct inpcb_hdr *)inp;
 	const struct sadb_x_policy *xpl;
 	struct secpolicy *policy;
 
 	/* sanity check. */
-	if (inp == NULL || request == NULL || mp == NULL)
+	if (inph == NULL || request == NULL || mp == NULL)
 		return EINVAL;
-	KASSERT(inp->inp_sp != NULL);
+	KASSERT(inph->inph_sp != NULL);
 	if (len < sizeof(*xpl))
 		return EINVAL;
 	xpl = (const struct sadb_x_policy *)request;
@@ -1406,10 +1408,10 @@ ipsec4_get_policy(struct inpcb *inp, con
 	/* select direction */
 	switch (xpl->sadb_x_policy_dir) {
 	case IPSEC_DIR_INBOUND:
-		policy = inp->inp_sp->sp_in;
+		policy = inph->inph_sp->sp_in;
 		break;
 	case IPSEC_DIR_OUTBOUND:
-		policy = inp->inp_sp->sp_out;
+		policy = inph->inph_sp->sp_out;
 		break;
 	default:
 		IPSECLOG(LOG_ERR, "invalid direction=%u\n",
@@ -1423,22 +1425,23 @@ ipsec4_get_policy(struct inpcb *inp, con
 int
 ipsec4_delete_pcbpolicy(struct inpcb *inp)
 {
+	struct inpcb_hdr *inph = (struct inpcb_hdr *)inp;
 
-	KASSERT(inp != NULL);
+	KASSERT(inph != NULL);
 
-	if (inp->inp_sp == NULL)
+	if (inph->inph_sp == NULL)
 		return 0;
 
-	if (inp->inp_sp->sp_in != NULL)
-		ipsec_destroy_policy(inp->inp_sp->sp_in);
+	if (inph->inph_sp->sp_in != NULL)
+		ipsec_destroy_policy(inph->inph_sp->sp_in);
 
-	if (inp->inp_sp->sp_out != NULL)
-		ipsec_destroy_policy(inp->inp_sp->sp_out);
+	if (inph->inph_sp->sp_out != NULL)
+		ipsec_destroy_policy(inph->inph_sp->sp_out);
 
-	ipsec_invalpcbcache(inp->inp_sp, IPSEC_DIR_ANY);
+	ipsec_invalpcbcache(inph->inph_sp, IPSEC_DIR_ANY);
 
-	ipsec_delpcbpolicy(inp->inp_sp);
-	inp->inp_sp = NULL;
+	ipsec_delpcbpolicy(inph->inph_sp);
+	inph->inph_sp = NULL;
 
 	return 0;
 }
@@ -1448,12 +1451,13 @@ int
 ipsec6_set_policy(struct in6pcb *in6p, int optname, const void *request,
 size_t len, kauth_cred_t cred)
 {
+	struct inpcb_hdr *inph = (struct inpcb_hdr *)in6p;
 	const struct sadb_x_policy *xpl;
 	struct secpolicy **policy;
 
 	KASSERT(!cpu_softintr_p());
-	KASSERT(in6p != NULL);
-	KASSERT(in6p_locked(in6p));
+	KASSERT(inph != NULL);
+	KASSERT(inph_locked(inph));
 	KASSERT(request != NULL);
 
 	if (len < sizeof(*xpl))
@@ -1463,10 +1467,10 @@ ipsec6_set_policy(struct in6pcb *in6p, i
 	/* select direction */
 	switch (xpl->sadb_x_policy_dir) {
 	case IPSEC_DIR_INBOUND:
-		policy = >in6p_sp->sp_in;
+		policy = >inph_sp->sp_in;
 		break;
 	case IPSEC_DIR_OUTBOUND:
-		policy = >in6p_sp->sp_out;
+		policy = >inph_sp->sp_out;
 		break;
 	default:
 		IPSECLOG(LOG_ERR, "invalid direction=%u\n",
@@ -1481,13 +1485,14 @@ int
 ipsec6_get_policy(struct in6pcb *in6p, const void *request, size_t len,
 struct mbuf **mp)
 {
+	struct 

CVS commit: src/sys/dev/ic

2018-02-27 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Feb 27 12:59:54 UTC 2018

Modified Files:
src/sys/dev/ic: nvme.c

Log Message:
- don't leak ccb on alloc failure.
- KASSERT to prevent memory leak.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/ic/nvme.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/ic/nvme.c
diff -u src/sys/dev/ic/nvme.c:1.31 src/sys/dev/ic/nvme.c:1.32
--- src/sys/dev/ic/nvme.c:1.31	Sat Oct 28 00:53:55 2017
+++ src/sys/dev/ic/nvme.c	Tue Feb 27 07:59:53 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvme.c,v 1.31 2017/10/28 04:53:55 riastradh Exp $	*/
+/*	$NetBSD: nvme.c,v 1.32 2018/02/27 12:59:53 christos Exp $	*/
 /*	$OpenBSD: nvme.c,v 1.49 2016/04/18 05:59:50 dlg Exp $ */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.31 2017/10/28 04:53:55 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.32 2018/02/27 12:59:53 christos Exp $");
 
 #include 
 #include 
@@ -570,8 +570,10 @@ nvme_ns_identify(struct nvme_softc *sc, 
 	KASSERT(ccb != NULL); /* it's a bug if we don't have spare ccb here */
 
 	mem = nvme_dmamem_alloc(sc, sizeof(*identify));
-	if (mem == NULL)
+	if (mem == NULL) {
+		nvme_ccb_put(sc->sc_admin_q, ccb);
 		return ENOMEM;
+	}
 
 	memset(, 0, sizeof(sqe));
 	sqe.opcode = NVM_ADMIN_IDENTIFY;
@@ -601,6 +603,7 @@ nvme_ns_identify(struct nvme_softc *sc, 
 
 	ns = nvme_ns_get(sc, nsid);
 	KASSERT(ns);
+	KASSERT(ns->ident == NULL);
 	ns->ident = identify;
 
 done:



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

2018-02-27 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Feb 27 12:20:35 UTC 2018

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

Log Message:
Include  in t_ucontext.c

The  user-land header is required for PRI types.
We were including indirectly  through  sources,
and this worked for most of the ports.

This fixes indirectly a build for MIPS (tested ports: arc and hpcmips),
where PRI types (PRIxREGISTER) were undefined.

Noted by .


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libc/sys/t_ucontext.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_ucontext.c
diff -u src/tests/lib/libc/sys/t_ucontext.c:1.4 src/tests/lib/libc/sys/t_ucontext.c:1.5
--- src/tests/lib/libc/sys/t_ucontext.c:1.4	Tue Feb 27 11:15:53 2018
+++ src/tests/lib/libc/sys/t_ucontext.c	Tue Feb 27 12:20:35 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: t_ucontext.c,v 1.4 2018/02/27 11:15:53 kamil Exp $ */
+/* $NetBSD: t_ucontext.c,v 1.5 2018/02/27 12:20:35 kamil Exp $ */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,11 +29,12 @@
 #include 
 __COPYRIGHT("@(#) Copyright (c) 2008\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_ucontext.c,v 1.4 2018/02/27 11:15:53 kamil Exp $");
+__RCSID("$NetBSD: t_ucontext.c,v 1.5 2018/02/27 12:20:35 kamil Exp $");
 
 #include 
 #include 
 #include 
+#include 
 
 ATF_TC(ucontext_basic);
 ATF_TC_HEAD(ucontext_basic, tc)



CVS commit: src/sys/dev/imcsmb

2018-02-27 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Feb 27 11:50:57 UTC 2018

Modified Files:
src/sys/dev/imcsmb: imc.c imcsmb.c

Log Message:
Detach our children before allowing ourselves to detach.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/imcsmb/imc.c
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/imcsmb/imcsmb.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/imcsmb/imc.c
diff -u src/sys/dev/imcsmb/imc.c:1.4 src/sys/dev/imcsmb/imc.c:1.5
--- src/sys/dev/imcsmb/imc.c:1.4	Mon Feb 26 05:47:03 2018
+++ src/sys/dev/imcsmb/imc.c	Tue Feb 27 11:50:57 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: imc.c,v 1.4 2018/02/26 05:47:03 pgoyette Exp $ */
+/* $NetBSD: imc.c,v 1.5 2018/02/27 11:50:57 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -259,6 +259,16 @@ imc_rescan(device_t self, const char * i
 static int
 imc_detach(device_t self, int flags)
 {
+	struct imc_softc *sc = device_private(self);
+	int i, error;
+
+	for (i = 0; i < 2; i++) {
+		if (sc->sc_smbchild[i] != NULL) {
+			error = config_detach(sc->sc_smbchild[i], flags); 
+			if (error)
+return error;
+		}
+	}
 
 	pmf_device_deregister(self);
 	return 0;

Index: src/sys/dev/imcsmb/imcsmb.c
diff -u src/sys/dev/imcsmb/imcsmb.c:1.13 src/sys/dev/imcsmb/imcsmb.c:1.14
--- src/sys/dev/imcsmb/imcsmb.c:1.13	Tue Feb 27 05:56:12 2018
+++ src/sys/dev/imcsmb/imcsmb.c	Tue Feb 27 11:50:57 2018
@@ -179,8 +179,15 @@ imcsmb_chdet(device_t self, device_t chi
 static int
 imcsmb_detach(device_t self, int flags)
 {
+	int error;
 	struct imcsmb_softc *sc = device_private(self);
 
+	if (sc->sc_smbus != NULL) {
+		error = config_detach(sc->sc_smbus, flags);
+		if (error)
+			return error;
+	}
+
 	pmf_device_deregister(self);
 	mutex_destroy(>sc_i2c_mutex);
 	return 0;



CVS commit: src/sys/arch/hppa/include

2018-02-27 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Feb 27 11:26:39 UTC 2018

Modified Files:
src/sys/arch/hppa/include: mcontext.h

Log Message:
Implement _UC_MACHINE_INTRV() for hppa

INTRV = integer return value
For hppa this is R28 alias _REG_RET0.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/hppa/include/mcontext.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/hppa/include/mcontext.h
diff -u src/sys/arch/hppa/include/mcontext.h:1.9 src/sys/arch/hppa/include/mcontext.h:1.10
--- src/sys/arch/hppa/include/mcontext.h:1.9	Thu Feb 15 15:53:56 2018
+++ src/sys/arch/hppa/include/mcontext.h	Tue Feb 27 11:26:39 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: mcontext.h,v 1.9 2018/02/15 15:53:56 kamil Exp $	*/
+/*	$NetBSD: mcontext.h,v 1.10 2018/02/27 11:26:39 kamil Exp $	*/
 
 #ifndef _HPPA_MCONTEXT_H_
 #define	_HPPA_MCONTEXT_H_
@@ -57,6 +57,7 @@ do {	\
 	(uc)->uc_mcontext.__gregs[_REG_PCOQH] = (pc);			\
 	(uc)->uc_mcontext.__gregs[_REG_PCOQT] = (pc) + 4;		\
 } while (/*CONSTCOND*/0)
+#define	_UC_MACHINE_INTRV(uc) 	((uc)->uc_mcontext.__gregs[_REG_RET0])
 
 static __inline void *
 __lwp_getprivate_fast(void)



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

2018-02-27 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Feb 27 11:15:53 UTC 2018

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

Log Message:
Make the t_ucontext.c test more portable

Cast _UC_MACHINE_*() to (register_t).
This allows to print the returned values with PRIxREGISTER.

This corrects build failures on MIPS and HPPA.
sizeof(int) == sizeof(long) on these 32-bit systems.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libc/sys/t_ucontext.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_ucontext.c
diff -u src/tests/lib/libc/sys/t_ucontext.c:1.3 src/tests/lib/libc/sys/t_ucontext.c:1.4
--- src/tests/lib/libc/sys/t_ucontext.c:1.3	Sun Feb 25 15:31:07 2018
+++ src/tests/lib/libc/sys/t_ucontext.c	Tue Feb 27 11:15:53 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: t_ucontext.c,v 1.3 2018/02/25 15:31:07 christos Exp $ */
+/* $NetBSD: t_ucontext.c,v 1.4 2018/02/27 11:15:53 kamil Exp $ */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 #include 
 __COPYRIGHT("@(#) Copyright (c) 2008\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_ucontext.c,v 1.3 2018/02/25 15:31:07 christos Exp $");
+__RCSID("$NetBSD: t_ucontext.c,v 1.4 2018/02/27 11:15:53 kamil Exp $");
 
 #include 
 #include 
@@ -80,7 +80,7 @@ ATF_TC_BODY(ucontext_sp, tc)
 
 	getcontext();
 
-	printf("_UC_MACHINE_SP(u)=%" PRIxREGISTER "\n", _UC_MACHINE_SP());
+	printf("_UC_MACHINE_SP(u)=%" PRIxREGISTER "\n", (register_t)_UC_MACHINE_SP());
 }
 
 ATF_TC(ucontext_fp);
@@ -95,7 +95,7 @@ ATF_TC_BODY(ucontext_fp, tc)
 
 	getcontext();
 
-	printf("_UC_MACHINE_FP(u)=%" PRIxREGISTER "\n", _UC_MACHINE_FP());
+	printf("_UC_MACHINE_FP(u)=%" PRIxREGISTER "\n", (register_t)_UC_MACHINE_FP());
 }
 
 ATF_TC(ucontext_pc);
@@ -110,7 +110,7 @@ ATF_TC_BODY(ucontext_pc, tc)
 
 	getcontext();
 
-	printf("_UC_MACHINE_PC(u)=%" PRIxREGISTER "\n", _UC_MACHINE_PC());
+	printf("_UC_MACHINE_PC(u)=%" PRIxREGISTER "\n", (register_t)_UC_MACHINE_PC());
 }
 
 ATF_TC(ucontext_intrv);
@@ -125,7 +125,7 @@ ATF_TC_BODY(ucontext_intrv, tc)
 
 	getcontext();
 
-	printf("_UC_MACHINE_INTRV(u)=%" PRIxREGISTER "\n", _UC_MACHINE_INTRV());
+	printf("_UC_MACHINE_INTRV(u)=%" PRIxREGISTER "\n", (register_t)_UC_MACHINE_INTRV());
 }
 
 ATF_TP_ADD_TCS(tp)



CVS commit: src/share/man/man2

2018-02-27 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue Feb 27 10:09:42 UTC 2018

Modified Files:
src/share/man/man2: ucontext.2

Log Message:
INTRV is INT-RV - integer return value (not INTR-V, interrupt vector) :)


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/share/man/man2/ucontext.2

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/man2/ucontext.2
diff -u src/share/man/man2/ucontext.2:1.9 src/share/man/man2/ucontext.2:1.10
--- src/share/man/man2/ucontext.2:1.9	Sun Feb 25 17:45:40 2018
+++ src/share/man/man2/ucontext.2	Tue Feb 27 10:09:42 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ucontext.2,v 1.9 2018/02/25 17:45:40 uwe Exp $
+.\"	$NetBSD: ucontext.2,v 1.10 2018/02/27 10:09:42 uwe Exp $
 .\"
 .\" Copyright (c) 2001 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -102,7 +102,7 @@ machine-specific information:
 .It Fn _UC_MACHINE_PC
 \(em read program counter,
 .It Fn _UC_MACHINE_INTRV
-\(em read interrupt vector,
+\(em read integer return value,
 .It Fn _UC_MACHINE_SET_PC
 \(em write program counter.
 .El



CVS commit: src/sys/arch/ia64/include

2018-02-27 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Feb 27 09:51:28 UTC 2018

Modified Files:
src/sys/arch/ia64/include: mcontext.h

Log Message:
Add a dummy implementation of _UC_MACHINE_INTRV() for ia64

This fixes a build problem in src/tests/lib/libc/sys/t_ucontext.c.

This needs to be revisited once the port will get more mature.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/ia64/include/mcontext.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/ia64/include/mcontext.h
diff -u src/sys/arch/ia64/include/mcontext.h:1.6 src/sys/arch/ia64/include/mcontext.h:1.7
--- src/sys/arch/ia64/include/mcontext.h:1.6	Thu Feb 15 15:53:56 2018
+++ src/sys/arch/ia64/include/mcontext.h	Tue Feb 27 09:51:28 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: mcontext.h,v 1.6 2018/02/15 15:53:56 kamil Exp $	*/
+/*	$NetBSD: mcontext.h,v 1.7 2018/02/27 09:51:28 kamil Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -115,6 +115,7 @@ typedef struct __mcontext {
 #define _UC_MACHINE_FP(uc)	((uc)->uc_mcontext.__gregs[79])
 /* XXX or assembly "mov Rn = ip" or ...? */
 #define	_UC_MACHINE_PC(uc)	((uc)->uc_mcontext.mc_special.iip)
+#define	_UC_MACHINE_INTRV(uc)	0 /* XXX */
 
 static __inline void *
 __lwp_getprivate_fast(void)



CVS commit: [netbsd-8] src/doc

2018-02-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Feb 27 09:08:22 UTC 2018

Modified Files:
src/doc [netbsd-8]: CHANGES-8.0

Log Message:
Ticket #593


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.133 -r1.1.2.134 src/doc/CHANGES-8.0

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

Modified files:

Index: src/doc/CHANGES-8.0
diff -u src/doc/CHANGES-8.0:1.1.2.133 src/doc/CHANGES-8.0:1.1.2.134
--- src/doc/CHANGES-8.0:1.1.2.133	Tue Feb 27 06:07:28 2018
+++ src/doc/CHANGES-8.0	Tue Feb 27 09:08:22 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.133 2018/02/27 06:07:28 martin Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.134 2018/02/27 09:08:22 martin Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -9969,3 +9969,23 @@ sys/dev/pci/ixgbe/ixv.c1.79-1.81
 	  the spec.
 	[msaitoh, ticket #592]
 
+sys/arch/alpha/alpha/pmap.c			1.262
+sys/arch/m68k/m68k/pmap_motorola.c		1.70
+sys/arch/powerpc/oea/pmap.c			1.95
+sys/arch/sparc64/sparc64/pmap.c			1.308
+sys/arch/x86/x86/pmap.c1.266 (via patch)
+sys/dev/dtv/dtv_scatter.c			1.4
+sys/dev/marvell/mvxpsec.c			1.2
+sys/kern/subr_extent.c1.86
+sys/kern/subr_pool.c1.209-1.216,1.219-1.220
+sys/kern/uipc_mbuf.c1.173
+sys/opencrypto/crypto.c1.102
+sys/sys/mbuf.h	1.172
+sys/sys/pool.h	1.80,1.82
+sys/ufs/chfs/chfs_malloc.c			1.5
+sys/uvm/uvm_fault.c1.202
+
+	Always use PR_WAITOK or PR_NOWAIT, never 0.  assert this.
+	Allow only one pending call to a pool's backing allocator at a time.
+	[mrg, ticket #593]
+



CVS commit: [netbsd-8] src/sys

2018-02-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Feb 27 09:07:33 UTC 2018

Modified Files:
src/sys/arch/alpha/alpha [netbsd-8]: pmap.c
src/sys/arch/m68k/m68k [netbsd-8]: pmap_motorola.c
src/sys/arch/powerpc/oea [netbsd-8]: pmap.c
src/sys/arch/sparc64/sparc64 [netbsd-8]: pmap.c
src/sys/arch/x86/x86 [netbsd-8]: pmap.c
src/sys/dev/dtv [netbsd-8]: dtv_scatter.c
src/sys/dev/marvell [netbsd-8]: mvxpsec.c
src/sys/kern [netbsd-8]: subr_extent.c subr_pool.c uipc_mbuf.c
src/sys/opencrypto [netbsd-8]: crypto.c
src/sys/sys [netbsd-8]: mbuf.h pool.h
src/sys/ufs/chfs [netbsd-8]: chfs_malloc.c
src/sys/uvm [netbsd-8]: uvm_fault.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #593):
sys/dev/marvell/mvxpsec.c: revision 1.2
sys/arch/m68k/m68k/pmap_motorola.c: revision 1.70
sys/opencrypto/crypto.c: revision 1.102
sys/arch/sparc64/sparc64/pmap.c: revision 1.308
sys/ufs/chfs/chfs_malloc.c: revision 1.5
sys/arch/powerpc/oea/pmap.c: revision 1.95
sys/sys/pool.h: revision 1.80,1.82
sys/kern/subr_pool.c: revision 1.209-1.216,1.219-1.220
sys/arch/alpha/alpha/pmap.c: revision 1.262
sys/kern/uipc_mbuf.c: revision 1.173
sys/uvm/uvm_fault.c: revision 1.202
sys/sys/mbuf.h: revision 1.172
sys/kern/subr_extent.c: revision 1.86
sys/arch/x86/x86/pmap.c: revision 1.266 (via patch)
sys/dev/dtv/dtv_scatter.c: revision 1.4

Allow only one pending call to a pool's backing allocator at a time.
Candidate fix for problems with hanging after kva fragmentation related
to PR kern/45718.

Proposed on tech-kern:
https://mail-index.NetBSD.org/tech-kern/2017/10/23/msg022472.html
Tested by bouyer@ on i386.

This makes one small change to the semantics of pool_prime and
pool_setlowat: they may fail with EWOULDBLOCK instead of ENOMEM, if
there is a pending call to the backing allocator in another thread but
we are not actually out of memory.  That is unlikely because nearly
always these are used during initialization, when the pool is not in
use.

Define the new flag too for previous commit.

pool_grow can now fail even when sleeping is ok. Catch this case in pool_get
and retry.

Assert that pool_get failure happens only with PR_NOWAIT.
This would have caught the mistake I made last week leading to null
pointer dereferences all over the place, a mistake which I evidently
poorly scheduled alongside maxv's change to the panic message on x86
for null pointer dereferences.

Since pr_lock is now used to wait for two things now (PR_GROWING and
PR_WANTED) we need to loop for the condition we wanted.
make the KASSERTMSG/panic strings consistent as '%s: [%s], __func__, wchan'
Handle the ERESTART case from pool_grow()

don't pass 0 to the pool flags
Guess pool_cache_get(pc, 0) means PR_WAITOK here.
Earlier on in the same context we use kmem_alloc(sz, KM_SLEEP).

use PR_WAITOK everywhere.
use PR_NOWAIT.

Don't use 0 for PR_NOWAIT

use PR_NOWAIT instead of 0

panic ex nihilo -- PR_NOWAITing for zerot

Add assertions that either PR_WAITOK or PR_NOWAIT are set.
- fix an assert; we can reach there if we are nowait or limitfail.
- when priming the pool and failing with ERESTART, don't decrement the number
  of pages; this avoids the issue of returning an ERESTART when we get to 0,
  and is more correct.
- simplify the pool_grow code, and don't wakeup things if we ENOMEM.

In pmap_enter_ma(), only try to allocate pves if we might need them,
and even if that fails, only fail the operation if we later discover
that we really do need them.  This implements the requirement that
pmap_enter(PMAP_CANFAIL) must not fail when replacing an existing
mapping with the first mapping of a new page, which is an unintended
consequence of the changes from the rmind-uvmplock branch in 2011.

The problem arises when pmap_enter(PMAP_CANFAIL) is used to replace an existing
pmap mapping with a mapping of a different page (eg. to resolve a 
copy-on-write).
If that fails and leaves the old pmap entry in place, then UVM won't hold
the right locks when it eventually retries.  This entanglement of the UVM and
pmap locking was done in rmind-uvmplock in order to improve performance,
but it also means that the UVM state and pmap state need to be kept in sync
more than they did before.  It would be possible to handle this in the UVM code
instead of in the pmap code, but these pmap changes improve the handling of
low memory situations in general, and handling this in UVM would be clunky,
so this seemed like the better way to go.

This somewhat indirectly fixes PR 52706, as well as the failing assertion
about "uvm_page_locked_p(old_pg)".  (but only on x86, various other platforms
will need their own changes to handle this issue.)
In uvm_fault_upper_enter(), if pmap_enter(PMAP_CANFAIL) fails, assert that
the pmap did not leave around a now-stale pmap mapping 

CVS commit: src/sys/netipsec

2018-02-27 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Feb 27 08:05:19 UTC 2018

Modified Files:
src/sys/netipsec: ipsec.c

Log Message:
Optimize: use ipsec_sp_hdrsiz instead of ipsec_hdrsiz, not to re-query
the SP.

ok ozaki-r@


To generate a diff of this commit:
cvs rdiff -u -r1.141 -r1.142 src/sys/netipsec/ipsec.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/netipsec/ipsec.c
diff -u src/sys/netipsec/ipsec.c:1.141 src/sys/netipsec/ipsec.c:1.142
--- src/sys/netipsec/ipsec.c:1.141	Mon Feb 26 10:36:24 2018
+++ src/sys/netipsec/ipsec.c	Tue Feb 27 08:05:19 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ipsec.c,v 1.141 2018/02/26 10:36:24 maxv Exp $ */
+/* $NetBSD: ipsec.c,v 1.142 2018/02/27 08:05:19 maxv Exp $ */
 /* $FreeBSD: src/sys/netipsec/ipsec.c,v 1.2.2.2 2003/07/01 01:38:13 sam Exp $ */
 /* $KAME: ipsec.c,v 1.103 2001/05/24 07:14:18 sakane Exp $ */
 
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.141 2018/02/26 10:36:24 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.142 2018/02/27 08:05:19 maxv Exp $");
 
 /*
  * IPsec controller part.
@@ -768,7 +768,7 @@ ipsec4_forward(struct mbuf *m, int *dest
 	}
 
 	/* Count IPsec header size. */
-	ipsechdr = ipsec_hdrsiz(m, IPSEC_DIR_OUTBOUND, NULL);
+	ipsechdr = ipsec_sp_hdrsiz(sp, m);
 
 	/*
 	 * Find the correct route for outer IPv4 header, compute tunnel MTU.