CVS commit: src/share/man/man7

2022-11-19 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat Nov 19 22:09:21 UTC 2022

Modified Files:
src/share/man/man7: orders.7

Log Message:
Extend orders(7) with prefixes from Resolution 3 of the 27th meeting of CGPM.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/share/man/man7/orders.7

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

Modified files:

Index: src/share/man/man7/orders.7
diff -u src/share/man/man7/orders.7:1.6 src/share/man/man7/orders.7:1.7
--- src/share/man/man7/orders.7:1.6	Sat Aug  6 11:07:18 2011
+++ src/share/man/man7/orders.7	Sat Nov 19 22:09:21 2022
@@ -1,4 +1,4 @@
-.\" $NetBSD: orders.7,v 1.6 2011/08/06 11:07:18 jruoho Exp $
+.\" $NetBSD: orders.7,v 1.7 2022/11/19 22:09:21 jakllsch Exp $
 .\"
 .\" Copyright (c) 2010 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd August 6, 2011
+.Dd November 19, 2022
 .Dt ORDERS 7
 .Os
 .Sh NAME
@@ -46,6 +46,8 @@ The following table lists common multipl
 .It Exabyte Ta EB Ta 2^60 Ta 10^18
 .It Zettabyte Ta ZB Ta 2^70 Ta 10^21
 .It Yottabyte Ta YB Ta 2^80 Ta 10^24
+.It Ronnabyte Ta RB Ta 2^90 Ta 10^27
+.It Quettabyte Ta QB Ta 2^100 Ta 10^30
 .El
 .Pp
 The following table lists common bit rates as a power of ten.
@@ -68,6 +70,8 @@ The following table lists common orders 
 .Bl -column -offset 2n \
 "Septillionth" "Order" "Prefix" "Symbol" "Decimal"
 .It Sy Name Ta Sy Order Ta Sy Prefix Ta Sy Symbol Ta Sy Decimal
+.It Nonillionth Ta 10^-30 Ta quecto Ta q Ta 0.01
+.It Octillionth Ta 10^-27 Ta ronto Ta r Ta 0.001
 .It Septillionth Ta 10^-24 Ta yocto Ta y Ta 0.0001
 .It Sextillionth Ta 10^-21 Ta zepto Ta z Ta 0.1
 .It Quintillionth Ta 10^-18 Ta atto Ta a Ta 0.01
@@ -89,6 +93,8 @@ The following table lists common orders 
 .It Quintillion Ta 10^18 Ta exa Ta E Ta 100
 .It Sextillion Ta 10^21 Ta zetta Ta Z Ta 10
 .It Septillion Ta 10^24 Ta yotta Ta Y Ta 1
+.It Octillion Ta 10^27 Ta ronna Ta R Ta 1000
+.It Nonillion Ta 10^30 Ta quetta Ta Q Ta 100
 .El
 .Sh SEE ALSO
 .Xr units 1 ,



CVS commit: src/share/man/man7

2022-11-19 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat Nov 19 22:09:21 UTC 2022

Modified Files:
src/share/man/man7: orders.7

Log Message:
Extend orders(7) with prefixes from Resolution 3 of the 27th meeting of CGPM.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/share/man/man7/orders.7

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



CVS commit: src/sys/kern

2022-11-19 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Nov 19 15:30:12 UTC 2022

Modified Files:
src/sys/kern: subr_optstr.c

Log Message:
Style. NFCI.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/kern/subr_optstr.c

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

Modified files:

Index: src/sys/kern/subr_optstr.c
diff -u src/sys/kern/subr_optstr.c:1.6 src/sys/kern/subr_optstr.c:1.7
--- src/sys/kern/subr_optstr.c:1.6	Mon May 30 11:24:40 2016
+++ src/sys/kern/subr_optstr.c	Sat Nov 19 15:30:12 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_optstr.c,v 1.6 2016/05/30 11:24:40 martin Exp $	*/
+/*	$NetBSD: subr_optstr.c,v 1.7 2022/11/19 15:30:12 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_optstr.c,v 1.6 2016/05/30 11:24:40 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_optstr.c,v 1.7 2022/11/19 15:30:12 skrll Exp $");
 
 #include 
 #include 
@@ -46,9 +46,7 @@ __KERNEL_RCSID(0, "$NetBSD: subr_optstr.
 bool
 optstr_get(const char *optstr, const char *key, char *buf, size_t bufsize)
 {
-	bool found;
-
-	found = false;
+	bool found = false;
 
 	/* Skip any initial spaces until we find a word. */
 	while (*optstr == ' ')



CVS commit: src/sys/kern

2022-11-19 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Nov 19 15:30:12 UTC 2022

Modified Files:
src/sys/kern: subr_optstr.c

Log Message:
Style. NFCI.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/kern/subr_optstr.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/netstat

2022-11-19 Thread Takahiro Kambe
Module Name:src
Committed By:   taca
Date:   Sat Nov 19 14:42:36 UTC 2022

Modified Files:
src/usr.bin/netstat: if.c

Log Message:
netstat/if.c: Fix error message with "-w" option.

Now ifq_drops is 64bit unsigned integer.

No description in src/doc/CHANGES?


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/usr.bin/netstat/if.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/netstat/if.c
diff -u src/usr.bin/netstat/if.c:1.106 src/usr.bin/netstat/if.c:1.107
--- src/usr.bin/netstat/if.c:1.106	Mon Oct 24 08:11:25 2022
+++ src/usr.bin/netstat/if.c	Sat Nov 19 14:42:35 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.c,v 1.106 2022/10/24 08:11:25 msaitoh Exp $	*/
+/*	$NetBSD: if.c,v 1.107 2022/11/19 14:42:35 taca Exp $	*/
 
 /*
  * Copyright (c) 1983, 1988, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "from: @(#)if.c	8.2 (Berkeley) 2/21/94";
 #else
-__RCSID("$NetBSD: if.c,v 1.106 2022/10/24 08:11:25 msaitoh Exp $");
+__RCSID("$NetBSD: if.c,v 1.107 2022/11/19 14:42:35 taca Exp $");
 #endif
 #endif /* not lint */
 
@@ -176,7 +176,7 @@ if_data_ext_get(const char *ifname, stru
 {
 	char namebuf[1024];
 	size_t len;
-	int drops;
+	uint64_t drops;
 
 	/* For sysctl */
 	snprintf(namebuf, sizeof(namebuf),



CVS commit: src/usr.bin/netstat

2022-11-19 Thread Takahiro Kambe
Module Name:src
Committed By:   taca
Date:   Sat Nov 19 14:42:36 UTC 2022

Modified Files:
src/usr.bin/netstat: if.c

Log Message:
netstat/if.c: Fix error message with "-w" option.

Now ifq_drops is 64bit unsigned integer.

No description in src/doc/CHANGES?


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/usr.bin/netstat/if.c

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



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

2022-11-19 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Nov 19 12:16:03 UTC 2022

Modified Files:
src/sys/arch/riscv/include: bus_defs.h bus_funcs.h

Log Message:
Fix some types


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/riscv/include/bus_defs.h \
src/sys/arch/riscv/include/bus_funcs.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/riscv/include/bus_defs.h
diff -u src/sys/arch/riscv/include/bus_defs.h:1.1 src/sys/arch/riscv/include/bus_defs.h:1.2
--- src/sys/arch/riscv/include/bus_defs.h:1.1	Sun Sep 11 15:31:12 2022
+++ src/sys/arch/riscv/include/bus_defs.h	Sat Nov 19 12:16:03 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_defs.h,v 1.1 2022/09/11 15:31:12 skrll Exp $	*/
+/*	$NetBSD: bus_defs.h,v 1.2 2022/11/19 12:16:03 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc.
@@ -339,7 +339,7 @@ typedef struct riscv_bus_dma_segment	bus
  *	This structure describes a valid DMA range.
  */
 struct riscv_dma_range {
-	bus_addr_t	dr_sysbase;	/* system base address */
+	paddr_t		dr_sysbase;	/* system base address */
 	bus_addr_t	dr_busbase;	/* appears here on bus */
 	bus_size_t	dr_len;		/* length of range */
 	uint32_t	dr_flags;	/* flags for range */
Index: src/sys/arch/riscv/include/bus_funcs.h
diff -u src/sys/arch/riscv/include/bus_funcs.h:1.1 src/sys/arch/riscv/include/bus_funcs.h:1.2
--- src/sys/arch/riscv/include/bus_funcs.h:1.1	Sun Sep 11 15:31:12 2022
+++ src/sys/arch/riscv/include/bus_funcs.h	Sat Nov 19 12:16:03 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_funcs.h,v 1.1 2022/09/11 15:31:12 skrll Exp $	*/
+/*	$NetBSD: bus_funcs.h,v 1.2 2022/11/19 12:16:03 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc.
@@ -720,7 +720,7 @@ paddr_t	_bus_dmamem_mmap(bus_dma_tag_t t
 int	_bus_dmamem_alloc_range(bus_dma_tag_t tag, bus_size_t size,
 	bus_size_t alignment, bus_size_t boundary,
 	bus_dma_segment_t *segs, int nsegs, int *rsegs, int flags,
-	vaddr_t low, vaddr_t high);
+	paddr_t low, paddr_t high);
 
 int	_bus_dmatag_subregion(bus_dma_tag_t, bus_addr_t, bus_addr_t,
 	bus_dma_tag_t *, int);



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

2022-11-19 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Nov 19 12:16:03 UTC 2022

Modified Files:
src/sys/arch/riscv/include: bus_defs.h bus_funcs.h

Log Message:
Fix some types


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/riscv/include/bus_defs.h \
src/sys/arch/riscv/include/bus_funcs.h

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



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

2022-11-19 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Nov 19 12:15:22 UTC 2022

Modified Files:
src/sys/arch/arm/include: bus_funcs.h

Log Message:
Fix _bus_dmamem_alloc_range function declaration - low and high are
paddr_t


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/include/bus_funcs.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/arm/include/bus_funcs.h
diff -u src/sys/arch/arm/include/bus_funcs.h:1.11 src/sys/arch/arm/include/bus_funcs.h:1.12
--- src/sys/arch/arm/include/bus_funcs.h:1.11	Sun Jan 24 13:33:56 2021
+++ src/sys/arch/arm/include/bus_funcs.h	Sat Nov 19 12:15:22 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_funcs.h,v 1.11 2021/01/24 13:33:56 martin Exp $	*/
+/*	$NetBSD: bus_funcs.h,v 1.12 2022/11/19 12:15:22 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc.
@@ -769,7 +769,7 @@ paddr_t	_bus_dmamem_mmap(bus_dma_tag_t t
 int	_bus_dmamem_alloc_range(bus_dma_tag_t tag, bus_size_t size,
 	bus_size_t alignment, bus_size_t boundary,
 	bus_dma_segment_t *segs, int nsegs, int *rsegs, int flags,
-	vaddr_t low, vaddr_t high);
+	paddr_t low, paddr_t high);
 
 int	_bus_dmatag_subregion(bus_dma_tag_t, bus_addr_t, bus_addr_t,
 	bus_dma_tag_t *, int);



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

2022-11-19 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Nov 19 12:15:22 UTC 2022

Modified Files:
src/sys/arch/arm/include: bus_funcs.h

Log Message:
Fix _bus_dmamem_alloc_range function declaration - low and high are
paddr_t


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/include/bus_funcs.h

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



CVS commit: src/sys/arch/arm/cortex

2022-11-19 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Nov 19 12:12:26 UTC 2022

Modified Files:
src/sys/arch/arm/cortex: gtmr_var.h

Log Message:
G/C gtmr_init function declaration


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/arm/cortex/gtmr_var.h

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

Modified files:

Index: src/sys/arch/arm/cortex/gtmr_var.h
diff -u src/sys/arch/arm/cortex/gtmr_var.h:1.15 src/sys/arch/arm/cortex/gtmr_var.h:1.16
--- src/sys/arch/arm/cortex/gtmr_var.h:1.15	Fri Nov 12 21:59:04 2021
+++ src/sys/arch/arm/cortex/gtmr_var.h	Sat Nov 19 12:12:25 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: gtmr_var.h,v 1.15 2021/11/12 21:59:04 jmcneill Exp $ */
+/* $NetBSD: gtmr_var.h,v 1.16 2022/11/19 12:12:25 skrll Exp $ */
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -51,7 +51,6 @@ struct gtmr_softc {
 #ifdef _KERNEL
 #include "opt_arm_timer.h"
 struct cpu_info;
-void	gtmr_init(device_t);
 int	gtmr_intr(void *);
 void	gtmr_init_cpu_clock(struct cpu_info *);
 void	gtmr_delay(unsigned int n);



CVS commit: src/sys/arch/arm/cortex

2022-11-19 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Nov 19 12:12:26 UTC 2022

Modified Files:
src/sys/arch/arm/cortex: gtmr_var.h

Log Message:
G/C gtmr_init function declaration


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/arm/cortex/gtmr_var.h

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



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

2022-11-19 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Nov 19 12:10:03 UTC 2022

Modified Files:
src/sys/arch/riscv/conf: GENERIC

Log Message:
Some comments


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/riscv/conf/GENERIC

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



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

2022-11-19 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Nov 19 12:10:03 UTC 2022

Modified Files:
src/sys/arch/riscv/conf: GENERIC

Log Message:
Some comments


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/riscv/conf/GENERIC

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/riscv/conf/GENERIC
diff -u src/sys/arch/riscv/conf/GENERIC:1.19 src/sys/arch/riscv/conf/GENERIC:1.20
--- src/sys/arch/riscv/conf/GENERIC:1.19	Tue Nov 15 14:44:04 2022
+++ src/sys/arch/riscv/conf/GENERIC	Sat Nov 19 12:10:03 2022
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.19 2022/11/15 14:44:04 simonb Exp $
+# $NetBSD: GENERIC,v 1.20 2022/11/19 12:10:03 skrll Exp $
 #
 # GENERIC machine description file
 #
@@ -22,14 +22,14 @@ include	"arch/riscv/conf/std.riscv64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.19 $"
+#ident 		"GENERIC-$Revision: 1.20 $"
 
 maxusers	64		# estimated number of users
 
 options 	FDT
 
-#options 	EARLYCONS=com, CONSADDR=0x1000
-#options 	EARLYCONS=com, CONSADDR=0x1244
+#options 	EARLYCONS=com, CONSADDR=0x1000	# qemu virt
+#options 	EARLYCONS=com, CONSADDR=0x1244	# sifive
 options 	VERBOSE_INIT_RISCV
 
 # Standard system options



CVS commit: src/sys/arch/riscv/riscv

2022-11-19 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Nov 19 09:55:11 UTC 2022

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

Log Message:
Fix CONSADDR and save a label


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/riscv/riscv/locore.S

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

Modified files:

Index: src/sys/arch/riscv/riscv/locore.S
diff -u src/sys/arch/riscv/riscv/locore.S:1.39 src/sys/arch/riscv/riscv/locore.S:1.40
--- src/sys/arch/riscv/riscv/locore.S:1.39	Sun Oct 16 06:14:53 2022
+++ src/sys/arch/riscv/riscv/locore.S	Sat Nov 19 09:55:11 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.S,v 1.39 2022/10/16 06:14:53 skrll Exp $ */
+/* $NetBSD: locore.S,v 1.40 2022/11/19 09:55:11 skrll Exp $ */
 
 /*-
  * Copyright (c) 2014, 2022 The NetBSD Foundation, Inc.
@@ -292,7 +292,7 @@ ENTRY_NP(start)
 	or	s0, s0, s7
 
 	VPRINTS("cons:")
-	VPRINTX(s2)
+	VPRINTX(s9)
 	VPRINTS(":  ")
 	VPRINTXNL(s0)
 
@@ -303,7 +303,7 @@ ENTRY_NP(start)
 	call	_C_LABEL(uartputc)
 
 	/* Set supervisor trap vector base register */
-	PTR_LA	t0, .Lmmu_on
+	PTR_LA	t0, vstart
 	add	t0, t0, s8
 	csrw	stvec, t0
 
@@ -319,10 +319,14 @@ ENTRY_NP(start)
 	csrw	satp, t0
 
 	.align 2
-.Lmmu_on:
+	.global vstart
+vstart:
 	// MMU is on!
 	csrw	sscratch, zero		// zero in sscratch to mark kernel
 
+#ifdef CONSADDR
+	add	sp, sp, s8
+#endif
 	li	a0, 'M'
 	call	_C_LABEL(uartputc)	// uartputs doesn't use stack
 	li	a0, '\n'
@@ -332,8 +336,6 @@ ENTRY_NP(start)
 
 	PTR_LA	tp, _C_LABEL(lwp0)	// put curlwp in tp
 
-	.global vstart
-vstart:
 
 	/* Set supervisor trap vector base register */
 	PTR_LA	a0, _C_LABEL(cpu_exception_handler)



CVS commit: src/sys/arch/riscv/riscv

2022-11-19 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Nov 19 09:55:11 UTC 2022

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

Log Message:
Fix CONSADDR and save a label


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/riscv/riscv/locore.S

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



CVS commit: src/sys/arch/arm/broadcom

2022-11-19 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Sat Nov 19 09:29:26 UTC 2022

Modified Files:
src/sys/arch/arm/broadcom: bcm2835_intr.c

Log Message:
bcm2835_intr.c: fix !MULTIPROCESSOR

Tested on Raspberry PI 3 model A+.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/arm/broadcom/bcm2835_intr.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/arm/broadcom/bcm2835_intr.c
diff -u src/sys/arch/arm/broadcom/bcm2835_intr.c:1.43 src/sys/arch/arm/broadcom/bcm2835_intr.c:1.44
--- src/sys/arch/arm/broadcom/bcm2835_intr.c:1.43	Sat Jun 25 12:41:55 2022
+++ src/sys/arch/arm/broadcom/bcm2835_intr.c	Sat Nov 19 09:29:26 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm2835_intr.c,v 1.43 2022/06/25 12:41:55 jmcneill Exp $	*/
+/*	$NetBSD: bcm2835_intr.c,v 1.44 2022/11/19 09:29:26 yamt Exp $	*/
 
 /*-
  * Copyright (c) 2012, 2015, 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_intr.c,v 1.43 2022/06/25 12:41:55 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_intr.c,v 1.44 2022/11/19 09:29:26 yamt Exp $");
 
 #define _INTR_PRIVATE
 
@@ -99,7 +99,12 @@ static int  bcm2835_icu_match(device_t, 
 static void bcm2835_icu_attach(device_t, device_t, void *);
 
 static int bcm2835_int_base;
-static int bcm2836mp_int_base[BCM2836_NCPUS];
+#if defined(MULTIPROCESSOR)
+#define _BCM2836_NCPUS BCM2836_NCPUS
+#else
+#define _BCM2836_NCPUS 1
+#endif
+static int bcm2836mp_int_base[_BCM2836_NCPUS];
 
 #define	BCM2835_INT_BASE		bcm2835_int_base
 #define	BCM2836_INT_BASECPUN(n)		bcm2836mp_int_base[(n)]
@@ -180,8 +185,8 @@ static struct pic_ops bcm2836mp_picops =
 #endif
 };
 
-static struct pic_softc bcm2836mp_pic[BCM2836_NCPUS] = {
-	[0 ... BCM2836_NCPUS - 1] = {
+static struct pic_softc bcm2836mp_pic[_BCM2836_NCPUS] = {
+	[0 ... _BCM2836_NCPUS - 1] = {
 		.pic_ops = _picops,
 		.pic_maxsources = BCM2836_NIRQPERCPU,
 		.pic_name = "bcm2836 pic",
@@ -208,7 +213,7 @@ struct bcm2836mp_interrupt {
 	int bi_flags;
 	int (*bi_func)(void *);
 	void *bi_arg;
-	void *bi_ihs[BCM2836_NCPUS];
+	void *bi_ihs[_BCM2836_NCPUS];
 };
 
 static TAILQ_HEAD(, bcm2836mp_interrupt) bcm2836mp_interrupts =
@@ -360,7 +365,6 @@ bcm2835_icu_attach(device_t parent, devi
 
 		ifuncs = _fdt_funcs;
 
-#if defined(MULTIPROCESSOR)
 		/*
 		 * Register all PICs here in order to avoid pic_add() from
 		 * cpu_hatch().  This is the only approved method.
@@ -371,8 +375,8 @@ bcm2835_icu_attach(device_t parent, devi
 			const cpuid_t cpuid = ci->ci_core_id;
 			struct pic_softc * const pic = _pic[cpuid];
 
-			KASSERT(cpuid < BCM2836_NCPUS);
-
+			KASSERT(cpuid < _BCM2836_NCPUS);
+#if defined(MULTIPROCESSOR)
 			pic->pic_cpus = ci->ci_kcpuset;
 			/*
 			 * Append "#n" to avoid duplication of .pic_name[]
@@ -381,12 +385,13 @@ bcm2835_icu_attach(device_t parent, devi
 			char suffix[sizeof("#0")];
 			snprintf(suffix, sizeof(suffix), "#%lu", cpuid);
 			strlcat(pic->pic_name, suffix, sizeof(pic->pic_name));
-
+#endif
 			bcm2836mp_int_base[cpuid] =
 			pic_add(pic, PIC_IRQBASE_ALLOC);
+#if defined(MULTIPROCESSOR)
 			bcm2836mp_intr_init(ci);
-		}
 #endif
+		}
 	} else {
 		if (bcml1icu_sc == NULL)
 			arm_fdt_irq_set_handler(bcm2835_irq_handler);
@@ -414,7 +419,7 @@ bcm2835_irq_handler(void *frame)
 	const uint32_t oldipl_mask = __BIT(oldipl);
 	int ipl_mask = 0;
 
-	KASSERT(cpuid < BCM2836_NCPUS);
+	KASSERT(cpuid < _BCM2836_NCPUS);
 
 	ci->ci_data.cpu_nintr++;
 
@@ -692,7 +697,7 @@ bcm2836mp_pic_unblock_irqs(struct pic_so
 	const bus_space_handle_t ioh = bcml1icu_sc->sc_ioh;
 	const cpuid_t cpuid = pic - _pic[0];
 
-	KASSERT(cpuid < BCM2836_NCPUS);
+	KASSERT(cpuid < _BCM2836_NCPUS);
 	KASSERT(irqbase == 0);
 
 	if (irq_mask & BCM2836MP_TIMER_IRQS) {
@@ -739,7 +744,7 @@ bcm2836mp_pic_block_irqs(struct pic_soft
 	const bus_space_handle_t ioh = bcml1icu_sc->sc_ioh;
 	const cpuid_t cpuid = pic - _pic[0];
 
-	KASSERT(cpuid < BCM2836_NCPUS);
+	KASSERT(cpuid < _BCM2836_NCPUS);
 	KASSERT(irqbase == 0);
 
 	if (irq_mask & BCM2836MP_TIMER_IRQS) {
@@ -777,7 +782,7 @@ bcm2836mp_pic_find_pending_irqs(struct p
 	uint32_t lpending;
 	int ipl = 0;
 
-	KASSERT(cpuid < BCM2836_NCPUS);
+	KASSERT(cpuid < _BCM2836_NCPUS);
 	KASSERT(pic == _pic[cpuid]);
 
 	bcm2835_barrier();
@@ -816,7 +821,7 @@ static void bcm2836mp_cpu_init(struct pi
 {
 	const cpuid_t cpuid = ci->ci_core_id;
 
-	KASSERT(cpuid < BCM2836_NCPUS);
+	KASSERT(cpuid < _BCM2836_NCPUS);
 
 	/* Enable IRQ and not FIQ */
 	bus_space_write_4(bcml1icu_sc->sc_iot, bcml1icu_sc->sc_ioh,
@@ -831,7 +836,7 @@ bcm2836mp_send_ipi(struct pic_softc *pic
 	KASSERT(pic->pic_cpus != NULL);
 
 	const cpuid_t cpuid = pic - _pic[0];
-	KASSERT(cpuid < BCM2836_NCPUS);
+	KASSERT(cpuid < _BCM2836_NCPUS);
 
 	bus_space_write_4(bcml1icu_sc->sc_iot, bcml1icu_sc->sc_ioh,
 	BCM2836_LOCAL_MAILBOX0_SETN(cpuid), __BIT(ipi));
@@ -844,7 +849,7 @@ 

CVS commit: src/sys/arch/arm/broadcom

2022-11-19 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Sat Nov 19 09:29:26 UTC 2022

Modified Files:
src/sys/arch/arm/broadcom: bcm2835_intr.c

Log Message:
bcm2835_intr.c: fix !MULTIPROCESSOR

Tested on Raspberry PI 3 model A+.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/arm/broadcom/bcm2835_intr.c

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



CVS commit: src/distrib/utils/embedded/conf

2022-11-19 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Sat Nov 19 09:19:28 UTC 2022

Modified Files:
src/distrib/utils/embedded/conf: armv7.conf rpi.conf rpi_inst.conf

Log Message:
Update a few www.raspberrypi.com URLs


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/distrib/utils/embedded/conf/armv7.conf
cvs rdiff -u -r1.39 -r1.40 src/distrib/utils/embedded/conf/rpi.conf
cvs rdiff -u -r1.18 -r1.19 src/distrib/utils/embedded/conf/rpi_inst.conf

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

Modified files:

Index: src/distrib/utils/embedded/conf/armv7.conf
diff -u src/distrib/utils/embedded/conf/armv7.conf:1.44 src/distrib/utils/embedded/conf/armv7.conf:1.45
--- src/distrib/utils/embedded/conf/armv7.conf:1.44	Wed May 27 21:53:04 2020
+++ src/distrib/utils/embedded/conf/armv7.conf	Sat Nov 19 09:19:27 2022
@@ -1,4 +1,4 @@
-# $NetBSD: armv7.conf,v 1.44 2020/05/27 21:53:04 jmcneill Exp $
+# $NetBSD: armv7.conf,v 1.45 2022/11/19 09:19:27 yamt Exp $
 # ARMv7 customization script used by mkimage
 #
 board=armv7
@@ -65,9 +65,9 @@ upstream_kernel=1
 os_prefix=dtb/
 cmdline=../cmdline.txt
 kernel=/netbsd-GENERIC.img
-# Boot options, see https://www.raspberrypi.org/documentation/configuration/config-txt/boot.md
+# Boot options, see https://www.raspberrypi.com/documentation/computers/config_txt.html#boot-options
 kernel_address=0x0140
-# UART settings, see https://www.raspberrypi.org/documentation/configuration/uart.md
+# UART settings, see https://www.raspberrypi.com/documentation/computers/configuration.html#configuring-uarts
 enable_uart=1
 force_turbo=0
 EOF

Index: src/distrib/utils/embedded/conf/rpi.conf
diff -u src/distrib/utils/embedded/conf/rpi.conf:1.39 src/distrib/utils/embedded/conf/rpi.conf:1.40
--- src/distrib/utils/embedded/conf/rpi.conf:1.39	Tue Dec  1 04:21:26 2020
+++ src/distrib/utils/embedded/conf/rpi.conf	Sat Nov 19 09:19:27 2022
@@ -1,4 +1,4 @@
-# $NetBSD: rpi.conf,v 1.39 2020/12/01 04:21:26 rin Exp $
+# $NetBSD: rpi.conf,v 1.40 2022/11/19 09:19:27 yamt Exp $
 # Raspberry Pi customization script used by mkimage
 #
 
@@ -59,7 +59,7 @@ EOF
 upstream_kernel=1
 os_prefix=dtb/
 cmdline=../cmdline.txt
-# UART settings, see https://www.raspberrypi.org/documentation/configuration/uart.md
+# UART settings, see https://www.raspberrypi.com/documentation/computers/configuration.html#configuring-uarts
 enable_uart=1
 force_turbo=0
 # Default kernel for BCM2836 and later

Index: src/distrib/utils/embedded/conf/rpi_inst.conf
diff -u src/distrib/utils/embedded/conf/rpi_inst.conf:1.18 src/distrib/utils/embedded/conf/rpi_inst.conf:1.19
--- src/distrib/utils/embedded/conf/rpi_inst.conf:1.18	Tue Jul  6 11:49:36 2021
+++ src/distrib/utils/embedded/conf/rpi_inst.conf	Sat Nov 19 09:19:27 2022
@@ -1,4 +1,4 @@
-# $NetBSD: rpi_inst.conf,v 1.18 2021/07/06 11:49:36 jmcneill Exp $
+# $NetBSD: rpi_inst.conf,v 1.19 2022/11/19 09:19:27 yamt Exp $
 # Raspberry Pi customization script used by mkimage
 #
 
@@ -47,7 +47,7 @@ upstream_kernel=1
 os_prefix=dtb/
 cmdline=../cmdline.txt
 kernel=/kernel.img
-# UART settings, see https://www.raspberrypi.org/documentation/configuration/uart.md
+# UART settings, https://www.raspberrypi.com/documentation/computers/configuration.html#configuring-uarts
 enable_uart=1
 force_turbo=0
 EOF



CVS commit: src/distrib/utils/embedded/conf

2022-11-19 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Sat Nov 19 09:19:28 UTC 2022

Modified Files:
src/distrib/utils/embedded/conf: armv7.conf rpi.conf rpi_inst.conf

Log Message:
Update a few www.raspberrypi.com URLs


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/distrib/utils/embedded/conf/armv7.conf
cvs rdiff -u -r1.39 -r1.40 src/distrib/utils/embedded/conf/rpi.conf
cvs rdiff -u -r1.18 -r1.19 src/distrib/utils/embedded/conf/rpi_inst.conf

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



CVS commit: src/sys/arch/arm/rockchip

2022-11-19 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Sat Nov 19 09:17:57 UTC 2022

Modified Files:
src/sys/arch/arm/rockchip: files.rockchip

Log Message:
arm/rockchip: fix build w/o MULTIPROCESSOR


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/arm/rockchip/files.rockchip

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/arm/rockchip/files.rockchip
diff -u src/sys/arch/arm/rockchip/files.rockchip:1.28 src/sys/arch/arm/rockchip/files.rockchip:1.29
--- src/sys/arch/arm/rockchip/files.rockchip:1.28	Tue Aug 23 05:40:46 2022
+++ src/sys/arch/arm/rockchip/files.rockchip	Sat Nov 19 09:17:57 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: files.rockchip,v 1.28 2022/08/23 05:40:46 ryo Exp $
+#	$NetBSD: files.rockchip,v 1.29 2022/11/19 09:17:57 yamt Exp $
 #
 # Configuration info for Rockchip family SoCs
 #
@@ -6,7 +6,7 @@
 
 file	arch/arm/rockchip/rk_platform.c		soc_rockchip
 
-file	arch/arm/rockchip/rk3066_smp.c		soc_rk3288
+file	arch/arm/rockchip/rk3066_smp.c		soc_rk3288 & multiprocessor
 
 # Clock and reset unit (CRU)
 device	rkcru: rk_cru



CVS commit: src/sys/arch/arm/rockchip

2022-11-19 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Sat Nov 19 09:17:57 UTC 2022

Modified Files:
src/sys/arch/arm/rockchip: files.rockchip

Log Message:
arm/rockchip: fix build w/o MULTIPROCESSOR


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/arm/rockchip/files.rockchip

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



CVS commit: src/sys/arch/arm/sunxi

2022-11-19 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Sat Nov 19 09:05:42 UTC 2022

Modified Files:
src/sys/arch/arm/sunxi: sunxi_can.c

Log Message:
sunxi_can.c: fix build with MBUFTRACE


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/sunxi/sunxi_can.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/arm/sunxi/sunxi_can.c
diff -u src/sys/arch/arm/sunxi/sunxi_can.c:1.12 src/sys/arch/arm/sunxi/sunxi_can.c:1.13
--- src/sys/arch/arm/sunxi/sunxi_can.c:1.12	Tue Sep 27 06:14:13 2022
+++ src/sys/arch/arm/sunxi/sunxi_can.c	Sat Nov 19 09:05:42 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: sunxi_can.c,v 1.12 2022/09/27 06:14:13 skrll Exp $	*/
+/*	$NetBSD: sunxi_can.c,v 1.13 2022/11/19 09:05:42 yamt Exp $	*/
 
 /*-
  * Copyright (c) 2017,2018 The NetBSD Foundation, Inc.
@@ -36,13 +36,14 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: sunxi_can.c,v 1.12 2022/09/27 06:14:13 skrll Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sunxi_can.c,v 1.13 2022/11/19 09:05:42 yamt Exp $");
 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 



CVS commit: src/sys/arch/arm/sunxi

2022-11-19 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Sat Nov 19 09:05:42 UTC 2022

Modified Files:
src/sys/arch/arm/sunxi: sunxi_can.c

Log Message:
sunxi_can.c: fix build with MBUFTRACE


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/sunxi/sunxi_can.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/netstat

2022-11-19 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Sat Nov 19 08:56:20 UTC 2022

Modified Files:
src/usr.bin/netstat: bpf.c

Log Message:
netstat/bpf.c: Don't print garbage for stale pid


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/usr.bin/netstat/bpf.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/netstat

2022-11-19 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Sat Nov 19 08:56:20 UTC 2022

Modified Files:
src/usr.bin/netstat: bpf.c

Log Message:
netstat/bpf.c: Don't print garbage for stale pid


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/usr.bin/netstat/bpf.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/netstat/bpf.c
diff -u src/usr.bin/netstat/bpf.c:1.16 src/usr.bin/netstat/bpf.c:1.17
--- src/usr.bin/netstat/bpf.c:1.16	Thu Sep  1 10:10:20 2022
+++ src/usr.bin/netstat/bpf.c	Sat Nov 19 08:56:20 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: bpf.c,v 1.16 2022/09/01 10:10:20 msaitoh Exp $	*/
+/*	$NetBSD: bpf.c,v 1.17 2022/11/19 08:56:20 yamt Exp $	*/
 
 /*
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -162,8 +162,13 @@ bpf_dump(const char *bpfif)
 			name[namelen++] = szproc;
 			name[namelen++] = 1;
 
+			/*
+			 * Note: The sysctl succeeds (returns 0) even if it failed
+			 * to find the process. The szproc check below is to detect
+			 * that case.
+			 */
 			if (prog_sysctl([0], namelen, , ,
-			NULL, 0) == -1)
+			NULL, 0) == -1 || szproc != sizeof(p))
 printf("-\n");
 			else
 printf("%s\n", p.p_comm);



CVS commit: src/sys/net

2022-11-19 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Sat Nov 19 08:53:06 UTC 2022

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

Log Message:
bpf: refresh bd_pid in a few more places as well

This made "netstat -B" show hostapd and wpa_supplicant for me.

kingcrab# netstat -B
Active BPF peers
PID Int Recv Drop Capt Flags  Bufsize  Comm
433 urtwn0  102  02I-RSH  524288   hostapd
211 urtwn0  102  04I-RS-  32768dhcpd
670 bwfm0   295  02I-RSH  524288   wpa_supplicant
kingcrab#


To generate a diff of this commit:
cvs rdiff -u -r1.247 -r1.248 src/sys/net/bpf.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/bpf.c
diff -u src/sys/net/bpf.c:1.247 src/sys/net/bpf.c:1.248
--- src/sys/net/bpf.c:1.247	Sat Sep  3 10:03:20 2022
+++ src/sys/net/bpf.c	Sat Nov 19 08:53:06 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: bpf.c,v 1.247 2022/09/03 10:03:20 riastradh Exp $	*/
+/*	$NetBSD: bpf.c,v 1.248 2022/11/19 08:53:06 yamt Exp $	*/
 
 /*
  * Copyright (c) 1990, 1991, 1993
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.247 2022/09/03 10:03:20 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.248 2022/11/19 08:53:06 yamt Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_bpf.h"
@@ -682,6 +682,11 @@ bpf_read(struct file *fp, off_t *offp, s
 	int timed_out;
 	int error;
 
+	/*
+	 * Refresh the PID associated with this bpf file.
+	 */
+	d->bd_pid = curproc->p_pid;
+
 	getnanotime(>bd_atime);
 	/*
 	 * Restrict application to use a buffer the same size as
@@ -817,6 +822,11 @@ bpf_write(struct file *fp, off_t *offp, 
 	struct psref psref;
 	int bound;
 
+	/*
+	 * Refresh the PID associated with this bpf file.
+	 */
+	d->bd_pid = curproc->p_pid;
+
 	m = NULL;	/* XXX gcc */
 
 	bound = curlwp_bind();
@@ -1569,6 +1579,11 @@ filt_bpfread(struct knote *kn, long hint
 	struct bpf_d *d = kn->kn_hook;
 	int rv;
 
+	/*
+	 * Refresh the PID associated with this bpf file.
+	 */
+	d->bd_pid = curproc->p_pid;
+
 	mutex_enter(d->bd_buf_mtx);
 	kn->kn_data = d->bd_hlen;
 	if (d->bd_immediate)



CVS commit: src/sys/net

2022-11-19 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Sat Nov 19 08:53:06 UTC 2022

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

Log Message:
bpf: refresh bd_pid in a few more places as well

This made "netstat -B" show hostapd and wpa_supplicant for me.

kingcrab# netstat -B
Active BPF peers
PID Int Recv Drop Capt Flags  Bufsize  Comm
433 urtwn0  102  02I-RSH  524288   hostapd
211 urtwn0  102  04I-RS-  32768dhcpd
670 bwfm0   295  02I-RSH  524288   wpa_supplicant
kingcrab#


To generate a diff of this commit:
cvs rdiff -u -r1.247 -r1.248 src/sys/net/bpf.c

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



CVS commit: src/sys

2022-11-19 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Sat Nov 19 08:00:51 UTC 2022

Modified Files:
src/sys/net: if_llatbl.c if_llatbl.h nd.c
src/sys/netinet: in.c in_var.h

Log Message:
Make arp have its own mowner

This helped me to debug mbuf leaks in arp.
(if_arp.c rev. 1.298)


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/net/if_llatbl.c
cvs rdiff -u -r1.18 -r1.19 src/sys/net/if_llatbl.h
cvs rdiff -u -r1.4 -r1.5 src/sys/net/nd.c
cvs rdiff -u -r1.245 -r1.246 src/sys/netinet/in.c
cvs rdiff -u -r1.102 -r1.103 src/sys/netinet/in_var.h

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

Modified files:

Index: src/sys/net/if_llatbl.c
diff -u src/sys/net/if_llatbl.c:1.34 src/sys/net/if_llatbl.c:1.35
--- src/sys/net/if_llatbl.c:1.34	Tue May 24 20:50:20 2022
+++ src/sys/net/if_llatbl.c	Sat Nov 19 08:00:51 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_llatbl.c,v 1.34 2022/05/24 20:50:20 andvar Exp $	*/
+/*	$NetBSD: if_llatbl.c,v 1.35 2022/11/19 08:00:51 yamt Exp $	*/
 /*
  * Copyright (c) 2004 Luigi Rizzo, Alessandro Cerri. All rights reserved.
  * Copyright (c) 2004-2008 Qing Li. All rights reserved.
@@ -540,6 +540,9 @@ lltable_allocate_htbl(uint32_t hsize)
 	llt->llt_foreach_entry = htable_foreach_lle;
 
 	llt->llt_free_tbl = htable_free_tbl;
+#ifdef MBUFTRACE
+	llt->llt_mowner = NULL;
+#endif
 
 	return (llt);
 }

Index: src/sys/net/if_llatbl.h
diff -u src/sys/net/if_llatbl.h:1.18 src/sys/net/if_llatbl.h:1.19
--- src/sys/net/if_llatbl.h:1.18	Mon Sep 14 15:09:57 2020
+++ src/sys/net/if_llatbl.h	Sat Nov 19 08:00:51 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_llatbl.h,v 1.18 2020/09/14 15:09:57 roy Exp $	*/
+/*	$NetBSD: if_llatbl.h,v 1.19 2022/11/19 08:00:51 yamt Exp $	*/
 /*
  * Copyright (c) 2004 Luigi Rizzo, Alessandro Cerri. All rights reserved.
  * Copyright (c) 2004-2008 Qing Li. All rights reserved.
@@ -34,6 +34,7 @@
 
 #if defined(_KERNEL_OPT)
 #include "opt_gateway.h"
+#include "opt_mbuftrace.h"
 #endif
 
 #include 
@@ -232,6 +233,9 @@ struct lltable {
 	llt_unlink_entry_t	*llt_unlink_entry;
 	llt_fill_sa_entry_t	*llt_fill_sa_entry;
 	llt_free_tbl_t		*llt_free_tbl;
+#ifdef MBUFTRACE
+	struct mowner		*llt_mowner;
+#endif
 };
 
 MALLOC_DECLARE(M_LLTABLE);

Index: src/sys/net/nd.c
diff -u src/sys/net/nd.c:1.4 src/sys/net/nd.c:1.5
--- src/sys/net/nd.c:1.4	Tue Sep 15 23:40:03 2020
+++ src/sys/net/nd.c	Sat Nov 19 08:00:51 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: nd.c,v 1.4 2020/09/15 23:40:03 roy Exp $	*/
+/*	$NetBSD: nd.c,v 1.5 2022/11/19 08:00:51 yamt Exp $	*/
 
 /*
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nd.c,v 1.4 2020/09/15 23:40:03 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd.c,v 1.5 2022/11/19 08:00:51 yamt Exp $");
 
 #include 
 #include 
@@ -359,6 +359,9 @@ nd_resolve(struct llentry *ln, const str
 	ln->ln_state == ND_LLINFO_WAITDELETE)
 		ln->ln_state = ND_LLINFO_INCOMPLETE;
 
+#ifdef MBUFTRACE
+	m_claimm(m, ln->lle_tbl->llt_mowner);
+#endif
 	if (ln->ln_hold != NULL) {
 		struct mbuf *m_hold;
 		int i;

Index: src/sys/netinet/in.c
diff -u src/sys/netinet/in.c:1.245 src/sys/netinet/in.c:1.246
--- src/sys/netinet/in.c:1.245	Thu Nov 17 05:02:11 2022
+++ src/sys/netinet/in.c	Sat Nov 19 08:00:51 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: in.c,v 1.245 2022/11/17 05:02:11 knakahara Exp $	*/
+/*	$NetBSD: in.c,v 1.246 2022/11/19 08:00:51 yamt Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.245 2022/11/17 05:02:11 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.246 2022/11/19 08:00:51 yamt Exp $");
 
 #include "arp.h"
 
@@ -2415,7 +2415,7 @@ in_sysctl_init(struct sysctllog **clog)
 #if NARP > 0
 
 static struct lltable *
-in_lltattach(struct ifnet *ifp)
+in_lltattach(struct ifnet *ifp, struct in_ifinfo *ii)
 {
 	struct lltable *llt;
 
@@ -2431,6 +2431,12 @@ in_lltattach(struct ifnet *ifp)
 	llt->llt_fill_sa_entry = in_lltable_fill_sa_entry;
 	llt->llt_free_entry = in_lltable_free_entry;
 	llt->llt_match_prefix = in_lltable_match_prefix;
+#ifdef MBUFTRACE
+	struct mowner *mowner = >ii_mowner;
+	mowner_init_owner(mowner, ifp->if_xname, "arp");
+	MOWNER_ATTACH(mowner);
+	llt->llt_mowner = mowner;
+#endif
 	lltable_link(llt);
 
 	return (llt);
@@ -2446,7 +2452,7 @@ in_domifattach(struct ifnet *ifp)
 	ii = kmem_zalloc(sizeof(struct in_ifinfo), KM_SLEEP);
 
 #if NARP > 0
-	ii->ii_llt = in_lltattach(ifp);
+	ii->ii_llt = in_lltattach(ifp, ii);
 #endif
 
 #ifdef IPSELSRC
@@ -2467,6 +2473,9 @@ in_domifdetach(struct ifnet *ifp, void *
 #endif
 #if NARP > 0
 	lltable_free(ii->ii_llt);
+#ifdef MBUFTRACE
+	MOWNER_DETACH(>ii_mowner);
+#endif
 #endif
 	kmem_free(ii, sizeof(struct in_ifinfo));
 }

Index: src/sys/netinet/in_var.h
diff -u src/sys/netinet/in_var.h:1.102 src/sys/netinet/in_var.h:1.103
--- src/sys/netinet/in_var.h:1.102	Mon Mar  8 22:01:18 2021
+++ 

CVS commit: src/sys

2022-11-19 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Sat Nov 19 08:00:51 UTC 2022

Modified Files:
src/sys/net: if_llatbl.c if_llatbl.h nd.c
src/sys/netinet: in.c in_var.h

Log Message:
Make arp have its own mowner

This helped me to debug mbuf leaks in arp.
(if_arp.c rev. 1.298)


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/net/if_llatbl.c
cvs rdiff -u -r1.18 -r1.19 src/sys/net/if_llatbl.h
cvs rdiff -u -r1.4 -r1.5 src/sys/net/nd.c
cvs rdiff -u -r1.245 -r1.246 src/sys/netinet/in.c
cvs rdiff -u -r1.102 -r1.103 src/sys/netinet/in_var.h

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