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.
This commit is contained in:
parent
c592185caf
commit
ead075f9f9
|
@ -101,7 +101,7 @@ ixgbe_get_bypass_time(u32 *year, u32 *sec)
|
|||
nanotime(¤t);
|
||||
*sec = current.tv_sec;
|
||||
|
||||
while(*sec > SEC_THIS_YEAR(*year)) {
|
||||
while (*sec > SEC_THIS_YEAR(*year)) {
|
||||
*sec -= SEC_THIS_YEAR(*year);
|
||||
(*year)++;
|
||||
}
|
||||
|
|
|
@ -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 @@ ixgbe_legacy_start_locked(struct ifnet *ifp, struct tx_ring *txr)
|
|||
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_ring *rxr)
|
|||
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 */
|
||||
|
|
|
@ -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 @@ SYSCTL_INT(_hw_ix, OID_AUTO, enable_msix, CTLFLAG_RDTUN, &ixgbe_enable_msix, 0,
|
|||
* 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 @@ ixgbe_attach(device_t parent, device_t dev, void *aux)
|
|||
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 @@ ixgbe_attach(device_t parent, device_t dev, void *aux)
|
|||
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 @@ 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);
|
||||
|
|
|
@ -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_deferred_mq_start_work(struct work *, void *);
|
|||
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 @@ const struct sysctlnode *ixgbe_sysctl_instance(struct adapter *);
|
|||
/* 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"
|
||||
|
|
|
@ -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 @@ void ixgbe_set_pcie_completion_timeout(struct ixgbe_hw *hw)
|
|||
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) {
|
||||
|
|
|
@ -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 @@ s32 ixgbe_bypass_rw(struct ixgbe_hw *hw, u32 cmd, u32 *status)
|
|||
* 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_hw *hw, u32 in_reg, u32 out_reg)
|
|||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
|
|
@ -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 @@ s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw,
|
|||
|
||||
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.
|
||||
|
|
|
@ -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 @@ 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, bus_dma_tag_t dmat,
|
|||
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, bus_dma_tag_t dmat,
|
|||
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)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ixgbe_osdep.c,v 1.4.8.1 2019/12/24 17:44:22 martin Exp $ */
|
||||
/* $NetBSD: ixgbe_osdep.c,v 1.4.8.2 2020/01/26 11:03:17 martin Exp $ */
|
||||
|
||||
/******************************************************************************
|
||||
|
||||
|
@ -56,7 +56,7 @@ ixgbe_read_pci_cfg(struct ixgbe_hw *hw, u32 reg)
|
|||
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, u32 reg, u16 value)
|
|||
__SHIFTIN(value, __BITS(31, 16)) | old);
|
||||
break;
|
||||
default:
|
||||
panic("%s: invalid register (%" PRIx32, __func__, reg);
|
||||
panic("%s: invalid register (%" PRIx32, __func__, reg);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ixgbe_osdep.h,v 1.23.6.1 2019/12/24 17:44:22 martin Exp $ */
|
||||
/* $NetBSD: ixgbe_osdep.h,v 1.23.6.2 2020/01/26 11:03:17 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
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ixgbe_phy.c,v 1.18 2018/12/06 13:25:02 msaitoh Exp $ */
|
||||
/* $NetBSD: ixgbe_phy.c,v 1.18.4.1 2020/01/26 11:03:17 martin Exp $ */
|
||||
|
||||
/******************************************************************************
|
||||
SPDX-License-Identifier: BSD-3-Clause
|
||||
|
@ -876,7 +876,7 @@ s32 ixgbe_setup_phy_link_generic(struct ixgbe_hw *hw)
|
|||
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);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*$NetBSD: ixv.c,v 1.125.2.8 2019/12/24 17:44:22 martin Exp $*/
|
||||
/*$NetBSD: ixv.c,v 1.125.2.9 2020/01/26 11:03:17 martin Exp $*/
|
||||
|
||||
/******************************************************************************
|
||||
|
||||
|
@ -547,9 +547,7 @@ ixv_attach(device_t parent, device_t dev, void *aux)
|
|||
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);
|
||||
|
@ -674,13 +672,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);
|
||||
|
||||
|
@ -766,19 +758,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);
|
||||
|
||||
|
@ -2101,7 +2080,7 @@ ixv_setup_vlan_support(struct adapter *adapter)
|
|||
adapter->shadow_vfta[idx] |= (u32)1 << (vlanidp->vid % 32);
|
||||
}
|
||||
ETHER_UNLOCK(ec);
|
||||
|
||||
|
||||
/*
|
||||
* A soft reset zero's out the VFTA, so
|
||||
* we need to repopulate it now.
|
||||
|
@ -2120,7 +2099,7 @@ ixv_setup_vlan_support(struct adapter *adapter)
|
|||
if ((vfta & ((u32)1 << j)) == 0)
|
||||
continue;
|
||||
vid = (i * 32) + j;
|
||||
|
||||
|
||||
/* Call the shared code mailbox routine */
|
||||
while ((rv = hw->mac.ops.set_vfta(hw, vid, 0, TRUE,
|
||||
FALSE)) != 0) {
|
||||
|
@ -2209,7 +2188,7 @@ ixv_unregister_vlan(struct adapter *adapter, u16 vtag)
|
|||
{
|
||||
struct ixgbe_hw *hw = &adapter->hw;
|
||||
u16 index, bit;
|
||||
int error;
|
||||
int error;
|
||||
|
||||
if ((vtag == 0) || (vtag > 4095)) /* Invalid */
|
||||
return EINVAL;
|
||||
|
|
Loading…
Reference in New Issue