summaryrefslogtreecommitdiffstats
path: root/src/vlib
diff options
context:
space:
mode:
Diffstat (limited to 'src/vlib')
-rw-r--r--src/vlib/main.c10
-rw-r--r--src/vlib/node.h1
-rw-r--r--src/vlib/node_funcs.h21
3 files changed, 25 insertions, 7 deletions
diff --git a/src/vlib/main.c b/src/vlib/main.c
index 41f74b9bdf6..fc6fadb625e 100644
--- a/src/vlib/main.c
+++ b/src/vlib/main.c
@@ -1056,13 +1056,9 @@ dispatch_node (vlib_main_t * vm,
/* n_vectors */ n,
/* n_clocks */ t - last_time_stamp);
- /* When in interrupt mode and vector rate crosses threshold switch to
- polling mode. */
- if (PREDICT_FALSE ((dispatch_state == VLIB_NODE_STATE_INTERRUPT)
- || (dispatch_state == VLIB_NODE_STATE_POLLING
- && (node->flags
- &
- VLIB_NODE_FLAG_SWITCH_FROM_INTERRUPT_TO_POLLING_MODE))))
+ /* When in adaptive mode and vector rate crosses threshold switch to
+ polling mode and vice versa. */
+ if (PREDICT_FALSE (node->flags & VLIB_NODE_FLAG_ADAPTIVE_MODE))
{
/* *INDENT-OFF* */
ELOG_TYPE_DECLARE (e) =
diff --git a/src/vlib/node.h b/src/vlib/node.h
index 9a3bb8370af..aae5103908d 100644
--- a/src/vlib/node.h
+++ b/src/vlib/node.h
@@ -294,6 +294,7 @@ typedef struct vlib_node_t
#define VLIB_NODE_FLAG_SWITCH_FROM_INTERRUPT_TO_POLLING_MODE (1 << 6)
#define VLIB_NODE_FLAG_SWITCH_FROM_POLLING_TO_INTERRUPT_MODE (1 << 7)
#define VLIB_NODE_FLAG_TRACE_SUPPORTED (1 << 8)
+#define VLIB_NODE_FLAG_ADAPTIVE_MODE (1 << 9)
/* State for input nodes. */
u8 state;
diff --git a/src/vlib/node_funcs.h b/src/vlib/node_funcs.h
index d65fd2e061d..3c90a88efa0 100644
--- a/src/vlib/node_funcs.h
+++ b/src/vlib/node_funcs.h
@@ -225,6 +225,27 @@ vlib_node_get_state (vlib_main_t * vm, u32 node_index)
}
always_inline void
+vlib_node_set_flag (vlib_main_t *vm, u32 node_index, u16 flag, u8 enable)
+{
+ vlib_node_runtime_t *r;
+ vlib_node_t *n;
+
+ n = vlib_get_node (vm, node_index);
+ r = vlib_node_get_runtime (vm, node_index);
+
+ if (enable)
+ {
+ n->flags |= flag;
+ r->flags |= flag;
+ }
+ else
+ {
+ n->flags &= ~flag;
+ r->flags &= ~flag;
+ }
+}
+
+always_inline void
vlib_node_set_interrupt_pending (vlib_main_t *vm, u32 node_index)
{
vlib_node_main_t *nm = &vm->node_main;