CVS commit: src/external/gpl3/gcc/dist/gcc/config/rs6000

2021-04-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr 16 02:33:28 UTC 2021

Modified Files:
src/external/gpl3/gcc/dist/gcc/config/rs6000: rs6000.c

Log Message:
Restore our local change to remove GNU_STACK program header:


http://cvsweb.netbsd.org/bsdweb.cgi/src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c#rev1.13

This was removed accidentally when merging GCC10 into our tree.

Note that some firmwares, e.g., Explora, refuse to execute ELF
kernel image if this program header is present.

Now, GCC10 becomes just fine for all three powerpc sub-archs, i.e.,
oea, booke, and ibm4xx, as far as I can see. No regressions are
observed for ATF.

OK mrg


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 \
src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c

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



CVS commit: src/external/gpl3/gcc/dist/gcc/config/rs6000

2021-04-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr 16 02:33:28 UTC 2021

Modified Files:
src/external/gpl3/gcc/dist/gcc/config/rs6000: rs6000.c

Log Message:
Restore our local change to remove GNU_STACK program header:


http://cvsweb.netbsd.org/bsdweb.cgi/src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c#rev1.13

This was removed accidentally when merging GCC10 into our tree.

Note that some firmwares, e.g., Explora, refuse to execute ELF
kernel image if this program header is present.

Now, GCC10 becomes just fine for all three powerpc sub-archs, i.e.,
oea, booke, and ibm4xx, as far as I can see. No regressions are
observed for ATF.

OK mrg


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 \
src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c

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

Modified files:

Index: src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c
diff -u src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c:1.26 src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c:1.27
--- src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c:1.26	Fri Apr 16 02:26:43 2021
+++ src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c	Fri Apr 16 02:33:28 2021
@@ -20284,7 +20284,7 @@ rs6000_elf_file_end (void)
 		 aix_struct_return ? 2 : 1);
 }
 #endif
-#if defined (POWERPC_LINUX) || defined (POWERPC_FREEBSD) || defined(POWERPC_NETBSD)
+#if defined (POWERPC_LINUX) || defined (POWERPC_FREEBSD)
   if (TARGET_32BIT || DEFAULT_ABI == ABI_ELFv2)
 file_end_indicate_exec_stack ();
 #endif



CVS commit: src/external/gpl3/gcc/dist/gcc/config/rs6000

2021-04-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr 16 02:26:43 UTC 2021

Modified Files:
src/external/gpl3/gcc/dist/gcc/config/rs6000: rs6000.c

Log Message:
Fix regression introduced to GCC10, where it wrongly recognizes 32-bit
processors as POWER9 if -misel flag is specified.

rs6000_machine_from_flags() assumes ISEL instructions are supported only
for POWER9 and successors. However, ISEL is also implemented for 32-bit
booke processors.

Since our kernel for booke is compiled with -misel, this regression
completely breaks it.

As a fix, check whether CPU is 64-bit capable or not, before checking
-misel flag.

The problem has been reported as 100108 to upstream:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100108

OK mrg


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 \
src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c

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

Modified files:

Index: src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c
diff -u src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c:1.25 src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c:1.26
--- src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c:1.25	Fri Apr 16 02:18:04 2021
+++ src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c	Fri Apr 16 02:26:43 2021
@@ -5552,6 +5552,8 @@ rs6000_machine_from_flags (void)
   /* Disable the flags that should never influence the .machine selection.  */
   flags &= ~(OPTION_MASK_PPC_GFXOPT | OPTION_MASK_PPC_GPOPT);
 
+  if ((flags & OPTION_MASK_POWERPC64) == 0)
+return "ppc";
   if ((flags & (ISA_3_1_MASKS_SERVER & ~ISA_3_0_MASKS_SERVER)) != 0)
 return "power10";
   if ((flags & (ISA_3_0_MASKS_SERVER & ~ISA_2_7_MASKS_SERVER)) != 0)
@@ -5566,9 +5568,7 @@ rs6000_machine_from_flags (void)
 return "power5";
   if ((flags & ISA_2_1_MASKS) != 0)
 return "power4";
-  if ((flags & OPTION_MASK_POWERPC64) != 0)
-return "ppc64";
-  return "ppc";
+  return "ppc64";
 }
 
 void



CVS commit: src/external/gpl3/gcc/dist/gcc/config/rs6000

2021-04-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr 16 02:26:43 UTC 2021

Modified Files:
src/external/gpl3/gcc/dist/gcc/config/rs6000: rs6000.c

Log Message:
Fix regression introduced to GCC10, where it wrongly recognizes 32-bit
processors as POWER9 if -misel flag is specified.

rs6000_machine_from_flags() assumes ISEL instructions are supported only
for POWER9 and successors. However, ISEL is also implemented for 32-bit
booke processors.

Since our kernel for booke is compiled with -misel, this regression
completely breaks it.

As a fix, check whether CPU is 64-bit capable or not, before checking
-misel flag.

The problem has been reported as 100108 to upstream:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100108

OK mrg


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 \
src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c

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



CVS commit: src/sys/net

2021-04-15 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Fri Apr 16 02:26:25 UTC 2021

Modified Files:
src/sys/net: if_spppvar.h

Log Message:
Added missing locking order between sppp and IFNET_LOCK


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/net/if_spppvar.h

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

Modified files:

Index: src/sys/net/if_spppvar.h
diff -u src/sys/net/if_spppvar.h:1.32 src/sys/net/if_spppvar.h:1.33
--- src/sys/net/if_spppvar.h:1.32	Wed Nov 25 10:30:51 2020
+++ src/sys/net/if_spppvar.h	Fri Apr 16 02:26:25 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_spppvar.h,v 1.32 2020/11/25 10:30:51 yamaguchi Exp $	*/
+/*	$NetBSD: if_spppvar.h,v 1.33 2021/04/16 02:26:25 yamaguchi Exp $	*/
 
 #ifndef _NET_IF_SPPPVAR_H_
 #define _NET_IF_SPPPVAR_H_
@@ -240,7 +240,7 @@ void sppp_flush (struct ifnet *);
  * if_spppsubr.c.
  *
  * Locking order:
- *- spppq_lock => struct sppp->pp_lock
+ *- IFNET_LOCK => spppq_lock => struct sppp->pp_lock
  *
  * NOTICE
  * - Lower layers must not acquire sppp->pp_lock



CVS commit: src/sys/net

2021-04-15 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Fri Apr 16 02:26:25 UTC 2021

Modified Files:
src/sys/net: if_spppvar.h

Log Message:
Added missing locking order between sppp and IFNET_LOCK


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/net/if_spppvar.h

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



CVS commit: src/sys/net

2021-04-15 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Fri Apr 16 02:23:25 UTC 2021

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

Log Message:
Stop and destroy timeout after sppp_detach and if_detach
for safety

The functions may use resources of pppoe(4) while detaching,
so the release should move after it.


To generate a diff of this commit:
cvs rdiff -u -r1.168 -r1.169 src/sys/net/if_pppoe.c

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

Modified files:

Index: src/sys/net/if_pppoe.c
diff -u src/sys/net/if_pppoe.c:1.168 src/sys/net/if_pppoe.c:1.169
--- src/sys/net/if_pppoe.c:1.168	Fri Apr 16 02:12:00 2021
+++ src/sys/net/if_pppoe.c	Fri Apr 16 02:23:25 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: if_pppoe.c,v 1.168 2021/04/16 02:12:00 yamaguchi Exp $ */
+/* $NetBSD: if_pppoe.c,v 1.169 2021/04/16 02:23:25 yamaguchi Exp $ */
 
 /*
  * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.168 2021/04/16 02:12:00 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.169 2021/04/16 02:23:25 yamaguchi Exp $");
 
 #ifdef _KERNEL_OPT
 #include "pppoe.h"
@@ -436,13 +436,18 @@ pppoe_clone_destroy(struct ifnet *ifp)
 	}
 	rw_exit(_softc_list_lock);
 
+	bpf_detach(ifp);
+	sppp_detach(>sc_sppp.pp_if);
+	if_detach(ifp);
+
 	callout_setfunc(>sc_timeout, pppoe_timeout_co_halt, sc);
+
 	workqueue_wait(sc->sc_timeout_wq, >sc_timeout_wk);
+	workqueue_destroy(sc->sc_timeout_wq);
+
 	callout_halt(>sc_timeout, NULL);
+	callout_destroy(>sc_timeout);
 
-	bpf_detach(ifp);
-	sppp_detach(>sc_sppp.pp_if);
-	if_detach(ifp);
 	if (sc->sc_concentrator_name)
 		free(sc->sc_concentrator_name, M_DEVBUF);
 	if (sc->sc_service_name)
@@ -451,8 +456,6 @@ pppoe_clone_destroy(struct ifnet *ifp)
 		free(sc->sc_ac_cookie, M_DEVBUF);
 	if (sc->sc_relay_sid)
 		free(sc->sc_relay_sid, M_DEVBUF);
-	callout_destroy(>sc_timeout);
-	workqueue_destroy(sc->sc_timeout_wq);
 
 	rw_destroy(>sc_lock);
 



CVS commit: src/sys/net

2021-04-15 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Fri Apr 16 02:23:25 UTC 2021

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

Log Message:
Stop and destroy timeout after sppp_detach and if_detach
for safety

The functions may use resources of pppoe(4) while detaching,
so the release should move after it.


To generate a diff of this commit:
cvs rdiff -u -r1.168 -r1.169 src/sys/net/if_pppoe.c

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



CVS commit: src/external/gpl3/gcc/dist/gcc/config/rs6000

2021-04-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr 16 02:18:04 UTC 2021

Modified Files:
src/external/gpl3/gcc/dist/gcc/config/rs6000: rs6000.c

Log Message:
Fix regression introduced to GCC10, by which inline assembler codes for
403/405 are miscompiled.

Redundant .machine directive introduced by upstream commit
2d94f7dea9c73ef3c116a0ddc722724578a860fe:


https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=2d94f7dea9c73ef3c116a0ddc722724578a860fe

clobbers CPU flags passed to assembler. This results in miscompile for
inline assembler codes specific to 403/405 processors, at least.

Therefore, revert this commit locally.

The problem has been reported as 100107 to upstream:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100107

OK mrg


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 \
src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c

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

Modified files:

Index: src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c
diff -u src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c:1.24 src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c:1.25
--- src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c:1.24	Mon Apr 12 07:23:06 2021
+++ src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c	Fri Apr 16 02:18:04 2021
@@ -5644,7 +5644,9 @@ rs6000_file_start (void)
 
 #ifdef USING_ELFOS_H
   rs6000_machine = rs6000_machine_from_flags ();
-  emit_asm_machine ();
+  if (!(rs6000_default_cpu && rs6000_default_cpu[0])
+	&& !global_options_set.x_rs6000_cpu_index)
+emit_asm_machine ();
 #endif
 
   if (DEFAULT_ABI == ABI_ELFv2)



CVS commit: src/external/gpl3/gcc/dist/gcc/config/rs6000

2021-04-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr 16 02:18:04 UTC 2021

Modified Files:
src/external/gpl3/gcc/dist/gcc/config/rs6000: rs6000.c

Log Message:
Fix regression introduced to GCC10, by which inline assembler codes for
403/405 are miscompiled.

Redundant .machine directive introduced by upstream commit
2d94f7dea9c73ef3c116a0ddc722724578a860fe:


https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=2d94f7dea9c73ef3c116a0ddc722724578a860fe

clobbers CPU flags passed to assembler. This results in miscompile for
inline assembler codes specific to 403/405 processors, at least.

Therefore, revert this commit locally.

The problem has been reported as 100107 to upstream:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100107

OK mrg


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 \
src/external/gpl3/gcc/dist/gcc/config/rs6000/rs6000.c

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



CVS commit: src/sys/net

2021-04-15 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Fri Apr 16 02:12:00 UTC 2021

Modified Files:
src/sys/net: if_pppoe.c if_spppsubr.c

Log Message:
Remove unnecessaly lock holdings to avoid dead lock

The locks were held while callout_halt() and workqueue_wait()
without reason.
And the locks also were held at callout and workqueue handler
so that the handler kicked by those function couldn't acquire
the lock.

The reasons why those are unneccesary are:
 - Items of callout_t are protected by callout_lock
 - Items of struct workqueue and struct work are protected
   by q_mutex in struct workqueue
 - Items of struct sppp_work protected by atomic_cas(3)
 - struct pppoe_softc does not free before workqueue_wait() and
   callout_halt() even if the locks are not held


To generate a diff of this commit:
cvs rdiff -u -r1.167 -r1.168 src/sys/net/if_pppoe.c
cvs rdiff -u -r1.216 -r1.217 src/sys/net/if_spppsubr.c

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



CVS commit: src/sys/net

2021-04-15 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Fri Apr 16 02:12:00 UTC 2021

Modified Files:
src/sys/net: if_pppoe.c if_spppsubr.c

Log Message:
Remove unnecessaly lock holdings to avoid dead lock

The locks were held while callout_halt() and workqueue_wait()
without reason.
And the locks also were held at callout and workqueue handler
so that the handler kicked by those function couldn't acquire
the lock.

The reasons why those are unneccesary are:
 - Items of callout_t are protected by callout_lock
 - Items of struct workqueue and struct work are protected
   by q_mutex in struct workqueue
 - Items of struct sppp_work protected by atomic_cas(3)
 - struct pppoe_softc does not free before workqueue_wait() and
   callout_halt() even if the locks are not held


To generate a diff of this commit:
cvs rdiff -u -r1.167 -r1.168 src/sys/net/if_pppoe.c
cvs rdiff -u -r1.216 -r1.217 src/sys/net/if_spppsubr.c

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

Modified files:

Index: src/sys/net/if_pppoe.c
diff -u src/sys/net/if_pppoe.c:1.167 src/sys/net/if_pppoe.c:1.168
--- src/sys/net/if_pppoe.c:1.167	Fri Apr 16 01:59:50 2021
+++ src/sys/net/if_pppoe.c	Fri Apr 16 02:12:00 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: if_pppoe.c,v 1.167 2021/04/16 01:59:50 yamaguchi Exp $ */
+/* $NetBSD: if_pppoe.c,v 1.168 2021/04/16 02:12:00 yamaguchi Exp $ */
 
 /*
  * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.167 2021/04/16 01:59:50 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.168 2021/04/16 02:12:00 yamaguchi Exp $");
 
 #ifdef _KERNEL_OPT
 #include "pppoe.h"
@@ -436,7 +436,6 @@ pppoe_clone_destroy(struct ifnet *ifp)
 	}
 	rw_exit(_softc_list_lock);
 
-	PPPOE_LOCK(sc, RW_WRITER);
 	callout_setfunc(>sc_timeout, pppoe_timeout_co_halt, sc);
 	workqueue_wait(sc->sc_timeout_wq, >sc_timeout_wk);
 	callout_halt(>sc_timeout, NULL);
@@ -455,7 +454,6 @@ pppoe_clone_destroy(struct ifnet *ifp)
 	callout_destroy(>sc_timeout);
 	workqueue_destroy(sc->sc_timeout_wq);
 
-	PPPOE_UNLOCK(sc);
 	rw_destroy(>sc_lock);
 
 	kmem_free(sc, sizeof(*sc));

Index: src/sys/net/if_spppsubr.c
diff -u src/sys/net/if_spppsubr.c:1.216 src/sys/net/if_spppsubr.c:1.217
--- src/sys/net/if_spppsubr.c:1.216	Fri Apr 16 02:05:37 2021
+++ src/sys/net/if_spppsubr.c	Fri Apr 16 02:12:00 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_spppsubr.c,v 1.216 2021/04/16 02:05:37 yamaguchi Exp $	 */
+/*	$NetBSD: if_spppsubr.c,v 1.217 2021/04/16 02:12:00 yamaguchi Exp $	 */
 
 /*
  * Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.216 2021/04/16 02:05:37 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.217 2021/04/16 02:12:00 yamaguchi Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -1074,8 +1074,6 @@ sppp_detach(struct ifnet *ifp)
 		spppq_lock = NULL;
 	}
 
-	SPPP_LOCK(sp, RW_WRITER);
-
 	sppp_cp_fini(, sp);
 	sppp_cp_fini(, sp);
 	sppp_cp_fini(, sp);
@@ -1090,7 +1088,6 @@ sppp_detach(struct ifnet *ifp)
 	if (sp->myauth.secret) free(sp->myauth.secret, M_DEVBUF);
 	if (sp->hisauth.name) free(sp->hisauth.name, M_DEVBUF);
 	if (sp->hisauth.secret) free(sp->hisauth.secret, M_DEVBUF);
-	SPPP_UNLOCK(sp);
 	rw_destroy(>pp_lock);
 }
 



CVS commit: src/sys/net

2021-04-15 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Fri Apr 16 02:05:37 UTC 2021

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

Log Message:
Fix not to put the wrong error message


To generate a diff of this commit:
cvs rdiff -u -r1.215 -r1.216 src/sys/net/if_spppsubr.c

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

Modified files:

Index: src/sys/net/if_spppsubr.c
diff -u src/sys/net/if_spppsubr.c:1.215 src/sys/net/if_spppsubr.c:1.216
--- src/sys/net/if_spppsubr.c:1.215	Fri Nov 27 03:37:11 2020
+++ src/sys/net/if_spppsubr.c	Fri Apr 16 02:05:37 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_spppsubr.c,v 1.215 2020/11/27 03:37:11 yamaguchi Exp $	 */
+/*	$NetBSD: if_spppsubr.c,v 1.216 2021/04/16 02:05:37 yamaguchi Exp $	 */
 
 /*
  * Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.215 2020/11/27 03:37:11 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.216 2021/04/16 02:05:37 yamaguchi Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -1933,6 +1933,13 @@ sppp_down_event(struct sppp *sp, void *x
 		sppp_cp_change_state(cp, sp, STATE_STARTING);
 		break;
 	default:
+		/*
+		 * a down event may be caused regardless
+		 * of state just in LCP case.
+		 */
+		if (cp->proto == PPP_LCP)
+			break;
+
 		printf("%s: %s illegal down in state %s\n",
 		   ifp->if_xname, cp->name,
 		   sppp_state_name(sp->scp[cp->protoidx].state));



CVS commit: src/sys/net

2021-04-15 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Fri Apr 16 02:05:37 UTC 2021

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

Log Message:
Fix not to put the wrong error message


To generate a diff of this commit:
cvs rdiff -u -r1.215 -r1.216 src/sys/net/if_spppsubr.c

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



CVS commit: src/sys/net

2021-04-15 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Fri Apr 16 01:59:50 UTC 2021

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

Log Message:
Stop ppp layer at first of destroying pppoe interface


To generate a diff of this commit:
cvs rdiff -u -r1.166 -r1.167 src/sys/net/if_pppoe.c

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



CVS commit: src/sys/net

2021-04-15 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Fri Apr 16 01:59:50 UTC 2021

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

Log Message:
Stop ppp layer at first of destroying pppoe interface


To generate a diff of this commit:
cvs rdiff -u -r1.166 -r1.167 src/sys/net/if_pppoe.c

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

Modified files:

Index: src/sys/net/if_pppoe.c
diff -u src/sys/net/if_pppoe.c:1.166 src/sys/net/if_pppoe.c:1.167
--- src/sys/net/if_pppoe.c:1.166	Fri Apr 16 01:44:35 2021
+++ src/sys/net/if_pppoe.c	Fri Apr 16 01:59:50 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: if_pppoe.c,v 1.166 2021/04/16 01:44:35 yamaguchi Exp $ */
+/* $NetBSD: if_pppoe.c,v 1.167 2021/04/16 01:59:50 yamaguchi Exp $ */
 
 /*
  * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.166 2021/04/16 01:44:35 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.167 2021/04/16 01:59:50 yamaguchi Exp $");
 
 #ifdef _KERNEL_OPT
 #include "pppoe.h"
@@ -188,6 +188,7 @@ struct pppoe_softc {
 	int sc_padi_retried;		/* number of PADI retries already done */
 	int sc_padr_retried;		/* number of PADR retries already done */
 	krwlock_t sc_lock;	/* lock of sc_state, sc_session, and sc_eth_if */
+	bool sc_detaching;
 };
 
 /* incoming traffic will be queued here */
@@ -417,13 +418,17 @@ pppoe_clone_destroy(struct ifnet *ifp)
 {
 	struct pppoe_softc * sc = ifp->if_softc;
 
-	rw_enter(_softc_list_lock, RW_WRITER);
-
 	PPPOE_LOCK(sc, RW_WRITER);
-	callout_setfunc(>sc_timeout, pppoe_timeout_co_halt, sc);
-	workqueue_wait(sc->sc_timeout_wq, >sc_timeout_wk);
-	callout_halt(>sc_timeout, NULL);
+	/* stop ioctls */
+	sc->sc_detaching = true;
 
+	if (ifp->if_flags & IFF_RUNNING) {
+		pppoe_clear_softc(sc, "destroy interface");
+		sc->sc_eth_if = NULL;
+	}
+	PPPOE_UNLOCK(sc);
+
+	rw_enter(_softc_list_lock, RW_WRITER);
 	LIST_REMOVE(sc, sc_list);
 
 	if (LIST_EMPTY(_softc_list)) {
@@ -431,6 +436,11 @@ pppoe_clone_destroy(struct ifnet *ifp)
 	}
 	rw_exit(_softc_list_lock);
 
+	PPPOE_LOCK(sc, RW_WRITER);
+	callout_setfunc(>sc_timeout, pppoe_timeout_co_halt, sc);
+	workqueue_wait(sc->sc_timeout_wq, >sc_timeout_wk);
+	callout_halt(>sc_timeout, NULL);
+
 	bpf_detach(ifp);
 	sppp_detach(>sc_sppp.pp_if);
 	if_detach(ifp);
@@ -1285,6 +1295,10 @@ pppoe_ioctl(struct ifnet *ifp, unsigned 
 			struct ifnet *eth_if;
 
 			PPPOE_LOCK(sc, RW_WRITER);
+			if (sc->sc_detaching) {
+PPPOE_UNLOCK(sc);
+return ENXIO;
+			}
 			eth_if = ifunit(parms->eth_ifname);
 			if (eth_if == NULL || eth_if->if_dlt != DLT_EN10MB) {
 sc->sc_eth_if = NULL;
@@ -1343,6 +1357,10 @@ pppoe_ioctl(struct ifnet *ifp, unsigned 
 		 * administrators choice.
 		 */
 		PPPOE_LOCK(sc, RW_WRITER);
+		if (sc->sc_detaching) {
+			PPPOE_UNLOCK(sc);
+			return ENXIO;
+		}
 
 		if ((ifr->ifr_flags & IFF_UP) == 0
 		 && sc->sc_state < PPPOE_STATE_SESSION) {
@@ -1506,7 +1524,8 @@ pppoe_timeout(struct pppoe_softc *sc)
 	switch (sc->sc_state) {
 	case PPPOE_STATE_INITIAL:
 		/* delayed connect from pppoe_tls() */
-		pppoe_connect(sc);
+		if (!sc->sc_detaching)
+			pppoe_connect(sc);
 		break;
 	case PPPOE_STATE_PADI_SENT:
 		/*



CVS commit: src/sys/net

2021-04-15 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Fri Apr 16 01:44:35 UTC 2021

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

Log Message:
Sort initialization sequence in pppoe_clone_create() out
for refactoring

It has no functionality impact


To generate a diff of this commit:
cvs rdiff -u -r1.165 -r1.166 src/sys/net/if_pppoe.c

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

Modified files:

Index: src/sys/net/if_pppoe.c
diff -u src/sys/net/if_pppoe.c:1.165 src/sys/net/if_pppoe.c:1.166
--- src/sys/net/if_pppoe.c:1.165	Fri Apr 16 01:32:04 2021
+++ src/sys/net/if_pppoe.c	Fri Apr 16 01:44:35 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: if_pppoe.c,v 1.165 2021/04/16 01:32:04 yamaguchi Exp $ */
+/* $NetBSD: if_pppoe.c,v 1.166 2021/04/16 01:44:35 yamaguchi Exp $ */
 
 /*
  * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.165 2021/04/16 01:32:04 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.166 2021/04/16 01:44:35 yamaguchi Exp $");
 
 #ifdef _KERNEL_OPT
 #include "pppoe.h"
@@ -339,34 +339,43 @@ static int
 pppoe_clone_create(struct if_clone *ifc, int unit)
 {
 	struct pppoe_softc *sc;
+	struct ifnet *ifp;
 	int rv;
 
 	sc = kmem_zalloc(sizeof(*sc), KM_SLEEP);
+	ifp = >sc_sppp.pp_if;
 
 	rw_init(>sc_lock);
 	pppoe_softc_genid(>sc_id);
+	/* changed to real address later */
+	memcpy(>sc_dest, etherbroadcastaddr, sizeof(sc->sc_dest));
 
-	if_initname(>sc_sppp.pp_if, "pppoe", unit);
-	sc->sc_sppp.pp_if.if_softc = sc;
-	sc->sc_sppp.pp_if.if_mtu = PPPOE_MAXMTU;
-	sc->sc_sppp.pp_if.if_flags = IFF_SIMPLEX|IFF_POINTOPOINT|IFF_MULTICAST;
+	if_initname(ifp, "pppoe", unit);
+	ifp->if_softc = sc;
+	ifp->if_mtu = PPPOE_MAXMTU;
+	ifp->if_flags = IFF_SIMPLEX|IFF_POINTOPOINT|IFF_MULTICAST;
+#ifdef PPPOE_MPSAFE
+	ifp->if_extflags = IFEF_MPSAFE;
+#endif
+	ifp->if_type = IFT_PPP;
+	ifp->if_hdrlen = sizeof(struct ether_header) + PPPOE_HEADERLEN;
+	ifp->if_dlt = DLT_PPP_ETHER;
+	ifp->if_ioctl = pppoe_ioctl;
+	ifp->if_start = pppoe_start;
 #ifdef PPPOE_MPSAFE
-	sc->sc_sppp.pp_if.if_extflags = IFEF_MPSAFE;
+	ifp->if_transmit = pppoe_transmit;
 #endif
-	sc->sc_sppp.pp_if.if_type = IFT_PPP;
-	sc->sc_sppp.pp_if.if_hdrlen = sizeof(struct ether_header) + PPPOE_HEADERLEN;
-	sc->sc_sppp.pp_if.if_dlt = DLT_PPP_ETHER;
+	IFQ_SET_MAXLEN(>if_snd, IFQ_MAXLEN);
+	IFQ_SET_READY(>if_snd);
+
+	sc->sc_sppp.pp_tls = pppoe_tls;
+	sc->sc_sppp.pp_tlf = pppoe_tlf;
 	sc->sc_sppp.pp_flags |= PP_KEEPALIVE |	/* use LCP keepalive */
 PP_NOFRAMING;	/* no serial encapsulation */
-	sc->sc_sppp.pp_if.if_ioctl = pppoe_ioctl;
-	IFQ_SET_MAXLEN(>sc_sppp.pp_if.if_snd, IFQ_MAXLEN);
-	IFQ_SET_READY(>sc_sppp.pp_if.if_snd);
-
-	/* changed to real address later */
-	memcpy(>sc_dest, etherbroadcastaddr, sizeof(sc->sc_dest));
+	sc->sc_sppp.pp_framebytes = PPPOE_HEADERLEN;	/* framing added to ppp packets */
 
 	rv = workqueue_create(>sc_timeout_wq,
-	sc->sc_sppp.pp_if.if_xname, pppoe_timeout_wk, sc,
+	ifp->if_xname, pppoe_timeout_wk, sc,
 	PRI_SOFTNET, IPL_SOFTNET, 0);
 	if (rv != 0)
 		goto destroy_sclock;
@@ -374,33 +383,23 @@ pppoe_clone_create(struct if_clone *ifc,
 	callout_init(>sc_timeout, CALLOUT_MPSAFE);
 	callout_setfunc(>sc_timeout, pppoe_timeout_co, sc);
 
-	sc->sc_sppp.pp_if.if_start = pppoe_start;
-#ifdef PPPOE_MPSAFE
-	sc->sc_sppp.pp_if.if_transmit = pppoe_transmit;
-#endif
-	sc->sc_sppp.pp_tls = pppoe_tls;
-	sc->sc_sppp.pp_tlf = pppoe_tlf;
-	sc->sc_sppp.pp_framebytes = PPPOE_HEADERLEN;	/* framing added to ppp packets */
-
-	rv = if_initialize(>sc_sppp.pp_if);
+	rv = if_initialize(ifp);
 	if (rv != 0)
 		goto destroy_timeout;
 
-	sc->sc_sppp.pp_if.if_percpuq = if_percpuq_create(>sc_sppp.pp_if);
-	sppp_attach(>sc_sppp.pp_if);
+	ifp->if_percpuq = if_percpuq_create(ifp);
 
-	bpf_attach(>sc_sppp.pp_if, DLT_PPP_ETHER, 0);
 	rw_enter(_softc_list_lock, RW_READER);
 	if (LIST_EMPTY(_softc_list)) {
 		pfil_add_ihook(pppoe_ifattach_hook, NULL, PFIL_IFNET, if_pfil);
 	}
+	LIST_INSERT_HEAD(_softc_list, sc, sc_list);
 	rw_exit(_softc_list_lock);
 
-	if_register(>sc_sppp.pp_if);
+	sppp_attach(ifp);
+	bpf_attach(ifp, DLT_PPP_ETHER, 0);
+	if_register(ifp);
 
-	rw_enter(_softc_list_lock, RW_WRITER);
-	LIST_INSERT_HEAD(_softc_list, sc, sc_list);
-	rw_exit(_softc_list_lock);
 	return 0;
 
 destroy_timeout:



CVS commit: src/sys/net

2021-04-15 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Fri Apr 16 01:44:35 UTC 2021

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

Log Message:
Sort initialization sequence in pppoe_clone_create() out
for refactoring

It has no functionality impact


To generate a diff of this commit:
cvs rdiff -u -r1.165 -r1.166 src/sys/net/if_pppoe.c

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



CVS commit: src/sys/net

2021-04-15 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Fri Apr 16 01:32:04 UTC 2021

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

Log Message:
Use kmem_zalloc to allocate pppoe_softc


To generate a diff of this commit:
cvs rdiff -u -r1.164 -r1.165 src/sys/net/if_pppoe.c

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

Modified files:

Index: src/sys/net/if_pppoe.c
diff -u src/sys/net/if_pppoe.c:1.164 src/sys/net/if_pppoe.c:1.165
--- src/sys/net/if_pppoe.c:1.164	Fri Apr 16 01:28:51 2021
+++ src/sys/net/if_pppoe.c	Fri Apr 16 01:32:04 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: if_pppoe.c,v 1.164 2021/04/16 01:28:51 yamaguchi Exp $ */
+/* $NetBSD: if_pppoe.c,v 1.165 2021/04/16 01:32:04 yamaguchi Exp $ */
 
 /*
  * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.164 2021/04/16 01:28:51 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.165 2021/04/16 01:32:04 yamaguchi Exp $");
 
 #ifdef _KERNEL_OPT
 #include "pppoe.h"
@@ -341,7 +341,7 @@ pppoe_clone_create(struct if_clone *ifc,
 	struct pppoe_softc *sc;
 	int rv;
 
-	sc = malloc(sizeof(struct pppoe_softc), M_DEVBUF, M_WAITOK|M_ZERO);
+	sc = kmem_zalloc(sizeof(*sc), KM_SLEEP);
 
 	rw_init(>sc_lock);
 	pppoe_softc_genid(>sc_id);
@@ -408,7 +408,7 @@ destroy_timeout:
 	workqueue_destroy(sc->sc_timeout_wq);
 destroy_sclock:
 	rw_destroy(>sc_lock);
-	free(sc, M_DEVBUF);
+	kmem_free(sc, sizeof(*sc));
 
 	return rv;
 }
@@ -449,7 +449,7 @@ pppoe_clone_destroy(struct ifnet *ifp)
 	PPPOE_UNLOCK(sc);
 	rw_destroy(>sc_lock);
 
-	free(sc, M_DEVBUF);
+	kmem_free(sc, sizeof(*sc));
 
 	return 0;
 }



CVS commit: src/sys/net

2021-04-15 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Fri Apr 16 01:32:04 UTC 2021

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

Log Message:
Use kmem_zalloc to allocate pppoe_softc


To generate a diff of this commit:
cvs rdiff -u -r1.164 -r1.165 src/sys/net/if_pppoe.c

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



CVS commit: src/sys/net

2021-04-15 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Fri Apr 16 01:28:51 UTC 2021

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

Log Message:
Move initialization of sc_lock in pppoe_softc to first

The lock may be held in callbacks for ppp layer or other
components so that it should be initialized early.


To generate a diff of this commit:
cvs rdiff -u -r1.163 -r1.164 src/sys/net/if_pppoe.c

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

Modified files:

Index: src/sys/net/if_pppoe.c
diff -u src/sys/net/if_pppoe.c:1.163 src/sys/net/if_pppoe.c:1.164
--- src/sys/net/if_pppoe.c:1.163	Fri Apr 16 01:24:35 2021
+++ src/sys/net/if_pppoe.c	Fri Apr 16 01:28:51 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: if_pppoe.c,v 1.163 2021/04/16 01:24:35 yamaguchi Exp $ */
+/* $NetBSD: if_pppoe.c,v 1.164 2021/04/16 01:28:51 yamaguchi Exp $ */
 
 /*
  * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.163 2021/04/16 01:24:35 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.164 2021/04/16 01:28:51 yamaguchi Exp $");
 
 #ifdef _KERNEL_OPT
 #include "pppoe.h"
@@ -343,6 +343,7 @@ pppoe_clone_create(struct if_clone *ifc,
 
 	sc = malloc(sizeof(struct pppoe_softc), M_DEVBUF, M_WAITOK|M_ZERO);
 
+	rw_init(>sc_lock);
 	pppoe_softc_genid(>sc_id);
 
 	if_initname(>sc_sppp.pp_if, "pppoe", unit);
@@ -368,7 +369,7 @@ pppoe_clone_create(struct if_clone *ifc,
 	sc->sc_sppp.pp_if.if_xname, pppoe_timeout_wk, sc,
 	PRI_SOFTNET, IPL_SOFTNET, 0);
 	if (rv != 0)
-		goto free_sc;
+		goto destroy_sclock;
 
 	callout_init(>sc_timeout, CALLOUT_MPSAFE);
 	callout_setfunc(>sc_timeout, pppoe_timeout_co, sc);
@@ -397,8 +398,6 @@ pppoe_clone_create(struct if_clone *ifc,
 
 	if_register(>sc_sppp.pp_if);
 
-	rw_init(>sc_lock);
-
 	rw_enter(_softc_list_lock, RW_WRITER);
 	LIST_INSERT_HEAD(_softc_list, sc, sc_list);
 	rw_exit(_softc_list_lock);
@@ -407,8 +406,10 @@ pppoe_clone_create(struct if_clone *ifc,
 destroy_timeout:
 	callout_destroy(>sc_timeout);
 	workqueue_destroy(sc->sc_timeout_wq);
-free_sc:
+destroy_sclock:
+	rw_destroy(>sc_lock);
 	free(sc, M_DEVBUF);
+
 	return rv;
 }
 



CVS commit: src/sys/net

2021-04-15 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Fri Apr 16 01:28:51 UTC 2021

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

Log Message:
Move initialization of sc_lock in pppoe_softc to first

The lock may be held in callbacks for ppp layer or other
components so that it should be initialized early.


To generate a diff of this commit:
cvs rdiff -u -r1.163 -r1.164 src/sys/net/if_pppoe.c

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



CVS commit: src/sys/net

2021-04-15 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Fri Apr 16 01:24:35 UTC 2021

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

Log Message:
commonize error handling in pppoe_clone_create()


To generate a diff of this commit:
cvs rdiff -u -r1.162 -r1.163 src/sys/net/if_pppoe.c

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



CVS commit: src/sys/net

2021-04-15 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Fri Apr 16 01:24:35 UTC 2021

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

Log Message:
commonize error handling in pppoe_clone_create()


To generate a diff of this commit:
cvs rdiff -u -r1.162 -r1.163 src/sys/net/if_pppoe.c

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

Modified files:

Index: src/sys/net/if_pppoe.c
diff -u src/sys/net/if_pppoe.c:1.162 src/sys/net/if_pppoe.c:1.163
--- src/sys/net/if_pppoe.c:1.162	Tue Apr 13 05:04:54 2021
+++ src/sys/net/if_pppoe.c	Fri Apr 16 01:24:35 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: if_pppoe.c,v 1.162 2021/04/13 05:04:54 yamaguchi Exp $ */
+/* $NetBSD: if_pppoe.c,v 1.163 2021/04/16 01:24:35 yamaguchi Exp $ */
 
 /*
  * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.162 2021/04/13 05:04:54 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.163 2021/04/16 01:24:35 yamaguchi Exp $");
 
 #ifdef _KERNEL_OPT
 #include "pppoe.h"
@@ -367,10 +367,8 @@ pppoe_clone_create(struct if_clone *ifc,
 	rv = workqueue_create(>sc_timeout_wq,
 	sc->sc_sppp.pp_if.if_xname, pppoe_timeout_wk, sc,
 	PRI_SOFTNET, IPL_SOFTNET, 0);
-	if (rv != 0) {
-		free(sc, M_DEVBUF);
-		return rv;
-	}
+	if (rv != 0)
+		goto free_sc;
 
 	callout_init(>sc_timeout, CALLOUT_MPSAFE);
 	callout_setfunc(>sc_timeout, pppoe_timeout_co, sc);
@@ -384,13 +382,9 @@ pppoe_clone_create(struct if_clone *ifc,
 	sc->sc_sppp.pp_framebytes = PPPOE_HEADERLEN;	/* framing added to ppp packets */
 
 	rv = if_initialize(>sc_sppp.pp_if);
-	if (rv != 0) {
-		workqueue_destroy(sc->sc_timeout_wq);
-		callout_halt(>sc_timeout, NULL);
-		callout_destroy(>sc_timeout);
-		free(sc, M_DEVBUF);
-		return rv;
-	}
+	if (rv != 0)
+		goto destroy_timeout;
+
 	sc->sc_sppp.pp_if.if_percpuq = if_percpuq_create(>sc_sppp.pp_if);
 	sppp_attach(>sc_sppp.pp_if);
 
@@ -409,6 +403,13 @@ pppoe_clone_create(struct if_clone *ifc,
 	LIST_INSERT_HEAD(_softc_list, sc, sc_list);
 	rw_exit(_softc_list_lock);
 	return 0;
+
+destroy_timeout:
+	callout_destroy(>sc_timeout);
+	workqueue_destroy(sc->sc_timeout_wq);
+free_sc:
+	free(sc, M_DEVBUF);
+	return rv;
 }
 
 static int



CVS commit: src/distrib/sets/lists/base

2021-04-15 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Apr 16 01:14:38 UTC 2021

Modified Files:
src/distrib/sets/lists/base: mi

Log Message:
restore gcc-8 subdirs and mark as obsolete.  oops.

noted by pgoyette.


To generate a diff of this commit:
cvs rdiff -u -r1.1277 -r1.1278 src/distrib/sets/lists/base/mi

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



CVS commit: src/distrib/sets/lists/base

2021-04-15 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Apr 16 01:14:38 UTC 2021

Modified Files:
src/distrib/sets/lists/base: mi

Log Message:
restore gcc-8 subdirs and mark as obsolete.  oops.

noted by pgoyette.


To generate a diff of this commit:
cvs rdiff -u -r1.1277 -r1.1278 src/distrib/sets/lists/base/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/base/mi
diff -u src/distrib/sets/lists/base/mi:1.1277 src/distrib/sets/lists/base/mi:1.1278
--- src/distrib/sets/lists/base/mi:1.1277	Mon Apr 12 02:08:59 2021
+++ src/distrib/sets/lists/base/mi	Fri Apr 16 01:14:38 2021
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1277 2021/04/12 02:08:59 mrg Exp $
+# $NetBSD: mi,v 1.1278 2021/04/16 01:14:38 mrg Exp $
 #
 # Note:	Don't delete entries from here - mark them as "obsolete" instead,
 #	unless otherwise stated below.
@@ -1240,6 +1240,8 @@
 ./usr/include/gcc-6/sanitizer			base-obsolete		obsolete
 ./usr/include/gcc-7base-obsolete		obsolete
 ./usr/include/gcc-7/sanitizer			base-obsolete		obsolete
+./usr/include/gcc-8base-obsolete		obsolete
+./usr/include/gcc-8/sanitizer			base-obsolete		obsolete
 ./usr/include/gcc-9base-c-usr
 ./usr/include/gcc-9/sanitizer			base-c-usr
 ./usr/include/gcc-10base-c-usr



CVS commit: src/sys/arch/m68k/m68k

2021-04-15 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Apr 16 00:13:48 UTC 2021

Modified Files:
src/sys/arch/m68k/m68k: pmap_motorola.c

Log Message:
check the result value of pmap_extract() and panic if it fails.
this is a "should never fail" case, and GCC 10 noticed that it
allows an uninitialised variable use.

tested by rin@ on amiga and mac68k.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/arch/m68k/m68k/pmap_motorola.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/m68k/m68k/pmap_motorola.c
diff -u src/sys/arch/m68k/m68k/pmap_motorola.c:1.73 src/sys/arch/m68k/m68k/pmap_motorola.c:1.74
--- src/sys/arch/m68k/m68k/pmap_motorola.c:1.73	Mon Feb  1 19:02:27 2021
+++ src/sys/arch/m68k/m68k/pmap_motorola.c	Fri Apr 16 00:13:48 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_motorola.c,v 1.73 2021/02/01 19:02:27 skrll Exp $*/
+/*	$NetBSD: pmap_motorola.c,v 1.74 2021/04/16 00:13:48 mrg Exp $*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -119,7 +119,7 @@
 #include "opt_m68k_arch.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap_motorola.c,v 1.73 2021/02/01 19:02:27 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_motorola.c,v 1.74 2021/04/16 00:13:48 mrg Exp $");
 
 #include 
 #include 
@@ -1667,7 +1667,11 @@ pmap_collect1(pmap_t pmap, paddr_t start
 		 * ST and Sysptmap entries.
 		 */
 
-		(void) pmap_extract(pmap, pv->pv_va, );
+		if (!pmap_extract(pmap, pv->pv_va, )) {
+			printf("collect: freeing KPT page at %lx (ste %x@%p)\n",
+			pv->pv_va, *pv->pv_ptste, pv->pv_ptste);
+			panic("pmap_collect: mapping not found");
+		}
 		pmap_remove_mapping(pmap, pv->pv_va, NULL,
 		PRM_TFLUSH|PRM_CFLUSH, NULL);
 



CVS commit: src/sys/arch/m68k/m68k

2021-04-15 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Apr 16 00:13:48 UTC 2021

Modified Files:
src/sys/arch/m68k/m68k: pmap_motorola.c

Log Message:
check the result value of pmap_extract() and panic if it fails.
this is a "should never fail" case, and GCC 10 noticed that it
allows an uninitialised variable use.

tested by rin@ on amiga and mac68k.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/arch/m68k/m68k/pmap_motorola.c

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



CVS commit: src/usr.bin/make

2021-04-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Apr 15 19:06:43 UTC 2021

Modified Files:
src/usr.bin/make: job.c

Log Message:
make: remove type name for the abort status in job handling


To generate a diff of this commit:
cvs rdiff -u -r1.426 -r1.427 src/usr.bin/make/job.c

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

Modified files:

Index: src/usr.bin/make/job.c
diff -u src/usr.bin/make/job.c:1.426 src/usr.bin/make/job.c:1.427
--- src/usr.bin/make/job.c:1.426	Thu Apr 15 18:36:17 2021
+++ src/usr.bin/make/job.c	Thu Apr 15 19:06:42 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.426 2021/04/15 18:36:17 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.427 2021/04/15 19:06:42 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -142,7 +142,7 @@
 #include "trace.h"
 
 /*	"@(#)job.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: job.c,v 1.426 2021/04/15 18:36:17 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.427 2021/04/15 19:06:42 rillig Exp $");
 
 /*
  * A shell defines how the commands are run.  All commands for a target are
@@ -247,14 +247,12 @@ typedef struct ShellWriter {
  * error handling variables
  */
 static int job_errors = 0;	/* number of errors reported */
-typedef enum AbortReason {	/* why is the make aborting? */
+static enum {			/* Why is the make aborting? */
 	ABORT_NONE,
-	ABORT_ERROR,		/* Because of an error */
-	ABORT_INTERRUPT,	/* Because it was interrupted */
+	ABORT_ERROR,		/* Aborted because of an error */
+	ABORT_INTERRUPT,	/* Aborted because it was interrupted */
 	ABORT_WAIT		/* Waiting for jobs to finish */
-	/* XXX: "WAIT" is not a _reason_ for aborting, it's rather a status. */
-} AbortReason;
-static AbortReason aborting = ABORT_NONE;
+} aborting = ABORT_NONE;
 #define JOB_TOKENS "+EI+"	/* Token to requeue for each abort state */
 
 /*



CVS commit: src/usr.bin/make

2021-04-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Apr 15 19:06:43 UTC 2021

Modified Files:
src/usr.bin/make: job.c

Log Message:
make: remove type name for the abort status in job handling


To generate a diff of this commit:
cvs rdiff -u -r1.426 -r1.427 src/usr.bin/make/job.c

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



CVS commit: src

2021-04-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Apr 15 19:02:29 UTC 2021

Modified Files:
src/distrib/sets/lists/tests: mi
src/usr.bin/make/unit-tests: Makefile
Added Files:
src/usr.bin/make/unit-tests: job-output-null.exp job-output-null.mk

Log Message:
tests/make: demonstrate handling of null bytes


To generate a diff of this commit:
cvs rdiff -u -r1.1040 -r1.1041 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.275 -r1.276 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/job-output-null.exp \
src/usr.bin/make/unit-tests/job-output-null.mk

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.1040 src/distrib/sets/lists/tests/mi:1.1041
--- src/distrib/sets/lists/tests/mi:1.1040	Wed Apr 14 18:27:11 2021
+++ src/distrib/sets/lists/tests/mi	Thu Apr 15 19:02:29 2021
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1040 2021/04/14 18:27:11 rillig Exp $
+# $NetBSD: mi,v 1.1041 2021/04/15 19:02:29 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -5487,6 +5487,8 @@
 ./usr/tests/usr.bin/make/unit-tests/job-flags.mktests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/job-output-long-lines.exp			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/job-output-long-lines.mk			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/job-output-null.exptests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/job-output-null.mktests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/jobs-empty-commands.exp			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/jobs-empty-commands.mk			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/jobs-error-indirect.exp			tests-usr.bin-tests	compattestfile,atf

Index: src/usr.bin/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.275 src/usr.bin/make/unit-tests/Makefile:1.276
--- src/usr.bin/make/unit-tests/Makefile:1.275	Sun Apr  4 13:20:52 2021
+++ src/usr.bin/make/unit-tests/Makefile	Thu Apr 15 19:02:29 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.275 2021/04/04 13:20:52 rillig Exp $
+# $NetBSD: Makefile,v 1.276 2021/04/15 19:02:29 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -204,6 +204,7 @@ TESTS+=		impsrc
 TESTS+=		include-main
 TESTS+=		job-flags
 TESTS+=		job-output-long-lines
+TESTS+=		job-output-null
 TESTS+=		jobs-empty-commands
 TESTS+=		jobs-error-indirect
 TESTS+=		jobs-error-nested

Added files:

Index: src/usr.bin/make/unit-tests/job-output-null.exp
diff -u /dev/null src/usr.bin/make/unit-tests/job-output-null.exp:1.1
--- /dev/null	Thu Apr 15 19:02:29 2021
+++ src/usr.bin/make/unit-tests/job-output-null.exp	Thu Apr 15 19:02:29 2021
@@ -0,0 +1,4 @@
+hello
+hello
+hello world without   newline, hello world without   newline, hello world without   newline.
+exit status 0
Index: src/usr.bin/make/unit-tests/job-output-null.mk
diff -u /dev/null src/usr.bin/make/unit-tests/job-output-null.mk:1.1
--- /dev/null	Thu Apr 15 19:02:29 2021
+++ src/usr.bin/make/unit-tests/job-output-null.mk	Thu Apr 15 19:02:29 2021
@@ -0,0 +1,32 @@
+# $NetBSD: job-output-null.mk,v 1.1 2021/04/15 19:02:29 rillig Exp $
+#
+# Test how null bytes in the output of a command are handled.  Make processes
+# them using null-terminated strings, which may cut off some of the output.
+#
+# As of 2021-04-15, make handles null bytes from the child process
+# inconsistently.  It's an edge case though since typically the child
+# processes output text.
+
+.MAKEFLAGS: -j1		# force jobs mode
+
+all: .PHONY
+	# The null byte from the command output is kept as-is.
+	# See CollectOutput, which looks like it intended to replace these
+	# null bytes with simple spaces.
+	@printf 'hello\0world%s\n' ''
+
+	# Give the parent process a chance to see the above output, but not
+	# yet the output from the next printf command.
+	@sleep 1
+
+	# All null bytes from the command output are kept as-is.
+	@printf 'hello\0world%s\n' '' '' '' '' '' ''
+
+	@sleep 1
+
+	# The null bytes are replaced with spaces since they are not followed
+	# by a newline.
+	#
+	# The three null bytes in a row test whether this output is
+	# compressed to a single space like in DebugFailedTarget.  It isn't.
+	@printf 'hello\0world\0without\0\0\0newline%s' ', ' ', ' '.'



CVS commit: src

2021-04-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Apr 15 19:02:29 UTC 2021

Modified Files:
src/distrib/sets/lists/tests: mi
src/usr.bin/make/unit-tests: Makefile
Added Files:
src/usr.bin/make/unit-tests: job-output-null.exp job-output-null.mk

Log Message:
tests/make: demonstrate handling of null bytes


To generate a diff of this commit:
cvs rdiff -u -r1.1040 -r1.1041 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.275 -r1.276 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/job-output-null.exp \
src/usr.bin/make/unit-tests/job-output-null.mk

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



CVS commit: src/usr.bin/make

2021-04-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Apr 15 18:36:17 UTC 2021

Modified Files:
src/usr.bin/make: job.c

Log Message:
make: rename PrintOutput to PrintFilteredOutput to avoid confusion

In the default configuration, the function PrintOutput did nothing.
Only if the shell has defined an output filter, something happens at
all.


To generate a diff of this commit:
cvs rdiff -u -r1.425 -r1.426 src/usr.bin/make/job.c

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

Modified files:

Index: src/usr.bin/make/job.c
diff -u src/usr.bin/make/job.c:1.425 src/usr.bin/make/job.c:1.426
--- src/usr.bin/make/job.c:1.425	Thu Apr 15 18:21:27 2021
+++ src/usr.bin/make/job.c	Thu Apr 15 18:36:17 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.425 2021/04/15 18:21:27 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.426 2021/04/15 18:36:17 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -142,7 +142,7 @@
 #include "trace.h"
 
 /*	"@(#)job.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: job.c,v 1.425 2021/04/15 18:21:27 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.426 2021/04/15 18:36:17 rillig Exp $");
 
 /*
  * A shell defines how the commands are run.  All commands for a target are
@@ -1724,12 +1724,15 @@ JobStart(GNode *gn, bool special)
 }
 
 /*
- * Print the output of the shell command, skipping the noPrint text of the
- * shell, if any.  The default shell does not have noPrint though, which means
- * that in all practical cases, handling the output is left to the caller.
+ * If the shell has an output filter (which only csh and ksh have by default),
+ * print the output of the child process, skipping the noPrint text of the
+ * shell.
+ *
+ * Return the part of the output that the calling function needs to output by
+ * itself.
  */
 static char *
-PrintOutput(char *cp, char *endp)	/* XXX: should all be const */
+PrintFilteredOutput(char *cp, char *endp)	/* XXX: should all be const */
 {
 	char *ecp;		/* XXX: should be const */
 
@@ -1835,8 +1838,8 @@ again:
 		} else if (job->outBuf[i] == '\0') {
 			/*
 			 * FIXME: The null characters are only replaced with
-			 * space in the last line.  Everywhere else they hide
-			 * the rest of the command output.
+			 * space _after_ the last '\n'.  Everywhere else they
+			 * hide the rest of the command output.
 			 */
 			job->outBuf[i] = ' ';
 		}
@@ -1874,10 +1877,10 @@ again:
 			 * do anything in the default shell, this bug has gone
 			 * unnoticed until now.
 			 */
-			cp = PrintOutput(job->outBuf, >outBuf[i]);
+			cp = PrintFilteredOutput(job->outBuf, >outBuf[i]);
 
 			/*
-			 * There's still more in that thar buffer. This time,
+			 * There's still more in the output buffer. This time,
 			 * though, we know there's no newline at the end, so
 			 * we add one of our own free will.
 			 */



CVS commit: src/usr.bin/make

2021-04-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Apr 15 18:36:17 UTC 2021

Modified Files:
src/usr.bin/make: job.c

Log Message:
make: rename PrintOutput to PrintFilteredOutput to avoid confusion

In the default configuration, the function PrintOutput did nothing.
Only if the shell has defined an output filter, something happens at
all.


To generate a diff of this commit:
cvs rdiff -u -r1.425 -r1.426 src/usr.bin/make/job.c

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



CVS commit: src/usr.bin/make

2021-04-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Apr 15 18:21:27 UTC 2021

Modified Files:
src/usr.bin/make: job.c

Log Message:
make: document two previously unknown bugs in job mode


To generate a diff of this commit:
cvs rdiff -u -r1.424 -r1.425 src/usr.bin/make/job.c

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

Modified files:

Index: src/usr.bin/make/job.c
diff -u src/usr.bin/make/job.c:1.424 src/usr.bin/make/job.c:1.425
--- src/usr.bin/make/job.c:1.424	Sun Apr  4 10:05:08 2021
+++ src/usr.bin/make/job.c	Thu Apr 15 18:21:27 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.424 2021/04/04 10:05:08 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.425 2021/04/15 18:21:27 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -142,7 +142,7 @@
 #include "trace.h"
 
 /*	"@(#)job.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: job.c,v 1.424 2021/04/04 10:05:08 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.425 2021/04/15 18:21:27 rillig Exp $");
 
 /*
  * A shell defines how the commands are run.  All commands for a target are
@@ -1834,7 +1834,9 @@ again:
 			break;
 		} else if (job->outBuf[i] == '\0') {
 			/*
-			 * Why?
+			 * FIXME: The null characters are only replaced with
+			 * space in the last line.  Everywhere else they hide
+			 * the rest of the command output.
 			 */
 			job->outBuf[i] = ' ';
 		}
@@ -1866,6 +1868,12 @@ again:
 		if (i >= job->curPos) {
 			char *cp;
 
+			/*
+			 * FIXME: SwitchOutputTo should be here, according to
+			 * the comment above.  But since PrintOutput does not
+			 * do anything in the default shell, this bug has gone
+			 * unnoticed until now.
+			 */
 			cp = PrintOutput(job->outBuf, >outBuf[i]);
 
 			/*



CVS commit: src/usr.bin/make

2021-04-15 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Apr 15 18:21:27 UTC 2021

Modified Files:
src/usr.bin/make: job.c

Log Message:
make: document two previously unknown bugs in job mode


To generate a diff of this commit:
cvs rdiff -u -r1.424 -r1.425 src/usr.bin/make/job.c

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



CVS commit: src/sys/rump/kern/lib/libsolaris

2021-04-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 15 17:31:45 UTC 2021

Modified Files:
src/sys/rump/kern/lib/libsolaris: Makefile

Log Message:
fix reversed comment


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/rump/kern/lib/libsolaris/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/rump/kern/lib/libsolaris/Makefile
diff -u src/sys/rump/kern/lib/libsolaris/Makefile:1.5 src/sys/rump/kern/lib/libsolaris/Makefile:1.6
--- src/sys/rump/kern/lib/libsolaris/Makefile:1.5	Thu Apr 15 13:28:09 2021
+++ src/sys/rump/kern/lib/libsolaris/Makefile	Thu Apr 15 13:31:44 2021
@@ -1,7 +1,7 @@
-#	$NetBSD: Makefile,v 1.5 2021/04/15 17:28:09 christos Exp $
+#	$NetBSD: Makefile,v 1.6 2021/04/15 17:31:44 christos Exp $
 #
 
-NEED_ISYSTEM=	# Tell rump that we can't use -isystem
+NEED_ISYSTEM=	# Tell rump that we must use -isystem
 
 .include 
 



CVS commit: src/sys/rump/kern/lib/libsolaris

2021-04-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 15 17:31:45 UTC 2021

Modified Files:
src/sys/rump/kern/lib/libsolaris: Makefile

Log Message:
fix reversed comment


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/rump/kern/lib/libsolaris/Makefile

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



CVS commit: src/sys/rump/fs/lib/libzfs

2021-04-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 15 17:31:16 UTC 2021

Modified Files:
src/sys/rump/fs/lib/libzfs: Makefile

Log Message:
fix reversed comment


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/rump/fs/lib/libzfs/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/rump/fs/lib/libzfs/Makefile
diff -u src/sys/rump/fs/lib/libzfs/Makefile:1.7 src/sys/rump/fs/lib/libzfs/Makefile:1.8
--- src/sys/rump/fs/lib/libzfs/Makefile:1.7	Sun Sep  6 03:20:30 2020
+++ src/sys/rump/fs/lib/libzfs/Makefile	Thu Apr 15 13:31:15 2021
@@ -1,6 +1,10 @@
-#	$NetBSD: Makefile,v 1.7 2020/09/06 07:20:30 mrg Exp $
+#	$NetBSD: Makefile,v 1.8 2021/04/15 17:31:15 christos Exp $
 #
 
+NEED_ISYSTEM=	# Tell rump that we must use -isystem
+
+.include 
+
 S!= cd ${.PARSEDIR}/../../../../;pwd
 
 .include "${.CURDIR}/../../../../modules/zfs/Makefile.zfsmod"



CVS commit: src/sys/rump/fs/lib/libzfs

2021-04-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 15 17:31:16 UTC 2021

Modified Files:
src/sys/rump/fs/lib/libzfs: Makefile

Log Message:
fix reversed comment


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/rump/fs/lib/libzfs/Makefile

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



CVS commit: src/sys/rump/kern/lib/libsolaris

2021-04-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 15 17:28:09 UTC 2021

Modified Files:
src/sys/rump/kern/lib/libsolaris: Makefile

Log Message:
- Define NEED_ISYSTEM here
- include  now that we can do it, because we need Makefile.rump
  to be included first, so that NOLINT gets defined, so that we don't end up
  building lint modules just for this.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/rump/kern/lib/libsolaris/Makefile

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



CVS commit: src/sys/rump/kern/lib/libsolaris

2021-04-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 15 17:28:09 UTC 2021

Modified Files:
src/sys/rump/kern/lib/libsolaris: Makefile

Log Message:
- Define NEED_ISYSTEM here
- include  now that we can do it, because we need Makefile.rump
  to be included first, so that NOLINT gets defined, so that we don't end up
  building lint modules just for this.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/rump/kern/lib/libsolaris/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/rump/kern/lib/libsolaris/Makefile
diff -u src/sys/rump/kern/lib/libsolaris/Makefile:1.4 src/sys/rump/kern/lib/libsolaris/Makefile:1.5
--- src/sys/rump/kern/lib/libsolaris/Makefile:1.4	Mon May 28 17:05:02 2018
+++ src/sys/rump/kern/lib/libsolaris/Makefile	Thu Apr 15 13:28:09 2021
@@ -1,6 +1,10 @@
-#	$NetBSD: Makefile,v 1.4 2018/05/28 21:05:02 chs Exp $
+#	$NetBSD: Makefile,v 1.5 2021/04/15 17:28:09 christos Exp $
 #
 
+NEED_ISYSTEM=	# Tell rump that we can't use -isystem
+
+.include 
+
 S!= cd ${.PARSEDIR}/../../../../;pwd
 
 .include "${.CURDIR}/../../../../modules/solaris/Makefile.solmod"



CVS commit: src/sys/modules/zfs

2021-04-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 15 17:26:22 UTC 2021

Modified Files:
src/sys/modules/zfs: Makefile.zfsmod

Log Message:
- Don't define NEED_ISYSTEM. This is a rump thing and should be only exposed
  there.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/modules/zfs/Makefile.zfsmod

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/zfs/Makefile.zfsmod
diff -u src/sys/modules/zfs/Makefile.zfsmod:1.9 src/sys/modules/zfs/Makefile.zfsmod:1.10
--- src/sys/modules/zfs/Makefile.zfsmod:1.9	Tue Feb  5 04:54:36 2019
+++ src/sys/modules/zfs/Makefile.zfsmod	Thu Apr 15 13:26:22 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.zfsmod,v 1.9 2019/02/05 09:54:36 hannken Exp $
+#	$NetBSD: Makefile.zfsmod,v 1.10 2021/04/15 17:26:22 christos Exp $
 
 ZFSDIR=	${S}/../external/cddl/osnet
 
@@ -135,5 +135,3 @@ CPPFLAGS+=	-I${ZFSDIR}/dist/uts/common/z
 CPPFLAGS+=	-I${ZFSDIR}/dist/uts/common
 
 CPPFLAGS+=	-D_PROPLIB_ZFS_CONFLICT
-
-NEED_ISYSTEM=	# duplicate headers, depends on -isystem to build



CVS commit: src/sys/modules/zfs

2021-04-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 15 17:26:22 UTC 2021

Modified Files:
src/sys/modules/zfs: Makefile.zfsmod

Log Message:
- Don't define NEED_ISYSTEM. This is a rump thing and should be only exposed
  there.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/modules/zfs/Makefile.zfsmod

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



CVS commit: src/sys/modules/solaris

2021-04-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 15 17:26:07 UTC 2021

Modified Files:
src/sys/modules/solaris: Makefile.solmod

Log Message:
- Don't include  It should be done by the enclosing Makefile
- Don't define NEED_ISYSTEM. This is a rump thing and should be only exposed
  there.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/modules/solaris/Makefile.solmod

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/solaris/Makefile.solmod
diff -u src/sys/modules/solaris/Makefile.solmod:1.8 src/sys/modules/solaris/Makefile.solmod:1.9
--- src/sys/modules/solaris/Makefile.solmod:1.8	Mon Apr 12 00:41:54 2021
+++ src/sys/modules/solaris/Makefile.solmod	Thu Apr 15 13:26:07 2021
@@ -1,6 +1,4 @@
-#	$NetBSD: Makefile.solmod,v 1.8 2021/04/12 04:41:54 mrg Exp $
-
-.include 
+#	$NetBSD: Makefile.solmod,v 1.9 2021/04/15 17:26:07 christos Exp $
 
 ZFSDIR=	${S}/../external/cddl/osnet
 
@@ -84,5 +82,3 @@ CPPFLAGS+=	-I${ZFSDIR}/dist/common
 CPPFLAGS+=	-I${ZFSDIR}/dist/uts/common/zmod
 CPPFLAGS+=	-I${ZFSDIR}/dist/uts/common
 CPPFLAGS+=  -I${ZFSDIR}/sys/sys
-
-NEED_ISYSTEM=   # duplicate headers, depends on -isystem to build



CVS commit: src/sys/modules/solaris

2021-04-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 15 17:26:07 UTC 2021

Modified Files:
src/sys/modules/solaris: Makefile.solmod

Log Message:
- Don't include  It should be done by the enclosing Makefile
- Don't define NEED_ISYSTEM. This is a rump thing and should be only exposed
  there.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/modules/solaris/Makefile.solmod

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



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

2021-04-15 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Thu Apr 15 14:43:19 UTC 2021

Modified Files:
src/sys/arch/hp300/dev: diofb.c topcat.c

Log Message:
Fix two problems on old topcat(4) framebuffers found on HP332/340.

- Fix panic on monochrome framebuffers. They don't have palette registers.
  The problem was reported from Anders Gustafsson and also Andrew Gillham
  back in 2013:
   https://mail-index.netbsd.org/port-hp300/2013/09/27/msg86.html
   https://mail-index.netbsd.org/port-hp300/2013/09/28/msg87.html
- Fix incorrect framebuffer width of 98542/98544 framebuffers on HP332.
  Reported from Andrew Gillham (98542) as above and Chris Hanson (98543):
   https://mail-index.netbsd.org/port-hp300/2013/09/27/msg83.html
   https://mail-index.netbsd.org/port-hp300/2020/05/01/msg000164.html

Worth to pullup to netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/hp300/dev/diofb.c \
src/sys/arch/hp300/dev/topcat.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/hp300/dev/diofb.c
diff -u src/sys/arch/hp300/dev/diofb.c:1.4 src/sys/arch/hp300/dev/diofb.c:1.5
--- src/sys/arch/hp300/dev/diofb.c:1.4	Mon Mar 24 19:42:58 2014
+++ src/sys/arch/hp300/dev/diofb.c	Thu Apr 15 14:43:19 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: diofb.c,v 1.4 2014/03/24 19:42:58 christos Exp $	*/
+/*	$NetBSD: diofb.c,v 1.5 2021/04/15 14:43:19 tsutsui Exp $	*/
 /*	$OpenBSD: diofb.c,v 1.18 2010/12/26 15:40:59 miod Exp $	*/
 
 /*
@@ -146,6 +146,15 @@ diofb_fbinquire(struct diofb *fb, int sc
 	if (fb->dheight > fb->fbheight)
 		fb->dheight = fb->fbheight;
 
+	/*
+	 * Some displays, such as the HP332 and HP340 internal video
+	 * appear to return a display width of 1024 instead of 512.
+	 */
+	if (fbr->num_planes == 1 || fbr->num_planes == 4) {
+		if (fb->dwidth == 1024 && fb->dheight == 400)
+			fb->dwidth = 512;
+	}
+
 	fb->planes = fbr->num_planes;
 	if (fb->planes > 8)
 		fb->planes = 8;
Index: src/sys/arch/hp300/dev/topcat.c
diff -u src/sys/arch/hp300/dev/topcat.c:1.4 src/sys/arch/hp300/dev/topcat.c:1.5
--- src/sys/arch/hp300/dev/topcat.c:1.4	Fri Feb 18 19:15:43 2011
+++ src/sys/arch/hp300/dev/topcat.c	Thu Apr 15 14:43:19 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: topcat.c,v 1.4 2011/02/18 19:15:43 tsutsui Exp $	*/
+/*	$NetBSD: topcat.c,v 1.5 2021/04/15 14:43:19 tsutsui Exp $	*/
 /*	$OpenBSD: topcat.c,v 1.15 2006/08/11 18:33:13 miod Exp $	*/
 
 /*
@@ -274,7 +274,10 @@ topcat_end_attach(struct topcat_softc *s
 	case GID_TOPCAT:
 		switch (sc->sc_fb->planes) {
 		case 1:
-			fbname = "HP98544 topcat";
+			if (sc->sc_fb->dheight == 400)
+fbname = "HP98542 topcat";
+			else
+fbname = "HP98544 topcat";
 			break;
 		case 4:
 			if (sc->sc_fb->dheight == 400)
@@ -413,8 +416,12 @@ topcat_ioctl(void *v, void *vs, u_long c
 		*(u_int *)data = fb->ri.ri_stride;
 		return 0;
 	case WSDISPLAYIO_GETCMAP:
+		if (fb->planemask == 1)
+			return EPASSTHROUGH;
 		return diofb_getcmap(fb, (struct wsdisplay_cmap *)data);
 	case WSDISPLAYIO_PUTCMAP:
+		if (fb->planemask == 1)
+			return EPASSTHROUGH;
 		return topcat_setcmap(fb, (struct wsdisplay_cmap *)data);
 	case WSDISPLAYIO_GVIDEO:
 	case WSDISPLAYIO_SVIDEO:
@@ -429,6 +436,10 @@ topcat_setcolor(struct diofb *fb, u_int 
 {
 	volatile struct tcboxfb *tc = (struct tcboxfb *)fb->regkva;
 
+	/* No color map registers on monochrome framebuffers. */
+	if (fb->planemask == 1)
+		return;
+
 	if (tc->regs.fbid != GID_TOPCAT) {
 		tccm_waitbusy(tc);
 		tc->plane_mask = 0xff;



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

2021-04-15 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Thu Apr 15 14:43:19 UTC 2021

Modified Files:
src/sys/arch/hp300/dev: diofb.c topcat.c

Log Message:
Fix two problems on old topcat(4) framebuffers found on HP332/340.

- Fix panic on monochrome framebuffers. They don't have palette registers.
  The problem was reported from Anders Gustafsson and also Andrew Gillham
  back in 2013:
   https://mail-index.netbsd.org/port-hp300/2013/09/27/msg86.html
   https://mail-index.netbsd.org/port-hp300/2013/09/28/msg87.html
- Fix incorrect framebuffer width of 98542/98544 framebuffers on HP332.
  Reported from Andrew Gillham (98542) as above and Chris Hanson (98543):
   https://mail-index.netbsd.org/port-hp300/2013/09/27/msg83.html
   https://mail-index.netbsd.org/port-hp300/2020/05/01/msg000164.html

Worth to pullup to netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/hp300/dev/diofb.c \
src/sys/arch/hp300/dev/topcat.c

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



CVS commit: src/sys/dev/pci

2021-04-15 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Apr 15 09:05:24 UTC 2021

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

Log Message:
mtu for revision B0 and B1 is supported up to 16338 bytes


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

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

Modified files:

Index: src/sys/dev/pci/if_aq.c
diff -u src/sys/dev/pci/if_aq.c:1.22 src/sys/dev/pci/if_aq.c:1.23
--- src/sys/dev/pci/if_aq.c:1.22	Thu Apr 15 09:04:42 2021
+++ src/sys/dev/pci/if_aq.c	Thu Apr 15 09:05:24 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_aq.c,v 1.22 2021/04/15 09:04:42 ryo Exp $	*/
+/*	$NetBSD: if_aq.c,v 1.23 2021/04/15 09:05:24 ryo Exp $	*/
 
 /**
  * aQuantia Corporation Network Driver
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.22 2021/04/15 09:04:42 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.23 2021/04/15 09:05:24 ryo Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_if_aq.h"
@@ -116,6 +116,9 @@ __KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.
 #define AQ_RSS_HASHKEY_SIZE		40
 #define AQ_RSS_INDIRECTION_TABLE_MAX	64
 
+#define AQ_JUMBO_MTU_REV_A		9000
+#define AQ_JUMBO_MTU_REV_B		16338
+
 /*
  * TERMINOLOGY
  *	MPI = MAC PHY INTERFACE?
@@ -996,6 +999,7 @@ struct aq_softc {
 #define FEATURES_REV_B0		0x2000
 #define FEATURES_REV_B1		0x4000
 #define FEATURES_REV_B		(FEATURES_REV_B0|FEATURES_REV_B1)
+	uint32_t sc_max_mtu;
 	uint32_t sc_mbox_addr;
 
 	bool sc_rbl_enabled;
@@ -2118,6 +2122,7 @@ aq_fw_version_init(struct aq_softc *sc)
 		fw_vers);
 		sc->sc_features |= FEATURES_REV_A0 |
 		FEATURES_MPI_AQ | FEATURES_MIPS;
+		sc->sc_max_mtu = AQ_JUMBO_MTU_REV_A;
 		break;
 	case 0x02:
 		aprint_normal_dev(sc->sc_dev, "Atlantic revision B0, %s\n",
@@ -2125,6 +2130,7 @@ aq_fw_version_init(struct aq_softc *sc)
 		sc->sc_features |= FEATURES_REV_B0 |
 		FEATURES_MPI_AQ | FEATURES_MIPS |
 		FEATURES_TPO2 | FEATURES_RPF2;
+		sc->sc_max_mtu = AQ_JUMBO_MTU_REV_B;
 		break;
 	case 0x0A:
 		aprint_normal_dev(sc->sc_dev, "Atlantic revision B1, %s\n",
@@ -2132,10 +2138,13 @@ aq_fw_version_init(struct aq_softc *sc)
 		sc->sc_features |= FEATURES_REV_B1 |
 		FEATURES_MPI_AQ | FEATURES_MIPS |
 		FEATURES_TPO2 | FEATURES_RPF2;
+		sc->sc_max_mtu = AQ_JUMBO_MTU_REV_B;
 		break;
 	default:
 		aprint_error_dev(sc->sc_dev,
 		"Unknown revision (0x%08x)\n", hwrev);
+		sc->sc_features = 0;
+		sc->sc_max_mtu = ETHERMTU;
 		error = ENOTSUP;
 		break;
 	}
@@ -4740,7 +4749,19 @@ aq_ioctl(struct ifnet *ifp, unsigned lon
 	error = 0;
 
 	s = splnet();
-	error = ether_ioctl(ifp, cmd, data);
+	switch (cmd) {
+	case SIOCSIFMTU:
+		if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > sc->sc_max_mtu) {
+			error = EINVAL;
+		} else {
+			ifp->if_mtu = ifr->ifr_mtu;
+			error = 0;	/* no need to reset (no ENETRESET) */
+		}
+		break;
+	default:
+		error = ether_ioctl(ifp, cmd, data);
+		break;
+	}
 	splx(s);
 
 	if (error != ENETRESET)



CVS commit: src/sys/dev/pci

2021-04-15 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Apr 15 09:05:24 UTC 2021

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

Log Message:
mtu for revision B0 and B1 is supported up to 16338 bytes


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

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



CVS commit: src/sys/dev/pci

2021-04-15 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Apr 15 09:04:42 UTC 2021

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

Log Message:
fixed the problem of instability when changing mtu in IFF_UP state


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/pci/if_aq.c

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

Modified files:

Index: src/sys/dev/pci/if_aq.c
diff -u src/sys/dev/pci/if_aq.c:1.21 src/sys/dev/pci/if_aq.c:1.22
--- src/sys/dev/pci/if_aq.c:1.21	Thu Apr 15 09:04:08 2021
+++ src/sys/dev/pci/if_aq.c	Thu Apr 15 09:04:42 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_aq.c,v 1.21 2021/04/15 09:04:08 ryo Exp $	*/
+/*	$NetBSD: if_aq.c,v 1.22 2021/04/15 09:04:42 ryo Exp $	*/
 
 /**
  * aQuantia Corporation Network Driver
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.21 2021/04/15 09:04:08 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.22 2021/04/15 09:04:42 ryo Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_if_aq.h"
@@ -4487,6 +4487,8 @@ aq_init(struct ifnet *ifp)
 	struct aq_softc *sc = ifp->if_softc;
 	int i, error = 0;
 
+	aq_stop(ifp, false);
+
 	AQ_LOCK(sc);
 
 	aq_set_vlan_filters(sc);
@@ -4659,6 +4661,9 @@ aq_stop(struct ifnet *ifp, int disable)
 
 	ifp->if_timer = 0;
 
+	if ((ifp->if_flags & IFF_RUNNING) == 0)
+		goto already_stopped;
+
 	/* disable tx/rx interrupts */
 	aq_enable_intr(sc, true, false);
 
@@ -4679,6 +4684,7 @@ aq_stop(struct ifnet *ifp, int disable)
 
 	ifp->if_timer = 0;
 
+ already_stopped:
 	if (!disable) {
 		/* when pmf stop, disable link status intr and callout */
 		aq_enable_intr(sc, false, false);



CVS commit: src/sys/dev/pci

2021-04-15 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Apr 15 09:04:42 UTC 2021

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

Log Message:
fixed the problem of instability when changing mtu in IFF_UP state


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/pci/if_aq.c

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



CVS commit: src/sys/dev/pci

2021-04-15 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Apr 15 09:04:08 UTC 2021

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

Log Message:
add support hardware tcp/udp rx checksum offloading


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/pci/if_aq.c

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



CVS commit: src/sys/dev/pci

2021-04-15 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Apr 15 09:04:08 UTC 2021

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

Log Message:
add support hardware tcp/udp rx checksum offloading


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/pci/if_aq.c

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

Modified files:

Index: src/sys/dev/pci/if_aq.c
diff -u src/sys/dev/pci/if_aq.c:1.20 src/sys/dev/pci/if_aq.c:1.21
--- src/sys/dev/pci/if_aq.c:1.20	Thu Feb 18 17:56:04 2021
+++ src/sys/dev/pci/if_aq.c	Thu Apr 15 09:04:08 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_aq.c,v 1.20 2021/02/18 17:56:04 ryo Exp $	*/
+/*	$NetBSD: if_aq.c,v 1.21 2021/04/15 09:04:08 ryo Exp $	*/
 
 /**
  * aQuantia Corporation Network Driver
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.20 2021/02/18 17:56:04 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.21 2021/04/15 09:04:08 ryo Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_if_aq.h"
@@ -1445,24 +1445,14 @@ aq_attach(device_t parent, device_t self
 	ifp->if_capabilities |= IFCAP_TSOv4 | IFCAP_TSOv6;
 #endif
 
-#if notyet
-	/*
-	 * XXX:
-	 *   Rx L4 CSUM doesn't work well for fragment packet.
-	 *   aq marks 'CHEDKED' and 'BAD' for them.
-	 *   we need to ignore (clear) hw-csum flags if the packet is fragmented
-	 *
-	 *   TODO: test with LRO enabled
-	 */
-	ifp->if_capabilities |= IFCAP_CSUM_TCPv4_Rx | IFCAP_CSUM_TCPv6_Rx;
-	ifp->if_capabilities |= IFCAP_CSUM_UDPv4_Rx | IFCAP_CSUM_UDPv6_Rx;
-#endif
 	/* TX hardware checksum offloadding */
 	ifp->if_capabilities |= IFCAP_CSUM_IPv4_Tx;
 	ifp->if_capabilities |= IFCAP_CSUM_TCPv4_Tx | IFCAP_CSUM_TCPv6_Tx;
 	ifp->if_capabilities |= IFCAP_CSUM_UDPv4_Tx | IFCAP_CSUM_UDPv6_Tx;
 	/* RX hardware checksum offloadding */
 	ifp->if_capabilities |= IFCAP_CSUM_IPv4_Rx;
+	ifp->if_capabilities |= IFCAP_CSUM_TCPv4_Rx | IFCAP_CSUM_TCPv6_Rx;
+	ifp->if_capabilities |= IFCAP_CSUM_UDPv4_Rx | IFCAP_CSUM_UDPv6_Rx;
 
 	error = if_initialize(ifp);
 	if (error != 0) {
@@ -4365,11 +4355,11 @@ aq_rx_intr(void *arg)
 	m0->m_pkthdr.csum_flags |=
 	M_CSUM_IPv4_BAD;
 			}
-#if notyet
+
 			/*
-			 * XXX: aq always marks BAD for fragmented packet.
-			 * we should peek L3 header, and ignore cksum flags
-			 * if the packet is fragmented.
+			 * aq will always mark BAD for fragment packets,
+			 * but this is not a problem because the IP stack
+			 * ignores the CSUM flag in fragment packets.
 			 */
 			if (__SHIFTOUT(rxd_type,
 			RXDESC_TYPE_TCPUDP_CSUM_CHECKED)) {
@@ -4422,7 +4412,7 @@ aq_rx_intr(void *arg)
 	M_CSUM_TCP_UDP_BAD;
 }
 			}
-#endif
+
 			m_set_rcvif(m0, ifp);
 			if_statinc_ref(nsr, if_ipackets);
 			if_statadd_ref(nsr, if_ibytes, m0->m_pkthdr.len);



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

2021-04-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Apr 15 08:23:24 UTC 2021

Modified Files:
src/sys/arch/alpha/include: cpu.h

Log Message:
Fix fallout from alpha/interrupt.c rev 1.93:

http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/alpha/alpha/interrupt.c#rev1.93

by which interrupts *seem* to occupy 100% CPU time.

Now, we bump ci_intrdepth for clock interrupt. Therefore, if ci_intrdepth > 1
is observed in statclock(), CPU is actually occupied by interrupts.

Thanks jklos and thorpej for notice!


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 src/sys/arch/alpha/include/cpu.h

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

Modified files:

Index: src/sys/arch/alpha/include/cpu.h
diff -u src/sys/arch/alpha/include/cpu.h:1.99 src/sys/arch/alpha/include/cpu.h:1.100
--- src/sys/arch/alpha/include/cpu.h:1.99	Thu Oct 15 01:00:01 2020
+++ src/sys/arch/alpha/include/cpu.h	Thu Apr 15 08:23:24 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.99 2020/10/15 01:00:01 thorpej Exp $ */
+/* $NetBSD: cpu.h,v 1.100 2021/04/15 08:23:24 rin Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -205,7 +205,8 @@ struct clockframe {
  * r/m/w cycle is complete, we won't be counted... but it's not
  * like this stastic has to be extremely accurate.
  */
-#define	CLKF_INTR(framep)	(curcpu()->ci_intrdepth)
+#define	CLKF_INTR(framep)		\
+	(curcpu()->ci_intrdepth > 1)	/* one for clock interrupt itself */
 
 /*
  * This is used during profiling to integrate system time.  It can safely



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

2021-04-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Apr 15 08:23:24 UTC 2021

Modified Files:
src/sys/arch/alpha/include: cpu.h

Log Message:
Fix fallout from alpha/interrupt.c rev 1.93:

http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/alpha/alpha/interrupt.c#rev1.93

by which interrupts *seem* to occupy 100% CPU time.

Now, we bump ci_intrdepth for clock interrupt. Therefore, if ci_intrdepth > 1
is observed in statclock(), CPU is actually occupied by interrupts.

Thanks jklos and thorpej for notice!


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 src/sys/arch/alpha/include/cpu.h

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



CVS commit: src/external/cddl/osnet/sys/sys

2021-04-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 15 07:00:50 UTC 2021

Modified Files:
src/external/cddl/osnet/sys/sys: opentypes.h

Log Message:
avoid second typedef for boolean_t in kernel code originally defined in



To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/cddl/osnet/sys/sys/opentypes.h

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

Modified files:

Index: src/external/cddl/osnet/sys/sys/opentypes.h
diff -u src/external/cddl/osnet/sys/sys/opentypes.h:1.5 src/external/cddl/osnet/sys/sys/opentypes.h:1.6
--- src/external/cddl/osnet/sys/sys/opentypes.h:1.5	Wed Dec  4 22:21:42 2019
+++ src/external/cddl/osnet/sys/sys/opentypes.h	Thu Apr 15 03:00:50 2021
@@ -36,7 +36,9 @@ typedef id_t		ctid_t;
 
 #define	B_FALSE	0
 #define	B_TRUE	1
+#ifndef _KERNEL
 typedef int		boolean_t;
+#endif
 
 #ifndef __defined_hr_t
 #define __defined_hr_t



CVS commit: src/external/cddl/osnet/sys/sys

2021-04-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 15 07:00:50 UTC 2021

Modified Files:
src/external/cddl/osnet/sys/sys: opentypes.h

Log Message:
avoid second typedef for boolean_t in kernel code originally defined in



To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/cddl/osnet/sys/sys/opentypes.h

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



CVS commit: src/external/cddl/osnet/sys/sys

2021-04-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 15 06:59:57 UTC 2021

Modified Files:
src/external/cddl/osnet/sys/sys: vnode.h

Log Message:
remove extra typedef for vnode_t done in 


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/external/cddl/osnet/sys/sys/vnode.h

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

Modified files:

Index: src/external/cddl/osnet/sys/sys/vnode.h
diff -u src/external/cddl/osnet/sys/sys/vnode.h:1.17 src/external/cddl/osnet/sys/sys/vnode.h:1.18
--- src/external/cddl/osnet/sys/sys/vnode.h:1.17	Tue May 26 04:39:27 2020
+++ src/external/cddl/osnet/sys/sys/vnode.h	Thu Apr 15 02:59:57 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnode.h,v 1.17 2020/05/26 08:39:27 hannken Exp $	*/
+/*	$NetBSD: vnode.h,v 1.18 2021/04/15 06:59:57 christos Exp $	*/
 
 /*
  * CDDL HEADER START
@@ -99,10 +99,7 @@
 
 #ifdef _KERNEL
 
-struct vnode;
 struct vattr;
-
-typedef	struct vnode	vnode_t;
 typedef	struct vattr	vattr_t;
 typedef enum vtype vtype_t;
 



CVS commit: src/external/cddl/osnet/sys/sys

2021-04-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 15 06:59:57 UTC 2021

Modified Files:
src/external/cddl/osnet/sys/sys: vnode.h

Log Message:
remove extra typedef for vnode_t done in 


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/external/cddl/osnet/sys/sys/vnode.h

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