aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlib/node_cli.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vlib/node_cli.c')
-rw-r--r--src/vlib/node_cli.c29
1 files changed, 8 insertions, 21 deletions
diff --git a/src/vlib/node_cli.c b/src/vlib/node_cli.c
index d0bdf5b9097..16e904e8433 100644
--- a/src/vlib/node_cli.c
+++ b/src/vlib/node_cli.c
@@ -339,29 +339,16 @@ format_vlib_node_state (u8 * s, va_list * va)
state = "active";
if (n->type == VLIB_NODE_TYPE_PROCESS)
{
+ char *state_str[] = {
+#define _(n, s) [VLIB_PROCESS_STATE_##n] = #s,
+ foreach_vlib_process_state
+ };
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))
- {
- default:
- if (!(p->flags & VLIB_PROCESS_IS_RUNNING))
- state = "done";
- break;
-
- case VLIB_PROCESS_IS_SUSPENDED_WAITING_FOR_CLOCK:
- state = "time wait";
- break;
-
- case VLIB_PROCESS_IS_SUSPENDED_WAITING_FOR_EVENT:
- state = "event wait";
- break;
-
- case (VLIB_PROCESS_IS_SUSPENDED_WAITING_FOR_EVENT | VLIB_PROCESS_IS_SUSPENDED_WAITING_FOR_CLOCK):
- state =
- "any wait";
- break;
- }
+ if (p->state >= ARRAY_LEN (state_str) || state_str[p->state] == 0)
+ state = "unknown";
+ else
+ state = state_str[p->state];
}
else if (n->type != VLIB_NODE_TYPE_INTERNAL)
{