CVS commit: src/share/doc/standards/xopen

2024-04-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr  5 23:06:32 UTC 2024

Modified Files:
src/share/doc/standards/xopen: Makefile

Log Message:
spacify the paper size for PostScript


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/share/doc/standards/xopen/Makefile

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

Modified files:

Index: src/share/doc/standards/xopen/Makefile
diff -u src/share/doc/standards/xopen/Makefile:1.5 src/share/doc/standards/xopen/Makefile:1.6
--- src/share/doc/standards/xopen/Makefile:1.5	Fri Aug  1 13:04:01 2003
+++ src/share/doc/standards/xopen/Makefile	Fri Apr  5 19:06:32 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.5 2003/08/01 17:04:01 lukem Exp $
+#	$NetBSD: Makefile,v 1.6 2024/04/05 23:06:32 christos Exp $
 
 DOCS=	xcu5
 .for i in ${DOCS}
@@ -7,7 +7,7 @@ TARGS+=	${i}.ps ${i}.txt ${i}.html ${i}.
 
 POST_PLAIN= -P-b -P-u -P-o -Tascii
 
-ARGS_PS=	${GFLAGS} -dformat=PostScript
+ARGS_PS=	${GFLAGS} -dformat=PostScript ${ROFF_PAGESIZE}
 ARGS_TXT=	${GFLAGS} -dformat=ASCII ${POST_PLAIN}
 ARGS_HTML=	${GFLAGS} -dformat=HTML  ${POST_PLAIN} -ww
 ARGS_MORE=	${GFLAGS} -dformat=more -P-h -Tascii



CVS commit: src/share/doc/standards/xopen

2024-04-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr  5 23:06:32 UTC 2024

Modified Files:
src/share/doc/standards/xopen: Makefile

Log Message:
spacify the paper size for PostScript


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/share/doc/standards/xopen/Makefile

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



CVS commit: src/share/man/man0

2024-04-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr  5 23:05:54 UTC 2024

Modified Files:
src/share/man/man0: Makefile

Log Message:
specify the page size for PostScript


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/share/man/man0/Makefile

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/man0/Makefile
diff -u src/share/man/man0/Makefile:1.18 src/share/man/man0/Makefile:1.19
--- src/share/man/man0/Makefile:1.18	Mon May 22 08:55:44 2023
+++ src/share/man/man0/Makefile	Fri Apr  5 19:05:53 2024
@@ -1,5 +1,5 @@
 #	from: @(#)Makefile	5.9 (Berkeley) 7/1/91
-#	$NetBSD: Makefile,v 1.18 2023/05/22 12:55:44 lukem Exp $
+#	$NetBSD: Makefile,v 1.19 2024/04/05 23:05:53 christos Exp $
 
 #
 # Note: Needs ps2pdf to convert .ps to .pdf
@@ -77,10 +77,10 @@ man${_S}pages.ps: man${_S}pages.files
 		if ${TOOL_GREP} -q ^\\.TS "${.CURDIR}/back" ; \
 		then	\
 			${_MKSHMSG_FORMAT} >&2 $${f} ;	\
-			cat $${f} | ${TOOL_TBL} | ${TOOL_GROFF} -Z -msafer -man -Tps ; \
+			cat $${f} | ${TOOL_TBL} | ${TOOL_GROFF} -Z -msafer -man -Tps ${ROFF_PAGESIZE}; \
 		else	\
 			${_MKSHMSG_FORMAT} >&2 $${f} "(tbl)";	\
-			cat $${f} | ${TOOL_GROFF} -Z -msafer -man -Tps ; \
+			cat $${f} | ${TOOL_GROFF} -Z -msafer -man -Tps ${ROFF_PAGESIZE}; \
 		fi ;	\
 	done > ${.TARGET}.troff.tmp			\
 	&& cat ${.TARGET}.troff.tmp			\



CVS commit: src/share/man/man0

2024-04-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr  5 23:05:54 UTC 2024

Modified Files:
src/share/man/man0: Makefile

Log Message:
specify the page size for PostScript


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/share/man/man0/Makefile

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



CVS commit: src/distrib/notes

2024-04-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr  5 23:05:04 UTC 2024

Modified Files:
src/distrib/notes: Makefile.inc

Log Message:
specify the paper size for PostScript


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/distrib/notes/Makefile.inc

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

Modified files:

Index: src/distrib/notes/Makefile.inc
diff -u src/distrib/notes/Makefile.inc:1.59 src/distrib/notes/Makefile.inc:1.60
--- src/distrib/notes/Makefile.inc:1.59	Thu Nov 16 13:06:05 2023
+++ src/distrib/notes/Makefile.inc	Fri Apr  5 19:05:04 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.59 2023/11/16 18:06:05 christos Exp $
+#	$NetBSD: Makefile.inc,v 1.60 2024/04/05 23:05:04 christos Exp $
 #
 
 # Ross Harvey 
@@ -71,7 +71,7 @@ PRESET+=	-dcur_date="${curdate}"
 
 POST_PLAIN= -P-b -P-u -P-o
 
-ARGS_PS=	${PRESET} -dformat=PostScript
+ARGS_PS=	${PRESET} -dformat=PostScript ${ROFF_PAGESIZE}
 ARGS_TXT=	${PRESET} -dformat=ASCII ${POST_PLAIN} -Tascii -mtty-char
 ARGS_HTML=	${PRESET} -dformat=HTML ${POST_PLAIN} -Tlatin1 -ww
 ARGS_MORE=	${PRESET} -dformat=more -P-h -Tascii -mtty-char



CVS commit: src/distrib/notes

2024-04-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr  5 23:05:04 UTC 2024

Modified Files:
src/distrib/notes: Makefile.inc

Log Message:
specify the paper size for PostScript


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/distrib/notes/Makefile.inc

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



CVS commit: src/lib/libterminfo

2024-04-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr  5 22:30:18 UTC 2024

Modified Files:
src/lib/libterminfo: genman

Log Message:
>From Jan-Benedict Glaw:

Use `printf` instead of `echo` for precise output

`man` pages generated under NetBSD and Linux differ as the escape codes
may or may not be interpreted when going through those two chained `echo`es.
Instead just use `printf`, which produces the desired output, always.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libterminfo/genman

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



CVS commit: src/lib/libterminfo

2024-04-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr  5 22:30:18 UTC 2024

Modified Files:
src/lib/libterminfo: genman

Log Message:
>From Jan-Benedict Glaw:

Use `printf` instead of `echo` for precise output

`man` pages generated under NetBSD and Linux differ as the escape codes
may or may not be interpreted when going through those two chained `echo`es.
Instead just use `printf`, which produces the desired output, always.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libterminfo/genman

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

Modified files:

Index: src/lib/libterminfo/genman
diff -u src/lib/libterminfo/genman:1.5 src/lib/libterminfo/genman:1.6
--- src/lib/libterminfo/genman:1.5	Fri Jan 25 07:52:45 2013
+++ src/lib/libterminfo/genman	Fri Apr  5 18:30:18 2024
@@ -1,5 +1,5 @@
 #!/bin/sh
-# $NetBSD: genman,v 1.5 2013/01/25 12:52:45 roy Exp $
+# $NetBSD: genman,v 1.6 2024/04/05 22:30:18 christos Exp $
 
 # Copyright (c) 2009, 2013 The NetBSD Foundation, Inc.
 #
@@ -44,11 +44,11 @@ gentab()
 	# Generate a list of long names and codes
 	$TOOL_SED -n \
 	-e "s/#define t_\([^(]*\).*>$tab\[TICODE_\([^]]*\).*/\1 \2/p" \
-	$ti | $TOOL_SORT | while read name code foo; do
+	$ti | $TOOL_SORT | while read name code _; do
 		cap=$($TOOL_SED -ne "s/.*{ \"\(..\)\", TICODE_$code }.*/\1/p" \
 		$tc | head -n 1)
 		desc=$($TOOL_SED -ne "s/ \* $name\: \(.*\)/\1/p" $ti)
-		echo ".It \"\\&$name\" Ta Sy \"\\&$code\" Ta Sy \"\\&$cap\" Ta \"\\&$desc\""
+		printf '.It "\\&%s" Ta Sy "\\&%s" Ta Sy "\\&%s" Ta "\\&%s"\n' "${name}" "${code}" "${cap}" "${desc}"
 	done
 }
 
@@ -56,15 +56,15 @@ boolcaps=$(gentab $TERMH $TERMC flags)
 numcaps=$(gentab $TERMH $TERMC nums)
 strcaps=$(gentab $TERMH $TERMC strs)
 
-echo ".\\\"DO NOT EDIT"
-echo ".\\\"Automatically generated from termcap.5.in"
-echo ".\\\""
+printf '.\\"DO NOT EDIT\n'
+printf '.\\"Automatically generated from termcap.5.in\n'
+printf '.\\"\n'
 
 while read -r line; do
 	case "$line" in
-	"@BOOLCAPS@")	echo "$boolcaps";;
-	"@NUMCAPS@")	echo "$numcaps";;
-	"@STRCAPS@")	echo "$strcaps";;
-	*)		echo "$line";;
+	"@BOOLCAPS@")	printf '%s\n' "${boolcaps}";;
+	"@NUMCAPS@")	printf '%s\n' "${numcaps}";;
+	"@STRCAPS@")	printf '%s\n' "${strcaps}";;
+	*)		printf '%s\n' "${line}";;
 	esac
 done <$TERMM



CVS commit: src/sys/conf

2024-04-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr  5 22:28:20 UTC 2024

Modified Files:
src/sys/conf: newvers_stand.mk

Log Message:
Use ${TOOL_DATE} (Jan-Benedict Glaw)


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/conf/newvers_stand.mk

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

Modified files:

Index: src/sys/conf/newvers_stand.mk
diff -u src/sys/conf/newvers_stand.mk:1.4 src/sys/conf/newvers_stand.mk:1.5
--- src/sys/conf/newvers_stand.mk:1.4	Fri May 21 07:28:11 2021
+++ src/sys/conf/newvers_stand.mk	Fri Apr  5 18:28:20 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: newvers_stand.mk,v 1.4 2021/05/21 11:28:11 nakayama Exp $
+#	$NetBSD: newvers_stand.mk,v 1.5 2024/04/05 22:28:20 christos Exp $
 
 VERSIONFILE?=version
 VERSIONMACHINE?=${MACHINE}
@@ -19,7 +19,7 @@ VERSIONFLAGS+=-d
 
 vers.c:	${VERSIONFILE} ${_NETBSD_VERSION_DEPENDS}
 	${_MKTARGET_CREATE}
-	${HOST_SH} ${S}/conf/newvers_stand.sh \
+	TOOL_DATE=${TOOL_DATE} ${HOST_SH} ${S}/conf/newvers_stand.sh \
 	-m ${VERSIONMACHINE} ${VERSIONFLAGS} ${.ALLSRC:[1]} ${NEWVERSWHAT}
 
 .endif



CVS commit: src/sys/conf

2024-04-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr  5 22:28:20 UTC 2024

Modified Files:
src/sys/conf: newvers_stand.mk

Log Message:
Use ${TOOL_DATE} (Jan-Benedict Glaw)


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/conf/newvers_stand.mk

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



CVS commit: src/sys/conf

2024-04-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr  5 22:27:25 UTC 2024

Modified Files:
src/sys/conf: newvers.mk newvers.sh

Log Message:
Use ${TOOL_DATE} (Jan-Benedict Glaw)


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/conf/newvers.mk
cvs rdiff -u -r1.62 -r1.63 src/sys/conf/newvers.sh

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



CVS commit: src/sys/conf

2024-04-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr  5 22:27:25 UTC 2024

Modified Files:
src/sys/conf: newvers.mk newvers.sh

Log Message:
Use ${TOOL_DATE} (Jan-Benedict Glaw)


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/conf/newvers.mk
cvs rdiff -u -r1.62 -r1.63 src/sys/conf/newvers.sh

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

Modified files:

Index: src/sys/conf/newvers.mk
diff -u src/sys/conf/newvers.mk:1.2 src/sys/conf/newvers.mk:1.3
--- src/sys/conf/newvers.mk:1.2	Sat Apr  8 14:24:09 2017
+++ src/sys/conf/newvers.mk	Fri Apr  5 18:27:25 2024
@@ -1,4 +1,4 @@
-# $NetBSD: newvers.mk,v 1.2 2017/04/08 18:24:09 christos Exp $
+# $NetBSD: newvers.mk,v 1.3 2024/04/05 22:27:25 christos Exp $
 
 MKREPRO?=no
 
@@ -17,7 +17,7 @@ newvers: vers.o
 vers.o: ${SYSTEM_OBJ:O} Makefile $S/conf/newvers.sh \
 		$S/conf/osrelease.sh ${_NETBSD_VERSION_DEPENDS}
 	${_MKMSG_CREATE} vers.c
-	${HOST_SH} $S/conf/newvers.sh ${_NVFLAGS}
+	TOOL_DATE=${TOOL_DATE} ${HOST_SH} $S/conf/newvers.sh ${_NVFLAGS}
 	${_MKTARGET_COMPILE}
 	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
 	${COMPILE_CTFCONVERT}

Index: src/sys/conf/newvers.sh
diff -u src/sys/conf/newvers.sh:1.62 src/sys/conf/newvers.sh:1.63
--- src/sys/conf/newvers.sh:1.62	Sat Apr  8 14:24:09 2017
+++ src/sys/conf/newvers.sh	Fri Apr  5 18:27:25 2024
@@ -1,6 +1,6 @@
 #!/bin/sh -
 #
-#	$NetBSD: newvers.sh,v 1.62 2017/04/08 18:24:09 christos Exp $
+#	$NetBSD: newvers.sh,v 1.63 2024/04/05 22:27:25 christos Exp $
 #
 # Copyright (c) 1984, 1986, 1990, 1993
 #	The Regents of the University of California.  All rights reserved.
@@ -153,6 +153,7 @@ if [ ! -e version ]; then
 	echo 0 > version
 fi
 
+DATE=${TOOL_DATE:-date}
 Rflag=false
 nflag=false
 timestamp=
@@ -206,7 +207,7 @@ if ${Rflag}; then
 else
 	if [ -z "${timestamp}" ]; then
 		v=$(cat version)
-		t=$(LC_ALL=C date)
+		t=$(LC_ALL=C ${DATE})
 		u=${USER-root}
 		h=$(hostname)
 		d=$(pwd)
@@ -214,7 +215,7 @@ else
 		echo $(expr ${v} + 1) > version
 	else
 		v=0
-		t=$(LC_ALL=C TZ=UTC date -r "${timestamp}")
+		t=$(LC_ALL=C TZ=UTC ${DATE} -r "${timestamp}")
 		u=mkrepro
 		h=mkrepro.NetBSD.org
 		d="/usr/src/sys/arch/${machine}/compile/${id}"



CVS commit: src/bin/sh

2024-04-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr  5 22:22:17 UTC 2024

Modified Files:
src/bin/sh: mkoptions.sh

Log Message:
>From Jan-Benedict Glaw:

Fix a redirection and prepare a stable sort for upper-/lowercase
option letters

This script is a mess, I strongly believe that it should be rewritten.
However, I'm not 100% sure why it was invented in the first place
(come on, the generated header file isn't _that_ complicated that
it couldn't be sanely managed by hand!), but let's fix the sorting
order by using LC_ALL=C.

Also add a few 'X' to the `mktemp` template to make non-BSD
implementations happy. As a bonus, actually *use* the initial `sed`
output instead of throwing it away by piping it into `sort` with
also connecting `sort`'s stdin with the original input file...


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/bin/sh/mkoptions.sh

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

Modified files:

Index: src/bin/sh/mkoptions.sh
diff -u src/bin/sh/mkoptions.sh:1.5 src/bin/sh/mkoptions.sh:1.6
--- src/bin/sh/mkoptions.sh:1.5	Wed Nov 15 04:21:19 2017
+++ src/bin/sh/mkoptions.sh	Fri Apr  5 18:22:17 2024
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# $NetBSD: mkoptions.sh,v 1.5 2017/11/15 09:21:19 kre Exp $
+# $NetBSD: mkoptions.sh,v 1.6 2024/04/05 22:22:17 christos Exp $
 
 #
 # It would be more sensible to generate 2 .h files, one which
@@ -13,12 +13,13 @@
 
 set -f
 IFS=' 	'	# blank, tab (no newline)
+export LC_ALL=C	# for sort consistency
 
 IF="$1"
 OF="${3+$3/}$2"
 
-E_FILE=$(${MKTEMP:-mktemp} -t MKO.E.$$)
-O_FILE=$(${MKTEMP:-mktemp} -t MKO.O.$$)
+E_FILE=$(${MKTEMP:-mktemp} -t MKO.E.$$)
+O_FILE=$(${MKTEMP:-mktemp} -t MKO.O.$$)
 trap 'rm -f "${E_FILE}" "${O_FILE}"' EXIT
 
 exec 5> "${E_FILE}"
@@ -40,8 +41,8 @@ ${SED:-sed} <"${IF}"			\
 	-e '/^#/d'			\
 	-e '/^[ 	]*\//d'		\
 	-e '/^[ 	]*\*/d'		\
-	-e '/^[ 	]*;/d'			|
-sort -b -k2,2f -k2,2 < "${IF}"			|
+	-e '/^[ 	]*;/d'		|
+sort -b -k2,2f -k2,2			|
 while read line
 do
 	# Look for comments in various styles, and ignore them



CVS commit: src/bin/sh

2024-04-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr  5 22:22:17 UTC 2024

Modified Files:
src/bin/sh: mkoptions.sh

Log Message:
>From Jan-Benedict Glaw:

Fix a redirection and prepare a stable sort for upper-/lowercase
option letters

This script is a mess, I strongly believe that it should be rewritten.
However, I'm not 100% sure why it was invented in the first place
(come on, the generated header file isn't _that_ complicated that
it couldn't be sanely managed by hand!), but let's fix the sorting
order by using LC_ALL=C.

Also add a few 'X' to the `mktemp` template to make non-BSD
implementations happy. As a bonus, actually *use* the initial `sed`
output instead of throwing it away by piping it into `sort` with
also connecting `sort`'s stdin with the original input file...


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/bin/sh/mkoptions.sh

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



CVS commit: src/external/bsd/flex/bin

2024-04-05 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr  5 22:21:40 UTC 2024

Modified Files:
src/external/bsd/flex/bin: flex.1

Log Message:
flex.1: fix single-bit error in contributor name


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/flex/bin/flex.1

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

Modified files:

Index: src/external/bsd/flex/bin/flex.1
diff -u src/external/bsd/flex/bin/flex.1:1.5 src/external/bsd/flex/bin/flex.1:1.6
--- src/external/bsd/flex/bin/flex.1:1.5	Sun Aug 28 10:48:16 2022
+++ src/external/bsd/flex/bin/flex.1	Fri Apr  5 22:21:40 2024
@@ -1,4 +1,4 @@
-.\" $NetBSD: flex.1,v 1.5 2022/08/28 10:48:16 hgutch Exp $
+.\" $NetBSD: flex.1,v 1.6 2024/04/05 22:21:40 rillig Exp $
 .\"
 .TH FLEX 1 "December 2021" "Version 2.5"
 .SH NAME
@@ -4266,7 +4266,7 @@ Frederic Raimbault, Pat Rankin, Rick Ric
 Kevin Rodgers, Kai Uwe Rommel, Jim Roskind, Alberto Santini,
 Andreas Scherer, Darrell Schiebel, Raf Schietekat,
 Doug Schmidt, Philippe Schnoebelen, Andreas Schwab,
-Larry Schwimmer, Alex Siegel, Eckehard Stolz, Jan-Erik Strvmquist,
+Larry Schwimmer, Alex Siegel, Eckehard Stolz, Jan-Erik Str\[:o]mquist,
 Mike Stump, Paul Stuart, Dave Tallman, Ian Lance Taylor,
 Chris Thewalt, Richard M. Timoney, Jodi Tsai,
 Paul Tuinenga, Gary Weik, Frank Whaley, Gerhard Wilhelms, Kent Williams, Ken



CVS commit: src/external/bsd/flex/bin

2024-04-05 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Apr  5 22:21:40 UTC 2024

Modified Files:
src/external/bsd/flex/bin: flex.1

Log Message:
flex.1: fix single-bit error in contributor name


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/flex/bin/flex.1

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



CVS commit: src/sys

2024-04-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Apr  5 18:57:10 UTC 2024

Modified Files:
src/sys/dev/usb: ehci.c motg.c ohci.c uhci.c usbdi.c xhci.c
src/sys/external/bsd/dwc2: dwc2.c

Log Message:
usb *hci: Always set ux_status before usbd_xfer_schedule_timeout.

Add an assert to usbd_xfer_schedule_timeout to enforce this.

Since access to ux_status is serialized by the bus lock, and nothing
releases the bus lock in the interim, this doesn't make a functional
change.  But it does reduce confusion by readers, who no longer have
to worry if some callers got the order wrong.  It could also now
potentially be factored out in a subsequent commit.


To generate a diff of this commit:
cvs rdiff -u -r1.324 -r1.325 src/sys/dev/usb/ehci.c
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/usb/motg.c
cvs rdiff -u -r1.325 -r1.326 src/sys/dev/usb/ohci.c
cvs rdiff -u -r1.317 -r1.318 src/sys/dev/usb/uhci.c
cvs rdiff -u -r1.252 -r1.253 src/sys/dev/usb/usbdi.c
cvs rdiff -u -r1.180 -r1.181 src/sys/dev/usb/xhci.c
cvs rdiff -u -r1.80 -r1.81 src/sys/external/bsd/dwc2/dwc2.c

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



CVS commit: src/sys

2024-04-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Apr  5 18:57:10 UTC 2024

Modified Files:
src/sys/dev/usb: ehci.c motg.c ohci.c uhci.c usbdi.c xhci.c
src/sys/external/bsd/dwc2: dwc2.c

Log Message:
usb *hci: Always set ux_status before usbd_xfer_schedule_timeout.

Add an assert to usbd_xfer_schedule_timeout to enforce this.

Since access to ux_status is serialized by the bus lock, and nothing
releases the bus lock in the interim, this doesn't make a functional
change.  But it does reduce confusion by readers, who no longer have
to worry if some callers got the order wrong.  It could also now
potentially be factored out in a subsequent commit.


To generate a diff of this commit:
cvs rdiff -u -r1.324 -r1.325 src/sys/dev/usb/ehci.c
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/usb/motg.c
cvs rdiff -u -r1.325 -r1.326 src/sys/dev/usb/ohci.c
cvs rdiff -u -r1.317 -r1.318 src/sys/dev/usb/uhci.c
cvs rdiff -u -r1.252 -r1.253 src/sys/dev/usb/usbdi.c
cvs rdiff -u -r1.180 -r1.181 src/sys/dev/usb/xhci.c
cvs rdiff -u -r1.80 -r1.81 src/sys/external/bsd/dwc2/dwc2.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/usb/ehci.c
diff -u src/sys/dev/usb/ehci.c:1.324 src/sys/dev/usb/ehci.c:1.325
--- src/sys/dev/usb/ehci.c:1.324	Sat Feb 10 09:21:53 2024
+++ src/sys/dev/usb/ehci.c	Fri Apr  5 18:57:10 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehci.c,v 1.324 2024/02/10 09:21:53 andvar Exp $ */
+/*	$NetBSD: ehci.c,v 1.325 2024/04/05 18:57:10 riastradh Exp $ */
 
 /*
  * Copyright (c) 2004-2012,2016,2020 The NetBSD Foundation, Inc.
@@ -54,7 +54,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.324 2024/02/10 09:21:53 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.325 2024/04/05 18:57:10 riastradh Exp $");
 
 #include "ohci.h"
 #include "uhci.h"
@@ -3799,9 +3799,9 @@ ehci_device_ctrl_start(struct usbd_xfer 
 
 	/* Insert qTD in QH list - also does usb_syncmem(sqh) */
 	ehci_set_qh_qtd(sqh, setup);
-	usbd_xfer_schedule_timeout(xfer);
 	ehci_add_intr_list(sc, exfer);
 	xfer->ux_status = USBD_IN_PROGRESS;
+	usbd_xfer_schedule_timeout(xfer);
 
 #if 0
 #ifdef EHCI_DEBUG
@@ -3985,9 +3985,9 @@ ehci_device_bulk_start(struct usbd_xfer 
 
 	/* also does usb_syncmem(sqh) */
 	ehci_set_qh_qtd(sqh, exfer->ex_sqtdstart);
-	usbd_xfer_schedule_timeout(xfer);
 	ehci_add_intr_list(sc, exfer);
 	xfer->ux_status = USBD_IN_PROGRESS;
+	usbd_xfer_schedule_timeout(xfer);
 
 #if 0
 #ifdef EHCI_DEBUG
@@ -4184,9 +4184,9 @@ ehci_device_intr_start(struct usbd_xfer 
 
 	/* also does usb_syncmem(sqh) */
 	ehci_set_qh_qtd(sqh, exfer->ex_sqtdstart);
-	usbd_xfer_schedule_timeout(xfer);
 	ehci_add_intr_list(sc, exfer);
 	xfer->ux_status = USBD_IN_PROGRESS;
+	usbd_xfer_schedule_timeout(xfer);
 
 #if 0
 #ifdef EHCI_DEBUG

Index: src/sys/dev/usb/motg.c
diff -u src/sys/dev/usb/motg.c:1.42 src/sys/dev/usb/motg.c:1.43
--- src/sys/dev/usb/motg.c:1.42	Sun Feb  4 05:43:06 2024
+++ src/sys/dev/usb/motg.c	Fri Apr  5 18:57:10 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: motg.c,v 1.42 2024/02/04 05:43:06 mrg Exp $	*/
+/*	$NetBSD: motg.c,v 1.43 2024/04/05 18:57:10 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004, 2011, 2012, 2014 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: motg.c,v 1.42 2024/02/04 05:43:06 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: motg.c,v 1.43 2024/04/05 18:57:10 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1321,8 +1321,8 @@ motg_device_ctrl_start1(struct motg_soft
 		goto end;
 	}
 	if (xfer->ux_status == USBD_NOT_STARTED) {
-		usbd_xfer_schedule_timeout(xfer);
 		xfer->ux_status = USBD_IN_PROGRESS;
+		usbd_xfer_schedule_timeout(xfer);
 	} else {
 		KASSERT(xfer->ux_status == USBD_IN_PROGRESS);
 	}
@@ -1764,8 +1764,8 @@ motg_device_data_start1(struct motg_soft
 		goto end;
 	}
 	if (xfer->ux_status == USBD_NOT_STARTED) {
-		usbd_xfer_schedule_timeout(xfer);
 		xfer->ux_status = USBD_IN_PROGRESS;
+		usbd_xfer_schedule_timeout(xfer);
 	} else {
 		KASSERT(xfer->ux_status == USBD_IN_PROGRESS);
 	}

Index: src/sys/dev/usb/ohci.c
diff -u src/sys/dev/usb/ohci.c:1.325 src/sys/dev/usb/ohci.c:1.326
--- src/sys/dev/usb/ohci.c:1.325	Fri Feb  9 22:08:37 2024
+++ src/sys/dev/usb/ohci.c	Fri Apr  5 18:57:10 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: ohci.c,v 1.325 2024/02/09 22:08:37 andvar Exp $	*/
+/*	$NetBSD: ohci.c,v 1.326 2024/04/05 18:57:10 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004, 2005, 2012, 2016, 2020 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.325 2024/02/09 22:08:37 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.326 2024/04/05 18:57:10 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -2906,12 +2906,11 @@ ohci_device_ctrl_start(struct usbd_xfer 
 	sizeof(sed->ed.ed_tailp),
 	BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
 	OWRITE4(sc, OHCI_COMMAND_STATUS, OHCI_CLF);
+	

CVS commit: src/external/bsd/file/dist/src

2024-04-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr  5 16:56:58 UTC 2024

Modified Files:
src/external/bsd/file/dist/src: apprentice.c

Log Message:
break strength ties so that qsort is deterministic


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/external/bsd/file/dist/src/apprentice.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/bsd/file/dist/src/apprentice.c
diff -u src/external/bsd/file/dist/src/apprentice.c:1.28 src/external/bsd/file/dist/src/apprentice.c:1.29
--- src/external/bsd/file/dist/src/apprentice.c:1.28	Fri Aug 18 15:00:11 2023
+++ src/external/bsd/file/dist/src/apprentice.c	Fri Apr  5 12:56:58 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: apprentice.c,v 1.28 2023/08/18 19:00:11 christos Exp $	*/
+/*	$NetBSD: apprentice.c,v 1.29 2024/04/05 16:56:58 christos Exp $	*/
 
 /*
  * Copyright (c) Ian F. Darwin 1986-1995.
@@ -37,7 +37,7 @@
 #if 0
 FILE_RCSID("@(#)$File: apprentice.c,v 1.342 2023/07/17 14:38:35 christos Exp $")
 #else
-__RCSID("$NetBSD: apprentice.c,v 1.28 2023/08/18 19:00:11 christos Exp $");
+__RCSID("$NetBSD: apprentice.c,v 1.29 2024/04/05 16:56:58 christos Exp $");
 #endif
 #endif	/* lint */
 
@@ -1141,8 +1141,12 @@ apprentice_sort(const void *a, const voi
 	const struct magic_entry *mb = CAST(const struct magic_entry *, b);
 	size_t sa = file_magic_strength(ma->mp, ma->cont_count);
 	size_t sb = file_magic_strength(mb->mp, mb->cont_count);
-	if (sa == sb)
-		return 0;
+	if (sa == sb) {
+		int x = memcmp(ma->mp, mb->mp, sizeof(*ma->mp));
+		if (x == 0)
+			abort();
+		return x > 0 ? -1 : 1;
+	}
 	else if (sa > sb)
 		return -1;
 	else



CVS commit: src/external/bsd/file/dist/src

2024-04-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr  5 16:56:58 UTC 2024

Modified Files:
src/external/bsd/file/dist/src: apprentice.c

Log Message:
break strength ties so that qsort is deterministic


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/external/bsd/file/dist/src/apprentice.c

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



CVS commit: src/usr.sbin/postinstall

2024-04-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr  5 16:44:54 UTC 2024

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
remove dup named dir


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/usr.sbin/postinstall/postinstall.in

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

Modified files:

Index: src/usr.sbin/postinstall/postinstall.in
diff -u src/usr.sbin/postinstall/postinstall.in:1.62 src/usr.sbin/postinstall/postinstall.in:1.63
--- src/usr.sbin/postinstall/postinstall.in:1.62	Sun Mar 10 14:23:18 2024
+++ src/usr.sbin/postinstall/postinstall.in	Fri Apr  5 12:44:54 2024
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall.in,v 1.62 2024/03/10 18:23:18 rillig Exp $
+# $NetBSD: postinstall.in,v 1.63 2024/04/05 16:44:54 christos Exp $
 #
 # Copyright (c) 2002-2022 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1706,6 +1706,12 @@ do_named()
 	compare_dir "${op}" "${SRC_DIR}/etc/namedb" "${DEST_DIR}/etc/namedb" \
 		644 \
 		root.cache
+
+	local od="${DEST_DIR}/usr/libexec/named"
+	if [ -d "$od" ]; then
+		rm -fr "$od"
+		msg "Removed obsolete '${od}'"
+	fi
 }
 
 



CVS commit: src/usr.sbin/postinstall

2024-04-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr  5 16:44:54 UTC 2024

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
remove dup named dir


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/usr.sbin/postinstall/postinstall.in

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



CVS commit: src/sys

2024-04-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Apr  5 13:05:41 UTC 2024

Modified Files:
src/sys/miscfs/genfs: genfs_io.c
src/sys/uvm: uvm_vnode.c

Log Message:
uvm: Expand v_size <= v_writesize assertions to help diagnostics.

PR kern/58117


To generate a diff of this commit:
cvs rdiff -u -r1.103 -r1.104 src/sys/miscfs/genfs/genfs_io.c
cvs rdiff -u -r1.120 -r1.121 src/sys/uvm/uvm_vnode.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/miscfs/genfs/genfs_io.c
diff -u src/sys/miscfs/genfs/genfs_io.c:1.103 src/sys/miscfs/genfs/genfs_io.c:1.104
--- src/sys/miscfs/genfs/genfs_io.c:1.103	Sun Apr  9 12:26:36 2023
+++ src/sys/miscfs/genfs/genfs_io.c	Fri Apr  5 13:05:40 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: genfs_io.c,v 1.103 2023/04/09 12:26:36 riastradh Exp $	*/
+/*	$NetBSD: genfs_io.c,v 1.104 2024/04/05 13:05:40 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v 1.103 2023/04/09 12:26:36 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v 1.104 2024/04/05 13:05:40 riastradh Exp $");
 
 #include 
 #include 
@@ -1449,7 +1449,12 @@ genfs_do_io(struct vnode *vp, off_t off,
 	UVMHIST_LOG(ubchist, "vp %#jx kva %#jx len 0x%jx flags 0x%jx",
 	(uintptr_t)vp, (uintptr_t)kva, len, flags);
 
-	KASSERT(vp->v_size <= vp->v_writesize);
+	KASSERT(vp->v_size != VSIZENOTSET);
+	KASSERT(vp->v_writesize != VSIZENOTSET);
+	KASSERTMSG(vp->v_size <= vp->v_writesize, "vp=%p"
+	" v_size=0x%llx v_writesize=0x%llx", vp,
+	(unsigned long long)vp->v_size,
+	(unsigned long long)vp->v_writesize);
 	GOP_SIZE(vp, vp->v_writesize, , 0);
 	if (vp->v_type != VBLK) {
 		fs_bshift = vp->v_mount->mnt_fs_bshift;

Index: src/sys/uvm/uvm_vnode.c
diff -u src/sys/uvm/uvm_vnode.c:1.120 src/sys/uvm/uvm_vnode.c:1.121
--- src/sys/uvm/uvm_vnode.c:1.120	Sun Apr  9 12:37:12 2023
+++ src/sys/uvm/uvm_vnode.c	Fri Apr  5 13:05:41 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_vnode.c,v 1.120 2023/04/09 12:37:12 riastradh Exp $	*/
+/*	$NetBSD: uvm_vnode.c,v 1.121 2024/04/05 13:05:41 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_vnode.c,v 1.120 2023/04/09 12:37:12 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_vnode.c,v 1.121 2024/04/05 13:05:41 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_uvmhist.h"
@@ -451,9 +451,17 @@ uvm_vnp_setsize(struct vnode *vp, voff_t
 
 	KASSERT(newsize != VSIZENOTSET);
 	KASSERT(newsize >= 0);
-	KASSERT(vp->v_size <= vp->v_writesize);
-	KASSERT(vp->v_size == vp->v_writesize ||
-	newsize == vp->v_writesize || newsize <= vp->v_size);
+	KASSERTMSG(vp->v_size <= vp->v_writesize, "vp=%p"
+	" v_size=0x%llx v_writesize=0x%llx", vp,
+	(unsigned long long)vp->v_size,
+	(unsigned long long)vp->v_writesize);
+	KASSERTMSG((vp->v_size == vp->v_writesize ||
+		newsize == vp->v_writesize || newsize <= vp->v_size),
+	"vp=%p v_size=0x%llx v_writesize=0x%llx newsize=0x%llx",
+	vp,
+	(unsigned long long)vp->v_size,
+	(unsigned long long)vp->v_writesize,
+	(unsigned long long)newsize);
 
 	oldsize = vp->v_writesize;
 
@@ -481,8 +489,16 @@ uvm_vnp_setwritesize(struct vnode *vp, v
 	KASSERT(newsize >= 0);
 	KASSERT(vp->v_size != VSIZENOTSET);
 	KASSERT(vp->v_writesize != VSIZENOTSET);
-	KASSERT(vp->v_size <= vp->v_writesize);
-	KASSERT(vp->v_size <= newsize);
+	KASSERTMSG(vp->v_size <= vp->v_writesize, "vp=%p"
+	" v_size=0x%llx v_writesize=0x%llx newsize=0x%llx", vp,
+	(unsigned long long)vp->v_size,
+	(unsigned long long)vp->v_writesize,
+	(unsigned long long)newsize);
+	KASSERTMSG(vp->v_size <= newsize, "vp=%p"
+	" v_size=0x%llx v_writesize=0x%llx newsize=0x%llx", vp,
+	(unsigned long long)vp->v_size,
+	(unsigned long long)vp->v_writesize,
+	(unsigned long long)newsize);
 	mutex_enter(vp->v_interlock);
 	vp->v_writesize = newsize;
 	mutex_exit(vp->v_interlock);



CVS commit: src/sys

2024-04-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Apr  5 13:05:41 UTC 2024

Modified Files:
src/sys/miscfs/genfs: genfs_io.c
src/sys/uvm: uvm_vnode.c

Log Message:
uvm: Expand v_size <= v_writesize assertions to help diagnostics.

PR kern/58117


To generate a diff of this commit:
cvs rdiff -u -r1.103 -r1.104 src/sys/miscfs/genfs/genfs_io.c
cvs rdiff -u -r1.120 -r1.121 src/sys/uvm/uvm_vnode.c

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



CVS commit: src/external/mit/libuv/lib

2024-04-05 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Apr  5 12:03:24 UTC 2024

Modified Files:
src/external/mit/libuv/lib: Makefile

Log Message:
Revert last, the .pic file is used elsewhere.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/external/mit/libuv/lib/Makefile

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

Modified files:

Index: src/external/mit/libuv/lib/Makefile
diff -u src/external/mit/libuv/lib/Makefile:1.8 src/external/mit/libuv/lib/Makefile:1.9
--- src/external/mit/libuv/lib/Makefile:1.8	Fri Apr  5 11:04:37 2024
+++ src/external/mit/libuv/lib/Makefile	Fri Apr  5 12:03:24 2024
@@ -1,12 +1,15 @@
-# $NetBSD: Makefile,v 1.8 2024/04/05 11:04:37 christos Exp $
+# $NetBSD: Makefile,v 1.9 2024/04/05 12:03:24 kre Exp $
 
-LIBISPRIVATE=yes
+LIBISPRIVATE=pic
 
 .include 
 
 MKLINT=	no
 LIB=	uv
 
+MAKESTATICLIB=yes
+MAKELINKLIB=yes
+
 .if ${LIBISPRIVATE:Uno} == "no"
 INCS=	uv.h uv/unix.h uv/bsd.h uv/errno.h uv/version.h uv/threadpool.h
 INCSDIR=/usr/include



CVS commit: src/external/mit/libuv/lib

2024-04-05 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Apr  5 12:03:24 UTC 2024

Modified Files:
src/external/mit/libuv/lib: Makefile

Log Message:
Revert last, the .pic file is used elsewhere.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/external/mit/libuv/lib/Makefile

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/dist/uts/common/fs/zfs

2024-04-05 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Fri Apr  5 11:20:34 UTC 2024

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: dmu.c

Log Message:
Apply FreeBSD svn r373278 fix for ZFS corruption.  Fix for NetBSD
PR kern/58111 .

It would be extremely unlikely to trip this bug on NetBSD, as we don't
expose SEEK_DATA and SEEK_HOLE and you need to call ioctl(2) with
FIOSEEKDATA and FIOSEEKHOLE directly which no currently known code does,
and even then be unlucky enough to trip a race condition.

With a reproducer based on that in https://www.illumos.org/issues/16087,
I saw 11 groups of failures over 8 hours.  With this patch, no
failures in 10 hours.  The repro for NetBSD will be attached to
https://gnats.netbsd.org/58111 .

Original FreeBSD commit message:

dnode_is_dirty: check dnode and its data for dirtiness

Over its history this the dirty dnode test has been changed between
checking for a dnodes being on `os_dirty_dnodes` (`dn_dirty_link`) and
`dn_dirty_record`.

It turns out both are actually required.

In the case of appending data to a newly created file, the dnode proper
is dirtied (at least to change the blocksize) and dirty records are
added.  Thus, a single logical operation is represented by separate
dirty indicators, and must not be separated.

The incorrect dirty check becomes a problem when the first block of a
file is being appended to while another process is calling lseek to skip
holes. There is a small window where the dnode part is undirtied while
there are still dirty records. In this case, `lseek(fd, 0, SEEK_DATA)`
would not know that the file is dirty, and would go to
`dnode_next_offset()`. Since the object has no data blocks yet, it
returns `ESRCH`, indicating no data found, which results in `ENXIO`
being returned to `lseek()`'s caller.

This change simply updates the dirty check to check both types of dirty.
If there's anything dirty at all, we immediately go to the "wait for
sync" stage, It doesn't really matter after that; both changes are on
disk, so the dirty fields should be correct.

Sponsored by:   Klara, Inc.
Sponsored by:   Wasabi Technology, Inc.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu.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/cddl/osnet/dist/uts/common/fs/zfs/dmu.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu.c:1.6 src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu.c:1.7
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu.c:1.6	Mon May 28 21:05:07 2018
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu.c	Fri Apr  5 11:20:34 2024
@@ -2145,7 +2145,8 @@ dmu_object_wait_synced(objset_t *os, uin
 	}
 
 	for (i = 0; i < TXG_SIZE; i++) {
-		if (list_link_active(>dn_dirty_link[i])) {
+		if (list_link_active(>dn_dirty_link[i]) ||
+		!list_is_empty(>dn_dirty_records[i])) {
 			break;
 		}
 	}



CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs

2024-04-05 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Fri Apr  5 11:20:34 UTC 2024

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: dmu.c

Log Message:
Apply FreeBSD svn r373278 fix for ZFS corruption.  Fix for NetBSD
PR kern/58111 .

It would be extremely unlikely to trip this bug on NetBSD, as we don't
expose SEEK_DATA and SEEK_HOLE and you need to call ioctl(2) with
FIOSEEKDATA and FIOSEEKHOLE directly which no currently known code does,
and even then be unlucky enough to trip a race condition.

With a reproducer based on that in https://www.illumos.org/issues/16087,
I saw 11 groups of failures over 8 hours.  With this patch, no
failures in 10 hours.  The repro for NetBSD will be attached to
https://gnats.netbsd.org/58111 .

Original FreeBSD commit message:

dnode_is_dirty: check dnode and its data for dirtiness

Over its history this the dirty dnode test has been changed between
checking for a dnodes being on `os_dirty_dnodes` (`dn_dirty_link`) and
`dn_dirty_record`.

It turns out both are actually required.

In the case of appending data to a newly created file, the dnode proper
is dirtied (at least to change the blocksize) and dirty records are
added.  Thus, a single logical operation is represented by separate
dirty indicators, and must not be separated.

The incorrect dirty check becomes a problem when the first block of a
file is being appended to while another process is calling lseek to skip
holes. There is a small window where the dnode part is undirtied while
there are still dirty records. In this case, `lseek(fd, 0, SEEK_DATA)`
would not know that the file is dirty, and would go to
`dnode_next_offset()`. Since the object has no data blocks yet, it
returns `ESRCH`, indicating no data found, which results in `ENXIO`
being returned to `lseek()`'s caller.

This change simply updates the dirty check to check both types of dirty.
If there's anything dirty at all, we immediately go to the "wait for
sync" stage, It doesn't really matter after that; both changes are on
disk, so the dirty fields should be correct.

Sponsored by:   Klara, Inc.
Sponsored by:   Wasabi Technology, Inc.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu.c

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



CVS commit: src/external/mit/libuv/lib

2024-04-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr  5 11:04:37 UTC 2024

Modified Files:
src/external/mit/libuv/lib: Makefile

Log Message:
Just build the staticlib.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/mit/libuv/lib/Makefile

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

Modified files:

Index: src/external/mit/libuv/lib/Makefile
diff -u src/external/mit/libuv/lib/Makefile:1.7 src/external/mit/libuv/lib/Makefile:1.8
--- src/external/mit/libuv/lib/Makefile:1.7	Fri Apr  5 04:51:27 2024
+++ src/external/mit/libuv/lib/Makefile	Fri Apr  5 07:04:37 2024
@@ -1,15 +1,12 @@
-# $NetBSD: Makefile,v 1.7 2024/04/05 08:51:27 kre Exp $
+# $NetBSD: Makefile,v 1.8 2024/04/05 11:04:37 christos Exp $
 
-LIBISPRIVATE=pic
+LIBISPRIVATE=yes
 
 .include 
 
 MKLINT=	no
 LIB=	uv
 
-MAKESTATICLIB=yes
-MAKELINKLIB=yes
-
 .if ${LIBISPRIVATE:Uno} == "no"
 INCS=	uv.h uv/unix.h uv/bsd.h uv/errno.h uv/version.h uv/threadpool.h
 INCSDIR=/usr/include



CVS commit: src/external/mit/libuv/lib

2024-04-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr  5 11:04:37 UTC 2024

Modified Files:
src/external/mit/libuv/lib: Makefile

Log Message:
Just build the staticlib.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/mit/libuv/lib/Makefile

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



CVS commit: src/external

2024-04-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr  5 11:04:19 UTC 2024

Modified Files:
src/external: Makefile

Log Message:
Fold long line


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/external/Makefile

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

Modified files:

Index: src/external/Makefile
diff -u src/external/Makefile:1.24 src/external/Makefile:1.25
--- src/external/Makefile:1.24	Fri Apr  5 04:51:27 2024
+++ src/external/Makefile	Fri Apr  5 07:04:19 2024
@@ -1,7 +1,8 @@
-#	$NetBSD: Makefile,v 1.24 2024/04/05 08:51:27 kre Exp $
+#	$NetBSD: Makefile,v 1.25 2024/04/05 11:04:19 christos Exp $
 
 SUBDIR+= amdgpu-firmware apache2 atheros broadcom bsd cddl gpl2 gpl3 historical
-SUBDIR+= intel-fw-eula intel-fw-public ibm-public mit .WAIT mpl nvidia-firmware ofl
+SUBDIR+= intel-fw-eula intel-fw-public ibm-public
+SUBDIR+= mit .WAIT mpl nvidia-firmware ofl
 SUBDIR+= public-domain realtek
 
 .include 



CVS commit: src/external

2024-04-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Apr  5 11:04:19 UTC 2024

Modified Files:
src/external: Makefile

Log Message:
Fold long line


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/external/Makefile

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



Re: CVS commit: src/external

2024-04-05 Thread Christos Zoulas
In article <20240405085127.b998ef...@cvs.netbsd.org>,
Robert Elz  wrote:
>Module Name:   src
>Committed By:  kre
>Date:  Fri Apr  5 08:51:27 UTC 2024
>
>Modified Files:
>   src/external: Makefile
>   src/external/mit/libuv/lib: Makefile
>
>Log Message:
>Probable hack fix for current build breakage.
>
>Make sure to build external/mit before external/mpl (as bind in mpl
>needs libuv from mit) and in mit/libuv make sure to build the
>static library with the new MAKESTATICLIB mechanism, as that is
>what bind needs.

Thanks for fixing. The Makefile in external does not handle dependencies
and I don't think it gets invoked until libraries have been built, which
in src/lib/Makefile handles the mit/uv mpl/bind order. The change you
made is fine, I will make the line shorter. The libuv Makefile change is
ok too, but it is simplere to just not build the pic library in the first
place, which is what I have done.

christos



Re: CVS commit: src/external

2024-04-05 Thread Robert Elz
Date:Fri, 5 Apr 2024 08:51:27 +
From:"Robert Elz" 
Message-ID:  <20240405085127.b998ef...@cvs.netbsd.org>

Christos, this seems to fix the builds, but I doubt it is really
done correctly (and I don't just mean the overlong line I left in
src/external/Makefile which was (temporarily) deliberate just to
reduce the diff).

kre

  | Modified Files:
  | src/external: Makefile
  | src/external/mit/libuv/lib: Makefile
  |
  | Log Message:
  | Probable hack fix for current build breakage.
  |
  | Make sure to build external/mit before external/mpl (as bind in mpl
  | needs libuv from mit) and in mit/libuv make sure to build the
  | static library with the new MAKESTATICLIB mechanism, as that is
  | what bind needs.
  |
  | To generate a diff of this commit:
  | cvs rdiff -u -r1.23 -r1.24 src/external/Makefile
  | cvs rdiff -u -r1.6 -r1.7 src/external/mit/libuv/lib/Makefile





CVS commit: src/external

2024-04-05 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Apr  5 08:51:27 UTC 2024

Modified Files:
src/external: Makefile
src/external/mit/libuv/lib: Makefile

Log Message:
Probable hack fix for current build breakage.

Make sure to build external/mit before external/mpl (as bind in mpl
needs libuv from mit) and in mit/libuv make sure to build the
static library with the new MAKESTATICLIB mechanism, as that is
what bind needs.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/external/Makefile
cvs rdiff -u -r1.6 -r1.7 src/external/mit/libuv/lib/Makefile

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

Modified files:

Index: src/external/Makefile
diff -u src/external/Makefile:1.23 src/external/Makefile:1.24
--- src/external/Makefile:1.23	Sun Dec 12 20:33:21 2021
+++ src/external/Makefile	Fri Apr  5 08:51:27 2024
@@ -1,7 +1,7 @@
-#	$NetBSD: Makefile,v 1.23 2021/12/12 20:33:21 maya Exp $
+#	$NetBSD: Makefile,v 1.24 2024/04/05 08:51:27 kre Exp $
 
 SUBDIR+= amdgpu-firmware apache2 atheros broadcom bsd cddl gpl2 gpl3 historical
-SUBDIR+= intel-fw-eula intel-fw-public ibm-public mpl mit nvidia-firmware ofl
+SUBDIR+= intel-fw-eula intel-fw-public ibm-public mit .WAIT mpl nvidia-firmware ofl
 SUBDIR+= public-domain realtek
 
 .include 

Index: src/external/mit/libuv/lib/Makefile
diff -u src/external/mit/libuv/lib/Makefile:1.6 src/external/mit/libuv/lib/Makefile:1.7
--- src/external/mit/libuv/lib/Makefile:1.6	Thu Sep 22 21:22:50 2022
+++ src/external/mit/libuv/lib/Makefile	Fri Apr  5 08:51:27 2024
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.6 2022/09/22 21:22:50 christos Exp $
+# $NetBSD: Makefile,v 1.7 2024/04/05 08:51:27 kre Exp $
 
 LIBISPRIVATE=pic
 
@@ -7,6 +7,9 @@ LIBISPRIVATE=pic
 MKLINT=	no
 LIB=	uv
 
+MAKESTATICLIB=yes
+MAKELINKLIB=yes
+
 .if ${LIBISPRIVATE:Uno} == "no"
 INCS=	uv.h uv/unix.h uv/bsd.h uv/errno.h uv/version.h uv/threadpool.h
 INCSDIR=/usr/include



CVS commit: src/external

2024-04-05 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Apr  5 08:51:27 UTC 2024

Modified Files:
src/external: Makefile
src/external/mit/libuv/lib: Makefile

Log Message:
Probable hack fix for current build breakage.

Make sure to build external/mit before external/mpl (as bind in mpl
needs libuv from mit) and in mit/libuv make sure to build the
static library with the new MAKESTATICLIB mechanism, as that is
what bind needs.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/external/Makefile
cvs rdiff -u -r1.6 -r1.7 src/external/mit/libuv/lib/Makefile

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



CVS commit: src/tests/net/if_lagg

2024-04-05 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Fri Apr  5 07:04:17 UTC 2024

Modified Files:
src/tests/net/if_lagg: t_lagg.sh

Log Message:
lagg(4) test: Fix typo and old comment


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/tests/net/if_lagg/t_lagg.sh

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

Modified files:

Index: src/tests/net/if_lagg/t_lagg.sh
diff -u src/tests/net/if_lagg/t_lagg.sh:1.10 src/tests/net/if_lagg/t_lagg.sh:1.11
--- src/tests/net/if_lagg/t_lagg.sh:1.10	Wed Oct 18 06:41:00 2023
+++ src/tests/net/if_lagg/t_lagg.sh	Fri Apr  5 07:04:17 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: t_lagg.sh,v 1.10 2023/10/18 06:41:00 yamaguchi Exp $
+#	$NetBSD: t_lagg.sh,v 1.11 2024/04/05 07:04:17 yamaguchi Exp $
 #
 # Copyright (c) 2021 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -214,7 +214,7 @@ lagg_ifconfig_body()
 
 lagg_ifconfig_cleanup()
 {
-	$DEBG && dump
+	$DEBUG && dump
 	cleanup
 }
 
@@ -392,7 +392,7 @@ lagg_mtu_body()
 	atf_check -s exit:0 -o match:"mtu *$mtu_big" rump.ifconfig shmif1
 	atf_check -s exit:0 -o match:"mtu *$mtu_small" rump.ifconfig shmif2
 
-	# copy MTU from 1st port
+	# copy MTU to 1st added port
 	$atf_ifconfig lagg0 laggport shmif0
 	atf_check -s exit:0 -o match:"mtu *$mtu_lagg" rump.ifconfig lagg0
 	atf_check -s exit:0 -o match:"mtu *$mtu_lagg" rump.ifconfig shmif0



CVS commit: src/tests/net/if_lagg

2024-04-05 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Fri Apr  5 07:04:17 UTC 2024

Modified Files:
src/tests/net/if_lagg: t_lagg.sh

Log Message:
lagg(4) test: Fix typo and old comment


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/tests/net/if_lagg/t_lagg.sh

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



CVS commit: src/sys/net/lagg

2024-04-05 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Fri Apr  5 06:51:41 UTC 2024

Modified Files:
src/sys/net/lagg: if_laggproto.c

Log Message:
lagg(4): Fix missing destroy for list and entry


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/net/lagg/if_laggproto.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/lagg/if_laggproto.c
diff -u src/sys/net/lagg/if_laggproto.c:1.14 src/sys/net/lagg/if_laggproto.c:1.15
--- src/sys/net/lagg/if_laggproto.c:1.14	Fri Apr  5 06:37:29 2024
+++ src/sys/net/lagg/if_laggproto.c	Fri Apr  5 06:51:41 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_laggproto.c,v 1.14 2024/04/05 06:37:29 yamaguchi Exp $	*/
+/*	$NetBSD: if_laggproto.c,v 1.15 2024/04/05 06:51:41 yamaguchi Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-NetBSD
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_laggproto.c,v 1.14 2024/04/05 06:37:29 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_laggproto.c,v 1.15 2024/04/05 06:51:41 yamaguchi Exp $");
 
 #include 
 #include 
@@ -206,6 +206,7 @@ lagg_proto_free(struct lagg_proto_softc 
 	pserialize_destroy(psc->psc_psz);
 	mutex_destroy(>psc_lock);
 	lagg_workq_destroy(psc->psc_workq);
+	PSLIST_DESTROY(>psc_ports);
 
 	if (psc->psc_ctxsiz > 0)
 		kmem_free(psc->psc_ctx, psc->psc_ctxsiz);
@@ -321,6 +322,10 @@ lagg_proto_remove_port(struct lagg_proto
 	PSLIST_WRITER_REMOVE(pport, lpp_entry);
 	LAGG_PROTO_UNLOCK(psc);
 	pserialize_perform(psc->psc_psz);
+
+	/* re-initialize for reuse */
+	PSLIST_ENTRY_DESTROY(pport, lpp_entry);
+	PSLIST_ENTRY_INIT(pport, lpp_entry);
 }
 
 void



CVS commit: src/sys/net/lagg

2024-04-05 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Fri Apr  5 06:51:41 UTC 2024

Modified Files:
src/sys/net/lagg: if_laggproto.c

Log Message:
lagg(4): Fix missing destroy for list and entry


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/net/lagg/if_laggproto.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/lagg

2024-04-05 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Fri Apr  5 06:48:23 UTC 2024

Modified Files:
src/sys/net/lagg: if_lagg.c

Log Message:
lagg(4): Added vlan check


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/sys/net/lagg/if_lagg.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/lagg

2024-04-05 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Fri Apr  5 06:48:23 UTC 2024

Modified Files:
src/sys/net/lagg: if_lagg.c

Log Message:
lagg(4): Added vlan check


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/sys/net/lagg/if_lagg.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/lagg/if_lagg.c
diff -u src/sys/net/lagg/if_lagg.c:1.69 src/sys/net/lagg/if_lagg.c:1.70
--- src/sys/net/lagg/if_lagg.c:1.69	Fri Apr  5 06:37:29 2024
+++ src/sys/net/lagg/if_lagg.c	Fri Apr  5 06:48:22 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_lagg.c,v 1.69 2024/04/05 06:37:29 yamaguchi Exp $	*/
+/*	$NetBSD: if_lagg.c,v 1.70 2024/04/05 06:48:22 yamaguchi Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006 Reyk Floeter 
@@ -20,7 +20,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_lagg.c,v 1.69 2024/04/05 06:37:29 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_lagg.c,v 1.70 2024/04/05 06:48:22 yamaguchi Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -2267,6 +2267,9 @@ lagg_port_setup(struct lagg_softc *sc,
 	switch (ifp_port->if_type) {
 	case IFT_ETHER:
 	case IFT_L2TP:
+		if (VLAN_ATTACHED((struct ethercom *)ifp_port))
+			return EBUSY;
+
 		if_type = IFT_IEEE8023ADLAG;
 		break;
 	default:



CVS commit: src/sys/net/lagg

2024-04-05 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Fri Apr  5 06:37:29 UTC 2024

Modified Files:
src/sys/net/lagg: if_lagg.c if_laggproto.c

Log Message:
lagg(4): release lock before pserialize_perform() if possible


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/net/lagg/if_lagg.c
cvs rdiff -u -r1.13 -r1.14 src/sys/net/lagg/if_laggproto.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/lagg/if_lagg.c
diff -u src/sys/net/lagg/if_lagg.c:1.68 src/sys/net/lagg/if_lagg.c:1.69
--- src/sys/net/lagg/if_lagg.c:1.68	Fri Apr  5 06:05:37 2024
+++ src/sys/net/lagg/if_lagg.c	Fri Apr  5 06:37:29 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_lagg.c,v 1.68 2024/04/05 06:05:37 yamaguchi Exp $	*/
+/*	$NetBSD: if_lagg.c,v 1.69 2024/04/05 06:37:29 yamaguchi Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006 Reyk Floeter 
@@ -20,7 +20,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_lagg.c,v 1.68 2024/04/05 06:05:37 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_lagg.c,v 1.69 2024/04/05 06:37:29 yamaguchi Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1705,8 +1705,8 @@ lagg_pr_detach(struct lagg_softc *sc)
 	LAGG_LOCK(sc);
 	var = sc->sc_var;
 	atomic_store_release(>sc_var, NULL);
-	pserialize_perform(sc->sc_psz);
 	LAGG_UNLOCK(sc);
+	pserialize_perform(sc->sc_psz);
 
 	if (var != NULL)
 		lagg_proto_detach(var);

Index: src/sys/net/lagg/if_laggproto.c
diff -u src/sys/net/lagg/if_laggproto.c:1.13 src/sys/net/lagg/if_laggproto.c:1.14
--- src/sys/net/lagg/if_laggproto.c:1.13	Fri Apr  5 06:23:48 2024
+++ src/sys/net/lagg/if_laggproto.c	Fri Apr  5 06:37:29 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_laggproto.c,v 1.13 2024/04/05 06:23:48 yamaguchi Exp $	*/
+/*	$NetBSD: if_laggproto.c,v 1.14 2024/04/05 06:37:29 yamaguchi Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-NetBSD
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_laggproto.c,v 1.13 2024/04/05 06:23:48 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_laggproto.c,v 1.14 2024/04/05 06:37:29 yamaguchi Exp $");
 
 #include 
 #include 
@@ -319,8 +319,8 @@ lagg_proto_remove_port(struct lagg_proto
 
 	LAGG_PROTO_LOCK(psc);
 	PSLIST_WRITER_REMOVE(pport, lpp_entry);
-	pserialize_perform(psc->psc_psz);
 	LAGG_PROTO_UNLOCK(psc);
+	pserialize_perform(psc->psc_psz);
 }
 
 void
@@ -646,8 +646,8 @@ lagg_lb_startport(struct lagg_proto_soft
 	pm_next->pm_nports = n;
 
 	lagg_portmap_switch(>lb_pmaps);
-	pserialize_perform(psc->psc_psz);
 	LAGG_PROTO_UNLOCK(psc);
+	pserialize_perform(psc->psc_psz);
 }
 
 void
@@ -675,8 +675,8 @@ lagg_lb_stopport(struct lagg_proto_softc
 	pm_next->pm_nports = n;
 
 	lagg_portmap_switch(>lb_pmaps);
-	pserialize_perform(psc->psc_psz);
 	LAGG_PROTO_UNLOCK(psc);
+	pserialize_perform(psc->psc_psz);
 
 	lagg_common_stopport(psc, lp);
 }



CVS commit: src/sys/net/lagg

2024-04-05 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Fri Apr  5 06:37:29 UTC 2024

Modified Files:
src/sys/net/lagg: if_lagg.c if_laggproto.c

Log Message:
lagg(4): release lock before pserialize_perform() if possible


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/net/lagg/if_lagg.c
cvs rdiff -u -r1.13 -r1.14 src/sys/net/lagg/if_laggproto.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/lagg

2024-04-05 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Fri Apr  5 06:31:37 UTC 2024

Modified Files:
src/sys/net/lagg: if_lagg_lacp.c

Log Message:
lagg(4): move reply limitation to recive processing


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/net/lagg/if_lagg_lacp.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/lagg/if_lagg_lacp.c
diff -u src/sys/net/lagg/if_lagg_lacp.c:1.42 src/sys/net/lagg/if_lagg_lacp.c:1.43
--- src/sys/net/lagg/if_lagg_lacp.c:1.42	Fri Apr  5 06:21:02 2024
+++ src/sys/net/lagg/if_lagg_lacp.c	Fri Apr  5 06:31:37 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_lagg_lacp.c,v 1.42 2024/04/05 06:21:02 yamaguchi Exp $	*/
+/*	$NetBSD: if_lagg_lacp.c,v 1.43 2024/04/05 06:31:37 yamaguchi Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-NetBSD
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_lagg_lacp.c,v 1.42 2024/04/05 06:21:02 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_lagg_lacp.c,v 1.43 2024/04/05 06:31:37 yamaguchi Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_lagg.h"
@@ -1360,10 +1360,6 @@ lacp_port_need_to_tell(struct lacp_port 
 	if (!ISSET(lacpp->lp_flags, LACP_PORT_NTT))
 		return false;
 
-	if (ppsratecheck(>lp_last_lacpdu, >lp_lacpdu_sent,
-	(LACP_SENDDU_PPS / LACP_FAST_PERIODIC_TIME)) == 0)
-		return false;
-
 	return true;
 }
 
@@ -1988,8 +1984,14 @@ lacp_sm_rx_update_ntt(struct lacp_softc 
 	if (lacp_compare_peerinfo(, my_pi) != 0 ||
 	!LACP_STATE_EQ(lacpp->lp_actor.lpi_state, my_pi->lpi_state,
 	LACP_STATE_ACTIVITY | LACP_STATE_SYNC | LACP_STATE_AGGREGATION)) {
-		LACP_DPRINTF((lsc, lacpp, "assert ntt\n"));
-		lacp_sm_assert_ntt(lacpp);
+		if (ppsratecheck(>lp_last_lacpdu, >lp_lacpdu_sent,
+		(LACP_SENDDU_PPS / LACP_FAST_PERIODIC_TIME)) == 0) {
+			LACP_DPRINTF((lsc, lacpp,
+			"skip ntt due to rate limit"));
+		} else {
+			LACP_DPRINTF((lsc, lacpp, "assert ntt\n"));
+			lacp_sm_assert_ntt(lacpp);
+		}
 	}
 }
 



CVS commit: src/sys/net/lagg

2024-04-05 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Fri Apr  5 06:31:37 UTC 2024

Modified Files:
src/sys/net/lagg: if_lagg_lacp.c

Log Message:
lagg(4): move reply limitation to recive processing


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/net/lagg/if_lagg_lacp.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/lagg

2024-04-05 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Fri Apr  5 06:23:48 UTC 2024

Modified Files:
src/sys/net/lagg: if_laggproto.c

Log Message:
lagg(4): remove unnecessary masking

pointed out by ozaki-r@, thanks.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/net/lagg/if_laggproto.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/lagg/if_laggproto.c
diff -u src/sys/net/lagg/if_laggproto.c:1.12 src/sys/net/lagg/if_laggproto.c:1.13
--- src/sys/net/lagg/if_laggproto.c:1.12	Thu Apr  4 07:49:06 2024
+++ src/sys/net/lagg/if_laggproto.c	Fri Apr  5 06:23:48 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_laggproto.c,v 1.12 2024/04/04 07:49:06 yamaguchi Exp $	*/
+/*	$NetBSD: if_laggproto.c,v 1.13 2024/04/05 06:23:48 yamaguchi Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-NetBSD
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_laggproto.c,v 1.12 2024/04/04 07:49:06 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_laggproto.c,v 1.13 2024/04/05 06:23:48 yamaguchi Exp $");
 
 #include 
 #include 
@@ -132,7 +132,6 @@ lagg_portmap_next(struct lagg_portmaps *
 	size_t i;
 
 	i = atomic_load_consume(>maps_activepmap);
-	i &= 0x1;
 	i ^= 0x1;
 
 	return >maps_pmap[i];



CVS commit: src/sys/net/lagg

2024-04-05 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Fri Apr  5 06:23:48 UTC 2024

Modified Files:
src/sys/net/lagg: if_laggproto.c

Log Message:
lagg(4): remove unnecessary masking

pointed out by ozaki-r@, thanks.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/net/lagg/if_laggproto.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/lagg

2024-04-05 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Fri Apr  5 06:21:02 UTC 2024

Modified Files:
src/sys/net/lagg: if_lagg_lacp.c

Log Message:
lagg(4): set suppress at the same time with distribution state


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/net/lagg/if_lagg_lacp.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/lagg/if_lagg_lacp.c
diff -u src/sys/net/lagg/if_lagg_lacp.c:1.41 src/sys/net/lagg/if_lagg_lacp.c:1.42
--- src/sys/net/lagg/if_lagg_lacp.c:1.41	Fri Apr  5 06:19:28 2024
+++ src/sys/net/lagg/if_lagg_lacp.c	Fri Apr  5 06:21:02 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_lagg_lacp.c,v 1.41 2024/04/05 06:19:28 yamaguchi Exp $	*/
+/*	$NetBSD: if_lagg_lacp.c,v 1.42 2024/04/05 06:21:02 yamaguchi Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-NetBSD
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_lagg_lacp.c,v 1.41 2024/04/05 06:19:28 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_lagg_lacp.c,v 1.42 2024/04/05 06:21:02 yamaguchi Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_lagg.h"
@@ -2560,19 +2560,23 @@ lacp_suppress_distributing(struct lacp_s
 {
 	struct lacp_aggregator *la;
 	struct lacp_port *lacpp;
+	bool marker_scheduled;
 
 	KASSERT(LACP_LOCKED(lsc));
 
 	la = lsc->lsc_aggregator;
+	marker_scheduled = false;
 
 	LIST_FOREACH(lacpp, >la_ports, lp_entry_la) {
 		if (ISSET(lacpp->lp_actor.lpi_state,
 		LACP_STATE_DISTRIBUTING)) {
 			lagg_workq_add(lsc->lsc_workq,
 			>lp_work_marker);
+			marker_scheduled = true;
 		}
 	}
 
+	lsc->lsc_suppress_distributing = marker_scheduled;
 	LACP_PTIMER_ARM(lsc, LACP_PTIMER_DISTRIBUTING,
 	LACP_TRANSIT_DELAY);
 }
@@ -2659,7 +2663,6 @@ lacp_marker_work(struct lagg_work *lw, v
 		return;
 	}
 	SET(lacpp->lp_flags, LACP_PORT_MARK);
-	lsc->lsc_suppress_distributing = true;
 	lp = lacpp->lp_laggport;
 	bound = curlwp_bind();
 	lagg_port_getref(lp, );



CVS commit: src/sys/net/lagg

2024-04-05 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Fri Apr  5 06:21:02 UTC 2024

Modified Files:
src/sys/net/lagg: if_lagg_lacp.c

Log Message:
lagg(4): set suppress at the same time with distribution state


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/net/lagg/if_lagg_lacp.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/lagg

2024-04-05 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Fri Apr  5 06:19:28 UTC 2024

Modified Files:
src/sys/net/lagg: if_lagg_lacp.c

Log Message:
added missing workq_wait for lacp_tick_work()


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/net/lagg/if_lagg_lacp.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/lagg/if_lagg_lacp.c
diff -u src/sys/net/lagg/if_lagg_lacp.c:1.40 src/sys/net/lagg/if_lagg_lacp.c:1.41
--- src/sys/net/lagg/if_lagg_lacp.c:1.40	Fri Apr  5 06:16:32 2024
+++ src/sys/net/lagg/if_lagg_lacp.c	Fri Apr  5 06:19:28 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_lagg_lacp.c,v 1.40 2024/04/05 06:16:32 yamaguchi Exp $	*/
+/*	$NetBSD: if_lagg_lacp.c,v 1.41 2024/04/05 06:19:28 yamaguchi Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-NetBSD
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_lagg_lacp.c,v 1.40 2024/04/05 06:16:32 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_lagg_lacp.c,v 1.41 2024/04/05 06:19:28 yamaguchi Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_lagg.h"
@@ -544,6 +544,7 @@ lacp_detach(struct lagg_proto_softc *xls
 	LAGG_UNLOCK(lsc->lsc_softc);
 
 	lagg_workq_wait(lsc->lsc_workq, >lsc_work_rcvdu);
+	lagg_workq_wait(lsc->lsc_workq, >lsc_work_tick);
 	evcnt_detach(>lsc_mgethdr_failed);
 	evcnt_detach(>lsc_mpullup_failed);
 	evcnt_detach(>lsc_badlacpdu);



CVS commit: src/sys/net/lagg

2024-04-05 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Fri Apr  5 06:19:28 UTC 2024

Modified Files:
src/sys/net/lagg: if_lagg_lacp.c

Log Message:
added missing workq_wait for lacp_tick_work()


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/net/lagg/if_lagg_lacp.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/lagg

2024-04-05 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Fri Apr  5 06:16:32 UTC 2024

Modified Files:
src/sys/net/lagg: if_lagg_lacp.c

Log Message:
lagg(4): added check of LACP running state for safety

When LACP stops, the handler of callout do nothing
because all port is already detached from lacp.
Therefore, the added checks are just for safety.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/net/lagg/if_lagg_lacp.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/lagg/if_lagg_lacp.c
diff -u src/sys/net/lagg/if_lagg_lacp.c:1.39 src/sys/net/lagg/if_lagg_lacp.c:1.40
--- src/sys/net/lagg/if_lagg_lacp.c:1.39	Fri Apr  5 06:11:16 2024
+++ src/sys/net/lagg/if_lagg_lacp.c	Fri Apr  5 06:16:32 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_lagg_lacp.c,v 1.39 2024/04/05 06:11:16 yamaguchi Exp $	*/
+/*	$NetBSD: if_lagg_lacp.c,v 1.40 2024/04/05 06:16:32 yamaguchi Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-NetBSD
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_lagg_lacp.c,v 1.39 2024/04/05 06:11:16 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_lagg_lacp.c,v 1.40 2024/04/05 06:16:32 yamaguchi Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_lagg.h"
@@ -1491,10 +1491,16 @@ lacp_tick(void *xlsc)
 
 	lsc = xlsc;
 
-	lagg_workq_add(lsc->lsc_workq, >lsc_work_tick);
-
 	LACP_LOCK(lsc);
+
+	if (!lsc->lsc_running) {
+		LACP_UNLOCK(lsc);
+		return;
+	}
+
+	lagg_workq_add(lsc->lsc_workq, >lsc_work_tick);
 	callout_schedule(>lsc_tick, hz);
+
 	LACP_UNLOCK(lsc);
 }
 
@@ -1548,6 +1554,11 @@ lacp_tick_work(struct lagg_work *lw __un
 	sc = lsc->lsc_softc;
 
 	LACP_LOCK(lsc);
+	if (!lsc->lsc_running) {
+		LACP_UNLOCK(lsc);
+		return;
+	}
+
 	lacp_run_prototimers(lsc);
 	LACP_UNLOCK(lsc);
 



CVS commit: src/sys/net/lagg

2024-04-05 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Fri Apr  5 06:16:32 UTC 2024

Modified Files:
src/sys/net/lagg: if_lagg_lacp.c

Log Message:
lagg(4): added check of LACP running state for safety

When LACP stops, the handler of callout do nothing
because all port is already detached from lacp.
Therefore, the added checks are just for safety.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/net/lagg/if_lagg_lacp.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/lagg

2024-04-05 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Fri Apr  5 06:11:16 UTC 2024

Modified Files:
src/sys/net/lagg: if_lagg_lacp.c

Log Message:
fix missing LACP_LOCK


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/net/lagg/if_lagg_lacp.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/lagg/if_lagg_lacp.c
diff -u src/sys/net/lagg/if_lagg_lacp.c:1.38 src/sys/net/lagg/if_lagg_lacp.c:1.39
--- src/sys/net/lagg/if_lagg_lacp.c:1.38	Fri Apr  5 06:07:36 2024
+++ src/sys/net/lagg/if_lagg_lacp.c	Fri Apr  5 06:11:16 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_lagg_lacp.c,v 1.38 2024/04/05 06:07:36 yamaguchi Exp $	*/
+/*	$NetBSD: if_lagg_lacp.c,v 1.39 2024/04/05 06:11:16 yamaguchi Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-NetBSD
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_lagg_lacp.c,v 1.38 2024/04/05 06:07:36 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_lagg_lacp.c,v 1.39 2024/04/05 06:11:16 yamaguchi Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_lagg.h"
@@ -1444,10 +1444,13 @@ lacp_sm_tx_work(struct lagg_work *lw, vo
 	lsc = xlsc;
 	lacpp = container_of(lw, struct lacp_port, lp_work_smtx);
 
-	if (lsc->lsc_stop_lacpdu)
+	LACP_LOCK(lsc);
+
+	if (lsc->lsc_stop_lacpdu) {
+		LACP_UNLOCK(lsc);
 		return;
+	}
 
-	LACP_LOCK(lsc);
 	m = lacp_lacpdu_mbuf(lsc, lacpp);
 	if (m == NULL) {
 		LACP_UNLOCK(lsc);



CVS commit: src/sys/net/lagg

2024-04-05 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Fri Apr  5 06:11:16 UTC 2024

Modified Files:
src/sys/net/lagg: if_lagg_lacp.c

Log Message:
fix missing LACP_LOCK


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/net/lagg/if_lagg_lacp.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/lagg

2024-04-05 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Fri Apr  5 06:07:37 UTC 2024

Modified Files:
src/sys/net/lagg: if_lagg_lacp.c

Log Message:
lagg(4): added missing pserialize_read_enter


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/net/lagg/if_lagg_lacp.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/lagg

2024-04-05 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Fri Apr  5 06:07:37 UTC 2024

Modified Files:
src/sys/net/lagg: if_lagg_lacp.c

Log Message:
lagg(4): added missing pserialize_read_enter


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/net/lagg/if_lagg_lacp.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/lagg/if_lagg_lacp.c
diff -u src/sys/net/lagg/if_lagg_lacp.c:1.37 src/sys/net/lagg/if_lagg_lacp.c:1.38
--- src/sys/net/lagg/if_lagg_lacp.c:1.37	Thu Apr  4 09:19:42 2024
+++ src/sys/net/lagg/if_lagg_lacp.c	Fri Apr  5 06:07:36 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_lagg_lacp.c,v 1.37 2024/04/04 09:19:42 yamaguchi Exp $	*/
+/*	$NetBSD: if_lagg_lacp.c,v 1.38 2024/04/05 06:07:36 yamaguchi Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-NetBSD
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_lagg_lacp.c,v 1.37 2024/04/04 09:19:42 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_lagg_lacp.c,v 1.38 2024/04/05 06:07:36 yamaguchi Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_lagg.h"
@@ -1290,7 +1290,7 @@ lacp_rcvdu_work(struct lagg_work *lw __u
 	struct lagg_port *lp;
 	struct mbuf *m;
 	uint8_t subtype;
-	int bound, s;
+	int bound, s0, s1;
 
 	bound = curlwp_bind();
 
@@ -1299,23 +1299,26 @@ lacp_rcvdu_work(struct lagg_work *lw __u
 		if (m == NULL)
 			break;
 
-		ifp = m_get_rcvif(m, );
+		ifp = m_get_rcvif(m, );
 		if (ifp == NULL) {
 			m_freem(m);
 			lsc->lsc_norcvif.ev_count++;
 			continue;
 		}
 
+		s1 = pserialize_read_enter();
 		lp = atomic_load_consume(>if_lagg);
 		if (lp == NULL) {
-			m_put_rcvif(ifp, );
+			pserialize_read_exit(s1);
+			m_put_rcvif(ifp, );
 			m_freem(m);
 			lsc->lsc_norcvif.ev_count++;
 			continue;
 		}
 
 		lagg_port_getref(lp, _lp);
-		m_put_rcvif(ifp, );
+		pserialize_read_exit(s1);
+		m_put_rcvif(ifp, );
 
 		m_copydata(m, sizeof(struct ether_header),
 		sizeof(subtype), );



CVS commit: src/sys/net/lagg

2024-04-05 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Fri Apr  5 06:05:37 UTC 2024

Modified Files:
src/sys/net/lagg: if_lagg.c

Log Message:
lagg(4): added __predict_true


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/net/lagg/if_lagg.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/lagg/if_lagg.c
diff -u src/sys/net/lagg/if_lagg.c:1.67 src/sys/net/lagg/if_lagg.c:1.68
--- src/sys/net/lagg/if_lagg.c:1.67	Thu Apr  4 09:19:42 2024
+++ src/sys/net/lagg/if_lagg.c	Fri Apr  5 06:05:37 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_lagg.c,v 1.67 2024/04/04 09:19:42 yamaguchi Exp $	*/
+/*	$NetBSD: if_lagg.c,v 1.68 2024/04/05 06:05:37 yamaguchi Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006 Reyk Floeter 
@@ -20,7 +20,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_lagg.c,v 1.67 2024/04/04 09:19:42 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_lagg.c,v 1.68 2024/04/05 06:05:37 yamaguchi Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -3010,7 +3010,7 @@ lagg_chg_sadl(struct ifnet *ifp, const u
 	}
 
 	/* Activate the next Link-Level address */
-	if (ifa_next != ifp->if_dl) {
+	if (__predict_true(ifa_next != ifp->if_dl)) {
 		/* save the current address */
 		ifa_cur = ifp->if_dl;
 		if (ifa_cur != NULL)



CVS commit: src/sys/net/lagg

2024-04-05 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Fri Apr  5 06:05:37 UTC 2024

Modified Files:
src/sys/net/lagg: if_lagg.c

Log Message:
lagg(4): added __predict_true


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/net/lagg/if_lagg.c

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