blob: 5712da5b8c85a36b59c414f54242fc9ff44b53e1 [file] [log] [blame]
Florin Coras6792ec02017-03-13 03:49:51 -07001
2/*
Florin Coras4399c2e2018-01-25 06:34:42 -08003 * echo_client.h - built-in application layer echo client
Florin Coras6792ec02017-03-13 03:49:51 -07004 *
5 * Copyright (c) <current-year> <your-organization>
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at:
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
Florin Coras4399c2e2018-01-25 06:34:42 -080018#ifndef __included_echo_client_h__
19#define __included_echo_client_h__
Florin Coras6792ec02017-03-13 03:49:51 -070020
21#include <vnet/vnet.h>
22#include <vnet/ip/ip.h>
23#include <vnet/ethernet/ethernet.h>
24
25#include <vppinfra/hash.h>
26#include <vppinfra/error.h>
Florin Coras6792ec02017-03-13 03:49:51 -070027#include <svm/svm_fifo_segment.h>
28#include <vnet/session/session.h>
29#include <vnet/session/application_interface.h>
30
31typedef struct
32{
Dave Barach0194f1a2017-05-15 10:11:39 -040033 u64 bytes_to_send;
34 u64 bytes_sent;
35 u64 bytes_to_receive;
36 u64 bytes_received;
Florin Coras6792ec02017-03-13 03:49:51 -070037
38 svm_fifo_t *server_rx_fifo;
39 svm_fifo_t *server_tx_fifo;
40
Florin Coras6cf30ad2017-04-04 23:08:23 -070041 u64 vpp_session_handle;
Florin Coras6792ec02017-03-13 03:49:51 -070042} session_t;
43
44typedef struct
45{
Florin Corasf03a59a2017-06-09 21:07:32 -070046 /*
47 * Application setup parameters
48 */
Florin Corase86a8ed2018-01-05 03:20:25 -080049 svm_queue_t *vl_input_queue; /**< vpe input queue */
50 svm_queue_t **vpp_event_queue;
Florin Coras6792ec02017-03-13 03:49:51 -070051
Florin Corasf03a59a2017-06-09 21:07:32 -070052 u32 cli_node_index; /**< cli process node index */
53 u32 my_client_index; /**< loopback API client handle */
54 u32 app_index; /**< app index after attach */
Florin Coras6792ec02017-03-13 03:49:51 -070055
Florin Corasf03a59a2017-06-09 21:07:32 -070056 /*
57 * Configuration params
58 */
59 u8 *connect_uri; /**< URI for slave's connect */
60 u64 bytes_to_send; /**< Bytes to send */
61 u32 configured_segment_size;
62 u32 fifo_size;
63 u32 expected_connections; /**< Number of clients/connections */
Dave Barach2c25a622017-06-26 11:35:07 -040064 u32 connections_per_batch; /**< Connections to rx/tx at once */
65 u32 private_segment_count; /**< Number of private fifo segs */
66 u32 private_segment_size; /**< size of private fifo segs */
Florin Coras58d36f02018-03-09 13:05:53 -080067 u32 tls_engine; /**< TLS engine mbedtls/openssl */
Florin Corasf03a59a2017-06-09 21:07:32 -070068 /*
69 * Test state variables
70 */
Florin Coras68810622017-07-24 17:40:28 -070071 session_t *sessions; /**< Session pool, shared */
72 clib_spinlock_t sessions_lock;
73 u8 **rx_buf; /**< intermediate rx buffers */
Florin Corasf03a59a2017-06-09 21:07:32 -070074 u8 *connect_test_data; /**< Pre-computed test data */
75 u32 **connection_index_by_thread;
Dave Barach2c25a622017-06-26 11:35:07 -040076 u32 **connections_this_batch_by_thread; /**< active connection batch */
Florin Corasf03a59a2017-06-09 21:07:32 -070077 pthread_t client_thread_handle;
Florin Coras6792ec02017-03-13 03:49:51 -070078
Florin Corasf03a59a2017-06-09 21:07:32 -070079 volatile u32 ready_connections;
80 volatile u32 finished_connections;
81 volatile u64 rx_total;
82 volatile u64 tx_total;
83 volatile int run_test; /**< Signal start of test */
Florin Coras6792ec02017-03-13 03:49:51 -070084
Dave Barach10d8cc62017-05-30 09:30:07 -040085 f64 test_start_time;
86 f64 test_end_time;
Dave Barach2c25a622017-06-26 11:35:07 -040087 u32 prev_conns;
88 u32 repeats;
Florin Corasf03a59a2017-06-09 21:07:32 -070089 /*
90 * Flags
91 */
Florin Coras6cf30ad2017-04-04 23:08:23 -070092 u8 is_init;
Dave Barach10d8cc62017-05-30 09:30:07 -040093 u8 test_client_attached;
Florin Corasf03a59a2017-06-09 21:07:32 -070094 u8 no_return;
95 u8 test_return_packets;
96 int i_am_master;
97 int drop_packets; /**< drop all packets */
98 u8 prealloc_fifos; /**< Request fifo preallocation */
Florin Corasb795bd02017-12-14 11:30:48 -080099 u8 no_output;
100 u8 test_bytes;
101 u8 test_failed;
Florin Coras6cf30ad2017-04-04 23:08:23 -0700102
Florin Coras6792ec02017-03-13 03:49:51 -0700103 vlib_main_t *vlib_main;
Florin Coras4399c2e2018-01-25 06:34:42 -0800104} echo_client_main_t;
Florin Coras6792ec02017-03-13 03:49:51 -0700105
Florin Coras4399c2e2018-01-25 06:34:42 -0800106extern echo_client_main_t echo_client_main;
Florin Coras6792ec02017-03-13 03:49:51 -0700107
Florin Coras4399c2e2018-01-25 06:34:42 -0800108vlib_node_registration_t echo_clients_node;
Florin Coras6792ec02017-03-13 03:49:51 -0700109
Florin Coras4399c2e2018-01-25 06:34:42 -0800110#endif /* __included_echo_client_h__ */
Florin Coras6792ec02017-03-13 03:49:51 -0700111
112/*
113 * fd.io coding-style-patch-verification: ON
114 *
115 * Local Variables:
116 * eval: (c-set-style "gnu")
117 * End:
118 */