aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlib
diff options
context:
space:
mode:
authorSteven <sluong@cisco.com>2017-03-15 21:18:55 -0700
committerDamjan Marion <dmarion.lists@gmail.com>2017-03-22 08:54:33 +0000
commit7312cc7785a9d1198519e1091a645fecc019a6b8 (patch)
tree7f46d3e5b36c766949ddfc37329cffeeebcc7323 /src/vlib
parentb616e9fdc270e786c31b9ee9de5464497f0b1f6d (diff)
vhost: support interrupt mode
vhost currently supports only polling mode. This patch is to add interrupt mode. When the interface is configured for interrupt mode, our input node does not get called unless there is a packet in the vring. If a particular CPU has one interface configured for polling mode and another in interrupt, the input node is set to polling for that CPU. This diffs also includes two crashes in vlib's dispatch_node. One is included in https://gerrit.fd.io/r/#/c/5516. The other crash is in the ASSERT. The ASSERT can become true when the caller of dispatch_node is in a loop. The first call converted the node to polling. The second call thereafter will hit the ASSERT. Change-Id: If17b6d48b20d7d8605c6a161459828637173cd32 Signed-off-by: Steven <sluong@cisco.com>
Diffstat (limited to 'src/vlib')
-rw-r--r--src/vlib/main.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/vlib/main.c b/src/vlib/main.c
index 605771c8..50f0b162 100644
--- a/src/vlib/main.c
+++ b/src/vlib/main.c
@@ -1032,15 +1032,14 @@ dispatch_node (vlib_main_t * vm,
vlib_worker_thread_t *w = vlib_worker_threads + vm->cpu_index;
#endif
- if (dispatch_state == VLIB_NODE_STATE_INTERRUPT
- && v >= nm->polling_threshold_vector_length)
+ if ((dispatch_state == VLIB_NODE_STATE_INTERRUPT
+ && v >= nm->polling_threshold_vector_length) &&
+ !(node->flags &
+ VLIB_NODE_FLAG_SWITCH_FROM_INTERRUPT_TO_POLLING_MODE))
{
vlib_node_t *n = vlib_get_node (vm, node->node_index);
n->state = VLIB_NODE_STATE_POLLING;
node->state = VLIB_NODE_STATE_POLLING;
- ASSERT (!
- (node->flags &
- VLIB_NODE_FLAG_SWITCH_FROM_INTERRUPT_TO_POLLING_MODE));
node->flags &=
~VLIB_NODE_FLAG_SWITCH_FROM_POLLING_TO_INTERRUPT_MODE;
node->flags |=
@@ -1445,6 +1444,10 @@ vlib_main_or_worker_loop (vlib_main_t * vm, int is_main)
/* Pre-allocate expired nodes. */
vec_alloc (nm->pending_interrupt_node_runtime_indices, 32);
+ if (!nm->polling_threshold_vector_length)
+ nm->polling_threshold_vector_length = 10;
+ if (!nm->interrupt_threshold_vector_length)
+ nm->interrupt_threshold_vector_length = 5;
if (is_main)
{