Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-9]: src/sys/dev/pci/ixgbe Pull up the following (via patch), requ...
details: https://anonhg.NetBSD.org/src/rev/5ff6c33bec8a
branches: netbsd-9
changeset: 744167:5ff6c33bec8a
user: martin <martin%NetBSD.org@localhost>
date: Sun Jan 26 11:03:17 2020 +0000
description:
Pull up the following (via patch), requested by msaitoh in ticket #648
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.220-1.221
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.142,1.144
- Free RX structure correctly when detaching.
- Remove unused code.
- Fix some typos in comment.
- Remove extra spaces.
- KNF.
diffstat:
sys/dev/pci/ixgbe/if_bypass.c | 2 +-
sys/dev/pci/ixgbe/ix_txrx.c | 29 ++++++++++++++++++++++++++-
sys/dev/pci/ixgbe/ixgbe.c | 20 ++++--------------
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 | 33 +++++--------------------------
12 files changed, 95 insertions(+), 74 deletions(-)
diffs (truncated from 456 to 300 lines):
diff -r 27499864fed5 -r 5ff6c33bec8a sys/dev/pci/ixgbe/if_bypass.c
--- a/sys/dev/pci/ixgbe/if_bypass.c Sun Jan 26 10:55:16 2020 +0000
+++ b/sys/dev/pci/ixgbe/if_bypass.c Sun Jan 26 11:03:17 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 27499864fed5 -r 5ff6c33bec8a sys/dev/pci/ixgbe/ix_txrx.c
--- a/sys/dev/pci/ixgbe/ix_txrx.c Sun Jan 26 10:55:16 2020 +0000
+++ b/sys/dev/pci/ixgbe/ix_txrx.c Sun Jan 26 11:03:17 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.54.2.2 2019/11/01 09:34:27 martin Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.54.2.3 2020/01/26 11:03:17 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 27499864fed5 -r 5ff6c33bec8a sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Sun Jan 26 10:55:16 2020 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Sun Jan 26 11:03:17 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.199.2.8 2019/12/24 17:44:22 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.199.2.9 2020/01/26 11:03:17 martin Exp $ */
/******************************************************************************
@@ -353,7 +353,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,
@@ -1063,9 +1063,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;
@@ -1241,9 +1239,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;
@@ -3717,13 +3713,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 27499864fed5 -r 5ff6c33bec8a sys/dev/pci/ixgbe/ixgbe.h
--- a/sys/dev/pci/ixgbe/ixgbe.h Sun Jan 26 10:55:16 2020 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.h Sun Jan 26 11:03:17 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.h,v 1.56.2.1 2019/09/26 19:07:22 martin Exp $ */
+/* $NetBSD: ixgbe.h,v 1.56.2.2 2020/01/26 11:03:17 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.
*/
@@ -770,6 +770,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 *);
@@ -782,6 +783,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 27499864fed5 -r 5ff6c33bec8a sys/dev/pci/ixgbe/ixgbe_82598.c
--- a/sys/dev/pci/ixgbe/ixgbe_82598.c Sun Jan 26 10:55:16 2020 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe_82598.c Sun Jan 26 11:03:17 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_82598.c,v 1.12 2018/04/04 08:59:22 msaitoh Exp $ */
+/* $NetBSD: ixgbe_82598.c,v 1.12.8.1 2020/01/26 11:03:17 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 27499864fed5 -r 5ff6c33bec8a sys/dev/pci/ixgbe/ixgbe_api.c
--- a/sys/dev/pci/ixgbe/ixgbe_api.c Sun Jan 26 10:55:16 2020 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe_api.c Sun Jan 26 11:03:17 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_api.c,v 1.23 2019/06/27 05:55:40 msaitoh Exp $ */
+/* $NetBSD: ixgbe_api.c,v 1.23.2.1 2020/01/26 11:03:17 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 27499864fed5 -r 5ff6c33bec8a sys/dev/pci/ixgbe/ixgbe_common.c
--- a/sys/dev/pci/ixgbe/ixgbe_common.c Sun Jan 26 10:55:16 2020 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe_common.c Sun Jan 26 11:03:17 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_common.c,v 1.25 2019/07/25 09:01:56 msaitoh Exp $ */
+/* $NetBSD: ixgbe_common.c,v 1.25.2.1 2020/01/26 11:03:17 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 27499864fed5 -r 5ff6c33bec8a sys/dev/pci/ixgbe/ixgbe_netbsd.c
--- a/sys/dev/pci/ixgbe/ixgbe_netbsd.c Sun Jan 26 10:55:16 2020 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe_netbsd.c Sun Jan 26 11:03:17 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_netbsd.c,v 1.9.4.1 2019/09/05 09:11:03 martin Exp $ */
+/* $NetBSD: ixgbe_netbsd.c,v 1.9.4.2 2020/01/26 11:03:17 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;
}
+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
Home |
Main Index |
Thread Index |
Old Index