summaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2018-05-16 09:28:02 -0700
committerDamjan Marion <dmarion.lists@gmail.com>2018-05-16 19:56:47 +0000
commit48750899d7da52a38b5e7f940c739e2b3f10f236 (patch)
tree437ddf26dbf2b55ae61a2b6071a21b4e23bf83e1 /src/vnet
parent1acbf1d17b567829286ea74aded420189cec1277 (diff)
echo client: used fixed pool for preallocated sessions
Change-Id: I9e2cf74ebe3e8750fa8d03930d2d72f4cae453c2 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/session-apps/echo_client.c18
-rw-r--r--src/vnet/session-apps/echo_client.h5
2 files changed, 9 insertions, 14 deletions
diff --git a/src/vnet/session-apps/echo_client.c b/src/vnet/session-apps/echo_client.c
index 3c1904cb55e..1d010f23d4d 100644
--- a/src/vnet/session-apps/echo_client.c
+++ b/src/vnet/session-apps/echo_client.c
@@ -43,7 +43,7 @@ signal_evt_to_cli (int code)
}
static void
-send_data_chunk (echo_client_main_t * ecm, session_t * s)
+send_data_chunk (echo_client_main_t * ecm, eclient_session_t * s)
{
u8 *test_data = ecm->connect_test_data;
int test_buf_len, test_buf_offset, rv;
@@ -140,7 +140,7 @@ send_data_chunk (echo_client_main_t * ecm, session_t * s)
}
static void
-receive_data_chunk (echo_client_main_t * ecm, session_t * s)
+receive_data_chunk (echo_client_main_t * ecm, eclient_session_t * s)
{
svm_fifo_t *rx_fifo = s->data.rx_fifo;
u32 thread_index = vlib_get_thread_index ();
@@ -207,7 +207,7 @@ echo_client_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
{
echo_client_main_t *ecm = &echo_client_main;
int my_thread_index = vlib_get_thread_index ();
- session_t *sp;
+ eclient_session_t *sp;
int i;
int delete_session;
u32 *connection_indices;
@@ -367,7 +367,7 @@ echo_clients_session_connected_callback (u32 app_index, u32 api_context,
stream_session_t * s, u8 is_fail)
{
echo_client_main_t *ecm = &echo_client_main;
- session_t *session;
+ eclient_session_t *session;
u32 session_index;
u8 thread_index = vlib_get_thread_index ();
@@ -453,7 +453,7 @@ static int
echo_clients_rx_callback (stream_session_t * s)
{
echo_client_main_t *ecm = &echo_client_main;
- session_t *sp;
+ eclient_session_t *sp;
sp = pool_elt_at_index (ecm->sessions,
s->server_rx_fifo->client_session_index);
@@ -757,13 +757,7 @@ echo_clients_command_fn (vlib_main_t * vm,
VLIB_NODE_STATE_POLLING);
if (preallocate_sessions)
- {
- session_t *sp __attribute__ ((unused));
- for (i = 0; i < n_clients; i++)
- pool_get (ecm->sessions, sp);
- for (i = 0; i < n_clients; i++)
- pool_put_index (ecm->sessions, i);
- }
+ pool_init_fixed (ecm->sessions, 1.1 * n_clients);
/* Fire off connect requests */
time_before_connects = vlib_time_now (vm);
diff --git a/src/vnet/session-apps/echo_client.h b/src/vnet/session-apps/echo_client.h
index 8c07b10fbba..f3fc8d2b59e 100644
--- a/src/vnet/session-apps/echo_client.h
+++ b/src/vnet/session-apps/echo_client.h
@@ -30,6 +30,7 @@
typedef struct
{
+ CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
app_session_t data;
u64 bytes_to_send;
u64 bytes_sent;
@@ -37,7 +38,7 @@ typedef struct
u64 bytes_received;
u64 vpp_session_handle;
u8 thread_index;
-} session_t;
+} eclient_session_t;
typedef struct
{
@@ -69,7 +70,7 @@ typedef struct
/*
* Test state variables
*/
- session_t *sessions; /**< Session pool, shared */
+ eclient_session_t *sessions; /**< Session pool, shared */
clib_spinlock_t sessions_lock;
u8 **rx_buf; /**< intermediate rx buffers */
u8 *connect_test_data; /**< Pre-computed test data */