DPDK helper functions TAPI

Overview

TAPI to handle DPDK-related operations

Copyright (C) 2019-2022 OKTET Labs Ltd. More…

// typedefs

typedef struct tapi_dpdk_testpmd_job_t tapi_dpdk_testpmd_job_t;

// structs

struct tapi_dpdk_testpmd_job_t;

// global functions

te_errno tapi_dpdk_create_testpmd_job(rcf_rpc_server* rpcs, tapi_env* env, unsigned int n_fwd_cpus, const tapi_cpu_prop_t* prop, te_kvpair_h* test_args, tapi_dpdk_testpmd_job_t* testpmd_job);
te_errno tapi_dpdk_testpmd_is_opt_supported(rcf_rpc_server* rpcs, tapi_env* env, te_kvpair_h* opt, te_bool* opt_supported);
te_errno tapi_dpdk_testpmd_start(tapi_dpdk_testpmd_job_t* testpmd_job);
te_errno tapi_dpdk_testpmd_get_link_speed(tapi_dpdk_testpmd_job_t* testpmd_job, unsigned int* link_speed);
te_errno tapi_dpdk_testpmd_get_stats(tapi_dpdk_testpmd_job_t* testpmd_job, te_meas_stats_t* tx, te_meas_stats_t* rx);
te_errno tapi_dpdk_testpmd_destroy(tapi_dpdk_testpmd_job_t* testpmd_job);
te_bool tapi_dpdk_mtu_by_pkt_size(unsigned int packet_size, unsigned int* mtu);
te_bool tapi_dpdk_mbuf_size_by_pkt_size(unsigned int packet_size, unsigned int* mbuf_size);
void tapi_dpdk_append_argument(const char* argument, int* argc_p, char*** argv_out);
te_errno tapi_dpdk_build_eal_arguments(rcf_rpc_server* rpcs, tapi_env* env, unsigned int n_cpus, tapi_cpu_index_t* cpu_ids, const char* program_name, int* argc_out, char*** argv_out);
te_errno tapi_dpdk_grab_cpus(const char* ta, unsigned int n_cpus_preferred, unsigned int n_cpus_required, int numa_node, const tapi_cpu_prop_t* prop, unsigned int* n_cpus_grabbed, tapi_cpu_index_t* cpu_ids);
te_errno tapi_dpdk_grab_cpus_nonstrict_prop(const char* ta, unsigned int n_cpus_preferred, unsigned int n_cpus_required, int numa_node, const tapi_cpu_prop_t* prop, unsigned int* n_cpus_grabbed, tapi_cpu_index_t* cpu_ids);
const char* tapi_dpdk_get_vdev_eal_argument(int eal_argc, char** eal_argv);
te_errno tapi_dpdk_get_vdev_port_number(const char* vdev, unsigned int* port_number);
te_errno tapi_dpdk_attach_dbells_filter_rx(tapi_dpdk_testpmd_job_t* testpmd_job);
te_errno tapi_dpdk_attach_dbells_filter_tx(tapi_dpdk_testpmd_job_t* testpmd_job);
te_errno tapi_dpdk_add_rx_dbells_display(te_kvpair_h* test_params, const char* q_num);
te_errno tapi_dpdk_add_tx_dbells_display(te_kvpair_h* test_params, const char* q_num);
te_errno tapi_dpdk_stats_log_rx_dbells(const tapi_dpdk_testpmd_job_t* testpmd_job, const te_meas_stats_t* meas_stats_pps);
te_errno tapi_dpdk_stats_log_tx_dbells(const tapi_dpdk_testpmd_job_t* testpmd_job, const te_meas_stats_t* meas_stats_pps);
te_errno tapi_dpdk_attach_rx_pkts_bytes_filters(tapi_dpdk_testpmd_job_t* testpmd_job);
te_errno tapi_dpdk_get_last_rx_pkts_bytes(tapi_dpdk_testpmd_job_t* testpmd_job, unsigned long* pkts, unsigned long* bytes);

// macros

#define TAPI_DPDK_L2FWD_NAME
#define TAPI_DPDK_TESTPMD_ARG_PREFIX
#define TAPI_DPDK_TESTPMD_COMMAND_PREFIX
#define TAPI_DPDK_TESTPMD_NAME
#define TAPI_DPDK_TESTPMD_RECEIVE_TIMEOUT_MS
#define TAPI_DPDK_TESTPMD_TERM_TIMEOUT_MS
#define TAPI_DPDK_TESTPMD_TSO_MSS_HDRS_LEN

Detailed Documentation

TAPI to handle DPDK-related operations

Copyright (C) 2019-2022 OKTET Labs Ltd. All rights reserved.

Global Functions

te_errno tapi_dpdk_create_testpmd_job(rcf_rpc_server* rpcs, tapi_env* env, unsigned int n_fwd_cpus, const tapi_cpu_prop_t* prop, te_kvpair_h* test_args, tapi_dpdk_testpmd_job_t* testpmd_job)

Create a job for test-pmd binary execution. The created job can be manipulated with other tapi_dpdk functions as well as passed to generic tapi_job functions.

prop is advisory

Parameters:

rpcs

RPC server to run test-pmd on

env

Test environment

n_fwd_cpus

Number of test-pmd forwarding CPUs

prop

Advisory properties of CPUs

test_args

Test arguments

testpmd_job

Handle of test-pmd job

Returns:

Status code

te_errno tapi_dpdk_testpmd_is_opt_supported(rcf_rpc_server* rpcs, tapi_env* env, te_kvpair_h* opt, te_bool* opt_supported)

Check if option specified in opt is supported by test-pmd.

Parameters:

rpcs

RPC server to run test-pmd on

env

Test environment

opt

Option to check support for

opt_supported

Result

Returns:

Status code

te_errno tapi_dpdk_testpmd_start(tapi_dpdk_testpmd_job_t* testpmd_job)

Start test-pmd job

Parameters:

testpmd_job

Handle of test-pmd job

Returns:

Status code

te_errno tapi_dpdk_testpmd_get_link_speed(tapi_dpdk_testpmd_job_t* testpmd_job, unsigned int* link_speed)

Get link speed from running test-pmd job.

Parameters:

testpmd_job

Handle of test-pmd job

link_speed

Link speed in Mbps

Returns:

Status code

te_errno tapi_dpdk_testpmd_get_stats(tapi_dpdk_testpmd_job_t* testpmd_job, te_meas_stats_t* tx, te_meas_stats_t* rx)

Get performance statistics from running test-pmd job.

The testpmd_job must be started.

Parameters:

testpmd_job

Handle of running test-pmd job

tx

Evaluated Tx statistics

rx

Evaluated Rx statistics

Returns:

Status code

te_errno tapi_dpdk_testpmd_destroy(tapi_dpdk_testpmd_job_t* testpmd_job)

Destroy test-pmd job

Parameters:

testpmd_job

Handle of test-pmd job

Returns:

Status code

te_bool tapi_dpdk_mtu_by_pkt_size(unsigned int packet_size, unsigned int* mtu)

Calculate required MTU by given packet size and decide whether the MTU should be specified explicitly in the parameters.

Parameters:

packet_size

Size of a packet

mtu

Location for required MTU

TRUE

Required MTU is greater than ETHER_DATA_LEN

FALSE

Required MTU is less or equal to ETHER_DATA_LEN

Returns:

If required MTU is greater than ETHER_DATA_LEN

te_bool tapi_dpdk_mbuf_size_by_pkt_size(unsigned int packet_size, unsigned int* mbuf_size)

Calculate required mbuf size by given packet size and decide whether the mbuf size should be specified explicitly in the parameters.

Parameters:

packet_size

Size of a packet

mbuf_size

Required mbuf size (set when the function returns TRUE)

Returns:

TRUE - mbuf size should be set, FALSE - should not be

void tapi_dpdk_append_argument(const char* argument, int* argc_p, char*** argv_out)

Append argument to the arguments storage Jumps out via TEST_FAIL in case of failure

Parameters:

argument

Argument to add

argc_p

Pointer to the number of arguments

argv_out

Pointer to the arguments

te_errno tapi_dpdk_build_eal_arguments(rcf_rpc_server* rpcs, tapi_env* env, unsigned int n_cpus, tapi_cpu_index_t* cpu_ids, const char* program_name, int* argc_out, char*** argv_out)

Build EAL arguments for TAPI jobs and store it to the arguments storage

Parameters:

rpcs

RPC server to run job on

env

Test environment

n_cpus

Number of job forwarding CPUs

cpu_ids

Indices of job forwarding CPUs

program_name

Full path to the binary job

argc_out

Pointer to the number of arguments

argv_out

Pointer to the arguments

Returns:

Status code

te_errno tapi_dpdk_attach_dbells_filter_rx(tapi_dpdk_testpmd_job_t* testpmd_job)

Attach filters to catch Rx doorbells rate and if they are supported.

Parameters:

testpmd_job

Handle of running test-pmd job

Returns:

Status code

te_errno tapi_dpdk_attach_dbells_filter_tx(tapi_dpdk_testpmd_job_t* testpmd_job)

Attach filters to catch Tx doorbells rate and if they are supported.

Parameters:

testpmd_job

Handle of running test-pmd job

Returns:

Status code

te_errno tapi_dpdk_add_rx_dbells_display(te_kvpair_h* test_params, const char* q_num)

Add display Rx doorbells xstats to dpdk-testpmd parameters.

Parameters:

test_params

kvpair storing dpdk-testpmd parameters

q_num

Number of Rx queues.

Returns:

Status code

te_errno tapi_dpdk_add_tx_dbells_display(te_kvpair_h* test_params, const char* q_num)

Add display Tx doorbells xstats to dpdk-testpmd parameters.

Parameters:

test_params

kvpair storing dpdk-testpmd parameters

q_num

Number of Tx queues.

Returns:

Status code

te_errno tapi_dpdk_stats_log_rx_dbells(const tapi_dpdk_testpmd_job_t* testpmd_job, const te_meas_stats_t* meas_stats_pps)

Report Rx doorbells rate and packets per doorbell as test artifacts.

Parameters:

testpmd_job

Handle of running test-pmd job

meas_stats_pps

Statistics of packets per second

Returns:

Status code

te_errno tapi_dpdk_stats_log_tx_dbells(const tapi_dpdk_testpmd_job_t* testpmd_job, const te_meas_stats_t* meas_stats_pps)

Report Tx doorbells rate and packets per doorbell as test artifacts.

Parameters:

testpmd_job

Handle of running test-pmd job

meas_stats_pps

Statistics of packets per second

Returns:

Status code

te_errno tapi_dpdk_attach_rx_pkts_bytes_filters(tapi_dpdk_testpmd_job_t* testpmd_job)

Attach Rx packets/bytes filters.

Parameters:

testpmd_job

Handle of test-pmd job

Returns:

Status code

te_errno tapi_dpdk_get_last_rx_pkts_bytes(tapi_dpdk_testpmd_job_t* testpmd_job, unsigned long* pkts, unsigned long* bytes)

Get latest values of Rx packets and bytes from filters attached by tapi_dpdk_attach_rx_pkts_bytes_filters().

Parameters:

testpmd_job

Rx job channel handle

pkts

Latest Rx packets

bytes

Latest Rx bytes

Returns:

Status code

Macros

#define TAPI_DPDK_L2FWD_NAME

Name of l2fwd tool

#define TAPI_DPDK_TESTPMD_NAME

Name of testpmd tool