summaryrefslogtreecommitdiffstats
path: root/src/vnet/devices/virtio/vhost_user_input.c
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2018-11-21 09:51:42 +0100
committerAndrew Yourtchenko <ayourtch@gmail.com>2018-11-22 19:08:08 +0000
commit9af4504db1f5d6f5562d8445ab325989b968cf12 (patch)
tree130a90523ce22b843428be61bdf0ec3b9cf7c01a /src/vnet/devices/virtio/vhost_user_input.c
parentbefe691f4c30c8a16cb23fe97c62770e44b56c03 (diff)
vhost-user: avoid per-packet feature arc lookups
Change-Id: If96f5a7c7e4b511cab3d57e5b57796aa516aff11 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vnet/devices/virtio/vhost_user_input.c')
-rw-r--r--src/vnet/devices/virtio/vhost_user_input.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/src/vnet/devices/virtio/vhost_user_input.c b/src/vnet/devices/virtio/vhost_user_input.c
index 6c3f6aad55c..97f6792354a 100644
--- a/src/vnet/devices/virtio/vhost_user_input.c
+++ b/src/vnet/devices/virtio/vhost_user_input.c
@@ -249,6 +249,7 @@ vhost_user_if_input (vlib_main_t * vm,
vnet_hw_interface_rx_mode mode)
{
vhost_user_vring_t *txvq = &vui->vrings[VHOST_VRING_IDX_TX (qid)];
+ vnet_feature_main_t *fm = &feature_main;
u16 n_rx_packets = 0;
u32 n_rx_bytes = 0;
u16 n_left;
@@ -258,6 +259,8 @@ vhost_user_if_input (vlib_main_t * vm,
u32 map_hint = 0;
vhost_cpu_t *cpu = &vum->cpus[vm->thread_index];
u16 copy_len = 0;
+ u8 feature_arc_idx = fm->device_input_feature_arc_index;
+ u32 current_config_index = ~(u32) 0;
/* The descriptor table is not ready yet */
if (PREDICT_FALSE (txvq->avail == 0))
@@ -369,6 +372,16 @@ vhost_user_if_input (vlib_main_t * vm,
}
}
+ if (PREDICT_FALSE (vnet_have_features (feature_arc_idx, vui->sw_if_index)))
+ {
+ vnet_feature_config_main_t *cm;
+ cm = &fm->feature_config_mains[feature_arc_idx];
+ current_config_index = vec_elt (cm->config_index_by_sw_if_index,
+ vui->sw_if_index);
+ vnet_get_config_data (&cm->config_main, &current_config_index,
+ &next_index, 0);
+ }
+
while (n_left > 0)
{
vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next);
@@ -539,18 +552,11 @@ vhost_user_if_input (vlib_main_t * vm,
vnet_buffer (b_head)->sw_if_index[VLIB_TX] = (u32) ~ 0;
b_head->error = 0;
- {
- u32 next0 = VNET_DEVICE_INPUT_NEXT_ETHERNET_INPUT;
-
- /* redirect if feature path enabled */
- vnet_feature_start_device_input_x1 (vui->sw_if_index, &next0,
- b_head);
-
- u32 bi = to_next[-1]; //Cannot use to_next[-1] in the macro
- vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
- to_next, n_left_to_next,
- bi, next0);
- }
+ if (current_config_index != ~(u32) 0)
+ {
+ b_head->current_config_index = current_config_index;
+ vnet_buffer (b_head)->feature_arc_index = feature_arc_idx;
+ }
n_left--;