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

2021-08-18 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Aug 18 09:17:17 UTC 2021

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

Log Message:
 Refresh unrefreshed descriptors' buffers correctly.

- Update next_to_refresh at least before ixgbe_rx_unrefresed() to detect
  the unrefreshed status correctly in ixgbe_rxeof().
- next_to_refresh points to the previous entry of the first unrefreshed
  descriptor, so fix a loop variable to point to the correct one in
  ixgbe_refresh_mbufs().
- Without the above two fixes, RX ring may have some unrefreshed entries
  which have inconsistent state. On such state, "ifconfig down up" causes
  panic in bus_dmamap_sync() on aarch64.
- Tested on amd64 and aarch64. OK'd by knakahara.


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 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.81 src/sys/dev/pci/ixgbe/ix_txrx.c:1.82
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.81	Wed Jul  7 08:58:19 2021
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Wed Aug 18 09:17:17 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.81 2021/07/07 08:58:19 msaitoh Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.82 2021/08/18 09:17:17 msaitoh Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.81 2021/07/07 08:58:19 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.82 2021/08/18 09:17:17 msaitoh Exp $");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -1336,15 +1336,15 @@ ixgbe_refresh_mbufs(struct rx_ring *rxr,
 	struct adapter  *adapter = rxr->adapter;
 	struct ixgbe_rx_buf *rxbuf;
 	struct mbuf *mp;
-	int i, j, error;
+	int i, error;
 	boolrefreshed = false;
 
-	i = j = rxr->next_to_refresh;
-	/* Control the loop with one beyond */
-	if (++j == rxr->num_desc)
-		j = 0;
+	i = rxr->next_to_refresh;
+	/* next_to_refresh points to the previous one */
+	if (++i == rxr->num_desc)
+		i = 0;
 
-	while (j != limit) {
+	while (i != limit) {
 		rxbuf = >rx_buffers[i];
 		if (rxbuf->buf == NULL) {
 			mp = ixgbe_getjcl(>jcl_head, M_NOWAIT,
@@ -1387,11 +1387,10 @@ ixgbe_refresh_mbufs(struct rx_ring *rxr,
 		}
 
 		refreshed = true;
-		/* Next is precalculated */
-		i = j;
+		/* next_to_refresh points to the previous one */
 		rxr->next_to_refresh = i;
-		if (++j == rxr->num_desc)
-			j = 0;
+		if (++i == rxr->num_desc)
+			i = 0;
 	}
 
 update:
@@ -2090,6 +2089,7 @@ next_desc:
 		/* Advance our pointers to the next descriptor. */
 		if (++i == rxr->num_desc)
 			i = 0;
+		rxr->next_to_check = i;
 
 		/* Now send to the stack or do LRO */
 		if (sendmp != NULL) {
@@ -2107,8 +2107,6 @@ next_desc:
 	if (ixgbe_rx_unrefreshed(rxr))
 		ixgbe_refresh_mbufs(rxr, i);
 
-	rxr->next_to_check = i;
-
 	IXGBE_RX_UNLOCK(rxr);
 
 #ifdef LRO



CVS commit: src/sys/dev/pci

2021-08-17 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Aug 17 17:16:40 UTC 2021

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

Log Message:
s/Windw/Window/ in log message.


To generate a diff of this commit:
cvs rdiff -u -r1.227 -r1.228 src/sys/dev/pci/pci_subr.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/pci_subr.c
diff -u src/sys/dev/pci/pci_subr.c:1.227 src/sys/dev/pci/pci_subr.c:1.228
--- src/sys/dev/pci/pci_subr.c:1.227	Mon Jul 12 04:41:14 2021
+++ src/sys/dev/pci/pci_subr.c	Tue Aug 17 17:16:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_subr.c,v 1.227 2021/07/12 04:41:14 msaitoh Exp $	*/
+/*	$NetBSD: pci_subr.c,v 1.228 2021/08/17 17:16:40 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.227 2021/07/12 04:41:14 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.228 2021/08/17 17:16:40 andvar Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -3539,7 +3539,7 @@ pci_conf_print_multicast_cap(const pcire
 	/* Endpoint Only */
 	n = PCIREG_SHIFTOUT(reg, PCI_MCAST_CAP_WINSIZEREQ);
 	if (n > 0)
-		printf("  Windw Size Requested: %d\n", 1 << (n - 1));
+		printf("  Window Size Requested: %d\n", 1 << (n - 1));
 
 	onoff("ECRC Regeneration Supported", reg, PCI_MCAST_CAP_ECRCREGEN);
 



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

2021-08-08 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Aug  8 20:57:09 UTC 2021

Modified Files:
src/sys/dev/pci/cxgb: cxgb_offload.c

Log Message:
s/propely/properly/


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/pci/cxgb/cxgb_offload.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/cxgb/cxgb_offload.c
diff -u src/sys/dev/pci/cxgb/cxgb_offload.c:1.6 src/sys/dev/pci/cxgb/cxgb_offload.c:1.7
--- src/sys/dev/pci/cxgb/cxgb_offload.c:1.6	Fri Dec 27 09:22:20 2019
+++ src/sys/dev/pci/cxgb/cxgb_offload.c	Sun Aug  8 20:57:09 2021
@@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE.
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cxgb_offload.c,v 1.6 2019/12/27 09:22:20 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cxgb_offload.c,v 1.7 2021/08/08 20:57:09 andvar Exp $");
 
 #include 
 #include 
@@ -516,7 +516,7 @@ cxgb_insert_tid(struct toedev *tdev, str
 }
 
 /*
- * Populate a TID_RELEASE WR.  The mbuf must be already propely sized.
+ * Populate a TID_RELEASE WR.  The mbuf must be already properly sized.
  */
 static inline void
 mk_tid_release(struct mbuf *m, unsigned int tid)



CVS commit: src/sys/dev/pci

2021-08-08 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sun Aug  8 12:17:37 UTC 2021

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

Log Message:
radeonfb: use BUS_SPACE_MAP_PREFETCHABLE for the framebuffer mapping

Makes the driver work on cia(4) based alpha machines, which can only
do dense access to linear mappings with prefetch. ok macallan@


To generate a diff of this commit:
cvs rdiff -u -r1.116 -r1.117 src/sys/dev/pci/radeonfb.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/radeonfb.c
diff -u src/sys/dev/pci/radeonfb.c:1.116 src/sys/dev/pci/radeonfb.c:1.117
--- src/sys/dev/pci/radeonfb.c:1.116	Sat Aug  7 16:19:14 2021
+++ src/sys/dev/pci/radeonfb.c	Sun Aug  8 12:17:37 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: radeonfb.c,v 1.116 2021/08/07 16:19:14 thorpej Exp $ */
+/*	$NetBSD: radeonfb.c,v 1.117 2021/08/08 12:17:37 tnn Exp $ */
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.116 2021/08/07 16:19:14 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.117 2021/08/08 12:17:37 tnn Exp $");
 
 #include 
 #include 
@@ -799,7 +799,8 @@ radeonfb_attach(device_t parent, device_
 
 	sc->sc_memt = pa->pa_memt;
 	if (bus_space_map(sc->sc_memt, sc->sc_memaddr, sc->sc_memsz,
-		BUS_SPACE_MAP_LINEAR, >sc_memh) != 0) {
+		BUS_SPACE_MAP_LINEAR | BUS_SPACE_MAP_PREFETCHABLE,
+		>sc_memh) != 0) {
 		sc->sc_memsz = 0;
 		aprint_error("%s: Unable to map frame buffer\n", XNAME(sc));
 		goto error;
@@ -1098,7 +1099,8 @@ radeonfb_map(struct radeonfb_softc *sc)
 			return;
 		}
 		if (bus_space_map(sc->sc_memt, sc->sc_memaddr, sc->sc_memsz,
-		BUS_SPACE_MAP_LINEAR, >sc_memh) != 0) {
+		BUS_SPACE_MAP_LINEAR | BUS_SPACE_MAP_PREFETCHABLE,
+		>sc_memh) != 0) {
 			sc->sc_memsz = 0;
 			aprint_error_dev(sc->sc_dev,
 			"Unable to map frame buffer\n");



CVS commit: src/sys/dev/pci

2021-08-02 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Tue Aug  3 01:08:18 UTC 2021

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

Log Message:
Fix locking against myself reported by rin@n.o.

In some machine, INTx interrupts occurs for some reason while holding
txq_lock in softint context.
e.g. https://dmesgd.nycbug.org/index.cgi?do=view=6139

The panic message is the following.

[  50.1699480] panic: LOCKDEBUG: Mutex error: mutex_vector_enter,467: locking 
against myself
[  50.1800188] cpu0: Begin traceback...
[  50.1800188] 0xc7a29ac4: netbsd:db_panic+0xc
[  50.1900018] 0xc7a29adc: netbsd:vpanic+0x120
[  50.1999533] 0xc7a29af4: netbsd:aprint_debug
[  50.1999533] 0xc7a29b34: netbsd:lockdebug_abort1+0x18c
[  50.2099719] 0xc7a29b74: netbsd:lockdebug_wantlock+0x1e8
[  50.2199525] 0xc7a29bb4: netbsd:mutex_enter+0x288
[  50.2299642] 0xc7a29be4: netbsd:wm_intr_legacy+0x9c
[  50.2299642] 0xc7a29c2c: netbsd:i80321_intr_dispatch+0x138
[  50.2399631] 0xc7a29de4: netbsd:irq_entry+0x98
[  50.2499452] 0xc7a29e24: netbsd:entropy_enter+0x88
[  50.256] 0xc7a29e6c: netbsd:rnd_add_data_1+0x50
[  50.2699565] 0xc7a29ebc: netbsd:rnd_add_data+0x10c
[  50.2699565] 0xc7a29ed4: netbsd:rnd_add_uint32+0x28
[  50.2799524] 0xc7a29f1c: netbsd:wm_txeof+0x2c0
[  50.2899527] 0xc7a29f5c: netbsd:wm_handle_queue+0x44
[  50.3000257] 0xc7a29fac: netbsd:softint_thread+0x130
[  50.3100119] cpu0: End traceback...


To fix this panic, stop wm(4) interrupts before calling softint.
This behavior is similar to MSI-X polling mode.

Reviewed by msaitoh@n.o, tested by rin@n.o, thanks.


To generate a diff of this commit:
cvs rdiff -u -r1.705 -r1.706 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.705 src/sys/dev/pci/if_wm.c:1.706
--- src/sys/dev/pci/if_wm.c:1.705	Wed Jun 16 00:21:18 2021
+++ src/sys/dev/pci/if_wm.c	Tue Aug  3 01:08:18 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.705 2021/06/16 00:21:18 riastradh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.706 2021/08/03 01:08:18 knakahara Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.705 2021/06/16 00:21:18 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.706 2021/08/03 01:08:18 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -9774,6 +9774,20 @@ wm_sched_handle_queue(struct wm_softc *s
 		softint_schedule(wmq->wmq_si);
 }
 
+static inline void
+wm_legacy_intr_disable(struct wm_softc *sc)
+{
+
+	CSR_WRITE(sc, WMREG_IMC, 0xU);
+}
+
+static inline void
+wm_legacy_intr_enable(struct wm_softc *sc)
+{
+
+	CSR_WRITE(sc, WMREG_IMS, sc->sc_icr);
+}
+
 /*
  * wm_intr_legacy:
  *
@@ -9788,6 +9802,7 @@ wm_intr_legacy(void *arg)
 	struct wm_rxqueue *rxq = >wmq_rxq;
 	uint32_t icr, rndval = 0;
 	int handled = 0;
+	bool more = false;
 
 	while (1 /* CONSTCOND */) {
 		icr = CSR_READ(sc, WMREG_ICR);
@@ -9822,7 +9837,7 @@ wm_intr_legacy(void *arg)
 		 * as if_percpuq_enqueue() just call softint_schedule().
 		 * So, we can call wm_rxeof() in interrupt context.
 		 */
-		wm_rxeof(rxq, UINT_MAX);
+		more = wm_rxeof(rxq, UINT_MAX);
 
 		mutex_exit(rxq->rxq_lock);
 		mutex_enter(txq->txq_lock);
@@ -9840,7 +9855,7 @@ wm_intr_legacy(void *arg)
 			WM_Q_EVCNT_INCR(txq, txdw);
 		}
 #endif
-		wm_txeof(txq, UINT_MAX);
+		more |= wm_txeof(txq, UINT_MAX);
 
 		mutex_exit(txq->txq_lock);
 		WM_CORE_LOCK(sc);
@@ -9869,8 +9884,9 @@ wm_intr_legacy(void *arg)
 
 	rnd_add_uint32(>rnd_source, rndval);
 
-	if (handled) {
+	if (more) {
 		/* Try to get more packets going. */
+		wm_legacy_intr_disable(sc);
 		wmq->wmq_txrx_use_workqueue = sc->sc_txrx_use_workqueue;
 		wm_sched_handle_queue(sc, wmq);
 	}
@@ -9883,6 +9899,10 @@ wm_txrxintr_disable(struct wm_queue *wmq
 {
 	struct wm_softc *sc = wmq->wmq_txq.txq_sc;
 
+	if (__predict_false(!wm_is_using_msix(sc))) {
+		return wm_legacy_intr_disable(sc);
+	}
+
 	if (sc->sc_type == WM_T_82574)
 		CSR_WRITE(sc, WMREG_IMC,
 		ICR_TXQ(wmq->wmq_id) | ICR_RXQ(wmq->wmq_id));
@@ -9900,6 +9920,10 @@ wm_txrxintr_enable(struct wm_queue *wmq)
 
 	wm_itrs_calculate(sc, wmq);
 
+	if (__predict_false(!wm_is_using_msix(sc))) {
+		return wm_legacy_intr_enable(sc);
+	}
+
 	/*
 	 * ICR_OTHER which is disabled in wm_linkintr_msix() is enabled here.
 	 * There is no need to care about which of RXQ(0) and RXQ(1) enable



CVS commit: src/sys/dev/pci

2021-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jul 17 10:45:58 UTC 2021

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

Log Message:
puc(4): Add Intel Core 5G (mobile) KT.


To generate a diff of this commit:
cvs rdiff -u -r1.109 -r1.110 src/sys/dev/pci/pucdata.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/pucdata.c
diff -u src/sys/dev/pci/pucdata.c:1.109 src/sys/dev/pci/pucdata.c:1.110
--- src/sys/dev/pci/pucdata.c:1.109	Tue Feb  2 16:11:43 2021
+++ src/sys/dev/pci/pucdata.c	Sat Jul 17 10:45:58 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pucdata.c,v 1.109 2021/02/02 16:11:43 bouyer Exp $	*/
+/*	$NetBSD: pucdata.c,v 1.110 2021/07/17 10:45:58 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1998, 1999 Christopher G. Demetriou.  All rights reserved.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pucdata.c,v 1.109 2021/02/02 16:11:43 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pucdata.c,v 1.110 2021/07/17 10:45:58 riastradh Exp $");
 
 #include 
 #include 
@@ -2046,6 +2046,15 @@ const struct puc_device_description puc_
 	},
 	},
 
+	/* Intel Core 5G (mobile) KT */
+	{   "Intel Core 5G (mobile) KT",
+	{	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE5G_M_KT, 0, 0 },
+	{	0x,	0x,	0,	0	},
+	{
+		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x00, COM_FREQ },
+	},
+	},
+
 	/* Intel EG20T UART */
 	{   "Intel EG20T UART #0",
 	{	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EG20T_UART_0, 0, 0 },



CVS commit: src/sys/dev/pci

2021-07-17 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Jul 17 07:11:36 UTC 2021

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

Log Message:
add current generation NVIDIA graphics cards (3050-3090 etc.)


To generate a diff of this commit:
cvs rdiff -u -r1.1427 -r1.1428 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.1427 src/sys/dev/pci/pcidevs:1.1428
--- src/sys/dev/pci/pcidevs:1.1427	Mon Jul 12 12:58:57 2021
+++ src/sys/dev/pci/pcidevs	Sat Jul 17 07:11:35 2021
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1427 2021/07/12 12:58:57 msaitoh Exp $
+$NetBSD: pcidevs,v 1.1428 2021/07/17 07:11:35 mrg Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -7182,6 +7182,44 @@ product NVIDIA	TESLA_V100PCI16	0x1db4 	T
 product NVIDIA	TESLA_V100SXM32	0x1db5 	Tesla V100 SXM2 32GB
 product NVIDIA 	TESLA_V100PCI32	0x1db6 	Tesla V100 PCIe 32GB
 product NVIDIA	QUADRO_GV100	0x1dba 	Quadro GV100
+product NVIDIA	TITAN_RTX	0x1e02 	TITAN RTX
+product NVIDIA	GF_GTX2080_Ti	0x1e04 	GeForce GTX 2080 Ti
+product NVIDIA	GF_GTX2080_Ti_2	0x1e07 	GeForce GTX 2080 Ti
+product NVIDIA	QUADRO_RTX_8000	0x1e30 	Quadro RTX 8000 / 6000
+product NVIDIA	QUADRO_RTX_6000	0x1e3c 	Quadro RTX 6000
+product NVIDIA	GF_GTX2080	0x1e82 	GeForce GTX 2080
+product NVIDIA	GF_GTX2080_2	0x1e87 	GeForce GTX 2080
+product NVIDIA	GF_GTX2060	0x1e89 	GeForce GTX 2060
+product NVIDIA	GF_GTX2080_M	0x1e90 	GeForce GTX 2080 Mobile
+product NVIDIA	QUADRO_RTX_5000	0x1eb0 	Quadro RTX 5000
+product NVIDIA	QUADRO_RTX_4000	0x1eb1 	Quadro RTX 4000
+product NVIDIA	GF_GTX2080_M2	0x1ed0 	GeForce GTX 2080 Mobile
+product NVIDIA	GF_GTX2070	0x1f02 	GeForce GTX 2070
+product NVIDIA	GF_GTX2070_2	0x1f07 	GeForce GTX 2070
+product NVIDIA	GF_GTX2060_2	0x1f08 	GeForce GTX 2060
+product NVIDIA	GF_GTX2070_M	0x1f10 	GeForce GTX 2070 Mobile
+product NVIDIA	GF_GTX2060_M	0x1f11 	GeForce GTX 2060 Mobile
+product NVIDIA	GF_GTX2070_M2	0x1f50 	GeForce GTX 2070 Mobile
+product NVIDIA	GF_GTX2060_M2	0x1f51 	GeForce GTX 2060 Mobile
+product NVIDIA	GF_GTX1650	0x1f82 	GeForce GTX 1650
+product NVIDIA	GF_GTX1650_M	0x1f91 	GeForce GTX 1650 Mobile
+product NVIDIA	GF_GTX1660_Ti	0x2182 	GeForce GTX 1660 Ti
+product NVIDIA	GF_GTX1660	0x2184 	GeForce GTX 1660
+product NVIDIA	GF_GTX3090	0x2204 	GeForce GTX 3090
+product NVIDIA	GF_GTX3080_Ti	0x2205 	GeForce GTX 3080 Ti
+product NVIDIA	GF_GTX3080	0x2206 	GeForce GTX 3080
+product NVIDIA	RTX_A6000	0x2230 	RTX A6000
+product NVIDIA	RTX_A40		0x2235 	RTX A40
+product NVIDIA	GF_RTX3090_Ti	0x2482 	GeForce RTX 3070 Ti
+product NVIDIA	GF_RTX3070	0x2484 	GeForce RTX 3070
+product NVIDIA	GF_RTX3060_Ti	0x2486 	GeForce RTX 3060 Ti
+product NVIDIA	GF_RTX3070_MM	0x249c 	GeForce RTX 3070 Mobile / Max-Q
+product NVIDIA	GF_RTX3070_MM2	0x249d 	GeForce RTX 3070 Mobile / Max-Q
+product NVIDIA	GF_RTX3070_M	0x24dc 	GeForce RTX 3070 Mobile
+product NVIDIA	GF_RTX3070_MM3	0x24dd 	GeForce RTX 3070 Mobile / Max-Q
+product NVIDIA	GF_RTX3060	0x2501 	GeForce RTX 3060
+product NVIDIA	GF_RTX3060_MM	0x2520 	GeForce RTX 3060 Mobile / Max-Q
+product NVIDIA	GF_RTX3050	0x2283 	GeForce RTX 3050
 
 
 /* Nvidia & SGS-Thomson Microelectronics */



CVS commit: src/sys/dev/pci

2021-07-16 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Fri Jul 16 12:20:01 UTC 2021

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

Log Message:
Add missing RCSID, remove non-breaking space characters in copyright, remove 
vim modeline (from yambo in IRC).
ok riastradh


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/pci/xmm7360.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/xmm7360.c
diff -u src/sys/dev/pci/xmm7360.c:1.7 src/sys/dev/pci/xmm7360.c:1.8
--- src/sys/dev/pci/xmm7360.c:1.7	Sat Apr 24 23:36:57 2021
+++ src/sys/dev/pci/xmm7360.c	Fri Jul 16 12:20:01 2021
@@ -1,4 +1,5 @@
-// vim: noet ts=8 sts=8 sw=8
+/*	$NetBSD: xmm7360.c,v 1.8 2021/07/16 12:20:01 andvar Exp $	*/
+
 /*
  * Device driver for Intel XMM7360 LTE modems, eg. Fibocom L850-GL.
  * Written by James Wah
@@ -6,8 +7,8 @@
  *
  * Development of this driver was supported by genua GmbH
  *
- * Copyright (c) 2020 genua GmbH 
- * Copyright (c) 2020 James Wah 
+ * Copyright (c) 2020 genua GmbH 
+ * Copyright (c) 2020 James Wah 
  *
  * The OpenBSD and NetBSD support was written by Jaromir Dolecek for
  * Moritz Systems Technology Company Sp. z o.o.
@@ -74,7 +75,7 @@ MODULE_DEVICE_TABLE(pci, xmm7360_ids);
 #include "opt_gateway.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xmm7360.c,v 1.7 2021/04/24 23:36:57 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xmm7360.c,v 1.8 2021/07/16 12:20:01 andvar Exp $");
 #endif
 
 #include 



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

2021-07-15 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Jul 15 08:09:31 UTC 2021

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

Log Message:
 Add a new sysctl to read rxr->next_to_refresh.


To generate a diff of this commit:
cvs rdiff -u -r1.286 -r1.287 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.163 -r1.164 src/sys/dev/pci/ixgbe/ixv.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.286 src/sys/dev/pci/ixgbe/ixgbe.c:1.287
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.286	Wed Jul  7 08:58:19 2021
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Thu Jul 15 08:09:31 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.286 2021/07/07 08:58:19 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.287 2021/07/15 08:09:31 msaitoh Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.286 2021/07/07 08:58:19 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.287 2021/07/15 08:09:31 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -253,6 +253,7 @@ static int	ixgbe_sysctl_power_state(SYSC
 static int	ixgbe_sysctl_print_rss_config(SYSCTLFN_PROTO);
 #endif
 static int	ixgbe_sysctl_next_to_check_handler(SYSCTLFN_PROTO);
+static int	ixgbe_sysctl_next_to_refresh_handler(SYSCTLFN_PROTO);
 static int	ixgbe_sysctl_rdh_handler(SYSCTLFN_PROTO);
 static int	ixgbe_sysctl_rdt_handler(SYSCTLFN_PROTO);
 static int	ixgbe_sysctl_tdt_handler(SYSCTLFN_PROTO);
@@ -1930,6 +1931,13 @@ ixgbe_add_hw_stats(struct adapter *adapt
 			break;
 
 		if (sysctl_createv(log, 0, , ,
+		CTLFLAG_READONLY, CTLTYPE_INT, "rxd_nxrf",
+		SYSCTL_DESCR("Receive Descriptor next to refresh"),
+		ixgbe_sysctl_next_to_refresh_handler, 0, (void *)rxr, 0,
+		CTL_CREATE, CTL_EOL) != 0)
+			break;
+
+		if (sysctl_createv(log, 0, , ,
 		CTLFLAG_READONLY, CTLTYPE_INT, "rxd_head",
 		SYSCTL_DESCR("Receive Descriptor Head"),
 		ixgbe_sysctl_rdh_handler, 0, (void *)rxr, 0,
@@ -2302,6 +2310,32 @@ ixgbe_sysctl_next_to_check_handler(SYSCT
 } /* ixgbe_sysctl_next_to_check_handler */
 
 /
+ * ixgbe_sysctl_next_to_refresh_handler - Receive Descriptor next to check
+ * handler function
+ *
+ *   Retrieves the next_to_refresh value
+ /
+static int
+ixgbe_sysctl_next_to_refresh_handler(SYSCTLFN_ARGS)
+{
+	struct sysctlnode node = *rnode;
+	struct rx_ring *rxr = (struct rx_ring *)node.sysctl_data;
+	struct adapter *adapter;
+	uint32_t val;
+
+	if (!rxr)
+		return (0);
+
+	adapter = rxr->adapter;
+	if (ixgbe_fw_recovery_mode_swflag(adapter))
+		return (EPERM);
+
+	val = rxr->next_to_refresh;
+	node.sysctl_data = 
+	return sysctl_lookup(SYSCTLFN_CALL());
+} /* ixgbe_sysctl_next_to_refresh_handler */
+
+/
  * ixgbe_sysctl_rdh_handler - Receive Descriptor Head handler function
  *
  *   Retrieves the RDH value from the hardware

Index: src/sys/dev/pci/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.163 src/sys/dev/pci/ixgbe/ixv.c:1.164
--- src/sys/dev/pci/ixgbe/ixv.c:1.163	Wed Jul  7 08:58:19 2021
+++ src/sys/dev/pci/ixgbe/ixv.c	Thu Jul 15 08:09:31 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ixv.c,v 1.163 2021/07/07 08:58:19 msaitoh Exp $ */
+/* $NetBSD: ixv.c,v 1.164 2021/07/15 08:09:31 msaitoh Exp $ */
 
 /**
 
@@ -35,7 +35,7 @@
 /*$FreeBSD: head/sys/dev/ixgbe/if_ixv.c 331224 2018-03-19 20:55:05Z erj $*/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.163 2021/07/07 08:58:19 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.164 2021/07/15 08:09:31 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -144,6 +144,7 @@ static void	ixv_set_sysctl_value(struct 
 		const char *, int *, int);
 static int	ixv_sysctl_interrupt_rate_handler(SYSCTLFN_PROTO);
 static int	ixv_sysctl_next_to_check_handler(SYSCTLFN_PROTO);
+static int	ixv_sysctl_next_to_refresh_handler(SYSCTLFN_PROTO);
 static int	ixv_sysctl_rdh_handler(SYSCTLFN_PROTO);
 static int	ixv_sysctl_rdt_handler(SYSCTLFN_PROTO);
 static int	ixv_sysctl_tdt_handler(SYSCTLFN_PROTO);
@@ -2033,6 +2034,32 @@ ixv_sysctl_next_to_check_handler(SYSCTLF
 } /* ixv_sysctl_next_to_check_handler */
 
 /
+ * ixv_sysctl_next_to_refresh_handler - Receive Descriptor next to refresh
+ * handler function
+ *
+ *   Retrieves the next_to_refresh value
+ /
+static int
+ixv_sysctl_next_to_refresh_handler(SYSCTLFN_ARGS)
+{
+	struct sysctlnode node = *rnode;
+	struct rx_ring *rxr = (struct rx_ring 

CVS commit: src/sys/dev/pci

2021-07-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Jul 12 12:59:54 UTC 2021

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

Log Message:
 Add Jasper Lake support.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/dev/pci/ichsmb.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/ichsmb.c
diff -u src/sys/dev/pci/ichsmb.c:1.70 src/sys/dev/pci/ichsmb.c:1.71
--- src/sys/dev/pci/ichsmb.c:1.70	Sat Apr 24 23:36:57 2021
+++ src/sys/dev/pci/ichsmb.c	Mon Jul 12 12:59:54 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ichsmb.c,v 1.70 2021/04/24 23:36:57 thorpej Exp $	*/
+/*	$NetBSD: ichsmb.c,v 1.71 2021/07/12 12:59:54 msaitoh Exp $	*/
 /*	$OpenBSD: ichiic.c,v 1.44 2020/10/07 11:23:05 jsg Exp $	*/
 
 /*
@@ -22,7 +22,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ichsmb.c,v 1.70 2021/04/24 23:36:57 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ichsmb.c,v 1.71 2021/07/12 12:59:54 msaitoh Exp $");
 
 #include 
 #include 
@@ -135,6 +135,7 @@ ichsmb_match(device_t parent, cfdata_t m
 		case PCI_PRODUCT_INTEL_BSW_PCU_SMB:
 		case PCI_PRODUCT_INTEL_APL_SMB:
 		case PCI_PRODUCT_INTEL_GLK_SMB:
+		case PCI_PRODUCT_INTEL_JSL_SMB:
 		case PCI_PRODUCT_INTEL_C600_SMBUS:
 		case PCI_PRODUCT_INTEL_C600_SMB_0:
 		case PCI_PRODUCT_INTEL_C600_SMB_1:



CVS commit: src/sys/dev/pci

2021-07-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Jul 12 12:58:58 UTC 2021

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

Log Message:
Add Intel Jasper Lake devices and Reealtek RTL8821CE.


To generate a diff of this commit:
cvs rdiff -u -r1.1426 -r1.1427 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.1426 src/sys/dev/pci/pcidevs:1.1427
--- src/sys/dev/pci/pcidevs:1.1426	Wed Apr 21 13:09:33 2021
+++ src/sys/dev/pci/pcidevs	Mon Jul 12 12:58:57 2021
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1426 2021/04/21 13:09:33 jakllsch Exp $
+$NetBSD: pcidevs,v 1.1427 2021/07/12 12:58:57 msaitoh Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -5183,6 +5183,56 @@ product INTEL WIFI_LINK_5350_1	0x423a	Wi
 product INTEL WIFI_LINK_5350_2	0x423b	WiFi Link 5350
 product INTEL WIFI_LINK_5150_1	0x423c	WiFi Link 5150
 product INTEL WIFI_LINK_5150_2	0x423d	WiFi Link 5150
+
+product INTEL JSL_ESPI		0x4d87	Jasper Lake eSPI
+product INTEL JSL_P2SB		0x4da0	Jasper Lake P2SB
+product INTEL JSL_PMC		0x4da1	Jasper Lake PMC
+product INTEL JSL_SMB		0x4da3	Jasper Lake SMBus
+product INTEL JSL_SPI_FLASH	0x4da4	Jasper Lake SPI (FLASH)
+product INTEL JSL_TRACE		0x4da6	Jasper Lake Intel Trace Hub
+product INTEL JSL_UART_0	0x4da8	Jasper Lake UART 0
+product INTEL JSL_UART_1	0x4da9	Jasper Lake UART 1
+product INTEL JSL_SPI_0		0x4daa	Jasper Lake SPI 0
+product INTEL JSL_SPI_1		0x4dab	Jasper Lake SPI 1
+product INTEL JSL_PCIE_1	0x4db8	Jasper Lake PCIe Root Port 1
+product INTEL JSL_PCIE_2	0x4db9	Jasper Lake PCIe Root Port 2
+product INTEL JSL_PCIE_3	0x4dba	Jasper Lake PCIe Root Port 3
+product INTEL JSL_PCIE_4	0x4dbb	Jasper Lake PCIe Root Port 4
+product INTEL JSL_PCIE_5	0x4dbc	Jasper Lake PCIe Root Port 5
+product INTEL JSL_PCIE_6	0x4dbd	Jasper Lake PCIe Root Port 6
+product INTEL JSL_PCIE_7	0x4dbe	Jasper Lake PCIe Root Port 7
+product INTEL JSL_PCIE_8	0x4dbf	Jasper Lake PCIe Root Port 8
+product INTEL JSL_EMMC		0x4dc4	Jasper Lake eMMC
+product INTEL JSL_LPSS_I2C_4	0x4dc5	Jasper Lake LPSS I2C 4
+product INTEL JSL_LPSS_I2C_5	0x4dc6	Jasper Lake LPSS I2C 5
+product INTEL JSL_UART_2	0x4dc7	Jasper Lake UART 2
+product INTEL JSL_CAVS		0x4dc8	Jasper Lake cAVS
+product INTEL JSL_AHCI_1	0x4dd2	Jasper Lake SATA (AHCI)
+product INTEL JSL_AHCI_2	0x4dd3	Jasper Lake SATA (AHCI)
+product INTEL JSL_D_RAID	0x4dd6	Jasper Lake SATA (RAID, desktop)
+product INTEL JSL_M_RAID	0x4dd7	Jasper Lake SATA (RAID, mobile)
+product INTEL JSL_AHCI_OPTANE	0x4dde	Jasper Lake SATA (Optane, desktop)
+product INTEL JSL_HECI_1	0x4de0	Jasper Lake HECI 1
+product INTEL JSL_HECI_2	0x4de1	Jasper Lake HECI 2
+product INTEL JSL_HECI_3	0x4de4	Jasper Lake HECI 3
+product INTEL JSL_LPSS_I2C_0	0x4de8	Jasper Lake LPSS I2C 0
+product INTEL JSL_LPSS_I2C_1	0x4de9	Jasper Lake LPSS I2C 1
+product INTEL JSL_LPSS_I2C_2	0x4dea	Jasper Lake LPSS I2C 2
+product INTEL JSL_LPSS_I2C_3	0x4deb	Jasper Lake LPSS I2C 3
+product INTEL JSL_XHCI		0x4ded	Jasper Lake USB Host (xHCI)
+product INTEL JSL_XDCI		0x4dee	Jasper Lake USB Device (xDCI)
+product INTEL JSL_SSRAM		0x4def	Jasper Lake Shared SRAM
+product INTEL JSL_CNVI_0	0x4df0	Jasper Lake CNVi WiFi (SKU 0)
+product INTEL JSL_CNVI_1	0x4df1	Jasper Lake CNVi WiFi (SKU 1)
+product INTEL JSL_CNVI_2	0x4df2	Jasper Lake CNVi WiFi (SKU 2)
+product INTEL JSL_CNVI_3	0x4df3	Jasper Lake CNVi WiFi (SKU 3)
+product INTEL JSL_SCS		0x4df8	Jasper Lake SD Card
+product INTEL JSL_SPI_2		0x4dfb	Jasper Lake SPI 2
+product INTEL JSL_DPTF		0x4e03	Jasper Lake DPTF
+product INTEL JSL_HB		0x4e22	Jasper Lake Processor Transaction Route
+product INTEL JSL_GPU_EU_16	0x4e55	Jasper Lake GPU 16 EU
+product INTEL JSL_GPU_EU_24	0x4e61	Jasper Lake GPU 24 EU
+product INTEL JSL_GPU_EU_32	0x4e71	Jasper Lake GPU 32 EU
 product INTEL EP80579_HB	0x5020	EP80579 Host
 product INTEL EP80579_MEM	0x5021	EP80579 Memory
 product INTEL EP80579_EDMA	0x5023	EP80579 EDMA
@@ -7574,6 +7624,7 @@ product REALTEK RTL8188EE	0x8179	RTL8188
 product REALTEK RT8180		0x8180	8180 802.11b
 product REALTEK RT8185		0x8185	8185 802.11a/b/g
 product REALTEK RTL8192EE	0x818b	RTL8192EE Wireless LAN 802.11n PCI-E NIC
+product REALTEK RTL8821CE	0xc821	RTL8821CE 802.11ac PCIe NIC
 
 /* Red Hat products */
 product REDHAT PPB		0x0001	Qemu PCI-PCI



CVS commit: src/sys/dev/pci

2021-07-11 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Jul 12 04:41:14 UTC 2021

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

Log Message:
s/Precision Time Management/Precision Time Measurement/


To generate a diff of this commit:
cvs rdiff -u -r1.226 -r1.227 src/sys/dev/pci/pci_subr.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/pci_subr.c
diff -u src/sys/dev/pci/pci_subr.c:1.226 src/sys/dev/pci/pci_subr.c:1.227
--- src/sys/dev/pci/pci_subr.c:1.226	Tue Jun 29 21:03:36 2021
+++ src/sys/dev/pci/pci_subr.c	Mon Jul 12 04:41:14 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_subr.c,v 1.226 2021/06/29 21:03:36 pgoyette Exp $	*/
+/*	$NetBSD: pci_subr.c,v 1.227 2021/07/12 04:41:14 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1997 Zubin D. Dittia.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.226 2021/06/29 21:03:36 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.227 2021/07/12 04:41:14 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -4175,7 +4175,7 @@ pci_conf_print_ptm_cap(const pcireg_t *r
 	pcireg_t reg;
 	uint32_t val;
 
-	printf("\n  Precision Time Management\n");
+	printf("\n  Precision Time Measurement\n");
 
 	reg = regs[o2i(extcapoff + PCI_PTM_CAP)];
 	printf("PTM Capability register: 0x%08x\n", reg);
@@ -4312,7 +4312,7 @@ static struct {
 	  pci_conf_print_dpc_cap },
 	{ PCI_EXTCAP_L1PM,	"L1 PM Substates",
 	  pci_conf_print_l1pm_cap },
-	{ PCI_EXTCAP_PTM,	"Precision Time Management",
+	{ PCI_EXTCAP_PTM,	"Precision Time Measurement",
 	  pci_conf_print_ptm_cap },
 	{ PCI_EXTCAP_MPCIE,	"M-PCIe",
 	  NULL },



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

2021-07-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Jul  7 08:58:20 UTC 2021

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

Log Message:
Add new sysctl "rx_copy_len".

 ixgbe_rxeof() has an optimization "RX_COPY" to reduce costs of
bus_dmamap_load_mbuf() and bus_dmamap_unload() by copying a mbuf cluster's
memory to a newly allocated mbuf's MH_databuf[] and recycle the original map.
The optimization is used when a length of a packet is smaller than a specific
value. The value is calculated based on MHLEN. The size of MHLEN is
architecture specific. It's 256 or 512. Make the threshold controllable by
adding a new sysctl.


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.285 -r1.286 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.75 -r1.76 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.162 -r1.163 src/sys/dev/pci/ixgbe/ixv.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.80 src/sys/dev/pci/ixgbe/ix_txrx.c:1.81
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.80	Wed Jul  7 08:32:51 2021
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Wed Jul  7 08:58:19 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.80 2021/07/07 08:32:51 msaitoh Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.81 2021/07/07 08:58:19 msaitoh Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.80 2021/07/07 08:32:51 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.81 2021/07/07 08:58:19 msaitoh Exp $");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -1976,7 +1976,7 @@ ixgbe_rxeof(struct ix_queue *que)
 			 * is cache aligned into a new mbuf, and
 			 * leave the old mbuf+cluster for re-use.
 			 */
-			if (eop && len <= IXGBE_RX_COPY_LEN) {
+			if (eop && len <= adapter->rx_copy_len) {
 sendmp = m_gethdr(M_NOWAIT, MT_DATA);
 if (sendmp != NULL) {
 	sendmp->m_data += IXGBE_RX_COPY_ALIGN;

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.285 src/sys/dev/pci/ixgbe/ixgbe.c:1.286
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.285	Tue Jun 29 21:03:36 2021
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Wed Jul  7 08:58:19 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.285 2021/06/29 21:03:36 pgoyette Exp $ */
+/* $NetBSD: ixgbe.c,v 1.286 2021/07/07 08:58:19 msaitoh Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.285 2021/06/29 21:03:36 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.286 2021/07/07 08:58:19 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -259,6 +259,7 @@ static int	ixgbe_sysctl_tdt_handler(SYSC
 static int	ixgbe_sysctl_tdh_handler(SYSCTLFN_PROTO);
 static int	ixgbe_sysctl_eee_state(SYSCTLFN_PROTO);
 static int	ixgbe_sysctl_debug(SYSCTLFN_PROTO);
+static int	ixgbe_sysctl_rx_copy_len(SYSCTLFN_PROTO);
 static int	ixgbe_sysctl_wol_enable(SYSCTLFN_PROTO);
 static int	ixgbe_sysctl_wufc(SYSCTLFN_PROTO);
 
@@ -986,6 +987,9 @@ ixgbe_attach(device_t parent, device_t d
 	} else
 		adapter->num_rx_desc = ixgbe_rxd;
 
+	/* Set default high limit of copying mbuf in rxeof */
+	adapter->rx_copy_len = IXGBE_RX_COPY_LEN_MAX;
+
 	adapter->num_jcl = adapter->num_rx_desc * IXGBE_JCLNUM_MULTI;
 
 	/* Allocate our TX/RX Queues */
@@ -3368,6 +3372,13 @@ ixgbe_add_device_sysctls(struct adapter 
 		aprint_error_dev(dev, "could not create sysctl\n");
 
 	if (sysctl_createv(log, 0, , ,
+	CTLFLAG_READWRITE, CTLTYPE_INT,
+	"rx_copy_len", SYSCTL_DESCR("RX Copy Length"),
+	ixgbe_sysctl_rx_copy_len, 0,
+	(void *)adapter, 0, CTL_CREATE, CTL_EOL) != 0)
+		aprint_error_dev(dev, "could not create sysctl\n");
+
+	if (sysctl_createv(log, 0, , ,
 	CTLFLAG_READONLY, CTLTYPE_INT,
 	"num_rx_desc", SYSCTL_DESCR("Number of rx descriptors"),
 	NULL, 0, >num_rx_desc, 0, CTL_CREATE, CTL_EOL) != 0)
@@ -6174,6 +6185,31 @@ ixgbe_sysctl_debug(SYSCTLFN_ARGS)
 } /* ixgbe_sysctl_debug */
 
 /
+ * ixgbe_sysctl_rx_copy_len
+ /
+static int
+ixgbe_sysctl_rx_copy_len(SYSCTLFN_ARGS)
+{
+	struct sysctlnode node = *rnode;
+	struct adapter *adapter = (struct adapter *)node.sysctl_data;
+	int error;
+	int result = adapter->rx_copy_len;
+
+	node.sysctl_data = 
+	error = sysctl_lookup(SYSCTLFN_CALL());
+
+	if (error || newp == NULL)
+		return error;
+
+	if ((result < 0) || (result > IXGBE_RX_COPY_LEN_MAX))
+		return EINVAL;
+
+	adapter->rx_copy_len = result;
+
+	return 0;
+} /* ixgbe_sysctl_rx_copy_len */
+
+/
  * 

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

2021-07-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Jul  7 08:32:51 UTC 2021

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

Log Message:
Set rxr->next_to_refresh correctly in ixgbe_setup_receive_ring().

 ixgbe_setup_receive_ring() fully allocates rx buffers. When a
descriptor ring is full, rxr->next_to_refresh should point to
rxr_next_to_check -1. Before this change, rxr->next_to_refresh
is set to 0 and ixgbe_refresh_mbufs() wastefully loops in
ixgbe_refresh_mbufs() because it means the ring is empty.


To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.80 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.79 src/sys/dev/pci/ixgbe/ix_txrx.c:1.80
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.79	Thu May 27 06:11:34 2021
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Wed Jul  7 08:32:51 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.79 2021/05/27 06:11:34 msaitoh Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.80 2021/07/07 08:32:51 msaitoh Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.79 2021/05/27 06:11:34 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.80 2021/07/07 08:32:51 msaitoh Exp $");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -1577,7 +1577,7 @@ ixgbe_setup_receive_ring(struct rx_ring 
 
 	/* Setup our descriptor indices */
 	rxr->next_to_check = 0;
-	rxr->next_to_refresh = 0;
+	rxr->next_to_refresh = adapter->num_rx_desc - 1; /* Fully allocated */
 	rxr->lro_enabled = FALSE;
 	rxr->rx_copies.ev_count = 0;
 #if 0 /* NetBSD */



CVS commit: src/sys/dev/pci

2021-07-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Jul  1 17:22:10 UTC 2021

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

Log Message:
port-evbarm/56274: no network on ec2 arm64 9.99.85

Remove custom SIOCSIFFLAGS handling and rely on ether_ioctl to DTRT


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/pci/if_ena.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_ena.c
diff -u src/sys/dev/pci/if_ena.c:1.27 src/sys/dev/pci/if_ena.c:1.28
--- src/sys/dev/pci/if_ena.c:1.27	Sat Jan 23 11:50:30 2021
+++ src/sys/dev/pci/if_ena.c	Thu Jul  1 17:22:10 2021
@@ -36,7 +36,7 @@
 #if 0
 __FBSDID("$FreeBSD: head/sys/dev/ena/ena.c 333456 2018-05-10 09:37:54Z mw $");
 #endif
-__KERNEL_RCSID(0, "$NetBSD: if_ena.c,v 1.27 2021/01/23 11:50:30 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ena.c,v 1.28 2021/07/01 17:22:10 jmcneill Exp $");
 
 #include 
 #include 
@@ -2396,28 +2396,6 @@ ena_ioctl(struct ifnet *ifp, u_long comm
 		rw_exit(>ioctl_sx);
 		break;
 
-	case SIOCSIFFLAGS:
-		if ((ifp->if_flags & IFF_UP) != 0) {
-			if ((if_getdrvflags(ifp) & IFF_RUNNING) != 0) {
-if ((ifp->if_flags & (IFF_PROMISC |
-IFF_ALLMULTI)) != 0) {
-	device_printf(adapter->pdev,
-	"ioctl promisc/allmulti\n");
-}
-			} else {
-rw_enter(>ioctl_sx, RW_WRITER);
-rc = ena_up(adapter);
-rw_exit(>ioctl_sx);
-			}
-		} else {
-			if ((if_getdrvflags(ifp) & IFF_RUNNING) != 0) {
-rw_enter(>ioctl_sx, RW_WRITER);
-ena_down(adapter);
-rw_exit(>ioctl_sx);
-			}
-		}
-		break;
-
 	case SIOCADDMULTI:
 	case SIOCDELMULTI:
 		break;



CVS commit: src/sys/dev/pci

2021-06-24 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Jun 24 23:48:08 UTC 2021

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

Log Message:
>From the "Should have been done years ago" department, add some macros
describing the format of PCI Type 0 and Type 1 Configuration Cycle
addresses.


To generate a diff of this commit:
cvs rdiff -u -r1.154 -r1.155 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/pcireg.h
diff -u src/sys/dev/pci/pcireg.h:1.154 src/sys/dev/pci/pcireg.h:1.155
--- src/sys/dev/pci/pcireg.h:1.154	Sat May 15 13:00:45 2021
+++ src/sys/dev/pci/pcireg.h	Thu Jun 24 23:48:08 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcireg.h,v 1.154 2021/05/15 13:00:45 jakllsch Exp $	*/
+/*	$NetBSD: pcireg.h,v 1.155 2021/06/24 23:48:08 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996, 1999, 2000
@@ -68,6 +68,21 @@ typedef u_int16_t pci_product_id_t;
 	 (((pid) & PCI_PRODUCT_MASK) << PCI_PRODUCT_SHIFT))	\
 
 /*
+ * Standard format of a PCI Type 0 Configuration Cycle address.
+ */
+#define	PCI_CONF_TYPE0_IDSEL(d)		__BIT((d) + 11)
+#define	PCI_CONF_TYPE0_FUNCTION		__BITS(8,10)
+#define	PCI_CONF_TYPE0_OFFSET		__BITS(0,7)
+
+/*
+ * Standard format of a PCI Type 1 Configuration Cycle address.
+ */
+#define	PCI_CONF_TYPE1_BUS		__BITS(16,23)
+#define	PCI_CONF_TYPE1_DEVICE		__BITS(11,15)
+#define	PCI_CONF_TYPE1_FUNCTION		__BITS(8,10)
+#define	PCI_CONF_TYPE1_OFFSET		__BITS(0,7)
+
+/*
  * Command and status register.
  */
 #define	PCI_COMMAND_STATUS_REG	0x04



CVS commit: src/sys/dev/pci

2021-06-24 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Jun 24 09:17:53 UTC 2021

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

Log Message:
iwm(4): Disentangle attach.

Don't attach a half-baked interface and then detach it and then
reattach it after mountroot when we can read firmware; just defer
attaching the interface altogether until mountroot.

Likely fixes some panics I've seen every now and then at boot with
iwm(4).


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 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.86 src/sys/dev/pci/if_iwm.c:1.87
--- src/sys/dev/pci/if_iwm.c:1.86	Wed Jun 16 00:21:18 2021
+++ src/sys/dev/pci/if_iwm.c	Thu Jun 24 09:17:53 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_iwm.c,v 1.86 2021/06/16 00:21:18 riastradh Exp $	*/
+/*	$NetBSD: if_iwm.c,v 1.87 2021/06/24 09:17:53 riastradh 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.86 2021/06/16 00:21:18 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.87 2021/06/24 09:17:53 riastradh Exp $");
 
 #include 
 #include 
@@ -482,6 +482,7 @@ static void	iwm_softintr(void *);
 static int	iwm_preinit(struct iwm_softc *);
 static void	iwm_attach_hook(device_t);
 static void	iwm_attach(device_t, device_t, void *);
+static int	iwm_config_complete(struct iwm_softc *);
 #if 0
 static void	iwm_init_task(void *);
 static int	iwm_activate(device_t, enum devact);
@@ -6598,10 +6599,6 @@ iwm_init_hw(struct iwm_softc *sc)
 	struct ieee80211com *ic = >sc_ic;
 	int err, i, ac;
 
-	err = iwm_preinit(sc);
-	if (err)
-		return err;
-
 	err = iwm_start_hw(sc);
 	if (err) {
 		aprint_error_dev(sc->sc_dev, "could not initialize hardware\n");
@@ -6951,10 +6948,6 @@ iwm_ioctl(struct ifnet *ifp, u_long cmd,
 
 	case SIOCADDMULTI:
 	case SIOCDELMULTI:
-		if (!ISSET(sc->sc_flags, IWM_FLAG_ATTACHED)) {
-			err = ENXIO;
-			break;
-		}
 		sa = ifreq_getaddr(SIOCADDMULTI, (struct ifreq *)data);
 		err = (cmd == SIOCADDMULTI) ?
 		ether_addmulti(sa, >sc_ec) :
@@ -6964,10 +6957,6 @@ iwm_ioctl(struct ifnet *ifp, u_long cmd,
 		break;
 
 	default:
-		if (!ISSET(sc->sc_flags, IWM_FLAG_ATTACHED)) {
-			err = ether_ioctl(ifp, cmd, data);
-			break;
-		}
 		err = ieee80211_ioctl(ic, cmd, data);
 		break;
 	}
@@ -7728,13 +7717,8 @@ iwm_match(device_t parent, cfdata_t matc
 static int
 iwm_preinit(struct iwm_softc *sc)
 {
-	struct ieee80211com *ic = >sc_ic;
-	struct ifnet *ifp = IC2IFP(>sc_ic);
 	int err;
 
-	if (ISSET(sc->sc_flags, IWM_FLAG_ATTACHED))
-		return 0;
-
 	err = iwm_start_hw(sc);
 	if (err) {
 		aprint_error_dev(sc->sc_dev, "could not initialize hardware\n");
@@ -7746,44 +7730,10 @@ iwm_preinit(struct iwm_softc *sc)
 	if (err)
 		return err;
 
-	sc->sc_flags |= IWM_FLAG_ATTACHED;
-
 	aprint_normal_dev(sc->sc_dev, "hw rev 0x%x, fw ver %s, address %s\n",
 	sc->sc_hw_rev & IWM_CSR_HW_REV_TYPE_MSK, sc->sc_fwver,
 	ether_sprintf(sc->sc_nvm.hw_addr));
 
-#ifndef IEEE80211_NO_HT
-	if (sc->sc_nvm.sku_cap_11n_enable)
-		iwm_setup_ht_rates(sc);
-#endif
-
-	/* not all hardware can do 5GHz band */
-	if (sc->sc_nvm.sku_cap_band_52GHz_enable)
-		ic->ic_sup_rates[IEEE80211_MODE_11A] = ieee80211_std_rateset_11a;
-
-	ether_ifdetach(ifp);
-	/*
-	 * XXX
-	 * ether_ifdetach() overwrites ifp->if_ioctl, so restore it here.
-	 */
-	ifp->if_ioctl = iwm_ioctl;
-	ieee80211_ifattach(ic);
-
-	ic->ic_node_alloc = iwm_node_alloc;
-
-	/* Override 802.11 state transition machine. */
-	sc->sc_newstate = ic->ic_newstate;
-	ic->ic_newstate = iwm_newstate;
-
-	/* XXX media locking needs revisiting */
-	mutex_init(>sc_media_mtx, MUTEX_DEFAULT, IPL_SOFTNET);
-	ieee80211_media_init_with_lock(ic,
-	iwm_media_change, ieee80211_media_status, >sc_media_mtx);
-
-	ieee80211_announce(ic);
-
-	iwm_radiotap_attach(sc);
-
 	return 0;
 }
 
@@ -7792,7 +7742,7 @@ iwm_attach_hook(device_t dev)
 {
 	struct iwm_softc *sc = device_private(dev);
 
-	iwm_preinit(sc);
+	iwm_config_complete(sc);
 }
 
 static void
@@ -7800,8 +7750,6 @@ iwm_attach(device_t parent, device_t sel
 {
 	struct iwm_softc *sc = device_private(self);
 	struct pci_attach_args *pa = aux;
-	struct ieee80211com *ic = >sc_ic;
-	struct ifnet *ifp = >sc_ec.ec_if;
 	pcireg_t reg, memtype;
 	char intrbuf[PCI_INTRSTR_LEN];
 	const char *intrstr;
@@ -8081,6 +8029,60 @@ iwm_attach(device_t parent, device_t sel
 		}
 	}
 
+	callout_init(>sc_calib_to, 0);
+	callout_setfunc(>sc_calib_to, iwm_calib_timeout, sc);
+	callout_init(>sc_led_blink_to, 0);
+	callout_setfunc(>sc_led_blink_to, iwm_led_blink_timeout, sc);
+#ifndef IEEE80211_NO_HT
+	if (workqueue_create(>sc_setratewq, "iwmsr",
+	iwm_setrates_task, sc, PRI_NONE, IPL_NET, 0))
+		panic("%s: could not create workqueue: setrates",
+		device_xname(self));

CVS commit: src/sys/dev/pci

2021-06-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jun 21 03:21:17 UTC 2021

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

Log Message:
fix proplib deprecation


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/sys/dev/pci/radeonfb.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/radeonfb.c
diff -u src/sys/dev/pci/radeonfb.c:1.114 src/sys/dev/pci/radeonfb.c:1.115
--- src/sys/dev/pci/radeonfb.c:1.114	Sat Apr 24 19:36:57 2021
+++ src/sys/dev/pci/radeonfb.c	Sun Jun 20 23:21:17 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: radeonfb.c,v 1.114 2021/04/24 23:36:57 thorpej Exp $ */
+/*	$NetBSD: radeonfb.c,v 1.115 2021/06/21 03:21:17 christos Exp $ */
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.114 2021/04/24 23:36:57 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.115 2021/06/21 03:21:17 christos Exp $");
 
 #include 
 #include 
@@ -812,7 +812,7 @@ radeonfb_attach(device_t parent, device_
 
 	/* setup default video mode from devprop (allows PROM override) */
 	sc->sc_defaultmode = radeonfb_default_mode;
-	if (prop_dictionary_get_cstring_nocopy(device_properties(sc->sc_dev),
+	if (prop_dictionary_get_string(device_properties(sc->sc_dev),
 	"videomode", )) {
 
 		strncpy(sc->sc_modebuf, mptr, sizeof(sc->sc_modebuf));



CVS commit: src/sys/dev/pci

2021-06-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jun 21 03:19:21 UTC 2021

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

Log Message:
fix proplib deprecation


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.105 src/sys/dev/pci/machfb.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/machfb.c
diff -u src/sys/dev/pci/machfb.c:1.104 src/sys/dev/pci/machfb.c:1.105
--- src/sys/dev/pci/machfb.c:1.104	Sat Apr 24 19:36:57 2021
+++ src/sys/dev/pci/machfb.c	Sun Jun 20 23:19:21 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: machfb.c,v 1.104 2021/04/24 23:36:57 thorpej Exp $	*/
+/*	$NetBSD: machfb.c,v 1.105 2021/06/21 03:19:21 christos Exp $	*/
 
 /*
  * Copyright (c) 2002 Bang Jun-Young
@@ -34,7 +34,7 @@
 
 #include 
 __KERNEL_RCSID(0,
-	"$NetBSD: machfb.c,v 1.104 2021/04/24 23:36:57 thorpej Exp $");
+	"$NetBSD: machfb.c,v 1.105 2021/06/21 03:19:21 christos Exp $");
 
 #include 
 #include 
@@ -520,7 +520,7 @@ mach64_attach(device_t parent, device_t 
 	default_mode.hdisplay = width;
 	default_mode.vdisplay = height;
 
-	prop_dictionary_get_cstring_nocopy(device_properties(sc->sc_dev),
+	prop_dictionary_get_string(device_properties(sc->sc_dev),
 	"videomode", );
 
 	memset(>sc_ei, 0, sizeof(sc->sc_ei));



CVS commit: src/sys/dev/pci

2021-06-16 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Jun 17 02:05:48 UTC 2021

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

Log Message:
Use unsigned to avoid undefined behavior. Found by kUBSan.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/pci/if_iwnreg.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_iwnreg.h
diff -u src/sys/dev/pci/if_iwnreg.h:1.17 src/sys/dev/pci/if_iwnreg.h:1.18
--- src/sys/dev/pci/if_iwnreg.h:1.17	Wed Jul 19 16:55:12 2017
+++ src/sys/dev/pci/if_iwnreg.h	Thu Jun 17 02:05:47 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_iwnreg.h,v 1.17 2017/07/19 16:55:12 mlelstv Exp $	*/
+/*	$NetBSD: if_iwnreg.h,v 1.18 2021/06/17 02:05:47 msaitoh Exp $	*/
 /*	$OpenBSD: if_iwnreg.h,v 1.49 2014/09/09 18:56:24 sthen Exp $	*/
 
 /*-
@@ -244,7 +244,7 @@
 
 /* Possible flags for register IWN_DRAM_INT_TBL. */
 #define IWN_DRAM_INT_TBL_WRAP_CHECK	(1 << 27)
-#define IWN_DRAM_INT_TBL_ENABLE		(1 << 31)
+#define IWN_DRAM_INT_TBL_ENABLE		(1U << 31)
 
 /* Possible values for register IWN_ANA_PLL. */
 #define IWN_ANA_PLL_INIT	0x00880300
@@ -267,7 +267,7 @@
 #define IWN_INT_FH_TX		(1 << 27)
 #define IWN_INT_RX_PERIODIC	(1 << 28)
 #define IWN_INT_HW_ERR		(1 << 29)
-#define IWN_INT_FH_RX		(1 << 31)
+#define IWN_INT_FH_RX		(1U << 31)
 
 /* Shortcut. */
 #define IWN_INT_MASK_DEF		\



CVS commit: src/sys/dev/pci

2021-06-13 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Jun 13 10:05:39 UTC 2021

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

Log Message:
Don't ignore errors of sysmon_envsys_register().


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 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.25 src/sys/dev/pci/if_aq.c:1.26
--- src/sys/dev/pci/if_aq.c:1.25	Fri Apr 16 08:09:40 2021
+++ src/sys/dev/pci/if_aq.c	Sun Jun 13 10:05:39 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_aq.c,v 1.25 2021/04/16 08:09:40 ryo Exp $	*/
+/*	$NetBSD: if_aq.c,v 1.26 2021/06/13 10:05:39 mlelstv Exp $	*/
 
 /**
  * aQuantia Corporation Network Driver
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.25 2021/04/16 08:09:40 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.26 2021/06/13 10:05:39 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_if_aq.h"
@@ -1491,7 +1491,11 @@ aq_attach(device_t parent, device_t self
 		snprintf(sc->sc_sensor_temp.desc, ENVSYS_DESCLEN, "PHY");
 
 		sysmon_envsys_sensor_attach(sc->sc_sme, >sc_sensor_temp);
-		sysmon_envsys_register(sc->sc_sme);
+		if (sysmon_envsys_register(sc->sc_sme)) {
+			sysmon_envsys_destroy(sc->sc_sme);
+			sc->sc_sme = NULL;
+			goto attach_failure;
+		}
 
 		/*
 		 * for unknown reasons, the first call of fw2x_get_temperature()
@@ -1579,7 +1583,6 @@ aq_detach(device_t self, int flags __unu
 	if (sc->sc_sme != NULL) {
 		/* all sensors associated with this will also be detached */
 		sysmon_envsys_unregister(sc->sc_sme);
-		sc->sc_sme = NULL;
 	}
 #endif
 



CVS commit: src/sys/dev/pci

2021-06-13 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Jun 13 10:04:10 UTC 2021

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

Log Message:
Fix race when freeing sensors.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/pci/arcmsr.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/arcmsr.c
diff -u src/sys/dev/pci/arcmsr.c:1.41 src/sys/dev/pci/arcmsr.c:1.42
--- src/sys/dev/pci/arcmsr.c:1.41	Sat Apr 24 23:36:57 2021
+++ src/sys/dev/pci/arcmsr.c	Sun Jun 13 10:04:10 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: arcmsr.c,v 1.41 2021/04/24 23:36:57 thorpej Exp $ */
+/*	$NetBSD: arcmsr.c,v 1.42 2021/06/13 10:04:10 mlelstv Exp $ */
 /*	$OpenBSD: arc.c,v 1.68 2007/10/27 03:28:27 dlg Exp $ */
 
 /*
@@ -21,7 +21,7 @@
 #include "bio.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: arcmsr.c,v 1.41 2021/04/24 23:36:57 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arcmsr.c,v 1.42 2021/06/13 10:04:10 mlelstv Exp $");
 
 #include 
 #include 
@@ -1884,9 +1884,9 @@ arc_create_sensors(void *arg)
 
 bad:
 	sysmon_envsys_destroy(sc->sc_sme);
-	kmem_free(sc->sc_arc_sensors, slen);
-
 	sc->sc_sme = NULL;
+
+	kmem_free(sc->sc_arc_sensors, slen);
 	sc->sc_arc_sensors = NULL;
 
 	kthread_exit(0);



CVS commit: src/sys/dev/pci

2021-06-05 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jun  5 14:28:28 UTC 2021

Modified Files:
src/sys/dev/pci: if_ti.c if_tireg.h

Log Message:
Back out the following changes:

  http://mail-index.netbsd.org/source-changes/2020/02/29/msg114581.html
  http://mail-index.netbsd.org/source-changes/2020/02/29/msg114583.html

They have reportedly caused some issues with link detection, and will
be revisited later.


To generate a diff of this commit:
cvs rdiff -u -r1.120 -r1.121 src/sys/dev/pci/if_ti.c
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/pci/if_tireg.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_ti.c
diff -u src/sys/dev/pci/if_ti.c:1.120 src/sys/dev/pci/if_ti.c:1.121
--- src/sys/dev/pci/if_ti.c:1.120	Thu Mar  5 15:45:48 2020
+++ src/sys/dev/pci/if_ti.c	Sat Jun  5 14:28:28 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ti.c,v 1.120 2020/03/05 15:45:48 msaitoh Exp $ */
+/* $NetBSD: if_ti.c,v 1.121 2021/06/05 14:28:28 thorpej Exp $ */
 
 /*
  * Copyright (c) 1997, 1998, 1999
@@ -81,7 +81,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ti.c,v 1.120 2020/03/05 15:45:48 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ti.c,v 1.121 2021/06/05 14:28:28 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -123,16 +123,6 @@ __KERNEL_RCSID(0, "$NetBSD: if_ti.c,v 1.
 #include 
 #include 
 
-#define	TI_HOSTADDR(x, y)		\
-	do {\
-		(x).ti_addr_lo = (uint32_t)(y);\
-		if (sizeof(bus_addr_t) == 8)\
-			(x).ti_addr_hi =\
-			(uint32_t)(((uint64_t)(y) >> 32));		\
-		else			\
-			(x).ti_addr_hi = 0;\
-	} while (/*CONSTCOND*/0)
-
 /*
  * Various supported device vendors/types and their names.
  */
@@ -752,7 +742,7 @@ ti_newbuf_std(struct ti_softc *sc, int i
 
 	sc->ti_cdata.ti_rx_std_chain[i] = m_new;
 	r = >ti_rdata->ti_rx_std_ring[i];
-	TI_HOSTADDR(r->ti_addr, dmamap->dm_segs[0].ds_addr);
+	TI_HOSTADDR(r->ti_addr) = dmamap->dm_segs[0].ds_addr;
 	r->ti_type = TI_BDTYPE_RECV_BD;
 	r->ti_flags = 0;
 	if (sc->ethercom.ec_if.if_capenable & IFCAP_CSUM_IPv4_Rx)
@@ -819,7 +809,7 @@ ti_newbuf_mini(struct ti_softc *sc, int 
 
 	r = >ti_rdata->ti_rx_mini_ring[i];
 	sc->ti_cdata.ti_rx_mini_chain[i] = m_new;
-	TI_HOSTADDR(r->ti_addr, dmamap->dm_segs[0].ds_addr);
+	TI_HOSTADDR(r->ti_addr) = dmamap->dm_segs[0].ds_addr;
 	r->ti_type = TI_BDTYPE_RECV_BD;
 	r->ti_flags = TI_BDFLAG_MINI_RING;
 	if (sc->ethercom.ec_if.if_capenable & IFCAP_CSUM_IPv4_Rx)
@@ -878,8 +868,8 @@ ti_newbuf_jumbo(struct ti_softc *sc, int
 	/* Set up the descriptor. */
 	r = >ti_rdata->ti_rx_jumbo_ring[i];
 	sc->ti_cdata.ti_rx_jumbo_chain[i] = m_new;
-	TI_HOSTADDR(r->ti_addr, sc->jumbo_dmaaddr +
-	(mtod(m_new, char *) - (char *)sc->ti_cdata.ti_jumbo_buf));
+	TI_HOSTADDR(r->ti_addr) = sc->jumbo_dmaaddr +
+		(mtod(m_new, char *) - (char *)sc->ti_cdata.ti_jumbo_buf);
 	r->ti_type = TI_BDTYPE_RECV_JUMBO_BD;
 	r->ti_flags = TI_BDFLAG_JUMBO_RING;
 	if (sc->ethercom.ec_if.if_capenable & IFCAP_CSUM_IPv4_Rx)
@@ -1426,10 +1416,10 @@ ti_gibinit(struct ti_softc *sc)
 	/* Set up the event ring and producer pointer. */
 	rcb = >ti_rdata->ti_info.ti_ev_rcb;
 
-	TI_HOSTADDR(rcb->ti_hostaddr, TI_CDEVENTADDR(sc, 0));
+	TI_HOSTADDR(rcb->ti_hostaddr) = TI_CDEVENTADDR(sc, 0);
 	rcb->ti_flags = 0;
-	TI_HOSTADDR(sc->ti_rdata->ti_info.ti_ev_prodidx_ptr,
-	TI_CDEVPRODADDR(sc));
+	TI_HOSTADDR(sc->ti_rdata->ti_info.ti_ev_prodidx_ptr) =
+	TI_CDEVPRODADDR(sc);
 
 	sc->ti_ev_prodidx.ti_idx = 0;
 	CSR_WRITE_4(sc, TI_GCR_EVENTCONS_IDX, 0);
@@ -1438,7 +1428,7 @@ ti_gibinit(struct ti_softc *sc)
 	/* Set up the command ring and producer mailbox. */
 	rcb = >ti_rdata->ti_info.ti_cmd_rcb;
 
-	TI_HOSTADDR(rcb->ti_hostaddr, TI_GCR_NIC_ADDR(TI_GCR_CMDRING));
+	TI_HOSTADDR(rcb->ti_hostaddr) = TI_GCR_NIC_ADDR(TI_GCR_CMDRING);
 	rcb->ti_flags = 0;
 	rcb->ti_max_len = 0;
 	for (i = 0; i < TI_CMD_RING_CNT; i++) {
@@ -1453,12 +1443,12 @@ ti_gibinit(struct ti_softc *sc)
 	 * We re-use the current stats buffer for this to
 	 * conserve memory.
 	 */
-	TI_HOSTADDR(sc->ti_rdata->ti_info.ti_refresh_stats_ptr,
-	TI_CDSTATSADDR(sc));
+	TI_HOSTADDR(sc->ti_rdata->ti_info.ti_refresh_stats_ptr) =
+	TI_CDSTATSADDR(sc);
 
 	/* Set up the standard receive ring. */
 	rcb = >ti_rdata->ti_info.ti_std_rx_rcb;
-	TI_HOSTADDR(rcb->ti_hostaddr, TI_CDRXSTDADDR(sc, 0));
+	TI_HOSTADDR(rcb->ti_hostaddr) = TI_CDRXSTDADDR(sc, 0);
 	rcb->ti_max_len = ETHER_MAX_LEN;
 	rcb->ti_flags = 0;
 	if (ifp->if_capenable & IFCAP_CSUM_IPv4_Rx)
@@ -1470,7 +1460,7 @@ ti_gibinit(struct ti_softc *sc)
 
 	/* Set up the jumbo receive ring. */
 	rcb = >ti_rdata->ti_info.ti_jumbo_rx_rcb;
-	TI_HOSTADDR(rcb->ti_hostaddr, TI_CDRXJUMBOADDR(sc, 0));
+	TI_HOSTADDR(rcb->ti_hostaddr) = TI_CDRXJUMBOADDR(sc, 0);
 	rcb->ti_max_len = ETHER_MAX_LEN_JUMBO;
 	rcb->ti_flags = 0;
 	if (ifp->if_capenable & IFCAP_CSUM_IPv4_Rx)
@@ -1486,7 +1476,7 @@ ti_gibinit(struct ti_softc *sc)
 	 * still there on the Tigon 

CVS commit: src/sys/dev/pci

2021-06-02 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Wed Jun  2 11:32:24 UTC 2021

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

Log Message:
Can't left shift a signed int by 31. Found by kubsan.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/pci/if_iwmreg.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_iwmreg.h
diff -u src/sys/dev/pci/if_iwmreg.h:1.7 src/sys/dev/pci/if_iwmreg.h:1.8
--- src/sys/dev/pci/if_iwmreg.h:1.7	Thu Apr 19 21:50:09 2018
+++ src/sys/dev/pci/if_iwmreg.h	Wed Jun  2 11:32:24 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_iwmreg.h,v 1.7 2018/04/19 21:50:09 christos Exp $	*/
+/*	$NetBSD: if_iwmreg.h,v 1.8 2021/06/02 11:32:24 nia Exp $	*/
 /*	OpenBSD: if_iwmreg.h,v 1.19 2016/09/20 11:46:09 stsp Exp 	*/
 
 /*-
@@ -191,7 +191,7 @@
 
 /* interrupt flags in INTA, set by uCode or hardware (e.g. dma),
  * acknowledged (reset) by host writing "1" to flagged bits. */
-#define IWM_CSR_INT_BIT_FH_RX	(1 << 31) /* Rx DMA, cmd responses, FH_INT[17:16] */
+#define IWM_CSR_INT_BIT_FH_RX	(1U << 31) /* Rx DMA, cmd responses, FH_INT[17:16] */
 #define IWM_CSR_INT_BIT_HW_ERR	(1 << 29) /* DMA hardware error FH_INT[31] */
 #define IWM_CSR_INT_BIT_RX_PERIODIC	(1 << 28) /* Rx periodic */
 #define IWM_CSR_INT_BIT_FH_TX	(1 << 27) /* Tx DMA FH_INT[1:0] */
@@ -214,7 +214,7 @@
  IWM_CSR_INT_BIT_RX_PERIODIC)
 
 /* interrupt flags in FH (flow handler) (PCI busmaster DMA) */
-#define IWM_CSR_FH_INT_BIT_ERR   (1 << 31) /* Error */
+#define IWM_CSR_FH_INT_BIT_ERR   (1U << 31) /* Error */
 #define IWM_CSR_FH_INT_BIT_HI_PRIOR  (1 << 30) /* High priority Rx, bypass coalescing */
 #define IWM_CSR_FH_INT_BIT_RX_CHNL1  (1 << 17) /* Rx channel 1 */
 #define IWM_CSR_FH_INT_BIT_RX_CHNL0  (1 << 16) /* Rx channel 0 */
@@ -405,7 +405,7 @@
 #define IWM_CSR_DBG_HPET_MEM_REG_VAL	(0x)
 
 /* DRAM INT TABLE */
-#define IWM_CSR_DRAM_INT_TBL_ENABLE		(1 << 31)
+#define IWM_CSR_DRAM_INT_TBL_ENABLE		(1U << 31)
 #define IWM_CSR_DRAM_INIT_TBL_WRITE_POINTER	(1 << 28)
 #define IWM_CSR_DRAM_INIT_TBL_WRAP_CHECK	(1 << 27)
 
@@ -558,7 +558,7 @@ enum iwm_secure_load_status_reg {
 #define IWM_HOST_INT_TIMEOUT_MAX	(0xFF)
 #define IWM_HOST_INT_TIMEOUT_DEF	(0x40)
 #define IWM_HOST_INT_TIMEOUT_MIN	(0x0)
-#define IWM_HOST_INT_OPER_MODE		(1 << 31)
+#define IWM_HOST_INT_OPER_MODE		(1U << 31)
 
 /*
  *7000/3000 series SHR DTS addresses *
@@ -643,7 +643,7 @@ enum iwm_ucode_tlv_flag {
 	IWM_UCODE_TLV_FLAGS_P2P_PS_UAPSD	= (1 << 26),
 	IWM_UCODE_TLV_FLAGS_BCAST_FILTERING	= (1 << 29),
 	IWM_UCODE_TLV_FLAGS_GO_UAPSD		= (1 << 30),
-	IWM_UCODE_TLV_FLAGS_LTE_COEX		= (1 << 31),
+	IWM_UCODE_TLV_FLAGS_LTE_COEX		= (1U << 31),
 };
 #define IWM_UCODE_TLV_FLAG_BITS \
 	"\020\1PAN\2NEWSCAN\3MFP\4P2P\5DW_BC_TABLE\6NEWBT_COEX\7PM_CMD\10SHORT_BL\11RX_ENERGY\12TIME_EVENT_V2\13D3_6_IPV6\14BF_UPDATED\15NO_BASIC_SSID\17D3_CONTINUITY\20NEW_NSOFFL_S\21NEW_NSOFFL_L\22SCHED_SCAN\24STA_KEY_CMD\25DEVICE_PS_CMD\26P2P_PS\27P2P_PS_DCM\30P2P_PS_SCM\31UAPSD_SUPPORT\32EBS\33P2P_PS_UAPSD\36BCAST_FILTERING\37GO_UAPSD\40LTE_COEX"
@@ -4369,7 +4369,7 @@ enum iwm_tx_flags {
 	IWM_TX_CMD_FLG_FW_DROP		= (1 << 26),
 	IWM_TX_CMD_FLG_EXEC_PAPD	= (1 << 27),
 	IWM_TX_CMD_FLG_PAPD_TYPE	= (1 << 28),
-	IWM_TX_CMD_FLG_HCCA_CHUNK	= (1 << 31)
+	IWM_TX_CMD_FLG_HCCA_CHUNK	= (1U << 31)
 }; /* IWM_TX_FLAGS_BITS_API_S_VER_1 */
 
 /**



CVS commit: src/sys/dev/pci

2021-05-29 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sun May 30 00:17:20 UTC 2021

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

Log Message:
Unindent code to match the logical structure, ignoring the commented out if.

This code should be rewritten to use BUS_DMA_WAITOK, but that's a
project of its own.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/pci/if_cas.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_cas.c
diff -u src/sys/dev/pci/if_cas.c:1.45 src/sys/dev/pci/if_cas.c:1.46
--- src/sys/dev/pci/if_cas.c:1.45	Sat May  8 00:27:02 2021
+++ src/sys/dev/pci/if_cas.c	Sun May 30 00:17:20 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_cas.c,v 1.45 2021/05/08 00:27:02 thorpej Exp $	*/
+/*	$NetBSD: if_cas.c,v 1.46 2021/05/30 00:17:20 joerg Exp $	*/
 /*	$OpenBSD: if_cas.c,v 1.29 2009/11/29 16:19:38 kettenis Exp $	*/
 
 /*
@@ -44,7 +44,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_cas.c,v 1.45 2021/05/08 00:27:02 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cas.c,v 1.46 2021/05/30 00:17:20 joerg Exp $");
 
 #ifndef _MODULE
 #include "opt_inet.h"
@@ -783,8 +783,8 @@ cas_detach(device_t self, int flags)
 			/* XXX   need to check that bus_dmamem_alloc suceeded
 			if (sc->sc_rxsoft[i].rxs_dmaseg != NULL)
 			*/
-bus_dmamem_free(sc->sc_dmatag,
-&(sc->sc_rxsoft[i].rxs_dmaseg), 1);
+			bus_dmamem_free(sc->sc_dmatag,
+			&(sc->sc_rxsoft[i].rxs_dmaseg), 1);
 		}
 		bus_dmamap_unload(sc->sc_dmatag, sc->sc_cddmamap);
 		/*FALLTHROUGH*/



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

2021-05-27 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu May 27 06:11:35 UTC 2021

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

Log Message:
 Do no_jmbuf++ when ixgbe_getjcl() failed in ixgbe_setup_receive_ring(), too.


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 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.78 src/sys/dev/pci/ixgbe/ix_txrx.c:1.79
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.78	Thu May 20 22:36:08 2021
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Thu May 27 06:11:34 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.78 2021/05/20 22:36:08 ryo Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.79 2021/05/27 06:11:34 msaitoh Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.78 2021/05/20 22:36:08 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.79 2021/05/27 06:11:34 msaitoh Exp $");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -1548,6 +1548,7 @@ ixgbe_setup_receive_ring(struct rx_ring 
 		rxbuf->buf = ixgbe_getjcl(>jcl_head, M_NOWAIT,
 		MT_DATA, M_PKTHDR, adapter->rx_mbuf_sz);
 		if (rxbuf->buf == NULL) {
+			rxr->no_jmbuf.ev_count++;
 			error = ENOBUFS;
 			goto fail;
 		}



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

2021-05-21 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri May 21 20:23:35 UTC 2021

Modified Files:
src/sys/dev/pci/voyager: voyagerfb.c

Log Message:
fix wsdisplay attachment in the New Order Of Things


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/pci/voyager/voyagerfb.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/voyager/voyagerfb.c
diff -u src/sys/dev/pci/voyager/voyagerfb.c:1.31 src/sys/dev/pci/voyager/voyagerfb.c:1.32
--- src/sys/dev/pci/voyager/voyagerfb.c:1.31	Fri May 21 20:22:15 2021
+++ src/sys/dev/pci/voyager/voyagerfb.c	Fri May 21 20:23:35 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: voyagerfb.c,v 1.31 2021/05/21 20:22:15 macallan Exp $	*/
+/*	$NetBSD: voyagerfb.c,v 1.32 2021/05/21 20:23:35 macallan Exp $	*/
 
 /*
  * Copyright (c) 2009, 2011 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: voyagerfb.c,v 1.31 2021/05/21 20:22:15 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: voyagerfb.c,v 1.32 2021/05/21 20:23:35 macallan Exp $");
 
 #include 
 #include 
@@ -363,7 +363,9 @@ voyagerfb_attach(device_t parent, device
 	aa.accessops = _accessops;
 	aa.accesscookie = >vd;
 
-	config_found(sc->sc_dev, , wsemuldisplaydevprint, CFARG_EOL);
+	config_found(sc->sc_dev, , wsemuldisplaydevprint,
+	CFARG_IATTR, "wsemuldisplaydev",
+	CFARG_EOL);
 }
 
 static int



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

2021-05-21 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri May 21 20:22:15 UTC 2021

Modified Files:
src/sys/dev/pci/voyager: voyagerfb.c

Log Message:
use probed VRAM size to determine where to put the cursor instead of blindly
assuming 16MB
also make sure the glyph cache can't overlap with the cursor


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/pci/voyager/voyagerfb.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/voyager/voyagerfb.c
diff -u src/sys/dev/pci/voyager/voyagerfb.c:1.30 src/sys/dev/pci/voyager/voyagerfb.c:1.31
--- src/sys/dev/pci/voyager/voyagerfb.c:1.30	Sat Apr 24 23:36:58 2021
+++ src/sys/dev/pci/voyager/voyagerfb.c	Fri May 21 20:22:15 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: voyagerfb.c,v 1.30 2021/04/24 23:36:58 thorpej Exp $	*/
+/*	$NetBSD: voyagerfb.c,v 1.31 2021/05/21 20:22:15 macallan Exp $	*/
 
 /*
  * Copyright (c) 2009, 2011 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: voyagerfb.c,v 1.30 2021/04/24 23:36:58 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: voyagerfb.c,v 1.31 2021/05/21 20:22:15 macallan Exp $");
 
 #include 
 #include 
@@ -328,7 +328,8 @@ voyagerfb_attach(device_t parent, device
 			(*ri->ri_ops.allocattr)(ri, 0, 0, 0, );
 	}
 	glyphcache_init(>sc_gc, sc->sc_height,
-			(sc->sc_fbsize / sc->sc_stride) - sc->sc_height,
+			((sc->sc_fbsize - 16 * 64) / sc->sc_stride) - 
+			sc->sc_height,
 			sc->sc_width,
 			ri->ri_font->fontwidth,
 			ri->ri_font->fontheight,
@@ -780,7 +781,7 @@ voyagerfb_init(struct voyagerfb_softc *s
 	reg);
 
 	/* put the cursor at the end of video memory */
-	sc->sc_cursor_addr = 16 * 1024 * 1024 - 16 * 64;	/* XXX */
+	sc->sc_cursor_addr = sc->sc_fbsize - 16 * 64;	/* XXX */
 	DPRINTF("%s: %08x\n", __func__, sc->sc_cursor_addr); 
 	sc->sc_cursor = (uint32_t *)((uint8_t *)bus_space_vaddr(sc->sc_memt,
 			 sc->sc_fbh) + sc->sc_cursor_addr);



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

2021-05-20 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu May 20 22:36:09 UTC 2021

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

Log Message:
fix little-endian dependence


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 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.77 src/sys/dev/pci/ixgbe/ix_txrx.c:1.78
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.77	Thu May 20 10:39:32 2021
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Thu May 20 22:36:08 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.77 2021/05/20 10:39:32 msaitoh Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.78 2021/05/20 22:36:08 ryo Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.77 2021/05/20 10:39:32 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.78 2021/05/20 22:36:08 ryo Exp $");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -1125,7 +1125,7 @@ ixgbe_txeof(struct tx_ring *txr)
 		 *   or the slot has the DD bit set.
 		 */
 		if (kring->nr_kflags < kring->nkr_num_slots &&
-		txd[kring->nr_kflags].wb.status & IXGBE_TXD_STAT_DD) {
+		le32toh(txd[kring->nr_kflags].wb.status) & IXGBE_TXD_STAT_DD) {
 			netmap_tx_irq(ifp, txr->me);
 		}
 		return false;
@@ -1150,7 +1150,7 @@ ixgbe_txeof(struct tx_ring *txr)
 		if (eop == NULL) /* No work */
 			break;
 
-		if ((eop->wb.status & IXGBE_TXD_STAT_DD) == 0)
+		if ((le32toh(eop->wb.status) & IXGBE_TXD_STAT_DD) == 0)
 			break;	/* I/O not complete */
 
 		if (buf->m_head) {



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

2021-05-20 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu May 20 10:39:32 UTC 2021

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

Log Message:
 Use uint64_t instead of bus_addr_t for the TX descriptor's buffer address.
At least, this change is required for macppc (sizeof(bus_addr_t) == 4) to
make TX work.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 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.76 src/sys/dev/pci/ixgbe/ix_txrx.c:1.77
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.76	Thu May 20 01:02:42 2021
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Thu May 20 10:39:32 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.76 2021/05/20 01:02:42 ryo Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.77 2021/05/20 10:39:32 msaitoh Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.76 2021/05/20 01:02:42 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.77 2021/05/20 10:39:32 msaitoh Exp $");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -501,7 +501,7 @@ retry:
 	i = txr->next_avail_desc;
 	for (j = 0; j < map->dm_nsegs; j++) {
 		bus_size_t seglen;
-		bus_addr_t segaddr;
+		uint64_t segaddr;
 
 		txbuf = >tx_buffers[i];
 		txd = >tx_base[i];



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

2021-05-19 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu May 20 01:02:42 UTC 2021

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

Log Message:
Added BUS_DMA_COHERENT flag to bus_dmamem_map() to improve stability on aarch64.

In ixgbe, TX/RX descriptor rings are configured in 16-byte units.
If BUS_DMA_COHERENT is not specified, cpu cache (writeback/invalidate)
operations by bus_dmamap_sync() in aarch64 (arm/arm32/bus_dma.c) are done per
cache line size (usually 64 bytes). As a result, adjacent descriptors conflict
with the DMA operation, resulting in unstable operation.

To avoid this, descriptors area should be mapped as non-cache with 
BUS_DMA_COHERENT.

thanks to msaitoh@ for his help in debugging.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 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.75 src/sys/dev/pci/ixgbe/ix_txrx.c:1.76
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.75	Tue May 18 05:29:15 2021
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Thu May 20 01:02:42 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.75 2021/05/18 05:29:15 msaitoh Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.76 2021/05/20 01:02:42 ryo Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.75 2021/05/18 05:29:15 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.76 2021/05/20 01:02:42 ryo Exp $");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -2208,7 +2208,7 @@ ixgbe_dma_malloc(struct adapter *adapter
 	}
 
 	r = bus_dmamem_map(dma->dma_tag->dt_dmat, >dma_seg, rsegs,
-	size, >dma_vaddr, BUS_DMA_NOWAIT);
+	size, >dma_vaddr, BUS_DMA_NOWAIT | BUS_DMA_COHERENT);
 	if (r != 0) {
 		aprint_error_dev(dev, "%s: bus_dmamem_map failed; error %d\n",
 		__func__, r);



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

2021-05-19 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed May 19 08:19:20 UTC 2021

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe_dcb_82598.h ixgbe_netbsd.h ixgbe_type.h
ixgbe_x540.c ixgbe_x550.c ixv.c

Log Message:
No functional change:

 - Add NetBSD RCS IDs.
 - KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/pci/ixgbe/ixgbe_dcb_82598.h
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/pci/ixgbe/ixgbe_netbsd.h
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/pci/ixgbe/ixgbe_x540.c
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/pci/ixgbe/ixgbe_x550.c
cvs rdiff -u -r1.160 -r1.161 src/sys/dev/pci/ixgbe/ixv.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_dcb_82598.h
diff -u src/sys/dev/pci/ixgbe/ixgbe_dcb_82598.h:1.6 src/sys/dev/pci/ixgbe/ixgbe_dcb_82598.h:1.7
--- src/sys/dev/pci/ixgbe/ixgbe_dcb_82598.h:1.6	Wed Apr  4 08:13:07 2018
+++ src/sys/dev/pci/ixgbe/ixgbe_dcb_82598.h	Wed May 19 08:19:20 2021
@@ -1,3 +1,5 @@
+/* $NetBSD: ixgbe_dcb_82598.h,v 1.7 2021/05/19 08:19:20 msaitoh Exp $ */
+
 /**
   SPDX-License-Identifier: BSD-3-Clause
 

Index: src/sys/dev/pci/ixgbe/ixgbe_netbsd.h
diff -u src/sys/dev/pci/ixgbe/ixgbe_netbsd.h:1.12 src/sys/dev/pci/ixgbe/ixgbe_netbsd.h:1.13
--- src/sys/dev/pci/ixgbe/ixgbe_netbsd.h:1.12	Tue Mar  9 10:03:18 2021
+++ src/sys/dev/pci/ixgbe/ixgbe_netbsd.h	Wed May 19 08:19:20 2021
@@ -1,4 +1,4 @@
-/*$NetBSD: ixgbe_netbsd.h,v 1.12 2021/03/09 10:03:18 msaitoh Exp $*/
+/* $NetBSD: ixgbe_netbsd.h,v 1.13 2021/05/19 08:19:20 msaitoh Exp $ */
 /*
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -96,8 +96,8 @@ struct ixgbe_extmem_head {
 	booleh_initialized;
 };
 
-int ixgbe_dma_tag_create(bus_dma_tag_t, bus_size_t, bus_size_t, bus_size_t, int,
-bus_size_t, int, ixgbe_dma_tag_t **);
+int ixgbe_dma_tag_create(bus_dma_tag_t, bus_size_t, bus_size_t, bus_size_t,
+int, bus_size_t, int, ixgbe_dma_tag_t **);
 void ixgbe_dma_tag_destroy(ixgbe_dma_tag_t *);
 int ixgbe_dmamap_create(ixgbe_dma_tag_t *, int, bus_dmamap_t *);
 void ixgbe_dmamap_destroy(ixgbe_dma_tag_t *, bus_dmamap_t);

Index: src/sys/dev/pci/ixgbe/ixgbe_type.h
diff -u src/sys/dev/pci/ixgbe/ixgbe_type.h:1.48 src/sys/dev/pci/ixgbe/ixgbe_type.h:1.49
--- src/sys/dev/pci/ixgbe/ixgbe_type.h:1.48	Sat Dec 26 06:10:17 2020
+++ src/sys/dev/pci/ixgbe/ixgbe_type.h	Wed May 19 08:19:20 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_type.h,v 1.48 2020/12/26 06:10:17 msaitoh Exp $ */
+/* $NetBSD: ixgbe_type.h,v 1.49 2021/05/19 08:19:20 msaitoh Exp $ */
 
 /**
   SPDX-License-Identifier: BSD-3-Clause
@@ -2782,7 +2782,7 @@ enum {
 #define IXGBE_RXDADV_ERR_FDIR_LEN	0x0010 /* FDIR Length error */
 #define IXGBE_RXDADV_ERR_FDIR_DROP	0x0020 /* FDIR Drop error */
 #define IXGBE_RXDADV_ERR_FDIR_COLL	0x0040 /* FDIR Collision error */
-#define IXGBE_RXDADV_ERR_HBO	0x0080 /*Header Buffer Overflow */
+#define IXGBE_RXDADV_ERR_HBO	0x0080 /* Header Buffer Overflow */
 #define IXGBE_RXDADV_ERR_CE	0x0100 /* CRC Error */
 #define IXGBE_RXDADV_ERR_LE	0x0200 /* Length Error */
 #define IXGBE_RXDADV_ERR_PE	0x0800 /* Packet Error */

Index: src/sys/dev/pci/ixgbe/ixgbe_x540.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_x540.c:1.18 src/sys/dev/pci/ixgbe/ixgbe_x540.c:1.19
--- src/sys/dev/pci/ixgbe/ixgbe_x540.c:1.18	Fri Apr 30 06:55:32 2021
+++ src/sys/dev/pci/ixgbe/ixgbe_x540.c	Wed May 19 08:19:20 2021
@@ -1,3 +1,5 @@
+/* $NetBSD: ixgbe_x540.c,v 1.19 2021/05/19 08:19:20 msaitoh Exp $ */
+
 /**
   SPDX-License-Identifier: BSD-3-Clause
 
@@ -34,7 +36,7 @@
 /*$FreeBSD: head/sys/dev/ixgbe/ixgbe_x540.c 331224 2018-03-19 20:55:05Z erj $*/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe_x540.c,v 1.18 2021/04/30 06:55:32 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe_x540.c,v 1.19 2021/05/19 08:19:20 msaitoh Exp $");
 
 #include "ixgbe_x540.h"
 #include "ixgbe_type.h"

Index: src/sys/dev/pci/ixgbe/ixgbe_x550.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_x550.c:1.19 src/sys/dev/pci/ixgbe/ixgbe_x550.c:1.20
--- src/sys/dev/pci/ixgbe/ixgbe_x550.c:1.19	Fri Apr 30 06:55:32 2021
+++ src/sys/dev/pci/ixgbe/ixgbe_x550.c	Wed May 19 08:19:20 2021
@@ -1,3 +1,5 @@
+/* $NetBSD: ixgbe_x550.c,v 1.20 2021/05/19 08:19:20 msaitoh Exp $ */
+
 /**
 
   Copyright (c) 2001-2017, Intel Corporation
@@ -33,7 +35,7 @@
 /*$FreeBSD: head/sys/dev/ixgbe/ixgbe_x550.c 331224 2018-03-19 20:55:05Z erj $*/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe_x550.c,v 1.19 2021/04/30 06:55:32 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe_x550.c,v 1.20 2021/05/19 

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

2021-05-17 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue May 18 05:29:16 UTC 2021

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

Log Message:
- Cleanup an rxbuf entry when bus_dmamap_load_mbuf() failed to prevent panic.
- Print error number when error occurred.


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.282 -r1.283 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.159 -r1.160 src/sys/dev/pci/ixgbe/ixv.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.74 src/sys/dev/pci/ixgbe/ix_txrx.c:1.75
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.74	Fri May 14 05:15:17 2021
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Tue May 18 05:29:15 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.74 2021/05/14 05:15:17 msaitoh Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.75 2021/05/18 05:29:15 msaitoh Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.74 2021/05/14 05:15:17 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.75 2021/05/18 05:29:15 msaitoh Exp $");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -1556,8 +1556,16 @@ ixgbe_setup_receive_ring(struct rx_ring 
 		/* Get the memory mapping */
 		error = bus_dmamap_load_mbuf(rxr->ptag->dt_dmat, rxbuf->pmap,
 		mp, BUS_DMA_NOWAIT);
-		if (error != 0)
+		if (error != 0) {
+			/*
+			 * Clear this entry for later cleanup in
+			 * ixgbe_discard() which is called via
+			 * ixgbe_free_receive_ring().
+			 */
+			m_freem(mp);
+			rxbuf->buf = NULL;
 goto fail;
+		}
 		bus_dmamap_sync(rxr->ptag->dt_dmat, rxbuf->pmap,
 		0, adapter->rx_mbuf_sz, BUS_DMASYNC_PREREAD);
 		/* Update the descriptor and the cached value */

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.282 src/sys/dev/pci/ixgbe/ixgbe.c:1.283
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.282	Fri May  7 09:15:52 2021
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Tue May 18 05:29:16 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.282 2021/05/07 09:15:52 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.283 2021/05/18 05:29:16 msaitoh Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.282 2021/05/07 09:15:52 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.283 2021/05/18 05:29:16 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -3984,7 +3984,7 @@ ixgbe_init_locked(struct adapter *adapte
 	u32		rxdctl, rxctrl;
 	u32		ctrl_ext;
 	bool		unsupported_sfp = false;
-	int		i, j, err;
+	int		i, j, error;
 
 	/* XXX check IFF_UP and IFF_RUNNING, power-saving state! */
 
@@ -4042,8 +4042,10 @@ ixgbe_init_locked(struct adapter *adapte
 		adapter->rx_mbuf_sz = MJUMPAGESIZE;
 
 	/* Prepare receive descriptors and buffers */
-	if (ixgbe_setup_receive_structures(adapter)) {
-		device_printf(dev, "Could not setup receive structures\n");
+	error = ixgbe_setup_receive_structures(adapter);
+	if (error) {
+		device_printf(dev,
+		"Could not setup receive structures (err = %d)\n", error);
 		ixgbe_stop_locked(adapter);
 		return;
 	}
@@ -4173,8 +4175,8 @@ ixgbe_init_locked(struct adapter *adapte
 	 * need to be kick-started
 	 */
 	if (hw->phy.type == ixgbe_phy_none) {
-		err = hw->phy.ops.identify(hw);
-		if (err == IXGBE_ERR_SFP_NOT_SUPPORTED)
+		error = hw->phy.ops.identify(hw);
+		if (error == IXGBE_ERR_SFP_NOT_SUPPORTED)
 			unsupported_sfp = true;
 	} else if (hw->phy.type == ixgbe_phy_sfp_unsupported)
 		unsupported_sfp = true;

Index: src/sys/dev/pci/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.159 src/sys/dev/pci/ixgbe/ixv.c:1.160
--- src/sys/dev/pci/ixgbe/ixv.c:1.159	Fri Apr 30 06:55:32 2021
+++ src/sys/dev/pci/ixgbe/ixv.c	Tue May 18 05:29:16 2021
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.159 2021/04/30 06:55:32 msaitoh Exp $*/
+/*$NetBSD: ixv.c,v 1.160 2021/05/18 05:29:16 msaitoh Exp $*/
 
 /**
 
@@ -35,7 +35,7 @@
 /*$FreeBSD: head/sys/dev/ixgbe/if_ixv.c 331224 2018-03-19 20:55:05Z erj $*/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.159 2021/04/30 06:55:32 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.160 2021/05/18 05:29:16 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -756,8 +756,10 @@ ixv_init_locked(struct adapter *adapter)
 		adapter->rx_mbuf_sz = MJUMPAGESIZE;
 
 	/* Prepare receive descriptors and buffers */
-	if (ixgbe_setup_receive_structures(adapter)) {
-		device_printf(dev, "Could not setup receive structures\n");
+	error = ixgbe_setup_receive_structures(adapter);
+	if (error) {
+		device_printf(dev,
+		"Could not setup receive structures (err = %d)\n", error);
 		

CVS commit: src/sys/dev/pci

2021-05-15 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat May 15 13:00:45 UTC 2021

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

Log Message:
Change PCI_VENDOR_MASK and PCI_PRODUCT_MASK to unsigned values, to prevent
sign extension of product ID when shifted up into place in PCI_ID_CODE()

Should fix PR 56176.


To generate a diff of this commit:
cvs rdiff -u -r1.153 -r1.154 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/pcireg.h
diff -u src/sys/dev/pci/pcireg.h:1.153 src/sys/dev/pci/pcireg.h:1.154
--- src/sys/dev/pci/pcireg.h:1.153	Mon Dec 28 13:12:24 2020
+++ src/sys/dev/pci/pcireg.h	Sat May 15 13:00:45 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcireg.h,v 1.153 2020/12/28 13:12:24 skrll Exp $	*/
+/*	$NetBSD: pcireg.h,v 1.154 2021/05/15 13:00:45 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996, 1999, 2000
@@ -54,12 +54,12 @@ typedef u_int16_t pci_vendor_id_t;
 typedef u_int16_t pci_product_id_t;
 
 #define	PCI_VENDOR_SHIFT		0
-#define	PCI_VENDOR_MASK			0x
+#define	PCI_VENDOR_MASK			0xU
 #define	PCI_VENDOR(id) \
 	(((id) >> PCI_VENDOR_SHIFT) & PCI_VENDOR_MASK)
 
 #define	PCI_PRODUCT_SHIFT		16
-#define	PCI_PRODUCT_MASK		0x
+#define	PCI_PRODUCT_MASK		0xU
 #define	PCI_PRODUCT(id) \
 	(((id) >> PCI_PRODUCT_SHIFT) & PCI_PRODUCT_MASK)
 



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

2021-05-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri May 14 05:15:17 UTC 2021

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

Log Message:
Keep m_len and m_pkthdr.len consistent to prevent panic on arm.

   Arm's bus_dmamap_load_mbuf() keeps a pointer to the original mbuf
  and bus_dmamap_sync() refers it. ixgbe_rxeof() modified mbuf's m_len
  inconsistently with m_pkthdr and dm_mapsize. "ifconfig down up" made
  panic by referring the inconsistent mbuf length.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 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.73 src/sys/dev/pci/ixgbe/ix_txrx.c:1.74
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.73	Fri May 14 01:30:06 2021
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Fri May 14 05:15:17 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.73 2021/05/14 01:30:06 knakahara Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.74 2021/05/14 05:15:17 msaitoh Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.73 2021/05/14 01:30:06 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.74 2021/05/14 05:15:17 msaitoh Exp $");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -1949,7 +1949,6 @@ ixgbe_rxeof(struct ix_queue *que)
 		 * buffer struct and pass this along from one
 		 * descriptor to the next, until we get EOP.
 		 */
-		mp->m_len = len;
 		/*
 		 * See if there is a stored head
 		 * that determines what we are
@@ -1958,6 +1957,7 @@ ixgbe_rxeof(struct ix_queue *que)
 		if (sendmp != NULL) {  /* secondary frag */
 			rbuf->buf = newmp;
 			rbuf->fmp = NULL;
+			mp->m_len = len;
 			mp->m_flags &= ~M_PKTHDR;
 			sendmp->m_pkthdr.len += mp->m_len;
 		} else {
@@ -1983,12 +1983,13 @@ ixgbe_rxeof(struct ix_queue *que)
 			if (sendmp == NULL) {
 rbuf->buf = newmp;
 rbuf->fmp = NULL;
+mp->m_len = len;
 sendmp = mp;
 			}
 
 			/* first desc of a non-ps chain */
 			sendmp->m_flags |= M_PKTHDR;
-			sendmp->m_pkthdr.len = mp->m_len;
+			sendmp->m_pkthdr.len = len;
 		}
 		++processed;
 



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

2021-05-13 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Fri May 14 01:30:06 UTC 2021

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

Log Message:
Comment out flow director processing in fast path.

ixgbe_xmit() is per-queue fast path.  It should reduce access to
per-device data (adapter->feat_en).


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 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.72 src/sys/dev/pci/ixgbe/ix_txrx.c:1.73
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.72	Tue May 11 01:30:30 2021
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Fri May 14 01:30:06 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.72 2021/05/11 01:30:30 rin Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.73 2021/05/14 01:30:06 knakahara Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.72 2021/05/11 01:30:30 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.73 2021/05/14 01:30:06 knakahara Exp $");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -485,6 +485,7 @@ retry:
 		return (error);
 	}
 
+#ifdef IXGBE_FDIR
 	/* Do the flow director magic */
 	if ((adapter->feat_en & IXGBE_FEATURE_FDIR) &&
 	(txr->atr_sample) && (!adapter->fdir_reinit)) {
@@ -494,6 +495,7 @@ retry:
 			txr->atr_count = 0;
 		}
 	}
+#endif
 
 	olinfo_status |= IXGBE_ADVTXD_CC;
 	i = txr->next_avail_desc;



CVS commit: src/sys/dev/pci

2021-05-12 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Wed May 12 10:16:12 UTC 2021

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

Log Message:
Fix i386 build failure with options WM_EVENT_COUNTERS.

pointed out by msaitoh@n.o.


To generate a diff of this commit:
cvs rdiff -u -r1.703 -r1.704 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.703 src/sys/dev/pci/if_wm.c:1.704
--- src/sys/dev/pci/if_wm.c:1.703	Mon May  3 07:43:31 2021
+++ src/sys/dev/pci/if_wm.c	Wed May 12 10:16:12 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.703 2021/05/03 07:43:31 rillig Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.704 2021/05/12 10:16:12 knakahara Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.703 2021/05/03 07:43:31 rillig Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.704 2021/05/12 10:16:12 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -107,6 +107,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -667,12 +668,19 @@ do {	\
 } while (/*CONSTCOND*/0)
 
 #ifdef WM_EVENT_COUNTERS
+#ifdef __HAVE_ATOMIC64_LOADSTORE
 #define	WM_EVCNT_INCR(ev)		\
 	atomic_store_relaxed(&((ev)->ev_count),\
 	atomic_load_relaxed(&(ev)->ev_count) + 1)
 #define	WM_EVCNT_ADD(ev, val)		\
 	atomic_store_relaxed(&((ev)->ev_count),\
 	atomic_load_relaxed(&(ev)->ev_count) + (val))
+#else
+#define	WM_EVCNT_INCR(ev)		\
+	((ev)->ev_count)++
+#define	WM_EVCNT_ADD(ev, val)		\
+	(ev)->ev_count += (val)
+#endif
 
 #define WM_Q_EVCNT_INCR(qname, evname)			\
 	WM_EVCNT_INCR(&(qname)->qname##_ev_##evname)



CVS commit: src/sys/dev/pci

2021-05-11 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue May 11 06:03:54 UTC 2021

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

Log Message:
Forward the bridge's devhandle to the downstream bus.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/dev/pci/ppb.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/ppb.c
diff -u src/sys/dev/pci/ppb.c:1.71 src/sys/dev/pci/ppb.c:1.72
--- src/sys/dev/pci/ppb.c:1.71	Sat Apr 24 23:36:57 2021
+++ src/sys/dev/pci/ppb.c	Tue May 11 06:03:54 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ppb.c,v 1.71 2021/04/24 23:36:57 thorpej Exp $	*/
+/*	$NetBSD: ppb.c,v 1.72 2021/05/11 06:03:54 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1996, 1998 Christopher G. Demetriou.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ppb.c,v 1.71 2021/04/24 23:36:57 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ppb.c,v 1.72 2021/05/11 06:03:54 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ppb.h"
@@ -436,7 +436,13 @@ configure:
 	pba.pba_intrswiz = pa->pa_intrswiz;
 	pba.pba_intrtag = pa->pa_intrtag;
 
-	config_found(self, , pcibusprint, CFARG_EOL);
+	config_found(self, , pcibusprint,
+	/*
+	 * Forward along the device handle for the bridge to the
+	 * downstream bus.
+	 */
+	CFARG_DEVHANDLE, device_handle(self),
+	CFARG_EOL);
 }
 
 static int



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

2021-05-10 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue May 11 01:30:30 UTC 2021

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

Log Message:
Call bus_dmamap_unload(9) via ixgbe_dmamap_unload(), before freeing
DMA buffer. Also, when the buffer is already freed, do not call
bus_dmamap_unload(9) (no resource leaks with this change).

Otherwise, MMU fault occurs for some bus_dma(9) implementations.

With this fix, X550-T1 and X540-T1 work fine on alpha (at least
DS10 with PCI-PCIe reverse bridge).

Discussed with msaitoh. Thanks!


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 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.71 src/sys/dev/pci/ixgbe/ix_txrx.c:1.72
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.71	Fri Apr 30 06:55:32 2021
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Tue May 11 01:30:30 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.71 2021/04/30 06:55:32 msaitoh Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.72 2021/05/11 01:30:30 rin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.71 2021/04/30 06:55:32 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.72 2021/05/11 01:30:30 rin Exp $");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -1766,16 +1766,17 @@ ixgbe_rx_discard(struct rx_ring *rxr, in
 	if (rbuf->fmp != NULL) {/* Partial chain ? */
 		bus_dmamap_sync(rxr->ptag->dt_dmat, rbuf->pmap, 0,
 		rbuf->buf->m_pkthdr.len, BUS_DMASYNC_POSTREAD);
+		ixgbe_dmamap_unload(rxr->ptag, rbuf->pmap);
 		m_freem(rbuf->fmp);
 		rbuf->fmp = NULL;
 		rbuf->buf = NULL; /* rbuf->buf is part of fmp's chain */
 	} else if (rbuf->buf) {
 		bus_dmamap_sync(rxr->ptag->dt_dmat, rbuf->pmap, 0,
 		rbuf->buf->m_pkthdr.len, BUS_DMASYNC_POSTREAD);
+		ixgbe_dmamap_unload(rxr->ptag, rbuf->pmap);
 		m_free(rbuf->buf);
 		rbuf->buf = NULL;
 	}
-	ixgbe_dmamap_unload(rxr->ptag, rbuf->pmap);
 
 	rbuf->flags = 0;
 



CVS commit: src/sys/dev/pci

2021-05-07 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat May  8 00:27:02 UTC 2021

Modified Files:
src/sys/dev/pci: if_bwfm_pci.c if_bwi_pci.c if_cas.c if_dge.c if_et.c
if_fxp_pci.c if_iwi.c if_iwn.c if_jme.c if_kse.c if_malo_pci.c
if_msk.c if_mtd_pci.c if_rge.c if_sk.c if_tlp_pci.c if_vr.c

Log Message:
Use pci_compatible_match().


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/pci/if_bwfm_pci.c
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/pci/if_bwi_pci.c
cvs rdiff -u -r1.44 -r1.45 src/sys/dev/pci/if_cas.c
cvs rdiff -u -r1.58 -r1.59 src/sys/dev/pci/if_dge.c
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/pci/if_et.c
cvs rdiff -u -r1.85 -r1.86 src/sys/dev/pci/if_fxp_pci.c
cvs rdiff -u -r1.114 -r1.115 src/sys/dev/pci/if_iwi.c
cvs rdiff -u -r1.94 -r1.95 src/sys/dev/pci/if_iwn.c
cvs rdiff -u -r1.49 -r1.50 src/sys/dev/pci/if_jme.c
cvs rdiff -u -r1.56 -r1.57 src/sys/dev/pci/if_kse.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/pci/if_malo_pci.c
cvs rdiff -u -r1.115 -r1.116 src/sys/dev/pci/if_msk.c
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/pci/if_mtd_pci.c
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/pci/if_rge.c
cvs rdiff -u -r1.107 -r1.108 src/sys/dev/pci/if_sk.c
cvs rdiff -u -r1.129 -r1.130 src/sys/dev/pci/if_tlp_pci.c
cvs rdiff -u -r1.133 -r1.134 src/sys/dev/pci/if_vr.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_bwfm_pci.c
diff -u src/sys/dev/pci/if_bwfm_pci.c:1.9 src/sys/dev/pci/if_bwfm_pci.c:1.10
--- src/sys/dev/pci/if_bwfm_pci.c:1.9	Sat May 30 15:55:47 2020
+++ src/sys/dev/pci/if_bwfm_pci.c	Sat May  8 00:27:02 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bwfm_pci.c,v 1.9 2020/05/30 15:55:47 jdolecek Exp $	*/
+/*	$NetBSD: if_bwfm_pci.c,v 1.10 2021/05/08 00:27:02 thorpej Exp $	*/
 /*	$OpenBSD: if_bwfm_pci.c,v 1.18 2018/02/08 05:00:38 patrick Exp $	*/
 /*
  * Copyright (c) 2010-2016 Broadcom Corporation
@@ -366,12 +366,14 @@ static const struct bwfm_firmware_select
 	BWFM_FW_ENTRY_END
 };
 
-static const struct bwfm_pci_matchid {
-	pci_vendor_id_t		bwfm_vendor;
-	pci_product_id_t	bwfm_product;
-} bwfm_pci_devices[] = {
-	{ PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM43602 },
-	{ PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_BCM4350 },
+static const struct device_compatible_entry compat_data[] = {
+	{ .id = PCI_ID_CODE(PCI_VENDOR_BROADCOM,
+		PCI_PRODUCT_BROADCOM_BCM43602), },
+
+	{ .id = PCI_ID_CODE(PCI_VENDOR_BROADCOM,
+		PCI_PRODUCT_BROADCOM_BCM4350), },
+
+	PCI_COMPAT_EOL
 };
 
 static struct mbuf *
@@ -397,14 +399,7 @@ bwfm_pci_match(device_t parent, cfdata_t
 {
 	struct pci_attach_args *pa = aux;
 
-	if (PCI_VENDOR(pa->pa_id) != PCI_VENDOR_BROADCOM)
-		return 0;
-
-	for (size_t i = 0; i < __arraycount(bwfm_pci_devices); i++)
-		if (PCI_PRODUCT(pa->pa_id) == bwfm_pci_devices[i].bwfm_product)
-			return 1;
-
-	return 0;
+	return pci_compatible_match(pa, compat_data);
 }
 
 void

Index: src/sys/dev/pci/if_bwi_pci.c
diff -u src/sys/dev/pci/if_bwi_pci.c:1.16 src/sys/dev/pci/if_bwi_pci.c:1.17
--- src/sys/dev/pci/if_bwi_pci.c:1.16	Sun Dec  9 11:14:02 2018
+++ src/sys/dev/pci/if_bwi_pci.c	Sat May  8 00:27:02 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bwi_pci.c,v 1.16 2018/12/09 11:14:02 jdolecek Exp $	*/
+/*	$NetBSD: if_bwi_pci.c,v 1.17 2021/05/08 00:27:02 thorpej Exp $	*/
 /*	$OpenBSD: if_bwi_pci.c,v 1.6 2008/02/14 22:10:02 brad Exp $ */
 
 /*
@@ -24,7 +24,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bwi_pci.c,v 1.16 2018/12/09 11:14:02 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bwi_pci.c,v 1.17 2021/05/08 00:27:02 thorpej Exp $");
 
 #include 
 #include 
@@ -74,31 +74,52 @@ struct bwi_pci_softc {
 CFATTACH_DECL_NEW(bwi_pci, sizeof(struct bwi_pci_softc),
 bwi_pci_match, bwi_pci_attach, bwi_pci_detach, NULL);
 
+static const struct device_compatible_entry compat_data[] = {
+	{ .id = PCI_ID_CODE(PCI_VENDOR_BROADCOM,
+		PCI_PRODUCT_BROADCOM_BCM4303), },
+
+	{ .id = PCI_ID_CODE(PCI_VENDOR_BROADCOM,
+		PCI_PRODUCT_BROADCOM_BCM4306), },
+
+	{ .id = PCI_ID_CODE(PCI_VENDOR_BROADCOM,
+		PCI_PRODUCT_BROADCOM_BCM4306_2), },
+
+	{ .id = PCI_ID_CODE(PCI_VENDOR_BROADCOM,
+		PCI_PRODUCT_BROADCOM_BCM4307), },
+
+	{ .id = PCI_ID_CODE(PCI_VENDOR_BROADCOM,
+		PCI_PRODUCT_BROADCOM_BCM4309), },
+
+	{ .id = PCI_ID_CODE(PCI_VENDOR_BROADCOM,
+		PCI_PRODUCT_BROADCOM_BCM4311), },
+
+	{ .id = PCI_ID_CODE(PCI_VENDOR_BROADCOM,
+		PCI_PRODUCT_BROADCOM_BCM4312), },
+
+	{ .id = PCI_ID_CODE(PCI_VENDOR_BROADCOM,
+		PCI_PRODUCT_BROADCOM_BCM4318), },
+
+	{ .id = PCI_ID_CODE(PCI_VENDOR_BROADCOM,
+		PCI_PRODUCT_BROADCOM_BCM4319), },
+
+	{ .id = PCI_ID_CODE(PCI_VENDOR_BROADCOM,
+		PCI_PRODUCT_BROADCOM_BCM4322), },
+
+	{ .id = PCI_ID_CODE(PCI_VENDOR_BROADCOM,
+		PCI_PRODUCT_BROADCOM_BCM43XG), },
+
+	{ .id = PCI_ID_CODE(PCI_VENDOR_BROADCOM,
+		PCI_PRODUCT_BROADCOM_BCM4328), },
+
+	PCI_COMPAT_EOL
+};
+
 static int
 bwi_pci_match(device_t parent, cfdata_t match, void *aux)
 {
 	struct pci_attach_args *pa 

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

2021-05-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri May  7 09:15:52 UTC 2021

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

Log Message:
 Print the error value of ixgbe_reset_hw() for debugging.


To generate a diff of this commit:
cvs rdiff -u -r1.281 -r1.282 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.281 src/sys/dev/pci/ixgbe/ixgbe.c:1.282
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.281	Fri Apr 30 06:55:32 2021
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Fri May  7 09:15:52 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.281 2021/04/30 06:55:32 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.282 2021/05/07 09:15:52 msaitoh Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.281 2021/04/30 06:55:32 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.282 2021/05/07 09:15:52 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1004,7 +1004,8 @@ ixgbe_attach(device_t parent, device_t d
 		unsupported_sfp = true;
 		error = IXGBE_SUCCESS;
 	} else if (error) {
-		aprint_error_dev(dev, "Hardware initialization failed\n");
+		aprint_error_dev(dev,
+		"Hardware initialization failed(error = %d)\n", error);
 		error = EIO;
 		goto err_late;
 	}



CVS commit: src/sys/dev/pci

2021-05-05 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Wed May  5 19:30:51 UTC 2021

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

Log Message:
disable MSI for SiI3124 - interrupts don't seem to work on this old board
when MSI is enabled, maybe because it's behind a PCI bridge

PR kern/55115 by John D. Baker


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/pci/siisata_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/siisata_pci.c
diff -u src/sys/dev/pci/siisata_pci.c:1.20 src/sys/dev/pci/siisata_pci.c:1.21
--- src/sys/dev/pci/siisata_pci.c:1.20	Thu Oct 25 21:03:19 2018
+++ src/sys/dev/pci/siisata_pci.c	Wed May  5 19:30:51 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: siisata_pci.c,v 1.20 2018/10/25 21:03:19 jdolecek Exp $ */
+/* $NetBSD: siisata_pci.c,v 1.21 2021/05/05 19:30:51 jdolecek Exp $ */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -51,7 +51,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: siisata_pci.c,v 1.20 2018/10/25 21:03:19 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: siisata_pci.c,v 1.21 2021/05/05 19:30:51 jdolecek Exp $");
 
 #include 
 #include 
@@ -82,14 +82,22 @@ struct siisata_pci_board {
 	pci_product_id_t	spb_prod;
 	uint16_t		spb_port;
 	uint16_t		spb_chip;
+	uint8_t			sbp_flags;
 };
 
+#define SIISATA_BROKEN_MSI		0x01
+
 static const struct siisata_pci_board siisata_pci_boards[] = {
 	{
 		.spb_vend = PCI_VENDOR_CMDTECH,
 		.spb_prod = PCI_PRODUCT_CMDTECH_3124,
 		.spb_port = 4,
 		.spb_chip = 3124,
+		/*
+		 * SiI3124 seems to be PCI/PCI-X chip behind PCI-e bridge,
+		 * claims MSI support but interrups don't work with MSI on.
+		 */
+		.sbp_flags = SIISATA_BROKEN_MSI,
 	},
 	{
 		.spb_vend = PCI_VENDOR_CMDTECH,
@@ -157,6 +165,9 @@ siisata_pci_attach(device_t parent, devi
 	bus_size_t grsize, prsize;
 	char intrbuf[PCI_INTRSTR_LEN];
 
+	spbp = siisata_pci_lookup(pa);
+	KASSERT(spbp != NULL);
+
 	sc->sc_atac.atac_dev = self;
 
 	psc->sc_pc = pa->pa_pc;
@@ -210,8 +221,19 @@ siisata_pci_attach(device_t parent, devi
 	else
 		sc->sc_dmat = pa->pa_dmat;
 
+	int counts[PCI_INTR_TYPE_SIZE] = {
+ 		[PCI_INTR_TYPE_INTX] = 1,
+ 		[PCI_INTR_TYPE_MSI] = 1,
+ 		[PCI_INTR_TYPE_MSIX] = 1,
+ 	};
+	int max_type = PCI_INTR_TYPE_MSIX;
+
+	if (spbp->sbp_flags & SIISATA_BROKEN_MSI) {
+		max_type = PCI_INTR_TYPE_INTX;
+	}
+
 	/* map interrupt */
-	if (pci_intr_alloc(pa, >sc_pihp, NULL, 0) != 0) {
+	if (pci_intr_alloc(pa, >sc_pihp, counts, max_type) != 0) {
 		bus_space_unmap(sc->sc_grt, sc->sc_grh, grsize);
 		bus_space_unmap(sc->sc_prt, sc->sc_prh, prsize);
 		aprint_error_dev(self, "couldn't map interrupt\n");
@@ -235,8 +257,6 @@ siisata_pci_attach(device_t parent, devi
 		intrstr ? intrstr : "unknown interrupt");
 
 	/* fill in number of ports on this device */
-	spbp = siisata_pci_lookup(pa);
-	KASSERT(spbp != NULL);
 	sc->sc_atac.atac_nchannels = spbp->spb_port;
 
 	/* set the necessary bits in case the firmware didn't */



CVS commit: src/sys/dev/pci

2021-05-03 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Mon May  3 07:43:31 UTC 2021

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

Log Message:
if_wm: do not return a void value from a void function

This is a GCC extension.


To generate a diff of this commit:
cvs rdiff -u -r1.702 -r1.703 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.702 src/sys/dev/pci/if_wm.c:1.703
--- src/sys/dev/pci/if_wm.c:1.702	Thu Mar 11 01:23:33 2021
+++ src/sys/dev/pci/if_wm.c	Mon May  3 07:43:31 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.702 2021/03/11 01:23:33 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.703 2021/05/03 07:43:31 rillig Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.702 2021/03/11 01:23:33 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.703 2021/05/03 07:43:31 rillig Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -14549,7 +14549,7 @@ wm_put_phy_82575(struct wm_softc *sc)
 
 	DPRINTF(sc, WM_DEBUG_LOCK, ("%s: %s called\n",
 		device_xname(sc->sc_dev), __func__));
-	return wm_put_swfw_semaphore(sc, swfwphysem[sc->sc_funcid]);
+	wm_put_swfw_semaphore(sc, swfwphysem[sc->sc_funcid]);
 }
 
 static int



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

2021-04-30 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Apr 30 06:55:32 UTC 2021

Modified Files:
src/sys/dev/pci/ixgbe: if_bypass.c if_fdir.c if_sriov.c ix_txrx.c
ixgbe.c ixgbe_82598.c ixgbe_82599.c ixgbe_api.c ixgbe_common.c
ixgbe_dcb.c ixgbe_dcb_82598.c ixgbe_dcb_82599.c ixgbe_mbx.c
ixgbe_netbsd.c ixgbe_netmap.c ixgbe_osdep.c ixgbe_phy.c ixgbe_vf.c
ixgbe_x540.c ixgbe_x550.c ixv.c

Log Message:
 Add missing __KERNEL_RCSID().


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/pci/ixgbe/if_bypass.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/pci/ixgbe/if_fdir.c
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/pci/ixgbe/if_sriov.c \
src/sys/dev/pci/ixgbe/ixgbe_dcb.c
cvs rdiff -u -r1.70 -r1.71 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.280 -r1.281 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/pci/ixgbe/ixgbe_82598.c \
src/sys/dev/pci/ixgbe/ixgbe_netbsd.c
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/pci/ixgbe/ixgbe_82599.c
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/pci/ixgbe/ixgbe_api.c
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/pci/ixgbe/ixgbe_common.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/pci/ixgbe/ixgbe_dcb_82598.c \
src/sys/dev/pci/ixgbe/ixgbe_dcb_82599.c
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/pci/ixgbe/ixgbe_mbx.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/ixgbe/ixgbe_netmap.c
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/pci/ixgbe/ixgbe_osdep.c
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/pci/ixgbe/ixgbe_phy.c
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/pci/ixgbe/ixgbe_vf.c
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/pci/ixgbe/ixgbe_x540.c
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/pci/ixgbe/ixgbe_x550.c
cvs rdiff -u -r1.158 -r1.159 src/sys/dev/pci/ixgbe/ixv.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/if_bypass.c
diff -u src/sys/dev/pci/ixgbe/if_bypass.c:1.7 src/sys/dev/pci/ixgbe/if_bypass.c:1.8
--- src/sys/dev/pci/ixgbe/if_bypass.c:1.7	Fri Apr 30 06:41:36 2021
+++ src/sys/dev/pci/ixgbe/if_bypass.c	Fri Apr 30 06:55:32 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: if_bypass.c,v 1.7 2021/04/30 06:41:36 msaitoh Exp $ */
+/* $NetBSD: if_bypass.c,v 1.8 2021/04/30 06:55:32 msaitoh Exp $ */
 /**
 
   Copyright (c) 2001-2017, Intel Corporation
@@ -33,6 +33,8 @@
 **/
 /*$FreeBSD: head/sys/dev/ixgbe/if_bypass.c 327031 2017-12-20 18:15:06Z erj $*/
 
+#include 
+__KERNEL_RCSID(0, "$NetBSD: if_bypass.c,v 1.8 2021/04/30 06:55:32 msaitoh Exp $");
 
 #include "ixgbe.h"
 

Index: src/sys/dev/pci/ixgbe/if_fdir.c
diff -u src/sys/dev/pci/ixgbe/if_fdir.c:1.4 src/sys/dev/pci/ixgbe/if_fdir.c:1.5
--- src/sys/dev/pci/ixgbe/if_fdir.c:1.4	Fri Apr 30 06:41:36 2021
+++ src/sys/dev/pci/ixgbe/if_fdir.c	Fri Apr 30 06:55:32 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: if_fdir.c,v 1.4 2021/04/30 06:41:36 msaitoh Exp $ */
+/* $NetBSD: if_fdir.c,v 1.5 2021/04/30 06:55:32 msaitoh Exp $ */
 /**
 
   Copyright (c) 2001-2017, Intel Corporation
@@ -33,6 +33,9 @@
 **/
 /*$FreeBSD: head/sys/dev/ixgbe/if_fdir.c 327031 2017-12-20 18:15:06Z erj $*/
 
+#include 
+__KERNEL_RCSID(0, "$NetBSD: if_fdir.c,v 1.5 2021/04/30 06:55:32 msaitoh Exp $");
+
 #include "ixgbe.h"
 
 #ifdef IXGBE_FDIR

Index: src/sys/dev/pci/ixgbe/if_sriov.c
diff -u src/sys/dev/pci/ixgbe/if_sriov.c:1.10 src/sys/dev/pci/ixgbe/if_sriov.c:1.11
--- src/sys/dev/pci/ixgbe/if_sriov.c:1.10	Fri Apr 30 06:41:36 2021
+++ src/sys/dev/pci/ixgbe/if_sriov.c	Fri Apr 30 06:55:32 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: if_sriov.c,v 1.10 2021/04/30 06:41:36 msaitoh Exp $ */
+/* $NetBSD: if_sriov.c,v 1.11 2021/04/30 06:55:32 msaitoh Exp $ */
 /**
 
   Copyright (c) 2001-2017, Intel Corporation
@@ -33,6 +33,9 @@
 **/
 /*$FreeBSD: head/sys/dev/ixgbe/if_sriov.c 327031 2017-12-20 18:15:06Z erj $*/
 
+#include 
+__KERNEL_RCSID(0, "$NetBSD: if_sriov.c,v 1.11 2021/04/30 06:55:32 msaitoh Exp $");
+
 #include "ixgbe.h"
 #include "ixgbe_sriov.h"
 
Index: src/sys/dev/pci/ixgbe/ixgbe_dcb.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_dcb.c:1.10 src/sys/dev/pci/ixgbe/ixgbe_dcb.c:1.11
--- src/sys/dev/pci/ixgbe/ixgbe_dcb.c:1.10	Fri Apr 30 06:41:36 2021
+++ src/sys/dev/pci/ixgbe/ixgbe_dcb.c	Fri Apr 30 06:55:32 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_dcb.c,v 1.10 2021/04/30 06:41:36 msaitoh Exp $ */
+/* $NetBSD: ixgbe_dcb.c,v 1.11 2021/04/30 06:55:32 msaitoh Exp $ */
 /**
   SPDX-License-Identifier: BSD-3-Clause
 
@@ -34,6 +34,8 @@
 

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

2021-04-30 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Apr 30 06:41:36 UTC 2021

Modified Files:
src/sys/dev/pci/ixgbe: if_bypass.c if_fdir.c if_sriov.c ixgbe_bypass.h
ixgbe_dcb.c ixgbe_dcb.h ixgbe_dcb_82598.c ixgbe_dcb_82599.c
ixgbe_dcb_82599.h ixgbe_fdir.h ixgbe_features.h ixgbe_netmap.c
ixgbe_netmap.h ixgbe_rss.h ixgbe_sriov.h ixgbe_x540.h ixgbe_x550.h

Log Message:
 Add NetBSD RCS IDs. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/pci/ixgbe/if_bypass.c \
src/sys/dev/pci/ixgbe/ixgbe_dcb.h src/sys/dev/pci/ixgbe/ixgbe_dcb_82599.h
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/ixgbe/if_fdir.c \
src/sys/dev/pci/ixgbe/ixgbe_sriov.h
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/pci/ixgbe/if_sriov.c \
src/sys/dev/pci/ixgbe/ixgbe_dcb.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/pci/ixgbe/ixgbe_bypass.h \
src/sys/dev/pci/ixgbe/ixgbe_netmap.h
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/pci/ixgbe/ixgbe_dcb_82598.c \
src/sys/dev/pci/ixgbe/ixgbe_dcb_82599.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/pci/ixgbe/ixgbe_fdir.h \
src/sys/dev/pci/ixgbe/ixgbe_features.h \
src/sys/dev/pci/ixgbe/ixgbe_netmap.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/pci/ixgbe/ixgbe_rss.h
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/pci/ixgbe/ixgbe_x540.h
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/pci/ixgbe/ixgbe_x550.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/if_bypass.c
diff -u src/sys/dev/pci/ixgbe/if_bypass.c:1.6 src/sys/dev/pci/ixgbe/if_bypass.c:1.7
--- src/sys/dev/pci/ixgbe/if_bypass.c:1.6	Wed Aug 12 09:13:46 2020
+++ src/sys/dev/pci/ixgbe/if_bypass.c	Fri Apr 30 06:41:36 2021
@@ -1,3 +1,4 @@
+/* $NetBSD: if_bypass.c,v 1.7 2021/04/30 06:41:36 msaitoh Exp $ */
 /**
 
   Copyright (c) 2001-2017, Intel Corporation
Index: src/sys/dev/pci/ixgbe/ixgbe_dcb.h
diff -u src/sys/dev/pci/ixgbe/ixgbe_dcb.h:1.6 src/sys/dev/pci/ixgbe/ixgbe_dcb.h:1.7
--- src/sys/dev/pci/ixgbe/ixgbe_dcb.h:1.6	Wed Apr  4 08:13:07 2018
+++ src/sys/dev/pci/ixgbe/ixgbe_dcb.h	Fri Apr 30 06:41:36 2021
@@ -1,3 +1,4 @@
+/* $NetBSD: ixgbe_dcb.h,v 1.7 2021/04/30 06:41:36 msaitoh Exp $ */
 /**
   SPDX-License-Identifier: BSD-3-Clause
 
Index: src/sys/dev/pci/ixgbe/ixgbe_dcb_82599.h
diff -u src/sys/dev/pci/ixgbe/ixgbe_dcb_82599.h:1.6 src/sys/dev/pci/ixgbe/ixgbe_dcb_82599.h:1.7
--- src/sys/dev/pci/ixgbe/ixgbe_dcb_82599.h:1.6	Wed Apr  4 08:13:07 2018
+++ src/sys/dev/pci/ixgbe/ixgbe_dcb_82599.h	Fri Apr 30 06:41:36 2021
@@ -1,3 +1,4 @@
+/* $NetBSD: ixgbe_dcb_82599.h,v 1.7 2021/04/30 06:41:36 msaitoh Exp $ */
 /**
   SPDX-License-Identifier: BSD-3-Clause
 

Index: src/sys/dev/pci/ixgbe/if_fdir.c
diff -u src/sys/dev/pci/ixgbe/if_fdir.c:1.3 src/sys/dev/pci/ixgbe/if_fdir.c:1.4
--- src/sys/dev/pci/ixgbe/if_fdir.c:1.3	Mon Sep  7 05:50:58 2020
+++ src/sys/dev/pci/ixgbe/if_fdir.c	Fri Apr 30 06:41:36 2021
@@ -1,3 +1,4 @@
+/* $NetBSD: if_fdir.c,v 1.4 2021/04/30 06:41:36 msaitoh Exp $ */
 /**
 
   Copyright (c) 2001-2017, Intel Corporation
Index: src/sys/dev/pci/ixgbe/ixgbe_sriov.h
diff -u src/sys/dev/pci/ixgbe/ixgbe_sriov.h:1.3 src/sys/dev/pci/ixgbe/ixgbe_sriov.h:1.4
--- src/sys/dev/pci/ixgbe/ixgbe_sriov.h:1.3	Wed Apr  4 08:13:07 2018
+++ src/sys/dev/pci/ixgbe/ixgbe_sriov.h	Fri Apr 30 06:41:36 2021
@@ -1,3 +1,4 @@
+/* $NetBSD: ixgbe_sriov.h,v 1.4 2021/04/30 06:41:36 msaitoh Exp $ */
 /**
 
   Copyright (c) 2001-2017, Intel Corporation

Index: src/sys/dev/pci/ixgbe/if_sriov.c
diff -u src/sys/dev/pci/ixgbe/if_sriov.c:1.9 src/sys/dev/pci/ixgbe/if_sriov.c:1.10
--- src/sys/dev/pci/ixgbe/if_sriov.c:1.9	Mon Jan 25 19:59:49 2021
+++ src/sys/dev/pci/ixgbe/if_sriov.c	Fri Apr 30 06:41:36 2021
@@ -1,3 +1,4 @@
+/* $NetBSD: if_sriov.c,v 1.10 2021/04/30 06:41:36 msaitoh Exp $ */
 /**
 
   Copyright (c) 2001-2017, Intel Corporation
Index: src/sys/dev/pci/ixgbe/ixgbe_dcb.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_dcb.c:1.9 src/sys/dev/pci/ixgbe/ixgbe_dcb.c:1.10
--- src/sys/dev/pci/ixgbe/ixgbe_dcb.c:1.9	Mon Sep  3 16:29:33 2018
+++ src/sys/dev/pci/ixgbe/ixgbe_dcb.c	Fri Apr 30 06:41:36 2021
@@ -1,3 +1,4 @@
+/* $NetBSD: ixgbe_dcb.c,v 1.10 2021/04/30 06:41:36 msaitoh Exp $ */
 /**
   SPDX-License-Identifier: BSD-3-Clause
 

Index: src/sys/dev/pci/ixgbe/ixgbe_bypass.h
diff -u src/sys/dev/pci/ixgbe/ixgbe_bypass.h:1.1 src/sys/dev/pci/ixgbe/ixgbe_bypass.h:1.2
--- src/sys/dev/pci/ixgbe/ixgbe_bypass.h:1.1	Wed 

CVS commit: src/sys/dev/pci

2021-04-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Apr 26 19:35:16 UTC 2021

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

Log Message:
Be explicit about the "eap" interface attribute when attaching a "joy"
instance.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/pci/joy_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/joy_eap.c
diff -u src/sys/dev/pci/joy_eap.c:1.15 src/sys/dev/pci/joy_eap.c:1.16
--- src/sys/dev/pci/joy_eap.c:1.15	Sat Apr 24 23:36:57 2021
+++ src/sys/dev/pci/joy_eap.c	Mon Apr 26 19:35:16 2021
@@ -1,7 +1,7 @@
-/* $NetBSD: joy_eap.c,v 1.15 2021/04/24 23:36:57 thorpej Exp $ */
+/* $NetBSD: joy_eap.c,v 1.16 2021/04/26 19:35:16 thorpej Exp $ */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: joy_eap.c,v 1.15 2021/04/24 23:36:57 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: joy_eap.c,v 1.16 2021/04/26 19:35:16 thorpej Exp $");
 
 #include 
 #include 
@@ -59,7 +59,9 @@ eap_joy_attach(device_t eapdev, struct e
 	aa.aa_aaa.type = AUDIODEV_TYPE_AUX;
 	aa.aa_iot = gpa->gpa_iot;
 	aa.aa_ioh = ioh;
-	joydev = config_found(eapdev, , 0, CFARG_EOL);
+	joydev = config_found(eapdev, , 0,
+	CFARG_IATTR, "eap",
+	CFARG_EOL);
 	/* this cannot fail */
 	KASSERT(joydev != NULL);
 



CVS commit: src/sys/dev/pci

2021-04-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Apr 26 19:28:24 UTC 2021

Modified Files:
src/sys/dev/pci: eso.c files.pci

Log Message:
- The "eso" device does not need to carry the "midibus" interface attribute.
  It attaches "opl" and "mpu" instances, which themselves attach "midi".
- Be explicit about specifying the "eso" interface attribute when attaching
  "opl", "mpu", and "joy" instances.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/dev/pci/eso.c
cvs rdiff -u -r1.436 -r1.437 src/sys/dev/pci/files.pci

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/eso.c
diff -u src/sys/dev/pci/eso.c:1.73 src/sys/dev/pci/eso.c:1.74
--- src/sys/dev/pci/eso.c:1.73	Sat Apr 24 23:36:57 2021
+++ src/sys/dev/pci/eso.c	Mon Apr 26 19:28:24 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: eso.c,v 1.73 2021/04/24 23:36:57 thorpej Exp $	*/
+/*	$NetBSD: eso.c,v 1.74 2021/04/26 19:28:24 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: eso.c,v 1.73 2021/04/24 23:36:57 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: eso.c,v 1.74 2021/04/26 19:28:24 thorpej Exp $");
 
 #include "mpu.h"
 
@@ -426,12 +426,16 @@ eso_attach(device_t parent, device_t sel
 	aa.type = AUDIODEV_TYPE_OPL;
 	aa.hwif = NULL;
 	aa.hdl = NULL;
-	(void)config_found(sc->sc_dev, , audioprint, CFARG_EOL);
+	(void)config_found(sc->sc_dev, , audioprint,
+	CFARG_IATTR, "eso",
+	CFARG_EOL);
 
 	aa.type = AUDIODEV_TYPE_MPU;
 	aa.hwif = NULL;
 	aa.hdl = NULL;
-	sc->sc_mpudev = config_found(sc->sc_dev, , audioprint, CFARG_EOL);
+	sc->sc_mpudev = config_found(sc->sc_dev, , audioprint,
+	CFARG_IATTR, "eso",
+	CFARG_EOL);
 	if (sc->sc_mpudev != NULL) {
 		/* Unmask the MPU irq. */
 		mutex_spin_enter(>sc_intr_lock);
@@ -444,7 +448,9 @@ eso_attach(device_t parent, device_t sel
 	aa.type = AUDIODEV_TYPE_AUX;
 	aa.hwif = NULL;
 	aa.hdl = NULL;
-	(void)config_found(sc->sc_dev, , eso_print, CFARG_EOL);
+	(void)config_found(sc->sc_dev, , eso_print,
+	CFARG_IATTR, "eso",
+	CFARG_EOL);
 }
 
 static void

Index: src/sys/dev/pci/files.pci
diff -u src/sys/dev/pci/files.pci:1.436 src/sys/dev/pci/files.pci:1.437
--- src/sys/dev/pci/files.pci:1.436	Tue Mar  9 10:03:18 2021
+++ src/sys/dev/pci/files.pci	Mon Apr 26 19:28:24 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: files.pci,v 1.436 2021/03/09 10:03:18 msaitoh Exp $
+#	$NetBSD: files.pci,v 1.437 2021/04/26 19:28:24 thorpej Exp $
 #
 # Config file and device description for machine-independent PCI code.
 # Included by ports that need it.  Requires that the SCSI files be
@@ -516,7 +516,7 @@ attach	esa at pci
 file	dev/pci/esa.c			esa
 
 # ESS Solo-1 PCI AudioDrive
-device	eso { }: audiobus, midibus
+device	eso { }: audiobus
 attach	eso at pci
 file	dev/pci/eso.c			eso
 



CVS commit: src/sys/dev/pci

2021-04-21 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed Apr 21 13:12:43 UTC 2021

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

Log Message:
regenerate


To generate a diff of this commit:
cvs rdiff -u -r1.1411 -r1.1412 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1410 -r1.1411 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.

Modified files:

Index: src/sys/dev/pci/pcidevs.h
diff -u src/sys/dev/pci/pcidevs.h:1.1411 src/sys/dev/pci/pcidevs.h:1.1412
--- src/sys/dev/pci/pcidevs.h:1.1411	Fri Apr  2 01:08:02 2021
+++ src/sys/dev/pci/pcidevs.h	Wed Apr 21 13:12:42 2021
@@ -1,10 +1,10 @@
-/*	$NetBSD: pcidevs.h,v 1.1411 2021/04/02 01:08:02 rin Exp $	*/
+/*	$NetBSD: pcidevs.h,v 1.1412 2021/04/21 13:12:42 jakllsch Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: pcidevs,v 1.1425 2021/04/02 01:07:16 rin Exp
+ *	NetBSD: pcidevs,v 1.1426 2021/04/21 13:09:33 jakllsch Exp
  */
 
 /*
@@ -7567,7 +7567,7 @@
 #define	PCI_PRODUCT_REALTEK_RT8029	0x8029		/* 8029 Ethernet */
 #define	PCI_PRODUCT_REALTEK_RT8139D	0x8039		/* 8139D 10/100 Ethernet */
 #define	PCI_PRODUCT_REALTEK_RT8100	0x8100		/* 8100 10/100 Ethernet */
-#define	PCI_PRODUCT_REALTEK_RT8125	0x8125		/* 8129 10/100/1G/2.5G Ethernet */
+#define	PCI_PRODUCT_REALTEK_RT8125	0x8125		/* 8125 10/100/1G/2.5G Ethernet */
 #define	PCI_PRODUCT_REALTEK_RT8129	0x8129		/* 8129 10/100 Ethernet */
 #define	PCI_PRODUCT_REALTEK_RT8101E	0x8136		/* 8100E/8101E/8102E 10/100 Ethernet */
 #define	PCI_PRODUCT_REALTEK_RT8138	0x8138		/* 8138 10/100 Ethernet */

Index: src/sys/dev/pci/pcidevs_data.h
diff -u src/sys/dev/pci/pcidevs_data.h:1.1410 src/sys/dev/pci/pcidevs_data.h:1.1411
--- src/sys/dev/pci/pcidevs_data.h:1.1410	Fri Apr  2 01:08:02 2021
+++ src/sys/dev/pci/pcidevs_data.h	Wed Apr 21 13:12:42 2021
@@ -1,10 +1,10 @@
-/*	$NetBSD: pcidevs_data.h,v 1.1410 2021/04/02 01:08:02 rin Exp $	*/
+/*	$NetBSD: pcidevs_data.h,v 1.1411 2021/04/21 13:12:42 jakllsch Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: pcidevs,v 1.1425 2021/04/02 01:07:16 rin Exp
+ *	NetBSD: pcidevs,v 1.1426 2021/04/21 13:09:33 jakllsch Exp
  */
 
 /*
@@ -13470,439 +13470,439 @@ static const uint16_t pci_products[] = {
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8125, 
 	33098, 33103, 5684, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8129, 
-	33098, 5786, 5684, 0,
-	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8101E, 
 	33118, 5786, 5684, 0,
+	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8101E, 
+	33123, 5786, 5684, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8138, 
-	33136, 5786, 5684, 0,
+	33141, 5786, 5684, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8139, 
 	7566, 5786, 5684, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8169SC, 
-	33141, 5699, 5684, 0,
+	33146, 5699, 5684, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8168, 
-	33155, 5699, 5684, 0,
+	33160, 5699, 5684, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8169, 
-	33165, 5699, 5684, 0,
+	33170, 5699, 5684, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTL8188CE, 
-	33175, 4759, 4534, 33185, 18821, 19433, 0,
+	33180, 4759, 4534, 33190, 18821, 19433, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTL8192CE, 
-	33193, 4759, 4534, 33185, 18821, 19433, 0,
+	33198, 4759, 4534, 33190, 18821, 19433, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTL8188EE, 
-	33203, 4759, 4534, 33185, 18821, 19433, 0,
+	33208, 4759, 4534, 33190, 18821, 19433, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8180, 
-	33213, 7653, 0,
+	33218, 7653, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8185, 
-	33218, 33223, 0,
+	33223, 33228, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTL8192EE, 
-	33235, 4759, 4534, 33185, 18821, 19433, 0,
+	33240, 4759, 4534, 33190, 18821, 19433, 0,
 	PCI_VENDOR_REDHAT, PCI_PRODUCT_REDHAT_PPB, 
-	33245, 8506, 0,
+	33250, 8506, 0,
 	PCI_VENDOR_REDHAT, PCI_PRODUCT_REDHAT_QXL, 
-	33250, 234, 0,
+	33255, 234, 0,
 	PCI_VENDOR_RENESAS, PCI_PRODUCT_RENESAS_SH7780, 
-	33254, 615, 6422, 0,
+	33259, 615, 6422, 0,
 	PCI_VENDOR_RENESAS, PCI_PRODUCT_RENESAS_SH7785, 
-	33261, 615, 6422, 0,
+	33266, 615, 6422, 0,
 	PCI_VENDOR_RENESAS, PCI_PRODUCT_RENESAS_SH7757_PBI, 
-	33268, 8140, 33275, 33285, 0,
+	33273, 8140, 33280, 33290, 0,
 	PCI_VENDOR_RENESAS, PCI_PRODUCT_RENESAS_SH7757_PPB, 
-	33268, 9419, 6530, 33291, 0,
+	33273, 9419, 6530, 33296, 0,
 	PCI_VENDOR_RENESAS, PCI_PRODUCT_RENESAS_SH7757_PS, 
-	33268, 8140, 14350, 33297, 0,
+	33273, 8140, 14350, 33302, 0,
 	PCI_VENDOR_RENESAS, PCI_PRODUCT_RENESAS_PD720201, 
-	33302, 6912, 8200, 6920, 6422, 0,
+	33307, 6912, 8200, 6920, 6422, 0,
 	

CVS commit: src/sys/dev/pci

2021-04-21 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed Apr 21 13:09:33 UTC 2021

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

Log Message:
Fix Realtek RTL8125 description


To generate a diff of this commit:
cvs rdiff -u -r1.1425 -r1.1426 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.1425 src/sys/dev/pci/pcidevs:1.1426
--- src/sys/dev/pci/pcidevs:1.1425	Fri Apr  2 01:07:16 2021
+++ src/sys/dev/pci/pcidevs	Wed Apr 21 13:09:33 2021
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1425 2021/04/02 01:07:16 rin Exp $
+$NetBSD: pcidevs,v 1.1426 2021/04/21 13:09:33 jakllsch Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -7560,7 +7560,7 @@ product REALTEK RTL8411		0x5289	RTL8411 
 product REALTEK RT8029		0x8029	8029 Ethernet
 product REALTEK RT8139D		0x8039	8139D 10/100 Ethernet
 product REALTEK RT8100		0x8100	8100 10/100 Ethernet
-product REALTEK RT8125		0x8125	8129 10/100/1G/2.5G Ethernet
+product REALTEK RT8125		0x8125	8125 10/100/1G/2.5G Ethernet
 product REALTEK RT8129		0x8129	8129 10/100 Ethernet
 product REALTEK RT8101E		0x8136	8100E/8101E/8102E 10/100 Ethernet
 product REALTEK RT8138		0x8138	8138 10/100 Ethernet



CVS commit: src/sys/dev/pci

2021-04-16 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Fri Apr 16 08:09:40 UTC 2021

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

Log Message:
fix typo


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 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.24 src/sys/dev/pci/if_aq.c:1.25
--- src/sys/dev/pci/if_aq.c:1.24	Fri Apr 16 08:07:02 2021
+++ src/sys/dev/pci/if_aq.c	Fri Apr 16 08:09:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_aq.c,v 1.24 2021/04/16 08:07:02 ryo Exp $	*/
+/*	$NetBSD: if_aq.c,v 1.25 2021/04/16 08:09:40 ryo Exp $	*/
 
 /**
  * aQuantia Corporation Network Driver
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.24 2021/04/16 08:07:02 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.25 2021/04/16 08:09:40 ryo Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_if_aq.h"
@@ -1449,11 +1449,11 @@ aq_attach(device_t parent, device_t self
 	ifp->if_capabilities |= IFCAP_TSOv4 | IFCAP_TSOv6;
 #endif
 
-	/* TX hardware checksum offloadding */
+	/* TX hardware checksum offloading */
 	ifp->if_capabilities |= IFCAP_CSUM_IPv4_Tx;
 	ifp->if_capabilities |= IFCAP_CSUM_TCPv4_Tx | IFCAP_CSUM_TCPv6_Tx;
 	ifp->if_capabilities |= IFCAP_CSUM_UDPv4_Tx | IFCAP_CSUM_UDPv6_Tx;
-	/* RX hardware checksum offloadding */
+	/* RX hardware checksum offloading */
 	ifp->if_capabilities |= IFCAP_CSUM_IPv4_Rx;
 	ifp->if_capabilities |= IFCAP_CSUM_TCPv4_Rx | IFCAP_CSUM_TCPv6_Rx;
 	ifp->if_capabilities |= IFCAP_CSUM_UDPv4_Rx | IFCAP_CSUM_UDPv6_Rx;



CVS commit: src/sys/dev/pci

2021-04-16 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Fri Apr 16 08:07:02 UTC 2021

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

Log Message:
when the packet size was just n*MCLBYTES, there was an inconsistency in the 
length of mbuf.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 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.23 src/sys/dev/pci/if_aq.c:1.24
--- src/sys/dev/pci/if_aq.c:1.23	Thu Apr 15 09:05:24 2021
+++ src/sys/dev/pci/if_aq.c	Fri Apr 16 08:07:02 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_aq.c,v 1.23 2021/04/15 09:05:24 ryo Exp $	*/
+/*	$NetBSD: if_aq.c,v 1.24 2021/04/16 08:07:02 ryo Exp $	*/
 
 /**
  * aQuantia Corporation Network Driver
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.23 2021/04/15 09:05:24 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.24 2021/04/16 08:07:02 ryo Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_if_aq.h"
@@ -4340,7 +4340,10 @@ aq_rx_intr(void *arg)
 			m->m_len = MCLBYTES;
 		} else {
 			/* last buffer */
-			m->m_len = rxd_pktlen % MCLBYTES;
+			int mlen = rxd_pktlen % MCLBYTES;
+			if (mlen == 0)
+mlen = MCLBYTES;
+			m->m_len = mlen;
 			m0->m_pkthdr.len = rxd_pktlen;
 			/* VLAN offloading */
 			if ((sc->sc_ethercom.ec_capenable &



CVS commit: src/sys/dev/pci

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

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

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


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

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

Modified files:

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



CVS commit: src/sys/dev/pci

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

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

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


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

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

Modified files:

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



CVS commit: src/sys/dev/pci

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

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

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


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

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

Modified files:

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



CVS commit: src/sys/dev/pci

2021-04-01 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr  2 01:08:03 UTC 2021

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.1410 -r1.1411 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1409 -r1.1410 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.

Modified files:

Index: src/sys/dev/pci/pcidevs.h
diff -u src/sys/dev/pci/pcidevs.h:1.1410 src/sys/dev/pci/pcidevs.h:1.1411
--- src/sys/dev/pci/pcidevs.h:1.1410	Sat Jan 30 21:24:46 2021
+++ src/sys/dev/pci/pcidevs.h	Fri Apr  2 01:08:02 2021
@@ -1,10 +1,10 @@
-/*	$NetBSD: pcidevs.h,v 1.1410 2021/01/30 21:24:46 jmcneill Exp $	*/
+/*	$NetBSD: pcidevs.h,v 1.1411 2021/04/02 01:08:02 rin Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: pcidevs,v 1.1424 2021/01/30 21:24:30 jmcneill Exp
+ *	NetBSD: pcidevs,v 1.1425 2021/04/02 01:07:16 rin Exp
  */
 
 /*
@@ -7260,7 +7260,7 @@
 #define	PCI_PRODUCT_PROLAN_NE2KETHER	0x1980		/* Ethernet */
 
 /* Promise products */
-#define	PCI_PRODUCT_PROMISE_PDC20265	0x0d30		/* PDC20265 Ultra/66 IDE Controller */
+#define	PCI_PRODUCT_PROMISE_PDC20265	0x0d30		/* PDC20265 Ultra/100 IDE Controller */
 #define	PCI_PRODUCT_PROMISE_PDC20263	0x0d38		/* PDC20263 Ultra/66 IDE Controller */
 #define	PCI_PRODUCT_PROMISE_PDC20275	0x1275		/* PDC20275 Ultra/133 IDE Controller */
 #define	PCI_PRODUCT_PROMISE_PDC20318	0x3318		/* PDC20318 Serial ATA Controller */

Index: src/sys/dev/pci/pcidevs_data.h
diff -u src/sys/dev/pci/pcidevs_data.h:1.1409 src/sys/dev/pci/pcidevs_data.h:1.1410
--- src/sys/dev/pci/pcidevs_data.h:1.1409	Sat Jan 30 21:24:46 2021
+++ src/sys/dev/pci/pcidevs_data.h	Fri Apr  2 01:08:02 2021
@@ -1,10 +1,10 @@
-/*	$NetBSD: pcidevs_data.h,v 1.1409 2021/01/30 21:24:46 jmcneill Exp $	*/
+/*	$NetBSD: pcidevs_data.h,v 1.1410 2021/04/02 01:08:02 rin Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: pcidevs,v 1.1424 2021/01/30 21:24:30 jmcneill Exp
+ *	NetBSD: pcidevs,v 1.1425 2021/04/02 01:07:16 rin Exp
  */
 
 /*
@@ -12906,75 +12906,75 @@ static const uint16_t pci_products[] = {
 	PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC20265, 
 	31910, 31919, 6593, 6422, 0,
 	PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC20263, 
-	31928, 31919, 6593, 6422, 0,
+	31929, 31938, 6593, 6422, 0,
 	PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC20275, 
-	31937, 31946, 6593, 6422, 0,
+	31947, 31956, 6593, 6422, 0,
 	PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC20318, 
-	31956, 12059, 6413, 6422, 0,
+	31966, 12059, 6413, 6422, 0,
 	PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC20319, 
-	31965, 12059, 6413, 6422, 0,
+	31975, 12059, 6413, 6422, 0,
 	PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC20371, 
-	31974, 12059, 6413, 6422, 0,
+	31984, 12059, 6413, 6422, 0,
 	PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC20379, 
-	31983, 12059, 6413, 6422, 0,
+	31993, 12059, 6413, 6422, 0,
 	PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC20378, 
-	31992, 12059, 6413, 6422, 0,
+	32002, 12059, 6413, 6422, 0,
 	PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC20375, 
-	32001, 12059, 6413, 6422, 0,
+	32011, 12059, 6413, 6422, 0,
 	PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC20376, 
-	32010, 12059, 6413, 6422, 0,
+	32020, 12059, 6413, 6422, 0,
 	PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC20377, 
-	32019, 12059, 6413, 6422, 0,
+	32029, 12059, 6413, 6422, 0,
 	PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC40719, 
-	32028, 12059, 6413, 6422, 0,
+	32038, 12059, 6413, 6422, 0,
 	PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC40519, 
-	32037, 12059, 6413, 6422, 0,
+	32047, 12059, 6413, 6422, 0,
 	PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC20771, 
-	32046, 12059, 6413, 6422, 0,
+	32056, 12059, 6413, 6422, 0,
 	PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC20571, 
-	32055, 12059, 6413, 6422, 0,
+	32065, 12059, 6413, 6422, 0,
 	PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC20579, 
-	32064, 12059, 6413, 6422, 0,
+	32074, 12059, 6413, 6422, 0,
 	PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC40779, 
-	32073, 12059, 6413, 6422, 0,
+	32083, 12059, 6413, 6422, 0,
 	PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC40718, 
-	32082, 12059, 6413, 6422, 0,
+	32092, 12059, 6413, 6422, 0,
 	PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC40518, 
-	32091, 12059, 6413, 6422, 0,
+	32101, 12059, 6413, 6422, 0,
 	PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC20775, 
-	32100, 12059, 6413, 6422, 0,
+	32110, 12059, 6413, 6422, 0,
 	PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC20575, 
-	32109, 12059, 6413, 6422, 0,
+	32119, 12059, 6413, 6422, 0,
 	PCI_VENDOR_PROMISE, PCI_PRODUCT_PROMISE_PDC20267, 
-	32118, 32127, 6593, 

CVS commit: src/sys/dev/pci

2021-04-01 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr  2 01:07:16 UTC 2021

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

Log Message:
PDC20265 is Ultra/100, not 66.


To generate a diff of this commit:
cvs rdiff -u -r1.1424 -r1.1425 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.1424 src/sys/dev/pci/pcidevs:1.1425
--- src/sys/dev/pci/pcidevs:1.1424	Sat Jan 30 21:24:30 2021
+++ src/sys/dev/pci/pcidevs	Fri Apr  2 01:07:16 2021
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1424 2021/01/30 21:24:30 jmcneill Exp $
+$NetBSD: pcidevs,v 1.1425 2021/04/02 01:07:16 rin Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -7253,7 +7253,7 @@ product POWERHOUSE POWERPRO	0x6073	Power
 product PROLAN NE2KETHER 0x1980 Ethernet
 
 /* Promise products */
-product PROMISE PDC20265	0x0d30	PDC20265 Ultra/66 IDE Controller
+product PROMISE PDC20265	0x0d30	PDC20265 Ultra/100 IDE Controller
 product PROMISE PDC20263	0x0d38	PDC20263 Ultra/66 IDE Controller
 product PROMISE PDC20275	0x1275	PDC20275 Ultra/133 IDE Controller
 product PROMISE PDC20318	0x3318	PDC20318 Serial ATA Controller



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

2021-03-31 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Mar 31 07:53:53 UTC 2021

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

Log Message:
KNF a bit. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.279 -r1.280 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.157 -r1.158 src/sys/dev/pci/ixgbe/ixv.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.69 src/sys/dev/pci/ixgbe/ix_txrx.c:1.70
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.69	Fri Mar 12 01:54:29 2021
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Wed Mar 31 07:53:53 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.69 2021/03/12 01:54:29 knakahara Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.70 2021/03/31 07:53:53 msaitoh Exp $ */
 
 /**
 
@@ -202,7 +202,7 @@ ixgbe_mq_start(struct ifnet *ifp, struct
 {
 	struct adapter	*adapter = ifp->if_softc;
 	struct tx_ring	*txr;
-	int 		i;
+	int		i;
 #ifdef RSS
 	uint32_t bucket_id;
 #endif
@@ -1755,11 +1755,9 @@ ixgbe_rx_discard(struct rx_ring *rxr, in
 	rbuf = >rx_buffers[i];
 
 	/*
-	 * With advanced descriptors the writeback
-	 * clobbers the buffer addrs, so its easier
-	 * to just free the existing mbufs and take
-	 * the normal refresh path to get new buffers
-	 * and mapping.
+	 * With advanced descriptors the writeback clobbers the buffer addrs,
+	 * so its easier to just free the existing mbufs and take the normal
+	 * refresh path to get new buffers and mapping.
 	 */
 
 	if (rbuf->fmp != NULL) {/* Partial chain ? */

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.279 src/sys/dev/pci/ixgbe/ixgbe.c:1.280
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.279	Tue Mar  9 10:03:18 2021
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Wed Mar 31 07:53:53 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.279 2021/03/09 10:03:18 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.280 2021/03/31 07:53:53 msaitoh Exp $ */
 
 /**
 
@@ -1694,17 +1694,20 @@ ixgbe_update_stats_counters(struct adapt
 		stats->gorc.ev_count += IXGBE_READ_REG(hw, IXGBE_GORCL) +
 		((u64)IXGBE_READ_REG(hw, IXGBE_GORCH) << 32);
 		stats->gotc.ev_count += IXGBE_READ_REG(hw, IXGBE_GOTCL) +
-		((u64)IXGBE_READ_REG(hw, IXGBE_GOTCH) << 32) - total * ETHER_MIN_LEN;
+		((u64)IXGBE_READ_REG(hw, IXGBE_GOTCH) << 32)
+		- total * ETHER_MIN_LEN;
 		stats->tor.ev_count += IXGBE_READ_REG(hw, IXGBE_TORL) +
 		((u64)IXGBE_READ_REG(hw, IXGBE_TORH) << 32);
 		stats->lxonrxc.ev_count += IXGBE_READ_REG(hw, IXGBE_LXONRXCNT);
-		stats->lxoffrxc.ev_count += IXGBE_READ_REG(hw, IXGBE_LXOFFRXCNT);
+		stats->lxoffrxc.ev_count
+		+= IXGBE_READ_REG(hw, IXGBE_LXOFFRXCNT);
 	} else {
 		stats->lxonrxc.ev_count += IXGBE_READ_REG(hw, IXGBE_LXONRXC);
 		stats->lxoffrxc.ev_count += IXGBE_READ_REG(hw, IXGBE_LXOFFRXC);
 		/* 82598 only has a counter in the high register */
 		stats->gorc.ev_count += IXGBE_READ_REG(hw, IXGBE_GORCH);
-		stats->gotc.ev_count += IXGBE_READ_REG(hw, IXGBE_GOTCH) - total * ETHER_MIN_LEN;
+		stats->gotc.ev_count += IXGBE_READ_REG(hw, IXGBE_GOTCH)
+		- total * ETHER_MIN_LEN;
 		stats->tor.ev_count += IXGBE_READ_REG(hw, IXGBE_TORH);
 	}
 
@@ -1916,42 +1919,35 @@ ixgbe_add_hw_stats(struct adapter *adapt
 #endif
 
 		if (sysctl_createv(log, 0, , ,
-		CTLFLAG_READONLY,
-		CTLTYPE_INT,
-		"rxd_nxck", SYSCTL_DESCR("Receive Descriptor next to check"),
-			ixgbe_sysctl_next_to_check_handler, 0, (void *)rxr, 0,
+		CTLFLAG_READONLY, CTLTYPE_INT, "rxd_nxck",
+		SYSCTL_DESCR("Receive Descriptor next to check"),
+		ixgbe_sysctl_next_to_check_handler, 0, (void *)rxr, 0,
 		CTL_CREATE, CTL_EOL) != 0)
 			break;
 
 		if (sysctl_createv(log, 0, , ,
-		CTLFLAG_READONLY,
-		CTLTYPE_INT,
-		"rxd_head", SYSCTL_DESCR("Receive Descriptor Head"),
+		CTLFLAG_READONLY, CTLTYPE_INT, "rxd_head",
+		SYSCTL_DESCR("Receive Descriptor Head"),
 		ixgbe_sysctl_rdh_handler, 0, (void *)rxr, 0,
 		CTL_CREATE, CTL_EOL) != 0)
 			break;
 
 		if (sysctl_createv(log, 0, , ,
-		CTLFLAG_READONLY,
-		CTLTYPE_INT,
-		"rxd_tail", SYSCTL_DESCR("Receive Descriptor Tail"),
+		CTLFLAG_READONLY, CTLTYPE_INT, "rxd_tail",
+		SYSCTL_DESCR("Receive Descriptor Tail"),
 		ixgbe_sysctl_rdt_handler, 0, (void *)rxr, 0,
 		CTL_CREATE, CTL_EOL) != 0)
 			break;
 
 		if (i < __arraycount(stats->qprc)) {
-			evcnt_attach_dynamic(>qprc[i],
-			EVCNT_TYPE_MISC, NULL, adapter->queues[i].evnamebuf,
-			"qprc");
-			evcnt_attach_dynamic(>qptc[i],
-			EVCNT_TYPE_MISC, NULL, adapter->queues[i].evnamebuf,
-			"qptc");
-			evcnt_attach_dynamic(>qbrc[i],
-			EVCNT_TYPE_MISC, NULL, 

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

2021-03-31 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Mar 31 07:52:15 UTC 2021

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

Log Message:
Modify error message to sync with ixgbe.c


To generate a diff of this commit:
cvs rdiff -u -r1.156 -r1.157 src/sys/dev/pci/ixgbe/ixv.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/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.156 src/sys/dev/pci/ixgbe/ixv.c:1.157
--- src/sys/dev/pci/ixgbe/ixv.c:1.156	Thu Mar 11 02:30:47 2021
+++ src/sys/dev/pci/ixgbe/ixv.c	Wed Mar 31 07:52:14 2021
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.156 2021/03/11 02:30:47 msaitoh Exp $*/
+/*$NetBSD: ixv.c,v 1.157 2021/03/31 07:52:14 msaitoh Exp $*/
 
 /**
 
@@ -3358,7 +3358,7 @@ ixv_allocate_msix(struct adapter *adapte
 	IXGBE_WORKQUEUE_FLAGS);
 	if (error) {
 		aprint_error_dev(dev,
-		"couldn't create workqueue\n");
+		"couldn't create workqueue for Tx/Rx\n");
 	}
 
 	/* and Mailbox */



CVS commit: src/sys/dev/pci

2021-03-13 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun Mar 14 03:14:42 UTC 2021

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

Log Message:
Initialize dp->rd_cmap_{red,green,blue} in radeonfb_init_palette() for 8bpp,
so that color map can be obtained by WSDISPLAYIO_GETCMAP ioctl(2).

Now, mlterm-fb from pkgsrc/x11/mlterm works just fine on radeonfb(4).


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/sys/dev/pci/radeonfb.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/radeonfb.c
diff -u src/sys/dev/pci/radeonfb.c:1.112 src/sys/dev/pci/radeonfb.c:1.113
--- src/sys/dev/pci/radeonfb.c:1.112	Fri Oct 30 15:30:43 2020
+++ src/sys/dev/pci/radeonfb.c	Sun Mar 14 03:14:42 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: radeonfb.c,v 1.112 2020/10/30 15:30:43 macallan Exp $ */
+/*	$NetBSD: radeonfb.c,v 1.113 2021/03/14 03:14:42 rin Exp $ */
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.112 2020/10/30 15:30:43 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.113 2021/03/14 03:14:42 rin Exp $");
 
 #include 
 #include 
@@ -2953,6 +2953,9 @@ radeonfb_init_palette(struct radeonfb_di
 			tmp |= tmp >> 4;
 			b = tmp;
 
+			dp->rd_cmap_red[i] = r;
+			dp->rd_cmap_green[i] = g;
+			dp->rd_cmap_blue[i] = b;
 			radeonfb_putpal(dp, i, r, g, b);
 		}
 	} else {



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

2021-03-11 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Fri Mar 12 01:54:29 UTC 2021

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

Log Message:
Refactor rxr->next_to_check updating.


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 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.68 src/sys/dev/pci/ixgbe/ix_txrx.c:1.69
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.68	Fri Mar 12 01:53:36 2021
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Fri Mar 12 01:54:29 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.68 2021/03/12 01:53:36 knakahara Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.69 2021/03/12 01:54:29 knakahara Exp $ */
 
 /**
 
@@ -2079,9 +2079,7 @@ next_desc:
 
 		/* Now send to the stack or do LRO */
 		if (sendmp != NULL) {
-			rxr->next_to_check = i;
 			ixgbe_rx_input(rxr, ifp, sendmp, ptype);
-			i = rxr->next_to_check;
 		}
 
 		/* Every 8 descriptors we go to refresh mbufs */



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

2021-03-11 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Fri Mar 12 01:53:36 UTC 2021

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

Log Message:
Remove extra unlock/lock processing around if_percpuq_enqueue().

same as if_wm.c:r1.700


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 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.67 src/sys/dev/pci/ixgbe/ix_txrx.c:1.68
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.67	Tue Mar  9 10:03:18 2021
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Fri Mar 12 01:53:36 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.67 2021/03/09 10:03:18 msaitoh Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.68 2021/03/12 01:53:36 knakahara Exp $ */
 
 /**
 
@@ -2080,9 +2080,7 @@ next_desc:
 		/* Now send to the stack or do LRO */
 		if (sendmp != NULL) {
 			rxr->next_to_check = i;
-			IXGBE_RX_UNLOCK(rxr);
 			ixgbe_rx_input(rxr, ifp, sendmp, ptype);
-			IXGBE_RX_LOCK(rxr);
 			i = rxr->next_to_check;
 		}
 



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

2021-03-10 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Mar 11 02:30:47 UTC 2021

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

Log Message:
Add "TX " to "Queue No Descriptor Available" to make it more understandable.
Same as ixgbe.c rev. 1.278.


To generate a diff of this commit:
cvs rdiff -u -r1.155 -r1.156 src/sys/dev/pci/ixgbe/ixv.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/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.155 src/sys/dev/pci/ixgbe/ixv.c:1.156
--- src/sys/dev/pci/ixgbe/ixv.c:1.155	Tue Mar  9 10:03:18 2021
+++ src/sys/dev/pci/ixgbe/ixv.c	Thu Mar 11 02:30:47 2021
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.155 2021/03/09 10:03:18 msaitoh Exp $*/
+/*$NetBSD: ixv.c,v 1.156 2021/03/11 02:30:47 msaitoh Exp $*/
 
 /**
 
@@ -2669,7 +2669,7 @@ ixv_add_stats_sysctls(struct adapter *ad
 		NULL, adapter->queues[i].evnamebuf, "TSO");
 		evcnt_attach_dynamic(>no_desc_avail, EVCNT_TYPE_MISC,
 		NULL, adapter->queues[i].evnamebuf,
-		"Queue No Descriptor Available");
+		"TX Queue No Descriptor Available");
 		evcnt_attach_dynamic(>total_packets, EVCNT_TYPE_MISC,
 		NULL, adapter->queues[i].evnamebuf,
 		"Queue Packets Transmitted");



CVS commit: src/sys/dev/pci

2021-03-10 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Mar 11 01:23:34 UTC 2021

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

Log Message:
Whitespace fixes. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.701 -r1.702 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.701 src/sys/dev/pci/if_wm.c:1.702
--- src/sys/dev/pci/if_wm.c:1.701	Mon Mar  1 04:50:17 2021
+++ src/sys/dev/pci/if_wm.c	Thu Mar 11 01:23:33 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.701 2021/03/01 04:50:17 knakahara Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.702 2021/03/11 01:23:33 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.701 2021/03/01 04:50:17 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.702 2021/03/11 01:23:33 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -270,7 +270,7 @@ typedef union txdescs {
 
 typedef union rxdescs {
 	wiseman_rxdesc_t sctxu_rxdescs[WM_NRXDESC];
-	ext_rxdesc_t	  sctxu_ext_rxdescs[WM_NRXDESC]; /* 82574 only */
+	ext_rxdesc_t	 sctxu_ext_rxdescs[WM_NRXDESC]; /* 82574 only */
 	nq_rxdesc_t	 sctxu_nq_rxdescs[WM_NRXDESC]; /* 82575 and newer */
 } rxdescs_t;
 
@@ -399,8 +399,8 @@ struct wm_txqueue {
 	time_t txq_lastsent;
 
 	/* Checksum flags used for previous packet */
-	uint32_t 	txq_last_hw_cmd;
-	uint8_t 	txq_last_hw_fields;
+	uint32_t	txq_last_hw_cmd;
+	uint8_t		txq_last_hw_fields;
 	uint16_t	txq_last_hw_ipcs;
 	uint16_t	txq_last_hw_tucs;
 
@@ -3505,7 +3505,7 @@ static bool
 wm_phy_need_linkdown_discard(struct wm_softc *sc)
 {
 
-	switch(sc->sc_phytype) {
+	switch (sc->sc_phytype) {
 	case WMPHY_82577: /* ihphy */
 	case WMPHY_82578: /* atphy */
 	case WMPHY_82579: /* ihphy */
@@ -7570,9 +7570,9 @@ wm_tx_offload(struct wm_softc *sc, struc
 
 	default:
 		/* Don't support this protocol or encapsulation. */
- 		txq->txq_last_hw_cmd = txq->txq_last_hw_fields = 0;
- 		txq->txq_last_hw_ipcs = 0;
- 		txq->txq_last_hw_tucs = 0;
+		txq->txq_last_hw_cmd = txq->txq_last_hw_fields = 0;
+		txq->txq_last_hw_ipcs = 0;
+		txq->txq_last_hw_tucs = 0;
 		*fieldsp = 0;
 		*cmdp = 0;
 		return;
@@ -7728,8 +7728,7 @@ wm_tx_offload(struct wm_softc *sc, struc
 	 */
 	if (sc->sc_nqueues < 2) {
 		/*
-	 	 *
-	  	 * Setting up new checksum offload context for every
+		 * Setting up new checksum offload context for every
 		 * frames takes a lot of processing time for hardware.
 		 * This also reduces performance a lot for small sized
 		 * frames so avoid it if driver can use previously
@@ -7739,7 +7738,7 @@ wm_tx_offload(struct wm_softc *sc, struc
 		 * checking whether a frame has the same IP/TCP structure is
 		 * hard thing so just ignore that and always restablish a
 		 * new TSO context.
-	  	 */
+		 */
 		if ((m0->m_pkthdr.csum_flags & (M_CSUM_TSOv4 | M_CSUM_TSOv6))
 		== 0) {
 			if (txq->txq_last_hw_cmd == cmd &&
@@ -7751,9 +7750,9 @@ wm_tx_offload(struct wm_softc *sc, struc
 			}
 		}
 
-	 	txq->txq_last_hw_cmd = cmd;
- 		txq->txq_last_hw_fields = fields;
- 		txq->txq_last_hw_ipcs = (ipcs & 0x);
+		txq->txq_last_hw_cmd = cmd;
+		txq->txq_last_hw_fields = fields;
+		txq->txq_last_hw_ipcs = (ipcs & 0x);
 		txq->txq_last_hw_tucs = (tucs & 0x);
 	}
 
@@ -8073,8 +8072,8 @@ retry:
 		M_CSUM_TCPv6 | M_CSUM_UDPv6)) {
 			wm_tx_offload(sc, txq, txs, , );
 		} else {
- 			txq->txq_last_hw_cmd = txq->txq_last_hw_fields = 0;
- 			txq->txq_last_hw_ipcs = txq->txq_last_hw_tucs = 0;
+			txq->txq_last_hw_cmd = txq->txq_last_hw_fields = 0;
+			txq->txq_last_hw_ipcs = txq->txq_last_hw_tucs = 0;
 			cksumcmd = 0;
 			cksumfields = 0;
 		}



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

2021-03-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Mar  8 07:10:45 UTC 2021

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

Log Message:
 Use no_jmbuf evcnt for the failure case of ixgbe_getjcl().


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 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.65 src/sys/dev/pci/ixgbe/ix_txrx.c:1.66
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.65	Tue Mar  2 11:10:53 2021
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Mon Mar  8 07:10:45 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.65 2021/03/02 11:10:53 msaitoh Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.66 2021/03/08 07:10:45 msaitoh Exp $ */
 
 /**
 
@@ -1883,7 +1883,7 @@ ixgbe_rxeof(struct ix_queue *que)
 		else
 			newmp = NULL;
 		if (newmp == NULL) {
-			rxr->rx_discarded.ev_count++;
+			rxr->no_jmbuf.ev_count++;
 			/*
 			 * Descriptor initialization is already done by the
 			 * above code (cur->wb.upper.status_error = 0).



CVS commit: src/sys/dev/pci

2021-03-05 Thread Shoichi YAMAGUCHI
Module Name:src
Committed By:   yamaguchi
Date:   Fri Mar  5 13:21:07 UTC 2021

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

Log Message:
Fix missing IFM_FDX


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/pci/if_iavf.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_iavf.c
diff -u src/sys/dev/pci/if_iavf.c:1.12 src/sys/dev/pci/if_iavf.c:1.13
--- src/sys/dev/pci/if_iavf.c:1.12	Tue Feb  9 15:05:49 2021
+++ src/sys/dev/pci/if_iavf.c	Fri Mar  5 13:21:07 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_iavf.c,v 1.12 2021/02/09 15:05:49 jakllsch Exp $	*/
+/*	$NetBSD: if_iavf.c,v 1.13 2021/03/05 13:21:07 yamaguchi Exp $	*/
 
 /*
  * Copyright (c) 2013-2015, Intel Corporation
@@ -75,7 +75,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_iavf.c,v 1.12 2021/02/09 15:05:49 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iavf.c,v 1.13 2021/03/05 13:21:07 yamaguchi Exp $");
 
 #include 
 #include 
@@ -4435,6 +4435,7 @@ iavf_process_vc_event(struct iavf_softc 
 		if (event->link_status) {
 			link = LINK_STATE_UP;
 			sc->sc_media_status |= IFM_ACTIVE;
+			sc->sc_media_active |= IFM_FDX;
 
 			ifp->if_baudrate = 0;
 			speed = iavf_find_link_speed(sc, event->link_speed);



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

2021-03-02 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Mar  2 11:10:53 UTC 2021

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

Log Message:
Fix jcl's starvation case in ixgbe_rxeof() again.

 ix_txrx.c rev.1.64 preallocates jcl to prevent starvation but it's not
perfect. Don't use ixgbe_rx_discard() and just update the old descriptor
for reuse. It's also required for multiple descriptors case to refresh
subsequent descriptor(s). Reviewed by knakahara@.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 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.64 src/sys/dev/pci/ixgbe/ix_txrx.c:1.65
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.64	Mon Jan 18 09:09:04 2021
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Tue Mar  2 11:10:53 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.64 2021/01/18 09:09:04 knakahara Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.65 2021/03/02 11:10:53 msaitoh Exp $ */
 
 /**
 
@@ -1319,6 +1319,11 @@ ixgbe_setup_hw_rsc(struct rx_ring *rxr)
  *  exhaustion are unnecessary, if an mbuf cannot be obtained
  *  it just returns, keeping its placeholder, thus it can simply
  *  be recalled to try again.
+ *
+ *   XXX NetBSD TODO:
+ *- The ixgbe_rxeof() function always preallocates mbuf cluster (jcl),
+ *  so the ixgbe_refresh_mbufs() function can be simplified.
+ *
  /
 static void
 ixgbe_refresh_mbufs(struct rx_ring *rxr, int limit)
@@ -1799,7 +1804,9 @@ ixgbe_rxeof(struct ix_queue *que)
 	struct ixgbe_rx_buf	*rbuf, *nbuf;
 	int			i, nextp, processed = 0;
 	u32			staterr = 0;
-	u32			count = adapter->rx_process_limit;
+	u32			count = 0;
+	u32			limit = adapter->rx_process_limit;
+	bool			discard_multidesc = false;
 #ifdef RSS
 	u16			pkt_info;
 #endif
@@ -1816,7 +1823,14 @@ ixgbe_rxeof(struct ix_queue *que)
 	}
 #endif /* DEV_NETMAP */
 
-	for (i = rxr->next_to_check; count != 0;) {
+	/*
+	 * The max number of loop is rx_process_limit. If discard_multidesc is
+	 * true, continue processing to not to send broken packet to the upper
+	 * layer.
+	 */
+	for (i = rxr->next_to_check;
+	 (count < limit) || (discard_multidesc == true);) {
+
 		struct mbuf *sendmp, *mp;
 		struct mbuf *newmp;
 		u32 rsc, ptype;
@@ -1837,7 +1851,7 @@ ixgbe_rxeof(struct ix_queue *que)
 		if ((staterr & IXGBE_RXD_STAT_DD) == 0)
 			break;
 
-		count--;
+		count++;
 		sendmp = NULL;
 		nbuf = NULL;
 		rsc = 0;
@@ -1858,17 +1872,37 @@ ixgbe_rxeof(struct ix_queue *que)
 #endif
 			rxr->rx_discarded.ev_count++;
 			ixgbe_rx_discard(rxr, i);
+			discard_multidesc = false;
 			goto next_desc;
 		}
 
 		/* pre-alloc new mbuf */
-		newmp = ixgbe_getjcl(>jcl_head, M_NOWAIT, MT_DATA, M_PKTHDR,
-		rxr->mbuf_sz);
+		if (!discard_multidesc)
+			newmp = ixgbe_getjcl(>jcl_head, M_NOWAIT, MT_DATA,
+			M_PKTHDR, rxr->mbuf_sz);
+		else
+			newmp = NULL;
 		if (newmp == NULL) {
 			rxr->rx_discarded.ev_count++;
-			ixgbe_rx_discard(rxr, i);
+			/*
+			 * Descriptor initialization is already done by the
+			 * above code (cur->wb.upper.status_error = 0).
+			 * So, we can reuse current rbuf->buf for new packet.
+			 *
+			 * Rewrite the buffer addr, see comment in
+			 * ixgbe_rx_discard().
+			 */
+			cur->read.pkt_addr = rbuf->addr;
+			m_freem(rbuf->fmp);
+			rbuf->fmp = NULL;
+			if (!eop) {
+/* Discard the entire packet. */
+discard_multidesc = true;
+			} else
+discard_multidesc = false;
 			goto next_desc;
 		}
+		discard_multidesc = false;
 
 		bus_dmamap_sync(rxr->ptag->dt_dmat, rbuf->pmap, 0,
 		rbuf->buf->m_pkthdr.len, BUS_DMASYNC_POSTREAD);



CVS commit: src/sys/dev/pci

2021-03-01 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Tue Mar  2 07:55:16 UTC 2021

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

Log Message:
Fix build failure for options NET_MPSAFE.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 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.17 src/sys/dev/pci/if_rge.c:1.18
--- src/sys/dev/pci/if_rge.c:1.17	Mon Mar  1 17:48:52 2021
+++ src/sys/dev/pci/if_rge.c	Tue Mar  2 07:55:16 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_rge.c,v 1.17 2021/03/01 17:48:52 jakllsch Exp $	*/
+/*	$NetBSD: if_rge.c,v 1.18 2021/03/02 07:55:16 knakahara 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.17 2021/03/01 17:48:52 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_rge.c,v 1.18 2021/03/02 07:55:16 knakahara Exp $");
 
 #include 
 
@@ -324,7 +324,7 @@ rge_attach(device_t parent, device_t sel
 	strlcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ);
 	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
 #ifdef RGE_MPSAFE
-	ifp->if_xflags = IFEF_MPSAFE;
+	ifp->if_extflags = IFEF_MPSAFE;
 #endif
 	ifp->if_ioctl = rge_ioctl;
 	ifp->if_stop = rge_stop;



CVS commit: src/sys/dev/pci

2021-03-01 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Mon Mar  1 17:48:52 UTC 2021

Modified Files:
src/sys/dev/pci: files.pci if_rge.c if_rgereg.h

Log Message:
Update rge(4) from older OpenBSD, finish porting.

Should consider merging this all into re(4) and rgephy(4) someday.

Some cleanup tasks remain here.


To generate a diff of this commit:
cvs rdiff -u -r1.434 -r1.435 src/sys/dev/pci/files.pci
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/pci/if_rge.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/pci/if_rgereg.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/files.pci
diff -u src/sys/dev/pci/files.pci:1.434 src/sys/dev/pci/files.pci:1.435
--- src/sys/dev/pci/files.pci:1.434	Wed Feb 17 08:15:43 2021
+++ src/sys/dev/pci/files.pci	Mon Mar  1 17:48:52 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: files.pci,v 1.434 2021/02/17 08:15:43 knakahara Exp $
+#	$NetBSD: files.pci,v 1.435 2021/03/01 17:48:52 jakllsch Exp $
 #
 # Config file and device description for machine-independent PCI code.
 # Included by ports that need it.  Requires that the SCSI files be
@@ -1183,3 +1183,8 @@ device	vmx: ether, ifnet, arp
 attach	vmx at pci
 file	dev/pci/if_vmx.c	vmx
 
+# Realtek RTL8125 2.5GBASE-T Ethernet
+device	rge: ether, ifnet, arp, mii
+attach	rge at pci
+file	dev/pci/if_rge.c		rge
+

Index: src/sys/dev/pci/if_rge.c
diff -u src/sys/dev/pci/if_rge.c:1.16 src/sys/dev/pci/if_rge.c:1.17
--- src/sys/dev/pci/if_rge.c:1.16	Wed Jan 27 14:25:22 2021
+++ src/sys/dev/pci/if_rge.c	Mon Mar  1 17:48:52 2021
@@ -1,8 +1,8 @@
-/*	$NetBSD: if_rge.c,v 1.16 2021/01/27 14:25:22 jakllsch Exp $	*/
-/*	$OpenBSD: if_rge.c,v 1.4 2020/07/10 13:26:38 patrick Exp $	*/
+/*	$NetBSD: if_rge.c,v 1.17 2021/03/01 17:48:52 jakllsch Exp $	*/
+/*	$OpenBSD: if_rge.c,v 1.9 2020/12/12 11:48:53 jan Exp $	*/
 
 /*
- * Copyright (c) 2019 Kevin Lo 
+ * Copyright (c) 2019, 2020 Kevin Lo 
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -18,9 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_rge.c,v 1.16 2021/01/27 14:25:22 jakllsch Exp $");
-
-/* #include "vlan.h" Sevan */
+__KERNEL_RCSID(0, "$NetBSD: if_rge.c,v 1.17 2021/03/01 17:48:52 jakllsch Exp $");
 
 #include 
 
@@ -46,9 +44,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_rge.c,v 1
 #include 
 #include 
 
-#if NBPFILTER > 0
 #include 
-#endif
 
 #include 
 #include 
@@ -64,16 +60,10 @@ __KERNEL_RCSID(0, "$NetBSD: if_rge.c,v 1
 #ifdef __NetBSD__
 #define letoh32 	htole32
 #define nitems(x) 	__arraycount(x)
-#define MBUF_LIST_INITIALIZER() 	{ NULL, NULL, 0 }
-struct mbuf_list {
-	struct mbuf 	*ml_head;
-	struct mbuf 	*ml_tail;
-	u_int 	ml_len;
-};
 
 static struct mbuf *
-MCLGETI(struct rge_softc *sc __unused, int how,
-struct ifnet *ifp __unused, u_int size)
+MCLGETL(struct rge_softc *sc __unused, int how,
+u_int size)
 {
 	struct mbuf *m;
 
@@ -97,6 +87,13 @@ MCLGETI(struct rge_softc *sc __unused, i
 #endif
 #endif
 
+#ifdef RGE_DEBUG
+#define DPRINTF(x)	do { if (rge_debug > 0) printf x; } while (0)
+int rge_debug = 0;
+#else
+#define DPRINTF(x)
+#endif
+
 static int		rge_match(device_t, cfdata_t, void *);
 static void		rge_attach(device_t, device_t, void *);
 int		rge_intr(void *);
@@ -105,7 +102,7 @@ int		rge_ioctl(struct ifnet *, u_long, v
 void		rge_start(struct ifnet *);
 void		rge_watchdog(struct ifnet *);
 int		rge_init(struct ifnet *);
-void		rge_stop(struct ifnet *);
+void		rge_stop(struct ifnet *, int);
 int		rge_ifmedia_upd(struct ifnet *);
 void		rge_ifmedia_sts(struct ifnet *, struct ifmediareq *);
 int		rge_allocmem(struct rge_softc *);
@@ -119,6 +116,11 @@ void		rge_reset(struct rge_softc *);
 void		rge_iff(struct rge_softc *);
 void		rge_set_phy_power(struct rge_softc *, int);
 void		rge_phy_config(struct rge_softc *);
+void		rge_phy_config_mac_cfg2(struct rge_softc *);
+void		rge_phy_config_mac_cfg3(struct rge_softc *);
+void		rge_phy_config_mac_cfg4(struct rge_softc *);
+void		rge_phy_config_mac_cfg5(struct rge_softc *);
+void		rge_phy_config_mcu(struct rge_softc *, uint16_t);
 void		rge_set_macaddr(struct rge_softc *, const uint8_t *);
 void		rge_get_macaddr(struct rge_softc *, uint8_t *);
 void		rge_hw_init(struct rge_softc *);
@@ -126,6 +128,7 @@ void		rge_disable_phy_ocp_pwrsave(struct
 void		rge_patch_phy_mcu(struct rge_softc *, int);
 void		rge_add_media_types(struct rge_softc *);
 void		rge_config_imtype(struct rge_softc *, int);
+void		rge_disable_hw_im(struct rge_softc *);
 void		rge_disable_sim_im(struct rge_softc *);
 void		rge_setup_sim_im(struct rge_softc *);
 void		rge_setup_intr(struct rge_softc *, int);
@@ -135,7 +138,9 @@ uint32_t	rge_read_csi(struct rge_softc *
 void		rge_write_mac_ocp(struct rge_softc *, uint16_t, uint16_t);
 uint16_t	rge_read_mac_ocp(struct rge_softc *, uint16_t);
 void		rge_write_ephy(struct rge_softc *, uint16_t, uint16_t);
+uint16_t	

CVS commit: src/sys/dev/pci

2021-02-28 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Mon Mar  1 04:50:18 UTC 2021

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

Log Message:
Refactor rxq->rxq_ptr updating.


To generate a diff of this commit:
cvs rdiff -u -r1.700 -r1.701 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.700 src/sys/dev/pci/if_wm.c:1.701
--- src/sys/dev/pci/if_wm.c:1.700	Mon Mar  1 04:49:11 2021
+++ src/sys/dev/pci/if_wm.c	Mon Mar  1 04:50:17 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.700 2021/03/01 04:49:11 knakahara Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.701 2021/03/01 04:50:17 knakahara Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.700 2021/03/01 04:49:11 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.701 2021/03/01 04:50:17 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -9177,7 +9177,6 @@ wm_rxeof(struct wm_rxqueue *rxq, u_int l
 
 	for (i = rxq->rxq_ptr;; i = WM_NEXTRX(i)) {
 		if (limit-- == 0) {
-			rxq->rxq_ptr = i;
 			more = true;
 			DPRINTF(sc, WM_DEBUG_RX,
 			("%s: RX: loop limited, descriptor %d is not processed\n",
@@ -9203,11 +9202,6 @@ wm_rxeof(struct wm_rxqueue *rxq, u_int l
 #endif
 
 		if (!wm_rxdesc_dd(rxq, i, status)) {
-			/*
-			 * Update the receive pointer holding rxq_lock
-			 * consistent with increment counter.
-			 */
-			rxq->rxq_ptr = i;
 			break;
 		}
 
@@ -9333,7 +9327,6 @@ wm_rxeof(struct wm_rxqueue *rxq, u_int l
 		/* Set up checksum info for this packet. */
 		wm_rxdesc_ensure_checksum(rxq, status, errors, m);
 
-		rxq->rxq_ptr = i;
 		rxq->rxq_packets++;
 		rxq->rxq_bytes += len;
 		/* Pass it on. */
@@ -9342,6 +9335,7 @@ wm_rxeof(struct wm_rxqueue *rxq, u_int l
 		if (rxq->rxq_stopping)
 			break;
 	}
+	rxq->rxq_ptr = i;
 
 	if (count != 0)
 		rnd_add_uint32(>rnd_source, count);



CVS commit: src/sys/dev/pci

2021-02-28 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Mon Mar  1 04:49:11 UTC 2021

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

Log Message:
Remove extra unlock/lock processing around if_percpuq_enqueue().

This temporary unlock/lock processing was required for direct calling
ifp->if_input.  After r1.391, wm(4) uses if_percpuq_enqueue() and it
does not hold any mutexes.


To generate a diff of this commit:
cvs rdiff -u -r1.699 -r1.700 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.699 src/sys/dev/pci/if_wm.c:1.700
--- src/sys/dev/pci/if_wm.c:1.699	Wed Feb 17 08:15:43 2021
+++ src/sys/dev/pci/if_wm.c	Mon Mar  1 04:49:11 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.699 2021/02/17 08:15:43 knakahara Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.700 2021/03/01 04:49:11 knakahara Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.699 2021/02/17 08:15:43 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.700 2021/03/01 04:49:11 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -9332,20 +9332,13 @@ wm_rxeof(struct wm_rxqueue *rxq, u_int l
 
 		/* Set up checksum info for this packet. */
 		wm_rxdesc_ensure_checksum(rxq, status, errors, m);
-		/*
-		 * Update the receive pointer holding rxq_lock consistent with
-		 * increment counter.
-		 */
+
 		rxq->rxq_ptr = i;
 		rxq->rxq_packets++;
 		rxq->rxq_bytes += len;
-		mutex_exit(rxq->rxq_lock);
-
 		/* Pass it on. */
 		if_percpuq_enqueue(sc->sc_ipq, m);
 
-		mutex_enter(rxq->rxq_lock);
-
 		if (rxq->rxq_stopping)
 			break;
 	}



CVS commit: src/sys/dev/pci

2021-02-25 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Feb 25 19:11:44 UTC 2021

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

Log Message:
match Geforce FX5200 Go found in some iMac G5 models


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/pci/gffb.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/gffb.c
diff -u src/sys/dev/pci/gffb.c:1.14 src/sys/dev/pci/gffb.c:1.15
--- src/sys/dev/pci/gffb.c:1.14	Thu May 21 22:55:48 2020
+++ src/sys/dev/pci/gffb.c	Thu Feb 25 19:11:44 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: gffb.c,v 1.14 2020/05/21 22:55:48 macallan Exp $	*/
+/*	$NetBSD: gffb.c,v 1.15 2021/02/25 19:11:44 macallan Exp $	*/
 
 /*
  * Copyright (c) 2013 Michael Lorenz
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gffb.c,v 1.14 2020/05/21 22:55:48 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gffb.c,v 1.15 2021/02/25 19:11:44 macallan Exp $");
 
 #include 
 #include 
@@ -165,6 +165,8 @@ gffb_match(device_t parent, cfdata_t mat
 		return 100;
 	if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_NVIDIA_GEFORCE_6800U)
 		return 100;
+	if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_NVIDIA_GF_FXGO5200)
+		return 100;
 	return (0);
 }
 



CVS commit: src/sys/dev/pci

2021-02-22 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Feb 23 07:17:58 UTC 2021

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

Log Message:
Whitespace (mostly trailing)


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/pci/mpii.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/mpii.c
diff -u src/sys/dev/pci/mpii.c:1.26 src/sys/dev/pci/mpii.c:1.27
--- src/sys/dev/pci/mpii.c:1.26	Tue Feb 23 07:15:30 2021
+++ src/sys/dev/pci/mpii.c	Tue Feb 23 07:17:58 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: mpii.c,v 1.26 2021/02/23 07:15:30 skrll Exp $ */
+/* $NetBSD: mpii.c,v 1.27 2021/02/23 07:17:58 skrll Exp $ */
 /*	$OpenBSD: mpii.c,v 1.115 2018/08/14 05:22:21 jmatthew Exp $	*/
 /*
  * Copyright (c) 2010, 2012 Mike Belopuhov
@@ -20,7 +20,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mpii.c,v 1.26 2021/02/23 07:15:30 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mpii.c,v 1.27 2021/02/23 07:17:58 skrll Exp $");
 
 #include "bio.h"
 
@@ -46,7 +46,7 @@ __KERNEL_RCSID(0, "$NetBSD: mpii.c,v 1.2
 
 #if NBIO > 0
 #include 
-#include  
+#include 
 #include 
 #endif
 
@@ -445,10 +445,10 @@ mpii_match(device_t parent, cfdata_t mat
 	struct pci_attach_args *pa = aux;
 	const struct mpii_pci_product *mpii;
 
-	for (mpii = mpii_devices; mpii->mpii_vendor != 0; mpii++) { 
-		if (PCI_VENDOR(pa->pa_id) == mpii->mpii_vendor &&   
-		PCI_PRODUCT(pa->pa_id) == mpii->mpii_product)   
-			return (1);   
+	for (mpii = mpii_devices; mpii->mpii_vendor != 0; mpii++) {
+		if (PCI_VENDOR(pa->pa_id) == mpii->mpii_vendor &&
+		PCI_PRODUCT(pa->pa_id) == mpii->mpii_product)
+			return (1);
 	}
 	return (0);
 }
@@ -618,7 +618,7 @@ mpii_attach(device_t parent, device_t se
 	memset(chan, 0, sizeof(*chan));
 	chan->chan_adapter = adapt;
 	chan->chan_bustype = _sas_bustype;
-	chan->chan_channel = 0;   
+	chan->chan_channel = 0;
 	chan->chan_flags = 0;
 	chan->chan_nluns = 8;
 	chan->chan_ntargets = sc->sc_max_devices;
@@ -719,7 +719,7 @@ mpii_detach(device_t self, int flags)
 }
 
 static int
-mpii_rescan(device_t self, const char *ifattr, const int *locators) 
+mpii_rescan(device_t self, const char *ifattr, const int *locators)
 {
 	struct mpii_softc *sc = device_private(self);
 
@@ -737,11 +737,11 @@ mpii_childdetached(device_t self, device
 {
 	struct mpii_softc *sc = device_private(self);
 
-	KASSERT(self == sc->sc_dev);  
+	KASSERT(self == sc->sc_dev);
 	KASSERT(child == sc->sc_child);
 
-	if (child == sc->sc_child)
-		sc->sc_child = NULL;  
+	if (child == sc->sc_child)
+		sc->sc_child = NULL;
 }
 
 
@@ -1884,7 +1884,7 @@ mpii_event_sas(struct mpii_softc *sc, st
 		le16toh(pe->dev_handle),
 		sc->sc_pd_id_start + tcl->start_phy_num + i,
 		tcl->start_phy_num + i, le16toh(tcl->enclosure_handle), le16toh(tcl->expander_handle));
-			
+
 		switch (pe->phy_status & MPII_EVENT_SAS_TOPO_PS_RC_MASK) {
 		case MPII_EVENT_SAS_TOPO_PS_RC_ADDED:
 			handle = le16toh(pe->dev_handle);
@@ -1972,7 +1972,7 @@ mpii_event_sas_work(struct work *wq, voi
 			le16toh(pe->dev_handle),
 			sc->sc_pd_id_start + tcl->start_phy_num + i,
 			tcl->start_phy_num + i, le16toh(tcl->enclosure_handle), le16toh(tcl->expander_handle));
-			
+
 			switch (pe->phy_status & MPII_EVENT_SAS_TOPO_PS_RC_MASK) {
 			case MPII_EVENT_SAS_TOPO_PS_RC_ADDED:
 /* already handled */
@@ -2955,18 +2955,18 @@ mpii_scsipi_request(struct scsipi_channe
 
 	switch (req) {
 	case ADAPTER_REQ_GROW_RESOURCES:
-		/* Not supported. */ 
+		/* Not supported. */
 		return;
 	case ADAPTER_REQ_SET_XFER_MODE:
 	{
 		struct scsipi_xfer_mode *xm = arg;
 		xm->xm_mode = PERIPH_CAP_TQING;
-		xm->xm_period = 0;   
-		xm->xm_offset = 0;   
+		xm->xm_period = 0;
+		xm->xm_offset = 0;
 		scsipi_async_event(>sc_chan, ASYNC_EVENT_XFER_MODE, xm);
 		return;
 	}
-	case ADAPTER_REQ_RUN_XFER:
+	case ADAPTER_REQ_RUN_XFER:
 		break;
 	}
 
@@ -3132,33 +3132,33 @@ static u_int8_t
 map_scsi_status(u_int8_t mpii_scsi_status)
 {
 	u_int8_t scsi_status;
-	
-	switch (mpii_scsi_status) 
+
+	switch (mpii_scsi_status)
 	{
 	case MPII_SCSIIO_STATUS_GOOD:
 		scsi_status = SCSI_OK;
 		break;
-		
+
 	case MPII_SCSIIO_STATUS_CHECK_COND:
 		scsi_status = SCSI_CHECK;
 		break;
-		
+
 	case MPII_SCSIIO_STATUS_BUSY:
 		scsi_status = SCSI_BUSY;
 		break;
-		
+
 	case MPII_SCSIIO_STATUS_INTERMEDIATE:
 		scsi_status = SCSI_INTERM;
 		break;
-		
+
 	case MPII_SCSIIO_STATUS_INTERMEDIATE_CONDMET:
 		scsi_status = SCSI_INTERM;
 		break;
-		
+
 	case MPII_SCSIIO_STATUS_RESERVATION_CONFLICT:
 		scsi_status = SCSI_RESV_CONFLICT;
 		break;
-		
+
 	case MPII_SCSIIO_STATUS_CMD_TERM:
 	case MPII_SCSIIO_STATUS_TASK_ABORTED:
 		scsi_status = SCSI_TERMINATED;
@@ -3203,11 +3203,11 @@ mpii_scsi_cmd_done(struct mpii_ccb *ccb)
 
 		bus_dmamap_unload(sc->sc_dmat, dmap);
 	}
-	
+
 	KASSERT(xs->error == XS_NOERROR);
 	KASSERT(xs->resid == xs->datalen);
 	KASSERT(xs->status == 

CVS commit: src/sys/dev/pci

2021-02-22 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Feb 23 07:15:30 UTC 2021

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

Log Message:
Use the PCI_MAPREG_TYPE macro.  No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/pci/mpii.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/mpii.c
diff -u src/sys/dev/pci/mpii.c:1.25 src/sys/dev/pci/mpii.c:1.26
--- src/sys/dev/pci/mpii.c:1.25	Sat Aug  8 19:39:28 2020
+++ src/sys/dev/pci/mpii.c	Tue Feb 23 07:15:30 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: mpii.c,v 1.25 2020/08/08 19:39:28 jnemeth Exp $ */
+/* $NetBSD: mpii.c,v 1.26 2021/02/23 07:15:30 skrll Exp $ */
 /*	$OpenBSD: mpii.c,v 1.115 2018/08/14 05:22:21 jmatthew Exp $	*/
 /*
  * Copyright (c) 2010, 2012 Mike Belopuhov
@@ -20,7 +20,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mpii.c,v 1.25 2020/08/08 19:39:28 jnemeth Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mpii.c,v 1.26 2021/02/23 07:15:30 skrll Exp $");
 
 #include "bio.h"
 
@@ -479,7 +479,7 @@ mpii_attach(device_t parent, device_t se
 	/* find the appropriate memory base */
 	for (r = PCI_MAPREG_START; r < PCI_MAPREG_END; r += sizeof(memtype)) {
 		memtype = pci_mapreg_type(sc->sc_pc, sc->sc_tag, r);
-		if ((memtype & PCI_MAPREG_TYPE_MASK) == PCI_MAPREG_TYPE_MEM)
+		if (PCI_MAPREG_TYPE(memtype) == PCI_MAPREG_TYPE_MEM)
 			break;
 	}
 	if (r >= PCI_MAPREG_END) {



CVS commit: src/sys/dev/pci

2021-02-20 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Feb 20 13:31:35 UTC 2021

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

Log Message:
Sync with OpenBSD r1.99:

   move the rearming of the cq after the refill of the rq.

   this is the only real diff we have left outstanding on a box that
   experienced rx lockups. since adding this change it's been happy
   for the last 4 weeks and counting so far.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 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.16 src/sys/dev/pci/if_mcx.c:1.17
--- src/sys/dev/pci/if_mcx.c:1.16	Fri Feb  5 22:23:30 2021
+++ src/sys/dev/pci/if_mcx.c	Sat Feb 20 13:31:35 2021
@@ -1,5 +1,5 @@
-/*	$NetBSD: if_mcx.c,v 1.16 2021/02/05 22:23:30 jmcneill Exp $ */
-/*	$OpenBSD: if_mcx.c,v 1.98 2021/01/27 07:46:11 dlg Exp $ */
+/*	$NetBSD: if_mcx.c,v 1.17 2021/02/20 13:31:35 jmcneill Exp $ */
+/*	$OpenBSD: if_mcx.c,v 1.99 2021/02/15 03:42:00 dlg Exp $ */
 
 /*
  * Copyright (c) 2017 David Gwynne 
@@ -23,7 +23,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mcx.c,v 1.16 2021/02/05 22:23:30 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mcx.c,v 1.17 2021/02/20 13:31:35 jmcneill Exp $");
 
 #include 
 #include 
@@ -7082,9 +7082,6 @@ mcx_process_cq(struct mcx_softc *sc, str
 	bus_dmamap_sync(sc->sc_dmat, MCX_DMA_MAP(>cq_mem),
 	0, MCX_DMA_LEN(>cq_mem), BUS_DMASYNC_PREREAD);
 
-	cq->cq_count++;
-	mcx_arm_cq(sc, cq, q->q_uar);
-
 	if (rxfree > 0) {
 		mcx_rxr_put(>rx_rxr, rxfree);
 		while (MBUFQ_FIRST() != NULL) {
@@ -7096,6 +7093,10 @@ mcx_process_cq(struct mcx_softc *sc, str
 		if (mcx_rxr_inuse(>rx_rxr) == 0)
 			callout_schedule(>rx_refill, 1);
 	}
+
+	cq->cq_count++;
+	mcx_arm_cq(sc, cq, q->q_uar);
+
 	if (txfree > 0) {
 		tx->tx_cons += txfree;
 		if_schedule_deferred_start(ifp);



CVS commit: src/sys/dev/pci

2021-02-18 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Feb 18 17:56:04 UTC 2021

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

Log Message:
- use if_initialize() and if_register() instead of if_attach()
- add IFEF_MPSAFE to if_extflags

pointed out by msaitoh@, thanks


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 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.19 src/sys/dev/pci/if_aq.c:1.20
--- src/sys/dev/pci/if_aq.c:1.19	Thu Sep 24 05:13:03 2020
+++ src/sys/dev/pci/if_aq.c	Thu Feb 18 17:56:04 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_aq.c,v 1.19 2020/09/24 05:13:03 ryo Exp $	*/
+/*	$NetBSD: if_aq.c,v 1.20 2021/02/18 17:56:04 ryo Exp $	*/
 
 /**
  * aQuantia Corporation Network Driver
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.19 2020/09/24 05:13:03 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.20 2021/02/18 17:56:04 ryo Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_if_aq.h"
@@ -1407,6 +1407,7 @@ aq_attach(device_t parent, device_t self
 	strlcpy(ifp->if_xname, device_xname(self), IFNAMSIZ);
 	ifp->if_softc = sc;
 	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
+	ifp->if_extflags = IFEF_MPSAFE;
 	ifp->if_baudrate = IF_Gbps(10);
 	ifp->if_init = aq_init;
 	ifp->if_ioctl = aq_ioctl;
@@ -1463,11 +1464,18 @@ aq_attach(device_t parent, device_t self
 	/* RX hardware checksum offloadding */
 	ifp->if_capabilities |= IFCAP_CSUM_IPv4_Rx;
 
-	if_attach(ifp);
+	error = if_initialize(ifp);
+	if (error != 0) {
+		aprint_error_dev(sc->sc_dev, "if_initialize failed(%d)\n",
+		error);
+		goto attach_failure;
+	}
+	ifp->if_percpuq = if_percpuq_create(ifp);
 	if_deferred_start_init(ifp, NULL);
 	ether_ifattach(ifp, sc->sc_enaddr.ether_addr_octet);
 	ether_set_vlan_cb(>sc_ethercom, aq_vlan_cb);
 	ether_set_ifflags_cb(>sc_ethercom, aq_ifflags_cb);
+	if_register(ifp);
 
 	aq_enable_intr(sc, true, false);	/* only intr about link */
 



CVS commit: src/sys/dev/pci

2021-02-17 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Wed Feb 17 08:10:34 UTC 2021

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

Log Message:
wm(4) use atomic_{load,store}_relaxed for evcnt 64 bit counter.

ok'ed by msaitoh@n.o.


To generate a diff of this commit:
cvs rdiff -u -r1.697 -r1.698 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.697 src/sys/dev/pci/if_wm.c:1.698
--- src/sys/dev/pci/if_wm.c:1.697	Thu Nov 19 02:36:30 2020
+++ src/sys/dev/pci/if_wm.c	Wed Feb 17 08:10:33 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.697 2020/11/19 02:36:30 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.698 2021/02/17 08:10:33 knakahara Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.697 2020/11/19 02:36:30 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.698 2021/02/17 08:10:33 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -661,8 +661,12 @@ do {	\
 } while (/*CONSTCOND*/0)
 
 #ifdef WM_EVENT_COUNTERS
-#define	WM_EVCNT_INCR(ev)	(ev)->ev_count++
-#define	WM_EVCNT_ADD(ev, val)	(ev)->ev_count += (val)
+#define	WM_EVCNT_INCR(ev)		\
+	atomic_store_relaxed(&((ev)->ev_count),\
+	atomic_load_relaxed(&(ev)->ev_count) + 1)
+#define	WM_EVCNT_ADD(ev, val)		\
+	atomic_store_relaxed(&((ev)->ev_count),\
+	atomic_load_relaxed(&(ev)->ev_count) + (val))
 
 #define WM_Q_EVCNT_INCR(qname, evname)			\
 	WM_EVCNT_INCR(&(qname)->qname##_ev_##evname)



CVS commit: src/sys/dev/pci

2021-02-14 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sun Feb 14 14:05:03 UTC 2021

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

Log Message:
if_bnx.c: fix misleading indentation

suggested by rillig@


To generate a diff of this commit:
cvs rdiff -u -r1.107 -r1.108 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.107 src/sys/dev/pci/if_bnx.c:1.108
--- src/sys/dev/pci/if_bnx.c:1.107	Sat Feb 13 16:33:30 2021
+++ src/sys/dev/pci/if_bnx.c	Sun Feb 14 14:05:03 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bnx.c,v 1.107 2021/02/13 16:33:30 jakllsch Exp $	*/
+/*	$NetBSD: if_bnx.c,v 1.108 2021/02/14 14:05:03 jakllsch 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.107 2021/02/13 16:33:30 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bnx.c,v 1.108 2021/02/14 14:05:03 jakllsch Exp $");
 
 /*
  * The following controllers are supported by this driver:
@@ -4588,7 +4588,7 @@ bnx_rx_intr(struct bnx_softc *sc)
 		sc->free_rx_bd++;
 
 		DBRUN(BNX_VERBOSE_RECV, printf("%s(): ", __func__);
-		bnx_dump_rxbd(sc, sw_chain_cons, rxbd));
+		bnx_dump_rxbd(sc, sw_chain_cons, rxbd));
 
 		/* The mbuf is stored with the last rx_bd entry of a packet. */
 		if (sc->rx_mbuf_ptr[sw_chain_cons] != NULL) {



CVS commit: src/sys/dev/pci

2021-02-13 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat Feb 13 16:33:30 UTC 2021

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

Log Message:
Curb aprint_*() abuse in bnx(4)


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/sys/dev/pci/if_bnx.c
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/pci/if_bnxreg.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_bnx.c
diff -u src/sys/dev/pci/if_bnx.c:1.106 src/sys/dev/pci/if_bnx.c:1.107
--- src/sys/dev/pci/if_bnx.c:1.106	Sat Feb 13 01:51:24 2021
+++ src/sys/dev/pci/if_bnx.c	Sat Feb 13 16:33:30 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bnx.c,v 1.106 2021/02/13 01:51:24 jakllsch Exp $	*/
+/*	$NetBSD: if_bnx.c,v 1.107 2021/02/13 16:33:30 jakllsch 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.106 2021/02/13 01:51:24 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bnx.c,v 1.107 2021/02/13 16:33:30 jakllsch Exp $");
 
 /*
  * The following controllers are supported by this driver:
@@ -923,10 +923,8 @@ bnx_attach(device_t parent, device_t sel
 	sc->bnx_intrhand = pci_intr_establish_xname(pc, sc->bnx_ih[0], IPL_NET,
 	bnx_intr, sc, device_xname(self));
 	if (sc->bnx_intrhand == NULL) {
-		aprint_error_dev(self, "couldn't establish interrupt");
-		if (intrstr != NULL)
-			aprint_error(" at %s", intrstr);
-		aprint_error("\n");
+		aprint_error_dev(self, "couldn't establish interrupt%s%s\n",
+		intrstr ? " at " : "", intrstr ? intrstr : "");
 		goto bnx_attach_fail;
 	}
 	aprint_normal_dev(sc->bnx_dev, "interrupting at %s\n", intrstr);
@@ -3991,7 +3989,7 @@ bnx_get_buf(struct bnx_softc *sc, uint16
 
 	/* Make sure the inputs are valid. */
 	DBRUNIF((*chain_prod > MAX_RX_BD),
-	aprint_error_dev(sc->bnx_dev,
+	device_printf(sc->bnx_dev,
 		"RX producer out of range: 0x%04X > 0x%04X\n",
 		*chain_prod, (uint16_t)MAX_RX_BD));
 
@@ -4007,7 +4005,7 @@ bnx_get_buf(struct bnx_softc *sc, uint16
 	while (sc->free_rx_bd >= min_free_bd) {
 		/* Simulate an mbuf allocation failure. */
 		DBRUNIF(DB_RANDOMTRUE(bnx_debug_mbuf_allocation_failure),
-		aprint_error_dev(sc->bnx_dev,
+		device_printf(sc->bnx_dev,
 		"Simulating mbuf allocation failure.\n");
 			sc->mbuf_sim_alloc_failed++;
 			rc = ENOBUFS;
@@ -4260,7 +4258,7 @@ bnx_free_tx_chain(struct bnx_softc *sc)
 
 	/* Check if we lost any mbufs in the process. */
 	DBRUNIF((sc->tx_mbuf_alloc),
-	aprint_error_dev(sc->bnx_dev,
+	device_printf(sc->bnx_dev,
 		"Memory leak! Lost %d mbufs from tx chain!\n",
 		sc->tx_mbuf_alloc));
 
@@ -4415,7 +4413,7 @@ bnx_free_rx_chain(struct bnx_softc *sc)
 
 	/* Check if we lost any mbufs in the process. */
 	DBRUNIF((sc->rx_mbuf_alloc),
-	aprint_error_dev(sc->bnx_dev,
+	device_printf(sc->bnx_dev,
 		"Memory leak! Lost %d mbufs from rx chain!\n",
 		sc->rx_mbuf_alloc));
 
@@ -4589,7 +4587,7 @@ bnx_rx_intr(struct bnx_softc *sc)
 		rxbd = >rx_bd_chain[RX_PAGE(sw_chain_cons)][RX_IDX(sw_chain_cons)];
 		sc->free_rx_bd++;
 
-		DBRUN(BNX_VERBOSE_RECV, aprint_error("%s(): ", __func__);
+		DBRUN(BNX_VERBOSE_RECV, printf("%s(): ", __func__);
 		bnx_dump_rxbd(sc, sw_chain_cons, rxbd));
 
 		/* The mbuf is stored with the last rx_bd entry of a packet. */
@@ -4650,13 +4648,13 @@ bnx_rx_intr(struct bnx_softc *sc)
 			status = l2fhdr->l2_fhdr_status;
 
 			DBRUNIF(DB_RANDOMTRUE(bnx_debug_l2fhdr_status_check),
-			aprint_error("Simulating l2_fhdr status error.\n");
+			printf("Simulating l2_fhdr status error.\n");
 			status = status | L2_FHDR_ERRORS_PHY_DECODE);
 
 			/* Watch for unusual sized frames. */
 			DBRUNIF(((len < BNX_MIN_MTU) ||
 			(len > BNX_MAX_JUMBO_ETHER_MTU_VLAN)),
-			aprint_error_dev(sc->bnx_dev,
+			device_printf(sc->bnx_dev,
 "Unusual frame size found. "
 "Min(%d), Actual(%d), Max(%d)\n",
 (int)BNX_MIN_MTU, len,
@@ -4697,7 +4695,7 @@ bnx_rx_intr(struct bnx_softc *sc)
 			 */
 			if (bnx_get_buf(sc, _prod, _chain_prod,
 			_prod_bseq)) {
-DBRUN(BNX_WARN, aprint_debug_dev(sc->bnx_dev,
+DBRUN(BNX_WARN, device_printf(sc->bnx_dev,
 "Failed to allocate "
 "new mbuf, incoming frame dropped!\n"));
 
@@ -4728,7 +4726,7 @@ bnx_rx_intr(struct bnx_softc *sc)
 			DBRUN(BNX_VERBOSE_RECV,
 			struct ether_header *eh;
 			eh = mtod(m, struct ether_header *);
-			aprint_error("%s: to: %s, from: %s, type: 0x%04X\n",
+			printf("%s: to: %s, from: %s, type: 0x%04X\n",
 			__func__, ether_sprintf(eh->ether_dhost),
 			ether_sprintf(eh->ether_shost),
 			htons(eh->ether_type)));
@@ -4868,7 +4866,7 @@ bnx_tx_intr(struct bnx_softc *sc)
 		__func__, hw_tx_cons, sw_tx_cons, sw_tx_chain_cons);
 
 		DBRUNIF((sw_tx_chain_cons > MAX_TX_BD),
-		

CVS commit: src/sys/dev/pci

2021-02-12 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat Feb 13 01:51:24 UTC 2021

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

Log Message:
Revert bnx(4) to INTx interrupts.

Should fix PR kern/55974.

This driver does not yet do the special MSI and MSI-X setup that the
chip apparently requires.


To generate a diff of this commit:
cvs rdiff -u -r1.105 -r1.106 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.105 src/sys/dev/pci/if_bnx.c:1.106
--- src/sys/dev/pci/if_bnx.c:1.105	Fri Jul 17 10:56:15 2020
+++ src/sys/dev/pci/if_bnx.c	Sat Feb 13 01:51:24 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bnx.c,v 1.105 2020/07/17 10:56:15 jdolecek Exp $	*/
+/*	$NetBSD: if_bnx.c,v 1.106 2021/02/13 01:51:24 jakllsch 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.105 2020/07/17 10:56:15 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bnx.c,v 1.106 2021/02/13 01:51:24 jakllsch Exp $");
 
 /*
  * The following controllers are supported by this driver:
@@ -625,7 +625,13 @@ bnx_attach(device_t parent, device_t sel
 		return;
 	}
 
-	if (pci_intr_alloc(pa, >bnx_ih, NULL, 0)) {
+	/* XXX driver needs more work before MSI or MSI-X can be enabled */
+	int counts[PCI_INTR_TYPE_SIZE] = {
+		[PCI_INTR_TYPE_INTX] = 1,
+		[PCI_INTR_TYPE_MSI] = 0,
+		[PCI_INTR_TYPE_MSIX] = 0,
+	};
+	if (pci_intr_alloc(pa, >bnx_ih, counts, PCI_INTR_TYPE_INTX)) {
 		aprint_error_dev(sc->bnx_dev, "couldn't map interrupt\n");
 		goto bnx_attach_fail;
 	}



CVS commit: src/sys/dev/pci

2021-02-09 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Tue Feb  9 15:05:49 UTC 2021

Modified Files:
src/sys/dev/pci: if_iavf.c if_ixl.c

Log Message:
Zero interrupt handles upon allocation.

Might prevent detach-time bugs.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/pci/if_iavf.c
cvs rdiff -u -r1.75 -r1.76 src/sys/dev/pci/if_ixl.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_iavf.c
diff -u src/sys/dev/pci/if_iavf.c:1.11 src/sys/dev/pci/if_iavf.c:1.12
--- src/sys/dev/pci/if_iavf.c:1.11	Thu Dec 10 04:03:00 2020
+++ src/sys/dev/pci/if_iavf.c	Tue Feb  9 15:05:49 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_iavf.c,v 1.11 2020/12/10 04:03:00 yamaguchi Exp $	*/
+/*	$NetBSD: if_iavf.c,v 1.12 2021/02/09 15:05:49 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 2013-2015, Intel Corporation
@@ -75,7 +75,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_iavf.c,v 1.11 2020/12/10 04:03:00 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iavf.c,v 1.12 2021/02/09 15:05:49 jakllsch Exp $");
 
 #include 
 #include 
@@ -1789,7 +1789,7 @@ iavf_setup_interrupts(struct iavf_softc 
 		num = counts[PCI_INTR_TYPE_MSIX];
 	}
 
-	sc->sc_ihs = kmem_alloc(sizeof(sc->sc_ihs[0]) * num, KM_NOSLEEP);
+	sc->sc_ihs = kmem_zalloc(sizeof(sc->sc_ihs[0]) * num, KM_NOSLEEP);
 	if (sc->sc_ihs == NULL) {
 		IAVF_LOG(sc, LOG_ERR,
 		"couldn't allocate memory for interrupts\n");

Index: src/sys/dev/pci/if_ixl.c
diff -u src/sys/dev/pci/if_ixl.c:1.75 src/sys/dev/pci/if_ixl.c:1.76
--- src/sys/dev/pci/if_ixl.c:1.75	Tue Sep  8 10:05:47 2020
+++ src/sys/dev/pci/if_ixl.c	Tue Feb  9 15:05:49 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ixl.c,v 1.75 2020/09/08 10:05:47 yamaguchi Exp $	*/
+/*	$NetBSD: if_ixl.c,v 1.76 2021/02/09 15:05:49 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 2013-2015, Intel Corporation
@@ -74,7 +74,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ixl.c,v 1.75 2020/09/08 10:05:47 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ixl.c,v 1.76 2021/02/09 15:05:49 jakllsch Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -5925,7 +5925,7 @@ ixl_setup_interrupts(struct ixl_softc *s
 			PCI_INTR_MPSAFE, true);
 		}
 
-		sc->sc_ihs = kmem_alloc(sizeof(sc->sc_ihs[0]) * sc->sc_nintrs,
+		sc->sc_ihs = kmem_zalloc(sizeof(sc->sc_ihs[0]) * sc->sc_nintrs,
 		KM_SLEEP);
 
 		if (intr_type == PCI_INTR_TYPE_MSIX) {



CVS commit: src/sys/dev/pci

2021-02-07 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Feb  8 06:56:26 UTC 2021

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

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 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.69 src/sys/dev/pci/if_vioif.c:1.70
--- src/sys/dev/pci/if_vioif.c:1.69	Wed Feb  3 21:04:41 2021
+++ src/sys/dev/pci/if_vioif.c	Mon Feb  8 06:56:26 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vioif.c,v 1.69 2021/02/03 21:04:41 reinoud Exp $	*/
+/*	$NetBSD: if_vioif.c,v 1.70 2021/02/08 06:56:26 skrll Exp $	*/
 
 /*
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.69 2021/02/03 21:04:41 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.70 2021/02/08 06:56:26 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -1669,12 +1669,12 @@ vioif_rx_handle_locked(void *xrxq, u_int
 	if (more) {
 		vioif_rx_sched_handle(sc, rxq);
 		return;
-	} 
+	}
 	more = virtio_start_vq_intr(vsc, rxq->rxq_vq);
 	if (more) {
 		vioif_rx_sched_handle(sc, rxq);
 		return;
-	} 
+	}
 	atomic_store_relaxed(>rxq_active, false);
 }
 
@@ -1777,7 +1777,7 @@ vioif_tx_handle_locked(struct vioif_txqu
 		return;
 	}
 
-	if (virtio_features(vsc) & VIRTIO_F_RING_EVENT_IDX) 
+	if (virtio_features(vsc) & VIRTIO_F_RING_EVENT_IDX)
 		more = virtio_postpone_intr_smart(vsc, vq);
 	else
 		more = virtio_start_vq_intr(vsc, vq);



CVS commit: src/sys/dev/pci

2021-02-07 Thread Ryo ONODERA
Module Name:src
Committed By:   ryoon
Date:   Sun Feb  7 11:25:56 UTC 2021

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

Log Message:
Allow MSIX and MSI for interrupt type


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/pci/xhci_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/xhci_pci.c
diff -u src/sys/dev/pci/xhci_pci.c:1.27 src/sys/dev/pci/xhci_pci.c:1.28
--- src/sys/dev/pci/xhci_pci.c:1.27	Sun Feb  7 04:58:17 2021
+++ src/sys/dev/pci/xhci_pci.c	Sun Feb  7 11:25:56 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhci_pci.c,v 1.27 2021/02/07 04:58:17 dbj Exp $	*/
+/*	$NetBSD: xhci_pci.c,v 1.28 2021/02/07 11:25:56 ryoon Exp $	*/
 /*	OpenBSD: xhci_pci.c,v 1.4 2014/07/12 17:38:51 yuo Exp	*/
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xhci_pci.c,v 1.27 2021/02/07 04:58:17 dbj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci_pci.c,v 1.28 2021/02/07 11:25:56 ryoon Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_xhci_pci.h"
@@ -223,7 +223,7 @@ xhci_pci_attach(device_t parent, device_
 #endif
 
 	/* Allocate and establish the interrupt. */
-	if (pci_intr_alloc(pa, >sc_pihp, counts, 0)) {
+	if (pci_intr_alloc(pa, >sc_pihp, counts, PCI_INTR_TYPE_MSIX)) {
 		aprint_error_dev(self, "can't allocate handler\n");
 		goto fail;
 	}



CVS commit: src/sys/dev/pci

2021-02-07 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Feb  7 09:29:53 UTC 2021

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

Log Message:
In virtio_alloc_vq change BUS_DMA_NOWAIT to BUS_DMA_WAITOK.  It's always
called from attach routines.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 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.48 src/sys/dev/pci/virtio.c:1.49
--- src/sys/dev/pci/virtio.c:1.48	Sun Feb  7 09:26:17 2021
+++ src/sys/dev/pci/virtio.c	Sun Feb  7 09:29:53 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: virtio.c,v 1.48 2021/02/07 09:26:17 skrll Exp $	*/
+/*	$NetBSD: virtio.c,v 1.49 2021/02/07 09:29:53 skrll Exp $	*/
 
 /*
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.48 2021/02/07 09:26:17 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.49 2021/02/07 09:29:53 skrll Exp $");
 
 #include 
 #include 
@@ -692,7 +692,7 @@ virtio_alloc_vq(struct virtio_softc *sc,
 
 	/* alloc and map the memory */
 	r = bus_dmamem_alloc(sc->sc_dmat, allocsize, VIRTIO_PAGE_SIZE, 0,
-			 >vq_segs[0], 1, , BUS_DMA_NOWAIT);
+			 >vq_segs[0], 1, , BUS_DMA_WAITOK);
 	if (r != 0) {
 		aprint_error_dev(sc->sc_dev,
  "virtqueue %d for %s allocation failed, "
@@ -700,7 +700,7 @@ virtio_alloc_vq(struct virtio_softc *sc,
 		goto err;
 	}
 	r = bus_dmamem_map(sc->sc_dmat, >vq_segs[0], rsegs, allocsize,
-			   >vq_vaddr, BUS_DMA_NOWAIT);
+			   >vq_vaddr, BUS_DMA_WAITOK);
 	if (r != 0) {
 		aprint_error_dev(sc->sc_dev,
  "virtqueue %d for %s map failed, "
@@ -708,7 +708,7 @@ virtio_alloc_vq(struct virtio_softc *sc,
 		goto err;
 	}
 	r = bus_dmamap_create(sc->sc_dmat, allocsize, 1, allocsize, 0,
-			  BUS_DMA_NOWAIT, >vq_dmamap);
+			  BUS_DMA_WAITOK, >vq_dmamap);
 	if (r != 0) {
 		aprint_error_dev(sc->sc_dev,
  "virtqueue %d for %s dmamap creation failed, "
@@ -716,7 +716,7 @@ virtio_alloc_vq(struct virtio_softc *sc,
 		goto err;
 	}
 	r = bus_dmamap_load(sc->sc_dmat, vq->vq_dmamap,
-			vq->vq_vaddr, allocsize, NULL, BUS_DMA_NOWAIT);
+			vq->vq_vaddr, allocsize, NULL, BUS_DMA_WAITOK);
 	if (r != 0) {
 		aprint_error_dev(sc->sc_dev,
  "virtqueue %d for %s dmamap load failed, "



CVS commit: src/sys/dev/pci

2021-02-07 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Feb  7 09:26:17 UTC 2021

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

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 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.47 src/sys/dev/pci/virtio.c:1.48
--- src/sys/dev/pci/virtio.c:1.47	Fri Feb  5 20:45:38 2021
+++ src/sys/dev/pci/virtio.c	Sun Feb  7 09:26:17 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: virtio.c,v 1.47 2021/02/05 20:45:38 reinoud Exp $	*/
+/*	$NetBSD: virtio.c,v 1.48 2021/02/07 09:26:17 skrll Exp $	*/
 
 /*
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.47 2021/02/05 20:45:38 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.48 2021/02/07 09:26:17 skrll Exp $");
 
 #include 
 #include 
@@ -649,7 +649,7 @@ virtio_init_vq(struct virtio_softc *sc, 
 	vq_sync_uring(sc, vq, BUS_DMASYNC_PREREAD);
 	vq->vq_queued++;
 }
-	   
+
 /*
  * Allocate/free a vq.
  */
@@ -864,7 +864,7 @@ vq_free_entry(struct virtqueue *vq, stru
  *	  virtio_enqueue_abort(sc, vq, slot);
  *	  return r;
  *	}
- *	r = virtio_enqueue_reserve(sc, vq, slot, 
+ *	r = virtio_enqueue_reserve(sc, vq, slot,
  *   dmamap_payload[slot]->dm_nsegs+1);
  *			// ^ +1 for command
  *	if (r) {	// currently 0 or EAGAIN
@@ -1159,7 +1159,7 @@ virtio_dequeue_commit(struct virtio_soft
  * Attach a child, fill all the members.
  */
 void
-virtio_child_attach_start(struct virtio_softc *sc, device_t child, int ipl, 
+virtio_child_attach_start(struct virtio_softc *sc, device_t child, int ipl,
 		struct virtqueue *vqs,
 		virtio_callback config_change,
 		virtio_callback intr_hand,
@@ -1207,7 +1207,7 @@ virtio_child_attach_finish(struct virtio
 
 	KASSERT(sc->sc_soft_ih == NULL);
 	if (sc->sc_flags & VIRTIO_F_INTR_SOFTINT) {
-		u_int flags = SOFTINT_NET; 
+		u_int flags = SOFTINT_NET;
 		if (sc->sc_flags & VIRTIO_F_INTR_MPSAFE)
 			flags |= SOFTINT_MPSAFE;
 
@@ -1323,24 +1323,24 @@ virtio_print_device_type(device_t self, 
 
 
 MODULE(MODULE_CLASS_DRIVER, virtio, NULL);
- 
+
 #ifdef _MODULE
 #include "ioconf.c"
 #endif
- 
+
 static int
 virtio_modcmd(modcmd_t cmd, void *opaque)
 {
 	int error = 0;
- 
+
 #ifdef _MODULE
 	switch (cmd) {
 	case MODULE_CMD_INIT:
-		error = config_init_component(cfdriver_ioconf_virtio, 
-		cfattach_ioconf_virtio, cfdata_ioconf_virtio); 
+		error = config_init_component(cfdriver_ioconf_virtio,
+		cfattach_ioconf_virtio, cfdata_ioconf_virtio);
 		break;
 	case MODULE_CMD_FINI:
-		error = config_fini_component(cfdriver_ioconf_virtio, 
+		error = config_fini_component(cfdriver_ioconf_virtio,
 		cfattach_ioconf_virtio, cfdata_ioconf_virtio);
 		break;
 	default:
@@ -1348,6 +1348,6 @@ virtio_modcmd(modcmd_t cmd, void *opaque
 		break;
 	}
 #endif
- 
-	return error; 
+
+	return error;
 }



CVS commit: src/sys/dev/pci

2021-02-06 Thread Darrin B. Jewell
Module Name:src
Committed By:   dbj
Date:   Sun Feb  7 04:58:17 UTC 2021

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

Log Message:
xhci_pci.c: reimplement XHCI_DISABLE_MSI and XHCI_DISABLE_MSIX


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/pci/xhci_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/xhci_pci.c
diff -u src/sys/dev/pci/xhci_pci.c:1.26 src/sys/dev/pci/xhci_pci.c:1.27
--- src/sys/dev/pci/xhci_pci.c:1.26	Wed Dec  9 14:21:09 2020
+++ src/sys/dev/pci/xhci_pci.c	Sun Feb  7 04:58:17 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhci_pci.c,v 1.26 2020/12/09 14:21:09 jakllsch Exp $	*/
+/*	$NetBSD: xhci_pci.c,v 1.27 2021/02/07 04:58:17 dbj Exp $	*/
 /*	OpenBSD: xhci_pci.c,v 1.4 2014/07/12 17:38:51 yuo Exp	*/
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xhci_pci.c,v 1.26 2020/12/09 14:21:09 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci_pci.c,v 1.27 2021/02/07 04:58:17 dbj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_xhci_pci.h"
@@ -126,6 +126,7 @@ xhci_pci_attach(device_t parent, device_
 	char const *intrstr;
 	pcireg_t csr, memtype, usbrev;
 	uint32_t hccparams;
+	int counts[PCI_INTR_TYPE_SIZE];
 	char intrbuf[PCI_INTRSTR_LEN];
 	bus_addr_t memaddr;
 	int flags, msixoff;
@@ -211,8 +212,18 @@ xhci_pci_attach(device_t parent, device_
 	pci_conf_write(pc, tag, PCI_COMMAND_STATUS_REG,
 		   csr | PCI_COMMAND_MASTER_ENABLE);
 
+	for (int i = 0; i < PCI_INTR_TYPE_SIZE; i++) {
+		counts[i] = 1;
+	}
+#ifdef XHCI_DISABLE_MSI
+	counts[PCI_INTR_TYPE_MSI] = 0;
+#endif
+#ifdef XHCI_DISABLE_MSIX
+	counts[PCI_INTR_TYPE_MSIX] = 0;
+#endif
+
 	/* Allocate and establish the interrupt. */
-	if (pci_intr_alloc(pa, >sc_pihp, NULL, 0)) {
+	if (pci_intr_alloc(pa, >sc_pihp, counts, 0)) {
 		aprint_error_dev(self, "can't allocate handler\n");
 		goto fail;
 	}



CVS commit: src/sys/dev/pci

2021-02-06 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Feb  6 12:59:13 UTC 2021

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

Log Message:
Remove an extra mutex_spin_exit() in yds_resume().
This one has been moved to before yds_init() in rev 1.59.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 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/yds.c
diff -u src/sys/dev/pci/yds.c:1.65 src/sys/dev/pci/yds.c:1.66
--- src/sys/dev/pci/yds.c:1.65	Sat Feb 29 05:51:11 2020
+++ src/sys/dev/pci/yds.c	Sat Feb  6 12:59:13 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: yds.c,v 1.65 2020/02/29 05:51:11 isaki Exp $	*/
+/*	$NetBSD: yds.c,v 1.66 2021/02/06 12:59:13 isaki Exp $	*/
 
 /*
  * Copyright (c) 2000, 2001 Kazuki Sakamoto and Minoura Makoto.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: yds.c,v 1.65 2020/02/29 05:51:11 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: yds.c,v 1.66 2021/02/06 12:59:13 isaki Exp $");
 
 #include "mpu.h"
 
@@ -725,7 +725,6 @@ yds_resume(device_t dv, const pmf_qual_t
 
 	pci_conf_write(pc, tag, YDS_PCI_DSCTRL, sc->sc_dsctrl);
 	sc->sc_enabled = 1;
-	mutex_spin_exit(>sc_intr_lock);
 	sc->sc_codec[0].codec_if->vtbl->restore_ports(sc->sc_codec[0].codec_if);
 	mutex_exit(>sc_lock);
 



CVS commit: src/sys/dev/pci

2021-02-06 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Feb  6 12:55:34 UTC 2021

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

Log Message:
Add a missing mutex_spin_exit().


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/dev/pci/sv.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/sv.c
diff -u src/sys/dev/pci/sv.c:1.58 src/sys/dev/pci/sv.c:1.59
--- src/sys/dev/pci/sv.c:1.58	Sun Apr 19 08:18:19 2020
+++ src/sys/dev/pci/sv.c	Sat Feb  6 12:55:34 2021
@@ -1,4 +1,4 @@
-/*  $NetBSD: sv.c,v 1.58 2020/04/19 08:18:19 isaki Exp $ */
+/*  $NetBSD: sv.c,v 1.59 2021/02/06 12:55:34 isaki 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.58 2020/04/19 08:18:19 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sv.c,v 1.59 2021/02/06 12:55:34 isaki Exp $");
 
 #include 
 #include 
@@ -1236,6 +1236,7 @@ sv_mixer_get_port(void *addr, mixer_ctrl
 			}
 		}
 
+		mutex_spin_exit(>sc_intr_lock);
 		return error;
 	}
 



CVS commit: src/sys/dev/pci

2021-02-06 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Feb  6 09:45:17 UTC 2021

Modified Files:
src/sys/dev/pci: auich.c auvia.c

Log Message:
Hold sc_intr_lock in open()/close().
vtbl->{lock,unlock} (in fact ac97_{lock,unlock}) don't seem to need
releasing an interrupt lock.
Confirmed on auich.


To generate a diff of this commit:
cvs rdiff -u -r1.159 -r1.160 src/sys/dev/pci/auich.c
cvs rdiff -u -r1.86 -r1.87 src/sys/dev/pci/auvia.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/auich.c
diff -u src/sys/dev/pci/auich.c:1.159 src/sys/dev/pci/auich.c:1.160
--- src/sys/dev/pci/auich.c:1.159	Sat Feb 29 06:34:30 2020
+++ src/sys/dev/pci/auich.c	Sat Feb  6 09:45:17 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: auich.c,v 1.159 2020/02/29 06:34:30 isaki Exp $	*/
+/*	$NetBSD: auich.c,v 1.160 2021/02/06 09:45:17 isaki Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2004, 2005, 2008 The NetBSD Foundation, Inc.
@@ -111,7 +111,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: auich.c,v 1.159 2020/02/29 06:34:30 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auich.c,v 1.160 2021/02/06 09:45:17 isaki Exp $");
 
 #include 
 #include 
@@ -930,9 +930,7 @@ auich_open(void *addr, int flags)
 	struct auich_softc *sc;
 
 	sc = (struct auich_softc *)addr;
-	mutex_spin_exit(>sc_intr_lock);
 	sc->codec_if->vtbl->lock(sc->codec_if);
-	mutex_spin_enter(>sc_intr_lock);
 	return 0;
 }
 
@@ -942,9 +940,7 @@ auich_close(void *addr)
 	struct auich_softc *sc;
 
 	sc = (struct auich_softc *)addr;
-	mutex_spin_exit(>sc_intr_lock);
 	sc->codec_if->vtbl->unlock(sc->codec_if);
-	mutex_spin_enter(>sc_intr_lock);
 }
 
 static int

Index: src/sys/dev/pci/auvia.c
diff -u src/sys/dev/pci/auvia.c:1.86 src/sys/dev/pci/auvia.c:1.87
--- src/sys/dev/pci/auvia.c:1.86	Sun Apr 19 08:18:19 2020
+++ src/sys/dev/pci/auvia.c	Sat Feb  6 09:45:17 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: auvia.c,v 1.86 2020/04/19 08:18:19 isaki Exp $	*/
+/*	$NetBSD: auvia.c,v 1.87 2021/02/06 09:45:17 isaki Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2008 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: auvia.c,v 1.86 2020/04/19 08:18:19 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auvia.c,v 1.87 2021/02/06 09:45:17 isaki Exp $");
 
 #include 
 #include 
@@ -614,9 +614,7 @@ auvia_open(void *addr, int flags)
 	struct auvia_softc *sc;
 
 	sc = (struct auvia_softc *)addr;
-	mutex_spin_exit(>sc_intr_lock);
 	sc->codec_if->vtbl->lock(sc->codec_if);
-	mutex_spin_enter(>sc_intr_lock);
 	return 0;
 }
 
@@ -626,9 +624,7 @@ auvia_close(void *addr)
 	struct auvia_softc *sc;
 
 	sc = (struct auvia_softc *)addr;
-	mutex_spin_exit(>sc_intr_lock);
 	sc->codec_if->vtbl->unlock(sc->codec_if);
-	mutex_spin_enter(>sc_intr_lock);
 }
 
 static int



CVS commit: src/sys/dev/pci

2021-02-05 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Feb  6 05:15:03 UTC 2021

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

Log Message:
Remove debug messages which are no longer necessary.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/dev/pci/emuxki.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/emuxki.c
diff -u src/sys/dev/pci/emuxki.c:1.70 src/sys/dev/pci/emuxki.c:1.71
--- src/sys/dev/pci/emuxki.c:1.70	Sat Jun  8 08:02:38 2019
+++ src/sys/dev/pci/emuxki.c	Sat Feb  6 05:15:03 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: emuxki.c,v 1.70 2019/06/08 08:02:38 isaki Exp $	*/
+/*	$NetBSD: emuxki.c,v 1.71 2021/02/06 05:15:03 isaki Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2007 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: emuxki.c,v 1.70 2019/06/08 08:02:38 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: emuxki.c,v 1.71 2021/02/06 05:15:03 isaki Exp $");
 
 #include 
 #include 
@@ -217,8 +217,6 @@ static void	emuxki_play_start(struct emu
 		uint32_t);
 static void	emuxki_play_stop(struct emuxki_softc *, int);
 
-static int	emuxki_open(void *, int);
-static void	emuxki_close(void *);
 static int	emuxki_query_format(void *, audio_format_query_t *);
 static int	emuxki_set_format(void *, int,
 		const audio_params_t *, const audio_params_t *,
@@ -254,8 +252,6 @@ CFATTACH_DECL_NEW(emuxki, sizeof(struct 
 emuxki_match, emuxki_attach, emuxki_detach, NULL);
 
 static const struct audio_hw_if emuxki_hw_if = {
-	.open			= emuxki_open,
-	.close			= emuxki_close,
 	.query_format		= emuxki_query_format,
 	.set_format		= emuxki_set_format,
 	.round_blocksize	= emuxki_round_blocksize,
@@ -952,24 +948,6 @@ emuxki_timer_stop(struct emuxki_softc *s
  */
 
 static int
-emuxki_open(void *hdl, int flags)
-{
-
-	DPRINTF("%s for %s%s\n", __func__,
-	(flags & FWRITE) ? "P" : "",
-	(flags & FREAD)  ? "R" : "");
-
-	return 0;
-}
-
-static void
-emuxki_close(void *hdl)
-{
-
-	DPRINTF("%s\n", __func__);
-}
-
-static int
 emuxki_query_format(void *hdl, audio_format_query_t *afp)
 {
 



CVS commit: src/sys/dev/pci

2021-02-05 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Feb  5 22:23:30 UTC 2021

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

Log Message:
mcx: Add if_transmit callback to enable more than one tx queue


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 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.15 src/sys/dev/pci/if_mcx.c:1.16
--- src/sys/dev/pci/if_mcx.c:1.15	Sat Jan 30 21:26:32 2021
+++ src/sys/dev/pci/if_mcx.c	Fri Feb  5 22:23:30 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mcx.c,v 1.15 2021/01/30 21:26:32 jmcneill Exp $ */
+/*	$NetBSD: if_mcx.c,v 1.16 2021/02/05 22:23:30 jmcneill Exp $ */
 /*	$OpenBSD: if_mcx.c,v 1.98 2021/01/27 07:46:11 dlg Exp $ */
 
 /*
@@ -23,7 +23,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mcx.c,v 1.15 2021/01/30 21:26:32 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mcx.c,v 1.16 2021/02/05 22:23:30 jmcneill Exp $");
 
 #include 
 #include 
@@ -41,6 +41,8 @@ __KERNEL_RCSID(0, "$NetBSD: if_mcx.c,v 1
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 
@@ -70,6 +72,8 @@ __KERNEL_RCSID(0, "$NetBSD: if_mcx.c,v 1
 #define	CALLOUT_FLAGS	0
 /* #endif */
 
+#define	MCX_TXQ_NUM		2048
+
 #define BUS_DMASYNC_PRERW	(BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE)
 #define BUS_DMASYNC_POSTRW	(BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE)
 
@@ -2318,6 +2322,9 @@ struct mcx_rx {
 
 struct mcx_tx {
 	struct mcx_softc	*tx_softc;
+	kmutex_t		 tx_lock;
+	pcq_t			*tx_pcq;
+	void			*tx_softint;
 
 	int			 tx_uar;
 	int			 tx_sqn;
@@ -2624,6 +2631,8 @@ static int	mcx_init(struct ifnet *);
 static void	mcx_stop(struct ifnet *, int);
 static int	mcx_ioctl(struct ifnet *, u_long, void *);
 static void	mcx_start(struct ifnet *);
+static int	mcx_transmit(struct ifnet *, struct mbuf *);
+static void	mcx_deferred_transmit(void *);
 static void	mcx_watchdog(struct ifnet *);
 static void	mcx_media_add_types(struct mcx_softc *);
 static void	mcx_media_status(struct ifnet *, struct ifmediareq *);
@@ -2954,6 +2963,9 @@ mcx_attach(device_t parent, device_t sel
 	ifp->if_stop = mcx_stop;
 	ifp->if_ioctl = mcx_ioctl;
 	ifp->if_start = mcx_start;
+	if (sc->sc_nqueues > 1) {
+		ifp->if_transmit = mcx_transmit;
+	}
 	ifp->if_watchdog = mcx_watchdog;
 	ifp->if_mtu = sc->sc_hardmtu;
 	ifp->if_capabilities = IFCAP_CSUM_IPv4_Rx | IFCAP_CSUM_IPv4_Tx |
@@ -3009,6 +3021,10 @@ mcx_attach(device_t parent, device_t sel
 		callout_setfunc(>rx_refill, mcx_refill, rx);
 
 		tx->tx_softc = sc;
+		mutex_init(>tx_lock, MUTEX_DEFAULT, IPL_NET);
+		tx->tx_pcq = pcq_create(MCX_TXQ_NUM, KM_SLEEP);
+		tx->tx_softint = softint_establish(SOFTINT_NET|SOFTINT_MPSAFE,
+		mcx_deferred_transmit, tx);
 
 		snprintf(intrxname, sizeof(intrxname), "%s queue %d",
 		DEVNAME(sc), i);
@@ -7763,11 +7779,9 @@ mcx_load_mbuf(struct mcx_softc *sc, stru
 }
 
 static void
-mcx_start(struct ifnet *ifp)
+mcx_send_common_locked(struct ifnet *ifp, struct mcx_tx *tx, bool is_transmit)
 {
 	struct mcx_softc *sc = ifp->if_softc;
-	/* mcx_start() always uses TX ring[0] */
-	struct mcx_tx *tx = >sc_queues[0].q_tx;
 	struct mcx_sq_entry *sq, *sqe;
 	struct mcx_sq_entry_seg *sqs;
 	struct mcx_slot *ms;
@@ -7779,6 +7793,11 @@ mcx_start(struct ifnet *ifp)
 	size_t bf_base;
 	int i, seg, nseg;
 
+	KASSERT(mutex_owned(>tx_lock));
+
+	if ((ifp->if_flags & IFF_RUNNING) == 0)
+		return;
+
 	bf_base = (tx->tx_uar * MCX_PAGE_SIZE) + MCX_UAR_BF;
 
 	idx = tx->tx_prod % (1 << MCX_LOG_SQ_SIZE);
@@ -7798,7 +7817,11 @@ mcx_start(struct ifnet *ifp)
 			break;
 		}
 
-		IFQ_DEQUEUE(>if_snd, m);
+		if (is_transmit) {
+			m = pcq_get(tx->tx_pcq);
+		} else {
+			IFQ_DEQUEUE(>if_snd, m);
+		}
 		if (m == NULL) {
 			break;
 		}
@@ -7917,6 +7940,56 @@ mcx_start(struct ifnet *ifp)
 }
 
 static void
+mcx_start(struct ifnet *ifp)
+{
+	struct mcx_softc *sc = ifp->if_softc;
+	/* mcx_start() always uses TX ring[0] */
+	struct mcx_tx *tx = >sc_queues[0].q_tx;
+
+	mutex_enter(>tx_lock);
+	if (!ISSET(ifp->if_flags, IFF_OACTIVE)) {
+		mcx_send_common_locked(ifp, tx, false);
+	}
+	mutex_exit(>tx_lock);
+}
+
+static int
+mcx_transmit(struct ifnet *ifp, struct mbuf *m)
+{
+	struct mcx_softc *sc = ifp->if_softc;
+	struct mcx_tx *tx;
+
+	tx = >sc_queues[cpu_index(curcpu()) % sc->sc_nqueues].q_tx;
+	if (__predict_false(!pcq_put(tx->tx_pcq, m))) {
+		m_freem(m);
+		return ENOBUFS;
+	}
+
+	if (mutex_tryenter(>tx_lock)) {
+		mcx_send_common_locked(ifp, tx, true);
+		mutex_exit(>tx_lock);
+	} else {
+		softint_schedule(tx->tx_softint);
+	}
+
+	return 0;
+}
+
+static void
+mcx_deferred_transmit(void *arg)
+{
+	struct mcx_tx *tx = arg;
+	struct mcx_softc *sc = tx->tx_softc;
+	struct ifnet *ifp = >sc_ec.ec_if;
+
+	mutex_enter(>tx_lock);
+	if (pcq_peek(tx->tx_pcq) != NULL) {
+		mcx_send_common_locked(ifp, tx, true);
+	}
+	mutex_exit(>tx_lock);
+}
+
+static void
 mcx_watchdog(struct 

CVS commit: src/sys/dev/pci

2021-02-05 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Fri Feb  5 20:45:38 UTC 2021

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

Log Message:
Better reading of 4.1.3.1, it seems that using 32 bit reads/writes is
mandatory for non-legacy devices.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 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.46 src/sys/dev/pci/virtio.c:1.47
--- src/sys/dev/pci/virtio.c:1.46	Fri Feb  5 19:18:23 2021
+++ src/sys/dev/pci/virtio.c	Fri Feb  5 20:45:38 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: virtio.c,v 1.46 2021/02/05 19:18:23 reinoud Exp $	*/
+/*	$NetBSD: virtio.c,v 1.47 2021/02/05 20:45:38 reinoud Exp $	*/
 
 /*
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.46 2021/02/05 19:18:23 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.47 2021/02/05 20:45:38 reinoud Exp $");
 
 #include 
 #include 
@@ -204,7 +204,7 @@ virtio_read_device_config_4(struct virti
 /*
  * The Virtio spec explicitly tells that reading and writing 8 bytes are not
  * considered atomic and no triggers may be connected to reading or writing
- * it. This allows for reading byte-by-byte.
+ * it. We access it using two 32 reads. See virtio spec 4.1.3.1.
  */
 uint64_t
 virtio_read_device_config_8(struct virtio_softc *sc, int index) {
@@ -212,12 +212,16 @@ virtio_read_device_config_8(struct virti
 	bus_space_handle_t ioh = sc->sc_devcfg_ioh;
 	union {
 		uint64_t u64;
-		uint8_t  b[8];
+		uint32_t l[2];
 	} v;
 	uint64_t val;
 
-	for (int i = 0; i < 8; i++)
-		v.b[i] = bus_space_read_1(iot, ioh, index + i);
+	v.l[0] = bus_space_read_4(iot, ioh, index);
+	v.l[1] = bus_space_read_4(iot, ioh, index + 4);
+	if (sc->sc_bus_endian != sc->sc_struct_endian) {
+		v.l[0] = bswap32(v.l[0]);
+		v.l[1] = bswap32(v.l[1]);
+	}
 	val = v.u64;
 
 	if (BYTE_ORDER != sc->sc_struct_endian)
@@ -306,8 +310,9 @@ virtio_write_device_config_4(struct virt
 /*
  * The Virtio spec explicitly tells that reading and writing 8 bytes are not
  * considered atomic and no triggers may be connected to reading or writing
- * it. This allows for writing byte-by-byte. For good measure it is stated to
- * always write lsb first just in case of a hypervisor bug.
+ * it. We access it using two 32 bit writes. For good measure it is stated to
+ * always write lsb first just in case of a hypervisor bug. See See virtio
+ * spec 4.1.3.1.
  */
 void
 virtio_write_device_config_8(struct virtio_softc *sc, int index, uint64_t value)
@@ -316,19 +321,25 @@ virtio_write_device_config_8(struct virt
 	bus_space_handle_t ioh = sc->sc_devcfg_ioh;
 	union {
 		uint64_t u64;
-		uint8_t  b[8];
+		uint32_t l[2];
 	} v;
 
 	if (BYTE_ORDER != sc->sc_struct_endian)
 		value = bswap64(value);
 
 	v.u64 = value;
-	if (sc->sc_struct_endian == LITTLE_ENDIAN)
-		for (int i = 0; i < 8; i++)
-			bus_space_write_1(iot, ioh, index + i, v.b[i]);
- 	else
-		for (int i = 7; i >= 0; i--)
-			bus_space_write_1(iot, ioh, index + i, v.b[i]);
+	if (sc->sc_bus_endian != sc->sc_struct_endian) {
+		v.l[0] = bswap32(v.l[0]);
+		v.l[1] = bswap32(v.l[1]);
+	}
+
+	if (sc->sc_struct_endian == LITTLE_ENDIAN) {
+		bus_space_write_4(iot, ioh, index, v.l[0]);
+		bus_space_write_4(iot, ioh, index + 4, v.l[1]);
+	} else {
+		bus_space_write_4(iot, ioh, index + 4, v.l[1]);
+		bus_space_write_4(iot, ioh, index, v.l[0]);
+	}
 }
 
 /*



CVS commit: src/sys/dev/pci

2021-02-05 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Fri Feb  5 19:18:23 UTC 2021

Modified Files:
src/sys/dev/pci: virtio.c virtio_pci.c virtiovar.h

Log Message:
Second round of cleaning up endian code. No more tailored code to maintain.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/pci/virtio.c
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/pci/virtio_pci.c
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/pci/virtiovar.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/virtio.c
diff -u src/sys/dev/pci/virtio.c:1.45 src/sys/dev/pci/virtio.c:1.46
--- src/sys/dev/pci/virtio.c:1.45	Thu Jan 28 15:43:12 2021
+++ src/sys/dev/pci/virtio.c	Fri Feb  5 19:18:23 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: virtio.c,v 1.45 2021/01/28 15:43:12 reinoud Exp $	*/
+/*	$NetBSD: virtio.c,v 1.46 2021/02/05 19:18:23 reinoud Exp $	*/
 
 /*
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.45 2021/01/28 15:43:12 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.46 2021/02/05 19:18:23 reinoud Exp $");
 
 #include 
 #include 
@@ -201,32 +201,27 @@ virtio_read_device_config_4(struct virti
 	return val;
 }
 
+/*
+ * The Virtio spec explicitly tells that reading and writing 8 bytes are not
+ * considered atomic and no triggers may be connected to reading or writing
+ * it. This allows for reading byte-by-byte.
+ */
 uint64_t
 virtio_read_device_config_8(struct virtio_softc *sc, int index) {
 	bus_space_tag_t	   iot = sc->sc_devcfg_iot;
 	bus_space_handle_t ioh = sc->sc_devcfg_ioh;
-	uint64_t val, val_0, val_1, val_l, val_h;
+	union {
+		uint64_t u64;
+		uint8_t  b[8];
+	} v;
+	uint64_t val;
+
+	for (int i = 0; i < 8; i++)
+		v.b[i] = bus_space_read_1(iot, ioh, index + i);
+	val = v.u64;
 
-	val_0 = bus_space_read_4(iot, ioh, index);
-	val_1 = bus_space_read_4(iot, ioh, index + 4);
-	if (BYTE_ORDER != sc->sc_bus_endian) {
-		val_l = bswap32(val_1);
-		val_h = bswap32(val_0);
-	} else {
-		val_l = val_0;
-		val_h = val_1;
-	}
-
-#ifdef AARCH64EB_PROBLEM
-	/* XXX see comment at virtio_pci.c */
-	if (sc->sc_aarch64eb_bus_problem) {
-		val_l = val_1;
-		val_h = val_0;
-	}
-#endif
-
-	val = val_h << 32;
-	val |= val_l;
+	if (BYTE_ORDER != sc->sc_struct_endian)
+		val = bswap64(val);
 
 	DPRINTFR("read_8", "%08lx", val, index, 8);
 	DPRINTFR2("read_8 low ", "%08x",
@@ -308,34 +303,32 @@ virtio_write_device_config_4(struct virt
 	bus_space_write_4(iot, ioh, index, value);
 }
 
+/*
+ * The Virtio spec explicitly tells that reading and writing 8 bytes are not
+ * considered atomic and no triggers may be connected to reading or writing
+ * it. This allows for writing byte-by-byte. For good measure it is stated to
+ * always write lsb first just in case of a hypervisor bug.
+ */
 void
 virtio_write_device_config_8(struct virtio_softc *sc, int index, uint64_t value)
 {
 	bus_space_tag_t	   iot = sc->sc_devcfg_iot;
 	bus_space_handle_t ioh = sc->sc_devcfg_ioh;
-	uint64_t val_0, val_1, val_l, val_h;
-
-	val_l = BUS_ADDR_LO32(value);
-	val_h = BUS_ADDR_HI32(value);
-
-	if (BYTE_ORDER != sc->sc_bus_endian) {
-		val_0 = bswap32(val_h);
-		val_1 = bswap32(val_l);
-	} else {
-		val_0 = val_l;
-		val_1 = val_h;
-	}
-
-#ifdef AARCH64EB_PROBLEM
-	/* XXX see comment at virtio_pci.c */
-	if (sc->sc_aarch64eb_bus_problem) {
-		val_0 = val_h;
-		val_1 = val_l;
-	}
-#endif
-
-	bus_space_write_4(iot, ioh, index, val_0);
-	bus_space_write_4(iot, ioh, index + 4, val_1);
+	union {
+		uint64_t u64;
+		uint8_t  b[8];
+	} v;
+
+	if (BYTE_ORDER != sc->sc_struct_endian)
+		value = bswap64(value);
+
+	v.u64 = value;
+	if (sc->sc_struct_endian == LITTLE_ENDIAN)
+		for (int i = 0; i < 8; i++)
+			bus_space_write_1(iot, ioh, index + i, v.b[i]);
+ 	else
+		for (int i = 7; i >= 0; i--)
+			bus_space_write_1(iot, ioh, index + i, v.b[i]);
 }
 
 /*

Index: src/sys/dev/pci/virtio_pci.c
diff -u src/sys/dev/pci/virtio_pci.c:1.27 src/sys/dev/pci/virtio_pci.c:1.28
--- src/sys/dev/pci/virtio_pci.c:1.27	Thu Jan 28 15:43:12 2021
+++ src/sys/dev/pci/virtio_pci.c	Fri Feb  5 19:18:23 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: virtio_pci.c,v 1.27 2021/01/28 15:43:12 reinoud Exp $ */
+/* $NetBSD: virtio_pci.c,v 1.28 2021/02/05 19:18:23 reinoud Exp $ */
 
 /*
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.27 2021/01/28 15:43:12 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio_pci.c,v 1.28 2021/02/05 19:18:23 reinoud Exp $");
 
 #include 
 #include 
@@ -127,15 +127,11 @@ static int	virtio_pci_setup_intx_interru
  * suddenly read BIG_ENDIAN where it should stay LITTLE_ENDIAN. The data read
  * 1 byte at a time seem OK but reading bigger lengths result in swapped
  * endian. This is most notable on reading 8 byters since we can't use
- * bus_space_{read,write}_8() and it has to be patched there explicitly. We

CVS commit: src/sys/dev/pci

2021-02-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb  5 16:06:25 UTC 2021

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

Log Message:
PR/55975: Riccardo Mottola: Don't try to lock a mutex from an interrupt context.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/sys/dev/pci/if_wpi.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_wpi.c
diff -u src/sys/dev/pci/if_wpi.c:1.89 src/sys/dev/pci/if_wpi.c:1.90
--- src/sys/dev/pci/if_wpi.c:1.89	Fri Mar 20 13:19:25 2020
+++ src/sys/dev/pci/if_wpi.c	Fri Feb  5 11:06:24 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wpi.c,v 1.89 2020/03/20 17:19:25 sevan Exp $	*/
+/*	$NetBSD: if_wpi.c,v 1.90 2021/02/05 16:06:24 christos Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wpi.c,v 1.89 2020/03/20 17:19:25 sevan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wpi.c,v 1.90 2021/02/05 16:06:24 christos Exp $");
 
 /*
  * Driver for Intel PRO/Wireless 3945ABG 802.11 network adapters.
@@ -158,6 +158,8 @@ static bool	wpi_resume(device_t, const p
 static int	wpi_getrfkill(struct wpi_softc *);
 static void	wpi_sysctlattach(struct wpi_softc *);
 static void	wpi_rsw_thread(void *);
+static void	wpi_rsw_suspend(struct wpi_softc *);
+static void	wpi_stop_intr(struct ifnet *, int);
 
 #ifdef WPI_DEBUG
 #define DPRINTF(x)	do { if (wpi_debug > 0) printf x; } while (0)
@@ -1769,7 +1771,7 @@ wpi_notif_intr(struct wpi_softc *sc)
 "Radio transmitter is off\n");
 /* turn the interface down */
 ifp->if_flags &= ~IFF_UP;
-wpi_stop(ifp, 1);
+wpi_stop_intr(ifp, 1);
 splx(s);
 return;	/* no further processing */
 			}
@@ -1853,7 +1855,7 @@ wpi_softintr(void *arg)
 		/* SYSTEM FAILURE, SYSTEM FAILURE */
 		aprint_error_dev(sc->sc_dev, "fatal firmware error\n");
 		ifp->if_flags &= ~IFF_UP;
-		wpi_stop(ifp, 1);
+		wpi_stop_intr(ifp, 1);
 		return;
 	}
 
@@ -2203,7 +2205,7 @@ wpi_watchdog(struct ifnet *ifp)
 		if (--sc->sc_tx_timer == 0) {
 			aprint_error_dev(sc->sc_dev, "device timeout\n");
 			ifp->if_flags &= ~IFF_UP;
-			wpi_stop(ifp, 1);
+			wpi_stop_intr(ifp, 1);
 			if_statinc(ifp, if_oerrors);
 			return;
 		}
@@ -3200,7 +3202,7 @@ wpi_init(struct ifnet *ifp)
 	uint32_t tmp;
 	int qid, ntries, error;
 
-	wpi_stop(ifp,1);
+	wpi_stop(ifp, 1);
 	(void)wpi_reset(sc);
 
 	wpi_mem_lock(sc);
@@ -3311,7 +3313,7 @@ fail1:	wpi_stop(ifp, 1);
 }
 
 static void
-wpi_stop(struct ifnet *ifp, int disable)
+wpi_stop1(struct ifnet *ifp, int disable, bool fromintr)
 {
 	struct wpi_softc *sc = ifp->if_softc;
 	struct ieee80211com *ic = >sc_ic;
@@ -3323,13 +3325,11 @@ wpi_stop(struct ifnet *ifp, int disable)
 
 	ieee80211_new_state(ic, IEEE80211_S_INIT, -1);
 
-	/* suspend rfkill test thread */
-	mutex_enter(>sc_rsw_mtx);
-	sc->sc_rsw_suspend = true;
-	cv_broadcast(>sc_rsw_cv);
-	while (!sc->sc_rsw_suspended)
-		cv_wait(>sc_rsw_cv, >sc_rsw_mtx);
-	mutex_exit(>sc_rsw_mtx);
+	if (fromintr) {
+		sc->sc_rsw_suspend = true; // XXX: without mutex or wait
+	} else {
+		wpi_rsw_suspend(sc);
+	}
 
 	/* disable interrupts */
 	WPI_WRITE(sc, WPI_MASK, 0);
@@ -3361,6 +3361,18 @@ wpi_stop(struct ifnet *ifp, int disable)
 	WPI_WRITE(sc, WPI_RESET, tmp | WPI_SW_RESET);
 }
 
+static void
+wpi_stop(struct ifnet *ifp, int disable)
+{
+	wpi_stop1(ifp, disable, false);
+}
+
+static void
+wpi_stop_intr(struct ifnet *ifp, int disable)
+{
+	wpi_stop1(ifp, disable, true);
+}
+
 static bool
 wpi_resume(device_t dv, const pmf_qual_t *qual)
 {
@@ -3463,6 +3475,18 @@ err:
 }
 
 static void
+wpi_rsw_suspend(struct wpi_softc *sc)
+{
+	/* suspend rfkill test thread */
+	mutex_enter(>sc_rsw_mtx);
+	sc->sc_rsw_suspend = true;
+	cv_broadcast(>sc_rsw_cv);
+	while (!sc->sc_rsw_suspended)
+		cv_wait(>sc_rsw_cv, >sc_rsw_mtx);
+	mutex_exit(>sc_rsw_mtx);
+}
+
+static void
 wpi_rsw_thread(void *arg)
 {
 	struct wpi_softc *sc = (struct wpi_softc *)arg;



CVS commit: src/sys/dev/pci

2021-02-03 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Feb  3 21:04:41 UTC 2021

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

Log Message:
Oops, made a mistake in my last commit


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 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.68 src/sys/dev/pci/if_vioif.c:1.69
--- src/sys/dev/pci/if_vioif.c:1.68	Wed Feb  3 20:27:59 2021
+++ src/sys/dev/pci/if_vioif.c	Wed Feb  3 21:04:41 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vioif.c,v 1.68 2021/02/03 20:27:59 reinoud Exp $	*/
+/*	$NetBSD: if_vioif.c,v 1.69 2021/02/03 21:04:41 reinoud Exp $	*/
 
 /*
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.68 2021/02/03 20:27:59 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.69 2021/02/03 21:04:41 reinoud Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -574,7 +574,7 @@ vioif_alloc_mems(struct vioif_softc *sc)
 		rxq = >sc_rxq[qid];
 		txq = >sc_txq[qid];
 
-		allocsize += sizeof(struct virtio_net_hdr *) *
+		allocsize += sizeof(struct virtio_net_hdr) *
 			(rxq->rxq_vq->vq_num + txq->txq_vq->vq_num);
 	}
 	if (sc->sc_has_ctrl) {



CVS commit: src/sys/dev/pci

2021-02-03 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Feb  3 20:28:00 UTC 2021

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

Log Message:
Allocate enough space for the bus_dmamap_t arrays for rxq_hdr_dmamaps[] and
txq_hdr_maps[]


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 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.67 src/sys/dev/pci/if_vioif.c:1.68
--- src/sys/dev/pci/if_vioif.c:1.67	Sun Jan 31 14:17:48 2021
+++ src/sys/dev/pci/if_vioif.c	Wed Feb  3 20:27:59 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vioif.c,v 1.67 2021/01/31 14:17:48 reinoud Exp $	*/
+/*	$NetBSD: if_vioif.c,v 1.68 2021/02/03 20:27:59 reinoud Exp $	*/
 
 /*
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.67 2021/01/31 14:17:48 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.68 2021/02/03 20:27:59 reinoud Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -574,8 +574,8 @@ vioif_alloc_mems(struct vioif_softc *sc)
 		rxq = >sc_rxq[qid];
 		txq = >sc_txq[qid];
 
-		allocsize += sc->sc_hdr_size * rxq->rxq_vq->vq_num;
-		allocsize += sc->sc_hdr_size * txq->txq_vq->vq_num;
+		allocsize += sizeof(struct virtio_net_hdr *) *
+			(rxq->rxq_vq->vq_num + txq->txq_vq->vq_num);
 	}
 	if (sc->sc_has_ctrl) {
 		allocsize += sizeof(struct virtio_net_ctrl_cmd) * 1;



CVS commit: src/sys/dev/pci

2021-02-03 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Wed Feb  3 14:44:32 UTC 2021

Modified Files:
src/sys/dev/pci: cs4280.c cs4281.c cs428x.h

Log Message:
Remove code no longer used.
The code that used sc->{halt_input,halt_output} function pointer
was removed in 2004. (see cs428x.c rev 1.7)


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/sys/dev/pci/cs4280.c
cvs rdiff -u -r1.56 -r1.57 src/sys/dev/pci/cs4281.c
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/pci/cs428x.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/cs4280.c
diff -u src/sys/dev/pci/cs4280.c:1.72 src/sys/dev/pci/cs4280.c:1.73
--- src/sys/dev/pci/cs4280.c:1.72	Wed May  8 13:40:18 2019
+++ src/sys/dev/pci/cs4280.c	Wed Feb  3 14:44:32 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: cs4280.c,v 1.72 2019/05/08 13:40:18 isaki Exp $	*/
+/*	$NetBSD: cs4280.c,v 1.73 2021/02/03 14:44:32 isaki Exp $	*/
 
 /*
  * Copyright (c) 1999, 2000 Tatoku Ogaito.  All rights reserved.
@@ -52,7 +52,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cs4280.c,v 1.72 2019/05/08 13:40:18 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cs4280.c,v 1.73 2021/02/03 14:44:32 isaki Exp $");
 
 #include "midi.h"
 
@@ -346,8 +346,6 @@ cs4280_attach(device_t parent, device_t 
 	}
 
 	sc->type = TYPE_CS4280;
-	sc->halt_input  = cs4280_halt_input;
-	sc->halt_output = cs4280_halt_output;
 
 	/* setup buffer related parameters */
 	sc->dma_size = CS4280_DCHUNK;

Index: src/sys/dev/pci/cs4281.c
diff -u src/sys/dev/pci/cs4281.c:1.56 src/sys/dev/pci/cs4281.c:1.57
--- src/sys/dev/pci/cs4281.c:1.56	Fri May  8 13:52:40 2020
+++ src/sys/dev/pci/cs4281.c	Wed Feb  3 14:44:32 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: cs4281.c,v 1.56 2020/05/08 13:52:40 simonb Exp $	*/
+/*	$NetBSD: cs4281.c,v 1.57 2021/02/03 14:44:32 isaki Exp $	*/
 
 /*
  * Copyright (c) 2000 Tatoku Ogaito.  All rights reserved.
@@ -43,7 +43,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cs4281.c,v 1.56 2020/05/08 13:52:40 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cs4281.c,v 1.57 2021/02/03 14:44:32 isaki Exp $");
 
 #include 
 #include 
@@ -272,8 +272,6 @@ cs4281_attach(device_t parent, device_t 
 	}
 
 	sc->type = TYPE_CS4281;
-	sc->halt_input  = cs4281_halt_input;
-	sc->halt_output = cs4281_halt_output;
 
 	sc->dma_size = CS4281_BUFFER_SIZE / MAX_CHANNELS;
 	sc->dma_align= 0x10;

Index: src/sys/dev/pci/cs428x.h
diff -u src/sys/dev/pci/cs428x.h:1.17 src/sys/dev/pci/cs428x.h:1.18
--- src/sys/dev/pci/cs428x.h:1.17	Wed May  8 13:40:18 2019
+++ src/sys/dev/pci/cs428x.h	Wed Feb  3 14:44:32 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: cs428x.h,v 1.17 2019/05/08 13:40:18 isaki Exp $	*/
+/*	$NetBSD: cs428x.h,v 1.18 2021/02/03 14:44:32 isaki Exp $	*/
 
 /*
  * Copyright (c) 2000 Tatoku Ogaito.  All rights reserved.
@@ -106,7 +106,6 @@ struct cs428x_softc {
 	int	sc_pi;
 	struct	cs428x_dma *sc_pdma;
 	char	*sc_pbuf;
-	int	(*halt_output)(void *);
 	char	sc_prun;		/* playback status */
 	int	sc_prate;		/* playback sample rate */
 
@@ -118,7 +117,6 @@ struct cs428x_softc {
 	int	sc_ri;
 	struct	cs428x_dma *sc_rdma;
 	char	*sc_rbuf;
-	int	(*halt_input)(void *);
 	char	sc_rrun;		/* recording status */
 	int	sc_rrate;		/* recording sample rate */
 



CVS commit: src/sys/dev/pci

2021-02-02 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Feb  2 16:11:43 UTC 2021

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

Log Message:
Also match Oxford Semiconductor Exsys EX-41098 PCI UARTs


To generate a diff of this commit:
cvs rdiff -u -r1.108 -r1.109 src/sys/dev/pci/pucdata.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/pucdata.c
diff -u src/sys/dev/pci/pucdata.c:1.108 src/sys/dev/pci/pucdata.c:1.109
--- src/sys/dev/pci/pucdata.c:1.108	Sat Jun 13 12:42:58 2020
+++ src/sys/dev/pci/pucdata.c	Tue Feb  2 16:11:43 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pucdata.c,v 1.108 2020/06/13 12:42:58 ryo Exp $	*/
+/*	$NetBSD: pucdata.c,v 1.109 2021/02/02 16:11:43 bouyer Exp $	*/
 
 /*
  * Copyright (c) 1998, 1999 Christopher G. Demetriou.  All rights reserved.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pucdata.c,v 1.108 2020/06/13 12:42:58 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pucdata.c,v 1.109 2021/02/02 16:11:43 bouyer Exp $");
 
 #include 
 #include 
@@ -1322,6 +1322,19 @@ const struct puc_device_description puc_
 	},
 	},
 
+	/* Oxford Semiconductor Exsys EX-41098 PCI UARTs */
+	{   "Oxford Semiconductor Exsys EX-41098 UARTs",
+	{	PCI_VENDOR_OXFORDSEMI,	PCI_PRODUCT_OXFORDSEMI_EXSYS_EX41098,
+		PCI_VENDOR_OXFORDSEMI,	0 },
+	{	0x,	0x,	0x,	0	},
+	{
+		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x00, COM_FREQ * 8},
+		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x08, COM_FREQ * 8},
+		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x10, COM_FREQ * 8},
+		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x18, COM_FREQ * 8},
+	},
+	},
+
 	/* I-O DATA RSA-PCI2 eight(5-8) UARTs base on OX16PCI954 */
 	{   "I-O DATA RSA-PCI2/P8 (5-8) UARTs",
 	{	PCI_VENDOR_OXFORDSEMI,	PCI_PRODUCT_OXFORDSEMI_EXSYS_EX41098,



CVS commit: src/sys/dev/pci

2021-01-31 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Sun Jan 31 14:17:48 UTC 2021

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

Log Message:
Although the header structure can be smaller, the headers *are* indexed as if
they are full sized so allocate enough memory so the indexing works as
expected and we are not scribbling outside bounds.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 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.66 src/sys/dev/pci/if_vioif.c:1.67
--- src/sys/dev/pci/if_vioif.c:1.66	Wed Jan 20 19:46:48 2021
+++ src/sys/dev/pci/if_vioif.c	Sun Jan 31 14:17:48 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vioif.c,v 1.66 2021/01/20 19:46:48 reinoud Exp $	*/
+/*	$NetBSD: if_vioif.c,v 1.67 2021/01/31 14:17:48 reinoud Exp $	*/
 
 /*
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.66 2021/01/20 19:46:48 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.67 2021/01/31 14:17:48 reinoud Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -611,9 +611,9 @@ vioif_alloc_mems(struct vioif_softc *sc)
 		txq = >sc_txq[qid];
 
 		rxq->rxq_hdrs = vioif_assign_mem(,
-		sc->sc_hdr_size * rxq->rxq_vq->vq_num);
+		sizeof(struct virtio_net_hdr) * rxq->rxq_vq->vq_num);
 		txq->txq_hdrs = vioif_assign_mem(,
-		sc->sc_hdr_size * txq->txq_vq->vq_num);
+		sizeof(struct virtio_net_hdr) * txq->txq_vq->vq_num);
 	}
 	if (sc->sc_has_ctrl) {
 		ctrlq->ctrlq_cmd = vioif_assign_mem(,



CVS commit: src/sys/dev/pci

2021-01-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jan 30 21:24:30 UTC 2021

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

Log Message:
Add some more product IDs for mcx(4)


To generate a diff of this commit:
cvs rdiff -u -r1.1423 -r1.1424 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.1423 src/sys/dev/pci/pcidevs:1.1424
--- src/sys/dev/pci/pcidevs:1.1423	Tue Dec 29 11:05:56 2020
+++ src/sys/dev/pci/pcidevs	Sat Jan 30 21:24:30 2021
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1423 2020/12/29 11:05:56 skrll Exp $
+$NetBSD: pcidevs,v 1.1424 2021/01/30 21:24:30 jmcneill Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -6298,9 +6298,16 @@ product MEDIAQ MQ200		0x0200	MQ200
 
 /* Mellanox Technologies */
 product MELLANOX MT27700	0x1013	ConnectX-4
+product MELLANOX MT27700VF	0x1014	ConnectX-4 VF
 product MELLANOX MT27710	0x1015	ConnectX-4 Lx
+product MELLANOX MT27710VF	0x1016	ConnectX-4 Lx VF
 product MELLANOX MT27800	0x1017	ConnectX-5
+product MELLANOX MT27800VF	0x1018	ConnectX-5 VF
 product MELLANOX MT28800	0x1019	ConnectX-5 Ex
+product MELLANOX MT28800VF	0x101a	ConnectX-5 Ex VF
+product MELLANOX MT28908	0x101b	ConnectX-6
+product MELLANOX MT28908VF	0x101c	ConnectX-6 VF
+product MELLANOX MT2892		0x101d	ConnectX-6 Dx
 product MELLANOX MT23108	0x5a44	InfiniHost (Tavor)
 product MELLANOX MT23108_PCI	0x5a46	InfiniHost PCI Bridge (Tavor)
 product MELLANOX MT25204_OLD	0x5e8c	InfiniHost III Lx (old Sinai)



CVS commit: src/sys/dev/pci

2021-01-28 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Jan 29 06:00:08 UTC 2021

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

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.157 -r1.158 src/sys/dev/pci/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/pci.c
diff -u src/sys/dev/pci/pci.c:1.157 src/sys/dev/pci/pci.c:1.158
--- src/sys/dev/pci/pci.c:1.157	Sun Feb  2 16:30:31 2020
+++ src/sys/dev/pci/pci.c	Fri Jan 29 06:00:08 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci.c,v 1.157 2020/02/02 16:30:31 jmcneill Exp $	*/
+/*	$NetBSD: pci.c,v 1.158 2021/01/29 06:00:08 skrll Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996, 1997, 1998
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci.c,v 1.157 2020/02/02 16:30:31 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci.c,v 1.158 2021/01/29 06:00:08 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -935,7 +935,7 @@ pci_conf_capture(pci_chipset_tag_t pc, p
 	/* For MSI */
 	if (pci_get_capability(pc, tag, PCI_CAP_MSI, , NULL) != 0) {
 		bool bit64, pvmask;
-		
+
 		pcs->msi_ctl = pci_conf_read(pc, tag, off + PCI_MSI_CTL);
 
 		bit64 = pcs->msi_ctl & PCI_MSI_CTL_64BIT_ADDR;



  1   2   3   4   5   6   7   8   9   10   >