CVS commit: src/sys/dev/spi

2024-02-23 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Feb 23 23:45:54 UTC 2024

Modified Files:
src/sys/dev/spi: spivar.h

Log Message:
Define mode macros for CPOL and CPHA, and define SPI_MODE_* in terms
of CPOL and CPHA.  Add SPI_FREQ_*() helper macros to make setting the
transfer frequency less error prone.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/spi/spivar.h

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

Modified files:

Index: src/sys/dev/spi/spivar.h
diff -u src/sys/dev/spi/spivar.h:1.12 src/sys/dev/spi/spivar.h:1.13
--- src/sys/dev/spi/spivar.h:1.12	Wed Jan 19 13:33:11 2022
+++ src/sys/dev/spi/spivar.h	Fri Feb 23 23:45:54 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: spivar.h,v 1.12 2022/01/19 13:33:11 thorpej Exp $ */
+/* $NetBSD: spivar.h,v 1.13 2024/02/23 23:45:54 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2006 Urbana-Champaign Independent Media Center.
@@ -55,16 +55,24 @@
 struct spi_handle;
 struct spi_transfer;
 
+#define	SPI_MODE_CPHA	__BIT(0)
+#define	SPI_MODE_CPOL	__BIT(1)
+
 /*
  * De facto standard latching modes.
  */
-#define	SPI_MODE_0	0	/* CPOL = 0, CPHA = 0 */
-#define	SPI_MODE_1	1	/* CPOL = 0, CPHA = 1 */
-#define	SPI_MODE_2	2	/* CPOL = 1, CPHA = 0 */
-#define	SPI_MODE_3	3	/* CPOL = 1, CPHA = 1 */
+#define	SPI_MODE_0	0
+#define	SPI_MODE_1	SPI_MODE_CPHA
+#define	SPI_MODE_2	SPI_MODE_CPOL
+#define	SPI_MODE_3	(SPI_MODE_CPHA | SPI_MODE_CPOL)
+
 /* Philips' Microwire is just Mode 0 */
 #define	SPI_MODE_MICROWIRE	SPI_MODE_0
 
+/* SPI transfer speed helper macros -- converts to Hz for spi_configure(). */
+#define	SPI_FREQ_kHz(x)	((x) * 1000)
+#define	SPI_FREQ_MHz(x)	((x) * 100)
+
 struct spi_controller {
 	void	*sct_cookie;	/* controller private data */
 	int	sct_nslaves;



CVS commit: src/sys/dev/spi

2024-02-23 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Feb 23 23:45:54 UTC 2024

Modified Files:
src/sys/dev/spi: spivar.h

Log Message:
Define mode macros for CPOL and CPHA, and define SPI_MODE_* in terms
of CPOL and CPHA.  Add SPI_FREQ_*() helper macros to make setting the
transfer frequency less error prone.


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

2024-02-23 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Fri Feb 23 22:10:40 UTC 2024

Modified Files:
src/sys/arch/amd64/conf: files.amd64
src/sys/arch/i386/conf: files.i386
src/sys/arch/xen/conf: files.compat

Log Message:
s/optionms/options/ in copy-pasted comment.


To generate a diff of this commit:
cvs rdiff -u -r1.122 -r1.123 src/sys/arch/amd64/conf/files.amd64
cvs rdiff -u -r1.407 -r1.408 src/sys/arch/i386/conf/files.i386
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/xen/conf/files.compat

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

Modified files:

Index: src/sys/arch/amd64/conf/files.amd64
diff -u src/sys/arch/amd64/conf/files.amd64:1.122 src/sys/arch/amd64/conf/files.amd64:1.123
--- src/sys/arch/amd64/conf/files.amd64:1.122	Tue Dec  5 16:32:38 2023
+++ src/sys/arch/amd64/conf/files.amd64	Fri Feb 23 22:10:39 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: files.amd64,v 1.122 2023/12/05 16:32:38 thorpej Exp $
+#	$NetBSD: files.amd64,v 1.123 2024/02/23 22:10:39 andvar Exp $
 #
 # new style config file for amd64 architecture
 #
@@ -14,7 +14,7 @@ defparam		CPURESET_DELAY
 # The REAL{BASE,EXT}MEM options
 defparam opt_realmem.h	REALBASEMEM REALEXTMEM
 
-# The PHYSMEM_MAX_{SIZE,ADDR} optionms
+# The PHYSMEM_MAX_{SIZE,ADDR} options
 defparam opt_physmem.h	PHYSMEM_MAX_ADDR PHYSMEM_MAX_SIZE
 
 # Enable GCC spectre V2 mitigation options

Index: src/sys/arch/i386/conf/files.i386
diff -u src/sys/arch/i386/conf/files.i386:1.407 src/sys/arch/i386/conf/files.i386:1.408
--- src/sys/arch/i386/conf/files.i386:1.407	Wed Oct 21 13:31:51 2020
+++ src/sys/arch/i386/conf/files.i386	Fri Feb 23 22:10:39 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: files.i386,v 1.407 2020/10/21 13:31:51 christos Exp $
+#	$NetBSD: files.i386,v 1.408 2024/02/23 22:10:39 andvar Exp $
 #
 # new style config file for i386 architecture
 #
@@ -25,7 +25,7 @@ defflag	opt_xserver.h	XSERVER XSERVER_DD
 # The REAL{BASE,EXT}MEM options
 defparam opt_realmem.h	REALBASEMEM REALEXTMEM
 
-# The PHYSMEM_MAX_{SIZE,ADDR} optionms
+# The PHYSMEM_MAX_{SIZE,ADDR} options
 defparam opt_physmem.h	PHYSMEM_MAX_ADDR PHYSMEM_MAX_SIZE
 
 # PCI BIOS options

Index: src/sys/arch/xen/conf/files.compat
diff -u src/sys/arch/xen/conf/files.compat:1.34 src/sys/arch/xen/conf/files.compat:1.35
--- src/sys/arch/xen/conf/files.compat:1.34	Thu Jun 23 14:32:16 2022
+++ src/sys/arch/xen/conf/files.compat	Fri Feb 23 22:10:39 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: files.compat,v 1.34 2022/06/23 14:32:16 bouyer Exp $
+#	$NetBSD: files.compat,v 1.35 2024/02/23 22:10:39 andvar Exp $
 #	NetBSD: files.x86,v 1.10 2003/10/08 17:30:00 bouyer Exp 
 
 # options for MP configuration through the MP spec
@@ -44,5 +44,5 @@ defflag	opt_via_c7temp.h		XXXVIA_CORETEM
 # Multiboot support
 defflag 	opt_multiboot.h		XXXMULTIBOOT
 
-# The PHYSMEM_MAX_{SIZE,ADDR} optionms
+# The PHYSMEM_MAX_{SIZE,ADDR} options
 defparam opt_physmem.h	XXXPHYSMEM_MAX_ADDR XXXPHYSMEM_MAX_SIZE



CVS commit: src/sys/arch

2024-02-23 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Fri Feb 23 22:10:40 UTC 2024

Modified Files:
src/sys/arch/amd64/conf: files.amd64
src/sys/arch/i386/conf: files.i386
src/sys/arch/xen/conf: files.compat

Log Message:
s/optionms/options/ in copy-pasted comment.


To generate a diff of this commit:
cvs rdiff -u -r1.122 -r1.123 src/sys/arch/amd64/conf/files.amd64
cvs rdiff -u -r1.407 -r1.408 src/sys/arch/i386/conf/files.i386
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/xen/conf/files.compat

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



CVS commit: src/sys/dev/pci

2024-02-23 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Fri Feb 23 22:03:45 UTC 2024

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

Log Message:
s/opetions/options/ in hw.ubsec node description.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/dev/pci/ubsec.c

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

Modified files:

Index: src/sys/dev/pci/ubsec.c
diff -u src/sys/dev/pci/ubsec.c:1.64 src/sys/dev/pci/ubsec.c:1.65
--- src/sys/dev/pci/ubsec.c:1.64	Fri Aug  4 07:38:53 2023
+++ src/sys/dev/pci/ubsec.c	Fri Feb 23 22:03:45 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: ubsec.c,v 1.64 2023/08/04 07:38:53 riastradh Exp $	*/
+/*	$NetBSD: ubsec.c,v 1.65 2024/02/23 22:03:45 andvar Exp $	*/
 /* $FreeBSD: src/sys/dev/ubsec/ubsec.c,v 1.6.2.6 2003/01/23 21:06:43 sam Exp $ */
 /*	$OpenBSD: ubsec.c,v 1.143 2009/03/27 13:31:30 reyk Exp$	*/
 
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.64 2023/08/04 07:38:53 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.65 2024/02/23 22:03:45 andvar Exp $");
 
 #undef UBSEC_DEBUG
 
@@ -609,7 +609,7 @@ SYSCTL_SETUP(ubsec_sysctl_init, "ubsec s
 	sysctl_createv(clog, 0, NULL, &node,
 		CTLFLAG_PERMANENT,
 		CTLTYPE_NODE, "ubsec",
-		SYSCTL_DESCR("ubsec opetions"),
+		SYSCTL_DESCR("ubsec options"),
 		NULL, 0, NULL, 0,
 		CTL_HW, CTL_CREATE, CTL_EOL);
 	sysctl_createv(clog, 0, &node, NULL,



CVS commit: src/sys/dev/pci

2024-02-23 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Fri Feb 23 22:03:45 UTC 2024

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

Log Message:
s/opetions/options/ in hw.ubsec node description.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/dev/pci/ubsec.c

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



CVS commit: src/external/mpl/bind/dist/lib/ns

2024-02-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb 23 21:09:49 UTC 2024

Modified Files:
src/external/mpl/bind/dist/lib/ns: client.c
src/external/mpl/bind/dist/lib/ns/include/ns: client.h

Log Message:
fix 32 bit build (no atomic_*_8)


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/external/mpl/bind/dist/lib/ns/client.c
cvs rdiff -u -r1.15 -r1.16 \
src/external/mpl/bind/dist/lib/ns/include/ns/client.h

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

Modified files:

Index: src/external/mpl/bind/dist/lib/ns/client.c
diff -u src/external/mpl/bind/dist/lib/ns/client.c:1.19 src/external/mpl/bind/dist/lib/ns/client.c:1.20
--- src/external/mpl/bind/dist/lib/ns/client.c:1.19	Wed Feb 21 17:52:46 2024
+++ src/external/mpl/bind/dist/lib/ns/client.c	Fri Feb 23 16:09:49 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: client.c,v 1.19 2024/02/21 22:52:46 christos Exp $	*/
+/*	$NetBSD: client.c,v 1.20 2024/02/23 21:09:49 christos Exp $	*/
 
 /*
  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
@@ -118,7 +118,11 @@
 #define NS_CLIENT_DROPPORT 1
 #endif /* ifndef NS_CLIENT_DROPPORT */
 
+#ifdef _LP64
 atomic_uint_fast64_t ns_client_requests = 0;
+#else
+atomic_uint_fast32_t ns_client_requests = 0;
+#endif
 
 static void
 clientmgr_attach(ns_clientmgr_t *source, ns_clientmgr_t **targetp);

Index: src/external/mpl/bind/dist/lib/ns/include/ns/client.h
diff -u src/external/mpl/bind/dist/lib/ns/include/ns/client.h:1.15 src/external/mpl/bind/dist/lib/ns/include/ns/client.h:1.16
--- src/external/mpl/bind/dist/lib/ns/include/ns/client.h:1.15	Wed Feb 21 17:52:46 2024
+++ src/external/mpl/bind/dist/lib/ns/include/ns/client.h	Fri Feb 23 16:09:49 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: client.h,v 1.15 2024/02/21 22:52:46 christos Exp $	*/
+/*	$NetBSD: client.h,v 1.16 2024/02/23 21:09:49 christos Exp $	*/
 
 /*
  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
@@ -273,7 +273,11 @@ struct ns_client {
  */
 #define NS_FAILCACHE_CD 0x01
 
+#ifdef _LP64
 extern atomic_uint_fast64_t ns_client_requests;
+#else
+extern atomic_uint_fast32_t ns_client_requests;
+#endif
 
 /***
  *** Functions



CVS commit: src/external/mpl/bind/dist/lib/ns

2024-02-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb 23 21:09:49 UTC 2024

Modified Files:
src/external/mpl/bind/dist/lib/ns: client.c
src/external/mpl/bind/dist/lib/ns/include/ns: client.h

Log Message:
fix 32 bit build (no atomic_*_8)


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/external/mpl/bind/dist/lib/ns/client.c
cvs rdiff -u -r1.15 -r1.16 \
src/external/mpl/bind/dist/lib/ns/include/ns/client.h

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



CVS commit: [netbsd-10] src/doc

2024-02-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 23 19:48:51 UTC 2024

Modified Files:
src/doc [netbsd-10]: CHANGES-10.0

Log Message:
Tickets #602 - #607


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.199 -r1.1.2.200 src/doc/CHANGES-10.0

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

Modified files:

Index: src/doc/CHANGES-10.0
diff -u src/doc/CHANGES-10.0:1.1.2.199 src/doc/CHANGES-10.0:1.1.2.200
--- src/doc/CHANGES-10.0:1.1.2.199	Mon Feb 19 08:59:48 2024
+++ src/doc/CHANGES-10.0	Fri Feb 23 19:48:51 2024
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-10.0,v 1.1.2.199 2024/02/19 08:59:48 martin Exp $
+# $NetBSD: CHANGES-10.0,v 1.1.2.200 2024/02/23 19:48:51 martin Exp $
 
 A complete list of changes from the initial NetBSD 10.0 branch on 2022-12-16
 until the 10.0 release:
@@ -15608,3 +15608,46 @@ sys/arch/vax/vsa/vsbus.c			1.69
 	on netboot.
 	[tsutsui, ticket #601]
 
+distrib/amd64/ramdisks/Makefile			1.5
+
+	amd64: PR 57948: build ramdisk-zfsroot by default.
+	[riastradh, ticket #602]
+
+lib/libm/arch/x86_64/fenv.c			1.11
+tests/lib/libm/t_fenv.c1.14,1.15
+
+	libm: PR 57949: fix spurious side effects in fetestexcept.
+	[riastradh, ticket #603]
+
+sys/dev/pci/ixgbe/ixgbe.c			1.349
+
+	ixg(4): add QPRDC (Queue Packet Receive Drop Count) to
+	the interfaces "dropped on input" error count.
+	[msaitoh, ticket #604]
+
+sys/dev/pci/igc/if_igc.c			1.10-1.13
+sys/dev/pci/igc/igc_defines.h			1.3
+
+	igc(4):
+- Count iqdrops (dropped on input errors).
+- Add missing igc_check_for_link() call. It's required
+  to set the collision distance, configure flow control
+  from the negotiated result and set the LTR thresholds.
+	[msaitoh, ticket #605]
+
+sys/dev/pci/if_wm.c1.794,1.798
+
+	wm(4): improve dmesg output.
+	 - Print RX packet buffer size.
+	 - Fix the upper 16bit of Image Unique ID(EtrackID).
+	[msaitoh, ticket #606]
+
+sys/dev/pci/if_wm.c1.795-1.797
+sys/dev/pci/if_wmreg.h1.131
+
+	wm(4):
+	- Add RQDPC(Receive Queue Drop Packet Count) to iqdrops.
+	- Drop frames if the RX descriptor ring has no room on
+	  multiqueue system
+	[msaitoh, ticket #607]
+



CVS commit: [netbsd-10] src/doc

2024-02-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 23 19:48:51 UTC 2024

Modified Files:
src/doc [netbsd-10]: CHANGES-10.0

Log Message:
Tickets #602 - #607


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.199 -r1.1.2.200 src/doc/CHANGES-10.0

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



CVS commit: [netbsd-9] src/doc

2024-02-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 23 19:47:59 UTC 2024

Modified Files:
src/doc [netbsd-9]: CHANGES-9.4

Log Message:
Tickets #1801 and #1802


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.131 -r1.1.2.132 src/doc/CHANGES-9.4

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

Modified files:

Index: src/doc/CHANGES-9.4
diff -u src/doc/CHANGES-9.4:1.1.2.131 src/doc/CHANGES-9.4:1.1.2.132
--- src/doc/CHANGES-9.4:1.1.2.131	Mon Feb 19 09:03:14 2024
+++ src/doc/CHANGES-9.4	Fri Feb 23 19:47:58 2024
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.4,v 1.1.2.131 2024/02/19 09:03:14 martin Exp $
+# $NetBSD: CHANGES-9.4,v 1.1.2.132 2024/02/23 19:47:58 martin Exp $
 
 A complete list of changes from the NetBSD 9.3 release to the NetBSD 9.4
 release:
@@ -4174,3 +4174,20 @@ sys/arch/vax/vsa/vsbus.c			1.69 (patch)
 	on netboot.
 	[tsutsui, ticket #1800]
 
+lib/libm/arch/x86_64/fenv.c			1.11
+tests/lib/libm/t_fenv.c1.14,1.15
+
+	libm: PR 57949: fix spurious side effects in fetestexcept.
+	[riastradh, ticket #1801]
+
+sys/dev/pci/if_wm.c 1.794-1.798 via patch
+sys/dev/pci/if_wmreg.h  1.131
+
+- Add RQDPC(Receive Queue Drop Packet Count) to iqdrops.
+- Drop frames if the RX descriptor ring has no room on multiqueue
+  system.
+- Improve dmesg output.
+  - Print RX packet buffer size.
+  - Fix the upper 16bit of Image Unique ID(EtrackID).
+	[msaitoh, ticket #1802]
+



CVS commit: [netbsd-9] src/doc

2024-02-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 23 19:47:59 UTC 2024

Modified Files:
src/doc [netbsd-9]: CHANGES-9.4

Log Message:
Tickets #1801 and #1802


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.131 -r1.1.2.132 src/doc/CHANGES-9.4

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



CVS commit: [netbsd-9] src/sys/dev/pci

2024-02-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 23 19:45:40 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-9]: if_wm.c if_wmreg.h

Log Message:
Pull up the following, requested by msaitoh in ticket #1802:

sys/dev/pci/if_wm.c 1.794-1.798 via patch
sys/dev/pci/if_wmreg.h  1.131

- Add RQDPC(Receive Queue Drop Packet Count) to iqdrops.
- Drop frames if the RX descriptor ring has no room on multiqueue
  system.
- Improve dmesg output:
  - Print RX packet buffer size.
  - Fix the upper 16bit of Image Unique ID(EtrackID).


To generate a diff of this commit:
cvs rdiff -u -r1.645.2.20 -r1.645.2.21 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.115.2.8 -r1.115.2.9 src/sys/dev/pci/if_wmreg.h

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



CVS commit: [netbsd-9] src/sys/dev/pci

2024-02-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 23 19:45:40 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-9]: if_wm.c if_wmreg.h

Log Message:
Pull up the following, requested by msaitoh in ticket #1802:

sys/dev/pci/if_wm.c 1.794-1.798 via patch
sys/dev/pci/if_wmreg.h  1.131

- Add RQDPC(Receive Queue Drop Packet Count) to iqdrops.
- Drop frames if the RX descriptor ring has no room on multiqueue
  system.
- Improve dmesg output:
  - Print RX packet buffer size.
  - Fix the upper 16bit of Image Unique ID(EtrackID).


To generate a diff of this commit:
cvs rdiff -u -r1.645.2.20 -r1.645.2.21 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.115.2.8 -r1.115.2.9 src/sys/dev/pci/if_wmreg.h

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

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.645.2.20 src/sys/dev/pci/if_wm.c:1.645.2.21
--- src/sys/dev/pci/if_wm.c:1.645.2.20	Sat Feb  3 12:02:58 2024
+++ src/sys/dev/pci/if_wm.c	Fri Feb 23 19:45:40 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.645.2.20 2024/02/03 12:02:58 martin Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.645.2.21 2024/02/23 19:45:40 martin Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.645.2.20 2024/02/03 12:02:58 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.645.2.21 2024/02/23 19:45:40 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -472,9 +472,9 @@ struct wm_rxqueue {
 	/* RX event counters */
 	WM_Q_EVCNT_DEFINE(rxq, intr);	/* Interrupts */
 	WM_Q_EVCNT_DEFINE(rxq, defer);	/* Rx deferred processing */
-
 	WM_Q_EVCNT_DEFINE(rxq, ipsum);	/* IP checksums checked */
 	WM_Q_EVCNT_DEFINE(rxq, tusum);	/* TCP/UDP cksums checked */
+	WM_Q_EVCNT_DEFINE(rxq, qdrop);	/* Rx queue drop packet */
 #endif
 };
 
@@ -2722,6 +2722,10 @@ alloc_retry:
 	/* Reset the chip to a known state. */
 	wm_reset(sc);
 
+	/* sc->sc_pba is set in wm_reset(). */
+	aprint_verbose_dev(sc->sc_dev, "RX packet buffer size: %uKB\n",
+	sc->sc_pba);
+
 	/*
 	 * Check for I21[01] PLL workaround.
 	 *
@@ -6618,6 +6622,7 @@ wm_update_stats(struct wm_softc *sc)
 	struct ifnet *ifp = &sc->sc_ethercom.ec_if;
 	uint64_t crcerrs, algnerrc, symerrc, mpc, colc,  sec, rlec, rxerrc,
 	cexterr;
+	uint64_t total_qdrop = 0;
 
 	crcerrs = CSR_READ(sc, WMREG_CRCERRS);
 	symerrc = CSR_READ(sc, WMREG_SYMERRC);
@@ -6766,6 +6771,22 @@ wm_update_stats(struct wm_softc *sc)
 		WM_EVCNT_ADD(&sc->sc_ev_lenerrs, CSR_READ(sc, WMREG_LENERRS));
 		WM_EVCNT_ADD(&sc->sc_ev_scvpc, CSR_READ(sc, WMREG_SCVPC));
 		WM_EVCNT_ADD(&sc->sc_ev_hrmpc, CSR_READ(sc, WMREG_HRMPC));
+#ifdef WM_EVENT_COUNTERS
+		for (int i = 0; i < sc->sc_nqueues; i++) {
+			struct wm_rxqueue *rxq = &sc->sc_queue[i].wmq_rxq;
+			uint32_t rqdpc;
+
+			rqdpc = CSR_READ(sc, WMREG_RQDPC(i));
+			/*
+			 * On I210 and newer device, the RQDPC register is not
+			 * cleard on read.
+			 */
+			if ((rqdpc != 0) && (sc->sc_type >= WM_T_I210))
+CSR_WRITE(sc, WMREG_RQDPC(i), 0);
+			WM_Q_EVCNT_ADD(rxq, qdrop, rqdpc);
+			total_qdrop += rqdpc;
+		}
+#endif
 	}
 	if ((sc->sc_type >= WM_T_I350) && !WM_IS_ICHPCH(sc)) {
 		WM_EVCNT_ADD(&sc->sc_ev_tlpic, CSR_READ(sc, WMREG_TLPIC));
@@ -6794,7 +6815,7 @@ wm_update_stats(struct wm_softc *sc)
 	 * If you want to know the nubmer of WMREG_RMBC, you should use such as
 	 * own EVCNT instead of if_iqdrops.
 	 */
-	ifp->if_iqdrops += mpc;
+	ifp->if_iqdrops += mpc + total_qdrop;
 }
 
 void
@@ -6811,6 +6832,8 @@ wm_clear_evcnt(struct wm_softc *sc)
 		WM_Q_EVCNT_STORE(rxq, defer, 0);
 		WM_Q_EVCNT_STORE(rxq, ipsum, 0);
 		WM_Q_EVCNT_STORE(rxq, tusum, 0);
+		if ((sc->sc_type >= WM_T_82575) && !WM_IS_ICHPCH(sc))
+			WM_Q_EVCNT_STORE(rxq, qdrop, 0);
 	}
 
 	/* TX queues */
@@ -8147,9 +8170,10 @@ wm_alloc_txrx_queues(struct wm_softc *sc
 
 		WM_Q_INTR_EVCNT_ATTACH(rxq, intr, rxq, i, xname);
 		WM_Q_INTR_EVCNT_ATTACH(rxq, defer, rxq, i, xname);
-
 		WM_Q_MISC_EVCNT_ATTACH(rxq, ipsum, rxq, i, xname);
 		WM_Q_MISC_EVCNT_ATTACH(rxq, tusum, rxq, i, xname);
+		if ((sc->sc_type >= WM_T_82575) && !WM_IS_ICHPCH(sc))
+			WM_Q_MISC_EVCNT_ATTACH(rxq, qdrop, rxq, i, xname);
 #endif /* WM_EVENT_COUNTERS */
 
 		rx_done++;
@@ -8212,6 +8236,8 @@ wm_free_txrx_queues(struct wm_softc *sc)
 		WM_Q_EVCNT_DETACH(rxq, defer, rxq, i);
 		WM_Q_EVCNT_DETACH(rxq, ipsum, rxq, i);
 		WM_Q_EVCNT_DETACH(rxq, tusum, rxq, i);
+		if ((sc->sc_type >= WM_T_82575) && !WM_IS_ICHPCH(sc))
+			WM_Q_EVCNT_DETACH(rxq, qdrop, rxq, i);
 #endif /* WM_EVENT_COUNTERS */
 
 		wm_free_rx_buffer(sc, rxq);
@@ -8401,6 +8427,8 @@ wm_init_rx_regs(struct wm_softc *sc, str
 		rxq->rxq_descsize * rxq->rxq_ndesc);
 
 		if ((sc->sc_flags & WM_F_NEWQUEUE) != 0) {
+			uint32_t srrctl;
+
 			if (MCLBYTES & ((1 << SRRCTL_BSIZEPKT_SHIFT) - 1))
 panic("%s: MCLBYTES %d unsupported for 

CVS commit: [netbsd-10] src/sys/dev/pci

2024-02-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 23 18:54:36 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-10]: if_wm.c if_wmreg.h

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #607):

sys/dev/pci/if_wm.c: revision 1.795
sys/dev/pci/if_wm.c: revision 1.796
sys/dev/pci/if_wm.c: revision 1.797
sys/dev/pci/if_wmreg.h: revision 1.131

wm(4): Add RQDPC(Receive Queue Drop Packet Count) to iqdrops.

 The iqdrops counter should include not only MPC(Missed Packet Count)
but also RQDPC(Receive Queue Drop Packet Count). Same as ixgbe(4) and igc(4).

 Note that the RQDPC is not currently counted because SRRCTL_DROP_EN
is not set.

wm(4): Drop frames if the RX descriptor ring has no room on multiqueue system.

 Drop frames if the RX descriptor ring has no room. This is enabled only on
multiqueue system to avoid bad influence to other queues. The drop count
can be seen by the RQDPC counter (wmN rxqXXdrop evcnt).

wm(4): Fix compile error without WM_EVENT_COUNTERS.


To generate a diff of this commit:
cvs rdiff -u -r1.767.2.7 -r1.767.2.8 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.128.2.1 -r1.128.2.2 src/sys/dev/pci/if_wmreg.h

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

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.767.2.7 src/sys/dev/pci/if_wm.c:1.767.2.8
--- src/sys/dev/pci/if_wm.c:1.767.2.7	Fri Feb 23 18:45:46 2024
+++ src/sys/dev/pci/if_wm.c	Fri Feb 23 18:54:36 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.767.2.7 2024/02/23 18:45:46 martin Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.767.2.8 2024/02/23 18:54:36 martin Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.767.2.7 2024/02/23 18:45:46 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.767.2.8 2024/02/23 18:54:36 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_if_wm.h"
@@ -460,9 +460,9 @@ struct wm_rxqueue {
 	/* RX event counters */
 	WM_Q_EVCNT_DEFINE(rxq, intr);	/* Interrupts */
 	WM_Q_EVCNT_DEFINE(rxq, defer);	/* Rx deferred processing */
-
 	WM_Q_EVCNT_DEFINE(rxq, ipsum);	/* IP checksums checked */
 	WM_Q_EVCNT_DEFINE(rxq, tusum);	/* TCP/UDP cksums checked */
+	WM_Q_EVCNT_DEFINE(rxq, qdrop);	/* Rx queue drop packet */
 #endif
 };
 
@@ -6639,6 +6639,7 @@ wm_update_stats(struct wm_softc *sc)
 	struct ifnet *ifp = &sc->sc_ethercom.ec_if;
 	uint64_t crcerrs, algnerrc, symerrc, mpc, colc,  sec, rlec, rxerrc,
 	cexterr;
+	uint64_t total_qdrop = 0;
 
 	crcerrs = CSR_READ(sc, WMREG_CRCERRS);
 	symerrc = CSR_READ(sc, WMREG_SYMERRC);
@@ -6787,6 +6788,22 @@ wm_update_stats(struct wm_softc *sc)
 		WM_EVCNT_ADD(&sc->sc_ev_lenerrs, CSR_READ(sc, WMREG_LENERRS));
 		WM_EVCNT_ADD(&sc->sc_ev_scvpc, CSR_READ(sc, WMREG_SCVPC));
 		WM_EVCNT_ADD(&sc->sc_ev_hrmpc, CSR_READ(sc, WMREG_HRMPC));
+#ifdef WM_EVENT_COUNTERS
+		for (int i = 0; i < sc->sc_nqueues; i++) {
+			struct wm_rxqueue *rxq = &sc->sc_queue[i].wmq_rxq;
+			uint32_t rqdpc;
+
+			rqdpc = CSR_READ(sc, WMREG_RQDPC(i));
+			/*
+			 * On I210 and newer device, the RQDPC register is not
+			 * cleard on read.
+			 */
+			if ((rqdpc != 0) && (sc->sc_type >= WM_T_I210))
+CSR_WRITE(sc, WMREG_RQDPC(i), 0);
+			WM_Q_EVCNT_ADD(rxq, qdrop, rqdpc);
+			total_qdrop += rqdpc;
+		}
+#endif
 	}
 	if ((sc->sc_type >= WM_T_I350) && !WM_IS_ICHPCH(sc)) {
 		WM_EVCNT_ADD(&sc->sc_ev_tlpic, CSR_READ(sc, WMREG_TLPIC));
@@ -6815,7 +6832,7 @@ wm_update_stats(struct wm_softc *sc)
 	 * If you want to know the nubmer of WMREG_RMBC, you should use such as
 	 * own EVCNT instead of if_iqdrops.
 	 */
-	if_statadd_ref(nsr, if_iqdrops, mpc);
+	if_statadd_ref(nsr, if_iqdrops, mpc + total_qdrop);
 	IF_STAT_PUTREF(ifp);
 }
 
@@ -6833,6 +6850,8 @@ wm_clear_evcnt(struct wm_softc *sc)
 		WM_Q_EVCNT_STORE(rxq, defer, 0);
 		WM_Q_EVCNT_STORE(rxq, ipsum, 0);
 		WM_Q_EVCNT_STORE(rxq, tusum, 0);
+		if ((sc->sc_type >= WM_T_82575) && !WM_IS_ICHPCH(sc))
+			WM_Q_EVCNT_STORE(rxq, qdrop, 0);
 	}
 
 	/* TX queues */
@@ -8195,9 +8214,10 @@ wm_alloc_txrx_queues(struct wm_softc *sc
 
 		WM_Q_INTR_EVCNT_ATTACH(rxq, intr, rxq, i, xname);
 		WM_Q_INTR_EVCNT_ATTACH(rxq, defer, rxq, i, xname);
-
 		WM_Q_MISC_EVCNT_ATTACH(rxq, ipsum, rxq, i, xname);
 		WM_Q_MISC_EVCNT_ATTACH(rxq, tusum, rxq, i, xname);
+		if ((sc->sc_type >= WM_T_82575) && !WM_IS_ICHPCH(sc))
+			WM_Q_MISC_EVCNT_ATTACH(rxq, qdrop, rxq, i, xname);
 #endif /* WM_EVENT_COUNTERS */
 
 		rx_done++;
@@ -8248,6 +8268,8 @@ wm_free_txrx_queues(struct wm_softc *sc)
 		WM_Q_EVCNT_DETACH(rxq, defer, rxq, i);
 		WM_Q_EVCNT_DETACH(rxq, ipsum, rxq, i);
 		WM_Q_EVCNT_DETACH(rxq, tusum, rxq, i);
+		if ((sc->sc_type >= WM_T_82575) && !WM_IS_ICHPCH(sc))
+			WM_Q_EVCNT_DETACH(rxq, qdrop, rxq, i);
 #endif /* WM_EVENT_COUNTERS */
 
 		wm_free_rx_buffer(sc, rxq);
@@ -8437,6 +8459,8 @@ wm_init_rx_regs(struct wm_softc *sc, str
 		

CVS commit: [netbsd-10] src/sys/dev/pci

2024-02-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 23 18:54:36 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-10]: if_wm.c if_wmreg.h

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #607):

sys/dev/pci/if_wm.c: revision 1.795
sys/dev/pci/if_wm.c: revision 1.796
sys/dev/pci/if_wm.c: revision 1.797
sys/dev/pci/if_wmreg.h: revision 1.131

wm(4): Add RQDPC(Receive Queue Drop Packet Count) to iqdrops.

 The iqdrops counter should include not only MPC(Missed Packet Count)
but also RQDPC(Receive Queue Drop Packet Count). Same as ixgbe(4) and igc(4).

 Note that the RQDPC is not currently counted because SRRCTL_DROP_EN
is not set.

wm(4): Drop frames if the RX descriptor ring has no room on multiqueue system.

 Drop frames if the RX descriptor ring has no room. This is enabled only on
multiqueue system to avoid bad influence to other queues. The drop count
can be seen by the RQDPC counter (wmN rxqXXdrop evcnt).

wm(4): Fix compile error without WM_EVENT_COUNTERS.


To generate a diff of this commit:
cvs rdiff -u -r1.767.2.7 -r1.767.2.8 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.128.2.1 -r1.128.2.2 src/sys/dev/pci/if_wmreg.h

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



CVS commit: [netbsd-10] src/sys/dev/pci

2024-02-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 23 18:45:46 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-10]: if_wm.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #606):

sys/dev/pci/if_wm.c: revision 1.794
sys/dev/pci/if_wm.c: revision 1.798

wm(4): Print RX packet buffer size.

wm(4): Fix upper 16bit of Image Unique ID(EtrackID).

 Don't override uid1 variable while reading option ROM version
to print Image Unique ID correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.767.2.6 -r1.767.2.7 src/sys/dev/pci/if_wm.c

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

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.767.2.6 src/sys/dev/pci/if_wm.c:1.767.2.7
--- src/sys/dev/pci/if_wm.c:1.767.2.6	Sat Feb  3 12:01:59 2024
+++ src/sys/dev/pci/if_wm.c	Fri Feb 23 18:45:46 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.767.2.6 2024/02/03 12:01:59 martin Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.767.2.7 2024/02/23 18:45:46 martin Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.767.2.6 2024/02/03 12:01:59 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.767.2.7 2024/02/23 18:45:46 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_if_wm.h"
@@ -2722,6 +2722,10 @@ alloc_retry:
 	/* Reset the chip to a known state. */
 	wm_reset(sc);
 
+	/* sc->sc_pba is set in wm_reset(). */
+	aprint_verbose_dev(sc->sc_dev, "RX packet buffer size: %uKB\n",
+	sc->sc_pba);
+
 	/*
 	 * Check for I21[01] PLL workaround.
 	 *
@@ -15328,16 +15332,17 @@ printver:
 		/* Option ROM Version */
 		if ((off != 0x) && (off != 0x)) {
 			int rv;
+			uint16_t oid0, oid1;
 
 			off += NVM_COMBO_VER_OFF;
-			rv = wm_nvm_read(sc, off + 1, 1, &uid1);
-			rv |= wm_nvm_read(sc, off, 1, &uid0);
-			if ((rv == 0) && (uid0 != 0) && (uid0 != 0x)
-			&& (uid1 != 0) && (uid1 != 0x)) {
+			rv = wm_nvm_read(sc, off + 1, 1, &oid1);
+			rv |= wm_nvm_read(sc, off, 1, &oid0);
+			if ((rv == 0) && (oid0 != 0) && (oid0 != 0x)
+			&& (oid1 != 0) && (oid1 != 0x)) {
 /* 16bits */
-major = uid0 >> 8;
-build = (uid0 << 8) | (uid1 >> 8);
-patch = uid1 & 0x00ff;
+major = oid0 >> 8;
+build = (oid0 << 8) | (oid1 >> 8);
+patch = oid1 & 0x00ff;
 aprint_verbose(", option ROM Version %d.%d.%d",
 major, build, patch);
 			}



CVS commit: [netbsd-10] src/sys/dev/pci

2024-02-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 23 18:45:46 UTC 2024

Modified Files:
src/sys/dev/pci [netbsd-10]: if_wm.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #606):

sys/dev/pci/if_wm.c: revision 1.794
sys/dev/pci/if_wm.c: revision 1.798

wm(4): Print RX packet buffer size.

wm(4): Fix upper 16bit of Image Unique ID(EtrackID).

 Don't override uid1 variable while reading option ROM version
to print Image Unique ID correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.767.2.6 -r1.767.2.7 src/sys/dev/pci/if_wm.c

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



CVS commit: [netbsd-10] src/sys/dev/pci/igc

2024-02-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 23 18:41:02 UTC 2024

Modified Files:
src/sys/dev/pci/igc [netbsd-10]: if_igc.c igc_defines.h

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #605):

sys/dev/pci/igc/if_igc.c: revision 1.12
sys/dev/pci/igc/if_igc.c: revision 1.13
sys/dev/pci/igc/igc_defines.h: revision 1.3
sys/dev/pci/igc/if_igc.c: revision 1.10
sys/dev/pci/igc/if_igc.c: revision 1.11

igc(4): Count iqdrops.

 TODO: RQDPC should be visible via evcnt(9).

igc: Add missing igc_check_for_link() call.

 It's required to set the collision distance, configure flow control
from the negotiated result and set the LTR thresholds.

With this change, ifconfig igcN show the flow control status correctly.

igc(4): Modify dmesg output of PHY and NVM info.
 - Print PHY info first and then print NVM info.
 - Remove debug output.

igc(4): Print EtrackID.


To generate a diff of this commit:
cvs rdiff -u -r1.3.2.3 -r1.3.2.4 src/sys/dev/pci/igc/if_igc.c
cvs rdiff -u -r1.2.2.2 -r1.2.2.3 src/sys/dev/pci/igc/igc_defines.h

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



CVS commit: [netbsd-10] src/sys/dev/pci/igc

2024-02-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 23 18:41:02 UTC 2024

Modified Files:
src/sys/dev/pci/igc [netbsd-10]: if_igc.c igc_defines.h

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #605):

sys/dev/pci/igc/if_igc.c: revision 1.12
sys/dev/pci/igc/if_igc.c: revision 1.13
sys/dev/pci/igc/igc_defines.h: revision 1.3
sys/dev/pci/igc/if_igc.c: revision 1.10
sys/dev/pci/igc/if_igc.c: revision 1.11

igc(4): Count iqdrops.

 TODO: RQDPC should be visible via evcnt(9).

igc: Add missing igc_check_for_link() call.

 It's required to set the collision distance, configure flow control
from the negotiated result and set the LTR thresholds.

With this change, ifconfig igcN show the flow control status correctly.

igc(4): Modify dmesg output of PHY and NVM info.
 - Print PHY info first and then print NVM info.
 - Remove debug output.

igc(4): Print EtrackID.


To generate a diff of this commit:
cvs rdiff -u -r1.3.2.3 -r1.3.2.4 src/sys/dev/pci/igc/if_igc.c
cvs rdiff -u -r1.2.2.2 -r1.2.2.3 src/sys/dev/pci/igc/igc_defines.h

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

Modified files:

Index: src/sys/dev/pci/igc/if_igc.c
diff -u src/sys/dev/pci/igc/if_igc.c:1.3.2.3 src/sys/dev/pci/igc/if_igc.c:1.3.2.4
--- src/sys/dev/pci/igc/if_igc.c:1.3.2.3	Sat Oct 14 06:49:37 2023
+++ src/sys/dev/pci/igc/if_igc.c	Fri Feb 23 18:41:02 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_igc.c,v 1.3.2.3 2023/10/14 06:49:37 martin Exp $	*/
+/*	$NetBSD: if_igc.c,v 1.3.2.4 2024/02/23 18:41:02 martin Exp $	*/
 /*	$OpenBSD: if_igc.c,v 1.13 2023/04/28 10:18:57 bluhm Exp $	*/
 /*-
  * SPDX-License-Identifier: BSD-2-Clause
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_igc.c,v 1.3.2.3 2023/10/14 06:49:37 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_igc.c,v 1.3.2.4 2024/02/23 18:41:02 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -1112,11 +1112,35 @@ igc_update_counters(struct igc_softc *sc
 
 	/* Mac statistics */
 	struct igc_hw *hw = &sc->hw;
+	struct ifnet *ifp = &sc->sc_ec.ec_if;
+	uint64_t iqdrops = 0;
 
 	for (int cnt = 0; cnt < IGC_MAC_COUNTERS; cnt++) {
-		IGC_MAC_COUNTER_ADD(sc, cnt, igc_read_mac_counter(hw,
-		igc_mac_counters[cnt].reg, igc_mac_counters[cnt].is64));
+		uint64_t val;
+		bus_size_t regaddr = igc_mac_counters[cnt].reg;
+
+		val = igc_read_mac_counter(hw, regaddr,
+		igc_mac_counters[cnt].is64);
+		IGC_MAC_COUNTER_ADD(sc, cnt, val);
+		/* XXX Count MPC to iqdrops. */
+		if (regaddr == IGC_MPC)
+			iqdrops += val;
+	}
+
+	for (int iq = 0; iq < sc->sc_nqueues; iq++) {
+		uint32_t val;
+
+		/* XXX RQDPC should be visible via evcnt(9). */
+		val = IGC_READ_REG(hw, IGC_RQDPC(iq));
+
+		/* RQDPC is not cleard on read. */
+		if (val != 0)
+			IGC_WRITE_REG(hw, IGC_RQDPC(iq), 0);
+		iqdrops += val;
 	}
+
+	if (iqdrops != 0)
+		if_statadd(ifp, if_iqdrops, iqdrops);
 #endif
 }
 
@@ -2518,6 +2542,9 @@ igc_update_link_status(struct igc_softc 
 	struct ifnet *ifp = &sc->sc_ec.ec_if;
 	struct igc_hw *hw = &sc->hw;
 
+	if (hw->mac.get_link_status == true)
+		igc_check_for_link(hw);
+
 	if (IGC_READ_REG(&sc->hw, IGC_STATUS) & IGC_STATUS_LU) {
 		if (sc->link_active == 0) {
 			igc_get_speed_and_duplex(hw, &sc->link_speed,
@@ -3817,7 +3844,7 @@ igc_print_devinfo(struct igc_softc *sc)
 	struct igc_hw *hw = &sc->hw;
 	struct igc_phy_info *phy = &hw->phy;
 	u_int oui, model, rev;
-	uint16_t id1, id2, nvm_ver, phy_ver;
+	uint16_t id1, id2, nvm_ver, phy_ver, etk_lo, etk_hi;
 	char descr[MII_MAX_DESCR_LEN];
 
 	/* Print PHY Info */
@@ -3829,23 +3856,26 @@ igc_print_devinfo(struct igc_softc *sc)
 	rev = MII_REV(id2);
 	mii_get_descr(descr, sizeof(descr), oui, model);
 	if (descr[0])
-		aprint_normal_dev(dev, "PHY: %s, rev. %d\n",
+		aprint_normal_dev(dev, "PHY: %s, rev. %d",
 		descr, rev);
 	else
 		aprint_normal_dev(dev,
-		"PHY OUI 0x%06x, model 0x%04x, rev. %d\n",
+		"PHY OUI 0x%06x, model 0x%04x, rev. %d",
 		oui, model, rev);
 
-	/* Get NVM version */
+	/* PHY FW version */
+	phy->ops.read_reg(hw, 0x1e, &phy_ver);
+	aprint_normal(", PHY FW version 0x%04hx\n", phy_ver);
+
+	/* NVM version */
 	hw->nvm.ops.read(hw, NVM_VERSION, 1, &nvm_ver);
 
-	/* Get PHY FW version */
-	phy->ops.read_reg(hw, 0x1e, &phy_ver);
+	/* EtrackID */
+	hw->nvm.ops.read(hw, NVM_ETKID_LO, 1, &etk_lo);
+	hw->nvm.ops.read(hw, NVM_ETKID_HI, 1, &etk_hi);
 
-	aprint_normal_dev(dev, "ROM image version %x.%02x",
+	aprint_normal_dev(dev,
+	"NVM image version %x.%02x, EtrackID %04hx%04hx\n",
 	(nvm_ver & NVM_VERSION_MAJOR) >> NVM_VERSION_MAJOR_SHIFT,
-	(nvm_ver & NVM_VERSION_MINOR));
-	aprint_debug("(0x%04hx)", nvm_ver);
-
-	aprint_normal(", PHY FW version 0x%04hx\n", phy_ver);
+	nvm_ver & NVM_VERSION_MINOR, etk_hi, etk_lo);
 }

Index: src/sys/dev/pci/igc/igc_defines.h
diff -u src/sys/dev/pci/igc/igc_defines.h:1.2.2.2 src/sys/dev/pci/igc/igc_de

CVS commit: [netbsd-10] src/sys/dev/pci/ixgbe

2024-02-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 23 18:36:00 UTC 2024

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-10]: ixgbe.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #604):

sys/dev/pci/ixgbe/ixgbe.c: revision 1.349

ixgbe: Add QPRDC into iqdrops.

 A receive packet might drop at two different locations.

One is the packet buffer that packets are received into the chip first.
If the packet buffer is overflowed, the MPC register is incremented.
It's currently added to iqdrops. It's no problem.

Another is descriptor ring(s). A packet from the packet buffer is DMA'ed
into main memory base on the descriptor ring. If the ring is full, the packet
is dropped and the QPRDC register is incremented. It should be added to
iqdrops but it was not done. Fix it.

Reported by ozaki-r@.


To generate a diff of this commit:
cvs rdiff -u -r1.324.2.7 -r1.324.2.8 src/sys/dev/pci/ixgbe/ixgbe.c

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

Modified files:

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.324.2.7 src/sys/dev/pci/ixgbe/ixgbe.c:1.324.2.8
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.324.2.7	Sat Feb  3 11:58:53 2024
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Fri Feb 23 18:35:59 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.324.2.7 2024/02/03 11:58:53 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.324.2.8 2024/02/23 18:35:59 martin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.324.2.7 2024/02/03 11:58:53 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.324.2.8 2024/02/23 18:35:59 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1637,7 +1637,7 @@ ixgbe_update_stats_counters(struct ixgbe
 	struct ixgbe_hw	  *hw = &sc->hw;
 	struct ixgbe_hw_stats *stats = &sc->stats.pf;
 	u32		  missed_rx = 0, bprc, lxontxc, lxofftxc;
-	u64		  total, total_missed_rx = 0;
+	u64		  total, total_missed_rx = 0, total_qprdc = 0;
 	uint64_t	  crcerrs, illerrc, rlec, ruc, rfc, roc, rjc;
 	unsigned int	  queue_counters;
 	int		  i;
@@ -1656,13 +1656,18 @@ ixgbe_update_stats_counters(struct ixgbe
 		IXGBE_EVC_REGADD(hw, stats, IXGBE_QPRC(i), qprc[i]);
 		IXGBE_EVC_REGADD(hw, stats, IXGBE_QPTC(i), qptc[i]);
 		if (hw->mac.type >= ixgbe_mac_82599EB) {
+			uint32_t qprdc;
+
 			IXGBE_EVC_ADD(&stats->qbrc[i],
 			IXGBE_READ_REG(hw, IXGBE_QBRC_L(i)) +
 			((u64)IXGBE_READ_REG(hw, IXGBE_QBRC_H(i)) << 32));
 			IXGBE_EVC_ADD(&stats->qbtc[i],
 			IXGBE_READ_REG(hw, IXGBE_QBTC_L(i)) +
 			((u64)IXGBE_READ_REG(hw, IXGBE_QBTC_H(i)) << 32));
-			IXGBE_EVC_REGADD(hw, stats, IXGBE_QPRDC(i), qprdc[i]);
+			/* QPRDC will be added to iqdrops. */
+			qprdc = IXGBE_READ_REG(hw, IXGBE_QPRDC(i));
+			IXGBE_EVC_ADD(&stats->qprdc[i], qprdc);
+			total_qprdc += qprdc;
 		} else {
 			/* 82598 */
 			IXGBE_EVC_REGADD(hw, stats, IXGBE_QBRC(i), qbrc[i]);
@@ -1793,7 +1798,7 @@ ixgbe_update_stats_counters(struct ixgbe
 	 * normal RX counters are prepared in ether_input().
 	 */
 	net_stat_ref_t nsr = IF_STAT_GETREF(ifp);
-	if_statadd_ref(nsr, if_iqdrops, total_missed_rx);
+	if_statadd_ref(nsr, if_iqdrops, total_missed_rx + total_qprdc);
 
 	/*
 	 * Aggregate following types of errors as RX errors:



CVS commit: [netbsd-10] src/sys/dev/pci/ixgbe

2024-02-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 23 18:36:00 UTC 2024

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-10]: ixgbe.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #604):

sys/dev/pci/ixgbe/ixgbe.c: revision 1.349

ixgbe: Add QPRDC into iqdrops.

 A receive packet might drop at two different locations.

One is the packet buffer that packets are received into the chip first.
If the packet buffer is overflowed, the MPC register is incremented.
It's currently added to iqdrops. It's no problem.

Another is descriptor ring(s). A packet from the packet buffer is DMA'ed
into main memory base on the descriptor ring. If the ring is full, the packet
is dropped and the QPRDC register is incremented. It should be added to
iqdrops but it was not done. Fix it.

Reported by ozaki-r@.


To generate a diff of this commit:
cvs rdiff -u -r1.324.2.7 -r1.324.2.8 src/sys/dev/pci/ixgbe/ixgbe.c

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



CVS commit: [netbsd-8] src/doc

2024-02-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 23 18:18:35 UTC 2024

Modified Files:
src/doc [netbsd-8]: CHANGES-8.3

Log Message:
Ticket #1937


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.219 -r1.1.2.220 src/doc/CHANGES-8.3

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

Modified files:

Index: src/doc/CHANGES-8.3
diff -u src/doc/CHANGES-8.3:1.1.2.219 src/doc/CHANGES-8.3:1.1.2.220
--- src/doc/CHANGES-8.3:1.1.2.219	Sat Feb 17 16:14:05 2024
+++ src/doc/CHANGES-8.3	Fri Feb 23 18:18:35 2024
@@ -1,4 +1,4 @@
-$NetBSD: CHANGES-8.3,v 1.1.2.219 2024/02/17 16:14:05 martin Exp $
+$NetBSD: CHANGES-8.3,v 1.1.2.220 2024/02/23 18:18:35 martin Exp $
 
 A complete list of changes from the NetBSD 8.2 release to the NetBSD 8.3
 release:
@@ -4274,3 +4274,9 @@ libexec/utmp_update/utmp_update.c		1.14
 	utmp_update(8): check for non-printable characters in ut_host.
 	[shm, ticket #1936]
 
+lib/libm/arch/x86_64/fenv.c			1.11
+tests/lib/libm/t_fenv.c1.14,1.15
+
+	libm: PR 57949: fix spurious side effects in fetestexcept.
+	[riastradh, ticket #1937]
+



CVS commit: [netbsd-8] src/doc

2024-02-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 23 18:18:35 UTC 2024

Modified Files:
src/doc [netbsd-8]: CHANGES-8.3

Log Message:
Ticket #1937


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.219 -r1.1.2.220 src/doc/CHANGES-8.3

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



CVS commit: [netbsd-8] src

2024-02-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 23 18:15:53 UTC 2024

Modified Files:
src/lib/libm/arch/x86_64 [netbsd-8]: fenv.c
src/tests/lib/libm [netbsd-8]: t_fenv.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1937):

tests/lib/libm/t_fenv.c: revision 1.14
tests/lib/libm/t_fenv.c: revision 1.15
lib/libm/arch/x86_64/fenv.c: revision 1.11

fenv(3): Add test for PR port-amd64/57949.

fenv(3): Fix fetestexcept to avoid side effects on trap state.

PR port-amd64/57949


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.7.4.1 src/lib/libm/arch/x86_64/fenv.c
cvs rdiff -u -r1.3 -r1.3.8.1 src/tests/lib/libm/t_fenv.c

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

Modified files:

Index: src/lib/libm/arch/x86_64/fenv.c
diff -u src/lib/libm/arch/x86_64/fenv.c:1.7 src/lib/libm/arch/x86_64/fenv.c:1.7.4.1
--- src/lib/libm/arch/x86_64/fenv.c:1.7	Wed Mar 22 23:11:09 2017
+++ src/lib/libm/arch/x86_64/fenv.c	Fri Feb 23 18:15:53 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: fenv.c,v 1.7 2017/03/22 23:11:09 chs Exp $ */
+/* $NetBSD: fenv.c,v 1.7.4.1 2024/02/23 18:15:53 martin Exp $ */
 
 /*-
  * Copyright (c) 2004-2005 David Schultz 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: fenv.c,v 1.7 2017/03/22 23:11:09 chs Exp $");
+__RCSID("$NetBSD: fenv.c,v 1.7.4.1 2024/02/23 18:15:53 martin Exp $");
 
 #include "namespace.h"
 
@@ -259,7 +259,6 @@ fesetexceptflag(const fexcept_t *flagp, 
 int
 fetestexcept(int excepts)
 {
-	fenv_t fenv;
 	uint32_t mxcsr;
 	uint16_t status;
 	int ex;
@@ -268,17 +267,10 @@ fetestexcept(int excepts)
 
 	ex = excepts & FE_ALL_EXCEPT;
 
-	/* Store the current x87 floating-point environment */
-	memset(&fenv, 0, sizeof(fenv));
-
-	__fnstenv(&fenv);
 	__fnstsw(&status);
-
-	/* Store the MXCSR register state */
-	__stmxcsr(&fenv.mxcsr);
 	__stmxcsr(&mxcsr);
 
-	return ((fenv.x87.status | fenv.mxcsr) & ex);
+	return ((status | mxcsr) & ex);
 }
 
 /*

Index: src/tests/lib/libm/t_fenv.c
diff -u src/tests/lib/libm/t_fenv.c:1.3 src/tests/lib/libm/t_fenv.c:1.3.8.1
--- src/tests/lib/libm/t_fenv.c:1.3	Tue Dec 22 14:20:59 2015
+++ src/tests/lib/libm/t_fenv.c	Fri Feb 23 18:15:53 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: t_fenv.c,v 1.3 2015/12/22 14:20:59 christos Exp $ */
+/* $NetBSD: t_fenv.c,v 1.3.8.1 2024/02/23 18:15:53 martin Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: t_fenv.c,v 1.3 2015/12/22 14:20:59 christos Exp $");
+__RCSID("$NetBSD: t_fenv.c,v 1.3.8.1 2024/02/23 18:15:53 martin Exp $");
 
 #include 
 
@@ -185,12 +185,40 @@ ATF_TC_BODY(feenableexcept, tc)
 	ATF_CHECK(fpgetmask() == FP_X_INV);
 }
 
+ATF_TC(fetestexcept_trap);
+ATF_TC_HEAD(fetestexcept_trap, tc)
+{
+	atf_tc_set_md_var(tc, "descr",
+	"Verify fetestexcept doesn't affect the trapped excpetions");
+}
+ATF_TC_BODY(fetestexcept_trap, tc)
+{
+	int except;
+
+	fedisableexcept(FE_ALL_EXCEPT);
+	ATF_CHECK_EQ_MSG((except = fegetexcept()), 0,
+	"fegetexcept()=0x%x", except);
+
+	(void)fetestexcept(FE_ALL_EXCEPT);
+	ATF_CHECK_EQ_MSG((except = fegetexcept()), 0,
+	"fegetexcept()=0x%x", except);
+
+	feenableexcept(FE_ALL_EXCEPT);
+	ATF_CHECK_EQ_MSG((except = fegetexcept()), FE_ALL_EXCEPT,
+	"fegetexcept()=0x%x FE_ALL_EXCEPT=0x%x", except, FE_ALL_EXCEPT);
+
+	(void)fetestexcept(FE_ALL_EXCEPT);
+	ATF_CHECK_EQ_MSG((except = fegetexcept()), FE_ALL_EXCEPT,
+	"fegetexcept()=0x%x FE_ALL_EXCEPT=0x%x", except, FE_ALL_EXCEPT);
+}
+
 ATF_TP_ADD_TCS(tp)
 {
 	ATF_TP_ADD_TC(tp, fegetround);
 	ATF_TP_ADD_TC(tp, fesetround);
 	ATF_TP_ADD_TC(tp, fegetexcept);
 	ATF_TP_ADD_TC(tp, feenableexcept);
+	ATF_TP_ADD_TC(tp, fetestexcept_trap);
 
 	return atf_no_error();
 }



CVS commit: [netbsd-8] src

2024-02-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 23 18:15:53 UTC 2024

Modified Files:
src/lib/libm/arch/x86_64 [netbsd-8]: fenv.c
src/tests/lib/libm [netbsd-8]: t_fenv.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1937):

tests/lib/libm/t_fenv.c: revision 1.14
tests/lib/libm/t_fenv.c: revision 1.15
lib/libm/arch/x86_64/fenv.c: revision 1.11

fenv(3): Add test for PR port-amd64/57949.

fenv(3): Fix fetestexcept to avoid side effects on trap state.

PR port-amd64/57949


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.7.4.1 src/lib/libm/arch/x86_64/fenv.c
cvs rdiff -u -r1.3 -r1.3.8.1 src/tests/lib/libm/t_fenv.c

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



CVS commit: [netbsd-9] src

2024-02-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 23 18:13:54 UTC 2024

Modified Files:
src/lib/libm/arch/x86_64 [netbsd-9]: fenv.c
src/tests/lib/libm [netbsd-9]: t_fenv.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1801):

tests/lib/libm/t_fenv.c: revision 1.14
tests/lib/libm/t_fenv.c: revision 1.15
lib/libm/arch/x86_64/fenv.c: revision 1.11

fenv(3): Add test for PR port-amd64/57949.

fenv(3): Fix fetestexcept to avoid side effects on trap state.

PR port-amd64/57949


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.7.14.1 src/lib/libm/arch/x86_64/fenv.c
cvs rdiff -u -r1.6 -r1.6.2.1 src/tests/lib/libm/t_fenv.c

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

Modified files:

Index: src/lib/libm/arch/x86_64/fenv.c
diff -u src/lib/libm/arch/x86_64/fenv.c:1.7 src/lib/libm/arch/x86_64/fenv.c:1.7.14.1
--- src/lib/libm/arch/x86_64/fenv.c:1.7	Wed Mar 22 23:11:09 2017
+++ src/lib/libm/arch/x86_64/fenv.c	Fri Feb 23 18:13:54 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: fenv.c,v 1.7 2017/03/22 23:11:09 chs Exp $ */
+/* $NetBSD: fenv.c,v 1.7.14.1 2024/02/23 18:13:54 martin Exp $ */
 
 /*-
  * Copyright (c) 2004-2005 David Schultz 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: fenv.c,v 1.7 2017/03/22 23:11:09 chs Exp $");
+__RCSID("$NetBSD: fenv.c,v 1.7.14.1 2024/02/23 18:13:54 martin Exp $");
 
 #include "namespace.h"
 
@@ -259,7 +259,6 @@ fesetexceptflag(const fexcept_t *flagp, 
 int
 fetestexcept(int excepts)
 {
-	fenv_t fenv;
 	uint32_t mxcsr;
 	uint16_t status;
 	int ex;
@@ -268,17 +267,10 @@ fetestexcept(int excepts)
 
 	ex = excepts & FE_ALL_EXCEPT;
 
-	/* Store the current x87 floating-point environment */
-	memset(&fenv, 0, sizeof(fenv));
-
-	__fnstenv(&fenv);
 	__fnstsw(&status);
-
-	/* Store the MXCSR register state */
-	__stmxcsr(&fenv.mxcsr);
 	__stmxcsr(&mxcsr);
 
-	return ((fenv.x87.status | fenv.mxcsr) & ex);
+	return ((status | mxcsr) & ex);
 }
 
 /*

Index: src/tests/lib/libm/t_fenv.c
diff -u src/tests/lib/libm/t_fenv.c:1.6 src/tests/lib/libm/t_fenv.c:1.6.2.1
--- src/tests/lib/libm/t_fenv.c:1.6	Thu Apr 25 20:48:54 2019
+++ src/tests/lib/libm/t_fenv.c	Fri Feb 23 18:13:54 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: t_fenv.c,v 1.6 2019/04/25 20:48:54 kamil Exp $ */
+/* $NetBSD: t_fenv.c,v 1.6.2.1 2024/02/23 18:13:54 martin Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: t_fenv.c,v 1.6 2019/04/25 20:48:54 kamil Exp $");
+__RCSID("$NetBSD: t_fenv.c,v 1.6.2.1 2024/02/23 18:13:54 martin Exp $");
 
 #include 
 
@@ -185,12 +185,40 @@ ATF_TC_BODY(feenableexcept, tc)
 	ATF_CHECK(fpgetmask() == FP_X_INV);
 }
 
+ATF_TC(fetestexcept_trap);
+ATF_TC_HEAD(fetestexcept_trap, tc)
+{
+	atf_tc_set_md_var(tc, "descr",
+	"Verify fetestexcept doesn't affect the trapped excpetions");
+}
+ATF_TC_BODY(fetestexcept_trap, tc)
+{
+	int except;
+
+	fedisableexcept(FE_ALL_EXCEPT);
+	ATF_CHECK_EQ_MSG((except = fegetexcept()), 0,
+	"fegetexcept()=0x%x", except);
+
+	(void)fetestexcept(FE_ALL_EXCEPT);
+	ATF_CHECK_EQ_MSG((except = fegetexcept()), 0,
+	"fegetexcept()=0x%x", except);
+
+	feenableexcept(FE_ALL_EXCEPT);
+	ATF_CHECK_EQ_MSG((except = fegetexcept()), FE_ALL_EXCEPT,
+	"fegetexcept()=0x%x FE_ALL_EXCEPT=0x%x", except, FE_ALL_EXCEPT);
+
+	(void)fetestexcept(FE_ALL_EXCEPT);
+	ATF_CHECK_EQ_MSG((except = fegetexcept()), FE_ALL_EXCEPT,
+	"fegetexcept()=0x%x FE_ALL_EXCEPT=0x%x", except, FE_ALL_EXCEPT);
+}
+
 ATF_TP_ADD_TCS(tp)
 {
 	ATF_TP_ADD_TC(tp, fegetround);
 	ATF_TP_ADD_TC(tp, fesetround);
 	ATF_TP_ADD_TC(tp, fegetexcept);
 	ATF_TP_ADD_TC(tp, feenableexcept);
+	ATF_TP_ADD_TC(tp, fetestexcept_trap);
 
 	return atf_no_error();
 }



CVS commit: [netbsd-9] src

2024-02-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 23 18:13:54 UTC 2024

Modified Files:
src/lib/libm/arch/x86_64 [netbsd-9]: fenv.c
src/tests/lib/libm [netbsd-9]: t_fenv.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1801):

tests/lib/libm/t_fenv.c: revision 1.14
tests/lib/libm/t_fenv.c: revision 1.15
lib/libm/arch/x86_64/fenv.c: revision 1.11

fenv(3): Add test for PR port-amd64/57949.

fenv(3): Fix fetestexcept to avoid side effects on trap state.

PR port-amd64/57949


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.7.14.1 src/lib/libm/arch/x86_64/fenv.c
cvs rdiff -u -r1.6 -r1.6.2.1 src/tests/lib/libm/t_fenv.c

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



CVS commit: [netbsd-10] src

2024-02-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 23 18:09:23 UTC 2024

Modified Files:
src/lib/libm/arch/x86_64 [netbsd-10]: fenv.c
src/tests/lib/libm [netbsd-10]: t_fenv.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #603):

tests/lib/libm/t_fenv.c: revision 1.14
tests/lib/libm/t_fenv.c: revision 1.15
lib/libm/arch/x86_64/fenv.c: revision 1.11

fenv(3): Add test for PR port-amd64/57949.

fenv(3): Fix fetestexcept to avoid side effects on trap state.

PR port-amd64/57949


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.10.2.1 src/lib/libm/arch/x86_64/fenv.c
cvs rdiff -u -r1.6 -r1.6.10.1 src/tests/lib/libm/t_fenv.c

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

Modified files:

Index: src/lib/libm/arch/x86_64/fenv.c
diff -u src/lib/libm/arch/x86_64/fenv.c:1.10 src/lib/libm/arch/x86_64/fenv.c:1.10.2.1
--- src/lib/libm/arch/x86_64/fenv.c:1.10	Fri Sep  3 21:54:59 2021
+++ src/lib/libm/arch/x86_64/fenv.c	Fri Feb 23 18:09:23 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: fenv.c,v 1.10 2021/09/03 21:54:59 andvar Exp $ */
+/* $NetBSD: fenv.c,v 1.10.2.1 2024/02/23 18:09:23 martin Exp $ */
 
 /*-
  * Copyright (c) 2004-2005 David Schultz 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: fenv.c,v 1.10 2021/09/03 21:54:59 andvar Exp $");
+__RCSID("$NetBSD: fenv.c,v 1.10.2.1 2024/02/23 18:09:23 martin Exp $");
 
 #include "namespace.h"
 
@@ -259,7 +259,6 @@ fesetexceptflag(const fexcept_t *flagp, 
 int
 fetestexcept(int excepts)
 {
-	fenv_t fenv;
 	uint32_t mxcsr;
 	uint16_t status;
 	int ex;
@@ -268,17 +267,10 @@ fetestexcept(int excepts)
 
 	ex = excepts & FE_ALL_EXCEPT;
 
-	/* Store the current x87 floating-point environment */
-	memset(&fenv, 0, sizeof(fenv));
-
-	__fnstenv(&fenv);
 	__fnstsw(&status);
-
-	/* Store the MXCSR register state */
-	__stmxcsr(&fenv.mxcsr);
 	__stmxcsr(&mxcsr);
 
-	return ((fenv.x87.status | fenv.mxcsr) & ex);
+	return ((status | mxcsr) & ex);
 }
 
 /*

Index: src/tests/lib/libm/t_fenv.c
diff -u src/tests/lib/libm/t_fenv.c:1.6 src/tests/lib/libm/t_fenv.c:1.6.10.1
--- src/tests/lib/libm/t_fenv.c:1.6	Thu Apr 25 20:48:54 2019
+++ src/tests/lib/libm/t_fenv.c	Fri Feb 23 18:09:23 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: t_fenv.c,v 1.6 2019/04/25 20:48:54 kamil Exp $ */
+/* $NetBSD: t_fenv.c,v 1.6.10.1 2024/02/23 18:09:23 martin Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: t_fenv.c,v 1.6 2019/04/25 20:48:54 kamil Exp $");
+__RCSID("$NetBSD: t_fenv.c,v 1.6.10.1 2024/02/23 18:09:23 martin Exp $");
 
 #include 
 
@@ -185,12 +185,40 @@ ATF_TC_BODY(feenableexcept, tc)
 	ATF_CHECK(fpgetmask() == FP_X_INV);
 }
 
+ATF_TC(fetestexcept_trap);
+ATF_TC_HEAD(fetestexcept_trap, tc)
+{
+	atf_tc_set_md_var(tc, "descr",
+	"Verify fetestexcept doesn't affect the trapped excpetions");
+}
+ATF_TC_BODY(fetestexcept_trap, tc)
+{
+	int except;
+
+	fedisableexcept(FE_ALL_EXCEPT);
+	ATF_CHECK_EQ_MSG((except = fegetexcept()), 0,
+	"fegetexcept()=0x%x", except);
+
+	(void)fetestexcept(FE_ALL_EXCEPT);
+	ATF_CHECK_EQ_MSG((except = fegetexcept()), 0,
+	"fegetexcept()=0x%x", except);
+
+	feenableexcept(FE_ALL_EXCEPT);
+	ATF_CHECK_EQ_MSG((except = fegetexcept()), FE_ALL_EXCEPT,
+	"fegetexcept()=0x%x FE_ALL_EXCEPT=0x%x", except, FE_ALL_EXCEPT);
+
+	(void)fetestexcept(FE_ALL_EXCEPT);
+	ATF_CHECK_EQ_MSG((except = fegetexcept()), FE_ALL_EXCEPT,
+	"fegetexcept()=0x%x FE_ALL_EXCEPT=0x%x", except, FE_ALL_EXCEPT);
+}
+
 ATF_TP_ADD_TCS(tp)
 {
 	ATF_TP_ADD_TC(tp, fegetround);
 	ATF_TP_ADD_TC(tp, fesetround);
 	ATF_TP_ADD_TC(tp, fegetexcept);
 	ATF_TP_ADD_TC(tp, feenableexcept);
+	ATF_TP_ADD_TC(tp, fetestexcept_trap);
 
 	return atf_no_error();
 }



CVS commit: [netbsd-10] src

2024-02-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 23 18:09:23 UTC 2024

Modified Files:
src/lib/libm/arch/x86_64 [netbsd-10]: fenv.c
src/tests/lib/libm [netbsd-10]: t_fenv.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #603):

tests/lib/libm/t_fenv.c: revision 1.14
tests/lib/libm/t_fenv.c: revision 1.15
lib/libm/arch/x86_64/fenv.c: revision 1.11

fenv(3): Add test for PR port-amd64/57949.

fenv(3): Fix fetestexcept to avoid side effects on trap state.

PR port-amd64/57949


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.10.2.1 src/lib/libm/arch/x86_64/fenv.c
cvs rdiff -u -r1.6 -r1.6.10.1 src/tests/lib/libm/t_fenv.c

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



CVS commit: [netbsd-10] src/distrib/amd64/ramdisks

2024-02-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 23 18:07:24 UTC 2024

Modified Files:
src/distrib/amd64/ramdisks [netbsd-10]: Makefile

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #602):

distrib/amd64/ramdisks/Makefile: revision 1.5

ramdisk-zfsroot: Enable build by default on amd64.
XXX Should maybe copy this to other ports like evbarm64 too.

PR port-amd64/57948


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.20.1 src/distrib/amd64/ramdisks/Makefile

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

Modified files:

Index: src/distrib/amd64/ramdisks/Makefile
diff -u src/distrib/amd64/ramdisks/Makefile:1.4 src/distrib/amd64/ramdisks/Makefile:1.4.20.1
--- src/distrib/amd64/ramdisks/Makefile:1.4	Sun May 21 15:28:37 2017
+++ src/distrib/amd64/ramdisks/Makefile	Fri Feb 23 18:07:24 2024
@@ -1,8 +1,9 @@
-#	$NetBSD: Makefile,v 1.4 2017/05/21 15:28:37 riastradh Exp $
+#	$NetBSD: Makefile,v 1.4.20.1 2024/02/23 18:07:24 martin Exp $
 
 SUBDIR=
 SUBDIR+=	ramdisk
 SUBDIR+=	ramdisk-cgdroot
+SUBDIR+=	ramdisk-zfsroot
 
 TARGETS+=	release
 



CVS commit: [netbsd-10] src/distrib/amd64/ramdisks

2024-02-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 23 18:07:24 UTC 2024

Modified Files:
src/distrib/amd64/ramdisks [netbsd-10]: Makefile

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #602):

distrib/amd64/ramdisks/Makefile: revision 1.5

ramdisk-zfsroot: Enable build by default on amd64.
XXX Should maybe copy this to other ports like evbarm64 too.

PR port-amd64/57948


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.20.1 src/distrib/amd64/ramdisks/Makefile

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



CVS commit: src/lib/libm/src

2024-02-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb 23 13:42:01 UTC 2024

Modified Files:
src/lib/libm/src: s_tanl.c

Log Message:
fix the 32 bit tanl symbol.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libm/src/s_tanl.c

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

Modified files:

Index: src/lib/libm/src/s_tanl.c
diff -u src/lib/libm/src/s_tanl.c:1.1 src/lib/libm/src/s_tanl.c:1.2
--- src/lib/libm/src/s_tanl.c:1.1	Sun Jan 21 13:53:19 2024
+++ src/lib/libm/src/s_tanl.c	Fri Feb 23 08:42:01 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: s_tanl.c,v 1.1 2024/01/21 18:53:19 christos Exp $	*/
+/*	$NetBSD: s_tanl.c,v 1.2 2024/02/23 13:42:01 christos Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause
@@ -29,7 +29,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: s_tanl.c,v 1.1 2024/01/21 18:53:19 christos Exp $");
+__RCSID("$NetBSD: s_tanl.c,v 1.2 2024/02/23 13:42:01 christos Exp $");
 
 /*
  * Limited testing on pseudorandom numbers drawn within [0:4e8] shows
@@ -45,12 +45,12 @@ __RCSID("$NetBSD: s_tanl.c,v 1.1 2024/01
 #include "math.h"
 #include "math_private.h"
 
-#ifdef __HAVE_LONG_DOUBLE
-
 #ifdef __weak_alias
 __weak_alias(tanl, _tanl)
 #endif
 
+#ifdef __HAVE_LONG_DOUBLE
+
 #if LDBL_MANT_DIG == 64
 #include "../ld80/e_rem_pio2l.h"
 #include "../ld80/k_tanl.c"
@@ -109,8 +109,10 @@ tanl(long double x)
 
 #else
 
-#ifdef __weak_alias
-__weak_alias(tanl, tan)
-#endif
+long double
+tanl(long double x)
+{
+	return tan(x);
+}
 
 #endif



CVS commit: src/lib/libm/src

2024-02-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb 23 13:42:01 UTC 2024

Modified Files:
src/lib/libm/src: s_tanl.c

Log Message:
fix the 32 bit tanl symbol.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libm/src/s_tanl.c

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



CVS commit: src/common/lib/libc/gmon

2024-02-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb 23 13:32:28 UTC 2024

Modified Files:
src/common/lib/libc/gmon: mcount.c

Log Message:
fix static unused issue until lint understands attributes better.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/common/lib/libc/gmon/mcount.c

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

Modified files:

Index: src/common/lib/libc/gmon/mcount.c
diff -u src/common/lib/libc/gmon/mcount.c:1.17 src/common/lib/libc/gmon/mcount.c:1.18
--- src/common/lib/libc/gmon/mcount.c:1.17	Mon Aug 30 08:52:32 2021
+++ src/common/lib/libc/gmon/mcount.c	Fri Feb 23 08:32:28 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: mcount.c,v 1.17 2021/08/30 12:52:32 christos Exp $	*/
+/*	$NetBSD: mcount.c,v 1.18 2024/02/23 13:32:28 christos Exp $	*/
 
 /*
  * Copyright (c) 2003, 2004 Wasabi Systems, Inc.
@@ -76,7 +76,7 @@
 #if 0
 static char sccsid[] = "@(#)mcount.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: mcount.c,v 1.17 2021/08/30 12:52:32 christos Exp $");
+__RCSID("$NetBSD: mcount.c,v 1.18 2024/02/23 13:32:28 christos Exp $");
 #endif
 #endif
 
@@ -127,6 +127,7 @@ _MCOUNT_DECL(u_long, u_long)
  * perform this optimization.
  */
 /* _mcount; may be static, inline, etc */
+/*LINTED unused*/
 _MCOUNT_DECL(u_long frompc, u_long selfpc)
 {
 	u_short *frompcindex;



CVS commit: src/common/lib/libc/gmon

2024-02-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb 23 13:32:28 UTC 2024

Modified Files:
src/common/lib/libc/gmon: mcount.c

Log Message:
fix static unused issue until lint understands attributes better.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/common/lib/libc/gmon/mcount.c

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