Module Name:    src
Committed By:   martin
Date:           Wed Oct 18 14:05:28 UTC 2023

Modified Files:
        src/sys/dev/pci/ixgbe [netbsd-9]: 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 #1753:

        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.h                1.5
        sys/dev/pci/ixgbe/ixgbe_common.c                1.46-1.47
        sys/dev/pci/ixgbe/ixgbe_common.h                1.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

- 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.54.2.13 -r1.54.2.14 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.199.2.28 -r1.199.2.29 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.56.2.11 -r1.56.2.12 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.21.4.5 -r1.21.4.6 src/sys/dev/pci/ixgbe/ixgbe_82599.c
cvs rdiff -u -r1.23.2.4 -r1.23.2.5 src/sys/dev/pci/ixgbe/ixgbe_api.c
cvs rdiff -u -r1.1.14.3 -r1.1.14.4 src/sys/dev/pci/ixgbe/ixgbe_bypass.h
cvs rdiff -u -r1.25.2.8 -r1.25.2.9 src/sys/dev/pci/ixgbe/ixgbe_common.c
cvs rdiff -u -r1.14.2.2 -r1.14.2.3 src/sys/dev/pci/ixgbe/ixgbe_common.h
cvs rdiff -u -r1.9.4.2 -r1.9.4.3 src/sys/dev/pci/ixgbe/ixgbe_dcb.c
cvs rdiff -u -r1.7.8.2 -r1.7.8.3 src/sys/dev/pci/ixgbe/ixgbe_dcb_82598.c
cvs rdiff -u -r1.41.2.10 -r1.41.2.11 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.16.8.4 -r1.16.8.5 src/sys/dev/pci/ixgbe/ixgbe_x540.c
cvs rdiff -u -r1.15.2.7 -r1.15.2.8 src/sys/dev/pci/ixgbe/ixgbe_x550.c
cvs rdiff -u -r1.125.2.23 -r1.125.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.54.2.13 src/sys/dev/pci/ixgbe/ix_txrx.c:1.54.2.14
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.54.2.13	Fri Oct 13 18:20:30 2023
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Wed Oct 18 14:05:27 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.54.2.13 2023/10/13 18:20:30 martin Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.54.2.14 2023/10/18 14:05:27 martin Exp $ */
 
 /******************************************************************************
 
@@ -64,7 +64,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.54.2.13 2023/10/13 18:20:30 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.54.2.14 2023/10/18 14:05:27 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 = &sc->hw;
-	u32              rscctrl, rdrxctl;
+	struct ixgbe_softc *sc = rxr->sc;
+	struct ixgbe_hw	*hw = &sc->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
+                 *  - 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.199.2.28 src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.29
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.28	Fri Oct 13 18:20:30 2023
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Wed Oct 18 14:05:27 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.199.2.28 2023/10/13 18:20:30 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.199.2.29 2023/10/18 14:05:27 martin Exp $ */
 
 /******************************************************************************
 
@@ -64,7 +64,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.199.2.28 2023/10/13 18:20:30 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.199.2.29 2023/10/18 14:05:27 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},
@@ -368,12 +369,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");
 
@@ -760,8 +761,6 @@ ixgbe_initialize_transmit_units(struct i
 		rttdcs &= ~IXGBE_RTTDCS_ARBDIS;
 		IXGBE_WRITE_REG(hw, IXGBE_RTTDCS, rttdcs);
 	}
-
-	return;
 } /* ixgbe_initialize_transmit_units */
 
 /************************************************************************
@@ -780,7 +779,7 @@ ixgbe_attach(device_t parent, device_t d
 	struct ixgbe_hw *hw;
 	int		error = -1;
 	u32		ctrl_ext;
-	u16		high, low, nvmreg;
+	u16		high, low, nvmreg, dev_caps;
 	pcireg_t	id, subid;
 	const ixgbe_vendor_info_t *ent;
 	struct pci_attach_args *pa = aux;
@@ -927,14 +926,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;
@@ -1243,10 +1254,15 @@ ixgbe_attach(device_t parent, device_t d
 	if (sc->feat_en & IXGBE_FEATURE_NETMAP)
 		ixgbe_netmap_attach(sc);
 
+	/* Print some flags */
 	snprintb(buf, sizeof(buf), IXGBE_FEATURE_FLAGS, sc->feat_cap);
 	aprint_verbose_dev(dev, "feature cap %s\n", buf);
 	snprintb(buf, sizeof(buf), IXGBE_FEATURE_FLAGS, sc->feat_en);
 	aprint_verbose_dev(dev, "feature ena %s\n", buf);
+	if (ixgbe_get_device_caps(hw, &dev_caps) == 0) {
+		snprintb(buf, sizeof(buf), IXGBE_DEVICE_CAPS_FLAGS, dev_caps);
+		aprint_verbose_dev(dev, "device cap %s\n", buf);
+	}
 
 	if (pmf_device_register(dev, ixgbe_suspend, ixgbe_resume))
 		pmf_class_network_register(dev, sc->ifp);
@@ -3319,9 +3335,9 @@ ixgbe_sysctl_interrupt_rate_handler(SYSC
 			    && (reg < IXGBE_MIN_RSC_EITR_10G1G))
 				return EINVAL;
 		}
-		ixgbe_max_interrupt_rate = rate;
+		sc->max_interrupt_rate = rate;
 	} else
-		ixgbe_max_interrupt_rate = 0;
+		sc->max_interrupt_rate = 0;
 	ixgbe_eitr_write(sc, que->msix, reg);
 
 	return (0);
@@ -3426,6 +3442,7 @@ ixgbe_add_device_sysctls(struct ixgbe_so
 		aprint_error_dev(dev, "could not create sysctl\n");
 
 	sc->enable_aim = ixgbe_enable_aim;
+	sc->max_interrupt_rate = ixgbe_max_interrupt_rate;
 	if (sysctl_createv(log, 0, &rnode, &cnode, CTLFLAG_READWRITE,
 	    CTLTYPE_BOOL, "enable_aim", SYSCTL_DESCR("Interrupt Moderation"),
 	    NULL, 0, &sc->enable_aim, 0, CTL_CREATE, CTL_EOL) != 0)
@@ -4237,9 +4254,6 @@ ixgbe_init_locked(struct ixgbe_softc *sc
 	/* Setup DMA Coalescing */
 	ixgbe_config_dmac(sc);
 
-	/* 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);
@@ -4251,9 +4265,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 */
 
@@ -4334,8 +4351,8 @@ ixgbe_configure_ivars(struct ixgbe_softc
 	struct ix_queue *que = sc->queues;
 	u32		newitr;
 
-	if (ixgbe_max_interrupt_rate > 0)
-		newitr = (4000000 / ixgbe_max_interrupt_rate) & 0x0FF8;
+	if (sc->max_interrupt_rate > 0)
+		newitr = (4000000 / sc->max_interrupt_rate) & 0x0FF8;
 	else {
 		/*
 		 * Disable DMA coalescing if interrupt moderation is
@@ -4922,7 +4939,7 @@ ixgbe_update_link_status(struct ixgbe_so
 			for (int i = 0; i < sc->num_queues; i++, que++)
 				que->eitr_setting = 0;
 
-			if (sc->link_speed == IXGBE_LINK_SPEED_10GB_FULL){
+			if (sc->link_speed == IXGBE_LINK_SPEED_10GB_FULL) {
 				/*
 				 *  Discard count for both MAC Local Fault and
 				 * Remote Fault because those registers are
@@ -5150,7 +5167,7 @@ ixgbe_legacy_irq(void *arg)
 	struct ixgbe_softc *sc = que->sc;
 	struct ixgbe_hw	*hw = &sc->hw;
 	struct ifnet	*ifp = sc->ifp;
-	struct		tx_ring *txr = sc->tx_rings;
+	struct tx_ring	*txr = sc->tx_rings;
 	u32		eicr;
 	u32		eims_orig;
 	u32		eims_enable = 0;
@@ -6709,8 +6726,8 @@ static int
 ixgbe_allocate_msix(struct ixgbe_softc *sc, const struct pci_attach_args *pa)
 {
 	device_t	dev = sc->dev;
-	struct		ix_queue *que = sc->queues;
-	struct		tx_ring *txr = sc->tx_rings;
+	struct ix_queue	*que = sc->queues;
+	struct tx_ring	*txr = sc->tx_rings;
 	pci_chipset_tag_t pc;
 	char		intrbuf[PCI_INTRSTR_LEN];
 	char		intr_xname[32];
@@ -6975,9 +6992,6 @@ ixgbe_configure_interrupts(struct ixgbe_
 		queues = uimin(queues,
 		    uimin(mac->max_tx_queues, mac->max_rx_queues));
 
-	/* reflect correct sysctl value */
-	ixgbe_num_queues = queues;
-
 	/*
 	 * Want one vector (RX/TX pair) per queue
 	 * plus an additional for Link.

Index: src/sys/dev/pci/ixgbe/ixgbe.h
diff -u src/sys/dev/pci/ixgbe/ixgbe.h:1.56.2.11 src/sys/dev/pci/ixgbe/ixgbe.h:1.56.2.12
--- src/sys/dev/pci/ixgbe/ixgbe.h:1.56.2.11	Fri Oct 13 18:20:30 2023
+++ src/sys/dev/pci/ixgbe/ixgbe.h	Wed Oct 18 14:05:27 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.h,v 1.56.2.11 2023/10/13 18:20:30 martin Exp $ */
+/* $NetBSD: ixgbe.h,v 1.56.2.12 2023/10/18 14:05:27 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
@@ -502,6 +495,7 @@ struct ixgbe_softc {
 	/* Info about the interface */
 	int			advertise;  /* link speeds */
 	bool			enable_aim; /* adaptive interrupt moderation */
+	int			max_interrupt_rate;
 	int			link_active; /* Use LINK_STATE_* value */
 	u16			max_frame_size;
 	u16			num_segs;
@@ -681,19 +675,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.21.4.5 src/sys/dev/pci/ixgbe/ixgbe_82599.c:1.21.4.6
--- src/sys/dev/pci/ixgbe/ixgbe_82599.c:1.21.4.5	Sun Oct  8 15:13:09 2023
+++ src/sys/dev/pci/ixgbe/ixgbe_82599.c	Wed Oct 18 14:05:27 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_82599.c,v 1.21.4.5 2023/10/08 15:13:09 martin Exp $ */
+/* $NetBSD: ixgbe_82599.c,v 1.21.4.6 2023/10/18 14:05:27 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.21.4.5 2023/10/08 15:13:09 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe_82599.c,v 1.21.4.6 2023/10/18 14:05:27 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.23.2.4 src/sys/dev/pci/ixgbe/ixgbe_api.c:1.23.2.5
--- src/sys/dev/pci/ixgbe/ixgbe_api.c:1.23.2.4	Mon Jan 23 14:04:42 2023
+++ src/sys/dev/pci/ixgbe/ixgbe_api.c	Wed Oct 18 14:05:27 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_api.c,v 1.23.2.4 2023/01/23 14:04:42 martin Exp $ */
+/* $NetBSD: ixgbe_api.c,v 1.23.2.5 2023/10/18 14:05:27 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.23.2.4 2023/01/23 14:04:42 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe_api.c,v 1.23.2.5 2023/10/18 14:05:27 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.1.14.3 src/sys/dev/pci/ixgbe/ixgbe_bypass.h:1.1.14.4
--- src/sys/dev/pci/ixgbe/ixgbe_bypass.h:1.1.14.3	Fri Oct 13 18:20:30 2023
+++ src/sys/dev/pci/ixgbe/ixgbe_bypass.h	Wed Oct 18 14:05:27 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_bypass.h,v 1.1.14.3 2023/10/13 18:20:30 martin Exp $ */
+/* $NetBSD: ixgbe_bypass.h,v 1.1.14.4 2023/10/18 14:05:27 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.25.2.8 src/sys/dev/pci/ixgbe/ixgbe_common.c:1.25.2.9
--- src/sys/dev/pci/ixgbe/ixgbe_common.c:1.25.2.8	Fri Oct 13 18:20:30 2023
+++ src/sys/dev/pci/ixgbe/ixgbe_common.c	Wed Oct 18 14:05:27 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_common.c,v 1.25.2.8 2023/10/13 18:20:30 martin Exp $ */
+/* $NetBSD: ixgbe_common.c,v 1.25.2.9 2023/10/18 14:05:27 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.25.2.8 2023/10/13 18:20:30 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe_common.c,v 1.25.2.9 2023/10/18 14:05:27 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);
@@ -4313,10 +4311,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.14.2.2 src/sys/dev/pci/ixgbe/ixgbe_common.h:1.14.2.3
--- src/sys/dev/pci/ixgbe/ixgbe_common.h:1.14.2.2	Fri Oct 13 18:20:30 2023
+++ src/sys/dev/pci/ixgbe/ixgbe_common.h	Wed Oct 18 14:05:27 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_common.h,v 1.14.2.2 2023/10/13 18:20:30 martin Exp $ */
+/* $NetBSD: ixgbe_common.h,v 1.14.2.3 2023/10/18 14:05:27 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.9.4.2 src/sys/dev/pci/ixgbe/ixgbe_dcb.c:1.9.4.3
--- src/sys/dev/pci/ixgbe/ixgbe_dcb.c:1.9.4.2	Sun Jan 30 15:58:28 2022
+++ src/sys/dev/pci/ixgbe/ixgbe_dcb.c	Wed Oct 18 14:05:27 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_dcb.c,v 1.9.4.2 2022/01/30 15:58:28 martin Exp $ */
+/* $NetBSD: ixgbe_dcb.c,v 1.9.4.3 2023/10/18 14:05:27 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.9.4.2 2022/01/30 15:58:28 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe_dcb.c,v 1.9.4.3 2023/10/18 14:05:27 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.7.8.2 src/sys/dev/pci/ixgbe/ixgbe_dcb_82598.c:1.7.8.3
--- src/sys/dev/pci/ixgbe/ixgbe_dcb_82598.c:1.7.8.2	Sun Jan 30 15:58:28 2022
+++ src/sys/dev/pci/ixgbe/ixgbe_dcb_82598.c	Wed Oct 18 14:05:27 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_dcb_82598.c,v 1.7.8.2 2022/01/30 15:58:28 martin Exp $ */
+/* $NetBSD: ixgbe_dcb_82598.c,v 1.7.8.3 2023/10/18 14:05:27 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.7.8.2 2022/01/30 15:58:28 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe_dcb_82598.c,v 1.7.8.3 2023/10/18 14:05:27 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.41.2.10 src/sys/dev/pci/ixgbe/ixgbe_type.h:1.41.2.11
--- src/sys/dev/pci/ixgbe/ixgbe_type.h:1.41.2.10	Fri Oct 13 18:20:30 2023
+++ src/sys/dev/pci/ixgbe/ixgbe_type.h	Wed Oct 18 14:05:27 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_type.h,v 1.41.2.10 2023/10/13 18:20:30 martin Exp $ */
+/* $NetBSD: ixgbe_type.h,v 1.41.2.11 2023/10/18 14:05:27 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
@@ -2552,6 +2553,10 @@ enum {
 #define IXGBE_DEVICE_CAPS_WOL_PORT0	0x8 /* WoL supported on port 0 */
 #define IXGBE_DEVICE_CAPS_WOL_MASK	0xC /* Mask for WoL capabilities */
 
+#define IXGBE_DEVICE_CAPS_FLAGS		"\20"				     \
+	"\1ALLOW_ANY_SFP" "\2FCOE_OFFLOAD" "\3WOL_PORT0_1" "\4WOL_PORT0"     \
+							"\10NO_CROSSTALK_WR"
+
 /* PCI Bus Info */
 #define IXGBE_PCI_DEVICE_STATUS		0xAA
 #define IXGBE_PCI_DEVICE_STATUS_TRANSACTION_PENDING	0x0020
@@ -3628,8 +3633,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 +3665,6 @@ union ixgbe_atr_hash_dword {
 	__be32 dword;
 };
 
-
 #define IXGBE_MVALS_INIT(m)	\
 	IXGBE_CAT(EEC, m),		\
 	IXGBE_CAT(FLA, m),		\
@@ -3796,6 +3800,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 +4170,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 +4183,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 +4218,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 +4245,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;
@@ -4266,7 +4271,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
@@ -4317,7 +4321,6 @@ struct ixgbe_hw {
 
 #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.16.8.4 src/sys/dev/pci/ixgbe/ixgbe_x540.c:1.16.8.5
--- src/sys/dev/pci/ixgbe/ixgbe_x540.c:1.16.8.4	Mon Jan 31 17:36:25 2022
+++ src/sys/dev/pci/ixgbe/ixgbe_x540.c	Wed Oct 18 14:05:27 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_x540.c,v 1.16.8.4 2022/01/31 17:36:25 martin Exp $ */
+/* $NetBSD: ixgbe_x540.c,v 1.16.8.5 2023/10/18 14:05:27 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.16.8.4 2022/01/31 17:36:25 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe_x540.c,v 1.16.8.5 2023/10/18 14:05:27 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.15.2.7 src/sys/dev/pci/ixgbe/ixgbe_x550.c:1.15.2.8
--- src/sys/dev/pci/ixgbe/ixgbe_x550.c:1.15.2.7	Fri Oct 13 18:20:30 2023
+++ src/sys/dev/pci/ixgbe/ixgbe_x550.c	Wed Oct 18 14:05:27 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_x550.c,v 1.15.2.7 2023/10/13 18:20:30 martin Exp $ */
+/* $NetBSD: ixgbe_x550.c,v 1.15.2.8 2023/10/18 14:05:27 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.15.2.7 2023/10/13 18:20:30 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe_x550.c,v 1.15.2.8 2023/10/18 14:05:27 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.125.2.23 src/sys/dev/pci/ixgbe/ixv.c:1.125.2.24
--- src/sys/dev/pci/ixgbe/ixv.c:1.125.2.23	Fri Oct 13 18:20:30 2023
+++ src/sys/dev/pci/ixgbe/ixv.c	Wed Oct 18 14:05:27 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ixv.c,v 1.125.2.23 2023/10/13 18:20:30 martin Exp $ */
+/* $NetBSD: ixv.c,v 1.125.2.24 2023/10/18 14:05:27 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.125.2.23 2023/10/13 18:20:30 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.125.2.24 2023/10/18 14:05:27 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -216,11 +216,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) */
@@ -488,14 +488,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;
@@ -525,6 +537,7 @@ ixv_attach(device_t parent, device_t dev
 
 	/* hw.ix defaults init */
 	sc->enable_aim = ixv_enable_aim;
+	sc->max_interrupt_rate = ixv_max_interrupt_rate;
 
 	sc->txrx_use_workqueue = ixv_txrx_workqueue;
 
@@ -547,7 +560,7 @@ ixv_attach(device_t parent, device_t dev
 
 	/* Check if VF was disabled by PF */
 	error = hw->mac.ops.get_link_state(hw, &sc->link_enabled);
-	if (error) {		
+	if (error) {
 		/* PF is not capable of controlling VF state. Enable the link. */
 		sc->link_enabled = TRUE;
 	}
@@ -797,7 +810,7 @@ ixv_init_locked(struct ixgbe_softc *sc)
 
 	/* Config/Enable Link */
 	error = hw->mac.ops.get_link_state(hw, &sc->link_enabled);
-	if (error) {		
+	if (error) {
 		/* PF is not capable of controlling VF state. Enable the link. */
 		sc->link_enabled = TRUE;
 	} else if (sc->link_enabled == FALSE)
@@ -810,17 +823,17 @@ ixv_init_locked(struct ixgbe_softc *sc)
 	/* Start watchdog */
 	callout_reset(&sc->timer, hz, ixv_local_timer, sc);
 
-	/* 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 */
 
@@ -1538,7 +1551,7 @@ map_err:
 static void
 ixv_free_pci_resources(struct ixgbe_softc *sc)
 {
-	struct		ix_queue *que = sc->queues;
+	struct ix_queue *que = sc->queues;
 	int		rid;
 
 	/*
@@ -2469,9 +2482,9 @@ ixv_sysctl_interrupt_rate_handler(SYSCTL
 			    && (reg < IXGBE_MIN_RSC_EITR_10G1G))
 				return EINVAL;
 		}
-		ixv_max_interrupt_rate = rate;
+		sc->max_interrupt_rate = rate;
 	} else
-		ixv_max_interrupt_rate = 0;
+		sc->max_interrupt_rate = 0;
 	ixv_eitr_write(sc, que->msix, reg);
 
 	return (0);
@@ -3314,7 +3327,7 @@ ixv_allocate_msix(struct ixgbe_softc *sc
 {
 	device_t	dev = sc->dev;
 	struct ix_queue *que = sc->queues;
-	struct		tx_ring *txr = sc->tx_rings;
+	struct tx_ring	*txr = sc->tx_rings;
 	int		error, msix_ctrl, rid, vector = 0;
 	pci_chipset_tag_t pc;
 	pcitag_t	tag;

Reply via email to