aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/devices/virtio
diff options
context:
space:
mode:
authorMohsin Kazmi <sykazmi@cisco.com>2019-01-31 13:18:00 +0000
committerDamjan Marion <dmarion@me.com>2019-02-06 17:27:44 +0000
commit80659b4624d55e2d293198b06c5c6077b3ba816b (patch)
tree195b39ddfd4fbc5642eb58da482c3c0c990b7a7d /src/vnet/devices/virtio
parentef20f0eff7f0e6ed75f316eb7080aa655de077ff (diff)
virtio: Use new buffer optimization
Change-Id: Ifc98373371b967c49a75989eac415ddda1dcf15f Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
Diffstat (limited to 'src/vnet/devices/virtio')
-rw-r--r--src/vnet/devices/virtio/node.c6
-rw-r--r--src/vnet/devices/virtio/pci.c1
-rw-r--r--src/vnet/devices/virtio/virtio.c15
-rw-r--r--src/vnet/devices/virtio/virtio.h3
4 files changed, 23 insertions, 2 deletions
diff --git a/src/vnet/devices/virtio/node.c b/src/vnet/devices/virtio/node.c
index 6627456de00..78d071a24ed 100644
--- a/src/vnet/devices/virtio/node.c
+++ b/src/vnet/devices/virtio/node.c
@@ -96,8 +96,10 @@ more:
next = vring->desc_next;
avail = vring->avail->idx;
- n_slots = vlib_buffer_alloc_to_ring (vm, vring->buffers, next, vring->size,
- n_slots);
+ n_slots =
+ vlib_buffer_alloc_to_ring_from_pool (vm, vring->buffers, next,
+ vring->size, n_slots,
+ vring->buffer_pool_index);
if (n_slots == 0)
return;
diff --git a/src/vnet/devices/virtio/pci.c b/src/vnet/devices/virtio/pci.c
index a90dca47218..ffc18f4ca05 100644
--- a/src/vnet/devices/virtio/pci.c
+++ b/src/vnet/devices/virtio/pci.c
@@ -873,6 +873,7 @@ virtio_pci_create_if (vlib_main_t * vm, virtio_pci_create_if_args_t * args)
vnet_hw_interface_set_input_node (vnm, vif->hw_if_index,
virtio_input_node.index);
vnet_hw_interface_assign_rx_thread (vnm, vif->hw_if_index, 0, ~0);
+ virtio_vring_set_numa_node (vm, vif, 0);
if (virtio_pci_is_link_up (vm, vif) & VIRTIO_NET_S_LINK_UP)
{
diff --git a/src/vnet/devices/virtio/virtio.c b/src/vnet/devices/virtio/virtio.c
index 94f140dac97..cfeb30246f0 100644
--- a/src/vnet/devices/virtio/virtio.c
+++ b/src/vnet/devices/virtio/virtio.c
@@ -196,6 +196,21 @@ virtio_vring_free (vlib_main_t * vm, virtio_if_t * vif, u32 idx)
return 0;
}
+void
+virtio_vring_set_numa_node (vlib_main_t * vm, virtio_if_t * vif, u32 idx)
+{
+ vnet_main_t *vnm = vnet_get_main ();
+ u32 thread_index;
+ virtio_vring_t *vring = vec_elt_at_index (vif->vrings, idx);
+ thread_index =
+ vnet_get_device_input_thread_index (vnm, vif->hw_if_index,
+ vring->queue_id);
+ vring->buffer_pool_index =
+ vlib_buffer_pool_get_default_for_numa (vm,
+ vlib_mains
+ [thread_index]->numa_node);
+}
+
inline void
virtio_set_net_hdr_size (virtio_if_t * vif)
{
diff --git a/src/vnet/devices/virtio/virtio.h b/src/vnet/devices/virtio/virtio.h
index 73bb33f8bcc..b2e74bed799 100644
--- a/src/vnet/devices/virtio/virtio.h
+++ b/src/vnet/devices/virtio/virtio.h
@@ -103,6 +103,7 @@ typedef struct
u16 desc_next;
int kick_fd;
int call_fd;
+ u8 buffer_pool_index;
u16 size;
u16 queue_id;
u16 flags;
@@ -188,6 +189,8 @@ clib_error_t *virtio_vring_init (vlib_main_t * vm, virtio_if_t * vif, u16 idx,
u16 sz);
clib_error_t *virtio_vring_free (vlib_main_t * vm, virtio_if_t * vif,
u32 idx);
+void virtio_vring_set_numa_node (vlib_main_t * vm, virtio_if_t * vif,
+ u32 idx);
extern void virtio_free_used_desc (vlib_main_t * vm, virtio_vring_t * vring);
extern void virtio_free_rx_buffers (vlib_main_t * vm, virtio_vring_t * vring);
extern void virtio_set_net_hdr_size (virtio_if_t * vif);