| NVIDIA DOCA SDK | Data Center on a Chip Framework Documentation |
#include <ctype.h>#include <net/if.h>#include <sys/ioctl.h>#include <fstream>#include <functional>#include <sstream>#include <json-c/json.h>#include <rte_hash_crc.h>#include <doca_argp.h>#include <doca_dev.h>#include <doca_log.h>#include <psp_gw_config.h>#include <psp_gw_params.h>#include <psp_gw_utils.h>
Go to the source code of this file.
Data Structures | |
| struct | psp_json_field_handler |
Typedefs | |
| using | psp_parse_json_object_cb = std::function< doca_error_t(json_object *, psp_gw_app_config *, std::vector< void * > &)> |
| using | psp_json_field_handlers = std::vector< psp_json_field_handler > |
Functions | |
| DOCA_LOG_REGISTER (PSP_Gateway_Params) | |
| static doca_error_t | create_ip6_table (psp_gw_app_config *app_config) |
| static doca_error_t | handle_pci_addr_param (void *param, void *config) |
| Configures the dst-mac to apply on decap. More... | |
| static doca_error_t | handle_repr_param (void *param, void *config) |
| Configures the device representors parameter. More... | |
| static doca_error_t | handle_core_mask_param (void *param, void *config) |
| Configures the DPDK eal_init core mask parameter. More... | |
| static doca_error_t | handle_decap_dmac_param (void *param, void *config) |
| Configures the dst-mac to apply on decap. More... | |
| static doca_error_t | handle_nexthop_dmac_param (void *param, void *config) |
| Configures the next-hop dst-mac to apply on encap. More... | |
| static doca_error_t | parse_subnet_mask (std::string &ip, uint32_t &mask_len) |
| Parses a host string with optional subnet mask suffix (i.e. /24). More... | |
| static doca_error_t | handle_vc_param (void *param, void *config) |
| Indicates the application should include the VC in the PSP tunnel header. More... | |
| static doca_error_t | handle_ingress_acl_param (void *param, void *config) |
| Indicates the application should skip ACL checks on ingress. More... | |
| static doca_error_t | handle_sample_param (void *param, void *config) |
| Configures the sampling rate of packets. More... | |
| static doca_error_t | handle_static_tunnels_param (void *param, void *config) |
| Indicates the application should create all PSP tunnels at startup. More... | |
| static doca_error_t | handle_max_tunnels_param (void *param, void *config) |
| Configures the max number of tunnels to be supported. More... | |
| static doca_error_t | handle_psp_crypt_offset_param (void *param, void *config) |
| Configures the PSP crypt-offset. More... | |
| static doca_error_t | handle_psp_version_param (void *param, void *config) |
| Configures the PSP version to use for outgoing connections. More... | |
| static doca_error_t | handle_debug_keys_param (void *param, void *config) |
| Indicates the application should log all encryption keys. More... | |
| static doca_error_t | handle_vf_name_param (void *param, void *config) |
| Indicates the name of the netdev used as the unsecured port. More... | |
| static doca_error_t | handle_stats_print_param (void *param, void *config) |
| Indicates whether statistics should be printed. More... | |
| static void | get_supported_perf_types (std::string &supported_types) |
| Returns supported perf types as a string. More... | |
| static doca_error_t | handle_perf_print_param (void *param, void *config) |
| Indicates what performance printing should be enabled. More... | |
| static doca_error_t | handle_show_rss_rx_packets_param (void *param, void *config) |
| Indicates the application should log all received packets to RSS. More... | |
| static doca_error_t | handle_maintain_order_param (void *param, void *config) |
| Indicates if the application should maintain the order of original packets. More... | |
| static doca_error_t | handle_outer_param (void *param, void *config) |
| Handle outer IP type param. More... | |
| static doca_error_t | handle_inner_param (void *param, void *config) |
| Handle inner IP type param. More... | |
| static doca_error_t | handle_mode_param (void *param, void *config) |
| Handle the mode param. More... | |
| static doca_error_t | handle_config_file_param (void *param, void *config) |
| Configures the JSON config file path. More... | |
| static doca_error_t | json_object_ver_get_string (json_object *json_obj, std::string &value) |
| Verifies and extracts the string from the json object. More... | |
| static doca_error_t | json_object_ver_array_length (json_object *json_obj, int &length) |
| Verifies and extracts the array length from the json object. More... | |
| static doca_error_t | handle_json_level_fields (psp_json_field_handlers &handlers, json_object *json_obj, psp_gw_app_config *app_config) |
| Handles a JSON object with all of its keys. More... | |
| static doca_error_t | parse_local_grpc_address (json_object *json_obj_local_addr, psp_gw_app_config *app_config, std::vector< void * > ¶ms) |
| Parse the local gRPC address. More... | |
| static doca_error_t | parse_json_config (json_object *json_obj_config, psp_gw_app_config *app_config, std::vector< void * > ¶ms) |
| Parses the remote gRPC address. More... | |
| static doca_error_t | parse_remote_grpc_address (json_object *json_obj_remote_addr, psp_gw_app_config *app_config, std::vector< void * > ¶ms) |
| Parses the remote gRPC address. More... | |
| static doca_error_t | parse_local_vip (json_object *json_obj_local_vip, psp_gw_app_config *app_config, std::vector< void * > ¶ms) |
| Parses the local VIP. More... | |
| static doca_error_t | parse_remote_vips (json_object *json_obj_remote_vips, psp_gw_app_config *app_config, std::vector< void * > ¶ms) |
| Parses the remote VIPs. More... | |
| static doca_error_t | parse_sessions (json_object *json_obj_sessions, psp_gw_app_config *app_config, std::vector< void * > ¶ms) |
| Parses the sessions. More... | |
| static doca_error_t | parse_json_peers (json_object *json_obj_peers, psp_gw_app_config *app_config, std::vector< void * > ¶ms) |
| Parses the peers. More... | |
| doca_error_t | psp_gw_parse_config_file (psp_gw_app_config *app_config) |
| Parses the configuration JSON file that was passed to the application. More... | |
| static doca_error_t | psp_gw_register_single_param (const char *short_name, const char *long_name, const char *description, doca_argp_param_cb_t cb, enum doca_argp_type arg_type, bool required, bool accept_multiple) |
| Utility function to create a single argp parameter. More... | |
| static doca_error_t | psp_gw_register_params (void) |
| Registers command-line arguments to the application. More... | |
| doca_error_t | psp_gw_argp_exec (int &argc, char *argv[], psp_gw_app_config *app_config) |
| Parses command-line arguments to the application. More... | |
Variables | |
| doca_flow_ip_addr | interface_vf_addr |
| using psp_json_field_handlers = std::vector<psp_json_field_handler> |
Definition at line 75 of file psp_gw_params.cpp.
| using psp_parse_json_object_cb = std::function<doca_error_t(json_object *, psp_gw_app_config *, std::vector<void *> &)> |
Definition at line 51 of file psp_gw_params.cpp.
|
static |
Definition at line 83 of file psp_gw_params.cpp.
| DOCA_LOG_REGISTER | ( | PSP_Gateway_Params | ) |
|
static |
Returns supported perf types as a string.
@supported_types [out]: string to store supported types
Definition at line 489 of file psp_gw_params.cpp.
|
static |
Configures the JSON config file path.
| [in] |
Definition at line 649 of file psp_gw_params.cpp.
|
static |
Configures the DPDK eal_init core mask parameter.
| [in] |
Definition at line 151 of file psp_gw_params.cpp.
|
static |
Indicates the application should log all encryption keys.
| [in] |
Definition at line 397 of file psp_gw_params.cpp.
|
static |
Configures the dst-mac to apply on decap.
| [in] |
Definition at line 168 of file psp_gw_params.cpp.
|
static |
Indicates the application should skip ACL checks on ingress.
| [in] |
Definition at line 276 of file psp_gw_params.cpp.
|
static |
|
static |
Handles a JSON object with all of its keys.
@handlers [in]: JSON handlers (expected keys and handlers) @json_obj [in]: JSON object @app_config [in/out]: Application config
Definition at line 713 of file psp_gw_params.cpp.
|
static |
Indicates if the application should maintain the order of original packets.
| [in] |
Definition at line 552 of file psp_gw_params.cpp.
|
static |
Configures the max number of tunnels to be supported.
| [in] |
Definition at line 326 of file psp_gw_params.cpp.
|
static |
|
static |
Configures the next-hop dst-mac to apply on encap.
| [in] |
Definition at line 194 of file psp_gw_params.cpp.
|
static |
|
static |
Configures the dst-mac to apply on decap.
| [in] |
Definition at line 107 of file psp_gw_params.cpp.
|
static |
Indicates what performance printing should be enabled.
| [in] |
Definition at line 505 of file psp_gw_params.cpp.
|
static |
Configures the PSP crypt-offset.
The offset determines the number of words (4-byte chunks) in the packet header that will be transmitted as cleartext.
| [in] |
Definition at line 353 of file psp_gw_params.cpp.
|
static |
Configures the PSP version to use for outgoing connections.
| [in] |
Definition at line 375 of file psp_gw_params.cpp.
|
static |
Configures the device representors parameter.
| [in] |
Definition at line 134 of file psp_gw_params.cpp.
|
static |
Configures the sampling rate of packets.
| [in] |
Definition at line 292 of file psp_gw_params.cpp.
|
static |
Indicates the application should log all received packets to RSS.
| [in] |
Definition at line 533 of file psp_gw_params.cpp.
|
static |
Indicates the application should create all PSP tunnels at startup.
| [in] |
Definition at line 308 of file psp_gw_params.cpp.
|
static |
Indicates whether statistics should be printed.
| [in] |
Definition at line 475 of file psp_gw_params.cpp.
|
static |
Indicates the application should include the VC in the PSP tunnel header.
| [in] |
Definition at line 260 of file psp_gw_params.cpp.
|
static |
Indicates the name of the netdev used as the unsecured port.
The MAC and IP addresses will be derived from this interface.
| [in] |
Definition at line 417 of file psp_gw_params.cpp.
|
static |
Verifies and extracts the array length from the json object.
@NOTE: Does not return the array itself, only the length.
@json_obj [in]: json object @length [out]: array length to extract
Definition at line 695 of file psp_gw_params.cpp.
|
static |
Verifies and extracts the string from the json object.
@json_obj [in]: json object @value [out]: string value to extract
Definition at line 676 of file psp_gw_params.cpp.
|
static |
Parses the remote gRPC address.
@json_obj_config [in]: JSON object @app_config [in/out]: Application config @params [in/out]: Custom data to pass to the handler
Definition at line 810 of file psp_gw_params.cpp.
|
static |
Parses the peers.
@json_obj_peers [in]: JSON object @app_config [in/out]: Application config @params [in/out]: Custom data to pass to the handler
Definition at line 1051 of file psp_gw_params.cpp.
|
static |
Parse the local gRPC address.
@json_obj_local_addr [in]: JSON object @app_config [in/out]: Application config @params [in/out]: Custom data to pass to the handler
Definition at line 765 of file psp_gw_params.cpp.
|
static |
Parses the local VIP.
@json_obj_local_vip [in]: JSON object @app_config [in/out]: Application config @params [in/out]: Custom data to pass to the handler
Definition at line 861 of file psp_gw_params.cpp.
|
static |
Parses the remote gRPC address.
@json_obj_remote_addr [in]: JSON object @app_config [in/out]: Application config @params [in/out]: Custom data to pass to the handler
Definition at line 835 of file psp_gw_params.cpp.
|
static |
Parses the remote VIPs.
@json_obj_remote_vips [in]: JSON object @app_config [in/out]: Application config @params [in/out]: Custom data to pass to the handler
Definition at line 890 of file psp_gw_params.cpp.
|
static |
Parses the sessions.
@json_obj_sessions [in]: JSON object @app_config [in/out]: Application config @params [in/out]: Custom data to pass to the handler
Definition at line 993 of file psp_gw_params.cpp.
|
static |
Parses a host string with optional subnet mask suffix (i.e. /24).
@ip [in/out]: host string, returned with subnet mask suffix removed (and applied) @mask_len [out]: the subnet mask length if one was found; 32 (single host) otherwise
Definition at line 217 of file psp_gw_params.cpp.
| doca_error_t psp_gw_argp_exec | ( | int & | argc, |
| char * | argv[], | ||
| psp_gw_app_config * | app_config | ||
| ) |
Parses command-line arguments to the application.
During processing of arguments, both DPDK and the application may remove arguments from argv, and argc will reflect the new size.
@argc [in/out]: The number of args passed to main() @argv [in/out]: The args passed to main @app_config [out]: The configuration of the application
Definition at line 1425 of file psp_gw_params.cpp.
| doca_error_t psp_gw_parse_config_file | ( | psp_gw_app_config * | app_config | ) |
Parses the configuration JSON file that was passed to the application.
@app_config [in/out]: The configuration of the application
Definition at line 1094 of file psp_gw_params.cpp.
|
static |
Registers command-line arguments to the application.
Definition at line 1200 of file psp_gw_params.cpp.
|
static |
Utility function to create a single argp parameter.
@short_name [in]: The single-letter command-line flag @long_name [in]: The spelled-out command-line flag @description [in]: Describes the option @cb [in]: Called when the option is parsed @arg_type [in]: How the option string should be parsed @required [in]: Whether the program should terminate if the option is omitted @accept_multiple [in]: Whether the program should accept multiple instances of the option
Definition at line 1156 of file psp_gw_params.cpp.
| doca_flow_ip_addr interface_vf_addr |
Definition at line 48 of file psp_gw_params.cpp.