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

2024-02-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Feb  3 12:17:03 UTC 2024

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: ix_txrx.c ixgbe.c ixgbe.h
ixgbe_type.h ixv.c

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

sys/dev/pci/ixgbe/ix_txrx.c 1.105-1.116 via patch
sys/dev/pci/ixgbe/ixgbe.c   1.345-1.346,1.349 via 
patch
sys/dev/pci/ixgbe/ixgbe.h   1.94-1.98
sys/dev/pci/ixgbe/ixgbe_type.h  1.62
sys/dev/pci/ixgbe/ixv.c 1.193,1.195-1.196

- Clear the WTHRESH bit field before writing it.
- Optimize ixgbe_txeof().
- Use kmem_zalloc() instead of malloc(,M_ZERO).
- Add QPRDC(Queue Packet Receive Drop Count) into iqdrops.
- No functional change
  - Move assignment of TXD.
  - ixv(4): Remove unused IFF_OACTIVE.
  - Don't include the Flow Director related members to reduce the
size of struct tx_ring. On amd64 and aarch64, the real size is
not changed because of the alignment.
  - The descriptor ring size and the alignment are tested in the
attach function, so it's not required to use
roundup2(size, DBA_ALIGN).
  - Use #ifdef LRO more to reduce the size of struct rx_ring.
  - Change "me" from 32bit to 8bit because the max is 128.
This commit doesn't change the real size of ix_queue, tx_ring
and rx_ring because of the alignment.
  - Th RSC (hardware receive side coalescing) feature has been
disabled all along, so enclose the code with #ifdef RSC.
  - Remove unused.
  - Modify for the readability.
  - Modify comment.
  - Fix comment. Whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.24.2.30 -r1.24.2.31 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.88.2.58 -r1.88.2.59 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.24.6.29 -r1.24.6.30 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.22.2.21 -r1.22.2.22 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.56.2.43 -r1.56.2.44 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.24.2.30 src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.31
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.30	Wed Oct 18 14:23:15 2023
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Sat Feb  3 12:17:03 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.24.2.30 2023/10/18 14:23:15 martin Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.24.2.31 2024/02/03 12:17:03 martin Exp $ */
 
 /**
 
@@ -64,13 +64,14 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.24.2.30 2023/10/18 14:23:15 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.24.2.31 2024/02/03 12:17:03 martin Exp $");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
 
 #include "ixgbe.h"
 
+#ifdef RSC
 /*
  * HW RSC control:
  *  this feature only works with
@@ -84,7 +85,9 @@ __KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 
  *  to enable.
  */
 static bool ixgbe_rsc_enable = FALSE;
+#endif
 
+#ifdef IXGBE_FDIR
 /*
  * For Flow Director: this is the
  * number of TX packets we sample
@@ -95,6 +98,7 @@ static bool ixgbe_rsc_enable = FALSE;
  * setting this to 0.
  */
 static int atr_sample_rate = 20;
+#endif
 
 #define IXGBE_M_ADJ(sc, rxr, mp)	\
 	if (sc->max_frame_size <= (rxr->mbuf_sz - ETHER_ALIGN))	\
@@ -122,8 +126,9 @@ static __inline void ixgbe_rx_input(stru
 static int   ixgbe_dma_malloc(struct ixgbe_softc *, bus_size_t,
   struct ixgbe_dma_alloc *, int);
 static void  ixgbe_dma_free(struct ixgbe_softc *, struct ixgbe_dma_alloc *);
-
-static void	ixgbe_setup_hw_rsc(struct rx_ring *);
+#ifdef RSC
+static void	 ixgbe_setup_hw_rsc(struct rx_ring *);
+#endif
 
 /
  * ixgbe_legacy_start_locked - Transmit entry point
@@ -406,7 +411,7 @@ ixgbe_drain_all(struct ixgbe_softc *sc)
 static int
 ixgbe_xmit(struct tx_ring *txr, struct mbuf *m_head)
 {
-	struct ixgbe_softc  *sc = txr->sc;
+	struct ixgbe_softc  *sc = txr->sc;
 	struct ixgbe_tx_buf *txbuf;
 	union ixgbe_adv_tx_desc *txd = NULL;
 	struct ifnet	*ifp = sc->ifp;
@@ -487,8 +492,8 @@ retry:
 	}
 
 	/*
-	 * Set up the appropriate offload context
-	 * this will consume the first descriptor
+	 * Set up the appropriate offload context if requested,
+	 * this may consume one TX descriptor.
 	 */
 	error = ixgbe_tx_ctx_setup(txr, m_head, _type_len, _status);
 	if (__predict_false(error)) {
@@ -625,14 +630,8 @@ ixgbe_allocate_transmit_buffers(struct t
 		goto fail;
 	}
 
-	txr->tx_buffers =
-	(struct ixgbe_tx_buf *) malloc(sizeof(struct ixgbe_tx_buf) *
-	sc->num_tx_desc, M_DEVBUF, M_NOWAIT | M_ZERO);
-	if (txr->tx_buffers == NULL) {
-		aprint_error_dev(dev, "Unable 

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

2024-02-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Feb  3 12:17:03 UTC 2024

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: ix_txrx.c ixgbe.c ixgbe.h
ixgbe_type.h ixv.c

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

sys/dev/pci/ixgbe/ix_txrx.c 1.105-1.116 via patch
sys/dev/pci/ixgbe/ixgbe.c   1.345-1.346,1.349 via 
patch
sys/dev/pci/ixgbe/ixgbe.h   1.94-1.98
sys/dev/pci/ixgbe/ixgbe_type.h  1.62
sys/dev/pci/ixgbe/ixv.c 1.193,1.195-1.196

- Clear the WTHRESH bit field before writing it.
- Optimize ixgbe_txeof().
- Use kmem_zalloc() instead of malloc(,M_ZERO).
- Add QPRDC(Queue Packet Receive Drop Count) into iqdrops.
- No functional change
  - Move assignment of TXD.
  - ixv(4): Remove unused IFF_OACTIVE.
  - Don't include the Flow Director related members to reduce the
size of struct tx_ring. On amd64 and aarch64, the real size is
not changed because of the alignment.
  - The descriptor ring size and the alignment are tested in the
attach function, so it's not required to use
roundup2(size, DBA_ALIGN).
  - Use #ifdef LRO more to reduce the size of struct rx_ring.
  - Change "me" from 32bit to 8bit because the max is 128.
This commit doesn't change the real size of ix_queue, tx_ring
and rx_ring because of the alignment.
  - Th RSC (hardware receive side coalescing) feature has been
disabled all along, so enclose the code with #ifdef RSC.
  - Remove unused.
  - Modify for the readability.
  - Modify comment.
  - Fix comment. Whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.24.2.30 -r1.24.2.31 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.88.2.58 -r1.88.2.59 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.24.6.29 -r1.24.6.30 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.22.2.21 -r1.22.2.22 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.56.2.43 -r1.56.2.44 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.



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

2023-10-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Oct 18 14:23:15 UTC 2023

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: ix_txrx.c ixgbe.c ixgbe.h
ixgbe_82599.c ixgbe_api.c ixgbe_bypass.h ixgbe_common.c
ixgbe_common.h ixgbe_dcb.c ixgbe_dcb_82598.c ixgbe_type.h
ixgbe_x540.c ixgbe_x550.c ixv.c

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

sys/dev/pci/ixgbe/ix_txrx.c 1.103-1.104
sys/dev/pci/ixgbe/ixgbe.c   1.334-1.338,
1.341-1.344 via patch
sys/dev/pci/ixgbe/ixgbe.h   1.90-1.93
sys/dev/pci/ixgbe/ixgbe_82599.c 1.31-1.32
sys/dev/pci/ixgbe/ixgbe_api.c   1.29
sys/dev/pci/ixgbe/ixgbe_bypass.h1.5
sys/dev/pci/ixgbe/ixgbe_common.c1.46-1.47
sys/dev/pci/ixgbe/ixgbe_common.h1.18
sys/dev/pci/ixgbe/ixgbe_dcb.c   1.14-1.15
sys/dev/pci/ixgbe/ixgbe_dcb_82598.c 1.13
sys/dev/pci/ixgbe/ixgbe_type.h  1.59-1.61
sys/dev/pci/ixgbe/ixgbe_x540.c  1.24
sys/dev/pci/ixgbe/ixgbe_x550.c  1.28
sys/dev/pci/ixgbe/ixv.c 1.187-1.192 via patch

- ixg(4): Add 82599 LS support once again.
- ixg(4): Filter out spurious link up indication more.
- ixg(4): Print DEVICE_CAPS register.
- ixg(4): Fix a bug that the number of queues is unintentionally
  limited to a small number or wrong error message may be printed
  when two devices' number of MSI-X vectors are different.
- Modify error message of wrong TX/RX descriptor size.
- Enable interrupt after setting IFF_RUNNING.
- Fix a bug that changing hw.ix[gv]X.qY.interrupt_rate would change
  all devices all queues default interrupt rate.
- Cleanup the code.


To generate a diff of this commit:
cvs rdiff -u -r1.24.2.29 -r1.24.2.30 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.88.2.57 -r1.88.2.58 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.24.6.28 -r1.24.6.29 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.14.8.10 -r1.14.8.11 src/sys/dev/pci/ixgbe/ixgbe_82599.c
cvs rdiff -u -r1.15.8.9 -r1.15.8.10 src/sys/dev/pci/ixgbe/ixgbe_api.c
cvs rdiff -u -r1.1.4.5 -r1.1.4.6 src/sys/dev/pci/ixgbe/ixgbe_bypass.h
cvs rdiff -u -r1.13.2.15 -r1.13.2.16 src/sys/dev/pci/ixgbe/ixgbe_common.c
cvs rdiff -u -r1.7.8.7 -r1.7.8.8 src/sys/dev/pci/ixgbe/ixgbe_common.h
cvs rdiff -u -r1.4.8.4 -r1.4.8.5 src/sys/dev/pci/ixgbe/ixgbe_dcb.c
cvs rdiff -u -r1.3.8.4 -r1.3.8.5 src/sys/dev/pci/ixgbe/ixgbe_dcb_82598.c
cvs rdiff -u -r1.22.2.20 -r1.22.2.21 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.9.6.8 -r1.9.6.9 src/sys/dev/pci/ixgbe/ixgbe_x540.c
cvs rdiff -u -r1.5.6.13 -r1.5.6.14 src/sys/dev/pci/ixgbe/ixgbe_x550.c
cvs rdiff -u -r1.56.2.42 -r1.56.2.43 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.



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

2023-10-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Oct 18 14:23:15 UTC 2023

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: ix_txrx.c ixgbe.c ixgbe.h
ixgbe_82599.c ixgbe_api.c ixgbe_bypass.h ixgbe_common.c
ixgbe_common.h ixgbe_dcb.c ixgbe_dcb_82598.c ixgbe_type.h
ixgbe_x540.c ixgbe_x550.c ixv.c

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

sys/dev/pci/ixgbe/ix_txrx.c 1.103-1.104
sys/dev/pci/ixgbe/ixgbe.c   1.334-1.338,
1.341-1.344 via patch
sys/dev/pci/ixgbe/ixgbe.h   1.90-1.93
sys/dev/pci/ixgbe/ixgbe_82599.c 1.31-1.32
sys/dev/pci/ixgbe/ixgbe_api.c   1.29
sys/dev/pci/ixgbe/ixgbe_bypass.h1.5
sys/dev/pci/ixgbe/ixgbe_common.c1.46-1.47
sys/dev/pci/ixgbe/ixgbe_common.h1.18
sys/dev/pci/ixgbe/ixgbe_dcb.c   1.14-1.15
sys/dev/pci/ixgbe/ixgbe_dcb_82598.c 1.13
sys/dev/pci/ixgbe/ixgbe_type.h  1.59-1.61
sys/dev/pci/ixgbe/ixgbe_x540.c  1.24
sys/dev/pci/ixgbe/ixgbe_x550.c  1.28
sys/dev/pci/ixgbe/ixv.c 1.187-1.192 via patch

- ixg(4): Add 82599 LS support once again.
- ixg(4): Filter out spurious link up indication more.
- ixg(4): Print DEVICE_CAPS register.
- ixg(4): Fix a bug that the number of queues is unintentionally
  limited to a small number or wrong error message may be printed
  when two devices' number of MSI-X vectors are different.
- Modify error message of wrong TX/RX descriptor size.
- Enable interrupt after setting IFF_RUNNING.
- Fix a bug that changing hw.ix[gv]X.qY.interrupt_rate would change
  all devices all queues default interrupt rate.
- Cleanup the code.


To generate a diff of this commit:
cvs rdiff -u -r1.24.2.29 -r1.24.2.30 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.88.2.57 -r1.88.2.58 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.24.6.28 -r1.24.6.29 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.14.8.10 -r1.14.8.11 src/sys/dev/pci/ixgbe/ixgbe_82599.c
cvs rdiff -u -r1.15.8.9 -r1.15.8.10 src/sys/dev/pci/ixgbe/ixgbe_api.c
cvs rdiff -u -r1.1.4.5 -r1.1.4.6 src/sys/dev/pci/ixgbe/ixgbe_bypass.h
cvs rdiff -u -r1.13.2.15 -r1.13.2.16 src/sys/dev/pci/ixgbe/ixgbe_common.c
cvs rdiff -u -r1.7.8.7 -r1.7.8.8 src/sys/dev/pci/ixgbe/ixgbe_common.h
cvs rdiff -u -r1.4.8.4 -r1.4.8.5 src/sys/dev/pci/ixgbe/ixgbe_dcb.c
cvs rdiff -u -r1.3.8.4 -r1.3.8.5 src/sys/dev/pci/ixgbe/ixgbe_dcb_82598.c
cvs rdiff -u -r1.22.2.20 -r1.22.2.21 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.9.6.8 -r1.9.6.9 src/sys/dev/pci/ixgbe/ixgbe_x540.c
cvs rdiff -u -r1.5.6.13 -r1.5.6.14 src/sys/dev/pci/ixgbe/ixgbe_x550.c
cvs rdiff -u -r1.56.2.42 -r1.56.2.43 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.24.2.29 src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.30
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.29	Fri Oct 13 18:32:38 2023
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Wed Oct 18 14:23:15 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.24.2.29 2023/10/13 18:32:38 martin Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.24.2.30 2023/10/18 14:23:15 martin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.24.2.29 2023/10/13 18:32:38 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.24.2.30 2023/10/18 14:23:15 martin Exp $");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -846,7 +846,6 @@ ixgbe_tx_ctx_setup(struct tx_ring *txr, 
 	u8   ipproto = 0;
 	char *l3d;
 
-
 	/* First check if TSO is to be used */
 	if (mp->m_pkthdr.csum_flags & (M_CSUM_TSOv4 | M_CSUM_TSOv6)) {
 		int rv = ixgbe_tso_setup(txr, mp, cmd_type_len, olinfo_status);
@@ -1282,9 +1281,9 @@ ixgbe_rsc_count(union ixgbe_adv_rx_desc 
 static void
 ixgbe_setup_hw_rsc(struct rx_ring *rxr)
 {
-	struct	ixgbe_softc *sc = rxr->sc;
-	struct	ixgbe_hw *hw = >hw;
-	u32  rscctrl, rdrxctl;
+	struct ixgbe_softc *sc = rxr->sc;
+	struct ixgbe_hw	*hw = >hw;
+	u32		rscctrl, rdrxctl;
 
 	/* If turning LRO/RSC off we need to disable it */
 	if ((sc->ifp->if_capenable & IFCAP_LRO) == 0) {
@@ -1746,9 +1745,9 @@ ixgbe_rx_input(struct rx_ring *rxr, stru
 (CSUM_DATA_VALID | CSUM_PSEUDO_HDR)) {
 /*
  * Send to the stack if:
- **  - LRO not enabled, or
- **  - no LRO resources, or
- **  - lro enqueue fails
+ *  - LRO not enabled, or
+

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

2023-10-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Oct 13 18:32:39 UTC 2023

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: if_bypass.c if_fdir.c if_sriov.c
ix_txrx.c ixgbe.c ixgbe.h ixgbe_api.h ixgbe_bypass.h ixgbe_common.c
ixgbe_common.h ixgbe_fdir.h ixgbe_netmap.c ixgbe_netmap.h
ixgbe_osdep.c ixgbe_sriov.h ixgbe_type.h ixgbe_x550.c ixv.c

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

sys/dev/pci/ixgbe/if_bypass.c   1.10
sys/dev/pci/ixgbe/if_fdir.c 1.6 via patch
sys/dev/pci/ixgbe/if_sriov.c1.18 via patch
sys/dev/pci/ixgbe/ix_txrx.c 1.102 via patch
sys/dev/pci/ixgbe/ixgbe.c   1.333,1.339 via patch
sys/dev/pci/ixgbe/ixgbe.h   1.89
sys/dev/pci/ixgbe/ixgbe_api.h   1.17
sys/dev/pci/ixgbe/ixgbe_common.h1.17
sys/dev/pci/ixgbe/ixgbe_bypass.h1.4
sys/dev/pci/ixgbe/ixgbe_common.c1.45
sys/dev/pci/ixgbe/ixgbe_fdir.h  1.5
sys/dev/pci/ixgbe/ixgbe_netmap.h1.3
sys/dev/pci/ixgbe/ixgbe_netmap.c1.6
sys/dev/pci/ixgbe/ixgbe_osdep.c 1.9
sys/dev/pci/ixgbe/ixgbe_sriov.h 1.6
sys/dev/pci/ixgbe/ixgbe_type.h  1.58
sys/dev/pci/ixgbe/ixgbe_x550.c  1.27
sys/dev/pci/ixgbe/ixv.c 1.186 via patch

ixgbe: Rename some definitions, modify comment. No functional change.
 Apply changes from FreeBSD's ix-3.3.31 and ixv-1.5.32.
- struct adapter *adapter -> struct ixgbe_softc *sc
- master -> primary
- black -> block

ixg(4): Whitespace. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.2.4.7 -r1.2.4.8 src/sys/dev/pci/ixgbe/if_bypass.c
cvs rdiff -u -r1.1.4.4 -r1.1.4.5 src/sys/dev/pci/ixgbe/if_fdir.c \
src/sys/dev/pci/ixgbe/ixgbe_bypass.h
cvs rdiff -u -r1.1.4.8 -r1.1.4.9 src/sys/dev/pci/ixgbe/if_sriov.c
cvs rdiff -u -r1.24.2.28 -r1.24.2.29 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.88.2.56 -r1.88.2.57 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.24.6.27 -r1.24.6.28 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.9.8.5 -r1.9.8.6 src/sys/dev/pci/ixgbe/ixgbe_api.h
cvs rdiff -u -r1.13.2.14 -r1.13.2.15 src/sys/dev/pci/ixgbe/ixgbe_common.c
cvs rdiff -u -r1.7.8.6 -r1.7.8.7 src/sys/dev/pci/ixgbe/ixgbe_common.h
cvs rdiff -u -r1.1.4.5 -r1.1.4.6 src/sys/dev/pci/ixgbe/ixgbe_fdir.h \
src/sys/dev/pci/ixgbe/ixgbe_netmap.c
cvs rdiff -u -r1.1.4.3 -r1.1.4.4 src/sys/dev/pci/ixgbe/ixgbe_netmap.h
cvs rdiff -u -r1.1.12.6 -r1.1.12.7 src/sys/dev/pci/ixgbe/ixgbe_osdep.c
cvs rdiff -u -r1.1.4.6 -r1.1.4.7 src/sys/dev/pci/ixgbe/ixgbe_sriov.h
cvs rdiff -u -r1.22.2.19 -r1.22.2.20 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.5.6.12 -r1.5.6.13 src/sys/dev/pci/ixgbe/ixgbe_x550.c
cvs rdiff -u -r1.56.2.41 -r1.56.2.42 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.



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

2023-10-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Oct  8 15:19:32 UTC 2023

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: ix_txrx.c ixgbe.c ixgbe.h
ixgbe_82599.c ixgbe_mbx.h ixgbe_type.h ixgbe_vf.c ixgbe_vf.h ixv.c

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

sys/dev/pci/ixgbe/ixgbe.c   1.327-1.332 via patch
sys/dev/pci/ixgbe/ixgbe.h   1.87-1.88
sys/dev/pci/ixgbe/ixv.c 1.184-1.185
sys/dev/pci/ixgbe/ix_txrx.c 1.101
sys/dev/pci/ixgbe/ixgbe_82599.c 1.30
sys/dev/pci/ixgbe/ixgbe_vf.c1.32-1.33
sys/dev/pci/ixgbe/ixgbe_vf.h1.18
sys/dev/pci/ixgbe/ixgbe_mbx.h   1.20
sys/dev/pci/ixgbe/ixgbe_type.h  1.57

- Reorder some event counters for readability.
- Rename some descriptions of event counters.
- Count Queue Bytes {Transmit, Receive} counter.
- Improve error check in ixgbe_check_mac_link_vf().
- Add new IXGBE_VF_GET_LINK_STATE message support.
  The VF's link state can be forced to down by PF.
- Update FCTRL after writing multicast filter.
- Update comments.


To generate a diff of this commit:
cvs rdiff -u -r1.24.2.27 -r1.24.2.28 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.88.2.55 -r1.88.2.56 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.24.6.26 -r1.24.6.27 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.14.8.9 -r1.14.8.10 src/sys/dev/pci/ixgbe/ixgbe_82599.c
cvs rdiff -u -r1.10.8.5 -r1.10.8.6 src/sys/dev/pci/ixgbe/ixgbe_mbx.h
cvs rdiff -u -r1.22.2.18 -r1.22.2.19 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.12.8.9 -r1.12.8.10 src/sys/dev/pci/ixgbe/ixgbe_vf.c
cvs rdiff -u -r1.8.6.6 -r1.8.6.7 src/sys/dev/pci/ixgbe/ixgbe_vf.h
cvs rdiff -u -r1.56.2.40 -r1.56.2.41 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.



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

2023-10-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Oct  8 15:19:32 UTC 2023

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: ix_txrx.c ixgbe.c ixgbe.h
ixgbe_82599.c ixgbe_mbx.h ixgbe_type.h ixgbe_vf.c ixgbe_vf.h ixv.c

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

sys/dev/pci/ixgbe/ixgbe.c   1.327-1.332 via patch
sys/dev/pci/ixgbe/ixgbe.h   1.87-1.88
sys/dev/pci/ixgbe/ixv.c 1.184-1.185
sys/dev/pci/ixgbe/ix_txrx.c 1.101
sys/dev/pci/ixgbe/ixgbe_82599.c 1.30
sys/dev/pci/ixgbe/ixgbe_vf.c1.32-1.33
sys/dev/pci/ixgbe/ixgbe_vf.h1.18
sys/dev/pci/ixgbe/ixgbe_mbx.h   1.20
sys/dev/pci/ixgbe/ixgbe_type.h  1.57

- Reorder some event counters for readability.
- Rename some descriptions of event counters.
- Count Queue Bytes {Transmit, Receive} counter.
- Improve error check in ixgbe_check_mac_link_vf().
- Add new IXGBE_VF_GET_LINK_STATE message support.
  The VF's link state can be forced to down by PF.
- Update FCTRL after writing multicast filter.
- Update comments.


To generate a diff of this commit:
cvs rdiff -u -r1.24.2.27 -r1.24.2.28 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.88.2.55 -r1.88.2.56 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.24.6.26 -r1.24.6.27 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.14.8.9 -r1.14.8.10 src/sys/dev/pci/ixgbe/ixgbe_82599.c
cvs rdiff -u -r1.10.8.5 -r1.10.8.6 src/sys/dev/pci/ixgbe/ixgbe_mbx.h
cvs rdiff -u -r1.22.2.18 -r1.22.2.19 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.12.8.9 -r1.12.8.10 src/sys/dev/pci/ixgbe/ixgbe_vf.c
cvs rdiff -u -r1.8.6.6 -r1.8.6.7 src/sys/dev/pci/ixgbe/ixgbe_vf.h
cvs rdiff -u -r1.56.2.40 -r1.56.2.41 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.24.2.27 src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.28
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.27	Mon Jan 23 14:07:24 2023
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Sun Oct  8 15:19:31 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.24.2.27 2023/01/23 14:07:24 martin Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.24.2.28 2023/10/08 15:19:31 martin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.24.2.27 2023/01/23 14:07:24 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.24.2.28 2023/10/08 15:19:31 martin Exp $");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -1341,11 +1341,6 @@ 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,
- *  so the ixgbe_refresh_mbufs() function can be simplified.
- *
  /
 static void
 ixgbe_refresh_mbufs(struct rx_ring *rxr, int limit)

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.55 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.56
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.55	Wed Jun 21 19:28:12 2023
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Sun Oct  8 15:19:31 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.55 2023/06/21 19:28:12 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.56 2023/10/08 15:19:31 martin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.88.2.55 2023/06/21 19:28:12 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.88.2.56 2023/10/08 15:19:31 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1601,8 +1601,19 @@ ixgbe_update_stats_counters(struct adapt
 	for (i = 0; i < queue_counters; i++) {
 		IXGBE_EVC_REGADD(hw, stats, IXGBE_QPRC(i), qprc[i]);
 		IXGBE_EVC_REGADD(hw, stats, IXGBE_QPTC(i), qptc[i]);
-		if (hw->mac.type >= ixgbe_mac_82599EB)
+		if (hw->mac.type >= ixgbe_mac_82599EB) {
+			IXGBE_EVC_ADD(>qbrc[i],
+			IXGBE_READ_REG(hw, IXGBE_QBRC_L(i)) +
+			((u64)IXGBE_READ_REG(hw, IXGBE_QBRC_H(i)) << 32));
+			IXGBE_EVC_ADD(>qbtc[i],
+			IXGBE_READ_REG(hw, IXGBE_QBTC_L(i)) +
+			((u64)IXGBE_READ_REG(hw, IXGBE_QBTC_H(i)) << 32));
 			IXGBE_EVC_REGADD(hw, stats, IXGBE_QPRDC(i), qprdc[i]);
+		} else {
+			/* 82598 */
+			IXGBE_EVC_REGADD(hw, stats, IXGBE_QBRC(i), qbrc[i]);
+			IXGBE_EVC_REGADD(hw, stats, IXGBE_QBTC(i), qbtc[i]);
+		}
 	}
 
 	/* 8 registers exist */
@@ -1813,28 +1824,28 @@ ixgbe_add_hw_stats(struct adapter *adapt
 		if (i < __arraycount(stats->pxontxc)) {
 			

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

2023-06-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jun 21 19:28:12 UTC 2023

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: ixgbe.c ixgbe_common.c ixgbe_type.h

Log Message:
Pullup the following revisions, requested by msaitoh in ticket #1828:

sys/dev/pci/ixgbe/ixgbe.c   1.325-1.326 via patch
sys/dev/pci/ixgbe/ixgbe_common.c1.44
sys/dev/pci/ixgbe/ixgbe_type.h  1.56

- PCI device ID 0x15c8 also uses X557-AT PHY, so create the thermal
  sensor sysctl for it, too.
- Count the number of link down events in the MAC using with
  LINK_DN_CNT register.


To generate a diff of this commit:
cvs rdiff -u -r1.88.2.54 -r1.88.2.55 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.13.2.13 -r1.13.2.14 src/sys/dev/pci/ixgbe/ixgbe_common.c
cvs rdiff -u -r1.22.2.17 -r1.22.2.18 src/sys/dev/pci/ixgbe/ixgbe_type.h

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

Modified files:

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.54 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.55
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.54	Mon Jan 23 14:07:24 2023
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Wed Jun 21 19:28:12 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.54 2023/01/23 14:07:24 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.55 2023/06/21 19:28:12 martin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.88.2.54 2023/01/23 14:07:24 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.88.2.55 2023/06/21 19:28:12 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1643,6 +1643,8 @@ ixgbe_update_stats_counters(struct adapt
 		IXGBE_EVC_REGADD(hw, stats, IXGBE_MLFC, mlfc);
 		IXGBE_EVC_REGADD(hw, stats, IXGBE_MRFC, mrfc);
 	}
+	if (hw->mac.type == ixgbe_mac_X550EM_a)
+		IXGBE_EVC_REGADD(hw, stats, IXGBE_LINK_DN_CNT, link_dn_cnt);
 	IXGBE_EVC_REGADD2(hw, stats, IXGBE_RLEC, rlec);
 
 	/* Hardware workaround, gprc counts missed packets */
@@ -1993,6 +1995,9 @@ ixgbe_add_hw_stats(struct adapter *adapt
 	stats->namebuf, "MAC Local Faults");
 	evcnt_attach_dynamic(>mrfc, EVCNT_TYPE_MISC, NULL,
 	stats->namebuf, "MAC Remote Faults");
+	if (hw->mac.type == ixgbe_mac_X550EM_a)
+		evcnt_attach_dynamic(>link_dn_cnt, EVCNT_TYPE_MISC,
+		NULL, stats->namebuf, "Link down event in the MAC");
 	evcnt_attach_dynamic(>rlec, EVCNT_TYPE_MISC, NULL,
 	stats->namebuf, "Receive Length Errors");
 	evcnt_attach_dynamic(>lxontxc, EVCNT_TYPE_MISC, NULL,
@@ -2161,6 +2166,8 @@ ixgbe_clear_evcnt(struct adapter *adapte
 	IXGBE_EVC_STORE(>mpctotal, 0);
 	IXGBE_EVC_STORE(>mlfc, 0);
 	IXGBE_EVC_STORE(>mrfc, 0);
+	if (hw->mac.type == ixgbe_mac_X550EM_a)
+		IXGBE_EVC_STORE(>link_dn_cnt, 0);
 	IXGBE_EVC_STORE(>rlec, 0);
 	IXGBE_EVC_STORE(>lxontxc, 0);
 	IXGBE_EVC_STORE(>lxonrxc, 0);
@@ -3433,7 +3440,8 @@ ixgbe_add_device_sysctls(struct adapter 
 	}
 
 	/* for X552/X557-AT devices */
-	if (hw->device_id == IXGBE_DEV_ID_X550EM_X_10G_T) {
+	if ((hw->device_id == IXGBE_DEV_ID_X550EM_X_10G_T) ||
+	(hw->device_id == IXGBE_DEV_ID_X550EM_A_10G_T)) {
 		const struct sysctlnode *phy_node;
 
 		if (sysctl_createv(log, 0, , _node, 0, CTLTYPE_NODE,
@@ -3729,6 +3737,8 @@ ixgbe_detach(device_t dev, int flags)
 	evcnt_detach(>mpctotal);
 	evcnt_detach(>mlfc);
 	evcnt_detach(>mrfc);
+	if (hw->mac.type == ixgbe_mac_X550EM_a)
+		evcnt_detach(>link_dn_cnt);
 	evcnt_detach(>rlec);
 	evcnt_detach(>lxontxc);
 	evcnt_detach(>lxonrxc);
@@ -5772,7 +5782,8 @@ ixgbe_sysctl_phy_temp(SYSCTLFN_ARGS)
 	if (ixgbe_fw_recovery_mode_swflag(adapter))
 		return (EPERM);
 
-	if (hw->device_id != IXGBE_DEV_ID_X550EM_X_10G_T) {
+	if ((hw->device_id != IXGBE_DEV_ID_X550EM_X_10G_T) &&
+	(hw->device_id != IXGBE_DEV_ID_X550EM_A_10G_T)) {
 		device_printf(adapter->dev,
 		"Device has no supported external thermal sensor.\n");
 		return (ENODEV);
@@ -5815,7 +5826,8 @@ ixgbe_sysctl_phy_overtemp_occurred(SYSCT
 	if (ixgbe_fw_recovery_mode_swflag(adapter))
 		return (EPERM);
 
-	if (hw->device_id != IXGBE_DEV_ID_X550EM_X_10G_T) {
+	if ((hw->device_id != IXGBE_DEV_ID_X550EM_X_10G_T) &&
+	(hw->device_id != IXGBE_DEV_ID_X550EM_A_10G_T)) {
 		device_printf(adapter->dev,
 		"Device has no supported external thermal sensor.\n");
 		return (ENODEV);

Index: src/sys/dev/pci/ixgbe/ixgbe_common.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_common.c:1.13.2.13 src/sys/dev/pci/ixgbe/ixgbe_common.c:1.13.2.14
--- src/sys/dev/pci/ixgbe/ixgbe_common.c:1.13.2.13	Mon Jan 23 14:07:24 2023
+++ src/sys/dev/pci/ixgbe/ixgbe_common.c	Wed Jun 21 19:28:12 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_common.c,v 1.13.2.13 2023/01/23 14:07:24 martin Exp $ */
+/* $NetBSD: ixgbe_common.c,v 1.13.2.14 2023/06/21 19:28:12 martin Exp $ */
 
 /**
   

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

2023-06-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jun 21 19:28:12 UTC 2023

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: ixgbe.c ixgbe_common.c ixgbe_type.h

Log Message:
Pullup the following revisions, requested by msaitoh in ticket #1828:

sys/dev/pci/ixgbe/ixgbe.c   1.325-1.326 via patch
sys/dev/pci/ixgbe/ixgbe_common.c1.44
sys/dev/pci/ixgbe/ixgbe_type.h  1.56

- PCI device ID 0x15c8 also uses X557-AT PHY, so create the thermal
  sensor sysctl for it, too.
- Count the number of link down events in the MAC using with
  LINK_DN_CNT register.


To generate a diff of this commit:
cvs rdiff -u -r1.88.2.54 -r1.88.2.55 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.13.2.13 -r1.13.2.14 src/sys/dev/pci/ixgbe/ixgbe_common.c
cvs rdiff -u -r1.22.2.17 -r1.22.2.18 src/sys/dev/pci/ixgbe/ixgbe_type.h

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



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

2022-06-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jun  6 11:09:16 UTC 2022

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

Log Message:
Apply patch, requested by msaitoh in ticket #1746:

sys/dev/pci/ixgbe/ixgbe.c   (apply patch)

Fix the location of "break" statement. No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.88.2.52 -r1.88.2.53 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.88.2.52 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.53
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.52	Fri Jun  3 12:31:10 2022
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Mon Jun  6 11:09:16 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.52 2022/06/03 12:31:10 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.53 2022/06/06 11:09:16 martin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.88.2.52 2022/06/03 12:31:10 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.88.2.53 2022/06/06 11:09:16 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -3170,8 +3170,8 @@ ixgbe_intr_admin_common(struct adapter *
 	"PHY IS SHUT DOWN!!\n");
 	device_printf(adapter->dev,
 	"System shutdown required!\n");
-	break;
 }
+break;
 			}
 		}
 



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

2022-06-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jun  6 11:09:16 UTC 2022

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

Log Message:
Apply patch, requested by msaitoh in ticket #1746:

sys/dev/pci/ixgbe/ixgbe.c   (apply patch)

Fix the location of "break" statement. No functional change intended.


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

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



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

2022-06-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jun  3 12:31:10 UTC 2022

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: ix_txrx.c ixgbe.c ixgbe.h ixgbe_mbx.c
ixgbe_netbsd.h ixgbe_type.h ixgbe_x550.c ixv.c

Log Message:
Pull up the following revisions, requestes by msaitoh in ticket #1746:

sys/dev/pci/ixgbe/ix_txrx.c 1.95
sys/dev/pci/ixgbe/ixgbe.c   1.261,1.263,
1.265-1.268,1.273,
1.275-1.277,1.305,
1.312,
1.316-1.321 via patch
sys/dev/pci/ixgbe/ixgbe.h   1.85 via patch
sys/dev/pci/ixgbe/ixgbe_mbx.c   1.19
sys/dev/pci/ixgbe/ixgbe_netbsd.h1.15-1.16
sys/dev/pci/ixgbe/ixgbe_type.h  1.46-1.47
sys/dev/pci/ixgbe/ixgbe_x550.c  1.26
sys/dev/pci/ixgbe/ixv.c 1.178,1.182 via patch

- Reduce code duplication between ixgbe_msix_admin() and
  ixgbe_legacy_irq().
  - Add missing code which was not in ixgbe_msix_admin() from
ixgbe_legacy_irq() and vice versa.
  - Reorder code.
- Disable/enable the OTHER interrupts correctly.
- Don't return in the middle of ixgbe_msix_admin() when an flow
  director reinit failed. NetBSD currently doesn't support flow
  director, so this is not a real bug.
- Print ECC, PHY and temp error log using with ratecheck().
- Correctly re-enable queue interrupt in ixgbe_legacy_irq().
- Correctly enter the recovery mode.
- No functional change:
  - Add some debug printf()s.
  - Don't use "more" flag for simplify.
  - Use macro.
  - Fix typos in comment.
  - KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.24.2.25 -r1.24.2.26 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.88.2.51 -r1.88.2.52 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.24.6.25 -r1.24.6.26 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.6.8.6 -r1.6.8.7 src/sys/dev/pci/ixgbe/ixgbe_mbx.c
cvs rdiff -u -r1.7.6.4 -r1.7.6.5 src/sys/dev/pci/ixgbe/ixgbe_netbsd.h
cvs rdiff -u -r1.22.2.16 -r1.22.2.17 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.5.6.11 -r1.5.6.12 src/sys/dev/pci/ixgbe/ixgbe_x550.c
cvs rdiff -u -r1.56.2.38 -r1.56.2.39 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.24.2.25 src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.26
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.25	Tue May 31 14:07:51 2022
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Fri Jun  3 12:31:09 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.24.2.25 2022/05/31 14:07:51 martin Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.24.2.26 2022/06/03 12:31:09 martin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.24.2.25 2022/05/31 14:07:51 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.24.2.26 2022/06/03 12:31:09 martin Exp $");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -247,7 +247,7 @@ ixgbe_mq_start(struct ifnet *ifp, struct
 
 	if (__predict_false(!pcq_put(txr->txr_interq, m))) {
 		m_freem(m);
-		txr->pcq_drops.ev_count++;
+		IXGBE_EVC_ADD(>pcq_drops, 1);
 		return ENOBUFS;
 	}
 	if (IXGBE_TX_TRYLOCK(txr)) {
@@ -475,7 +475,7 @@ retry:
 	/* Make certain there are enough descriptors */
 	if (txr->tx_avail < (map->dm_nsegs + 2)) {
 		txr->txr_no_space = true;
-		txr->no_desc_avail.ev_count++;
+		IXGBE_EVC_ADD(>no_desc_avail, 1);
 		ixgbe_dmamap_unload(txr->txtag, txbuf->map);
 		return EAGAIN;
 	}
@@ -546,7 +546,7 @@ retry:
 	 * Advance the Transmit Descriptor Tail (Tdt), this tells the
 	 * hardware that this frame is available to transmit.
 	 */
-	++txr->total_packets.ev_count;
+	IXGBE_EVC_ADD(>total_packets, 1);
 	IXGBE_WRITE_REG(>hw, txr->tail, i);
 
 	/*
@@ -583,7 +583,7 @@ ixgbe_drain(struct ifnet *ifp, struct tx
 
 	while ((m = pcq_get(txr->txr_interq)) != NULL) {
 		m_freem(m);
-		txr->pcq_drops.ev_count++;
+		IXGBE_EVC_ADD(>pcq_drops, 1);
 	}
 }
 
@@ -846,7 +846,7 @@ ixgbe_tx_ctx_setup(struct tx_ring *txr, 
 		int rv = ixgbe_tso_setup(txr, mp, cmd_type_len, olinfo_status);
 
 		if (rv != 0)
-			++adapter->tso_err.ev_count;
+			IXGBE_EVC_ADD(>tso_err, 1);
 		return rv;
 	}
 
@@ -1088,7 +1088,7 @@ ixgbe_tso_setup(struct tx_ring *txr, str
 	*cmd_type_len |= IXGBE_ADVTXD_DCMD_TSE;
 	*olinfo_status |= IXGBE_TXD_POPTS_TXSM << 8;
 	*olinfo_status |= paylen << IXGBE_ADVTXD_PAYLEN_SHIFT;
-	++txr->tso_tx.ev_count;
+	IXGBE_EVC_ADD(>tso_tx, 1);
 
 	return (0);
 } /* ixgbe_tso_setup */
@@ -1360,7 +1360,7 @@ ixgbe_refresh_mbufs(struct rx_ring *rxr,
 		if (__predict_false(rxbuf->buf == 

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

2022-06-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jun  3 12:31:10 UTC 2022

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: ix_txrx.c ixgbe.c ixgbe.h ixgbe_mbx.c
ixgbe_netbsd.h ixgbe_type.h ixgbe_x550.c ixv.c

Log Message:
Pull up the following revisions, requestes by msaitoh in ticket #1746:

sys/dev/pci/ixgbe/ix_txrx.c 1.95
sys/dev/pci/ixgbe/ixgbe.c   1.261,1.263,
1.265-1.268,1.273,
1.275-1.277,1.305,
1.312,
1.316-1.321 via patch
sys/dev/pci/ixgbe/ixgbe.h   1.85 via patch
sys/dev/pci/ixgbe/ixgbe_mbx.c   1.19
sys/dev/pci/ixgbe/ixgbe_netbsd.h1.15-1.16
sys/dev/pci/ixgbe/ixgbe_type.h  1.46-1.47
sys/dev/pci/ixgbe/ixgbe_x550.c  1.26
sys/dev/pci/ixgbe/ixv.c 1.178,1.182 via patch

- Reduce code duplication between ixgbe_msix_admin() and
  ixgbe_legacy_irq().
  - Add missing code which was not in ixgbe_msix_admin() from
ixgbe_legacy_irq() and vice versa.
  - Reorder code.
- Disable/enable the OTHER interrupts correctly.
- Don't return in the middle of ixgbe_msix_admin() when an flow
  director reinit failed. NetBSD currently doesn't support flow
  director, so this is not a real bug.
- Print ECC, PHY and temp error log using with ratecheck().
- Correctly re-enable queue interrupt in ixgbe_legacy_irq().
- Correctly enter the recovery mode.
- No functional change:
  - Add some debug printf()s.
  - Don't use "more" flag for simplify.
  - Use macro.
  - Fix typos in comment.
  - KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.24.2.25 -r1.24.2.26 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.88.2.51 -r1.88.2.52 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.24.6.25 -r1.24.6.26 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.6.8.6 -r1.6.8.7 src/sys/dev/pci/ixgbe/ixgbe_mbx.c
cvs rdiff -u -r1.7.6.4 -r1.7.6.5 src/sys/dev/pci/ixgbe/ixgbe_netbsd.h
cvs rdiff -u -r1.22.2.16 -r1.22.2.17 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.5.6.11 -r1.5.6.12 src/sys/dev/pci/ixgbe/ixgbe_x550.c
cvs rdiff -u -r1.56.2.38 -r1.56.2.39 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.



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

2022-05-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue May 31 14:07:52 UTC 2022

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: ix_txrx.c ixgbe.c ixgbe.h ixv.c

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

sys/dev/pci/ixgbe/ix_txrx.c: revision 1.98
sys/dev/pci/ixgbe/ixv.c: revision 1.181
sys/dev/pci/ixgbe/ixgbe.c: revision 1.315
sys/dev/pci/ixgbe/ixgbe.h: revision 1.86

bus_dmamem_unmap() before bus_dmamem_free(), otherwise we may give back meomry
which is still (and will stay) mapped.

Fixes one instance of "panic: HYPERVISOR_mmu_update failed" on Xen.
There may be others.

Fix a bug that the legacy interrupt doesn't work when MSI-X allocation failed.
Fixes PR kern/56857.

Remove unused adapter->msix_mem.


To generate a diff of this commit:
cvs rdiff -u -r1.24.2.24 -r1.24.2.25 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.88.2.50 -r1.88.2.51 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.24.6.24 -r1.24.6.25 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.56.2.37 -r1.56.2.38 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.24.2.24 src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.25
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.24	Mon May 30 17:05:51 2022
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Tue May 31 14:07:51 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.24.2.24 2022/05/30 17:05:51 martin Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.24.2.25 2022/05/31 14:07:51 martin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.24.2.24 2022/05/30 17:05:51 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.24.2.25 2022/05/31 14:07:51 martin Exp $");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -2322,6 +2322,7 @@ ixgbe_dma_free(struct adapter *adapter, 
 	bus_dmamap_sync(dma->dma_tag->dt_dmat, dma->dma_map, 0, dma->dma_size,
 	BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
 	ixgbe_dmamap_unload(dma->dma_tag, dma->dma_map);
+	bus_dmamem_unmap(dma->dma_tag->dt_dmat, dma->dma_vaddr, dma->dma_size);
 	bus_dmamem_free(dma->dma_tag->dt_dmat, >dma_seg, 1);
 	ixgbe_dma_tag_destroy(dma->dma_tag);
 } /* ixgbe_dma_free */

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.50 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.51
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.50	Mon May 30 17:05:51 2022
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Tue May 31 14:07:51 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.50 2022/05/30 17:05:51 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.51 2022/05/31 14:07:51 martin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.88.2.50 2022/05/30 17:05:51 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.88.2.51 2022/05/31 14:07:51 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1091,7 +1091,6 @@ ixgbe_attach(device_t parent, device_t d
 			ixgbe_free_queues(adapter);
 
 			/* Fallback to legacy interrupt */
-			adapter->feat_en &= ~IXGBE_FEATURE_MSIX;
 			if (adapter->feat_cap & IXGBE_FEATURE_MSI)
 adapter->feat_en |= IXGBE_FEATURE_MSI;
 			adapter->num_queues = 1;
@@ -5033,7 +5032,7 @@ ixgbe_enable_intr(struct adapter *adapte
 	IXGBE_WRITE_REG(hw, IXGBE_EIMS, mask);
 
 	/* With MSI-X we use auto clear */
-	if (adapter->msix_mem) {
+	if ((adapter->feat_en & IXGBE_FEATURE_MSIX) != 0) {
 		/*
 		 * We use auto clear for RTX_QUEUE only. Don't use other
 		 * interrupts (e.g. link interrupt). BTW, we don't use
@@ -5065,7 +5064,7 @@ ixgbe_disable_intr_internal(struct adapt
 	/* disable interrupts other than queues */
 	IXGBE_WRITE_REG(>hw, IXGBE_EIMC, ~IXGBE_EIMC_RTX_QUEUE);
 
-	if (adapter->msix_mem)
+	if ((adapter->feat_en & IXGBE_FEATURE_MSIX) != 0)
 		IXGBE_WRITE_REG(>hw, IXGBE_EIAC, 0);
 
 	for (int i = 0; i < adapter->num_queues; i++, que++)
@@ -6710,6 +6709,7 @@ ixgbe_allocate_msix(struct adapter *adap
 	adapter->osdep.nintrs) != 0) {
 		aprint_error_dev(dev,
 		"failed to allocate MSI-X interrupt\n");
+		adapter->feat_en &= ~IXGBE_FEATURE_MSIX;
 		return (ENXIO);
 	}
 
@@ -6909,7 +6909,7 @@ ixgbe_configure_interrupts(struct adapte
 	if (msgs < 2)
 		goto msi;
 
-	adapter->msix_mem = (void *)1; /* XXX */
+	adapter->feat_en |= IXGBE_FEATURE_MSIX;
 
 	/* Figure out a reasonable auto config value */
 	queues = (ncpu > (msgs - 1)) ? (msgs - 1) : ncpu;
@@ -6963,7 +6963,7 @@ msi:
 	adapter->feat_en  &= ~IXGBE_FEATURE_SRIOV;
 
 	msgs = pci_msi_count(adapter->osdep.pc, adapter->osdep.tag);
-	adapter->msix_mem = NULL; /* XXX */
+	adapter->feat_en &= ~IXGBE_FEATURE_MSIX;
 	if (msgs > 1)
 		msgs = 1;
 	if (msgs != 0) {

Index: 

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

2022-05-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue May 31 14:07:52 UTC 2022

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: ix_txrx.c ixgbe.c ixgbe.h ixv.c

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

sys/dev/pci/ixgbe/ix_txrx.c: revision 1.98
sys/dev/pci/ixgbe/ixv.c: revision 1.181
sys/dev/pci/ixgbe/ixgbe.c: revision 1.315
sys/dev/pci/ixgbe/ixgbe.h: revision 1.86

bus_dmamem_unmap() before bus_dmamem_free(), otherwise we may give back meomry
which is still (and will stay) mapped.

Fixes one instance of "panic: HYPERVISOR_mmu_update failed" on Xen.
There may be others.

Fix a bug that the legacy interrupt doesn't work when MSI-X allocation failed.
Fixes PR kern/56857.

Remove unused adapter->msix_mem.


To generate a diff of this commit:
cvs rdiff -u -r1.24.2.24 -r1.24.2.25 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.88.2.50 -r1.88.2.51 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.24.6.24 -r1.24.6.25 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.56.2.37 -r1.56.2.38 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.



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

2022-05-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 30 17:05:52 UTC 2022

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: ix_txrx.c ixgbe.c ixv.c

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

sys/dev/pci/ixgbe/ixgbe.c   1.270,1.280,1.307-1.311,
1.313-1.314 via patch
sys/dev/pci/ixgbe/ix_txrx.c 1.96-1.97
sys/dev/pci/ixgbe/ixv.c 1.179-1.180 via patch

- ixg(4): Print Printed Board Assembly (PBA) number.
- ixg(4): Add IFF_RUNNING check in ixgbe_legacy_irq() again. this might
  fix small race but it's not so dangerous.
- Add value check for {tx,rx}_process_limit sysctl to avoid setting
  wrong value.
- Add missing num_tx_desc sysctl.
- No functional change:
  - KNF a bit.
  - Simplify setting of EIAC register.
  - Move the definition of eicr_mask variable.
  - Enclose flow director stuff in ixgbe_intr_admin_common() with
IXGBE_FIR which is not defined in NetBSD.
  - Modify comment for consistency.
  - Use cached rx_copy_len in ixgbe_rxeof().


To generate a diff of this commit:
cvs rdiff -u -r1.24.2.23 -r1.24.2.24 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.88.2.49 -r1.88.2.50 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.56.2.36 -r1.56.2.37 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.24.2.23 src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.24
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.23	Sat Nov 20 15:21:31 2021
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Mon May 30 17:05:51 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.24.2.23 2021/11/20 15:21:31 martin Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.24.2.24 2022/05/30 17:05:51 martin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.24.2.23 2021/11/20 15:21:31 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.24.2.24 2022/05/30 17:05:51 martin Exp $");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -1819,6 +1819,7 @@ ixgbe_rxeof(struct ix_queue *que)
 	u32			staterr = 0;
 	u32			loopcount = 0, numdesc;
 	u32			limit = adapter->rx_process_limit;
+	u32			rx_copy_len = adapter->rx_copy_len;
 	bool			discard_multidesc = rxr->discard_multidesc;
 	bool			wraparound = false;
 	unsigned int		syncremain;
@@ -1929,7 +1930,7 @@ ixgbe_rxeof(struct ix_queue *que)
 			/* Pre-alloc new mbuf. */
 
 			if ((rbuf->fmp == NULL) &&
-			eop && (len <= adapter->rx_copy_len)) {
+			eop && (len <= rx_copy_len)) {
 /* For short packet. See below. */
 sendmp = m_gethdr(M_NOWAIT, MT_DATA);
 if (__predict_false(sendmp == NULL)) {
@@ -2035,7 +2036,7 @@ ixgbe_rxeof(struct ix_queue *que)
 			 * packet.
 			 */
 
-			if (eop && (len <= adapter->rx_copy_len)) {
+			if (eop && (len <= rx_copy_len)) {
 /*
  * Optimize.  This might be a small packet, may
  * be just a TCP ACK. Copy into a new mbuf, and
@@ -2047,7 +2048,7 @@ ixgbe_rxeof(struct ix_queue *que)
 rxr->rx_copies.ev_count++;
 rbuf->flags |= IXGBE_RX_COPY;
 			} else {
-/* Non short packet */
+/* For long packet */
 
 /* Update new (used in future) mbuf */
 newmp->m_pkthdr.len = newmp->m_len

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.49 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.50
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.49	Tue Feb  1 11:38:29 2022
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Mon May 30 17:05:51 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.49 2022/02/01 11:38:29 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.50 2022/05/30 17:05:51 martin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.88.2.49 2022/02/01 11:38:29 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.88.2.50 2022/05/30 17:05:51 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -233,8 +233,6 @@ static int	ixgbe_set_advertise(struct ad
 static int	ixgbe_get_default_advertise(struct adapter *);
 
 /* Sysctl handlers */
-static void	ixgbe_set_sysctl_value(struct adapter *, const char *,
-		 const char *, int *, int);
 static int	ixgbe_sysctl_flowcntl(SYSCTLFN_PROTO);
 static int	ixgbe_sysctl_advertise(SYSCTLFN_PROTO);
 static int	ixgbe_sysctl_interrupt_rate_handler(SYSCTLFN_PROTO);
@@ -254,6 +252,8 @@ static int	ixgbe_sysctl_tdh_handler(SYSC
 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_tx_process_limit(SYSCTLFN_PROTO);
+static int	ixgbe_sysctl_rx_process_limit(SYSCTLFN_PROTO);
 static 

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

2022-05-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 30 17:05:52 UTC 2022

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: ix_txrx.c ixgbe.c ixv.c

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

sys/dev/pci/ixgbe/ixgbe.c   1.270,1.280,1.307-1.311,
1.313-1.314 via patch
sys/dev/pci/ixgbe/ix_txrx.c 1.96-1.97
sys/dev/pci/ixgbe/ixv.c 1.179-1.180 via patch

- ixg(4): Print Printed Board Assembly (PBA) number.
- ixg(4): Add IFF_RUNNING check in ixgbe_legacy_irq() again. this might
  fix small race but it's not so dangerous.
- Add value check for {tx,rx}_process_limit sysctl to avoid setting
  wrong value.
- Add missing num_tx_desc sysctl.
- No functional change:
  - KNF a bit.
  - Simplify setting of EIAC register.
  - Move the definition of eicr_mask variable.
  - Enclose flow director stuff in ixgbe_intr_admin_common() with
IXGBE_FIR which is not defined in NetBSD.
  - Modify comment for consistency.
  - Use cached rx_copy_len in ixgbe_rxeof().


To generate a diff of this commit:
cvs rdiff -u -r1.24.2.23 -r1.24.2.24 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.88.2.49 -r1.88.2.50 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.56.2.36 -r1.56.2.37 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.



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

2022-02-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Feb  1 11:38:29 UTC 2022

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

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

sys/dev/pci/ixgbe/ixgbe.c   1.264,1.269,1.272,
1.306 via patch

Four INTx related fixes:
- Fix a bug that the all interrupt sources are enabled when the
  interface is UP and the INTx line is shared with other devices.
- Fix a bug that it might incorrectly enable interrupt when
  IFF_RUNNING is not set.
- Don't process TX/RX if a queue interrupt isn't occurred.
- Increment legacy interrupt counter after checking INTx sharing.


To generate a diff of this commit:
cvs rdiff -u -r1.88.2.48 -r1.88.2.49 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.88.2.48 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.49
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.48	Mon Jan 31 17:38:36 2022
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Tue Feb  1 11:38:29 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.48 2022/01/31 17:38:36 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.49 2022/02/01 11:38:29 martin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.88.2.48 2022/01/31 17:38:36 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.88.2.49 2022/02/01 11:38:29 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -5074,28 +5074,34 @@ ixgbe_legacy_irq(void *arg)
 	struct ix_queue *que = arg;
 	struct adapter	*adapter = que->adapter;
 	struct ixgbe_hw	*hw = >hw;
-	struct ifnet	*ifp = adapter->ifp;
 	struct		tx_ring *txr = adapter->tx_rings;
 	bool		more = false;
 	u32		eicr, eicr_mask;
+	u32		eims_orig;
 
-	/* Silicon errata #26 on 82598 */
+	eims_orig = IXGBE_READ_REG(hw, IXGBE_EIMS);
+	/*
+	 * Silicon errata #26 on 82598. Disable all interrupts before reading
+	 * EICR.
+	 */
 	IXGBE_WRITE_REG(hw, IXGBE_EIMC, IXGBE_IRQ_CLEAR_MASK);
 
 	eicr = IXGBE_READ_REG(hw, IXGBE_EICR);
 
-	adapter->stats.pf.legint.ev_count++;
-	++que->irqs.ev_count;
 	if (eicr == 0) {
 		adapter->stats.pf.intzero.ev_count++;
-		if ((ifp->if_flags & IFF_UP) != 0)
-			ixgbe_enable_intr(adapter);
+		IXGBE_WRITE_REG(hw, IXGBE_EIMS, eims_orig);
 		return 0;
 	}
+	adapter->stats.pf.legint.ev_count++;
+
+	/* Queue (0) intr */
+	if ((eicr & IXGBE_EIMC_RTX_QUEUE) != 0) {
+		++que->irqs.ev_count;
 
-	if ((ifp->if_flags & IFF_RUNNING) != 0) {
 		/*
-		 * The same as ixgbe_msix_que() about "que->txrx_use_workqueue".
+		 * The same as ixgbe_msix_que() about
+		 * "que->txrx_use_workqueue".
 		 */
 		que->txrx_use_workqueue = adapter->txrx_use_workqueue;
 



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

2022-02-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Feb  1 11:38:29 UTC 2022

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

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

sys/dev/pci/ixgbe/ixgbe.c   1.264,1.269,1.272,
1.306 via patch

Four INTx related fixes:
- Fix a bug that the all interrupt sources are enabled when the
  interface is UP and the INTx line is shared with other devices.
- Fix a bug that it might incorrectly enable interrupt when
  IFF_RUNNING is not set.
- Don't process TX/RX if a queue interrupt isn't occurred.
- Increment legacy interrupt counter after checking INTx sharing.


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

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



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

2022-01-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jan 31 17:38:36 UTC 2022

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: if_sriov.c ixgbe.c ixgbe_82599.c
ixgbe_mbx.c ixgbe_mbx.h ixgbe_type.h ixgbe_vf.c ixgbe_x540.c ixv.c

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

sys/dev/pci/ixgbe/ixgbe_mbx.h: revision 1.19
sys/dev/pci/ixgbe/ixgbe_vf.c: revision 1.31
sys/dev/pci/ixgbe/ixgbe_x540.c: revision 1.23
sys/dev/pci/ixgbe/if_sriov.c: revision 1.17
sys/dev/pci/ixgbe/ixv.c: revision 1.172
sys/dev/pci/ixgbe/ixv.c: revision 1.173
sys/dev/pci/ixgbe/ixgbe.c: revision 1.301
sys/dev/pci/ixgbe/ixgbe_type.h: revision 1.55
sys/dev/pci/ixgbe/ixgbe_82599.c: revision 1.29
sys/dev/pci/ixgbe/ixgbe_mbx.c: revision 1.16
sys/dev/pci/ixgbe/ixgbe_mbx.c: revision 1.17
sys/dev/pci/ixgbe/ixgbe_mbx.c: revision 1.18

Add code to support API version 1.5. No functional change.
   - This change adds almost all code to support API 1.5 except real negotiation
 and upgrade mailbox functions.
   - From ix-3.3.18, ix-3.3.22 and ixv-1.5.24.

Enable mailbox API 1.5 support. Tested on ESXi with ixgben 1.10.3.0.

Don't clear mailbox related counters in ixgbe_upgrade_mbx_params_vf().
Don't clear mailbox related counters in ixgbe_upgrade_mbx_params_pf().


To generate a diff of this commit:
cvs rdiff -u -r1.1.4.7 -r1.1.4.8 src/sys/dev/pci/ixgbe/if_sriov.c
cvs rdiff -u -r1.88.2.47 -r1.88.2.48 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.14.8.8 -r1.14.8.9 src/sys/dev/pci/ixgbe/ixgbe_82599.c
cvs rdiff -u -r1.6.8.5 -r1.6.8.6 src/sys/dev/pci/ixgbe/ixgbe_mbx.c
cvs rdiff -u -r1.10.8.4 -r1.10.8.5 src/sys/dev/pci/ixgbe/ixgbe_mbx.h
cvs rdiff -u -r1.22.2.15 -r1.22.2.16 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.12.8.8 -r1.12.8.9 src/sys/dev/pci/ixgbe/ixgbe_vf.c
cvs rdiff -u -r1.9.6.7 -r1.9.6.8 src/sys/dev/pci/ixgbe/ixgbe_x540.c
cvs rdiff -u -r1.56.2.35 -r1.56.2.36 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.



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

2022-01-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jan 31 17:38:36 UTC 2022

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: if_sriov.c ixgbe.c ixgbe_82599.c
ixgbe_mbx.c ixgbe_mbx.h ixgbe_type.h ixgbe_vf.c ixgbe_x540.c ixv.c

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

sys/dev/pci/ixgbe/ixgbe_mbx.h: revision 1.19
sys/dev/pci/ixgbe/ixgbe_vf.c: revision 1.31
sys/dev/pci/ixgbe/ixgbe_x540.c: revision 1.23
sys/dev/pci/ixgbe/if_sriov.c: revision 1.17
sys/dev/pci/ixgbe/ixv.c: revision 1.172
sys/dev/pci/ixgbe/ixv.c: revision 1.173
sys/dev/pci/ixgbe/ixgbe.c: revision 1.301
sys/dev/pci/ixgbe/ixgbe_type.h: revision 1.55
sys/dev/pci/ixgbe/ixgbe_82599.c: revision 1.29
sys/dev/pci/ixgbe/ixgbe_mbx.c: revision 1.16
sys/dev/pci/ixgbe/ixgbe_mbx.c: revision 1.17
sys/dev/pci/ixgbe/ixgbe_mbx.c: revision 1.18

Add code to support API version 1.5. No functional change.
   - This change adds almost all code to support API 1.5 except real negotiation
 and upgrade mailbox functions.
   - From ix-3.3.18, ix-3.3.22 and ixv-1.5.24.

Enable mailbox API 1.5 support. Tested on ESXi with ixgben 1.10.3.0.

Don't clear mailbox related counters in ixgbe_upgrade_mbx_params_vf().
Don't clear mailbox related counters in ixgbe_upgrade_mbx_params_pf().


To generate a diff of this commit:
cvs rdiff -u -r1.1.4.7 -r1.1.4.8 src/sys/dev/pci/ixgbe/if_sriov.c
cvs rdiff -u -r1.88.2.47 -r1.88.2.48 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.14.8.8 -r1.14.8.9 src/sys/dev/pci/ixgbe/ixgbe_82599.c
cvs rdiff -u -r1.6.8.5 -r1.6.8.6 src/sys/dev/pci/ixgbe/ixgbe_mbx.c
cvs rdiff -u -r1.10.8.4 -r1.10.8.5 src/sys/dev/pci/ixgbe/ixgbe_mbx.h
cvs rdiff -u -r1.22.2.15 -r1.22.2.16 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.12.8.8 -r1.12.8.9 src/sys/dev/pci/ixgbe/ixgbe_vf.c
cvs rdiff -u -r1.9.6.7 -r1.9.6.8 src/sys/dev/pci/ixgbe/ixgbe_x540.c
cvs rdiff -u -r1.56.2.35 -r1.56.2.36 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_sriov.c
diff -u src/sys/dev/pci/ixgbe/if_sriov.c:1.1.4.7 src/sys/dev/pci/ixgbe/if_sriov.c:1.1.4.8
--- src/sys/dev/pci/ixgbe/if_sriov.c:1.1.4.7	Sun Jan 30 16:06:35 2022
+++ src/sys/dev/pci/ixgbe/if_sriov.c	Mon Jan 31 17:38:36 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: if_sriov.c,v 1.1.4.7 2022/01/30 16:06:35 martin Exp $ */
+/* $NetBSD: if_sriov.c,v 1.1.4.8 2022/01/31 17:38:36 martin Exp $ */
 /**
 
   Copyright (c) 2001-2017, Intel Corporation
@@ -34,7 +34,7 @@
 /*$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.1.4.7 2022/01/30 16:06:35 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_sriov.c,v 1.1.4.8 2022/01/31 17:38:36 martin Exp $");
 
 #include "ixgbe.h"
 #include "ixgbe_sriov.h"
@@ -99,7 +99,7 @@ ixgbe_send_vf_msg(struct ixgbe_hw *hw, s
 	if (vf->flags & IXGBE_VF_CTS)
 		msg |= IXGBE_VT_MSGTYPE_CTS;
 
-	hw->mbx.ops.write(hw, , 1, vf->pool);
+	hw->mbx.ops[vf->pool].write(hw, , 1, vf->pool);
 }
 
 static inline void
@@ -594,7 +594,8 @@ ixgbe_process_vf_msg(struct adapter *ada
 
 	hw = >hw;
 
-	error = hw->mbx.ops.read(hw, msg, IXGBE_VFMAILBOX_SIZE, vf->pool);
+	error = hw->mbx.ops[vf->pool].read(hw, msg, IXGBE_VFMAILBOX_SIZE,
+	vf->pool);
 
 	if (error != 0)
 		return;
@@ -654,16 +655,17 @@ ixgbe_handle_mbx(void *context)
 	for (i = 0; i < adapter->num_vfs; i++) {
 		vf = >vfs[i];
 
-		if (vf->flags & IXGBE_VF_ACTIVE) {
-			if (hw->mbx.ops.check_for_rst(hw, vf->pool) == 0)
-ixgbe_process_vf_reset(adapter, vf);
-
-			if (hw->mbx.ops.check_for_msg(hw, vf->pool) == 0)
-ixgbe_process_vf_msg(adapter, vf);
-
-			if (hw->mbx.ops.check_for_ack(hw, vf->pool) == 0)
-ixgbe_process_vf_ack(adapter, vf);
-		}
+		if ((vf->flags & IXGBE_VF_ACTIVE) == 0)
+			continue;
+
+		if (hw->mbx.ops[vf->pool].check_for_rst(hw, vf->pool) == 0)
+			ixgbe_process_vf_reset(adapter, vf);
+
+		if (hw->mbx.ops[vf->pool].check_for_msg(hw, vf->pool) == 0)
+			ixgbe_process_vf_msg(adapter, vf);
+
+		if (hw->mbx.ops[vf->pool].check_for_ack(hw, vf->pool) == 0)
+			ixgbe_process_vf_ack(adapter, vf);
 	}
 	IXGBE_CORE_UNLOCK(adapter);
 } /* ixgbe_handle_mbx */

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.47 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.48
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.47	Sun Jan 30 16:06:35 2022
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Mon Jan 31 17:38:36 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.47 2022/01/30 16:06:35 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.48 2022/01/31 17:38:36 martin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, 

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

2022-01-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jan 30 16:06:36 UTC 2022

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: if_sriov.c ixgbe.c ixgbe.h
ixgbe_82598.c ixgbe_82598.h ixgbe_82599.c ixgbe_82599.h ixgbe_api.c
ixgbe_api.h ixgbe_bypass.h ixgbe_common.c ixgbe_common.h
ixgbe_dcb.c ixgbe_dcb.h ixgbe_dcb_82598.c ixgbe_dcb_82598.h
ixgbe_dcb_82599.c ixgbe_dcb_82599.h ixgbe_fdir.h ixgbe_features.h
ixgbe_mbx.c ixgbe_mbx.h ixgbe_netmap.c ixgbe_osdep.c ixgbe_osdep.h
ixgbe_phy.c ixgbe_phy.h ixgbe_rss.h ixgbe_sriov.h ixgbe_type.h
ixgbe_vf.c ixgbe_vf.h ixgbe_x540.c ixgbe_x540.h ixgbe_x550.c
ixgbe_x550.h ixv.c

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

sys/dev/pci/ixgbe/if_sriov.c1.12-1.16
sys/dev/pci/ixgbe/ixgbe.c   1.295-1.297,1.300,1.304 
via patch
sys/dev/pci/ixgbe/ixgbe.h   1.84
sys/dev/pci/ixgbe/ixgbe_82598.c 1.17-1.18
sys/dev/pci/ixgbe/ixgbe_82598.h 1.9
sys/dev/pci/ixgbe/ixgbe_82599.c 1.24-1.28
sys/dev/pci/ixgbe/ixgbe_82599.h 1.8
sys/dev/pci/ixgbe/ixgbe_api.c   1.26-1.27
sys/dev/pci/ixgbe/ixgbe_api.h   1.16
sys/dev/pci/ixgbe/ixgbe_bypass.h1.3
sys/dev/pci/ixgbe/ixgbe_common.c1.34-1.42
sys/dev/pci/ixgbe/ixgbe_common.h1.15-1.16
sys/dev/pci/ixgbe/ixgbe_dcb.c   1.12-1.13
sys/dev/pci/ixgbe/ixgbe_dcb.h   1.8-1.9
sys/dev/pci/ixgbe/ixgbe_dcb_82598.c 1.10-1.12
sys/dev/pci/ixgbe/ixgbe_dcb_82598.h 1.8
sys/dev/pci/ixgbe/ixgbe_dcb_82599.c 1.10-1.11
sys/dev/pci/ixgbe/ixgbe_dcb_82599.h 1.8
sys/dev/pci/ixgbe/ixgbe_fdir.h  1.4
sys/dev/pci/ixgbe/ixgbe_features.h  1.4
sys/dev/pci/ixgbe/ixgbe_mbx.c   1.13-1.15
sys/dev/pci/ixgbe/ixgbe_mbx.h   1.15-1.18
sys/dev/pci/ixgbe/ixgbe_netmap.c1.5
sys/dev/pci/ixgbe/ixgbe_osdep.c 1.8
sys/dev/pci/ixgbe/ixgbe_osdep.h 1.31
sys/dev/pci/ixgbe/ixgbe_phy.c   1.25-1.29
sys/dev/pci/ixgbe/ixgbe_phy.h   1.13
sys/dev/pci/ixgbe/ixgbe_rss.h   1.6
sys/dev/pci/ixgbe/ixgbe_sriov.h 1.5
sys/dev/pci/ixgbe/ixgbe_type.h  1.51-1.54
sys/dev/pci/ixgbe/ixgbe_vf.c1.28-1.29
sys/dev/pci/ixgbe/ixgbe_vf.h1.15
sys/dev/pci/ixgbe/ixgbe_x540.c  1.20-1.22
sys/dev/pci/ixgbe/ixgbe_x540.h  1.10
sys/dev/pci/ixgbe/ixgbe_x550.c  1.21-1.25
sys/dev/pci/ixgbe/ixgbe_x550.h  1.7
sys/dev/pci/ixgbe/ixv.c 1.170, 1.174-1.175 via 
patch

- Add typecast for type mismatch.
- Fix retry count calculation of I2C read/write.
- Wait longer for link after fiber MAC setup.
- ixv(4): Use adapter->mta for the multicast array memory instead of
  the on-stack array.
- Match X550_PHY_ID correctly on X550.
- Print NVM image version on 82598.
- Use 64bit for lxon + lxoff.
- Don't expose garbage data of hw.ixvN.debug.
- Some NetBSD unrelated changes:
  - Fix infinite recursion on PCIe link down if VMDQ is used.
  - Move PF mailbox initialization from ixgbe_attach() to
ixgbe_init_iov().
  - Add IPv6 mask for flow director.
  - Change error level in ixgbe_fc_autoneg().
  - Check host interface return status when writing NVM.
  - Change DCB credit parameters.
- Restore some mailbox related functions. Revert part of ixgbe_mbx.c
  rev. 1.7 and ixgbe_mbx.h rev. 1.11. No functional change.
- Rename IXGBE_VT_MSGTYPE_{ACK,NACK} to
  IXGBE_VT_MSGTYPE_{SUCCESS,FAILURE}. No functional change.
- Remove unused argument. Change argument.
- Remove unnecessary return value check.
- Remove debug error message.
- Remove dead code.
- Add some unused macros.
- Fix typo in comment.
- Rename some functions.
- Sort lines, modify comment.
- Whitespace fix.


To generate a diff of this commit:
cvs rdiff -u -r1.1.4.6 -r1.1.4.7 src/sys/dev/pci/ixgbe/if_sriov.c
cvs rdiff -u -r1.88.2.46 -r1.88.2.47 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.24.6.23 -r1.24.6.24 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.8.8.6 -r1.8.8.7 src/sys/dev/pci/ixgbe/ixgbe_82598.c
cvs rdiff -u -r1.5.8.2 -r1.5.8.3 src/sys/dev/pci/ixgbe/ixgbe_82598.h
cvs rdiff -u -r1.14.8.7 -r1.14.8.8 src/sys/dev/pci/ixgbe/ixgbe_82599.c
cvs rdiff -u -r1.4.8.2 -r1.4.8.3 src/sys/dev/pci/ixgbe/ixgbe_82599.h
cvs rdiff -u -r1.15.8.7 -r1.15.8.8 src/sys/dev/pci/ixgbe/ixgbe_api.c
cvs rdiff -u 

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

2022-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jan 29 16:45:49 UTC 2022

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: ixgbe_vf.h ixv.c

Log Message:
Pull up the following revisions (all via patch), requested by msaitoh
in ticket #1725:

sys/dev/pci/ixgbe/ixgbe_vf.h1.16-1.17
sys/dev/pci/ixgbe/ixv.c 1.176-1.177

Make ifconfig -z ixvN clear event counter.


To generate a diff of this commit:
cvs rdiff -u -r1.8.6.4 -r1.8.6.5 src/sys/dev/pci/ixgbe/ixgbe_vf.h
cvs rdiff -u -r1.56.2.33 -r1.56.2.34 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_vf.h
diff -u src/sys/dev/pci/ixgbe/ixgbe_vf.h:1.8.6.4 src/sys/dev/pci/ixgbe/ixgbe_vf.h:1.8.6.5
--- src/sys/dev/pci/ixgbe/ixgbe_vf.h:1.8.6.4	Thu Sep 26 18:19:26 2019
+++ src/sys/dev/pci/ixgbe/ixgbe_vf.h	Sat Jan 29 16:45:49 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_vf.h,v 1.8.6.4 2019/09/26 18:19:26 martin Exp $ */
+/* $NetBSD: ixgbe_vf.h,v 1.8.6.5 2022/01/29 16:45:49 martin Exp $ */
 
 /**
   SPDX-License-Identifier: BSD-3-Clause
@@ -101,29 +101,17 @@ struct ixgbevf_hw_stats {
 	struct evcnt l4cs;
 	struct evcnt l4cs_bad;
 
-	u64 base_vfgprc;
-	u64 base_vfgptc;
-	u64 base_vfgorc;
-	u64 base_vfgotc;
-	u64 base_vfmprc;
-
-	u64 last_vfgprc;
-	u64 last_vfgptc;
+	u32 last_vfgprc;
+	u32 last_vfgptc;
 	u64 last_vfgorc;
 	u64 last_vfgotc;
-	u64 last_vfmprc;
+	u32 last_vfmprc;
 
 	struct evcnt vfgprc;
 	struct evcnt vfgptc;
 	struct evcnt vfgorc;
 	struct evcnt vfgotc;
 	struct evcnt vfmprc;
-
-	u64 saved_reset_vfgprc;
-	u64 saved_reset_vfgptc;
-	u64 saved_reset_vfgorc;
-	u64 saved_reset_vfgotc;
-	u64 saved_reset_vfmprc;
 };
 
 s32 ixgbe_init_ops_vf(struct ixgbe_hw *hw);

Index: src/sys/dev/pci/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.56.2.33 src/sys/dev/pci/ixgbe/ixv.c:1.56.2.34
--- src/sys/dev/pci/ixgbe/ixv.c:1.56.2.33	Sat Nov 20 15:21:31 2021
+++ src/sys/dev/pci/ixgbe/ixv.c	Sat Jan 29 16:45:49 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixv.c,v 1.56.2.33 2021/11/20 15:21:31 martin Exp $ */
+/* $NetBSD: ixv.c,v 1.56.2.34 2022/01/29 16:45:49 martin 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.56.2.33 2021/11/20 15:21:31 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.56.2.34 2022/01/29 16:45:49 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -130,7 +130,6 @@ static void	ixv_unregister_vlan(void *, 
 #endif
 
 static void	ixv_add_device_sysctls(struct adapter *);
-static void	ixv_save_stats(struct adapter *);
 static void	ixv_init_stats(struct adapter *);
 static void	ixv_update_stats(struct adapter *);
 static void	ixv_add_stats_sysctls(struct adapter *);
@@ -550,7 +549,6 @@ ixv_attach(device_t parent, device_t dev
 	}
 
 	/* Do the stats setup */
-	ixv_save_stats(adapter);
 	ixv_init_stats(adapter);
 	ixv_add_stats_sysctls(adapter);
 
@@ -2269,34 +2267,11 @@ ixv_configure_ivars(struct adapter *adap
 
 
 /
- * ixv_save_stats
+ * ixv_init_stats
  *
  *   The VF stats registers never have a truly virgin
- *   starting point, so this routine tries to make an
- *   artificial one, marking ground zero on attach as
- *   it were.
- /
-static void
-ixv_save_stats(struct adapter *adapter)
-{
-	struct ixgbevf_hw_stats *stats = >stats.vf;
-
-	if (stats->vfgprc.ev_count || stats->vfgptc.ev_count) {
-		stats->saved_reset_vfgprc +=
-		stats->vfgprc.ev_count - stats->base_vfgprc;
-		stats->saved_reset_vfgptc +=
-		stats->vfgptc.ev_count - stats->base_vfgptc;
-		stats->saved_reset_vfgorc +=
-		stats->vfgorc.ev_count - stats->base_vfgorc;
-		stats->saved_reset_vfgotc +=
-		stats->vfgotc.ev_count - stats->base_vfgotc;
-		stats->saved_reset_vfmprc +=
-		stats->vfmprc.ev_count - stats->base_vfmprc;
-	}
-} /* ixv_save_stats */
-
-/
- * ixv_init_stats
+ *   starting point, so this routine save initial vaules to
+ *   last_.
  /
 static void
 ixv_init_stats(struct adapter *adapter)
@@ -2314,34 +2289,25 @@ ixv_init_stats(struct adapter *adapter)
 	(((u64)(IXGBE_READ_REG(hw, IXGBE_VFGOTC_MSB))) << 32);
 
 	adapter->stats.vf.last_vfmprc = IXGBE_READ_REG(hw, IXGBE_VFMPRC);
-
-	adapter->stats.vf.base_vfgprc = adapter->stats.vf.last_vfgprc;
-	adapter->stats.vf.base_vfgorc = adapter->stats.vf.last_vfgorc;
-	adapter->stats.vf.base_vfgptc = adapter->stats.vf.last_vfgptc;
-	

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

2022-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jan 29 16:45:49 UTC 2022

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: ixgbe_vf.h ixv.c

Log Message:
Pull up the following revisions (all via patch), requested by msaitoh
in ticket #1725:

sys/dev/pci/ixgbe/ixgbe_vf.h1.16-1.17
sys/dev/pci/ixgbe/ixv.c 1.176-1.177

Make ifconfig -z ixvN clear event counter.


To generate a diff of this commit:
cvs rdiff -u -r1.8.6.4 -r1.8.6.5 src/sys/dev/pci/ixgbe/ixgbe_vf.h
cvs rdiff -u -r1.56.2.33 -r1.56.2.34 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.



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

2022-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jan 29 16:36:07 UTC 2022

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

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

sys/dev/pci/ixgbe/ixgbe.c   1.298, 1.303 via patch

Add some missing error counters to ierror.


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

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



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

2022-01-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jan 29 16:36:07 UTC 2022

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

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

sys/dev/pci/ixgbe/ixgbe.c   1.298, 1.303 via patch

Add some missing error counters to ierror.


To generate a diff of this commit:
cvs rdiff -u -r1.88.2.45 -r1.88.2.46 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.88.2.45 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.46
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.45	Sat Nov 20 15:21:31 2021
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Sat Jan 29 16:36:07 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.45 2021/11/20 15:21:31 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.46 2022/01/29 16:36:07 martin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.88.2.45 2021/11/20 15:21:31 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.88.2.46 2022/01/29 16:36:07 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1579,13 +1579,19 @@ ixgbe_update_stats_counters(struct adapt
 	struct ixgbe_hw_stats *stats = >stats.pf;
 	u32		  missed_rx = 0, bprc, lxon, lxoff, total;
 	u64		  total_missed_rx = 0;
-	uint64_t	  crcerrs, rlec;
+	uint64_t	  crcerrs, illerrc, rlec, ruc, rfc, roc, rjc;
 	unsigned int	  queue_counters;
 	int		  i;
 
-	crcerrs = IXGBE_READ_REG(hw, IXGBE_CRCERRS);
-	stats->crcerrs.ev_count += crcerrs;
-	stats->illerrc.ev_count += IXGBE_READ_REG(hw, IXGBE_ILLERRC);
+#define READ_COPY_SET(hw, stats, regname, evname)		\
+	do {			\
+		(evname) = IXGBE_READ_REG((hw), regname);	\
+		(stats)->evname.ev_count += (evname);		\
+	} while (/*CONSTCOND*/0)
+	
+	READ_COPY_SET(hw, stats, IXGBE_CRCERRS, crcerrs);
+	READ_COPY_SET(hw, stats, IXGBE_ILLERRC, illerrc);
+
 	stats->errbc.ev_count += IXGBE_READ_REG(hw, IXGBE_ERRBC);
 	stats->mspdc.ev_count += IXGBE_READ_REG(hw, IXGBE_MSPDC);
 	if (hw->mac.type >= ixgbe_mac_X550)
@@ -1643,8 +1649,7 @@ ixgbe_update_stats_counters(struct adapt
 		stats->mlfc.ev_count += IXGBE_READ_REG(hw, IXGBE_MLFC);
 		stats->mrfc.ev_count += IXGBE_READ_REG(hw, IXGBE_MRFC);
 	}
-	rlec = IXGBE_READ_REG(hw, IXGBE_RLEC);
-	stats->rlec.ev_count += rlec;
+	READ_COPY_SET(hw, stats, IXGBE_RLEC, rlec);
 
 	/* Hardware workaround, gprc counts missed packets */
 	stats->gprc.ev_count += IXGBE_READ_REG(hw, IXGBE_GPRC) - missed_rx;
@@ -1696,10 +1701,13 @@ ixgbe_update_stats_counters(struct adapt
 	stats->mptc.ev_count += IXGBE_READ_REG(hw, IXGBE_MPTC) - total;
 	stats->ptc64.ev_count += IXGBE_READ_REG(hw, IXGBE_PTC64) - total;
 
-	stats->ruc.ev_count += IXGBE_READ_REG(hw, IXGBE_RUC);
-	stats->rfc.ev_count += IXGBE_READ_REG(hw, IXGBE_RFC);
-	stats->roc.ev_count += IXGBE_READ_REG(hw, IXGBE_ROC);
-	stats->rjc.ev_count += IXGBE_READ_REG(hw, IXGBE_RJC);
+	READ_COPY_SET(hw, stats, IXGBE_RUC, ruc);
+	READ_COPY_SET(hw, stats, IXGBE_RFC, rfc);
+	READ_COPY_SET(hw, stats, IXGBE_ROC, roc);
+	READ_COPY_SET(hw, stats, IXGBE_RJC, rjc);
+
+#undef READ_COPY_SET
+
 	stats->mngprc.ev_count += IXGBE_READ_REG(hw, IXGBE_MNGPRC);
 	stats->mngpdc.ev_count += IXGBE_READ_REG(hw, IXGBE_MNGPDC);
 	stats->mngptc.ev_count += IXGBE_READ_REG(hw, IXGBE_MNGPTC);
@@ -1733,7 +1741,19 @@ ixgbe_update_stats_counters(struct adapt
 
 	/* Rx Errors */
 	ifp->if_iqdrops += total_missed_rx;
-	ifp->if_ierrors += crcerrs + rlec;
+
+	/*
+	 * Aggregate following types of errors as RX errors:
+	 * - CRC error count,
+	 * - illegal byte error count,
+	 * - length error count,
+	 * - undersized packets count,
+	 * - fragmented packets count,
+	 * - oversized packets count,
+	 * - jabber count.
+	 */
+	ifp->if_ierrors +=
+	crcerrs + illerrc + rlec + ruc + rfc + roc + rjc;
 } /* ixgbe_update_stats_counters */
 
 /



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

2021-11-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Nov 20 15:21:32 UTC 2021

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: ix_txrx.c ixgbe.c ixgbe.h
ixgbe_type.h ixv.c

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

sys/dev/pci/ixgbe/ixgbe.h   1.81-1.83
sys/dev/pci/ixgbe/ixgbe.c   1.291-1.292 via patch
sys/dev/pci/ixgbe/ixgbe_type.h  1.50
sys/dev/pci/ixgbe/ixv.c 1.167-1.168 via patch
sys/dev/pci/ixgbe/ix_txrx.c 1.94

- Fix a bug that a near 64KB TSO segment can't send.
- Reduce bus_dmamap_sync() cost.
- Use macro. Fix typos in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.24.2.22 -r1.24.2.23 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.88.2.44 -r1.88.2.45 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.24.6.22 -r1.24.6.23 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.22.2.13 -r1.22.2.14 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.56.2.32 -r1.56.2.33 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.24.2.22 src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.23
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.22	Wed Sep 15 16:38:00 2021
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Sat Nov 20 15:21:31 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.24.2.22 2021/09/15 16:38:00 martin Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.24.2.23 2021/11/20 15:21:31 martin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.24.2.22 2021/09/15 16:38:00 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.24.2.23 2021/11/20 15:21:31 martin Exp $");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -1817,9 +1817,11 @@ ixgbe_rxeof(struct ix_queue *que)
 	struct ixgbe_rx_buf	*rbuf, *nbuf;
 	int			i, nextp, processed = 0;
 	u32			staterr = 0;
-	u32			loopcount = 0;
+	u32			loopcount = 0, numdesc;
 	u32			limit = adapter->rx_process_limit;
 	bool			discard_multidesc = rxr->discard_multidesc;
+	bool			wraparound = false;
+	unsigned int		syncremain;
 #ifdef RSS
 	u16			pkt_info;
 #endif
@@ -1836,6 +1838,24 @@ ixgbe_rxeof(struct ix_queue *que)
 	}
 #endif /* DEV_NETMAP */
 
+	/* Sync the ring. The size is rx_process_limit or the first half */
+	if ((rxr->next_to_check + limit) <= rxr->num_desc) {
+		/* Non-wraparound */
+		numdesc = limit;
+		syncremain = 0;
+	} else {
+		/* Wraparound. Sync the first half. */
+		numdesc = rxr->num_desc - rxr->next_to_check;
+
+		/* Set the size of the last half */
+		syncremain = limit - numdesc;
+	}
+	bus_dmamap_sync(rxr->rxdma.dma_tag->dt_dmat,
+	rxr->rxdma.dma_map,
+	sizeof(union ixgbe_adv_rx_desc) * rxr->next_to_check,
+	sizeof(union ixgbe_adv_rx_desc) * numdesc,
+	BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
+
 	/*
 	 * 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
@@ -1852,9 +1872,22 @@ ixgbe_rxeof(struct ix_queue *que)
 		booleop;
 		booldiscard = false;
 
-		/* Sync the ring. */
-		ixgbe_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map,
-		BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
+		if (wraparound) {
+			/* Sync the last half. */
+			KASSERT(syncremain != 0);
+			numdesc = syncremain;
+			wraparound = false;
+		} else if (__predict_false(loopcount >= limit)) {
+			KASSERT(discard_multidesc == true);
+			numdesc = 1;
+		} else
+			numdesc = 0;
+
+		if (numdesc != 0)
+			bus_dmamap_sync(rxr->rxdma.dma_tag->dt_dmat,
+			rxr->rxdma.dma_map, 0,
+			sizeof(union ixgbe_adv_rx_desc) * numdesc,
+			BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
 
 		cur = >rx_base[i];
 		staterr = le32toh(cur->wb.upper.status_error);
@@ -2118,8 +2151,10 @@ next_desc:
 		BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
 
 		/* Advance our pointers to the next descriptor. */
-		if (++i == rxr->num_desc)
+		if (++i == rxr->num_desc) {
+			wraparound = true;
 			i = 0;
+		}
 		rxr->next_to_check = i;
 
 		/* Now send to the stack or do LRO */

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.44 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.45
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.44	Wed Sep 15 16:38:00 2021
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Sat Nov 20 15:21:31 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.44 2021/09/15 16:38:00 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.45 2021/11/20 15:21:31 martin Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.88.2.44 2021/09/15 16:38:00 martin Exp $");

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

2021-11-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Nov 20 15:21:32 UTC 2021

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: ix_txrx.c ixgbe.c ixgbe.h
ixgbe_type.h ixv.c

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

sys/dev/pci/ixgbe/ixgbe.h   1.81-1.83
sys/dev/pci/ixgbe/ixgbe.c   1.291-1.292 via patch
sys/dev/pci/ixgbe/ixgbe_type.h  1.50
sys/dev/pci/ixgbe/ixv.c 1.167-1.168 via patch
sys/dev/pci/ixgbe/ix_txrx.c 1.94

- Fix a bug that a near 64KB TSO segment can't send.
- Reduce bus_dmamap_sync() cost.
- Use macro. Fix typos in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.24.2.22 -r1.24.2.23 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.88.2.44 -r1.88.2.45 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.24.6.22 -r1.24.6.23 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.22.2.13 -r1.22.2.14 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.56.2.32 -r1.56.2.33 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.



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

2019-11-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 19 10:48:15 UTC 2019

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

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

sys/dev/pci/ixgbe/ixgbe.c: revision 1.216
sys/dev/pci/ixgbe/ixv.c: revision 1.141

Print MAC address.

XXX Should we move such type of printf() to ether_ifattach?


To generate a diff of this commit:
cvs rdiff -u -r1.88.2.36 -r1.88.2.37 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.56.2.27 -r1.56.2.28 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.



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

2019-11-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 19 10:48:15 UTC 2019

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

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

sys/dev/pci/ixgbe/ixgbe.c: revision 1.216
sys/dev/pci/ixgbe/ixv.c: revision 1.141

Print MAC address.

XXX Should we move such type of printf() to ether_ifattach?


To generate a diff of this commit:
cvs rdiff -u -r1.88.2.36 -r1.88.2.37 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.56.2.27 -r1.56.2.28 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.88.2.36 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.37
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.36	Thu Oct 17 18:39:41 2019
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Tue Nov 19 10:48:15 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.36 2019/10/17 18:39:41 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.37 2019/11/19 10:48:15 martin Exp $ */
 
 /**
 
@@ -1333,6 +1333,8 @@ ixgbe_setup_interface(device_t dev, stru
 	}
 	adapter->ipq = if_percpuq_create(>osdep.ec.ec_if);
 	ether_ifattach(ifp, adapter->hw.mac.addr);
+	aprint_normal_dev(dev, "Ethernet address %s\n",
+	ether_sprintf(adapter->hw.mac.addr));
 	/*
 	 * We use per TX queue softint, so if_deferred_start_init() isn't
 	 * used.

Index: src/sys/dev/pci/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.56.2.27 src/sys/dev/pci/ixgbe/ixv.c:1.56.2.28
--- src/sys/dev/pci/ixgbe/ixv.c:1.56.2.27	Thu Nov 14 15:53:39 2019
+++ src/sys/dev/pci/ixgbe/ixv.c	Tue Nov 19 10:48:15 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.56.2.27 2019/11/14 15:53:39 martin Exp $*/
+/*$NetBSD: ixv.c,v 1.56.2.28 2019/11/19 10:48:15 martin Exp $*/
 
 /**
 
@@ -1623,6 +1623,8 @@ ixv_setup_interface(device_t dev, struct
 	}
 	adapter->ipq = if_percpuq_create(>osdep.ec.ec_if);
 	ether_ifattach(ifp, adapter->hw.mac.addr);
+	aprint_normal_dev(dev, "Ethernet address %s\n",
+	ether_sprintf(adapter->hw.mac.addr));
 	/*
 	 * We use per TX queue softint, so if_deferred_start_init() isn't
 	 * used.



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

2019-11-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Nov 14 15:53:40 UTC 2019

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

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

sys/dev/pci/ixgbe/ixv.c: revision 1.140

ixv(4): disable RSS configuration on 82599 and X540 VFs.

Those VFs share their RSS configuration with PF and, thus,
they cannot be configured independently. From FreeBSD r354349.


To generate a diff of this commit:
cvs rdiff -u -r1.56.2.26 -r1.56.2.27 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.



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

2019-11-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Nov 14 15:53:40 UTC 2019

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

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

sys/dev/pci/ixgbe/ixv.c: revision 1.140

ixv(4): disable RSS configuration on 82599 and X540 VFs.

Those VFs share their RSS configuration with PF and, thus,
they cannot be configured independently. From FreeBSD r354349.


To generate a diff of this commit:
cvs rdiff -u -r1.56.2.26 -r1.56.2.27 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.56.2.26 src/sys/dev/pci/ixgbe/ixv.c:1.56.2.27
--- src/sys/dev/pci/ixgbe/ixv.c:1.56.2.26	Tue Oct  8 18:16:50 2019
+++ src/sys/dev/pci/ixgbe/ixv.c	Thu Nov 14 15:53:39 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.56.2.26 2019/10/08 18:16:50 martin Exp $*/
+/*$NetBSD: ixv.c,v 1.56.2.27 2019/11/14 15:53:39 martin Exp $*/
 
 /**
 
@@ -1931,7 +1931,8 @@ ixv_initialize_receive_units(struct adap
 			adapter->num_rx_desc - 1);
 	}
 
-	ixv_initialize_rss_mapping(adapter);
+	if (adapter->hw.mac.type >= ixgbe_mac_X550_vf)
+		ixv_initialize_rss_mapping(adapter);
 } /* ixv_initialize_receive_units */
 
 /



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

2019-11-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Nov 10 13:36:29 UTC 2019

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

Log Message:
Pull up following revision(s) (requested by knakahara in ticket #1431):

sys/dev/pci/ixgbe/ix_txrx.c: revision 1.56

Fix missing kpreempt_disable() before softint_schedule() like if_vmx.c:r1.51.


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

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



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

2019-11-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Nov 10 13:36:29 UTC 2019

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

Log Message:
Pull up following revision(s) (requested by knakahara in ticket #1431):

sys/dev/pci/ixgbe/ix_txrx.c: revision 1.56

Fix missing kpreempt_disable() before softint_schedule() like if_vmx.c:r1.51.


To generate a diff of this commit:
cvs rdiff -u -r1.24.2.17 -r1.24.2.18 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.24.2.17 src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.18
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.17	Thu Sep  5 09:06:07 2019
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Sun Nov 10 13:36:29 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.24.2.17 2019/09/05 09:06:07 martin Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.24.2.18 2019/11/10 13:36:29 martin Exp $ */
 
 /**
 
@@ -266,8 +266,11 @@ ixgbe_mq_start(struct ifnet *ifp, struct
 >wq_cookie, curcpu());
 			} else
 percpu_putref(adapter->txr_wq_enqueued);
-		} else
+		} else {
+			kpreempt_disable();
 			softint_schedule(txr->txr_si);
+			kpreempt_enable();
+		}
 	}
 
 	return (0);



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

2019-10-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 17 18:39:42 UTC 2019

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

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

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

Apply FreeBSD r353599:
 > ixgbe: Disable EEE for backplane X550EM_X
 >
 > From Zach:
 > Intel documentation indicates that backplane X550EM_X KR devices do not
 > support Energy Efficient Ethernet. Prior to this patch, X552 devices
 > (device ID 0x15AB) will crash the system when transitioning EEE state
 > via sysctl.
 >
 > Signed-off-by: Zach Vargas 
 >
 > PR:  240320
 > Submitted by:Zach Vargas 
 > Reviewed by: erj@
 > MFC after:   3 days
 > Differential Revision:   https://reviews.freebsd.org/D21673


To generate a diff of this commit:
cvs rdiff -u -r1.88.2.35 -r1.88.2.36 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.88.2.35 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.36
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.35	Thu Sep 26 18:19:26 2019
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Thu Oct 17 18:39:41 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.35 2019/09/26 18:19:26 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.36 2019/10/17 18:39:41 martin Exp $ */
 
 /**
 
@@ -5819,7 +5819,7 @@ ixgbe_sysctl_eee_state(SYSCTLFN_ARGS)
 	if ((new_eee < 0) || (new_eee > 1))
 		return (EINVAL);
 
-	retval = adapter->hw.mac.ops.setup_eee(>hw, new_eee);
+	retval = ixgbe_setup_eee(>hw, new_eee);
 	if (retval) {
 		device_printf(dev, "Error in EEE setup: 0x%08X\n", retval);
 		return (EINVAL);
@@ -5993,8 +5993,6 @@ ixgbe_init_device_features(struct adapte
 		 */
 		adapter->feat_cap |= IXGBE_FEATURE_SRIOV;
 		adapter->feat_cap |= IXGBE_FEATURE_FDIR;
-		if (adapter->hw.device_id == IXGBE_DEV_ID_X550EM_X_KR)
-			adapter->feat_cap |= IXGBE_FEATURE_EEE;
 		break;
 	case ixgbe_mac_X550EM_a:
 		/*



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

2019-10-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 17 18:39:42 UTC 2019

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

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

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

Apply FreeBSD r353599:
 > ixgbe: Disable EEE for backplane X550EM_X
 >
 > From Zach:
 > Intel documentation indicates that backplane X550EM_X KR devices do not
 > support Energy Efficient Ethernet. Prior to this patch, X552 devices
 > (device ID 0x15AB) will crash the system when transitioning EEE state
 > via sysctl.
 >
 > Signed-off-by: Zach Vargas 
 >
 > PR:  240320
 > Submitted by:Zach Vargas 
 > Reviewed by: erj@
 > MFC after:   3 days
 > Differential Revision:   https://reviews.freebsd.org/D21673


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

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



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

2019-10-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct  8 18:16:50 UTC 2019

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

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

sys/dev/pci/ixgbe/ixv.c: revision 1.139

Set MTU correctly if mtu > 1500.


To generate a diff of this commit:
cvs rdiff -u -r1.56.2.25 -r1.56.2.26 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.



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

2019-09-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep  6 13:44:36 UTC 2019

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

Log Message:
Apply patch, requested by msaitoh in ticket #1367:

fix mistake in previous.


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

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



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

2019-09-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep  6 13:44:36 UTC 2019

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

Log Message:
Apply patch, requested by msaitoh in ticket #1367:

fix mistake in previous.


To generate a diff of this commit:
cvs rdiff -u -r1.88.2.33 -r1.88.2.34 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.88.2.33 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.34
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.33	Thu Sep  5 09:06:07 2019
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Fri Sep  6 13:44:36 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.33 2019/09/05 09:06:07 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.34 2019/09/06 13:44:36 martin Exp $ */
 
 /**
 
@@ -1397,6 +1397,7 @@ static void
 ixgbe_add_media_types(struct adapter *adapter)
 {
 	struct ixgbe_hw *hw = >hw;
+	device_t	dev = adapter->dev;
 	u64		layer;
 
 	layer = adapter->phy_layer;



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

2019-09-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Sep  5 09:06:08 UTC 2019

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: ix_txrx.c ixgbe.c ixgbe_common.c
ixgbe_netbsd.c ixgbe_x550.c ixv.c

Log Message:
Apply patch, requested by msaitoh in ticket #1367, to pull up the following
revisions:

sys/dev/pci/ixgbe/ixgbe_x550.c  1.16
sys/dev/pci/ixgbe/ixgbe.c   1.180,1.203-1.204,
1.207-1.208 via patch
sys/dev/pci/ixgbe/ix_txrx.c 1.55
sys/dev/pci/ixgbe/ixgbe_netbsd.c1.10
sys/dev/pci/ixgbe/ixgbe_common.c1.25
sys/dev/pci/ixgbe/ixv.c 1.129-1.130

- X550EM supports QSFP, so check ixgbe_media_type_fiber_qsfp too.
- An interrupt might not arrive when a module is inserted. When an link
  status change interrupt occurred and the driver still regard SFP as
  unplugged, issue the module softint before issuing LSC softint.
- Add 1BASE-LX media if it's 1000BASE-BX.
- printf -> device_printf
- Avoid undefined behavior of VLAN filter setting.
- Simplify code.
- Fix typo in unused code.
- Fix typo in comment. Found by Wataru Ashihara.


To generate a diff of this commit:
cvs rdiff -u -r1.24.2.16 -r1.24.2.17 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.88.2.32 -r1.88.2.33 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.13.2.6 -r1.13.2.7 src/sys/dev/pci/ixgbe/ixgbe_common.c
cvs rdiff -u -r1.6.2.3 -r1.6.2.4 src/sys/dev/pci/ixgbe/ixgbe_netbsd.c
cvs rdiff -u -r1.5.6.6 -r1.5.6.7 src/sys/dev/pci/ixgbe/ixgbe_x550.c
cvs rdiff -u -r1.56.2.23 -r1.56.2.24 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.24.2.16 src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.17
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.16	Mon Jul 22 17:53:35 2019
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Thu Sep  5 09:06:07 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.24.2.16 2019/07/22 17:53:35 martin Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.24.2.17 2019/09/05 09:06:07 martin Exp $ */
 
 /**
 
@@ -1363,7 +1363,9 @@ ixgbe_refresh_mbufs(struct rx_ring *rxr,
 			error = bus_dmamap_load_mbuf(rxr->ptag->dt_dmat,
 			rxbuf->pmap, mp, BUS_DMA_NOWAIT);
 			if (error != 0) {
-printf("Refresh mbufs: payload dmamap load failure - %d\n", error);
+device_printf(adapter->dev, "Refresh mbufs: "
+"payload dmamap load failure - %d\n",
+error);
 m_free(mp);
 rxbuf->buf = NULL;
 goto update;

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.32 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.33
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.32	Thu Aug 29 16:31:53 2019
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Thu Sep  5 09:06:07 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.32 2019/08/29 16:31:53 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.33 2019/09/05 09:06:07 martin Exp $ */
 
 /**
 
@@ -1397,7 +1397,6 @@ static void
 ixgbe_add_media_types(struct adapter *adapter)
 {
 	struct ixgbe_hw *hw = >hw;
-	device_t	dev = adapter->dev;
 	u64		layer;
 
 	layer = adapter->phy_layer;
@@ -1449,7 +1448,7 @@ ixgbe_add_media_types(struct adapter *ad
 		ADD(IFM_10G_KR | IFM_FDX, 0);
 	}
 	if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_KX4) {
-		ADD(AIFM_10G_KX4 | IFM_FDX, 0);
+		ADD(IFM_10G_KX4 | IFM_FDX, 0);
 	}
 #else
 	if (layer & IXGBE_PHYSICAL_LAYER_10GBASE_KR) {
@@ -1476,7 +1475,7 @@ ixgbe_add_media_types(struct adapter *ad
 		ADD(IFM_5000_T | IFM_FDX, 0);
 	}
 	if (layer & IXGBE_PHYSICAL_LAYER_1000BASE_BX)
-		device_printf(dev, "Media supported: 1000baseBX\n");
+		ADD(IFM_1000_LX | IFM_FDX, 0); /* IFM_1000_BX */
 	/* XXX no ifmedia_set? */
 
 	ADD(IFM_AUTO, 0);
@@ -1496,6 +1495,8 @@ ixgbe_is_sfp(struct ixgbe_hw *hw)
 			return (TRUE);
 		return (FALSE);
 	case ixgbe_mac_82599EB:
+	case ixgbe_mac_X550EM_x:
+	case ixgbe_mac_X550EM_a:
 		switch (hw->mac.ops.get_media_type(hw)) {
 		case ixgbe_media_type_fiber:
 		case ixgbe_media_type_fiber_qsfp:
@@ -1503,11 +1504,6 @@ ixgbe_is_sfp(struct ixgbe_hw *hw)
 		default:
 			return (FALSE);
 		}
-	case ixgbe_mac_X550EM_x:
-	case ixgbe_mac_X550EM_a:
-		if (hw->mac.ops.get_media_type(hw) == ixgbe_media_type_fiber)
-			return (TRUE);
-		return (FALSE);
 	default:
 		return (FALSE);
 	}
@@ -2542,7 +2538,7 @@ ixgbe_enable_queue(struct adapter *adapt
 {
 	struct ixgbe_hw *hw = >hw;
 	struct ix_queue *que = >queues[vector];
-	u64		queue = (u64)(1ULL << vector);
+	u64		queue = 1ULL << vector;
 	u32		mask;
 
 	mutex_enter(>dc_mtx);
@@ -3077,6 +3073,34 @@ ixgbe_msix_link(void *arg)
 	/* Clear interrupt with write */
 	IXGBE_WRITE_REG(hw, 

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

2019-09-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Sep  5 09:06:08 UTC 2019

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: ix_txrx.c ixgbe.c ixgbe_common.c
ixgbe_netbsd.c ixgbe_x550.c ixv.c

Log Message:
Apply patch, requested by msaitoh in ticket #1367, to pull up the following
revisions:

sys/dev/pci/ixgbe/ixgbe_x550.c  1.16
sys/dev/pci/ixgbe/ixgbe.c   1.180,1.203-1.204,
1.207-1.208 via patch
sys/dev/pci/ixgbe/ix_txrx.c 1.55
sys/dev/pci/ixgbe/ixgbe_netbsd.c1.10
sys/dev/pci/ixgbe/ixgbe_common.c1.25
sys/dev/pci/ixgbe/ixv.c 1.129-1.130

- X550EM supports QSFP, so check ixgbe_media_type_fiber_qsfp too.
- An interrupt might not arrive when a module is inserted. When an link
  status change interrupt occurred and the driver still regard SFP as
  unplugged, issue the module softint before issuing LSC softint.
- Add 1BASE-LX media if it's 1000BASE-BX.
- printf -> device_printf
- Avoid undefined behavior of VLAN filter setting.
- Simplify code.
- Fix typo in unused code.
- Fix typo in comment. Found by Wataru Ashihara.


To generate a diff of this commit:
cvs rdiff -u -r1.24.2.16 -r1.24.2.17 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.88.2.32 -r1.88.2.33 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.13.2.6 -r1.13.2.7 src/sys/dev/pci/ixgbe/ixgbe_common.c
cvs rdiff -u -r1.6.2.3 -r1.6.2.4 src/sys/dev/pci/ixgbe/ixgbe_netbsd.c
cvs rdiff -u -r1.5.6.6 -r1.5.6.7 src/sys/dev/pci/ixgbe/ixgbe_x550.c
cvs rdiff -u -r1.56.2.23 -r1.56.2.24 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.



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

2019-08-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Aug 29 16:31:53 UTC 2019

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

Log Message:
Pull up following revision(s) (requested by knakahara in ticket #1347):

sys/dev/pci/ixgbe/ixgbe.c: revision 1.205
sys/dev/pci/ixgbe/ixgbe.c: revision 1.206

fix typo in error handling of ixgbe_allocate_legacy().
ok by msaitoh@n.o
pullup-8, pullup-9

 -

Fix panic when ncpu == 1 && sysctl -w hw.ixg0.txrx_workqueue=1. Reported by 
nonaka@n.o.

ok by msaitoh@n.o and nonaka@n.o
pullup-8, pullup-9


To generate a diff of this commit:
cvs rdiff -u -r1.88.2.31 -r1.88.2.32 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.88.2.31 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.32
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.31	Thu Aug  1 14:14:30 2019
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Thu Aug 29 16:31:53 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.31 2019/08/01 14:14:30 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.32 2019/08/29 16:31:53 martin Exp $ */
 
 /**
 
@@ -6410,7 +6410,9 @@ ixgbe_allocate_legacy(struct adapter *ad
 	int		counts[PCI_INTR_TYPE_SIZE];
 	pci_intr_type_t intr_type, max_type;
 	char		intrbuf[PCI_INTRSTR_LEN];
+	char		wqname[MAXCOMLEN];
 	const char	*intrstr = NULL;
+	int defertx_error = 0, error;
 
 	/* We allocate a single interrupt resource */
 	max_type = PCI_INTR_TYPE_MSI;
@@ -6472,15 +6474,27 @@ alloc_retry:
 	 * Try allocating a fast interrupt and the associated deferred
 	 * processing contexts.
 	 */
-	if (!(adapter->feat_en & IXGBE_FEATURE_LEGACY_TX))
+	if (!(adapter->feat_en & IXGBE_FEATURE_LEGACY_TX)) {
 		txr->txr_si =
 		softint_establish(SOFTINT_NET | IXGBE_SOFTINFT_FLAGS,
 			ixgbe_deferred_mq_start, txr);
+
+		snprintf(wqname, sizeof(wqname), "%sdeferTx", device_xname(dev));
+		defertx_error = workqueue_create(>txr_wq, wqname,
+		ixgbe_deferred_mq_start_work, adapter, IXGBE_WORKQUEUE_PRI,
+		IPL_NET, IXGBE_WORKQUEUE_FLAGS);
+		adapter->txr_wq_enqueued = percpu_alloc(sizeof(u_int));
+	}
 	que->que_si = softint_establish(SOFTINT_NET | IXGBE_SOFTINFT_FLAGS,
 	ixgbe_handle_que, que);
+	snprintf(wqname, sizeof(wqname), "%sTxRx", device_xname(dev));
+	error = workqueue_create(>que_wq, wqname,
+	ixgbe_handle_que_work, adapter, IXGBE_WORKQUEUE_PRI, IPL_NET,
+	IXGBE_WORKQUEUE_FLAGS);
 
 	if ((!(adapter->feat_en & IXGBE_FEATURE_LEGACY_TX)
-		& (txr->txr_si == NULL)) || (que->que_si == NULL)) {
+		&& ((txr->txr_si == NULL) || defertx_error != 0))
+	|| (que->que_si == NULL) || error != 0) {
 		aprint_error_dev(dev,
 		"could not establish software interrupts\n");
 



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

2019-08-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Aug 29 16:31:53 UTC 2019

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

Log Message:
Pull up following revision(s) (requested by knakahara in ticket #1347):

sys/dev/pci/ixgbe/ixgbe.c: revision 1.205
sys/dev/pci/ixgbe/ixgbe.c: revision 1.206

fix typo in error handling of ixgbe_allocate_legacy().
ok by msaitoh@n.o
pullup-8, pullup-9

 -

Fix panic when ncpu == 1 && sysctl -w hw.ixg0.txrx_workqueue=1. Reported by 
nonaka@n.o.

ok by msaitoh@n.o and nonaka@n.o
pullup-8, pullup-9


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

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



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

2019-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Aug  1 14:14:30 UTC 2019

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: ixgbe.c ixgbe_common.c ixgbe_type.h
ixv.c

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

sys/dev/pci/ixgbe/ixgbe_type.h  1.41
sys/dev/pci/ixgbe/ixgbe.c   1.194,1.197-1.199
via patch
sys/dev/pci/ixgbe/ixgbe_common.c1.24
sys/dev/pci/ixgbe/ixv.c 1.121,1.124-1.125

 - Avoid undefined behavior of interrupt vector setting.
 - Avoid undefined behavior of TX/RX queue statistics calculation.
 - Avoid undefined behavior of X550EM's PHY accesses.
 - Avoid undefined behavior of Flow Control Transmit Timer setting.
 - Don't call {ixgbe,ixv}_stop() twice while detaching.


To generate a diff of this commit:
cvs rdiff -u -r1.88.2.30 -r1.88.2.31 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.13.2.5 -r1.13.2.6 src/sys/dev/pci/ixgbe/ixgbe_common.c
cvs rdiff -u -r1.22.2.9 -r1.22.2.10 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.56.2.22 -r1.56.2.23 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.88.2.30 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.31
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.30	Mon Jul 22 17:53:35 2019
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Thu Aug  1 14:14:30 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.30 2019/07/22 17:53:35 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.31 2019/08/01 14:14:30 martin Exp $ */
 
 /**
 
@@ -608,7 +608,7 @@ ixgbe_initialize_receive_units(struct ad
 
 		/* Set RQSMR (Receive Queue Statistic Mapping) register */
 		reg = IXGBE_READ_REG(hw, IXGBE_RQSMR(regnum));
-		reg &= ~(0x00ff << (regshift * 8));
+		reg &= ~(0x00ffUL << (regshift * 8));
 		reg |= i << (regshift * 8);
 		IXGBE_WRITE_REG(hw, IXGBE_RQSMR(regnum), reg);
 
@@ -697,7 +697,7 @@ ixgbe_initialize_transmit_units(struct a
 		else
 			tqsmreg = IXGBE_TQSM(regnum);
 		reg = IXGBE_READ_REG(hw, tqsmreg);
-		reg &= ~(0x00ff << (regshift * 8));
+		reg &= ~(0x00ffUL << (regshift * 8));
 		reg |= i << (regshift * 8);
 		IXGBE_WRITE_REG(hw, tqsmreg, reg);
 
@@ -2572,7 +2572,7 @@ ixgbe_disable_queue_internal(struct adap
 {
 	struct ixgbe_hw *hw = >hw;
 	struct ix_queue *que = >queues[vector];
-	u64		queue = (u64)(1ULL << vector);
+	u64		queue = 1ULL << vector;
 	u32		mask;
 
 	mutex_enter(>dc_mtx);
@@ -3555,8 +3555,13 @@ ixgbe_detach(device_t dev, int flags)
 		return (EBUSY);
 	}
 
-	/* Stop the interface. Callouts are stopped in it. */
-	ixgbe_ifstop(adapter->ifp, 1);
+	/*
+	 * Stop the interface. ixgbe_setup_low_power_mode() calls ixgbe_stop(),
+	 * so it's not required to call ixgbe_stop() directly.
+	 */
+	IXGBE_CORE_LOCK(adapter);
+	ixgbe_setup_low_power_mode(adapter);
+	IXGBE_CORE_UNLOCK(adapter);
 #if NVLAN > 0
 	/* Make sure VLANs are not using driver */
 	if (!VLAN_ATTACHED(>osdep.ec))
@@ -3572,10 +3577,6 @@ ixgbe_detach(device_t dev, int flags)
 	pmf_device_deregister(dev);
 
 	ether_ifdetach(adapter->ifp);
-	/* Stop the adapter */
-	IXGBE_CORE_LOCK(adapter);
-	ixgbe_setup_low_power_mode(adapter);
-	IXGBE_CORE_UNLOCK(adapter);
 
 	ixgbe_free_softint(adapter);
 
@@ -4174,8 +4175,8 @@ ixgbe_set_ivar(struct adapter *adapter, 
 			entry += (type * 64);
 		index = (entry >> 2) & 0x1F;
 		ivar = IXGBE_READ_REG(hw, IXGBE_IVAR(index));
-		ivar &= ~(0xFF << (8 * (entry & 0x3)));
-		ivar |= (vector << (8 * (entry & 0x3)));
+		ivar &= ~(0xffUL << (8 * (entry & 0x3)));
+		ivar |= ((u32)vector << (8 * (entry & 0x3)));
 		IXGBE_WRITE_REG(>hw, IXGBE_IVAR(index), ivar);
 		break;
 	case ixgbe_mac_82599EB:
@@ -4186,14 +4187,14 @@ ixgbe_set_ivar(struct adapter *adapter, 
 		if (type == -1) { /* MISC IVAR */
 			index = (entry & 1) * 8;
 			ivar = IXGBE_READ_REG(hw, IXGBE_IVAR_MISC);
-			ivar &= ~(0xFF << index);
-			ivar |= (vector << index);
+			ivar &= ~(0xffUL << index);
+			ivar |= ((u32)vector << index);
 			IXGBE_WRITE_REG(hw, IXGBE_IVAR_MISC, ivar);
 		} else {	/* RX/TX IVARS */
 			index = (16 * (entry & 1)) + (8 * type);
 			ivar = IXGBE_READ_REG(hw, IXGBE_IVAR(entry >> 1));
-			ivar &= ~(0xFF << index);
-			ivar |= (vector << index);
+			ivar &= ~(0xffUL << index);
+			ivar |= ((u32)vector << index);
 			IXGBE_WRITE_REG(hw, IXGBE_IVAR(entry >> 1), ivar);
 		}
 		break;

Index: src/sys/dev/pci/ixgbe/ixgbe_common.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_common.c:1.13.2.5 src/sys/dev/pci/ixgbe/ixgbe_common.c:1.13.2.6
--- src/sys/dev/pci/ixgbe/ixgbe_common.c:1.13.2.5	Mon Jul 22 17:53:35 2019
+++ src/sys/dev/pci/ixgbe/ixgbe_common.c	Thu Aug  1 14:14:30 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_common.c,v 

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

2019-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Aug  1 14:14:30 UTC 2019

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: ixgbe.c ixgbe_common.c ixgbe_type.h
ixv.c

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

sys/dev/pci/ixgbe/ixgbe_type.h  1.41
sys/dev/pci/ixgbe/ixgbe.c   1.194,1.197-1.199
via patch
sys/dev/pci/ixgbe/ixgbe_common.c1.24
sys/dev/pci/ixgbe/ixv.c 1.121,1.124-1.125

 - Avoid undefined behavior of interrupt vector setting.
 - Avoid undefined behavior of TX/RX queue statistics calculation.
 - Avoid undefined behavior of X550EM's PHY accesses.
 - Avoid undefined behavior of Flow Control Transmit Timer setting.
 - Don't call {ixgbe,ixv}_stop() twice while detaching.


To generate a diff of this commit:
cvs rdiff -u -r1.88.2.30 -r1.88.2.31 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.13.2.5 -r1.13.2.6 src/sys/dev/pci/ixgbe/ixgbe_common.c
cvs rdiff -u -r1.22.2.9 -r1.22.2.10 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.56.2.22 -r1.56.2.23 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.



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

2019-07-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jul 22 17:53:35 UTC 2019

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: if_sriov.c ix_txrx.c ixgbe.c ixgbe.h
ixgbe_82599.c ixgbe_api.c ixgbe_api.h ixgbe_common.c ixgbe_common.h
ixgbe_features.h ixgbe_mbx.c ixgbe_mbx.h ixgbe_netbsd.c
ixgbe_netbsd.h ixgbe_netmap.c ixgbe_phy.c ixgbe_type.h ixgbe_vf.c
ixgbe_x550.c ixgbe_x550.h ixv.c

Log Message:
Pull up the following revisions (via patch), requested by msaitoh in
ticket #1301:

sys/dev/pci/ixgbe/if_sriov.c1.5-1.6
sys/dev/pci/ixgbe/ix_txrx.c 1.53-1.54
sys/dev/pci/ixgbe/ixgbe_x550.h  1.5
sys/dev/pci/ixgbe/ixgbe.c   
1.169-1.170,1.176,1.179,1.181,1.185-1.186,1.188-1.192 via patch
sys/dev/pci/ixgbe/ixgbe.h   1.53,1.55
sys/dev/pci/ixgbe/ixgbe_82599.c 1.21
sys/dev/pci/ixgbe/ixgbe_api.c   1.22-1.23
sys/dev/pci/ixgbe/ixgbe_api.h   1.14-1.15
sys/dev/pci/ixgbe/ixgbe_x550.c  1.14-1.15
sys/dev/pci/ixgbe/ixgbe_common.c1.23
sys/dev/pci/ixgbe/ixgbe_common.h1.14
sys/dev/pci/ixgbe/ixgbe_mbx.c   1.11
sys/dev/pci/ixgbe/ixgbe_mbx.h   1.14
sys/dev/pci/ixgbe/ixgbe_netmap.c1.2
sys/dev/pci/ixgbe/ixgbe_features.h  1.2
sys/dev/pci/ixgbe/ixgbe_netbsd.c1.9
sys/dev/pci/ixgbe/ixgbe_netbsd.h1.9-1.10
sys/dev/pci/ixgbe/ixgbe_phy.c   1.18
sys/dev/pci/ixgbe/ixgbe_type.h  1.37,1.39-1.40
sys/dev/pci/ixgbe/ixgbe_vf.c1.18
sys/dev/pci/ixgbe/ixv.c 1.112-1.114,1.117,1.119 
via patch

Sync ixgbe up to 20190717 except ETHERCAP or ixv's VLAN stuff:
- Add firmware recovery mode for X550, X550A(Xeon D) and X550EM(C3000).
- Remove IXGBE_DEV_ID_82599_LS(0x154f) support again.
- On X550EMU, use ixgbe_identify_sfp_module_X550em() instead of
  ixgbe_identify_module_generic(). ixgbe_identify_sfp_module_X550em()
  has extra check (e.g. exclude 1G copper).
- It's not required to calculate unused queues' statistics.
- Remove ETHERCAP_VLAN_HWFILTER's definition.
- Match 82598_BX(0x1508), 82599_KR(0x1517), 82599_SFP_EM(0x1507),
  X550EM_X_XFI(0x15b0), X550EM_A_QSFP(0x15ca) and
  X550EM_A_QSFP_N(0x15cc)
- Add missing XFI support into ixgbe_get_link_capabilities_X550em().
- Other than IXGBE_VF_RESET should wait ACK, so use
  ixgbevf_write_msg_read_ack() instead of write_posted() in
  ixgbe_update_mc_addr_list_vf().
- When ixv_check_link() failed in the watchdog function, reset the
  interface.
- Remove RXCSUM register modification in
  ixv_initialize_receive_units(). It seems it's not required.
- Remove some debug printf in ixv_print_debug_info().
- Calculate vector's bit location correctly when the vector >= 31
  in ixgbe_allocate_msix().
- Fix hung queue check when the queue number >= 31.
- On ENETRESET case, not continue and quit the ifflags_cb() function
  because if_init() will do the same thing.
- Fix bugs in unused code.
- Fix typo in comment.
- Fix typo in unused code.
- Whitespace fixes. KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.1.4.4 -r1.1.4.5 src/sys/dev/pci/ixgbe/if_sriov.c
cvs rdiff -u -r1.24.2.15 -r1.24.2.16 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.88.2.29 -r1.88.2.30 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.24.6.16 -r1.24.6.17 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.14.8.4 -r1.14.8.5 src/sys/dev/pci/ixgbe/ixgbe_82599.c
cvs rdiff -u -r1.15.8.4 -r1.15.8.5 src/sys/dev/pci/ixgbe/ixgbe_api.c
cvs rdiff -u -r1.9.8.3 -r1.9.8.4 src/sys/dev/pci/ixgbe/ixgbe_api.h
cvs rdiff -u -r1.13.2.4 -r1.13.2.5 src/sys/dev/pci/ixgbe/ixgbe_common.c
cvs rdiff -u -r1.7.8.4 -r1.7.8.5 src/sys/dev/pci/ixgbe/ixgbe_common.h
cvs rdiff -u -r1.1.4.2 -r1.1.4.3 src/sys/dev/pci/ixgbe/ixgbe_features.h \
src/sys/dev/pci/ixgbe/ixgbe_netmap.c
cvs rdiff -u -r1.6.8.2 -r1.6.8.3 src/sys/dev/pci/ixgbe/ixgbe_mbx.c
cvs rdiff -u -r1.10.8.2 -r1.10.8.3 src/sys/dev/pci/ixgbe/ixgbe_mbx.h
cvs rdiff -u -r1.6.2.2 -r1.6.2.3 src/sys/dev/pci/ixgbe/ixgbe_netbsd.c
cvs rdiff -u -r1.7.6.1 -r1.7.6.2 src/sys/dev/pci/ixgbe/ixgbe_netbsd.h
cvs rdiff -u -r1.11.6.3 -r1.11.6.4 src/sys/dev/pci/ixgbe/ixgbe_phy.c
cvs rdiff -u -r1.22.2.8 -r1.22.2.9 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.12.8.2 -r1.12.8.3 src/sys/dev/pci/ixgbe/ixgbe_vf.c
cvs rdiff -u -r1.5.6.5 -r1.5.6.6 src/sys/dev/pci/ixgbe/ixgbe_x550.c
cvs rdiff -u -r1.2.12.2 -r1.2.12.3 src/sys/dev/pci/ixgbe/ixgbe_x550.h
cvs rdiff -u -r1.56.2.21 -r1.56.2.22 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.