Global Namespace
Overview
// typedefs typedef asn_value* test_transceiver_transform_tmpl( const asn_value *tmpl_tx, void *tmpl_data ); typedef asn_value* test_transceiver_transform_ptrn( const asn_value *ptrn_tx, void *ptrn_data ); // enums enum test_op_required; enum test_tmpl_fields; enum test_transceiver_type; // structs struct test_default_tmpl_prepare; struct test_ethdev_config; struct test_param_seg_ptrn; struct test_pkt_addresses; struct test_rx_mq; struct test_rx_mq_rss; struct test_transceiver; struct test_transceiver_dpdk; struct test_transceiver_exchange; struct test_transceiver_net; // global functions static te_errno test_eal_init(tapi_env* env); struct test_transceiver* test_transceiver_net_init(const char* ta, const char* if_name); struct test_transceiver* test_transceiver_dpdk_init(rcf_rpc_server* rpcs, uint16_t port_id, rpc_rte_mempool_p mp); void test_transceiver_free(struct test_transceiver* trsc); struct test_transceiver_exchange* test_transceiver_exchange_init(const asn_value* tmpl_tx, test_transceiver_transform_tmpl transform_tmpl, void* tmpl_data, test_transceiver_transform_ptrn transform_ptrn, void* ptrn_data); void test_transceiver_exchange_set_verdicts(struct test_transceiver_exchange* exchange, const char* verdict_no_pkts, const char* verdict_known_unexp); void test_transceiver_exchange_free(struct test_transceiver_exchange* exchange); void test_transceiver_exchange_commit(const struct test_transceiver_exchange* exchange, struct test_transceiver* tx, unsigned int n_tx_pkts, unsigned int tx_queue, struct test_transceiver* rx, unsigned int n_rx_pkts, unsigned int rx_queue); void test_transciever_simple_exchange_commit(const asn_value* tmpl, struct test_transceiver* tx, unsigned int n_tx_pkts, unsigned int tx_queue, struct test_transceiver* rx, unsigned int n_rx_pkts, unsigned int rx_queue, const char* verdict_no_pkts, const char* verdict_known_unexp); te_errno test_rx_burst_match_pattern_custom_verdicts(rcf_rpc_server* rpcs, uint16_t port_id, uint16_t queue_id, rpc_rte_mbuf_p* rx_pkts, uint16_t nb_pkts, uint16_t nb_expected, const asn_value* pattern, te_bool seq_strict, const char* verdict_no_pkts, const char* verdict_known_unexp); te_errno test_rx_burst_match_pattern(rcf_rpc_server* rpcs, uint16_t port_id, uint16_t queue_id, rpc_rte_mbuf_p* rx_pkts, uint16_t nb_pkts, uint16_t nb_expected, const asn_value* pattern, te_bool seq_strict); te_errno test_rx_await_pkts(const char* ta_name, csap_handle_t csap_handle, unsigned int nb_pkts, unsigned int timeount_max_ms); te_errno test_rx_await_pkts_exec_cb(const char* ta_name, csap_handle_t csap_handle, unsigned int nb_pkts, unsigned int timeount_max_ms, tapi_tad_trrecv_cb_data* cb_data); uint16_t test_tx_prepare_and_burst(rcf_rpc_server* rpcs, uint16_t port_id, uint16_t queue_id, rpc_rte_mbuf_p* tx_pkts, uint16_t nb_pkts); rpc_rte_mempool_p test_rte_pktmbuf_pool_create(rcf_rpc_server* rpcs, const char* name, uint32_t n, uint32_t cache_size, uint16_t priv_size, uint16_t data_room_size, int socket_id); rpc_rte_mempool_p test_rte_pktmbuf_rx_pool_create(rcf_rpc_server* rpcs, uint16_t port_id, struct tarpc_rte_eth_dev_info* dev_info, const char* name, uint32_t n, uint32_t cache_size, uint16_t priv_size, uint16_t data_room_size, int socket_id); struct tarpc_rte_eth_conf* test_rpc_rte_eth_make_eth_conf(rcf_rpc_server* rpcs, uint16_t port_id, struct tarpc_rte_eth_conf* eth_conf); unsigned int test_rx_burst_with_retries(rcf_rpc_server* rpcs, uint16_t port_id, uint16_t queue_id, rpc_rte_mbuf_p* rx_pkts, unsigned int nb_pkts, unsigned int nb_expected); void test_await_link_up(rcf_rpc_server* rpcs, uint16_t port_id); void test_rte_eth_dev_set_mtu_await_link_up(rcf_rpc_server* rpcs, uint16_t port_id, uint16_t mtu, struct test_ethdev_config* ethdev_config); te_errno test_tunnel_udp_port_add(struct test_ethdev_config* test_ethdev_config, struct tarpc_rte_eth_udp_tunnel* tunnel_udp); te_errno test_tunnel_udp_port_del(struct test_ethdev_config* test_ethdev_config, struct tarpc_rte_eth_udp_tunnel* tunnel_udp); te_errno test_prepare_ethdev(struct test_ethdev_config* test_ethdev_config, test_ethdev_state st); te_errno test_default_prepare_ethdev(tapi_env* env, rcf_rpc_server* rpcs, const struct if_nameindex* iut_port, struct test_ethdev_config* test_ethdev_config, test_ethdev_state st); struct test_ethdev_config* test_prepare_config_def_mk(tapi_env* env, rcf_rpc_server* rpcs, const struct if_nameindex* iut_port, struct test_ethdev_config* test_ethdev_config); struct test_ethdev_config* test_prepare_config_mk(tapi_env* env, rcf_rpc_server* rpcs, const char* dev_name, uint16_t port_id, struct test_ethdev_config* test_ethdev_config); te_errno test_calc_hash_by_tmpl_and_hf(tarpc_rss_hash_protos_t hf, uint8_t* rss_key, size_t rss_key_sz, asn_value* tmpl, uint32_t* hash_regular, uint32_t* hash_symmetric); te_errno test_rss_get_hash_by_pattern_unit(tarpc_rss_hash_protos_t rss_hf, uint8_t* rss_key, size_t rss_key_sz, const asn_value* pattern, int pattern_unit_index, uint32_t* hash_regular, uint32_t* hash_symmetric); te_errno test_change_src_addr_by_reta_index(const te_toeplitz_hash_cache* toeplitz_hash_cache, unsigned int hash, uint8_t* src_addr, unsigned int addr_size, uint16_t reta_size, const unsigned int* indexes, unsigned int nb_indexes); tarpc_rss_hash_protos_t test_rss_hash_protos_str2bitmask(const char* rss_hash_protos_str); te_errno test_get_rss_hf_by_tmpl(asn_value* tmpl, tarpc_rss_hash_protos_t* hf); void test_parse_mbuf_seg_ptrn(const char* seg_ptrn_str, struct test_param_seg_ptrn* segmentation); te_errno test_check_iut_tst_link_status(const char* tst_ta, const char* tst_if_name, rcf_rpc_server* iut_rpcs, uint16_t iut_port_id, te_bool expected_status); int test_get_xstat_by_name(const char* xstat_name, struct tarpc_rte_eth_xstat_name* xstats_names, struct tarpc_rte_eth_xstat* xstats, unsigned nb_xstats, uint64_t* value); uint32_t test_ptype_from_pattern(const asn_value* pattern, uint32_t* supp, unsigned int supp_count); te_bool test_check_packet_ptype(uint32_t pt_flag_expected, int pt_value_detected, int pt_flag_offset); te_errno test_dev_info_cmp(struct tarpc_rte_eth_dev_info* dev_info_1, struct tarpc_rte_eth_dev_info* dev_info_2); te_errno test_change_tmpl_ip_src_addr_by_queue_nb(asn_value* tmpl, uint16_t queue, uint64_t reta_size, struct tarpc_rte_eth_rss_reta_entry64* reta_conf, const struct tarpc_rte_eth_rss_conf* rss_conf); te_errno test_mk_template_get_match_fields_from_flow_ndn(const asn_value* flow_ndn, asn_value** tmpl, uint32_t* match_fields); struct sockaddr* test_rand_ip_addr(int af); void test_set_pkt_addresses(struct test_pkt_addresses* addrs, const uint8_t* src_mac, const uint8_t* dst_mac, const struct sockaddr* src_ip, const struct sockaddr* dst_ip); te_errno test_fill_in_tmpl_req_fields(const asn_value* tmpl, struct test_pkt_addresses* addrs, struct test_pkt_addresses* ifrm_addrs); asn_value* test_tmpl_copy_with_changed_fields(const asn_value* tmpl, uint32_t fields, struct test_pkt_addresses* addrs, struct test_pkt_addresses* ifrm_addrs); te_errno test_mk_tmpls_with_change_one_field(const asn_value* tmpl, uint32_t fields, struct test_pkt_addresses* addrs, struct test_pkt_addresses* ifrm_addrs, asn_value**[] tmpls_out, unsigned int* tmpls_nb_out); te_errno test_get_rx_info_by_rss_action(const asn_value* flow_rule_rss, uint16_t** rss_queues_out, uint16_t* nb_rss_queues_out, uint16_t* nb_queues_out, uint64_t* rss_hf, uint8_t** rss_key_out, size_t* rss_key_sz_out); te_errno test_add_tunnel_udp_port_from_tmpl(struct test_ethdev_config* ethdev_config, asn_value* tmpl, te_bool required); te_errno test_pdus_detect_and_spoil_cksums(unsigned int nb_pdus, asn_value** pdus, uint64_t* flags_good_out, uint64_t* flags_bad_out, int* l4_type_out); te_errno test_mk_rte_flow_attr_ingress(rcf_rpc_server* rpcs, rpc_rte_flow_attr_p* attr); te_errno test_mk_rte_flow_action_drop(rcf_rpc_server* rpcs, rpc_rte_flow_action_p* actions); te_errno test_mk_rte_flow_action_queue(rcf_rpc_server* rpcs, uint16_t queue, rpc_rte_flow_action_p* actions); te_errno test_mk_txmode_txconf(struct test_ethdev_config* tecp, uint64_t test_offloads, struct tarpc_rte_eth_txmode* txmodep, struct tarpc_rte_eth_txconf* txconfp); void test_get_rss_reta(rcf_rpc_server* rpcs, uint16_t port_id, uint64_t* reta_size, struct tarpc_rte_eth_rss_reta_entry64** reta_conf); void test_start_tx_queue(rcf_rpc_server* rpcs, uint16_t port_id, uint16_t queue_id); void test_start_rx_queue(rcf_rpc_server* rpcs, uint16_t port_id, uint16_t queue_id); void test_setup_rss_configuration(tarpc_rss_hash_protos_t hf, size_t rss_key_sz, te_bool regular, struct tarpc_rte_eth_rss_conf* rss_conf); struct tarpc_rte_eth_rss_conf* test_try_get_rss_hash_conf(rcf_rpc_server* rpcs, size_t rss_key_sz, uint16_t port_id); void test_send_and_match_one_packet(rcf_rpc_server* rpcs, uint16_t port_id, const char* tst_ta, const char* tst_if_name, rpc_rte_mbuf_p* mbufs, asn_value* tmpl, unsigned int queue, unsigned int packet_expected); const char* test_get_ethdev_state_name(test_ethdev_state state); uint32_t test_get_template_packet_length(rcf_rpc_server* rpcs, asn_value* tmpl, rpc_rte_mempool_p mp); unsigned int test_get_template_header_length(rcf_rpc_server* rpcs, asn_value* tmpl, rpc_rte_mempool_p mp); te_bool test_conf_tx_offload_supported(unsigned long long offload_bit); te_bool test_conf_rx_offload_supported(unsigned long long offload_bit); void test_add_ndn_action_queue(asn_value* ndn_actions, int action_index, uint16_t queue); void test_add_ndn_action_drop(asn_value* ndn_actions, int action_index); void test_mk_pattern_and_tmpl_by_flow_rule_pattern(rcf_rpc_server* rpcs, const asn_value* flow_rule_pattern, rpc_rte_flow_item_p* pattern, asn_value** tmpl, uint32_t* match_fields); te_errno test_generate_changed_flow_patterns(const asn_value* flow_rule_pattern, const char* field_path, size_t n_changed_patterns, asn_value** changed_patterns); asn_value* test_concatenate_tmpl_ptrn_pdus(const asn_value* dst, const asn_value* src, const char* label); asn_value* test_decap_tmpl_ptrn_pdus(const asn_value* val, const char* label); void test_check_flow_query_data(const tarpc_rte_flow_query_data* data, te_bool check_hits, uint64_t hits, te_bool check_bytes, uint64_t bytes); void test_add_and_mk_rte_flow_action_count(uint32_t counter_id, int action_id, rcf_rpc_server* rpcs, asn_value* ndn_actions, rpc_rte_flow_action_p* rte_actions); void test_check_xstat(const char* name, uint64_t value, struct tarpc_rte_eth_xstat_name* xstats_names, struct tarpc_rte_eth_xstat* xstats, int nb_xstats, te_string* wrong_xstats, te_string* zero_xstats); te_bool test_pdus_dst_mac_is_set(const asn_value* pdus); void test_pdus_set_eth_src_dst(asn_value* pdus, const char* pdus_path, const uint8_t* src, const uint8_t* dst); void test_rte_eth_promiscuous_enable(rcf_rpc_server* rpcs, uint16_t port_id, enum test_op_required required); void test_rte_eth_promiscuous_disable(rcf_rpc_server* rpcs, uint16_t port_id, enum test_op_required required); void test_rte_eth_allmulticast_enable(rcf_rpc_server* rpcs, uint16_t port_id, enum test_op_required required); void test_rte_eth_allmulticast_disable(rcf_rpc_server* rpcs, uint16_t port_id, enum test_op_required required); asn_value* test_mk_pattern_by_unit(const asn_value* ptrn, int index); void test_send_and_match_one_packet_custom_verdicts(rcf_rpc_server* rpcs, uint16_t port_id, const char* tst_ta, const char* tst_if_name, rpc_rte_mbuf_p* mbufs, asn_value* tmpl, unsigned int queue, unsigned int packet_expected, const char* verdict_no_pkts, const char* verdict_known_unexp); unsigned int test_get_extra_tx_descs_per_pkt(void); unsigned int test_get_min_tx_descs_by_nb_pkts(unsigned int nb_pkts); unsigned int test_get_tso_payload_cutoff_barrier(unsigned int hdrs_len); void test_hotplug_vfs_by_ids(rcf_rpc_server* rpcs, tapi_env* env, const cfg_net_node_t* node, unsigned int n_vfs, const unsigned int* vf_ids, struct test_ethdev_config** vfs); te_bool test_is_vdev(const char* device_name); void test_hotplug_reps(rcf_rpc_server* rpcs, tapi_env* env, const cfg_net_node_t* node, unsigned int n_rep, const unsigned int* rep_ids, struct test_ethdev_config** reps); void test_get_vf_pci_addrs_by_node(const cfg_net_node_t* node, unsigned int* n_vf_addrs, char*** vf_addrs, unsigned int** vf_ids); te_errno test_create_traffic_generator_params(const char* ta, char* arg_prefix, const char* command_prefix, const char* forward_mode, const char* txpkts, te_bool multi_flow, unsigned int txq, unsigned int txd, unsigned int burst, unsigned int txfreet, te_kvpair_h** params, unsigned int* n_cores); te_errno test_create_traffic_receiver_params(const char* arg_prefix, const char* command_prefix, unsigned int rxq, unsigned int packet_size, te_kvpair_h** params); uint16_t test_rte_af_packet_on_tst_if_deploy(rcf_rpc_server* tst_rpcs, const struct if_nameindex* tst_if, size_t frame_size, unsigned int nb_frames); void test_rte_af_packet_on_tst_if_release(rcf_rpc_server* tst_rpcs, const struct if_nameindex* tst_if); te_errno test_clone_mbuf(rcf_rpc_server* rpcs_src, rpc_rte_mbuf_p m_src, rcf_rpc_server* rpcs_dst, rpc_rte_mempool_p mp_dst, rpc_rte_mbuf_p* m_dstp); te_errno test_tx_mbuf_set_random_payload(rcf_rpc_server* rpcs, size_t size, rpc_rte_mbuf_p m); te_errno test_get_pci_fn_prop(rcf_rpc_server* rpcs, const struct if_nameindex* port, char* prop, unsigned int* value); te_errno test_add_pci_fn_prop(rcf_rpc_server* rpcs, const struct if_nameindex* port, char* prop, unsigned int value); void test_check_mtu(rcf_rpc_server* rpcs, const struct if_nameindex* port, unsigned int packet_size); void test_set_mtu(rcf_rpc_server* rpcs, uint16_t port_id, uint16_t mtu, struct test_ethdev_config* ethdev_config); void test_default_template_prepare(struct test_default_tmpl_prepare* p); void test_wait_stats_update(); te_bool test_desc_nb_violates_limits(unsigned int desc_nb, const struct tarpc_rte_eth_desc_lim* desc_lim); void test_check_rss_queues(rcf_rpc_server* rpcs, unsigned int port_id, uint16_t nb_rx_queues, uint16_t reta_size, const struct tarpc_rte_eth_rss_reta_entry64* reta_conf, asn_value* ptrn, uint32_t expected_hash, uint16_t expected_queue); void test_check_mbuf_rss_hash_value(rcf_rpc_server* rpcs, rpc_rte_mbuf_p mbuf, uint32_t expected_hash, uint32_t symmetric_hash); void test_rx_mq_rss_prepare(struct test_ethdev_config* ec, tarpc_rss_hash_protos_t hash_protos); const struct tarpc_rte_eth_rss_conf* test_rx_mq_rss_establish(struct test_ethdev_config* ec, te_bool enforce_initial_conf); te_bool test_tx_mbuf_segs_good(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m, struct tarpc_rte_eth_dev_info* dev_info); te_bool test_eth_get_vlan_from_bottom_layer_of_template(const asn_value* tmpl, uint16_t* vlan_id); void test_rx_clean_queue(rcf_rpc_server* rpcs, uint16_t port, uint16_t queue); void test_nullify_rte_pktmbuf_array(rpc_rte_mbuf_p* ptrs, unsigned int n_ptrs); // macros #define BURST_SIZE #define CHECK_MATCHED_PACKETS_NUM(_actual, _expected) #define CHECK_PACKETS_NUM(_actual, _expected) #define DPDK_TS_RX_CHECKS #define DPMD_TS_ETHERTYPE_RAND #define DPMD_TS_PAYLOAD_LEN_DEF #define DPMD_TS_RX_ATTEMPT_WAIT_MS #define RECEIVE_TIMEOUT_DEF #define RX_VEC_LIM #define TESTPMD_ARG_MAX_LEN #define TEST_DEF_ETHER_TYPE #define TEST_DEF_GENEVE_UDP_PORT #define TEST_DEF_IP_PROTO #define TEST_DEF_PPPOE_PADI_CODE #define TEST_DEF_PPPOE_TYPE #define TEST_DEF_PPPOE_VER #define TEST_DEF_PROTOCOL_TYPE #define TEST_DEF_VXLAN_UDP_PORT #define TEST_DEV_HEADER_SIZE #define TEST_END_SPECIFIC #define TEST_ENV_IUT_PORT #define TEST_ETHER_ENCAP_PROTO_OPAQUE #define TEST_ETH_RSS_FRAG_IPV4 #define TEST_ETH_RSS_FRAG_IPV6 #define TEST_ETH_RSS_GENEVE #define TEST_ETH_RSS_IP #define TEST_ETH_RSS_IPV4 #define TEST_ETH_RSS_IPV6 #define TEST_ETH_RSS_IPV6_EX #define TEST_ETH_RSS_IPV6_TCP_EX #define TEST_ETH_RSS_IPV6_UDP_EX #define TEST_ETH_RSS_L2_PAYLOAD #define TEST_ETH_RSS_NONFRAG_IPV4_OTHER #define TEST_ETH_RSS_NONFRAG_IPV4_SCTP #define TEST_ETH_RSS_NONFRAG_IPV4_TCP #define TEST_ETH_RSS_NONFRAG_IPV4_UDP #define TEST_ETH_RSS_NONFRAG_IPV6_OTHER #define TEST_ETH_RSS_NONFRAG_IPV6_SCTP #define TEST_ETH_RSS_NONFRAG_IPV6_TCP #define TEST_ETH_RSS_NONFRAG_IPV6_UDP #define TEST_ETH_RSS_NVGRE #define TEST_ETH_RSS_PORT #define TEST_ETH_RSS_PROTO_MASK #define TEST_ETH_RSS_SCTP #define TEST_ETH_RSS_TCP #define TEST_ETH_RSS_TUNNEL #define TEST_ETH_RSS_UDP #define TEST_ETH_RSS_VXLAN #define TEST_GET_MBUF_SEG_PTRN_PARAM(_parameter) #define TEST_GET_RSS_HASH_PROTOS(var_name_) #define TEST_GET_VLAN_ID_PARAM(_parameter) #define TEST_IP4_ADDR_LEN #define TEST_IP6_ADDR_LEN #define TEST_IP_ENCAP_PROTO_OPAQUE #define TEST_IUT_PORT_MAC_NAME #define TEST_LINK_UP_MAX_CHECKS #define TEST_LINK_UP_WAIT_MS #define TEST_MAX_NB_XSTAT_NAMES #define TEST_MAX_VLAN_ID #define TEST_MEAS_ALLOWED_SKIPS #define TEST_MEAS_DEVIATION_COEFF #define TEST_MEAS_INIT_FLAGS #define TEST_MEAS_MAX_NUM_DATAPOINTS #define TEST_MEAS_MIN_NUM_DATAPOINTS #define TEST_MEAS_REQUIRED_CV #define TEST_MIN_PAGE_SIZE #define TEST_PKTMBUF_HEADROOM #define TEST_PKTS_MEMPOOL_NAME #define TEST_POST_LINK_UP_TIMEOUT #define TEST_RTE_ETHDEV_DEF_NB_RX_DESCS #define TEST_RTE_MEMPOOL_DATA_ROOM_OVERHEAD #define TEST_RTE_MEMPOOL_DEF_CACHE #define TEST_RTE_MEMPOOL_DEF_DATA_ROOM #define TEST_RTE_MEMPOOL_DEF_EXTRA #define TEST_RTE_MEMPOOL_DEF_PRIV_SIZE #define TEST_RTE_MEMPOOL_DEF_SIZE #define TEST_RX_PKTS_WAIT_MAX_MS #define TEST_RX_UNEXP_PKTS_GUARD_TIMEOUT_MS #define TEST_START_SPECIFIC #define TEST_START_VARS #define TEST_STATS_UPDATE_WAIT_MS #define TEST_TUNNEL_UDP_PORT_AWAIT_MC_REBOOT_MS #define TEST_TUNNEL_UDP_PORT_MAX_CHECKS #define TEST_TUNNEL_UDP_PORT_WAIT_MS
Detailed Documentation
Typedefs
typedef asn_value* test_transceiver_transform_tmpl( const asn_value *tmpl_tx, void *tmpl_data )
Prototype of a function used to transform template for transmittion into template for receiving.
Returned ASN.1 value for template must not be dependend on tmpl_rx
Parameters:
tmpl_rx |
Template for transmittion |
tmpl_data |
User-provided data |
Returns:
Template for receiving or NULL
on error
typedef asn_value* test_transceiver_transform_ptrn( const asn_value *ptrn_tx, void *ptrn_data )
Prototype of a function used to transform pattern that was sniffed on transmittion into pattern for receiving and matching.
Returned ASN.1 value for pattern must not be dependend on ptrn_rx
Parameters:
ptrn_rx |
Pattern sniffed on transmittion |
ptrn_data |
User-provided data |
Returns:
Pattern for receiving or NULL
on error
Global Functions
struct test_transceiver* test_transceiver_net_init(const char* ta, const char* if_name)
Create kernel net driver transceiver.
Jumps out on failure
Parameters:
ta |
Test agent name |
if_name |
Interface name |
Returns:
Transceiver entity
struct test_transceiver* test_transceiver_dpdk_init(rcf_rpc_server* rpcs, uint16_t port_id, rpc_rte_mempool_p mp)
Create DPDK transceiver.
Jumps out on failure
Parameters:
rpcs |
RPC server handle, only a pointer is stored in transceiver |
port_id |
Port identifier |
mp |
Mem pool handle |
Returns:
Transceiver entity
void test_transceiver_free(struct test_transceiver* trsc)
Destroy transceiver entity.
Parameters:
trsc |
Transceiver entity |
struct test_transceiver_exchange* test_transceiver_exchange_init(const asn_value* tmpl_tx, test_transceiver_transform_tmpl transform_tmpl, void* tmpl_data, test_transceiver_transform_ptrn transform_ptrn, void* ptrn_data)
Create exchange between transceivers.
Jumps out on failure
Parameters:
tmpl_tx |
Template for transmittion |
transform_tmpl |
Template transformation, may be |
tmpl_data |
User-provided data for transform_tmpl |
transform_ptrn |
Pattern transformation, may be |
ptrn_data |
User-provided data for transform_ptrn |
Returns:
Exchange entity
void test_transceiver_exchange_set_verdicts(struct test_transceiver_exchange* exchange, const char* verdict_no_pkts, const char* verdict_known_unexp)
Set verdicts for an exchange object.
NULL
means use default verdict.
Jumps out on failure
Parameters:
verdict_no_pkts |
Verdict to use when no packets are received but at least one was expected |
verdict_known_unexp |
Verdict to use when more that expected number of matching packets were received |
void test_transceiver_exchange_free(struct test_transceiver_exchange* exchange)
Destroy exchange entity.
Parameters:
exchange |
Exchange entity |
void test_transceiver_exchange_commit(const struct test_transceiver_exchange* exchange, struct test_transceiver* tx, unsigned int n_tx_pkts, unsigned int tx_queue, struct test_transceiver* rx, unsigned int n_rx_pkts, unsigned int rx_queue)
Commit exchange between transceivers:
send packets from tx
sniff the packets pattern
transform transmit template and sniffed pattern into template and pattern for receiving using user-provided callbacks in exchange (or leave any of them unchanged if its callback is
NULL
)reseive and match packets on rx
The order of this actions is not strict due to limitations of underlying APIs (CSAP API).
Jumps out on failure
Parameters:
exchange |
Exchange entity |
tx |
Transmitting transceiver |
n_tx_pkts |
Number of packets to send |
tx_queue |
Transmit queue (or any value if n/a) |
tx |
Receiving transceiver |
n_rx_pkts |
Number of packets to receive and match |
tx_queue |
Receive queue (or any value if n/a) |
void test_transciever_simple_exchange_commit(const asn_value* tmpl, struct test_transceiver* tx, unsigned int n_tx_pkts, unsigned int tx_queue, struct test_transceiver* rx, unsigned int n_rx_pkts, unsigned int rx_queue, const char* verdict_no_pkts, const char* verdict_known_unexp)
Wrapper for test_transceiver_exchange_commit() that takes packet template instead of exchange object - the packet is expected to be unchanged from transmittion to receiving. Verdicts are set according to test_transceiver_exchange_set_verdicts().
te_errno test_rx_burst_match_pattern_custom_verdicts(rcf_rpc_server* rpcs, uint16_t port_id, uint16_t queue_id, rpc_rte_mbuf_p* rx_pkts, uint16_t nb_pkts, uint16_t nb_expected, const asn_value* pattern, te_bool seq_strict, const char* verdict_no_pkts, const char* verdict_known_unexp)
Encompass Rx burst operation with one-by-one packet matching and custom verdicts instead of generic.
te_errno test_rx_burst_match_pattern(rcf_rpc_server* rpcs, uint16_t port_id, uint16_t queue_id, rpc_rte_mbuf_p* rx_pkts, uint16_t nb_pkts, uint16_t nb_expected, const asn_value* pattern, te_bool seq_strict)
Encompass Rx burst operation with one-by-one packet matching
te_errno test_rx_await_pkts(const char* ta_name, csap_handle_t csap_handle, unsigned int nb_pkts, unsigned int timeount_max_ms)
Wait for a certain amount of packets to be received.
The function returns success even if specified number of packets is not received. Caller is responsible for checking the number of received expected and unexpected packets.
te_errno test_rx_await_pkts_exec_cb(const char* ta_name, csap_handle_t csap_handle, unsigned int nb_pkts, unsigned int timeount_max_ms, tapi_tad_trrecv_cb_data* cb_data)
Wait for a certain amount of packets to be received and execute specified callback for each of them.
See test_rx_await_pkts() notes
uint16_t test_tx_prepare_and_burst(rcf_rpc_server* rpcs, uint16_t port_id, uint16_t queue_id, rpc_rte_mbuf_p* tx_pkts, uint16_t nb_pkts)
Prepare (validate) a burst of packets, then send
rpc_rte_mempool_p test_rte_pktmbuf_pool_create(rcf_rpc_server* rpcs, const char* name, uint32_t n, uint32_t cache_size, uint16_t priv_size, uint16_t data_room_size, int socket_id)
Wrapper for rpc_rte_pktmbuf_pool_create()
It enforces minimum value restriction in data_room_size for AF_XDP.
rpc_rte_mempool_p test_rte_pktmbuf_rx_pool_create(rcf_rpc_server* rpcs, uint16_t port_id, struct tarpc_rte_eth_dev_info* dev_info, const char* name, uint32_t n, uint32_t cache_size, uint16_t priv_size, uint16_t data_room_size, int socket_id)
Wrapper for rpc_rte_pktmbuf_pool_create() which creates packets mempool taking Rx limitations into account and therefore suitable for Rx queue setup.
As well as test_rte_pktmbuf_pool_create() it enforces minimum value restriction in data_room_size for AF_XDP.
struct tarpc_rte_eth_conf* test_rpc_rte_eth_make_eth_conf(rcf_rpc_server* rpcs, uint16_t port_id, struct tarpc_rte_eth_conf* eth_conf)
Wrapper for tapi_rpc_rte_eth_make_eth_conf(), with test workarounds
unsigned int test_rx_burst_with_retries(rcf_rpc_server* rpcs, uint16_t port_id, uint16_t queue_id, rpc_rte_mbuf_p* rx_pkts, unsigned int nb_pkts, unsigned int nb_expected)
Perform Rx burst on a queue until expected number of packets are received or a timeout (TEST_RX_PKTS_WAIT_MAX_MS
) passes.
Parameters:
rpcs |
RPC server handle |
port_id |
The port identifier of the device |
queue_id |
Queue to receive packets on |
rx_pkts |
Array of mbufs to use for received packets |
nb_pkts |
Number of avaiable mbufs |
nb_expected |
Expected number of packets that should be received |
Returns:
number of received packets
void test_await_link_up(rcf_rpc_server* rpcs, uint16_t port_id)
Await link UP after port start/restart
void test_rte_eth_dev_set_mtu_await_link_up(rcf_rpc_server* rpcs, uint16_t port_id, uint16_t mtu, struct test_ethdev_config* ethdev_config)
Set MTU on IUT and await link UP
te_errno test_tunnel_udp_port_add(struct test_ethdev_config* test_ethdev_config, struct tarpc_rte_eth_udp_tunnel* tunnel_udp)
Add tunnel UDP port and, if device state is STARTED, cope with a possible failure caused by port restart
te_errno test_tunnel_udp_port_del(struct test_ethdev_config* test_ethdev_config, struct tarpc_rte_eth_udp_tunnel* tunnel_udp)
Delete tunnel UDP port and, if device state is STARTED, cope with a possible failure caused by port restart
te_errno test_prepare_ethdev(struct test_ethdev_config* test_ethdev_config, test_ethdev_state st)
Prepare the required Ethernet device state
Parameters:
Information about device configuration |
|
st |
The required state of device |
Status |
code |
te_errno test_default_prepare_ethdev(tapi_env* env, rcf_rpc_server* rpcs, const struct if_nameindex* iut_port, struct test_ethdev_config* test_ethdev_config, test_ethdev_state st)
Prepare the required Ethernet device state using default configuration
Parameters:
env |
Environment binding |
rpcs |
RPC server handle |
port_id |
The port identifier of the device |
Information about device configuration (out) |
|
st |
The required state of device |
Status |
code |
struct test_ethdev_config* test_prepare_config_def_mk(tapi_env* env, rcf_rpc_server* rpcs, const struct if_nameindex* iut_port, struct test_ethdev_config* test_ethdev_config)
Prepare the default Etheret device configuration for test
Parameters:
env |
Environment binding |
rpcs |
RPC server handle |
port_id |
The port identifier of the device |
Information about device configuration (out) |
|
Information about device configuration |
struct test_ethdev_config* test_prepare_config_mk(tapi_env* env, rcf_rpc_server* rpcs, const char* dev_name, uint16_t port_id, struct test_ethdev_config* test_ethdev_config)
Variation of test_prepare_config_def_mk() that accepts port id and device name as separate arguments.
Parameters:
env |
Environment binding |
rpcs |
RPC server handle |
device_name |
Name of the device |
port_id |
The port identifier of the device |
Information about device configuration (out) |
|
Information about device configuration |
te_errno test_calc_hash_by_tmpl_and_hf(tarpc_rss_hash_protos_t hf, uint8_t* rss_key, size_t rss_key_sz, asn_value* tmpl, uint32_t* hash_regular, uint32_t* hash_symmetric)
Calculate the packet hash by the template taking into account the hash function
Symmetric hash implies that IP addresses (or low 4 bytes, for IPv6) get exclusively ORed together to produce the input for Toeplitz hash.
Parameters:
hf |
Bitmask of RSS hash functions |
rss_key |
RSS key |
rss_key_sz |
RSS key size |
tmpl |
Template |
hash_regular |
Location for standard RSS hash or |
hash_symmetric |
Location for symmetric IP RSS hash (out) or |
Status |
code |
te_errno test_rss_get_hash_by_pattern_unit(tarpc_rss_hash_protos_t rss_hf, uint8_t* rss_key, size_t rss_key_sz, const asn_value* pattern, int pattern_unit_index, uint32_t* hash_regular, uint32_t* hash_symmetric)
test_calc_hash_by_tmpl_and_hf()
variation to deal with a pattern unit
te_errno test_change_src_addr_by_reta_index(const te_toeplitz_hash_cache* toeplitz_hash_cache, unsigned int hash, uint8_t* src_addr, unsigned int addr_size, uint16_t reta_size, const unsigned int* indexes, unsigned int nb_indexes)
Change source v4/v6 address by redirection table indexes to be sure that the modified packet will be received on the proper queue calculated using Toeplitz hash function
Parameters:
toeplitz_hash_cache |
Pre-constructed cache |
hash |
RSS hash value |
src_addr |
Pointer to source address |
addr_size |
Size of src_addr in bytes |
reta_size |
Redirection table size |
indexes |
Array of required RETA indexes |
nb_indexes |
Number of RETA indexes |
Status |
code |
tarpc_rss_hash_protos_t test_rss_hash_protos_str2bitmask(const char* rss_hash_protos_str)
Convert the string with several RSS hash protocols separated by commas to an tarpc_rss_hash_protos_t protocols bitmask
Parameters:
rss_hash_protos_str |
String with RSS hash protocols |
hash |
function bitmask |
te_errno test_get_rss_hf_by_tmpl(asn_value* tmpl, tarpc_rss_hash_protos_t* hf)
Anticipate RSS HF combination by traffic template.
Parameters:
tmpl |
Traffic template |
hf |
RSS HF combination (out) |
Status |
code |
void test_parse_mbuf_seg_ptrn(const char* seg_ptrn_str, struct test_param_seg_ptrn* segmentation)
Parse mbuf segmentation rules.
The function jumps out in the case of parsing faliure.
Parameters:
seg_ptrn_str |
Segmentation rules in string format |
segmentation |
Segmentation rules to be filled in |
te_errno test_check_iut_tst_link_status(const char* tst_ta, const char* tst_if_name, rcf_rpc_server* iut_rpcs, uint16_t iut_port_id, te_bool expected_status)
Check that tester and IUT link statuses match the expected link status
Parameters:
tst_ta |
Test Agent name |
tst_if_name |
Interface name |
iut_rpcs |
RPC server handle |
iut_port_id |
Port identifier (port number) |
expected_status |
Expected link status |
status |
code |
int test_get_xstat_by_name(const char* xstat_name, struct tarpc_rte_eth_xstat_name* xstats_names, struct tarpc_rte_eth_xstat* xstats, unsigned nb_xstats, uint64_t* value)
Get xstat value by name
Parameters:
xstat_name |
Name of extended statistic |
xstats_names |
Array of extended statistics names |
xstats |
Array of extended statistics values |
nb_xstats |
Number of extended statistics |
value |
Value of extended statistic (OUT) |
0 |
on success and -1 on error |
uint32_t test_ptype_from_pattern(const asn_value* pattern, uint32_t* supp, unsigned int supp_count)
Get packet type from the pattern and check that it is supported
Parameters:
pattern |
Traffic pattern |
supp |
Packet types supported by the driver |
supp_count |
The number of supported packet types |
Packet |
type |
te_bool test_check_packet_ptype(uint32_t pt_flag_expected, int pt_value_detected, int pt_flag_offset)
Compare expected packet type flag with an actual value and provide a log message on mismatch
c FALSE on success, TRUE
on error
Parameters:
pt_flag_expected |
Expected packet type flag |
pt_value_detected |
Detected packet type value |
pt_flag_offset |
te_errno test_dev_info_cmp(struct tarpc_rte_eth_dev_info* dev_info_1, struct tarpc_rte_eth_dev_info* dev_info_2)
Compare informations about Ethernet device
Parameters:
dev_info_1 |
Firts device information |
dev_info_2 |
Second device information to compare |
0 |
if they are equal |
te_errno test_change_tmpl_ip_src_addr_by_queue_nb(asn_value* tmpl, uint16_t queue, uint64_t reta_size, struct tarpc_rte_eth_rss_reta_entry64* reta_conf, const struct tarpc_rte_eth_rss_conf* rss_conf)
Change source v4/v6 address to be sure that the modified packet will be received on the proper queue
Parameters:
tmpl |
Pointer to ASN.1 template |
queue |
The receive queue number Device redirection table size |
reta_size |
Device redirection table size |
reta_conf |
RSS RETA configuration |
rss_conf |
RSS hash configuration of the Ethernet device |
Status |
code |
te_errno test_mk_template_get_match_fields_from_flow_ndn(const asn_value* flow_ndn, asn_value** tmpl, uint32_t* match_fields)
Convert an ASN.1 flow rule or pattern to a template containing the same set of PDUs as ones in the flow rule and get flags of template match fields
Parameters:
flow_ndn |
ASN.1 flow rule or pattern |
tmpl |
Pointer to ASN.1 template |
match_fields |
Match fields flags if not |
status |
code |
struct sockaddr* test_rand_ip_addr(int af)
Get random IPv4/IPv6 address
Function allocates memory, which should be freed by the caller.
Parameters:
af |
Address family |
Address |
void test_set_pkt_addresses(struct test_pkt_addresses* addrs, const uint8_t* src_mac, const uint8_t* dst_mac, const struct sockaddr* src_ip, const struct sockaddr* dst_ip)
Set addresses of the packet
The function just fills struct test_pkt_addresses, so it must be allocated before function call.
Parameters:
addrs |
Packet addresses |
src_mac |
Source MAC address |
dst_mac |
Destination MAC address |
src_ip |
Source IP address |
dst_ip |
Destination IP address |
te_errno test_fill_in_tmpl_req_fields(const asn_value* tmpl, struct test_pkt_addresses* addrs, struct test_pkt_addresses* ifrm_addrs)
Fill in ASN.1 template required fields
Parameters:
tmpl |
ASN.1 template |
addrs |
Packet outer frame addresses |
ifrm_addrs |
Packet inner frame addresses |
status |
code |
asn_value* test_tmpl_copy_with_changed_fields(const asn_value* tmpl, uint32_t fields, struct test_pkt_addresses* addrs, struct test_pkt_addresses* ifrm_addrs)
Copy template with changed specific fields. Addresses change to new values, other fields are increased by one. New addresses could not match to values in the template.
Parameters:
tmpl |
Pointer to ASN.1 template |
fields |
Template fields flags that need to change |
addrs |
Packet outer frame addresses |
ifrm_addrs |
Packet inner frame addresses |
status |
code |
te_errno test_mk_tmpls_with_change_one_field(const asn_value* tmpl, uint32_t fields, struct test_pkt_addresses* addrs, struct test_pkt_addresses* ifrm_addrs, asn_value**[] tmpls_out, unsigned int* tmpls_nb_out)
Make copies of ASN.1 template with change only one field. Each copy corresponds to a change of the one of fields.
Function allocates memory for array of templates, which should be freed by the caller.
Parameters:
tmpl |
Pointer to ASN.1 template |
fields |
Template fields flags that need to change |
addrs |
Basic packet outer frame addresses |
ifrm_addrs |
Basic packet inner frame addresses |
tmpls_out |
Pointer to array of changed ASN.1 template copies |
tmpls_nb_out |
Number of tempaltes in the array |
status |
code |
te_errno test_get_rx_info_by_rss_action(const asn_value* flow_rule_rss, uint16_t** rss_queues_out, uint16_t* nb_rss_queues_out, uint16_t* nb_queues_out, uint64_t* rss_hf, uint8_t** rss_key_out, size_t* rss_key_sz_out)
Pull out Rx information from an RSS flow rule
te_errno test_add_tunnel_udp_port_from_tmpl(struct test_ethdev_config* ethdev_config, asn_value* tmpl, te_bool required)
Add the appropriate tunnel UDP port if VXLAN/GENEVE protocols are in the template
te_errno test_pdus_detect_and_spoil_cksums(unsigned int nb_pdus, asn_value** pdus, uint64_t* flags_good_out, uint64_t* flags_bad_out, int* l4_type_out)
Spoil checksums across the PDUs and make notes on GOOD and BAD checksum offload flags which _could be expected, respectively, for the original packet and for the spoiled packet
te_errno test_mk_rte_flow_attr_ingress(rcf_rpc_server* rpcs, rpc_rte_flow_attr_p* attr)
Make RTE flow attributes with only one "ingress" attribute
Parameters:
rpcs |
RPC server handle |
attr |
RTE flow attr pointer |
te_errno test_mk_rte_flow_action_drop(rcf_rpc_server* rpcs, rpc_rte_flow_action_p* actions)
Make RTE flow actions with only one "drop" action
Parameters:
rpcs |
RPC server handle |
actions |
RTE flow actions pointer |
te_errno test_mk_rte_flow_action_queue(rcf_rpc_server* rpcs, uint16_t queue, rpc_rte_flow_action_p* actions)
Make RTE flow actions with only one "queue" action
Parameters:
rpcs |
RPC server handle |
queue |
Queue number |
actions |
RTE flow actions pointer |
te_errno test_mk_txmode_txconf(struct test_ethdev_config* tecp, uint64_t test_offloads, struct tarpc_rte_eth_txmode* txmodep, struct tarpc_rte_eth_txconf* txconfp)
Validate Tx offload request and generate Tx mode and Tx queue configuration based on DPDK version.
Parameters:
tecp |
Test ethdev configuration |
test_offloads |
Offload request in terms of Tx offload capability flags supported by TAPI RPC |
txmodep |
Tx mode configuration to be filled in, or |
txconfp |
Tx queue configuration to be filled in, or |
Returns:
0
on success, TE_EINVAL
in the case of verdict, other non-zero value in the case of techical problem.
void test_get_rss_reta(rcf_rpc_server* rpcs, uint16_t port_id, uint64_t* reta_size, struct tarpc_rte_eth_rss_reta_entry64** reta_conf)
Get RSS RETA configuration using rss_reta_query() RPC. Fill RETA with default values and generate warning if the RPC is not supported.
Parameters:
rpcs |
RPC server handle |
port_id |
The port identifier of the device |
reta_size |
Location for length of RETA table |
reta_conf |
Location for RETA configuration |
void test_start_tx_queue(rcf_rpc_server* rpcs, uint16_t port_id, uint16_t queue_id)
Start Tx queue with specified queue_id using rx_queue_start() RPC Stop test with warning if the RPC is not supported
Parameters:
rpcs |
RPC server handle |
port_id |
The port identifier of the device |
queue_id |
The index of queue to start |
void test_start_rx_queue(rcf_rpc_server* rpcs, uint16_t port_id, uint16_t queue_id)
Start Rx queue with specified queue_id using rx_queue_start() RPC Stop test with warning if the RPC is not supported
Parameters:
rpcs |
RPC server handle |
port_id |
The port identifier of the device |
queue_id |
The index of queue to start |
void test_setup_rss_configuration(tarpc_rss_hash_protos_t hf, size_t rss_key_sz, te_bool regular, struct tarpc_rte_eth_rss_conf* rss_conf)
Fill RSS with provided hf and regular or random RSS key
Parameters:
hf |
Hash functions to include into RSS configuration |
rss_key_size |
RSS key size |
regular |
If |
rss_conf |
RSS configuration to setup |
struct tarpc_rte_eth_rss_conf* test_try_get_rss_hash_conf(rcf_rpc_server* rpcs, size_t rss_key_sz, uint16_t port_id)
Try to get RSS configuration using rss_hash_conf_get() RPC
Parameters:
rpcs |
RPC server handle |
rss_key_sz |
Expected MAX RSS key size |
port_id |
The port identifier of the device |
Returns:
Pointer to allocated RSS configuration on heap on success NULL
if the RPC is not supported
void test_send_and_match_one_packet(rcf_rpc_server* rpcs, uint16_t port_id, const char* tst_ta, const char* tst_if_name, rpc_rte_mbuf_p* mbufs, asn_value* tmpl, unsigned int queue, unsigned int packet_expected)
Send one packet with tmpl, receive it on queue and match it
Parameters:
rpcs |
RPC server handle |
port_id |
The port identifier of the device |
tst_ta |
Test Agent name |
tst_if_name |
Interface name |
mbufs |
Array of mbufs to use for received packets |
tmpl |
Traffic template |
queue |
Queue to receive packets on |
packets_expected |
Number of expected received packets |
const char* test_get_ethdev_state_name(test_ethdev_state state)
Get string representation of a test_ethdev_state enum value
Parameters:
state |
Device state |
uint32_t test_get_template_packet_length(rcf_rpc_server* rpcs, asn_value* tmpl, rpc_rte_mempool_p mp)
Get length of a single packet generated from a traffic template
Parameters:
rpcs |
RPC server handle |
tmpl |
Traffic template |
mp |
RTE mempool pointer |
unsigned int test_get_template_header_length(rcf_rpc_server* rpcs, asn_value* tmpl, rpc_rte_mempool_p mp)
Get header length of a traffic template
Parameters:
rpcs |
RPC server handle |
tmpl |
Traffic template |
mp |
RTE mempool pointer |
te_bool test_conf_tx_offload_supported(unsigned long long offload_bit)
Find out if a requested Tx offload is supported by looking into configuration tree
Parameters:
offload_bit |
Bit of the offload to query |
te_bool test_conf_rx_offload_supported(unsigned long long offload_bit)
Find out if a requested Rx offload is supported by looking into configuration tree
Parameters:
offload_bit |
Bit of the offload to query |
void test_add_ndn_action_queue(asn_value* ndn_actions, int action_index, uint16_t queue)
Add a QUEUE action to an action list at specified index.
Parameters:
ndn_actions |
Action list |
action_index |
Index at which QUEUE action is put to list |
queue |
Queue index of QUEUE action |
void test_add_ndn_action_drop(asn_value* ndn_actions, int action_index)
Add a DROP action to an action list at specified index.
Parameters:
ndn_actions |
Action list |
action_index |
Index at which DROP action is put to list |
void test_mk_pattern_and_tmpl_by_flow_rule_pattern(rcf_rpc_server* rpcs, const asn_value* flow_rule_pattern, rpc_rte_flow_item_p* pattern, asn_value** tmpl, uint32_t* match_fields)
Convert an ASN value representing a flow rule pattern into RTE flow rule pattern and a template that matches the pattern.
Parameters:
rpcs |
RPC server handle |
flow_rule_pattern |
ASN.1 representation of a flow rule pattern |
pattern |
RTE pattern |
tmpl |
Matching ASN.1 template |
match_fields |
Match fields flags if not |
te_errno test_generate_changed_flow_patterns(const asn_value* flow_rule_pattern, const char* field_path, size_t n_changed_patterns, asn_value** changed_patterns)
Generate flow rule patterns with a changed field.
Parameters:
flow_rule_pattern |
Flow rule pattern to build other patterns upon |
field_path |
ASN.1 path to a field that needs to be changed |
n_changed_patterns |
Size of an array of changed patterns |
changed_patterns |
Pointer to an array of changed patterns |
Returns:
RTE flow pointer on success; jumps out on failure
asn_value* test_concatenate_tmpl_ptrn_pdus(const asn_value* dst, const asn_value* src, const char* label)
Concatenate PDU sequences in two packet templates/patterns.
Parameters:
dst |
Pattern or template to which PDUs are appended |
src |
Pattern or template from which PDUs are retrieved |
Returns:
ASN.1 value with concatenated PDUs on success; jumps out on failure
asn_value* test_decap_tmpl_ptrn_pdus(const asn_value* val, const char* label)
Remove outer frame from a PDU sequence in a template/pattern.
Parameters:
val |
Encapsulated pattern or template |
label |
Path to PDU sequence in val |
Returns:
Decapsulated ASN.1 value on success; jumps out on failure
void test_check_flow_query_data(const tarpc_rte_flow_query_data* data, te_bool check_hits, uint64_t hits, te_bool check_bytes, uint64_t bytes)
Check that query data for COUNT action meets provided expectations.
Jumps out on check fail
Parameters:
data |
RTE flow query counter data |
check_hits |
Check number of hits if |
hits |
Expected number of hits |
check_bytes |
Check number of bytes if |
bytes |
Expected nymber of bytes |
void test_add_and_mk_rte_flow_action_count(uint32_t counter_id, int action_id, rcf_rpc_server* rpcs, asn_value* ndn_actions, rpc_rte_flow_action_p* rte_actions)
Add an ASN.1 flow rule action "count" to action list at specified index and make RTE flow actions with only this action.
Jumps out on failure
Parameters:
counter_id |
Counter index |
action_id |
Index at which the action is put to list |
rpcs |
RPC server handle |
ndn_actions |
ASN.1 flow rule action list |
rte_actions |
RTE flow actions pointer |
void test_check_xstat(const char* name, uint64_t value, struct tarpc_rte_eth_xstat_name* xstats_names, struct tarpc_rte_eth_xstat* xstats, int nb_xstats, te_string* wrong_xstats, te_string* zero_xstats)
Check that extended statistic is correct
Parameters:
name |
String with extended statistic name |
value |
Correct value |
xstats_names |
Name of array of extended statistics names |
xstats |
Name of array of extended statistics values |
nb_xstats |
Name of variable with the number of extended statistics |
wrong_xstats |
String with wrong extended statistics names |
zero_xstats |
String with always zero extended statistics names |
te_bool test_pdus_dst_mac_is_set(const asn_value* pdus)
Check that PDU sequence has destination MAC set.
Parameters:
pdus |
PDU sequence |
Returns:
TRUE
if destination MAC is set
void test_pdus_set_eth_src_dst(asn_value* pdus, const char* pdus_path, const uint8_t* src, const uint8_t* dst)
Set source and destination MAC addresses of outer frame in a PDU sequence.
PDU sequence must contain outer Ethernet PDU
The function jumps out on failure
Parameters:
container |
ASN.1 container in which PDU sequence is changed |
pdus_path |
Path to PDU sequence in the container |
src |
Source MAC address to set (ignore if |
dst |
Destination MAC address to set (ignore if |
void test_rte_eth_promiscuous_enable(rcf_rpc_server* rpcs, uint16_t port_id, enum test_op_required required)
Enable promiscuous mode and check that rte_eth_promiscuous_get() reports enabled promiscuous mode.
Parameters:
rpcs |
RPC server handle |
port_id |
The port identifier of the device |
required |
Is operation required? |
void test_rte_eth_promiscuous_disable(rcf_rpc_server* rpcs, uint16_t port_id, enum test_op_required required)
Disable promiscuous mode and check that rte_eth_promiscuous_get() reports disabled promiscuous mode.
Parameters:
rpcs |
RPC server handle |
port_id |
The port identifier of the device |
required |
Is operation required? |
void test_rte_eth_allmulticast_enable(rcf_rpc_server* rpcs, uint16_t port_id, enum test_op_required required)
Enable all-multicast mode and check that rte_eth_allmulticast_get() reports enabled all-multicast mode.
Parameters:
rpcs |
RPC server handle |
port_id |
The port identifier of the device |
required |
Is operation required? |
void test_rte_eth_allmulticast_disable(rcf_rpc_server* rpcs, uint16_t port_id, enum test_op_required required)
Disable all-multicast mode and check that rte_eth_allmulticast_get() reports disabled all-multicast mode.
Parameters:
rpcs |
RPC server handle |
port_id |
The port identifier of the device |
required |
Is operation required? |
asn_value* test_mk_pattern_by_unit(const asn_value* ptrn, int index)
Create a new traffic pattern with only one unit, that is get from ptrn by index.
Jumps out on failure
Parameters:
ptrn |
Traffic pattern @paran[in] index Index of needed pattern unit |
Returns:
New pattern that contains only one unit
void test_send_and_match_one_packet_custom_verdicts(rcf_rpc_server* rpcs, uint16_t port_id, const char* tst_ta, const char* tst_if_name, rpc_rte_mbuf_p* mbufs, asn_value* tmpl, unsigned int queue, unsigned int packet_expected, const char* verdict_no_pkts, const char* verdict_known_unexp)
Send one packet with tmpl, receive it on queue and match it. Report custom verdicts.
Parameters:
rpcs |
RPC server handle |
port_id |
The port identifier of the device |
tst_ta |
Test Agent name |
tst_if_name |
Interface name |
mbufs |
Array of mbufs to use for received packets |
tmpl |
Traffic template |
queue |
Queue to receive packets on |
packets_expected |
Number of expected received packets |
unsigned int test_get_extra_tx_descs_per_pkt(void)
Get number of Tx descriptors which could be required per packet.
unsigned int test_get_min_tx_descs_by_nb_pkts(unsigned int nb_pkts)
Get minimum number of Tx descriptors to send specified number of packets.
unsigned int test_get_tso_payload_cutoff_barrier(unsigned int hdrs_len)
Get TSO payload cutoff barrier (i.e. without net headers length).
Parameters:
hdrs_len |
Net headers length. |
void test_hotplug_vfs_by_ids(rcf_rpc_server* rpcs, tapi_env* env, const cfg_net_node_t* node, unsigned int n_vfs, const unsigned int* vf_ids, struct test_ethdev_config** vfs)
Hotplug VFs with indices specified by vf_ids.
The function jumps out on failure
Parameters:
rpcs |
RPC server handle |
env |
Environment binding |
node |
Network node of the device (PF) |
n_vfs |
The number of VFs to hotplug |
vf_ids |
Indices of the VFs to hotplug |
vfs |
Configurations of the added VFs |
te_bool test_is_vdev(const char* device_name)
Determine if a device is virtual by its name.
Parameters:
device_name |
Name of a device |
Returns:
TRUE
if device is virtual, FALSE
otherwise
void test_hotplug_reps(rcf_rpc_server* rpcs, tapi_env* env, const cfg_net_node_t* node, unsigned int n_rep, const unsigned int* rep_ids, struct test_ethdev_config** reps)
Add port representors of the device of a network node using hotplug and create ethdev configurations for each of the representor. A port representor is created for each index in rep_ids
The function jumps out on failure
Parameters:
rpcs |
RPC server handle |
node |
Network node of the device (PF) |
n_rep |
Size of rep_ids |
rep_ids |
Array of representor indexes to add |
reps |
Configurations of the added port representors |
void test_get_vf_pci_addrs_by_node(const cfg_net_node_t* node, unsigned int* n_vf_addrs, char*** vf_addrs, unsigned int** vf_ids)
Get VF PCI addresses of a PF associated with network node.
The function jumps out on failure
Parameters:
node |
Network node of the device (PF) |
n_vf_addrs |
Number of VFs |
vf_addrs |
VF PCI addresses |
vf_ids |
Indices of the VFs |
te_errno test_create_traffic_generator_params(const char* ta, char* arg_prefix, const char* command_prefix, const char* forward_mode, const char* txpkts, te_bool multi_flow, unsigned int txq, unsigned int txd, unsigned int burst, unsigned int txfreet, te_kvpair_h** params, unsigned int* n_cores)
Create parameters for traffic generation
Parameters:
ta |
Test agent to run generator on |
arg_prefix |
App-specific prefix for arguments |
command_prefix |
App-specific prefix for commands |
txpkts |
TX segment size |
multi_flow |
Generate many flow to use RSS on Rx side |
txq |
Number of Tx queues (0 for default number) |
txd |
Number of Tx descriptors |
burst |
Number of packets per burst |
txfreet |
Number of transmit free threshold of TX rings |
params |
List of kvpairs to store parameters |
n_cores |
Location to put required number of testpmd data cores |
te_errno test_create_traffic_receiver_params(const char* arg_prefix, const char* command_prefix, unsigned int rxq, unsigned int packet_size, te_kvpair_h** params)
Create parameters for traffic reception
Parameters:
arg_prefix |
App-specific prefix for arguments |
command_prefix |
App-specific prefix for commands |
rxq |
Number of Rx queues |
packet_size |
Packet size in bytes (without l1 and FCS) |
params |
List of kvpairs to store parameters |
uint16_t test_rte_af_packet_on_tst_if_deploy(rcf_rpc_server* tst_rpcs, const struct if_nameindex* tst_if, size_t frame_size, unsigned int nb_frames)
Deploy RTE af_packet on top of a tester's regular network interface.
One must invoke test_rte_af_packet_on_tst_if_release()
on cleanup.
The function jumps out on failure.
Parameters:
tst_rpcs |
RPC server handle |
tst_if |
Network interface description |
frame_size |
The biggest packet's size |
nb_frames |
The number of packets which need to be received |
Returns:
RTE port ID which can be used to invoke rpc_rte_eth_rx_burst()
.
void test_rte_af_packet_on_tst_if_release(rcf_rpc_server* tst_rpcs, const struct if_nameindex* tst_if)
Release RTE af_packet which has been previously deployed on top of a tester's regular network interface.
The function jumps out on failure.
Parameters:
tst_rpcs |
RPC server handle |
tst_if |
Network interface description |
te_errno test_clone_mbuf(rcf_rpc_server* rpcs_src, rpc_rte_mbuf_p m_src, rcf_rpc_server* rpcs_dst, rpc_rte_mempool_p mp_dst, rpc_rte_mbuf_p* m_dstp)
Clone the given mbuf and preserve its flags + Tx offload meta information.
Parameters:
rpcs_src |
Source RPC server handle |
m_src |
The mbuf to be cloned |
rpcs_dst |
Destination RPC server handle |
mp_dst |
Destination mempool handle |
m_dstp |
Location for the new mbuf pointer |
Returns:
Status code
te_errno test_tx_mbuf_set_random_payload(rcf_rpc_server* rpcs, size_t size, rpc_rte_mbuf_p m)
Append randomised payload to the given mbuf.
The function will trim existing non-header data.
The header will not be updated.
Parameters:
rpcs |
RPC server handle |
size |
Payload size |
m |
The mbuf |
Returns:
Status code
void test_check_mtu(rcf_rpc_server* rpcs, const struct if_nameindex* port, unsigned int packet_size)
Skip the test if required packet size is out of MTU limitations reported by the device and saved in local configuration tree.
Parameters:
rpcs |
RPC server handle |
port |
Network interface description |
packet_size |
Maximum packet size required for the test |
void test_set_mtu(rcf_rpc_server* rpcs, uint16_t port_id, uint16_t mtu, struct test_ethdev_config* ethdev_config)
Set requested MTU to the device considering maximum/minimum reported MTU. Errors are reported as verdicts.
Parameters:
rpcs |
RPC server handle |
port_id |
Port identifier |
mtu |
MTU to set |
ethdev_config |
Information about device configuration |
void test_default_template_prepare(struct test_default_tmpl_prepare* p)
Do default template prepare procedure that essentially sets MAC, packets number and payload and substitutes "#env" units.
Parameters:
p |
Holds template to prepare with auxiliary data. |
void test_wait_stats_update()
Wait default time for statistics update with motivation logging.
te_bool test_desc_nb_violates_limits(unsigned int desc_nb, const struct tarpc_rte_eth_desc_lim* desc_lim)
Check given descriptors number against descriptors limits.
Parameters:
desc_nb |
Descriptors number |
desc_lim |
Descriptors limits |
Returns:
Boolean if descriptors number violates reported limits
void test_check_rss_queues(rcf_rpc_server* rpcs, unsigned int port_id, uint16_t nb_rx_queues, uint16_t reta_size, const struct tarpc_rte_eth_rss_reta_entry64* reta_conf, asn_value* ptrn, uint32_t expected_hash, uint16_t expected_queue)
Collect diagnostcs in the case of no packet delivery to the expected queue in accordance with RSS settings.
Parameters:
rpcs |
RPC server handle |
port_id |
Port identifier |
nb_rx_queues |
Number of Rx queues |
reta_size |
Redirection table size |
reta_conf |
Redirection table |
ptrn |
Expected packet |
expected_hash |
Expected RSS hash value |
expected_queue |
Expected Rx queues |
void test_check_mbuf_rss_hash_value(rcf_rpc_server* rpcs, rpc_rte_mbuf_p mbuf, uint32_t expected_hash, uint32_t symmetric_hash)
Check RSS hash value provided in mbuf if available.
Parameters:
rpcs |
RPC server handle |
mbuf |
Packet buffer handle |
expected_hash |
Expected RSS hash value |
symmetric_hash |
Symmetric RSS hash value |
void test_rx_mq_rss_prepare(struct test_ethdev_config* ec, tarpc_rss_hash_protos_t hash_protos)
Prepare custom RSS configuration (random RSS key + given hash proto mask) to be programmed into the ethdev either during transition to CONFIGURED state or at a later invocation of test_rx_mq_rss_establish()
Parameters:
ec |
Ethdev configuration handle |
hash_protos |
Hash proto mask to be applied |
const struct tarpc_rte_eth_rss_conf* test_rx_mq_rss_establish(struct test_ethdev_config* ec, te_bool enforce_initial_conf)
Establish effective RSS configuration to be used for building expectations
The API first invokes rte_eth_dev_rss_hash_conf_get() to check whether early setup during transition to CONFIGURED state has been successful. If the current RSS configuration contradicts the initial one or if it cannot be retrieved at all, rte_eth_dev_rss_hash_update() will be invoked to retry setup before checking the result one more time.
Parameters:
ec |
Ethdev configuration handle |
enforce_initial_conf |
Toggle for strict verification mode |
Returns:
Established (effective) RSS configuration
te_bool test_tx_mbuf_segs_good(rcf_rpc_server* rpcs, rpc_rte_mbuf_p m, struct tarpc_rte_eth_dev_info* dev_info)
Check segmentation of the mbuf to be sent to comply with Tx segmentation limits reported by the driver in device information.
Parameters:
rpcs |
RPC server handle |
m |
mbuf RPC pointer |
dev_info |
Device information |
Returns:
Is mbuf segmentation good vs limits?
te_bool test_eth_get_vlan_from_bottom_layer_of_template(const asn_value* tmpl, uint16_t* vlan_id)
Get the VLAN identifier from the bottom layer of a traffic template.
The VLAN protocol, IEEE 802.1Q, is considered only.
Parameters:
tmpl |
A traffic template. |
vlan_id |
The VLAN identifier if provided or UINT16_MAX otherwise. |
Returns:
TRUE
if the VLAN identifier is provided or FALSE
otherwise.
void test_rx_clean_queue(rcf_rpc_server* rpcs, uint16_t port, uint16_t queue)
Read out packets from an interface queue.
At leasts one mpool buffer is available for the queue.
Parameters:
rpcs |
The RCP server. |
port |
The DPDK interface. |
queue |
The queue index. |
void test_nullify_rte_pktmbuf_array(rpc_rte_mbuf_p* ptrs, unsigned int n_ptrs)
Nullify an array of RPC mempool buffers.
Parameters:
ptrs |
An array of RPC mempool buffers. |
n_ptrs |
The length of the ptrs array. |
Macros
#define BURST_SIZE
Default size of rx/tx burst
#define CHECK_MATCHED_PACKETS_NUM(_actual, _expected)
Check that the number of matched packets is expected
#define CHECK_PACKETS_NUM(_actual, _expected)
Check that the number of packets is expected
#define DPDK_TS_RX_CHECKS
Number of attempts to receive the packets
#define DPMD_TS_ETHERTYPE_RAND
Ethertype for tests
#define DPMD_TS_PAYLOAD_LEN_DEF
Default length of payload
#define DPMD_TS_RX_ATTEMPT_WAIT_MS
Waiting times of receiving in milliseconds
#define RECEIVE_TIMEOUT_DEF
Infinitive timeout for traffic receive operation by default
#define RX_VEC_LIM
Vector RX limitation
#define TESTPMD_ARG_MAX_LEN
Maximum length of test-pmd arguments
#define TEST_DEF_ETHER_TYPE
Default Ether-Type in Ethernet header
#define TEST_DEF_GENEVE_UDP_PORT
Default UDP destination port for GENEVE protocol
#define TEST_DEF_IP_PROTO
Default IP Protocol number in IPv4/IPv6 header
#define TEST_DEF_PPPOE_PADI_CODE
Default code for PPPOE protocol (PADI packet)
#define TEST_DEF_PPPOE_TYPE
Default type for PPPOE protocol
#define TEST_DEF_PPPOE_VER
Default version for PPPOE protocol
#define TEST_DEF_PROTOCOL_TYPE
Default protocol type for GENEVE/GRE protocols
#define TEST_DEF_VXLAN_UDP_PORT
Default UDP destination port for VXLAN protocol
#define TEST_DEV_HEADER_SIZE
Maximum header size
#define TEST_END_SPECIFIC
Test suite specific part of the last action of the test main() function.
#define TEST_ENV_IUT_PORT
Name of the IUT DPDK port in the environment.
#define TEST_ETHER_ENCAP_PROTO_OPAQUE
Ethernet encapsulated protocol opaque ID
#define TEST_ETH_RSS_IPV4
RSS hash protocols
#define TEST_GET_MBUF_SEG_PTRN_PARAM(_parameter)
Obtain mbuf segmentation pattern from a string representation
Parameters:
_parameter |
The name to denote both the target variable of 'struct test_param_seg_ptrn ' type and the string parameter of interest |
#define TEST_GET_RSS_HASH_PROTOS(var_name_)
Get the value of parameter of type 'tarpc_rss_hash_protos_t'
Parameters:
var_name_ |
Name of the variable used to get the value of "var_name_" parameter (OUT) |
#define TEST_GET_VLAN_ID_PARAM(_parameter)
Obtain the value of a VLAN ID parameter
Parameters:
_parameter |
The name to denote both the target 'int' variable and the VLAN ID parameter of interest |
#define TEST_IP4_ADDR_LEN
IPv4 address length
#define TEST_IP6_ADDR_LEN
IPv6 address length
#define TEST_IP_ENCAP_PROTO_OPAQUE
IP encapsulated protocol opaque ID
#define TEST_IUT_PORT_MAC_NAME
Name of iut_port MAC
#define TEST_LINK_UP_MAX_CHECKS
The number of attempts to check link status
#define TEST_LINK_UP_WAIT_MS
The number of milliseconds to wait for link status change (link status check is done on port start and after MTU changes)
#define TEST_MAX_NB_XSTAT_NAMES
Maximum number of different names of one extended statistic
#define TEST_MAX_VLAN_ID
Maximum VLAN ID value
#define TEST_MIN_PAGE_SIZE
Minimum page size in bytes on most architectures
#define TEST_PKTMBUF_HEADROOM
Size of headroom reserved in packet mbuf.
Todo Get it from RPC server.
#define TEST_PKTS_MEMPOOL_NAME
Name of mempool for packets
#define TEST_POST_LINK_UP_TIMEOUT
A timeout which is required to elapse in certain cases after link is established before the HW becomes ready
#define TEST_RTE_ETHDEV_DEF_NB_RX_DESCS
Default number of Rx descriptors to be taken into account when mempool is sized if driver does not provide the minimum.
It matches RTE_ETH_DEV_FALLBACK_RX_RINGSIZE.
#define TEST_RTE_MEMPOOL_DATA_ROOM_OVERHEAD
Overhead of RTE mbuf data buffer sufficient to cover unused part of the buffer
#define TEST_RTE_MEMPOOL_DEF_CACHE
Default cache size of RTE mempool to be used by tests (TEST_RTE_MEMPOOL_DEF_SIZE % TEST_RTE_MEMPOOL_DEF_CACHE = 0)
#define TEST_RTE_MEMPOOL_DEF_DATA_ROOM
Default size of RTE mbuf data buffer, including RTE_PKTMBUF_HEADROOM
#define TEST_RTE_MEMPOOL_DEF_EXTRA
Extra elements in default RTE mempool for Tx mbufs.
Tests which allocate more mbufs for Tx should care about mempool size itself.
#define TEST_RTE_MEMPOOL_DEF_PRIV_SIZE
Default size of RTE mbuf private area
#define TEST_RTE_MEMPOOL_DEF_SIZE
Default number of elements in RTE mempool to be used by tests
#define TEST_RX_PKTS_WAIT_MAX_MS
Maximum timeout on packet reception
#define TEST_RX_UNEXP_PKTS_GUARD_TIMEOUT_MS
Guard timeout to make sure that no unexpected packets arrive
#define TEST_START_SPECIFIC
Test suite specific the first actions of the test.
#define TEST_START_VARS
Test suite specific variables of the test main() function.
#define TEST_STATS_UPDATE_WAIT_MS
The number of milliseconds to wait for statistics update
#define TEST_TUNNEL_UDP_PORT_AWAIT_MC_REBOOT_MS
The number of milliseconds to wait for MC REBOOT after adding/deleting the tunnel UDP port
#define TEST_TUNNEL_UDP_PORT_MAX_CHECKS
The number of attempts to configure tunnel UDP port
#define TEST_TUNNEL_UDP_PORT_WAIT_MS
The number of milliseconds to wait on each attempt of tunnel UDP port configuration