aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/acl/hash_lookup.c22
-rw-r--r--src/plugins/dev_iavf/virtchnl.h1
-rw-r--r--src/plugins/hs_apps/echo_client.c52
-rw-r--r--src/plugins/hs_apps/echo_client.h2
4 files changed, 45 insertions, 32 deletions
diff --git a/src/plugins/acl/hash_lookup.c b/src/plugins/acl/hash_lookup.c
index 9c3c662a8f1..b4f86208a71 100644
--- a/src/plugins/acl/hash_lookup.c
+++ b/src/plugins/acl/hash_lookup.c
@@ -946,31 +946,15 @@ hash_acl_reapply(acl_main_t *am, u32 lc_index, int acl_index)
static void
make_ip6_address_mask(ip6_address_t *addr, u8 prefix_len)
{
+ ASSERT (prefix_len <= 128);
ip6_address_mask_from_width(addr, prefix_len);
}
-
-/* Maybe should be moved into the core somewhere */
-always_inline void
-ip4_address_mask_from_width (ip4_address_t * a, u32 width)
-{
- int i, byte, bit, bitnum;
- ASSERT (width <= 32);
- clib_memset (a, 0, sizeof (a[0]));
- for (i = 0; i < width; i++)
- {
- bitnum = (7 - (i & 7));
- byte = i / 8;
- bit = 1 << bitnum;
- a->as_u8[byte] |= bit;
- }
-}
-
-
static void
make_ip4_address_mask(ip4_address_t *addr, u8 prefix_len)
{
- ip4_address_mask_from_width(addr, prefix_len);
+ ASSERT (prefix_len <= 32);
+ ip4_preflen_to_mask (prefix_len, addr);
}
static void
diff --git a/src/plugins/dev_iavf/virtchnl.h b/src/plugins/dev_iavf/virtchnl.h
index 2099104c8ad..72158684e9e 100644
--- a/src/plugins/dev_iavf/virtchnl.h
+++ b/src/plugins/dev_iavf/virtchnl.h
@@ -560,6 +560,7 @@ typedef struct
{
u16 unicast_promisc : 1;
u16 multicast_promisc : 1;
+ u16 unused : 14;
};
u16 flags;
};
diff --git a/src/plugins/hs_apps/echo_client.c b/src/plugins/hs_apps/echo_client.c
index b08edaaa5f5..f57fd748dba 100644
--- a/src/plugins/hs_apps/echo_client.c
+++ b/src/plugins/hs_apps/echo_client.c
@@ -79,21 +79,27 @@ ec_session_get (ec_worker_t *wrk, u32 ec_index)
static void
send_data_chunk (ec_main_t *ecm, ec_session_t *es)
{
+ const u64 max_burst = 128000;
u8 *test_data = ecm->connect_test_data;
int test_buf_len, test_buf_offset, rv;
+ u64 bytes_to_send;
u32 bytes_this_chunk;
+ svm_fifo_t *f = es->tx_fifo;
test_buf_len = vec_len (test_data);
ASSERT (test_buf_len > 0);
+ if (ecm->run_time)
+ bytes_to_send = clib_min (svm_fifo_max_enqueue_prod (f), max_burst);
+ else
+ bytes_to_send = clib_min (es->bytes_to_send, max_burst);
test_buf_offset = es->bytes_sent % test_buf_len;
- bytes_this_chunk =
- clib_min (test_buf_len - test_buf_offset, es->bytes_to_send);
+
+ bytes_this_chunk = clib_min (test_buf_len - test_buf_offset, bytes_to_send);
if (!es->is_dgram)
{
if (ecm->no_copy)
{
- svm_fifo_t *f = es->tx_fifo;
rv = clib_min (svm_fifo_max_enqueue_prod (f), bytes_this_chunk);
svm_fifo_enqueue_nocopy (f, rv);
session_program_tx_io_evt (es->tx_fifo->vpp_sh, SESSION_IO_EVT_TX);
@@ -105,7 +111,6 @@ send_data_chunk (ec_main_t *ecm, ec_session_t *es)
}
else
{
- svm_fifo_t *f = es->tx_fifo;
u32 max_enqueue = svm_fifo_max_enqueue_prod (f);
if (max_enqueue < sizeof (session_dgram_hdr_t))
@@ -147,8 +152,11 @@ send_data_chunk (ec_main_t *ecm, ec_session_t *es)
if (rv > 0)
{
/* Account for it... */
- es->bytes_to_send -= rv;
es->bytes_sent += rv;
+ if (ecm->run_time)
+ es->bytes_to_receive += rv;
+ else
+ es->bytes_to_send -= rv;
if (ecm->cfg.verbose)
{
@@ -266,7 +274,7 @@ ec_node_fn (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
{
ecm->repeats++;
ecm->prev_conns = vec_len (conns_this_batch);
- if (ecm->repeats == 500000)
+ if (ecm->repeats == 500000 && !ecm->run_time)
{
ec_err ("stuck clients");
}
@@ -297,7 +305,7 @@ ec_node_fn (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
delete_session = 0;
}
- if (PREDICT_FALSE (delete_session == 1))
+ if (PREDICT_FALSE (delete_session == 1) || ecm->timer_expired)
{
clib_atomic_fetch_add (&ecm->tx_total, es->bytes_sent);
clib_atomic_fetch_add (&ecm->rx_total, es->bytes_received);
@@ -356,6 +364,7 @@ ec_reset_runtime_config (ec_main_t *ecm)
ecm->tls_engine = CRYPTO_ENGINE_OPENSSL;
ecm->no_copy = 0;
ecm->run_test = EC_STARTING;
+ ecm->timer_expired = false;
ecm->ready_connections = 0;
ecm->connect_conn_index = 0;
ecm->rx_total = 0;
@@ -368,6 +377,7 @@ ec_reset_runtime_config (ec_main_t *ecm)
ecm->attach_flags = 0;
ecm->syn_timeout = 20.0;
ecm->test_timeout = 20.0;
+ ecm->run_time = 0;
vec_free (ecm->connect_uri);
}
@@ -1072,7 +1082,7 @@ ec_command_fn (vlib_main_t *vm, unformat_input_t *input,
ec_main_t *ecm = &ec_main;
uword *event_data = 0, event_type;
clib_error_t *error = 0;
- int rv, had_config = 1;
+ int rv, timed_run_conflict = 0, had_config = 1;
u64 total_bytes;
f64 delta;
@@ -1101,11 +1111,13 @@ ec_command_fn (vlib_main_t *vm, unformat_input_t *input,
;
else if (unformat (line_input, "bytes %U", unformat_memory_size,
&ecm->bytes_to_send))
- ;
+ timed_run_conflict++;
else if (unformat (line_input, "test-timeout %f", &ecm->test_timeout))
;
else if (unformat (line_input, "syn-timeout %f", &ecm->syn_timeout))
;
+ else if (unformat (line_input, "run-time %f", &ecm->run_time))
+ ;
else if (unformat (line_input, "echo-bytes"))
ecm->echo_bytes = 1;
else if (unformat (line_input, "fifo-size %U", unformat_memory_size,
@@ -1149,6 +1161,9 @@ ec_command_fn (vlib_main_t *vm, unformat_input_t *input,
}
}
+ if (timed_run_conflict && ecm->run_time)
+ return clib_error_return (0, "failed: invalid arguments for a timed run!");
+
parse_config:
ecm->cfg.num_test_sessions = ecm->expected_connections =
@@ -1234,11 +1249,22 @@ parse_config:
goto stop_test;
}
+ /* Testing officially starts now */
+ ecm->test_start_time = vlib_time_now (ecm->vlib_main);
+ ec_cli ("Test started at %.6f", ecm->test_start_time);
+
+ /*
+ * If a timed run, wait and expire timer
+ */
+ if (ecm->run_time)
+ {
+ vlib_process_suspend (vm, ecm->run_time);
+ ec_main.timer_expired = true;
+ }
+
/*
* Wait for the sessions to finish or test_timeout seconds pass
*/
- ecm->test_start_time = vlib_time_now (ecm->vlib_main);
- ec_cli ("Test started at %.6f", ecm->test_start_time);
vlib_process_wait_for_event_or_clock (vm, ecm->test_timeout);
event_type = vlib_process_get_events (vm, &event_data);
switch (event_type)
@@ -1332,8 +1358,8 @@ cleanup:
VLIB_CLI_COMMAND (ec_command, static) = {
.path = "test echo clients",
.short_help =
- "test echo clients [nclients %d][bytes <bytes>[m|g]]"
- "[test-timeout <time>][syn-timeout <time>][echo-bytes][fifo-size <size>]"
+ "test echo clients [nclients %d][bytes <bytes>[m|g]][test-timeout <time>]"
+ "[run-time <time>][syn-timeout <time>][echo-bytes][fifo-size <size>]"
"[private-segment-count <count>][private-segment-size <bytes>[m|g]]"
"[preallocate-fifos][preallocate-sessions][client-batch <batch-size>]"
"[uri <tcp://ip/port>][test-bytes][verbose]",
diff --git a/src/plugins/hs_apps/echo_client.h b/src/plugins/hs_apps/echo_client.h
index 5868c3652ce..d06f237c757 100644
--- a/src/plugins/hs_apps/echo_client.h
+++ b/src/plugins/hs_apps/echo_client.h
@@ -57,6 +57,7 @@ typedef struct
volatile u64 rx_total;
volatile u64 tx_total;
volatile int run_test; /**< Signal start of test */
+ volatile bool timer_expired; /**< Signal end of timed test */
f64 syn_start_time;
f64 test_start_time;
@@ -97,6 +98,7 @@ typedef struct
u64 appns_secret; /**< App namespace secret */
f64 syn_timeout; /**< Test syn timeout (s) */
f64 test_timeout; /**< Test timeout (s) */
+ f64 run_time; /**< Length of a test (s) */
/*
* Flags