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

2018-03-29 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Mar 29 07:15:12 UTC 2018

Modified Files:
src/sys/arch/x86/x86: spectre.c svs.c

Log Message:
Fix sysctl type, should be bool.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/x86/x86/spectre.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/x86/x86/svs.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/spectre.c
diff -u src/sys/arch/x86/x86/spectre.c:1.3 src/sys/arch/x86/x86/spectre.c:1.4
--- src/sys/arch/x86/x86/spectre.c:1.3	Wed Mar 28 19:50:57 2018
+++ src/sys/arch/x86/x86/spectre.c	Thu Mar 29 07:15:12 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: spectre.c,v 1.3 2018/03/28 19:50:57 maxv Exp $	*/
+/*	$NetBSD: spectre.c,v 1.4 2018/03/29 07:15:12 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018 NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spectre.c,v 1.3 2018/03/28 19:50:57 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spectre.c,v 1.4 2018/03/29 07:15:12 maxv Exp $");
 
 #include 
 #include 
@@ -338,9 +338,10 @@ int
 sysctl_machdep_spectreV2_mitigated(SYSCTLFN_ARGS)
 {
 	struct sysctlnode node;
-	int error, val;
+	int error;
+	bool val;
 
-	val = *(int *)rnode->sysctl_data;
+	val = *(bool *)rnode->sysctl_data;
 
 	node = *rnode;
 	node.sysctl_data = &val;

Index: src/sys/arch/x86/x86/svs.c
diff -u src/sys/arch/x86/x86/svs.c:1.14 src/sys/arch/x86/x86/svs.c:1.15
--- src/sys/arch/x86/x86/svs.c:1.14	Tue Mar 13 16:45:52 2018
+++ src/sys/arch/x86/x86/svs.c	Thu Mar 29 07:15:12 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: svs.c,v 1.14 2018/03/13 16:45:52 maxv Exp $	*/
+/*	$NetBSD: svs.c,v 1.15 2018/03/29 07:15:12 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: svs.c,v 1.14 2018/03/13 16:45:52 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: svs.c,v 1.15 2018/03/29 07:15:12 maxv Exp $");
 
 #include "opt_svs.h"
 
@@ -720,9 +720,10 @@ int
 sysctl_machdep_svs_enabled(SYSCTLFN_ARGS)
 {
 	struct sysctlnode node;
-	int error, val;
+	int error;
+	bool val;
 
-	val = *(int *)rnode->sysctl_data;
+	val = *(bool *)rnode->sysctl_data;
 
 	node = *rnode;
 	node.sysctl_data = &val;



CVS commit: src/sys/arch

2018-03-29 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Mar 29 07:21:25 UTC 2018

Modified Files:
src/sys/arch/amd64/amd64: locore.S
src/sys/arch/x86/x86: spectre.c

Log Message:
Allow IBRS to be disabled dynamically.


To generate a diff of this commit:
cvs rdiff -u -r1.161 -r1.162 src/sys/arch/amd64/amd64/locore.S
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/x86/x86/spectre.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.161 src/sys/arch/amd64/amd64/locore.S:1.162
--- src/sys/arch/amd64/amd64/locore.S:1.161	Wed Mar 28 19:56:40 2018
+++ src/sys/arch/amd64/amd64/locore.S	Thu Mar 29 07:21:24 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.161 2018/03/28 19:56:40 maxv Exp $	*/
+/*	$NetBSD: locore.S,v 1.162 2018/03/29 07:21:24 maxv Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -1682,3 +1682,11 @@ LABEL(ibrs_leave)
 	wrmsr
 1234:
 LABEL(ibrs_leave_end)
+
+LABEL(noibrs_enter)
+	NOIBRS_ENTER
+LABEL(noibrs_enter_end)
+
+LABEL(noibrs_leave)
+	NOIBRS_LEAVE
+LABEL(noibrs_leave_end)

Index: src/sys/arch/x86/x86/spectre.c
diff -u src/sys/arch/x86/x86/spectre.c:1.4 src/sys/arch/x86/x86/spectre.c:1.5
--- src/sys/arch/x86/x86/spectre.c:1.4	Thu Mar 29 07:15:12 2018
+++ src/sys/arch/x86/x86/spectre.c	Thu Mar 29 07:21:24 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: spectre.c,v 1.4 2018/03/29 07:15:12 maxv Exp $	*/
+/*	$NetBSD: spectre.c,v 1.5 2018/03/29 07:21:24 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018 NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spectre.c,v 1.4 2018/03/29 07:15:12 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spectre.c,v 1.5 2018/03/29 07:21:24 maxv Exp $");
 
 #include 
 #include 
@@ -129,6 +129,28 @@ static volatile unsigned long ibrs_cpu_b
 static volatile unsigned long ibrs_cpu_barrier2 __cacheline_aligned;
 
 static void
+ibrs_disable_hotpatch(void)
+{
+	extern uint8_t noibrs_enter, noibrs_enter_end;
+	extern uint8_t noibrs_leave, noibrs_leave_end;
+	u_long psl, cr0;
+	uint8_t *bytes;
+	size_t size;
+
+	x86_patch_window_open(&psl, &cr0);
+
+	bytes = &noibrs_enter;
+	size = (size_t)&noibrs_enter_end - (size_t)&noibrs_enter;
+	x86_hotpatch(HP_NAME_IBRS_ENTER, bytes, size);
+
+	bytes = &noibrs_leave;
+	size = (size_t)&noibrs_leave_end - (size_t)&noibrs_leave;
+	x86_hotpatch(HP_NAME_IBRS_LEAVE, bytes, size);
+
+	x86_patch_window_close(psl, cr0);
+}
+
+static void
 ibrs_enable_hotpatch(void)
 {
 	extern uint8_t ibrs_enter, ibrs_enter_end;
@@ -170,10 +192,14 @@ ibrs_change_cpu(void *arg1, void *arg2)
 		if (enabled) {
 			ibrs_enable_hotpatch();
 		} else {
-			/* TODO */
+			ibrs_disable_hotpatch();
 		}
 	}
 
+	if (!enabled) {
+		wrmsr(MSR_IA32_SPEC_CTRL, 0);
+	}
+
 	atomic_dec_ulong(&ibrs_cpu_barrier2);
 	while (atomic_cas_ulong(&ibrs_cpu_barrier2, 0, 0) != 0) {
 		x86_pause();



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

2018-03-29 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Mar 29 07:24:26 UTC 2018

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

Log Message:
Use EOPNOTSUPP instead of EINVAL.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/x86/x86/svs.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/svs.c
diff -u src/sys/arch/x86/x86/svs.c:1.15 src/sys/arch/x86/x86/svs.c:1.16
--- src/sys/arch/x86/x86/svs.c:1.15	Thu Mar 29 07:15:12 2018
+++ src/sys/arch/x86/x86/svs.c	Thu Mar 29 07:24:26 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: svs.c,v 1.15 2018/03/29 07:15:12 maxv Exp $	*/
+/*	$NetBSD: svs.c,v 1.16 2018/03/29 07:24:26 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: svs.c,v 1.15 2018/03/29 07:15:12 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: svs.c,v 1.16 2018/03/29 07:24:26 maxv Exp $");
 
 #include "opt_svs.h"
 
@@ -733,7 +733,10 @@ sysctl_machdep_svs_enabled(SYSCTLFN_ARGS
 		return error;
 
 	if (val == 1) {
-		error = EINVAL;
+		if (svs_enabled)
+			error = 0;
+		else
+			error = EOPNOTSUPP;
 	} else {
 		if (svs_enabled)
 			error = svs_disable();



CVS commit: src/sys/netinet

2018-03-29 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Mar 29 07:46:43 UTC 2018

Modified Files:
src/sys/netinet: tcp_congctl.c tcp_debug.c tcp_output.c tcp_sack.c
tcp_subr.c tcp_timer.c tcp_usrreq.c

Log Message:
Remove #ifdef INET. Same as tcp_input.c. Makes the code easier to
understand.

Also make tcp6_mtudisc() static in tcp_subr.c.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/netinet/tcp_congctl.c
cvs rdiff -u -r1.30 -r1.31 src/sys/netinet/tcp_debug.c
cvs rdiff -u -r1.199 -r1.200 src/sys/netinet/tcp_output.c
cvs rdiff -u -r1.33 -r1.34 src/sys/netinet/tcp_sack.c
cvs rdiff -u -r1.273 -r1.274 src/sys/netinet/tcp_subr.c
cvs rdiff -u -r1.93 -r1.94 src/sys/netinet/tcp_timer.c
cvs rdiff -u -r1.216 -r1.217 src/sys/netinet/tcp_usrreq.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/netinet/tcp_congctl.c
diff -u src/sys/netinet/tcp_congctl.c:1.23 src/sys/netinet/tcp_congctl.c:1.24
--- src/sys/netinet/tcp_congctl.c:1.23	Mon Jan  2 09:29:38 2017
+++ src/sys/netinet/tcp_congctl.c	Thu Mar 29 07:46:43 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_congctl.c,v 1.23 2017/01/02 09:29:38 skrll Exp $	*/
+/*	$NetBSD: tcp_congctl.c,v 1.24 2018/03/29 07:46:43 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 1999, 2001, 2005, 2006 The NetBSD Foundation, Inc.
@@ -135,7 +135,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tcp_congctl.c,v 1.23 2017/01/02 09:29:38 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_congctl.c,v 1.24 2018/03/29 07:46:43 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -167,9 +167,6 @@ __KERNEL_RCSID(0, "$NetBSD: tcp_congctl.
 #include 
 
 #ifdef INET6
-#ifndef INET
-#include 
-#endif
 #include 
 #include 
 #include 

Index: src/sys/netinet/tcp_debug.c
diff -u src/sys/netinet/tcp_debug.c:1.30 src/sys/netinet/tcp_debug.c:1.31
--- src/sys/netinet/tcp_debug.c:1.30	Tue Apr 26 08:44:44 2016
+++ src/sys/netinet/tcp_debug.c	Thu Mar 29 07:46:43 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_debug.c,v 1.30 2016/04/26 08:44:44 ozaki-r Exp $	*/
+/*	$NetBSD: tcp_debug.c,v 1.31 2018/03/29 07:46:43 maxv Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tcp_debug.c,v 1.30 2016/04/26 08:44:44 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_debug.c,v 1.31 2018/03/29 07:46:43 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -91,9 +91,6 @@ __KERNEL_RCSID(0, "$NetBSD: tcp_debug.c,
 #include 
 
 #ifdef INET6
-#ifndef INET
-#include 
-#endif
 #include 
 #endif
 

Index: src/sys/netinet/tcp_output.c
diff -u src/sys/netinet/tcp_output.c:1.199 src/sys/netinet/tcp_output.c:1.200
--- src/sys/netinet/tcp_output.c:1.199	Sat Mar 10 23:28:13 2018
+++ src/sys/netinet/tcp_output.c	Thu Mar 29 07:46:43 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_output.c,v 1.199 2018/03/10 23:28:13 khorben Exp $	*/
+/*	$NetBSD: tcp_output.c,v 1.200 2018/03/29 07:46:43 maxv Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -135,7 +135,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tcp_output.c,v 1.199 2018/03/10 23:28:13 khorben Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_output.c,v 1.200 2018/03/29 07:46:43 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -166,9 +166,6 @@ __KERNEL_RCSID(0, "$NetBSD: tcp_output.c
 #include 
 
 #ifdef INET6
-#ifndef INET
-#include 
-#endif
 #include 
 #include 
 #include 
@@ -182,7 +179,7 @@ __KERNEL_RCSID(0, "$NetBSD: tcp_output.c
 #ifdef INET6
 #include 
 #endif
-#endif	/* IPSEC*/
+#endif
 
 #include 
 #define	TCPOUTFLAGS
@@ -238,9 +235,7 @@ int
 tcp_segsize(struct tcpcb *tp, int *txsegsizep, int *rxsegsizep,
 bool *alwaysfragp)
 {
-#ifdef INET
 	struct inpcb *inp = tp->t_inpcb;
-#endif
 #ifdef INET6
 	struct in6pcb *in6p = tp->t_in6pcb;
 #endif
@@ -258,11 +253,9 @@ tcp_segsize(struct tcpcb *tp, int *txseg
 		panic("tcp_segsize: both t_inpcb and t_in6pcb are set");
 #endif
 	switch (tp->t_family) {
-#ifdef INET
 	case AF_INET:
 		hdrlen = sizeof(struct ip) + sizeof(struct tcphdr);
 		break;
-#endif
 #ifdef INET6
 	case AF_INET6:
 		hdrlen = sizeof(struct ip6_hdr) + sizeof(struct tcphdr);
@@ -274,12 +267,10 @@ tcp_segsize(struct tcpcb *tp, int *txseg
 	}
 
 	rt = NULL;
-#ifdef INET
 	if (inp) {
 		rt = in_pcbrtentry(inp);
 		so = inp->inp_socket;
 	}
-#endif
 #ifdef INET6
 	if (in6p) {
 		rt = in6_pcbrtentry(in6p);
@@ -311,24 +302,19 @@ tcp_segsize(struct tcpcb *tp, int *txseg
 #endif
 	} else if (ifp->if_flags & IFF_LOOPBACK)
 		size = ifp->if_mtu - hdrlen;
-#ifdef INET
 	else if (inp && tp->t_mtudisc)
 		size = ifp->if_mtu - hdrlen;
 	else if (inp && in_localaddr(inp->inp_faddr))
 		size = ifp->if_mtu - hdrlen;
-#endif
 #ifdef INET6
 	else if (in6p) {
-#ifdef INET
 		if (IN6_IS_ADDR_V4MAPPED(&in6p->in6p_faddr)) {
 			/* mapped addr case */
 			struct in_addr d;
 			bcopy(&in6p->in6p_faddr.s6_addr32[3], &d, sizeof(d));
 			if (

CVS commit: src/sys/netinet

2018-03-29 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Mar 29 08:11:41 UTC 2018

Modified Files:
src/sys/netinet: tcp_subr.c

Log Message:
Misc changes; no real functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.274 -r1.275 src/sys/netinet/tcp_subr.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/netinet/tcp_subr.c
diff -u src/sys/netinet/tcp_subr.c:1.274 src/sys/netinet/tcp_subr.c:1.275
--- src/sys/netinet/tcp_subr.c:1.274	Thu Mar 29 07:46:43 2018
+++ src/sys/netinet/tcp_subr.c	Thu Mar 29 08:11:41 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_subr.c,v 1.274 2018/03/29 07:46:43 maxv Exp $	*/
+/*	$NetBSD: tcp_subr.c,v 1.275 2018/03/29 08:11:41 maxv Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -29,7 +29,7 @@
  * SUCH DAMAGE.
  */
 
-/*-
+/*
  * Copyright (c) 1997, 1998, 2000, 2001, 2008 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.274 2018/03/29 07:46:43 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.275 2018/03/29 08:11:41 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -210,7 +210,7 @@ int	tcp_msl_enable = 1;		/* enable TIME_
 int	tcp_msl_loop   = PR_SLOWHZ;	/* MSL for loopback		*/
 int	tcp_msl_local  = 5 * PR_SLOWHZ;	/* MSL for 'local'		*/
 int	tcp_msl_remote = TCPTV_MSL;	/* MSL otherwise		*/
-int	tcp_msl_remote_threshold = TCPTV_SRTTDFLT;	/* RTT threshold */ 
+int	tcp_msl_remote_threshold = TCPTV_SRTTDFLT;	/* RTT threshold */
 int	tcp_rttlocal = 0;		/* Use RTT to decide who's 'local' */
 
 int	tcp4_vtw_enable = 0;		/* 1 to enable */
@@ -488,17 +488,15 @@ tcp_template(struct tcpcb *tp)
 		return NULL;	/*EINVAL*/
 #endif
 	default:
-		hlen = 0;	/*pacify gcc*/
 		return NULL;	/*EAFNOSUPPORT*/
 	}
-#ifdef DIAGNOSTIC
-	if (hlen + sizeof(struct tcphdr) > MCLBYTES)
-		panic("mclbytes too small for t_template");
-#endif
+
+	KASSERT(hlen + sizeof(struct tcphdr) <= MCLBYTES);
+
 	m = tp->t_template;
-	if (m && m->m_len == hlen + sizeof(struct tcphdr))
+	if (m && m->m_len == hlen + sizeof(struct tcphdr)) {
 		;
-	else {
+	} else {
 		if (m)
 			m_freem(m);
 		m = tp->t_template = NULL;
@@ -542,6 +540,7 @@ tcp_template(struct tcpcb *tp)
 sizeof(ipov->ih_dst));
 		}
 #endif
+
 		/*
 		 * Compute the pseudo-header portion of the checksum
 		 * now.  We incrementally add in the TCP option and
@@ -587,6 +586,7 @@ tcp_template(struct tcpcb *tp)
 	}
 #endif
 	}
+
 	if (inp) {
 		n->th_sport = inp->inp_lport;
 		n->th_dport = inp->inp_fport;
@@ -597,6 +597,7 @@ tcp_template(struct tcpcb *tp)
 		n->th_dport = in6p->in6p_fport;
 	}
 #endif
+
 	n->th_seq = 0;
 	n->th_ack = 0;
 	n->th_x2 = 0;
@@ -604,7 +605,7 @@ tcp_template(struct tcpcb *tp)
 	n->th_flags = 0;
 	n->th_win = 0;
 	n->th_urp = 0;
-	return (m);
+	return m;
 }
 
 /*
@@ -635,10 +636,8 @@ tcp_respond(struct tcpcb *tp, struct mbu
 	struct tcphdr *th;
 
 	if (tp != NULL && (flags & TH_RST) == 0) {
-#ifdef DIAGNOSTIC
-		if (tp->t_inpcb && tp->t_in6pcb)
-			panic("tcp_respond: both t_inpcb and t_in6pcb are set");
-#endif
+		KASSERT(!(tp->t_inpcb && tp->t_in6pcb));
+
 		if (tp->t_inpcb)
 			win = sbspace(&tp->t_inpcb->inp_socket->so_rcv);
 #ifdef INET6
@@ -652,7 +651,7 @@ tcp_respond(struct tcpcb *tp, struct mbu
 #ifdef INET6
 	ip6 = NULL;
 #endif
-	if (m == 0) {
+	if (m == NULL) {
 		if (!mtemplate)
 			return EINVAL;
 
@@ -682,7 +681,7 @@ tcp_respond(struct tcpcb *tp, struct mbu
 			}
 		}
 		if (m == NULL)
-			return (ENOBUFS);
+			return ENOBUFS;
 
 		tlen = 0;
 
@@ -700,27 +699,14 @@ tcp_respond(struct tcpcb *tp, struct mbu
 			th = (struct tcphdr *)(ip6 + 1);
 			break;
 #endif
-#if 0
-		default:
-			/* noone will visit here */
-			m_freem(m);
-			return EAFNOSUPPORT;
-#endif
 		}
 		flags = TH_ACK;
 	} else {
-
 		if ((m->m_flags & M_PKTHDR) == 0) {
-#if 0
-			printf("non PKTHDR to tcp_respond\n");
-#endif
 			m_freem(m);
 			return EINVAL;
 		}
-#ifdef DIAGNOSTIC
-		if (!th0)
-			panic("th0 == NULL in tcp_respond");
-#endif
+		KASSERT(th0 != NULL);
 
 		/* get family information from m */
 		switch (mtod(m, struct ip *)->ip_v) {
@@ -756,12 +742,8 @@ tcp_respond(struct tcpcb *tp, struct mbu
 		} else {
 			struct mbuf *n;
 
-#ifdef DIAGNOSTIC
-			if (max_linkhdr + hlen + tlen > MCLBYTES) {
-m_freem(m);
-return EMSGSIZE;
-			}
-#endif
+			KASSERT(max_linkhdr + hlen + tlen <= MCLBYTES);
+
 			MGETHDR(n, M_DONTWAIT, MT_HEADER);
 			if (n && max_linkhdr + hlen + tlen > MHLEN) {
 MCLGET(n, M_DONTWAIT);
@@ -804,12 +786,6 @@ tcp_respond(struct tcpcb *tp, struct mbu
 			ip6->ip6_nxt = IPPROTO_TCP;
 			break;
 #endif
-#if 0
-		default:
-			/* noone will visit here */
-			m_freem(m);
-			return EAFNOSUPPORT;
-#endif
 		}
 		xchg(th->th_dport, th->th_sport, u_int16_t);
 #undef xchg
@@ -826,8 +802,9 @@ tcp_respond(struct tcpcb *tp, struct mbu
 		th->th_win = htons((u_int16_t)win);
 		th

CVS commit: [pgoyette-compat] src/sys/dev/usb

2018-03-29 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Mar 29 10:15:20 UTC 2018

Modified Files:
src/sys/dev/usb [pgoyette-compat]: usbdivar.h

Log Message:
Protect against multiple-inclusion


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.114.12.1 src/sys/dev/usb/usbdivar.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/usbdivar.h
diff -u src/sys/dev/usb/usbdivar.h:1.114 src/sys/dev/usb/usbdivar.h:1.114.12.1
--- src/sys/dev/usb/usbdivar.h:1.114	Thu Jan 19 16:05:00 2017
+++ src/sys/dev/usb/usbdivar.h	Thu Mar 29 10:15:20 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdivar.h,v 1.114 2017/01/19 16:05:00 skrll Exp $	*/
+/*	$NetBSD: usbdivar.h,v 1.114.12.1 2018/03/29 10:15:20 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 1998, 2012 The NetBSD Foundation, Inc.
@@ -69,6 +69,9 @@
  *
  */
 
+#ifndef _USBDIVAR_H_
+#define _USBDIVAR_H_
+
 #include 
 #include 
 #include 
@@ -368,3 +371,5 @@ usb_addr2dindex(int addr)
 
 #define usbd_lock_pipe(p)	mutex_enter((p)->up_dev->ud_bus->ub_lock)
 #define usbd_unlock_pipe(p)	mutex_exit((p)->up_dev->ud_bus->ub_lock)
+
+#endif /* _USBDIVAR_H_ */



CVS commit: [pgoyette-compat] src/sys/dev/usb

2018-03-29 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Mar 29 10:27:28 UTC 2018

Modified Files:
src/sys/dev/usb [pgoyette-compat]: usbdivar.h

Log Message:
Revert previous.  Instead, we'll just move usbd_printBCD() to usbdi.h


To generate a diff of this commit:
cvs rdiff -u -r1.114.12.1 -r1.114.12.2 src/sys/dev/usb/usbdivar.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/usbdivar.h
diff -u src/sys/dev/usb/usbdivar.h:1.114.12.1 src/sys/dev/usb/usbdivar.h:1.114.12.2
--- src/sys/dev/usb/usbdivar.h:1.114.12.1	Thu Mar 29 10:15:20 2018
+++ src/sys/dev/usb/usbdivar.h	Thu Mar 29 10:27:27 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdivar.h,v 1.114.12.1 2018/03/29 10:15:20 pgoyette Exp $	*/
+/*	$NetBSD: usbdivar.h,v 1.114.12.2 2018/03/29 10:27:27 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 1998, 2012 The NetBSD Foundation, Inc.
@@ -69,9 +69,6 @@
  *
  */
 
-#ifndef _USBDIVAR_H_
-#define _USBDIVAR_H_
-
 #include 
 #include 
 #include 
@@ -329,7 +326,6 @@ usbd_status	usbd_reattach_device(device_
  int, const int *);
 
 void		usbd_remove_device(struct usbd_device *, struct usbd_port *);
-int		usbd_printBCD(char *, size_t, int);
 usbd_status	usbd_fill_iface_data(struct usbd_device *, int, int);
 void		usb_free_device(struct usbd_device *);
 
@@ -371,5 +367,3 @@ usb_addr2dindex(int addr)
 
 #define usbd_lock_pipe(p)	mutex_enter((p)->up_dev->ud_bus->ub_lock)
 #define usbd_unlock_pipe(p)	mutex_exit((p)->up_dev->ud_bus->ub_lock)
-
-#endif /* _USBDIVAR_H_ */



CVS commit: [pgoyette-compat] src/sys

2018-03-29 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Mar 29 11:20:03 UTC 2018

Modified Files:
src/sys/compat/common [pgoyette-compat]: compat_30_mod.c compat_mod.c
compat_mod.h files.common
src/sys/dev/usb [pgoyette-compat]: ugen.c uhid.c usb.c usb_subr.c
usbdi.h
src/sys/kern [pgoyette-compat]: compat_stub.c
src/sys/sys [pgoyette-compat]: compat_stub.h
Added Files:
src/sys/compat/common [pgoyette-compat]: usb_30_subr.c

Log Message:
Split out the usb compat_30 code and add it to the module


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/compat/common/compat_30_mod.c
cvs rdiff -u -r1.24.14.22 -r1.24.14.23 src/sys/compat/common/compat_mod.c
cvs rdiff -u -r1.1.42.11 -r1.1.42.12 src/sys/compat/common/compat_mod.h
cvs rdiff -u -r1.1.2.21 -r1.1.2.22 src/sys/compat/common/files.common
cvs rdiff -u -r0 -r1.1.2.1 src/sys/compat/common/usb_30_subr.c
cvs rdiff -u -r1.139 -r1.139.2.1 src/sys/dev/usb/ugen.c
cvs rdiff -u -r1.101 -r1.101.2.1 src/sys/dev/usb/uhid.c
cvs rdiff -u -r1.168 -r1.168.2.1 src/sys/dev/usb/usb.c
cvs rdiff -u -r1.223 -r1.223.2.1 src/sys/dev/usb/usb_subr.c
cvs rdiff -u -r1.92 -r1.92.14.1 src/sys/dev/usb/usbdi.h
cvs rdiff -u -r1.1.2.10 -r1.1.2.11 src/sys/kern/compat_stub.c
cvs rdiff -u -r1.1.2.10 -r1.1.2.11 src/sys/sys/compat_stub.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/compat/common/compat_30_mod.c
diff -u src/sys/compat/common/compat_30_mod.c:1.1.2.2 src/sys/compat/common/compat_30_mod.c:1.1.2.3
--- src/sys/compat/common/compat_30_mod.c:1.1.2.2	Wed Mar 28 07:51:09 2018
+++ src/sys/compat/common/compat_30_mod.c	Thu Mar 29 11:20:02 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_30_mod.c,v 1.1.2.2 2018/03/28 07:51:09 pgoyette Exp $	*/
+/*	$NetBSD: compat_30_mod.c,v 1.1.2.3 2018/03/29 11:20:02 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: compat_30_mod.c,v 1.1.2.2 2018/03/28 07:51:09 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_30_mod.c,v 1.1.2.3 2018/03/29 11:20:02 pgoyette Exp $");
 
 #include 
 #include 
@@ -64,6 +64,7 @@ compat_30_init(void)
 	}
 	bio_30_init();
 	vnd_30_init();
+	usb_30_init();
 
 	return error;
 }
@@ -73,23 +74,26 @@ compat_30_fini(void)
 {
 	int error = 0;
 
+	usb_30_fini();
 	vnd_30_fini();
 	bio_30_fini();
 
 	error = kern_time_30_fini();
-	if (error != 0) {
-		bio_30_init();
-		vnd_30_init();
-		return error;
-	}
+	if (error != 0)
+		goto err1;
 
 	error = vfs_syscalls_30_fini();
-	if (error != 0) {
-		bio_30_init();
-		vnd_30_init();
-		kern_time_30_init();
-		return error;
-	}
+	if (error != 0)
+		goto err2;
+
+	return 0;
+
+ err2:
+	kern_time_30_init();
+ err1:
+	bio_30_init();
+	vnd_30_init();
+	usb_30_init();
 
 	return error;
 }

Index: src/sys/compat/common/compat_mod.c
diff -u src/sys/compat/common/compat_mod.c:1.24.14.22 src/sys/compat/common/compat_mod.c:1.24.14.23
--- src/sys/compat/common/compat_mod.c:1.24.14.22	Wed Mar 28 04:18:24 2018
+++ src/sys/compat/common/compat_mod.c	Thu Mar 29 11:20:02 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_mod.c,v 1.24.14.22 2018/03/28 04:18:24 pgoyette Exp $	*/
+/*	$NetBSD: compat_mod.c,v 1.24.14.23 2018/03/29 11:20:02 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.24.14.22 2018/03/28 04:18:24 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.24.14.23 2018/03/29 11:20:02 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -77,7 +77,8 @@ static struct sysctllog *compat_clog = N
 #endif
 
 static const char * const compat_includes[] = {
-	"compat_80", "compat_70", "compat_60", "compat_50", 
+	"compat_80", "compat_70", "compat_60", "compat_50", "compat_40",
+	"compat_30",
 	NULL
 };
 

Index: src/sys/compat/common/compat_mod.h
diff -u src/sys/compat/common/compat_mod.h:1.1.42.11 src/sys/compat/common/compat_mod.h:1.1.42.12
--- src/sys/compat/common/compat_mod.h:1.1.42.11	Wed Mar 28 07:51:09 2018
+++ src/sys/compat/common/compat_mod.h	Thu Mar 29 11:20:02 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_mod.h,v 1.1.42.11 2018/03/28 07:51:09 pgoyette Exp $	*/
+/*	$NetBSD: compat_mod.h,v 1.1.42.12 2018/03/29 11:20:02 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -101,6 +101,8 @@ void bio_30_init(void);
 void bio_30_fini(void);
 void vnd_30_init(void);
 void vnd_30_fini(void);
+void usb_30_init(void);
+void usb_30_fini(void);
 #endif
 
 #endif /* !_COMPAT_MOD_H_ */

Index: src/sys/compat/common/files.common
diff -u src/sys/compat/common/files.common:1.1.2.21 src/sys/compat/common/files.common:1.1.2.22
--- src/sys/compat/common/files.common:1.1.2.21	Wed Mar 28 07:51:09 2018
+++ src/sys/compat/common/files.common	Thu Mar 29 11:20:02 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: file

CVS commit: [pgoyette-compat] src/sys/modules/vnd

2018-03-29 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Mar 29 11:22:23 UTC 2018

Modified Files:
src/sys/modules/vnd [pgoyette-compat]: Makefile

Log Message:
We no longer need to force compat_30 - it will be automatically
invoked if the appropriate compat module is loaded.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.16.1 src/sys/modules/vnd/Makefile

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

Modified files:

Index: src/sys/modules/vnd/Makefile
diff -u src/sys/modules/vnd/Makefile:1.3 src/sys/modules/vnd/Makefile:1.3.16.1
--- src/sys/modules/vnd/Makefile:1.3	Thu Aug 20 11:05:02 2015
+++ src/sys/modules/vnd/Makefile	Thu Mar 29 11:22:23 2018
@@ -1,8 +1,8 @@
-#	$NetBSD: Makefile,v 1.3 2015/08/20 11:05:02 christos Exp $
+#	$NetBSD: Makefile,v 1.3.16.1 2018/03/29 11:22:23 pgoyette Exp $
 
 .include "../Makefile.inc"
 
-CPPFLAGS+= -DVND_COMPRESSION -DCOMPAT_30 -DCOMPAT_50
+CPPFLAGS+= -DVND_COMPRESSION -DCOMPAT_50
 
 .PATH:	${S}/dev
 



CVS commit: src

2018-03-29 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Mar 29 13:23:40 UTC 2018

Modified Files:
src/distrib/sets/lists/comp: md.sparc md.sparc64
src/lib/csu/common: crt0-common.c
src/libexec/ld.elf_so/arch/sparc: mdreloc.c
src/libexec/ld.elf_so/arch/sparc64: mdreloc.c
src/sys/arch/sparc/include: Makefile
src/sys/arch/sparc64/include: Makefile
Added Files:
src/sys/arch/sparc/include: elf_support.h
src/sys/arch/sparc64/include: elf_support.h

Log Message:
Move the complex logic for dynamically writing branches from ld.elf_so
into a header for reuse in crt0.o for static ifunc support. Change the
existing logic for sparc64 to use the Bicc variant of ba,a as it allows
+-8MB displacement compared to the BPcc variant's +-1MB. Teach the sparc
variant the same trick for using ba,a and not sethi+jmp when possible.


To generate a diff of this commit:
cvs rdiff -u -r1.92 -r1.93 src/distrib/sets/lists/comp/md.sparc
cvs rdiff -u -r1.199 -r1.200 src/distrib/sets/lists/comp/md.sparc64
cvs rdiff -u -r1.15 -r1.16 src/lib/csu/common/crt0-common.c
cvs rdiff -u -r1.53 -r1.54 src/libexec/ld.elf_so/arch/sparc/mdreloc.c
cvs rdiff -u -r1.67 -r1.68 src/libexec/ld.elf_so/arch/sparc64/mdreloc.c
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/sparc/include/Makefile
cvs rdiff -u -r0 -r1.1 src/sys/arch/sparc/include/elf_support.h
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/sparc64/include/Makefile
cvs rdiff -u -r0 -r1.1 src/sys/arch/sparc64/include/elf_support.h

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/comp/md.sparc
diff -u src/distrib/sets/lists/comp/md.sparc:1.92 src/distrib/sets/lists/comp/md.sparc:1.93
--- src/distrib/sets/lists/comp/md.sparc:1.92	Sat Feb  3 21:27:45 2018
+++ src/distrib/sets/lists/comp/md.sparc	Thu Mar 29 13:23:39 2018
@@ -1,4 +1,4 @@
-# $NetBSD: md.sparc,v 1.92 2018/02/03 21:27:45 mrg Exp $
+# $NetBSD: md.sparc,v 1.93 2018/03/29 13:23:39 joerg Exp $
 ./usr/include/gcc-4.5/tgmath.h			comp-obsolete		obsolete
 ./usr/include/gcc-4.8/tgmath.h			comp-c-include		obsolete
 ./usr/include/gcc-4.8/visintrin.h		comp-c-include		obsolete
@@ -24,6 +24,7 @@
 ./usr/include/sparc/disklabel.h			comp-c-include
 ./usr/include/sparc/eeprom.h			comp-c-include
 ./usr/include/sparc/elf_machdep.h		comp-c-include
+./usr/include/sparc/elf_support.h		comp-c-include
 ./usr/include/sparc/endian.h			comp-c-include
 ./usr/include/sparc/endian_machdep.h		comp-c-include
 ./usr/include/sparc/fbio.h			comp-obsolete		obsolete
@@ -92,6 +93,7 @@
 ./usr/include/sparc64/disklabel.h		comp-c-include
 ./usr/include/sparc64/eeprom.h			comp-c-include
 ./usr/include/sparc64/elf_machdep.h		comp-c-include
+./usr/include/sparc64/elf_support.h		comp-c-include
 ./usr/include/sparc64/endian.h			comp-c-include
 ./usr/include/sparc64/endian_machdep.h		comp-c-include
 ./usr/include/sparc64/fbio.h			comp-obsolete		obsolete

Index: src/distrib/sets/lists/comp/md.sparc64
diff -u src/distrib/sets/lists/comp/md.sparc64:1.199 src/distrib/sets/lists/comp/md.sparc64:1.200
--- src/distrib/sets/lists/comp/md.sparc64:1.199	Sat Feb  3 21:27:45 2018
+++ src/distrib/sets/lists/comp/md.sparc64	Thu Mar 29 13:23:39 2018
@@ -1,4 +1,4 @@
-# $NetBSD: md.sparc64,v 1.199 2018/02/03 21:27:45 mrg Exp $
+# $NetBSD: md.sparc64,v 1.200 2018/03/29 13:23:39 joerg Exp $
 ./usr/include/g++/bits/sparc			comp-c-include		compat
 ./usr/include/g++/bits/sparc/c++config.h	comp-c-include		gcc,compat
 ./usr/include/g++/bits/sparc64			comp-c-include		compat
@@ -28,6 +28,7 @@
 ./usr/include/sparc/disklabel.h			comp-c-include
 ./usr/include/sparc/eeprom.h			comp-c-include
 ./usr/include/sparc/elf_machdep.h		comp-c-include
+./usr/include/sparc/elf_support.h		comp-c-include
 ./usr/include/sparc/endian.h			comp-c-include
 ./usr/include/sparc/endian_machdep.h		comp-c-include
 ./usr/include/sparc/fbio.h			comp-obsolete		obsolete
@@ -95,6 +96,7 @@
 ./usr/include/sparc64/disklabel.h		comp-c-include
 ./usr/include/sparc64/eeprom.h			comp-c-include
 ./usr/include/sparc64/elf_machdep.h		comp-c-include
+./usr/include/sparc64/elf_support.h		comp-c-include
 ./usr/include/sparc64/endian.h			comp-c-include
 ./usr/include/sparc64/endian_machdep.h		comp-c-include
 ./usr/include/sparc64/fbio.h			comp-obsolete		obsolete

Index: src/lib/csu/common/crt0-common.c
diff -u src/lib/csu/common/crt0-common.c:1.15 src/lib/csu/common/crt0-common.c:1.16
--- src/lib/csu/common/crt0-common.c:1.15	Fri Mar  9 20:20:47 2018
+++ src/lib/csu/common/crt0-common.c	Thu Mar 29 13:23:39 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: crt0-common.c,v 1.15 2018/03/09 20:20:47 joerg Exp $ */
+/* $NetBSD: crt0-common.c,v 1.16 2018/03/29 13:23:39 joerg Exp $ */
 
 /*
  * Copyright (c) 1998 Christos Zoulas
@@ -36,7 +36,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: crt0-common.c,v 1.15 2018/03/09 20:20:47 joerg Exp $");
+__RCSID("$NetBSD: crt0-common.c,v 1.16 2018/03/29 13:23:39 joerg Exp $");
 
 #in

CVS commit: src/distrib/sparc/miniroot

2018-03-29 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Mar 29 13:25:11 UTC 2018

Modified Files:
src/distrib/sparc/miniroot: Makefile.inc

Log Message:
Bump image size again for new bloat.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/distrib/sparc/miniroot/Makefile.inc

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

Modified files:

Index: src/distrib/sparc/miniroot/Makefile.inc
diff -u src/distrib/sparc/miniroot/Makefile.inc:1.28 src/distrib/sparc/miniroot/Makefile.inc:1.29
--- src/distrib/sparc/miniroot/Makefile.inc:1.28	Sun Jul 23 19:00:22 2017
+++ src/distrib/sparc/miniroot/Makefile.inc	Thu Mar 29 13:25:11 2018
@@ -1,6 +1,6 @@
-#	$NetBSD: Makefile.inc,v 1.28 2017/07/23 19:00:22 joerg Exp $
+#	$NetBSD: Makefile.inc,v 1.29 2018/03/29 13:25:11 joerg Exp $
 
-IMAGESIZE=	9700k
+IMAGESIZE=	9800k
 DBG=		${${ACTIVE_CC} == "clang":? -Oz -fomit-frame-pointer : -Os } -fno-unwind-tables
 
 MAKEFS_FLAGS+=   -o density=4k



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

2018-03-29 Thread Anders Magnusson
Module Name:src
Committed By:   ragge
Date:   Thu Mar 29 15:45:15 UTC 2018

Modified Files:
src/sys/arch/vax/conf: majors.vax

Log Message:
Use same major for rx floppies for both b and c devices.
Works around a bug in the mscp disk driver, and solves PR port-vax/26138.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/vax/conf/majors.vax

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/vax/conf/majors.vax
diff -u src/sys/arch/vax/conf/majors.vax:1.27 src/sys/arch/vax/conf/majors.vax:1.28
--- src/sys/arch/vax/conf/majors.vax:1.27	Thu Jun 22 17:51:22 2017
+++ src/sys/arch/vax/conf/majors.vax	Thu Mar 29 15:45:15 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: majors.vax,v 1.27 2017/06/22 17:51:22 flxd Exp $
+#	$NetBSD: majors.vax,v 1.28 2018/03/29 15:45:15 ragge Exp $
 #
 # Device majors for vax
 #
@@ -38,7 +38,7 @@ device-major	lpa		char 26			lpa
 device-major	ps		char 27			ps
 device-major	racd		char 28  block 28	racd
 device-major	ad		char 29			ad
-device-major	rx		char 30  block 12	rx
+device-major	rx		char 30  block 30	rx
 device-major	ik		char 31			ik
 device-major	rl		char 32  block 14	rl
 device-major	log		char 33



CVS commit: src/sys/arch

2018-03-29 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Mar 29 16:19:46 UTC 2018

Modified Files:
src/sys/arch/macppc/macppc: cpu.c
src/sys/arch/powerpc/oea: cpu_subr.c

Log Message:
fix build for 32bit non-bridge SMP kernels


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/macppc/macppc/cpu.c
cvs rdiff -u -r1.91 -r1.92 src/sys/arch/powerpc/oea/cpu_subr.c

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

Modified files:

Index: src/sys/arch/macppc/macppc/cpu.c
diff -u src/sys/arch/macppc/macppc/cpu.c:1.62 src/sys/arch/macppc/macppc/cpu.c:1.63
--- src/sys/arch/macppc/macppc/cpu.c:1.62	Thu Mar 22 21:28:58 2018
+++ src/sys/arch/macppc/macppc/cpu.c	Thu Mar 29 16:19:46 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.62 2018/03/22 21:28:58 macallan Exp $	*/
+/*	$NetBSD: cpu.c,v 1.63 2018/03/29 16:19:46 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2001 Tsubai Masanari.
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.62 2018/03/22 21:28:58 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.63 2018/03/29 16:19:46 macallan Exp $");
 
 #include "opt_ppcparam.h"
 #include "opt_multiprocessor.h"
@@ -209,7 +209,7 @@ md_setup_trampoline(volatile struct cpu_
 {
 #ifdef OPENPIC
 	if (openpic_base) {
-		uint32_t kl_base = oea_mapiodev(0x8000, 0x1000);
+		uint32_t kl_base = (uint32_t)oea_mapiodev(0x8000, 0x1000);
 		uint32_t gpio = kl_base + 0x5c;	/* XXX */
 		u_int node, off;
 		char cpupath[32];

Index: src/sys/arch/powerpc/oea/cpu_subr.c
diff -u src/sys/arch/powerpc/oea/cpu_subr.c:1.91 src/sys/arch/powerpc/oea/cpu_subr.c:1.92
--- src/sys/arch/powerpc/oea/cpu_subr.c:1.91	Thu Mar 22 15:18:06 2018
+++ src/sys/arch/powerpc/oea/cpu_subr.c	Thu Mar 29 16:19:46 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.91 2018/03/22 15:18:06 macallan Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.92 2018/03/29 16:19:46 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2001 Matt Thomas.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.91 2018/03/22 15:18:06 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.92 2018/03/29 16:19:46 macallan Exp $");
 
 #include "opt_ppcparam.h"
 #include "opt_ppccache.h"
@@ -1430,9 +1430,11 @@ cpu_hatch(void)
 		__asm ("mtdbatl 3,%0" :: "r"(h->hatch_dbatl[3]));
 	}
 
+#ifdef PPC_OEA64_BRIDGE
 	if ((oeacpufeat & OEACPU_64_BRIDGE) != 0) {
 		mtspr64(SPR_HID0, h->hatch_hid0);
 	} else
+#endif
 		mtspr(SPR_HID0, h->hatch_hid0);
 
 	if ((oeacpufeat & OEACPU_NOBAT) == 0) {



CVS commit: src/sys/netinet

2018-03-29 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Mar 29 16:54:59 UTC 2018

Modified Files:
src/sys/netinet: tcp_input.c

Log Message:
Simplify the computation:

  m->m_pkthdr.len -  sizeof(struct tcphdr) - optlen - hlen
= m->m_pkthdr.len - (sizeof(struct tcphdr) + optlen + hlen)
= m->m_pkthdr.len - [tcp_len]
= toff


To generate a diff of this commit:
cvs rdiff -u -r1.393 -r1.394 src/sys/netinet/tcp_input.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/netinet/tcp_input.c
diff -u src/sys/netinet/tcp_input.c:1.393 src/sys/netinet/tcp_input.c:1.394
--- src/sys/netinet/tcp_input.c:1.393	Wed Mar 28 14:43:55 2018
+++ src/sys/netinet/tcp_input.c	Thu Mar 29 16:54:59 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_input.c,v 1.393 2018/03/28 14:43:55 maxv Exp $	*/
+/*	$NetBSD: tcp_input.c,v 1.394 2018/03/29 16:54:59 maxv Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.393 2018/03/28 14:43:55 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.394 2018/03/29 16:54:59 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1774,7 +1774,7 @@ nosave:;
 			 * state for it.
 			 */
 			if (so->so_qlen <= so->so_qlimit &&
-			syn_cache_add(&src.sa, &dst.sa, th, tlen,
+			syn_cache_add(&src.sa, &dst.sa, th, toff,
 			so, m, optp, optlen, &opti))
 m = NULL;
 		}
@@ -4159,7 +4159,7 @@ syn_cache_unreach(const struct sockaddr 
  */
 int
 syn_cache_add(struct sockaddr *src, struct sockaddr *dst, struct tcphdr *th,
-unsigned int hlen, struct socket *so, struct mbuf *m, u_char *optp,
+unsigned int toff, struct socket *so, struct mbuf *m, u_char *optp,
 int optlen, struct tcp_opt_info *oi)
 {
 	struct tcpcb tb, *tp;
@@ -4189,8 +4189,7 @@ syn_cache_add(struct sockaddr *src, stru
 		tb.t_flags |= (tp->t_flags & TF_SIGNATURE);
 #endif
 		tb.t_state = TCPS_LISTEN;
-		if (tcp_dooptions(&tb, optp, optlen, th, m, m->m_pkthdr.len -
-		sizeof(struct tcphdr) - optlen - hlen, oi) < 0)
+		if (tcp_dooptions(&tb, optp, optlen, th, m, toff, oi) < 0)
 			return 0;
 	} else
 		tb.t_flags = 0;



CVS commit: src/sys/netinet

2018-03-29 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Mar 29 16:59:38 UTC 2018

Modified Files:
src/sys/netinet: tcp_input.c

Log Message:
Clarify with KASSERT.


To generate a diff of this commit:
cvs rdiff -u -r1.394 -r1.395 src/sys/netinet/tcp_input.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/netinet/tcp_input.c
diff -u src/sys/netinet/tcp_input.c:1.394 src/sys/netinet/tcp_input.c:1.395
--- src/sys/netinet/tcp_input.c:1.394	Thu Mar 29 16:54:59 2018
+++ src/sys/netinet/tcp_input.c	Thu Mar 29 16:59:38 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_input.c,v 1.394 2018/03/29 16:54:59 maxv Exp $	*/
+/*	$NetBSD: tcp_input.c,v 1.395 2018/03/29 16:59:38 maxv Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.394 2018/03/29 16:54:59 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.395 2018/03/29 16:59:38 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -2359,6 +2359,7 @@ after_listen:
 			 * and (if not RST) ack.
 			 */
 			if (tp->rcv_wnd == 0 && th->th_seq == tp->rcv_nxt) {
+KASSERT(todrop == tlen);
 tp->t_flags |= TF_ACKNOW;
 TCP_STATINC(TCP_STAT_RCVWINPROBE);
 			} else {



CVS commit: src/sys/netinet

2018-03-29 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Mar 29 17:01:46 UTC 2018

Modified Files:
src/sys/netinet: tcp_input.c

Log Message:
Remove 'else', makes it clearer that we leave.


To generate a diff of this commit:
cvs rdiff -u -r1.395 -r1.396 src/sys/netinet/tcp_input.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/netinet/tcp_input.c
diff -u src/sys/netinet/tcp_input.c:1.395 src/sys/netinet/tcp_input.c:1.396
--- src/sys/netinet/tcp_input.c:1.395	Thu Mar 29 16:59:38 2018
+++ src/sys/netinet/tcp_input.c	Thu Mar 29 17:01:46 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_input.c,v 1.395 2018/03/29 16:59:38 maxv Exp $	*/
+/*	$NetBSD: tcp_input.c,v 1.396 2018/03/29 17:01:46 maxv Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.395 2018/03/29 16:59:38 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.396 2018/03/29 17:01:46 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -2463,8 +2463,7 @@ after_listen:
 	if ((tiflags & TH_ACK) == 0) {
 		if (tp->t_flags & TF_ACKNOW)
 			goto dropafterack;
-		else
-			goto drop;
+		goto drop;
 	}
 
 	/*



CVS commit: src/sys/netinet

2018-03-29 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Mar 29 17:09:00 UTC 2018

Modified Files:
src/sys/netinet: tcp_input.c

Log Message:
Fix memory leak, we may reallocate 'tcp_saveti' after 'findpcb'. It's not
a tragic bug, because it happens only on sockets with debug enabled.


To generate a diff of this commit:
cvs rdiff -u -r1.396 -r1.397 src/sys/netinet/tcp_input.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/netinet/tcp_input.c
diff -u src/sys/netinet/tcp_input.c:1.396 src/sys/netinet/tcp_input.c:1.397
--- src/sys/netinet/tcp_input.c:1.396	Thu Mar 29 17:01:46 2018
+++ src/sys/netinet/tcp_input.c	Thu Mar 29 17:09:00 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_input.c,v 1.396 2018/03/29 17:01:46 maxv Exp $	*/
+/*	$NetBSD: tcp_input.c,v 1.397 2018/03/29 17:09:00 maxv Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.396 2018/03/29 17:01:46 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.397 2018/03/29 17:09:00 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -2348,6 +2348,8 @@ after_listen:
 			SEQ_GT(th->th_seq, tp->rcv_nxt)) {
 tp = tcp_close(tp);
 tcp_fields_to_net(th);
+m_freem(tcp_saveti);
+tcp_saveti = NULL;
 goto findpcb;
 			}
 



CVS commit: src/sys/netinet

2018-03-29 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Mar 29 17:12:36 UTC 2018

Modified Files:
src/sys/netinet: tcp_input.c

Log Message:
Remove two more 'else' branches.


To generate a diff of this commit:
cvs rdiff -u -r1.397 -r1.398 src/sys/netinet/tcp_input.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/netinet/tcp_input.c
diff -u src/sys/netinet/tcp_input.c:1.397 src/sys/netinet/tcp_input.c:1.398
--- src/sys/netinet/tcp_input.c:1.397	Thu Mar 29 17:09:00 2018
+++ src/sys/netinet/tcp_input.c	Thu Mar 29 17:12:36 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_input.c,v 1.397 2018/03/29 17:09:00 maxv Exp $	*/
+/*	$NetBSD: tcp_input.c,v 1.398 2018/03/29 17:12:36 maxv Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.397 2018/03/29 17:09:00 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.398 2018/03/29 17:12:36 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1142,8 +1142,7 @@ static void tcp_vtw_input(struct tcphdr 
 	if ((tiflags & TH_ACK) == 0) {
 		if (t_flags & TF_ACKNOW)
 			goto dropafterack;
-		else
-			goto drop;
+		goto drop;
 	}
 
 	/*
@@ -2539,8 +2538,8 @@ after_listen:
 	if (tp->t_congctl->fast_retransmit(tp, th)) {
 		/* False fast retransmit */
 		break;
-	} else
-		goto drop;
+	}
+	goto drop;
 } else if (tp->t_dupacks > tcprexmtthresh) {
 	tp->snd_cwnd += tp->t_segsz;
 	KERNEL_LOCK(1, NULL);



CVS commit: src/sys/netinet

2018-03-29 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Mar 29 17:46:17 UTC 2018

Modified Files:
src/sys/netinet: tcp_input.c

Log Message:
Reorder/Fix comments to clarify.


To generate a diff of this commit:
cvs rdiff -u -r1.398 -r1.399 src/sys/netinet/tcp_input.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/netinet/tcp_input.c
diff -u src/sys/netinet/tcp_input.c:1.398 src/sys/netinet/tcp_input.c:1.399
--- src/sys/netinet/tcp_input.c:1.398	Thu Mar 29 17:12:36 2018
+++ src/sys/netinet/tcp_input.c	Thu Mar 29 17:46:17 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_input.c,v 1.398 2018/03/29 17:12:36 maxv Exp $	*/
+/*	$NetBSD: tcp_input.c,v 1.399 2018/03/29 17:46:17 maxv Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.398 2018/03/29 17:12:36 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.399 2018/03/29 17:46:17 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -444,6 +444,11 @@ tcpipqent_free(struct ipqent *ipqe)
 	splx(s);
 }
 
+/*
+ * Insert segment ti into reassembly queue of tcp with
+ * control block tp.  Return TH_FIN if reassembly now includes
+ * a segment with FIN.
+ */
 static int
 tcp_reass(struct tcpcb *tp, const struct tcphdr *th, struct mbuf *m, int tlen)
 {
@@ -479,8 +484,8 @@ tcp_reass(struct tcpcb *tp, const struct
 
 	rcvoobyte = tlen;
 	/*
-	 * Copy these to local variables because the tcpiphdr
-	 * gets munged while we are collapsing mbufs.
+	 * Copy these to local variables because the TCP header gets munged
+	 * while we are collapsing mbufs.
 	 */
 	pkt_seq = th->th_seq;
 	pkt_len = tlen;
@@ -547,6 +552,7 @@ tcp_reass(struct tcpcb *tp, const struct
 #ifdef TCP_REASS_COUNTERS
 		count++;
 #endif
+
 		/*
 		 * If the received segment is just right after this
 		 * fragment, merge the two together and then check
@@ -567,14 +573,16 @@ tcp_reass(struct tcpcb *tp, const struct
 			TCP_REASS_COUNTER_INCR(&tcp_reass_append);
 			goto free_ipqe;
 		}
+
 		/*
 		 * If the received segment is completely past this
-		 * fragment, we need to go the next fragment.
+		 * fragment, we need to go to the next fragment.
 		 */
 		if (SEQ_LT(q->ipqe_seq + q->ipqe_len, pkt_seq)) {
 			p = q;
 			continue;
 		}
+
 		/*
 		 * If the fragment is past the received segment,
 		 * it (or any following) can't be concatenated.
@@ -586,7 +594,7 @@ tcp_reass(struct tcpcb *tp, const struct
 
 		/*
 		 * We've received all the data in this segment before.
-		 * mark it as a duplicate and return.
+		 * Mark it as a duplicate and return.
 		 */
 		if (SEQ_LEQ(q->ipqe_seq, pkt_seq) &&
 		SEQ_GEQ(q->ipqe_seq + q->ipqe_len, pkt_seq + pkt_len)) {
@@ -602,6 +610,7 @@ tcp_reass(struct tcpcb *tp, const struct
 			TCP_REASS_COUNTER_INCR(&tcp_reass_segdup);
 			goto out;
 		}
+
 		/*
 		 * Received segment completely overlaps this fragment
 		 * so we drop the fragment (this keeps the temporal
@@ -614,11 +623,11 @@ tcp_reass(struct tcpcb *tp, const struct
 			TCP_REASS_COUNTER_INCR(&tcp_reass_fragdup);
 			goto free_ipqe;
 		}
+
 		/*
-		 * RX'ed segment extends past the end of the
-		 * fragment.  Drop the overlapping bytes.  Then
-		 * merge the fragment and segment then treat as
-		 * a longer received packet.
+		 * Received segment extends past the end of the fragment.
+		 * Drop the overlapping bytes, merge the fragment and
+		 * segment, and treat as a longer received packet.
 		 */
 		if (SEQ_LT(q->ipqe_seq, pkt_seq) &&
 		SEQ_GT(q->ipqe_seq + q->ipqe_len, pkt_seq))  {
@@ -639,11 +648,12 @@ tcp_reass(struct tcpcb *tp, const struct
 			TCP_REASS_COUNTER_INCR(&tcp_reass_overlaptail);
 			goto free_ipqe;
 		}
+
 		/*
-		 * RX'ed segment extends past the front of the
-		 * fragment.  Drop the overlapping bytes on the
-		 * received packet.  The packet will then be
-		 * contatentated with this fragment a bit later.
+		 * Received segment extends past the front of the fragment.
+		 * Drop the overlapping bytes on the received packet. The
+		 * packet will then be concatenated with this fragment a
+		 * bit later.
 		 */
 		if (SEQ_GT(q->ipqe_seq, pkt_seq) &&
 		SEQ_LT(q->ipqe_seq, pkt_seq + pkt_len))  {
@@ -659,8 +669,9 @@ tcp_reass(struct tcpcb *tp, const struct
 			TCP_REASS_COUNTER_INCR(&tcp_reass_overlapfront);
 			rcvoobyte -= overlap;
 		}
+
 		/*
-		 * If the received segment immediates precedes this
+		 * If the received segment immediately precedes this
 		 * fragment then tack the fragment onto this segment
 		 * and reinsert the data.
 		 */
@@ -688,11 +699,12 @@ tcp_reass(struct tcpcb *tp, const struct
 			TCP_REASS_COUNTER_INCR(&tcp_reass_prepend);
 			break;
 		}
+
 		/*
 		 * If the fragment is before the segment, remember it.
 		 * When this loop is terminated, p will contain the
-		 * pointer to fragment that is right before the received
-		 * segment.
+		 * pointe

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

2018-03-29 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Mar 29 18:34:32 UTC 2018

Modified Files:
src/sys/arch/macppc/dev: snapper.c

Log Message:
explicitly enable the i2s part in the keylargo FCR
now this works on my PCI-X G5


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/macppc/dev/snapper.c

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

Modified files:

Index: src/sys/arch/macppc/dev/snapper.c
diff -u src/sys/arch/macppc/dev/snapper.c:1.45 src/sys/arch/macppc/dev/snapper.c:1.46
--- src/sys/arch/macppc/dev/snapper.c:1.45	Thu Mar 29 06:56:54 2018
+++ src/sys/arch/macppc/dev/snapper.c	Thu Mar 29 18:34:32 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: snapper.c,v 1.45 2018/03/29 06:56:54 macallan Exp $	*/
+/*	$NetBSD: snapper.c,v 1.46 2018/03/29 18:34:32 macallan Exp $	*/
 /*	Id: snapper.c,v 1.11 2002/10/31 17:42:13 tsubai Exp	*/
 /*	Id: i2s.c,v 1.12 2005/01/15 14:32:35 tsubai Exp		*/
 
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: snapper.c,v 1.45 2018/03/29 06:56:54 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: snapper.c,v 1.46 2018/03/29 18:34:32 macallan Exp $");
 
 #include 
 #include 
@@ -2064,13 +2064,17 @@ snapper_init(struct snapper_softc *sc, i
 {
 	int gpio;
 	int headphone_detect_intr;
-	uint32_t gpio_base, reg[1];
+	uint32_t gpio_base, reg[1], fcreg;
 #ifdef SNAPPER_DEBUG
 	char fcr[32];
 
 	snprintb(fcr, sizeof(fcr),  FCR3C_BITMASK, obio_read_4(KEYLARGO_FCR1));
 	printf("FCR(0x3c) %s\n", fcr);
 #endif
+	fcreg = obio_read_4(KEYLARGO_FCR1);
+	fcreg |= I2S0CLKEN | I2S0EN;
+	obio_write_4(KEYLARGO_FCR1, fcreg);
+
 	headphone_detect_intr = -1;
 
 	gpio = of_getnode_byname(OF_parent(node), "gpio");



CVS commit: src/sys

2018-03-29 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Mar 29 18:54:48 UTC 2018

Modified Files:
src/sys/arch/amd64/conf: ALL
src/sys/arch/i386/conf: ALL
src/sys/netinet: tcp_input.c tcp_subr.c

Log Message:
Remove TCPREASS_DEBUG. It was introduced 20 years ago when the reassembler
was being developed, but it's irrelevant today. Makes the code clearer.


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/sys/arch/amd64/conf/ALL
cvs rdiff -u -r1.435 -r1.436 src/sys/arch/i386/conf/ALL
cvs rdiff -u -r1.399 -r1.400 src/sys/netinet/tcp_input.c
cvs rdiff -u -r1.275 -r1.276 src/sys/netinet/tcp_subr.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/conf/ALL
diff -u src/sys/arch/amd64/conf/ALL:1.83 src/sys/arch/amd64/conf/ALL:1.84
--- src/sys/arch/amd64/conf/ALL:1.83	Fri Mar 16 12:48:54 2018
+++ src/sys/arch/amd64/conf/ALL	Thu Mar 29 18:54:48 2018
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.83 2018/03/16 12:48:54 maxv Exp $
+# $NetBSD: ALL,v 1.84 2018/03/29 18:54:48 maxv 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.83 $"
+#ident		"ALL-$Revision: 1.84 $"
 
 maxusers	64		# estimated number of users
 
@@ -2257,7 +2257,6 @@ options TC5165DEBUG
 options TCICDEBUG
 options TCICISADEBUG
 options TCPISS_DEBUG
-options TCPREASS_DEBUG
 options TCTRLDEBUG
 options TIMECOUNTER_DEBUG
 options TIMEKEEPER_DEBUG

Index: src/sys/arch/i386/conf/ALL
diff -u src/sys/arch/i386/conf/ALL:1.435 src/sys/arch/i386/conf/ALL:1.436
--- src/sys/arch/i386/conf/ALL:1.435	Fri Mar 16 12:48:54 2018
+++ src/sys/arch/i386/conf/ALL	Thu Mar 29 18:54:48 2018
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.435 2018/03/16 12:48:54 maxv Exp $
+# $NetBSD: ALL,v 1.436 2018/03/29 18:54:48 maxv 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.435 $"
+#ident		"ALL-$Revision: 1.436 $"
 
 maxusers	64		# estimated number of users
 
@@ -2403,7 +2403,6 @@ options TC5165DEBUG
 options TCICDEBUG
 options TCICISADEBUG
 options TCPISS_DEBUG
-options TCPREASS_DEBUG
 options TCTRLDEBUG
 options TIMECOUNTER_DEBUG
 options TIMEKEEPER_DEBUG

Index: src/sys/netinet/tcp_input.c
diff -u src/sys/netinet/tcp_input.c:1.399 src/sys/netinet/tcp_input.c:1.400
--- src/sys/netinet/tcp_input.c:1.399	Thu Mar 29 17:46:17 2018
+++ src/sys/netinet/tcp_input.c	Thu Mar 29 18:54:48 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_input.c,v 1.399 2018/03/29 17:46:17 maxv Exp $	*/
+/*	$NetBSD: tcp_input.c,v 1.400 2018/03/29 18:54:48 maxv Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.399 2018/03/29 17:46:17 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.400 2018/03/29 18:54:48 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -559,11 +559,6 @@ tcp_reass(struct tcpcb *tp, const struct
 		 * for further overlaps.
 		 */
 		if (q->ipqe_seq + q->ipqe_len == pkt_seq) {
-#ifdef TCPREASS_DEBUG
-			printf("tcp_reass[%p]: concat %u:%u(%u) to %u:%u(%u)\n",
-			   tp, pkt_seq, pkt_seq + pkt_len, pkt_len,
-			   q->ipqe_seq, q->ipqe_seq + q->ipqe_len, q->ipqe_len);
-#endif
 			pkt_len += q->ipqe_len;
 			pkt_flags |= q->ipqe_flags;
 			pkt_seq = q->ipqe_seq;
@@ -632,11 +627,6 @@ tcp_reass(struct tcpcb *tp, const struct
 		if (SEQ_LT(q->ipqe_seq, pkt_seq) &&
 		SEQ_GT(q->ipqe_seq + q->ipqe_len, pkt_seq))  {
 			int overlap = q->ipqe_seq + q->ipqe_len - pkt_seq;
-#ifdef TCPREASS_DEBUG
-			printf("tcp_reass[%p]: trim starting %d bytes of %u:%u(%u)\n",
-			   tp, overlap,
-			   pkt_seq, pkt_seq + pkt_len, pkt_len);
-#endif
 			m_adj(m, overlap);
 			rcvpartdupbyte += overlap;
 			m_cat(q->ipre_mlast, m);
@@ -658,11 +648,6 @@ tcp_reass(struct tcpcb *tp, const struct
 		if (SEQ_GT(q->ipqe_seq, pkt_seq) &&
 		SEQ_LT(q->ipqe_seq, pkt_seq + pkt_len))  {
 			int overlap = pkt_seq + pkt_len - q->ipqe_seq;
-#ifdef TCPREASS_DEBUG
-			printf("tcp_reass[%p]: trim trailing %d bytes of %u:%u(%u)\n",
-			   tp, overlap,
-			   pkt_seq, pkt_seq + pkt_len, pkt_len);
-#endif
 			m_adj(m, -overlap);
 			pkt_len -= overlap;
 			rcvpartdupbyte += overlap;
@@ -676,11 +661,6 @@ tcp_reass(struct tcpcb *tp, const struct
 		 * and reinsert the data.
 		 */
 		if (q->ipqe_seq == pkt_seq + pkt_len) {
-#ifdef TCPREASS_DEBUG
-			printf("tcp_reass[%p]: append %u:%u(%u) to %u:%u(%u)\n",
-			   tp, q->ipqe_seq, q->ipqe_seq + q->ipqe_len, q->ipqe_len,
-			   pkt_seq, pkt_seq + pkt_len, pkt_len);
-#endif
 			pkt_len += q->ipqe_len;
 			pkt_flag

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

2018-03-29 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Mar 29 19:11:17 UTC 2018

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

Log Message:
audio works now, so enable it


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/macppc/conf/POWERMAC_G5

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

Modified files:

Index: src/sys/arch/macppc/conf/POWERMAC_G5
diff -u src/sys/arch/macppc/conf/POWERMAC_G5:1.36 src/sys/arch/macppc/conf/POWERMAC_G5:1.37
--- src/sys/arch/macppc/conf/POWERMAC_G5:1.36	Fri Mar  9 20:19:25 2018
+++ src/sys/arch/macppc/conf/POWERMAC_G5	Thu Mar 29 19:11:17 2018
@@ -138,7 +138,7 @@ ppb*	at pci? dev ? function ?	# PCI-PCI 
 obio0		at pci? dev ? function ?
 zsc*		at obio?
 zstty*		at zsc? channel ?
-#snapper* 	at obio?
+snapper* 	at obio?
 ki2c*		at obio?	# Keywest I2C
 iic*		at i2cbus?
 
@@ -152,13 +152,13 @@ deq* 		at iic?
 pmu* 		at obio?	# Apple PMU
 
 # Audio support
-#audio*	at audiobus?
+audio*	at audiobus?
 
-#spkr*	at audio?		# PC speaker (synthesized)
-#wsbell* at spkr?
+spkr*	at audio?		# PC speaker (synthesized)
+wsbell* at spkr?
 
 gem*	at pci? dev ? function ?	# gmac ethernet
-options 	GEM_DEBUG
+#options 	GEM_DEBUG
 bge*	at pci? dev ? function ?	# borgcom ethernet
 bmtphy*	at mii? phy ?			# Broadcom BCM5201/BCM5202 PHYs
 brgphy*	at mii? phy ?			# Broadcom BCM5400 PHYs



CVS commit: src/sys/netinet

2018-03-29 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Thu Mar 29 21:40:53 UTC 2018

Modified Files:
src/sys/netinet: tcp_input.c

Log Message:
tcp_urp_drop: fix a bug introduced in 1.390 rev (hi maxv@).


To generate a diff of this commit:
cvs rdiff -u -r1.400 -r1.401 src/sys/netinet/tcp_input.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/netinet/tcp_input.c
diff -u src/sys/netinet/tcp_input.c:1.400 src/sys/netinet/tcp_input.c:1.401
--- src/sys/netinet/tcp_input.c:1.400	Thu Mar 29 18:54:48 2018
+++ src/sys/netinet/tcp_input.c	Thu Mar 29 21:40:53 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_input.c,v 1.400 2018/03/29 18:54:48 maxv Exp $	*/
+/*	$NetBSD: tcp_input.c,v 1.401 2018/03/29 21:40:53 rmind Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.400 2018/03/29 18:54:48 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.401 2018/03/29 21:40:53 rmind Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -340,7 +340,7 @@ tcp_fields_to_net(struct tcphdr *th)
 static void
 tcp_urp_drop(struct tcphdr *th, int todrop, int *tiflags)
 {
-	if (th->th_urp > 1) {
+	if (th->th_urp > todrop) {
 		th->th_urp -= todrop;
 	} else {
 		*tiflags &= ~TH_URG;



CVS commit: [pgoyette-compat] src/sys

2018-03-29 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Mar 29 23:23:03 UTC 2018

Modified Files:
src/sys/compat/common [pgoyette-compat]: Makefile.sysio files.common
src/sys/modules/compat_30 [pgoyette-compat]: Makefile
Added Files:
src/sys/compat/common [pgoyette-compat]: usb_subr_30.c
Removed Files:
src/sys/compat/common [pgoyette-compat]: usb_30_subr.c

Log Message:
Rename usb_30_subr.c --> usb_subr_30.c for consistency with others


To generate a diff of this commit:
cvs rdiff -u -r1.7.18.18 -r1.7.18.19 src/sys/compat/common/Makefile.sysio
cvs rdiff -u -r1.1.2.22 -r1.1.2.23 src/sys/compat/common/files.common
cvs rdiff -u -r1.1.2.1 -r0 src/sys/compat/common/usb_30_subr.c
cvs rdiff -u -r0 -r1.1.2.1 src/sys/compat/common/usb_subr_30.c
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/modules/compat_30/Makefile

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

Modified files:

Index: src/sys/compat/common/Makefile.sysio
diff -u src/sys/compat/common/Makefile.sysio:1.7.18.18 src/sys/compat/common/Makefile.sysio:1.7.18.19
--- src/sys/compat/common/Makefile.sysio:1.7.18.18	Wed Mar 28 07:51:09 2018
+++ src/sys/compat/common/Makefile.sysio	Thu Mar 29 23:23:03 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.sysio,v 1.7.18.18 2018/03/28 07:51:09 pgoyette Exp $
+#	$NetBSD: Makefile.sysio,v 1.7.18.19 2018/03/29 23:23:03 pgoyette Exp $
 
 # Sources for syscall and ioctl compatibility across the versions.
 
@@ -25,10 +25,11 @@ SRCS+=	kern_sig_16.c
 SRCS+=	rtsock_14.c
 
 # Compatibility code for NetBSD 2.0
-SRCS+=	vfs_syscalls_20.c
+SRCS+=	vfs_syscalls_20.c ieee80211_20.c if43_20.c
 
 # Compatibility code for NetBSD 3.0
 SRCS+=	kern_time_30.c vfs_syscalls_30.c uipc_syscalls_30.c bio_30.c vnd_30.c
+SRCS+=	usb_subr_30.c
 
 # Compatibility code for NetBSD 4.0
 SRCS+=	vfs_syscalls_40.c uipc_syscalls_40.c

Index: src/sys/compat/common/files.common
diff -u src/sys/compat/common/files.common:1.1.2.22 src/sys/compat/common/files.common:1.1.2.23
--- src/sys/compat/common/files.common:1.1.2.22	Thu Mar 29 11:20:02 2018
+++ src/sys/compat/common/files.common	Thu Mar 29 23:23:03 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.common,v 1.1.2.22 2018/03/29 11:20:02 pgoyette Exp $
+#	$NetBSD: files.common,v 1.1.2.23 2018/03/29 23:23:03 pgoyette Exp $
 
 #
 # Generic files, used by all compat options.
@@ -44,7 +44,10 @@ file	compat/common/rtsock_14.c		compat_1
 file	compat/common/kern_sig_16.c		compat_16
 
 # Compatibility code for NetBSD 2.0
+file	compat/common/compat_20_mod.c		compat_20
 file	compat/common/vfs_syscalls_20.c		compat_20
+file	compat_common/if43_20.c			compat_20
+file	compat_common/ieee80211_20.c		compat_20
 
 # Compatibility code for NetBSD 3.0
 file	compat/common/compat_30_mod.c		compat_30
@@ -53,7 +56,7 @@ file	compat/common/vfs_syscalls_30.c		co
 file	compat/common/uipc_syscalls_30.c	compat_30
 file	compat/common/bio_30.c			compat_30
 file	compat/common/vnd_30.c			compat_30
-file	compat/common/usb_30_subr.c		compat_30
+file	compat/common/usb_subr_30.c		compat_30
 
 # Compatibility code for NetBSD 4.0
 file	compat/common/compat_40_mod.c		compat_40

Index: src/sys/modules/compat_30/Makefile
diff -u src/sys/modules/compat_30/Makefile:1.1.2.2 src/sys/modules/compat_30/Makefile:1.1.2.3
--- src/sys/modules/compat_30/Makefile:1.1.2.2	Wed Mar 28 07:51:09 2018
+++ src/sys/modules/compat_30/Makefile	Thu Mar 29 23:23:03 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.1.2.2 2018/03/28 07:51:09 pgoyette Exp $
+#	$NetBSD: Makefile,v 1.1.2.3 2018/03/29 23:23:03 pgoyette Exp $
 
 .include "../Makefile.inc"
 
@@ -11,5 +11,6 @@ CPPFLAGS+=	-DCOMPAT_40 -DCOMPAT_50 -DCOM
 
 SRCS+=	compat_30_mod.c
 SRCS+=	vfs_syscalls_30.c uipc_syscalls_30.c kern_time_30.c bio_30.c vnd_30.c
+SRCS+=	usb_subr_30.c
 
 .include 

Added files:

Index: src/sys/compat/common/usb_subr_30.c
diff -u /dev/null src/sys/compat/common/usb_subr_30.c:1.1.2.1
--- /dev/null	Thu Mar 29 23:23:03 2018
+++ src/sys/compat/common/usb_subr_30.c	Thu Mar 29 23:23:03 2018
@@ -0,0 +1,243 @@
+/*	$NetBSD: usb_subr_30.c,v 1.1.2.1 2018/03/29 23:23:03 pgoyette Exp $	*/
+/*	$FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $	*/
+
+/*
+ * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Lennart Augustsson (lenn...@augustsson.net) at
+ * Carlstedt Research & Technology.
+ *
+ * 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 dist

CVS commit: [pgoyette-compat] src/distrib/sets/lists/modules

2018-03-29 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Mar 30 02:28:25 UTC 2018

Modified Files:
src/distrib/sets/lists/modules [pgoyette-compat]: mi

Log Message:
Add compat_20 module to sets lists


To generate a diff of this commit:
cvs rdiff -u -r1.114.2.8 -r1.114.2.9 src/distrib/sets/lists/modules/mi

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/modules/mi
diff -u src/distrib/sets/lists/modules/mi:1.114.2.8 src/distrib/sets/lists/modules/mi:1.114.2.9
--- src/distrib/sets/lists/modules/mi:1.114.2.8	Wed Mar 28 04:18:24 2018
+++ src/distrib/sets/lists/modules/mi	Fri Mar 30 02:28:25 2018
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.114.2.8 2018/03/28 04:18:24 pgoyette Exp $
+# $NetBSD: mi,v 1.114.2.9 2018/03/30 02:28:25 pgoyette Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -68,6 +68,8 @@
 ./@MODULEDIR@/coda5/coda5.kmod			base-kernel-modules	kmod
 ./@MODULEDIR@/compatbase-kernel-modules	kmod
 ./@MODULEDIR@/compat/compat.kmod		base-kernel-modules	kmod
+./@MODULEDIR@/compat_20base-kernel-modules	kmod
+./@MODULEDIR@/compat_20/compat_20.kmod		base-kernel-modules	kmod
 ./@MODULEDIR@/compat_30base-kernel-modules	kmod
 ./@MODULEDIR@/compat_30/compat_30.kmod		base-kernel-modules	kmod
 ./@MODULEDIR@/compat_40base-kernel-modules	kmod



CVS commit: [pgoyette-compat] src/sys

2018-03-29 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Mar 30 02:28:49 UTC 2018

Modified Files:
src/sys/compat/common [pgoyette-compat]: compat_mod.c compat_mod.h
files.common if_43.c vfs_syscalls_20.c
src/sys/kern [pgoyette-compat]: compat_stub.c
src/sys/modules [pgoyette-compat]: Makefile
src/sys/net80211 [pgoyette-compat]: ieee80211_ioctl.c ieee80211_ioctl.h
src/sys/sys [pgoyette-compat]: compat_stub.h
Added Files:
src/sys/compat/common [pgoyette-compat]: compat_20_mod.c ieee80211_20.c
if43_20.c

Log Message:
Create and build the compat_20 module


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1.2.1 src/sys/compat/common/compat_20_mod.c \
src/sys/compat/common/ieee80211_20.c src/sys/compat/common/if43_20.c
cvs rdiff -u -r1.24.14.23 -r1.24.14.24 src/sys/compat/common/compat_mod.c
cvs rdiff -u -r1.1.42.12 -r1.1.42.13 src/sys/compat/common/compat_mod.h
cvs rdiff -u -r1.1.2.23 -r1.1.2.24 src/sys/compat/common/files.common
cvs rdiff -u -r1.14 -r1.14.2.1 src/sys/compat/common/if_43.c
cvs rdiff -u -r1.40 -r1.40.10.1 src/sys/compat/common/vfs_syscalls_20.c
cvs rdiff -u -r1.1.2.11 -r1.1.2.12 src/sys/kern/compat_stub.c
cvs rdiff -u -r1.202.2.12 -r1.202.2.13 src/sys/modules/Makefile
cvs rdiff -u -r1.60.16.1 -r1.60.16.2 src/sys/net80211/ieee80211_ioctl.c
cvs rdiff -u -r1.23 -r1.23.16.1 src/sys/net80211/ieee80211_ioctl.h
cvs rdiff -u -r1.1.2.11 -r1.1.2.12 src/sys/sys/compat_stub.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/compat/common/compat_mod.c
diff -u src/sys/compat/common/compat_mod.c:1.24.14.23 src/sys/compat/common/compat_mod.c:1.24.14.24
--- src/sys/compat/common/compat_mod.c:1.24.14.23	Thu Mar 29 11:20:02 2018
+++ src/sys/compat/common/compat_mod.c	Fri Mar 30 02:28:49 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_mod.c,v 1.24.14.23 2018/03/29 11:20:02 pgoyette Exp $	*/
+/*	$NetBSD: compat_mod.c,v 1.24.14.24 2018/03/30 02:28:49 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.24.14.23 2018/03/29 11:20:02 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.24.14.24 2018/03/30 02:28:49 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -167,12 +167,6 @@ static const struct syscall_package comp
 #endif
 #endif
 
-#if defined(COMPAT_20)
-	{ SYS_compat_20_fhstatfs, 0, (sy_call_t *)compat_20_sys_fhstatfs },
-	{ SYS_compat_20_fstatfs, 0, (sy_call_t *)compat_20_sys_fstatfs },
-	{ SYS_compat_20_getfsstat, 0, (sy_call_t *)compat_20_sys_getfsstat },
-	{ SYS_compat_20_statfs, 0, (sy_call_t *)compat_20_sys_statfs },
-#endif
 	{ 0, 0, NULL },
 };
 
@@ -195,10 +189,10 @@ struct compat_init_fini {
 #ifdef COMPAT_30
 	{ compat_30_init, compat_30_fini },
 #endif
-#if 0	/* NOT YET */
 #ifdef COMPAT_20
 	{ compat_20_init, compat_20_fini },
 #endif
+#if 0	/* NOT YET */
 #ifdef COMPAT_16
 	{ compat_16_init, compat_16_fini },
 #endif

Index: src/sys/compat/common/compat_mod.h
diff -u src/sys/compat/common/compat_mod.h:1.1.42.12 src/sys/compat/common/compat_mod.h:1.1.42.13
--- src/sys/compat/common/compat_mod.h:1.1.42.12	Thu Mar 29 11:20:02 2018
+++ src/sys/compat/common/compat_mod.h	Fri Mar 30 02:28:49 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_mod.h,v 1.1.42.12 2018/03/29 11:20:02 pgoyette Exp $	*/
+/*	$NetBSD: compat_mod.h,v 1.1.42.13 2018/03/30 02:28:49 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -105,4 +105,15 @@ void usb_30_init(void);
 void usb_30_fini(void);
 #endif
 
+#ifdef COMPAT_20
+int compat_20_init(void);
+int compat_20_fini(void);
+int vfs_syscalls_20_init(void);
+int vfs_syscalls_20_fini(void);
+void ieee80211_20_init(void);
+void ieee80211_20_fini(void);
+void if43_20_init(void);
+void if43_20_fini(void);
+#endif
+
 #endif /* !_COMPAT_MOD_H_ */

Index: src/sys/compat/common/files.common
diff -u src/sys/compat/common/files.common:1.1.2.23 src/sys/compat/common/files.common:1.1.2.24
--- src/sys/compat/common/files.common:1.1.2.23	Thu Mar 29 23:23:03 2018
+++ src/sys/compat/common/files.common	Fri Mar 30 02:28:49 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.common,v 1.1.2.23 2018/03/29 23:23:03 pgoyette Exp $
+#	$NetBSD: files.common,v 1.1.2.24 2018/03/30 02:28:49 pgoyette Exp $
 
 #
 # Generic files, used by all compat options.
@@ -46,8 +46,8 @@ file	compat/common/kern_sig_16.c		compat
 # Compatibility code for NetBSD 2.0
 file	compat/common/compat_20_mod.c		compat_20
 file	compat/common/vfs_syscalls_20.c		compat_20
-file	compat_common/if43_20.c			compat_20
-file	compat_common/ieee80211_20.c		compat_20
+file	compat/common/if43_20.c			compat_20
+file	compat/common/ieee80211_20.c		compat_20
 
 # Compatibility code for NetBSD 3.0
 file	compat/common/compat_30_mod.c		compat_30

Index: src/sys/compat/common/if_43.c
diff -u src/sys/compat/common/if_43.c:1.14 sr

CVS commit: [pgoyette-compat] src/sys/compat/common

2018-03-29 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Mar 30 02:52:06 UTC 2018

Modified Files:
src/sys/compat/common [pgoyette-compat]: compat_mod.c

Log Message:
Add compat_20 to the list of aliases


To generate a diff of this commit:
cvs rdiff -u -r1.24.14.24 -r1.24.14.25 src/sys/compat/common/compat_mod.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/compat/common/compat_mod.c
diff -u src/sys/compat/common/compat_mod.c:1.24.14.24 src/sys/compat/common/compat_mod.c:1.24.14.25
--- src/sys/compat/common/compat_mod.c:1.24.14.24	Fri Mar 30 02:28:49 2018
+++ src/sys/compat/common/compat_mod.c	Fri Mar 30 02:52:06 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_mod.c,v 1.24.14.24 2018/03/30 02:28:49 pgoyette Exp $	*/
+/*	$NetBSD: compat_mod.c,v 1.24.14.25 2018/03/30 02:52:06 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.24.14.24 2018/03/30 02:28:49 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.24.14.25 2018/03/30 02:52:06 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -78,7 +78,7 @@ static struct sysctllog *compat_clog = N
 
 static const char * const compat_includes[] = {
 	"compat_80", "compat_70", "compat_60", "compat_50", "compat_40",
-	"compat_30",
+	"compat_30","compat_20",
 	NULL
 };
 



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

2018-03-29 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Fri Mar 30 03:56:38 UTC 2018

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

Log Message:
Fix the problem between eitr and link_speed.

In ixgbe_msix_que(), que->eitr_setting is limited to IXGBE_MIN_RSC_EITR_10G1G
when link_speed is 1Gbps or 10Gbps. However, que->eitr_setting is set to EITR
register in the *next* Tx/Rx interrupt. If link_speed changes from 100Mbps to
1Gbps ro 10Gbps, que->eitr_setting which is not limited can be set to EITR
register, that is, the problem fixed by ixgbe.c:r1.124 can occur in this case.

To fix this case, que->eitr_setting should be clear when link_speed is changed
or link state is changed.

Furthermore, expand the variants used for AIM (txr->bytes, txr->packets,
rxr->bytes and rxr->packets) from u32 to u64 to avoid wraparound which causes
que->eitr_setting calculation mistake.

XXX pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.137 -r1.138 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/pci/ixgbe/ixgbe.h

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

Modified files:

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.137 src/sys/dev/pci/ixgbe/ixgbe.c:1.138
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.137	Mon Mar 26 06:40:28 2018
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Fri Mar 30 03:56:38 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.137 2018/03/26 06:40:28 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.138 2018/03/30 03:56:38 knakahara Exp $ */
 
 /**
 
@@ -4012,6 +4012,13 @@ ixgbe_configure_ivars(struct adapter *ad
 		ixgbe_set_ivar(adapter, txr->me, que->msix, 1);
 		/* Set an Initial EITR value */
 		ixgbe_eitr_write(que, newitr);
+		/*
+		 * To eliminate influence of the previous state.
+		 * At this point, Tx/Rx interrupt handler
+		 * (ixgbe_msix_que()) cannot be called, so  both
+		 * IXGBE_TX_LOCK and IXGBE_RX_LOCK are not required.
+		 */
+		que->eitr_setting = 0;
 	}
 
 	/* For the Link interrupt */
@@ -4509,6 +4516,14 @@ ixgbe_update_link_status(struct adapter 
 
 	if (adapter->link_up) {
 		if (adapter->link_active == FALSE) {
+			/*
+			 * To eliminate influence of the previous state
+			 * in the same way as ixgbe_init_locked().
+			 */
+			struct ix_queue	*que = adapter->queues;
+			for (int i = 0; i < adapter->num_queues; i++, que++)
+que->eitr_setting = 0;
+
 			if (adapter->link_speed == IXGBE_LINK_SPEED_10GB_FULL){
 /*
  *  Discard count for both MAC Local Fault and

Index: src/sys/dev/pci/ixgbe/ixgbe.h
diff -u src/sys/dev/pci/ixgbe/ixgbe.h:1.37 src/sys/dev/pci/ixgbe/ixgbe.h:1.38
--- src/sys/dev/pci/ixgbe/ixgbe.h:1.37	Mon Mar 26 06:40:28 2018
+++ src/sys/dev/pci/ixgbe/ixgbe.h	Fri Mar 30 03:56:38 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.h,v 1.37 2018/03/26 06:40:28 msaitoh Exp $ */
+/* $NetBSD: ixgbe.h,v 1.38 2018/03/30 03:56:38 knakahara Exp $ */
 
 /**
   SPDX-License-Identifier: BSD-3-Clause
@@ -370,8 +370,8 @@ struct tx_ring {
 	u16			atr_sample;
 	u16			atr_count;
 
-	u32			bytes;  /* used for AIM */
-	u32			packets;
+	u64			bytes;  /* used for AIM */
+	u64			packets;
 	/* Soft Stats */
 	struct evcnt	   	tso_tx;
 	struct evcnt		no_desc_avail;
@@ -413,8 +413,8 @@ struct rx_ring {
 	struct ixgbe_rx_buf	*rx_buffers;
 	ixgbe_dma_tag_t		*ptag;
 
-	u32			bytes; /* Used for AIM calc */
-	u32			packets;
+	u64			bytes; /* Used for AIM calc */
+	u64			packets;
 
 	/* Soft stats */
 	struct evcnt		rx_copies;



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

2018-03-29 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Fri Mar 30 03:58:20 UTC 2018

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

Log Message:
Don't write EIMC directly. It is required to manage with struct ix_queue status.

XXX pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.138 -r1.139 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/pci/ixgbe/ixgbe_api.h
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/pci/ixgbe/ixgbe_common.c
cvs rdiff -u -r1.89 -r1.90 src/sys/dev/pci/ixgbe/ixv.c

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

Modified files:

Index: src/sys/dev/pci/ixgbe/ix_txrx.c
diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.36 src/sys/dev/pci/ixgbe/ix_txrx.c:1.37
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.36	Thu Mar 15 06:48:51 2018
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Fri Mar 30 03:58:20 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.36 2018/03/15 06:48:51 msaitoh Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.37 2018/03/30 03:58:20 knakahara Exp $ */
 
 /**
 
@@ -2298,8 +2298,8 @@ ixgbe_allocate_queues(struct adapter *ad
 		que->txr = &adapter->tx_rings[i];
 		que->rxr = &adapter->rx_rings[i];
 
-		mutex_init(&que->im_mtx, MUTEX_DEFAULT, IPL_NET);
-		que->im_nest = 0;
+		mutex_init(&que->dc_mtx, MUTEX_DEFAULT, IPL_NET);
+		que->disabled_count = 0;
 	}
 
 	return (0);

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.138 src/sys/dev/pci/ixgbe/ixgbe.c:1.139
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.138	Fri Mar 30 03:56:38 2018
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Fri Mar 30 03:58:20 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.138 2018/03/30 03:56:38 knakahara Exp $ */
+/* $NetBSD: ixgbe.c,v 1.139 2018/03/30 03:58:20 knakahara Exp $ */
 
 /**
 
@@ -2410,8 +2410,8 @@ ixgbe_enable_queue(struct adapter *adapt
 	u64 queue = (u64)(1ULL << vector);
 	u32 mask;
 
-	mutex_enter(&que->im_mtx);
-	if (que->im_nest > 0 && --que->im_nest > 0)
+	mutex_enter(&que->dc_mtx);
+	if (que->disabled_count > 0 && --que->disabled_count > 0)
 		goto out;
 
 	if (hw->mac.type == ixgbe_mac_82598EB) {
@@ -2426,23 +2426,28 @@ ixgbe_enable_queue(struct adapter *adapt
 			IXGBE_WRITE_REG(hw, IXGBE_EIMS_EX(1), mask);
 	}
 out:
-	mutex_exit(&que->im_mtx);
+	mutex_exit(&que->dc_mtx);
 } /* ixgbe_enable_queue */
 
 /
- * ixgbe_disable_queue
+ * ixgbe_disable_queue_internal
  /
 static inline void
-ixgbe_disable_queue(struct adapter *adapter, u32 vector)
+ixgbe_disable_queue_internal(struct adapter *adapter, u32 vector, bool nestok)
 {
 	struct ixgbe_hw *hw = &adapter->hw;
 	struct ix_queue *que = &adapter->queues[vector];
 	u64 queue = (u64)(1ULL << vector);
 	u32 mask;
 
-	mutex_enter(&que->im_mtx);
-	if (que->im_nest++ > 0)
-		goto  out;
+	mutex_enter(&que->dc_mtx);
+
+	if (que->disabled_count > 0) {
+		if (nestok)
+			que->disabled_count++;
+		goto out;
+	}
+	que->disabled_count++;
 
 	if (hw->mac.type == ixgbe_mac_82598EB) {
 		mask = (IXGBE_EIMS_RTX_QUEUE & queue);
@@ -2456,7 +2461,17 @@ ixgbe_disable_queue(struct adapter *adap
 			IXGBE_WRITE_REG(hw, IXGBE_EIMC_EX(1), mask);
 	}
 out:
-	mutex_exit(&que->im_mtx);
+	mutex_exit(&que->dc_mtx);
+} /* ixgbe_disable_queue_internal */
+
+/
+ * ixgbe_disable_queue
+ /
+static inline void
+ixgbe_disable_queue(struct adapter *adapter, u32 vector)
+{
+
+	ixgbe_disable_queue_internal(adapter, vector, true);
 } /* ixgbe_disable_queue */
 
 /
@@ -3511,7 +3526,7 @@ ixgbe_detach(device_t dev, int flags)
 	ixgbe_free_receive_structures(adapter);
 	for (int i = 0; i < adapter->num_queues; i++) {
 		struct ix_queue * que = &adapter->queues[i];
-		mutex_destroy(&que->im_mtx);
+		mutex_destroy(&que->dc_mtx);
 	}
 	free(adapter->queues, M_DEVBUF);
 	free(adapter->mta, M_DEVBUF);
@@ -4295,11 +4310,11 @@ ixgbe_local_timer1(void *arg)
 	else if (queues != 0) { /* Force an IRQ on queues with work */
 		que = adapter->queues;
 		for (i = 0; i < adapter->num_queues; i++, que++) {
-			mutex_enter(&que->im_mtx);
-			if (que->im_nest == 0)
+			mutex_enter(&que->dc_mtx);
+			if (que->disabled_count == 0)
 ixgbe_rearm_queues(adapter,
 queues & ((u64)1 << i));
-			mutex_exit(&que->im_mtx);
+			mutex_exit(&que->dc_mtx);
 		}
 	}
 
@@ -4697,10 +4712,10 @@ ixgbe_enable_int

CVS commit: [pgoyette-compat] src

2018-03-29 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Mar 30 05:35:47 UTC 2018

Modified Files:
src/distrib/sets/lists/modules [pgoyette-compat]: mi
src/sys/compat/common [pgoyette-compat]: compat_mod.c compat_mod.h
files.common kern_sig_16.c
src/sys/modules [pgoyette-compat]: Makefile
Added Files:
src/sys/compat/common [pgoyette-compat]: compat_16_mod.c

Log Message:
Create and build a compat_16 module


To generate a diff of this commit:
cvs rdiff -u -r1.114.2.9 -r1.114.2.10 src/distrib/sets/lists/modules/mi
cvs rdiff -u -r0 -r1.1.2.1 src/sys/compat/common/compat_16_mod.c
cvs rdiff -u -r1.24.14.25 -r1.24.14.26 src/sys/compat/common/compat_mod.c
cvs rdiff -u -r1.1.42.13 -r1.1.42.14 src/sys/compat/common/compat_mod.h
cvs rdiff -u -r1.1.2.24 -r1.1.2.25 src/sys/compat/common/files.common
cvs rdiff -u -r1.2 -r1.2.38.1 src/sys/compat/common/kern_sig_16.c
cvs rdiff -u -r1.202.2.13 -r1.202.2.14 src/sys/modules/Makefile

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/modules/mi
diff -u src/distrib/sets/lists/modules/mi:1.114.2.9 src/distrib/sets/lists/modules/mi:1.114.2.10
--- src/distrib/sets/lists/modules/mi:1.114.2.9	Fri Mar 30 02:28:25 2018
+++ src/distrib/sets/lists/modules/mi	Fri Mar 30 05:35:47 2018
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.114.2.9 2018/03/30 02:28:25 pgoyette Exp $
+# $NetBSD: mi,v 1.114.2.10 2018/03/30 05:35:47 pgoyette Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -68,6 +68,8 @@
 ./@MODULEDIR@/coda5/coda5.kmod			base-kernel-modules	kmod
 ./@MODULEDIR@/compatbase-kernel-modules	kmod
 ./@MODULEDIR@/compat/compat.kmod		base-kernel-modules	kmod
+./@MODULEDIR@/compat_16base-kernel-modules	kmod
+./@MODULEDIR@/compat_16/compat_16.kmod		base-kernel-modules	kmod
 ./@MODULEDIR@/compat_20base-kernel-modules	kmod
 ./@MODULEDIR@/compat_20/compat_20.kmod		base-kernel-modules	kmod
 ./@MODULEDIR@/compat_30base-kernel-modules	kmod

Index: src/sys/compat/common/compat_mod.c
diff -u src/sys/compat/common/compat_mod.c:1.24.14.25 src/sys/compat/common/compat_mod.c:1.24.14.26
--- src/sys/compat/common/compat_mod.c:1.24.14.25	Fri Mar 30 02:52:06 2018
+++ src/sys/compat/common/compat_mod.c	Fri Mar 30 05:35:47 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_mod.c,v 1.24.14.25 2018/03/30 02:52:06 pgoyette Exp $	*/
+/*	$NetBSD: compat_mod.c,v 1.24.14.26 2018/03/30 05:35:47 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.24.14.25 2018/03/30 02:52:06 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.24.14.26 2018/03/30 05:35:47 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -78,24 +78,13 @@ static struct sysctllog *compat_clog = N
 
 static const char * const compat_includes[] = {
 	"compat_80", "compat_70", "compat_60", "compat_50", "compat_40",
-	"compat_30","compat_20",
+	"compat_30", "compat_20",
 	NULL
 };
 
 MODULE_WITH_ALIASES(MODULE_CLASS_EXEC, compat, NULL, &compat_includes);
 
 
-#ifdef _MODULE
-#ifdef COMPAT_16
-#if !defined(__amd64__) || defined(COMPAT_NETBSD32)
-#define COMPAT_SIGCONTEXT
-extern char sigcode[], esigcode[];
-struct uvm_object *emul_netbsd_object;
-#endif
-#endif
-#endif /* _MODULE */
-
-extern krwlock_t exec_lock;
 extern krwlock_t ttcompat_lock;
 
 static const struct syscall_package compat_syscalls[] = {
@@ -160,13 +149,6 @@ static const struct syscall_package comp
 	{ SYS_compat_13_sigsuspend13, 0, (sy_call_t *)compat_13_sys_sigsuspend },
 #endif
 
-#if defined(COMPAT_16)
-#if defined(COMPAT_SIGCONTEXT)
-	{ SYS_compat_16___sigaction14, 0, (sy_call_t *)compat_16_sys___sigaction14 },
-	{ SYS_compat_16___sigreturn14, 0, (sy_call_t *)compat_16_sys___sigreturn14 },
-#endif
-#endif
-
 	{ 0, 0, NULL },
 };
 
@@ -192,10 +174,10 @@ struct compat_init_fini {
 #ifdef COMPAT_20
 	{ compat_20_init, compat_20_fini },
 #endif
-#if 0	/* NOT YET */
 #ifdef COMPAT_16
 	{ compat_16_init, compat_16_fini },
 #endif
+#if 0	/* NOT YET */
 #ifdef COMPAT_14
 	{ compat_14_init, compat_14_fini },
 #endif
@@ -220,9 +202,6 @@ struct compat_init_fini {
 static int
 compat_modcmd(modcmd_t cmd, void *arg)
 {
-#ifdef COMPAT_16
-	proc_t *p;
-#endif
 	int error;
 	int i, j;
 
@@ -266,18 +245,6 @@ compat_modcmd(modcmd_t cmd, void *arg)
 #ifdef COMPAT_13
 		uvm_13_init();
 #endif
-#ifdef COMPAT_16
-#if defined(COMPAT_SIGCONTEXT)
-		KASSERT(emul_netbsd.e_sigobject == NULL);
-		rw_enter(&exec_lock, RW_WRITER);
-		emul_netbsd.e_sigcode = sigcode;
-		emul_netbsd.e_esigcode = esigcode;
-		emul_netbsd.e_sigobject = &emul_netbsd_object;
-		rw_exit(&exec_lock);
-		KASSERT(sendsig_sigcontext_vec == NULL);
-		sendsig_sigcontext_vec = sendsig_sigcontext;
-#endif
-#endif
 #ifdef COMPAT_10
 		vfs_syscalls_10_init();
 #endif
@@ -291,25 +258,6 @@ compat_modcmd(modcmd_t cmd, vo

CVS commit: [pgoyette-compat] src/sys/modules/compat_16

2018-03-29 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Mar 30 05:38:26 UTC 2018

Added Files:
src/sys/modules/compat_16 [pgoyette-compat]: Makefile

Log Message:
Forgot a file!


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1.2.1 src/sys/modules/compat_16/Makefile

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

Added files:

Index: src/sys/modules/compat_16/Makefile
diff -u /dev/null src/sys/modules/compat_16/Makefile:1.1.2.1
--- /dev/null	Fri Mar 30 05:38:26 2018
+++ src/sys/modules/compat_16/Makefile	Fri Mar 30 05:38:26 2018
@@ -0,0 +1,15 @@
+#	$NetBSD: Makefile,v 1.1.2.1 2018/03/30 05:38:26 pgoyette Exp $
+
+.include "../Makefile.inc"
+
+.PATH:	${S}/compat/common
+
+KMOD=	compat_16
+
+CPPFLAGS+=	-DCOMPAT_16 -DCOMPAT_20 -DCOMPAT_30
+CPPFLAGS+=	-DCOMPAT_40 -DCOMPAT_50 -DCOMPAT_60 -DCOMPAT_70 -DCOMPAT_80
+
+SRCS+=	compat_16_mod.c
+SRCS+=	kern_sig_16.c
+
+.include 



CVS commit: [pgoyette-compat] src/sys/compat/common

2018-03-29 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Mar 30 06:34:01 UTC 2018

Modified Files:
src/sys/compat/common [pgoyette-compat]: files.common

Log Message:
typo in version dependency


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.25 -r1.1.2.26 src/sys/compat/common/files.common

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

Modified files:

Index: src/sys/compat/common/files.common
diff -u src/sys/compat/common/files.common:1.1.2.25 src/sys/compat/common/files.common:1.1.2.26
--- src/sys/compat/common/files.common:1.1.2.25	Fri Mar 30 05:35:47 2018
+++ src/sys/compat/common/files.common	Fri Mar 30 06:34:00 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.common,v 1.1.2.25 2018/03/30 05:35:47 pgoyette Exp $
+#	$NetBSD: files.common,v 1.1.2.26 2018/03/30 06:34:00 pgoyette Exp $
 
 #
 # Generic files, used by all compat options.
@@ -41,7 +41,7 @@ file	compat/common/uvm_13.c			compat_13
 file	compat/common/rtsock_14.c		compat_14
 
 # Compatibility code for NetBSD 1.6
-file	compat/common/compat_16_mod.c		compat_20
+file	compat/common/compat_16_mod.c		compat_16
 file	compat/common/kern_sig_16.c		compat_16
 
 # Compatibility code for NetBSD 2.0



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

2018-03-29 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Mar 30 06:44:30 UTC 2018

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

Log Message:
-  Add missing IFM_NONE support. If a interface support linkdown,
  "ifconfig ixgN media none" drpos link.  Not all interface can do link down.

 Tested:
82598 AT2 (T)
92599 SF+(SFI) (X520-DA2)
X540
X550-T1
X550EM_x (X10SDV-8C-TLN4F)
X550EM_a (A2SDi-H-TP4F port 0, 1 (T))

 Doesn't work:
X550EM_a (A2SDi-H-TP4F port 2, 3 (SFP+ (KR)))
X550EM_a (MA10-ST0 port 2, 3 (SFP+ (SFI)))
(Denverton SFP+ can't force link down because SFP+'s TX_DISABLE pin is
pull down. Is there a way to shutdown SFP+ cage's power?)
 Not tested:
82598 fiber.

- Change some functions static.


To generate a diff of this commit:
cvs rdiff -u -r1.139 -r1.140 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/pci/ixgbe/ixgbe_82599.c
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/pci/ixgbe/ixgbe_common.c
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/pci/ixgbe/ixgbe_common.h
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/pci/ixgbe/ixgbe_x550.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/ixgbe/ixgbe_x550.h

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

Modified files:

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.139 src/sys/dev/pci/ixgbe/ixgbe.c:1.140
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.139	Fri Mar 30 03:58:20 2018
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Fri Mar 30 06:44:30 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.139 2018/03/30 03:58:20 knakahara Exp $ */
+/* $NetBSD: ixgbe.c,v 1.140 2018/03/30 06:44:30 msaitoh Exp $ */
 
 /**
 
@@ -1378,6 +1378,8 @@ ixgbe_add_media_types(struct adapter *ad
 #define	ADD(mm, dd)			\
 	ifmedia_add(&adapter->media, IFM_ETHER | (mm), (dd), NULL);
 
+	ADD(IFM_NONE, 0);
+
 	/* Media types with matching NetBSD media defines */
 	if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_T) {
 		ADD(IFM_10G_T | IFM_FDX, 0);
@@ -2829,6 +2831,8 @@ ixgbe_media_change(struct ifnet *ifp)
 	case IFM_10_T:
 		speed |= IXGBE_LINK_SPEED_10_FULL;
 		break;
+	case IFM_NONE:
+		break;
 	default:
 		goto invalid;
 	}

Index: src/sys/dev/pci/ixgbe/ixgbe_82599.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_82599.c:1.16 src/sys/dev/pci/ixgbe/ixgbe_82599.c:1.17
--- src/sys/dev/pci/ixgbe/ixgbe_82599.c:1.16	Wed Dec  6 04:08:50 2017
+++ src/sys/dev/pci/ixgbe/ixgbe_82599.c	Fri Mar 30 06:44:30 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_82599.c,v 1.16 2017/12/06 04:08:50 msaitoh Exp $ */
+/* $NetBSD: ixgbe_82599.c,v 1.17 2018/03/30 06:44:30 msaitoh Exp $ */
 
 /**
   SPDX-License-Identifier: BSD-3-Clause
@@ -56,6 +56,7 @@ static s32 ixgbe_read_eeprom_82599(struc
    u16 offset, u16 *data);
 static s32 ixgbe_read_eeprom_buffer_82599(struct ixgbe_hw *hw, u16 offset,
 	  u16 words, u16 *data);
+static s32 ixgbe_reset_pipeline_82599(struct ixgbe_hw *hw);
 static s32 ixgbe_read_i2c_byte_82599(struct ixgbe_hw *hw, u8 byte_offset,
 	u8 dev_addr, u8 *data);
 static s32 ixgbe_write_i2c_byte_82599(struct ixgbe_hw *hw, u8 byte_offset,
@@ -914,9 +915,13 @@ s32 ixgbe_setup_mac_link_82599(struct ix
 
 	speed &= link_capabilities;
 
-	if (speed == IXGBE_LINK_SPEED_UNKNOWN) {
-		status = IXGBE_ERR_LINK_SETUP;
-		goto out;
+	if (speed == 0) {
+		ixgbe_disable_tx_laser(hw); /* For fiber */
+		ixgbe_set_phy_power(hw, false); /* For copper */
+	} else {
+		/* In case previous media setting was none(down) */
+		ixgbe_enable_tx_laser(hw); /* for Fiber */
+		ixgbe_set_phy_power(hw, true); /* For copper */
 	}
 
 	/* Use stored value (EEPROM defaults) of AUTOC to find KR/KX4 support*/
@@ -2475,7 +2480,7 @@ static s32 ixgbe_read_eeprom_82599(struc
  * Reset pipeline by asserting Restart_AN together with LMS change to ensure
  * full pipeline reset.  This function assumes the SW/FW lock is held.
  **/
-s32 ixgbe_reset_pipeline_82599(struct ixgbe_hw *hw)
+static s32 ixgbe_reset_pipeline_82599(struct ixgbe_hw *hw)
 {
 	s32 ret_val;
 	u32 anlp1_reg = 0;

Index: src/sys/dev/pci/ixgbe/ixgbe_common.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_common.c:1.19 src/sys/dev/pci/ixgbe/ixgbe_common.c:1.20
--- src/sys/dev/pci/ixgbe/ixgbe_common.c:1.19	Fri Mar 30 03:58:20 2018
+++ src/sys/dev/pci/ixgbe/ixgbe_common.c	Fri Mar 30 06:44:30 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_common.c,v 1.19 2018/03/30 03:58:20 knakahara Exp $ */
+/* $NetBSD: ixgbe_common.c,v 1.20 2018/03/30 06:44:30 msaitoh Exp $ */
 
 /**
   SPDX-License-Identifier: BSD-3-Clause
@@ -5427,6 +5427,13 @@ s32 ixgbe_setup_mac_link_multispeed_fibe
 			goto out;
 	}
 
+	if (speed == 0) {
+		/* Disable the Tx