summaryrefslogtreecommitdiffstats
path: root/vnet/vnet/devices/virtio/vhost-user.h
diff options
context:
space:
mode:
authorPierre Pfister <ppfister@cisco.com>2016-11-29 15:36:14 +0000
committerDamjan Marion <dmarion.lists@gmail.com>2016-12-06 16:22:16 +0000
commitd3eb90ecfc1711805deab241a63edd2da2203ef8 (patch)
treeec0a74dac9d6f1f055dafb4ef2b17317c7fa3939 /vnet/vnet/devices/virtio/vhost-user.h
parentf3bd5716c1e2dfb1063a0abb0b2fdaf0bccf159f (diff)
vhost: Improve data path
This patch significantly improves vhost Tx and Rx performance (20% Mpps improvement in PVP scenario). Most significant change consists in the split of virtio ring parsing and memory copies. Other minor changes mostly consist in getting rid of unnecessary variables. Change-Id: Ia94e12ab9a6c114e3f7fef376a9343823d051209 Signed-off-by: Pierre Pfister <ppfister@cisco.com>
Diffstat (limited to 'vnet/vnet/devices/virtio/vhost-user.h')
-rw-r--r--vnet/vnet/devices/virtio/vhost-user.h30
1 files changed, 29 insertions, 1 deletions
diff --git a/vnet/vnet/devices/virtio/vhost-user.h b/vnet/vnet/devices/virtio/vhost-user.h
index ab0128aad48..3083b614016 100644
--- a/vnet/vnet/devices/virtio/vhost-user.h
+++ b/vnet/vnet/devices/virtio/vhost-user.h
@@ -259,12 +259,40 @@ typedef struct
typedef struct
{
+ uword dst;
+ uword src;
+ u32 len;
+} vhost_copy_t;
+
+typedef struct
+{
+ u16 qid; /** The interface queue index (Not the virtio vring idx) */
+ u16 device_index; /** The device index */
+ u32 virtio_ring_flags; /** Runtime queue flags **/
+ u16 first_desc_len; /** Length of the first data descriptor **/
+ virtio_net_hdr_mrg_rxbuf_t hdr; /** Virtio header **/
+} vhost_trace_t;
+
+
+#define VHOST_USER_RX_BUFFERS_N (2 * VLIB_FRAME_SIZE + 2)
+#define VHOST_USER_COPY_ARRAY_N (4 * VLIB_FRAME_SIZE)
+
+typedef struct
+{
vhost_iface_and_queue_t *rx_queues;
+ u32 rx_buffers_len;
+ u32 rx_buffers[VHOST_USER_RX_BUFFERS_N];
+
+ virtio_net_hdr_mrg_rxbuf_t tx_headers[VLIB_FRAME_SIZE];
+ vhost_copy_t copy[VHOST_USER_COPY_ARRAY_N];
+
+ /* This is here so it doesn't end-up
+ * using stack or registers. */
+ vhost_trace_t *current_trace;
} vhost_cpu_t;
typedef struct
{
- u32 **rx_buffers;
u32 mtu_bytes;
vhost_user_intf_t *vhost_user_interfaces;
u32 *show_dev_instance_by_real_dev_instance;