CVS commit: src/sys/arch/sparc64/sparc64

2016-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Apr 17 14:32:03 UTC 2016

Modified Files:
src/sys/arch/sparc64/sparc64: cpu.c pmap.c

Log Message:
Move the SMP-disabled hack for SUN4V a bit earlier


To generate a diff of this commit:
cvs rdiff -u -r1.127 -r1.128 src/sys/arch/sparc64/sparc64/cpu.c
cvs rdiff -u -r1.301 -r1.302 src/sys/arch/sparc64/sparc64/pmap.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/sparc64/sparc64/cpu.c
diff -u src/sys/arch/sparc64/sparc64/cpu.c:1.127 src/sys/arch/sparc64/sparc64/cpu.c:1.128
--- src/sys/arch/sparc64/sparc64/cpu.c:1.127	Sun Sep  6 23:48:39 2015
+++ src/sys/arch/sparc64/sparc64/cpu.c	Sun Apr 17 14:32:03 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.127 2015/09/06 23:48:39 nakayama Exp $ */
+/*	$NetBSD: cpu.c,v 1.128 2016/04/17 14:32:03 martin Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -52,7 +52,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.127 2015/09/06 23:48:39 nakayama Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.128 2016/04/17 14:32:03 martin Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -670,10 +670,6 @@ cpu_boot_secondary_processors(void)
 		return;
 	}
 
-	/* No MP for SUN4V yet */
-	if (CPU_ISSUN4V)
-		return;
-	
 	for (ci = cpus; ci != NULL; ci = ci->ci_next) {
 		if (ci->ci_cpuid == cpu_myid())
 			continue;

Index: src/sys/arch/sparc64/sparc64/pmap.c
diff -u src/sys/arch/sparc64/sparc64/pmap.c:1.301 src/sys/arch/sparc64/sparc64/pmap.c:1.302
--- src/sys/arch/sparc64/sparc64/pmap.c:1.301	Wed Feb  3 20:33:52 2016
+++ src/sys/arch/sparc64/sparc64/pmap.c	Sun Apr 17 14:32:03 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.301 2016/02/03 20:33:52 palle Exp $	*/
+/*	$NetBSD: pmap.c,v 1.302 2016/04/17 14:32:03 martin Exp $	*/
 /*
  *
  * Copyright (C) 1996-1999 Eduardo Horvath.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.301 2016/02/03 20:33:52 palle Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.302 2016/04/17 14:32:03 martin Exp $");
 
 #undef	NO_VCACHE /* Don't forget the locked TLB in dostart */
 #define	HWREF
@@ -49,6 +49,7 @@ __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.3
 #include 
 
 #include 	/* for MID_* */
+#include 
 
 #include 
 
@@ -728,6 +729,10 @@ pmap_bootstrap(u_long kernelstart, u_lon
 
 	BDPRINTF(PDB_BOOT, ("Entered pmap_bootstrap.\n"));
 
+	/* XXX - incomplete spinup code for SUN4V */
+	if (CPU_ISSUN4V)
+		boothowto |= RB_MD1;
+
 	cache_setup_funcs();
 
 	/*



CVS commit: src/lib/libedit

2016-04-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr 17 18:39:14 UTC 2016

Modified Files:
src/lib/libedit: common.c editrc.5 map.c

Log Message:
Remove empty callbacks (Ingo Schwartze)


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/lib/libedit/common.c
cvs rdiff -u -r1.29 -r1.30 src/lib/libedit/editrc.5
cvs rdiff -u -r1.48 -r1.49 src/lib/libedit/map.c

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

Modified files:

Index: src/lib/libedit/common.c
diff -u src/lib/libedit/common.c:1.43 src/lib/libedit/common.c:1.44
--- src/lib/libedit/common.c:1.43	Sun Apr 10 20:50:13 2016
+++ src/lib/libedit/common.c	Sun Apr 17 14:39:14 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: common.c,v 1.43 2016/04/11 00:50:13 christos Exp $	*/
+/*	$NetBSD: common.c,v 1.44 2016/04/17 18:39:14 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)common.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: common.c,v 1.43 2016/04/11 00:50:13 christos Exp $");
+__RCSID("$NetBSD: common.c,v 1.44 2016/04/17 18:39:14 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -441,17 +441,13 @@ ed_unassigned(EditLine *el __attribute__
 }
 
 
-/**
- ** TTY key handling.
- **/
-
-/* ed_tty_sigint():
- *	Tty interrupt character
- *	[^C]
+/* ed_ignore():
+ *	Input characters that have no effect
+ *	[^C ^O ^Q ^S ^Z ^\ ^]] [^C ^O ^Q ^S ^\]
  */
 protected el_action_t
 /*ARGSUSED*/
-ed_tty_sigint(EditLine *el __attribute__((__unused__)),
+ed_ignore(EditLine *el __attribute__((__unused__)),
 	  wint_t c __attribute__((__unused__)))
 {
 
@@ -459,90 +455,6 @@ ed_tty_sigint(EditLine *el __attribute__
 }
 
 
-/* ed_tty_dsusp():
- *	Tty delayed suspend character
- *	[^Y]
- */
-protected el_action_t
-/*ARGSUSED*/
-ed_tty_dsusp(EditLine *el __attribute__((__unused__)),
-	 wint_t c __attribute__((__unused__)))
-{
-
-	return CC_NORM;
-}
-
-
-/* ed_tty_flush_output():
- *	Tty flush output characters
- *	[^O]
- */
-protected el_action_t
-/*ARGSUSED*/
-ed_tty_flush_output(EditLine *el __attribute__((__unused__)),
-		wint_t c __attribute__((__unused__)))
-{
-
-	return CC_NORM;
-}
-
-
-/* ed_tty_sigquit():
- *	Tty quit character
- *	[^\]
- */
-protected el_action_t
-/*ARGSUSED*/
-ed_tty_sigquit(EditLine *el __attribute__((__unused__)),
-	   wint_t c __attribute__((__unused__)))
-{
-
-	return CC_NORM;
-}
-
-
-/* ed_tty_sigtstp():
- *	Tty suspend character
- *	[^Z]
- */
-protected el_action_t
-/*ARGSUSED*/
-ed_tty_sigtstp(EditLine *el __attribute__((__unused__)),
-	   wint_t c __attribute__((__unused__)))
-{
-
-	return CC_NORM;
-}
-
-
-/* ed_tty_stop_output():
- *	Tty disallow output characters
- *	[^S]
- */
-protected el_action_t
-/*ARGSUSED*/
-ed_tty_stop_output(EditLine *el __attribute__((__unused__)),
-		   wint_t c __attribute__((__unused__)))
-{
-
-	return CC_NORM;
-}
-
-
-/* ed_tty_start_output():
- *	Tty allow output characters
- *	[^Q]
- */
-protected el_action_t
-/*ARGSUSED*/
-ed_tty_start_output(EditLine *el __attribute__((__unused__)),
-		wint_t c __attribute__((__unused__)))
-{
-
-	return CC_NORM;
-}
-
-
 /* ed_newline():
  *	Execute command
  *	[^J]

Index: src/lib/libedit/editrc.5
diff -u src/lib/libedit/editrc.5:1.29 src/lib/libedit/editrc.5:1.30
--- src/lib/libedit/editrc.5:1.29	Thu Dec 25 08:39:41 2014
+++ src/lib/libedit/editrc.5	Sun Apr 17 14:39:14 2016
@@ -1,4 +1,4 @@
-.\"	$NetBSD: editrc.5,v 1.29 2014/12/25 13:39:41 wiz Exp $
+.\"	$NetBSD: editrc.5,v 1.30 2016/04/17 18:39:14 christos Exp $
 .\"
 .\" Copyright (c) 1997-2000 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -459,20 +459,8 @@ Adds to argument or enters a digit.
 Digit that starts argument.
 .It Ic ed-unassigned
 Indicates unbound character.
-.It Ic ed-tty-sigint
-Tty interrupt character.
-.It Ic ed-tty-dsusp
-Tty delayed suspend character.
-.It Ic ed-tty-flush-output
-Tty flush output characters.
-.It Ic ed-tty-sigquit
-Tty quit character.
-.It Ic ed-tty-sigtstp
-Tty suspend character.
-.It Ic ed-tty-stop-output
-Tty disallow output characters.
-.It Ic ed-tty-start-output
-Tty allow output characters.
+.It Ic ed-ignore
+Ignore this character.
 .It Ic ed-newline
 Execute command.
 .It Ic ed-delete-prev-char

Index: src/lib/libedit/map.c
diff -u src/lib/libedit/map.c:1.48 src/lib/libedit/map.c:1.49
--- src/lib/libedit/map.c:1.48	Mon Apr 11 20:16:06 2016
+++ src/lib/libedit/map.c	Sun Apr 17 14:39:14 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: map.c,v 1.48 2016/04/12 00:16:06 christos Exp $	*/
+/*	$NetBSD: map.c,v 1.49 2016/04/17 18:39:14 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)map.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: map.c,v 1.48 2016/04/12 00:16:06 christos Exp $");
+__RCSID("$NetBSD: map.c,v 1.49 2016/04/17 18:39:14 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -65,7 +65,7 @@ static const 

CVS commit: src/sys/arch/sparc64/doc

2016-04-17 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sun Apr 17 19:54:32 UTC 2016

Modified Files:
src/sys/arch/sparc64/doc: TODO

Log Message:
Update sparc64 TODO file: note issue with interrupt handling + issue when 
booting from iso image


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/sparc64/doc/TODO

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/sparc64/doc/TODO
diff -u src/sys/arch/sparc64/doc/TODO:1.13 src/sys/arch/sparc64/doc/TODO:1.14
--- src/sys/arch/sparc64/doc/TODO:1.13	Sun Sep  6 18:41:34 2015
+++ src/sys/arch/sparc64/doc/TODO	Sun Apr 17 19:54:32 2016
@@ -1,4 +1,4 @@
- /* $NetBSD: TODO,v 1.13 2015/09/06 18:41:34 palle Exp $ */
+ /* $NetBSD: TODO,v 1.14 2016/04/17 19:54:32 palle Exp $ */
 
 Things to be done:
 
@@ -23,5 +23,7 @@ sun4v:
 - replace constructs line "wrpr %g0, PSTATE_INTR, %pstate" with ALTERNATE_GOBALS
 - sun4v tsb no need to lock... per cpu... anyway...
 - ci_tsb_desc->td_ctxidx: -1 or 1?
-- MP support - currently bypassed in cpu_boot_secondary_processors() for sun4v
+- MP support - currently bypassed in pmap_bootstrap() for sun4v
 - vpci.c/vpcivar.h: cleanup FIXMEs
+- "bad magic number in disk label" when booting from an .iso image
+- interrups not handled properly
\ No newline at end of file



CVS commit: src/sys/netinet

2016-04-17 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Apr 18 01:28:06 UTC 2016

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

Log Message:
Get rid of meaningless RTF_UP check from ip_hresolv_output

The check is meaningless because
- An obtained rtentry is ensured that it's always RTF_UP by rtcache,
  rtalloc1 and rtlookup. If the rtentry isn't changed (i.e., RTF_UP gets
  dropped) during processing, the check should be unnecessary
- Even if not, i.e., an obtained rtentry can be changed during processing,
  checking only at the point doesn't help; the rtentry can be changed after
  the check

Instead we have to ensure that RTF_UP isn't dropped if someone is using it
somehow. Note that we already ensure that a rtentry being used isn't freed
by rt_refcnt.

Proposed on tech-kern and tech-net.


To generate a diff of this commit:
cvs rdiff -u -r1.248 -r1.249 src/sys/netinet/ip_output.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/ip_output.c
diff -u src/sys/netinet/ip_output.c:1.248 src/sys/netinet/ip_output.c:1.249
--- src/sys/netinet/ip_output.c:1.248	Wed Jan 20 22:12:22 2016
+++ src/sys/netinet/ip_output.c	Mon Apr 18 01:28:06 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_output.c,v 1.248 2016/01/20 22:12:22 riastradh Exp $	*/
+/*	$NetBSD: ip_output.c,v 1.249 2016/04/18 01:28:06 ozaki-r Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.248 2016/01/20 22:12:22 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.249 2016/04/18 01:28:06 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -202,50 +202,20 @@ klock_if_output(struct ifnet * const ifp
  * calling ifp's output routine.
  */
 int
-ip_hresolv_output(struct ifnet * const ifp0, struct mbuf * const m,
-const struct sockaddr * const dst, struct rtentry *rt00)
+ip_hresolv_output(struct ifnet * const ifp, struct mbuf * const m,
+const struct sockaddr * const dst, struct rtentry *rt0)
 {
 	int error = 0;
-	struct ifnet *ifp = ifp0;
-	struct rtentry *rt, *rt0, *gwrt;
+	struct rtentry *rt = rt0, *gwrt;
 
 #define RTFREE_IF_NEEDED(_rt) \
-	if ((_rt) != NULL && (_rt) != rt00) \
+	if ((_rt) != NULL && (_rt) != rt0) \
 		rtfree((_rt));
 
-	rt0 = rt00;
-retry:
-	if (!ip_hresolv_needed(ifp)) {
-		rt = rt0;
+	if (!ip_hresolv_needed(ifp))
 		goto out;
-	}
-
-	if (rt0 == NULL) {
-		rt = NULL;
-		goto out;
-	}
-
-	rt = rt0;
-
-	/*
-	 * The following block is highly questionable.  How did we get here
-	 * with a !RTF_UP route?  Does rtalloc1() always return an RTF_UP
-	 * route?
-	 */
-	if ((rt->rt_flags & RTF_UP) == 0) {
-		rt = rtalloc1(dst, 1);
-		if (rt == NULL) {
-			error = EHOSTUNREACH;
-			goto bad;
-		}
-		rt0 = rt;
-		if (rt->rt_ifp != ifp) {
-			ifp = rt->rt_ifp;
-			goto retry;
-		}
-	}
 
-	if ((rt->rt_flags & RTF_GATEWAY) == 0)
+	if (rt == NULL || (rt->rt_flags & RTF_GATEWAY) == 0)
 		goto out;
 
 	gwrt = rt_get_gwroute(rt);



CVS commit: src/tests/net/arp

2016-04-17 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Apr 18 02:27:34 UTC 2016

Modified Files:
src/tests/net/arp: t_arp.sh

Log Message:
Add a test case for static ARP

It tests receiving an ARP request that has a spa (i.e., IP address) whose
ARP entry already exists in the table as a static ARP entry.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/tests/net/arp/t_arp.sh

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

Modified files:

Index: src/tests/net/arp/t_arp.sh
diff -u src/tests/net/arp/t_arp.sh:1.14 src/tests/net/arp/t_arp.sh:1.15
--- src/tests/net/arp/t_arp.sh:1.14	Mon Apr  4 07:37:08 2016
+++ src/tests/net/arp/t_arp.sh	Mon Apr 18 02:27:34 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: t_arp.sh,v 1.14 2016/04/04 07:37:08 ozaki-r Exp $
+#	$NetBSD: t_arp.sh,v 1.15 2016/04/18 02:27:34 ozaki-r Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -47,6 +47,7 @@ atf_test_case cache_overwriting cleanup
 atf_test_case proxy_arp_pub cleanup
 atf_test_case proxy_arp_pubproxy cleanup
 atf_test_case link_activation cleanup
+atf_test_case static_arp cleanup
 
 cache_expiration_5s_head()
 {
@@ -96,6 +97,13 @@ link_activation_head()
 	atf_set "require.progs" "rump_server"
 }
 
+static_arp_head()
+{
+
+	atf_set "descr" "Tests for static ARP entries"
+	atf_set "require.progs" "rump_server"
+}
+
 setup_dst_server()
 {
 	export RUMP_SERVER=$SOCKDST
@@ -520,6 +528,31 @@ link_activation_body()
 	"cat ./out |grep '$pkt' |grep -q 'b2:a1:00:00:00:02'"
 }
 
+static_arp_body()
+{
+	local arp_keep=5
+	local macaddr_src=
+
+	atf_check -s exit:0 ${inetserver} $SOCKSRC
+	atf_check -s exit:0 ${inetserver} $SOCKDST
+
+	setup_dst_server
+	setup_src_server $arp_keep
+
+	export RUMP_SERVER=$SOCKSRC
+	macaddr_src=$(rump.ifconfig shmif0 |awk '/address/ {print $2;}')
+
+	# Set a (valid) static ARP entry for the src server
+	export RUMP_SERVER=$SOCKDST
+	$DEBUG && rump.arp -n -a
+	atf_check -s exit:0 -o ignore rump.arp -s $IP4SRC $macaddr_src
+	$DEBUG && rump.arp -n -a
+
+	# Test receiving an ARP request with the static ARP entry (as spa/sha)
+	export RUMP_SERVER=$SOCKSRC
+	atf_check -s exit:0 -o ignore rump.ping -n -w 1 -c 1 $IP4DST
+}
+
 cleanup()
 {
 	env RUMP_SERVER=$SOCKSRC rump.halt
@@ -600,6 +633,12 @@ link_activation_cleanup()
 	cleanup
 }
 
+static_arp_cleanup()
+{
+	$DEBUG && dump
+	cleanup
+}
+
 atf_init_test_cases()
 {
 	atf_add_test_case cache_expiration_5s
@@ -610,4 +649,5 @@ atf_init_test_cases()
 	atf_add_test_case proxy_arp_pub
 	atf_add_test_case proxy_arp_pubproxy
 	atf_add_test_case link_activation
+	atf_add_test_case static_arp
 }



CVS commit: src/sys/netinet

2016-04-17 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Apr 18 02:24:42 UTC 2016

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

Log Message:
Fix panic on receiving an ARP request

The panic happened if an ARP request has a spa (i.e., IP address) whose
ARP entry already exists in the table as a static ARP entry.


To generate a diff of this commit:
cvs rdiff -u -r1.206 -r1.207 src/sys/netinet/if_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/sys/netinet/if_arp.c
diff -u src/sys/netinet/if_arp.c:1.206 src/sys/netinet/if_arp.c:1.207
--- src/sys/netinet/if_arp.c:1.206	Wed Apr 13 00:47:01 2016
+++ src/sys/netinet/if_arp.c	Mon Apr 18 02:24:42 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_arp.c,v 1.206 2016/04/13 00:47:01 ozaki-r Exp $	*/
+/*	$NetBSD: if_arp.c,v 1.207 2016/04/18 02:24:42 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.206 2016/04/13 00:47:01 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.207 2016/04/18 02:24:42 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -1223,10 +1223,11 @@ in_arpinput(struct mbuf *m)
 	KASSERT(sizeof(la->ll_addr) >= ifp->if_addrlen);
 	(void)memcpy(>ll_addr, ar_sha(ah), ifp->if_addrlen);
 	la->la_flags |= LLE_VALID;
-	la->la_expire = time_uptime + arpt_keep;
+	if ((la->la_flags & LLE_STATIC) == 0) {
+		la->la_expire = time_uptime + arpt_keep;
+		arp_settimer(la, arpt_keep);
+	}
 	la->la_asked = 0;
-	KASSERT((la->la_flags & LLE_STATIC) == 0);
-	arp_settimer(la, arpt_keep);
 	/* rt->rt_flags &= ~RTF_REJECT; */
 
 	if (la->la_hold != NULL) {