CDI SDK
SDK for transporting chunks of data reliably and with low latency using a polled mode network driver.
|
This file contains the RunTestGeneric() function which is the main test execution function that uses the SDK's API to initialize the adapter, create connections, and send and receive payloads. More...
#include "run_test.h"
#include <assert.h>
#include <inttypes.h>
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include "configuration.h"
#include "cdi_core_api.h"
#include "cdi_logger_api.h"
#include "cdi_os_api.h"
#include "cdi_raw_api.h"
#include "cdi_test.h"
#include "curses.h"
#include "test_args.h"
#include "test_console.h"
#include "test_dynamic.h"
#include "test_receiver.h"
#include "test_transmitter.h"
Data Structures | |
struct | PoolInitArgs |
Structure used to pass arguments into InitPoolSgl(). More... | |
Functions | |
static char * | ThreadName (const char *direction, int number) |
static bool | CreateCommonResources (TestConnectionInfo *connection_info_ptr) |
static void | DestroyCommonResources (TestConnectionInfo *connection_info_ptr) |
static bool | IsAnyConnected (TestConnectionInfo *connection_info_array, int num_connections) |
static void | WaitForTestToComplete (TestConnectionInfo *connection_info_array, int num_connections) |
static bool | InitPoolSgl (const void *context_ptr, void *item_ptr) |
static bool | DestroyPoolSgl (const void *context_ptr, void *item_ptr) |
static bool | CreateTxBufferPools (TestConnectionInfo *connection_info_ptr, uint8_t **tx_buffer_ptr) |
static int | NextMultipleOf (int value, int quantum) |
bool | RunTestGeneric (TestSettings *test_settings_ptr, int max_test_settings_entries, int num_connections) |
This file contains the RunTestGeneric() function which is the main test execution function that uses the SDK's API to initialize the adapter, create connections, and send and receive payloads.
This function takes in the TestSettings array, and for each TestSetting instance, we create a TestConnectionInfo instance which contains a pointer to the TestSettings instance associated with that connection.
Then we register the SDK adapter, launch all Rx connections, and then launch up all Tx connections. Once all connection threads have been launched, we wait until all of the threads complete and then check for any failures.
See CDI Test Application Architecture Top Level for diagrams and detailed description of this test function.
|
static |
Create resources that are common to both Tx and Rx connections.
connection_info_ptr | Pointer to test connection structure. |
|
static |
Creates all of the pools for tracking the connection's transmit buffers. Each stream in the connection has its own pool. The buffer passed through connection_info_ptr is assumed to have been sized correctly to account for all streams of all connections before the first time this function is called.
connection_info_ptr | pointer to the structure containing all of the specifics of the connection for which to create the transmit buffer SGL pools. |
tx_buffer_ptr | pointer to the pointer which tracks the assignment of each stream's buffers. |
|
static |
Destroy resources that are common to both Tx and Rx connections.
connection_info_ptr | Pointer to test connection structure. |
|
static |
Pool operator function that gets called once for each item prior to the destruction of the transmit buffer SGL pool. This function must free any resources that were allocated in InitPoolSgl().
context_ptr | pointer to the structure containing all of the values passed into CdiPoolForEach() for a given connection's transmit buffer pool. |
item_ptr | the address of the particular CdiSgList need of cleanup. |
|
static |
Pool operator function that gets called once for each item during the creation of the transmit buffer SGL pool. Updates context_ptr->tx_buffer_ptr as a side-effect.
context_ptr | pointer to the structure containing all of the values passed into CdiPoolCreateAndInitItems() for a given connection's transmit buffer pool. |
item_ptr | the address of the particular CdiSgList being added to the pool in need of initialization. |
|
static |
Tell if any of the connections is in connected state.
connection_info_array | Pointer to array of all the test connection structures. |
num_connections | Number of connections. |
|
static |
Helper function to up-quantize an integer value.
value | The value to quantize up. |
quantum | The number to calculate a multiple of. |
bool RunTestGeneric | ( | TestSettings * | test_settings_ptr, |
int | max_test_settings_entries, | ||
int | num_connections ) |
Runs a test using the test parameters provided by the user.
test_settings_ptr | Pointer to an array of user-supplied test settings for all connections. |
max_test_settings_entries | The maximum number of test settings structures that the test_settings array can hold. |
num_connections | The number of connections to create. |
|
static |
Create a unique thread name for an Rx or Tx thread.
direction | Either "Rx" or "Tx". |
number | Unique number for this thread. |
|
static |
Wait for test to complete and provides stats update on the console while tests are running.
connection_info_array | Pointer to array of all the test connection structures. |
num_connections | Number of connections. |