Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-8]: src/sys/dev/pci/ixgbe Pull up the following, requested by msa...
details: https://anonhg.NetBSD.org/src/rev/3d72b1067af9
branches: netbsd-8
changeset: 852718:3d72b1067af9
user: martin <martin%NetBSD.org@localhost>
date: Fri Jan 24 18:37:31 2020 +0000
description:
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.
diffstat:
sys/dev/pci/ixgbe/if_bypass.c | 2 +-
sys/dev/pci/ixgbe/ix_txrx.c | 29 ++++++++++++++++++++++++++-
sys/dev/pci/ixgbe/ixgbe.c | 24 ++++++----------------
sys/dev/pci/ixgbe/ixgbe.h | 10 +++++---
sys/dev/pci/ixgbe/ixgbe_82598.c | 6 ++--
sys/dev/pci/ixgbe/ixgbe_api.c | 8 +++---
sys/dev/pci/ixgbe/ixgbe_common.c | 4 +-
sys/dev/pci/ixgbe/ixgbe_netbsd.c | 41 ++++++++++++++++++++++++++++++++-------
sys/dev/pci/ixgbe/ixgbe_osdep.c | 6 ++--
sys/dev/pci/ixgbe/ixgbe_osdep.h | 6 ++--
sys/dev/pci/ixgbe/ixgbe_phy.c | 4 +-
sys/dev/pci/ixgbe/ixv.c | 31 ++++-------------------------
12 files changed, 96 insertions(+), 75 deletions(-)
diffs (truncated from 465 to 300 lines):
diff -r fbc40ac60869 -r 3d72b1067af9 sys/dev/pci/ixgbe/if_bypass.c
--- a/sys/dev/pci/ixgbe/if_bypass.c Thu Jan 23 10:32:38 2020 +0000
+++ b/sys/dev/pci/ixgbe/if_bypass.c Fri Jan 24 18:37:31 2020 +0000
@@ -101,7 +101,7 @@
nanotime(¤t);
*sec = current.tv_sec;
- while(*sec > SEC_THIS_YEAR(*year)) {
+ while (*sec > SEC_THIS_YEAR(*year)) {
*sec -= SEC_THIS_YEAR(*year);
(*year)++;
}
diff -r fbc40ac60869 -r 3d72b1067af9 sys/dev/pci/ixgbe/ix_txrx.c
--- a/sys/dev/pci/ixgbe/ix_txrx.c Thu Jan 23 10:32:38 2020 +0000
+++ b/sys/dev/pci/ixgbe/ix_txrx.c Fri Jan 24 18:37:31 2020 +0000
@@ -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 @@
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 @@
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 @@
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 */
diff -r fbc40ac60869 -r 3d72b1067af9 sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Thu Jan 23 10:32:38 2020 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Fri Jan 24 18:37:31 2020 +0000
@@ -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 @@
* 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 @@
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 @@
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_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_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 @@
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);
diff -r fbc40ac60869 -r 3d72b1067af9 sys/dev/pci/ixgbe/ixgbe.h
--- a/sys/dev/pci/ixgbe/ixgbe.h Thu Jan 23 10:32:38 2020 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.h Fri Jan 24 18:37:31 2020 +0000
@@ -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_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 @@
/* 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"
diff -r fbc40ac60869 -r 3d72b1067af9 sys/dev/pci/ixgbe/ixgbe_82598.c
--- a/sys/dev/pci/ixgbe/ixgbe_82598.c Thu Jan 23 10:32:38 2020 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe_82598.c Fri Jan 24 18:37:31 2020 +0000
@@ -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 @@
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 @@
/*
* 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) {
diff -r fbc40ac60869 -r 3d72b1067af9 sys/dev/pci/ixgbe/ixgbe_api.c
--- a/sys/dev/pci/ixgbe/ixgbe_api.c Thu Jan 23 10:32:38 2020 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe_api.c Fri Jan 24 18:37:31 2020 +0000
@@ -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 @@
* 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 @@
}
/**
- * 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
diff -r fbc40ac60869 -r 3d72b1067af9 sys/dev/pci/ixgbe/ixgbe_common.c
--- a/sys/dev/pci/ixgbe/ixgbe_common.c Thu Jan 23 10:32:38 2020 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe_common.c Fri Jan 24 18:37:31 2020 +0000
@@ -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 @@
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.
diff -r fbc40ac60869 -r 3d72b1067af9 sys/dev/pci/ixgbe/ixgbe_netbsd.c
--- a/sys/dev/pci/ixgbe/ixgbe_netbsd.c Thu Jan 23 10:32:38 2020 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe_netbsd.c Fri Jan 24 18:37:31 2020 +0000
@@ -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 @@
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 @@
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 @@
rxr->last_num_rx_desc = adapter->num_rx_desc;
Home |
Main Index |
Thread Index |
Old Index