diff options
author | Shesha Sreenivasamurthy <shesha@cisco.com> | 2016-02-03 09:38:36 -0800 |
---|---|---|
committer | Gerrit Code Review <gerrit@fd.io> | 2016-02-10 13:14:17 +0000 |
commit | b8f45b37292fcb3b19c4ffcdb91947a9eec03500 (patch) | |
tree | 1ee2b5a9b78907025c9d14633bf3474ec94cd71a /vnet/vnet/devices/dpdk/device.c | |
parent | 1b1695316dab02fdbb626ca73ad61a92c31e417e (diff) |
Vhost multi-q support
Remove multi-q support patch for DPDK-2.1.0
Change-Id: I685f3886b3883803210221682fa80353670a6970
Signed-off-by: Shesha Sreenivasamurthy <shesha@cisco.com>
Diffstat (limited to 'vnet/vnet/devices/dpdk/device.c')
-rw-r--r-- | vnet/vnet/devices/dpdk/device.c | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/vnet/vnet/devices/dpdk/device.c b/vnet/vnet/devices/dpdk/device.c index 92f8dcb7870..832853134bb 100644 --- a/vnet/vnet/devices/dpdk/device.c +++ b/vnet/vnet/devices/dpdk/device.c @@ -16,6 +16,7 @@ #include <vppinfra/vec.h> #include <vppinfra/format.h> #include <vlib/unix/cj.h> +#include <assert.h> #include <vnet/ethernet/ethernet.h> #include <vnet/devices/dpdk/dpdk.h> @@ -261,22 +262,37 @@ u32 tx_burst_vector_internal (vlib_main_t * vm, } else if (xd->dev_type == VNET_DPDK_DEV_VHOST_USER) { + u32 offset = 0; +#if RTE_VERSION >= RTE_VERSION_NUM(2, 2, 0, 0) + if (PREDICT_TRUE(xd->lockp == NULL)) { + dpdk_device_and_queue_t * dq; + vec_foreach (dq, dm->devices_by_cpu[vm->cpu_index]) + { + if (xd->device_index == dq->device) + break; + } + assert (dq); + offset = dq->queue_id * VIRTIO_QNUM; + } else { + offset = queue_id * VIRTIO_QNUM; + } +#endif if (PREDICT_TRUE(tx_head > tx_tail)) { /* no wrap, transmit in one burst */ - rv = rte_vhost_enqueue_burst(&xd->vu_vhost_dev, VIRTIO_RXQ, + rv = rte_vhost_enqueue_burst(&xd->vu_vhost_dev, offset + VIRTIO_RXQ, &tx_vector[tx_tail], (uint16_t) (tx_head-tx_tail)); if (PREDICT_TRUE(rv > 0)) { - if (dpdk_vhost_user_want_interrupt(xd, VIRTIO_RXQ)) { - dpdk_vu_vring *vring = &(xd->vu_intf->vrings[VIRTIO_RXQ]); + if (dpdk_vhost_user_want_interrupt(xd, offset + VIRTIO_RXQ)) { + dpdk_vu_vring *vring = &(xd->vu_intf->vrings[offset + VIRTIO_RXQ]); vring->n_since_last_int += rv; f64 now = vlib_time_now (vm); if (vring->int_deadline < now || vring->n_since_last_int > dm->vhost_coalesce_frames) - dpdk_vhost_user_send_interrupt(vm, xd, VIRTIO_RXQ); + dpdk_vhost_user_send_interrupt(vm, xd, offset + VIRTIO_RXQ); } int c = rv; @@ -291,20 +307,20 @@ u32 tx_burst_vector_internal (vlib_main_t * vm, * so we can try to transmit the rest. If we didn't transmit * everything, stop now. */ - rv = rte_vhost_enqueue_burst(&xd->vu_vhost_dev, VIRTIO_RXQ, + rv = rte_vhost_enqueue_burst(&xd->vu_vhost_dev, offset + VIRTIO_RXQ, &tx_vector[tx_tail], (uint16_t) (DPDK_TX_RING_SIZE - tx_tail)); if (PREDICT_TRUE(rv > 0)) { - if (dpdk_vhost_user_want_interrupt(xd, VIRTIO_RXQ)) { - dpdk_vu_vring *vring = &(xd->vu_intf->vrings[VIRTIO_RXQ]); + if (dpdk_vhost_user_want_interrupt(xd, offset + VIRTIO_RXQ)) { + dpdk_vu_vring *vring = &(xd->vu_intf->vrings[offset + VIRTIO_RXQ]); vring->n_since_last_int += rv; f64 now = vlib_time_now (vm); if (vring->int_deadline < now || vring->n_since_last_int > dm->vhost_coalesce_frames) - dpdk_vhost_user_send_interrupt(vm, xd, VIRTIO_RXQ); + dpdk_vhost_user_send_interrupt(vm, xd, offset + VIRTIO_RXQ); } int c = rv; |