CVS commit: src/bin/mt

2018-08-31 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Sep  1 06:56:23 UTC 2018

Modified Files:
src/bin/mt: mt.1 mt.c

Log Message:
Make tape cache ioctls available to userland command.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/bin/mt/mt.1
cvs rdiff -u -r1.47 -r1.48 src/bin/mt/mt.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/mt/mt.1
diff -u src/bin/mt/mt.1:1.36 src/bin/mt/mt.1:1.37
--- src/bin/mt/mt.1:1.36	Mon Mar 19 10:48:20 2012
+++ src/bin/mt/mt.1	Sat Sep  1 06:56:23 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mt.1,v 1.36 2012/03/19 10:48:20 njoly Exp $
+.\"	$NetBSD: mt.1,v 1.37 2018/09/01 06:56:23 mlelstv Exp $
 .\"
 .\" Copyright (c) 1981, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -184,6 +184,10 @@ If
 is zero, disable compression.
 Otherwise enable compression.
 Not all tape drives support this feature.
+.It Cm cache
+Enable controller buffering.
+.It Cm nocache
+Disable controller buffering.
 .El
 .Pp
 If a tape name is not specified, and the environment variable

Index: src/bin/mt/mt.c
diff -u src/bin/mt/mt.c:1.47 src/bin/mt/mt.c:1.48
--- src/bin/mt/mt.c:1.47	Mon Aug 29 14:46:01 2011
+++ src/bin/mt/mt.c	Sat Sep  1 06:56:23 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: mt.c,v 1.47 2011/08/29 14:46:01 joerg Exp $ */
+/* $NetBSD: mt.c,v 1.48 2018/09/01 06:56:23 mlelstv Exp $ */
 
 /*
  * Copyright (c) 1980, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = "@(#)mt.c	8.2 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: mt.c,v 1.47 2011/08/29 14:46:01 joerg Exp $");
+__RCSID("$NetBSD: mt.c,v 1.48 2018/09/01 06:56:23 mlelstv Exp $");
 #endif
 #endif /* not lint */
 
@@ -101,6 +101,8 @@ static const struct commands com[] = {
 	{ CMD("status"),	MTIOCGET, MTNOP,  1,  0 },
 	{ CMD("weof"),		MTIOCTOP, MTWEOF, 0,  1 },
 	{ CMD("eew"),		MTIOCTOP, MTEWARN,1,  0 },
+	{ CMD("cache"),		MTIOCTOP, MTCACHE,1,  0 },
+	{ CMD("nocache"),	MTIOCTOP, MTNOCACHE,  1,  0 },
 	{ .c_name = NULL }
 };
 



CVS commit: [netbsd-8] src/doc

2018-08-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep  1 06:35:20 UTC 2018

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

Log Message:
Tickets #996 - #1003


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.17 -r1.1.2.18 src/doc/CHANGES-8.1

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.1
diff -u src/doc/CHANGES-8.1:1.1.2.17 src/doc/CHANGES-8.1:1.1.2.18
--- src/doc/CHANGES-8.1:1.1.2.17	Tue Aug 28 16:25:19 2018
+++ src/doc/CHANGES-8.1	Sat Sep  1 06:35:20 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.1,v 1.1.2.17 2018/08/28 16:25:19 snj Exp $
+# $NetBSD: CHANGES-8.1,v 1.1.2.18 2018/09/01 06:35:20 martin Exp $
 
 A complete list of changes from the NetBSD 8.0 release to the NetBSD 8.1
 release:
@@ -658,3 +658,72 @@ sys/arch/prep/prep/mainbus.c			1.34
 	Model 6015.
 	[martin, ticket #994]
 
+sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c 1.5-1.9
+sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.h 1.3-1.5
+sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv84_fence.c 1.3
+
+	Rewrite nouveau_fence in an attempt to make it make sense.
+	Fences may last longer than their channels.
+	Fix return values.
+	[riastradh, ticket #996]
+
+sys/external/bsd/common/include/linux/kernel.h	1.9
+sys/external/bsd/drm2/i915drm/intel_gtt.c	1.6
+sys/external/bsd/drm2/include/linux/bitops.h	1.12
+sys/external/bsd/drm2/include/linux/bitops.h	1.13
+sys/external/bsd/drm2/include/linux/delay.h	1.5
+sys/external/bsd/drm2/include/linux/vmalloc.h	1.5
+
+	Change hweight32 to take a uint32_t arg.
+	Fix find_first_zero_bit to find the high bits of 64-bit words.
+	Use uvm_km_alloc(kernel_map) and pmap_kenter, not uvm_pagermapin.
+	Flush chipset writes after GGTT update.
+	Round nsec up for usec delay.
+	libkern min/max is 32-bit.  Linux min/max is generic.
+	[riastradh, ticket #997]
+
+sys/dev/pci/agp_i810.c1.123
+sys/dev/pci/agp_i810var.h			1.7
+sys/external/bsd/drm2/i915drm/intel_gtt.c	1.7
+
+	Restore gtt page table control register on resume.
+	[riastradh, ticket #998]
+
+sys/dev/fss.c	1.105,1.106
+sys/dev/fssvar.h1.30,1.31
+
+	Change fss ioctl to no longer block while a snapshot gets
+	created or destroyed.
+	[hannken, ticket #999]
+
+sys/kern/vfs_bio.c1.277
+
+	Fix deadlock with getnewbuf().
+	[hannken, ticket #1000]
+
+usr.sbin/npf/npfctl/npf.conf.5			1.49,1.50(partly),
+		1.51-1.70 (patch)
+
+	Various improvements to the npf.conf(5) man page.
+	[maxv, ticket #1001]
+
+usr.bin/printf/printf.11.31 (patch)
+usr.bin/printf/printf.c1.43
+
+	Allow signed numbers as inputs for all integer formats, including
+	those which treat the data as unsigned.
+	[kre, ticket #1002]
+
+sys/external/bsd/drm2/dist/drm/i915/i915_reg.h	1.2
+sys/external/bsd/drm2/dist/drm/i915/intel_sdvo.c 1.8
+sys/external/bsd/drm2/dist/drm/ttm/ttm_tt.c	1.10
+sys/external/bsd/drm2/drm/drm_scatter.c		1.4
+sys/external/bsd/drm2/linux/linux_idr.c		1.6
+sys/external/bsd/drm2/linux/linux_ww_mutex.c	1.3,1.4
+
+	Miscelaneous minor improvements to DRM/KMS.
+	The state in netbsd-8 now matches HEAD before the
+	Linux 4.4 drm import, with the exception of Tegra (arm)
+	specific code.
+	[riastradh, ticket #1003]
+



CVS commit: [netbsd-8] src/sys/external/bsd/drm2

2018-08-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep  1 06:34:00 UTC 2018

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915 [netbsd-8]: i915_reg.h
intel_sdvo.c
src/sys/external/bsd/drm2/dist/drm/ttm [netbsd-8]: ttm_tt.c
src/sys/external/bsd/drm2/drm [netbsd-8]: drm_scatter.c
src/sys/external/bsd/drm2/linux [netbsd-8]: linux_idr.c
linux_ww_mutex.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1003):

sys/external/bsd/drm2/dist/drm/i915/intel_sdvo.c: revision 1.8
sys/external/bsd/drm2/dist/drm/ttm/ttm_tt.c: revision 1.10
sys/external/bsd/drm2/drm/drm_scatter.c: revision 1.4
sys/external/bsd/drm2/dist/drm/i915/i915_reg.h: revision 1.2
sys/external/bsd/drm2/linux/linux_ww_mutex.c: revision 1.3
sys/external/bsd/drm2/linux/linux_ww_mutex.c: revision 1.4
sys/external/bsd/drm2/linux/linux_idr.c: revision 1.6

Pull in upstream commit:
Author: Ville Syrj=E4l=E4 
Date:   Mon Jun 9 16:20:46 2014 +0300
drm/i915: Avoid div-by-zero when pixel_multiplier is zero
On certain platforms pixel_multiplier is read out in
.get_pipe_config(), but it also gets used to calculate the
pixel clock in intel_sdvo_get_config(). If the pipe is disabled
but some SDVO outputs are active, we may end up dividing by zero
in intel_sdvo_get_config().
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=3D76520
Tweak slightly sketchy logic in linux_idr.
1. idr_preload can fail if you don't set __GFP_WAIT.
2. If idr_preload fails, it is wrong for idr_alloc to assert.
3. There is no way for idr_alloc to know what flags idr_preload got.
Probably won't *fix* any bugs, but if there is a bug with a missing
__GFP_WAIT, then we will learn about a trifle sooner.
Fix error branch in ttm_dma_tt_init to avoid double-free.
Should fix symptom of PR kern/52438, but who knows what underlying
problem causes us to reach the error branch in the first place.
Fix lockdebug_locked annotations.
When thread A grants ownership to thread B waiting with a context,
thread B needs to assert lockdebug_locked; otherwise, when it
releases, lockdebug_unlocked thinks it's releasing an unlocked
ww_mutex.

Fixes LOCKDEBUG failure with radeon noticed by martin@.

more const

XXX: add a NULL init to avoid a GCC 6 maybe uninit warning.

Remove UB from definition of symbols in i915_reg.h
Kernel Undefined Behavior Sanitizer enforces more warnings in build time.
This makes the build fatal in the drm/i915 code in:
 - intel_ddi_put_crtc_pll(),
 - intel_ddi_clock_get(),
 - intel_ddi_pll_enable(),
 - intel_ddi_setup_hw_pll_state().
The error message in all the cases says:
  error: case label does not reduce to an integer constant
Set the type of the value left shifted to unsigned.
This change is required to build NetBSD/amd64 with KUBSan.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.2 -r1.1.1.2.22.1 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_reg.h
cvs rdiff -u -r1.7 -r1.7.10.1 \
src/sys/external/bsd/drm2/dist/drm/i915/intel_sdvo.c
cvs rdiff -u -r1.9 -r1.9.6.1 src/sys/external/bsd/drm2/dist/drm/ttm/ttm_tt.c
cvs rdiff -u -r1.3 -r1.3.22.1 src/sys/external/bsd/drm2/drm/drm_scatter.c
cvs rdiff -u -r1.5 -r1.5.10.1 src/sys/external/bsd/drm2/linux/linux_idr.c
cvs rdiff -u -r1.2 -r1.2.10.1 \
src/sys/external/bsd/drm2/linux/linux_ww_mutex.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/external/bsd/drm2/dist/drm/i915/i915_reg.h
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_reg.h:1.1.1.2 src/sys/external/bsd/drm2/dist/drm/i915/i915_reg.h:1.1.1.2.22.1
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_reg.h:1.1.1.2	Wed Jul 16 19:35:25 2014
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_reg.h	Sat Sep  1 06:34:00 2018
@@ -5426,10 +5426,10 @@ enum punit_power_well {
 #define  PORT_CLK_SEL_LCPLL_1350	(1<<29)
 #define  PORT_CLK_SEL_LCPLL_810		(2<<29)
 #define  PORT_CLK_SEL_SPLL		(3<<29)
-#define  PORT_CLK_SEL_WRPLL1		(4<<29)
-#define  PORT_CLK_SEL_WRPLL2		(5<<29)
-#define  PORT_CLK_SEL_NONE		(7<<29)
-#define  PORT_CLK_SEL_MASK		(7<<29)
+#define  PORT_CLK_SEL_WRPLL1		(4U<<29)
+#define  PORT_CLK_SEL_WRPLL2		(5U<<29)
+#define  PORT_CLK_SEL_NONE		(7U<<29)
+#define  PORT_CLK_SEL_MASK		(7U<<29)
 
 /* Transcoder clock selection */
 #define TRANS_CLK_SEL_A			0x46140

Index: src/sys/external/bsd/drm2/dist/drm/i915/intel_sdvo.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/intel_sdvo.c:1.7 src/sys/external/bsd/drm2/dist/drm/i915/intel_sdvo.c:1.7.10.1
--- src/sys/external/bsd/drm2/dist/drm/i915/intel_sdvo.c:1.7	Tue Oct 27 13:16:33 2015
+++ src/sys/external/bsd/drm2/dist/drm/i915/intel_sdvo.c	Sat Sep  1 06:34:00 2018
@@ -1391,7 +1391,10 @@ static void intel_sdvo_get_config(struct
 			 >> SDVO_PORT_MULTIPLY_SHIFT) + 1;
 	}
 
-	dotclock = pipe_config->port_clock / pipe_config->pixel_multiplier;
+	dotclock = pipe_config->por

CVS commit: [netbsd-8] src/usr.bin/printf

2018-08-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep  1 06:28:23 UTC 2018

Modified Files:
src/usr.bin/printf [netbsd-8]: printf.c

Log Message:
Pull up following revision(s) (requested by kre in ticket #1002):

usr.bin/printf/printf.1: revision 1.31 (via patch)
usr.bin/printf/printf.c: revision 1.43

PR standards/53563

POSIX requires that signed numbers (strings preceded by '+' or '-')
be allowed as inputs to all of the integer format conversions, including
those which treat the data as unsigned.

Hence we do not need a variant function whose only difference from its
companion is to reject strings starting with '-' - instead we use
the primary function (getintmax()) for everything and remove getuintmax().

Minor update to the man page to indicate that the arg to all of the
integer conversions (diouxX) must be an integer constant (with an
optional sign) and to make it blatantly clear that %o is octal and
%u is unsigned decimal (for some reason those weren't explicitly stated
unlike d i x and X).  Delete "respectively", it is not needed (and does
not really apply).

XXX pullup -8


To generate a diff of this commit:
cvs rdiff -u -r1.37.8.1 -r1.37.8.2 src/usr.bin/printf/printf.c

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/printf/printf.c
diff -u src/usr.bin/printf/printf.c:1.37.8.1 src/usr.bin/printf/printf.c:1.37.8.2
--- src/usr.bin/printf/printf.c:1.37.8.1	Fri Jul 13 15:58:25 2018
+++ src/usr.bin/printf/printf.c	Sat Sep  1 06:28:23 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: printf.c,v 1.37.8.1 2018/07/13 15:58:25 martin Exp $	*/
+/*	$NetBSD: printf.c,v 1.37.8.2 2018/09/01 06:28:23 martin Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -41,7 +41,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 19
 #if 0
 static char sccsid[] = "@(#)printf.c	8.2 (Berkeley) 3/22/95";
 #else
-__RCSID("$NetBSD: printf.c,v 1.37.8.1 2018/07/13 15:58:25 martin Exp $");
+__RCSID("$NetBSD: printf.c,v 1.37.8.2 2018/09/01 06:28:23 martin Exp $");
 #endif
 #endif /* not lint */
 
@@ -72,7 +72,6 @@ static char	 getchr(void);
 static double	 getdouble(void);
 static int	 getwidth(void);
 static intmax_t	 getintmax(void);
-static uintmax_t getuintmax(void);
 static char	*getstr(void);
 static char	*mklong(const char *, char);
 static void  check_conversion(const char *, const char *);
@@ -286,7 +285,7 @@ int main(int argc, char *argv[])
 			case 'u':
 			case 'x':
 			case 'X': {
-uintmax_t p = getuintmax();
+uintmax_t p = (uintmax_t)getintmax();
 char *f = mklong(start, ch);
 PF(f, p);
 if (error < 0)
@@ -633,35 +632,6 @@ getintmax(void)
 	return val;
 }
 
-static uintmax_t
-getuintmax(void)
-{
-	uintmax_t val;
-	char *cp, *ep;
-
-	cp = *gargv;
-	if (cp == NULL)
-		return 0;
-	gargv++;
-
-	if (*cp == '\"' || *cp == '\'')
-		return (uintmax_t)*(cp + 1);
-
-	/* strtoumax won't error -ve values */
-	while (isspace(*(unsigned char *)cp))
-		cp++;
-	if (*cp == '-') {
-		warnx("%s: expected positive numeric value", cp);
-		rval = 1;
-		return 0;
-	}
-
-	errno = 0;
-	val = strtoumax(cp, &ep, 0);
-	check_conversion(cp, ep);
-	return val;
-}
-
 static double
 getdouble(void)
 {



CVS commit: [netbsd-8] src/usr.bin/printf

2018-08-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep  1 06:27:12 UTC 2018

Modified Files:
src/usr.bin/printf [netbsd-8]: printf.1

Log Message:
Pull up following revision(s) (requested by kre in ticket #1002):

usr.bin/printf/printf.1: revision 1.31 (via patch)
usr.bin/printf/printf.c: revision 1.43 (via patch)

PR standards/53563

POSIX requires that signed numbers (strings preceded by '+' or '-')
be allowed as inputs to all of the integer format conversions, including
those which treat the data as unsigned.

Hence we do not need a variant function whose only difference from its
companion is to reject strings starting with '-' - instead we use
the primary function (getintmax()) for everything and remove getuintmax().

Minor update to the man page to indicate that the arg to all of the
integer conversions (diouxX) must be an integer constant (with an
optional sign) and to make it blatantly clear that %o is octal and
%u is unsigned decimal (for some reason those weren't explicitly stated
unlike d i x and X).  Delete "respectively", it is not needed (and does
not really apply).

XXX pullup -8


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.25.16.1 src/usr.bin/printf/printf.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/printf/printf.1
diff -u src/usr.bin/printf/printf.1:1.25 src/usr.bin/printf/printf.1:1.25.16.1
--- src/usr.bin/printf/printf.1:1.25	Sun Apr 13 01:45:34 2014
+++ src/usr.bin/printf/printf.1	Sat Sep  1 06:27:12 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: printf.1,v 1.25 2014/04/13 01:45:34 snj Exp $
+.\"	$NetBSD: printf.1,v 1.25.16.1 2018/09/01 06:27:12 martin Exp $
 .\"
 .\" Copyright (c) 1989, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -32,7 +32,7 @@
 .\"
 .\"	from: @(#)printf.1	8.1 (Berkeley) 6/6/93
 .\"
-.Dd May 6, 2008
+.Dd August 31, 2018
 .Dt PRINTF 1
 .Os
 .Sh NAME
@@ -257,9 +257,12 @@ The format characters and their meanings
 .Bl -tag -width Fl
 .It Cm diouXx
 The
-.Ar argument
-is printed as a signed decimal (d or i), unsigned octal, unsigned decimal,
-or unsigned hexadecimal (X or x), respectively.
+.Ar argument ,
+which must represent an integer constant,
+with an optional leading plus or minus sign,
+is printed as a signed decimal (d or i),
+unsigned octal (o), unsigned decimal (u),
+or unsigned hexadecimal (X or x).
 .It Cm f
 The
 .Ar argument



CVS commit: [netbsd-8] src/usr.sbin/npf/npfctl

2018-08-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep  1 06:19:12 UTC 2018

Modified Files:
src/usr.sbin/npf/npfctl [netbsd-8]: npf.conf.5

Log Message:
Sync the following with -current, with minor modifications as the
"[ map-flags ]" feature is not available in netbsd-8, requested by
maxv in ticket #1001:

usr.sbin/npf/npfctl/npf.conf.5  1.49,1.50(partly),1.51-1.70 (via patch)

Remove workaround for ancient HTML generation code.

 -

npfctl: add support for the 'no-ports' flag in the 'map' statements.
This allows us to create a NAT policy without the port translation.

 -

Remove superfluous Pp.

 -

First pass at editing this manual.
Add a link to the NPF documentation website and refer to it.
Switch the multiple structural elements to a list to make it easier to read and
extend.
Clarify tables, re-order so all terms are before the example.
Clarify obtaining addresses per family
Move the minimum requirement for a default group to the group section.

 -

Add missing El. Remove trailing whitespace.

 -

Enlighten the "Procedures" section. In particular document the "no-df"
option. Also replace "normalisation" -> "normalization", to match the
name of the rule.

 -

Add quotes around the option names, to match the actual npf conf.

 -

Improve the "Rules" section: better explain the "final" keyword (it is
the same as PF's "quick", so use the same wording), and document the
"return" options.

While here simplify the man code, suggested by wiz.

 -

Document the "flags" keyword.

 -

Improve the "Map" section a little.

 -

Improve wording.

 -

Replace () by [] in tcp-flags.

Fix proc-opts, the value is optional, noted by he@.

 -

Replace "rproc"->"proc" in the grammar (spotted by he@), and slightly
reword.

 -

Add missing quote in static-rule, it causes man-k.org (and other tools)
to wrongly highlight the grammar.

 -

Add the values of "algo" in the grammar, and use # as comment marker for
man-k.org (and others) not to highlight things in an incorrect way.

 -

Document ALGs.

 -

Improve the "Map" section.

 -

Add missing -width; remove unnecessary .Pp.

 -

Clarify the "Groups" section.

 -

should be port-opts

 -

"interface" already contains "var-name", so don't mention it in "filt-addr",
that's redundant

 -

rename net-seg -> map-seg, and document it


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.48.4.1 src/usr.sbin/npf/npfctl/npf.conf.5

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

Modified files:

Index: src/usr.sbin/npf/npfctl/npf.conf.5
diff -u src/usr.sbin/npf/npfctl/npf.conf.5:1.48 src/usr.sbin/npf/npfctl/npf.conf.5:1.48.4.1
--- src/usr.sbin/npf/npfctl/npf.conf.5:1.48	Fri Jan 20 08:48:14 2017
+++ src/usr.sbin/npf/npfctl/npf.conf.5	Sat Sep  1 06:19:12 2018
@@ -1,4 +1,4 @@
-.\"$NetBSD: npf.conf.5,v 1.48 2017/01/20 08:48:14 wiz Exp $
+.\"$NetBSD: npf.conf.5,v 1.48.4.1 2018/09/01 06:19:12 martin Exp $
 .\"
 .\" Copyright (c) 2009-2017 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd January 19, 2017
+.Dd August 31, 2018
 .Dt NPF.CONF 5
 .Os
 .Sh NAME
@@ -40,31 +40,32 @@ is the default configuration file for th
 .Pp
 This manual page serves as a reference for editing
 .Nm .
-Please refer to the official NPF documentation for comprehensive and
+Please refer to the official NPF documentation website for comprehensive and
 in-depth information.
 .Pp
-There are multiple structural elements
+There are multiple structural elements that
 .Nm
-may contain:
-.Cd variable
-and
-.Cd table
-definitions (with or without content), abstraction
-.Cd groups ,
-packet filtering
-.Cd rules ,
-.Cd map
-rules for address translation and
-.Cd procedure
-definitions to call on filtered packets.
-The minimal
-.Nm
-must contain a mandatory
-.Cd default group .
+may contain, such as:
+.Bl -bullet -offset indent
+.It
+variables
+.It
+table definitions (with or without content)
+.It
+abstraction groups
+.It
+packet filtering rules
+.It
+map rules for address translation
+.It
+application level gateways
+.It
+procedure definitions to call on filtered packets.
+.El
 .Sh SYNTAX
 .Ss Variables
-Variables are specified using the dollar ($) sign, which is used both
-in definitions and uses of a variable.
+Variables are specified using the dollar ($) sign, which is used for both
+definition and referencing of a variable.
 Variables are defined by assigning a value to them as follows:
 .Bd -literal
 $var1 = 10.0.0.1
@@ -79,33 +80,34 @@ Common variable definitions are for IP a
 and interfaces.
 .Ss Tables
 Tables are specified using a name between angle brackets
-\*[Lt] and \*[Gt].
+< and >.
 The following is an example of table definition:
 .Bd -literal
 table  type hash dynamic
 .Pp
 .Ed
-Currently, tables support three storage types: "hash", "tree", or "cdb".
-They can a

CVS commit: [netbsd-8] src/sys/kern

2018-08-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep  1 06:04:16 UTC 2018

Modified Files:
src/sys/kern [netbsd-8]: vfs_bio.c

Log Message:
Pull up following revision(s) (requested by hannken in ticket #1000):

sys/kern/vfs_bio.c: revision 1.277

Make sure getnewbuf() runs bawrite() inside fstrans.

Use fstrans_start_nowait() to skip buffers that would block.


To generate a diff of this commit:
cvs rdiff -u -r1.273.2.1 -r1.273.2.2 src/sys/kern/vfs_bio.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/kern/vfs_bio.c
diff -u src/sys/kern/vfs_bio.c:1.273.2.1 src/sys/kern/vfs_bio.c:1.273.2.2
--- src/sys/kern/vfs_bio.c:1.273.2.1	Thu Nov  2 21:29:52 2017
+++ src/sys/kern/vfs_bio.c	Sat Sep  1 06:04:16 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_bio.c,v 1.273.2.1 2017/11/02 21:29:52 snj Exp $	*/
+/*	$NetBSD: vfs_bio.c,v 1.273.2.2 2018/09/01 06:04:16 martin Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -123,7 +123,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.273.2.1 2017/11/02 21:29:52 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.273.2.2 2018/09/01 06:04:16 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_bufcache.h"
@@ -1347,11 +1347,12 @@ allocbuf(buf_t *bp, int size, int preser
  * Called with the buffer queues locked.
  * Return buffer locked.
  */
-buf_t *
+static buf_t *
 getnewbuf(int slpflag, int slptimeo, int from_bufq)
 {
 	buf_t *bp;
 	struct vnode *vp;
+	struct mount *transmp = NULL;
 
  start:
 	KASSERT(mutex_owned(&bufcache_lock));
@@ -1376,8 +1377,21 @@ getnewbuf(int slpflag, int slptimeo, int
 	}
 
 	KASSERT(mutex_owned(&bufcache_lock));
-	if ((bp = TAILQ_FIRST(&bufqueues[BQ_AGE].bq_queue)) != NULL ||
-	(bp = TAILQ_FIRST(&bufqueues[BQ_LRU].bq_queue)) != NULL) {
+	if ((bp = TAILQ_FIRST(&bufqueues[BQ_AGE].bq_queue)) != NULL) {
+		KASSERT(!ISSET(bp->b_oflags, BO_DELWRI));
+	} else {
+		TAILQ_FOREACH(bp, &bufqueues[BQ_LRU].bq_queue, b_freelist) {
+			if (ISSET(bp->b_cflags, BC_VFLUSH) ||
+			!ISSET(bp->b_oflags, BO_DELWRI))
+break;
+			if (fstrans_start_nowait(bp->b_vp->v_mount) == 0) {
+KASSERT(transmp == NULL);
+transmp = bp->b_vp->v_mount;
+break;
+			}
+		}
+	}
+	if (bp != NULL) {
 		KASSERT(!ISSET(bp->b_cflags, BC_BUSY) || ISSET(bp->b_cflags, BC_VFLUSH));
 		bremfree(bp);
 
@@ -1431,10 +1445,14 @@ getnewbuf(int slpflag, int slptimeo, int
 		SET(bp->b_cflags, BC_AGE);
 		mutex_exit(&bufcache_lock);
 		bawrite(bp);
+		KASSERT(transmp != NULL);
+		fstrans_done(transmp);
 		mutex_enter(&bufcache_lock);
 		return (NULL);
 	}
 
+	KASSERT(transmp == NULL);
+
 	vp = bp->b_vp;
 
 	/* clear out various other fields */



CVS commit: [netbsd-8] src/sys/dev

2018-08-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep  1 06:02:14 UTC 2018

Modified Files:
src/sys/dev [netbsd-8]: fss.c fssvar.h

Log Message:
Pull up following revision(s) (requested by hannken in ticket #999):

sys/dev/fssvar.h: revision 1.30
sys/dev/fssvar.h: revision 1.31
sys/dev/fss.c: revision 1.105
sys/dev/fss.c: revision 1.106

Convert flags FSS_ACTIVE and FSS_ERROR into new member sc_state
with states FSS_IDLE, FSS_ACTIVE and FSS_ERROR.

No functional change intended.

Add two new states FSS_CREATING and FSS_DESTROYING and use them
while creating or destroying a snapshot.

Remove now unneeded sc_lock that made fss_ioctl mutually exclusive.
Fss_ioctl no longer blocks forever because a snapshot gets
created or destroyed.

Serialize snapshot creation and make it interruptible.


To generate a diff of this commit:
cvs rdiff -u -r1.98.2.2 -r1.98.2.3 src/sys/dev/fss.c
cvs rdiff -u -r1.29 -r1.29.10.1 src/sys/dev/fssvar.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/fss.c
diff -u src/sys/dev/fss.c:1.98.2.2 src/sys/dev/fss.c:1.98.2.3
--- src/sys/dev/fss.c:1.98.2.2	Sat Jan 13 05:38:54 2018
+++ src/sys/dev/fss.c	Sat Sep  1 06:02:13 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: fss.c,v 1.98.2.2 2018/01/13 05:38:54 snj Exp $	*/
+/*	$NetBSD: fss.c,v 1.98.2.3 2018/09/01 06:02:13 martin Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.98.2.2 2018/01/13 05:38:54 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.98.2.3 2018/09/01 06:02:13 martin Exp $");
 
 #include 
 #include 
@@ -93,6 +93,8 @@ static int fss_bs_io(struct fss_softc *,
 static u_int32_t *fss_bs_indir(struct fss_softc *, u_int32_t);
 
 static kmutex_t fss_device_lock;	/* Protect all units. */
+static kcondvar_t fss_device_cv;	/* Serialize snapshot creation. */
+static bool fss_creating = false;	/* Currently creating a snapshot. */
 static int fss_num_attached = 0;	/* Number of attached devices. */
 static struct vfs_hooks fss_vfs_hooks = {
 	.vh_unmount = fss_unmount_hook
@@ -137,6 +139,7 @@ fssattach(int num)
 {
 
 	mutex_init(&fss_device_lock, MUTEX_DEFAULT, IPL_NONE);
+	cv_init(&fss_device_cv, "snapwait");
 	if (config_cfattach_attach(fss_cd.cd_name, &fss_ca))
 		aprint_error("%s: unable to register\n", fss_cd.cd_name);
 }
@@ -155,7 +158,6 @@ fss_attach(device_t parent, device_t sel
 	sc->sc_dev = self;
 	sc->sc_bdev = NODEV;
 	mutex_init(&sc->sc_slock, MUTEX_DEFAULT, IPL_NONE);
-	mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_NONE);
 	cv_init(&sc->sc_work_cv, "fssbs");
 	cv_init(&sc->sc_cache_cv, "cowwait");
 	bufq_alloc(&sc->sc_bufq, "fcfs", 0);
@@ -174,15 +176,18 @@ fss_detach(device_t self, int flags)
 {
 	struct fss_softc *sc = device_private(self);
 
-	if (sc->sc_flags & FSS_ACTIVE)
+	mutex_enter(&sc->sc_slock);
+	if (sc->sc_state != FSS_IDLE) {
+		mutex_exit(&sc->sc_slock);
 		return EBUSY;
+	}
+	mutex_exit(&sc->sc_slock);
 
 	if (--fss_num_attached == 0)
 		vfs_hooks_detach(&fss_vfs_hooks);
 
 	pmf_device_deregister(self);
 	mutex_destroy(&sc->sc_slock);
-	mutex_destroy(&sc->sc_lock);
 	cv_destroy(&sc->sc_work_cv);
 	cv_destroy(&sc->sc_cache_cv);
 	bufq_drain(sc->sc_bufq);
@@ -216,6 +221,7 @@ fss_open(dev_t dev, int flags, int mode,
 			mutex_exit(&fss_device_lock);
 			return ENOMEM;
 		}
+		sc->sc_state = FSS_IDLE;
 	}
 
 	mutex_enter(&sc->sc_slock);
@@ -247,20 +253,20 @@ restart:
 		mutex_exit(&fss_device_lock);
 		return 0;
 	}
-	if ((sc->sc_flags & FSS_ACTIVE) != 0 &&
+	if (sc->sc_state != FSS_IDLE &&
 	(sc->sc_uflags & FSS_UNCONFIG_ON_CLOSE) != 0) {
 		sc->sc_uflags &= ~FSS_UNCONFIG_ON_CLOSE;
 		mutex_exit(&sc->sc_slock);
 		error = fss_ioctl(dev, FSSIOCCLR, NULL, FWRITE, l);
 		goto restart;
 	}
-	if ((sc->sc_flags & FSS_ACTIVE) != 0) {
+	if (sc->sc_state != FSS_IDLE) {
 		mutex_exit(&sc->sc_slock);
 		mutex_exit(&fss_device_lock);
 		return error;
 	}
 
-	KASSERT((sc->sc_flags & FSS_ACTIVE) == 0);
+	KASSERT(sc->sc_state == FSS_IDLE);
 	KASSERT((sc->sc_flags & (FSS_CDEV_OPEN|FSS_BDEV_OPEN)) == mflag);
 	mutex_exit(&sc->sc_slock);
 	cf = device_cfdata(sc->sc_dev);
@@ -280,7 +286,7 @@ fss_strategy(struct buf *bp)
 
 	mutex_enter(&sc->sc_slock);
 
-	if (write || !FSS_ISVALID(sc)) {
+	if (write || sc->sc_state != FSS_ACTIVE) {
 		bp->b_error = (write ? EROFS : ENXIO);
 		goto done;
 	}
@@ -318,7 +324,7 @@ fss_write(dev_t dev, struct uio *uio, in
 int
 fss_ioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
 {
-	int error;
+	int error = 0;
 	struct fss_softc *sc = device_lookup_private(&fss_cd, minor(dev));
 	struct fss_set _fss;
 	struct fss_set *fss = (struct fss_set *)data;
@@ -337,81 +343,125 @@ fss_ioctl(dev_t dev, u_long cmd, void *d
 		fss->fss_flags = 0;
 		/* Fall through */
 	case FSSIOCSET:
-		mutex_enter(&sc->sc_lock);
+		mutex_enter(&sc->sc_slock);
 		if ((flag & FWRITE) 

CVS commit: src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mmu

2018-08-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Sep  1 04:38:22 UTC 2018

Modified Files:
src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mmu:
nouveau_nvkm_subdev_mmu_base.c

Log Message:
Destroy mutex before freeing memory.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \

src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mmu/nouveau_nvkm_subdev_mmu_base.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/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mmu/nouveau_nvkm_subdev_mmu_base.c
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mmu/nouveau_nvkm_subdev_mmu_base.c:1.3 src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mmu/nouveau_nvkm_subdev_mmu_base.c:1.4
--- src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mmu/nouveau_nvkm_subdev_mmu_base.c:1.3	Mon Aug 27 07:41:19 2018
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mmu/nouveau_nvkm_subdev_mmu_base.c	Sat Sep  1 04:38:22 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_nvkm_subdev_mmu_base.c,v 1.3 2018/08/27 07:41:19 riastradh Exp $	*/
+/*	$NetBSD: nouveau_nvkm_subdev_mmu_base.c,v 1.4 2018/09/01 04:38:22 riastradh Exp $	*/
 
 /*
  * Copyright 2010 Red Hat Inc.
@@ -24,7 +24,7 @@
  * Authors: Ben Skeggs
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_subdev_mmu_base.c,v 1.3 2018/08/27 07:41:19 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_subdev_mmu_base.c,v 1.4 2018/09/01 04:38:22 riastradh Exp $");
 
 #include "priv.h"
 
@@ -436,6 +436,11 @@ nvkm_vm_create(struct nvkm_mmu *mmu, u64
 
 	vm->pgt  = vzalloc((vm->lpde - vm->fpde + 1) * sizeof(*vm->pgt));
 	if (!vm->pgt) {
+#ifdef __NetBSD__
+		linux_mutex_destroy(&vm->mutex);
+#else
+		mutex_destroy(&vm->mutex);
+#endif
 		kfree(vm);
 		return -ENOMEM;
 	}
@@ -444,6 +449,11 @@ nvkm_vm_create(struct nvkm_mmu *mmu, u64
 			   block >> 12);
 	if (ret) {
 		vfree(vm->pgt);
+#ifdef __NetBSD__
+		linux_mutex_destroy(&vm->mutex);
+#else
+		mutex_destroy(&vm->mutex);
+#endif
 		kfree(vm);
 		return ret;
 	}



CVS commit: src/sys/external/bsd/drm2/dist/drm/nouveau/core

2018-08-31 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Sep  1 04:35:03 UTC 2018

Removed Files:
src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo:
nouveau_engine_fifo_gk20a.c
src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/graph:
nouveau_engine_graph_ctxgk20a.c nouveau_engine_graph_gk20a.c
src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/fb:
nouveau_subdev_fb_gk20a.c nouveau_subdev_fb_ramgk20a.c
src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/ibus:
nouveau_subdev_ibus_gk20a.c

Log Message:
Delete backported files that were renamed upstream.

Not sure how these didn't get nixed in the import.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r0 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_gk20a.c
cvs rdiff -u -r1.2 -r0 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/graph/nouveau_engine_graph_ctxgk20a.c
 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/graph/nouveau_engine_graph_gk20a.c
cvs rdiff -u -r1.2 -r0 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/fb/nouveau_subdev_fb_gk20a.c
cvs rdiff -u -r1.5 -r0 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/fb/nouveau_subdev_fb_ramgk20a.c
cvs rdiff -u -r1.2 -r0 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/subdev/ibus/nouveau_subdev_ibus_gk20a.c

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



CVS commit: src/share/man/man4

2018-08-31 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Fri Aug 31 19:36:28 UTC 2018

Modified Files:
src/share/man/man4: adb.4 atppc.4 az.4 bktr.4

Log Message:
Use the An macro in the AUTHORS section.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/share/man/man4/adb.4
cvs rdiff -u -r1.15 -r1.16 src/share/man/man4/atppc.4
cvs rdiff -u -r1.6 -r1.7 src/share/man/man4/az.4
cvs rdiff -u -r1.18 -r1.19 src/share/man/man4/bktr.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/adb.4
diff -u src/share/man/man4/adb.4:1.3 src/share/man/man4/adb.4:1.4
--- src/share/man/man4/adb.4:1.3	Tue Aug  6 17:32:30 2013
+++ src/share/man/man4/adb.4	Fri Aug 31 19:36:28 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: adb.4,v 1.3 2013/08/06 17:32:30 snj Exp $
+.\"	$NetBSD: adb.4,v 1.4 2018/08/31 19:36:28 sevan Exp $
 .\"
 .\" Copyright (c) 2003 Alex Zepeda 
 .\" Copyright (c) 1997 Colin Wood
@@ -30,7 +30,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd September 21, 2003
+.Dd August 31, 2018
 .Dt ADB 4
 .Os
 .Sh NAME
@@ -210,14 +210,17 @@ interface first appeared in
 .Nx 0.9 .
 It has been under development ever since.
 .Sh AUTHORS
-Bradley A. Grantham wrote the original
+.An -nosplit
+.An "Bradley A. Grantham"
+wrote the original
 .Nm
 driver, including the
 .Tn MRG
 support.
 The hardware direct interface was written by
-John P. Wittkowski.
-The PowerManager interface was written by Takashi Hamada.
+.An "John P. Wittkowski" .
+The PowerManager interface was written by
+.An "Takashi Hamada" .
 .Sh BUGS
 .Bl -bullet
 .It

Index: src/share/man/man4/atppc.4
diff -u src/share/man/man4/atppc.4:1.15 src/share/man/man4/atppc.4:1.16
--- src/share/man/man4/atppc.4:1.15	Sat Jan 31 21:28:45 2004
+++ src/share/man/man4/atppc.4	Fri Aug 31 19:36:28 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: atppc.4,v 1.15 2004/01/31 21:28:45 wiz Exp $
+.\"	$NetBSD: atppc.4,v 1.16 2018/08/31 19:36:28 sevan Exp $
 .\"
 .\" Copyright (c) 1998, 1999, Nicolas Souchu
 .\" Copyright (c) 2003, 2004 Gary Thorpe 
@@ -25,7 +25,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd January 30, 2004
+.Dd August 31, 2018
 .Dt ATPPC 4
 .Os
 .Sh NAME
@@ -103,7 +103,8 @@ This manual page is based on the
 manual page.
 The information has been updated for the
 .Nx
-port by Gary Thorpe.
+port by
+.An "Gary Thorpe" .
 .Sh BUGS
 The
 .Fx

Index: src/share/man/man4/az.4
diff -u src/share/man/man4/az.4:1.6 src/share/man/man4/az.4:1.7
--- src/share/man/man4/az.4:1.6	Sat Mar 20 04:52:59 2004
+++ src/share/man/man4/az.4	Fri Aug 31 19:36:28 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: az.4,v 1.6 2004/03/20 04:52:59 snj Exp $
+.\"	$NetBSD: az.4,v 1.7 2018/08/31 19:36:28 sevan Exp $
 .\"	$RuOBSD: az.4,v 1.3 2001/10/26 05:38:43 form Exp $
 .\"	$OpenBSD: az.4,v 1.1 2001/12/05 10:58:54 mickey Exp $
 .\"
@@ -25,7 +25,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd October 8, 2001
+.Dd August 31, 2018
 .Dt AZ 4
 .Os
 .Sh NAME
@@ -61,10 +61,15 @@ device driver appeared in
 and
 .Nx 1.6 .
 .Sh AUTHORS
+.An -nosplit
 The
 .Nm
-driver was written by Vladimir Popov and Maxim Tsyplakov.
-The man page was written by Vladimir Popov.
+driver was written by
+.An "Vladimir Popov"
+and
+.An "Maxim Tsyplakov" .
+The man page was written by
+.An "Vladimir Popov" .
 .Sh BUGS
 It is impossible to determine to which frequency the card is tuned.
 Thus, the driver will report an internally stored value even if it is not

Index: src/share/man/man4/bktr.4
diff -u src/share/man/man4/bktr.4:1.18 src/share/man/man4/bktr.4:1.19
--- src/share/man/man4/bktr.4:1.18	Tue Aug 30 05:58:02 2011
+++ src/share/man/man4/bktr.4	Fri Aug 31 19:36:28 2018
@@ -1,4 +1,4 @@
-.\" $NetBSD: bktr.4,v 1.18 2011/08/30 05:58:02 jruoho Exp $
+.\" $NetBSD: bktr.4,v 1.19 2018/08/31 19:36:28 sevan Exp $
 .\"
 .\" Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005 Thomas Klausner
 .\" 	All rights reserved.
@@ -481,11 +481,19 @@ driver appeared in
 and
 .Nx 1.5 .
 .Sh AUTHORS
+.An -nosplit
 The
 .Nm
-driver was originally written by Amancio Hasty for
+driver was originally written by
+.An "Amancio Hasty"
+for
 .Fx
-and is now maintained by Roger Hardiman.
+and is now maintained by
+.An "Roger Hardiman" .
 .Nx
-porting was done by Bernd Ernesti, Berndt Josef Wulf, Matthias
-Scheler, and Thomas Klausner.
+porting was done by
+.An "Bernd Ernesti" ,
+.An "Berndt Josef Wulf" ,
+.An "Matthias Scheler" ,
+and
+.An "Thomas Klausner" .



CVS commit: src/share/man/man4

2018-08-31 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Fri Aug 31 19:34:44 UTC 2018

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

Log Message:
Pp before Bl


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/share/man/man4/acpicpu.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/acpicpu.4
diff -u src/share/man/man4/acpicpu.4:1.34 src/share/man/man4/acpicpu.4:1.35
--- src/share/man/man4/acpicpu.4:1.34	Tue Aug  9 07:18:54 2011
+++ src/share/man/man4/acpicpu.4	Fri Aug 31 19:34:44 2018
@@ -1,4 +1,4 @@
-.\" $NetBSD: acpicpu.4,v 1.34 2011/08/09 07:18:54 jruoho Exp $
+.\" $NetBSD: acpicpu.4,v 1.35 2018/08/31 19:34:44 sevan Exp $
 .\"
 .\" Copyright (c) 2010 Jukka Ruohonen 
 .\" All rights reserved.
@@ -24,7 +24,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd August 6, 2011
+.Dd August 31, 2018
 .Dt ACPICPU 4
 .Os
 .Sh NAME
@@ -69,7 +69,6 @@ The following C-states are typically ava
 Additional processor or vendor specific
 states (C4, ..., Cn) are handled internally by
 .Nm .
-.Pp
 .Bl -tag -width C1 -offset indent
 .It Dv C0
 This is the normal state of a processor; the



CVS commit: [jdolecek-ncqfixes] src/sys/dev/ata

2018-08-31 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Fri Aug 31 19:23:54 UTC 2018

Modified Files:
src/sys/dev/ata [jdolecek-ncqfixes]: TODO.ncq

Log Message:
fix comment - dynamically allocated yes, per-drive not


To generate a diff of this commit:
cvs rdiff -u -r1.4.2.1 -r1.4.2.2 src/sys/dev/ata/TODO.ncq

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/ata/TODO.ncq
diff -u src/sys/dev/ata/TODO.ncq:1.4.2.1 src/sys/dev/ata/TODO.ncq:1.4.2.2
--- src/sys/dev/ata/TODO.ncq:1.4.2.1	Fri Aug 31 19:15:04 2018
+++ src/sys/dev/ata/TODO.ncq	Fri Aug 31 19:23:54 2018
@@ -1,5 +1,5 @@
 jdolecek-ncqfixes goals:
-- make ata_xfer dynamically allocated per-drive using a pool
+- make ata_xfer dynamically allocated using a pool
   - fixes: queue is allocated regardless if there are any drives, fix? 
 - remove limit of queued ata_xfers, allow any number of pending xfers;
   this should fix kern/52614 AKA wdc-attached ATAPI cd(4)



CVS commit: [jdolecek-ncqfixes] src/sys/dev/ata

2018-08-31 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Fri Aug 31 19:15:04 UTC 2018

Modified Files:
src/sys/dev/ata [jdolecek-ncqfixes]: TODO.ncq

Log Message:
list goals for the jdolecek-ncqfixes branch


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.2.1 src/sys/dev/ata/TODO.ncq

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/ata/TODO.ncq
diff -u src/sys/dev/ata/TODO.ncq:1.4 src/sys/dev/ata/TODO.ncq:1.4.2.1
--- src/sys/dev/ata/TODO.ncq:1.4	Fri Aug 31 18:44:04 2018
+++ src/sys/dev/ata/TODO.ncq	Fri Aug 31 19:15:04 2018
@@ -1,3 +1,16 @@
+jdolecek-ncqfixes goals:
+- make ata_xfer dynamically allocated per-drive using a pool
+  - fixes: queue is allocated regardless if there are any drives, fix? 
+- remove limit of queued ata_xfers, allow any number of pending xfers;
+  this should fix kern/52614 AKA wdc-attached ATAPI cd(4)
+- remove the wd(4) flush condition, just allocate a dynamic ata_xfer
+- change wd(4) dump code to use on-stack ata_xfer to not rely on pool having
+  memory
+- re-fix QEMU ahci(4) bug workaround (no READ LOG EXT support) - now it
+  triggers KASSERT()
+- fix ahci(4) error handling under paralles - invalid bio via WD_CHAOS_MONKEY
+  ends up being handled as NOERROR, triggering KASSERT() in wd(4)
+
 Bugs
 
 test wd* at umass?, confirm the ata_channel kludge works
@@ -15,8 +28,6 @@ xfers for several different drives
 maybe do device error handling in not-interrupt-context (maybe this should be
 done on a mpata branch?)
 
-queue is allocated regardless if there are any drives, fix? 
-
 dump to unopened disk fails (e.g. dump do wd1b when wd1a not mounted), due
 to the open path executing ata_get_params(), which eventually tsleeps()
 while waiting for the command to finish; specifically, if WDF_LOADED is not



CVS commit: [jdolecek-ncqfixes] src/sys/dev

2018-08-31 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Fri Aug 31 19:08:03 UTC 2018

Modified Files:
src/sys/dev/ata [jdolecek-ncqfixes]: ata.c ata_subr.c ata_wdc.c
atavar.h wd.c wdvar.h
src/sys/dev/ic [jdolecek-ncqfixes]: ahcisata_core.c mvsata.c siisata.c
wdc.c
src/sys/dev/scsipi [jdolecek-ncqfixes]: atapi_wdc.c

Log Message:
refactor ata_xfer to be just dumb structure; move all callouts/condvars out

retry callout to wd(4); reset callout and the active/cmd finish condvars
to channel queue; change code using the condvars so it works if there
are multiple waiters

simplify the async wait code for cmds, replace ata_wait_xfer()/ata_wake_xfer()
with ata_wait_cmd()

fix the callout_invoking/ack race handling code for timeouts to
actually have chance to work; change mvsata(4) to use generic timeout func

towards resolution of kern/52614


To generate a diff of this commit:
cvs rdiff -u -r1.141 -r1.141.6.1 src/sys/dev/ata/ata.c
cvs rdiff -u -r1.6 -r1.6.2.1 src/sys/dev/ata/ata_subr.c
cvs rdiff -u -r1.110 -r1.110.4.1 src/sys/dev/ata/ata_wdc.c
cvs rdiff -u -r1.99 -r1.99.2.1 src/sys/dev/ata/atavar.h
cvs rdiff -u -r1.441 -r1.441.2.1 src/sys/dev/ata/wd.c
cvs rdiff -u -r1.46 -r1.46.6.1 src/sys/dev/ata/wdvar.h
cvs rdiff -u -r1.62 -r1.62.2.1 src/sys/dev/ic/ahcisata_core.c
cvs rdiff -u -r1.41 -r1.41.2.1 src/sys/dev/ic/mvsata.c
cvs rdiff -u -r1.35 -r1.35.6.1 src/sys/dev/ic/siisata.c
cvs rdiff -u -r1.288 -r1.288.6.1 src/sys/dev/ic/wdc.c
cvs rdiff -u -r1.129 -r1.129.6.1 src/sys/dev/scsipi/atapi_wdc.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/ata/ata.c
diff -u src/sys/dev/ata/ata.c:1.141 src/sys/dev/ata/ata.c:1.141.6.1
--- src/sys/dev/ata/ata.c:1.141	Sat Oct 28 04:53:54 2017
+++ src/sys/dev/ata/ata.c	Fri Aug 31 19:08:03 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ata.c,v 1.141 2017/10/28 04:53:54 riastradh Exp $	*/
+/*	$NetBSD: ata.c,v 1.141.6.1 2018/08/31 19:08:03 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.141 2017/10/28 04:53:54 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.141.6.1 2018/08/31 19:08:03 jdolecek Exp $");
 
 #include "opt_ata.h"
 
@@ -1075,19 +1075,19 @@ ata_exec_xfer(struct ata_channel *chp, s
 		while (chp->ch_queue->queue_active > 0 ||
 		TAILQ_FIRST(&chp->ch_queue->queue_xfer) != xfer) {
 			xfer->c_flags |= C_WAITACT;
-			cv_wait(&xfer->c_active, &chp->ch_lock);
+			cv_wait(&chp->ch_queue->c_active, &chp->ch_lock);
 			xfer->c_flags &= ~C_WAITACT;
+		}
 
-			/*
-			 * Free xfer now if it there was attempt to free it
-			 * while we were waiting.
-			 */
-			if ((xfer->c_flags & (C_FREE|C_WAITTIMO)) == C_FREE) {
-ata_channel_unlock(chp);
+		/*
+		 * Free xfer now if it there was attempt to free it
+		 * while we were waiting.
+		 */
+		if ((xfer->c_flags & (C_FREE|C_WAITTIMO)) == C_FREE) {
+			ata_channel_unlock(chp);
 
-ata_free_xfer(chp, xfer);
-return;
-			}
+			ata_free_xfer(chp, xfer);
+			return;
 		}
 	}
 
@@ -1187,7 +1187,7 @@ again:
 		ATADEBUG_PRINT(("atastart: xfer %p channel %d drive %d "
 		"wait active\n", xfer, chp->ch_channel, xfer->c_drive),
 		DEBUG_XFERS);
-		cv_signal(&xfer->c_active);
+		cv_broadcast(&chp->ch_queue->c_active);
 		goto out;
 	}
 
@@ -1300,15 +1300,20 @@ ata_deactivate_xfer(struct ata_channel *
 	KASSERT(chq->queue_active > 0);
 	KASSERT((chq->active_xfers_used & __BIT(xfer->c_slot)) != 0);
 
-	callout_stop(&xfer->c_timo_callout);
+	/* Stop only when this is last active xfer */
+	if (chq->queue_active == 1)
+		callout_stop(&chp->c_timo_callout);
 
-	if (callout_invoking(&xfer->c_timo_callout))
+	if (callout_invoking(&chp->c_timo_callout))
 		xfer->c_flags |= C_WAITTIMO;
 
 	TAILQ_REMOVE(&chq->active_xfers, xfer, c_activechain);
 	chq->active_xfers_used &= ~__BIT(xfer->c_slot);
 	chq->queue_active--;
 
+	if (xfer->c_flags & C_WAIT)
+		cv_broadcast(&chq->c_cmd_finish);
+
 	ata_channel_unlock(chp);
 }
 
@@ -1356,8 +1361,6 @@ ata_timo_xfer_check(struct ata_xfer *xfe
 
 	ata_channel_lock(chp);
 
-	callout_ack(&xfer->c_timo_callout);
-
 	if (xfer->c_flags & C_WAITTIMO) {
 		xfer->c_flags &= ~C_WAITTIMO;
 
@@ -1389,30 +1392,6 @@ ata_timo_xfer_check(struct ata_xfer *xfe
 	return false;
 }
 
-void
-ata_timeout(void *v)
-{
-	struct ata_xfer *xfer = v;
-	int s;
-
-	ATADEBUG_PRINT(("%s: slot %d\n", __func__, xfer->c_slot),
-	DEBUG_FUNCS|DEBUG_XFERS);
-
-	s = splbio();/* XXX MPSAFE */
-
-	if (ata_timo_xfer_check(xfer)) {
-		/* Already logged */
-		goto out;
-	}
-
-	/* Mark as timed out. Do not print anything, wd(4) will. */
-	xfer->c_flags |= C_TIMEOU;
-	xfer->c_intr(xfer->c_chp, xfer, 0);
-
-out:
-	splx(s);
-}
-
 /*
  * Kill off all active xfers for a ata_channel.
  *
@@ -2304,17 +2283,17 @@ atacmd_toncq(struct ata_xfer *xfer, uint
 }
 
 void
-ata_wait_xfer(struct ata_ch

CVS commit: src/sys/dev/ata

2018-08-31 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Fri Aug 31 18:44:04 UTC 2018

Modified Files:
src/sys/dev/ata: TODO.ncq

Log Message:
one less


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/ata/TODO.ncq

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/ata/TODO.ncq
diff -u src/sys/dev/ata/TODO.ncq:1.3 src/sys/dev/ata/TODO.ncq:1.4
--- src/sys/dev/ata/TODO.ncq:1.3	Wed Nov  1 21:27:22 2017
+++ src/sys/dev/ata/TODO.ncq	Fri Aug 31 18:44:04 2018
@@ -32,8 +32,7 @@ implement DIOCGCACHE/DIOCCACHESYNC for l
 
 MSI/MSI-X support for AHCI and mvsata(4)
 
-mvsata - constify mvsata_pci_products and move pci-specific code to
-the pci attach code
+mvsata - move pci-specific code to the pci attach code
 
 mvsata(4) 64-bit DMA
 - at least with AHA1430SA does not really work, crash in mvsata_intr() on boot



CVS commit: src/sys/dev

2018-08-31 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Fri Aug 31 18:43:30 UTC 2018

Modified Files:
src/sys/dev/ic: mvsata.c mvsatavar.h
src/sys/dev/pci: mvsata_pci.c

Log Message:
constify mvsata_pci_products[]


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/ic/mvsata.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/ic/mvsatavar.h
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/pci/mvsata_pci.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/mvsata.c
diff -u src/sys/dev/ic/mvsata.c:1.40 src/sys/dev/ic/mvsata.c:1.41
--- src/sys/dev/ic/mvsata.c:1.40	Sun Apr  8 11:57:43 2018
+++ src/sys/dev/ic/mvsata.c	Fri Aug 31 18:43:29 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvsata.c,v 1.40 2018/04/08 11:57:43 mlelstv Exp $	*/
+/*	$NetBSD: mvsata.c,v 1.41 2018/08/31 18:43:29 jdolecek Exp $	*/
 /*
  * Copyright (c) 2008 KIYOHARA Takashi
  * All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mvsata.c,v 1.40 2018/04/08 11:57:43 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mvsata.c,v 1.41 2018/08/31 18:43:29 jdolecek Exp $");
 
 #include "opt_mvsata.h"
 
@@ -255,7 +255,7 @@ mvsata_pmp_select(struct mvsata_port *mv
 }
 
 int
-mvsata_attach(struct mvsata_softc *sc, struct mvsata_product *product,
+mvsata_attach(struct mvsata_softc *sc, const struct mvsata_product *product,
 	  int (*mvsata_sreset)(struct mvsata_softc *),
 	  int (*mvsata_misc_reset)(struct mvsata_softc *),
 	  int read_pre_amps)

Index: src/sys/dev/ic/mvsatavar.h
diff -u src/sys/dev/ic/mvsatavar.h:1.3 src/sys/dev/ic/mvsatavar.h:1.4
--- src/sys/dev/ic/mvsatavar.h:1.3	Sat Oct  7 16:05:32 2017
+++ src/sys/dev/ic/mvsatavar.h	Fri Aug 31 18:43:29 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvsatavar.h,v 1.3 2017/10/07 16:05:32 jdolecek Exp $	*/
+/*	$NetBSD: mvsatavar.h,v 1.4 2018/08/31 18:43:29 jdolecek Exp $	*/
 /*
  * Copyright (c) 2008 KIYOHARA Takashi
  * All rights reserved.
@@ -142,7 +142,7 @@ struct mvsata_softc {
 	void (*sc_enable_intr)(struct mvsata_port *, int);
 };
 
-int mvsata_attach(struct mvsata_softc *, struct mvsata_product *,
+int mvsata_attach(struct mvsata_softc *, const struct mvsata_product *,
 		  int (*mvsata_sreset)(struct mvsata_softc *),
 		  int (*mvsata_misc_reset)(struct mvsata_softc *), int);
 int mvsata_intr(struct mvsata_hc *);

Index: src/sys/dev/pci/mvsata_pci.c
diff -u src/sys/dev/pci/mvsata_pci.c:1.9 src/sys/dev/pci/mvsata_pci.c:1.10
--- src/sys/dev/pci/mvsata_pci.c:1.9	Wed Jun 21 22:48:05 2017
+++ src/sys/dev/pci/mvsata_pci.c	Fri Aug 31 18:43:29 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvsata_pci.c,v 1.9 2017/06/21 22:48:05 jdolecek Exp $	*/
+/*	$NetBSD: mvsata_pci.c,v 1.10 2018/08/31 18:43:29 jdolecek Exp $	*/
 /*
  * Copyright (c) 2008 KIYOHARA Takashi
  * All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mvsata_pci.c,v 1.9 2017/06/21 22:48:05 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mvsata_pci.c,v 1.10 2018/08/31 18:43:29 jdolecek Exp $");
 
 #include 
 #include 
@@ -108,7 +108,7 @@ static void mvsata_pci_enable_intr(struc
 CFATTACH_DECL_NEW(mvsata_pci, sizeof(struct mvsata_pci_softc),
 mvsata_pci_match, mvsata_pci_attach, mvsata_pci_detach, NULL);
 
-struct mvsata_product mvsata_pci_products[] = {
+static const struct mvsata_product mvsata_pci_products[] = {
 #define PCI_VP(v, p)	PCI_VENDOR_ ## v, PCI_PRODUCT_ ## v ## _ ## p
 	{ PCI_VP(MARVELL, 88SX5040),		1, 4, gen1, 0 },
 	{ PCI_VP(MARVELL, 88SX5041),		1, 4, gen1, 0 },



CVS commit: src/share/man/man4

2018-08-31 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Fri Aug 31 18:27:47 UTC 2018

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

Log Message:
New sentence, new line.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/share/man/man4/acphy.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/acphy.4
diff -u src/share/man/man4/acphy.4:1.3 src/share/man/man4/acphy.4:1.4
--- src/share/man/man4/acphy.4:1.3	Fri Jan 17 06:23:53 2003
+++ src/share/man/man4/acphy.4	Fri Aug 31 18:27:47 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: acphy.4,v 1.3 2003/01/17 06:23:53 gendalia Exp $
+.\"	$NetBSD: acphy.4,v 1.4 2018/08/31 18:27:47 sevan Exp $
 .\"
 .\" Copyright 2001 Wasabi Systems, Inc.
 .\" All rights reserved.
@@ -33,7 +33,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd August 24, 2001
+.Dd August 31, 2018
 .Dt ACPHY 4
 .Os
 .Sh NAME
@@ -45,9 +45,9 @@
 The
 .Nm
 driver supports the Altima AC101, AC101L and AMD Am79c874 NetPHY-1LP
-10/100 Ethernet PHYs.  These PHYs are often found on low-power
-Ethernet interfaces, such as MiniPCI interfaces found in
-laptops and embedded systems.
+10/100 Ethernet PHYs.
+These PHYs are often found on low-power Ethernet interfaces, such as MiniPCI
+interfaces found in laptops and embedded systems.
 .Pp
 The AMD 79c874 is a work-alike (most likely an OEM of the core) of the
 Altima part.



CVS commit: src/share/man/man4

2018-08-31 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Fri Aug 31 18:20:10 UTC 2018

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

Log Message:
Apply Tn macro to XTS


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/share/man/man4/cgd.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/cgd.4
diff -u src/share/man/man4/cgd.4:1.21 src/share/man/man4/cgd.4:1.22
--- src/share/man/man4/cgd.4:1.21	Mon Dec 12 10:13:00 2016
+++ src/share/man/man4/cgd.4	Fri Aug 31 18:20:10 2018
@@ -1,4 +1,4 @@
-.\" $NetBSD: cgd.4,v 1.21 2016/12/12 10:13:00 wiz Exp $
+.\" $NetBSD: cgd.4,v 1.22 2018/08/31 18:20:10 sevan Exp $
 .\"
 .\" Copyright (c) 2002, 2003 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd December 11, 2016
+.Dd August 31, 2018
 .Dt CGD 4
 .Os
 .Sh NAME
@@ -189,8 +189,8 @@ possible to change every second block on
 .Tn CBC
 mode to plaintext blocks of their choice.
 The
-.Tn
-XTS mode isn't vulnerable to this particular attack but a lack of
+.Tn XTS
+mode isn't vulnerable to this particular attack but a lack of
 integrity should be taken into account when evaluating security risks.
 .Sh FILES
 .Bl -tag -width indentxxx



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

2018-08-31 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Fri Aug 31 18:11:20 UTC 2018

Modified Files:
src/sys/arch/macppc/conf: INSTALL

Log Message:
Enable USB 2.0 support so installs go a little faster on systems which support
it.
Include support for USB Ethernet adapters and relevant PHY as a fallback if
onboard Ethernet port is unavailable for some reason.


To generate a diff of this commit:
cvs rdiff -u -r1.127 -r1.128 src/sys/arch/macppc/conf/INSTALL

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/conf/INSTALL
diff -u src/sys/arch/macppc/conf/INSTALL:1.127 src/sys/arch/macppc/conf/INSTALL:1.128
--- src/sys/arch/macppc/conf/INSTALL:1.127	Fri May 11 22:51:33 2018
+++ src/sys/arch/macppc/conf/INSTALL	Fri Aug 31 18:11:20 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: INSTALL,v 1.127 2018/05/11 22:51:33 macallan Exp $
+#	$NetBSD: INSTALL,v 1.128 2018/08/31 18:11:20 sevan Exp $
 #
 # config file for INSTALL FLOPPY
 #
@@ -95,6 +95,7 @@ siop*	at pci? dev ? function ?	# NCR 53c
 #ofb*	at pci? dev ? function ?	# Generic Open Firmware Framebuffer
 genfb*	at pci? dev ? function ?
 cbb*	at pci? dev ? function ?	# PCI-CardBus bridge
+ehci* 	at pci?	dev ? function ?	# Enhanced Host Controller
 ohci*	at pci? dev ? function ?	# Open Host Controller
 pciide* at pci? dev ? function ? flags 0x	# GENERIC pciide driver
 acardide* at pci? dev ? function ?	# Acard IDE controllers
@@ -130,6 +131,7 @@ rlphy*	at mii? phy ?			# Realtek 8139/82
 sqphy*	at mii? phy ?			# Seeq 80220/80221/80223 PHYs
 tqphy*	at mii? phy ?			# TDK Semiconductor PHYs
 ukphy*	at mii? phy ?			# generic unknown PHYs
+urlphy* at mii? phy ?			# Realtek RTL8150L internal PHYs
 
 cardslot* at cbb?
 cardbus* at cardslot?
@@ -180,6 +182,7 @@ atapibus* at atapi?
 cd*	at atapibus? drive ? flags 0x	# ATAPI CD-ROM drives
 sd*	at atapibus? drive ? flags 0x	# ATAPI disk drives
 
+usb* 	at ehci?
 usb*	at ohci?
 uhub*	at usb?
 uhub*	at uhub? port ?
@@ -187,6 +190,16 @@ uhidev* 	at uhub? port ? configuration ?
 ukbd* 	at uhidev? reportid ?
 umass*	at uhub? port ? configuration ? interface ?	# USB Mass Storage
 
+# USB Ethernet adapters
+aue*	at uhub? port ?		# ADMtek AN986 Pegasus based adapters
+axe*	at uhub? port ?		# ASIX AX88172 based adapters
+axen*	at uhub? port ?		# ASIX AX88178a/AX88179 based adapters
+cdce*	at uhub? port ?		# CDC, Ethernet Networking Control Model
+cue*	at uhub? port ?		# CATC USB-EL1201A based adapters
+kue*	at uhub? port ?		# Kawasaki LSI KL5KUSB101B based adapters
+url*	at uhub? port ?		# Realtek RTL8150L based adapters
+udav*	at uhub? port ?		# Davicom DM9601 based adapters
+
 pseudo-device	md			# memory disk
 #pseudo-device	fss			# file system snapshot device
 pseudo-device	loop			# network loopback



CVS commit: [netbsd-8] src/sys

2018-08-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Aug 31 17:51:15 UTC 2018

Modified Files:
src/sys/dev/pci [netbsd-8]: agp_i810.c agp_i810var.h
src/sys/external/bsd/drm2/i915drm [netbsd-8]: intel_gtt.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #998):

sys/dev/pci/agp_i810var.h: revision 1.7
sys/external/bsd/drm2/i915drm/intel_gtt.c: revision 1.7
sys/dev/pci/agp_i810.c: revision 1.123

Restore gtt page table control register on resume.

Additional subroutine agp_i810_reset is used by i915drmkms to make
sure it happens early enough, since i915drmkms resumes before agp.

XXX pullup-7
XXX pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.122 -r1.122.10.1 src/sys/dev/pci/agp_i810.c
cvs rdiff -u -r1.6 -r1.6.10.1 src/sys/dev/pci/agp_i810var.h
cvs rdiff -u -r1.5.10.1 -r1.5.10.2 \
src/sys/external/bsd/drm2/i915drm/intel_gtt.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/agp_i810.c
diff -u src/sys/dev/pci/agp_i810.c:1.122 src/sys/dev/pci/agp_i810.c:1.122.10.1
--- src/sys/dev/pci/agp_i810.c:1.122	Sun May  1 04:22:50 2016
+++ src/sys/dev/pci/agp_i810.c	Fri Aug 31 17:51:15 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: agp_i810.c,v 1.122 2016/05/01 04:22:50 nonaka Exp $	*/
+/*	$NetBSD: agp_i810.c,v 1.122.10.1 2018/08/31 17:51:15 martin Exp $	*/
 
 /*-
  * Copyright (c) 2000 Doug Rabson
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: agp_i810.c,v 1.122 2016/05/01 04:22:50 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: agp_i810.c,v 1.122.10.1 2018/08/31 17:51:15 martin Exp $");
 
 #include 
 #include 
@@ -1490,17 +1490,24 @@ agp_i810_unbind_memory(struct agp_softc 
 	return 0;
 }
 
+void
+agp_i810_reset(struct agp_i810_softc *isc)
+{
+
+	/* Restore the page table control register.  */
+	bus_space_write_4(isc->bst, isc->bsh, AGP_I810_PGTBL_CTL,
+	isc->pgtblctl);
+
+	agp_flush_cache();
+}
+
 static bool
 agp_i810_resume(device_t dv, const pmf_qual_t *qual)
 {
 	struct agp_softc *sc = device_private(dv);
 	struct agp_i810_softc *isc = sc->as_chipc;
 
-	/*
-	 * XXX Nothing uses this!  Save on suspend, restore on resume?
-	 */
-	isc->pgtblctl_resume_hack = READ4(AGP_I810_PGTBL_CTL);
-	agp_flush_cache();
+	agp_i810_reset(isc);
 
 	return true;
 }

Index: src/sys/dev/pci/agp_i810var.h
diff -u src/sys/dev/pci/agp_i810var.h:1.6 src/sys/dev/pci/agp_i810var.h:1.6.10.1
--- src/sys/dev/pci/agp_i810var.h:1.6	Fri Mar  6 22:03:06 2015
+++ src/sys/dev/pci/agp_i810var.h	Fri Aug 31 17:51:15 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: agp_i810var.h,v 1.6 2015/03/06 22:03:06 riastradh Exp $	*/
+/*	$NetBSD: agp_i810var.h,v 1.6.10.1 2018/08/31 17:51:15 martin Exp $	*/
 
 /*-
  * Copyright (c) 2000 Doug Rabson
@@ -58,11 +58,8 @@ struct agp_i810_softc {
 	struct agp_gatt *gatt;		/* i810-only OS-allocated GTT */
 	uint32_t dcache_size;		/* i810-only on-chip memory size */
 
-	/* XXX Kludge to work around broken X servers.  */
+	/* Cached pgtblctl register for resume.  */
 	pcireg_t pgtblctl;
-
-	/* XXX Vestige of unfinished powerhook?  */
-	uint32_t pgtblctl_resume_hack;
 };
 
 extern struct agp_softc	*agp_i810_sc;
@@ -75,3 +72,4 @@ int	agp_i810_write_gtt_entry(struct agp_
 	int);
 void	agp_i810_post_gtt_entry(struct agp_i810_softc *, off_t);
 void	agp_i810_chipset_flush(struct agp_i810_softc *);
+void	agp_i810_reset(struct agp_i810_softc *);

Index: src/sys/external/bsd/drm2/i915drm/intel_gtt.c
diff -u src/sys/external/bsd/drm2/i915drm/intel_gtt.c:1.5.10.1 src/sys/external/bsd/drm2/i915drm/intel_gtt.c:1.5.10.2
--- src/sys/external/bsd/drm2/i915drm/intel_gtt.c:1.5.10.1	Fri Aug 31 17:43:03 2018
+++ src/sys/external/bsd/drm2/i915drm/intel_gtt.c	Fri Aug 31 17:51:15 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: intel_gtt.c,v 1.5.10.1 2018/08/31 17:43:03 martin Exp $	*/
+/*	$NetBSD: intel_gtt.c,v 1.5.10.2 2018/08/31 17:51:15 martin Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 /* Intel GTT stubs */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intel_gtt.c,v 1.5.10.1 2018/08/31 17:43:03 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_gtt.c,v 1.5.10.2 2018/08/31 17:51:15 martin Exp $");
 
 #include 
 #include 
@@ -125,8 +125,14 @@ intel_gmch_remove(void)
 bool
 intel_enable_gtt(void)
 {
+	struct agp_softc *sc = agp_i810_sc;
+	struct agp_i810_softc *isc;
 
-	return (agp_i810_sc != NULL);
+	if (sc == NULL)
+		return false;
+	isc = sc->as_chipc;
+	agp_i810_reset(isc);
+	return true;
 }
 
 void



CVS commit: [netbsd-8] src/sys/external/bsd

2018-08-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Aug 31 17:43:03 UTC 2018

Modified Files:
src/sys/external/bsd/common/include/linux [netbsd-8]: kernel.h
src/sys/external/bsd/drm2/i915drm [netbsd-8]: intel_gtt.c
src/sys/external/bsd/drm2/include/linux [netbsd-8]: bitops.h delay.h
vmalloc.h

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #997):

sys/external/bsd/drm2/i915drm/intel_gtt.c: revision 1.6
sys/external/bsd/drm2/include/linux/delay.h: revision 1.5
sys/external/bsd/common/include/linux/kernel.h: revision 1.9
sys/external/bsd/drm2/include/linux/vmalloc.h: revision 1.5
sys/external/bsd/drm2/include/linux/bitops.h: revision 1.12
sys/external/bsd/drm2/include/linux/bitops.h: revision 1.13

hweight32 should take uint32_t, not uint16_t.  OOPS.
XXX pullup

Fix find_first_zero_bit to find the high bits of 64-bit words...oops.
XXX pullup

Use uvm_km_alloc(kernel_map) and pmap_kenter, not uvm_pagermapin.
XXX pullup

Flush chipset writes after GGTT update.

Echoes Linux commit:

commit 8516673a996870ea0ceb337ee4f83c33c5ec3111
Author: Chris Wilson 
Date:   Fri Dec 8 21:46:16 2017 +
agp/intel: Flush all chipset writes after updating the GGTT
Before accessing the GGTT we must flush the PTE writes and make them
visible to the chipset, or else the indirect access may end up in the
wrong page. In commit 3497971a71d8 ("agp/intel: Flush chipset writes
after updating a single PTE"), we noticed corruption of the uploads for
pwrite and for capturing GPU error states, but it was presumed that the
explicit calls to intel_gtt_chipset_flush() were sufficient for the
execbuffer path. However, we have not been flushing the chipset between
the PTE writes and access via the GTT itself.
For simplicity, do the flush after any PTE update rather than try and
batch the flushes on a just-in-time basis.
References: 3497971a71d8 ("agp/intel: Flush chipset writes after updating a 
single PTE")
Signed-off-by: Chris Wilson 
Cc: Tvrtko Ursulin 
Cc: Mika Kuoppala 
Cc: drm-intel-fixes%lists.freedesktop.org@localhost
Reviewed-by: Joonas Lahtinen 
Link: 
https://patchwork.freedesktop.org/patch/msgid/20171208214616.30147-1-chris%chris-wilson.co.uk@localhost

XXX pullup

Round nsec up for usec delay.
XXX pullup

libkern min/max is 32-bit.  Linux min/max is generic.  @!*#@!$&
XXX pullup


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.8.10.1 \
src/sys/external/bsd/common/include/linux/kernel.h
cvs rdiff -u -r1.5 -r1.5.10.1 src/sys/external/bsd/drm2/i915drm/intel_gtt.c
cvs rdiff -u -r1.11 -r1.11.10.1 \
src/sys/external/bsd/drm2/include/linux/bitops.h
cvs rdiff -u -r1.4 -r1.4.10.1 src/sys/external/bsd/drm2/include/linux/delay.h
cvs rdiff -u -r1.4 -r1.4.12.1 \
src/sys/external/bsd/drm2/include/linux/vmalloc.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/external/bsd/common/include/linux/kernel.h
diff -u src/sys/external/bsd/common/include/linux/kernel.h:1.8 src/sys/external/bsd/common/include/linux/kernel.h:1.8.10.1
--- src/sys/external/bsd/common/include/linux/kernel.h:1.8	Thu Aug 20 21:41:12 2015
+++ src/sys/external/bsd/common/include/linux/kernel.h	Fri Aug 31 17:43:03 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kernel.h,v 1.8 2015/08/20 21:41:12 skrll Exp $	*/
+/*	$NetBSD: kernel.h,v 1.8.10.1 2018/08/31 17:43:03 martin Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -59,6 +59,9 @@
 #define	uninitialized_var(x)	x = 0
 
 /* XXX These will multiply evaluate their arguments.  */
+#define	min(X, Y)	MIN(X, Y)
+#define	max(X, Y)	MAX(X, Y)
+
 #define	max_t(T, X, Y)	MAX(X, Y)
 #define	min_t(T, X, Y)	MIN(X, Y)
 

Index: src/sys/external/bsd/drm2/i915drm/intel_gtt.c
diff -u src/sys/external/bsd/drm2/i915drm/intel_gtt.c:1.5 src/sys/external/bsd/drm2/i915drm/intel_gtt.c:1.5.10.1
--- src/sys/external/bsd/drm2/i915drm/intel_gtt.c:1.5	Fri Mar  6 22:03:06 2015
+++ src/sys/external/bsd/drm2/i915drm/intel_gtt.c	Fri Aug 31 17:43:03 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: intel_gtt.c,v 1.5 2015/03/06 22:03:06 riastradh Exp $	*/
+/*	$NetBSD: intel_gtt.c,v 1.5.10.1 2018/08/31 17:43:03 martin Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 /* Intel GTT stubs */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intel_gtt.c,v 1.5 2015/03/06 22:03:06 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_gtt.c,v 1.5.10.1 2018/08/31 17:43:03 martin Exp $");
 
 #include 
 #include 
@@ -176,6 +176,7 @@ intel_gtt_insert_entries(bus_dmamap_t dm
 		va += PAGE_SIZE;
 	}
 	agp_i810_post_gtt_entry(isc, (va - PAGE_SIZE));
+	intel_gtt_chipset_flush();
 }
 
 void

Index: src/sys/external/bsd/drm2/include/linux/bitops.h
diff -u src/sys/external/bsd/drm2/include/linux/bitops.h:1.11 src/sys/external/bsd/drm2/include/linux/bitops.h:

CVS commit: [netbsd-8] src/sys/external/bsd/drm2/dist/drm/nouveau

2018-08-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Aug 31 17:35:51 UTC 2018

Modified Files:
src/sys/external/bsd/drm2/dist/drm/nouveau [netbsd-8]: nouveau_fence.c
nouveau_fence.h nouveau_nv84_fence.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #996):

sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv84_fence.c: revision 
1.3
sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.h: revision 1.3
sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.h: revision 1.4
sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.h: revision 1.5
sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c: revision 1.5
sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c: revision 1.6
sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c: revision 1.7
sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c: revision 1.8
sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c: revision 1.9

Rewrite nouveau_fence in an attempt to make it make sense.
PR kern/53441
XXX pullup-7
XXX pullup-8

Fences may last longer than their channels.
- Use a reference count on the nouveau_fence_chan object.
- Acquire it with kpreemption disabled.
- Use xcall to wait for kpreempt-disabled sections to complete.
PR kern/53441
XXX pullup-7
XXX pullup-8

Defer nouveau_fence_unref until spin unlock.
- kfree while holding a spin lock is not a good idea.
- Make sure we GC every time we might signal fences.
PR kern/53441
XXX pullup-7
XXX pullup-8

Attempt to make sense of return values of nouveau_fence_wait.
PR kern/53441
XXX pullup-7
XXX pullup-8

Fix edge case of reference counting, oops.
PR kern/53441
XXX pullup-7
XXX pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.10.1 \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c
cvs rdiff -u -r1.2 -r1.2.24.1 \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.h
cvs rdiff -u -r1.2 -r1.2.10.1 \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv84_fence.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/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c:1.4 src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c:1.4.10.1
--- src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c:1.4	Wed Apr 13 07:57:15 2016
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c	Fri Aug 31 17:35:51 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_fence.c,v 1.4 2016/04/13 07:57:15 riastradh Exp $	*/
+/*	$NetBSD: nouveau_fence.c,v 1.4.10.1 2018/08/31 17:35:51 martin Exp $	*/
 
 /*
  * Copyright (C) 2007 Ben Skeggs.
@@ -27,7 +27,10 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nouveau_fence.c,v 1.4 2016/04/13 07:57:15 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_fence.c,v 1.4.10.1 2018/08/31 17:35:51 martin Exp $");
+
+#include 
+#include 
 
 #include 
 
@@ -41,6 +44,12 @@ __KERNEL_RCSID(0, "$NetBSD: nouveau_fenc
 
 #include 
 
+/*
+ * struct fence_work
+ *
+ *	State for a work action scheduled when a fence is completed.
+ *	Will call func(data) at some point after that happens.
+ */
 struct fence_work {
 	struct work_struct base;
 	struct list_head head;
@@ -48,101 +57,291 @@ struct fence_work {
 	void *data;
 };
 
+/*
+ * nouveau_fence_channel_acquire(fence)
+ *
+ *	Try to return the channel associated with fence.
+ */
+static struct nouveau_channel *
+nouveau_fence_channel_acquire(struct nouveau_fence *fence)
+{
+	struct nouveau_channel *chan;
+	struct nouveau_fence_chan *fctx;
+
+	/*
+	 * Block cross-calls while we examine fence.  If we observe
+	 * that fence->done is false, then the channel cannot be
+	 * destroyed even by another CPU until after kpreempt_enable.
+	 */
+	kpreempt_disable();
+	if (fence->done) {
+		chan = NULL;
+	} else {
+		chan = fence->channel;
+		fctx = chan->fence;
+		atomic_inc_uint(&fctx->refcnt);
+	}
+	kpreempt_enable();
+
+	return chan;
+}
+
+/*
+ * nouveau_fence_gc_grab(fctx, list)
+ *
+ *	Move all of channel's done fences to list.
+ *
+ *	Caller must hold channel's fence lock.
+ */
+static void
+nouveau_fence_gc_grab(struct nouveau_fence_chan *fctx, struct list_head *list)
+{
+	struct list_head *node, *next;
+
+	BUG_ON(!spin_is_locked(&fctx->lock));
+
+	list_for_each_safe(node, next, &fctx->done) {
+		list_move_tail(node, list);
+	}
+}
+
+/*
+ * nouveau_fence_gc_free(list)
+ *
+ *	Unreference all of the fences in the list.
+ *
+ *	Caller MUST NOT hold the fences' channel's fence lock.
+ */
+static void
+nouveau_fence_gc_free(struct list_head *list)
+{
+	struct nouveau_fence *fence, *next;
+
+	list_for_each_entry_safe(fence, next, list, head) {
+		list_del(&fence->head);
+		nouveau_fence_unref(&fence);
+	}
+}
+
+/*
+ * nouveau_fence_channel_release(channel)
+ *
+ *	Release the channel acquired with nouveau_fence_channel_acquire.
+ *

CVS commit: src/share/man/man4

2018-08-31 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Fri Aug 31 17:35:06 UTC 2018

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

Log Message:
Remove superfluous Pp.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/share/man/man4/axe.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/axe.4
diff -u src/share/man/man4/axe.4:1.14 src/share/man/man4/axe.4:1.15
--- src/share/man/man4/axe.4:1.14	Fri Aug 31 16:43:26 2018
+++ src/share/man/man4/axe.4	Fri Aug 31 17:35:06 2018
@@ -1,4 +1,4 @@
-.\" $NetBSD: axe.4,v 1.14 2018/08/31 16:43:26 sevan Exp $
+.\" $NetBSD: axe.4,v 1.15 2018/08/31 17:35:06 wiz Exp $
 .\"
 .\" Copyright (c) 2003-2004 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -131,7 +131,6 @@ The chip also supports USB 2.0, thereby 
 The
 .Nm
 driver supports the following media types:
-.Pp
 .Bl -tag -width 
 .It autoselect
 Enable automatic selection of the media type and options.
@@ -170,7 +169,6 @@ operation (AX88178 only).
 The
 .Nm
 driver supports the following media options:
-.Pp
 .Bl -tag -width 
 .It full-duplex
 Force full duplex operation.



CVS commit: src/usr.bin/printf

2018-08-31 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Aug 31 17:27:35 UTC 2018

Modified Files:
src/usr.bin/printf: printf.1 printf.c

Log Message:
PR standards/53563

POSIX requires that signed numbers (strings preceded by '+' or '-')
be allowed as inputs to all of the integer format conversions, including
those which treat the data as unsigned.

Hence we do not need a variant function whose only difference from its
companion is to reject strings starting with '-' - instead we use
the primary function (getintmax()) for everything and remove getuintmax().

Minor update to the man page to indicate that the arg to all of the
integer conversions (diouxX) must be an integer constant (with an
optional sign) and to make it blatantly clear that %o is octal and
%u is unsigned decimal (for some reason those weren't explicitly stated
unlike d i x and X).  Delete "respectively", it is not needed (and does
not really apply).

XXX pullup -8


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/usr.bin/printf/printf.1
cvs rdiff -u -r1.42 -r1.43 src/usr.bin/printf/printf.c

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/printf/printf.1
diff -u src/usr.bin/printf/printf.1:1.30 src/usr.bin/printf/printf.1:1.31
--- src/usr.bin/printf/printf.1:1.30	Tue Jul 24 20:58:39 2018
+++ src/usr.bin/printf/printf.1	Fri Aug 31 17:27:35 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: printf.1,v 1.30 2018/07/24 20:58:39 kre Exp $
+.\"	$NetBSD: printf.1,v 1.31 2018/08/31 17:27:35 kre Exp $
 .\"
 .\" Copyright (c) 1989, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -32,7 +32,7 @@
 .\"
 .\"	from: @(#)printf.1	8.1 (Berkeley) 6/6/93
 .\"
-.Dd July 25, 2018
+.Dd August 31, 2018
 .Dt PRINTF 1
 .Os
 .Sh NAME
@@ -255,9 +255,12 @@ The format characters and their meanings
 .Bl -tag -width Fl
 .It Cm diouXx
 The
-.Ar argument
-is printed as a signed decimal (d or i), unsigned octal, unsigned decimal,
-or unsigned hexadecimal (X or x), respectively.
+.Ar argument ,
+which must represent an integer constant,
+with an optional leading plus or minus sign,
+is printed as a signed decimal (d or i),
+unsigned octal (o), unsigned decimal (u),
+or unsigned hexadecimal (X or x).
 .It Cm fF
 The
 .Ar argument

Index: src/usr.bin/printf/printf.c
diff -u src/usr.bin/printf/printf.c:1.42 src/usr.bin/printf/printf.c:1.43
--- src/usr.bin/printf/printf.c:1.42	Wed Jul 25 15:35:27 2018
+++ src/usr.bin/printf/printf.c	Fri Aug 31 17:27:35 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: printf.c,v 1.42 2018/07/25 15:35:27 kre Exp $	*/
+/*	$NetBSD: printf.c,v 1.43 2018/08/31 17:27:35 kre Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -41,7 +41,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 19
 #if 0
 static char sccsid[] = "@(#)printf.c	8.2 (Berkeley) 3/22/95";
 #else
-__RCSID("$NetBSD: printf.c,v 1.42 2018/07/25 15:35:27 kre Exp $");
+__RCSID("$NetBSD: printf.c,v 1.43 2018/08/31 17:27:35 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -72,7 +72,6 @@ static char	 getchr(void);
 static double	 getdouble(void);
 static int	 getwidth(void);
 static intmax_t	 getintmax(void);
-static uintmax_t getuintmax(void);
 static char	*getstr(void);
 static char	*mklong(const char *, char);
 static void  check_conversion(const char *, const char *);
@@ -301,7 +300,7 @@ int main(int argc, char *argv[])
 			case 'u':
 			case 'x':
 			case 'X': {
-uintmax_t p = getuintmax();
+uintmax_t p = (uintmax_t)getintmax();
 char *f = mklong(start, ch);
 
 PF(f, p);
@@ -655,35 +654,6 @@ getintmax(void)
 	return val;
 }
 
-static uintmax_t
-getuintmax(void)
-{
-	uintmax_t val;
-	char *cp, *ep;
-
-	cp = *gargv;
-	if (cp == NULL)
-		return 0;
-	gargv++;
-
-	if (*cp == '\"' || *cp == '\'')
-		return (uintmax_t)*(cp + 1);
-
-	/* strtoumax won't error -ve values */
-	while (isspace(*(unsigned char *)cp))
-		cp++;
-	if (*cp == '-') {
-		warnx("%s: expected positive numeric value", cp);
-		rval = 1;
-		return 0;
-	}
-
-	errno = 0;
-	val = strtoumax(cp, &ep, 0);
-	check_conversion(cp, ep);
-	return val;
-}
-
 static double
 getdouble(void)
 {



CVS commit: src/share/man/man4

2018-08-31 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Fri Aug 31 16:43:26 UTC 2018

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

Log Message:
Add the correct PHY to SYNOPSIS

axe0 at uhub3 port 1
axe0: Apple Computer (0x5ac) Apple USB to Ethernet (0x1402), rev 2.00/0.01, 
addr 3
axe0: Ethernet address b8:8d:12:XX:XX:XX
ukphy0 at axe0 phy 16: OUI 0x007063, model 0x0006, rev. 1
ukphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/share/man/man4/axe.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/axe.4
diff -u src/share/man/man4/axe.4:1.13 src/share/man/man4/axe.4:1.14
--- src/share/man/man4/axe.4:1.13	Sat Jan 21 09:53:29 2017
+++ src/share/man/man4/axe.4	Fri Aug 31 16:43:26 2018
@@ -1,4 +1,4 @@
-.\" $NetBSD: axe.4,v 1.13 2017/01/21 09:53:29 skrll Exp $
+.\" $NetBSD: axe.4,v 1.14 2018/08/31 16:43:26 sevan Exp $
 .\"
 .\" Copyright (c) 2003-2004 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -60,7 +60,7 @@
 .\" $FreeBSD: /repoman/r/ncvs/src/share/man/man4/axe.4,v 1.3 2003/05/29 21:28:35 ru Exp $
 .\" $OpenBSD: axe.4,v 1.37 2009/11/08 20:25:29 jasper Exp $
 .\"
-.Dd December 19, 2016
+.Dd August 31, 2018
 .Dt AXE 4
 .Os
 .Sh NAME
@@ -68,7 +68,7 @@
 .Nd ASIX Electronics AX88172/AX88178/AX88772 10/100/Gigabit USB Ethernet device
 .Sh SYNOPSIS
 .Cd "axe*   at uhub?"
-.Cd "XXphy* at mii?"
+.Cd "ukphy* at mii?"
 .Sh HARDWARE
 The
 .Nm



CVS commit: src/sys/net

2018-08-31 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Aug 31 15:15:23 UTC 2018

Modified Files:
src/sys/net: rtsock.c

Log Message:
Fix buffer overflow, detected by kASan.

ifconfig gif0 create
ifconfig gif0 up

[   50.682919] kASan: Unauthorized Access In 0x80f22655: Addr 
0x81b997a0 [8 bytes, read]
[   50.682919] #0 0x8021ce6a in kasan_memcpy 
[   50.692999] #1 0x80f22655 in m_copyback_internal 
[   50.692999] #2 0x80f22e81 in m_copyback 
[   50.692999] #3 0x8103109a in rt_msg1 
[   50.692999] #4 0x8159109a in compat_70_rt_newaddrmsg1 
[   50.692999] #5 0x81031b0f in rt_newaddrmsg 
[   50.692999] #6 0x8102c35e in rt_ifa_addlocal 
[   50.692999] #7 0x80a5287c in in6_update_ifa1 
[   50.692999] #8 0x80a54149 in in6_update_ifa 
[   50.692999] #9 0x80a59176 in in6_ifattach 
[   50.692999] #10 0x80a56dd4 in in6_if_up 
[   50.692999] #11 0x80fc5cb8 in if_up_locked 
[   50.703622] #12 0x80fcc4c1 in ifioctl_common 
[   50.703622] #13 0x80fde694 in gif_ioctl 
[   50.703622] #14 0x80fcdb1f in doifioctl 


To generate a diff of this commit:
cvs rdiff -u -r1.241 -r1.242 src/sys/net/rtsock.c

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

Modified files:

Index: src/sys/net/rtsock.c
diff -u src/sys/net/rtsock.c:1.241 src/sys/net/rtsock.c:1.242
--- src/sys/net/rtsock.c:1.241	Wed Apr 25 03:49:57 2018
+++ src/sys/net/rtsock.c	Fri Aug 31 15:15:23 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtsock.c,v 1.241 2018/04/25 03:49:57 ozaki-r Exp $	*/
+/*	$NetBSD: rtsock.c,v 1.242 2018/08/31 15:15:23 maxv Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.241 2018/04/25 03:49:57 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.242 2018/08/31 15:15:23 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1221,11 +1221,11 @@ COMPATNAME(rt_msg1)(int type, struct rt_
 		m_copyback(m, len, sa->sa_len, sa);
 		if (dlen != sa->sa_len) {
 			/*
-			 * Up to 6 + 1 nul's since roundup is to
+			 * Up to 7 + 1 nul's since roundup is to
 			 * sizeof(uint64_t) (8 bytes)
 			 */
 			m_copyback(m, len + sa->sa_len,
-			dlen - sa->sa_len, "\0\0\0\0\0\0");
+			dlen - sa->sa_len, "\0\0\0\0\0\0\0");
 		}
 		len += dlen;
 	}



CVS commit: src/sys/net/npf

2018-08-31 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Aug 31 14:16:07 UTC 2018

Modified Files:
src/sys/net/npf: npf_ext_normalize.c npf_impl.h npf_inet.c

Log Message:
Introduce npf_set_mss(). When the MSS is not 16bit-aligned, it sets:

0  8   16  2432
+--+---+---+--+
| data | MSS (low) | MSS (hig) | data |
+--+---+---+--+
^  ^
old[0] old[1]

And sets new[0,1] accordingly with the new value. The MSS-clamping code
then adjusts twice the checksum on a 16bit boundary:

from old[0] to new[0]
from old[1] to new[1]

Fixes PR/53479, opened by myself. Tested with wireshark and kASan.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/net/npf/npf_ext_normalize.c
cvs rdiff -u -r1.70 -r1.71 src/sys/net/npf/npf_impl.h
cvs rdiff -u -r1.50 -r1.51 src/sys/net/npf/npf_inet.c

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

Modified files:

Index: src/sys/net/npf/npf_ext_normalize.c
diff -u src/sys/net/npf/npf_ext_normalize.c:1.7 src/sys/net/npf/npf_ext_normalize.c:1.8
--- src/sys/net/npf/npf_ext_normalize.c:1.7	Sat Apr  7 09:20:25 2018
+++ src/sys/net/npf/npf_ext_normalize.c	Fri Aug 31 14:16:06 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_ext_normalize.c,v 1.7 2018/04/07 09:20:25 maxv Exp $	*/
+/*	$NetBSD: npf_ext_normalize.c,v 1.8 2018/08/31 14:16:06 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2009-2012 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
 
 #ifdef _KERNEL
 #include 
-__KERNEL_RCSID(0, "$NetBSD: npf_ext_normalize.c,v 1.7 2018/04/07 09:20:25 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_ext_normalize.c,v 1.8 2018/08/31 14:16:06 maxv Exp $");
 
 #include 
 #include 
@@ -148,8 +148,10 @@ npf_normalize(npf_cache_t *npc, void *pa
 {
 	npf_normalize_t *np = params;
 	uint16_t cksum, mss, maxmss = np->n_maxmss;
+	uint16_t old[2], new[2];
 	struct tcphdr *th;
 	int wscale;
+	bool mid;
 
 	/* Skip, if already blocking. */
 	if (*decision == NPF_DECISION_BLOCK) {
@@ -182,13 +184,22 @@ npf_normalize(npf_cache_t *npc, void *pa
 	maxmss = htons(maxmss);
 
 	/*
-	 * Store new MSS, calculate TCP checksum and update it.
+	 * Store new MSS, calculate TCP checksum and update it. The MSS may
+	 * not be aligned and fall in the middle of two uint16_t's, so we
+	 * need to take care of that when calculating the checksum.
+	 *
 	 * WARNING: must re-fetch the TCP header after the modification.
 	 */
-	if (npf_fetch_tcpopts(npc, &maxmss, &wscale) &&
+	if (npf_set_mss(npc, maxmss, old, new, &mid) &&
 	!nbuf_cksum_barrier(npc->npc_nbuf, mi->mi_di)) {
 		th = npc->npc_l4.tcp;
-		cksum = npf_fixup16_cksum(th->th_sum, mss, maxmss);
+		if (mid) {
+			cksum = th->th_sum;
+			cksum = npf_fixup16_cksum(cksum, old[0], new[0]);
+			cksum = npf_fixup16_cksum(cksum, old[1], new[1]);
+		} else {
+			cksum = npf_fixup16_cksum(th->th_sum, mss, maxmss);
+		}
 		th->th_sum = cksum;
 	}
 

Index: src/sys/net/npf/npf_impl.h
diff -u src/sys/net/npf/npf_impl.h:1.70 src/sys/net/npf/npf_impl.h:1.71
--- src/sys/net/npf/npf_impl.h:1.70	Sun Dec 10 01:18:21 2017
+++ src/sys/net/npf/npf_impl.h	Fri Aug 31 14:16:06 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_impl.h,v 1.70 2017/12/10 01:18:21 rmind Exp $	*/
+/*	$NetBSD: npf_impl.h,v 1.71 2018/08/31 14:16:06 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2009-2014 The NetBSD Foundation, Inc.
@@ -283,6 +283,8 @@ void		npf_addr_mask(const npf_addr_t *, 
 int		npf_tcpsaw(const npf_cache_t *, tcp_seq *, tcp_seq *,
 		uint32_t *);
 bool		npf_fetch_tcpopts(npf_cache_t *, uint16_t *, int *);
+bool		npf_set_mss(npf_cache_t *, uint16_t, uint16_t *, uint16_t *,
+		bool *);
 bool		npf_return_block(npf_cache_t *, const int);
 
 /* BPF interface. */

Index: src/sys/net/npf/npf_inet.c
diff -u src/sys/net/npf/npf_inet.c:1.50 src/sys/net/npf/npf_inet.c:1.51
--- src/sys/net/npf/npf_inet.c:1.50	Sun Apr  8 05:51:45 2018
+++ src/sys/net/npf/npf_inet.c	Fri Aug 31 14:16:06 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_inet.c,v 1.50 2018/04/08 05:51:45 maxv Exp $	*/
+/*	$NetBSD: npf_inet.c,v 1.51 2018/08/31 14:16:06 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2009-2014 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
 
 #ifdef _KERNEL
 #include 
-__KERNEL_RCSID(0, "$NetBSD: npf_inet.c,v 1.50 2018/04/08 05:51:45 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_inet.c,v 1.51 2018/08/31 14:16:06 maxv Exp $");
 
 #include 
 #include 
@@ -230,7 +230,6 @@ npf_fetch_tcpopts(npf_cache_t *npc, uint
 	nbuf_t *nbuf = npc->npc_nbuf;
 	const struct tcphdr *th = npc->npc_l4.tcp;
 	int cnt, optlen = 0;
-	bool setmss = false;
 	uint8_t *cp, opt;
 	uint8_t val;
 	bool ok;
@@ -246,11 +245,6 @@ npf_fetch_tcpopts(npf_cache_t *npc, uint
 	}
 	KASSERT(cnt <= MAX_TCPOPTLEN);
 
-	/* Determine if we want to set or get the mss. */
-	if (mss) {
-		setmss = (*mss != 0);
-	}
-
 	/* Fetch all the options at once. */
 	nbuf_reset(nbuf);
 	co

CVS commit: src/sys/dev/usb

2018-08-31 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Aug 31 11:21:00 UTC 2018

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

Log Message:
Convert debug printf to KASSERTMSG for check of RX buffer length.
Also turn KASSERT into KASSERTMSG for that of TX buffer.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/usb/if_mue.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_mue.c
diff -u src/sys/dev/usb/if_mue.c:1.4 src/sys/dev/usb/if_mue.c:1.5
--- src/sys/dev/usb/if_mue.c:1.4	Thu Aug 30 09:59:12 2018
+++ src/sys/dev/usb/if_mue.c	Fri Aug 31 11:21:00 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mue.c,v 1.4 2018/08/30 09:59:12 rin Exp $	*/
+/*	$NetBSD: if_mue.c,v 1.5 2018/08/31 11:21:00 rin Exp $	*/
 /*	$OpenBSD: if_mue.c,v 1.3 2018/08/04 16:42:46 jsg Exp $	*/
 
 /*
@@ -20,7 +20,7 @@
 /* Driver for Microchip LAN7500/LAN7800 chipsets. */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mue.c,v 1.4 2018/08/30 09:59:12 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mue.c,v 1.5 2018/08/31 11:21:00 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1229,7 +1229,8 @@ mue_encap(struct mue_softc *sc, struct m
 	memcpy(c->mue_buf, &hdr, sizeof(hdr)); 
 	len = sizeof(hdr);
 
-	KASSERT(len + m->m_pkthdr.len <= sc->mue_txbufsz);
+	KASSERTMSG(len + m->m_pkthdr.len <= sc->mue_txbufsz, "%d <= %u",
+	len + m->m_pkthdr.len, sc->mue_txbufsz);
 
 	m_copydata(m, 0, m->m_pkthdr.len, c->mue_buf + len);
 	len += m->m_pkthdr.len;
@@ -1447,10 +1448,8 @@ mue_rxeof(struct usbd_xfer *xfer, void *
 
 	usbd_get_xfer_status(xfer, NULL, NULL, &total_len, NULL);
 
-	if (__predict_false(total_len > sc->mue_rxbufsz)) {
-		DPRINTF(sc, "too large transfer\n");
-		goto done;
-	}
+	KASSERTMSG(total_len <= sc->mue_rxbufsz, "%d <= %u",
+	total_len, sc->mue_rxbufsz);
 
 	do {
 		if (__predict_false(total_len < sizeof(*hdrp))) {



CVS commit: src/usr.sbin/npf/npfctl

2018-08-31 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Aug 31 11:18:35 UTC 2018

Modified Files:
src/usr.sbin/npf/npfctl: npf.conf.5

Log Message:
rename net-seg -> map-seg, and document it


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/usr.sbin/npf/npfctl/npf.conf.5

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

Modified files:

Index: src/usr.sbin/npf/npfctl/npf.conf.5
diff -u src/usr.sbin/npf/npfctl/npf.conf.5:1.69 src/usr.sbin/npf/npfctl/npf.conf.5:1.70
--- src/usr.sbin/npf/npfctl/npf.conf.5:1.69	Fri Aug 31 11:11:21 2018
+++ src/usr.sbin/npf/npfctl/npf.conf.5	Fri Aug 31 11:18:35 2018
@@ -1,4 +1,4 @@
-.\"$NetBSD: npf.conf.5,v 1.69 2018/08/31 11:11:21 maxv Exp $
+.\"$NetBSD: npf.conf.5,v 1.70 2018/08/31 11:18:35 maxv Exp $
 .\"
 .\" Copyright (c) 2009-2017 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -408,11 +408,12 @@ table-def	= "table" table-id "type" ( "h
 map		= "map" interface
 		  ( "static" [ "algo" map-algo ] | "dynamic" )
 		  [ map-flags ] [ proto ]
-		  net-seg ( "->" | "<-" | "<->" ) net-seg
+		  map-seg ( "->" | "<-" | "<->" ) map-seg
 		  [ "pass" [ proto ] filt-opts ]
 
 map-algo	= "npt66"
 map-flags	= "no-ports"
+map-seg		= ( addr-mask | interface ) [ port-opts ]
 
 # Rule procedure definition.  The name should be in the double quotes.
 #
@@ -448,11 +449,11 @@ family-opt	= "inet4" | "inet6"
 proto-opts	= "flags" tcp-flags [ "/" tcp-flag-mask ] |
 		  "icmp-type" type [ "code" icmp-code ]
 
-addr-mask	= addr [ "/" mask ]
 filt-opts	= "from" filt-addr [ port-opts ] "to" filt-addr [ port-opts ]
 filt-addr	= [ "!" ] [ interface | addr-mask | table-id | "any" ]
 
 port-opts	= "port" ( port-num | port-from "-" port-to | var-name )
+addr-mask	= addr [ "/" mask ]
 .Ed
 .\" -
 .Sh FILES



CVS commit: src/usr.sbin/npf/npfctl

2018-08-31 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Aug 31 11:11:21 UTC 2018

Modified Files:
src/usr.sbin/npf/npfctl: npf.conf.5

Log Message:
"interface" already contains "var-name", so don't mention it in "filt-addr",
that's redundant


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/usr.sbin/npf/npfctl/npf.conf.5

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

Modified files:

Index: src/usr.sbin/npf/npfctl/npf.conf.5
diff -u src/usr.sbin/npf/npfctl/npf.conf.5:1.68 src/usr.sbin/npf/npfctl/npf.conf.5:1.69
--- src/usr.sbin/npf/npfctl/npf.conf.5:1.68	Fri Aug 31 11:01:09 2018
+++ src/usr.sbin/npf/npfctl/npf.conf.5	Fri Aug 31 11:11:21 2018
@@ -1,4 +1,4 @@
-.\"$NetBSD: npf.conf.5,v 1.68 2018/08/31 11:01:09 maxv Exp $
+.\"$NetBSD: npf.conf.5,v 1.69 2018/08/31 11:11:21 maxv Exp $
 .\"
 .\" Copyright (c) 2009-2017 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -450,8 +450,7 @@ proto-opts	= "flags" tcp-flags [ "/" tcp
 
 addr-mask	= addr [ "/" mask ]
 filt-opts	= "from" filt-addr [ port-opts ] "to" filt-addr [ port-opts ]
-filt-addr	= [ "!" ] [ interface | var-name |
-  addr-mask | table-id | "any" ]
+filt-addr	= [ "!" ] [ interface | addr-mask | table-id | "any" ]
 
 port-opts	= "port" ( port-num | port-from "-" port-to | var-name )
 .Ed



CVS commit: src/usr.sbin/npf/npfctl

2018-08-31 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Aug 31 11:01:09 UTC 2018

Modified Files:
src/usr.sbin/npf/npfctl: npf.conf.5

Log Message:
should be port-opts


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/usr.sbin/npf/npfctl/npf.conf.5

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

Modified files:

Index: src/usr.sbin/npf/npfctl/npf.conf.5
diff -u src/usr.sbin/npf/npfctl/npf.conf.5:1.67 src/usr.sbin/npf/npfctl/npf.conf.5:1.68
--- src/usr.sbin/npf/npfctl/npf.conf.5:1.67	Fri Aug 31 10:52:30 2018
+++ src/usr.sbin/npf/npfctl/npf.conf.5	Fri Aug 31 11:01:09 2018
@@ -1,4 +1,4 @@
-.\"$NetBSD: npf.conf.5,v 1.67 2018/08/31 10:52:30 maxv Exp $
+.\"$NetBSD: npf.conf.5,v 1.68 2018/08/31 11:01:09 maxv Exp $
 .\"
 .\" Copyright (c) 2009-2017 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -452,7 +452,8 @@ addr-mask	= addr [ "/" mask ]
 filt-opts	= "from" filt-addr [ port-opts ] "to" filt-addr [ port-opts ]
 filt-addr	= [ "!" ] [ interface | var-name |
   addr-mask | table-id | "any" ]
-filt-port	= "port" ( port-num | port-from "-" port-to | var-name )
+
+port-opts	= "port" ( port-num | port-from "-" port-to | var-name )
 .Ed
 .\" -
 .Sh FILES



CVS commit: src/usr.sbin/npf/npfctl

2018-08-31 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Aug 31 10:52:30 UTC 2018

Modified Files:
src/usr.sbin/npf/npfctl: npf.conf.5

Log Message:
Clarify the "Groups" section.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/usr.sbin/npf/npfctl/npf.conf.5

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

Modified files:

Index: src/usr.sbin/npf/npfctl/npf.conf.5
diff -u src/usr.sbin/npf/npfctl/npf.conf.5:1.66 src/usr.sbin/npf/npfctl/npf.conf.5:1.67
--- src/usr.sbin/npf/npfctl/npf.conf.5:1.66	Mon Aug 27 13:20:47 2018
+++ src/usr.sbin/npf/npfctl/npf.conf.5	Fri Aug 31 10:52:30 2018
@@ -1,4 +1,4 @@
-.\"$NetBSD: npf.conf.5,v 1.66 2018/08/27 13:20:47 wiz Exp $
+.\"$NetBSD: npf.conf.5,v 1.67 2018/08/31 10:52:30 maxv Exp $
 .\"
 .\" Copyright (c) 2009-2017 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd August 27, 2018
+.Dd August 31, 2018
 .Dt NPF.CONF 5
 .Os
 .Sh NAME
@@ -132,17 +132,25 @@ The
 .Cd family
 keyword can be used in combination of a filtering rule to be explicit.
 .Ss Groups
+NPF requires that all rules be defined within groups.
+Groups can be thought of as higher level rules which can contain subrules.
 Groups may have the following options: name, interface, and direction.
-They are defined in the following form:
+Packets matching group criteria are passed to the ruleset of that group.
+If a packet does not match any group, it is passed to the
+.Cd default group .
+The
+.Cd default group
+must always be defined.
+.Pp
+Example of configuration:
 .Bd -literal
 group "my-name" in on wm0 {
-	# List of rules
+	# List of rules, for packets received on wm0
+}
+group default {
+	# List of rules, for the other packets
 }
 .Ed
-A minimal
-.Nm
-must contain a mandatory
-.Cd default group .
 .Ss Rules
 With a rule statement NPF is instructed to
 .Cd pass



CVS commit: src/usr.sbin/npf/npfd

2018-08-31 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Aug 31 10:38:17 UTC 2018

Modified Files:
src/usr.sbin/npf/npfd: npfd.8

Log Message:
remove commented reference to pflog


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/npf/npfd/npfd.8

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

Modified files:

Index: src/usr.sbin/npf/npfd/npfd.8
diff -u src/usr.sbin/npf/npfd/npfd.8:1.5 src/usr.sbin/npf/npfd/npfd.8:1.6
--- src/usr.sbin/npf/npfd/npfd.8:1.5	Tue Aug  7 22:55:47 2018
+++ src/usr.sbin/npf/npfd/npfd.8	Fri Aug 31 10:38:17 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: npfd.8,v 1.5 2018/08/07 22:55:47 sevan Exp $
+.\"	$NetBSD: npfd.8,v 1.6 2018/08/31 10:38:17 maxv Exp $
 .\"	$OpenBSD: pflogd.8,v 1.35 2007/05/31 19:19:47 jmc Exp $
 .\"
 .\" Copyright (c) 2001 Can Erkin Acar.  All rights reserved.
@@ -156,7 +156,6 @@ Log specific tcp packets to a different 
 .Ed
 .Pp
 Log from another
-.\" .Xr pflog 4
 npflog
 interface, excluding specific packets:
 .Bd -literal -offset indent