Module Name:    src
Committed By:   martin
Date:           Fri Jan 24 18:37:32 UTC 2020

Modified Files:
        src/sys/dev/pci/ixgbe [netbsd-8]: if_bypass.c ix_txrx.c ixgbe.c ixgbe.h
            ixgbe_82598.c ixgbe_api.c ixgbe_common.c ixgbe_netbsd.c
            ixgbe_osdep.c ixgbe_osdep.h ixgbe_phy.c ixv.c

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

        sys/dev/pci/ixgbe/if_bypass.c           1.5
        sys/dev/pci/ixgbe/ixgbe_osdep.c         1.5
        sys/dev/pci/ixgbe/ix_txrx.c             1.58-1.60
        sys/dev/pci/ixgbe/ixgbe.c               1.195,1.220-1.221 via patch
        sys/dev/pci/ixgbe/ixgbe.h               1.60-1.2
        sys/dev/pci/ixgbe/ixgbe_api.c           1.24
        sys/dev/pci/ixgbe/ixgbe_common.c        1.26
        sys/dev/pci/ixgbe/ixgbe_netbsd.c        1.11-1.12
        sys/dev/pci/ixgbe/ixgbe_osdep.h         1.24
        sys/dev/pci/ixgbe/ixgbe_phy.c           1.19
        sys/dev/pci/ixgbe/ixgbe_82598.c         1.14
        sys/dev/pci/ixgbe/ixv.c                 1.122,1.142,1.144 via patch

- Use unsigned to avoid undefined behavior in
  ix{gbe,v}_[un]register_vlan().
- Free RX structure correctly when detaching.
- Remove unused code.
- Remove extra spaces.
- Fix some typos in comment.
- KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.2.4.4 -r1.2.4.5 src/sys/dev/pci/ixgbe/if_bypass.c
cvs rdiff -u -r1.24.2.18 -r1.24.2.19 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.88.2.38 -r1.88.2.39 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.24.6.18 -r1.24.6.19 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.8.8.2 -r1.8.8.3 src/sys/dev/pci/ixgbe/ixgbe_82598.c
cvs rdiff -u -r1.15.8.5 -r1.15.8.6 src/sys/dev/pci/ixgbe/ixgbe_api.c
cvs rdiff -u -r1.13.2.7 -r1.13.2.8 src/sys/dev/pci/ixgbe/ixgbe_common.c
cvs rdiff -u -r1.6.2.4 -r1.6.2.5 src/sys/dev/pci/ixgbe/ixgbe_netbsd.c
cvs rdiff -u -r1.1.12.3 -r1.1.12.4 src/sys/dev/pci/ixgbe/ixgbe_osdep.c
cvs rdiff -u -r1.17.6.5 -r1.17.6.6 src/sys/dev/pci/ixgbe/ixgbe_osdep.h
cvs rdiff -u -r1.11.6.4 -r1.11.6.5 src/sys/dev/pci/ixgbe/ixgbe_phy.c
cvs rdiff -u -r1.56.2.28 -r1.56.2.29 src/sys/dev/pci/ixgbe/ixv.c

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

Modified files:

Index: src/sys/dev/pci/ixgbe/if_bypass.c
diff -u src/sys/dev/pci/ixgbe/if_bypass.c:1.2.4.4 src/sys/dev/pci/ixgbe/if_bypass.c:1.2.4.5
--- src/sys/dev/pci/ixgbe/if_bypass.c:1.2.4.4	Sat Apr 14 10:25:11 2018
+++ src/sys/dev/pci/ixgbe/if_bypass.c	Fri Jan 24 18:37:31 2020
@@ -101,7 +101,7 @@ ixgbe_get_bypass_time(u32 *year, u32 *se
 	nanotime(&current);
 	*sec = current.tv_sec;
 
-	while(*sec > SEC_THIS_YEAR(*year)) {
+	while (*sec > SEC_THIS_YEAR(*year)) {
 		*sec -= SEC_THIS_YEAR(*year);
 		(*year)++;
 	}

Index: src/sys/dev/pci/ixgbe/ix_txrx.c
diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.18 src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.19
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.18	Sun Nov 10 13:36:29 2019
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Fri Jan 24 18:37:31 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.24.2.18 2019/11/10 13:36:29 martin Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.24.2.19 2020/01/24 18:37:31 martin Exp $ */
 
 /******************************************************************************
 
@@ -148,7 +148,7 @@ ixgbe_legacy_start_locked(struct ifnet *
 		return (ENETDOWN);
 	if (txr->txr_no_space)
 		return (ENETDOWN);
-	
+
 	while (!IFQ_IS_EMPTY(&ifp->if_snd)) {
 		if (txr->tx_avail <= IXGBE_QUEUE_MIN_FREE)
 			break;
@@ -1693,6 +1693,10 @@ ixgbe_free_receive_buffers(struct rx_rin
 				rxbuf->pmap = NULL;
 			}
 		}
+
+		/* NetBSD specific. See ixgbe_netbsd.c */
+		ixgbe_jcl_destroy(adapter, rxr);
+
 		if (rxr->rx_buffers != NULL) {
 			free(rxr->rx_buffers, M_DEVBUF);
 			rxr->rx_buffers = NULL;
@@ -2379,3 +2383,24 @@ tx_fail:
 fail:
 	return (error);
 } /* ixgbe_allocate_queues */
+
+/************************************************************************
+ * ixgbe_free_queues
+ *
+ *   Free descriptors for the transmit and receive rings, and then
+ *   the memory associated with each.
+ ************************************************************************/
+void
+ixgbe_free_queues(struct adapter *adapter)
+{
+	struct ix_queue *que;
+	int i;
+
+	ixgbe_free_transmit_structures(adapter);
+	ixgbe_free_receive_structures(adapter);
+	for (i = 0; i < adapter->num_queues; i++) {
+		que = &adapter->queues[i];
+		mutex_destroy(&que->dc_mtx);
+	}
+	free(adapter->queues, M_DEVBUF);
+} /* ixgbe_free_queues */

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.38 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.39
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.38	Thu Dec 26 20:25:07 2019
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Fri Jan 24 18:37:31 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.88.2.38 2019/12/26 20:25:07 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.88.2.39 2020/01/24 18:37:31 martin Exp $ */
 
 /******************************************************************************
 
@@ -351,7 +351,7 @@ SYSCTL_INT(_hw_ix, OID_AUTO, enable_msix
  * Number of Queues, can be set to 0,
  * it then autoconfigures based on the
  * number of cpus with a max of 8. This
- * can be overriden manually here.
+ * can be overridden manually here.
  */
 static int ixgbe_num_queues = 0;
 SYSCTL_INT(_hw_ix, OID_AUTO, num_queues, CTLFLAG_RDTUN, &ixgbe_num_queues, 0,
@@ -1058,9 +1058,7 @@ ixgbe_attach(device_t parent, device_t d
 		error = ixgbe_allocate_msix(adapter, pa);
 		if (error) {
 			/* Free allocated queue structures first */
-			ixgbe_free_transmit_structures(adapter);
-			ixgbe_free_receive_structures(adapter);
-			free(adapter->queues, M_DEVBUF);
+			ixgbe_free_queues(adapter);
 
 			/* Fallback to legacy interrupt */
 			adapter->feat_en &= ~IXGBE_FEATURE_MSIX;
@@ -1236,9 +1234,7 @@ ixgbe_attach(device_t parent, device_t d
 	return;
 
 err_late:
-	ixgbe_free_transmit_structures(adapter);
-	ixgbe_free_receive_structures(adapter);
-	free(adapter->queues, M_DEVBUF);
+	ixgbe_free_queues(adapter);
 err_out:
 	ctrl_ext = IXGBE_READ_REG(&adapter->hw, IXGBE_CTRL_EXT);
 	ctrl_ext &= ~IXGBE_CTRL_EXT_DRV_LOAD;
@@ -2332,7 +2328,7 @@ ixgbe_register_vlan(void *arg, struct if
 	IXGBE_CORE_LOCK(adapter);
 	index = (vtag >> 5) & 0x7F;
 	bit = vtag & 0x1F;
-	adapter->shadow_vfta[index] |= (1 << bit);
+	adapter->shadow_vfta[index] |= ((u32)1 << bit);
 	ixgbe_setup_vlan_hw_support(adapter);
 	IXGBE_CORE_UNLOCK(adapter);
 } /* ixgbe_register_vlan */
@@ -2357,7 +2353,7 @@ ixgbe_unregister_vlan(void *arg, struct 
 	IXGBE_CORE_LOCK(adapter);
 	index = (vtag >> 5) & 0x7F;
 	bit = vtag & 0x1F;
-	adapter->shadow_vfta[index] &= ~(1 << bit);
+	adapter->shadow_vfta[index] &= ~((u32)1 << bit);
 	/* Re-init to load the changes */
 	ixgbe_setup_vlan_hw_support(adapter);
 	IXGBE_CORE_UNLOCK(adapter);
@@ -3679,13 +3675,7 @@ ixgbe_detach(device_t dev, int flags)
 	evcnt_detach(&stats->ptc1023);
 	evcnt_detach(&stats->ptc1522);
 
-	ixgbe_free_transmit_structures(adapter);
-	ixgbe_free_receive_structures(adapter);
-	for (i = 0; i < adapter->num_queues; i++) {
-		struct ix_queue * que = &adapter->queues[i];
-		mutex_destroy(&que->dc_mtx);
-	}
-	free(adapter->queues, M_DEVBUF);
+	ixgbe_free_queues(adapter);
 	free(adapter->mta, M_DEVBUF);
 
 	IXGBE_CORE_LOCK_DESTROY(adapter);

Index: src/sys/dev/pci/ixgbe/ixgbe.h
diff -u src/sys/dev/pci/ixgbe/ixgbe.h:1.24.6.18 src/sys/dev/pci/ixgbe/ixgbe.h:1.24.6.19
--- src/sys/dev/pci/ixgbe/ixgbe.h:1.24.6.18	Thu Sep 26 18:19:26 2019
+++ src/sys/dev/pci/ixgbe/ixgbe.h	Fri Jan 24 18:37:31 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.h,v 1.24.6.18 2019/09/26 18:19:26 martin Exp $ */
+/* $NetBSD: ixgbe.h,v 1.24.6.19 2020/01/24 18:37:31 martin Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -134,9 +134,9 @@
  * RxDescriptors Valid Range: 64-4096 Default Value: 256 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. 
- * 
- * Note: with 8 rings and a dual port card, it is possible to bump up 
+ * is 16 bytes.  A receive buffer is also allocated for each descriptor.
+ *
+ * Note: with 8 rings and a dual port card, it is possible to bump up
  *	against the system mbuf pool limit, you can tune nmbclusters
  *	to adjust for this.
  */
@@ -769,6 +769,7 @@ void ixgbe_deferred_mq_start_work(struct
 void ixgbe_drain_all(struct adapter *);
 
 int  ixgbe_allocate_queues(struct adapter *);
+void ixgbe_free_queues(struct adapter *);
 int  ixgbe_setup_transmit_structures(struct adapter *);
 void ixgbe_free_transmit_structures(struct adapter *);
 int  ixgbe_setup_receive_structures(struct adapter *);
@@ -781,6 +782,7 @@ const struct sysctlnode *ixgbe_sysctl_in
 /* For NetBSD */
 void ixgbe_jcl_reinit(struct adapter *, bus_dma_tag_t, struct rx_ring *,
     int, size_t);
+void ixgbe_jcl_destroy(struct adapter *,  struct rx_ring *);
 
 #include "ixgbe_bypass.h"
 #include "ixgbe_fdir.h"

Index: src/sys/dev/pci/ixgbe/ixgbe_82598.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_82598.c:1.8.8.2 src/sys/dev/pci/ixgbe/ixgbe_82598.c:1.8.8.3
--- src/sys/dev/pci/ixgbe/ixgbe_82598.c:1.8.8.2	Sat Apr 14 10:25:11 2018
+++ src/sys/dev/pci/ixgbe/ixgbe_82598.c	Fri Jan 24 18:37:31 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_82598.c,v 1.8.8.2 2018/04/14 10:25:11 martin Exp $ */
+/* $NetBSD: ixgbe_82598.c,v 1.8.8.3 2020/01/24 18:37:31 martin Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -90,7 +90,7 @@ void ixgbe_set_pcie_completion_timeout(s
 		goto out;
 
 	/*
-	 * if capababilities version is type 1 we can write the
+	 * if capabilities version is type 1 we can write the
 	 * timeout of 10ms to 250ms through the GCR register
 	 */
 	if (!(gcr & IXGBE_GCR_CAP_VER2)) {
@@ -914,7 +914,7 @@ mac_reset_top:
 	/*
 	 * Store the original AUTOC value if it has not been
 	 * stored off yet.  Otherwise restore the stored original
-	 * AUTOC value since the reset operation sets back to deaults.
+	 * AUTOC value since the reset operation sets back to defaults.
 	 */
 	autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC);
 	if (hw->mac.orig_link_settings_stored == FALSE) {

Index: src/sys/dev/pci/ixgbe/ixgbe_api.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_api.c:1.15.8.5 src/sys/dev/pci/ixgbe/ixgbe_api.c:1.15.8.6
--- src/sys/dev/pci/ixgbe/ixgbe_api.c:1.15.8.5	Mon Jul 22 17:53:35 2019
+++ src/sys/dev/pci/ixgbe/ixgbe_api.c	Fri Jan 24 18:37:31 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_api.c,v 1.15.8.5 2019/07/22 17:53:35 martin Exp $ */
+/* $NetBSD: ixgbe_api.c,v 1.15.8.6 2020/01/24 18:37:31 martin Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -1381,8 +1381,8 @@ s32 ixgbe_bypass_rw(struct ixgbe_hw *hw,
  * ixgbe_bypass_valid_rd - Verify valid return from bit-bang.
  *
  * If we send a write we can't be sure it took until we can read back
- * that same register.  It can be a problem as some of the feilds may
- * for valid reasons change inbetween the time wrote the register and
+ * that same register.  It can be a problem as some of the fields may
+ * for valid reasons change in-between the time wrote the register and
  * we read it again to verify.  So this function check everything we
  * can check and then assumes it worked.
  *
@@ -1396,7 +1396,7 @@ bool ixgbe_bypass_valid_rd(struct ixgbe_
 }
 
 /**
- *  ixgbe_bypass_set - Set a bypass field in the FW CTRL Regiter.
+ *  ixgbe_bypass_set - Set a bypass field in the FW CTRL Register.
  *  @hw: pointer to hardware structure
  *  @cmd: The control word we are setting.
  *  @event: The event we are setting in the FW.  This also happens to

Index: src/sys/dev/pci/ixgbe/ixgbe_common.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_common.c:1.13.2.7 src/sys/dev/pci/ixgbe/ixgbe_common.c:1.13.2.8
--- src/sys/dev/pci/ixgbe/ixgbe_common.c:1.13.2.7	Thu Sep  5 09:06:08 2019
+++ src/sys/dev/pci/ixgbe/ixgbe_common.c	Fri Jan 24 18:37:31 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_common.c,v 1.13.2.7 2019/09/05 09:06:08 martin Exp $ */
+/* $NetBSD: ixgbe_common.c,v 1.13.2.8 2020/01/24 18:37:31 martin Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -5520,7 +5520,7 @@ s32 ixgbe_setup_mac_link_multispeed_fibe
 
 		goto out;
 	}
-	
+
 	/* We didn't get link.  Configure back to the highest speed we tried,
 	 * (if there was more than one).  We call ourselves back with just the
 	 * single highest speed that the user requested.

Index: src/sys/dev/pci/ixgbe/ixgbe_netbsd.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_netbsd.c:1.6.2.4 src/sys/dev/pci/ixgbe/ixgbe_netbsd.c:1.6.2.5
--- src/sys/dev/pci/ixgbe/ixgbe_netbsd.c:1.6.2.4	Thu Sep  5 09:06:08 2019
+++ src/sys/dev/pci/ixgbe/ixgbe_netbsd.c	Fri Jan 24 18:37:31 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_netbsd.c,v 1.6.2.4 2019/09/05 09:06:08 martin Exp $ */
+/* $NetBSD: ixgbe_netbsd.c,v 1.6.2.5 2020/01/24 18:37:31 martin Exp $ */
 /*
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -161,6 +161,22 @@ post_zalloc_err:
 	return NULL;
 }
 
+static void
+ixgbe_jcl_freeall(struct adapter *adapter, struct rx_ring *rxr)
+{
+	ixgbe_extmem_head_t *eh = &rxr->jcl_head;
+	ixgbe_extmem_t *em;
+	bus_dma_tag_t dmat = rxr->ptag->dt_dmat;
+
+	while ((em = ixgbe_getext(eh, 0)) != NULL) {
+		KASSERT(em->em_vaddr != NULL);
+		bus_dmamem_unmap(dmat, em->em_vaddr, em->em_size);
+		bus_dmamem_free(dmat, &em->em_seg, 1);
+		memset(em, 0, sizeof(*em));
+		kmem_free(em, sizeof(*em));
+	}
+}
+
 void
 ixgbe_jcl_reinit(struct adapter *adapter, bus_dma_tag_t dmat,
     struct rx_ring *rxr, int nbuf, size_t size)
@@ -187,13 +203,7 @@ ixgbe_jcl_reinit(struct adapter *adapter
 		return;
 
 	/* Free all dmamem */
-	while ((em = ixgbe_getext(eh, 0)) != NULL) {
-		KASSERT(em->em_vaddr != NULL);
-		bus_dmamem_unmap(dmat, em->em_vaddr, em->em_size);
-		bus_dmamem_free(dmat, &em->em_seg, 1);
-		memset(em, 0, sizeof(*em));
-		kmem_free(em, sizeof(*em));
-	}
+	ixgbe_jcl_freeall(adapter, rxr);
 
 	for (i = 0; i < nbuf; i++) {
 		if ((em = ixgbe_newext(eh, dmat, size)) == NULL) {
@@ -210,6 +220,21 @@ ixgbe_jcl_reinit(struct adapter *adapter
 	rxr->last_num_rx_desc = adapter->num_rx_desc;
 }
 
+void
+ixgbe_jcl_destroy(struct adapter *adapter, struct rx_ring *rxr)
+{
+	ixgbe_extmem_head_t *eh = &rxr->jcl_head;
+
+	if (eh->eh_initialized) {
+		/* Free all dmamem */
+		ixgbe_jcl_freeall(adapter, rxr);
+
+		mutex_destroy(&eh->eh_mtx);
+		eh->eh_initialized = false;
+	}
+}
+
+
 static void
 ixgbe_jcl_free(struct mbuf *m, void *buf, size_t size, void *arg)
 {

Index: src/sys/dev/pci/ixgbe/ixgbe_osdep.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_osdep.c:1.1.12.3 src/sys/dev/pci/ixgbe/ixgbe_osdep.c:1.1.12.4
--- src/sys/dev/pci/ixgbe/ixgbe_osdep.c:1.1.12.3	Sat Apr 14 10:25:11 2018
+++ src/sys/dev/pci/ixgbe/ixgbe_osdep.c	Fri Jan 24 18:37:31 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_osdep.c,v 1.1.12.3 2018/04/14 10:25:11 martin Exp $ */
+/* $NetBSD: ixgbe_osdep.c,v 1.1.12.4 2020/01/24 18:37:31 martin Exp $ */
 
 /******************************************************************************
 
@@ -56,7 +56,7 @@ ixgbe_read_pci_cfg(struct ixgbe_hw *hw, 
 		return __SHIFTOUT(pci_conf_read(pc, tag, reg - 2),
 		    __BITS(31, 16));
 	default:
-		panic("%s: invalid register (%" PRIx32, __func__, reg); 
+		panic("%s: invalid register (%" PRIx32, __func__, reg);
 		break;
 	}
 }
@@ -79,7 +79,7 @@ ixgbe_write_pci_cfg(struct ixgbe_hw *hw,
 		    __SHIFTIN(value, __BITS(31, 16)) | old);
 		break;
 	default:
-		panic("%s: invalid register (%" PRIx32, __func__, reg); 
+		panic("%s: invalid register (%" PRIx32, __func__, reg);
 		break;
 	}
 

Index: src/sys/dev/pci/ixgbe/ixgbe_osdep.h
diff -u src/sys/dev/pci/ixgbe/ixgbe_osdep.h:1.17.6.5 src/sys/dev/pci/ixgbe/ixgbe_osdep.h:1.17.6.6
--- src/sys/dev/pci/ixgbe/ixgbe_osdep.h:1.17.6.5	Tue Aug  7 13:33:23 2018
+++ src/sys/dev/pci/ixgbe/ixgbe_osdep.h	Fri Jan 24 18:37:31 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_osdep.h,v 1.17.6.5 2018/08/07 13:33:23 martin Exp $ */
+/* $NetBSD: ixgbe_osdep.h,v 1.17.6.6 2020/01/24 18:37:31 martin Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -54,7 +54,7 @@
 #include <net/if.h>
 #include <net/if_ether.h>
 
-#define ASSERT(x) if(!(x)) panic("IXGBE: x")
+#define ASSERT(x) if (!(x)) panic("IXGBE: x")
 #define EWARN(H, W) printf(W)
 
 enum {
@@ -152,7 +152,7 @@ typedef uint32_t	u32;
 typedef int32_t		s32;
 typedef uint64_t	u64;
 
-#define le16_to_cpu 
+#define le16_to_cpu
 
 /* This device driver's max interrupt numbers. */
 #define IXG_MAX_NINTR		64

Index: src/sys/dev/pci/ixgbe/ixgbe_phy.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_phy.c:1.11.6.4 src/sys/dev/pci/ixgbe/ixgbe_phy.c:1.11.6.5
--- src/sys/dev/pci/ixgbe/ixgbe_phy.c:1.11.6.4	Mon Jul 22 17:53:35 2019
+++ src/sys/dev/pci/ixgbe/ixgbe_phy.c	Fri Jan 24 18:37:31 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_phy.c,v 1.11.6.4 2019/07/22 17:53:35 martin Exp $ */
+/* $NetBSD: ixgbe_phy.c,v 1.11.6.5 2020/01/24 18:37:31 martin Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -876,7 +876,7 @@ s32 ixgbe_setup_phy_link_generic(struct 
 		hw->phy.ops.read_reg(hw, IXGBE_MDIO_AUTO_NEG_CONTROL,
 			     IXGBE_MDIO_AUTO_NEG_DEV_TYPE, &autoneg_reg);
 
-		autoneg_reg &= ~AN_CTRL1_AUTOEN;	
+		autoneg_reg &= ~AN_CTRL1_AUTOEN;
 
 		hw->phy.ops.write_reg(hw, IXGBE_MDIO_AUTO_NEG_CONTROL,
 			      IXGBE_MDIO_AUTO_NEG_DEV_TYPE, autoneg_reg);

Index: src/sys/dev/pci/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.56.2.28 src/sys/dev/pci/ixgbe/ixv.c:1.56.2.29
--- src/sys/dev/pci/ixgbe/ixv.c:1.56.2.28	Tue Nov 19 10:48:15 2019
+++ src/sys/dev/pci/ixgbe/ixv.c	Fri Jan 24 18:37:31 2020
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.56.2.28 2019/11/19 10:48:15 martin Exp $*/
+/*$NetBSD: ixv.c,v 1.56.2.29 2020/01/24 18:37:31 martin Exp $*/
 
 /******************************************************************************
 
@@ -559,9 +559,7 @@ ixv_attach(device_t parent, device_t dev
 	return;
 
 err_late:
-	ixgbe_free_transmit_structures(adapter);
-	ixgbe_free_receive_structures(adapter);
-	free(adapter->queues, M_DEVBUF);
+	ixgbe_free_queues(adapter);
 err_out:
 	ixv_free_pci_resources(adapter);
 	IXGBE_CORE_LOCK_DESTROY(adapter);
@@ -694,13 +692,7 @@ ixv_detach(device_t dev, int flags)
 	evcnt_detach(&hw->mbx.stats.reqs);
 	evcnt_detach(&hw->mbx.stats.rsts);
 
-	ixgbe_free_transmit_structures(adapter);
-	ixgbe_free_receive_structures(adapter);
-	for (int i = 0; i < adapter->num_queues; i++) {
-		struct ix_queue *lque = &adapter->queues[i];
-		mutex_destroy(&lque->dc_mtx);
-	}
-	free(adapter->queues, M_DEVBUF);
+	ixgbe_free_queues(adapter);
 
 	IXGBE_CORE_LOCK_DESTROY(adapter);
 
@@ -786,19 +778,6 @@ ixv_init_locked(struct adapter *adapter)
 	/* Configure RX settings */
 	ixv_initialize_receive_units(adapter);
 
-#if 0 /* XXX isn't it required? -- msaitoh  */
-	/* Set the various hardware offload abilities */
-	ifp->if_hwassist = 0;
-	if (ifp->if_capenable & IFCAP_TSO4)
-		ifp->if_hwassist |= CSUM_TSO;
-	if (ifp->if_capenable & IFCAP_TXCSUM) {
-		ifp->if_hwassist |= (CSUM_TCP | CSUM_UDP);
-#if __FreeBSD_version >= 800000
-		ifp->if_hwassist |= CSUM_SCTP;
-#endif
-	}
-#endif
-
 	/* Set up VLAN offload and filter */
 	ixv_setup_vlan_support(adapter);
 
@@ -2126,7 +2105,7 @@ ixv_register_vlan(void *arg, struct ifne
 	IXGBE_CORE_LOCK(adapter);
 	index = (vtag >> 5) & 0x7F;
 	bit = vtag & 0x1F;
-	ixv_shadow_vfta[index] |= (1 << bit);
+	ixv_shadow_vfta[index] |= ((u32)1 << bit);
 	/* Re-init to load the changes */
 	ixv_init_locked(adapter);
 	IXGBE_CORE_UNLOCK(adapter);
@@ -2153,7 +2132,7 @@ ixv_unregister_vlan(void *arg, struct if
 	IXGBE_CORE_LOCK(adapter);
 	index = (vtag >> 5) & 0x7F;
 	bit = vtag & 0x1F;
-	ixv_shadow_vfta[index] &= ~(1 << bit);
+	ixv_shadow_vfta[index] &= ~((u32)1 << bit);
 	/* Re-init to load the changes */
 	ixv_init_locked(adapter);
 	IXGBE_CORE_UNLOCK(adapter);

Reply via email to