Florin Coras | 6792ec0 | 2017-03-13 03:49:51 -0700 | [diff] [blame] | 1 | |
| 2 | /* |
| 3 | * tclient.h - skeleton vpp engine plug-in header file |
| 4 | * |
| 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 | */ |
| 18 | #ifndef __included_tclient_h__ |
| 19 | #define __included_tclient_h__ |
| 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> |
| 27 | #include <vlibmemory/unix_shared_memory_queue.h> |
| 28 | #include <svm/svm_fifo_segment.h> |
| 29 | #include <vnet/session/session.h> |
| 30 | #include <vnet/session/application_interface.h> |
| 31 | |
| 32 | typedef struct |
| 33 | { |
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 | 6792ec0 | 2017-03-13 03:49:51 -0700 | [diff] [blame] | 38 | |
| 39 | svm_fifo_t *server_rx_fifo; |
| 40 | svm_fifo_t *server_tx_fifo; |
| 41 | |
Florin Coras | 6cf30ad | 2017-04-04 23:08:23 -0700 | [diff] [blame] | 42 | u64 vpp_session_handle; |
Florin Coras | 6792ec0 | 2017-03-13 03:49:51 -0700 | [diff] [blame] | 43 | } session_t; |
| 44 | |
| 45 | typedef struct |
| 46 | { |
Florin Coras | f03a59a | 2017-06-09 21:07:32 -0700 | [diff] [blame^] | 47 | /* |
| 48 | * Application setup parameters |
| 49 | */ |
| 50 | unix_shared_memory_queue_t *vl_input_queue; /**< vpe input queue */ |
| 51 | unix_shared_memory_queue_t *our_event_queue; /**< Our event queue */ |
| 52 | unix_shared_memory_queue_t *vpp_event_queue; /**< $$$ single thread */ |
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 | u32 cli_node_index; /**< cli process node index */ |
| 55 | u32 my_client_index; /**< loopback API client handle */ |
| 56 | u32 app_index; /**< app index after attach */ |
Florin Coras | 6792ec0 | 2017-03-13 03:49:51 -0700 | [diff] [blame] | 57 | |
Florin Coras | f03a59a | 2017-06-09 21:07:32 -0700 | [diff] [blame^] | 58 | /* |
| 59 | * Configuration params |
| 60 | */ |
| 61 | u8 *connect_uri; /**< URI for slave's connect */ |
| 62 | u64 bytes_to_send; /**< Bytes to send */ |
| 63 | u32 configured_segment_size; |
| 64 | u32 fifo_size; |
| 65 | u32 expected_connections; /**< Number of clients/connections */ |
Florin Coras | 6792ec0 | 2017-03-13 03:49:51 -0700 | [diff] [blame] | 66 | |
Florin Coras | f03a59a | 2017-06-09 21:07:32 -0700 | [diff] [blame^] | 67 | /* |
| 68 | * Test state variables |
| 69 | */ |
| 70 | session_t *sessions; /**< Sessions pool */ |
| 71 | u8 *rx_buf; /**< intermediate rx buffer */ |
| 72 | uword *session_index_by_vpp_handles; /**< Hash table for disconnecting */ |
| 73 | u8 *connect_test_data; /**< Pre-computed test data */ |
| 74 | u32 **connection_index_by_thread; |
| 75 | pthread_t client_thread_handle; |
Florin Coras | 6792ec0 | 2017-03-13 03:49:51 -0700 | [diff] [blame] | 76 | |
Florin Coras | f03a59a | 2017-06-09 21:07:32 -0700 | [diff] [blame^] | 77 | volatile u32 ready_connections; |
| 78 | volatile u32 finished_connections; |
| 79 | volatile u64 rx_total; |
| 80 | volatile u64 tx_total; |
| 81 | volatile int run_test; /**< Signal start of test */ |
Florin Coras | 6792ec0 | 2017-03-13 03:49:51 -0700 | [diff] [blame] | 82 | |
Dave Barach | 10d8cc6 | 2017-05-30 09:30:07 -0400 | [diff] [blame] | 83 | f64 test_start_time; |
| 84 | f64 test_end_time; |
Florin Coras | 6792ec0 | 2017-03-13 03:49:51 -0700 | [diff] [blame] | 85 | |
Florin Coras | f03a59a | 2017-06-09 21:07:32 -0700 | [diff] [blame^] | 86 | /* |
| 87 | * Flags |
| 88 | */ |
Florin Coras | 6cf30ad | 2017-04-04 23:08:23 -0700 | [diff] [blame] | 89 | u8 is_init; |
Dave Barach | 10d8cc6 | 2017-05-30 09:30:07 -0400 | [diff] [blame] | 90 | u8 test_client_attached; |
Florin Coras | f03a59a | 2017-06-09 21:07:32 -0700 | [diff] [blame^] | 91 | u8 no_return; |
| 92 | u8 test_return_packets; |
| 93 | int i_am_master; |
| 94 | int drop_packets; /**< drop all packets */ |
| 95 | u8 prealloc_fifos; /**< Request fifo preallocation */ |
Florin Coras | 6cf30ad | 2017-04-04 23:08:23 -0700 | [diff] [blame] | 96 | |
Florin Coras | f03a59a | 2017-06-09 21:07:32 -0700 | [diff] [blame^] | 97 | /* |
| 98 | * Convenience |
| 99 | */ |
Florin Coras | 6792ec0 | 2017-03-13 03:49:51 -0700 | [diff] [blame] | 100 | vlib_main_t *vlib_main; |
| 101 | vnet_main_t *vnet_main; |
| 102 | ethernet_main_t *ethernet_main; |
| 103 | } tclient_main_t; |
| 104 | |
| 105 | tclient_main_t tclient_main; |
| 106 | |
| 107 | vlib_node_registration_t tclient_node; |
| 108 | |
| 109 | #endif /* __included_tclient_h__ */ |
| 110 | |
| 111 | /* |
| 112 | * fd.io coding-style-patch-verification: ON |
| 113 | * |
| 114 | * Local Variables: |
| 115 | * eval: (c-set-style "gnu") |
| 116 | * End: |
| 117 | */ |