Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/e1000/if_em.c
Show First 20 Lines • Show All 287 Lines • ▼ Show 20 Lines | |||||
static void em_get_wakeup(if_ctx_t ctx); | static void em_get_wakeup(if_ctx_t ctx); | ||||
static void em_enable_wakeup(if_ctx_t ctx); | static void em_enable_wakeup(if_ctx_t ctx); | ||||
static int em_enable_phy_wakeup(struct adapter *); | static int em_enable_phy_wakeup(struct adapter *); | ||||
static void em_disable_aspm(struct adapter *); | static void em_disable_aspm(struct adapter *); | ||||
int em_intr(void *arg); | int em_intr(void *arg); | ||||
static void em_disable_promisc(if_ctx_t ctx); | static void em_disable_promisc(if_ctx_t ctx); | ||||
/* MSIX handlers */ | /* MSI-X handlers */ | ||||
static int em_if_msix_intr_assign(if_ctx_t, int); | static int em_if_msix_intr_assign(if_ctx_t, int); | ||||
static int em_msix_link(void *); | static int em_msix_link(void *); | ||||
static void em_handle_link(void *context); | static void em_handle_link(void *context); | ||||
static void em_enable_vectors_82574(if_ctx_t); | static void em_enable_vectors_82574(if_ctx_t); | ||||
static int em_set_flowcntl(SYSCTL_HANDLER_ARGS); | static int em_set_flowcntl(SYSCTL_HANDLER_ARGS); | ||||
static int em_sysctl_eee(SYSCTL_HANDLER_ARGS); | static int em_sysctl_eee(SYSCTL_HANDLER_ARGS); | ||||
▲ Show 20 Lines • Show All 470 Lines • ▼ Show 20 Lines | SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), | ||||
em_get_rs, "I", "Dump RS indexes"); | em_get_rs, "I", "Dump RS indexes"); | ||||
/* Determine hardware and mac info */ | /* Determine hardware and mac info */ | ||||
em_identify_hardware(ctx); | em_identify_hardware(ctx); | ||||
scctx->isc_msix_bar = PCIR_BAR(EM_MSIX_BAR); | scctx->isc_msix_bar = PCIR_BAR(EM_MSIX_BAR); | ||||
scctx->isc_tx_nsegments = EM_MAX_SCATTER; | scctx->isc_tx_nsegments = EM_MAX_SCATTER; | ||||
scctx->isc_nrxqsets_max = scctx->isc_ntxqsets_max = em_set_num_queues(ctx); | scctx->isc_nrxqsets_max = scctx->isc_ntxqsets_max = em_set_num_queues(ctx); | ||||
device_printf(dev, "attach_pre capping queues at %d\n", scctx->isc_ntxqsets_max); | if (bootverbose) | ||||
device_printf(dev, "attach_pre capping queues at %d\n", | |||||
scctx->isc_ntxqsets_max); | |||||
if (adapter->hw.mac.type >= igb_mac_min) { | if (adapter->hw.mac.type >= igb_mac_min) { | ||||
int try_second_bar; | int try_second_bar; | ||||
scctx->isc_txqsizes[0] = roundup2(scctx->isc_ntxd[0] * sizeof(union e1000_adv_tx_desc), EM_DBA_ALIGN); | scctx->isc_txqsizes[0] = roundup2(scctx->isc_ntxd[0] * sizeof(union e1000_adv_tx_desc), EM_DBA_ALIGN); | ||||
scctx->isc_rxqsizes[0] = roundup2(scctx->isc_nrxd[0] * sizeof(union e1000_adv_rx_desc), EM_DBA_ALIGN); | scctx->isc_rxqsizes[0] = roundup2(scctx->isc_nrxd[0] * sizeof(union e1000_adv_rx_desc), EM_DBA_ALIGN); | ||||
scctx->isc_txd_size[0] = sizeof(union e1000_adv_tx_desc); | scctx->isc_txd_size[0] = sizeof(union e1000_adv_tx_desc); | ||||
scctx->isc_rxd_size[0] = sizeof(union e1000_adv_rx_desc); | scctx->isc_rxd_size[0] = sizeof(union e1000_adv_rx_desc); | ||||
▲ Show 20 Lines • Show All 504 Lines • ▼ Show 20 Lines | else { | ||||
E1000_WRITE_REG(&adapter->hw, E1000_CTRL, ctrl); | E1000_WRITE_REG(&adapter->hw, E1000_CTRL, ctrl); | ||||
} | } | ||||
} | } | ||||
/* Don't lose promiscuous settings */ | /* Don't lose promiscuous settings */ | ||||
em_if_set_promisc(ctx, IFF_PROMISC); | em_if_set_promisc(ctx, IFF_PROMISC); | ||||
e1000_clear_hw_cntrs_base_generic(&adapter->hw); | e1000_clear_hw_cntrs_base_generic(&adapter->hw); | ||||
/* MSI/X configuration for 82574 */ | /* MSI-X configuration for 82574 */ | ||||
if (adapter->hw.mac.type == e1000_82574) { | if (adapter->hw.mac.type == e1000_82574) { | ||||
int tmp = E1000_READ_REG(&adapter->hw, E1000_CTRL_EXT); | int tmp = E1000_READ_REG(&adapter->hw, E1000_CTRL_EXT); | ||||
tmp |= E1000_CTRL_EXT_PBA_CLR; | tmp |= E1000_CTRL_EXT_PBA_CLR; | ||||
E1000_WRITE_REG(&adapter->hw, E1000_CTRL_EXT, tmp); | E1000_WRITE_REG(&adapter->hw, E1000_CTRL_EXT, tmp); | ||||
/* Set the IVAR - interrupt vector routing. */ | /* Set the IVAR - interrupt vector routing. */ | ||||
E1000_WRITE_REG(&adapter->hw, E1000_IVAR, adapter->ivars); | E1000_WRITE_REG(&adapter->hw, E1000_IVAR, adapter->ivars); | ||||
} else if (adapter->intr_type == IFLIB_INTR_MSIX) /* Set up queue routing */ | } else if (adapter->intr_type == IFLIB_INTR_MSIX) /* Set up queue routing */ | ||||
▲ Show 20 Lines • Show All 109 Lines • ▼ Show 20 Lines | if (adapter->hw.mac.type >= igb_mac_min) | ||||
igb_tx_enable_queue(adapter, txq); | igb_tx_enable_queue(adapter, txq); | ||||
else | else | ||||
em_tx_enable_queue(adapter, txq); | em_tx_enable_queue(adapter, txq); | ||||
return (0); | return (0); | ||||
} | } | ||||
/********************************************************************* | /********************************************************************* | ||||
* | * | ||||
* MSIX RX Interrupt Service routine | * MSI-X RX Interrupt Service routine | ||||
* | * | ||||
**********************************************************************/ | **********************************************************************/ | ||||
static int | static int | ||||
em_msix_que(void *arg) | em_msix_que(void *arg) | ||||
{ | { | ||||
struct em_rx_queue *que = arg; | struct em_rx_queue *que = arg; | ||||
++que->irqs; | ++que->irqs; | ||||
return (FILTER_SCHEDULE_THREAD); | return (FILTER_SCHEDULE_THREAD); | ||||
} | } | ||||
/********************************************************************* | /********************************************************************* | ||||
* | * | ||||
* MSIX Link Fast Interrupt Service routine | * MSI-X Link Fast Interrupt Service routine | ||||
* | * | ||||
**********************************************************************/ | **********************************************************************/ | ||||
static int | static int | ||||
em_msix_link(void *arg) | em_msix_link(void *arg) | ||||
{ | { | ||||
struct adapter *adapter = arg; | struct adapter *adapter = arg; | ||||
u32 reg_icr; | u32 reg_icr; | ||||
▲ Show 20 Lines • Show All 453 Lines • ▼ Show 20 Lines | em_allocate_pci_resources(if_ctx_t ctx) | ||||
/* Only older adapters use IO mapping */ | /* Only older adapters use IO mapping */ | ||||
if (adapter->hw.mac.type < em_mac_min && | if (adapter->hw.mac.type < em_mac_min && | ||||
adapter->hw.mac.type > e1000_82543) { | adapter->hw.mac.type > e1000_82543) { | ||||
/* Figure our where our IO BAR is ? */ | /* Figure our where our IO BAR is ? */ | ||||
for (rid = PCIR_BAR(0); rid < PCIR_CIS;) { | for (rid = PCIR_BAR(0); rid < PCIR_CIS;) { | ||||
val = pci_read_config(dev, rid, 4); | val = pci_read_config(dev, rid, 4); | ||||
if (EM_BAR_TYPE(val) == EM_BAR_TYPE_IO) { | if (EM_BAR_TYPE(val) == EM_BAR_TYPE_IO) { | ||||
adapter->io_rid = rid; | |||||
break; | break; | ||||
} | } | ||||
rid += 4; | rid += 4; | ||||
/* check for 64bit BAR */ | /* check for 64bit BAR */ | ||||
if (EM_BAR_MEM_TYPE(val) == EM_BAR_MEM_TYPE_64BIT) | if (EM_BAR_MEM_TYPE(val) == EM_BAR_MEM_TYPE_64BIT) | ||||
rid += 4; | rid += 4; | ||||
} | } | ||||
if (rid >= PCIR_CIS) { | if (rid >= PCIR_CIS) { | ||||
device_printf(dev, "Unable to locate IO BAR\n"); | device_printf(dev, "Unable to locate IO BAR\n"); | ||||
return (ENXIO); | return (ENXIO); | ||||
} | } | ||||
adapter->ioport = bus_alloc_resource_any(dev, | adapter->ioport = bus_alloc_resource_any(dev, SYS_RES_IOPORT, | ||||
SYS_RES_IOPORT, &adapter->io_rid, RF_ACTIVE); | &rid, RF_ACTIVE); | ||||
if (adapter->ioport == NULL) { | if (adapter->ioport == NULL) { | ||||
device_printf(dev, "Unable to allocate bus resource: " | device_printf(dev, "Unable to allocate bus resource: " | ||||
"ioport\n"); | "ioport\n"); | ||||
return (ENXIO); | return (ENXIO); | ||||
} | } | ||||
adapter->hw.io_base = 0; | adapter->hw.io_base = 0; | ||||
adapter->osdep.io_bus_space_tag = | adapter->osdep.io_bus_space_tag = | ||||
rman_get_bustag(adapter->ioport); | rman_get_bustag(adapter->ioport); | ||||
adapter->osdep.io_bus_space_handle = | adapter->osdep.io_bus_space_handle = | ||||
rman_get_bushandle(adapter->ioport); | rman_get_bushandle(adapter->ioport); | ||||
} | } | ||||
adapter->hw.back = &adapter->osdep; | adapter->hw.back = &adapter->osdep; | ||||
return (0); | return (0); | ||||
} | } | ||||
/********************************************************************* | /********************************************************************* | ||||
* | * | ||||
* Setup the MSIX Interrupt handlers | * Set up the MSI-X Interrupt handlers | ||||
* | * | ||||
**********************************************************************/ | **********************************************************************/ | ||||
static int | static int | ||||
em_if_msix_intr_assign(if_ctx_t ctx, int msix) | em_if_msix_intr_assign(if_ctx_t ctx, int msix) | ||||
{ | { | ||||
struct adapter *adapter = iflib_get_softc(ctx); | struct adapter *adapter = iflib_get_softc(ctx); | ||||
struct em_rx_queue *rx_que = adapter->rx_queues; | struct em_rx_queue *rx_que = adapter->rx_queues; | ||||
struct em_tx_queue *tx_que = adapter->tx_queues; | struct em_tx_queue *tx_que = adapter->tx_queues; | ||||
Show All 12 Lines | for (i = 0; i < adapter->rx_num_queues; i++, rx_que++, vector++) { | ||||
} | } | ||||
rx_que->msix = vector; | rx_que->msix = vector; | ||||
/* | /* | ||||
* Set the bit to enable interrupt | * Set the bit to enable interrupt | ||||
* in E1000_IMS -- bits 20 and 21 | * in E1000_IMS -- bits 20 and 21 | ||||
* are for RX0 and RX1, note this has | * are for RX0 and RX1, note this has | ||||
* NOTHING to do with the MSIX vector | * NOTHING to do with the MSI-X vector | ||||
*/ | */ | ||||
if (adapter->hw.mac.type == e1000_82574) { | if (adapter->hw.mac.type == e1000_82574) { | ||||
rx_que->eims = 1 << (20 + i); | rx_que->eims = 1 << (20 + i); | ||||
adapter->ims |= rx_que->eims; | adapter->ims |= rx_que->eims; | ||||
adapter->ivars |= (8 | rx_que->msix) << (i * 4); | adapter->ivars |= (8 | rx_que->msix) << (i * 4); | ||||
} else if (adapter->hw.mac.type == e1000_82575) | } else if (adapter->hw.mac.type == e1000_82575) | ||||
rx_que->eims = E1000_EICR_TX_QUEUE0 << vector; | rx_que->eims = E1000_EICR_TX_QUEUE0 << vector; | ||||
else | else | ||||
Show All 10 Lines | iflib_softirq_alloc_generic(ctx, | ||||
IFLIB_INTR_TX, tx_que, tx_que->me, buf); | IFLIB_INTR_TX, tx_que, tx_que->me, buf); | ||||
tx_que->msix = (vector % adapter->tx_num_queues); | tx_que->msix = (vector % adapter->tx_num_queues); | ||||
/* | /* | ||||
* Set the bit to enable interrupt | * Set the bit to enable interrupt | ||||
* in E1000_IMS -- bits 22 and 23 | * in E1000_IMS -- bits 22 and 23 | ||||
* are for TX0 and TX1, note this has | * are for TX0 and TX1, note this has | ||||
* NOTHING to do with the MSIX vector | * NOTHING to do with the MSI-X vector | ||||
*/ | */ | ||||
if (adapter->hw.mac.type == e1000_82574) { | if (adapter->hw.mac.type == e1000_82574) { | ||||
tx_que->eims = 1 << (22 + i); | tx_que->eims = 1 << (22 + i); | ||||
adapter->ims |= tx_que->eims; | adapter->ims |= tx_que->eims; | ||||
adapter->ivars |= (8 | tx_que->msix) << (8 + (i * 4)); | adapter->ivars |= (8 | tx_que->msix) << (8 + (i * 4)); | ||||
} else if (adapter->hw.mac.type == e1000_82575) { | } else if (adapter->hw.mac.type == e1000_82575) { | ||||
tx_que->eims = E1000_EICR_TX_QUEUE0 << (i % adapter->tx_num_queues); | tx_que->eims = E1000_EICR_TX_QUEUE0 << (i % adapter->tx_num_queues); | ||||
} else { | } else { | ||||
Show All 32 Lines | igb_configure_queues(struct adapter *adapter) | ||||
u32 tmp, ivar = 0, newitr = 0; | u32 tmp, ivar = 0, newitr = 0; | ||||
/* First turn on RSS capability */ | /* First turn on RSS capability */ | ||||
if (adapter->hw.mac.type != e1000_82575) | if (adapter->hw.mac.type != e1000_82575) | ||||
E1000_WRITE_REG(hw, E1000_GPIE, | E1000_WRITE_REG(hw, E1000_GPIE, | ||||
E1000_GPIE_MSIX_MODE | E1000_GPIE_EIAME | | E1000_GPIE_MSIX_MODE | E1000_GPIE_EIAME | | ||||
E1000_GPIE_PBA | E1000_GPIE_NSICR); | E1000_GPIE_PBA | E1000_GPIE_NSICR); | ||||
/* Turn on MSIX */ | /* Turn on MSI-X */ | ||||
switch (adapter->hw.mac.type) { | switch (adapter->hw.mac.type) { | ||||
case e1000_82580: | case e1000_82580: | ||||
case e1000_i350: | case e1000_i350: | ||||
case e1000_i354: | case e1000_i354: | ||||
case e1000_i210: | case e1000_i210: | ||||
case e1000_i211: | case e1000_i211: | ||||
case e1000_vfadapt: | case e1000_vfadapt: | ||||
case e1000_vfadapt_i350: | case e1000_vfadapt_i350: | ||||
▲ Show 20 Lines • Show All 117 Lines • ▼ Show 20 Lines | |||||
static void | static void | ||||
em_free_pci_resources(if_ctx_t ctx) | em_free_pci_resources(if_ctx_t ctx) | ||||
{ | { | ||||
struct adapter *adapter = iflib_get_softc(ctx); | struct adapter *adapter = iflib_get_softc(ctx); | ||||
struct em_rx_queue *que = adapter->rx_queues; | struct em_rx_queue *que = adapter->rx_queues; | ||||
device_t dev = iflib_get_dev(ctx); | device_t dev = iflib_get_dev(ctx); | ||||
/* Release all msix queue resources */ | /* Release all MSI-X queue resources */ | ||||
if (adapter->intr_type == IFLIB_INTR_MSIX) | if (adapter->intr_type == IFLIB_INTR_MSIX) | ||||
iflib_irq_free(ctx, &adapter->irq); | iflib_irq_free(ctx, &adapter->irq); | ||||
for (int i = 0; i < adapter->rx_num_queues; i++, que++) { | for (int i = 0; i < adapter->rx_num_queues; i++, que++) { | ||||
iflib_irq_free(ctx, &que->que_irq); | iflib_irq_free(ctx, &que->que_irq); | ||||
} | } | ||||
/* First release all the interrupt resources */ | |||||
if (adapter->memory != NULL) { | if (adapter->memory != NULL) { | ||||
bus_release_resource(dev, SYS_RES_MEMORY, | bus_release_resource(dev, SYS_RES_MEMORY, | ||||
PCIR_BAR(0), adapter->memory); | rman_get_rid(adapter->memory), adapter->memory); | ||||
adapter->memory = NULL; | adapter->memory = NULL; | ||||
} | } | ||||
if (adapter->flash != NULL) { | if (adapter->flash != NULL) { | ||||
bus_release_resource(dev, SYS_RES_MEMORY, | bus_release_resource(dev, SYS_RES_MEMORY, | ||||
EM_FLASH, adapter->flash); | rman_get_rid(adapter->flash), adapter->flash); | ||||
adapter->flash = NULL; | adapter->flash = NULL; | ||||
} | } | ||||
if (adapter->ioport != NULL) | |||||
if (adapter->ioport != NULL) { | |||||
bus_release_resource(dev, SYS_RES_IOPORT, | bus_release_resource(dev, SYS_RES_IOPORT, | ||||
adapter->io_rid, adapter->ioport); | rman_get_rid(adapter->ioport), adapter->ioport); | ||||
adapter->ioport = NULL; | |||||
} | } | ||||
} | |||||
/* Setup MSI or MSI/X */ | /* Set up MSI or MSI-X */ | ||||
static int | static int | ||||
em_setup_msix(if_ctx_t ctx) | em_setup_msix(if_ctx_t ctx) | ||||
{ | { | ||||
struct adapter *adapter = iflib_get_softc(ctx); | struct adapter *adapter = iflib_get_softc(ctx); | ||||
if (adapter->hw.mac.type == e1000_82574) { | if (adapter->hw.mac.type == e1000_82574) { | ||||
em_enable_vectors_82574(ctx); | em_enable_vectors_82574(ctx); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 625 Lines • ▼ Show 20 Lines | for (i = 0, que = adapter->tx_queues; i < adapter->tx_num_queues; i++, que++) { | ||||
} | } | ||||
for (j = 0; j < scctx->isc_ntxd[0]; j++) | for (j = 0; j < scctx->isc_ntxd[0]; j++) | ||||
txr->tx_rsq[j] = QIDX_INVALID; | txr->tx_rsq[j] = QIDX_INVALID; | ||||
/* get the virtual and physical address of the hardware queues */ | /* get the virtual and physical address of the hardware queues */ | ||||
txr->tx_base = (struct e1000_tx_desc *)vaddrs[i*ntxqs]; | txr->tx_base = (struct e1000_tx_desc *)vaddrs[i*ntxqs]; | ||||
txr->tx_paddr = paddrs[i*ntxqs]; | txr->tx_paddr = paddrs[i*ntxqs]; | ||||
} | } | ||||
device_printf(iflib_get_dev(ctx), "allocated for %d tx_queues\n", adapter->tx_num_queues); | if (bootverbose) | ||||
device_printf(iflib_get_dev(ctx), | |||||
"allocated for %d tx_queues\n", adapter->tx_num_queues); | |||||
return (0); | return (0); | ||||
fail: | fail: | ||||
em_if_queues_free(ctx); | em_if_queues_free(ctx); | ||||
return (error); | return (error); | ||||
} | } | ||||
static int | static int | ||||
em_if_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, int nrxqs, int nrxqsets) | em_if_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, int nrxqs, int nrxqsets) | ||||
Show All 21 Lines | for (i = 0, que = adapter->rx_queues; i < nrxqsets; i++, que++) { | ||||
rxr->adapter = que->adapter = adapter; | rxr->adapter = que->adapter = adapter; | ||||
rxr->que = que; | rxr->que = que; | ||||
que->me = rxr->me = i; | que->me = rxr->me = i; | ||||
/* get the virtual and physical address of the hardware queues */ | /* get the virtual and physical address of the hardware queues */ | ||||
rxr->rx_base = (union e1000_rx_desc_extended *)vaddrs[i*nrxqs]; | rxr->rx_base = (union e1000_rx_desc_extended *)vaddrs[i*nrxqs]; | ||||
rxr->rx_paddr = paddrs[i*nrxqs]; | rxr->rx_paddr = paddrs[i*nrxqs]; | ||||
} | } | ||||
device_printf(iflib_get_dev(ctx), "allocated for %d rx_queues\n", adapter->rx_num_queues); | if (bootverbose) | ||||
device_printf(iflib_get_dev(ctx), | |||||
"allocated for %d rx_queues\n", adapter->rx_num_queues); | |||||
return (0); | return (0); | ||||
fail: | fail: | ||||
em_if_queues_free(ctx); | em_if_queues_free(ctx); | ||||
return (error); | return (error); | ||||
} | } | ||||
static void | static void | ||||
▲ Show 20 Lines • Show All 226 Lines • ▼ Show 20 Lines | em_initialize_receive_unit(if_ctx_t ctx) | ||||
} | } | ||||
E1000_WRITE_REG(&adapter->hw, E1000_RDTR, | E1000_WRITE_REG(&adapter->hw, E1000_RDTR, | ||||
adapter->rx_int_delay.value); | adapter->rx_int_delay.value); | ||||
/* Use extended rx descriptor formats */ | /* Use extended rx descriptor formats */ | ||||
rfctl = E1000_READ_REG(hw, E1000_RFCTL); | rfctl = E1000_READ_REG(hw, E1000_RFCTL); | ||||
rfctl |= E1000_RFCTL_EXTEN; | rfctl |= E1000_RFCTL_EXTEN; | ||||
/* | /* | ||||
* When using MSIX interrupts we need to throttle | * When using MSI-X interrupts we need to throttle | ||||
* using the EITR register (82574 only) | * using the EITR register (82574 only) | ||||
*/ | */ | ||||
if (hw->mac.type == e1000_82574) { | if (hw->mac.type == e1000_82574) { | ||||
for (int i = 0; i < 4; i++) | for (int i = 0; i < 4; i++) | ||||
E1000_WRITE_REG(hw, E1000_EITR_82574(i), | E1000_WRITE_REG(hw, E1000_EITR_82574(i), | ||||
DEFAULT_ITR); | DEFAULT_ITR); | ||||
/* Disable accelerated acknowledge */ | /* Disable accelerated acknowledge */ | ||||
rfctl |= E1000_RFCTL_ACK_DIS; | rfctl |= E1000_RFCTL_ACK_DIS; | ||||
▲ Show 20 Lines • Show All 857 Lines • ▼ Show 20 Lines | #define QUEUE_NAME_LEN 32 | ||||
char namebuf[QUEUE_NAME_LEN]; | char namebuf[QUEUE_NAME_LEN]; | ||||
/* Driver Statistics */ | /* Driver Statistics */ | ||||
SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "dropped", | SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "dropped", | ||||
CTLFLAG_RD, &adapter->dropped_pkts, | CTLFLAG_RD, &adapter->dropped_pkts, | ||||
"Driver dropped packets"); | "Driver dropped packets"); | ||||
SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "link_irq", | SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "link_irq", | ||||
CTLFLAG_RD, &adapter->link_irq, | CTLFLAG_RD, &adapter->link_irq, | ||||
"Link MSIX IRQ Handled"); | "Link MSI-X IRQ Handled"); | ||||
SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "mbuf_defrag_fail", | SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "mbuf_defrag_fail", | ||||
CTLFLAG_RD, &adapter->mbuf_defrag_failed, | CTLFLAG_RD, &adapter->mbuf_defrag_failed, | ||||
"Defragmenting mbuf chain failed"); | "Defragmenting mbuf chain failed"); | ||||
SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "tx_dma_fail", | SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "tx_dma_fail", | ||||
CTLFLAG_RD, &adapter->no_tx_dma_setup, | CTLFLAG_RD, &adapter->no_tx_dma_setup, | ||||
"Driver tx dma failure in xmit"); | "Driver tx dma failure in xmit"); | ||||
SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "rx_overruns", | SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "rx_overruns", | ||||
CTLFLAG_RD, &adapter->rx_overruns, | CTLFLAG_RD, &adapter->rx_overruns, | ||||
▲ Show 20 Lines • Show All 500 Lines • ▼ Show 20 Lines | for (int j=0; j < adapter->rx_num_queues; j++, rxr++) { | ||||
device_printf(dev, "hw rdh = %d, hw rdt = %d\n", | device_printf(dev, "hw rdh = %d, hw rdt = %d\n", | ||||
E1000_READ_REG(&adapter->hw, E1000_RDH(j)), | E1000_READ_REG(&adapter->hw, E1000_RDH(j)), | ||||
E1000_READ_REG(&adapter->hw, E1000_RDT(j))); | E1000_READ_REG(&adapter->hw, E1000_RDT(j))); | ||||
} | } | ||||
} | } | ||||
/* | /* | ||||
* 82574 only: | * 82574 only: | ||||
* Write a new value to the EEPROM increasing the number of MSIX | * Write a new value to the EEPROM increasing the number of MSI-X | ||||
* vectors from 3 to 5, for proper multiqueue support. | * vectors from 3 to 5, for proper multiqueue support. | ||||
*/ | */ | ||||
static void | static void | ||||
em_enable_vectors_82574(if_ctx_t ctx) | em_enable_vectors_82574(if_ctx_t ctx) | ||||
{ | { | ||||
struct adapter *adapter = iflib_get_softc(ctx); | struct adapter *adapter = iflib_get_softc(ctx); | ||||
struct e1000_hw *hw = &adapter->hw; | struct e1000_hw *hw = &adapter->hw; | ||||
device_t dev = iflib_get_dev(ctx); | device_t dev = iflib_get_dev(ctx); | ||||
u16 edata; | u16 edata; | ||||
e1000_read_nvm(hw, EM_NVM_PCIE_CTRL, 1, &edata); | e1000_read_nvm(hw, EM_NVM_PCIE_CTRL, 1, &edata); | ||||
printf("Current cap: %#06x\n", edata); | printf("Current cap: %#06x\n", edata); | ||||
if (((edata & EM_NVM_MSIX_N_MASK) >> EM_NVM_MSIX_N_SHIFT) != 4) { | if (((edata & EM_NVM_MSIX_N_MASK) >> EM_NVM_MSIX_N_SHIFT) != 4) { | ||||
device_printf(dev, "Writing to eeprom: increasing " | device_printf(dev, "Writing to eeprom: increasing " | ||||
"reported MSIX vectors from 3 to 5...\n"); | "reported MSI-X vectors from 3 to 5...\n"); | ||||
edata &= ~(EM_NVM_MSIX_N_MASK); | edata &= ~(EM_NVM_MSIX_N_MASK); | ||||
edata |= 4 << EM_NVM_MSIX_N_SHIFT; | edata |= 4 << EM_NVM_MSIX_N_SHIFT; | ||||
e1000_write_nvm(hw, EM_NVM_PCIE_CTRL, 1, &edata); | e1000_write_nvm(hw, EM_NVM_PCIE_CTRL, 1, &edata); | ||||
e1000_update_nvm_checksum(hw); | e1000_update_nvm_checksum(hw); | ||||
device_printf(dev, "Writing to eeprom: done\n"); | device_printf(dev, "Writing to eeprom: done\n"); | ||||
} | } | ||||
} | } |