CVS commit: src/sys/dev/pci

2024-05-21 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Tue May 21 22:47:11 UTC 2024

Modified Files:
src/sys/dev/pci: eapreg.h

Log Message:
eap(4): re-organize mixer controls to put classes first

some software (understandably) doesn't like it if you declare a
mixer node's child before the parent, notably ossxmix in pkgsrc


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/pci/eapreg.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/eapreg.h
diff -u src/sys/dev/pci/eapreg.h:1.13 src/sys/dev/pci/eapreg.h:1.14
--- src/sys/dev/pci/eapreg.h:1.13	Mon Apr 28 20:23:54 2008
+++ src/sys/dev/pci/eapreg.h	Tue May 21 22:47:11 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: eapreg.h,v 1.13 2008/04/28 20:23:54 martin Exp $	*/
+/*	$NetBSD: eapreg.h,v 1.14 2024/05/21 22:47:11 nia Exp $	*/
 
 /*
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -292,20 +292,20 @@
 #define VOL_0DB 200
 
 /* Futzable parms */
-#define EAP_MASTER_VOL		0
-#define EAP_VOICE_VOL		1
-#define EAP_FM_VOL		2
-#define EAP_VIDEO_VOL		2	/* ES1371 */
-#define EAP_CD_VOL		3
-#define EAP_LINE_VOL		4
-#define EAP_AUX_VOL		5
-#define EAP_MIC_VOL		6
-#define	EAP_RECORD_SOURCE	7
-#define EAP_INPUT_SOURCE	8
-#define	EAP_MIC_PREAMP		9
-#define EAP_OUTPUT_CLASS	10
-#define EAP_RECORD_CLASS	11
-#define EAP_INPUT_CLASS		12
+#define EAP_OUTPUT_CLASS	0
+#define EAP_RECORD_CLASS	1
+#define EAP_INPUT_CLASS		2
+#define EAP_MASTER_VOL		3
+#define EAP_VOICE_VOL		4
+#define EAP_FM_VOL		5
+#define EAP_VIDEO_VOL		5	/* ES1371 */
+#define EAP_CD_VOL		6
+#define EAP_LINE_VOL		7
+#define EAP_AUX_VOL		8
+#define EAP_MIC_VOL		9
+#define	EAP_RECORD_SOURCE	10
+#define EAP_INPUT_SOURCE	11
+#define	EAP_MIC_PREAMP		12
 
 #define MIDI_BUSY_WAIT		100
 #define MIDI_BUSY_DELAY		100	/* Delay when UART is busy */



CVS commit: src/sys/dev/pci

2024-05-21 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Tue May 21 22:47:11 UTC 2024

Modified Files:
src/sys/dev/pci: eapreg.h

Log Message:
eap(4): re-organize mixer controls to put classes first

some software (understandably) doesn't like it if you declare a
mixer node's child before the parent, notably ossxmix in pkgsrc


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/pci/eapreg.h

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-05-17 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Fri May 17 12:20:02 UTC 2024

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

Log Message:
eap(4): Restore the full set of supported hardware encodings from netbsd-7

Tested in QEMU.


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.103 src/sys/dev/pci/eap.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/eap.c
diff -u src/sys/dev/pci/eap.c:1.102 src/sys/dev/pci/eap.c:1.103
--- src/sys/dev/pci/eap.c:1.102	Thu Jul 25 15:06:07 2019
+++ src/sys/dev/pci/eap.c	Fri May 17 12:20:02 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: eap.c,v 1.102 2019/07/25 15:06:07 msaitoh Exp $	*/
+/*	$NetBSD: eap.c,v 1.103 2024/05/17 12:20:02 nia Exp $	*/
 /*  $OpenBSD: eap.c,v 1.6 1999/10/05 19:24:42 csapuntz Exp $ */
 
 /*
@@ -56,7 +56,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: eap.c,v 1.102 2019/07/25 15:06:07 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: eap.c,v 1.103 2024/05/17 12:20:02 nia Exp $");
 
 #include "midi.h"
 #include "joy_eap.h"
@@ -218,9 +218,39 @@ static const struct audio_format eap_for
 		.precision	= 16,
 		.channels	= 2,
 		.channel_mask	= AUFMT_STEREO,
-		.frequency_type	= 2,
+		.frequency_type	= 0,
 		.frequency	= { 4000, 48000 },
 	},
+	{
+		.mode		= AUMODE_PLAY | AUMODE_RECORD,
+		.encoding	= AUDIO_ENCODING_SLINEAR_LE,
+		.validbits	= 16,
+		.precision	= 16,
+		.channels	= 1,
+		.channel_mask	= AUFMT_MONAURAL,
+		.frequency_type	= 0,
+		.frequency	= { 4000, 48000 },
+	},
+	{
+		.mode		= AUMODE_PLAY | AUMODE_RECORD,
+		.encoding	= AUDIO_ENCODING_ULINEAR_LE,
+		.validbits	= 8,
+		.precision	= 8,
+		.channels	= 2,
+		.channel_mask	= AUFMT_STEREO,
+		.frequency_type	= 0,
+		.frequency	= { 4000, 48000 },
+	},
+	{
+		.mode		= AUMODE_PLAY | AUMODE_RECORD,
+		.encoding	= AUDIO_ENCODING_ULINEAR_LE,
+		.validbits	= 8,
+		.precision	= 8,
+		.channels	= 1,
+		.channel_mask	= AUFMT_MONAURAL,
+		.frequency_type	= 0,
+		.frequency	= { 4000, 48000 },
+	}
 };
 #define EAP_NFORMATS	__arraycount(eap_formats)
 



CVS commit: src/sys/dev/pci

2024-05-17 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Fri May 17 12:20:02 UTC 2024

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

Log Message:
eap(4): Restore the full set of supported hardware encodings from netbsd-7

Tested in QEMU.


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.103 src/sys/dev/pci/eap.c

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



CVS commit: src/sys/dev/pci/ixgbe

2024-05-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon May 13 03:15:33 UTC 2024

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

Log Message:
Modify comment. The number of queues is not limited to 8.

The number of queue is calculated from both the number of CPUs and
the number of MSI-X vectors.


To generate a diff of this commit:
cvs rdiff -u -r1.349 -r1.350 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.349 src/sys/dev/pci/ixgbe/ixgbe.c:1.350
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.349	Wed Jan 24 05:18:59 2024
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Mon May 13 03:15:33 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.349 2024/01/24 05:18:59 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.350 2024/05/13 03:15:33 msaitoh Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.349 2024/01/24 05:18:59 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.350 2024/05/13 03:15:33 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -358,8 +358,8 @@ SYSCTL_INT(_hw_ix, OID_AUTO, enable_msix
 /*
  * Number of Queues, can be set to 0,
  * it then autoconfigures based on the
- * number of cpus with a max of 8. This
- * can be overridden manually here.
+ * number of cpus and number of MSI-X vectors.
+ * This can be overridden manually here.
  */
 static int ixgbe_num_queues = 0;
 SYSCTL_INT(_hw_ix, OID_AUTO, num_queues, CTLFLAG_RDTUN, _num_queues, 0,



CVS commit: src/sys/dev/pci/ixgbe

2024-05-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon May 13 03:15:33 UTC 2024

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

Log Message:
Modify comment. The number of queues is not limited to 8.

The number of queue is calculated from both the number of CPUs and
the number of MSI-X vectors.


To generate a diff of this commit:
cvs rdiff -u -r1.349 -r1.350 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: src/sys/dev/pci

2024-05-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun May 12 23:30:37 UTC 2024

Modified Files:
src/sys/dev/pci: pcidevs.h pcidevs_data.h

Log Message:
Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.1484 -r1.1485 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1483 -r1.1484 src/sys/dev/pci/pcidevs_data.h

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-05-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun May 12 23:30:07 UTC 2024

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
Add some Intel Rapotr Lake graphics.


To generate a diff of this commit:
cvs rdiff -u -r1.1505 -r1.1506 src/sys/dev/pci/pcidevs

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/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1505 src/sys/dev/pci/pcidevs:1.1506
--- src/sys/dev/pci/pcidevs:1.1505	Sun May 12 23:29:14 2024
+++ src/sys/dev/pci/pcidevs	Sun May 12 23:30:07 2024
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1505 2024/05/12 23:29:14 msaitoh Exp $
+$NetBSD: pcidevs,v 1.1506 2024/05/12 23:30:07 msaitoh Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -7476,6 +7476,9 @@ product INTEL RPL_IGD_6		0xa7a0	Raptor L
 product INTEL RPL_IGD_7		0xa7a1	Raptor Lake Graphics (96 or 80EU)
 product INTEL RPL_IGD_8		0xa7a8	Raptor Lake Graphics (64 or 48EU)
 product INTEL RPL_IGD_9		0xa7a9	Raptor Lake Graphics (64 or 48EU)
+product INTEL RPL_IGD_10	0xa7aa	Raptor Lake Graphics (96 or 80EU)
+product INTEL RPL_IGD_11	0xa7ac	Raptor Lake Graphics (96 or 80EU)
+product INTEL RPL_IGD_12	0xa7ad	Raptor Lake Graphics (64EU)
 product INTEL 21152		0xb152	S21152BB PCI-PCI Bridge
 product INTEL 21154		0xb154	S21152BA,S21154AE/BE PCI-PCI Bridge
 product INTEL 21555		0xb555	21555 Non-Transparent PCI-PCI Bridge



CVS commit: src/sys/dev/pci

2024-05-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun May 12 23:30:07 UTC 2024

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
Add some Intel Rapotr Lake graphics.


To generate a diff of this commit:
cvs rdiff -u -r1.1505 -r1.1506 src/sys/dev/pci/pcidevs

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-05-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun May 12 23:29:14 UTC 2024

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
Add Phison PS5021 and PS5026.


To generate a diff of this commit:
cvs rdiff -u -r1.1504 -r1.1505 src/sys/dev/pci/pcidevs

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/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1504 src/sys/dev/pci/pcidevs:1.1505
--- src/sys/dev/pci/pcidevs:1.1504	Sat Apr  6 09:10:11 2024
+++ src/sys/dev/pci/pcidevs	Sun May 12 23:29:14 2024
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1504 2024/04/06 09:10:11 andvar Exp $
+$NetBSD: pcidevs,v 1.1505 2024/05/12 23:29:14 msaitoh Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -7856,8 +7856,10 @@ product PHILIPS SAA7135HL	0x7135	SAA7135
 product PHILIPS SAA7146AH	0x7146	SAA7146AH PCI Multimedia Bridge
 
 /* Phison products */
-product PHISON PS5000		0x5000 PS5000
-product PHISON PS5016		0x5016 PS5016
+product PHISON PS5000		0x5000	PS5000
+product PHISON PS5016		0x5016	PS5016
+product PHISON PS5021		0x5021	PS5021
+product PHISON PS5026		0x5026	PS5026
 
 /* NCR/Symbios Logic products */
 product SYMBIOS 810			0x0001	53c810



CVS commit: src/sys/dev/pci

2024-05-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun May 12 23:29:14 UTC 2024

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
Add Phison PS5021 and PS5026.


To generate a diff of this commit:
cvs rdiff -u -r1.1504 -r1.1505 src/sys/dev/pci/pcidevs

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-04-23 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Apr 24 02:31:26 UTC 2024

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

Log Message:
b3_2706_map_vme(): Use VM_BESTFIT.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/pci/btvmeii.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/btvmeii.c
diff -u src/sys/dev/pci/btvmeii.c:1.27 src/sys/dev/pci/btvmeii.c:1.28
--- src/sys/dev/pci/btvmeii.c:1.27	Tue Dec  5 15:58:32 2023
+++ src/sys/dev/pci/btvmeii.c	Wed Apr 24 02:31:26 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: btvmeii.c,v 1.27 2023/12/05 15:58:32 thorpej Exp $ */
+/* $NetBSD: btvmeii.c,v 1.28 2024/04/24 02:31:26 thorpej Exp $ */
 
 /*
  * Copyright (c) 1999
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: btvmeii.c,v 1.27 2023/12/05 15:58:32 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: btvmeii.c,v 1.28 2024/04/24 02:31:26 thorpej Exp $");
 
 #include 
 #include 
@@ -328,7 +328,7 @@ b3_2706_map_vme(void *vsc, vme_addr_t vm
 			0,			/* boundary */
 			VMEM_ADDR_MIN,		/* minaddr */
 			VMEM_ADDR_MAX,		/* maxaddr */
-			VM_NOSLEEP,
+			VM_BESTFIT | VM_NOSLEEP,
 			)) {
 		sc->windowused[wnd] = 0;
 		return (ENOMEM);



CVS commit: src/sys/dev/pci

2024-04-23 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Apr 24 02:31:26 UTC 2024

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

Log Message:
b3_2706_map_vme(): Use VM_BESTFIT.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/pci/btvmeii.c

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



CVS commit: src/sys/dev/pci

2024-04-23 Thread Hans Rosenfeld
Module Name:src
Committed By:   hans
Date:   Tue Apr 23 15:34:07 UTC 2024

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

Log Message:
Sync the statistics DMA memory correctly before it is accessed.


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/sys/dev/pci/if_bnx.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_bnx.c
diff -u src/sys/dev/pci/if_bnx.c:1.113 src/sys/dev/pci/if_bnx.c:1.114
--- src/sys/dev/pci/if_bnx.c:1.113	Fri Feb  9 22:08:35 2024
+++ src/sys/dev/pci/if_bnx.c	Tue Apr 23 15:34:07 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bnx.c,v 1.113 2024/02/09 22:08:35 andvar Exp $	*/
+/*	$NetBSD: if_bnx.c,v 1.114 2024/04/23 15:34:07 hans Exp $	*/
 /*	$OpenBSD: if_bnx.c,v 1.101 2013/03/28 17:21:44 brad Exp $	*/
 
 /*-
@@ -35,7 +35,7 @@
 #if 0
 __FBSDID("$FreeBSD: src/sys/dev/bce/if_bce.c,v 1.3 2006/04/13 14:12:26 ru Exp $");
 #endif
-__KERNEL_RCSID(0, "$NetBSD: if_bnx.c,v 1.113 2024/02/09 22:08:35 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bnx.c,v 1.114 2024/04/23 15:34:07 hans Exp $");
 
 /*
  * The following controllers are supported by this driver:
@@ -5667,7 +5667,7 @@ bnx_stats_update(struct bnx_softc *sc)
 	struct statistics_block	*stats;
 
 	DBPRINT(sc, BNX_EXCESSIVE, "Entering %s()\n", __func__);
-	bus_dmamap_sync(sc->bnx_dmatag, sc->status_map, 0, BNX_STATUS_BLK_SZ,
+	bus_dmamap_sync(sc->bnx_dmatag, sc->stats_map, 0, BNX_STATS_BLK_SZ,
 	BUS_DMASYNC_POSTREAD);
 
 	stats = (struct statistics_block *)sc->stats_block;
@@ -6257,7 +6257,7 @@ void
 bnx_dump_stats_block(struct bnx_softc *sc)
 {
 	struct statistics_block	*sblk;
-	bus_dmamap_sync(sc->bnx_dmatag, sc->status_map, 0, BNX_STATUS_BLK_SZ,
+	bus_dmamap_sync(sc->bnx_dmatag, sc->stats_map, 0, BNX_STATS_BLK_SZ,
 	BUS_DMASYNC_POSTREAD);
 
 	sblk = sc->stats_block;



CVS commit: src/sys/dev/pci

2024-04-23 Thread Hans Rosenfeld
Module Name:src
Committed By:   hans
Date:   Tue Apr 23 15:34:07 UTC 2024

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

Log Message:
Sync the statistics DMA memory correctly before it is accessed.


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/sys/dev/pci/if_bnx.c

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



CVS commit: src/sys/dev/pci

2024-04-19 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Fri Apr 19 21:24:00 UTC 2024

Modified Files:
src/sys/dev/pci: pci_subr.c pcireg.h

Log Message:
s/Resorce/Resource/ in comment and log message.


To generate a diff of this commit:
cvs rdiff -u -r1.243 -r1.244 src/sys/dev/pci/pci_subr.c
cvs rdiff -u -r1.169 -r1.170 src/sys/dev/pci/pcireg.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/pci_subr.c
diff -u src/sys/dev/pci/pci_subr.c:1.243 src/sys/dev/pci/pci_subr.c:1.244
--- src/sys/dev/pci/pci_subr.c:1.243	Thu Aug 10 20:02:56 2023
+++ src/sys/dev/pci/pci_subr.c	Fri Apr 19 21:24:00 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_subr.c,v 1.243 2023/08/10 20:02:56 andvar Exp $	*/
+/*	$NetBSD: pci_subr.c,v 1.244 2024/04/19 21:24:00 andvar Exp $	*/
 
 /*
  * Copyright (c) 1997 Zubin D. Dittia.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.243 2023/08/10 20:02:56 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.244 2024/04/19 21:24:00 andvar Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -2559,10 +2559,10 @@ pci_conf_print_ea_cap_prop(unsigned int 
 		printf("I/O Space\n");
 		break;
 	case PCI_EA_PROP_VF_MEM_NONPREF:
-		printf("Resorce for VF use, Memory Space, Non-Prefetchable\n");
+		printf("Resource for VF use, Memory Space, Non-Prefetchable\n");
 		break;
 	case PCI_EA_PROP_VF_MEM_PREF:
-		printf("Resorce for VF use, Memory Space, Prefetch\n");
+		printf("Resource for VF use, Memory Space, Prefetch\n");
 		break;
 	case PCI_EA_PROP_BB_MEM_NONPREF:
 		printf("Behind the Bridge, Memory Space, Non-Pref\n");

Index: src/sys/dev/pci/pcireg.h
diff -u src/sys/dev/pci/pcireg.h:1.169 src/sys/dev/pci/pcireg.h:1.170
--- src/sys/dev/pci/pcireg.h:1.169	Fri Feb  2 22:19:13 2024
+++ src/sys/dev/pci/pcireg.h	Fri Apr 19 21:24:00 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcireg.h,v 1.169 2024/02/02 22:19:13 andvar Exp $	*/
+/*	$NetBSD: pcireg.h,v 1.170 2024/04/19 21:24:00 andvar Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996, 1999, 2000
@@ -1963,8 +1963,8 @@ struct pci_rom {
 #define  PCI_EA_PROP_MEM_NONPREF	0x00	/* Memory Space, Non-Prefetchable */
 #define  PCI_EA_PROP_MEM_PREF		0x01	/* Memory Space, Prefetchable */
 #define  PCI_EA_PROP_IO			0x02	/* I/O Space */
-#define  PCI_EA_PROP_VF_MEM_NONPREF	0x03	/* Resorce for VF use. Mem. Non-Pref */
-#define  PCI_EA_PROP_VF_MEM_PREF	0x04	/* Resorce for VF use. Mem. Prefetch */
+#define  PCI_EA_PROP_VF_MEM_NONPREF	0x03	/* Resource for VF use. Mem. Non-Pref */
+#define  PCI_EA_PROP_VF_MEM_PREF	0x04	/* Resource for VF use. Mem. Prefetch */
 #define  PCI_EA_PROP_BB_MEM_NONPREF	0x05	/* Behind Bridge: MEM. Non-Pref */
 #define  PCI_EA_PROP_BB_MEM_PREF	0x06	/* Behind Bridge: MEM. Prefetch */
 #define  PCI_EA_PROP_BB_IO		0x07	/* Behind Bridge: I/O Space */



CVS commit: src/sys/dev/pci

2024-04-19 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Fri Apr 19 21:24:00 UTC 2024

Modified Files:
src/sys/dev/pci: pci_subr.c pcireg.h

Log Message:
s/Resorce/Resource/ in comment and log message.


To generate a diff of this commit:
cvs rdiff -u -r1.243 -r1.244 src/sys/dev/pci/pci_subr.c
cvs rdiff -u -r1.169 -r1.170 src/sys/dev/pci/pcireg.h

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-04-11 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Thu Apr 11 10:42:42 UTC 2024

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

Log Message:
mcx(4): enforce full-duplex mark in mcx_media_status(), when link is up.

LACP protocol requires full-duplex to be enabled for lagg(4) to work,
however mcx(4) was not setting this capability making it to fail.

Fixes PR kern/58124.  OK'd by msaitoh@


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/pci/if_mcx.c

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



CVS commit: src/sys/dev/pci

2024-04-11 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Thu Apr 11 10:42:42 UTC 2024

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

Log Message:
mcx(4): enforce full-duplex mark in mcx_media_status(), when link is up.

LACP protocol requires full-duplex to be enabled for lagg(4) to work,
however mcx(4) was not setting this capability making it to fail.

Fixes PR kern/58124.  OK'd by msaitoh@


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/pci/if_mcx.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_mcx.c
diff -u src/sys/dev/pci/if_mcx.c:1.26 src/sys/dev/pci/if_mcx.c:1.27
--- src/sys/dev/pci/if_mcx.c:1.26	Thu Oct 26 03:44:12 2023
+++ src/sys/dev/pci/if_mcx.c	Thu Apr 11 10:42:42 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mcx.c,v 1.26 2023/10/26 03:44:12 msaitoh Exp $ */
+/*	$NetBSD: if_mcx.c,v 1.27 2024/04/11 10:42:42 andvar Exp $ */
 /*	$OpenBSD: if_mcx.c,v 1.101 2021/06/02 19:16:11 patrick Exp $ */
 
 /*
@@ -23,7 +23,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mcx.c,v 1.26 2023/10/26 03:44:12 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mcx.c,v 1.27 2024/04/11 10:42:42 andvar Exp $");
 
 #include 
 #include 
@@ -8072,7 +8072,7 @@ mcx_media_status(struct ifnet *ifp, stru
 	ifmr->ifm_status = IFM_AVALID;
 	if (proto_oper != 0) {
 		ifmr->ifm_status |= IFM_ACTIVE;
-		ifmr->ifm_active = IFM_ETHER | IFM_AUTO | media_oper;
+		ifmr->ifm_active = IFM_ETHER | IFM_FDX | IFM_AUTO | media_oper;
 		/* txpause, rxpause, duplex? */
 	}
 }



CVS commit: src/sys/dev/pci

2024-04-06 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Apr  6 09:11:50 UTC 2024

Modified Files:
src/sys/dev/pci: pcidevs.h pcidevs_data.h

Log Message:
regen.


To generate a diff of this commit:
cvs rdiff -u -r1.1483 -r1.1484 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1482 -r1.1483 src/sys/dev/pci/pcidevs_data.h

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

diffs are larger than 1MB and have been omitted


CVS commit: src/sys/dev/pci

2024-04-06 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Apr  6 09:11:50 UTC 2024

Modified Files:
src/sys/dev/pci: pcidevs.h pcidevs_data.h

Log Message:
regen.


To generate a diff of this commit:
cvs rdiff -u -r1.1483 -r1.1484 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1482 -r1.1483 src/sys/dev/pci/pcidevs_data.h

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-04-06 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Apr  6 09:10:11 UTC 2024

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
Add Zhaoxin devices, mainly from my TVS-675 NAS device, and some additional
to fill the gaps from pci-ids database.


To generate a diff of this commit:
cvs rdiff -u -r1.1503 -r1.1504 src/sys/dev/pci/pcidevs

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/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1503 src/sys/dev/pci/pcidevs:1.1504
--- src/sys/dev/pci/pcidevs:1.1503	Wed Feb 28 18:51:34 2024
+++ src/sys/dev/pci/pcidevs	Sat Apr  6 09:10:11 2024
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1503 2024/02/28 18:51:34 jakllsch Exp $
+$NetBSD: pcidevs,v 1.1504 2024/04/06 09:10:11 andvar Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -651,6 +651,7 @@ vendor SYMPHONY2	0x1c1c	Symphony Labs (2
 vendor HGST		0x1c58	HGST, Inc.
 vendor BEIJING_MEMBLAZE	0x1c5f	Beijing Memblaze Technology Co. Ltd.
 vendor AMAZON		0x1d0f	Amazon.com, Inc.
+vendor ZHAOXIN		0x1d17	Zhaoxin
 vendor AQUANTIA		0x1d6a	Aquantia
 vendor ROCKCHIP		0x1d87	Rockchip
 vendor TEKRAM2		0x1de1	Tekram Technology (2nd PCI Vendor ID)
@@ -10173,6 +10174,47 @@ product ZEINET 1221	0x0001	1221
 /* Ziatech products */
 product ZIATECH ZT8905	0x8905 PCI-ST32 Bridge
 
+/* Zhaoxin products */
+product ZHAOXIN ZX100_PCIE		0x0708	ZX-100 PCI Express Root Port
+product ZHAOXIN ZX200_PCIE_0		0x0710	ZX-100/ZX-200 PCI Express Root Port
+product ZHAOXIN ZX200_PCIE_1		0x0711	ZX-100/ZX-200 PCI Express Root Port
+product ZHAOXIN ZX200_PCIE_2		0x0712	ZX-100/ZX-200 PCI Express Root Port
+product ZHAOXIN ZX200_PCIE_3		0x0713	ZX-100/ZX-200 PCI Express Root Port
+product ZHAOXIN ZX200_PCIE_4		0x0714	ZX-100/ZX-200 PCI Express Root Port
+product ZHAOXIN ZX200_PCIE_5		0x0715	ZX-100/ZX-200 PCI Express Root Port
+product ZHAOXIN ZXD_PCIE		0x0716	ZX-D PCI Express Root Port
+product ZHAOXIN KX_PCIE_0		0x0717	KX-5000|6000(G)|7000 / KH-4 PCI Express Root Port
+product ZHAOXIN KX_PCIE_1		0x0718	KX-5000|6000(G)|7000 / KH-4 PCI Express Root Port
+product ZHAOXIN KX_PCIE_2		0x0719	KX-5000|6000(G)|7000 / KH-4 PCI Express Root Port
+product ZHAOXIN KX_PCIE_3		0x071a	KX-5000|6000(G) / KH-4 PCI Express Root Port
+product ZHAOXIN KX_PCIE_4		0x071b	KX-5000|6000(G)|7000 / KH-4 PCI Express Root Port
+product ZHAOXIN KX_PCIE_5		0x071c	KX-5000|6000(G)|7000 / KH-4 PCI Express Root Port
+product ZHAOXIN KX_PCIE_6		0x071d	KX-5000|6000(G) / KH-4 PCI Express Root Port
+product ZHAOXIN KX_PCIE_7		0x071e	KX-5000|6000(G)|7000 / KH-4 PCI Express Root Port
+product ZHAOXIN ZX200_UP_PCIE_SWITCH	0x071f	ZX-200 Upstream Port of PCI Express Switch
+product ZHAOXIN ZX200_DP_PCIE_SWITCH	0x0721	ZX-200 Downstream Port of PCI Express Switch
+product ZHAOXIN ZX200_PCIE_PC2_BRIDGE	0x0722	ZX-200 PCIE P2C bridge
+product ZHAOXIN ZX_MISC_BUS		0x1001	ZX-D/ZX-E/KH-4/KX-7000 Miscellaneous Bus
+product ZHAOXIN ZX_PCHB_0		0x1003	ZX-E Standard Host Bridge
+product ZHAOXIN ZX_UHCI			0x3038	USB UHCI Controller
+product ZHAOXIN ZX_EHCI			0x3104	USB EHCI Controller
+product ZHAOXIN ZX_PCHB_1		0x31b0	ZX-100 / KX-5000|6000(G)|7000 / KH-4 Standard Host Bridge
+product ZHAOXIN ZX_PCHB_2		0x31b1	ZX-100 / KX-5000|6000(G)|7000 / KH-4 Standard Host Bridge
+product ZHAOXIN ZX_DRAM			0x31b2	ZX-100 / KX-5000|6000(G)|7000 / KH-4 DRAM Controller
+product ZHAOXIN ZX_PMC			0x31b3	ZX-100 / KX-5000|6000(G)|7000 / KH-4 Power Management Controller
+product ZHAOXIN ZX_IOAPIC		0x31b4	ZX-100 / KX-5000|6000(G)|7000 / KH-4 I/O APIC
+product ZHAOXIN ZX_SCRATCH		0x31b5	ZX-100 / KX-5000|6000(G)|7000 / KH-4 Scratch Device
+product ZHAOXIN ZX_PCHB_3		0x31b7	ZX-100 / KX-5000|6000(G)|7000 / KH-4 Standard Host Bridge
+product ZHAOXIN C320_GPU		0x3a02	ZX-100 C-320 GPU
+product ZHAOXIN C860_GPU		0x3a03	ZX-D C-860 Integrated Graphics
+product ZHAOXIN C960_GPU		0x3a04	KX-6000 C-960 Integrated Graphics
+product ZHAOXIN C1190_GPU		0x3a05	KX-7000 C-1190 Integrated Graphics
+product ZHAOXIN ZX200_AHCI		0x9083	StorX AHCI Controller
+product ZHAOXIN ZXE_HDAUDIO 		0x9144	ZX-E High Definition Audio Controller
+product ZHAOXIN ZX100_XHCI		0x9202	ZX-100 USB xHCI Controller
+product ZHAOXIN ZX200_XHCI		0x9203	ZX-200 USB xHCI Controller
+product ZHAOXIN KX_XHCI			0x9204	KX-6000(G)|7000 USB xHCI Controller
+
 /* Zoran products */
 product ZORAN ZR36057	0x6057 ZR36057 Multimedia Controller
 product ZORAN ZR36120	0x6120 ZR36120 Video Controller



CVS commit: src/sys/dev/pci

2024-04-06 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Apr  6 09:10:11 UTC 2024

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
Add Zhaoxin devices, mainly from my TVS-675 NAS device, and some additional
to fill the gaps from pci-ids database.


To generate a diff of this commit:
cvs rdiff -u -r1.1503 -r1.1504 src/sys/dev/pci/pcidevs

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-04-02 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Wed Apr  3 01:13:41 UTC 2024

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

Log Message:
if_iwn.c: pick up proper firmware for Centrino Wireless-N 130

Both variants should use iwlwifi-6000g2b-6 not iwlwifi-6000g2a-6. (It
seems only two specific product variants use iwlwifi-6000g2a-6. We
could simplify by reversing the sense of the test, as OpenBSD does, but
it doesn't seem to matter much, as what we now match seems to be the
full gamut possible, so the simpler diff was chosen here.)

Addresses PR kern/58105 from wandrien@gmail.com, with the
PCI_PRODUCT_INTEL_WIFI_LINK_130_1 match tested by the reporter. Code
inspection of the FreeBSD driver indicates we should safely be able to
match PCI_PRODUCT_INTEL_WIFI_LINK_130_2 also.


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 src/sys/dev/pci/if_iwn.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_iwn.c
diff -u src/sys/dev/pci/if_iwn.c:1.99 src/sys/dev/pci/if_iwn.c:1.100
--- src/sys/dev/pci/if_iwn.c:1.99	Mon Apr 25 02:29:14 2022
+++ src/sys/dev/pci/if_iwn.c	Wed Apr  3 01:13:41 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_iwn.c,v 1.99 2022/04/25 02:29:14 gutteridge Exp $	*/
+/*	$NetBSD: if_iwn.c,v 1.100 2024/04/03 01:13:41 gutteridge Exp $	*/
 /*	$OpenBSD: if_iwn.c,v 1.135 2014/09/10 07:22:09 dcoppa Exp $	*/
 
 /*-
@@ -22,7 +22,7 @@
  * adapters.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_iwn.c,v 1.99 2022/04/25 02:29:14 gutteridge Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iwn.c,v 1.100 2024/04/03 01:13:41 gutteridge Exp $");
 
 #define IWN_USE_RBUF	/* Use local storage for RX */
 #undef IWN_HWCRYPTO	/* XXX does not even compile yet */
@@ -846,6 +846,8 @@ iwn5000_attach(struct iwn_softc *sc, pci
 		/* Type 6030 cards return IWN_HW_REV_TYPE_6005 */
 		if (pid == PCI_PRODUCT_INTEL_WIFI_LINK_1030_1 ||
 		pid == PCI_PRODUCT_INTEL_WIFI_LINK_1030_2 ||
+		pid == PCI_PRODUCT_INTEL_WIFI_LINK_130_1  ||
+		pid == PCI_PRODUCT_INTEL_WIFI_LINK_130_2  ||
 		pid == PCI_PRODUCT_INTEL_WIFI_LINK_6230_1 ||
 		pid == PCI_PRODUCT_INTEL_WIFI_LINK_6230_2 ||
 		pid == PCI_PRODUCT_INTEL_WIFI_LINK_6235   ||



CVS commit: src/sys/dev/pci

2024-04-02 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Wed Apr  3 01:13:41 UTC 2024

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

Log Message:
if_iwn.c: pick up proper firmware for Centrino Wireless-N 130

Both variants should use iwlwifi-6000g2b-6 not iwlwifi-6000g2a-6. (It
seems only two specific product variants use iwlwifi-6000g2a-6. We
could simplify by reversing the sense of the test, as OpenBSD does, but
it doesn't seem to matter much, as what we now match seems to be the
full gamut possible, so the simpler diff was chosen here.)

Addresses PR kern/58105 from wandrien@gmail.com, with the
PCI_PRODUCT_INTEL_WIFI_LINK_130_1 match tested by the reporter. Code
inspection of the FreeBSD driver indicates we should safely be able to
match PCI_PRODUCT_INTEL_WIFI_LINK_130_2 also.


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 src/sys/dev/pci/if_iwn.c

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



CVS commit: src/sys/dev/pci

2024-04-01 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Mon Apr  1 22:56:56 UTC 2024

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

Log Message:
s/Doucments/Documents/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.390 -r1.391 src/sys/dev/pci/if_bge.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_bge.c
diff -u src/sys/dev/pci/if_bge.c:1.390 src/sys/dev/pci/if_bge.c:1.391
--- src/sys/dev/pci/if_bge.c:1.390	Fri Feb  9 22:08:35 2024
+++ src/sys/dev/pci/if_bge.c	Mon Apr  1 22:56:55 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bge.c,v 1.390 2024/02/09 22:08:35 andvar Exp $	*/
+/*	$NetBSD: if_bge.c,v 1.391 2024/04/01 22:56:55 andvar Exp $	*/
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.390 2024/02/09 22:08:35 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.391 2024/04/01 22:56:55 andvar Exp $");
 
 #include 
 #include 
@@ -5746,7 +5746,7 @@ bge_init_locked(struct ifnet *ifp)
 
 	/* 5718 step 12, 57XX step 37 */
 	/*
-	 * XXX Doucments of 5718 series and 577xx say the recommended value
+	 * XXX Documents of 5718 series and 577xx say the recommended value
 	 * is 1, but tg3 set 1 only on 57765 series.
 	 */
 	if (BGE_IS_57765_PLUS(sc))



CVS commit: src/sys/dev/pci

2024-04-01 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Mon Apr  1 22:56:56 UTC 2024

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

Log Message:
s/Doucments/Documents/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.390 -r1.391 src/sys/dev/pci/if_bge.c

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



CVS commit: src/sys/dev/pci

2024-03-31 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 31 18:59:52 UTC 2024

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

Log Message:
As the final step in configuraing bus-master DMA, consult the boolean device
property "pciide-disable-dma" and disable bus-master DMA if that property is
present and true.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/dev/pci/pciide_common.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/pciide_common.c
diff -u src/sys/dev/pci/pciide_common.c:1.70 src/sys/dev/pci/pciide_common.c:1.71
--- src/sys/dev/pci/pciide_common.c:1.70	Mon Nov 20 21:59:38 2023
+++ src/sys/dev/pci/pciide_common.c	Sun Mar 31 18:59:52 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: pciide_common.c,v 1.70 2023/11/20 21:59:38 thorpej Exp $	*/
+/*	$NetBSD: pciide_common.c,v 1.71 2024/03/31 18:59:52 thorpej Exp $	*/
 
 
 /*
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pciide_common.c,v 1.70 2023/11/20 21:59:38 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pciide_common.c,v 1.71 2024/03/31 18:59:52 thorpej Exp $");
 
 #include 
 
@@ -484,6 +484,16 @@ pciide_mapreg_dma(struct pciide_softc *s
 			aprint_verbose(
 			", but unused (forced off by config file)");
 			sc->sc_dma_ok = 0;
+		} else {
+			bool disable;
+
+			if (prop_dictionary_get_bool(
+			device_properties(sc->sc_wdcdev.sc_atac.atac_dev),
+			"pciide-disable-dma", ) && disable) {
+aprint_verbose(
+", but unused (disabled by platform)");
+sc->sc_dma_ok = 0;
+			}
 		}
 		break;
 



CVS commit: src/sys/dev/pci

2024-03-31 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Mar 31 18:59:52 UTC 2024

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

Log Message:
As the final step in configuraing bus-master DMA, consult the boolean device
property "pciide-disable-dma" and disable bus-master DMA if that property is
present and true.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/dev/pci/pciide_common.c

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



CVS commit: src/sys/dev/pci

2024-03-23 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Mar 24 03:29:03 UTC 2024

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

Log Message:
ehci(4): properly handle failed attach

thinkpad a475 fails to attach an ehci instance:

   ehci0: pre-2.0 USB rev, device ignored

which ends up stopping suspend/resume working as the device has no
pmf handlers installed.  put most of the teardown code into a new
common function that is called from failed attach and detach.  if
attach fails, register NULL pmf handlers.  don't check the return
value of pmf_device_register*().

re-order several parts of detach to match the reverse attach order.

tested on rockpro64, thinkpad a475, and xps 1645, the a475 can now
suspend/resume almost fully successfully.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/dev/pci/ehci_pci.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/ehci_pci.c
diff -u src/sys/dev/pci/ehci_pci.c:1.76 src/sys/dev/pci/ehci_pci.c:1.77
--- src/sys/dev/pci/ehci_pci.c:1.76	Tue Jan 24 08:40:46 2023
+++ src/sys/dev/pci/ehci_pci.c	Sun Mar 24 03:29:02 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehci_pci.c,v 1.76 2023/01/24 08:40:46 mlelstv Exp $	*/
+/*	$NetBSD: ehci_pci.c,v 1.77 2024/03/24 03:29:02 mrg Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ehci_pci.c,v 1.76 2023/01/24 08:40:46 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci_pci.c,v 1.77 2024/03/24 03:29:02 mrg Exp $");
 
 #include 
 #include 
@@ -85,10 +85,12 @@ struct ehci_pci_softc {
 	void 			*sc_ih;		/* interrupt vectoring */
 	enum {
 		EHCI_INIT_NONE,
+		EHCI_INIT_OWNER,
 		EHCI_INIT_INITED
 	} sc_init_state;
 };
 
+static void ehci_pci_release_resources(struct ehci_pci_softc *);
 static int ehci_sb700_match(const struct pci_attach_args *);
 static int ehci_apply_amd_quirks(struct ehci_pci_softc *);
 static enum ehci_pci_quirk_flags ehci_pci_lookup_quirkdata(pci_vendor_id_t,
@@ -200,9 +202,6 @@ ehci_pci_attach(device_t parent, device_
 	sc->sc_ih = pci_intr_establish_xname(pc, sc->sc_pihp[0], IPL_USB,
 	ehci_intr, sc, device_xname(self));
 	if (sc->sc_ih == NULL) {
-		pci_intr_release(sc->sc_pc, sc->sc_pihp, 1);
-		sc->sc_pihp = NULL;
-
 		aprint_error_dev(self, "couldn't establish interrupt");
 		if (intrstr != NULL)
 			aprint_error(" at %s", intrstr);
@@ -258,6 +257,7 @@ ehci_pci_attach(device_t parent, device_
 	sc->sc.sc_ncomp = ncomp;
 
 	ehci_get_ownership(>sc, pc, tag);
+	sc->sc_init_state = EHCI_INIT_OWNER;
 
 	int err = ehci_init(>sc);
 	if (err) {
@@ -266,9 +266,8 @@ ehci_pci_attach(device_t parent, device_
 	}
 	sc->sc_init_state = EHCI_INIT_INITED;
 
-	if (!pmf_device_register1(self, ehci_pci_suspend, ehci_pci_resume,
-	ehci_shutdown))
-		aprint_error_dev(self, "couldn't establish power handler\n");
+	pmf_device_register1(self, ehci_pci_suspend, ehci_pci_resume,
+	ehci_shutdown);
 
 	/* Attach usb device. */
 	sc->sc.sc_child = config_found(self, >sc.sc_bus, usbctlprint,
@@ -276,15 +275,31 @@ ehci_pci_attach(device_t parent, device_
 	return;
 
 fail:
+	ehci_pci_release_resources(sc);
+	pmf_device_register(self, NULL, NULL);
+}
+
+static void
+ehci_pci_release_resources(struct ehci_pci_softc *sc)
+{
+	if (sc->sc_init_state >= EHCI_INIT_OWNER)
+		ehci_release_ownership(>sc, sc->sc_pc, sc->sc_tag);
+
 	if (sc->sc_ih) {
 		pci_intr_disestablish(sc->sc_pc, sc->sc_ih);
 		sc->sc_ih = NULL;
 	}
+	if (sc->sc_pihp != NULL) {
+		pci_intr_release(sc->sc_pc, sc->sc_pihp, 1);
+		sc->sc_pihp = NULL;
+	}
+
 	if (sc->sc.sc_size) {
-		ehci_release_ownership(>sc, sc->sc_pc, sc->sc_tag);
 		bus_space_unmap(sc->sc.iot, sc->sc.ioh, sc->sc.sc_size);
 		sc->sc.sc_size = 0;
 	}
+
+	sc->sc_init_state = EHCI_INIT_NONE;
 }
 
 static int
@@ -302,26 +317,14 @@ ehci_pci_detach(device_t self, int flags
 	pmf_device_deregister(self);
 	ehci_shutdown(self, flags);
 
-	/* disable interrupts */
-	EOWRITE4(>sc, EHCI_USBINTR, 0);
-	/* XXX grotty hack to flush the write */
-	(void)EOREAD4(>sc, EHCI_USBINTR);
-
-	if (sc->sc_ih != NULL) {
-		pci_intr_disestablish(sc->sc_pc, sc->sc_ih);
-		sc->sc_ih = NULL;
-	}
-
-	if (sc->sc_pihp != NULL) {
-		pci_intr_release(sc->sc_pc, sc->sc_pihp, 1);
-		sc->sc_pihp = NULL;
+	if (sc->sc_init_state >= EHCI_INIT_INITED) {
+		/* disable interrupts */
+		EOWRITE4(>sc, EHCI_USBINTR, 0);
+		/* XXX grotty hack to flush the write */
+		(void)EOREAD4(>sc, EHCI_USBINTR);
 	}
 
-	if (sc->sc.sc_size) {
-		ehci_release_ownership(>sc, sc->sc_pc, sc->sc_tag);
-		bus_space_unmap(sc->sc.iot, sc->sc.ioh, sc->sc.sc_size);
-		sc->sc.sc_size = 0;
-	}
+	ehci_pci_release_resources(sc);
 
 #if 1
 	/* XXX created in ehci.c */



CVS commit: src/sys/dev/pci

2024-03-23 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Mar 24 03:29:03 UTC 2024

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

Log Message:
ehci(4): properly handle failed attach

thinkpad a475 fails to attach an ehci instance:

   ehci0: pre-2.0 USB rev, device ignored

which ends up stopping suspend/resume working as the device has no
pmf handlers installed.  put most of the teardown code into a new
common function that is called from failed attach and detach.  if
attach fails, register NULL pmf handlers.  don't check the return
value of pmf_device_register*().

re-order several parts of detach to match the reverse attach order.

tested on rockpro64, thinkpad a475, and xps 1645, the a475 can now
suspend/resume almost fully successfully.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/dev/pci/ehci_pci.c

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



CVS commit: src/sys/dev/pci

2024-03-21 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Thu Mar 21 12:33:21 UTC 2024

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

Log Message:
Ensure that the number of bus_dma segments doesn't exceed VirtIO queue size.
This fixes reproducible panics when the host's VirtIO queue size is too small,
less than or equal to VIRTIO_NET_TX_MAXNSEGS(=16).
PR kern/58049.


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.111 src/sys/dev/pci/if_vioif.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_vioif.c
diff -u src/sys/dev/pci/if_vioif.c:1.110 src/sys/dev/pci/if_vioif.c:1.111
--- src/sys/dev/pci/if_vioif.c:1.110	Fri Feb  9 22:08:36 2024
+++ src/sys/dev/pci/if_vioif.c	Thu Mar 21 12:33:21 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vioif.c,v 1.110 2024/02/09 22:08:36 andvar Exp $	*/
+/*	$NetBSD: if_vioif.c,v 1.111 2024/03/21 12:33:21 isaki Exp $	*/
 
 /*
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.110 2024/02/09 22:08:36 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.111 2024/03/21 12:33:21 isaki Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -1280,12 +1280,14 @@ vioif_alloc_mems(struct vioif_softc *sc)
 
 		struct virtio_net_hdr *hdrs;
 		int dir;
+		int nsegs;
 
 		dir = VIOIF_NETQ_DIR(qid);
 		netq = >sc_netqs[qid];
 		vq_num = netq->netq_vq->vq_num;
 		maps = netq->netq_maps;
 		hdrs = netq->netq_maps_kva;
+		nsegs = uimin(dmaparams[dir].dma_nsegs, vq_num - 1/*hdr*/);
 
 		for (i = 0; i < vq_num; i++) {
 			maps[i].vnm_hdr = [i];
@@ -1297,7 +1299,7 @@ vioif_alloc_mems(struct vioif_softc *sc)
 goto err_reqs;
 
 			r = vioif_dmamap_create(sc, [i].vnm_mbuf_map,
-			dmaparams[dir].dma_size, dmaparams[dir].dma_nsegs,
+			dmaparams[dir].dma_size, nsegs,
 			dmaparams[dir].msg_payload);
 			if (r != 0)
 goto err_reqs;



CVS commit: src/sys/dev/pci

2024-03-21 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Thu Mar 21 12:33:21 UTC 2024

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

Log Message:
Ensure that the number of bus_dma segments doesn't exceed VirtIO queue size.
This fixes reproducible panics when the host's VirtIO queue size is too small,
less than or equal to VIRTIO_NET_TX_MAXNSEGS(=16).
PR kern/58049.


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.111 src/sys/dev/pci/if_vioif.c

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



CVS commit: src/sys/dev/pci

2024-03-09 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Mar  9 22:03:32 UTC 2024

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

Log Message:
aq(4): always poll for link status

some devices don't have working link status and rather than have
a likely incomplete list of issues, always poll as well as use
the interrupt if possible.

fixes link status on this device:

aq0 at pci5 dev 0 function 0: Aquantia AQC107 10 Gigabit Network Adapter (rev. 
0x02)
aq0: Atlantic revision B1, F/W version 3.1.88

(was otherwise functional, just didn't report status, which likely
meant eg, dhcpcd would be upset?)

idea via mlelstv@ from linux.

remove sc_detect_linkstat and rename sc_poll_linkstat to
sc_no_link_intr, as the meaning has changed.  simplify the signature
for aq_setup_msix() and aq_establish_msix_intr(), removing forward
decls that aren't required.  obsolete AQ_FORCE_POLL_LINKSTAT.


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

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

Modified files:

Index: src/sys/dev/pci/if_aq.c
diff -u src/sys/dev/pci/if_aq.c:1.46 src/sys/dev/pci/if_aq.c:1.47
--- src/sys/dev/pci/if_aq.c:1.46	Wed Feb  7 04:20:28 2024
+++ src/sys/dev/pci/if_aq.c	Sat Mar  9 22:03:32 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_aq.c,v 1.46 2024/02/07 04:20:28 msaitoh Exp $	*/
+/*	$NetBSD: if_aq.c,v 1.47 2024/03/09 22:03:32 mrg Exp $	*/
 
 /**
  * aQuantia Corporation Network Driver
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.46 2024/02/07 04:20:28 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.47 2024/03/09 22:03:32 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_if_aq.h"
@@ -1330,8 +1330,7 @@ struct aq_softc {
 	int sc_rx_irq[AQ_RSSQUEUE_MAX];
 	int sc_linkstat_irq;
 	bool sc_use_txrx_independent_intr;
-	bool sc_poll_linkstat;
-	bool sc_detect_linkstat;
+	bool sc_no_link_intr;
 
 #if NSYSMON_ENVSYS > 0
 	struct sysmon_envsys *sc_sme;
@@ -1443,11 +1442,9 @@ static int aq_match(device_t, cfdata_t, 
 static void aq_attach(device_t, device_t, void *);
 static int aq_detach(device_t, int);
 
-static int aq_setup_msix(struct aq_softc *, struct pci_attach_args *, int,
-bool, bool);
+static int aq_setup_msix(struct aq_softc *, struct pci_attach_args *);
 static int aq_setup_legacy(struct aq_softc *, struct pci_attach_args *,
 pci_intr_type_t);
-static int aq_establish_msix_intr(struct aq_softc *, bool, bool);
 
 static int aq_ifmedia_change(struct ifnet * const);
 static void aq_ifmedia_status(struct ifnet * const, struct ifmediareq *);
@@ -1784,67 +1781,57 @@ aq_attach(device_t parent, device_t self
 	if (msixcount >= (sc->sc_nqueues * 2 + 1)) {
 		/* TX intrs + RX intrs + LINKSTAT intrs */
 		sc->sc_use_txrx_independent_intr = true;
-		sc->sc_poll_linkstat = false;
 		sc->sc_msix = true;
 	} else if (msixcount >= (sc->sc_nqueues * 2)) {
 		/* TX intrs + RX intrs */
 		sc->sc_use_txrx_independent_intr = true;
-		sc->sc_poll_linkstat = true;
 		sc->sc_msix = true;
 	} else
 #endif
 	if (msixcount >= (sc->sc_nqueues + 1)) {
 		/* TX/RX intrs LINKSTAT intrs */
 		sc->sc_use_txrx_independent_intr = false;
-		sc->sc_poll_linkstat = false;
 		sc->sc_msix = true;
 	} else if (msixcount >= sc->sc_nqueues) {
 		/* TX/RX intrs */
 		sc->sc_use_txrx_independent_intr = false;
-		sc->sc_poll_linkstat = true;
+		sc->sc_no_link_intr = true;
 		sc->sc_msix = true;
 	} else {
 		/* giving up using MSI-X */
 		sc->sc_msix = false;
 	}
 
-	/* on AQ1a0, AQ2, or FIBRE, linkstat interrupt doesn't work? */
-	if (aqp->aq_media_type == AQ_MEDIA_TYPE_FIBRE ||
-	(HWTYPE_AQ1_P(sc) && FW_VERSION_MAJOR(sc) == 1) ||
-	HWTYPE_AQ2_P(sc))
-		sc->sc_poll_linkstat = true;
-
-#ifdef AQ_FORCE_POLL_LINKSTAT
-	sc->sc_poll_linkstat = true;
-#endif
-
 	aprint_debug_dev(sc->sc_dev,
 	"ncpu=%d, pci_msix_count=%d."
 	" allocate %d interrupts for %d%s queues%s\n",
 	ncpu, msixcount,
 	(sc->sc_use_txrx_independent_intr ?
 	(sc->sc_nqueues * 2) : sc->sc_nqueues) +
-	(sc->sc_poll_linkstat ? 0 : 1),
+	(sc->sc_no_link_intr ? 0 : 1),
 	sc->sc_nqueues,
 	sc->sc_use_txrx_independent_intr ? "*2" : "",
-	sc->sc_poll_linkstat ? "" : ", and link status");
+	(sc->sc_no_link_intr) ? "" : ", and link status");
 
 	if (sc->sc_msix)
-		error = aq_setup_msix(sc, pa, sc->sc_nqueues,
-		sc->sc_use_txrx_independent_intr, !sc->sc_poll_linkstat);
+		error = aq_setup_msix(sc, pa);
 	else
 		error = ENODEV;
 
 	if (error != 0) {
 		/* if MSI-X failed, fallback to MSI with single queue */
 		sc->sc_use_txrx_independent_intr = false;
-		sc->sc_poll_linkstat = false;
 		sc->sc_msix = false;
 		sc->sc_nqueues = 1;
+		sc->sc_no_link_intr = false;
+		aprint_debug_dev(sc->sc_dev, "MSI-X failed: %d, trying MSI",
+		error);
 		error = aq_setup_legacy(sc, pa, PCI_INTR_TYPE_MSI);
 	}
 	if (error != 0) {
 		/* if MSI failed, fallback to INTx */
+		aprint_debug_dev(sc->sc_dev, 

CVS commit: src/sys/dev/pci

2024-03-09 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Mar  9 22:03:32 UTC 2024

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

Log Message:
aq(4): always poll for link status

some devices don't have working link status and rather than have
a likely incomplete list of issues, always poll as well as use
the interrupt if possible.

fixes link status on this device:

aq0 at pci5 dev 0 function 0: Aquantia AQC107 10 Gigabit Network Adapter (rev. 
0x02)
aq0: Atlantic revision B1, F/W version 3.1.88

(was otherwise functional, just didn't report status, which likely
meant eg, dhcpcd would be upset?)

idea via mlelstv@ from linux.

remove sc_detect_linkstat and rename sc_poll_linkstat to
sc_no_link_intr, as the meaning has changed.  simplify the signature
for aq_setup_msix() and aq_establish_msix_intr(), removing forward
decls that aren't required.  obsolete AQ_FORCE_POLL_LINKSTAT.


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

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



CVS commit: src/sys/dev/pci

2024-03-09 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Mar  9 11:04:22 UTC 2024

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

Log Message:
Modify a confused expression in ld_virtio_attach().
VIRTIO_BLK_MIN_SEGMENTS should be the total number of non-data segments,
so I rename it to VIRTIO_BLK_CTRL_SEGMENTS.
PR kern/57981.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/pci/ld_virtio.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/ld_virtio.c
diff -u src/sys/dev/pci/ld_virtio.c:1.33 src/sys/dev/pci/ld_virtio.c:1.34
--- src/sys/dev/pci/ld_virtio.c:1.33	Mon Feb 12 02:28:28 2024
+++ src/sys/dev/pci/ld_virtio.c	Sat Mar  9 11:04:22 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: ld_virtio.c,v 1.33 2024/02/12 02:28:28 isaki Exp $	*/
+/*	$NetBSD: ld_virtio.c,v 1.34 2024/03/09 11:04:22 isaki Exp $	*/
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ld_virtio.c,v 1.33 2024/02/12 02:28:28 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld_virtio.c,v 1.34 2024/03/09 11:04:22 isaki Exp $");
 
 #include 
 #include 
@@ -74,7 +74,7 @@ __KERNEL_RCSID(0, "$NetBSD: ld_virtio.c,
  * Each block request uses at least two segments - one for the header
  * and one for the status.
 */
-#define	VIRTIO_BLK_MIN_SEGMENTS	2
+#define	VIRTIO_BLK_CTRL_SEGMENTS	2
 
 #define VIRTIO_BLK_FLAG_BITS			\
 	VIRTIO_COMMON_FLAG_BITS			\
@@ -222,7 +222,7 @@ ld_virtio_alloc_reqs(struct ld_virtio_so
 		r = bus_dmamap_create(virtio_dmat(sc->sc_virtio),
   ld->sc_maxxfer,
   (ld->sc_maxxfer / NBPG) +
-  VIRTIO_BLK_MIN_SEGMENTS,
+  VIRTIO_BLK_CTRL_SEGMENTS,
   ld->sc_maxxfer,
   0,
   BUS_DMA_WAITOK|BUS_DMA_ALLOCNOW,
@@ -319,18 +319,15 @@ ld_virtio_attach(device_t parent, device
 	if (features & VIRTIO_BLK_F_SEG_MAX) {
 		maxnsegs = virtio_read_device_config_4(vsc,
 		VIRTIO_BLK_CONFIG_SEG_MAX);
-		if (maxnsegs < VIRTIO_BLK_MIN_SEGMENTS) {
+		if (maxnsegs == 0) {
 			aprint_error_dev(sc->sc_dev,
-			"Too small SEG_MAX %d minimum is %d\n",
-			maxnsegs, VIRTIO_BLK_MIN_SEGMENTS);
-			maxnsegs = maxxfersize / NBPG;
-			// goto err;
+			"Invalid SEG_MAX %d\n", maxnsegs);
+			goto err;
 		}
 	} else
 		maxnsegs = maxxfersize / NBPG;
 
-	/* 2 for the minimum size */
-	maxnsegs += VIRTIO_BLK_MIN_SEGMENTS;
+	maxnsegs += VIRTIO_BLK_CTRL_SEGMENTS;
 
 	virtio_init_vq_vqdone(vsc, >sc_vq, 0,
 	ld_virtio_vq_done);
@@ -414,7 +411,7 @@ ld_virtio_start(struct ld_softc *ld, str
 	}
 
 	r = virtio_enqueue_reserve(vsc, vq, slot, vr->vr_payload->dm_nsegs +
-	VIRTIO_BLK_MIN_SEGMENTS);
+	VIRTIO_BLK_CTRL_SEGMENTS);
 	if (r != 0) {
 		bus_dmamap_unload(virtio_dmat(vsc), vr->vr_payload);
 		return r;
@@ -543,7 +540,7 @@ ld_virtio_dump(struct ld_softc *ld, void
 		return r;
 
 	r = virtio_enqueue_reserve(vsc, vq, slot, vr->vr_payload->dm_nsegs +
-	VIRTIO_BLK_MIN_SEGMENTS);
+	VIRTIO_BLK_CTRL_SEGMENTS);
 	if (r != 0) {
 		bus_dmamap_unload(virtio_dmat(vsc), vr->vr_payload);
 		return r;
@@ -679,7 +676,7 @@ ld_virtio_flush(struct ld_softc *ld, boo
 	vr = >sc_reqs[slot];
 	KASSERT(vr->vr_bp == NULL);
 
-	r = virtio_enqueue_reserve(vsc, vq, slot, VIRTIO_BLK_MIN_SEGMENTS);
+	r = virtio_enqueue_reserve(vsc, vq, slot, VIRTIO_BLK_CTRL_SEGMENTS);
 	if (r != 0) {
 		return r;
 	}



CVS commit: src/sys/dev/pci

2024-03-09 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Mar  9 11:04:22 UTC 2024

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

Log Message:
Modify a confused expression in ld_virtio_attach().
VIRTIO_BLK_MIN_SEGMENTS should be the total number of non-data segments,
so I rename it to VIRTIO_BLK_CTRL_SEGMENTS.
PR kern/57981.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/pci/ld_virtio.c

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



CVS commit: src/sys/dev/pci

2024-02-28 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed Feb 28 18:55:11 UTC 2024

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

Log Message:
Add Killer E2600, adapted from PR 57969


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/dev/pci/if_re_pci.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_re_pci.c
diff -u src/sys/dev/pci/if_re_pci.c:1.52 src/sys/dev/pci/if_re_pci.c:1.53
--- src/sys/dev/pci/if_re_pci.c:1.52	Tue Feb 18 03:48:22 2020
+++ src/sys/dev/pci/if_re_pci.c	Wed Feb 28 18:55:11 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_re_pci.c,v 1.52 2020/02/18 03:48:22 msaitoh Exp $	*/
+/*	$NetBSD: if_re_pci.c,v 1.53 2024/02/28 18:55:11 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 1997, 1998-2003
@@ -46,7 +46,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_re_pci.c,v 1.52 2020/02/18 03:48:22 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_re_pci.c,v 1.53 2024/02/28 18:55:11 jakllsch Exp $");
 
 #include 
 
@@ -108,6 +108,9 @@ static const struct rtk_type re_devs[] =
 	{ PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8169SC,
 	RTK_8169,
 	"RealTek 8169SC/8110SC Single-chip Gigabit Ethernet" },
+	{ PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_E2600,
+	RTK_8169,
+	"Killer E2600 Gigabit Ethernet" },
 	{ PCI_VENDOR_COREGA, PCI_PRODUCT_COREGA_LAPCIGT,
 	RTK_8169,
 	"Corega CG-LAPCIGT Gigabit Ethernet" },



CVS commit: src/sys/dev/pci

2024-02-28 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed Feb 28 18:55:11 UTC 2024

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

Log Message:
Add Killer E2600, adapted from PR 57969


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/dev/pci/if_re_pci.c

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



CVS commit: src/sys/dev/pci

2024-02-28 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed Feb 28 18:54:04 UTC 2024

Modified Files:
src/sys/dev/pci: pcidevs.h pcidevs_data.h

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.1482 -r1.1483 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1481 -r1.1482 src/sys/dev/pci/pcidevs_data.h

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-28 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed Feb 28 18:51:34 UTC 2024

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
Add (Realtek/)Killer E2600 Ethernet


To generate a diff of this commit:
cvs rdiff -u -r1.1502 -r1.1503 src/sys/dev/pci/pcidevs

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/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1502 src/sys/dev/pci/pcidevs:1.1503
--- src/sys/dev/pci/pcidevs:1.1502	Thu Jan 18 03:15:26 2024
+++ src/sys/dev/pci/pcidevs	Wed Feb 28 18:51:34 2024
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1502 2024/01/18 03:15:26 msaitoh Exp $
+$NetBSD: pcidevs,v 1.1503 2024/02/28 18:51:34 jakllsch Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -9190,6 +9190,7 @@ product RDC	R6060_OHCI	0x6060	R6060 USB 
 product RDC	R6061_EHCI	0x6061	R6061 USB EHCI
 
 /* Realtek products */
+product REALTEK E2600 		0x2600	Killer E2600
 product REALTEK E3000 		0x3000	Killer E3000
 product REALTEK RTS5208		0x5208	RTS5208 PCI-E Card Reader
 product REALTEK RTS5209		0x5209	RTS5209 PCI-E Card Reader



CVS commit: src/sys/dev/pci

2024-02-28 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed Feb 28 18:51:34 UTC 2024

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
Add (Realtek/)Killer E2600 Ethernet


To generate a diff of this commit:
cvs rdiff -u -r1.1502 -r1.1503 src/sys/dev/pci/pcidevs

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, ,
 		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, , 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/sys/dev/pci/igc

2024-02-21 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Feb 21 12:39:39 UTC 2024

Modified Files:
src/sys/dev/pci/igc: if_igc.c igc_defines.h

Log Message:
igc(4): Print EtrackID.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/pci/igc/if_igc.c
cvs rdiff -u -r1.2 -r1.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.12 src/sys/dev/pci/igc/if_igc.c:1.13
--- src/sys/dev/pci/igc/if_igc.c:1.12	Wed Feb 21 12:34:06 2024
+++ src/sys/dev/pci/igc/if_igc.c	Wed Feb 21 12:39:39 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_igc.c,v 1.12 2024/02/21 12:34:06 msaitoh Exp $	*/
+/*	$NetBSD: if_igc.c,v 1.13 2024/02/21 12:39:39 msaitoh 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.12 2024/02/21 12:34:06 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_igc.c,v 1.13 2024/02/21 12:39:39 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_if_igc.h"
@@ -3850,7 +3850,7 @@ igc_print_devinfo(struct igc_softc *sc)
 	struct igc_hw *hw = >hw;
 	struct igc_phy_info *phy = >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 */
@@ -3873,10 +3873,15 @@ igc_print_devinfo(struct igc_softc *sc)
 	phy->ops.read_reg(hw, 0x1e, _ver);
 	aprint_normal(", PHY FW version 0x%04hx\n", phy_ver);
 
-	/* Get NVM version */
+	/* NVM version */
 	hw->nvm.ops.read(hw, NVM_VERSION, 1, _ver);
 
-	aprint_normal_dev(dev, "ROM image version %x.%02x\n",
+	/* EtrackID */
+	hw->nvm.ops.read(hw, NVM_ETKID_LO, 1, _lo);
+	hw->nvm.ops.read(hw, NVM_ETKID_HI, 1, _hi);
+
+	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));
+	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 src/sys/dev/pci/igc/igc_defines.h:1.3
--- src/sys/dev/pci/igc/igc_defines.h:1.2	Wed Oct  4 07:35:27 2023
+++ src/sys/dev/pci/igc/igc_defines.h	Wed Feb 21 12:39:39 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: igc_defines.h,v 1.2 2023/10/04 07:35:27 rin Exp $	*/
+/*	$NetBSD: igc_defines.h,v 1.3 2024/02/21 12:39:39 msaitoh Exp $	*/
 /*	$OpenBSD: igc_defines.h,v 1.1 2021/10/31 14:52:57 patrick Exp $	*/
 
 /*-
@@ -982,6 +982,8 @@
 #define NVM_CFG0x0012
 #define NVM_ALT_MAC_ADDR_PTR		0x0037
 #define NVM_CHECKSUM_REG		0x003F
+#define NVM_ETKID_LO			0x0042
+#define NVM_ETKID_HI			0x0043
 
 #define IGC_NVM_CFG_DONE_PORT_0	0x04 /* MNG config cycle done */
 #define IGC_NVM_CFG_DONE_PORT_1	0x08 /* ...for second port */



CVS commit: src/sys/dev/pci/igc

2024-02-21 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Feb 21 12:39:39 UTC 2024

Modified Files:
src/sys/dev/pci/igc: if_igc.c igc_defines.h

Log Message:
igc(4): Print EtrackID.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/pci/igc/if_igc.c
cvs rdiff -u -r1.2 -r1.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: src/sys/dev/pci/igc

2024-02-21 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Feb 21 12:34:06 UTC 2024

Modified Files:
src/sys/dev/pci/igc: if_igc.c

Log Message:
igc(4): Modify dmesg output of PHY and NVM info.

 - Print PHY info first and then print NVM info.
 - Remove debug output.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/pci/igc/if_igc.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/igc/if_igc.c
diff -u src/sys/dev/pci/igc/if_igc.c:1.11 src/sys/dev/pci/igc/if_igc.c:1.12
--- src/sys/dev/pci/igc/if_igc.c:1.11	Thu Feb  8 09:59:35 2024
+++ src/sys/dev/pci/igc/if_igc.c	Wed Feb 21 12:34:06 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_igc.c,v 1.11 2024/02/08 09:59:35 msaitoh Exp $	*/
+/*	$NetBSD: if_igc.c,v 1.12 2024/02/21 12:34:06 msaitoh 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.11 2024/02/08 09:59:35 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_igc.c,v 1.12 2024/02/21 12:34:06 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_if_igc.h"
@@ -3862,23 +3862,21 @@ 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);
 
+	/* PHY FW version */
+	phy->ops.read_reg(hw, 0x1e, _ver);
+	aprint_normal(", PHY FW version 0x%04hx\n", phy_ver);
+
 	/* Get NVM version */
 	hw->nvm.ops.read(hw, NVM_VERSION, 1, _ver);
 
-	/* Get PHY FW version */
-	phy->ops.read_reg(hw, 0x1e, _ver);
-
-	aprint_normal_dev(dev, "ROM image version %x.%02x",
+	aprint_normal_dev(dev, "ROM image version %x.%02x\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);
 }



CVS commit: src/sys/dev/pci/igc

2024-02-21 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Feb 21 12:34:06 UTC 2024

Modified Files:
src/sys/dev/pci/igc: if_igc.c

Log Message:
igc(4): Modify dmesg output of PHY and NVM info.

 - Print PHY info first and then print NVM info.
 - Remove debug output.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/pci/igc/if_igc.c

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



CVS commit: src/sys/dev/pci

2024-02-21 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Feb 21 12:23:52 UTC 2024

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

Log Message:
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.797 -r1.798 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: src/sys/dev/pci

2024-02-21 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Feb 21 12:23:52 UTC 2024

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

Log Message:
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.797 -r1.798 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.797 src/sys/dev/pci/if_wm.c:1.798
--- src/sys/dev/pci/if_wm.c:1.797	Mon Jan 29 06:24:51 2024
+++ src/sys/dev/pci/if_wm.c	Wed Feb 21 12:23:52 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.797 2024/01/29 06:24:51 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.798 2024/02/21 12:23:52 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.797 2024/01/29 06:24:51 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.798 2024/02/21 12:23:52 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_if_wm.h"
@@ -15364,16 +15364,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, );
-			rv |= wm_nvm_read(sc, off, 1, );
-			if ((rv == 0) && (uid0 != 0) && (uid0 != 0x)
-			&& (uid1 != 0) && (uid1 != 0x)) {
+			rv = wm_nvm_read(sc, off + 1, 1, );
+			rv |= wm_nvm_read(sc, off, 1, );
+			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: src/sys/dev/pci

2024-02-11 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Mon Feb 12 02:28:28 UTC 2024

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

Log Message:
Fix typo in error message.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/pci/ld_virtio.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/ld_virtio.c
diff -u src/sys/dev/pci/ld_virtio.c:1.32 src/sys/dev/pci/ld_virtio.c:1.33
--- src/sys/dev/pci/ld_virtio.c:1.32	Thu Mar 23 03:55:11 2023
+++ src/sys/dev/pci/ld_virtio.c	Mon Feb 12 02:28:28 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: ld_virtio.c,v 1.32 2023/03/23 03:55:11 yamaguchi Exp $	*/
+/*	$NetBSD: ld_virtio.c,v 1.33 2024/02/12 02:28:28 isaki Exp $	*/
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ld_virtio.c,v 1.32 2023/03/23 03:55:11 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld_virtio.c,v 1.33 2024/02/12 02:28:28 isaki Exp $");
 
 #include 
 #include 
@@ -308,7 +308,7 @@ ld_virtio_attach(device_t parent, device
 			maxxfersize = MAXPHYS;
 		} else if (maxxfersize > MAXPHYS) {
 			aprint_normal_dev(sc->sc_dev,
-			"Clip SEG_MAX from %dK to %dK\n",
+			"Clip SIZE_MAX from %dK to %dK\n",
 			maxxfersize / 1024,
 			MAXPHYS / 1024);
 			maxxfersize = MAXPHYS;



CVS commit: src/sys/dev/pci

2024-02-11 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Mon Feb 12 02:28:28 UTC 2024

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

Log Message:
Fix typo in error message.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/pci/ld_virtio.c

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



CVS commit: src/sys/dev/pci

2024-02-09 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Feb 10 02:25:15 UTC 2024

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

Log Message:
Split KASSERT(A && B) into KASSERT(A); KASSERT(B).


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/sys/dev/pci/virtio.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/virtio.c
diff -u src/sys/dev/pci/virtio.c:1.80 src/sys/dev/pci/virtio.c:1.81
--- src/sys/dev/pci/virtio.c:1.80	Fri Feb  9 22:08:36 2024
+++ src/sys/dev/pci/virtio.c	Sat Feb 10 02:25:15 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: virtio.c,v 1.80 2024/02/09 22:08:36 andvar Exp $	*/
+/*	$NetBSD: virtio.c,v 1.81 2024/02/10 02:25:15 isaki Exp $	*/
 
 /*
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.80 2024/02/09 22:08:36 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.81 2024/02/10 02:25:15 isaki Exp $");
 
 #include 
 #include 
@@ -1069,7 +1069,8 @@ virtio_enqueue_reserve(struct virtio_sof
 	struct vring_desc_extra *vdx;
 	int i;
 
-	KASSERT(1 <= nsegs && nsegs <= vq->vq_num);
+	KASSERT(1 <= nsegs);
+	KASSERT(nsegs <= vq->vq_num);
 
 	vdx = >vq_descx[slot];
 	vd = >vq_desc[slot];



CVS commit: src/sys/dev/pci

2024-02-09 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Feb 10 02:25:15 UTC 2024

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

Log Message:
Split KASSERT(A && B) into KASSERT(A); KASSERT(B).


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/sys/dev/pci/virtio.c

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



CVS commit: src/sys/dev/pci

2024-02-08 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Fri Feb  9 06:01:03 UTC 2024

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

Log Message:
Fix DMA sync sizes.
Don't panic for inconsistent queue counter, just print an error to console.


To generate a diff of this commit:
cvs rdiff -u -r1.88 -r1.89 src/sys/dev/pci/if_iwm.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_iwm.c
diff -u src/sys/dev/pci/if_iwm.c:1.88 src/sys/dev/pci/if_iwm.c:1.89
--- src/sys/dev/pci/if_iwm.c:1.88	Thu Sep 21 09:31:50 2023
+++ src/sys/dev/pci/if_iwm.c	Fri Feb  9 06:01:03 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_iwm.c,v 1.88 2023/09/21 09:31:50 msaitoh Exp $	*/
+/*	$NetBSD: if_iwm.c,v 1.89 2024/02/09 06:01:03 mlelstv Exp $	*/
 /*	OpenBSD: if_iwm.c,v 1.148 2016/11/19 21:07:08 stsp Exp	*/
 #define IEEE80211_NO_HT
 /*
@@ -106,7 +106,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.88 2023/09/21 09:31:50 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.89 2024/02/09 06:01:03 mlelstv Exp $");
 
 #include 
 #include 
@@ -1262,8 +1262,9 @@ iwm_free_rx_ring(struct iwm_softc *sc, s
 		struct iwm_rx_data *data = >data[i];
 
 		if (data->m != NULL) {
+			bus_size_t sz = data->m->m_pkthdr.len;
 			bus_dmamap_sync(sc->sc_dmat, data->map, 0,
-			data->map->dm_mapsize, BUS_DMASYNC_POSTREAD);
+			sz, BUS_DMASYNC_POSTREAD);
 			bus_dmamap_unload(sc->sc_dmat, data->map);
 			m_freem(data->m);
 			data->m = NULL;
@@ -1405,8 +1406,9 @@ iwm_reset_tx_ring(struct iwm_softc *sc, 
 		struct iwm_tx_data *data = >data[i];
 
 		if (data->m != NULL) {
+			bus_size_t sz = data->m->m_pkthdr.len;
 			bus_dmamap_sync(sc->sc_dmat, data->map, 0,
-			data->map->dm_mapsize, BUS_DMASYNC_POSTWRITE);
+			sz, BUS_DMASYNC_POSTWRITE);
 			bus_dmamap_unload(sc->sc_dmat, data->map);
 			m_freem(data->m);
 			data->m = NULL;
@@ -1436,8 +1438,9 @@ iwm_free_tx_ring(struct iwm_softc *sc, s
 		struct iwm_tx_data *data = >data[i];
 
 		if (data->m != NULL) {
+			bus_size_t sz = data->m->m_pkthdr.len;
 			bus_dmamap_sync(sc->sc_dmat, data->map, 0,
-			data->map->dm_mapsize, BUS_DMASYNC_POSTWRITE);
+			sz, BUS_DMASYNC_POSTWRITE);
 			bus_dmamap_unload(sc->sc_dmat, data->map);
 			m_freem(data->m);
 			data->m = NULL;
@@ -1517,7 +1520,7 @@ iwm_ict_reset(struct iwm_softc *sc)
 	iwm_disable_interrupts(sc);
 
 	memset(sc->ict_dma.vaddr, 0, IWM_ICT_SIZE);
-	bus_dmamap_sync(sc->sc_dmat, sc->ict_dma.map, 0, IWM_ICT_SIZE,
+	bus_dmamap_sync(sc->sc_dmat, sc->ict_dma.map, 0, sc->ict_dma.size,
 	BUS_DMASYNC_PREWRITE);
 	sc->ict_cur = 0;
 
@@ -3766,7 +3769,7 @@ iwm_rx_addbuf(struct iwm_softc *sc, int 
 	if (size <= MCLBYTES) {
 		MCLGET(m, M_DONTWAIT);
 	} else {
-		MEXTMALLOC(m, IWM_RBUF_SIZE, M_DONTWAIT);
+		MEXTMALLOC(m, size, M_DONTWAIT);
 	}
 	if ((m->m_flags & M_EXT) == 0) {
 		m_freem(m);
@@ -3778,7 +3781,7 @@ iwm_rx_addbuf(struct iwm_softc *sc, int 
 		fatal = 1;
 	}
 
-	m->m_len = m->m_pkthdr.len = m->m_ext.ext_size;
+	m->m_len = m->m_pkthdr.len = size;
 	err = bus_dmamap_load_mbuf(sc->sc_dmat, data->map, m,
 	BUS_DMA_READ|BUS_DMA_NOWAIT);
 	if (err) {
@@ -4452,12 +4455,17 @@ iwm_cmd_done(struct iwm_softc *sc, int q
 	wakeup(>desc[idx]);
 
 	if (((idx + ring->queued) % IWM_TX_RING_COUNT) != ring->cur) {
-		aprint_error_dev(sc->sc_dev,
+		device_printf(sc->sc_dev,
 		"Some HCMDs skipped?: idx=%d queued=%d cur=%d\n",
 		idx, ring->queued, ring->cur);
 	}
 
-	KASSERT(ring->queued > 0);
+	if (ring->queued == 0) {
+		splx(s);
+		device_printf(sc->sc_dev, "cmd_done with empty ring\n");
+		return;
+	}
+
 	if (--ring->queued == 0)
 		iwm_clear_cmd_in_flight(sc);
 
@@ -4785,7 +4793,7 @@ iwm_tx(struct iwm_softc *sc, struct mbuf
 		| ((seg->ds_len) << 4);
 	}
 
-	bus_dmamap_sync(sc->sc_dmat, data->map, 0, data->map->dm_mapsize,
+	bus_dmamap_sync(sc->sc_dmat, data->map, 0, m->m_pkthdr.len,
 	BUS_DMASYNC_PREWRITE);
 	bus_dmamap_sync(sc->sc_dmat, ring->cmd_dma.map,
 	(uint8_t *)cmd - (uint8_t *)ring->cmd, sizeof(*cmd),



CVS commit: src/sys/dev/pci

2024-02-08 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Fri Feb  9 06:01:03 UTC 2024

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

Log Message:
Fix DMA sync sizes.
Don't panic for inconsistent queue counter, just print an error to console.


To generate a diff of this commit:
cvs rdiff -u -r1.88 -r1.89 src/sys/dev/pci/if_iwm.c

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



CVS commit: src/sys/dev/pci/igc

2024-02-08 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Feb  8 09:59:35 UTC 2024

Modified Files:
src/sys/dev/pci/igc: if_igc.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/pci/igc/if_igc.c

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



CVS commit: src/sys/dev/pci/igc

2024-02-08 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Feb  8 09:59:35 UTC 2024

Modified Files:
src/sys/dev/pci/igc: if_igc.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/pci/igc/if_igc.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/igc/if_igc.c
diff -u src/sys/dev/pci/igc/if_igc.c:1.10 src/sys/dev/pci/igc/if_igc.c:1.11
--- src/sys/dev/pci/igc/if_igc.c:1.10	Thu Jan 25 05:48:56 2024
+++ src/sys/dev/pci/igc/if_igc.c	Thu Feb  8 09:59:35 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_igc.c,v 1.10 2024/01/25 05:48:56 msaitoh Exp $	*/
+/*	$NetBSD: if_igc.c,v 1.11 2024/02/08 09:59:35 msaitoh 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.10 2024/01/25 05:48:56 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_igc.c,v 1.11 2024/02/08 09:59:35 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_if_igc.h"
@@ -2548,6 +2548,9 @@ igc_update_link_status(struct igc_softc 
 	struct ifnet *ifp = >sc_ec.ec_if;
 	struct igc_hw *hw = >hw;
 
+	if (hw->mac.get_link_status == true)
+		igc_check_for_link(hw);
+
 	if (IGC_READ_REG(>hw, IGC_STATUS) & IGC_STATUS_LU) {
 		if (sc->link_active == 0) {
 			igc_get_speed_and_duplex(hw, >link_speed,



CVS commit: src/sys/dev/pci

2024-01-28 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Jan 29 06:24:51 UTC 2024

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

Log Message:
wm(4): Fix compile error without WM_EVENT_COUNTERS.


To generate a diff of this commit:
cvs rdiff -u -r1.796 -r1.797 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.796 src/sys/dev/pci/if_wm.c:1.797
--- src/sys/dev/pci/if_wm.c:1.796	Mon Jan 29 06:05:11 2024
+++ src/sys/dev/pci/if_wm.c	Mon Jan 29 06:24:51 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.796 2024/01/29 06:05:11 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.797 2024/01/29 06:24:51 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.796 2024/01/29 06:05:11 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.797 2024/01/29 06:24:51 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_if_wm.h"
@@ -6640,7 +6640,6 @@ wm_update_stats(struct wm_softc *sc)
 	uint64_t crcerrs, algnerrc, symerrc, mpc, colc,  sec, rlec, rxerrc,
 	cexterr;
 	uint64_t total_qdrop = 0;
-	int i;
 
 	crcerrs = CSR_READ(sc, WMREG_CRCERRS);
 	symerrc = CSR_READ(sc, WMREG_SYMERRC);
@@ -6789,7 +6788,8 @@ wm_update_stats(struct wm_softc *sc)
 		WM_EVCNT_ADD(>sc_ev_lenerrs, CSR_READ(sc, WMREG_LENERRS));
 		WM_EVCNT_ADD(>sc_ev_scvpc, CSR_READ(sc, WMREG_SCVPC));
 		WM_EVCNT_ADD(>sc_ev_hrmpc, CSR_READ(sc, WMREG_HRMPC));
-		for (i = 0; i < sc->sc_nqueues; i++) {
+#ifdef WM_EVENT_COUNTERS
+		for (int i = 0; i < sc->sc_nqueues; i++) {
 			struct wm_rxqueue *rxq = >sc_queue[i].wmq_rxq;
 			uint32_t rqdpc;
 
@@ -6803,6 +6803,7 @@ wm_update_stats(struct wm_softc *sc)
 			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_ev_tlpic, CSR_READ(sc, WMREG_TLPIC));



CVS commit: src/sys/dev/pci

2024-01-28 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Jan 29 06:24:51 UTC 2024

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

Log Message:
wm(4): Fix compile error without WM_EVENT_COUNTERS.


To generate a diff of this commit:
cvs rdiff -u -r1.796 -r1.797 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: src/sys/dev/pci

2024-01-28 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Jan 29 06:05:11 UTC 2024

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

Log Message:
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).


To generate a diff of this commit:
cvs rdiff -u -r1.795 -r1.796 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.795 src/sys/dev/pci/if_wm.c:1.796
--- src/sys/dev/pci/if_wm.c:1.795	Mon Jan 29 05:02:06 2024
+++ src/sys/dev/pci/if_wm.c	Mon Jan 29 06:05:11 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.795 2024/01/29 05:02:06 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.796 2024/01/29 06:05:11 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.795 2024/01/29 05:02:06 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.796 2024/01/29 06:05:11 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_if_wm.h"
@@ -8458,6 +8458,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 82575 "
 "or higher\n", __func__, MCLBYTES);
@@ -8466,9 +8468,17 @@ wm_init_rx_regs(struct wm_softc *sc, str
 			 * Currently, support SRRCTL_DESCTYPE_ADV_ONEBUF
 			 * only.
 			 */
-			CSR_WRITE(sc, WMREG_SRRCTL(qid),
-			SRRCTL_DESCTYPE_ADV_ONEBUF
-			| (MCLBYTES >> SRRCTL_BSIZEPKT_SHIFT));
+			srrctl = SRRCTL_DESCTYPE_ADV_ONEBUF
+			| (MCLBYTES >> SRRCTL_BSIZEPKT_SHIFT);
+			/*
+			 * Drop frames if the RX descriptor ring has no room.
+			 * This is enabled only on multiqueue system to avoid
+			 * bad influence to other queues.
+			 */
+			if (sc->sc_nqueues > 1)
+srrctl |= SRRCTL_DROP_EN;
+			CSR_WRITE(sc, WMREG_SRRCTL(qid), srrctl);
+
 			CSR_WRITE(sc, WMREG_RXDCTL(qid), RXDCTL_QUEUE_ENABLE
 			| RXDCTL_PTHRESH(16) | RXDCTL_HTHRESH(8)
 			| RXDCTL_WTHRESH(1));



CVS commit: src/sys/dev/pci

2024-01-28 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Jan 29 06:05:11 UTC 2024

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

Log Message:
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).


To generate a diff of this commit:
cvs rdiff -u -r1.795 -r1.796 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: src/sys/dev/pci

2024-01-28 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Jan 29 05:02:06 UTC 2024

Modified Files:
src/sys/dev/pci: if_wm.c if_wmreg.h

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.794 -r1.795 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.130 -r1.131 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: src/sys/dev/pci

2024-01-28 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Jan 29 05:02:06 UTC 2024

Modified Files:
src/sys/dev/pci: if_wm.c if_wmreg.h

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.794 -r1.795 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.130 -r1.131 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.794 src/sys/dev/pci/if_wm.c:1.795
--- src/sys/dev/pci/if_wm.c:1.794	Fri Jan 26 03:23:36 2024
+++ src/sys/dev/pci/if_wm.c	Mon Jan 29 05:02:06 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.794 2024/01/26 03:23:36 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.795 2024/01/29 05:02:06 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.794 2024/01/26 03:23:36 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.795 2024/01/29 05:02:06 msaitoh 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,8 @@ wm_update_stats(struct wm_softc *sc)
 	struct ifnet *ifp = >sc_ethercom.ec_if;
 	uint64_t crcerrs, algnerrc, symerrc, mpc, colc,  sec, rlec, rxerrc,
 	cexterr;
+	uint64_t total_qdrop = 0;
+	int i;
 
 	crcerrs = CSR_READ(sc, WMREG_CRCERRS);
 	symerrc = CSR_READ(sc, WMREG_SYMERRC);
@@ -6787,6 +6789,20 @@ wm_update_stats(struct wm_softc *sc)
 		WM_EVCNT_ADD(>sc_ev_lenerrs, CSR_READ(sc, WMREG_LENERRS));
 		WM_EVCNT_ADD(>sc_ev_scvpc, CSR_READ(sc, WMREG_SCVPC));
 		WM_EVCNT_ADD(>sc_ev_hrmpc, CSR_READ(sc, WMREG_HRMPC));
+		for (i = 0; i < sc->sc_nqueues; i++) {
+			struct wm_rxqueue *rxq = >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;
+		}
 	}
 	if ((sc->sc_type >= WM_T_I350) && !WM_IS_ICHPCH(sc)) {
 		WM_EVCNT_ADD(>sc_ev_tlpic, CSR_READ(sc, WMREG_TLPIC));
@@ -6815,7 +6831,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 +6849,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 +8213,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 +8267,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);

Index: src/sys/dev/pci/if_wmreg.h
diff -u src/sys/dev/pci/if_wmreg.h:1.130 src/sys/dev/pci/if_wmreg.h:1.131
--- src/sys/dev/pci/if_wmreg.h:1.130	Thu May 11 07:19:02 2023
+++ src/sys/dev/pci/if_wmreg.h	Mon Jan 29 05:02:06 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wmreg.h,v 1.130 2023/05/11 07:19:02 msaitoh Exp $	*/
+/*	$NetBSD: if_wmreg.h,v 1.131 2024/01/29 05:02:06 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -857,6 +857,9 @@ struct livengood_tcpip_ctxdesc {
 #define	RXDCTL_QUEUE_ENABLE  0x0200 /* Enable specific Tx Queue */
 #define	RXDCTL_SWFLSH0x0400 /* Rx Desc. write-back flushing */
 
+#define	WMREG_RQDPC(x)	(((x) < 4) ? (0x2830 + (0x100 * (x))) :		\
+	(0xc030 + (0x40 * (x /* Receive Queue Drop 

CVS commit: src/sys/dev/pci

2024-01-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Jan 29 01:05:55 UTC 2024

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

Log Message:
agp_i810(4): Use ipi(9) for chipset flush on all CPUs, not xcall(9).

i915 now calls into this with a spin lock held, so we have to use
ipi(9), which spin-waits for the other CPUs to complete, rather than
xcall(9), which may sleep-wait.

Fortunately, this is just to execute WBINVD on x86 (and if this code
ever runs on other architectures, which it probably doesn't, it'll be
a similar barrier instruction), so spinning to wait for that on all
CPUs isn't too costly.

PR kern/57878

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 src/sys/dev/pci/agp_i810.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/agp_i810.c
diff -u src/sys/dev/pci/agp_i810.c:1.125 src/sys/dev/pci/agp_i810.c:1.126
--- src/sys/dev/pci/agp_i810.c:1.125	Sun Jul 17 10:10:45 2022
+++ src/sys/dev/pci/agp_i810.c	Mon Jan 29 01:05:55 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: agp_i810.c,v 1.125 2022/07/17 10:10:45 riastradh Exp $	*/
+/*	$NetBSD: agp_i810.c,v 1.126 2024/01/29 01:05:55 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2000 Doug Rabson
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: agp_i810.c,v 1.125 2022/07/17 10:10:45 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: agp_i810.c,v 1.126 2024/01/29 01:05:55 riastradh Exp $");
 
 #include 
 #include 
@@ -180,7 +180,7 @@ agp_i810_post_gtt_entry(struct agp_i810_
 }
 
 static void
-agp_flush_cache_xc(void *a __unused, void *b __unused)
+agp_flush_cache_ipi(void *cookie __unused)
 {
 
 	agp_flush_cache();
@@ -204,11 +204,19 @@ agp_i810_chipset_flush(struct agp_i810_s
 		 * XXX Come to think of it, do these chipsets appear in
 		 * any multi-CPU systems?
 		 */
-		if (cold)
+		if (cold) {
 			agp_flush_cache();
-		else
-			xc_wait(xc_broadcast(0, _flush_cache_xc,
-NULL, NULL));
+		} else {
+			/*
+			 * Caller may hold a spin lock, so use ipi(9)
+			 * rather than xcall(9) here.
+			 */
+			ipi_msg_t msg = { .func = agp_flush_cache_ipi };
+			kpreempt_disable();
+			ipi_broadcast(, /*skip_self*/false);
+			ipi_wait();
+			kpreempt_enable();
+		}
 		WRITE4(AGP_I830_HIC, READ4(AGP_I830_HIC) | __BIT(31));
 		while (ISSET(READ4(AGP_I830_HIC), __BIT(31))) {
 			if (timo-- == 0)



CVS commit: src/sys/dev/pci

2024-01-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Jan 29 01:05:55 UTC 2024

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

Log Message:
agp_i810(4): Use ipi(9) for chipset flush on all CPUs, not xcall(9).

i915 now calls into this with a spin lock held, so we have to use
ipi(9), which spin-waits for the other CPUs to complete, rather than
xcall(9), which may sleep-wait.

Fortunately, this is just to execute WBINVD on x86 (and if this code
ever runs on other architectures, which it probably doesn't, it'll be
a similar barrier instruction), so spinning to wait for that on all
CPUs isn't too costly.

PR kern/57878

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 src/sys/dev/pci/agp_i810.c

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



CVS commit: src/sys/dev/pci

2024-01-25 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Jan 26 03:23:36 UTC 2024

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

Log Message:
wm(4): Print RX packet buffer size.


To generate a diff of this commit:
cvs rdiff -u -r1.793 -r1.794 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.793 src/sys/dev/pci/if_wm.c:1.794
--- src/sys/dev/pci/if_wm.c:1.793	Thu Jan 18 03:16:44 2024
+++ src/sys/dev/pci/if_wm.c	Fri Jan 26 03:23:36 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.793 2024/01/18 03:16:44 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.794 2024/01/26 03:23:36 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.793 2024/01/18 03:16:44 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.794 2024/01/26 03:23:36 msaitoh 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.
 	 *



CVS commit: src/sys/dev/pci

2024-01-25 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Jan 26 03:23:36 UTC 2024

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

Log Message:
wm(4): Print RX packet buffer size.


To generate a diff of this commit:
cvs rdiff -u -r1.793 -r1.794 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: src/sys/dev/pci/igc

2024-01-24 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Jan 25 05:48:56 UTC 2024

Modified Files:
src/sys/dev/pci/igc: if_igc.c

Log Message:
igc(4): Count iqdrops.

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


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/pci/igc/if_igc.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/igc/if_igc.c
diff -u src/sys/dev/pci/igc/if_igc.c:1.9 src/sys/dev/pci/igc/if_igc.c:1.10
--- src/sys/dev/pci/igc/if_igc.c:1.9	Wed Dec 20 18:09:19 2023
+++ src/sys/dev/pci/igc/if_igc.c	Thu Jan 25 05:48:56 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_igc.c,v 1.9 2023/12/20 18:09:19 skrll Exp $	*/
+/*	$NetBSD: if_igc.c,v 1.10 2024/01/25 05:48:56 msaitoh 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.9 2023/12/20 18:09:19 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_igc.c,v 1.10 2024/01/25 05:48:56 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_if_igc.h"
@@ -1116,11 +1116,35 @@ igc_update_counters(struct igc_softc *sc
 
 	/* Mac statistics */
 	struct igc_hw *hw = >hw;
+	struct ifnet *ifp = >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
 }
 



CVS commit: src/sys/dev/pci/igc

2024-01-24 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Jan 25 05:48:56 UTC 2024

Modified Files:
src/sys/dev/pci/igc: if_igc.c

Log Message:
igc(4): Count iqdrops.

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


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/pci/igc/if_igc.c

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



CVS commit: src/sys/dev/pci/ixgbe

2024-01-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Jan 24 05:18:59 UTC 2024

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

Log Message:
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.348 -r1.349 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.348 src/sys/dev/pci/ixgbe/ixgbe.c:1.349
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.348	Wed Nov 15 03:50:22 2023
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Wed Jan 24 05:18:59 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.348 2023/11/15 03:50:22 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.349 2024/01/24 05:18:59 msaitoh Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.348 2023/11/15 03:50:22 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.349 2024/01/24 05:18:59 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1637,7 +1637,7 @@ ixgbe_update_stats_counters(struct ixgbe
 	struct ixgbe_hw	  *hw = >hw;
 	struct ixgbe_hw_stats *stats = >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(>qbrc[i],
 			IXGBE_READ_REG(hw, IXGBE_QBRC_L(i)) +
 			((u64)IXGBE_READ_REG(hw, IXGBE_QBRC_H(i)) << 32));
 			IXGBE_EVC_ADD(>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(>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: src/sys/dev/pci/ixgbe

2024-01-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Jan 24 05:18:59 UTC 2024

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

Log Message:
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.348 -r1.349 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: src/sys/dev/pci

2024-01-17 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Jan 18 03:47:26 UTC 2024

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

Log Message:
rge(4): Print HW revision.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/pci/if_rge.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_rge.c
diff -u src/sys/dev/pci/if_rge.c:1.30 src/sys/dev/pci/if_rge.c:1.31
--- src/sys/dev/pci/if_rge.c:1.30	Thu Dec 21 08:50:22 2023
+++ src/sys/dev/pci/if_rge.c	Thu Jan 18 03:47:26 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_rge.c,v 1.30 2023/12/21 08:50:22 skrll Exp $	*/
+/*	$NetBSD: if_rge.c,v 1.31 2024/01/18 03:47:26 msaitoh Exp $	*/
 /*	$OpenBSD: if_rge.c,v 1.9 2020/12/12 11:48:53 jan Exp $	*/
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_rge.c,v 1.30 2023/12/21 08:50:22 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_rge.c,v 1.31 2024/01/18 03:47:26 msaitoh Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_net_mpsafe.h"
@@ -198,6 +198,7 @@ rge_attach(device_t parent, device_t sel
 	uint8_t eaddr[ETHER_ADDR_LEN];
 	int offset;
 	pcireg_t command;
+	const char *revstr;
 
 	pci_set_powerstate(pa->pa_pc, pa->pa_tag, PCI_PMCSR_STATE_D0);
 
@@ -269,21 +270,26 @@ rge_attach(device_t parent, device_t sel
 	switch (hwrev) {
 	case 0x6080:
 		sc->rge_type = MAC_CFG2;
+		revstr = "Z1";
 		break;
 	case 0x6090:
 		sc->rge_type = MAC_CFG3;
+		revstr = "Z2";
 		break;
 	case 0x6400:
 		sc->rge_type = MAC_CFG4;
+		revstr = "A";
 		break;
 	case 0x6410:
 		sc->rge_type = MAC_CFG5;
+		revstr = "B";
 		break;
 	default:
 		aprint_error(": unknown version 0x%08x\n", hwrev);
 		return;
 	}
 
+	aprint_normal_dev(sc->sc_dev, "HW rev. %s\n", revstr);
 	rge_config_imtype(sc, RGE_IMTYPE_SIM);
 
 	/*



CVS commit: src/sys/dev/pci

2024-01-17 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Jan 18 03:47:26 UTC 2024

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

Log Message:
rge(4): Print HW revision.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/pci/if_rge.c

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



CVS commit: src/sys/dev/pci

2024-01-17 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Jan 18 03:16:44 UTC 2024

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

Log Message:
Add Intel I219-{LM,V}(20,21) support.


To generate a diff of this commit:
cvs rdiff -u -r1.792 -r1.793 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: src/sys/dev/pci

2024-01-17 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Jan 18 03:16:44 UTC 2024

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

Log Message:
Add Intel I219-{LM,V}(20,21) support.


To generate a diff of this commit:
cvs rdiff -u -r1.792 -r1.793 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.792 src/sys/dev/pci/if_wm.c:1.793
--- src/sys/dev/pci/if_wm.c:1.792	Tue Nov 21 23:09:40 2023
+++ src/sys/dev/pci/if_wm.c	Thu Jan 18 03:16:44 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.792 2023/11/21 23:09:40 gutteridge Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.793 2024/01/18 03:16:44 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.792 2023/11/21 23:09:40 gutteridge Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.793 2024/01/18 03:16:44 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_if_wm.h"
@@ -1752,6 +1752,12 @@ static const struct wm_product {
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_LM19,
 	  "I219 LM (19) Ethernet Connection",
 	  WM_T_PCH_TGP,		WMP_F_COPPER }, /* MTP */
+	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_LM20,
+	  "I219 LM (20) Ethernet Connection",
+	  WM_T_PCH_TGP,		WMP_F_COPPER }, /* MTP */
+	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_LM21,
+	  "I219 LM (21) Ethernet Connection",
+	  WM_T_PCH_TGP,		WMP_F_COPPER }, /* MTP */
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_LM22,
 	  "I219 LM (22) Ethernet Connection",
 	  WM_T_PCH_TGP,		WMP_F_COPPER }, /* ADP(RPL) */
@@ -1812,6 +1818,12 @@ static const struct wm_product {
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_V19,
 	  "I219 V (19) Ethernet Connection",
 	  WM_T_PCH_TGP,		WMP_F_COPPER }, /* MTP */
+	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_V20,
+	  "I219 V (20) Ethernet Connection",
+	  WM_T_PCH_TGP,		WMP_F_COPPER }, /* MTP */
+	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_V21,
+	  "I219 V (21) Ethernet Connection",
+	  WM_T_PCH_TGP,		WMP_F_COPPER }, /* MTP */
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I219_V22,
 	  "I219 V (22) Ethernet Connection",
 	  WM_T_PCH_TGP,		WMP_F_COPPER }, /* ADP(RPL) */



CVS commit: src/sys/dev/pci

2024-01-17 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Jan 18 03:15:54 UTC 2024

Modified Files:
src/sys/dev/pci: pcidevs.h pcidevs_data.h

Log Message:
regen.


To generate a diff of this commit:
cvs rdiff -u -r1.1481 -r1.1482 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1480 -r1.1481 src/sys/dev/pci/pcidevs_data.h

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-01-17 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Jan 18 03:15:27 UTC 2024

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
Add Intel I219-{LM,V}(20,21)


To generate a diff of this commit:
cvs rdiff -u -r1.1501 -r1.1502 src/sys/dev/pci/pcidevs

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/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1501 src/sys/dev/pci/pcidevs:1.1502
--- src/sys/dev/pci/pcidevs:1.1501	Thu Dec 28 09:43:57 2023
+++ src/sys/dev/pci/pcidevs	Thu Jan 18 03:15:26 2024
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1501 2023/12/28 09:43:57 msaitoh Exp $
+$NetBSD: pcidevs,v 1.1502 2024/01/18 03:15:26 msaitoh Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -6307,6 +6307,10 @@ product INTEL I219_LM18		0x550a	I219-LM 
 product INTEL I219_V18		0x550b	I219-V (18) Ethernet Connection
 product INTEL I219_LM19		0x550c	I219-LM (19) Ethernet Connection
 product INTEL I219_V19		0x550d	I219-V (19) Ethernet Connection
+product INTEL I219_LM20		0x550e	I219-LM (20) Ethernet Connection
+product INTEL I219_V20		0x550f	I219-V (20) Ethernet Connection
+product INTEL I219_LM21		0x5510	I219-LM (21) Ethernet Connection
+product INTEL I219_V21		0x5511	I219-V (21) Ethernet Connection
 product INTEL CORE7G_H_M_D_HOST_DRAM 0x5900 Core 7G (H, Mobile, Dual) Host Bridge, DRAM
 product INTEL CORE7G_PCIE_X16	0x5901	Core 7G PCIe x16
 product INTEL CORE7G_S_GT1	0x5902	HD Graphics 610 (GT1)



CVS commit: src/sys/dev/pci

2024-01-17 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Jan 18 03:15:27 UTC 2024

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
Add Intel I219-{LM,V}(20,21)


To generate a diff of this commit:
cvs rdiff -u -r1.1501 -r1.1502 src/sys/dev/pci/pcidevs

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-01-08 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Mon Jan  8 18:38:25 UTC 2024

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

Log Message:
ips: fix a couple more device_t/softc split bugs


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/pci/ips.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/ips.c
diff -u src/sys/dev/pci/ips.c:1.6 src/sys/dev/pci/ips.c:1.7
--- src/sys/dev/pci/ips.c:1.6	Sat Feb 12 02:58:50 2022
+++ src/sys/dev/pci/ips.c	Mon Jan  8 18:38:25 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: ips.c,v 1.6 2022/02/12 02:58:50 riastradh Exp $	*/
+/*	$NetBSD: ips.c,v 1.7 2024/01/08 18:38:25 chs Exp $	*/
 /*	$OpenBSD: ips.c,v 1.113 2016/08/14 04:08:03 dlg Exp $	*/
 
 /*-
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ips.c,v 1.6 2022/02/12 02:58:50 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ips.c,v 1.7 2024/01/08 18:38:25 chs Exp $");
 
 #include "bio.h"
 
@@ -458,7 +458,7 @@ struct ips_softc {
 };
 
 int	ips_match(device_t, cfdata_t, void *);
-void	ips_attach(struct device *, struct device *, void *);
+void	ips_attach(device_t, device_t, void *);
 
 void	ips_scsi_cmd(struct ips_ccb *);
 void	ips_scsi_pt_cmd(struct scsipi_xfer *);
@@ -617,9 +617,9 @@ ips_match(device_t parent, cfdata_t cfda
 }
 
 void
-ips_attach(struct device *parent, struct device *self, void *aux)
+ips_attach(device_t parent, device_t self, void *aux)
 {
-	struct ips_softc *sc = (struct ips_softc *)self;
+	struct ips_softc *sc = device_private(self);
 	struct pci_attach_args *pa = aux;
 	struct ips_ccb ccb0;
 	struct ips_adapterinfo *ai;
@@ -1042,7 +1042,7 @@ ips_scsi_ioctl(struct scsipi_channel *ch
 int
 ips_ioctl(device_t dev, u_long cmd, void *data)
 {
-	struct ips_softc *sc = (struct ips_softc *)dev;
+	struct ips_softc *sc = device_private(dev);
 
 	DPRINTF(IPS_D_INFO, ("%s: ips_ioctl: cmd %lu\n",
 	device_xname(sc->sc_dev), cmd));
@@ -1086,7 +1086,7 @@ ips_ioctl_vol(struct ips_softc *sc, stru
 	struct ips_rblstat *rblstat = >sc_info->rblstat;
 	struct ips_ld *ld;
 	int vid = bv->bv_volid;
-	struct device *dv;
+	device_t dv;
 	int error, rebuild = 0;
 	u_int32_t total = 0, done = 0;
 



CVS commit: src/sys/dev/pci

2024-01-08 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Mon Jan  8 18:38:25 UTC 2024

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

Log Message:
ips: fix a couple more device_t/softc split bugs


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

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



CVS commit: src/sys/dev/pci

2024-01-08 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Mon Jan  8 18:37:24 UTC 2024

Modified Files:
src/sys/dev/pci: cmpci.c fms.c sv.c yds.c

Log Message:
mpu / opl: add an interface attribute to config_found() calls for these

specify an interface attribute when attaching mpu and opl devices.
the PCI devices that are the parents of these midi devices
(cmpci, eso, fms, sv, yds) have two interface attributes:
"audiobus", and also one named the same as the parent device,
eg. "cmpci" has an interface attribute named "cmpci".
we must specify the latter one to attach these children.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/sys/dev/pci/cmpci.c
cvs rdiff -u -r1.49 -r1.50 src/sys/dev/pci/fms.c
cvs rdiff -u -r1.61 -r1.62 src/sys/dev/pci/sv.c
cvs rdiff -u -r1.68 -r1.69 src/sys/dev/pci/yds.c

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



CVS commit: src/sys/dev/pci

2024-01-08 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Mon Jan  8 18:37:24 UTC 2024

Modified Files:
src/sys/dev/pci: cmpci.c fms.c sv.c yds.c

Log Message:
mpu / opl: add an interface attribute to config_found() calls for these

specify an interface attribute when attaching mpu and opl devices.
the PCI devices that are the parents of these midi devices
(cmpci, eso, fms, sv, yds) have two interface attributes:
"audiobus", and also one named the same as the parent device,
eg. "cmpci" has an interface attribute named "cmpci".
we must specify the latter one to attach these children.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/sys/dev/pci/cmpci.c
cvs rdiff -u -r1.49 -r1.50 src/sys/dev/pci/fms.c
cvs rdiff -u -r1.61 -r1.62 src/sys/dev/pci/sv.c
cvs rdiff -u -r1.68 -r1.69 src/sys/dev/pci/yds.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/cmpci.c
diff -u src/sys/dev/pci/cmpci.c:1.60 src/sys/dev/pci/cmpci.c:1.61
--- src/sys/dev/pci/cmpci.c:1.60	Tue May 31 08:43:15 2022
+++ src/sys/dev/pci/cmpci.c	Mon Jan  8 18:37:24 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cmpci.c,v 1.60 2022/05/31 08:43:15 andvar Exp $	*/
+/*	$NetBSD: cmpci.c,v 1.61 2024/01/08 18:37:24 chs Exp $	*/
 
 /*
  * Copyright (c) 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -43,7 +43,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cmpci.c,v 1.60 2022/05/31 08:43:15 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cmpci.c,v 1.61 2024/01/08 18:37:24 chs Exp $");
 
 #if defined(AUDIO_DEBUG) || defined(DEBUG)
 #define DPRINTF(x) if (cmpcidebug) printf x
@@ -419,7 +419,7 @@ cmpci_attach(device_t parent, device_t s
 	aa.type = AUDIODEV_TYPE_OPL;
 	aa.hwif = NULL;
 	aa.hdl = NULL;
-	(void)config_found(sc->sc_dev, , audioprint, CFARGS_NONE);
+	(void)config_found(sc->sc_dev, , audioprint, CFARGS(.iattr = "cmpci"));
 
 	/* attach MPU-401 device */
 	aa.type = AUDIODEV_TYPE_MPU;
@@ -428,7 +428,7 @@ cmpci_attach(device_t parent, device_t s
 	if (bus_space_subregion(sc->sc_iot, sc->sc_ioh,
 	CMPCI_REG_MPU_BASE, CMPCI_REG_MPU_SIZE, >sc_mpu_ioh) == 0)
 		sc->sc_mpudev = config_found(sc->sc_dev, , audioprint,
-		CFARGS_NONE);
+		CFARGS(.iattr = "cmpci"));
 
 	/* get initial value (this is 0 and may be omitted but just in case) */
 	sc->sc_reg_misc = bus_space_read_4(sc->sc_iot, sc->sc_ioh,

Index: src/sys/dev/pci/fms.c
diff -u src/sys/dev/pci/fms.c:1.49 src/sys/dev/pci/fms.c:1.50
--- src/sys/dev/pci/fms.c:1.49	Sat Aug  7 16:19:14 2021
+++ src/sys/dev/pci/fms.c	Mon Jan  8 18:37:24 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: fms.c,v 1.49 2021/08/07 16:19:14 thorpej Exp $	*/
+/*	$NetBSD: fms.c,v 1.50 2024/01/08 18:37:24 chs Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fms.c,v 1.49 2021/08/07 16:19:14 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fms.c,v 1.50 2024/01/08 18:37:24 chs Exp $");
 
 #include "mpu.h"
 
@@ -325,12 +325,13 @@ fms_attach(device_t parent, device_t sel
 	aa.type = AUDIODEV_TYPE_OPL;
 	aa.hwif = NULL;
 	aa.hdl = NULL;
-	config_found(sc->sc_dev, , audioprint, CFARGS_NONE);
+	config_found(sc->sc_dev, , audioprint, CFARGS(.iattr = "fms"));
 
 	aa.type = AUDIODEV_TYPE_MPU;
 	aa.hwif = NULL;
 	aa.hdl = NULL;
-	sc->sc_mpu_dev = config_found(sc->sc_dev, , audioprint, CFARGS_NONE);
+	sc->sc_mpu_dev = config_found(sc->sc_dev, , audioprint,
+	CFARGS(.iattr = "fms"));
 }
 
 /*

Index: src/sys/dev/pci/sv.c
diff -u src/sys/dev/pci/sv.c:1.61 src/sys/dev/pci/sv.c:1.62
--- src/sys/dev/pci/sv.c:1.61	Sat Aug  7 16:19:14 2021
+++ src/sys/dev/pci/sv.c	Mon Jan  8 18:37:24 2024
@@ -1,4 +1,4 @@
-/*  $NetBSD: sv.c,v 1.61 2021/08/07 16:19:14 thorpej Exp $ */
+/*  $NetBSD: sv.c,v 1.62 2024/01/08 18:37:24 chs Exp $ */
 /*  $OpenBSD: sv.c,v 1.2 1998/07/13 01:50:15 csapuntz Exp $ */
 
 /*
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sv.c,v 1.61 2021/08/07 16:19:14 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sv.c,v 1.62 2024/01/08 18:37:24 chs Exp $");
 
 #include 
 #include 
@@ -449,7 +449,7 @@ sv_attach(device_t parent, device_t self
 	arg.type = AUDIODEV_TYPE_OPL;
 	arg.hwif = 0;
 	arg.hdl = 0;
-	(void)config_found(self, , audioprint, CFARGS_NONE);
+	(void)config_found(self, , audioprint, CFARGS(.iattr = "sv"));
 
 	sc->sc_pa = *pa;	/* for deferred setup */
 	config_defer(self, sv_defer);

Index: src/sys/dev/pci/yds.c
diff -u src/sys/dev/pci/yds.c:1.68 src/sys/dev/pci/yds.c:1.69
--- src/sys/dev/pci/yds.c:1.68	Sat Aug  7 16:19:14 2021
+++ src/sys/dev/pci/yds.c	Mon Jan  8 18:37:24 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: yds.c,v 1.68 2021/08/07 16:19:14 thorpej Exp $	*/
+/*	$NetBSD: yds.c,v 1.69 2024/01/08 18:37:24 chs Exp $	*/
 
 /*
  * Copyright (c) 2000, 2001 Kazuki Sakamoto and Minoura Makoto.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: yds.c,v 1.68 2021/08/07 16:19:14 thorpej Exp $");

CVS commit: src/sys/dev/pci/ixgbe

2023-12-29 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sat Dec 30 06:16:44 UTC 2023

Modified Files:
src/sys/dev/pci/ixgbe: ix_txrx.c ixgbe.h

Log Message:
ixgbe: Use #ifdef RSC

 This feature (hardware receive side coalescing) has been disabled all along,
so enclose the code with #ifdef RSC.


To generate a diff of this commit:
cvs rdiff -u -r1.115 -r1.116 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.97 -r1.98 src/sys/dev/pci/ixgbe/ixgbe.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/ixgbe/ix_txrx.c
diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.115 src/sys/dev/pci/ixgbe/ix_txrx.c:1.116
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.115	Fri Dec 29 07:36:47 2023
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Sat Dec 30 06:16:44 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.115 2023/12/29 07:36:47 msaitoh Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.116 2023/12/30 06:16:44 msaitoh Exp $ */
 
 /**
 
@@ -64,13 +64,14 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.115 2023/12/29 07:36:47 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.116 2023/12/30 06:16:44 msaitoh Exp $");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
 
 #include "ixgbe.h"
 
+#ifdef RSC
 /*
  * HW RSC control:
  *  this feature only works with
@@ -84,6 +85,7 @@ __KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 
  *  to enable.
  */
 static bool ixgbe_rsc_enable = FALSE;
+#endif
 
 #ifdef IXGBE_FDIR
 /*
@@ -124,8 +126,9 @@ static __inline void ixgbe_rx_input(stru
 static int   ixgbe_dma_malloc(struct ixgbe_softc *, bus_size_t,
   struct ixgbe_dma_alloc *, int);
 static void  ixgbe_dma_free(struct ixgbe_softc *, struct ixgbe_dma_alloc *);
-
+#ifdef RSC
 static void	 ixgbe_setup_hw_rsc(struct rx_ring *);
+#endif
 
 /
  * ixgbe_legacy_start_locked - Transmit entry point
@@ -1258,6 +1261,7 @@ ixgbe_txeof(struct tx_ring *txr)
 	return ((limit > 0) ? false : true);
 } /* ixgbe_txeof */
 
+#ifdef RSC
 /
  * ixgbe_rsc_count
  *
@@ -1334,6 +1338,7 @@ ixgbe_setup_hw_rsc(struct rx_ring *rxr)
 
 	rxr->hw_rsc = TRUE;
 } /* ixgbe_setup_hw_rsc */
+#endif
 
 /
  * ixgbe_refresh_mbufs
@@ -1596,10 +1601,15 @@ ixgbe_setup_receive_ring(struct rx_ring 
 	/*
 	 * Now set up the LRO interface
 	 */
+#ifdef RSC
 	if (ixgbe_rsc_enable)
 		ixgbe_setup_hw_rsc(rxr);
+#endif
 #ifdef LRO
-	else if (ifp->if_capenable & IFCAP_LRO) {
+#ifdef RSC
+	else
+#endif
+	if (ifp->if_capenable & IFCAP_LRO) {
 		device_t dev = sc->dev;
 		int err = tcp_lro_init(lro);
 		if (err) {
@@ -1867,7 +1877,10 @@ ixgbe_rxeof(struct ix_queue *que)
 
 		struct mbuf *sendmp, *mp;
 		struct mbuf *newmp;
-		u32 rsc, ptype;
+#ifdef RSC
+		u32 rsc;
+#endif
+		u32 ptype;
 		u16 len;
 		u16 vtag = 0;
 		booleop;
@@ -1902,7 +1915,9 @@ ixgbe_rxeof(struct ix_queue *que)
 		loopcount++;
 		sendmp = newmp = NULL;
 		nbuf = NULL;
+#ifdef RSC
 		rsc = 0;
+#endif
 		cur->wb.upper.status_error = 0;
 		rbuf = >rx_buffers[i];
 		mp = rbuf->buf;
@@ -1988,6 +2003,7 @@ ixgbe_rxeof(struct ix_queue *que)
 			 * Figure out the next descriptor
 			 * of this frame.
 			 */
+#ifdef RSC
 			if (rxr->hw_rsc == TRUE) {
 rsc = ixgbe_rsc_count(cur);
 rxr->rsc_num += (rsc - 1);
@@ -1995,7 +2011,9 @@ ixgbe_rxeof(struct ix_queue *que)
 			if (rsc) { /* Get hardware index */
 nextp = ((staterr & IXGBE_RXDADV_NEXTP_MASK) >>
 IXGBE_RXDADV_NEXTP_SHIFT);
-			} else { /* Just sequential */
+			} else
+#endif
+			{ /* Just sequential */
 nextp = i + 1;
 if (nextp == sc->num_rx_desc)
 	nextp = 0;

Index: src/sys/dev/pci/ixgbe/ixgbe.h
diff -u src/sys/dev/pci/ixgbe/ixgbe.h:1.97 src/sys/dev/pci/ixgbe/ixgbe.h:1.98
--- src/sys/dev/pci/ixgbe/ixgbe.h:1.97	Sat Dec 30 06:16:03 2023
+++ src/sys/dev/pci/ixgbe/ixgbe.h	Sat Dec 30 06:16:44 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.h,v 1.97 2023/12/30 06:16:03 msaitoh Exp $ */
+/* $NetBSD: ixgbe.h,v 1.98 2023/12/30 06:16:44 msaitoh Exp $ */
 
 /**
   SPDX-License-Identifier: BSD-3-Clause
@@ -415,7 +415,9 @@ struct rx_ring {
 	struct lro_ctrl		lro;
 	bool			lro_enabled;
 #endif /* LRO */
+#ifdef RSC
 	bool			hw_rsc;
+#endif
 	bool			vtag_strip;
 	bool			discard_multidesc;
 	u16			next_to_refresh;
@@ -437,7 +439,9 @@ struct rx_ring {
 	struct evcnt		rx_bytes;
 	struct evcnt		rx_discarded;
 	struct evcnt		no_mbuf;
+#ifdef RSC
 	u64			rsc_num;
+#endif
 };
 
 struct ixgbe_vf {



CVS commit: src/sys/dev/pci/ixgbe

2023-12-29 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sat Dec 30 06:16:44 UTC 2023

Modified Files:
src/sys/dev/pci/ixgbe: ix_txrx.c ixgbe.h

Log Message:
ixgbe: Use #ifdef RSC

 This feature (hardware receive side coalescing) has been disabled all along,
so enclose the code with #ifdef RSC.


To generate a diff of this commit:
cvs rdiff -u -r1.115 -r1.116 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.97 -r1.98 src/sys/dev/pci/ixgbe/ixgbe.h

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/ixgbe

2023-12-29 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sat Dec 30 06:16:03 UTC 2023

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe.h

Log Message:
ixgbe: Change "me" from 32bit to 8bit because the max is 128.

 This commit doesn't change the real size of ix_queue, tx_ring and rx_ring
because of the alignment.


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/sys/dev/pci/ixgbe/ixgbe.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/ixgbe/ixgbe.h
diff -u src/sys/dev/pci/ixgbe/ixgbe.h:1.96 src/sys/dev/pci/ixgbe/ixgbe.h:1.97
--- src/sys/dev/pci/ixgbe/ixgbe.h:1.96	Fri Dec 29 07:36:47 2023
+++ src/sys/dev/pci/ixgbe/ixgbe.h	Sat Dec 30 06:16:03 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.h,v 1.96 2023/12/29 07:36:47 msaitoh Exp $ */
+/* $NetBSD: ixgbe.h,v 1.97 2023/12/30 06:16:03 msaitoh Exp $ */
 
 /**
   SPDX-License-Identifier: BSD-3-Clause
@@ -325,7 +325,7 @@ struct ix_queue {
 	struct ixgbe_softc *sc;
 	u32  msix;   /* This queue's MSI-X vector */
 	u32  eitr_setting;
-	u32  me;
+	u8   me;
 	struct resource  *res;
 	int  busy;
 	struct tx_ring   *txr;
@@ -357,7 +357,7 @@ struct ix_queue {
 struct tx_ring {
 	struct ixgbe_softc	*sc;
 	kmutex_t		tx_mtx;
-	u32			me;
+	u8			me;
 	u32			tail;
 	int			busy;
 	union ixgbe_adv_tx_desc	*tx_base;
@@ -407,7 +407,7 @@ struct tx_ring {
 struct rx_ring {
 	struct ixgbe_softc	*sc;
 	kmutex_t		rx_mtx;
-	u32			me;
+	u8			me;
 	u32			tail;
 	union ixgbe_adv_rx_desc	*rx_base;
 	struct ixgbe_dma_alloc	rxdma;



CVS commit: src/sys/dev/pci/ixgbe

2023-12-29 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sat Dec 30 06:16:03 UTC 2023

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe.h

Log Message:
ixgbe: Change "me" from 32bit to 8bit because the max is 128.

 This commit doesn't change the real size of ix_queue, tx_ring and rx_ring
because of the alignment.


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/sys/dev/pci/ixgbe/ixgbe.h

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/ixgbe

2023-12-28 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Dec 29 07:36:47 UTC 2023

Modified Files:
src/sys/dev/pci/ixgbe: ix_txrx.c ixgbe.h

Log Message:
ixgbe: Use #ifdef LRO more to reduce the size of struct rx_ring.


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.95 -r1.96 src/sys/dev/pci/ixgbe/ixgbe.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/ixgbe/ix_txrx.c
diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.114 src/sys/dev/pci/ixgbe/ix_txrx.c:1.115
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.114	Thu Dec 28 10:13:51 2023
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Fri Dec 29 07:36:47 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.114 2023/12/28 10:13:51 msaitoh Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.115 2023/12/29 07:36:47 msaitoh Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.114 2023/12/28 10:13:51 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.115 2023/12/29 07:36:47 msaitoh Exp $");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -1577,7 +1577,9 @@ ixgbe_setup_receive_ring(struct rx_ring 
 	/* Setup our descriptor indices */
 	rxr->next_to_check = 0;
 	rxr->next_to_refresh = sc->num_rx_desc - 1; /* Fully allocated */
+#ifdef LRO
 	rxr->lro_enabled = FALSE;
+#endif
 	rxr->discard_multidesc = false;
 	IXGBE_EVC_STORE(>rx_copies, 0);
 #if 0 /* NetBSD */

Index: src/sys/dev/pci/ixgbe/ixgbe.h
diff -u src/sys/dev/pci/ixgbe/ixgbe.h:1.95 src/sys/dev/pci/ixgbe/ixgbe.h:1.96
--- src/sys/dev/pci/ixgbe/ixgbe.h:1.95	Fri Dec 29 07:34:20 2023
+++ src/sys/dev/pci/ixgbe/ixgbe.h	Fri Dec 29 07:36:47 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.h,v 1.95 2023/12/29 07:34:20 msaitoh Exp $ */
+/* $NetBSD: ixgbe.h,v 1.96 2023/12/29 07:36:47 msaitoh Exp $ */
 
 /**
   SPDX-License-Identifier: BSD-3-Clause
@@ -413,8 +413,8 @@ struct rx_ring {
 	struct ixgbe_dma_alloc	rxdma;
 #ifdef LRO
 	struct lro_ctrl		lro;
-#endif /* LRO */
 	bool			lro_enabled;
+#endif /* LRO */
 	bool			hw_rsc;
 	bool			vtag_strip;
 	bool			discard_multidesc;



CVS commit: src/sys/dev/pci/ixgbe

2023-12-28 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Dec 29 07:36:47 UTC 2023

Modified Files:
src/sys/dev/pci/ixgbe: ix_txrx.c ixgbe.h

Log Message:
ixgbe: Use #ifdef LRO more to reduce the size of struct rx_ring.


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.95 -r1.96 src/sys/dev/pci/ixgbe/ixgbe.h

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/ixgbe

2023-12-28 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Dec 29 07:34:20 UTC 2023

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe.h

Log Message:
ixgbe: Remove unused to reduce the size of struct rx_ring.


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/sys/dev/pci/ixgbe/ixgbe.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/ixgbe/ixgbe.h
diff -u src/sys/dev/pci/ixgbe/ixgbe.h:1.94 src/sys/dev/pci/ixgbe/ixgbe.h:1.95
--- src/sys/dev/pci/ixgbe/ixgbe.h:1.94	Thu Dec 28 10:02:14 2023
+++ src/sys/dev/pci/ixgbe/ixgbe.h	Fri Dec 29 07:34:20 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.h,v 1.94 2023/12/28 10:02:14 msaitoh Exp $ */
+/* $NetBSD: ixgbe.h,v 1.95 2023/12/29 07:34:20 msaitoh Exp $ */
 
 /**
   SPDX-License-Identifier: BSD-3-Clause
@@ -438,9 +438,6 @@ struct rx_ring {
 	struct evcnt		rx_discarded;
 	struct evcnt		no_mbuf;
 	u64			rsc_num;
-
-	/* Flow Director */
-	u64			flm;
 };
 
 struct ixgbe_vf {



CVS commit: src/sys/dev/pci/ixgbe

2023-12-28 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Dec 29 07:34:20 UTC 2023

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe.h

Log Message:
ixgbe: Remove unused to reduce the size of struct rx_ring.


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/sys/dev/pci/ixgbe/ixgbe.h

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/ixgbe

2023-12-28 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Dec 28 10:13:51 UTC 2023

Modified Files:
src/sys/dev/pci/ixgbe: ix_txrx.c

Log Message:
ixgbe: Use kmem_zalloc() instead of malloc(,M_ZERO).


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/sys/dev/pci/ixgbe/ix_txrx.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/ix_txrx.c
diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.113 src/sys/dev/pci/ixgbe/ix_txrx.c:1.114
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.113	Thu Dec 28 10:05:18 2023
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Thu Dec 28 10:13:51 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.113 2023/12/28 10:05:18 msaitoh Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.114 2023/12/28 10:13:51 msaitoh Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.113 2023/12/28 10:05:18 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.114 2023/12/28 10:13:51 msaitoh Exp $");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -626,8 +626,8 @@ ixgbe_allocate_transmit_buffers(struct t
 		goto fail;
 	}
 
-	txr->tx_buffers = malloc(sizeof(struct ixgbe_tx_buf) *
-	sc->num_tx_desc, M_DEVBUF, M_WAITOK | M_ZERO);
+	txr->tx_buffers = kmem_zalloc(sizeof(struct ixgbe_tx_buf) *
+	sc->num_tx_desc, KM_SLEEP);
 
 	/* Create the descriptor buffer dma maps */
 	txbuf = txr->tx_buffers;
@@ -758,7 +758,7 @@ ixgbe_free_transmit_structures(struct ix
 		ixgbe_dma_free(sc, >txdma);
 		IXGBE_TX_LOCK_DESTROY(txr);
 	}
-	free(sc->tx_rings, M_DEVBUF);
+	kmem_free(sc->tx_rings, sizeof(struct tx_ring) * sc->num_queues);
 } /* ixgbe_free_transmit_structures */
 
 /
@@ -806,7 +806,8 @@ ixgbe_free_transmit_buffers(struct tx_ri
 		pcq_destroy(txr->txr_interq);
 	}
 	if (txr->tx_buffers != NULL) {
-		free(txr->tx_buffers, M_DEVBUF);
+		kmem_free(txr->tx_buffers,
+		sizeof(struct ixgbe_tx_buf) * sc->num_tx_desc);
 		txr->tx_buffers = NULL;
 	}
 	if (txr->txtag != NULL) {
@@ -1427,7 +1428,7 @@ ixgbe_allocate_receive_buffers(struct rx
 	int bsize, error;
 
 	bsize = sizeof(struct ixgbe_rx_buf) * rxr->num_desc;
-	rxr->rx_buffers = malloc(bsize, M_DEVBUF, M_WAITOK | M_ZERO);
+	rxr->rx_buffers = kmem_zalloc(bsize, KM_SLEEP);
 
 	error = ixgbe_dma_tag_create(
 	 /*  parent */ sc->osdep.dmat,
@@ -1673,7 +1674,7 @@ ixgbe_free_receive_structures(struct ixg
 		IXGBE_RX_LOCK_DESTROY(rxr);
 	}
 
-	free(sc->rx_rings, M_DEVBUF);
+	kmem_free(sc->rx_rings, sizeof(struct rx_ring) * sc->num_queues);
 } /* ixgbe_free_receive_structures */
 
 
@@ -1700,7 +1701,8 @@ ixgbe_free_receive_buffers(struct rx_rin
 		}
 
 		if (rxr->rx_buffers != NULL) {
-			free(rxr->rx_buffers, M_DEVBUF);
+			kmem_free(rxr->rx_buffers,
+			sizeof(struct ixgbe_rx_buf) * rxr->num_desc);
 			rxr->rx_buffers = NULL;
 		}
 	}
@@ -2341,16 +2343,16 @@ ixgbe_allocate_queues(struct ixgbe_softc
 	int txconf = 0, rxconf = 0;
 
 	/* First, allocate the top level queue structs */
-	sc->queues = (struct ix_queue *)malloc(sizeof(struct ix_queue) *
-	sc->num_queues, M_DEVBUF, M_WAITOK | M_ZERO);
+	sc->queues = kmem_zalloc(sizeof(struct ix_queue) * sc->num_queues,
+	KM_SLEEP);
 
 	/* Second, allocate the TX ring struct memory */
-	sc->tx_rings = malloc(sizeof(struct tx_ring) *
-	sc->num_queues, M_DEVBUF, M_WAITOK | M_ZERO);
+	sc->tx_rings = kmem_zalloc(sizeof(struct tx_ring) * sc->num_queues,
+	KM_SLEEP);
 
 	/* Third, allocate the RX ring */
-	sc->rx_rings = (struct rx_ring *)malloc(sizeof(struct rx_ring) *
-	sc->num_queues, M_DEVBUF, M_WAITOK | M_ZERO);
+	sc->rx_rings = kmem_zalloc(sizeof(struct rx_ring) * sc->num_queues,
+	KM_SLEEP);
 
 	/* For the ring itself */
 	tsize = sc->num_tx_desc * sizeof(union ixgbe_adv_tx_desc);
@@ -2469,9 +2471,9 @@ err_rx_desc:
 err_tx_desc:
 	for (txr = sc->tx_rings; txconf > 0; txr++, txconf--)
 		ixgbe_dma_free(sc, >txdma);
-	free(sc->rx_rings, M_DEVBUF);
-	free(sc->tx_rings, M_DEVBUF);
-	free(sc->queues, M_DEVBUF);
+	kmem_free(sc->rx_rings, sizeof(struct rx_ring) * sc->num_queues);
+	kmem_free(sc->tx_rings, sizeof(struct tx_ring) * sc->num_queues);
+	kmem_free(sc->queues, sizeof(struct ix_queue) * sc->num_queues);
 	return (error);
 } /* ixgbe_allocate_queues */
 
@@ -2493,5 +2495,5 @@ ixgbe_free_queues(struct ixgbe_softc *sc
 		que = >queues[i];
 		mutex_destroy(>dc_mtx);
 	}
-	free(sc->queues, M_DEVBUF);
+	kmem_free(sc->queues, sizeof(struct ix_queue) * sc->num_queues);
 } /* ixgbe_free_queues */



CVS commit: src/sys/dev/pci/ixgbe

2023-12-28 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Dec 28 10:13:51 UTC 2023

Modified Files:
src/sys/dev/pci/ixgbe: ix_txrx.c

Log Message:
ixgbe: Use kmem_zalloc() instead of malloc(,M_ZERO).


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

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



CVS commit: src/sys/dev/pci/ixgbe

2023-12-28 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Dec 28 10:05:18 UTC 2023

Modified Files:
src/sys/dev/pci/ixgbe: ix_txrx.c

Log Message:
ixgbe: Simplify. No functional change.

 The descriptor ring size and the alignment are tested in the attach
function, so it's not required to use roundup2(size, DBA_ALIGN).


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/sys/dev/pci/ixgbe/ix_txrx.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/ix_txrx.c
diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.112 src/sys/dev/pci/ixgbe/ix_txrx.c:1.113
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.112	Thu Dec 28 10:02:14 2023
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Thu Dec 28 10:05:18 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.112 2023/12/28 10:02:14 msaitoh Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.113 2023/12/28 10:05:18 msaitoh Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.112 2023/12/28 10:02:14 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.113 2023/12/28 10:05:18 msaitoh Exp $");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -1505,8 +1505,8 @@ ixgbe_setup_receive_ring(struct rx_ring 
 		slot = netmap_reset(na, NR_RX, rxr->me, 0);
 #endif /* DEV_NETMAP */
 
-	rsize = roundup2(sc->num_rx_desc *
-	sizeof(union ixgbe_adv_rx_desc), DBA_ALIGN);
+	rsize = sc->num_rx_desc * sizeof(union ixgbe_adv_rx_desc);
+	KASSERT((rsize % DBA_ALIGN) == 0);
 	bzero((void *)rxr->rx_base, rsize);
 	/* Cache the size */
 	rxr->mbuf_sz = sc->rx_mbuf_sz;
@@ -2353,8 +2353,8 @@ ixgbe_allocate_queues(struct ixgbe_softc
 	sc->num_queues, M_DEVBUF, M_WAITOK | M_ZERO);
 
 	/* For the ring itself */
-	tsize = roundup2(sc->num_tx_desc * sizeof(union ixgbe_adv_tx_desc),
-	DBA_ALIGN);
+	tsize = sc->num_tx_desc * sizeof(union ixgbe_adv_tx_desc);
+	KASSERT((tsize % DBA_ALIGN) == 0);
 
 	/*
 	 * Now set up the TX queues, txconf is needed to handle the
@@ -2410,8 +2410,8 @@ ixgbe_allocate_queues(struct ixgbe_softc
 	/*
 	 * Next the RX queues...
 	 */
-	rsize = roundup2(sc->num_rx_desc * sizeof(union ixgbe_adv_rx_desc),
-	DBA_ALIGN);
+	rsize = sc->num_rx_desc * sizeof(union ixgbe_adv_rx_desc);
+	KASSERT((rsize % DBA_ALIGN) == 0);
 	for (int i = 0; i < sc->num_queues; i++, rxconf++) {
 		rxr = >rx_rings[i];
 		/* Set up some basics */



CVS commit: src/sys/dev/pci/ixgbe

2023-12-28 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Dec 28 10:05:18 UTC 2023

Modified Files:
src/sys/dev/pci/ixgbe: ix_txrx.c

Log Message:
ixgbe: Simplify. No functional change.

 The descriptor ring size and the alignment are tested in the attach
function, so it's not required to use roundup2(size, DBA_ALIGN).


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

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



CVS commit: src/sys/dev/pci/ixgbe

2023-12-28 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Dec 28 10:02:14 UTC 2023

Modified Files:
src/sys/dev/pci/ixgbe: ix_txrx.c ixgbe.h

Log Message:
ixgbe: Use #ifdef IXGBE_FDIR more

 Don't include the Flow Director related members to reduce the size of
struct tx_ring. On amd64 and aarch64, the real size is not changed
because of the alignment.


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.112 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.93 -r1.94 src/sys/dev/pci/ixgbe/ixgbe.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/ixgbe/ix_txrx.c
diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.111 src/sys/dev/pci/ixgbe/ix_txrx.c:1.112
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.111	Wed Dec 13 08:25:54 2023
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Thu Dec 28 10:02:14 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.111 2023/12/13 08:25:54 msaitoh Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.112 2023/12/28 10:02:14 msaitoh Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.111 2023/12/13 08:25:54 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.112 2023/12/28 10:02:14 msaitoh Exp $");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -85,6 +85,7 @@ __KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 
  */
 static bool ixgbe_rsc_enable = FALSE;
 
+#ifdef IXGBE_FDIR
 /*
  * For Flow Director: this is the
  * number of TX packets we sample
@@ -95,6 +96,7 @@ static bool ixgbe_rsc_enable = FALSE;
  * setting this to 0.
  */
 static int atr_sample_rate = 20;
+#endif
 
 #define IXGBE_M_ADJ(sc, rxr, mp)	\
 	if (sc->max_frame_size <= (rxr->mbuf_sz - ETHER_ALIGN))	\
@@ -715,9 +717,11 @@ ixgbe_setup_transmit_ring(struct tx_ring
 		txbuf->eop = NULL;
 	}
 
+#ifdef IXGBE_FDIR
 	/* Set the rate at which we sample packets */
 	if (sc->feat_en & IXGBE_FEATURE_FDIR)
 		txr->atr_sample = atr_sample_rate;
+#endif
 
 	/* Set number of descriptors available */
 	txr->tx_avail = sc->num_tx_desc;

Index: src/sys/dev/pci/ixgbe/ixgbe.h
diff -u src/sys/dev/pci/ixgbe/ixgbe.h:1.93 src/sys/dev/pci/ixgbe/ixgbe.h:1.94
--- src/sys/dev/pci/ixgbe/ixgbe.h:1.93	Thu Oct 12 08:06:13 2023
+++ src/sys/dev/pci/ixgbe/ixgbe.h	Thu Dec 28 10:02:14 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.h,v 1.93 2023/10/12 08:06:13 msaitoh Exp $ */
+/* $NetBSD: ixgbe.h,v 1.94 2023/12/28 10:02:14 msaitoh Exp $ */
 
 /**
   SPDX-License-Identifier: BSD-3-Clause
@@ -376,9 +376,11 @@ struct tx_ring {
 	void			*txr_si;
 	bool			txr_no_space; /* Like IFF_OACTIVE */
 
+#ifdef IXGBE_FDIR
 	/* Flow Director */
 	u16			atr_sample;
 	u16			atr_count;
+#endif
 
 	u64			bytes;  /* Used for AIM */
 	u64			packets;



CVS commit: src/sys/dev/pci/ixgbe

2023-12-28 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Dec 28 10:02:14 UTC 2023

Modified Files:
src/sys/dev/pci/ixgbe: ix_txrx.c ixgbe.h

Log Message:
ixgbe: Use #ifdef IXGBE_FDIR more

 Don't include the Flow Director related members to reduce the size of
struct tx_ring. On amd64 and aarch64, the real size is not changed
because of the alignment.


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.112 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.93 -r1.94 src/sys/dev/pci/ixgbe/ixgbe.h

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

2023-12-28 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Dec 28 09:46:13 UTC 2023

Modified Files:
src/sys/dev/pci: pcidevs.h pcidevs_data.h

Log Message:
pcidevs: Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.1480 -r1.1481 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1479 -r1.1480 src/sys/dev/pci/pcidevs_data.h

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

2023-12-28 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Dec 28 09:43:58 UTC 2023

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
Update Intel Raptor Lake devices.


To generate a diff of this commit:
cvs rdiff -u -r1.1500 -r1.1501 src/sys/dev/pci/pcidevs

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

2023-12-28 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Dec 28 09:43:58 UTC 2023

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
Update Intel Raptor Lake devices.


To generate a diff of this commit:
cvs rdiff -u -r1.1500 -r1.1501 src/sys/dev/pci/pcidevs

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/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1500 src/sys/dev/pci/pcidevs:1.1501
--- src/sys/dev/pci/pcidevs:1.1500	Thu Dec 28 09:42:39 2023
+++ src/sys/dev/pci/pcidevs	Thu Dec 28 09:43:57 2023
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1500 2023/12/28 09:42:39 msaitoh Exp $
+$NetBSD: pcidevs,v 1.1501 2023/12/28 09:43:57 msaitoh Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -5963,7 +5963,7 @@ product INTEL ADL_U15_2_4_HOST	0x4609	Al
 product INTEL ADL_U9_2_4_HOST	0x460a	Alder Lake (U9,2+4) Host
 product INTEL ADL_PCIE_RP_0	0x460d	Alder Lake PCIe G5 Root Port 0 (x16)
 product INTEL ADL_XDCI		0x460e	Alder Lake USB-C Device (xDCI)
-product INTEL ADL_S_2_0_HOST	0x4610	Alder Lake (S,2+0) Host
+product INTEL ADL_S_2_0_HOST	0x4610	Alder Lake Refresh (S,2+0) Host
 product INTEL ADL_N_8_HOST	0x4617	Alder Lake-N (0+8) Host
 product INTEL ADL_U15_1_4_HOST	0x4619	Alder Lake (U15,1+4) Host
 product INTEL ADL_U9_1_4_HOST	0x461a	Alder Lake (U9,1+4) Host
@@ -5985,7 +5985,9 @@ product INTEL ADL_HX_6_8_HOST	0x463b	Ald
 product INTEL ADL_PCIE_RP_3	0x463d	Alder Lake PCIe G4 Root Port 3 (x4)
 product INTEL ADL_TBTDMA_0	0x463e	Alder Lake Thunderbolt DMA 0
 product INTEL ADL_TBT_PCIE_1	0x463f	Alder Lake Thunderbolt PCIe 1
+product INTEL RPL_S_6_8_HOST_2	0x4640	Raptor Lake (S,6+8) Host
 product INTEL ADL_H_6_8_HOST	0x4641	Alder Lake (H,6+8) Host
+product INTEL RPL_HX_6_4_HOST_2	0x4647	Raptor Lake (HX,6+4) Host
 product INTEL ADL_S_6_4_HOST	0x4648	Alder Lake (S,6+4) Host
 product INTEL ADL_H_6_4_HOST	0x4649	Alder Lake (H,6+4) Host
 product INTEL ADL_PCIE_RP_2	0x464d	Alder Lake PCIe G4 Root Port 2 (x4)
@@ -7436,7 +7438,12 @@ product INTEL RPL_S_6_4_HOST	0xa705	Rapt
 product INTEL RPL_H_6_8_HOST	0xa706	Raptor Lake (H,6+8) Host
 product INTEL RPL_H_4_8_HOST	0xa707	Raptor Lake (H,4+8) Host
 product INTEL RPL_U_2_8_HOST	0xa708	Raptor Lake (U,2+8) Host
+product INTEL RPL_PX_6_8_HOST	0xa709	Raptor Lake (PX,6+8) Host
+product INTEL RPL_PX_4_8_HOST	0xa70a	Raptor Lake (PX,4+8) Host
 product INTEL RPL_PCIE_RP_0	0xa70d	Raptor Lake PCIe G5 Root Port 0 (x16)
+product INTEL RPL_E_8_0_HOST	0xa711	Raptor Lake (E,8+0) Host
+product INTEL RPL_E_6_0_HOST	0xa712	Raptor Lake (E,6+0) Host
+product INTEL RPL_E_4_0_HOST	0xa713	Raptor Lake (E,4+0) Host
 product INTEL RPL_H_4_4_HOST	0xa716	Raptor Lake (H,4+4) Host
 product INTEL RPL_HX_6_4_HOST	0xa719	Raptor Lake (HX,6+4) Host
 product INTEL RPL_U_2_4_HOST	0xa71b	Raptor Lake (U,2+4) Host
@@ -7448,6 +7455,7 @@ product INTEL RPL_HX_8_12_HOST	0xa729	Ra
 product INTEL RPL_HX_6_8_HOST	0xa72a	Raptor Lake (HX,6+8) Host
 product INTEL RPL_PCIE_RP_1	0xa72d	Raptor Lake PCIe G5 Root Port 1 (x8)
 product INTEL RPL_TBTDMA_0	0xa73e	Raptor Lake Thunderbolt DMA 0
+product INTEL RPL_S_8_12_HOST	0xa740	Raptor Lake Refresh (S,8+12) Host
 product INTEL RPL_PCIE_RP_2	0xa74d	Raptor Lake PCIe G4 Root Port 2 (x4)
 product INTEL RPL_GNA		0xa74f	Raptor Lake Gauss Newton Algorithm
 product INTEL RPL_TBTDMA_1	0xa76d	Raptor Lake Thunderbolt DMA 1



  1   2   3   4   5   6   7   8   9   10   >