summaryrefslogtreecommitdiffstats
path: root/src/plugins/avf/cli.c
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2020-08-20 17:28:20 +0200
committerFlorin Coras <florin.coras@gmail.com>2020-09-11 07:49:45 +0000
commit66bb7dd64ee2377103e18b96f1e6bf6405de44b5 (patch)
tree1a98102ba4c0346431de03717d0c6dbf7344e443 /src/plugins/avf/cli.c
parent78681def21b931309a779dfc6a5cbc6ff8b1f814 (diff)
avf: fix race between avf process node and avf_delete_if(...)
It may happen that process node is suspended while it waits for response from adminq and during that time CLI or API process can call avf_delete_if. When avf process node resumes, it may happen that device is not there anymeore. This patch delegates interface deletion to process node, so CLI/API process just sends signal instead of deleting device instance itself. Type: fix Change-Id: I7f12e12df3071650f6e60ad7eb5af23b7acfe335 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/plugins/avf/cli.c')
-rw-r--r--src/plugins/avf/cli.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/plugins/avf/cli.c b/src/plugins/avf/cli.c
index 414163ac8a2..29c2a6b1f6e 100644
--- a/src/plugins/avf/cli.c
+++ b/src/plugins/avf/cli.c
@@ -84,8 +84,6 @@ avf_delete_command_fn (vlib_main_t * vm, unformat_input_t * input,
unformat_input_t _line_input, *line_input = &_line_input;
u32 sw_if_index = ~0;
vnet_hw_interface_t *hw;
- avf_main_t *am = &avf_main;
- avf_device_t *ad;
vnet_main_t *vnm = vnet_get_main ();
/* Get a line of input. */
@@ -113,9 +111,8 @@ avf_delete_command_fn (vlib_main_t * vm, unformat_input_t * input,
if (hw == NULL || avf_device_class.index != hw->dev_class_index)
return clib_error_return (0, "not an AVF interface");
- ad = pool_elt_at_index (am->devices, hw->dev_instance);
-
- avf_delete_if (vm, ad);
+ vlib_process_signal_event (vm, avf_process_node.index,
+ AVF_PROCESS_EVENT_DELETE_IF, hw->dev_instance);
return 0;
}
@@ -126,6 +123,7 @@ VLIB_CLI_COMMAND (avf_delete_command, static) = {
.short_help = "delete interface avf "
"{<interface> | sw_if_index <sw_idx>}",
.function = avf_delete_command_fn,
+ .is_mp_safe = 1,
};
/* *INDENT-ON* */