diff options
author | Damjan Marion <damarion@cisco.com> | 2024-09-10 17:07:49 +0200 |
---|---|---|
committer | Ole Tr�an <otroan@employees.org> | 2024-09-26 08:33:47 +0000 |
commit | dfa77dc6062eeaed426879bf162f58337ed36692 (patch) | |
tree | afbee346e9590dc66c8a200f666daa2af0f5ac0c /src/vlibapi | |
parent | d8022139ebf5f2cfb0e207b21baf6aa22e908bb9 (diff) |
vlib: process node scheduler rework
This commit allow use od cooperative multitasking with multiple
descheduling reasons (i.e. event wait and suspend) inside the same
process node. In previus code remote node will wake up process node
by sending event evein if process node is waiting in
vlib_process_ssupend().
This change also allowed new vlib_process_yield() API which deschedules
current process and it puts it into the end of queue.
Change-Id: I846e5a99b4ea1809eb80895f6ffe0ef0b2fd21ae
Type: improvement
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vlibapi')
-rw-r--r-- | src/vlibapi/node_serialize.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/vlibapi/node_serialize.c b/src/vlibapi/node_serialize.c index 09b59247eab..3f921fb0450 100644 --- a/src/vlibapi/node_serialize.c +++ b/src/vlibapi/node_serialize.c @@ -84,26 +84,27 @@ vlib_node_serialize (vlib_main_t * vm, vlib_node_t *** node_dups, u8 * vector, { vlib_process_t *p = vlib_get_process_from_node (vm, n); - switch (p->flags - & (VLIB_PROCESS_IS_SUSPENDED_WAITING_FOR_CLOCK - | VLIB_PROCESS_IS_SUSPENDED_WAITING_FOR_EVENT)) + switch (p->state) { default: - if (!(p->flags & VLIB_PROCESS_IS_RUNNING)) - state_code = STATE_DONE; break; - case VLIB_PROCESS_IS_SUSPENDED_WAITING_FOR_CLOCK: + case VLIB_PROCESS_STATE_WAIT_FOR_CLOCK: + case VLIB_PROCESS_STATE_SUSPENDED: state_code = STATE_TIME_WAIT; break; - case VLIB_PROCESS_IS_SUSPENDED_WAITING_FOR_EVENT: + case VLIB_PROCESS_STATE_WAIT_FOR_EVENT: + case VLIB_PROCESS_STATE_WAIT_FOR_ONE_TIME_EVENT: state_code = STATE_EVENT_WAIT; break; - case (VLIB_PROCESS_IS_SUSPENDED_WAITING_FOR_EVENT | VLIB_PROCESS_IS_SUSPENDED_WAITING_FOR_CLOCK): - state_code = - STATE_ANY_WAIT; + case VLIB_PROCESS_STATE_WAIT_FOR_EVENT_OR_CLOCK: + state_code = STATE_ANY_WAIT; + break; + + case VLIB_PROCESS_STATE_NOT_STARTED: + state_code = STATE_DONE; break; } } |