Module Name:    src
Committed By:   martin
Date:           Fri Oct 13 18:55:12 UTC 2023

Modified Files:
        src/sys/dev/pci/ixgbe [netbsd-10]: 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 following revision(s) (requested by msaitoh in ticket #407):

        sys/dev/pci/ixgbe/ixgbe_common.c: revision 1.47
        sys/dev/pci/ixgbe/ixgbe_x550.c: revision 1.28
        sys/dev/pci/ixgbe/ixgbe_type.h: revision 1.60
        sys/dev/pci/ixgbe/ixgbe_82599.c: revision 1.31
        sys/dev/pci/ixgbe/ixgbe_82599.c: revision 1.32
        sys/dev/pci/ixgbe/ixv.c: revision 1.187
        sys/dev/pci/ixgbe/ixv.c: revision 1.188
        sys/dev/pci/ixgbe/ixv.c: revision 1.189
        sys/dev/pci/ixgbe/ixgbe_common.h: revision 1.18
        sys/dev/pci/ixgbe/ixgbe_x540.c: revision 1.24
        sys/dev/pci/ixgbe/ixgbe.c: revision 1.334
        sys/dev/pci/ixgbe/ixgbe.c: revision 1.335
        sys/dev/pci/ixgbe/ixgbe.c: revision 1.336
        sys/dev/pci/ixgbe/ixgbe.c: revision 1.337
        sys/dev/pci/ixgbe/ix_txrx.c: revision 1.103
        sys/dev/pci/ixgbe/ixgbe.c: revision 1.338
        sys/dev/pci/ixgbe/ixgbe_type.h: revision 1.59
        sys/dev/pci/ixgbe/ixgbe_dcb_82598.c: revision 1.13
        sys/dev/pci/ixgbe/ixgbe_dcb.c: revision 1.14
        sys/dev/pci/ixgbe/ixgbe_dcb.c: revision 1.15
        sys/dev/pci/ixgbe/ixgbe_api.c: revision 1.29
        sys/dev/pci/ixgbe/ixgbe_bypass.h: revision 1.5
        sys/dev/pci/ixgbe/ixgbe.h: revision 1.90
        sys/dev/pci/ixgbe/ixgbe.h: revision 1.91
        sys/dev/pci/ixgbe/ixgbe.h: revision 1.92
        sys/dev/pci/ixgbe/ixgbe_common.c: revision 1.46

ixg(4): Remove unused and old function. No functional change.
 - From FreeBSD's ix-3.3.32.

ixg(4): Add 82599 LS once again.
 - From:
        FreeBSD: 9228ac3a69c4c7401a743e6465e118101a2beeb0
        DPDK:    549ccd3dc01539e060597b503f2b65b272de3347
 - This was removed 5 years ago. From the commit message:
   > Remove IXGBE_DEV_ID_82599_LS(0x154f) support again. I don't know why. This
   > was added in ix-3.2.18.tar.gz(NetBSD: ixgbe_82599.c rev. 1.20) and
   > removed in ix-3.3.6.tar.gz.

ixg(4): Filter out spurious link up indication
 - Extend SFP+ cage crosstalk fix by re-checking link state after 5ms delay
   to filter out spurious link up indication by transceiver with no fiber
   cable connected.
 - From FreeBSD:
     In-tree: 04a5e6d7cadd06b10169c3c3a560649e7dc7444c
     Out of tree: ix-3.3.33.

ixgbe: Simplify definitions. No functional change.
 Both DEFAULT_{TX,RX}D and PERFORM_{TX,RX}D are 2048. Use DEFAULT_{TX,RX}D.
Same as FreeBSD.

ixgbe: Modify error message of wrong TX/RX descriptor size.
  - Based from FreeBSD ix-3.3.35. I think ix-3.3.35's RING_INCREMENT(== 32)
    is wrong. It should be 8(DBA_ALIGN / sizeof(union ixgbe_adv_[tr]x_desc)).
    Linux also uses 8.

ixgbe: Remove NO_82599_SUPPORT and NO_X540_SUPPORT support. NFCI.
 From FreeBSD ix-3.3.35. Note that this file is not used in NetBSD.

ixgbe: Enable interrupt after setting IFF_RUNNING. Same as FreeBSD x-3.3.35.

ixgbe: Cleanup. No fucntional change.

 Remove unused code, fix whitespace and modify comment to reduce against
FreeBSD(mainly from ix-3.3.35).


To generate a diff of this commit:
cvs rdiff -u -r1.100.4.2 -r1.100.4.3 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.324.2.3 -r1.324.2.4 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.86.4.2 -r1.86.4.3 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.29.4.1 -r1.29.4.2 src/sys/dev/pci/ixgbe/ixgbe_82599.c
cvs rdiff -u -r1.28 -r1.28.4.1 src/sys/dev/pci/ixgbe/ixgbe_api.c
cvs rdiff -u -r1.3.4.1 -r1.3.4.2 src/sys/dev/pci/ixgbe/ixgbe_bypass.h
cvs rdiff -u -r1.43.4.2 -r1.43.4.3 src/sys/dev/pci/ixgbe/ixgbe_common.c
cvs rdiff -u -r1.16.4.1 -r1.16.4.2 src/sys/dev/pci/ixgbe/ixgbe_common.h
cvs rdiff -u -r1.13 -r1.13.4.1 src/sys/dev/pci/ixgbe/ixgbe_dcb.c
cvs rdiff -u -r1.12 -r1.12.4.1 src/sys/dev/pci/ixgbe/ixgbe_dcb_82598.c
cvs rdiff -u -r1.55.4.3 -r1.55.4.4 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.23 -r1.23.4.1 src/sys/dev/pci/ixgbe/ixgbe_x540.c
cvs rdiff -u -r1.26.4.1 -r1.26.4.2 src/sys/dev/pci/ixgbe/ixgbe_x550.c
cvs rdiff -u -r1.183.4.2 -r1.183.4.3 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.100.4.2 src/sys/dev/pci/ixgbe/ix_txrx.c:1.100.4.3
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.100.4.2	Fri Oct 13 18:16:51 2023
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Fri Oct 13 18:55:12 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.100.4.2 2023/10/13 18:16:51 martin Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.100.4.3 2023/10/13 18:55:12 martin Exp $ */
 
 /******************************************************************************
 
@@ -64,7 +64,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.100.4.2 2023/10/13 18:16:51 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.100.4.3 2023/10/13 18:55:12 martin Exp $");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -839,7 +839,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);
@@ -1733,9 +1732,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
+                 *  - no LRO resources, or
+                 *  - lro enqueue fails
                  */
                 if (rxr->lro.lro_cnt != 0)
                         if (tcp_lro_rx(&rxr->lro, m, 0) == 0)

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.324.2.3 src/sys/dev/pci/ixgbe/ixgbe.c:1.324.2.4
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.324.2.3	Fri Oct 13 18:16:51 2023
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Fri Oct 13 18:55:12 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.324.2.3 2023/10/13 18:16:51 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.324.2.4 2023/10/13 18:55:12 martin Exp $ */
 
 /******************************************************************************
 
@@ -64,7 +64,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.324.2.3 2023/10/13 18:16:51 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.324.2.4 2023/10/13 18:55:12 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -117,6 +117,7 @@ static const ixgbe_vendor_info_t ixgbe_v
 	{IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_XAUI_LOM, 0, 0, 0},
 	{IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_CX4, 0, 0, 0},
 	{IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_T3_LOM, 0, 0, 0},
+	{IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_LS, 0, 0, 0},
 	{IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_COMBO_BACKPLANE, 0, 0, 0},
 	{IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_BACKPLANE_FCOE, 0, 0, 0},
 	{IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_SFP_SF2, 0, 0, 0},
@@ -369,12 +370,12 @@ SYSCTL_INT(_hw_ix, OID_AUTO, num_queues,
  * setting higher than RX as this seems
  * the better performing choice.
  */
-static int ixgbe_txd = PERFORM_TXD;
+static int ixgbe_txd = DEFAULT_TXD;
 SYSCTL_INT(_hw_ix, OID_AUTO, txd, CTLFLAG_RDTUN, &ixgbe_txd, 0,
     "Number of transmit descriptors per queue");
 
 /* Number of RX descriptors per ring */
-static int ixgbe_rxd = PERFORM_RXD;
+static int ixgbe_rxd = DEFAULT_RXD;
 SYSCTL_INT(_hw_ix, OID_AUTO, rxd, CTLFLAG_RDTUN, &ixgbe_rxd, 0,
     "Number of receive descriptors per queue");
 
@@ -763,8 +764,6 @@ ixgbe_initialize_transmit_units(struct i
 		rttdcs &= ~IXGBE_RTTDCS_ARBDIS;
 		IXGBE_WRITE_REG(hw, IXGBE_RTTDCS, rttdcs);
 	}
-
-	return;
 } /* ixgbe_initialize_transmit_units */
 
 static void
@@ -966,14 +965,26 @@ ixgbe_attach(device_t parent, device_t d
 	/* Do descriptor calc and sanity checks */
 	if (((ixgbe_txd * sizeof(union ixgbe_adv_tx_desc)) % DBA_ALIGN) != 0 ||
 	    ixgbe_txd < MIN_TXD || ixgbe_txd > MAX_TXD) {
-		aprint_error_dev(dev, "TXD config issue, using default!\n");
+		aprint_error_dev(dev, "Invalid TX ring size (%d). "
+		    "It must be between %d and %d, "
+		    "inclusive, and must be a multiple of %zu. "
+		    "Using default value of %d instead.\n",
+		    ixgbe_txd, MIN_TXD, MAX_TXD,
+		    DBA_ALIGN / sizeof(union ixgbe_adv_tx_desc),
+		    DEFAULT_TXD);
 		sc->num_tx_desc = DEFAULT_TXD;
 	} else
 		sc->num_tx_desc = ixgbe_txd;
 
 	if (((ixgbe_rxd * sizeof(union ixgbe_adv_rx_desc)) % DBA_ALIGN) != 0 ||
 	    ixgbe_rxd < MIN_RXD || ixgbe_rxd > MAX_RXD) {
-		aprint_error_dev(dev, "RXD config issue, using default!\n");
+		aprint_error_dev(dev, "Invalid RX ring size (%d). "
+		    "It must be between %d and %d, "
+		    "inclusive, and must be a multiple of %zu. "
+		    "Using default value of %d instead.\n",
+		    ixgbe_rxd, MIN_RXD, MAX_RXD,
+		    DBA_ALIGN / sizeof(union ixgbe_adv_rx_desc),
+		    DEFAULT_RXD);
 		sc->num_rx_desc = DEFAULT_RXD;
 	} else
 		sc->num_rx_desc = ixgbe_rxd;
@@ -4281,9 +4292,6 @@ ixgbe_init_locked(struct ixgbe_softc *sc
 	/* OK to schedule workqueues. */
 	sc->schedule_wqs_ok = true;
 
-	/* And now turn on interrupts */
-	ixgbe_enable_intr(sc);
-
 	/* Enable the use of the MBX by the VF's */
 	if (sc->feat_en & IXGBE_FEATURE_SRIOV) {
 		ctrl_ext = IXGBE_READ_REG(hw, IXGBE_CTRL_EXT);
@@ -4295,9 +4303,12 @@ ixgbe_init_locked(struct ixgbe_softc *sc
 	sc->if_flags = ifp->if_flags;
 	sc->ec_capenable = sc->osdep.ec.ec_capenable;
 
-	/* Now inform the stack we're ready */
+	/* Inform the stack we're ready */
 	ifp->if_flags |= IFF_RUNNING;
 
+	/* And now turn on interrupts */
+	ixgbe_enable_intr(sc);
+
 	return;
 } /* ixgbe_init_locked */
 

Index: src/sys/dev/pci/ixgbe/ixgbe.h
diff -u src/sys/dev/pci/ixgbe/ixgbe.h:1.86.4.2 src/sys/dev/pci/ixgbe/ixgbe.h:1.86.4.3
--- src/sys/dev/pci/ixgbe/ixgbe.h:1.86.4.2	Fri Oct 13 18:16:51 2023
+++ src/sys/dev/pci/ixgbe/ixgbe.h	Fri Oct 13 18:55:12 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.h,v 1.86.4.2 2023/10/13 18:16:51 martin Exp $ */
+/* $NetBSD: ixgbe.h,v 1.86.4.3 2023/10/13 18:55:12 martin Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -119,19 +119,18 @@
 /* Tunables */
 
 /*
- * TxDescriptors Valid Range: 64-4096 Default Value: 256 This value is the
+ * TxDescriptors Valid Range: 64-4096 Default Value: 2048 This value is the
  * number of transmit descriptors allocated by the driver. Increasing this
  * value allows the driver to queue more transmits. Each descriptor is 16
  * bytes. Performance tests have show the 2K value to be optimal for top
  * performance.
  */
-#define DEFAULT_TXD	1024
-#define PERFORM_TXD	2048
+#define DEFAULT_TXD	2048
 #define MAX_TXD		4096
 #define MIN_TXD		64
 
 /*
- * RxDescriptors Valid Range: 64-4096 Default Value: 256 This value is the
+ * RxDescriptors Valid Range: 64-4096 Default Value: 2048 This value is the
  * number of receive descriptors allocated for each RX queue. Increasing this
  * value allows the driver to buffer more incoming packets. Each descriptor
  * is 16 bytes.  A receive buffer is also allocated for each descriptor.
@@ -140,8 +139,7 @@
  *	against the system mbuf pool limit, you can tune nmbclusters
  *	to adjust for this.
  */
-#define DEFAULT_RXD	1024
-#define PERFORM_RXD	2048
+#define DEFAULT_RXD	2048
 #define MAX_RXD		4096
 #define MIN_RXD		64
 
@@ -202,11 +200,6 @@
 #define IXGBE_82599_SCATTER_MAX	(40 - IXGBE_TX_WTHRESH - 2)
 #define IXGBE_SCATTER_DEFAULT	33
 
-/* Keep older OS drivers building... */
-#if !defined(SYSCTL_ADD_UQUAD)
-#define SYSCTL_ADD_UQUAD SYSCTL_ADD_QUAD
-#endif
-
 /* Defines for printing debug information */
 #define DEBUG_INIT  0
 #define DEBUG_IOCTL 0
@@ -692,19 +685,6 @@ struct ixgbe_softc {
 	"\t2 - tx pause\n" \
 	"\t3 - tx and rx pause"
 
-/* Workaround to make 8.0 buildable */
-#if __FreeBSD_version >= 800000 && __FreeBSD_version < 800504
-static __inline int
-drbr_needs_enqueue(struct ifnet *ifp, struct buf_ring *br)
-{
-#ifdef ALTQ
-	if (ALTQ_IS_ENABLED(&ifp->if_snd))
-		return (1);
-#endif
-	return (!buf_ring_empty(br));
-}
-#endif
-
 /*
  * Find the number of unrefreshed RX descriptors
  */

Index: src/sys/dev/pci/ixgbe/ixgbe_82599.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_82599.c:1.29.4.1 src/sys/dev/pci/ixgbe/ixgbe_82599.c:1.29.4.2
--- src/sys/dev/pci/ixgbe/ixgbe_82599.c:1.29.4.1	Sun Oct  8 14:57:53 2023
+++ src/sys/dev/pci/ixgbe/ixgbe_82599.c	Fri Oct 13 18:55:12 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_82599.c,v 1.29.4.1 2023/10/08 14:57:53 martin Exp $ */
+/* $NetBSD: ixgbe_82599.c,v 1.29.4.2 2023/10/13 18:55:12 martin Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -36,7 +36,7 @@
 /*$FreeBSD: head/sys/dev/ixgbe/ixgbe_82599.c 331224 2018-03-19 20:55:05Z erj $*/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ixgbe_82599.c,v 1.29.4.1 2023/10/08 14:57:53 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe_82599.c,v 1.29.4.2 2023/10/13 18:55:12 martin Exp $");
 
 #include "ixgbe_type.h"
 #include "ixgbe_82599.h"
@@ -571,6 +571,9 @@ enum ixgbe_media_type ixgbe_get_media_ty
 	case IXGBE_DEV_ID_82599_T3_LOM:
 		media_type = ixgbe_media_type_copper;
 		break;
+	case IXGBE_DEV_ID_82599_LS:
+		media_type = ixgbe_media_type_fiber_lco;
+		break;
 	case IXGBE_DEV_ID_82599_QSFP_SF_QP:
 		media_type = ixgbe_media_type_fiber_qsfp;
 		break;
@@ -628,7 +631,6 @@ s32 ixgbe_start_mac_link_82599(struct ix
 
 	DEBUGFUNC("ixgbe_start_mac_link_82599");
 
-
 	/*  reset_pipeline requires us to hold this lock as it writes to
 	 *  AUTOC.
 	 */

Index: src/sys/dev/pci/ixgbe/ixgbe_api.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_api.c:1.28 src/sys/dev/pci/ixgbe/ixgbe_api.c:1.28.4.1
--- src/sys/dev/pci/ixgbe/ixgbe_api.c:1.28	Mon Jun  6 02:16:37 2022
+++ src/sys/dev/pci/ixgbe/ixgbe_api.c	Fri Oct 13 18:55:12 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_api.c,v 1.28 2022/06/06 02:16:37 msaitoh Exp $ */
+/* $NetBSD: ixgbe_api.c,v 1.28.4.1 2023/10/13 18:55:12 martin Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -36,7 +36,7 @@
 /*$FreeBSD: head/sys/dev/ixgbe/ixgbe_api.c 331224 2018-03-19 20:55:05Z erj $*/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ixgbe_api.c,v 1.28 2022/06/06 02:16:37 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe_api.c,v 1.28.4.1 2023/10/13 18:55:12 martin Exp $");
 
 #include "ixgbe_api.h"
 #include "ixgbe_common.h"
@@ -879,7 +879,7 @@ s32 ixgbe_validate_eeprom_checksum(struc
 }
 
 /**
- * ixgbe_eeprom_update_checksum - Updates the EEPROM checksum
+ * ixgbe_update_eeprom_checksum - Updates the EEPROM checksum
  * @hw: pointer to hardware structure
  **/
 s32 ixgbe_update_eeprom_checksum(struct ixgbe_hw *hw)
@@ -1163,8 +1163,6 @@ s32 ixgbe_set_fw_drv_ver(struct ixgbe_hw
 			       IXGBE_NOT_IMPLEMENTED);
 }
 
-
-
 /**
  * ixgbe_dmac_config - Configure DMA Coalescing registers.
  * @hw: pointer to hardware structure

Index: src/sys/dev/pci/ixgbe/ixgbe_bypass.h
diff -u src/sys/dev/pci/ixgbe/ixgbe_bypass.h:1.3.4.1 src/sys/dev/pci/ixgbe/ixgbe_bypass.h:1.3.4.2
--- src/sys/dev/pci/ixgbe/ixgbe_bypass.h:1.3.4.1	Fri Oct 13 18:16:51 2023
+++ src/sys/dev/pci/ixgbe/ixgbe_bypass.h	Fri Oct 13 18:55:12 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_bypass.h,v 1.3.4.1 2023/10/13 18:16:51 martin Exp $ */
+/* $NetBSD: ixgbe_bypass.h,v 1.3.4.2 2023/10/13 18:55:12 martin Exp $ */
 /******************************************************************************
 
   Copyright (c) 2001-2020, Intel Corporation
@@ -36,7 +36,6 @@
 #ifndef _IXGBE_BYPASS_H_
 #define _IXGBE_BYPASS_H_
 
-
 /*
  * The bypass driver needs to set FW to a epoc of the number of
  * seconds we are into this year.  This macro's help support that.

Index: src/sys/dev/pci/ixgbe/ixgbe_common.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_common.c:1.43.4.2 src/sys/dev/pci/ixgbe/ixgbe_common.c:1.43.4.3
--- src/sys/dev/pci/ixgbe/ixgbe_common.c:1.43.4.2	Fri Oct 13 18:16:51 2023
+++ src/sys/dev/pci/ixgbe/ixgbe_common.c	Fri Oct 13 18:55:12 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_common.c,v 1.43.4.2 2023/10/13 18:16:51 martin Exp $ */
+/* $NetBSD: ixgbe_common.c,v 1.43.4.3 2023/10/13 18:55:12 martin Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -36,7 +36,7 @@
 /*$FreeBSD: head/sys/dev/ixgbe/ixgbe_common.c 331224 2018-03-19 20:55:05Z erj $*/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ixgbe_common.c,v 1.43.4.2 2023/10/13 18:16:51 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe_common.c,v 1.43.4.3 2023/10/13 18:55:12 martin Exp $");
 
 #include "ixgbe_common.h"
 #include "ixgbe_phy.h"
@@ -1904,7 +1904,6 @@ static s32 ixgbe_get_eeprom_semaphore(st
 
 	DEBUGFUNC("ixgbe_get_eeprom_semaphore");
 
-
 	/* Get SMBI software semaphore between device drivers first */
 	for (i = 0; i < timeout; i++) {
 		/*
@@ -3389,7 +3388,6 @@ s32 ixgbe_disable_sec_rx_path_generic(st
 
 	DEBUGFUNC("ixgbe_disable_sec_rx_path_generic");
 
-
 	secrxreg = IXGBE_READ_REG(hw, IXGBE_SECRXCTRL);
 	secrxreg |= IXGBE_SECRXCTRL_RX_DIS;
 	IXGBE_WRITE_REG(hw, IXGBE_SECRXCTRL, secrxreg);
@@ -4296,10 +4294,25 @@ s32 ixgbe_check_mac_link_generic(struct 
 			links_reg = IXGBE_READ_REG(hw, IXGBE_LINKS);
 		}
 	} else {
-		if (links_reg & IXGBE_LINKS_UP)
+		if (links_reg & IXGBE_LINKS_UP) {
+			if (ixgbe_need_crosstalk_fix(hw)) {
+				/* Check the link state again after a delay
+				 * to filter out spurious link up
+				 * notifications.
+				 */
+				msec_delay(5);
+				links_reg = IXGBE_READ_REG(hw, IXGBE_LINKS);
+				if (!(links_reg & IXGBE_LINKS_UP)) {
+					*link_up = false;
+					*speed = IXGBE_LINK_SPEED_UNKNOWN;
+					return IXGBE_SUCCESS;
+				}
+
+			}
 			*link_up = TRUE;
-		else
+		} else {
 			*link_up = FALSE;
+		}
 	}
 
 	switch (links_reg & IXGBE_LINKS_SPEED_82599) {

Index: src/sys/dev/pci/ixgbe/ixgbe_common.h
diff -u src/sys/dev/pci/ixgbe/ixgbe_common.h:1.16.4.1 src/sys/dev/pci/ixgbe/ixgbe_common.h:1.16.4.2
--- src/sys/dev/pci/ixgbe/ixgbe_common.h:1.16.4.1	Fri Oct 13 18:16:51 2023
+++ src/sys/dev/pci/ixgbe/ixgbe_common.h	Fri Oct 13 18:55:12 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_common.h,v 1.16.4.1 2023/10/13 18:16:51 martin Exp $ */
+/* $NetBSD: ixgbe_common.h,v 1.16.4.2 2023/10/13 18:55:12 martin Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -45,12 +45,10 @@
 		IXGBE_WRITE_REG(hw, reg + 4, (u32) (value >> 32)); \
 	} while (0)
 #define IXGBE_REMOVED(a) (0)
-#if !defined(NO_READ_PBA_RAW) || !defined(NO_WRITE_PBA_RAW)
 struct ixgbe_pba {
 	u16 word[2];
 	u16 *pba_block;
 };
-#endif
 
 void ixgbe_dcb_get_rtrup2tc_generic(struct ixgbe_hw *hw, u8 *map);
 

Index: src/sys/dev/pci/ixgbe/ixgbe_dcb.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_dcb.c:1.13 src/sys/dev/pci/ixgbe/ixgbe_dcb.c:1.13.4.1
--- src/sys/dev/pci/ixgbe/ixgbe_dcb.c:1.13	Fri Dec 24 05:02:11 2021
+++ src/sys/dev/pci/ixgbe/ixgbe_dcb.c	Fri Oct 13 18:55:12 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_dcb.c,v 1.13 2021/12/24 05:02:11 msaitoh Exp $ */
+/* $NetBSD: ixgbe_dcb.c,v 1.13.4.1 2023/10/13 18:55:12 martin Exp $ */
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
 
@@ -35,7 +35,7 @@
 /*$FreeBSD: head/sys/dev/ixgbe/ixgbe_dcb.c 331224 2018-03-19 20:55:05Z erj $*/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ixgbe_dcb.c,v 1.13 2021/12/24 05:02:11 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe_dcb.c,v 1.13.4.1 2023/10/13 18:55:12 martin Exp $");
 
 #include "ixgbe_type.h"
 #include "ixgbe_dcb.h"
@@ -297,7 +297,7 @@ void ixgbe_dcb_unpack_map_cee(struct ixg
 }
 
 /**
- * ixgbe_dcb_config - Struct containing DCB settings.
+ * ixgbe_dcb_check_config_cee - Struct containing DCB settings.
  * @dcb_config: Pointer to DCB config structure
  *
  * This function checks DCB rules for DCB settings.
@@ -412,10 +412,8 @@ s32 ixgbe_dcb_get_tc_stats(struct ixgbe_
 	case ixgbe_mac_X550:
 	case ixgbe_mac_X550EM_x:
 	case ixgbe_mac_X550EM_a:
-#if !defined(NO_82599_SUPPORT) || !defined(NO_X540_SUPPORT)
 		ret = ixgbe_dcb_get_tc_stats_82599(hw, stats, tc_count);
 		break;
-#endif
 	default:
 		break;
 	}
@@ -443,10 +441,8 @@ s32 ixgbe_dcb_get_pfc_stats(struct ixgbe
 	case ixgbe_mac_X550:
 	case ixgbe_mac_X550EM_x:
 	case ixgbe_mac_X550EM_a:
-#if !defined(NO_82599_SUPPORT) || !defined(NO_X540_SUPPORT)
 		ret = ixgbe_dcb_get_pfc_stats_82599(hw, stats, tc_count);
 		break;
-#endif
 	default:
 		break;
 	}
@@ -485,11 +481,9 @@ s32 ixgbe_dcb_config_rx_arbiter_cee(stru
 	case ixgbe_mac_X550:
 	case ixgbe_mac_X550EM_x:
 	case ixgbe_mac_X550EM_a:
-#if !defined(NO_82599_SUPPORT) || !defined(NO_X540_SUPPORT)
 		ret = ixgbe_dcb_config_rx_arbiter_82599(hw, refill, max, bwgid,
 							tsa, map);
 		break;
-#endif
 	default:
 		break;
 	}
@@ -527,11 +521,9 @@ s32 ixgbe_dcb_config_tx_desc_arbiter_cee
 	case ixgbe_mac_X550:
 	case ixgbe_mac_X550EM_x:
 	case ixgbe_mac_X550EM_a:
-#if !defined(NO_82599_SUPPORT) || !defined(NO_X540_SUPPORT)
 		ret = ixgbe_dcb_config_tx_desc_arbiter_82599(hw, refill, max,
 							     bwgid, tsa);
 		break;
-#endif
 	default:
 		break;
 	}
@@ -571,12 +563,10 @@ s32 ixgbe_dcb_config_tx_data_arbiter_cee
 	case ixgbe_mac_X550:
 	case ixgbe_mac_X550EM_x:
 	case ixgbe_mac_X550EM_a:
-#if !defined(NO_82599_SUPPORT) || !defined(NO_X540_SUPPORT)
 		ret = ixgbe_dcb_config_tx_data_arbiter_82599(hw, refill, max,
 							     bwgid, tsa,
 							     map);
 		break;
-#endif
 	default:
 		break;
 	}
@@ -609,10 +599,8 @@ s32 ixgbe_dcb_config_pfc_cee(struct ixgb
 	case ixgbe_mac_X550:
 	case ixgbe_mac_X550EM_x:
 	case ixgbe_mac_X550EM_a:
-#if !defined(NO_82599_SUPPORT) || !defined(NO_X540_SUPPORT)
 		ret = ixgbe_dcb_config_pfc_82599(hw, pfc_en, map);
 		break;
-#endif
 	default:
 		break;
 	}
@@ -638,10 +626,8 @@ s32 ixgbe_dcb_config_tc_stats(struct ixg
 	case ixgbe_mac_X550:
 	case ixgbe_mac_X550EM_x:
 	case ixgbe_mac_X550EM_a:
-#if !defined(NO_82599_SUPPORT) || !defined(NO_X540_SUPPORT)
 		ret = ixgbe_dcb_config_tc_stats_82599(hw, NULL);
 		break;
-#endif
 	default:
 		break;
 	}
@@ -686,7 +672,6 @@ s32 ixgbe_dcb_hw_config_cee(struct ixgbe
 	case ixgbe_mac_X550:
 	case ixgbe_mac_X550EM_x:
 	case ixgbe_mac_X550EM_a:
-#if !defined(NO_82599_SUPPORT) || !defined(NO_X540_SUPPORT)
 		ixgbe_dcb_config_82599(hw, dcb_config);
 		ret = ixgbe_dcb_hw_config_82599(hw, dcb_config->link_speed,
 						refill, max, bwgid,
@@ -694,7 +679,6 @@ s32 ixgbe_dcb_hw_config_cee(struct ixgbe
 
 		ixgbe_dcb_config_tc_stats_82599(hw, dcb_config);
 		break;
-#endif
 	default:
 		break;
 	}
@@ -721,10 +705,8 @@ s32 ixgbe_dcb_config_pfc(struct ixgbe_hw
 	case ixgbe_mac_X550:
 	case ixgbe_mac_X550EM_x:
 	case ixgbe_mac_X550EM_a:
-#if !defined(NO_82599_SUPPORT) || !defined(NO_X540_SUPPORT)
 		ret = ixgbe_dcb_config_pfc_82599(hw, pfc_en, map);
 		break;
-#endif
 	default:
 		break;
 	}
@@ -747,7 +729,6 @@ s32 ixgbe_dcb_hw_config(struct ixgbe_hw 
 	case ixgbe_mac_X550:
 	case ixgbe_mac_X550EM_x:
 	case ixgbe_mac_X550EM_a:
-#if !defined(NO_82599_SUPPORT) || !defined(NO_X540_SUPPORT)
 		ixgbe_dcb_config_rx_arbiter_82599(hw, refill, max, bwg_id,
 						  tsa, map);
 		ixgbe_dcb_config_tx_desc_arbiter_82599(hw, refill, max, bwg_id,
@@ -755,7 +736,6 @@ s32 ixgbe_dcb_hw_config(struct ixgbe_hw 
 		ixgbe_dcb_config_tx_data_arbiter_82599(hw, refill, max, bwg_id,
 						       tsa, map);
 		break;
-#endif
 	default:
 		break;
 	}

Index: src/sys/dev/pci/ixgbe/ixgbe_dcb_82598.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_dcb_82598.c:1.12 src/sys/dev/pci/ixgbe/ixgbe_dcb_82598.c:1.12.4.1
--- src/sys/dev/pci/ixgbe/ixgbe_dcb_82598.c:1.12	Fri Dec 24 05:02:11 2021
+++ src/sys/dev/pci/ixgbe/ixgbe_dcb_82598.c	Fri Oct 13 18:55:12 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_dcb_82598.c,v 1.12 2021/12/24 05:02:11 msaitoh Exp $ */
+/* $NetBSD: ixgbe_dcb_82598.c,v 1.12.4.1 2023/10/13 18:55:12 martin Exp $ */
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
 
@@ -35,7 +35,7 @@
 /*$FreeBSD: head/sys/dev/ixgbe/ixgbe_dcb_82598.c 331224 2018-03-19 20:55:05Z erj $*/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ixgbe_dcb_82598.c,v 1.12 2021/12/24 05:02:11 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe_dcb_82598.c,v 1.12.4.1 2023/10/13 18:55:12 martin Exp $");
 
 #include "ixgbe_type.h"
 #include "ixgbe_dcb.h"
@@ -364,6 +364,5 @@ s32 ixgbe_dcb_hw_config_82598(struct ixg
 					       tsa);
 	ixgbe_dcb_config_tc_stats_82598(hw);
 
-
 	return IXGBE_SUCCESS;
 }

Index: src/sys/dev/pci/ixgbe/ixgbe_type.h
diff -u src/sys/dev/pci/ixgbe/ixgbe_type.h:1.55.4.3 src/sys/dev/pci/ixgbe/ixgbe_type.h:1.55.4.4
--- src/sys/dev/pci/ixgbe/ixgbe_type.h:1.55.4.3	Fri Oct 13 18:16:51 2023
+++ src/sys/dev/pci/ixgbe/ixgbe_type.h	Fri Oct 13 18:55:12 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_type.h,v 1.55.4.3 2023/10/13 18:16:51 martin Exp $ */
+/* $NetBSD: ixgbe_type.h,v 1.55.4.4 2023/10/13 18:55:12 martin Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -108,6 +108,7 @@
 #define IXGBE_DEV_ID_82599_KR			0x1517
 #define IXGBE_DEV_ID_82599_COMBO_BACKPLANE	PCI_PRODUCT_INTEL_82599_COMBO_BACKPLANE
 #define IXGBE_SUBDEV_ID_82599_KX4_KR_MEZZ	0x000C
+#define IXGBE_DEV_ID_82599_LS			0x154F
 #define IXGBE_DEV_ID_82599_CX4			PCI_PRODUCT_INTEL_82599_CX4
 #define IXGBE_DEV_ID_82599_SFP			PCI_PRODUCT_INTEL_82599_SFP
 #define IXGBE_SUBDEV_ID_82599_SFP_WOL0		0x1071
@@ -3628,8 +3629,8 @@ union ixgbe_atr_input {
 	 * bkt_hash	- 2 bytes
 	 */
 	struct {
-		u8     vm_pool;
-		u8     flow_type;
+		u8 vm_pool;
+		u8 flow_type;
 		__be16 vlan_id;
 		__be32 dst_ip[4];
 		__be32 src_ip[4];
@@ -3660,7 +3661,6 @@ union ixgbe_atr_hash_dword {
 	__be32 dword;
 };
 
-
 #define IXGBE_MVALS_INIT(m)	\
 	IXGBE_CAT(EEC, m),		\
 	IXGBE_CAT(FLA, m),		\
@@ -3796,6 +3796,7 @@ enum ixgbe_media_type {
 	ixgbe_media_type_fiber,
 	ixgbe_media_type_fiber_fixed,
 	ixgbe_media_type_fiber_qsfp,
+	ixgbe_media_type_fiber_lco,
 	ixgbe_media_type_copper,
 	ixgbe_media_type_backplane,
 	ixgbe_media_type_cx4,
@@ -4165,11 +4166,11 @@ struct ixgbe_link_info {
 };
 
 struct ixgbe_eeprom_info {
-	struct ixgbe_eeprom_operations	ops;
-	enum ixgbe_eeprom_type		type;
-	u32				semaphore_delay;
-	u16				word_size;
-	u16				address_bits;
+	struct ixgbe_eeprom_operations ops;
+	enum ixgbe_eeprom_type type;
+	u32 semaphore_delay;
+	u16 word_size;
+	u16 address_bits;
 	u16 word_page_size;
 	u16 ctrl_word_3;
 	u8  nvm_image_ver_high;
@@ -4178,34 +4179,34 @@ struct ixgbe_eeprom_info {
 
 #define IXGBE_FLAGS_DOUBLE_RESET_REQUIRED	0x01
 struct ixgbe_mac_info {
-	struct ixgbe_mac_operations	ops;
-	enum ixgbe_mac_type		type;
-	u8				addr[IXGBE_ETH_LENGTH_OF_ADDRESS];
-	u8				perm_addr[IXGBE_ETH_LENGTH_OF_ADDRESS];
-	u8				san_addr[IXGBE_ETH_LENGTH_OF_ADDRESS];
+	struct ixgbe_mac_operations ops;
+	enum ixgbe_mac_type type;
+	u8 addr[IXGBE_ETH_LENGTH_OF_ADDRESS];
+	u8 perm_addr[IXGBE_ETH_LENGTH_OF_ADDRESS];
+	u8 san_addr[IXGBE_ETH_LENGTH_OF_ADDRESS];
 	/* prefix for World Wide Node Name (WWNN) */
-	u16				wwnn_prefix;
+	u16 wwnn_prefix;
 	/* prefix for World Wide Port Name (WWPN) */
-	u16				wwpn_prefix;
+	u16 wwpn_prefix;
 #define IXGBE_MAX_MTA			128
-	u32				mta_shadow[IXGBE_MAX_MTA];
-	s32				mc_filter_type;
-	u32				mcft_size;
-	u32				vft_size;
-	u32				num_rar_entries;
-	u32				rar_highwater;
-	u32				rx_pb_size;
-	u32				max_tx_queues;
-	u32				max_rx_queues;
-	u32				orig_autoc;
+	u32 mta_shadow[IXGBE_MAX_MTA];
+	s32 mc_filter_type;
+	u32 mcft_size;
+	u32 vft_size;
+	u32 num_rar_entries;
+	u32 rar_highwater;
+	u32 rx_pb_size;
+	u32 max_tx_queues;
+	u32 max_rx_queues;
+	u32 orig_autoc;
 	u8  san_mac_rar_index;
 	bool get_link_status;
-	u32				orig_autoc2;
+	u32 orig_autoc2;
 	u16 max_msix_vectors;
 	bool arc_subsystem_valid;
-	bool				orig_link_settings_stored;
-	bool				autotry_restart;
-	u8				flags;
+	bool orig_link_settings_stored;
+	bool autotry_restart;
+	u8 flags;
 	struct ixgbe_dmac_config dmac_config;
 	bool set_lben;
 	u32  max_link_up_time;
@@ -4213,25 +4214,25 @@ struct ixgbe_mac_info {
 };
 
 struct ixgbe_phy_info {
-	struct ixgbe_phy_operations	ops;
-	enum ixgbe_phy_type		type;
-	u32				addr;
-	u32				id;
-	enum ixgbe_sfp_type		sfp_type;
-	bool				sfp_setup_needed;
-	u32				revision;
-	enum ixgbe_media_type		media_type;
+	struct ixgbe_phy_operations ops;
+	enum ixgbe_phy_type type;
+	u32 addr;
+	u32 id;
+	enum ixgbe_sfp_type sfp_type;
+	bool sfp_setup_needed;
+	u32 revision;
+	enum ixgbe_media_type media_type;
 	u32 phy_semaphore_mask;
-	bool				reset_disable;
-	bool				force_10_100_autonego;
-	ixgbe_autoneg_advertised	autoneg_advertised;
+	bool reset_disable;
+	bool force_10_100_autonego;
+	ixgbe_autoneg_advertised autoneg_advertised;
 	ixgbe_link_speed speeds_supported;
 	ixgbe_link_speed eee_speeds_supported;
 	ixgbe_link_speed eee_speeds_advertised;
-	enum ixgbe_smart_speed		smart_speed;
-	bool				smart_speed_active;
-	bool				multispeed_fiber;
-	bool				reset_if_overtemp;
+	enum ixgbe_smart_speed smart_speed;
+	bool smart_speed_active;
+	bool multispeed_fiber;
+	bool reset_if_overtemp;
 	bool qsfp_shared_i2c_bus;
 	u32 nw_mng_if_sel;
 };
@@ -4240,21 +4241,21 @@ struct ixgbe_phy_info {
 
 struct ixgbe_hw {
 	struct ixgbe_softc *back;
-	struct ixgbe_mac_info		mac;
-	struct ixgbe_addr_filter_info	addr_ctrl;
-	struct ixgbe_fc_info		fc;
-	struct ixgbe_phy_info		phy;
+	struct ixgbe_mac_info mac;
+	struct ixgbe_addr_filter_info addr_ctrl;
+	struct ixgbe_fc_info fc;
+	struct ixgbe_phy_info phy;
 	struct ixgbe_link_info link;
-	struct ixgbe_eeprom_info	eeprom;
-	struct ixgbe_bus_info		bus;
-	struct ixgbe_mbx_info		mbx;
+	struct ixgbe_eeprom_info eeprom;
+	struct ixgbe_bus_info bus;
+	struct ixgbe_mbx_info mbx;
 	const u32 *mvals;
-	u16				device_id;
-	u16				vendor_id;
-	u16				subsystem_device_id;
-	u16				subsystem_vendor_id;
-	u8				revision_id;
-	bool				adapter_stopped;
+	u16 device_id;
+	u16 vendor_id;
+	u16 subsystem_device_id;
+	u16 subsystem_vendor_id;
+	u8 revision_id;
+	bool adapter_stopped;
 	int api_version;
 	bool force_full_reset;
 	bool allow_unsupported_sfp;
@@ -4267,7 +4268,6 @@ struct ixgbe_hw {
 #define ixgbe_call_func(hw, func, params, error) \
 		(func != NULL) ? func params : error
 
-
 /* Error Codes */
 #define IXGBE_SUCCESS				0
 #define IXGBE_ERR_EEPROM			-1
@@ -4318,7 +4318,6 @@ struct ixgbe_hw {
 #define IXGBE_ERR_FAN_FAILURE			-52 /* XXX NetBSD */
 #define IXGBE_NOT_IMPLEMENTED			0x7FFFFFFF
 
-
 #define BYPASS_PAGE_CTL0	0x00000000
 #define BYPASS_PAGE_CTL1	0x40000000
 #define BYPASS_PAGE_CTL2	0x80000000

Index: src/sys/dev/pci/ixgbe/ixgbe_x540.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_x540.c:1.23 src/sys/dev/pci/ixgbe/ixgbe_x540.c:1.23.4.1
--- src/sys/dev/pci/ixgbe/ixgbe_x540.c:1.23	Fri Dec 24 05:11:04 2021
+++ src/sys/dev/pci/ixgbe/ixgbe_x540.c	Fri Oct 13 18:55:12 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_x540.c,v 1.23 2021/12/24 05:11:04 msaitoh Exp $ */
+/* $NetBSD: ixgbe_x540.c,v 1.23.4.1 2023/10/13 18:55:12 martin Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -36,7 +36,7 @@
 /*$FreeBSD: head/sys/dev/ixgbe/ixgbe_x540.c 331224 2018-03-19 20:55:05Z erj $*/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ixgbe_x540.c,v 1.23 2021/12/24 05:11:04 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe_x540.c,v 1.23.4.1 2023/10/13 18:55:12 martin Exp $");
 
 #include "ixgbe_x540.h"
 #include "ixgbe_type.h"
@@ -75,7 +75,6 @@ s32 ixgbe_init_ops_X540(struct ixgbe_hw 
 	ret_val = ixgbe_init_phy_ops_generic(hw);
 	ret_val = ixgbe_init_ops_generic(hw);
 
-
 	/* EEPROM */
 	eeprom->ops.init_params = ixgbe_init_eeprom_params_X540;
 	eeprom->ops.read = ixgbe_read_eerd_X540;
@@ -135,7 +134,6 @@ s32 ixgbe_init_ops_X540(struct ixgbe_hw 
 	mac->ops.bypass_set = ixgbe_bypass_set_generic;
 	mac->ops.bypass_rd_eep = ixgbe_bypass_rd_eep_generic;
 
-
 	mac->mcft_size		= IXGBE_X540_MC_TBL_SIZE;
 	mac->vft_size		= IXGBE_X540_VFT_TBL_SIZE;
 	mac->num_rar_entries	= IXGBE_X540_RAR_ENTRIES;

Index: src/sys/dev/pci/ixgbe/ixgbe_x550.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_x550.c:1.26.4.1 src/sys/dev/pci/ixgbe/ixgbe_x550.c:1.26.4.2
--- src/sys/dev/pci/ixgbe/ixgbe_x550.c:1.26.4.1	Fri Oct 13 18:16:50 2023
+++ src/sys/dev/pci/ixgbe/ixgbe_x550.c	Fri Oct 13 18:55:12 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_x550.c,v 1.26.4.1 2023/10/13 18:16:50 martin Exp $ */
+/* $NetBSD: ixgbe_x550.c,v 1.26.4.2 2023/10/13 18:55:12 martin Exp $ */
 
 /******************************************************************************
 
@@ -35,7 +35,7 @@
 /*$FreeBSD: head/sys/dev/ixgbe/ixgbe_x550.c 331224 2018-03-19 20:55:05Z erj $*/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ixgbe_x550.c,v 1.26.4.1 2023/10/13 18:16:50 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe_x550.c,v 1.26.4.2 2023/10/13 18:55:12 martin Exp $");
 
 #include "ixgbe_x550.h"
 #include "ixgbe_x540.h"
@@ -786,7 +786,6 @@ s32 ixgbe_init_ops_X550EM(struct ixgbe_h
 	if (mac->ops.get_media_type(hw) != ixgbe_media_type_copper)
 		phy->ops.set_phy_power = NULL;
 
-
 	/* EEPROM */
 	eeprom->ops.init_params = ixgbe_init_eeprom_params_X540;
 	eeprom->ops.read = ixgbe_read_ee_hostif_X550;
@@ -922,7 +921,7 @@ out:
 }
 
 /**
- * ixgbe_fc_autoneg_fw _ Set up flow control for FW-controlled PHYs
+ * ixgbe_fc_autoneg_fw - Set up flow control for FW-controlled PHYs
  * @hw: pointer to hardware structure
  *
  * Called at init time to set up flow control.
@@ -2048,7 +2047,7 @@ void ixgbe_init_mac_link_ops_X550em(stru
 }
 
 /**
- * ixgbe_get_link_capabilities_x550em - Determines link capabilities
+ * ixgbe_get_link_capabilities_X550em - Determines link capabilities
  * @hw: pointer to hardware structure
  * @speed: pointer to link speed
  * @autoneg: TRUE when autoneg or autotry is enabled
@@ -2059,7 +2058,6 @@ s32 ixgbe_get_link_capabilities_X550em(s
 {
 	DEBUGFUNC("ixgbe_get_link_capabilities_X550em");
 
-
 	if (hw->phy.type == ixgbe_phy_fw) {
 		*autoneg = TRUE;
 		*speed = hw->phy.speeds_supported;
@@ -3416,7 +3414,7 @@ out:
 }
 
 /**
- * ixgbe_write_ee_hostif_X550 - Write EEPROM word using hostif
+ * ixgbe_write_ee_hostif_data_X550 - Write EEPROM word using hostif
  * @hw: pointer to hardware structure
  * @offset: offset of  word in the EEPROM to write
  * @data: word write to the EEPROM
@@ -3883,7 +3881,7 @@ u64 ixgbe_get_supported_physical_layer_X
 }
 
 /**
- * ixgbe_get_bus_info_x550em - Set PCI bus info
+ * ixgbe_get_bus_info_X550em - Set PCI bus info
  * @hw: pointer to hardware structure
  *
  * Sets bus link width and speed to unknown because X550em is
@@ -3948,7 +3946,7 @@ void ixgbe_disable_rx_x550(struct ixgbe_
 }
 
 /**
- * ixgbe_enter_lplu_x550em - Transition to low power states
+ * ixgbe_enter_lplu_t_x550em - Transition to low power states
  * @hw: pointer to hardware structure
  *
  * Configures Low Power Link Up on transition to low power states
@@ -4056,7 +4054,7 @@ s32 ixgbe_enter_lplu_t_x550em(struct ixg
 }
 
 /**
- * ixgbe_get_lcd_x550em - Determine lowest common denominator
+ * ixgbe_get_lcd_t_x550em - Determine lowest common denominator
  * @hw: pointer to hardware structure
  * @lcd_speed: pointer to lowest common link speed
  *

Index: src/sys/dev/pci/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.183.4.2 src/sys/dev/pci/ixgbe/ixv.c:1.183.4.3
--- src/sys/dev/pci/ixgbe/ixv.c:1.183.4.2	Fri Oct 13 18:16:51 2023
+++ src/sys/dev/pci/ixgbe/ixv.c	Fri Oct 13 18:55:12 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ixv.c,v 1.183.4.2 2023/10/13 18:16:51 martin Exp $ */
+/* $NetBSD: ixv.c,v 1.183.4.3 2023/10/13 18:55:12 martin Exp $ */
 
 /******************************************************************************
 
@@ -35,7 +35,7 @@
 /*$FreeBSD: head/sys/dev/ixgbe/if_ixv.c 331224 2018-03-19 20:55:05Z erj $*/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.183.4.2 2023/10/13 18:16:51 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.183.4.3 2023/10/13 18:55:12 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -217,11 +217,11 @@ static bool ixv_txrx_workqueue = false;
  * setting higher than RX as this seems
  * the better performing choice.
  */
-static int ixv_txd = PERFORM_TXD;
+static int ixv_txd = DEFAULT_TXD;
 TUNABLE_INT("hw.ixv.txd", &ixv_txd);
 
 /* Number of RX descriptors per ring */
-static int ixv_rxd = PERFORM_RXD;
+static int ixv_rxd = DEFAULT_RXD;
 TUNABLE_INT("hw.ixv.rxd", &ixv_rxd);
 
 /* Legacy Transmit (single queue) */
@@ -501,14 +501,26 @@ ixv_attach(device_t parent, device_t dev
 	/* Do descriptor calc and sanity checks */
 	if (((ixv_txd * sizeof(union ixgbe_adv_tx_desc)) % DBA_ALIGN) != 0 ||
 	    ixv_txd < MIN_TXD || ixv_txd > MAX_TXD) {
-		aprint_error_dev(dev, "TXD config issue, using default!\n");
+		aprint_error_dev(dev, "Invalid TX ring size (%d). "
+		    "It must be between %d and %d, "
+		    "inclusive, and must be a multiple of %zu. "
+		    "Using default value of %d instead.\n",
+		    ixv_txd, MIN_TXD, MAX_TXD,
+		    DBA_ALIGN / sizeof(union ixgbe_adv_tx_desc),
+		    DEFAULT_TXD);
 		sc->num_tx_desc = DEFAULT_TXD;
 	} else
 		sc->num_tx_desc = ixv_txd;
 
 	if (((ixv_rxd * sizeof(union ixgbe_adv_rx_desc)) % DBA_ALIGN) != 0 ||
 	    ixv_rxd < MIN_RXD || ixv_rxd > MAX_RXD) {
-		aprint_error_dev(dev, "RXD config issue, using default!\n");
+		aprint_error_dev(dev, "Invalid RX ring size (%d). "
+		    "It must be between %d and %d, "
+		    "inclusive, and must be a multiple of %zu. "
+		    "Using default value of %d instead.\n",
+		    ixv_rxd, MIN_RXD, MAX_RXD,
+		    DBA_ALIGN / sizeof(union ixgbe_adv_rx_desc),
+		    DEFAULT_RXD);
 		sc->num_rx_desc = DEFAULT_RXD;
 	} else
 		sc->num_rx_desc = ixv_rxd;
@@ -811,17 +823,17 @@ ixv_init_locked(struct ixgbe_softc *sc)
 	/* OK to schedule workqueues. */
 	sc->schedule_wqs_ok = true;
 
-	/* And now turn on interrupts */
-	ixv_enable_intr(sc);
-
 	/* Update saved flags. See ixgbe_ifflags_cb() */
 	sc->if_flags = ifp->if_flags;
 	sc->ec_capenable = sc->osdep.ec.ec_capenable;
 
-	/* Now inform the stack we're ready */
+	/* Inform the stack we're ready */
 	ifp->if_flags |= IFF_RUNNING;
 	ifp->if_flags &= ~IFF_OACTIVE;
 
+	/* And now turn on interrupts */
+	ixv_enable_intr(sc);
+
 	return;
 } /* ixv_init_locked */
 

Reply via email to