diff options
author | Florin Coras <fcoras@cisco.com> | 2020-11-09 09:39:28 -0800 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2020-11-09 22:47:36 +0000 |
commit | 9ed4866440f4a20c04c86ecfc7f8b2cc380b2b09 (patch) | |
tree | ac7ef76672c3ebf1f427210dd9556f8d0745efcf /src/plugins | |
parent | 165f3ae9670c98259677155bd04e92fe5830daa7 (diff) |
hsa: remove fake binary api registration in echo apps
Type: improvement
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I73fbf991f42e643f906b6a3badd95ef46106eb25
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/hs_apps/echo_client.c | 20 | ||||
-rw-r--r-- | src/plugins/hs_apps/echo_server.c | 28 |
2 files changed, 6 insertions, 42 deletions
diff --git a/src/plugins/hs_apps/echo_client.c b/src/plugins/hs_apps/echo_client.c index 188aa90baff..072d767fa6e 100644 --- a/src/plugins/hs_apps/echo_client.c +++ b/src/plugins/hs_apps/echo_client.c @@ -321,19 +321,6 @@ VLIB_REGISTER_NODE (echo_clients_node) = /* *INDENT-ON* */ static int -create_api_loopback (echo_client_main_t * ecm) -{ - api_main_t *am = vlibapi_get_main (); - vl_shmem_hdr_t *shmem_hdr; - - shmem_hdr = am->shmem_hdr; - ecm->vl_input_queue = shmem_hdr->vl_input_queue; - ecm->my_client_index = vl_api_memclnt_create_internal ("echo_client", - ecm->vl_input_queue); - return 0; -} - -static int echo_clients_init (vlib_main_t * vm) { echo_client_main_t *ecm = &echo_client_main; @@ -341,9 +328,6 @@ echo_clients_init (vlib_main_t * vm) u32 num_threads; int i; - if (create_api_loopback (ecm)) - return -1; - num_threads = 1 /* main thread */ + vtm->n_threads; /* Init test data. Big buffer */ @@ -648,7 +632,8 @@ echo_clients_attach (u8 * appns_id, u64 appns_flags, u64 appns_secret) clib_memset (a, 0, sizeof (*a)); clib_memset (options, 0, sizeof (options)); - a->api_client_index = ecm->my_client_index; + a->api_client_index = ~0; + a->name = format (0, "echo_client"); if (ecm->transport_proto == TRANSPORT_PROTO_QUIC) echo_clients.session_connected_callback = quic_echo_clients_session_connected_callback; @@ -681,6 +666,7 @@ echo_clients_attach (u8 * appns_id, u64 appns_flags, u64 appns_secret) return clib_error_return (0, "attach returned %d", rv); ecm->app_index = a->app_index; + vec_free (a->name); clib_memset (a_cert, 0, sizeof (*a_cert)); a_cert->app_index = a->app_index; diff --git a/src/plugins/hs_apps/echo_server.c b/src/plugins/hs_apps/echo_server.c index 4e758619a6a..a5335bb2f20 100644 --- a/src/plugins/hs_apps/echo_server.c +++ b/src/plugins/hs_apps/echo_server.c @@ -301,21 +301,6 @@ static session_cb_vft_t echo_server_session_cb_vft = { .session_reset_callback = echo_server_session_reset_callback }; -/* Abuse VPP's input queue */ -static int -create_api_loopback (vlib_main_t * vm) -{ - echo_server_main_t *esm = &echo_server_main; - api_main_t *am = vlibapi_get_main (); - vl_shmem_hdr_t *shmem_hdr; - - shmem_hdr = am->shmem_hdr; - esm->vl_input_queue = shmem_hdr->vl_input_queue; - esm->my_client_index = vl_api_memclnt_create_internal ("echo_server", - esm->vl_input_queue); - return 0; -} - static int echo_server_attach (u8 * appns_id, u64 appns_flags, u64 appns_secret) { @@ -342,7 +327,8 @@ echo_server_attach (u8 * appns_id, u64 appns_flags, u64 appns_secret) if (esm->private_segment_size) segment_size = esm->private_segment_size; - a->api_client_index = esm->my_client_index; + a->api_client_index = ~0; + a->name = format (0, "echo_server"); a->session_cb_vft = &echo_server_session_cb_vft; a->options = options; a->options[APP_OPTIONS_SEGMENT_SIZE] = segment_size; @@ -369,6 +355,7 @@ echo_server_attach (u8 * appns_id, u64 appns_flags, u64 appns_secret) return -1; } esm->app_index = a->app_index; + vec_free (a->name); clib_memset (a_cert, 0, sizeof (*a_cert)); a_cert->app_index = a->app_index; @@ -433,15 +420,6 @@ echo_server_create (vlib_main_t * vm, u8 * appns_id, u64 appns_flags, u32 num_threads; int i; - if (esm->my_client_index == (u32) ~ 0) - { - if (create_api_loopback (vm)) - { - clib_warning ("failed to create api loopback"); - return -1; - } - } - num_threads = 1 /* main thread */ + vtm->n_threads; vec_validate (echo_server_main.vpp_queue, num_threads - 1); vec_validate (esm->rx_buf, num_threads - 1); |