Florin Coras | 6792ec0 | 2017-03-13 03:49:51 -0700 | [diff] [blame] | 1 | |
| 2 | /* |
Florin Coras | 4399c2e | 2018-01-25 06:34:42 -0800 | [diff] [blame] | 3 | * echo_client.h - built-in application layer echo client |
Florin Coras | 6792ec0 | 2017-03-13 03:49:51 -0700 | [diff] [blame] | 4 | * |
Florin Coras | c5df8c7 | 2019-04-08 07:42:30 -0700 | [diff] [blame] | 5 | * Copyright (c) 2017-2019 Cisco and/or its affiliates. |
Florin Coras | 6792ec0 | 2017-03-13 03:49:51 -0700 | [diff] [blame] | 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 Coras | 4399c2e | 2018-01-25 06:34:42 -0800 | [diff] [blame] | 18 | #ifndef __included_echo_client_h__ |
| 19 | #define __included_echo_client_h__ |
Florin Coras | 6792ec0 | 2017-03-13 03:49:51 -0700 | [diff] [blame] | 20 | |
| 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 Coras | 6792ec0 | 2017-03-13 03:49:51 -0700 | [diff] [blame] | 27 | #include <vnet/session/session.h> |
| 28 | #include <vnet/session/application_interface.h> |
| 29 | |
| 30 | typedef struct |
| 31 | { |
Florin Coras | 4875089 | 2018-05-16 09:28:02 -0700 | [diff] [blame] | 32 | CLIB_CACHE_LINE_ALIGN_MARK (cacheline0); |
Florin Coras | 7fb0fe1 | 2018-04-09 09:24:52 -0700 | [diff] [blame] | 33 | app_session_t data; |
Dave Barach | 0194f1a | 2017-05-15 10:11:39 -0400 | [diff] [blame] | 34 | u64 bytes_to_send; |
| 35 | u64 bytes_sent; |
| 36 | u64 bytes_to_receive; |
| 37 | u64 bytes_received; |
Florin Coras | 6cf30ad | 2017-04-04 23:08:23 -0700 | [diff] [blame] | 38 | u64 vpp_session_handle; |
Florin Coras | 7fb0fe1 | 2018-04-09 09:24:52 -0700 | [diff] [blame] | 39 | u8 thread_index; |
Florin Coras | 4875089 | 2018-05-16 09:28:02 -0700 | [diff] [blame] | 40 | } eclient_session_t; |
Florin Coras | 6792ec0 | 2017-03-13 03:49:51 -0700 | [diff] [blame] | 41 | |
| 42 | typedef struct |
| 43 | { |
Florin Coras | f03a59a | 2017-06-09 21:07:32 -0700 | [diff] [blame] | 44 | /* |
| 45 | * Application setup parameters |
| 46 | */ |
Florin Coras | 7fb0fe1 | 2018-04-09 09:24:52 -0700 | [diff] [blame] | 47 | svm_queue_t *vl_input_queue; /**< vpe input queue */ |
Florin Coras | 3c2fed5 | 2018-07-04 04:15:05 -0700 | [diff] [blame] | 48 | svm_msg_q_t **vpp_event_queue; |
Florin Coras | 6792ec0 | 2017-03-13 03:49:51 -0700 | [diff] [blame] | 49 | |
Florin Coras | f03a59a | 2017-06-09 21:07:32 -0700 | [diff] [blame] | 50 | u32 cli_node_index; /**< cli process node index */ |
| 51 | u32 my_client_index; /**< loopback API client handle */ |
| 52 | u32 app_index; /**< app index after attach */ |
Florin Coras | 6792ec0 | 2017-03-13 03:49:51 -0700 | [diff] [blame] | 53 | |
Florin Coras | f03a59a | 2017-06-09 21:07:32 -0700 | [diff] [blame] | 54 | /* |
| 55 | * Configuration params |
| 56 | */ |
| 57 | u8 *connect_uri; /**< URI for slave's connect */ |
| 58 | u64 bytes_to_send; /**< Bytes to send */ |
| 59 | u32 configured_segment_size; |
| 60 | u32 fifo_size; |
| 61 | u32 expected_connections; /**< Number of clients/connections */ |
Dave Barach | 2c25a62 | 2017-06-26 11:35:07 -0400 | [diff] [blame] | 62 | u32 connections_per_batch; /**< Connections to rx/tx at once */ |
| 63 | u32 private_segment_count; /**< Number of private fifo segs */ |
| 64 | u32 private_segment_size; /**< size of private fifo segs */ |
Florin Coras | 58d36f0 | 2018-03-09 13:05:53 -0800 | [diff] [blame] | 65 | u32 tls_engine; /**< TLS engine mbedtls/openssl */ |
Florin Coras | 7fb0fe1 | 2018-04-09 09:24:52 -0700 | [diff] [blame] | 66 | u8 is_dgram; |
Florin Coras | 8e43d04 | 2018-05-04 15:46:57 -0700 | [diff] [blame] | 67 | u32 no_copy; /**< Don't memcpy data to tx fifo */ |
| 68 | |
Florin Coras | f03a59a | 2017-06-09 21:07:32 -0700 | [diff] [blame] | 69 | /* |
| 70 | * Test state variables |
| 71 | */ |
Florin Coras | 4875089 | 2018-05-16 09:28:02 -0700 | [diff] [blame] | 72 | eclient_session_t *sessions; /**< Session pool, shared */ |
Florin Coras | 6881062 | 2017-07-24 17:40:28 -0700 | [diff] [blame] | 73 | clib_spinlock_t sessions_lock; |
| 74 | u8 **rx_buf; /**< intermediate rx buffers */ |
Florin Coras | f03a59a | 2017-06-09 21:07:32 -0700 | [diff] [blame] | 75 | u8 *connect_test_data; /**< Pre-computed test data */ |
Aloys Augustin | 502785b | 2019-04-09 11:40:57 +0200 | [diff] [blame] | 76 | u32 **quic_session_index_by_thread; |
Florin Coras | f03a59a | 2017-06-09 21:07:32 -0700 | [diff] [blame] | 77 | u32 **connection_index_by_thread; |
Dave Barach | 2c25a62 | 2017-06-26 11:35:07 -0400 | [diff] [blame] | 78 | u32 **connections_this_batch_by_thread; /**< active connection batch */ |
Florin Coras | f03a59a | 2017-06-09 21:07:32 -0700 | [diff] [blame] | 79 | pthread_t client_thread_handle; |
Florin Coras | 6792ec0 | 2017-03-13 03:49:51 -0700 | [diff] [blame] | 80 | |
Florin Coras | f03a59a | 2017-06-09 21:07:32 -0700 | [diff] [blame] | 81 | volatile u32 ready_connections; |
| 82 | volatile u32 finished_connections; |
| 83 | volatile u64 rx_total; |
| 84 | volatile u64 tx_total; |
| 85 | volatile int run_test; /**< Signal start of test */ |
Florin Coras | 6792ec0 | 2017-03-13 03:49:51 -0700 | [diff] [blame] | 86 | |
Dave Barach | 10d8cc6 | 2017-05-30 09:30:07 -0400 | [diff] [blame] | 87 | f64 test_start_time; |
| 88 | f64 test_end_time; |
Dave Barach | 2c25a62 | 2017-06-26 11:35:07 -0400 | [diff] [blame] | 89 | u32 prev_conns; |
| 90 | u32 repeats; |
Florin Coras | f03a59a | 2017-06-09 21:07:32 -0700 | [diff] [blame] | 91 | /* |
| 92 | * Flags |
| 93 | */ |
Florin Coras | 6cf30ad | 2017-04-04 23:08:23 -0700 | [diff] [blame] | 94 | u8 is_init; |
Dave Barach | 10d8cc6 | 2017-05-30 09:30:07 -0400 | [diff] [blame] | 95 | u8 test_client_attached; |
Florin Coras | f03a59a | 2017-06-09 21:07:32 -0700 | [diff] [blame] | 96 | u8 no_return; |
| 97 | u8 test_return_packets; |
| 98 | int i_am_master; |
| 99 | int drop_packets; /**< drop all packets */ |
| 100 | u8 prealloc_fifos; /**< Request fifo preallocation */ |
Florin Coras | b795bd0 | 2017-12-14 11:30:48 -0800 | [diff] [blame] | 101 | u8 no_output; |
| 102 | u8 test_bytes; |
| 103 | u8 test_failed; |
Aloys Augustin | 502785b | 2019-04-09 11:40:57 +0200 | [diff] [blame] | 104 | u8 transport_proto; |
Florin Coras | 6cf30ad | 2017-04-04 23:08:23 -0700 | [diff] [blame] | 105 | |
Florin Coras | 6792ec0 | 2017-03-13 03:49:51 -0700 | [diff] [blame] | 106 | vlib_main_t *vlib_main; |
Florin Coras | 4399c2e | 2018-01-25 06:34:42 -0800 | [diff] [blame] | 107 | } echo_client_main_t; |
Florin Coras | 6792ec0 | 2017-03-13 03:49:51 -0700 | [diff] [blame] | 108 | |
Florin Coras | eb97e5f | 2018-10-15 21:35:42 -0700 | [diff] [blame] | 109 | enum |
| 110 | { |
| 111 | ECHO_CLIENTS_STARTING, |
| 112 | ECHO_CLIENTS_RUNNING, |
| 113 | ECHO_CLIENTS_EXITING |
| 114 | } echo_clients_test_state_e; |
Florin Coras | 4399c2e | 2018-01-25 06:34:42 -0800 | [diff] [blame] | 115 | extern echo_client_main_t echo_client_main; |
Florin Coras | 6792ec0 | 2017-03-13 03:49:51 -0700 | [diff] [blame] | 116 | |
Florin Coras | 4399c2e | 2018-01-25 06:34:42 -0800 | [diff] [blame] | 117 | vlib_node_registration_t echo_clients_node; |
Florin Coras | 6792ec0 | 2017-03-13 03:49:51 -0700 | [diff] [blame] | 118 | |
Florin Coras | 4399c2e | 2018-01-25 06:34:42 -0800 | [diff] [blame] | 119 | #endif /* __included_echo_client_h__ */ |
Florin Coras | 6792ec0 | 2017-03-13 03:49:51 -0700 | [diff] [blame] | 120 | |
| 121 | /* |
| 122 | * fd.io coding-style-patch-verification: ON |
| 123 | * |
| 124 | * Local Variables: |
| 125 | * eval: (c-set-style "gnu") |
| 126 | * End: |
| 127 | */ |