PCI devices configuration of Test Agents

Overview

// typedefs

typedef enum tapi_cfg_ovs_cfg_type tapi_cfg_ovs_cfg_type;
typedef struct tapi_cfg_ovs_cfg tapi_cfg_ovs_cfg;

// enums

enum tapi_cfg_ovs_cfg_type;

// structs

struct tapi_cfg_ovs_cfg;

// global variables

const char*const tapi_cfg_ovs_cfg_name[];

// global functions

te_errno tapi_cfg_ovs_convert_eal_args(int argc, const char*const* argv, tapi_cfg_ovs_cfg* ovs_cfg);
te_errno tapi_cfg_ovs_default_bridge(const char* ta, char** bridge);
te_errno tapi_cfg_ovs_clear_rules(const char* ta, const char* bridge);
te_errno tapi_cfg_ovs_add_rule(const char* ta, const char* bridge, uint64_t* cookie, const char* fmt, ...);
te_errno tapi_cfg_ovs_flow_rule_get(const char* ta, const char* bridge, uint64_t cookie, ovs_flow_rule* rule);
te_errno tapi_cfg_ovs_del_rule(const char* ta, const char* bridge, uint64_t cookie);

Detailed Documentation

Typedefs

typedef enum tapi_cfg_ovs_cfg_type tapi_cfg_ovs_cfg_type

Configuration entry type, see tapi_cfg_ovs_cfg_name for details

typedef struct tapi_cfg_ovs_cfg tapi_cfg_ovs_cfg

Open vSwitch Configuration entry array

Global Variables

const char*const tapi_cfg_ovs_cfg_name[]

Configuration entry name. Names correspond to Open vSwitch configuration entries.

Global Functions

te_errno tapi_cfg_ovs_convert_eal_args(int argc, const char*const* argv, tapi_cfg_ovs_cfg* ovs_cfg)

Convert raw DPDK EAL arguments into Open vSwitch configuration entries.

Parameters:

argc

Number of arguments

argv

EAL arguments

ovs_cfg

Open vSwitch configuraion

Returns:

Status code

te_errno tapi_cfg_ovs_default_bridge(const char* ta, char** bridge)

Find the name of the OvS bridge that’s running on the given agent. This function assumes there is only one bridge. The memory for the name is allocated by this function and needs to be freed by the user.

Parameters:

ta

Test Agent name.

bridge

Where the bridge name should be stored.

Returns:

Status code.

te_errno tapi_cfg_ovs_clear_rules(const char* ta, const char* bridge)

Remove all flow rules from the given OvS bridge. Only flow rules that are visible to TE will be removed, all hidden flows will still be present after this function is called.

Parameters:

ta

Test Agent name.

bridge

Bridge name. If NULL, use default bridge.

Returns:

Status code.

te_errno tapi_cfg_ovs_add_rule(const char* ta, const char* bridge, uint64_t* cookie, const char* fmt, ...)

Add a flow rule to the given OvS bridge. Flow cookie will be generated by the function and may be used by the user to refer to the rule later.

Parameters:

ta

Test Agent name.

bridge

Bridge name. If NULL, use default bridge.

cookie

Where to store the new flow’s cookie.

fmt

Format string that defines the flow rule.

Additional arguments for the format string.

Returns:

Status code.

te_errno tapi_cfg_ovs_flow_rule_get(const char* ta, const char* bridge, uint64_t cookie, ovs_flow_rule* rule)

Get the descriptor structure for the flow rule defined by the given Open vSwitch bridge and cookie.

Parameters:

ta

Test Agent name.

bridge

Bridge name. If NULL, use default bridge.

cookie

Flow cookie.

rule

Flow rule descriptor structure.

Returns:

Status code.

te_errno tapi_cfg_ovs_del_rule(const char* ta, const char* bridge, uint64_t cookie)

Remove a flow rule from the given OvS bridge.

Parameters:

ta

Test Agent name.

bridge

Bridge name. If NULL, use default bridge.

cookie

Cookie of the flow to be removed.

Returns:

Status code.