Module Name:    src
Committed By:   martin
Date:           Fri Jul 10 11:35:51 UTC 2020

Modified Files:
        src/sys/dev/pci/ixgbe [netbsd-9]: ix_txrx.c ixgbe.c ixgbe.h
            ixgbe_82598.c ixgbe_common.c ixgbe_netbsd.c ixgbe_osdep.h
            ixgbe_phy.c ixgbe_vf.c ixgbe_x550.c ixv.c

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

        sys/dev/pci/ixgbe/ix_txrx.c                     1.62-1.63 via patch
        sys/dev/pci/ixgbe/ixgbe.c                       1.225, 1.228-1.229,
                                                        1.232 via patch
        sys/dev/pci/ixgbe/ixgbe.h                       1.64, 1.66
        sys/dev/pci/ixgbe/ixv.c                         1.146, 1.148-1.150
        sys/dev/pci/ixgbe/ixgbe_common.c                1.27
        sys/dev/pci/ixgbe/ixgbe_vf.c                    1.23
        sys/dev/pci/ixgbe/ixgbe_82598.c                 1.15
        sys/dev/pci/ixgbe/ixgbe_x550.c                  1.18
        sys/dev/pci/ixgbe/ixgbe_netbsd.c                1.14
        sys/dev/pci/ixgbe/ixgbe_phy.c                   1.21
        sys/dev/pci/ixgbe/ixgbe_osdep.h                 1.26

- Fix IXGBE_LE32_TO_CPUS() macro for big endian machine. This problem
  was only on X550*.
- Add debug printf()s.
- Use unsigned to avoid undefined behavior in
  ixgbe_fc_enable_generic().
- Modify a little to reduce diff between ixgbe.c and ixv.c.
  No functional change.
- Modify comment.
- Remove unused macros.
- Whitespace fix.
- Fix typos.


To generate a diff of this commit:
cvs rdiff -u -r1.54.2.3 -r1.54.2.4 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.199.2.10 -r1.199.2.11 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.56.2.2 -r1.56.2.3 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.12.8.2 -r1.12.8.3 src/sys/dev/pci/ixgbe/ixgbe_82598.c
cvs rdiff -u -r1.25.2.1 -r1.25.2.2 src/sys/dev/pci/ixgbe/ixgbe_common.c
cvs rdiff -u -r1.9.4.2 -r1.9.4.3 src/sys/dev/pci/ixgbe/ixgbe_netbsd.c
cvs rdiff -u -r1.23.6.2 -r1.23.6.3 src/sys/dev/pci/ixgbe/ixgbe_osdep.h
cvs rdiff -u -r1.18.4.2 -r1.18.4.3 src/sys/dev/pci/ixgbe/ixgbe_phy.c
cvs rdiff -u -r1.18.2.1 -r1.18.2.2 src/sys/dev/pci/ixgbe/ixgbe_vf.c
cvs rdiff -u -r1.15.2.2 -r1.15.2.3 src/sys/dev/pci/ixgbe/ixgbe_x550.c
cvs rdiff -u -r1.125.2.9 -r1.125.2.10 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.3 src/sys/dev/pci/ixgbe/ix_txrx.c:1.54.2.4
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.54.2.3	Sun Jan 26 11:03:17 2020
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Fri Jul 10 11:35:51 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.54.2.3 2020/01/26 11:03:17 martin Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.54.2.4 2020/07/10 11:35:51 martin Exp $ */
 
 /******************************************************************************
 
@@ -926,7 +926,7 @@ ixgbe_tx_ctx_setup(struct tx_ring *txr, 
 	vlan_macip_lens |= ip_hlen;
 
 	/* No support for offloads for non-L4 next headers */
- 	switch (ipproto) {
+	switch (ipproto) {
 	case IPPROTO_TCP:
 		if (mp->m_pkthdr.csum_flags &
 		    (M_CSUM_TCPv4 | M_CSUM_TCPv6))
@@ -1569,7 +1569,6 @@ ixgbe_setup_receive_ring(struct rx_ring 
 		rxbuf->addr = htole64(rxbuf->pmap->dm_segs[0].ds_addr);
 	}
 
-
 	/* Setup our descriptor indices */
 	rxr->next_to_check = 0;
 	rxr->next_to_refresh = 0;
@@ -1625,6 +1624,7 @@ ixgbe_setup_receive_structures(struct ad
 	struct rx_ring *rxr = adapter->rx_rings;
 	int            j;
 
+	INIT_DEBUGOUT("ixgbe_setup_receive_structures");
 	for (j = 0; j < adapter->num_queues; j++, rxr++)
 		if (ixgbe_setup_receive_ring(rxr))
 			goto fail;
@@ -2233,7 +2233,7 @@ ixgbe_allocate_queues(struct adapter *ad
 
 	/* First, allocate the top level queue structs */
 	adapter->queues = (struct ix_queue *)malloc(sizeof(struct ix_queue) *
-            adapter->num_queues, M_DEVBUF, M_NOWAIT | M_ZERO);
+	    adapter->num_queues, M_DEVBUF, M_NOWAIT | M_ZERO);
         if (adapter->queues == NULL) {
 		aprint_error_dev(dev, "Unable to allocate queue memory\n");
                 error = ENOMEM;
@@ -2300,7 +2300,7 @@ ixgbe_allocate_queues(struct adapter *ad
 			    "Critical Failure setting up transmit buffers\n");
 			error = ENOMEM;
 			goto err_tx_desc;
-        	}
+		}
 		if (!(adapter->feat_en & IXGBE_FEATURE_LEGACY_TX)) {
 			/* Allocate a buf ring */
 			txr->txr_interq = pcq_create(IXGBE_BR_SIZE, KM_SLEEP);

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.10 src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.11
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.10	Tue Jan 28 11:09:27 2020
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Fri Jul 10 11:35:51 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.199.2.10 2020/01/28 11:09:27 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.199.2.11 2020/07/10 11:35:51 martin Exp $ */
 
 /******************************************************************************
 
@@ -168,9 +168,9 @@ static bool	ixgbe_suspend(device_t, cons
 static bool	ixgbe_resume(device_t, const pmf_qual_t *);
 static int	ixgbe_ifflags_cb(struct ethercom *);
 static int	ixgbe_ioctl(struct ifnet *, u_long, void *);
-static void	ixgbe_ifstop(struct ifnet *, int);
 static int	ixgbe_init(struct ifnet *);
 static void	ixgbe_init_locked(struct adapter *);
+static void	ixgbe_ifstop(struct ifnet *, int);
 static void	ixgbe_stop(void *);
 static void	ixgbe_init_device_features(struct adapter *);
 static void	ixgbe_check_fan_failure(struct adapter *, u32, bool);
@@ -408,11 +408,11 @@ static int (*ixgbe_ring_empty)(struct if
 #ifdef NET_MPSAFE
 #define IXGBE_MPSAFE		1
 #define IXGBE_CALLOUT_FLAGS	CALLOUT_MPSAFE
-#define IXGBE_SOFTINFT_FLAGS	SOFTINT_MPSAFE
+#define IXGBE_SOFTINT_FLAGS	SOFTINT_MPSAFE
 #define IXGBE_WORKQUEUE_FLAGS	WQ_PERCPU | WQ_MPSAFE
 #else
 #define IXGBE_CALLOUT_FLAGS	0
-#define IXGBE_SOFTINFT_FLAGS	0
+#define IXGBE_SOFTINT_FLAGS	0
 #define IXGBE_WORKQUEUE_FLAGS	WQ_PERCPU
 #endif
 #define IXGBE_WORKQUEUE_PRI PRI_SOFTNET
@@ -674,6 +674,8 @@ ixgbe_initialize_transmit_units(struct a
 	struct ixgbe_hw	*hw = &adapter->hw;
 	int i;
 
+	INIT_DEBUGOUT("ixgbe_initialize_transmit_units");
+
 	/* Setup the Base and Length of the Tx Descriptor Ring */
 	for (i = 0; i < adapter->num_queues; i++, txr++) {
 		u64 tdba = txr->txdma.dma_paddr;
@@ -1100,17 +1102,17 @@ ixgbe_attach(device_t parent, device_t d
 		goto err_late;
 
 	/* Tasklets for Link, SFP, Multispeed Fiber and Flow Director */
-	adapter->link_si = softint_establish(SOFTINT_NET |IXGBE_SOFTINFT_FLAGS,
+	adapter->link_si = softint_establish(SOFTINT_NET |IXGBE_SOFTINT_FLAGS,
 	    ixgbe_handle_link, adapter);
-	adapter->mod_si = softint_establish(SOFTINT_NET | IXGBE_SOFTINFT_FLAGS,
+	adapter->mod_si = softint_establish(SOFTINT_NET | IXGBE_SOFTINT_FLAGS,
 	    ixgbe_handle_mod, adapter);
-	adapter->msf_si = softint_establish(SOFTINT_NET | IXGBE_SOFTINFT_FLAGS,
+	adapter->msf_si = softint_establish(SOFTINT_NET | IXGBE_SOFTINT_FLAGS,
 	    ixgbe_handle_msf, adapter);
-	adapter->phy_si = softint_establish(SOFTINT_NET | IXGBE_SOFTINFT_FLAGS,
+	adapter->phy_si = softint_establish(SOFTINT_NET | IXGBE_SOFTINT_FLAGS,
 	    ixgbe_handle_phy, adapter);
 	if (adapter->feat_en & IXGBE_FEATURE_FDIR)
 		adapter->fdir_si =
-		    softint_establish(SOFTINT_NET | IXGBE_SOFTINFT_FLAGS,
+		    softint_establish(SOFTINT_NET | IXGBE_SOFTINT_FLAGS,
 			ixgbe_reinit_fdir, adapter);
 	if ((adapter->link_si == NULL) || (adapter->mod_si == NULL)
 	    || (adapter->msf_si == NULL) || (adapter->phy_si == NULL)
@@ -3217,7 +3219,7 @@ ixgbe_sysctl_interrupt_rate_handler(SYSC
 	if (rate > 0 && rate < 500000) {
 		if (rate < 1000)
 			rate = 1000;
-		reg |= ((4000000/rate) & 0xff8);
+		reg |= ((4000000 / rate) & 0xff8);
 		/*
 		 * When RSC is used, ITR interval must be larger than
 		 * RSC_DELAY. Currently, we use 2us for RSC_DELAY.
@@ -4438,7 +4440,7 @@ ixgbe_local_timer1(void *arg)
 {
 	struct adapter	*adapter = arg;
 	device_t	dev = adapter->dev;
-	struct ix_queue *que = adapter->queues;
+	struct ix_queue	*que = adapter->queues;
 	u64		queues = 0;
 	u64		v0, v1, v2, v3, v4, v5, v6, v7;
 	int		hung = 0;
@@ -4511,7 +4513,7 @@ ixgbe_local_timer1(void *arg)
 		}
 	}
 
-	/* Only truely watchdog if all queues show hung */
+	/* Only truly watchdog if all queues show hung */
 	if (hung == adapter->num_queues)
 		goto watchdog;
 #if 0 /* XXX Avoid unexpectedly disabling interrupt forever (PR#53294) */
@@ -6221,7 +6223,7 @@ out:
  *   return 0 on success, positive on failure
  ************************************************************************/
 static int
-ixgbe_ioctl(struct ifnet * ifp, u_long command, void *data)
+ixgbe_ioctl(struct ifnet *ifp, u_long command, void *data)
 {
 	struct adapter	*adapter = ifp->if_softc;
 	struct ixgbe_hw *hw = &adapter->hw;
@@ -6505,7 +6507,7 @@ alloc_retry:
 	 */
 	if (!(adapter->feat_en & IXGBE_FEATURE_LEGACY_TX)) {
 		txr->txr_si =
-		    softint_establish(SOFTINT_NET | IXGBE_SOFTINFT_FLAGS,
+		    softint_establish(SOFTINT_NET | IXGBE_SOFTINT_FLAGS,
 			ixgbe_deferred_mq_start, txr);
 
 		snprintf(wqname, sizeof(wqname), "%sdeferTx", device_xname(dev));
@@ -6514,7 +6516,7 @@ alloc_retry:
 		    IPL_NET, IXGBE_WORKQUEUE_FLAGS);
 		adapter->txr_wq_enqueued = percpu_alloc(sizeof(u_int));
 	}
-	que->que_si = softint_establish(SOFTINT_NET | IXGBE_SOFTINFT_FLAGS,
+	que->que_si = softint_establish(SOFTINT_NET | IXGBE_SOFTINT_FLAGS,
 	    ixgbe_handle_que, que);
 	snprintf(wqname, sizeof(wqname), "%sTxRx", device_xname(dev));
 	error = workqueue_create(&adapter->que_wq, wqname,
@@ -6654,7 +6656,7 @@ ixgbe_allocate_msix(struct adapter *adap
 
 		if (!(adapter->feat_en & IXGBE_FEATURE_LEGACY_TX)) {
 			txr->txr_si = softint_establish(
-				SOFTINT_NET | IXGBE_SOFTINFT_FLAGS,
+				SOFTINT_NET | IXGBE_SOFTINT_FLAGS,
 				ixgbe_deferred_mq_start, txr);
 			if (txr->txr_si == NULL) {
 				aprint_error_dev(dev,
@@ -6664,7 +6666,7 @@ ixgbe_allocate_msix(struct adapter *adap
 			}
 		}
 		que->que_si
-		    = softint_establish(SOFTINT_NET | IXGBE_SOFTINFT_FLAGS,
+		    = softint_establish(SOFTINT_NET | IXGBE_SOFTINT_FLAGS,
 			ixgbe_handle_que, que);
 		if (que->que_si == NULL) {
 			aprint_error_dev(dev,
@@ -6726,7 +6728,7 @@ ixgbe_allocate_msix(struct adapter *adap
 
 	if (adapter->feat_cap & IXGBE_FEATURE_SRIOV) {
 		adapter->mbx_si =
-		    softint_establish(SOFTINT_NET | IXGBE_SOFTINFT_FLAGS,
+		    softint_establish(SOFTINT_NET | IXGBE_SOFTINT_FLAGS,
 			ixgbe_handle_mbx, adapter);
 		if (adapter->mbx_si == NULL) {
 			aprint_error_dev(dev,

Index: src/sys/dev/pci/ixgbe/ixgbe.h
diff -u src/sys/dev/pci/ixgbe/ixgbe.h:1.56.2.2 src/sys/dev/pci/ixgbe/ixgbe.h:1.56.2.3
--- src/sys/dev/pci/ixgbe/ixgbe.h:1.56.2.2	Sun Jan 26 11:03:17 2020
+++ src/sys/dev/pci/ixgbe/ixgbe.h	Fri Jul 10 11:35:51 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.h,v 1.56.2.2 2020/01/26 11:03:17 martin Exp $ */
+/* $NetBSD: ixgbe.h,v 1.56.2.3 2020/07/10 11:35:51 martin Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -268,10 +268,10 @@ typedef struct _ixgbe_vendor_info_t {
 
 /* This is used to get SFP+ module data */
 struct ixgbe_i2c_req {
-        u8 dev_addr;
-        u8 offset;
-        u8 len;
-        u8 data[8];
+	u8 dev_addr;
+	u8 offset;
+	u8 len;
+	u8 data[8];
 };
 
 struct ixgbe_bp_data {
@@ -334,13 +334,15 @@ struct ix_queue {
 	char             namebuf[32];
 	char             evnamebuf[32];
 
-	kmutex_t         dc_mtx;	/* lock for disabled_count and this queue's EIMS/EIMC bit */
-	int              disabled_count;/*
-					 * means
-					 *     0   : this queue is enabled
-					 *     > 0 : this queue is disabled
-					 *           the value is ixgbe_disable_queue() called count
-					 */
+	/* Lock for disabled_count and this queue's EIMS/EIMC bit */
+	kmutex_t         dc_mtx;
+	/*
+	 * disabled_count means:
+	 *     0   : this queue is enabled
+	 *     > 0 : this queue is disabled
+	 *           the value is ixgbe_disable_queue() called count
+	 */
+	int              disabled_count;
 	bool             txrx_use_workqueue;
 };
 
@@ -373,10 +375,10 @@ struct tx_ring {
 	u16			atr_sample;
 	u16			atr_count;
 
-	u64			bytes;  /* used for AIM */
+	u64			bytes;  /* Used for AIM */
 	u64			packets;
 	/* Soft Stats */
-	struct evcnt	   	tso_tx;
+	struct evcnt		tso_tx;
 	struct evcnt		no_desc_avail;
 	struct evcnt		total_packets;
 	struct evcnt		pcq_drops;
@@ -409,7 +411,7 @@ struct rx_ring {
 	bool			hw_rsc;
 	bool			vtag_strip;
 	u16			next_to_refresh;
-	u16 			next_to_check;
+	u16			next_to_check;
 	u16			num_desc;
 	u16			mbuf_sz;
 #if 0
@@ -417,8 +419,8 @@ struct rx_ring {
 #endif
 	struct ixgbe_rx_buf	*rx_buffers;
 	ixgbe_dma_tag_t		*ptag;
-	u16	                last_rx_mbuf_sz;
-	u32                	last_num_rx_desc;
+	u16			last_rx_mbuf_sz;
+	u32			last_num_rx_desc;
 	ixgbe_extmem_head_t	jcl_head;
 
 	u64			bytes; /* Used for AIM calc */
@@ -427,10 +429,10 @@ struct rx_ring {
 	/* Soft stats */
 	struct evcnt		rx_copies;
 	struct evcnt		rx_packets;
-	struct evcnt 		rx_bytes;
-	struct evcnt 		rx_discarded;
-	struct evcnt 		no_jmbuf;
-	u64 			rsc_num;
+	struct evcnt		rx_bytes;
+	struct evcnt		rx_discarded;
+	struct evcnt		no_jmbuf;
+	u64			rsc_num;
 
 	/* Flow Director */
 	u64			flm;
@@ -496,7 +498,7 @@ struct adapter {
 	u16			num_segs;
 	u32			link_speed;
 	bool			link_up;
-	u32 			vector;
+	u32			vector;
 	u16			dmac;
 	u32			phy_layer;
 
@@ -521,15 +523,17 @@ struct adapter {
 	void			*phy_si;   /* PHY intr tasklet */
 
 	bool			txrx_use_workqueue;
-	struct workqueue	*que_wq;    /* workqueue for ixgbe_handle_que_work() */
-					    /*
-					     * que_wq's "enqueued flag" is not required,
-					     * because twice workqueue_enqueue() for
-					     * ixgbe_handle_que_work() is avoided by masking
-					     * the queue's interrupt by EIMC.
-					     * See also ixgbe_msix_que().
-					     */
-	struct workqueue	*txr_wq;    /* workqueue for ixgbe_deferred_mq_start_work() */
+
+	/*
+	 * Workqueue for ixgbe_handle_que_work().
+	 *
+	 * que_wq's "enqueued flag" is not required, because twice
+	 * workqueue_enqueue() for ixgbe_handle_que_work() is avoided by
+	 * masking the queue's interrupt by EIMC. See also ixgbe_msix_que().
+	 */
+	struct workqueue	*que_wq;
+	/* Workqueue for ixgbe_deferred_mq_start_work() */
+	struct workqueue	*txr_wq;
 	percpu_t		*txr_wq_enqueued;
 
 	/*
@@ -570,23 +574,23 @@ struct adapter {
 	struct ixgbe_bp_data    bypass;
 
 	/* Netmap */
-	void 			(*init_locked)(struct adapter *);
-	void 			(*stop_locked)(void *);
+	void			(*init_locked)(struct adapter *);
+	void			(*stop_locked)(void *);
 
 	/* Firmware error check */
 	u_int                   recovery_mode;
 	struct callout          recovery_mode_timer;
 
 	/* Misc stats maintained by the driver */
-	struct evcnt	   	efbig_tx_dma_setup;
-	struct evcnt   		mbuf_defrag_failed;
-	struct evcnt	   	efbig2_tx_dma_setup;
-	struct evcnt	   	einval_tx_dma_setup;
-	struct evcnt	   	other_tx_dma_setup;
-	struct evcnt	   	eagain_tx_dma_setup;
-	struct evcnt	   	enomem_tx_dma_setup;
-	struct evcnt	   	tso_err;
-	struct evcnt	   	watchdog_events;
+	struct evcnt		efbig_tx_dma_setup;
+	struct evcnt		mbuf_defrag_failed;
+	struct evcnt		efbig2_tx_dma_setup;
+	struct evcnt		einval_tx_dma_setup;
+	struct evcnt		other_tx_dma_setup;
+	struct evcnt		eagain_tx_dma_setup;
+	struct evcnt		enomem_tx_dma_setup;
+	struct evcnt		tso_err;
+	struct evcnt		watchdog_events;
 	struct evcnt		link_irq;
 	struct evcnt		link_sicount;
 	struct evcnt		mod_sicount;
@@ -629,7 +633,7 @@ struct adapter {
 
 
 #define IXGBE_CORE_LOCK_INIT(_sc, _name) \
-        mutex_init(&(_sc)->core_mtx, MUTEX_DEFAULT, IPL_SOFTNET)
+	mutex_init(&(_sc)->core_mtx, MUTEX_DEFAULT, IPL_SOFTNET)
 #define IXGBE_CORE_LOCK_DESTROY(_sc)      mutex_destroy(&(_sc)->core_mtx)
 #define IXGBE_TX_LOCK_DESTROY(_sc)        mutex_destroy(&(_sc)->tx_mtx)
 #define IXGBE_RX_LOCK_DESTROY(_sc)        mutex_destroy(&(_sc)->rx_mtx)
@@ -643,31 +647,6 @@ struct adapter {
 #define IXGBE_CORE_LOCK_ASSERT(_sc)       KASSERT(mutex_owned(&(_sc)->core_mtx))
 #define IXGBE_TX_LOCK_ASSERT(_sc)         KASSERT(mutex_owned(&(_sc)->tx_mtx))
 
-/* Stats macros */
-#if __FreeBSD_version >= 1100036
-#define IXGBE_SET_IPACKETS(sc, count)    (sc)->ipackets = (count)
-#define IXGBE_SET_IERRORS(sc, count)     (sc)->ierrors = (count)
-#define IXGBE_SET_OPACKETS(sc, count)    (sc)->opackets = (count)
-#define IXGBE_SET_OERRORS(sc, count)     (sc)->oerrors = (count)
-#define IXGBE_SET_COLLISIONS(sc, count)
-#define IXGBE_SET_IBYTES(sc, count)      (sc)->ibytes = (count)
-#define IXGBE_SET_OBYTES(sc, count)      (sc)->obytes = (count)
-#define IXGBE_SET_IMCASTS(sc, count)     (sc)->imcasts = (count)
-#define IXGBE_SET_OMCASTS(sc, count)     (sc)->omcasts = (count)
-#define IXGBE_SET_IQDROPS(sc, count)     (sc)->iqdrops = (count)
-#else
-#define IXGBE_SET_IPACKETS(sc, count)    (sc)->ifp->if_ipackets = (count)
-#define IXGBE_SET_IERRORS(sc, count)     (sc)->ifp->if_ierrors = (count)
-#define IXGBE_SET_OPACKETS(sc, count)    (sc)->ifp->if_opackets = (count)
-#define IXGBE_SET_OERRORS(sc, count)     (sc)->ifp->if_oerrors = (count)
-#define IXGBE_SET_COLLISIONS(sc, count)  (sc)->ifp->if_collisions = (count)
-#define IXGBE_SET_IBYTES(sc, count)      (sc)->ifp->if_ibytes = (count)
-#define IXGBE_SET_OBYTES(sc, count)      (sc)->ifp->if_obytes = (count)
-#define IXGBE_SET_IMCASTS(sc, count)     (sc)->ifp->if_imcasts = (count)
-#define IXGBE_SET_OMCASTS(sc, count)     (sc)->ifp->if_omcasts = (count)
-#define IXGBE_SET_IQDROPS(sc, count)     (sc)->ifp->if_iqdrops = (count)
-#endif
-
 /* External PHY register addresses */
 #define IXGBE_PHY_CURRENT_TEMP		0xC820
 #define IXGBE_PHY_OVERTEMP_STATUS	0xC830

Index: src/sys/dev/pci/ixgbe/ixgbe_82598.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_82598.c:1.12.8.2 src/sys/dev/pci/ixgbe/ixgbe_82598.c:1.12.8.3
--- src/sys/dev/pci/ixgbe/ixgbe_82598.c:1.12.8.2	Tue Jan 28 11:09:27 2020
+++ src/sys/dev/pci/ixgbe/ixgbe_82598.c	Fri Jul 10 11:35:51 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_82598.c,v 1.12.8.2 2020/01/28 11:09:27 martin Exp $ */
+/* $NetBSD: ixgbe_82598.c,v 1.12.8.3 2020/07/10 11:35:51 martin Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -538,7 +538,7 @@ s32 ixgbe_fc_enable_82598(struct ixgbe_h
 	}
 
 	/* Configure pause time (2 TCs per register) */
-	reg = hw->fc.pause_time * 0x00010001;
+	reg = (u32)hw->fc.pause_time * 0x00010001;
 	for (i = 0; i < (IXGBE_DCB_MAX_TRAFFIC_CLASS / 2); i++)
 		IXGBE_WRITE_REG(hw, IXGBE_FCTTV(i), reg);
 

Index: src/sys/dev/pci/ixgbe/ixgbe_common.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_common.c:1.25.2.1 src/sys/dev/pci/ixgbe/ixgbe_common.c:1.25.2.2
--- src/sys/dev/pci/ixgbe/ixgbe_common.c:1.25.2.1	Sun Jan 26 11:03:17 2020
+++ src/sys/dev/pci/ixgbe/ixgbe_common.c	Fri Jul 10 11:35:51 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_common.c,v 1.25.2.1 2020/01/26 11:03:17 martin Exp $ */
+/* $NetBSD: ixgbe_common.c,v 1.25.2.2 2020/07/10 11:35:51 martin Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -464,6 +464,8 @@ s32 ixgbe_start_hw_gen2(struct ixgbe_hw 
 	u32 i;
 	u32 regval;
 
+	DEBUGFUNC("ixgbe_start_hw_gen2");
+
 	/* Clear the rate limiters */
 	for (i = 0; i < hw->mac.max_tx_queues; i++) {
 		IXGBE_WRITE_REG(hw, IXGBE_RTTDQSEL, i);

Index: src/sys/dev/pci/ixgbe/ixgbe_netbsd.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_netbsd.c:1.9.4.2 src/sys/dev/pci/ixgbe/ixgbe_netbsd.c:1.9.4.3
--- src/sys/dev/pci/ixgbe/ixgbe_netbsd.c:1.9.4.2	Sun Jan 26 11:03:17 2020
+++ src/sys/dev/pci/ixgbe/ixgbe_netbsd.c	Fri Jul 10 11:35:51 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_netbsd.c,v 1.9.4.2 2020/01/26 11:03:17 martin Exp $ */
+/* $NetBSD: ixgbe_netbsd.c,v 1.9.4.3 2020/07/10 11:35:51 martin Exp $ */
 /*
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -79,7 +79,7 @@ ixgbe_dmamap_destroy(ixgbe_dma_tag_t *dt
 void
 ixgbe_dmamap_sync(ixgbe_dma_tag_t *dt, bus_dmamap_t dmam, int ops)
 {
-        bus_dmamap_sync(dt->dt_dmat, dmam, 0, dt->dt_maxsize, ops);
+	bus_dmamap_sync(dt->dt_dmat, dmam, 0, dt->dt_maxsize, ops);
 }
 
 void

Index: src/sys/dev/pci/ixgbe/ixgbe_osdep.h
diff -u src/sys/dev/pci/ixgbe/ixgbe_osdep.h:1.23.6.2 src/sys/dev/pci/ixgbe/ixgbe_osdep.h:1.23.6.3
--- src/sys/dev/pci/ixgbe/ixgbe_osdep.h:1.23.6.2	Sun Jan 26 11:03:17 2020
+++ src/sys/dev/pci/ixgbe/ixgbe_osdep.h	Fri Jul 10 11:35:51 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_osdep.h,v 1.23.6.2 2020/01/26 11:03:17 martin Exp $ */
+/* $NetBSD: ixgbe_osdep.h,v 1.23.6.3 2020/07/10 11:35:51 martin Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -139,7 +139,7 @@ enum {
 #define IXGBE_CPU_TO_LE16 htole16
 #define IXGBE_CPU_TO_LE32 htole32
 #define IXGBE_LE32_TO_CPU le32toh
-#define IXGBE_LE32_TO_CPUS(x)
+#define IXGBE_LE32_TO_CPUS(x) (*(x) = le32toh(*(x)))
 #define IXGBE_CPU_TO_BE16 htobe16
 #define IXGBE_CPU_TO_BE32 htobe32
 #define IXGBE_BE32_TO_CPU be32toh

Index: src/sys/dev/pci/ixgbe/ixgbe_phy.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_phy.c:1.18.4.2 src/sys/dev/pci/ixgbe/ixgbe_phy.c:1.18.4.3
--- src/sys/dev/pci/ixgbe/ixgbe_phy.c:1.18.4.2	Tue Jan 28 11:09:27 2020
+++ src/sys/dev/pci/ixgbe/ixgbe_phy.c	Fri Jul 10 11:35:51 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_phy.c,v 1.18.4.2 2020/01/28 11:09:27 martin Exp $ */
+/* $NetBSD: ixgbe_phy.c,v 1.18.4.3 2020/07/10 11:35:51 martin Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -1786,7 +1786,7 @@ s32 ixgbe_identify_qsfp_module_generic(s
 
 	/* Determine PHY vendor for optical modules */
 	if (comp_codes_10g & (IXGBE_SFF_10GBASESR_CAPABLE |
-			      IXGBE_SFF_10GBASELR_CAPABLE))  {
+			      IXGBE_SFF_10GBASELR_CAPABLE)) {
 		status = hw->phy.ops.read_i2c_eeprom(hw,
 					    IXGBE_SFF_QSFP_VENDOR_OUI_BYTE0,
 					    &oui_bytes[0]);

Index: src/sys/dev/pci/ixgbe/ixgbe_vf.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_vf.c:1.18.2.1 src/sys/dev/pci/ixgbe/ixgbe_vf.c:1.18.2.2
--- src/sys/dev/pci/ixgbe/ixgbe_vf.c:1.18.2.1	Thu Sep 26 19:07:22 2019
+++ src/sys/dev/pci/ixgbe/ixgbe_vf.c	Fri Jul 10 11:35:51 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_vf.c,v 1.18.2.1 2019/09/26 19:07:22 martin Exp $ */
+/* $NetBSD: ixgbe_vf.c,v 1.18.2.2 2020/07/10 11:35:51 martin Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -475,7 +475,7 @@ s32 ixgbevf_update_xcast_mode(struct ixg
 	 *  On linux's PF driver implementation, the PF replies VF's
 	 * XCAST_MODE_ALLMULTI message not with NACK but with ACK even if the
 	 * virtual function is NOT marked "trust" and act as
-	 * XCAST_MODE_"MULTI". If ixv(4) simply check the return vaule of
+	 * XCAST_MODE_"MULTI". If ixv(4) simply check the return value of
 	 * update_xcast_mode(XCAST_MODE_ALLMULTI), SIOCSADDMULTI success and
 	 * the user may have trouble with some addresses. Fortunately, the
 	 * Linux's PF driver's "ACK" message has not XCAST_MODE_"ALL"MULTI but

Index: src/sys/dev/pci/ixgbe/ixgbe_x550.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_x550.c:1.15.2.2 src/sys/dev/pci/ixgbe/ixgbe_x550.c:1.15.2.3
--- src/sys/dev/pci/ixgbe/ixgbe_x550.c:1.15.2.2	Tue Jan 28 11:09:27 2020
+++ src/sys/dev/pci/ixgbe/ixgbe_x550.c	Fri Jul 10 11:35:51 2020
@@ -2895,7 +2895,7 @@ static s32 ixgbe_setup_sfi_x550a(struct 
  *  @speed: new link speed
  *  @autoneg_wait_to_complete: unused
  *
- *  Configure the the integrated PHY for SFP support.
+ *  Configure the integrated PHY for SFP support.
  **/
 static s32 ixgbe_setup_mac_link_sfp_x550a(struct ixgbe_hw *hw,
 				    ixgbe_link_speed speed,
@@ -4843,4 +4843,3 @@ bool ixgbe_fw_recovery_mode_X550(struct 
 
 	return !!(fwsm & IXGBE_FWSM_FW_NVM_RECOVERY_MODE);
 }
-

Index: src/sys/dev/pci/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.125.2.9 src/sys/dev/pci/ixgbe/ixv.c:1.125.2.10
--- src/sys/dev/pci/ixgbe/ixv.c:1.125.2.9	Sun Jan 26 11:03:17 2020
+++ src/sys/dev/pci/ixgbe/ixv.c	Fri Jul 10 11:35:51 2020
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.125.2.9 2020/01/26 11:03:17 martin Exp $*/
+/*$NetBSD: ixv.c,v 1.125.2.10 2020/07/10 11:35:51 martin Exp $*/
 
 /******************************************************************************
 
@@ -158,7 +158,7 @@ const struct sysctlnode *ixv_sysctl_inst
 static const ixgbe_vendor_info_t *ixv_lookup(const struct pci_attach_args *);
 
 /************************************************************************
- * FreeBSD Device Interface Entry Points
+ * NetBSD Device Interface Entry Points
  ************************************************************************/
 CFATTACH_DECL3_NEW(ixv, sizeof(struct adapter),
     ixv_probe, ixv_attach, ixv_detach, NULL, NULL, NULL,
@@ -226,11 +226,11 @@ TUNABLE_INT("hw.ixv.enable_legacy_tx", &
 #ifdef NET_MPSAFE
 #define IXGBE_MPSAFE		1
 #define IXGBE_CALLOUT_FLAGS	CALLOUT_MPSAFE
-#define IXGBE_SOFTINFT_FLAGS	SOFTINT_MPSAFE
+#define IXGBE_SOFTINT_FLAGS	SOFTINT_MPSAFE
 #define IXGBE_WORKQUEUE_FLAGS	WQ_PERCPU | WQ_MPSAFE
 #else
 #define IXGBE_CALLOUT_FLAGS	0
-#define IXGBE_SOFTINFT_FLAGS	0
+#define IXGBE_SOFTINT_FLAGS	0
 #define IXGBE_WORKQUEUE_FLAGS	WQ_PERCPU
 #endif
 #define IXGBE_WORKQUEUE_PRI PRI_SOFTNET
@@ -319,8 +319,8 @@ ixv_attach(device_t parent, device_t dev
 
 	/* Allocate, clear, and link in our adapter structure */
 	adapter = device_private(dev);
-	adapter->dev = dev;
 	adapter->hw.back = adapter;
+	adapter->dev = dev;
 	hw = &adapter->hw;
 
 	adapter->init_locked = ixv_init_locked;
@@ -341,7 +341,7 @@ ixv_attach(device_t parent, device_t dev
 	aprint_normal(": %s, Version - %s\n",
 	    ixv_strings[ent->index], ixv_driver_version);
 
-	/* Core Lock Init*/
+	/* Core Lock Init */
 	IXGBE_CORE_LOCK_INIT(adapter, device_xname(dev));
 
 	/* Do base PCI setup - map BAR0 */
@@ -1084,7 +1084,7 @@ ixv_negotiate_api(struct adapter *adapte
 
 
 /************************************************************************
- * ixv_set_multi - Multicast Update
+ * ixv_set_rxfilter - Multicast Update
  *
  *   Called whenever multicast address list is updated.
  ************************************************************************/
@@ -1171,7 +1171,7 @@ ixv_set_rxfilter(struct adapter *adapter
 			ETHER_LOCK(ec);
 			ec->ec_flags |= ETHER_F_ALLMULTI;
 			ETHER_UNLOCK(ec);
-			return rc; /* Promisc might failed */
+			return rc; /* Promisc might have failed */
 		}
 
 		if (rc == 0)
@@ -2400,12 +2400,8 @@ ixv_update_stats(struct adapter *adapter
 	    stats->vfgotc);
 	UPDATE_STAT_32(IXGBE_VFMPRC, stats->last_vfmprc, stats->vfmprc);
 
-	/* Fill out the OS statistics structure */
-	/*
-	 * NetBSD: Don't override if_{i|o}{packets|bytes|mcasts} with
-	 * adapter->stats counters. It's required to make ifconfig -z
-	 * (SOICZIFDATA) work.
-	 */
+	/* VF doesn't count errors by hardware */
+
 } /* ixv_update_stats */
 
 /************************************************************************
@@ -2436,7 +2432,7 @@ ixv_sysctl_interrupt_rate_handler(SYSCTL
 	if (rate > 0 && rate < 500000) {
 		if (rate < 1000)
 			rate = 1000;
-		reg |= ((4000000/rate) & 0xff8);
+		reg |= ((4000000 / rate) & 0xff8);
 		/*
 		 * When RSC is used, ITR interval must be larger than
 		 * RSC_DELAY. Currently, we use 2us for RSC_DELAY.
@@ -3262,11 +3258,11 @@ ixv_allocate_msix(struct adapter *adapte
 
 #ifndef IXGBE_LEGACY_TX
 		txr->txr_si
-		    = softint_establish(SOFTINT_NET | IXGBE_SOFTINFT_FLAGS,
+		    = softint_establish(SOFTINT_NET | IXGBE_SOFTINT_FLAGS,
 			ixgbe_deferred_mq_start, txr);
 #endif
 		que->que_si
-		    = softint_establish(SOFTINT_NET | IXGBE_SOFTINFT_FLAGS,
+		    = softint_establish(SOFTINT_NET | IXGBE_SOFTINT_FLAGS,
 			ixv_handle_que, que);
 		if (que->que_si == NULL) {
 			aprint_error_dev(dev,
@@ -3313,8 +3309,8 @@ ixv_allocate_msix(struct adapter *adapte
 	/* Round-robin affinity */
 	kcpuset_zero(affinity);
 	kcpuset_set(affinity, cpu_id % ncpu);
-	error = interrupt_distribute(adapter->osdep.ihs[vector],
-	    affinity, NULL);
+	error = interrupt_distribute(adapter->osdep.ihs[vector], affinity,
+	    NULL);
 
 	aprint_normal_dev(dev,
 	    "for link, interrupting at %s", intrstr);
@@ -3324,7 +3320,7 @@ ixv_allocate_msix(struct adapter *adapte
 		aprint_normal("\n");
 
 	/* Tasklets for Mailbox */
-	adapter->link_si = softint_establish(SOFTINT_NET |IXGBE_SOFTINFT_FLAGS,
+	adapter->link_si = softint_establish(SOFTINT_NET |IXGBE_SOFTINT_FLAGS,
 	    ixv_handle_link, adapter);
 	/*
 	 * Due to a broken design QEMU will fail to properly

Reply via email to