summaryrefslogtreecommitdiffstats
path: root/src/plugins/hs_apps/echo_client.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2022-01-12 23:01:29 -0800
committerFlorin Coras <fcoras@cisco.com>2022-01-12 23:30:38 -0800
commit85299b1bb6810acf468bf52740df76bd92d28128 (patch)
tree5d236363323ea8ea7622c134c6f21ba6d814bd3f /src/plugins/hs_apps/echo_client.c
parent0c8375de839aa11eeb332b8240e19aca72e6f846 (diff)
hsa: echo clients connect improvements
Do burst of connects with barrier held. Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I7e6dcf097022b56d6880de0cba7b8492a938077b
Diffstat (limited to 'src/plugins/hs_apps/echo_client.c')
-rw-r--r--src/plugins/hs_apps/echo_client.c51
1 files changed, 33 insertions, 18 deletions
diff --git a/src/plugins/hs_apps/echo_client.c b/src/plugins/hs_apps/echo_client.c
index 39cf98d2a1b..03297510d3e 100644
--- a/src/plugins/hs_apps/echo_client.c
+++ b/src/plugins/hs_apps/echo_client.c
@@ -821,7 +821,8 @@ echo_clients_connect (vlib_main_t *vm)
{
echo_client_main_t *ecm = &echo_client_main;
vnet_connect_args_t _a = {}, *a = &_a;
- int i, rv, needs_crypto;
+ int ci = 0, rv, needs_crypto;
+ clib_error_t *error = 0;
u32 n_clients;
n_clients = ecm->n_clients;
@@ -829,9 +830,11 @@ echo_clients_connect (vlib_main_t *vm)
clib_memcpy (&a->sep_ext, &ecm->connect_sep, sizeof (ecm->connect_sep));
a->app_index = ecm->app_index;
- for (i = 0; i < n_clients; i++)
+ vlib_worker_thread_barrier_sync (vm);
+
+ while (ci < n_clients)
{
- a->api_context = i;
+ a->api_context = ci;
if (needs_crypto)
{
session_endpoint_alloc_ext_cfg (&a->sep_ext,
@@ -839,8 +842,6 @@ echo_clients_connect (vlib_main_t *vm)
a->sep_ext.ext_cfg->crypto.ckpair_index = ecm->ckpair_index;
}
- vlib_worker_thread_barrier_sync (vm);
-
rv = vnet_connect (a);
if (needs_crypto)
@@ -848,20 +849,35 @@ echo_clients_connect (vlib_main_t *vm)
if (rv)
{
- vlib_worker_thread_barrier_release (vm);
- return clib_error_return (0, "connect returned: %d", rv);
+ error = clib_error_return (0, "connect returned: %d", rv);
+ break;
}
- vlib_worker_thread_barrier_release (vm);
+ ci += 1;
/* Crude pacing for call setups */
- if ((i % 16) == 0)
- vlib_process_suspend (vm, 100e-6);
- ASSERT (i + 1 >= ecm->ready_connections);
- while (i + 1 - ecm->ready_connections > 128)
- vlib_process_suspend (vm, 1e-3);
+ if ((ci % 16) == 0)
+ {
+ vlib_worker_thread_barrier_release (vm);
+
+ ASSERT (ci >= ecm->ready_connections);
+ if (ci - ecm->ready_connections > 128)
+ {
+ while (ci - ecm->ready_connections > 128)
+ vlib_process_suspend (vm, 100e-6);
+ }
+ else
+ {
+ vlib_process_suspend (vm, 50e-6);
+ }
+
+ vlib_worker_thread_barrier_sync (vm);
+ }
}
- return 0;
+
+ vlib_worker_thread_barrier_release (vm);
+
+ return error;
}
#define ec_cli(_fmt, _args...) \
@@ -873,14 +889,13 @@ echo_clients_command_fn (vlib_main_t *vm, unformat_input_t *input,
vlib_cli_command_t *cmd)
{
unformat_input_t _line_input, *line_input = &_line_input;
+ char *default_uri = "tcp://6.0.1.1/1234", *transfer_type;
echo_client_main_t *ecm = &echo_client_main;
- u64 tmp, total_bytes;
- f64 delta;
- char *default_uri = "tcp://6.0.1.1/1234";
uword *event_data = 0, event_type;
- char *transfer_type;
clib_error_t *error = 0;
int rv, had_config = 1;
+ u64 tmp, total_bytes;
+ f64 delta;
if (ecm->test_client_attached)
return clib_error_return (0, "failed: already running!");