CVS commit: src/sys/netinet

2018-07-10 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Jul 11 05:38:55 UTC 2018

Modified Files:
src/sys/netinet: in_offload.c in_offload.h

Log Message:
Remove the callback, localify, and add a comment.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/netinet/in_offload.c
cvs rdiff -u -r1.9 -r1.10 src/sys/netinet/in_offload.h

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

Modified files:

Index: src/sys/netinet/in_offload.c
diff -u src/sys/netinet/in_offload.c:1.8 src/sys/netinet/in_offload.c:1.9
--- src/sys/netinet/in_offload.c:1.8	Wed Jul 11 05:25:45 2018
+++ src/sys/netinet/in_offload.c	Wed Jul 11 05:38:55 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: in_offload.c,v 1.8 2018/07/11 05:25:45 maxv Exp $	*/
+/*	$NetBSD: in_offload.c,v 1.9 2018/07/11 05:38:55 maxv Exp $	*/
 
 /*-
  * Copyright (c)2005, 2006 YAMAMOTO Takashi,
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in_offload.c,v 1.8 2018/07/11 05:25:45 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in_offload.c,v 1.9 2018/07/11 05:38:55 maxv Exp $");
 
 #include 
 #include 
@@ -41,46 +41,13 @@ __KERNEL_RCSID(0, "$NetBSD: in_offload.c
 #include 
 #include 
 
-struct ip_tso_output_args {
-	struct ifnet *ifp;
-	const struct sockaddr *sa;
-	struct rtentry *rt;
-};
-
-static int ip_tso_output_callback(void *, struct mbuf *);
-
-static int
-ip_tso_output_callback(void *vp, struct mbuf *m)
-{
-	struct ip_tso_output_args *args = vp;
-	struct ifnet *ifp = args->ifp;
-
-	return ip_if_output(ifp, m, args->sa, args->rt);
-}
-
-int
-ip_tso_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *sa,
-struct rtentry *rt)
-{
-	struct ip_tso_output_args args;
-
-	args.ifp = ifp;
-	args.sa = sa;
-	args.rt = rt;
-
-	return tcp4_segment(m, ip_tso_output_callback, );
-}
-
 /*
- * tcp4_segment: handle M_CSUM_TSOv4 by software.
- *
- * => always consume m.
- * => call output_func with output_arg for each segments.
+ * Handle M_CSUM_TSOv4 in software. Split the TCP payload in chunks of
+ * size MSS, and send them.
  */
-
-int
-tcp4_segment(struct mbuf *m, int (*output_func)(void *, struct mbuf *),
-void *output_arg)
+static int
+tcp4_segment(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *sa,
+struct rtentry *rt)
 {
 	int mss;
 	int iphlen;
@@ -176,7 +143,7 @@ tcp4_segment(struct mbuf *m, int (*outpu
 		th->th_sum = 0;
 		th->th_sum = in4_cksum(n, IPPROTO_TCP, iphlen, thlen + mss);
 
-		error = (*output_func)(output_arg, n);
+		error = ip_if_output(ifp, n, sa, rt);
 		if (error) {
 			goto quit;
 		}
@@ -197,6 +164,13 @@ quit:
 	return error;
 }
 
+int
+ip_tso_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *sa,
+struct rtentry *rt)
+{
+	return tcp4_segment(ifp, m, sa, rt);
+}
+
 /*
  * Compute now in software the IP and TCP/UDP checksums. Cancel the
  * hardware offloading.

Index: src/sys/netinet/in_offload.h
diff -u src/sys/netinet/in_offload.h:1.9 src/sys/netinet/in_offload.h:1.10
--- src/sys/netinet/in_offload.h:1.9	Wed Jul 11 05:25:45 2018
+++ src/sys/netinet/in_offload.h	Wed Jul 11 05:38:55 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: in_offload.h,v 1.9 2018/07/11 05:25:45 maxv Exp $	*/
+/*	$NetBSD: in_offload.h,v 1.10 2018/07/11 05:38:55 maxv Exp $	*/
 
 /*-
  * Copyright (c)2005, 2006 YAMAMOTO Takashi,
@@ -33,11 +33,10 @@
  * subroutines to do software-only equivalent of h/w offloading.
  */
 
-int tcp4_segment(struct mbuf *, int (*)(void *, struct mbuf *), void *);
 int ip_tso_output(struct ifnet *, struct mbuf *, const struct sockaddr *,
 struct rtentry *);
 void in_undefer_cksum(struct mbuf *, size_t, int);
-void in_undefer_cksum_tcpudp(struct mbuf *m);
+void in_undefer_cksum_tcpudp(struct mbuf *);
 
 /*
  * offloading related sysctl variables.



CVS commit: src/sys

2018-07-10 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Jul 11 05:25:46 UTC 2018

Modified Files:
src/sys/arch/powerpc/booke/dev: pq3etsec.c
src/sys/dist/pf/net: pf.c pf_ioctl.c
src/sys/external/bsd/ipf/netinet: fil.c ip_fil_netbsd.c
src/sys/net: if_loop.c
src/sys/net/npf: npf_mbuf.c
src/sys/netinet: in.h in_offload.c in_offload.h ip_mroute.c ip_output.c
src/sys/netipsec: ipsec.c

Log Message:
Rename

ip_undefer_csum  -> in_undefer_cksum
in_delayed_cksum -> in_undefer_cksum_tcpudp

The two previous names were inconsistent and misleading.

Put the two functions into in_offload.c. Add comments to explain what
we're doing.

The same could be done for IPv6.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/powerpc/booke/dev/pq3etsec.c
cvs rdiff -u -r1.81 -r1.82 src/sys/dist/pf/net/pf.c
cvs rdiff -u -r1.52 -r1.53 src/sys/dist/pf/net/pf_ioctl.c
cvs rdiff -u -r1.23 -r1.24 src/sys/external/bsd/ipf/netinet/fil.c
cvs rdiff -u -r1.28 -r1.29 src/sys/external/bsd/ipf/netinet/ip_fil_netbsd.c
cvs rdiff -u -r1.103 -r1.104 src/sys/net/if_loop.c
cvs rdiff -u -r1.18 -r1.19 src/sys/net/npf/npf_mbuf.c
cvs rdiff -u -r1.105 -r1.106 src/sys/netinet/in.h
cvs rdiff -u -r1.7 -r1.8 src/sys/netinet/in_offload.c
cvs rdiff -u -r1.8 -r1.9 src/sys/netinet/in_offload.h
cvs rdiff -u -r1.160 -r1.161 src/sys/netinet/ip_mroute.c
cvs rdiff -u -r1.306 -r1.307 src/sys/netinet/ip_output.c
cvs rdiff -u -r1.164 -r1.165 src/sys/netipsec/ipsec.c

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

Modified files:

Index: src/sys/arch/powerpc/booke/dev/pq3etsec.c
diff -u src/sys/arch/powerpc/booke/dev/pq3etsec.c:1.34 src/sys/arch/powerpc/booke/dev/pq3etsec.c:1.35
--- src/sys/arch/powerpc/booke/dev/pq3etsec.c:1.34	Tue Jun 26 06:47:59 2018
+++ src/sys/arch/powerpc/booke/dev/pq3etsec.c	Wed Jul 11 05:25:45 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pq3etsec.c,v 1.34 2018/06/26 06:47:59 msaitoh Exp $	*/
+/*	$NetBSD: pq3etsec.c,v 1.35 2018/07/11 05:25:45 maxv Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -41,7 +41,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pq3etsec.c,v 1.34 2018/06/26 06:47:59 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pq3etsec.c,v 1.35 2018/07/11 05:25:45 maxv Exp $");
 
 #include 
 #include 
@@ -2087,7 +2087,7 @@ pq3etsec_tx_offload(
 		if (mn == NULL) {
 			if (csum_flags & M_CSUM_IP4) {
 #ifdef INET
-ip_undefer_csum(m, ETHER_HDR_LEN,
+in_undefer_cksum(m, ETHER_HDR_LEN,
 csum_flags & M_CSUM_IP4);
 #else
 panic("%s: impossible M_CSUM flags %#x",

Index: src/sys/dist/pf/net/pf.c
diff -u src/sys/dist/pf/net/pf.c:1.81 src/sys/dist/pf/net/pf.c:1.82
--- src/sys/dist/pf/net/pf.c:1.81	Thu May  3 07:01:08 2018
+++ src/sys/dist/pf/net/pf.c	Wed Jul 11 05:25:46 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pf.c,v 1.81 2018/05/03 07:01:08 maxv Exp $	*/
+/*	$NetBSD: pf.c,v 1.82 2018/07/11 05:25:46 maxv Exp $	*/
 /*	$OpenBSD: pf.c,v 1.552.2.1 2007/11/27 16:37:57 henning Exp $ */
 
 /*
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pf.c,v 1.81 2018/05/03 07:01:08 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pf.c,v 1.82 2018/07/11 05:25:46 maxv Exp $");
 
 #include "pflog.h"
 
@@ -5353,7 +5353,7 @@ pf_route(struct mbuf **m, struct pf_rule
 	/* Catch routing changes wrt. hardware checksumming for TCP or UDP. */
 #ifdef __NetBSD__
 	if (m0->m_pkthdr.csum_flags & (M_CSUM_TCPv4|M_CSUM_UDPv4)) {
-		in_delayed_cksum(m0);
+		in_undefer_cksum_tcpudp(m0);
 		m0->m_pkthdr.csum_flags &= ~(M_CSUM_TCPv4|M_CSUM_UDPv4);
 	}
 #else

Index: src/sys/dist/pf/net/pf_ioctl.c
diff -u src/sys/dist/pf/net/pf_ioctl.c:1.52 src/sys/dist/pf/net/pf_ioctl.c:1.53
--- src/sys/dist/pf/net/pf_ioctl.c:1.52	Sun Oct 15 04:30:05 2017
+++ src/sys/dist/pf/net/pf_ioctl.c	Wed Jul 11 05:25:46 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pf_ioctl.c,v 1.52 2017/10/15 04:30:05 pgoyette Exp $	*/
+/*	$NetBSD: pf_ioctl.c,v 1.53 2018/07/11 05:25:46 maxv Exp $	*/
 /*	$OpenBSD: pf_ioctl.c,v 1.182 2007/06/24 11:17:13 mcbride Exp $ */
 
 /*
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pf_ioctl.c,v 1.52 2017/10/15 04:30:05 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pf_ioctl.c,v 1.53 2018/07/11 05:25:46 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -3293,7 +3293,7 @@ pfil4_wrapper(void *arg, struct mbuf **m
 	 */
 	if (dir == PFIL_OUT) {
 		if ((*mp)->m_pkthdr.csum_flags & (M_CSUM_TCPv4|M_CSUM_UDPv4)) {
-			in_delayed_cksum(*mp);
+			in_undefer_cksum_tcpudp(*mp);
 			(*mp)->m_pkthdr.csum_flags &=
 			~(M_CSUM_TCPv4|M_CSUM_UDPv4);
 		}

Index: src/sys/external/bsd/ipf/netinet/fil.c
diff -u src/sys/external/bsd/ipf/netinet/fil.c:1.23 src/sys/external/bsd/ipf/netinet/fil.c:1.24
--- src/sys/external/bsd/ipf/netinet/fil.c:1.23	Sun Jun  3 10:37:23 2018
+++ src/sys/external/bsd/ipf/netinet/fil.c	Wed Jul 11 05:25:46 2018
@@ -1,4 +1,4 @@
-/*	

CVS commit: src/sys/arch/x86/x86

2018-07-10 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Jul 11 03:36:32 UTC 2018

Modified Files:
src/sys/arch/x86/x86: coretemp.c

Log Message:
- Detect and set Atom's Tj(max) to 90 if it's not the 45nm D400/D500/N400
  series (90 for Diamondville and 100 for Pineview). From FreeBSD r221509.
- Reducde diff a little against FreeBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/x86/x86/coretemp.c

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

Modified files:

Index: src/sys/arch/x86/x86/coretemp.c
diff -u src/sys/arch/x86/x86/coretemp.c:1.35 src/sys/arch/x86/x86/coretemp.c:1.36
--- src/sys/arch/x86/x86/coretemp.c:1.35	Thu Jul  7 06:55:40 2016
+++ src/sys/arch/x86/x86/coretemp.c	Wed Jul 11 03:36:32 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: coretemp.c,v 1.35 2016/07/07 06:55:40 msaitoh Exp $ */
+/* $NetBSD: coretemp.c,v 1.36 2018/07/11 03:36:32 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: coretemp.c,v 1.35 2016/07/07 06:55:40 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: coretemp.c,v 1.36 2018/07/11 03:36:32 msaitoh Exp $");
 
 #include 
 #include 
@@ -265,14 +265,12 @@ coretemp_tjmax(device_t self)
 	model = CPUID_TO_MODEL(ci->ci_signature);
 	stepping = CPUID_TO_STEPPING(ci->ci_signature);
 
-	sc->sc_tjmax = 100;
-
 	/*
-	 * On some Core 2 CPUs, there is an undocumented
-	 * MSR that tells if Tj(max) is 100 or 85. Note
-	 * that MSR_IA32_EXT_CONFIG is not safe on all CPUs.
+	 * Use 100C as the initial value.
 	 */
-	if ((model == 0x0F && stepping >= 2) || (model == 0x0E)) {
+	sc->sc_tjmax = 100;
+
+	if ((model == 0x0f && stepping >= 2) || (model == 0x0e)) {
 
 		if (rdmsr_safe(MSR_IA32_EXT_CONFIG, ) == EFAULT)
 			return;
@@ -285,6 +283,12 @@ coretemp_tjmax(device_t self)
 		/* The mobile Penryn family. */
 		sc->sc_tjmax = 105;
 		return;
+	} else if (model == 0x1c) {
+		if (stepping == 0x0a) {
+			/* 45nm Atom D400, N400 and D500 series */
+			sc->sc_tjmax = 100;
+		} else
+			sc->sc_tjmax = 90;
 	} else {
 		/*
 		 * Attempt to get Tj(max) from IA32_TEMPERATURE_TARGET,



CVS commit: src/usr.sbin/arp

2018-07-10 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Jul 11 03:10:48 UTC 2018

Modified Files:
src/usr.sbin/arp: arp.c

Log Message:
arp: warn if failed to delete a specified arp entry

This restores the original behavior of arp in NetBSD 7.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/usr.sbin/arp/arp.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.sbin/arp/arp.c
diff -u src/usr.sbin/arp/arp.c:1.61 src/usr.sbin/arp/arp.c:1.62
--- src/usr.sbin/arp/arp.c:1.61	Sat Jul  7 15:44:27 2018
+++ src/usr.sbin/arp/arp.c	Wed Jul 11 03:10:48 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: arp.c,v 1.61 2018/07/07 15:44:27 christos Exp $ */
+/*	$NetBSD: arp.c,v 1.62 2018/07/11 03:10:48 ozaki-r Exp $ */
 
 /*
  * Copyright (c) 1984, 1993
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1984, 19
 #if 0
 static char sccsid[] = "@(#)arp.c	8.3 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: arp.c,v 1.61 2018/07/07 15:44:27 christos Exp $");
+__RCSID("$NetBSD: arp.c,v 1.62 2018/07/11 03:10:48 ozaki-r Exp $");
 #endif
 #endif /* not lint */
 
@@ -502,6 +502,7 @@ delete(const char *host, const char *inf
 	struct rt_msghdr *rtm;
 	struct sockaddr_inarp *sina;
 	struct sockaddr_inarp sin_m = blank_sin; /* struct copy */
+	bool found = false;
 
 	if (host != NULL) {
 		int ret = getinetaddr(host, _m.sin_addr);
@@ -539,12 +540,15 @@ retry:
 		if (host != NULL &&
 		sina->sin_addr.s_addr != sin_m.sin_addr.s_addr)
 			continue;
+		found = true;
 		ret = delete_one(rtm);
 		if (vflag && ret == 0) {
 			(void)printf("%s (%s) deleted\n", host,
 			inet_ntoa(sina->sin_addr));
 		}
 	}
+	if (host != NULL && !found)
+		warnx("delete: can't locate %s", host);
 	free(buf);
 }
 



CVS commit: src/sys/dev/pci

2018-07-10 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Jul 11 00:46:40 UTC 2018

Modified Files:
src/sys/dev/pci: if_skreg.h

Log Message:
Build fix:  Supply missing symbol definition.
Value taken from OpenBSD (and confirmed with FreeBSD)
(Feel free to fix/reformat as appropriate...)


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/pci/if_skreg.h

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

Modified files:

Index: src/sys/dev/pci/if_skreg.h
diff -u src/sys/dev/pci/if_skreg.h:1.23 src/sys/dev/pci/if_skreg.h:1.24
--- src/sys/dev/pci/if_skreg.h:1.23	Tue Jul 10 22:52:38 2018
+++ src/sys/dev/pci/if_skreg.h	Wed Jul 11 00:46:39 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: if_skreg.h,v 1.23 2018/07/10 22:52:38 kre Exp $ */
+/* $NetBSD: if_skreg.h,v 1.24 2018/07/11 00:46:39 kre Exp $ */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -515,6 +515,7 @@
 #define SK_GPIO_DAT7		0x0080
 #define SK_GPIO_DAT8		0x0100
 #define SK_GPIO_DAT9		0x0200
+#define SK_Y2_GPIO_STAT_RACE_DIS	0x2000
 #define SK_GPIO_DIR0		0x0001
 #define SK_GPIO_DIR1		0x0002
 #define SK_GPIO_DIR2		0x0004



CVS commit: src/share/mk

2018-07-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jul 10 23:25:27 UTC 2018

Modified Files:
src/share/mk: sys.mk

Log Message:
Back to always using just the list of sources for the hash. Hopefully this
is reproducible now.


To generate a diff of this commit:
cvs rdiff -u -r1.135 -r1.136 src/share/mk/sys.mk

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

Modified files:

Index: src/share/mk/sys.mk
diff -u src/share/mk/sys.mk:1.135 src/share/mk/sys.mk:1.136
--- src/share/mk/sys.mk:1.135	Tue Jul 10 12:53:16 2018
+++ src/share/mk/sys.mk	Tue Jul 10 19:25:27 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: sys.mk,v 1.135 2018/07/10 16:53:16 christos Exp $
+#	$NetBSD: sys.mk,v 1.136 2018/07/10 23:25:27 christos Exp $
 #	@(#)sys.mk	8.2 (Berkeley) 3/21/94
 #
 # This file contains the basic rules for make(1) and is read first
@@ -54,10 +54,6 @@ CXX?=		c++
 # Remove -Wsystem-headers because C++ headers aren't clean of warnings
 CXXFLAGS?=	${CFLAGS:N-Wno-traditional:N-Wstrict-prototypes:N-Wmissing-prototypes:N-Wno-pointer-sign:N-ffreestanding:N-std=gnu[0-9][0-9]:N-Wold-style-definition:N-Wno-format-zero-length:N-Wsystem-headers}
 
-.if defined(MKREPRO_TIMESTAMP) && !empty(MKREPRO_TIMESTAMP)
-# Use the timestamp as a seed
-__INITSEED=${MKREPRO_TIMESTAMP}
-.else
 # Use the sources, as the seed... Normalize all paths...
 __ALLSRC1=	${empty(DESTDIR):?${.ALLSRC}:${.ALLSRC:S|^${DESTDIR}|^destdir|}}
 __ALLSRC2=	${empty(MAKEOBJDIR):?${__ALLSRC1}:${__ALLSRC1:S|^${MAKEOBJDIR}|^obj|}}
@@ -65,7 +61,6 @@ __ALLSRC3=	${empty(NETBSDSRCDIR):?${__AL
 __ALLSRC4=	${empty(X11SRCDIR):?${__ALLSRC3}:${__ALLSRC3:S|^${X11SRCDIR}|^xsrc|}}
 # Skip paths that contain relative components and can't be normalized, sort..
 __INITSEED=	${__ALLSRC4:N*/../*:O}
-.endif
 
 __BUILDSEED=	${BUILDSEED}/${__INITSEED}/${.TARGET}
 _CXXSEED?=	${BUILDSEED:D-frandom-seed=${__BUILDSEED:hash}}



CVS commit: src/sys/dev/pci

2018-07-10 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Jul 10 22:52:38 UTC 2018

Modified Files:
src/sys/dev/pci: if_skreg.h

Log Message:
Whitespace fixes.  NFC.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/pci/if_skreg.h

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

Modified files:

Index: src/sys/dev/pci/if_skreg.h
diff -u src/sys/dev/pci/if_skreg.h:1.22 src/sys/dev/pci/if_skreg.h:1.23
--- src/sys/dev/pci/if_skreg.h:1.22	Wed Jul  4 19:37:10 2018
+++ src/sys/dev/pci/if_skreg.h	Tue Jul 10 22:52:38 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: if_skreg.h,v 1.22 2018/07/04 19:37:10 jdolecek Exp $ */
+/* $NetBSD: if_skreg.h,v 1.23 2018/07/10 22:52:38 kre Exp $ */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -524,7 +524,7 @@
 #define SK_GPIO_DIR6		0x0040
 #define SK_GPIO_DIR7		0x0080
 #define SK_GPIO_DIR8		0x0100
-#define SK_GPIO_DIR9   0x0200
+#define SK_GPIO_DIR9		0x0200
 
 #define	SK_Y2_CLKGATE_LINK2_INACTIVE	0x80	/* port 2 inactive */
 #define	SK_Y2_CLKGATE_LINK2_GATE_DIS	0x40	/* disable clock gate, 2 */
@@ -836,7 +836,7 @@
 #define SK_TXQS1_Y2_PREF_LIDX   0x0654
 #define SK_TXQS1_Y2_PREF_ADDRLO 0x0658
 #define SK_TXQS1_Y2_PREF_ADDRHI 0x065C
-#define SK_TXQS1_Y2_PREF_GETIDX 0x0660 
+#define SK_TXQS1_Y2_PREF_GETIDX 0x0660
 #define SK_TXQS1_Y2_PREF_PUTIDX 0x0664
 #define SK_TXQS1_Y2_PREF_FIFOWP 0x0670
 #define SK_TXQS1_Y2_PREF_FIFORP 0x0674



CVS commit: src/crypto/external/bsd/openssh/dist

2018-07-10 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Tue Jul 10 22:12:08 UTC 2018

Modified Files:
src/crypto/external/bsd/openssh/dist: ssh-agent.1 ssh-agent.c

Log Message:
Amend whitelisted filesystem paths ssh-agent will look for PKCS11 related
libraries so that things work out of the box with pkgsrc without having to
explicitly whitelist things.

ok christos


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/crypto/external/bsd/openssh/dist/ssh-agent.1
cvs rdiff -u -r1.22 -r1.23 src/crypto/external/bsd/openssh/dist/ssh-agent.c

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

Modified files:

Index: src/crypto/external/bsd/openssh/dist/ssh-agent.1
diff -u src/crypto/external/bsd/openssh/dist/ssh-agent.1:1.12 src/crypto/external/bsd/openssh/dist/ssh-agent.1:1.13
--- src/crypto/external/bsd/openssh/dist/ssh-agent.1:1.12	Tue Apr 18 18:41:46 2017
+++ src/crypto/external/bsd/openssh/dist/ssh-agent.1	Tue Jul 10 22:12:08 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ssh-agent.1,v 1.12 2017/04/18 18:41:46 christos Exp $
+.\"	$NetBSD: ssh-agent.1,v 1.13 2018/07/10 22:12:08 sevan Exp $
 .\" $OpenBSD: ssh-agent.1,v 1.64 2016/11/30 06:54:26 jmc Exp $
 .\"
 .\"
@@ -131,7 +131,7 @@ that may be added using the
 option to
 .Xr ssh-add 1 .
 The default is to allow loading PKCS#11 libraries from
-.Dq /usr/lib/*,/usr/local/lib/* .
+.Dq /usr/lib/*,/usr/pkg/lib/* .
 PKCS#11 libraries that do not match the whitelist will be refused.
 See PATTERNS in
 .Xr ssh_config 5

Index: src/crypto/external/bsd/openssh/dist/ssh-agent.c
diff -u src/crypto/external/bsd/openssh/dist/ssh-agent.c:1.22 src/crypto/external/bsd/openssh/dist/ssh-agent.c:1.23
--- src/crypto/external/bsd/openssh/dist/ssh-agent.c:1.22	Fri Apr  6 18:59:00 2018
+++ src/crypto/external/bsd/openssh/dist/ssh-agent.c	Tue Jul 10 22:12:08 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ssh-agent.c,v 1.22 2018/04/06 18:59:00 christos Exp $	*/
+/*	$NetBSD: ssh-agent.c,v 1.23 2018/07/10 22:12:08 sevan Exp $	*/
 /* $OpenBSD: ssh-agent.c,v 1.228 2018/02/23 15:58:37 markus Exp $ */
 /*
  * Author: Tatu Ylonen 
@@ -36,7 +36,7 @@
  */
 
 #include "includes.h"
-__RCSID("$NetBSD: ssh-agent.c,v 1.22 2018/04/06 18:59:00 christos Exp $");
+__RCSID("$NetBSD: ssh-agent.c,v 1.23 2018/07/10 22:12:08 sevan Exp $");
 
 #include 	/* MIN MAX */
 #include 
@@ -82,7 +82,7 @@ __RCSID("$NetBSD: ssh-agent.c,v 1.22 201
 #endif
 
 #ifndef DEFAULT_PKCS11_WHITELIST
-# define DEFAULT_PKCS11_WHITELIST "/usr/lib*/*,/usr/local/lib*/*"
+# define DEFAULT_PKCS11_WHITELIST "/usr/lib*/*,/usr/pkg/lib*/*"
 #endif
 
 /* Maximum accepted message length */



CVS commit: src/sys/dev/pci

2018-07-10 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Jul 10 20:48:55 UTC 2018

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

Log Message:
replace code using SK_WA_4109 workaround flag by explicit conditional
on affected type ids and revisions, so it's properly applied whenever
new types are added; taken with FreeBSD

contrary to FreeBSD, keep the IWM workaround for all XL revs - my XL rev. A3
seems to consistently have slightly (~2%) better Rx performance with the 0x04
value


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/sys/dev/pci/if_msk.c

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

Modified files:

Index: src/sys/dev/pci/if_msk.c
diff -u src/sys/dev/pci/if_msk.c:1.74 src/sys/dev/pci/if_msk.c:1.75
--- src/sys/dev/pci/if_msk.c:1.74	Tue Jul 10 18:43:20 2018
+++ src/sys/dev/pci/if_msk.c	Tue Jul 10 20:48:54 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: if_msk.c,v 1.74 2018/07/10 18:43:20 jdolecek Exp $ */
+/* $NetBSD: if_msk.c,v 1.75 2018/07/10 20:48:54 jdolecek Exp $ */
 /*	$OpenBSD: if_msk.c,v 1.79 2009/10/15 17:54:56 deraadt Exp $	*/
 
 /*
@@ -52,7 +52,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.74 2018/07/10 18:43:20 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.75 2018/07/10 20:48:54 jdolecek Exp $");
 
 #include 
 #include 
@@ -975,15 +975,20 @@ mskc_reset(struct sk_softc *sc)
 	sc->sk_status_map->dm_segs[0].ds_addr);
 	sk_win_write_4(sc, SK_STAT_BMU_ADDRHI,
 	(u_int64_t)sc->sk_status_map->dm_segs[0].ds_addr >> 32);
-	if ((sc->sk_workaround & SK_STAT_BMU_FIFOIWM) != 0) {
+	if (sc->sk_type == SK_YUKON_EC &&
+	sc->sk_rev == SK_YUKON_EC_REV_A1) {
+		/* WA for dev. #4.3 */
 		sk_win_write_2(sc, SK_STAT_BMU_TX_THRESH, SK_STAT_BMU_TXTHIDX_MSK);
+		/* WA for dev. #4.18 */
 		sk_win_write_1(sc, SK_STAT_BMU_FIFOWM, 0x21);
 		sk_win_write_1(sc, SK_STAT_BMU_FIFOIWM, 0x07);
 	} else {
 		sk_win_write_2(sc, SK_STAT_BMU_TX_THRESH, 0x000a);
 		sk_win_write_1(sc, SK_STAT_BMU_FIFOWM, 0x10);
-		sk_win_write_1(sc, SK_STAT_BMU_FIFOIWM,
-		((sc->sk_workaround & SK_WA_4109) != 0) ? 0x10 : 0x04);
+		if (sc->sk_type == SK_YUKON_XL)
+			sk_win_write_1(sc, SK_STAT_BMU_FIFOIWM, 0x04);
+		else
+			sk_win_write_1(sc, SK_STAT_BMU_FIFOIWM, 0x10);
 		sk_win_write_4(sc, SK_Y2_ISR_ITIMERINIT, 0x0190); /* 3.2us on Yukon-EC */
 	}
 
@@ -992,6 +997,7 @@ mskc_reset(struct sk_softc *sc)
 #endif
 	sk_win_write_4(sc, SK_Y2_TX_ITIMERINIT, SK_IM_USECS(1000));
 
+	/* Enable status unit. */
 	sk_win_write_4(sc, SK_STAT_BMU_CSR, SK_STAT_BMU_ON);
 
 	sk_win_write_1(sc, SK_Y2_LEV_ITIMERCTL, SK_IMCTL_START);
@@ -1473,23 +1479,18 @@ mskc_attach(device_t parent, device_t se
 	if (sc->sk_type == SK_YUKON_XL) {
 		switch (sc->sk_rev) {
 		case SK_YUKON_XL_REV_A0:
-			sc->sk_workaround = 0;
 			revstr = "A0";
 			break;
 		case SK_YUKON_XL_REV_A1:
-			sc->sk_workaround = SK_WA_4109;
 			revstr = "A1";
 			break;
 		case SK_YUKON_XL_REV_A2:
-			sc->sk_workaround = SK_WA_4109;
 			revstr = "A2";
 			break;
 		case SK_YUKON_XL_REV_A3:
-			sc->sk_workaround = SK_WA_4109;
 			revstr = "A3";
 			break;
 		default:
-			sc->sk_workaround = 0;
 			break;
 		}
 	}
@@ -1497,25 +1498,20 @@ mskc_attach(device_t parent, device_t se
 	if (sc->sk_type == SK_YUKON_EC) {
 		switch (sc->sk_rev) {
 		case SK_YUKON_EC_REV_A1:
-			sc->sk_workaround = SK_WA_43_418 | SK_WA_4109;
 			revstr = "A1";
 			break;
 		case SK_YUKON_EC_REV_A2:
-			sc->sk_workaround = SK_WA_4109;
 			revstr = "A2";
 			break;
 		case SK_YUKON_EC_REV_A3:
-			sc->sk_workaround = SK_WA_4109;
 			revstr = "A3";
 			break;
 		default:
-			sc->sk_workaround = 0;
 			break;
 		}
 	}
 
 	if (sc->sk_type == SK_YUKON_FE) {
-		sc->sk_workaround = SK_WA_4109;
 		switch (sc->sk_rev) {
 		case SK_YUKON_FE_REV_A1:
 			revstr = "A1";
@@ -1524,13 +1520,11 @@ mskc_attach(device_t parent, device_t se
 			revstr = "A2";
 			break;
 		default:
-			sc->sk_workaround = 0;
 			break;
 		}
 	}
 
 	if (sc->sk_type == SK_YUKON_EC_U) {
-		sc->sk_workaround = SK_WA_4109;
 		switch (sc->sk_rev) {
 		case SK_YUKON_EC_U_REV_A0:
 			revstr = "A0";
@@ -1545,7 +1539,6 @@ mskc_attach(device_t parent, device_t se
 			revstr = "B1";
 			break;
 		default:
-			sc->sk_workaround = 0;
 			break;
 		}
 	}



CVS commit: src/sys

2018-07-10 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Tue Jul 10 19:58:13 UTC 2018

Modified Files:
src/sys/arch/amd64/conf: ALL
src/sys/arch/i386/conf: ALL GENERIC
src/sys/dev/apm: files.apm

Log Message:
Remove unused macro.


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/sys/arch/amd64/conf/ALL
cvs rdiff -u -r1.441 -r1.442 src/sys/arch/i386/conf/ALL
cvs rdiff -u -r1.1181 -r1.1182 src/sys/arch/i386/conf/GENERIC
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/apm/files.apm

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/amd64/conf/ALL
diff -u src/sys/arch/amd64/conf/ALL:1.91 src/sys/arch/amd64/conf/ALL:1.92
--- src/sys/arch/amd64/conf/ALL:1.91	Tue Jul 10 17:01:43 2018
+++ src/sys/arch/amd64/conf/ALL	Tue Jul 10 19:58:13 2018
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.91 2018/07/10 17:01:43 maya Exp $
+# $NetBSD: ALL,v 1.92 2018/07/10 19:58:13 maya Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"ALL-$Revision: 1.91 $"
+#ident		"ALL-$Revision: 1.92 $"
 
 maxusers	64		# estimated number of users
 
@@ -319,7 +319,6 @@ config		netbsd	root on ? type ?
 #options 	APM_V10_ONLY		# Use only the APM 1.0 calls
 #options 	APM_NO_POWEROFF		# Don't power off on halt(8)
 #options 	APM_POWER_PRINT		# Print stats on the console
-#options 	APM_DISABLE_INTERRUPTS=0 # Don't disable interrupts
 
 
 # Basic Bus Support

Index: src/sys/arch/i386/conf/ALL
diff -u src/sys/arch/i386/conf/ALL:1.441 src/sys/arch/i386/conf/ALL:1.442
--- src/sys/arch/i386/conf/ALL:1.441	Tue Jul 10 17:01:43 2018
+++ src/sys/arch/i386/conf/ALL	Tue Jul 10 19:58:13 2018
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.441 2018/07/10 17:01:43 maya Exp $
+# $NetBSD: ALL,v 1.442 2018/07/10 19:58:13 maya Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"ALL-$Revision: 1.441 $"
+#ident		"ALL-$Revision: 1.442 $"
 
 maxusers	64		# estimated number of users
 
@@ -319,7 +319,6 @@ p64h2apic* at pci? dev? function?	# P64H
 #options 	APM_V10_ONLY		# Use only the APM 1.0 calls
 #options 	APM_NO_POWEROFF		# Don't power off on halt(8)
 #options 	APM_POWER_PRINT		# Print stats on the console
-#options 	APM_DISABLE_INTERRUPTS=0 # Don't disable interrupts
 
 
 # Basic Bus Support

Index: src/sys/arch/i386/conf/GENERIC
diff -u src/sys/arch/i386/conf/GENERIC:1.1181 src/sys/arch/i386/conf/GENERIC:1.1182
--- src/sys/arch/i386/conf/GENERIC:1.1181	Tue Jul 10 17:01:43 2018
+++ src/sys/arch/i386/conf/GENERIC	Tue Jul 10 19:58:13 2018
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.1181 2018/07/10 17:01:43 maya Exp $
+# $NetBSD: GENERIC,v 1.1182 2018/07/10 19:58:13 maya Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.1181 $"
+#ident		"GENERIC-$Revision: 1.1182 $"
 
 maxusers	64		# estimated number of users
 
@@ -299,7 +299,6 @@ config		netbsd	root on ? type ?
 #options 	APM_V10_ONLY		# Use only the APM 1.0 calls
 #options 	APM_NO_POWEROFF		# Don't power off on halt(8)
 #options 	APM_POWER_PRINT		# Print stats on the console
-#options 	APM_DISABLE_INTERRUPTS=0 # Don't disable interrupts
 
 
 # Basic Bus Support

Index: src/sys/dev/apm/files.apm
diff -u src/sys/dev/apm/files.apm:1.4 src/sys/dev/apm/files.apm:1.5
--- src/sys/dev/apm/files.apm:1.4	Sun Sep 30 21:36:20 2012
+++ src/sys/dev/apm/files.apm	Tue Jul 10 19:58:13 2018
@@ -1,10 +1,10 @@
-# $NetBSD: files.apm,v 1.4 2012/09/30 21:36:20 dsl Exp $
+# $NetBSD: files.apm,v 1.5 2018/07/10 19:58:13 maya Exp $
 
 #
 # Common APM support files
 #
 defflag	opt_apm.h	APM_V10_ONLY APM_NO_V12 APMDEBUG
 			APM_POWER_PRINT
-defparam opt_apm.h	APMDEBUG_VALUE APM_DISABLE_INTERRUPTS
+defparam opt_apm.h	APMDEBUG_VALUE
 device	apm
 file	dev/apm/apm.c		apm



CVS commit: src/sys/sys

2018-07-10 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Tue Jul 10 19:55:05 UTC 2018

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

Log Message:
Remove unused macro.


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/sys/sys/lock.h

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

Modified files:

Index: src/sys/sys/lock.h
diff -u src/sys/sys/lock.h:1.86 src/sys/sys/lock.h:1.87
--- src/sys/sys/lock.h:1.86	Thu Jul  1 13:00:57 2010
+++ src/sys/sys/lock.h	Tue Jul 10 19:55:05 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: lock.h,v 1.86 2010/07/01 13:00:57 hannken Exp $	*/
+/*	$NetBSD: lock.h,v 1.87 2018/07/10 19:55:05 maya Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2006, 2007 The NetBSD Foundation, Inc.
@@ -101,8 +101,6 @@ do {\
 		(count) += (count);\
 } while (/* CONSTCOND */ 0);
 
-#define	SPINLOCK_RUN_HOOK(count)	((count) >= SPINLOCK_BACKOFF_MAX)
-
 #ifdef LOCKDEBUG
 #define	SPINLOCK_SPINOUT(spins)		((spins)++ > 0x0fff)
 #else



CVS commit: src/sys/net

2018-07-10 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Jul 10 19:30:37 UTC 2018

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

Log Message:
UPdate previous so that there is no unused (but assigned) variable
left when there is no ARP.   Thanks gcc!


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/net/if_llatbl.c

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

Modified files:

Index: src/sys/net/if_llatbl.c
diff -u src/sys/net/if_llatbl.c:1.29 src/sys/net/if_llatbl.c:1.30
--- src/sys/net/if_llatbl.c:1.29	Tue Jul 10 11:00:40 2018
+++ src/sys/net/if_llatbl.c	Tue Jul 10 19:30:37 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_llatbl.c,v 1.29 2018/07/10 11:00:40 kre Exp $	*/
+/*	$NetBSD: if_llatbl.c,v 1.30 2018/07/10 19:30:37 kre Exp $	*/
 /*
  * Copyright (c) 2004 Luigi Rizzo, Alessandro Cerri. All rights reserved.
  * Copyright (c) 2004-2008 Qing Li. All rights reserved.
@@ -690,12 +690,14 @@ lla_rt_output(const u_char rtm_type, con
 		 * conditions so remove it first.
 		 */
 		if (lle != NULL) {
-			size_t pkts_dropped = llentry_free(lle);
 #if defined(INET) && NARP > 0
+			size_t pkts_dropped = llentry_free(lle);
 			if (dst->sa_family == AF_INET) {
 arp_stat_add(ARP_STAT_DFRDROPPED,
 (uint64_t)pkts_dropped);
 			}
+#else
+			(void) llentry_free(lle);
 #endif
 		}
 



CVS commit: src/sys/dev/pci

2018-07-10 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Jul 10 18:43:20 UTC 2018

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

Log Message:
minor fix for earlier sync with OpenBSD if_msk.c; remove duplicit
COMA handling, add also workaround code for Yukon EC Ultra and EX, and
remove a write-only assignment


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/dev/pci/if_msk.c

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

Modified files:

Index: src/sys/dev/pci/if_msk.c
diff -u src/sys/dev/pci/if_msk.c:1.73 src/sys/dev/pci/if_msk.c:1.74
--- src/sys/dev/pci/if_msk.c:1.73	Tue Jul 10 18:34:42 2018
+++ src/sys/dev/pci/if_msk.c	Tue Jul 10 18:43:20 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: if_msk.c,v 1.73 2018/07/10 18:34:42 jdolecek Exp $ */
+/* $NetBSD: if_msk.c,v 1.74 2018/07/10 18:43:20 jdolecek Exp $ */
 /*	$OpenBSD: if_msk.c,v 1.79 2009/10/15 17:54:56 deraadt Exp $	*/
 
 /*
@@ -52,7 +52,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.73 2018/07/10 18:34:42 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.74 2018/07/10 18:43:20 jdolecek Exp $");
 
 #include 
 #include 
@@ -837,12 +837,6 @@ mskc_reset(struct sk_softc *sc)
 	CSR_WRITE_1(sc, SK_CSR, SK_CSR_MASTER_UNRESET);
 	sk_win_write_1(sc, SK_TESTCTL1, 2);
 
-	reg1 = sk_win_read_4(sc, SK_Y2_PCI_REG(SK_PCI_OURREG1));
-	if (sc->sk_type == SK_YUKON_XL && sc->sk_rev > SK_YUKON_XL_REV_A1)
-		reg1 |= (SK_Y2_REG1_PHY1_COMA | SK_Y2_REG1_PHY2_COMA);
-	else
-		reg1 &= ~(SK_Y2_REG1_PHY1_COMA | SK_Y2_REG1_PHY2_COMA);
-
 	if (sc->sk_type == SK_YUKON_EC_U || sc->sk_type == SK_YUKON_EX ||
 	sc->sk_type >= SK_YUKON_FE_P) {
 		uint32_t our;
@@ -860,6 +854,15 @@ mskc_reset(struct sk_softc *sc)
 		sk_win_write_4(sc, SK_Y2_PCI_REG(SK_PCI_OURREG4), our);
 		/* Set to default value */
 		sk_win_write_4(sc, SK_Y2_PCI_REG(SK_PCI_OURREG5), 0);
+
+		/*
+		 * Disable status race, workaround for Yukon EC Ultra &
+		 * Yukon EX.
+		 */
+		reg1 = sk_win_read_4(sc, SK_GPIO);
+		reg1 |= SK_Y2_GPIO_STAT_RACE_DIS;
+		sk_win_write_4(sc, SK_GPIO, reg1);
+		sk_win_read_4(sc, SK_GPIO);
 	}
 
 	/* release PHY from PowerDown/Coma mode. */
@@ -963,7 +966,6 @@ mskc_reset(struct sk_softc *sc)
 	bus_dmamap_sync(sc->sc_dmatag, sc->sk_status_map, 0,
 	sc->sk_status_map->dm_mapsize, BUS_DMASYNC_PREREAD);
 	sc->sk_status_idx = 0;
-	sc->sk_status_own_idx = 0;
 
 	sk_win_write_4(sc, SK_STAT_BMU_CSR, SK_STAT_BMU_RESET);
 	sk_win_write_4(sc, SK_STAT_BMU_CSR, SK_STAT_BMU_UNRESET);



CVS commit: src/sys/dev/pci

2018-07-10 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Jul 10 18:42:37 UTC 2018

Modified Files:
src/sys/dev/pci: if_mskvar.h

Log Message:
add the RX refill callout (forgot to commit with if_msk.c change)


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/pci/if_mskvar.h

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

Modified files:

Index: src/sys/dev/pci/if_mskvar.h
diff -u src/sys/dev/pci/if_mskvar.h:1.17 src/sys/dev/pci/if_mskvar.h:1.18
--- src/sys/dev/pci/if_mskvar.h:1.17	Tue Jul  3 19:56:01 2018
+++ src/sys/dev/pci/if_mskvar.h	Tue Jul 10 18:42:37 2018
@@ -1,5 +1,5 @@
 /*	$OpenBSD: if_mskvar.h,v 1.3 2006/12/28 16:34:42 kettenis Exp $	*/
-/*	$NetBSD: if_mskvar.h,v 1.17 2018/07/03 19:56:01 jdolecek Exp $	*/
+/*	$NetBSD: if_mskvar.h,v 1.18 2018/07/10 18:42:37 jdolecek Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -229,6 +229,7 @@ struct sk_if_softc {
 	int			sk_pktlen;	/* XXX set but unused for now */
 	int			sk_link;
 	struct callout		sk_tick_ch;
+	struct callout		sk_tick_rx;
 	struct msk_chain_data	sk_cdata;
 	struct msk_ring_data	*sk_rdata;
 	bus_dmamap_t		sk_ring_map;



CVS commit: src/sys/dev/pci

2018-07-10 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Jul 10 18:34:42 UTC 2018

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

Log Message:
fix comment typo


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/sys/dev/pci/if_msk.c

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

Modified files:

Index: src/sys/dev/pci/if_msk.c
diff -u src/sys/dev/pci/if_msk.c:1.72 src/sys/dev/pci/if_msk.c:1.73
--- src/sys/dev/pci/if_msk.c:1.72	Tue Jul 10 18:32:25 2018
+++ src/sys/dev/pci/if_msk.c	Tue Jul 10 18:34:42 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: if_msk.c,v 1.72 2018/07/10 18:32:25 jdolecek Exp $ */
+/* $NetBSD: if_msk.c,v 1.73 2018/07/10 18:34:42 jdolecek Exp $ */
 /*	$OpenBSD: if_msk.c,v 1.79 2009/10/15 17:54:56 deraadt Exp $	*/
 
 /*
@@ -52,7 +52,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.72 2018/07/10 18:32:25 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.73 2018/07/10 18:34:42 jdolecek Exp $");
 
 #include 
 #include 
@@ -2292,7 +2292,7 @@ msk_init_yukon(struct sk_if_softc *sc_if
 	SK_IF_WRITE_2(sc_if, 0, SK_RXMF1_CTRL_TEST, SK_RFCTL_OPERATION_ON |
 	SK_RFCTL_FIFO_FLUSH_ON);
 
-	/* Increase flush threshould to 64 bytes */
+	/* Increase flush threshold to 64 bytes */
 	SK_IF_WRITE_2(sc_if, 0, SK_RXMF1_FLUSH_THRESHOLD,
 	SK_RFCTL_FIFO_THRESHOLD + 1);
 



CVS commit: src/sys/dev/pci

2018-07-10 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Jul 10 18:32:25 UTC 2018

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

Log Message:
add callout for re-filling RX ring - it's invoked when the RX refill
code can't get enough buffers; fixes possible stall when the RXSTAT
interrupt arrives while no buffers are available

idea from OpenBSD if_msk.c rev. 1.131

as part of this remove the confusingly commented re-fill code from
msk_jfree() and instead just invoke the callout if needed; also
refill in msk_intr() only when running low instead of every RX intr;
this simplifies the code, and gives small RX performance boost on
my hardware (6%: ~38 MB/s -> ~40 MB/s)

tested on SK-9E22 (Yukon-2 XL rev. A3) by me, and 88E8071 (Yukon-2
Extreme rev. B0) by Jogn Halfpenny; unfortunately still doesn't
resolve the PR kern/53301 stall


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/dev/pci/if_msk.c

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

Modified files:

Index: src/sys/dev/pci/if_msk.c
diff -u src/sys/dev/pci/if_msk.c:1.71 src/sys/dev/pci/if_msk.c:1.72
--- src/sys/dev/pci/if_msk.c:1.71	Wed Jul  4 19:26:09 2018
+++ src/sys/dev/pci/if_msk.c	Tue Jul 10 18:32:25 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: if_msk.c,v 1.71 2018/07/04 19:26:09 jdolecek Exp $ */
+/* $NetBSD: if_msk.c,v 1.72 2018/07/10 18:32:25 jdolecek Exp $ */
 /*	$OpenBSD: if_msk.c,v 1.79 2009/10/15 17:54:56 deraadt Exp $	*/
 
 /*
@@ -52,7 +52,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.71 2018/07/04 19:26:09 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.72 2018/07/10 18:32:25 jdolecek Exp $");
 
 #include 
 #include 
@@ -114,7 +114,7 @@ int msk_init(struct ifnet *);
 void msk_init_yukon(struct sk_if_softc *);
 void msk_stop(struct ifnet *, int);
 void msk_watchdog(struct ifnet *);
-int msk_newbuf(struct sk_if_softc *, struct mbuf *, bus_dmamap_t);
+int msk_newbuf(struct sk_if_softc *, bus_dmamap_t);
 int msk_alloc_jumbo_mem(struct sk_if_softc *);
 void *msk_jalloc(struct sk_if_softc *);
 void msk_jfree(struct mbuf *, void *, size_t, void *);
@@ -131,6 +131,7 @@ void msk_miibus_statchg(struct ifnet *);
 void msk_setmulti(struct sk_if_softc *);
 void msk_setpromisc(struct sk_if_softc *);
 void msk_tick(void *);
+static void msk_fill_rx_tick(void *);
 
 /* #define MSK_DEBUG 1 */
 #ifdef MSK_DEBUG
@@ -473,42 +474,30 @@ msk_init_tx_ring(struct sk_if_softc *sc_
 }
 
 int
-msk_newbuf(struct sk_if_softc *sc_if, struct mbuf *m,
-	  bus_dmamap_t dmamap)
+msk_newbuf(struct sk_if_softc *sc_if, bus_dmamap_t dmamap)
 {
 	struct mbuf		*m_new = NULL;
 	struct sk_chain		*c;
 	struct msk_rx_desc	*r;
+	void *buf = NULL;
 
-	if (m == NULL) {
-		void *buf = NULL;
+	MGETHDR(m_new, M_DONTWAIT, MT_DATA);
+	if (m_new == NULL)
+		return (ENOBUFS);
 
-		MGETHDR(m_new, M_DONTWAIT, MT_DATA);
-		if (m_new == NULL)
-			return (ENOBUFS);
+	/* Allocate the jumbo buffer */
+	buf = msk_jalloc(sc_if);
+	if (buf == NULL) {
+		m_freem(m_new);
+		DPRINTFN(1, ("%s jumbo allocation failed -- packet "
+		"dropped!\n", sc_if->sk_ethercom.ec_if.if_xname));
+		return (ENOBUFS);
+	}
 
-		/* Allocate the jumbo buffer */
-		buf = msk_jalloc(sc_if);
-		if (buf == NULL) {
-			m_freem(m_new);
-			DPRINTFN(1, ("%s jumbo allocation failed -- packet "
-			"dropped!\n", sc_if->sk_ethercom.ec_if.if_xname));
-			return (ENOBUFS);
-		}
+	/* Attach the buffer to the mbuf */
+	m_new->m_len = m_new->m_pkthdr.len = SK_JLEN;
+	MEXTADD(m_new, buf, SK_JLEN, 0, msk_jfree, sc_if);
 
-		/* Attach the buffer to the mbuf */
-		m_new->m_len = m_new->m_pkthdr.len = SK_JLEN;
-		MEXTADD(m_new, buf, SK_JLEN, 0, msk_jfree, sc_if);
-	} else {
-		/*
-	 	 * We're re-using a previously allocated mbuf;
-		 * be sure to re-init pointers and lengths to
-		 * default values.
-		 */
-		m_new = m;
-		m_new->m_len = m_new->m_pkthdr.len = SK_JLEN;
-		m_new->m_data = m_new->m_ext.ext_buf;
-	}
 	m_adj(m_new, ETHER_ALIGN);
 
 	c = _if->sk_cdata.sk_rx_chain[sc_if->sk_cdata.sk_rx_prod];
@@ -697,6 +686,11 @@ msk_jfree(struct mbuf *m, void *buf, siz
 
 	if (__predict_true(m != NULL))
 		pool_cache_put(mb_cache, m);
+
+	/* Now that we know we have a free RX buffer, refill if running out */
+	if ((sc->sk_ethercom.ec_if.if_flags & IFF_RUNNING) != 0
+	&& sc->sk_cdata.sk_rx_cnt < (MSK_RX_RING_CNT/3))
+		callout_schedule(>sk_tick_rx, 0);
 }
 
 int
@@ -1202,6 +1196,9 @@ msk_attach(device_t parent, device_t sel
 	callout_setfunc(_if->sk_tick_ch, msk_tick, sc_if);
 	callout_schedule(_if->sk_tick_ch, hz);
 
+	callout_init(_if->sk_tick_rx, 0);
+	callout_setfunc(_if->sk_tick_rx, msk_fill_rx_tick, sc_if);
+
 	/*
 	 * Call MI attach routines.
 	 */
@@ -1250,6 +1247,9 @@ msk_detach(device_t self, int flags)
 	callout_halt(_if->sk_tick_ch, NULL);
 	callout_destroy(_if->sk_tick_ch);
 
+	callout_halt(_if->sk_tick_rx, NULL);
+	callout_destroy(_if->sk_tick_rx);
+
 	/* Detach any PHYs we might have. */
 	if 

CVS commit: src/external/mit/xorg/server/drivers/xf86-video-openchrome

2018-07-10 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Tue Jul 10 17:36:38 UTC 2018

Modified Files:
src/external/mit/xorg/server/drivers/xf86-video-openchrome: Makefile

Log Message:
Add missing file to openchrome driver.

Prior to this commit, startx failed with a missing symbol.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 \
src/external/mit/xorg/server/drivers/xf86-video-openchrome/Makefile

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

Modified files:

Index: src/external/mit/xorg/server/drivers/xf86-video-openchrome/Makefile
diff -u src/external/mit/xorg/server/drivers/xf86-video-openchrome/Makefile:1.13 src/external/mit/xorg/server/drivers/xf86-video-openchrome/Makefile:1.14
--- src/external/mit/xorg/server/drivers/xf86-video-openchrome/Makefile:1.13	Fri Feb  2 01:02:40 2018
+++ src/external/mit/xorg/server/drivers/xf86-video-openchrome/Makefile	Tue Jul 10 17:36:38 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.13 2018/02/02 01:02:40 mrg Exp $
+#	$NetBSD: Makefile,v 1.14 2018/07/10 17:36:38 maya Exp $
 
 DRIVER=		xf86-video-openchrome
 DRIVER_NAME=	openchrome_drv
@@ -24,6 +24,7 @@ SRCS=	\
 	via_tv.c \
 	via_vgahw.c \
 	via_vt162x.c \
+	via_vt1632.c \
 	via_xv_overlay.c \
 	via_xv.c
 



CVS commit: src

2018-07-10 Thread Maya Rashish
video.html		man-sys-htmlman		html
@@ -8021,7 +8021,7 @@
 ./usr/share/man/man4/verifiedexec.4		man-obsolete		obsolete
 ./usr/share/man/man4/vga.4			man-sys-man		.man
 ./usr/share/man/man4/vge.4			man-sys-man		.man
-./usr/share/man/man4/viadrm.4			man-sys-man		.man
+./usr/share/man/man4/viadrm.4			man-obsolete		obsolete
 ./usr/share/man/man4/viaenv.4			man-sys-man		.man
 ./usr/share/man/man4/viaide.4			man-sys-man		.man
 ./usr/share/man/man4/viapm.4			man-obsolete		obsolete

Index: src/distrib/sets/lists/modules/md.i386
diff -u src/distrib/sets/lists/modules/md.i386:1.78 src/distrib/sets/lists/modules/md.i386:1.79
--- src/distrib/sets/lists/modules/md.i386:1.78	Mon Feb 26 07:30:17 2018
+++ src/distrib/sets/lists/modules/md.i386	Tue Jul 10 17:01:42 2018
@@ -1,4 +1,4 @@
-# $NetBSD: md.i386,v 1.78 2018/02/26 07:30:17 pgoyette Exp $
+# $NetBSD: md.i386,v 1.79 2018/07/10 17:01:42 maya Exp $
 #
 # NOTE that there are three sets of files here:
 # @MODULEDIR@, i386-xen, and i386pae-xen
@@ -182,8 +182,8 @@
 ./@MODULEDIR@/ubsec/ubsec.kmod			base-kernel-modules	kmod
 ./@MODULEDIR@/viac7tempbase-kernel-modules	kmod
 ./@MODULEDIR@/viac7temp/viac7temp.kmod		base-kernel-modules	kmod
-./@MODULEDIR@/viadrmbase-kernel-modules	kmod
-./@MODULEDIR@/viadrm/viadrm.kmod		base-kernel-modules	kmod
+./@MODULEDIR@/viadrmbase-obsolete		obsolete
+./@MODULEDIR@/viadrm/viadrm.kmod		base-obsolete		obsolete
 ./@MODULEDIR@/viadrmumsbase-kernel-modules	kmod
 ./@MODULEDIR@/viadrmums/viadrmums.kmod		base-kernel-modules	kmod
 ./@MODULEDIR@/vmtbase-kernel-modules	kmod

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2406 src/doc/CHANGES:1.2407
--- src/doc/CHANGES:1.2406	Mon Jul  9 10:08:35 2018
+++ src/doc/CHANGES	Tue Jul 10 17:01:43 2018
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2406 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2407 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -169,3 +169,4 @@ Changes from NetBSD 8.0 to NetBSD 9.0:
 		[msaitoh 20180626]
 	gcc: add lsan the Leak Sanitizer [christos 20180626]
 	aarch64: Add support for SMP. [ryo 20180709]
+	viadrm(4): Removed, superseded by viadrmums. [maya 20180710]

Index: src/share/man/man4/Makefile
diff -u src/share/man/man4/Makefile:1.656 src/share/man/man4/Makefile:1.657
--- src/share/man/man4/Makefile:1.656	Wed Jun 13 03:28:36 2018
+++ src/share/man/man4/Makefile	Tue Jul 10 17:01:43 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.656 2018/06/13 03:28:36 ozaki-r Exp $
+#	$NetBSD: Makefile,v 1.657 2018/07/10 17:01:43 maya Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/18/93
 
 MAN=	aac.4 ac97.4 acardide.4 aceride.4 acphy.4 \
@@ -177,7 +177,6 @@ MLINKS+=drm.4 radeondrm.4
 MLINKS+=drm.4 savagedrm.4
 MLINKS+=drm.4 sisdrm.4
 MLINKS+=drm.4 tdfxdrm.4
-MLINKS+=drm.4 viadrm.4
 
 MLINKS+=acpiec.4 acpiecdt.4
 MLINKS+=acpivga.4 acpiout.4

Index: src/share/man/man4/drm.4
diff -u src/share/man/man4/drm.4:1.15 src/share/man/man4/drm.4:1.16
--- src/share/man/man4/drm.4:1.15	Tue Jun  4 07:47:54 2013
+++ src/share/man/man4/drm.4	Tue Jul 10 17:01:43 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: drm.4,v 1.15 2013/06/04 07:47:54 wiz Exp $
+.\"	$NetBSD: drm.4,v 1.16 2018/07/10 17:01:43 maya Exp $
 .\"
 .\" Copyright (c) 2007, 2013 Thomas Klausner
 .\" All rights reserved.
@@ -23,7 +23,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd June 4, 2013
+.Dd July 10, 2018
 .Dt DRM 4
 .Os
 .Sh NAME
@@ -38,7 +38,6 @@
 .Cd savagedrm* at drm?
 .Cd sisdrm*at drm?
 .Cd tdfxdrm*   at drm?
-.Cd viadrm*at drm?
 .Pp
 .Cd optionsDRM_DEBUG
 .Cd optionsDRM_NO_AGP

Index: src/sys/arch/amd64/conf/ALL
diff -u src/sys/arch/amd64/conf/ALL:1.90 src/sys/arch/amd64/conf/ALL:1.91
--- src/sys/arch/amd64/conf/ALL:1.90	Sat Jun 16 15:04:29 2018
+++ src/sys/arch/amd64/conf/ALL	Tue Jul 10 17:01:43 2018
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.90 2018/06/16 15:04:29 jdolecek Exp $
+# $NetBSD: ALL,v 1.91 2018/07/10 17:01:43 maya Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"ALL-$Revision: 1.90 $"
+#ident		"ALL-$Revision: 1.91 $"
 
 maxusers	64		# estimated number of users
 
@@ -511,7 +511,6 @@ wcfb*	at pci? dev ? function ?
 #sisdrm* 	at drm?		# SiS DRM driver
 #tdfxdrm*	at drm?		# 3dfx (voodoo) DRM driver
 #vboxdrm*	at drm?		# VirtualBox DRM driver
-#viadrm* 	at drm?		# VIA UniChrome DRM driver
 
 # DRMKMS drivers
 i915drmkms*	at pci? dev ? function ?

Index: src/sys/arch/amd64/conf/GENERIC
diff -u src/sys/arch/amd64/conf/GENERIC:1.493 src/sys/arch/amd64/conf/GENERIC:1.494
--- src/sys/arch/amd64/conf/GENERIC:1.493	Thu Jun  7 13:36:28 2018
+++ sr

CVS commit: src/share/mk

2018-07-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jul 10 16:53:16 UTC 2018

Modified Files:
src/share/mk: sys.mk

Log Message:
Build seed fixes:
- use MKREPRO_TIMESTAMP as the seed if available.
- skip relative paths that cannot be normalized if it is not
XXX: pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.134 -r1.135 src/share/mk/sys.mk

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

Modified files:

Index: src/share/mk/sys.mk
diff -u src/share/mk/sys.mk:1.134 src/share/mk/sys.mk:1.135
--- src/share/mk/sys.mk:1.134	Mon Jul  9 05:22:55 2018
+++ src/share/mk/sys.mk	Tue Jul 10 12:53:16 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: sys.mk,v 1.134 2018/07/09 09:22:55 martin Exp $
+#	$NetBSD: sys.mk,v 1.135 2018/07/10 16:53:16 christos Exp $
 #	@(#)sys.mk	8.2 (Berkeley) 3/21/94
 #
 # This file contains the basic rules for make(1) and is read first
@@ -54,11 +54,20 @@ CXX?=		c++
 # Remove -Wsystem-headers because C++ headers aren't clean of warnings
 CXXFLAGS?=	${CFLAGS:N-Wno-traditional:N-Wstrict-prototypes:N-Wmissing-prototypes:N-Wno-pointer-sign:N-ffreestanding:N-std=gnu[0-9][0-9]:N-Wold-style-definition:N-Wno-format-zero-length:N-Wsystem-headers}
 
+.if defined(MKREPRO_TIMESTAMP) && !empty(MKREPRO_TIMESTAMP)
+# Use the timestamp as a seed
+__INITSEED=${MKREPRO_TIMESTAMP}
+.else
+# Use the sources, as the seed... Normalize all paths...
 __ALLSRC1=	${empty(DESTDIR):?${.ALLSRC}:${.ALLSRC:S|^${DESTDIR}|^destdir|}}
 __ALLSRC2=	${empty(MAKEOBJDIR):?${__ALLSRC1}:${__ALLSRC1:S|^${MAKEOBJDIR}|^obj|}}
 __ALLSRC3=	${empty(NETBSDSRCDIR):?${__ALLSRC2}:${__ALLSRC2:S|^${NETBSDSRCDIR}|^src|}}
 __ALLSRC4=	${empty(X11SRCDIR):?${__ALLSRC3}:${__ALLSRC3:S|^${X11SRCDIR}|^xsrc|}}
-__BUILDSEED=	${BUILDSEED}/${__ALLSRC4:O}/${.TARGET}
+# Skip paths that contain relative components and can't be normalized, sort..
+__INITSEED=	${__ALLSRC4:N*/../*:O}
+.endif
+
+__BUILDSEED=	${BUILDSEED}/${__INITSEED}/${.TARGET}
 _CXXSEED?=	${BUILDSEED:D-frandom-seed=${__BUILDSEED:hash}}
 
 COMPILE.cc?=	echo "random-seed is ${__BUILDSEED}"; ${CXX} ${_CXXSEED} ${CXXFLAGS} ${DTRACE_OPTS} ${CPPFLAGS} -c



CVS commit: src/sys/net/npf

2018-07-10 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Jul 10 16:49:09 UTC 2018

Modified Files:
src/sys/net/npf: npf_handler.c

Log Message:
Modify the logic in npf_reassembly. Don't call nbuf_reset, we don't need
it since we don't read the IPv4 header anymore.

If ip{6}_reass_packet fails, always free 'm', and always clear the nbuf.

We want to avoid the case where

'm' was reallocated
the nbuf pointer was not updated accordingly
the caller tried to use the nbuf pointer

This case doesn't happen right now, but the code is fragile, so strengthen
it.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/net/npf/npf_handler.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_handler.c
diff -u src/sys/net/npf/npf_handler.c:1.43 src/sys/net/npf/npf_handler.c:1.44
--- src/sys/net/npf/npf_handler.c:1.43	Tue Jul 10 15:46:58 2018
+++ src/sys/net/npf/npf_handler.c	Tue Jul 10 16:49:09 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_handler.c,v 1.43 2018/07/10 15:46:58 maxv Exp $	*/
+/*	$NetBSD: npf_handler.c,v 1.44 2018/07/10 16:49:09 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2009-2013 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 #ifdef _KERNEL
 #include 
-__KERNEL_RCSID(0, "$NetBSD: npf_handler.c,v 1.43 2018/07/10 15:46:58 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_handler.c,v 1.44 2018/07/10 16:49:09 maxv Exp $");
 
 #include 
 #include 
@@ -79,20 +79,17 @@ npf_reassembly(npf_t *npf, npf_cache_t *
 	*mff = false;
 	m = nbuf_head_mbuf(nbuf);
 
-	/* Reset the mbuf as it may have changed. */
-	nbuf_reset(nbuf);
-
 	if (npf_iscached(npc, NPC_IP4)) {
 		error = ip_reass_packet();
-		KASSERT(!error || (m != NULL));
 	} else if (npf_iscached(npc, NPC_IP6)) {
 		error = ip6_reass_packet(, npc->npc_hlen);
-		if (error && m == NULL) {
-			memset(nbuf, 0, sizeof(nbuf_t));
-		}
 	}
+
 	if (error) {
+		/* Reass failed. Free the mbuf, clear the nbuf. */
 		npf_stats_inc(npf, NPF_STAT_REASSFAIL);
+		m_freem(m);
+		memset(nbuf, 0, sizeof(nbuf_t));
 		return error;
 	}
 	if (m == NULL) {



CVS commit: src/sys

2018-07-10 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Jul 10 15:46:58 UTC 2018

Modified Files:
src/sys/net/npf: npf_handler.c
src/sys/netinet: ip_input.c ip_reass.c ip_var.h

Log Message:
Remove the second argument from ip_reass_packet(). We want the IP header
on the mbuf, not elsewhere. Simplifies the NPF reassembly code a little.
No real functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/net/npf/npf_handler.c
cvs rdiff -u -r1.384 -r1.385 src/sys/netinet/ip_input.c
cvs rdiff -u -r1.17 -r1.18 src/sys/netinet/ip_reass.c
cvs rdiff -u -r1.125 -r1.126 src/sys/netinet/ip_var.h

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

Modified files:

Index: src/sys/net/npf/npf_handler.c
diff -u src/sys/net/npf/npf_handler.c:1.42 src/sys/net/npf/npf_handler.c:1.43
--- src/sys/net/npf/npf_handler.c:1.42	Tue Jul 10 15:25:01 2018
+++ src/sys/net/npf/npf_handler.c	Tue Jul 10 15:46:58 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_handler.c,v 1.42 2018/07/10 15:25:01 maxv Exp $	*/
+/*	$NetBSD: npf_handler.c,v 1.43 2018/07/10 15:46:58 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2009-2013 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 #ifdef _KERNEL
 #include 
-__KERNEL_RCSID(0, "$NetBSD: npf_handler.c,v 1.42 2018/07/10 15:25:01 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_handler.c,v 1.43 2018/07/10 15:46:58 maxv Exp $");
 
 #include 
 #include 
@@ -83,8 +83,7 @@ npf_reassembly(npf_t *npf, npf_cache_t *
 	nbuf_reset(nbuf);
 
 	if (npf_iscached(npc, NPC_IP4)) {
-		struct ip *ip = nbuf_dataptr(nbuf);
-		error = ip_reass_packet(, ip);
+		error = ip_reass_packet();
 		KASSERT(!error || (m != NULL));
 	} else if (npf_iscached(npc, NPC_IP6)) {
 		error = ip6_reass_packet(, npc->npc_hlen);

Index: src/sys/netinet/ip_input.c
diff -u src/sys/netinet/ip_input.c:1.384 src/sys/netinet/ip_input.c:1.385
--- src/sys/netinet/ip_input.c:1.384	Thu May 17 11:59:36 2018
+++ src/sys/netinet/ip_input.c	Tue Jul 10 15:46:58 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_input.c,v 1.384 2018/05/17 11:59:36 maxv Exp $	*/
+/*	$NetBSD: ip_input.c,v 1.385 2018/07/10 15:46:58 maxv Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.384 2018/05/17 11:59:36 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.385 2018/07/10 15:46:58 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -752,7 +752,7 @@ ours:
 		/*
 		 * Pass to IP reassembly mechanism.
 		 */
-		if (ip_reass_packet(, ip) != 0) {
+		if (ip_reass_packet() != 0) {
 			/* Failed; invalid fragment(s) or packet. */
 			goto out;
 		}

Index: src/sys/netinet/ip_reass.c
diff -u src/sys/netinet/ip_reass.c:1.17 src/sys/netinet/ip_reass.c:1.18
--- src/sys/netinet/ip_reass.c:1.17	Tue May 15 19:16:38 2018
+++ src/sys/netinet/ip_reass.c	Tue Jul 10 15:46:58 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_reass.c,v 1.17 2018/05/15 19:16:38 maxv Exp $	*/
+/*	$NetBSD: ip_reass.c,v 1.18 2018/07/10 15:46:58 maxv Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1988, 1993
@@ -46,7 +46,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_reass.c,v 1.17 2018/05/15 19:16:38 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_reass.c,v 1.18 2018/07/10 15:46:58 maxv Exp $");
 
 #include 
 #include 
@@ -612,11 +612,12 @@ ip_reass_slowtimo(void)
  * => On complete, m0 represents a constructed final packet.
  */
 int
-ip_reass_packet(struct mbuf **m0, struct ip *ip)
+ip_reass_packet(struct mbuf **m0)
 {
+	struct mbuf *m = *m0;
+	struct ip *ip = mtod(m, struct ip *);
 	const int hlen = ip->ip_hl << 2;
 	const int len = ntohs(ip->ip_len);
-	struct mbuf *m = *m0;
 	int ipsecflags = m->m_flags & (M_DECRYPTED|M_AUTHIPHDR);
 	ipfr_queue_t *fp;
 	ipfr_qent_t *ipqe;

Index: src/sys/netinet/ip_var.h
diff -u src/sys/netinet/ip_var.h:1.125 src/sys/netinet/ip_var.h:1.126
--- src/sys/netinet/ip_var.h:1.125	Sun Apr  8 12:18:06 2018
+++ src/sys/netinet/ip_var.h	Tue Jul 10 15:46:58 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_var.h,v 1.125 2018/04/08 12:18:06 maxv Exp $	*/
+/*	$NetBSD: ip_var.h,v 1.126 2018/07/10 15:46:58 maxv Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -209,7 +209,7 @@ int	 ip_output(struct mbuf *, struct mbu
 int	 ip_fragment(struct mbuf *, struct ifnet *, u_long);
 
 void	 ip_reass_init(void);
-int	 ip_reass_packet(struct mbuf **, struct ip *);
+int	 ip_reass_packet(struct mbuf **);
 void	 ip_reass_slowtimo(void);
 void	 ip_reass_drain(void);
 



CVS commit: [netbsd-8] src/doc

2018-07-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jul 10 15:37:42 UTC 2018

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

Log Message:
Note ticket #910


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

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

Modified files:

Index: src/doc/CHANGES-8.0
diff -u src/doc/CHANGES-8.0:1.1.2.222 src/doc/CHANGES-8.0:1.1.2.223
--- src/doc/CHANGES-8.0:1.1.2.222	Tue Jul 10 15:32:28 2018
+++ src/doc/CHANGES-8.0	Tue Jul 10 15:37:42 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.222 2018/07/10 15:32:28 martin Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.223 2018/07/10 15:37:42 martin Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -14137,3 +14137,12 @@ sys/net/npf/npf_handler.c			1.41
 	NPF: fix use-after-free.
 	[maxv, ticket #919]
 
+sys/arch/amd64/amd64/locore.S   		1.167 (patch)
+sys/arch/i386/i386/locore.S 		1.158 (patch)
+sys/arch/x86/x86/fpu.c  		1.44 (patch)
+
+	Don't switch the FPU when leaving a softint. This fixes
+	several problems when EagerFPU is enabled.
+	[maxv, ticket #910]
+
+



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

2018-07-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jul 10 15:35:26 UTC 2018

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-8]: locore.S
src/sys/arch/i386/i386 [netbsd-8]: locore.S
src/sys/arch/x86/x86 [netbsd-8]: fpu.c

Log Message:
Pull up the following, requested by maxv in ticket #910:

sys/arch/amd64/amd64/locore.S   r1.167 (patch)
sys/arch/i386/i386/locore.S r1.158 (patch)
sys/arch/x86/x86/fpu.c  r1.44 (patch)

Don't switch the FPU when leaving a softint. This fixes
several problems when EagerFPU is enabled.


To generate a diff of this commit:
cvs rdiff -u -r1.123.6.7 -r1.123.6.8 src/sys/arch/amd64/amd64/locore.S
cvs rdiff -u -r1.145.6.4 -r1.145.6.5 src/sys/arch/i386/i386/locore.S
cvs rdiff -u -r1.12.8.2 -r1.12.8.3 src/sys/arch/x86/x86/fpu.c

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

Modified files:

Index: src/sys/arch/amd64/amd64/locore.S
diff -u src/sys/arch/amd64/amd64/locore.S:1.123.6.7 src/sys/arch/amd64/amd64/locore.S:1.123.6.8
--- src/sys/arch/amd64/amd64/locore.S:1.123.6.7	Sat Jun 23 11:39:01 2018
+++ src/sys/arch/amd64/amd64/locore.S	Tue Jul 10 15:35:26 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.123.6.7 2018/06/23 11:39:01 martin Exp $	*/
+/*	$NetBSD: locore.S,v 1.123.6.8 2018/07/10 15:35:26 martin Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -1094,20 +1094,6 @@ skip_save:
 	popq	%rdx
 #endif
 
-#ifndef XEN
-	/* RDI/RSI got clobbered. */
-	movq	%r13,%rdi
-	movq	%r12,%rsi
-
-	pushq	%rdx
-	movb	_C_LABEL(x86_fpu_eager),%dl
-	testb	%dl,%dl
-	jz	.Lno_eagerfpu
-	callq	_C_LABEL(fpu_eagerswitch)
-.Lno_eagerfpu:
-	popq	%rdx
-#endif
-
 	/* Switch to newlwp's stack. */
 	movq	L_PCB(%r12),%r14
 	movq	PCB_RSP(%r14),%rsp
@@ -1148,6 +1134,18 @@ skip_save:
 #endif
 .Lring0_switched:
 
+#ifndef XEN
+	pushq	%rdx
+	movb	_C_LABEL(x86_fpu_eager),%dl
+	testb	%dl,%dl
+	jz	.Lno_eagerfpu
+	movq	%r13,%rdi
+	movq	%r12,%rsi
+	callq	_C_LABEL(fpu_eagerswitch)
+.Lno_eagerfpu:
+	popq	%rdx
+#endif
+
 	/* Don't bother with the rest if switching to a system process. */
 	testl	$LW_SYSTEM,L_FLAG(%r12)
 	jnz	switch_return

Index: src/sys/arch/i386/i386/locore.S
diff -u src/sys/arch/i386/i386/locore.S:1.145.6.4 src/sys/arch/i386/i386/locore.S:1.145.6.5
--- src/sys/arch/i386/i386/locore.S:1.145.6.4	Sat Jun 23 11:39:02 2018
+++ src/sys/arch/i386/i386/locore.S	Tue Jul 10 15:35:26 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.145.6.4 2018/06/23 11:39:02 martin Exp $	*/
+/*	$NetBSD: locore.S,v 1.145.6.5 2018/07/10 15:35:26 martin Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -128,7 +128,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.145.6.4 2018/06/23 11:39:02 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.145.6.5 2018/07/10 15:35:26 martin Exp $");
 
 #include "opt_compat_oldboot.h"
 #include "opt_copy_symtab.h"
@@ -1089,19 +1089,6 @@ ENTRY(cpu_switchto)
 	movl	%ebp,PCB_EBP(%eax)
 skip_save:
 
-#ifndef XEN
-	pushl	%edx
-	movb	_C_LABEL(x86_fpu_eager),%dl
-	testb	%dl,%dl
-	jz	.Lno_eagerfpu
-	pushl	%edi
-	pushl	%esi
-	call	_C_LABEL(fpu_eagerswitch)
-	addl	$8,%esp
-.Lno_eagerfpu:
-	popl	%edx
-#endif
-
 	/* Switch to newlwp's stack. */
 	movl	L_PCB(%edi),%ebx
 	movl	PCB_EBP(%ebx),%ebp
@@ -1129,6 +1116,19 @@ skip_save:
 	movl	%eax,TSS_ESP0(%ecx)
 #endif
 
+#ifndef XEN
+	pushl	%edx
+	movb	_C_LABEL(x86_fpu_eager),%dl
+	testb	%dl,%dl
+	jz	.Lno_eagerfpu
+	pushl	%edi
+	pushl	%esi
+	call	_C_LABEL(fpu_eagerswitch)
+	addl	$8,%esp
+.Lno_eagerfpu:
+	popl	%edx
+#endif
+
 	/* Don't bother with the rest if switching to a system process. */
 	testl	$LW_SYSTEM,L_FLAG(%edi)
 	jnz	switch_return

Index: src/sys/arch/x86/x86/fpu.c
diff -u src/sys/arch/x86/x86/fpu.c:1.12.8.2 src/sys/arch/x86/x86/fpu.c:1.12.8.3
--- src/sys/arch/x86/x86/fpu.c:1.12.8.2	Sat Jun 23 11:39:02 2018
+++ src/sys/arch/x86/x86/fpu.c	Tue Jul 10 15:35:26 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu.c,v 1.12.8.2 2018/06/23 11:39:02 martin Exp $	*/
+/*	$NetBSD: fpu.c,v 1.12.8.3 2018/07/10 15:35:26 martin Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.  All
@@ -96,7 +96,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.12.8.2 2018/06/23 11:39:02 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.12.8.3 2018/07/10 15:35:26 martin Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -306,6 +306,20 @@ fpu_eagerswitch(struct lwp *oldlwp, stru
 	int s;
 
 	s = splhigh();
+#ifdef DIAGNOSTIC
+	if (oldlwp != NULL) {
+		struct pcb *pcb = lwp_getpcb(oldlwp);
+		struct cpu_info *ci = curcpu();
+		if (pcb->pcb_fpcpu == NULL) {
+			KASSERT(ci->ci_fpcurlwp != oldlwp);
+		} else if (pcb->pcb_fpcpu == ci) {
+			KASSERT(ci->ci_fpcurlwp == oldlwp);
+		} else {
+			panic("%s: oldlwp's state installed elsewhere",
+			__func__);
+		}
+	}
+#endif
 	fpusave_cpu(true);
 	if (!(newlwp->l_flag & LW_SYSTEM))
 		fpu_eagerrestore(newlwp);



CVS commit: [netbsd-8] src/doc

2018-07-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jul 10 15:32:28 UTC 2018

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

Log Message:
Ammend ticket #918 with additional pullups


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

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

Modified files:

Index: src/doc/CHANGES-8.0
diff -u src/doc/CHANGES-8.0:1.1.2.221 src/doc/CHANGES-8.0:1.1.2.222
--- src/doc/CHANGES-8.0:1.1.2.221	Tue Jul 10 15:08:33 2018
+++ src/doc/CHANGES-8.0	Tue Jul 10 15:32:28 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.221 2018/07/10 15:08:33 martin Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.222 2018/07/10 15:32:28 martin Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -14126,7 +14126,7 @@ distrib/notes/i386/prep(manually edi
 
 	Fix NetBSD.org capitalization in some URLs.
 
-sys/net/if_llatbl.c1.28
+sys/net/if_llatbl.c1.28,1.29
 
 	Don't overwrite an existing llentry on RTM_ADD to avoid race
 	conditions.



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

2018-07-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jul 10 15:31:33 UTC 2018

Modified Files:
src/sys/net [netbsd-8]: if_llatbl.c

Log Message:
Additionally pull up the following, requested by ozaki-r in ticket #918:

src/sys/net/if_llatbl.c 1.29

Avoid attempting to call arp related functions if there is no
arp in the kernel.


To generate a diff of this commit:
cvs rdiff -u -r1.18.6.5 -r1.18.6.6 src/sys/net/if_llatbl.c

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

Modified files:

Index: src/sys/net/if_llatbl.c
diff -u src/sys/net/if_llatbl.c:1.18.6.5 src/sys/net/if_llatbl.c:1.18.6.6
--- src/sys/net/if_llatbl.c:1.18.6.5	Tue Jul 10 14:41:31 2018
+++ src/sys/net/if_llatbl.c	Tue Jul 10 15:31:33 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_llatbl.c,v 1.18.6.5 2018/07/10 14:41:31 martin Exp $	*/
+/*	$NetBSD: if_llatbl.c,v 1.18.6.6 2018/07/10 15:31:33 martin Exp $	*/
 /*
  * Copyright (c) 2004 Luigi Rizzo, Alessandro Cerri. All rights reserved.
  * Copyright (c) 2004-2008 Qing Li. All rights reserved.
@@ -696,10 +696,12 @@ lla_rt_output(const u_char rtm_type, con
 		 */
 		if (lle != NULL) {
 			size_t pkts_dropped = llentry_free(lle);
+#if defined(INET) && NARP > 0
 			if (dst->sa_family == AF_INET) {
 arp_stat_add(ARP_STAT_DFRDROPPED,
 (uint64_t)pkts_dropped);
 			}
+#endif
 		}
 
 		lle = lla_create(llt, 0, dst, rt);



CVS commit: src/sys/net/npf

2018-07-10 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Jul 10 15:25:01 UTC 2018

Modified Files:
src/sys/net/npf: npf_handler.c

Log Message:
Simplify the pointer handling. Set *mp = NULL at the beginning of the
function. In npf_reassembly, pass a simple boolean instead of a ** mbuf
pointer. Add a KASSERT for IPv4, we don't want (error && !m). Remove
the 'fastout' label, use 'out'.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/net/npf/npf_handler.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_handler.c
diff -u src/sys/net/npf/npf_handler.c:1.41 src/sys/net/npf/npf_handler.c:1.42
--- src/sys/net/npf/npf_handler.c:1.41	Tue Jul 10 14:04:07 2018
+++ src/sys/net/npf/npf_handler.c	Tue Jul 10 15:25:01 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_handler.c,v 1.41 2018/07/10 14:04:07 maxv Exp $	*/
+/*	$NetBSD: npf_handler.c,v 1.42 2018/07/10 15:25:01 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2009-2013 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 #ifdef _KERNEL
 #include 
-__KERNEL_RCSID(0, "$NetBSD: npf_handler.c,v 1.41 2018/07/10 14:04:07 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_handler.c,v 1.42 2018/07/10 15:25:01 maxv Exp $");
 
 #include 
 #include 
@@ -70,25 +70,25 @@ __KERNEL_RCSID(0, "$NetBSD: npf_handler.
 #endif
 
 static int
-npf_reassembly(npf_t *npf, npf_cache_t *npc, struct mbuf **mp)
+npf_reassembly(npf_t *npf, npf_cache_t *npc, bool *mff)
 {
 	nbuf_t *nbuf = npc->npc_nbuf;
 	int error = EINVAL;
+	struct mbuf *m;
+
+	*mff = false;
+	m = nbuf_head_mbuf(nbuf);
 
 	/* Reset the mbuf as it may have changed. */
-	*mp = nbuf_head_mbuf(nbuf);
 	nbuf_reset(nbuf);
 
 	if (npf_iscached(npc, NPC_IP4)) {
 		struct ip *ip = nbuf_dataptr(nbuf);
-		error = ip_reass_packet(mp, ip);
+		error = ip_reass_packet(, ip);
+		KASSERT(!error || (m != NULL));
 	} else if (npf_iscached(npc, NPC_IP6)) {
-		/*
-		 * Note: ip6_reass_packet() offset is the start of
-		 * the fragment header.
-		 */
-		error = ip6_reass_packet(mp, npc->npc_hlen);
-		if (error && *mp == NULL) {
+		error = ip6_reass_packet(, npc->npc_hlen);
+		if (error && m == NULL) {
 			memset(nbuf, 0, sizeof(nbuf_t));
 		}
 	}
@@ -96,9 +96,10 @@ npf_reassembly(npf_t *npf, npf_cache_t *
 		npf_stats_inc(npf, NPF_STAT_REASSFAIL);
 		return error;
 	}
-	if (*mp == NULL) {
+	if (m == NULL) {
 		/* More fragments should come. */
 		npf_stats_inc(npf, NPF_STAT_FRAGMENTS);
+		*mff = true;
 		return 0;
 	}
 
@@ -106,7 +107,7 @@ npf_reassembly(npf_t *npf, npf_cache_t *
 	 * Reassembly is complete, we have the final packet.
 	 * Cache again, since layer 4 data is accessible now.
 	 */
-	nbuf_init(npf, nbuf, *mp, nbuf->nb_ifp);
+	nbuf_init(npf, nbuf, m, nbuf->nb_ifp);
 	npc->npc_info = 0;
 
 	if (npf_cache_all(npc) & (NPC_IPFRAG|NPC_FMTERR)) {
@@ -132,6 +133,7 @@ npf_packet_handler(npf_t *npf, struct mb
 	int error, decision, flags;
 	uint32_t ntag;
 	npf_match_info_t mi;
+	bool mff;
 
 	/* QSBR checkpoint. */
 	pserialize_checkpoint(npf->qsbr);
@@ -150,6 +152,7 @@ npf_packet_handler(npf_t *npf, struct mb
 	mi.mi_rid = 0;
 	mi.mi_retfl = 0;
 
+	*mp = NULL;
 	decision = NPF_DECISION_BLOCK;
 	error = 0;
 	rp = NULL;
@@ -160,22 +163,19 @@ npf_packet_handler(npf_t *npf, struct mb
 
 	/* If error on the format, leave quickly. */
 	if (flags & NPC_FMTERR) {
-		*mp = nbuf_head_mbuf();
 		error = EINVAL;
-		goto fastout;
+		goto out;
 	}
 
 	/* Determine whether it is an IP fragment. */
 	if (__predict_false(flags & NPC_IPFRAG)) {
-		/*
-		 * Pass to IPv4/IPv6 reassembly mechanism.
-		 */
-		error = npf_reassembly(npf, , mp);
+		/* Pass to IPv4/IPv6 reassembly mechanism. */
+		error = npf_reassembly(npf, , );
 		if (error) {
 			goto out;
 		}
-		if (*mp == NULL) {
-			/* More fragments should come; return. */
+		if (mff) {
+			/* More fragments should come. */
 			return 0;
 		}
 	}
@@ -250,6 +250,7 @@ npf_packet_handler(npf_t *npf, struct mb
 			npf_conn_setpass(con, , rp);
 		}
 	}
+
 pass:
 	decision = NPF_DECISION_PASS;
 	KASSERT(error == 0);
@@ -257,6 +258,7 @@ pass:
 	 * Perform NAT.
 	 */
 	error = npf_do_nat(, con, di);
+
 block:
 	/*
 	 * Execute the rule procedure, if any is associated.
@@ -267,9 +269,10 @@ block:
 			npf_conn_release(con);
 		}
 		npf_rproc_release(rp);
-		*mp = NULL;
+		/* mbuf already freed */
 		return 0;
 	}
+
 out:
 	/*
 	 * Release the reference on a connection.  Release the reference
@@ -281,7 +284,7 @@ out:
 		npf_rproc_release(rp);
 	}
 
-	/* Reset mbuf pointer before returning to the caller. */
+	/* Get the new mbuf pointer. */
 	if ((*mp = nbuf_head_mbuf()) == NULL) {
 		return error ? error : ENOMEM;
 	}
@@ -309,7 +312,6 @@ out:
 		error = ENETUNREACH;
 	}
 
-fastout:
 	if (*mp) {
 		/* Free the mbuf chain. */
 		m_freem(*mp);



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

2018-07-10 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Tue Jul 10 15:12:29 UTC 2018

Modified Files:
src/share/man/man4/man4.i386: apm.4

Log Message:
Don't mention options that don't appear in kernel code.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/share/man/man4/man4.i386/apm.4

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

Modified files:

Index: src/share/man/man4/man4.i386/apm.4
diff -u src/share/man/man4/man4.i386/apm.4:1.18 src/share/man/man4/man4.i386/apm.4:1.19
--- src/share/man/man4/man4.i386/apm.4:1.18	Tue Apr  5 08:24:43 2011
+++ src/share/man/man4/man4.i386/apm.4	Tue Jul 10 15:12:29 2018
@@ -24,9 +24,9 @@
 .\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\"   $NetBSD: apm.4,v 1.18 2011/04/05 08:24:43 wiz Exp $
+.\"   $NetBSD: apm.4,v 1.19 2018/07/10 15:12:29 maya Exp $
 .\"
-.Dd May 18, 1996
+.Dd July 10, 2018
 .Dt APM 4 i386
 .Os
 .Sh NAME
@@ -49,10 +49,6 @@ jointly by the Intel Corporation and the
 The APM driver's behavior may be adjusted by specifying any of the
 following kernel configuration options:
 .Bl -tag -width indent -compact
-.It Dv APM_NO_IDLE
-Do not call the BIOS CPU idle function from the system idle loop.
-(Some systems will hang on certain device accesses, such as sound
-cards or floppy diskette drives, without this option)
 .It Dv APM_V10_ONLY
 Use only the APM revision 1.0 specification calls.
 (Some systems do not implement APM v1.1 very well, and generate
@@ -65,10 +61,6 @@ Don't attach to the BIOS as APM v1.2 com
 Do not attempt to put the system into standby mode.
 .It Dv APM_NO_POWEROFF
 Do not attempt to turn off power when halting the system.
-.It Dv APM_FORCE_64K_SEGMENTS
-Force the length of the APM BIOS code and data segments to 64KB.
-.It Dv APM_ALLOW_BOGUS_SEGMENTS
-Allow the use of data segments which are in unexpected locations.
 .It Dv APMDEBUG
 Enable kernel printout of events received from the APM BIOS.
 .It Dv APMCALLDEBUG
@@ -82,14 +74,6 @@ events.
 activity, it may consume increased battery power.
 Some systems generate the events too frequently,
 and printing the status may disturb single-user operations.)
-.It Dv APM_DISABLE_INTERRUPTS
-Set this to zero if you don't want the kernel to disable interrupts
-before calling the BIOS.
-This is required for most IBM ThinkPads, and some other newer laptops.
-A good indication that you need this is that
-the machine hangs just after resuming from suspended state.
-It's unclear if doing this has negative effects on older BIOS, therefore it
-defaults to one (i.e interrupts are disabled).
 .El
 .Pp
 If no processes are holding open file descriptors to the APM device, the



CVS commit: [netbsd-8] src/doc

2018-07-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jul 10 15:08:34 UTC 2018

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

Log Message:
Ammend entry for ticket #892, note tickets #918 and #919


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

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

Modified files:

Index: src/doc/CHANGES-8.0
diff -u src/doc/CHANGES-8.0:1.1.2.220 src/doc/CHANGES-8.0:1.1.2.221
--- src/doc/CHANGES-8.0:1.1.2.220	Tue Jul  3 07:13:41 2018
+++ src/doc/CHANGES-8.0	Tue Jul 10 15:08:33 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.220 2018/07/03 07:13:41 martin Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.221 2018/07/10 15:08:33 martin Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -13995,9 +13995,10 @@ crypto/external/bsd/openssl/dist/crypto/
 
 lib/libc/sys/sched.c1.5
 tests/lib/libc/gen/posix_spawn/t_spawnattr.c	1.2,1.3
+tests/lib/librt/t_sched.c			1.6
 
 	Return PRI_NONE for sched_get_priority_m{in,ax} and SCHED_OTHER.
-	Fix broken test, don't use SCHED_OTHER.
+	Fix broken tests.
 	[maya, ticket #892]
 
 sys/netinet6/icmp6.c1.228,1.230
@@ -14124,3 +14125,15 @@ distrib/notes/evbarm/install			(manually
 distrib/notes/i386/prep(manually edited)
 
 	Fix NetBSD.org capitalization in some URLs.
+
+sys/net/if_llatbl.c1.28
+
+	Don't overwrite an existing llentry on RTM_ADD to avoid race
+	conditions.
+	[ozaki-r, ticket #918]
+
+sys/net/npf/npf_handler.c			1.41
+
+	NPF: fix use-after-free.
+	[maxv, ticket #919]
+



CVS commit: [netbsd-8] src/tests/lib/librt

2018-07-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jul 10 15:06:25 UTC 2018

Modified Files:
src/tests/lib/librt [netbsd-8]: t_sched.c

Log Message:
Additionally pull up the following, requested by maya in ticket #892:

src/tests/lib/librt/t_sched.c   1.6

fix priority tests for SCHED_OTHER


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.5.24.1 src/tests/lib/librt/t_sched.c

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

Modified files:

Index: src/tests/lib/librt/t_sched.c
diff -u src/tests/lib/librt/t_sched.c:1.5 src/tests/lib/librt/t_sched.c:1.5.24.1
--- src/tests/lib/librt/t_sched.c:1.5	Sun Mar 25 04:11:42 2012
+++ src/tests/lib/librt/t_sched.c	Tue Jul 10 15:06:25 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: t_sched.c,v 1.5 2012/03/25 04:11:42 christos Exp $ */
+/* $NetBSD: t_sched.c,v 1.5.24.1 2018/07/10 15:06:25 martin Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,8 +29,9 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: t_sched.c,v 1.5 2012/03/25 04:11:42 christos Exp $");
+__RCSID("$NetBSD: t_sched.c,v 1.5.24.1 2018/07/10 15:06:25 martin Exp $");
 
+#include 	/* PRI_NONE */
 #include 
 #include 
 #include 
@@ -94,10 +95,14 @@ ATF_TC_BODY(sched_priority, tc)
 
 		pmax = sched_get_priority_max(pol[i]);
 		pmin = sched_get_priority_min(pol[i]);
-
-		ATF_REQUIRE(pmax != -1);
-		ATF_REQUIRE(pmin != -1);
-		ATF_REQUIRE(pmax > pmin);
+		if (pol[i] == SCHED_OTHER) {
+			ATF_REQUIRE(pmax == PRI_NONE);
+			ATF_REQUIRE(pmin == PRI_NONE);
+		} else {
+			ATF_REQUIRE(pmax != -1);
+			ATF_REQUIRE(pmin != -1);
+			ATF_REQUIRE(pmax > pmin);
+		}
 	}
 }
 



CVS commit: [netbsd-8] src/sys/net/npf

2018-07-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jul 10 14:44:05 UTC 2018

Modified Files:
src/sys/net/npf [netbsd-8]: npf_handler.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #919):

sys/net/npf/npf_handler.c: revision 1.41

Update the pointer when fast-kicking, because it may have been freed.

Before my changes the nonsensical pointer ininitialization held, but
when I started introducing sanity checks the whole thing collapsed.

Need pullup-8.


To generate a diff of this commit:
cvs rdiff -u -r1.37.6.1 -r1.37.6.2 src/sys/net/npf/npf_handler.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_handler.c
diff -u src/sys/net/npf/npf_handler.c:1.37.6.1 src/sys/net/npf/npf_handler.c:1.37.6.2
--- src/sys/net/npf/npf_handler.c:1.37.6.1	Wed May  9 15:35:37 2018
+++ src/sys/net/npf/npf_handler.c	Tue Jul 10 14:44:05 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_handler.c,v 1.37.6.1 2018/05/09 15:35:37 martin Exp $	*/
+/*	$NetBSD: npf_handler.c,v 1.37.6.2 2018/07/10 14:44:05 martin Exp $	*/
 
 /*-
  * Copyright (c) 2009-2013 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 #ifdef _KERNEL
 #include 
-__KERNEL_RCSID(0, "$NetBSD: npf_handler.c,v 1.37.6.1 2018/05/09 15:35:37 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_handler.c,v 1.37.6.2 2018/07/10 14:44:05 martin Exp $");
 
 #include 
 #include 
@@ -159,6 +159,7 @@ npf_packet_handler(npf_t *npf, struct mb
 
 	/* If error on the format, leave quickly. */
 	if (flags & NPC_FMTERR) {
+		*mp = nbuf_head_mbuf();
 		error = EINVAL;
 		goto fastout;
 	}



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

2018-07-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jul 10 14:41:31 UTC 2018

Modified Files:
src/sys/net [netbsd-8]: if_llatbl.c

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #918):

sys/net/if_llatbl.c: revision 1.28

Don't overwrite an existing llentry on RTM_ADD to avoid race conditions
Reported and tested by christos@


To generate a diff of this commit:
cvs rdiff -u -r1.18.6.4 -r1.18.6.5 src/sys/net/if_llatbl.c

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

Modified files:

Index: src/sys/net/if_llatbl.c
diff -u src/sys/net/if_llatbl.c:1.18.6.4 src/sys/net/if_llatbl.c:1.18.6.5
--- src/sys/net/if_llatbl.c:1.18.6.4	Sat Jun  9 14:44:33 2018
+++ src/sys/net/if_llatbl.c	Tue Jul 10 14:41:31 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_llatbl.c,v 1.18.6.4 2018/06/09 14:44:33 martin Exp $	*/
+/*	$NetBSD: if_llatbl.c,v 1.18.6.5 2018/07/10 14:41:31 martin Exp $	*/
 /*
  * Copyright (c) 2004 Luigi Rizzo, Alessandro Cerri. All rights reserved.
  * Copyright (c) 2004-2008 Qing Li. All rights reserved.
@@ -677,7 +677,7 @@ lla_rt_output(const u_char rtm_type, con
 
 		/* Add static LLE */
 		IF_AFDATA_WLOCK(ifp);
-		lle = lla_lookup(llt, 0, dst);
+		lle = lla_lookup(llt, LLE_EXCLUSIVE, dst);
 
 		/* Cannot overwrite an existing static entry */
 		if (lle != NULL &&
@@ -689,8 +689,18 @@ lla_rt_output(const u_char rtm_type, con
 			error = EEXIST;
 			goto out;
 		}
-		if (lle != NULL)
-			LLE_RUNLOCK(lle);
+
+		/*
+		 * We can't overwrite an existing entry to avoid race
+		 * conditions so remove it first.
+		 */
+		if (lle != NULL) {
+			size_t pkts_dropped = llentry_free(lle);
+			if (dst->sa_family == AF_INET) {
+arp_stat_add(ARP_STAT_DFRDROPPED,
+(uint64_t)pkts_dropped);
+			}
+		}
 
 		lle = lla_create(llt, 0, dst, rt);
 		if (lle == NULL) {



CVS commit: src/sys/net/npf

2018-07-10 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Jul 10 14:04:07 UTC 2018

Modified Files:
src/sys/net/npf: npf_handler.c

Log Message:
Update the pointer when fast-kicking, because it may have been freed.
Before my changes the nonsensical pointer ininitialization held, but
when I started introducing sanity checks the whole thing collapsed.

Need pullup-8.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/net/npf/npf_handler.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_handler.c
diff -u src/sys/net/npf/npf_handler.c:1.40 src/sys/net/npf/npf_handler.c:1.41
--- src/sys/net/npf/npf_handler.c:1.40	Tue Jul 10 12:31:46 2018
+++ src/sys/net/npf/npf_handler.c	Tue Jul 10 14:04:07 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_handler.c,v 1.40 2018/07/10 12:31:46 maxv Exp $	*/
+/*	$NetBSD: npf_handler.c,v 1.41 2018/07/10 14:04:07 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2009-2013 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 #ifdef _KERNEL
 #include 
-__KERNEL_RCSID(0, "$NetBSD: npf_handler.c,v 1.40 2018/07/10 12:31:46 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_handler.c,v 1.41 2018/07/10 14:04:07 maxv Exp $");
 
 #include 
 #include 
@@ -160,6 +160,7 @@ npf_packet_handler(npf_t *npf, struct mb
 
 	/* If error on the format, leave quickly. */
 	if (flags & NPC_FMTERR) {
+		*mp = nbuf_head_mbuf();
 		error = EINVAL;
 		goto fastout;
 	}



CVS commit: src/sys/dev/usb

2018-07-10 Thread S.P.Zeidler
Module Name:src
Committed By:   spz
Date:   Tue Jul 10 13:36:51 UTC 2018

Modified Files:
src/sys/dev/usb: usbdevs.h usbdevs_data.h

Log Message:
regenerated (now with correct reference id)


To generate a diff of this commit:
cvs rdiff -u -r1.744 -r1.745 src/sys/dev/usb/usbdevs.h \
src/sys/dev/usb/usbdevs_data.h

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

Modified files:

Index: src/sys/dev/usb/usbdevs.h
diff -u src/sys/dev/usb/usbdevs.h:1.744 src/sys/dev/usb/usbdevs.h:1.745
--- src/sys/dev/usb/usbdevs.h:1.744	Tue Jul 10 11:21:34 2018
+++ src/sys/dev/usb/usbdevs.h	Tue Jul 10 13:36:51 2018
@@ -1,10 +1,10 @@
-/*	$NetBSD: usbdevs.h,v 1.744 2018/07/10 11:21:34 spz Exp $	*/
+/*	$NetBSD: usbdevs.h,v 1.745 2018/07/10 13:36:51 spz Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: usbdevs,v 1.750 2018/06/05 13:21:15 martin Exp
+ *	NetBSD: usbdevs,v 1.752 2018/07/10 13:32:38 spz Exp
  */
 
 /*-
@@ -38,7 +38,7 @@
  */
 
 /*
- * Use "make -f Makefile.usbdevs" to regenerate usbdevs.h and usbdevs_data.h
+ * Follow the handling instructions in Makefile.usbdevs
  */
 
 /*
Index: src/sys/dev/usb/usbdevs_data.h
diff -u src/sys/dev/usb/usbdevs_data.h:1.744 src/sys/dev/usb/usbdevs_data.h:1.745
--- src/sys/dev/usb/usbdevs_data.h:1.744	Tue Jul 10 11:21:34 2018
+++ src/sys/dev/usb/usbdevs_data.h	Tue Jul 10 13:36:51 2018
@@ -1,10 +1,10 @@
-/*	$NetBSD: usbdevs_data.h,v 1.744 2018/07/10 11:21:34 spz Exp $	*/
+/*	$NetBSD: usbdevs_data.h,v 1.745 2018/07/10 13:36:51 spz Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: usbdevs,v 1.750 2018/06/05 13:21:15 martin Exp
+ *	NetBSD: usbdevs,v 1.752 2018/07/10 13:32:38 spz Exp
  */
 
 /*-



CVS commit: src/sys/dev/usb

2018-07-10 Thread S.P.Zeidler
Module Name:src
Committed By:   spz
Date:   Tue Jul 10 13:32:38 UTC 2018

Modified Files:
src/sys/dev/usb: usbdevs

Log Message:
change handling hint to point to the full instructions
(comment change only)


To generate a diff of this commit:
cvs rdiff -u -r1.751 -r1.752 src/sys/dev/usb/usbdevs

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/usbdevs
diff -u src/sys/dev/usb/usbdevs:1.751 src/sys/dev/usb/usbdevs:1.752
--- src/sys/dev/usb/usbdevs:1.751	Tue Jul 10 11:21:34 2018
+++ src/sys/dev/usb/usbdevs	Tue Jul 10 13:32:38 2018
@@ -1,4 +1,4 @@
-$NetBSD: usbdevs,v 1.751 2018/07/10 11:21:34 spz Exp $
+$NetBSD: usbdevs,v 1.752 2018/07/10 13:32:38 spz Exp $
 
 /*-
  * Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@ $NetBSD: usbdevs,v 1.751 2018/07/10 11:2
  */
 
 /*
- * Use "make -f Makefile.usbdevs" to regenerate usbdevs.h and usbdevs_data.h
+ * Follow the handling instructions in Makefile.usbdevs
  */
 
 /*



CVS commit: src/etc

2018-07-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jul 10 13:22:22 UTC 2018

Modified Files:
src/etc: Makefile.params

Log Message:
Drop output for MAKECONF MAKEOBJDIR MAKEOBJDIRPREFIX MAKEVERBOSE
in MKREPRO=yes builds.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/etc/Makefile.params

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

Modified files:

Index: src/etc/Makefile.params
diff -u src/etc/Makefile.params:1.19 src/etc/Makefile.params:1.20
--- src/etc/Makefile.params:1.19	Mon Jul  9 08:24:33 2018
+++ src/etc/Makefile.params	Tue Jul 10 13:22:22 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.params,v 1.19 2018/07/09 08:24:33 martin Exp $
+#	$NetBSD: Makefile.params,v 1.20 2018/07/10 13:22:22 martin Exp $
 #
 # Makefile fragment for printing build parameters.
 #
@@ -39,8 +39,7 @@
 
 RELEASEVARS=	DISTRIBVER EXTERNAL_TOOLCHAIN HAVE_GCC HAVE_GDB \
 		HAVE_LLVM HAVE_PCC INSTALLWORLDDIR \
-		MACHINE MACHINE_ARCH MAKECONF \
-		MAKEOBJDIR MAKEOBJDIRPREFIX MAKEVERBOSE \
+		MACHINE MACHINE_ARCH \
 		NOCLEANDIR NODISTRIBDIRS NOINCLUDES \
 		TOOLCHAIN_MISSING \
 		USE_HESIOD USE_INET6 USE_JEMALLOC USE_KERBEROS USE_LDAP \
@@ -50,7 +49,8 @@ RELEASEVARS=	DISTRIBVER EXTERNAL_TOOLCHA
 .if ${MKREPRO:Uno} != "yes"
 RELEASEVARS+= 	BSDOBJDIR BSDSRCDIR BUILDID BUILDINFO BUILDSEED \
 		DESTDIR KERNARCHDIR KERNCONFDIR KERNOBJDIR KERNSRCDIR MAKE \
-		MAKEFLAGS NBUILDJOBS NETBSDSRCDIR OBJMACHINE OBJMACHINE_ARCH \
+		MAKECONF MAKEFLAGS MAKEOBJDIR MAKEOBJDIRPREFIX MAKEVERBOSE \
+		NBUILDJOBS NETBSDSRCDIR OBJMACHINE OBJMACHINE_ARCH \
 		RELEASEDIR RELEASEMACHINEDIR TOOLDIR USR_OBJMACHINE X11SRCDIR
 .endif
 



CVS commit: src/crypto/external/bsd/heimdal/lib/libgssapi

2018-07-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jul 10 13:17:36 UTC 2018

Modified Files:
src/crypto/external/bsd/heimdal/lib/libgssapi: Makefile

Log Message:
Explicit heimbase dependency (similar to other recent MKREPRO fixes)


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/crypto/external/bsd/heimdal/lib/libgssapi/Makefile

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

Modified files:

Index: src/crypto/external/bsd/heimdal/lib/libgssapi/Makefile
diff -u src/crypto/external/bsd/heimdal/lib/libgssapi/Makefile:1.4 src/crypto/external/bsd/heimdal/lib/libgssapi/Makefile:1.5
--- src/crypto/external/bsd/heimdal/lib/libgssapi/Makefile:1.4	Thu Apr 24 13:50:53 2014
+++ src/crypto/external/bsd/heimdal/lib/libgssapi/Makefile	Tue Jul 10 13:17:36 2018
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.4 2014/04/24 13:50:53 pettai Exp $
+# $NetBSD: Makefile,v 1.5 2018/07/10 13:17:36 martin Exp $
 
 USE_FORT?= yes# network protocol library
 
@@ -17,6 +17,7 @@ LIBDPLIBS+=	krb5		${HEIMBASE}/lib/libkrb
 		asn1		${HEIMBASE}/lib/libasn1		\
 		com_err		${HEIMBASE}/lib/libcom_err	\
 		roken		${HEIMBASE}/lib/libroken	\
+		heimbase	${HEIMBASE}/lib/libheimbase	\
 		heimntlm	${HEIMBASE}/lib/libheimntlm	\
 		crypto		${SSLBASE}/lib/libcrypto
 



CVS commit: src/sys/net/npf

2018-07-10 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Jul 10 12:31:46 UTC 2018

Modified Files:
src/sys/net/npf: npf_handler.c

Log Message:
Set con = NULL just once, instead of doing it in each branch.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/net/npf/npf_handler.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_handler.c
diff -u src/sys/net/npf/npf_handler.c:1.39 src/sys/net/npf/npf_handler.c:1.40
--- src/sys/net/npf/npf_handler.c:1.39	Tue Mar 13 09:04:02 2018
+++ src/sys/net/npf/npf_handler.c	Tue Jul 10 12:31:46 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_handler.c,v 1.39 2018/03/13 09:04:02 maxv Exp $	*/
+/*	$NetBSD: npf_handler.c,v 1.40 2018/07/10 12:31:46 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2009-2013 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 #ifdef _KERNEL
 #include 
-__KERNEL_RCSID(0, "$NetBSD: npf_handler.c,v 1.39 2018/03/13 09:04:02 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_handler.c,v 1.40 2018/07/10 12:31:46 maxv Exp $");
 
 #include 
 #include 
@@ -153,6 +153,7 @@ npf_packet_handler(npf_t *npf, struct mb
 	decision = NPF_DECISION_BLOCK;
 	error = 0;
 	rp = NULL;
+	con = NULL;
 
 	/* Cache everything. */
 	flags = npf_cache_all();
@@ -170,7 +171,6 @@ npf_packet_handler(npf_t *npf, struct mb
 		 */
 		error = npf_reassembly(npf, , mp);
 		if (error) {
-			con = NULL;
 			goto out;
 		}
 		if (*mp == NULL) {
@@ -181,7 +181,6 @@ npf_packet_handler(npf_t *npf, struct mb
 
 	/* Just pass-through if specially tagged. */
 	if (nbuf_find_tag(, ) == 0 && (ntag & NPF_NTAG_PASS) != 0) {
-		con = NULL;
 		goto pass;
 	}
 



CVS commit: src/sys/net

2018-07-10 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Jul 10 11:00:40 UTC 2018

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

Log Message:
Avoid attempting to call arp related functions if there is no
arp in the kernel.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/net/if_llatbl.c

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

Modified files:

Index: src/sys/net/if_llatbl.c
diff -u src/sys/net/if_llatbl.c:1.28 src/sys/net/if_llatbl.c:1.29
--- src/sys/net/if_llatbl.c:1.28	Tue Jul 10 01:23:13 2018
+++ src/sys/net/if_llatbl.c	Tue Jul 10 11:00:40 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_llatbl.c,v 1.28 2018/07/10 01:23:13 ozaki-r Exp $	*/
+/*	$NetBSD: if_llatbl.c,v 1.29 2018/07/10 11:00:40 kre Exp $	*/
 /*
  * Copyright (c) 2004 Luigi Rizzo, Alessandro Cerri. All rights reserved.
  * Copyright (c) 2004-2008 Qing Li. All rights reserved.
@@ -691,10 +691,12 @@ lla_rt_output(const u_char rtm_type, con
 		 */
 		if (lle != NULL) {
 			size_t pkts_dropped = llentry_free(lle);
+#if defined(INET) && NARP > 0
 			if (dst->sa_family == AF_INET) {
 arp_stat_add(ARP_STAT_DFRDROPPED,
 (uint64_t)pkts_dropped);
 			}
+#endif
 		}
 
 		lle = lla_create(llt, 0, dst, rt);



CVS commit: src/sys/arch/aarch64/aarch64

2018-07-10 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Tue Jul 10 08:35:58 UTC 2018

Modified Files:
src/sys/arch/aarch64/aarch64: genassym.cf locore.S

Log Message:
allow to read CNTVCT_EL0 and CNTFRQ_EL0 from EL0


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/aarch64/aarch64/genassym.cf
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/aarch64/aarch64/locore.S

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/aarch64/aarch64/genassym.cf
diff -u src/sys/arch/aarch64/aarch64/genassym.cf:1.3 src/sys/arch/aarch64/aarch64/genassym.cf:1.4
--- src/sys/arch/aarch64/aarch64/genassym.cf:1.3	Mon Jul  9 06:19:53 2018
+++ src/sys/arch/aarch64/aarch64/genassym.cf	Tue Jul 10 08:35:58 2018
@@ -1,4 +1,4 @@
-# $NetBSD: genassym.cf,v 1.3 2018/07/09 06:19:53 ryo Exp $
+# $NetBSD: genassym.cf,v 1.4 2018/07/10 08:35:58 ryo Exp $
 #-
 # Copyright (c) 2014 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -264,6 +264,7 @@ define	DAIF_SETCLR_SHIFT	DAIF_SETCLR_SHI
 
 define	CNTHCTL_EL1PCTEN	CNTHCTL_EL1PCTEN
 define	CNTHCTL_EL1PCEN		CNTHCTL_EL1PCEN
+define	CNTKCTL_EL0VCTEN	CNTKCTL_EL0VCTEN
 define	SPSR_F			SPSR_F
 define	SPSR_I			SPSR_I
 define	SPSR_A			SPSR_A

Index: src/sys/arch/aarch64/aarch64/locore.S
diff -u src/sys/arch/aarch64/aarch64/locore.S:1.9 src/sys/arch/aarch64/aarch64/locore.S:1.10
--- src/sys/arch/aarch64/aarch64/locore.S:1.9	Tue Jul 10 08:20:29 2018
+++ src/sys/arch/aarch64/aarch64/locore.S	Tue Jul 10 08:35:58 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.9 2018/07/10 08:20:29 ryo Exp $	*/
+/*	$NetBSD: locore.S,v 1.10 2018/07/10 08:35:58 ryo Exp $	*/
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -36,7 +36,7 @@
 #include 
 #include "assym.h"
 
-RCSID("$NetBSD: locore.S,v 1.9 2018/07/10 08:20:29 ryo Exp $")
+RCSID("$NetBSD: locore.S,v 1.10 2018/07/10 08:35:58 ryo Exp $")
 
 /* #define DEBUG_LOCORE */
 /* #define DEBUG_MMU */
@@ -802,6 +802,11 @@ init_sysregs:
 	/* No trap system register access, and Trap FP/SIMD access */
 	msr	cpacr_el1, xzr
 
+	/* allow to read CNTVCT_EL0 and CNTFRQ_EL0 from EL0 */
+	mrs	x0, cntkctl_el1
+	orr	x0, x0, #CNTKCTL_EL0VCTEN
+	msr	cntkctl_el1, x0
+
 	/* any exception not masked */
 	msr	daif, xzr
 



CVS commit: src/sys/arch/aarch64/aarch64

2018-07-10 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Tue Jul 10 08:20:29 UTC 2018

Modified Files:
src/sys/arch/aarch64/aarch64: locore.S

Log Message:
allow to execute wfi/wfe instruction on EL0. some userland program use them.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/aarch64/aarch64/locore.S

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/aarch64/aarch64/locore.S
diff -u src/sys/arch/aarch64/aarch64/locore.S:1.8 src/sys/arch/aarch64/aarch64/locore.S:1.9
--- src/sys/arch/aarch64/aarch64/locore.S:1.8	Mon Jul  9 06:19:53 2018
+++ src/sys/arch/aarch64/aarch64/locore.S	Tue Jul 10 08:20:29 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.8 2018/07/09 06:19:53 ryo Exp $	*/
+/*	$NetBSD: locore.S,v 1.9 2018/07/10 08:20:29 ryo Exp $	*/
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -36,7 +36,7 @@
 #include 
 #include "assym.h"
 
-RCSID("$NetBSD: locore.S,v 1.8 2018/07/09 06:19:53 ryo Exp $")
+RCSID("$NetBSD: locore.S,v 1.9 2018/07/10 08:20:29 ryo Exp $")
 
 /* #define DEBUG_LOCORE */
 /* #define DEBUG_MMU */
@@ -922,6 +922,8 @@ sctlr_set:
 	SCTLR_UCI | /* Enables EL0 DC {CVAU,CIVAC,CVAC}, IC IVAU */ \
 	SCTLR_SPAN |/* This field resets to 1 */ \
 	SCTLR_UCT | /* Enables EL0 access to the CTR_EL0 */ \
+	SCTLR_nTWE |/* EL0 WFE non-trapping */ \
+	SCTLR_nTWI |/* EL0 WFI non-trapping */ \
 	SCTLR_DZE | /* Enables access to the DC ZVA instruction */ \
 	SCTLR_I |   /* Instruction cache enable */ \
 	SCTLR_SED | /* SETEND instruction disable */ \
@@ -935,8 +937,6 @@ sctlr_clear:
 	.quad ( \
 	SCTLR_IESB |/* Enable Implicit ErrorSynchronizationBarrier */ \
 	SCTLR_WXN | /* Write permission implies Execute Never (W^X) */ \
-	SCTLR_nTWE |/* EL0 WFE non-trapping */ \
-	SCTLR_nTWI |/* EL0 WFI non-trapping */ \
 	SCTLR_UMA | /* EL0 Controls access to interrupt masks */ \
 	SCTLR_ITD | /* IT instruction disable */ \
 	SCTLR_THEE |/* T32EE is not implemented */ \



CVS commit: src/sys/sys

2018-07-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jul 10 07:40:42 UTC 2018

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

Log Message:
We need to make ISSET/SET/CLR available for bootloaders too.


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/sys/sys/types.h

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

Modified files:

Index: src/sys/sys/types.h
diff -u src/sys/sys/types.h:1.100 src/sys/sys/types.h:1.101
--- src/sys/sys/types.h:1.100	Sun Jul  8 21:59:12 2018
+++ src/sys/sys/types.h	Tue Jul 10 07:40:42 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: types.h,v 1.100 2018/07/08 21:59:12 pgoyette Exp $	*/
+/*	$NetBSD: types.h,v 1.101 2018/07/10 07:40:42 martin Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1991, 1993, 1994
@@ -342,7 +342,7 @@ struct	tty;
 struct	uio;
 #endif
 
-#ifdef _KERNEL
+#if defined(_KERNEL) || defined(_STANDALONE)
 #define SET(t, f)	((t) |= (f))
 #define	ISSET(t, f)	((t) & (f))
 #define	CLR(t, f)	((t) &= ~(f))



CVS commit: src

2018-07-10 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Jul 10 06:49:30 UTC 2018

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/bin/sh: Makefile
Added Files:
src/tests/bin/sh: t_patterns.sh

Log Message:
Add tests for pattern matching (filename expansion (glob), case statement
patterns, and variable expansion substring matching)

Currently (2018-07-10) all 3 sub-tests fail (sh bugs...)
Expect to see 14 (of 261) case matching sub-tests fail, 11 (of 167) filename
expansion (glob) sub-tests fail, and 6 (of 87) var substring sub-tests fail.

Also expect those numbers to reduce as sh bugs are fixed.


To generate a diff of this commit:
cvs rdiff -u -r1.788 -r1.789 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.12 -r1.13 src/tests/bin/sh/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/bin/sh/t_patterns.sh

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.788 src/distrib/sets/lists/tests/mi:1.789
--- src/distrib/sets/lists/tests/mi:1.788	Wed Jun 20 03:51:27 2018
+++ src/distrib/sets/lists/tests/mi	Tue Jul 10 06:49:29 2018
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.788 2018/06/20 03:51:27 maya Exp $
+# $NetBSD: mi,v 1.789 2018/07/10 06:49:29 kre Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -1277,6 +1277,7 @@
 ./usr/tests/bin/sh/t_fsplit			tests-bin-tests		compattestfile,atf
 ./usr/tests/bin/sh/t_here			tests-bin-tests		compattestfile,atf
 ./usr/tests/bin/sh/t_option			tests-bin-tests		compattestfile,atf
+./usr/tests/bin/sh/t_patterns			tests-bin-tests		compattestfile,atf
 ./usr/tests/bin/sh/t_redir			tests-bin-tests		compattestfile,atf
 ./usr/tests/bin/sh/t_redircloexec		tests-bin-tests		compattestfile,atf
 ./usr/tests/bin/sh/t_set_e			tests-bin-tests		compattestfile,atf

Index: src/tests/bin/sh/Makefile
diff -u src/tests/bin/sh/Makefile:1.12 src/tests/bin/sh/Makefile:1.13
--- src/tests/bin/sh/Makefile:1.12	Sat May 20 16:35:55 2017
+++ src/tests/bin/sh/Makefile	Tue Jul 10 06:49:29 2018
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.12 2017/05/20 16:35:55 kre Exp $
+# $NetBSD: Makefile,v 1.13 2018/07/10 06:49:29 kre Exp $
 #
 
 .include 
@@ -15,6 +15,7 @@ TESTS_SH+=	t_expand
 TESTS_SH+=	t_fsplit
 TESTS_SH+=	t_here
 TESTS_SH+=	t_option
+TESTS_SH+=	t_patterns
 TESTS_SH+=	t_redir
 TESTS_SH+=	t_redircloexec
 TESTS_SH+=	t_set_e

Added files:

Index: src/tests/bin/sh/t_patterns.sh
diff -u /dev/null src/tests/bin/sh/t_patterns.sh:1.1
--- /dev/null	Tue Jul 10 06:49:30 2018
+++ src/tests/bin/sh/t_patterns.sh	Tue Jul 10 06:49:29 2018
@@ -0,0 +1,784 @@
+# $NetBSD: t_patterns.sh,v 1.1 2018/07/10 06:49:29 kre Exp $
+#
+# Copyright (c) 2018 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#notice, this list of conditions and the following disclaimer in the
+#documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# the implementation of "sh" to test
+: ${TEST_SH:=/bin/sh}
+
+#
+# This file tests pattern matching (glob)
+#
+# Three forms:
+#	standard filename expansion (echo *.c)
+#	case statements (case word in (*.c) ...;;)
+#	var expansions with substring matching ${var%*.c}
+#
+# Note: the emphasis here is on testing the various possible patterns,
+# not that case statements, or var expansions (etc) work in general.
+
+### Helper functions
+
+nl='
+'
+reset()
+{
+	TEST_NUM=0
+	TEST_FAILURES=''
+	TEST_FAIL_COUNT=0
+	TEST_ID="$1"
+}
+
+# Test run & validate.
+#
+#	$1 is the command to run (via sh -c)
+#	$2 is the expected output (with any \n's in output replaced by spaces)
+#	$3 is the expected exit status from sh
+#
+# Stderr is exxpected to be empty, unless the expected exit code ($3) is != 0
+# in which case some message there is 

CVS commit: src/sys/arch/x86/pci

2018-07-10 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Jul 10 06:44:49 UTC 2018

Modified Files:
src/sys/arch/x86/pci: pci_machdep.c

Log Message:
Fix bug, SPINOUT() is not supposed to take the value given to BACKOFF().
Here the exponential backoff is wrecked.


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/sys/arch/x86/pci/pci_machdep.c

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

Modified files:

Index: src/sys/arch/x86/pci/pci_machdep.c
diff -u src/sys/arch/x86/pci/pci_machdep.c:1.82 src/sys/arch/x86/pci/pci_machdep.c:1.83
--- src/sys/arch/x86/pci/pci_machdep.c:1.82	Sat Jun 23 16:09:53 2018
+++ src/sys/arch/x86/pci/pci_machdep.c	Tue Jul 10 06:44:49 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_machdep.c,v 1.82 2018/06/23 16:09:53 jakllsch Exp $	*/
+/*	$NetBSD: pci_machdep.c,v 1.83 2018/07/10 06:44:49 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.82 2018/06/23 16:09:53 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.83 2018/07/10 06:44:49 maxv Exp $");
 
 #include 
 #include 
@@ -340,20 +340,23 @@ pci_conf_lock(struct pci_conf_lock *ocl,
 	if (cpuno == cl->cl_cpuno) {
 		ocl->cl_cpuno = cpuno;
 	} else {
-		u_int spins;
+#ifdef LOCKDEBUG
+		u_int spins = 0;
+#endif
+		u_int count;
+		count = SPINLOCK_BACKOFF_MIN;
 
 		ocl->cl_cpuno = 0;
 
-		spins = SPINLOCK_BACKOFF_MIN;
 		while (atomic_cas_32(>cl_cpuno, 0, cpuno) != 0) {
-			SPINLOCK_BACKOFF(spins);
+			SPINLOCK_BACKOFF(count);
 #ifdef LOCKDEBUG
 			if (SPINLOCK_SPINOUT(spins)) {
 panic("%s: cpu %" PRId32
 " spun out waiting for cpu %" PRId32,
 __func__, cpuno, cl->cl_cpuno);
 			}
-#endif	/* LOCKDEBUG */
+#endif
 		}
 	}