From 6295d50b37ded4a335058722545dd5310202b8c0 Mon Sep 17 00:00:00 2001 From: Andrew Yourtchenko Date: Tue, 6 Jun 2017 14:50:03 +0200 Subject: acl-plugin: add a plugin-specific control-ping message api and make the test code use it This fixes the undesirable pause in the dump commands in case there is nothing to dump. Change-Id: I0554556c9e442038aa2a1ed8c88234f21f7fe9b9 Signed-off-by: Andrew Yourtchenko --- src/plugins/acl/acl_test.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'src/plugins/acl/acl_test.c') diff --git a/src/plugins/acl/acl_test.c b/src/plugins/acl/acl_test.c index 8f6179f8f33..65ef8009955 100644 --- a/src/plugins/acl/acl_test.c +++ b/src/plugins/acl/acl_test.c @@ -243,6 +243,22 @@ static void vl_api_macip_acl_interface_get_reply_t_handler vam->result_ready = 1; } +static void vl_api_acl_plugin_control_ping_reply_t_handler + (vl_api_acl_plugin_control_ping_reply_t * mp) +{ + vat_main_t *vam = &vat_main; + i32 retval = ntohl (mp->retval); + if (vam->async_mode) + { + vam->async_errors += (retval < 0); + } + else + { + vam->retval = retval; + vam->result_ready = 1; + } +} + /* * Table of message reply handlers, must include boilerplate handlers @@ -260,6 +276,7 @@ _(MACIP_ACL_DEL_REPLY, macip_acl_del_reply) \ _(MACIP_ACL_DETAILS, macip_acl_details) \ _(MACIP_ACL_INTERFACE_ADD_DEL_REPLY, macip_acl_interface_add_del_reply) \ _(MACIP_ACL_INTERFACE_GET_REPLY, macip_acl_interface_get_reply) \ +_(ACL_PLUGIN_CONTROL_PING_REPLY, acl_plugin_control_ping_reply) \ _(ACL_PLUGIN_GET_VERSION_REPLY, acl_plugin_get_version_reply) static int api_acl_plugin_get_version (vat_main_t * vam) @@ -728,6 +745,15 @@ static int api_acl_interface_set_acl_list (vat_main_t * vam) return ret; } +static void +api_acl_send_control_ping(vat_main_t *vam) +{ + vl_api_acl_plugin_control_ping_t *mp_ping; + + M(ACL_PLUGIN_CONTROL_PING, mp_ping); + S(mp_ping); +} + static int api_acl_interface_list_dump (vat_main_t * vam) { @@ -753,6 +779,9 @@ static int api_acl_interface_list_dump (vat_main_t * vam) /* send it... */ S(mp); + /* Use control ping for synchronization */ + api_acl_send_control_ping(vam); + /* Wait for a reply... */ W (ret); return ret; @@ -780,6 +809,9 @@ static int api_acl_dump (vat_main_t * vam) /* send it... */ S(mp); + /* Use control ping for synchronization */ + api_acl_send_control_ping(vam); + /* Wait for a reply... */ W (ret); return ret; @@ -807,6 +839,9 @@ static int api_macip_acl_dump (vat_main_t * vam) /* send it... */ S(mp); + /* Use control ping for synchronization */ + api_acl_send_control_ping(vam); + /* Wait for a reply... */ W (ret); return ret; -- cgit 1.2.3-korg