diff options
-rw-r--r-- | sys/dev/e1000/if_em.c | 54 | ||||
-rw-r--r-- | sys/dev/e1000/if_igb.c | 66 | ||||
-rw-r--r-- | sys/dev/ixgbe/if_ix.c | 25 | ||||
-rw-r--r-- | sys/dev/ixgbe/if_ixv.c | 3 | ||||
-rw-r--r-- | sys/dev/ixgbe/ix_txrx.c | 7 | ||||
-rw-r--r-- | sys/dev/ixgbe/ixgbe.h | 3 | ||||
-rw-r--r-- | sys/dev/oce/oce_if.c | 11 | ||||
-rw-r--r-- | sys/dev/virtio/network/if_vtnet.c | 26 | ||||
-rw-r--r-- | sys/dev/vmware/vmxnet3/if_vmx.c | 24 |
9 files changed, 82 insertions, 137 deletions
diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index 9ed3f36..5248f7f 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -211,15 +211,15 @@ static int em_detach(device_t); static int em_shutdown(device_t); static int em_suspend(device_t); static int em_resume(device_t); -#ifdef EM_MULTIQUEUE + static int em_mq_start(struct ifnet *, struct mbuf *); static int em_mq_start_locked(struct ifnet *, struct tx_ring *); static void em_qflush(struct ifnet *); -#else + static void em_start(struct ifnet *); static void em_start_locked(struct ifnet *, struct tx_ring *); -#endif + static int em_ioctl(struct ifnet *, u_long, caddr_t); static void em_init(void *); static void em_init_locked(struct adapter *); @@ -918,13 +918,13 @@ em_resume(device_t dev) (ifp->if_drv_flags & IFF_DRV_RUNNING) && adapter->link_active) { for (int i = 0; i < adapter->num_queues; i++, txr++) { EM_TX_LOCK(txr); -#ifdef EM_MULTIQUEUE + if (!drbr_empty(ifp, txr->br)) em_mq_start_locked(ifp, txr); -#else + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) em_start_locked(ifp, txr); -#endif + EM_TX_UNLOCK(txr); } } @@ -934,7 +934,7 @@ em_resume(device_t dev) } -#ifndef EM_MULTIQUEUE + static void em_start_locked(struct ifnet *ifp, struct tx_ring *txr) { @@ -997,7 +997,7 @@ em_start(struct ifnet *ifp) } return; } -#else /* EM_MULTIQUEUE */ + /********************************************************************* * Multiqueue Transmit routines * @@ -1104,7 +1104,7 @@ em_qflush(struct ifnet *ifp) } if_qflush(ifp); } -#endif /* EM_MULTIQUEUE */ + /********************************************************************* * Ioctl entry point @@ -1498,13 +1498,13 @@ em_poll(struct ifnet *ifp, enum poll_cmd cmd, int count) EM_TX_LOCK(txr); em_txeof(txr); -#ifdef EM_MULTIQUEUE + if (!drbr_empty(ifp, txr->br)) em_mq_start_locked(ifp, txr); -#else + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) em_start_locked(ifp, txr); -#endif + EM_TX_UNLOCK(txr); return (rx_done); @@ -1572,13 +1572,13 @@ em_handle_que(void *context, int pending) EM_TX_LOCK(txr); em_txeof(txr); -#ifdef EM_MULTIQUEUE + if (!drbr_empty(ifp, txr->br)) em_mq_start_locked(ifp, txr); -#else + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) em_start_locked(ifp, txr); -#endif + EM_TX_UNLOCK(txr); if (more) { taskqueue_enqueue(adapter->tq, &adapter->que_task); @@ -1606,13 +1606,13 @@ em_msix_tx(void *arg) ++txr->tx_irq; EM_TX_LOCK(txr); em_txeof(txr); -#ifdef EM_MULTIQUEUE + if (!drbr_empty(ifp, txr->br)) em_mq_start_locked(ifp, txr); -#else + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) em_start_locked(ifp, txr); -#endif + /* Reenable this interrupt */ E1000_WRITE_REG(&adapter->hw, E1000_IMS, txr->ims); @@ -1707,13 +1707,13 @@ em_handle_tx(void *context, int pending) EM_TX_LOCK(txr); em_txeof(txr); -#ifdef EM_MULTIQUEUE + if (!drbr_empty(ifp, txr->br)) em_mq_start_locked(ifp, txr); -#else + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) em_start_locked(ifp, txr); -#endif + E1000_WRITE_REG(&adapter->hw, E1000_IMS, txr->ims); EM_TX_UNLOCK(txr); } @@ -1737,13 +1737,13 @@ em_handle_link(void *context, int pending) if (adapter->link_active) { for (int i = 0; i < adapter->num_queues; i++, txr++) { EM_TX_LOCK(txr); -#ifdef EM_MULTIQUEUE + if (!drbr_empty(ifp, txr->br)) em_mq_start_locked(ifp, txr); -#else + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) em_start_locked(ifp, txr); -#endif + EM_TX_UNLOCK(txr); } } @@ -3078,16 +3078,16 @@ em_setup_interface(device_t dev, struct adapter *adapter) ifp->if_softc = adapter; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = em_ioctl; -#ifdef EM_MULTIQUEUE + /* Multiqueue stack interface */ ifp->if_transmit = em_mq_start; ifp->if_qflush = em_qflush; -#else + ifp->if_start = em_start; IFQ_SET_MAXLEN(&ifp->if_snd, adapter->num_tx_desc - 1); ifp->if_snd.ifq_drv_maxlen = adapter->num_tx_desc - 1; IFQ_SET_READY(&ifp->if_snd); -#endif + ether_ifattach(ifp, adapter->hw.mac.addr); diff --git a/sys/dev/e1000/if_igb.c b/sys/dev/e1000/if_igb.c index 5dc261a..798adee 100644 --- a/sys/dev/e1000/if_igb.c +++ b/sys/dev/e1000/if_igb.c @@ -43,9 +43,7 @@ #include <sys/param.h> #include <sys/systm.h> -#ifndef IGB_LEGACY_TX #include <sys/buf_ring.h> -#endif #include <sys/bus.h> #include <sys/endian.h> #include <sys/kernel.h> @@ -189,15 +187,12 @@ static int igb_detach(device_t); static int igb_shutdown(device_t); static int igb_suspend(device_t); static int igb_resume(device_t); -#ifndef IGB_LEGACY_TX static int igb_mq_start(struct ifnet *, struct mbuf *); static int igb_mq_start_locked(struct ifnet *, struct tx_ring *); static void igb_qflush(struct ifnet *); static void igb_deferred_mq_start(void *, int); -#else static void igb_start(struct ifnet *); static void igb_start_locked(struct tx_ring *, struct ifnet *ifp); -#endif static int igb_ioctl(struct ifnet *, u_long, caddr_t); static void igb_init(void *); static void igb_init_locked(struct adapter *); @@ -361,7 +356,6 @@ TUNABLE_INT("hw.igb.max_interrupt_rate", &igb_max_interrupt_rate); SYSCTL_INT(_hw_igb, OID_AUTO, max_interrupt_rate, CTLFLAG_RDTUN, &igb_max_interrupt_rate, 0, "Maximum interrupts per second"); -#ifndef IGB_LEGACY_TX /* ** Tuneable number of buffers in the buf-ring (drbr_xxx) */ @@ -369,7 +363,6 @@ static int igb_buf_ring_size = IGB_BR_SIZE; TUNABLE_INT("hw.igb.buf_ring_size", &igb_buf_ring_size); SYSCTL_INT(_hw_igb, OID_AUTO, buf_ring_size, CTLFLAG_RDTUN, &igb_buf_ring_size, 0, "Size of the bufring"); -#endif /* ** Header split causes the packet header to @@ -865,15 +858,15 @@ igb_resume(device_t dev) (ifp->if_drv_flags & IFF_DRV_RUNNING) && adapter->link_active) { for (int i = 0; i < adapter->num_queues; i++, txr++) { IGB_TX_LOCK(txr); -#ifndef IGB_LEGACY_TX + /* Process the stack queue only if not depleted */ if (((txr->queue_status & IGB_QUEUE_DEPLETED) == 0) && !drbr_empty(ifp, txr->br)) igb_mq_start_locked(ifp, txr); -#else + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) igb_start_locked(txr, ifp); -#endif + IGB_TX_UNLOCK(txr); } } @@ -883,7 +876,6 @@ igb_resume(device_t dev) } -#ifdef IGB_LEGACY_TX /********************************************************************* * Transmit entry point @@ -961,7 +953,6 @@ igb_start(struct ifnet *ifp) return; } -#else /* ~IGB_LEGACY_TX */ /* ** Multiqueue Transmit Entry: @@ -1081,7 +1072,6 @@ igb_qflush(struct ifnet *ifp) } if_qflush(ifp); } -#endif /* ~IGB_LEGACY_TX */ /********************************************************************* * Ioctl entry point @@ -1415,15 +1405,15 @@ igb_handle_que(void *context, int pending) IGB_TX_LOCK(txr); igb_txeof(txr); -#ifndef IGB_LEGACY_TX + /* Process the stack queue only if not depleted */ if (((txr->queue_status & IGB_QUEUE_DEPLETED) == 0) && !drbr_empty(ifp, txr->br)) igb_mq_start_locked(ifp, txr); -#else + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) igb_start_locked(txr, ifp); -#endif + IGB_TX_UNLOCK(txr); /* Do we need another? */ if (more) { @@ -1466,15 +1456,15 @@ igb_handle_link_locked(struct adapter *adapter) if ((ifp->if_drv_flags & IFF_DRV_RUNNING) && adapter->link_active) { for (int i = 0; i < adapter->num_queues; i++, txr++) { IGB_TX_LOCK(txr); -#ifndef IGB_LEGACY_TX + /* Process the stack queue only if not depleted */ if (((txr->queue_status & IGB_QUEUE_DEPLETED) == 0) && !drbr_empty(ifp, txr->br)) igb_mq_start_locked(ifp, txr); -#else + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) igb_start_locked(txr, ifp); -#endif + IGB_TX_UNLOCK(txr); } } @@ -1568,13 +1558,10 @@ igb_poll(struct ifnet *ifp, enum poll_cmd cmd, int count) do { more = igb_txeof(txr); } while (loop-- && more); -#ifndef IGB_LEGACY_TX if (!drbr_empty(ifp, txr->br)) igb_mq_start_locked(ifp, txr); -#else if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) igb_start_locked(txr, ifp); -#endif IGB_TX_UNLOCK(txr); } @@ -1607,15 +1594,12 @@ igb_msix_que(void *arg) IGB_TX_LOCK(txr); igb_txeof(txr); -#ifndef IGB_LEGACY_TX /* Process the stack queue only if not depleted */ if (((txr->queue_status & IGB_QUEUE_DEPLETED) == 0) && !drbr_empty(ifp, txr->br)) igb_mq_start_locked(ifp, txr); -#else if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) igb_start_locked(txr, ifp); -#endif IGB_TX_UNLOCK(txr); more_rx = igb_rxeof(que, adapter->rx_process_limit, NULL); @@ -2380,9 +2364,7 @@ igb_allocate_legacy(struct adapter *adapter) { device_t dev = adapter->dev; struct igb_queue *que = adapter->queues; -#ifndef IGB_LEGACY_TX struct tx_ring *txr = adapter->tx_rings; -#endif int error, rid = 0; /* Turn off all interrupts */ @@ -2401,9 +2383,7 @@ igb_allocate_legacy(struct adapter *adapter) return (ENXIO); } -#ifndef IGB_LEGACY_TX TASK_INIT(&txr->txq_task, 0, igb_deferred_mq_start, txr); -#endif /* * Try allocating a fast interrupt and the associated deferred @@ -2485,10 +2465,8 @@ igb_allocate_msix(struct adapter *adapter) i,igb_last_bind_cpu); igb_last_bind_cpu = CPU_NEXT(igb_last_bind_cpu); } -#ifndef IGB_LEGACY_TX TASK_INIT(&que->txr->txq_task, 0, igb_deferred_mq_start, que->txr); -#endif /* Make tasklet for deferred handling */ TASK_INIT(&que->que_task, 0, igb_handle_que, que); que->tq = taskqueue_create("igb_que", M_NOWAIT, @@ -2712,9 +2690,9 @@ igb_free_pci_resources(struct adapter *adapter) for (int i = 0; i < adapter->num_queues; i++, que++) { if (que->tq != NULL) { -#ifndef IGB_LEGACY_TX + taskqueue_drain(que->tq, &que->txr->txq_task); -#endif + taskqueue_drain(que->tq, &que->que_task); taskqueue_free(que->tq); } @@ -3115,15 +3093,15 @@ igb_setup_interface(device_t dev, struct adapter *adapter) ifp->if_softc = adapter; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = igb_ioctl; -#ifndef IGB_LEGACY_TX + ifp->if_transmit = igb_mq_start; ifp->if_qflush = igb_qflush; -#else + ifp->if_start = igb_start; IFQ_SET_MAXLEN(&ifp->if_snd, adapter->num_tx_desc - 1); ifp->if_snd.ifq_drv_maxlen = adapter->num_tx_desc - 1; IFQ_SET_READY(&ifp->if_snd); -#endif + ether_ifattach(ifp, adapter->hw.mac.addr); @@ -3360,11 +3338,11 @@ igb_allocate_queues(struct adapter *adapter) error = ENOMEM; goto err_tx_desc; } -#ifndef IGB_LEGACY_TX + /* Allocate a buf ring */ txr->br = buf_ring_alloc(igb_buf_ring_size, M_DEVBUF, M_WAITOK, &txr->tx_mtx); -#endif + } /* @@ -3421,9 +3399,9 @@ err_tx_desc: igb_dma_free(adapter, &txr->txdma); free(adapter->rx_rings, M_DEVBUF); rx_fail: -#ifndef IGB_LEGACY_TX + buf_ring_free(txr->br, M_DEVBUF); -#endif + free(adapter->tx_rings, M_DEVBUF); tx_fail: free(adapter->queues, M_DEVBUF); @@ -3679,10 +3657,10 @@ igb_free_transmit_buffers(struct tx_ring *txr) tx_buffer->map = NULL; } } -#ifndef IGB_LEGACY_TX + if (txr->br != NULL) buf_ring_free(txr->br, M_DEVBUF); -#endif + if (txr->tx_buffers != NULL) { free(txr->tx_buffers, M_DEVBUF); txr->tx_buffers = NULL; @@ -4986,10 +4964,10 @@ igb_rxeof(struct igb_queue *que, int count, int *done) */ M_HASHTYPE_SET(rxr->fmp, M_HASHTYPE_OPAQUE); } else { -#ifndef IGB_LEGACY_TX + rxr->fmp->m_pkthdr.flowid = que->msix; M_HASHTYPE_SET(rxr->fmp, M_HASHTYPE_OPAQUE); -#endif + } sendmp = rxr->fmp; /* Make sure to set M_PKTHDR. */ diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c index 9b405c0..78f25f0 100644 --- a/sys/dev/ixgbe/if_ix.c +++ b/sys/dev/ixgbe/if_ix.c @@ -621,9 +621,7 @@ ixgbe_detach(device_t dev) for (int i = 0; i < adapter->num_queues; i++, que++, txr++) { if (que->tq) { -#ifndef IXGBE_LEGACY_TX taskqueue_drain(que->tq, &txr->txq_task); -#endif taskqueue_drain(que->tq, &que->que_task); taskqueue_free(que->tq); } @@ -1282,13 +1280,10 @@ ixgbe_handle_que(void *context, int pending) more = ixgbe_rxeof(que); IXGBE_TX_LOCK(txr); ixgbe_txeof(txr); -#ifndef IXGBE_LEGACY_TX if (!drbr_empty(ifp, txr->br)) ixgbe_mq_start_locked(ifp, txr); -#else if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) ixgbe_start_locked(txr, ifp); -#endif IXGBE_TX_UNLOCK(txr); } @@ -1331,13 +1326,10 @@ ixgbe_legacy_irq(void *arg) IXGBE_TX_LOCK(txr); ixgbe_txeof(txr); -#ifdef IXGBE_LEGACY_TX if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) ixgbe_start_locked(txr, ifp); -#else if (!drbr_empty(ifp, txr->br)) ixgbe_mq_start_locked(ifp, txr); -#endif IXGBE_TX_UNLOCK(txr); /* Check for fan failure */ @@ -1392,13 +1384,10 @@ ixgbe_msix_que(void *arg) IXGBE_TX_LOCK(txr); ixgbe_txeof(txr); -#ifdef IXGBE_LEGACY_TX - if (!IFQ_DRV_IS_EMPTY(ifp->if_snd)) + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) ixgbe_start_locked(txr, ifp); -#else if (!drbr_empty(ifp, txr->br)) ixgbe_mq_start_locked(ifp, txr); -#endif IXGBE_TX_UNLOCK(txr); /* Do AIM now? */ @@ -2137,9 +2126,7 @@ ixgbe_allocate_legacy(struct adapter *adapter) { device_t dev = adapter->dev; struct ix_queue *que = adapter->queues; -#ifndef IXGBE_LEGACY_TX struct tx_ring *txr = adapter->tx_rings; -#endif int error, rid = 0; /* MSI RID at 1 */ @@ -2159,9 +2146,7 @@ ixgbe_allocate_legacy(struct adapter *adapter) * Try allocating a fast interrupt and the associated deferred * processing contexts. */ -#ifndef IXGBE_LEGACY_TX TASK_INIT(&txr->txq_task, 0, ixgbe_deferred_mq_start, txr); -#endif TASK_INIT(&que->que_task, 0, ixgbe_handle_que, que); que->tq = taskqueue_create_fast("ixgbe_que", M_NOWAIT, taskqueue_thread_enqueue, &que->tq); @@ -2249,9 +2234,7 @@ ixgbe_allocate_msix(struct adapter *adapter) if (adapter->num_queues > 1) bus_bind_intr(dev, que->res, cpu_id); -#ifndef IXGBE_LEGACY_TX TASK_INIT(&txr->txq_task, 0, ixgbe_deferred_mq_start, txr); -#endif TASK_INIT(&que->que_task, 0, ixgbe_handle_que, que); que->tq = taskqueue_create_fast("ixgbe_que", M_NOWAIT, taskqueue_thread_enqueue, &que->tq); @@ -2509,15 +2492,15 @@ ixgbe_setup_interface(device_t dev, struct adapter *adapter) ifp->if_hw_tsomax = 65518; ifp->if_hw_tsomaxsegcount = IXGBE_82599_SCATTER; ifp->if_hw_tsomaxsegsize = 2048; -#ifndef IXGBE_LEGACY_TX + ifp->if_transmit = ixgbe_mq_start; ifp->if_qflush = ixgbe_qflush; -#else + ifp->if_start = ixgbe_start; IFQ_SET_MAXLEN(&ifp->if_snd, adapter->num_tx_desc - 2); ifp->if_snd.ifq_drv_maxlen = adapter->num_tx_desc - 2; IFQ_SET_READY(&ifp->if_snd); -#endif + ether_ifattach(ifp, adapter->hw.mac.addr); diff --git a/sys/dev/ixgbe/if_ixv.c b/sys/dev/ixgbe/if_ixv.c index a550a85..fbcf948 100644 --- a/sys/dev/ixgbe/if_ixv.c +++ b/sys/dev/ixgbe/if_ixv.c @@ -809,13 +809,10 @@ ixv_msix_que(void *arg) ** has anything queued the task gets ** scheduled to handle it. */ -#ifdef IXGBE_LEGACY_TX if (!IFQ_DRV_IS_EMPTY(&adapter->ifp->if_snd)) ixgbe_start_locked(txr, ifp); -#else if (!drbr_empty(adapter->ifp, txr->br)) ixgbe_mq_start_locked(ifp, txr); -#endif IXGBE_TX_UNLOCK(txr); /* Do AIM now? */ diff --git a/sys/dev/ixgbe/ix_txrx.c b/sys/dev/ixgbe/ix_txrx.c index 35c1ddd..1c35b8e 100644 --- a/sys/dev/ixgbe/ix_txrx.c +++ b/sys/dev/ixgbe/ix_txrx.c @@ -118,7 +118,6 @@ static __inline void ixgbe_rx_discard(struct rx_ring *, int); static __inline void ixgbe_rx_input(struct rx_ring *, struct ifnet *, struct mbuf *, u32); -#ifdef IXGBE_LEGACY_TX /********************************************************************* * Transmit entry point * @@ -180,7 +179,6 @@ ixgbe_start(struct ifnet *ifp) return; } -#else /* ! IXGBE_LEGACY_TX */ /* ** Multiqueue Transmit driver @@ -318,7 +316,6 @@ ixgbe_qflush(struct ifnet *ifp) } if_qflush(ifp); } -#endif /* IXGBE_LEGACY_TX */ /********************************************************************* @@ -698,10 +695,8 @@ ixgbe_free_transmit_buffers(struct tx_ring *txr) tx_buffer->map = NULL; } } -#ifdef IXGBE_LEGACY_TX if (txr->br != NULL) buf_ring_free(txr->br, M_DEVBUF); -#endif if (txr->tx_buffers != NULL) { free(txr->tx_buffers, M_DEVBUF); txr->tx_buffers = NULL; @@ -2160,7 +2155,6 @@ ixgbe_allocate_queues(struct adapter *adapter) error = ENOMEM; goto err_tx_desc; } -#ifndef IXGBE_LEGACY_TX /* Allocate a buf ring */ txr->br = buf_ring_alloc(IXGBE_BR_SIZE, M_DEVBUF, M_WAITOK, &txr->tx_mtx); @@ -2170,7 +2164,6 @@ ixgbe_allocate_queues(struct adapter *adapter) error = ENOMEM; goto err_tx_desc; } -#endif } /* diff --git a/sys/dev/ixgbe/ixgbe.h b/sys/dev/ixgbe/ixgbe.h index a28bdc8..6f220f9 100644 --- a/sys/dev/ixgbe/ixgbe.h +++ b/sys/dev/ixgbe/ixgbe.h @@ -646,15 +646,12 @@ ixv_check_ether_addr(u8 *addr) /* Shared Prototypes */ -#ifdef IXGBE_LEGACY_TX void ixgbe_start(struct ifnet *); void ixgbe_start_locked(struct tx_ring *, struct ifnet *); -#else /* ! IXGBE_LEGACY_TX */ int ixgbe_mq_start(struct ifnet *, struct mbuf *); int ixgbe_mq_start_locked(struct ifnet *, struct tx_ring *); void ixgbe_qflush(struct ifnet *); void ixgbe_deferred_mq_start(void *, int); -#endif /* IXGBE_LEGACY_TX */ int ixgbe_allocate_queues(struct adapter *); int ixgbe_allocate_transmit_buffers(struct tx_ring *); diff --git a/sys/dev/oce/oce_if.c b/sys/dev/oce/oce_if.c index f37ef3a..3711503 100644 --- a/sys/dev/oce/oce_if.c +++ b/sys/dev/oce/oce_if.c @@ -1060,11 +1060,10 @@ oce_tx_restart(POCE_SOFTC sc, struct oce_wq *wq) if ((sc->ifp->if_drv_flags & IFF_DRV_RUNNING) != IFF_DRV_RUNNING) return; -#if __FreeBSD_version >= 800000 if (!drbr_empty(sc->ifp, wq->br)) -#else + taskqueue_enqueue_fast(taskqueue_swi, &wq->txtask); + if (!IFQ_DRV_IS_EMPTY(&sc->ifp->if_snd)) -#endif taskqueue_enqueue_fast(taskqueue_swi, &wq->txtask); } @@ -1147,7 +1146,7 @@ oce_tx_task(void *arg, int npending) struct ifnet *ifp = sc->ifp; int rc = 0; -#if __FreeBSD_version >= 800000 + LOCK(&wq->tx_lock); rc = oce_multiq_transmit(ifp, NULL, wq); if (rc) { @@ -1155,9 +1154,9 @@ oce_tx_task(void *arg, int npending) "TX[%d] restart failed\n", wq->queue_index); } UNLOCK(&wq->tx_lock); -#else + oce_start(ifp); -#endif + } diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c index 5453998..a5e6383 100644 --- a/sys/dev/virtio/network/if_vtnet.c +++ b/sys/dev/virtio/network/if_vtnet.c @@ -139,23 +139,21 @@ static struct mbuf * static int vtnet_txq_enqueue_buf(struct vtnet_txq *, struct mbuf **, struct vtnet_tx_header *); static int vtnet_txq_encap(struct vtnet_txq *, struct mbuf **); -#ifdef VTNET_LEGACY_TX + static void vtnet_start_locked(struct vtnet_txq *, struct ifnet *); static void vtnet_start(struct ifnet *); -#else + static int vtnet_txq_mq_start_locked(struct vtnet_txq *, struct mbuf *); static int vtnet_txq_mq_start(struct ifnet *, struct mbuf *); static void vtnet_txq_tq_deferred(void *, int); -#endif + static void vtnet_txq_start(struct vtnet_txq *); static void vtnet_txq_tq_intr(void *, int); static int vtnet_txq_eof(struct vtnet_txq *); static void vtnet_tx_vq_intr(void *); static void vtnet_tx_start_all(struct vtnet_softc *); -#ifndef VTNET_LEGACY_TX static void vtnet_qflush(struct ifnet *); -#endif static int vtnet_watchdog(struct vtnet_txq *); static void vtnet_rxq_accum_stats(struct vtnet_rxq *, @@ -922,16 +920,16 @@ vtnet_setup_interface(struct vtnet_softc *sc) ifp->if_init = vtnet_init; ifp->if_ioctl = vtnet_ioctl; -#ifndef VTNET_LEGACY_TX + ifp->if_transmit = vtnet_txq_mq_start; ifp->if_qflush = vtnet_qflush; -#else + struct virtqueue *vq = sc->vtnet_txqs[0].vtntx_vq; ifp->if_start = vtnet_start; IFQ_SET_MAXLEN(&ifp->if_snd, virtqueue_size(vq) - 1); ifp->if_snd.ifq_drv_maxlen = virtqueue_size(vq) - 1; IFQ_SET_READY(&ifp->if_snd); -#endif + ifmedia_init(&sc->vtnet_media, IFM_IMASK, vtnet_ifmedia_upd, vtnet_ifmedia_sts); @@ -2209,7 +2207,7 @@ fail: return (error); } -#ifdef VTNET_LEGACY_TX + static void vtnet_start_locked(struct vtnet_txq *txq, struct ifnet *ifp) @@ -2275,7 +2273,7 @@ vtnet_start(struct ifnet *ifp) VTNET_TXQ_UNLOCK(txq); } -#else /* !VTNET_LEGACY_TX */ + static int vtnet_txq_mq_start_locked(struct vtnet_txq *txq, struct mbuf *m) @@ -2387,7 +2385,7 @@ vtnet_txq_tq_deferred(void *xtxq, int pending) VTNET_TXQ_UNLOCK(txq); } -#endif /* VTNET_LEGACY_TX */ + static void vtnet_txq_start(struct vtnet_txq *txq) @@ -2398,13 +2396,13 @@ vtnet_txq_start(struct vtnet_txq *txq) sc = txq->vtntx_sc; ifp = sc->vtnet_ifp; -#ifdef VTNET_LEGACY_TX + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) vtnet_start_locked(txq, ifp); -#else + if (!drbr_empty(ifp, txq->vtntx_br)) vtnet_txq_mq_start_locked(txq, NULL); -#endif + } static void diff --git a/sys/dev/vmware/vmxnet3/if_vmx.c b/sys/dev/vmware/vmxnet3/if_vmx.c index 202bc8e..3b55ff5 100644 --- a/sys/dev/vmware/vmxnet3/if_vmx.c +++ b/sys/dev/vmware/vmxnet3/if_vmx.c @@ -166,15 +166,15 @@ static int vmxnet3_txq_load_mbuf(struct vmxnet3_txqueue *, struct mbuf **, bus_dmamap_t, bus_dma_segment_t [], int *); static void vmxnet3_txq_unload_mbuf(struct vmxnet3_txqueue *, bus_dmamap_t); static int vmxnet3_txq_encap(struct vmxnet3_txqueue *, struct mbuf **); -#ifdef VMXNET3_LEGACY_TX + static void vmxnet3_start_locked(struct ifnet *); static void vmxnet3_start(struct ifnet *); -#else + static int vmxnet3_txq_mq_start_locked(struct vmxnet3_txqueue *, struct mbuf *); static int vmxnet3_txq_mq_start(struct ifnet *, struct mbuf *); static void vmxnet3_txq_tq_deferred(void *, int); -#endif + static void vmxnet3_txq_start(struct vmxnet3_txqueue *); static void vmxnet3_tx_start_all(struct vmxnet3_softc *); @@ -1724,15 +1724,15 @@ vmxnet3_setup_interface(struct vmxnet3_softc *sc) ifp->if_hw_tsomaxsegcount = VMXNET3_TX_MAXSEGS; ifp->if_hw_tsomaxsegsize = VMXNET3_TX_MAXSEGSIZE; -#ifdef VMXNET3_LEGACY_TX + ifp->if_start = vmxnet3_start; ifp->if_snd.ifq_drv_maxlen = sc->vmx_ntxdescs - 1; IFQ_SET_MAXLEN(&ifp->if_snd, sc->vmx_ntxdescs - 1); IFQ_SET_READY(&ifp->if_snd); -#else + ifp->if_transmit = vmxnet3_txq_mq_start; ifp->if_qflush = vmxnet3_qflush; -#endif + vmxnet3_get_lladdr(sc); ether_ifattach(ifp, sc->vmx_lladdr); @@ -2865,7 +2865,7 @@ vmxnet3_txq_encap(struct vmxnet3_txqueue *txq, struct mbuf **m0) return (0); } -#ifdef VMXNET3_LEGACY_TX + static void vmxnet3_start_locked(struct ifnet *ifp) @@ -2929,7 +2929,7 @@ vmxnet3_start(struct ifnet *ifp) VMXNET3_TXQ_UNLOCK(txq); } -#else /* !VMXNET3_LEGACY_TX */ + static int vmxnet3_txq_mq_start_locked(struct vmxnet3_txqueue *txq, struct mbuf *m) @@ -3036,7 +3036,7 @@ vmxnet3_txq_tq_deferred(void *xtxq, int pending) VMXNET3_TXQ_UNLOCK(txq); } -#endif /* VMXNET3_LEGACY_TX */ + static void vmxnet3_txq_start(struct vmxnet3_txqueue *txq) @@ -3047,13 +3047,13 @@ vmxnet3_txq_start(struct vmxnet3_txqueue *txq) sc = txq->vxtxq_sc; ifp = sc->vmx_ifp; -#ifdef VMXNET3_LEGACY_TX + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) vmxnet3_start_locked(ifp); -#else + if (!drbr_empty(ifp, txq->vxtxq_br)) vmxnet3_txq_mq_start_locked(txq, NULL); -#endif + } static void |