From ccbb0665ae7e388e08390c8318a48a9f32659ecd Mon Sep 17 00:00:00 2001 From: Damjan Marion Date: Thu, 12 Nov 2020 15:48:15 +0100 Subject: avf: don't switch process if already running process node Type: fix Change-Id: I82b11339402b5848b27c600f6484aaeee66cc888 Signed-off-by: Damjan Marion --- src/plugins/avf/device.c | 43 +++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 18 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/avf/device.c b/src/plugins/avf/device.c index b6cf32f0866..1cedc35db9b 100644 --- a/src/plugins/avf/device.c +++ b/src/plugins/avf/device.c @@ -1165,23 +1165,6 @@ error: vlib_log_err (avf_log.class, "%U", format_clib_error, ad->error); } -static clib_error_t * -avf_process_request (vlib_main_t * vm, avf_process_req_t * req) -{ - uword *event_data = 0; - req->calling_process_index = vlib_get_current_process_node_index (vm); - vlib_process_signal_event_pointer (vm, avf_process_node.index, - AVF_PROCESS_EVENT_REQ, req); - - vlib_process_wait_for_event_or_clock (vm, 5.0); - - if (vlib_process_get_events (vm, &event_data) != 0) - clib_panic ("avf process node failed to reply in 5 seconds"); - vec_free (event_data); - - return req->error; -} - static void avf_process_handle_request (vlib_main_t * vm, avf_process_req_t * req) { @@ -1195,7 +1178,31 @@ avf_process_handle_request (vlib_main_t * vm, avf_process_req_t * req) else clib_panic ("BUG: unknown avf proceess request type"); - vlib_process_signal_event (vm, req->calling_process_index, 0, 0); + if (req->calling_process_index != avf_process_node.index) + vlib_process_signal_event (vm, req->calling_process_index, 0, 0); +} + +static clib_error_t * +avf_process_request (vlib_main_t * vm, avf_process_req_t * req) +{ + uword *event_data = 0; + req->calling_process_index = vlib_get_current_process_node_index (vm); + + if (req->calling_process_index != avf_process_node.index) + { + vlib_process_signal_event_pointer (vm, avf_process_node.index, + AVF_PROCESS_EVENT_REQ, req); + + vlib_process_wait_for_event_or_clock (vm, 5.0); + + if (vlib_process_get_events (vm, &event_data) != 0) + clib_panic ("avf process node failed to reply in 5 seconds"); + vec_free (event_data); + } + else + avf_process_handle_request (vm, req); + + return req->error; } static u32 -- cgit 1.2.3-korg