Index: sys/dev/e1000/if_em.c =================================================================== --- sys/dev/e1000/if_em.c (revision 228674) +++ sys/dev/e1000/if_em.c (working copy) @@ -281,8 +281,6 @@ static void em_msix_tx(void *); static void em_msix_rx(void *); static void em_msix_link(void *); -static void em_handle_tx(void *context, int pending); -static void em_handle_rx(void *context, int pending); static void em_handle_link(void *context, int pending); static void em_set_sysctl_value(struct adapter *, const char *, @@ -1015,18 +1013,9 @@ struct adapter *adapter = ifp->if_softc; struct tx_ring *txr = adapter->tx_rings; - if (ifp->if_drv_flags & IFF_DRV_RUNNING) { - EM_TX_LOCK(txr); - em_start_locked(ifp, txr); - EM_TX_UNLOCK(txr); - } - /* - ** If we went inactive schedule - ** a task to clean up. - */ - if (ifp->if_drv_flags & IFF_DRV_OACTIVE) - taskqueue_enqueue(txr->tq, &txr->tx_task); - return; + EM_TX_LOCK(txr); + em_start_locked(ifp, txr); + EM_TX_UNLOCK(txr); } /********************************************************************* @@ -1347,6 +1336,7 @@ e1000_clear_hw_cntrs_base_generic(&adapter->hw); /* MSI/X configuration for 82574 */ + /* XXX Should be cleared when MSI-X is not active. */ if (adapter->hw.mac.type == e1000_82574) { int tmp; tmp = E1000_READ_REG(&adapter->hw, E1000_CTRL_EXT); @@ -1490,7 +1480,7 @@ if (ifp->if_drv_flags & IFF_DRV_RUNNING) { - bool more = em_rxeof(rxr, adapter->rx_process_limit, NULL); + em_rxeof(rxr, adapter->rx_process_limit, NULL); EM_TX_LOCK(txr); em_txeof(txr); #ifdef EM_MULTIQUEUE @@ -1500,14 +1490,8 @@ em_start_locked(ifp, txr); #endif EM_TX_UNLOCK(txr); - if (more || (ifp->if_drv_flags & IFF_DRV_OACTIVE)) { - taskqueue_enqueue(adapter->tq, &adapter->que_task); - return; - } + em_enable_intr(adapter); } - - em_enable_intr(adapter); - return; } @@ -1521,18 +1505,16 @@ { struct tx_ring *txr = arg; struct adapter *adapter = txr->adapter; - bool more; - ++txr->tx_irq; - EM_TX_LOCK(txr); - more = em_txeof(txr); - EM_TX_UNLOCK(txr); - if (more) - taskqueue_enqueue(txr->tq, &txr->tx_task); - else + /* XXX core_mtx lock required to check if_drv_flags */ + if (adapter->ifp->if_drv_flags & IFF_DRV_RUNNING) { + ++txr->tx_irq; + EM_TX_LOCK(txr); + em_txeof(txr); + EM_TX_UNLOCK(txr); /* Reenable this interrupt */ E1000_WRITE_REG(&adapter->hw, E1000_IMS, txr->ims); - return; + } } /********************************************************************* @@ -1546,16 +1528,14 @@ { struct rx_ring *rxr = arg; struct adapter *adapter = rxr->adapter; - bool more; - ++rxr->rx_irq; - more = em_rxeof(rxr, adapter->rx_process_limit, NULL); - if (more) - taskqueue_enqueue(rxr->tq, &rxr->rx_task); - else + /* XXX core_mtx lock required to check if_drv_flags */ + if (adapter->ifp->if_drv_flags & IFF_DRV_RUNNING) { + ++rxr->rx_irq; + em_rxeof(rxr, adapter->rx_process_limit, NULL); /* Reenable this interrupt */ E1000_WRITE_REG(&adapter->hw, E1000_IMS, rxr->ims); - return; + } } /********************************************************************* @@ -1569,53 +1549,21 @@ struct adapter *adapter = arg; u32 reg_icr; - ++adapter->link_irq; - reg_icr = E1000_READ_REG(&adapter->hw, E1000_ICR); + /* XXX core_mtx lock required to check if_drv_flags */ + if (adapter->ifp->if_drv_flags & IFF_DRV_RUNNING) { + ++adapter->link_irq; + reg_icr = E1000_READ_REG(&adapter->hw, E1000_ICR); - if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) { - adapter->hw.mac.get_link_status = 1; - em_handle_link(adapter, 0); - } else - E1000_WRITE_REG(&adapter->hw, E1000_IMS, - EM_MSIX_LINK | E1000_IMS_LSC); - return; + if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) { + adapter->hw.mac.get_link_status = 1; + em_handle_link(adapter, 0); + } else + E1000_WRITE_REG(&adapter->hw, E1000_IMS, + EM_MSIX_LINK | E1000_IMS_LSC); + } } static void -em_handle_rx(void *context, int pending) -{ - struct rx_ring *rxr = context; - struct adapter *adapter = rxr->adapter; - bool more; - - more = em_rxeof(rxr, adapter->rx_process_limit, NULL); - if (more) - taskqueue_enqueue(rxr->tq, &rxr->rx_task); - else - /* Reenable this interrupt */ - E1000_WRITE_REG(&adapter->hw, E1000_IMS, rxr->ims); -} - -static void -em_handle_tx(void *context, int pending) -{ - struct tx_ring *txr = context; - struct adapter *adapter = txr->adapter; - struct ifnet *ifp = adapter->ifp; - - EM_TX_LOCK(txr); - em_txeof(txr); -#ifdef EM_MULTIQUEUE - if (!drbr_empty(ifp, txr->br)) - em_mq_start_locked(ifp, txr, NULL); -#else - em_start_locked(ifp, txr); -#endif - E1000_WRITE_REG(&adapter->hw, E1000_IMS, txr->ims); - EM_TX_UNLOCK(txr); -} - -static void em_handle_link(void *context, int pending) { struct adapter *adapter = context; @@ -2209,9 +2157,6 @@ if ((txr->queue_status == EM_QUEUE_HUNG) && (adapter->pause_frames == 0)) goto hung; - /* Schedule a TX tasklet if needed */ - if (txr->tx_avail <= EM_MAX_SCATTER) - taskqueue_enqueue(txr->tq, &txr->tx_task); } adapter->pause_frames = 0; @@ -2429,7 +2374,6 @@ em_allocate_legacy(struct adapter *adapter) { device_t dev = adapter->dev; - struct tx_ring *txr = adapter->tx_rings; int error, rid = 0; /* Manually turn off all interrupts */ @@ -2455,12 +2399,6 @@ taskqueue_thread_enqueue, &adapter->tq); taskqueue_start_threads(&adapter->tq, 1, PI_NET, "%s que", device_get_nameunit(adapter->dev)); - /* Use a TX only tasklet for local timer */ - TASK_INIT(&txr->tx_task, 0, em_handle_tx, txr); - txr->tq = taskqueue_create_fast("em_txq", M_NOWAIT, - taskqueue_thread_enqueue, &txr->tq); - taskqueue_start_threads(&txr->tq, 1, PI_NET, "%s txq", - device_get_nameunit(adapter->dev)); TASK_INIT(&adapter->link_task, 0, em_handle_link, adapter); if ((error = bus_setup_intr(dev, adapter->res, INTR_TYPE_NET, em_irq_fast, NULL, adapter, &adapter->tag)) != 0) { @@ -2518,11 +2456,6 @@ bus_describe_intr(dev, rxr->res, rxr->tag, "rx %d", i); #endif rxr->msix = vector++; /* NOTE increment vector for TX */ - TASK_INIT(&rxr->rx_task, 0, em_handle_rx, rxr); - rxr->tq = taskqueue_create_fast("em_rxq", M_NOWAIT, - taskqueue_thread_enqueue, &rxr->tq); - taskqueue_start_threads(&rxr->tq, 1, PI_NET, "%s rxq", - device_get_nameunit(adapter->dev)); /* ** Set the bit to enable interrupt ** in E1000_IMS -- bits 20 and 21 @@ -2552,11 +2485,6 @@ bus_describe_intr(dev, txr->res, txr->tag, "tx %d", i); #endif txr->msix = vector++; /* Increment vector for next pass */ - TASK_INIT(&txr->tx_task, 0, em_handle_tx, txr); - txr->tq = taskqueue_create_fast("em_txq", M_NOWAIT, - taskqueue_thread_enqueue, &txr->tq); - taskqueue_start_threads(&txr->tq, 1, PI_NET, "%s txq", - device_get_nameunit(adapter->dev)); /* ** Set the bit to enable interrupt ** in E1000_IMS -- bits 22 and 23 @@ -2767,6 +2695,8 @@ pba = E1000_PBA_12K; /* 12K for Rx, 20K for Tx */ break; case e1000_82574: + pba = E1000_PBA_24K; /* 24K for Rx, 16K for Tx */ + break; case e1000_82583: pba = E1000_PBA_20K; /* 20K for Rx, 20K for Tx */ break; @@ -4277,6 +4207,7 @@ ** When using MSIX interrupts we need to throttle ** using the EITR register (82574 only) */ + /* XXX This should be rewritten since only 3 vectors are available. */ if (hw->mac.type == e1000_82574) { for (int i = 0; i < 4; i++) E1000_WRITE_REG(hw, E1000_EITR_82574(i), Index: sys/dev/e1000/if_em.h =================================================================== --- sys/dev/e1000/if_em.h (revision 228674) +++ sys/dev/e1000/if_em.h (working copy) @@ -285,8 +285,6 @@ int watchdog_time; struct em_dma_alloc txdma; struct e1000_tx_desc *tx_base; - struct task tx_task; - struct taskqueue *tq; u32 next_avail_desc; u32 next_to_clean; struct em_buffer *tx_buffers; @@ -319,8 +317,6 @@ struct mtx rx_mtx; char mtx_name[16]; u32 payload; - struct task rx_task; - struct taskqueue *tq; struct e1000_rx_desc *rx_base; struct em_dma_alloc rxdma; u32 next_to_refresh;