NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
ipsec_security_gw.c File Reference
#include <signal.h>
#include <fcntl.h>
#include <rte_ethdev.h>
#include <doca_argp.h>
#include <doca_flow_tune_server.h>
#include <doca_log.h>
#include <doca_pe.h>
#include <doca_dev.h>
#include <dpdk_utils.h>
#include <pack.h>
#include "config.h"
#include "flow_common.h"
#include "flow_decrypt.h"
#include "flow_encrypt.h"
#include "ipsec_ctx.h"
#include "policy.h"
Include dependency graph for ipsec_security_gw.c:

Go to the source code of this file.

Data Structures

struct  multi_thread_insertion_ctx
 

Macros

#define DEFAULT_NB_CORES   4 /* Default number of running cores */
 
#define PACKET_BURST   32 /* The number of packets in the rx queue */
 
#define NB_TX_BURST_TRIES   5 /* Number of tries for sending batch of packets */
 
#define MIN_ENTRIES_PER_CORE   1024 /* Minimum number of entries per core */
 
#define MAC_ADDRESS_SIZE   6 /* Size of mac address */
 

Functions

 DOCA_LOG_REGISTER (IPSEC_SECURITY_GW)
 
static void signal_handler (int signum)
 
static bool query_pipe_info (struct security_gateway_pipe_info *pipe)
 
static void query_bad_syndrome (struct decrypt_rule *decrypt_rule)
 
static void query_encrypt_pipes (struct ipsec_security_gw_config *app_cfg)
 
static void query_decrypt_pipes (struct ipsec_security_gw_config *app_cfg)
 
static void process_syndrome_packets (void *args)
 
static bool is_fwd_syndrome_rss (struct ipsec_security_gw_config *app_cfg)
 
static void handle_packets_received (uint16_t port_id, uint16_t nb_packets, struct rte_mbuf **packets, struct ipsec_security_gw_core_ctx *ctx, uint16_t *nb_processed_packets, struct rte_mbuf **processed_packets, struct rte_mbuf **unprocessed_packets)
 
static void process_queue_packets (void *args)
 
static doca_error_t ipsec_security_gw_process_bad_packets (struct ipsec_security_gw_config *config, struct ipsec_security_gw_ports_map *ports[])
 
static doca_error_t ipsec_security_gw_process_packets (struct ipsec_security_gw_config *config, struct ipsec_security_gw_ports_map *ports[])
 
static doca_error_t unpack_policy_buffer (uint8_t *buf, uint32_t nb_bytes, struct ipsec_security_gw_ipsec_policy *policy)
 
static doca_error_t fill_buffer_from_socket (int fd, size_t bytes_to_read, uint8_t *buf)
 
static doca_error_t read_message_length (struct ipsec_security_gw_config *app_cfg, uint32_t *length)
 
static doca_error_t read_message_from_socket (struct ipsec_security_gw_config *app_cfg, struct ipsec_security_gw_ipsec_policy *policy)
 
static void sw_handling_sn_inc (struct ipsec_security_gw_config *app_cfg, struct encrypt_rule *encrypt_rules, int encrypt_array_size)
 
static void sw_handling_antireplay (struct ipsec_security_gw_config *app_cfg, struct decrypt_rule *decrypt_rules, int decrypt_array_size)
 
static doca_error_t ipsec_security_gw_wait_for_traffic (struct ipsec_security_gw_config *app_cfg, struct ipsec_security_gw_ports_map *ports[])
 
static doca_error_t create_policy_socket (struct ipsec_security_gw_config *app_cfg)
 
static void rule_inserter_worker (void *args)
 
static bool is_insertion_rate (struct ipsec_security_gw_config *app_cfg)
 
static doca_error_t run_multithread_insertion (struct ipsec_security_gw_config *app_cfg, struct ipsec_security_gw_ports_map *ports[], int nb_queues)
 
int main (int argc, char **argv)
 

Variables

static bool force_quit
 
static char * syndrome_list [NUM_OF_SYNDROMES]
 

Macro Definition Documentation

◆ DEFAULT_NB_CORES

#define DEFAULT_NB_CORES   4 /* Default number of running cores */

Definition at line 48 of file ipsec_security_gw.c.

◆ MAC_ADDRESS_SIZE

#define MAC_ADDRESS_SIZE   6 /* Size of mac address */

Definition at line 52 of file ipsec_security_gw.c.

◆ MIN_ENTRIES_PER_CORE

#define MIN_ENTRIES_PER_CORE   1024 /* Minimum number of entries per core */

Definition at line 51 of file ipsec_security_gw.c.

◆ NB_TX_BURST_TRIES

#define NB_TX_BURST_TRIES   5 /* Number of tries for sending batch of packets */

Definition at line 50 of file ipsec_security_gw.c.

◆ PACKET_BURST

#define PACKET_BURST   32 /* The number of packets in the rx queue */

Definition at line 49 of file ipsec_security_gw.c.

Function Documentation

◆ create_policy_socket()

static doca_error_t create_policy_socket ( struct ipsec_security_gw_config app_cfg)
static

Definition at line 779 of file ipsec_security_gw.c.

◆ DOCA_LOG_REGISTER()

DOCA_LOG_REGISTER ( IPSEC_SECURITY_GW  )

◆ fill_buffer_from_socket()

static doca_error_t fill_buffer_from_socket ( int  fd,
size_t  bytes_to_read,
uint8_t *  buf 
)
static

Definition at line 499 of file ipsec_security_gw.c.

◆ handle_packets_received()

static void handle_packets_received ( uint16_t  port_id,
uint16_t  nb_packets,
struct rte_mbuf **  packets,
struct ipsec_security_gw_core_ctx ctx,
uint16_t *  nb_processed_packets,
struct rte_mbuf **  processed_packets,
struct rte_mbuf **  unprocessed_packets 
)
static

Definition at line 257 of file ipsec_security_gw.c.

◆ ipsec_security_gw_process_bad_packets()

static doca_error_t ipsec_security_gw_process_bad_packets ( struct ipsec_security_gw_config config,
struct ipsec_security_gw_ports_map ports[] 
)
static

Definition at line 371 of file ipsec_security_gw.c.

◆ ipsec_security_gw_process_packets()

static doca_error_t ipsec_security_gw_process_packets ( struct ipsec_security_gw_config config,
struct ipsec_security_gw_ports_map ports[] 
)
static

Definition at line 407 of file ipsec_security_gw.c.

◆ ipsec_security_gw_wait_for_traffic()

static doca_error_t ipsec_security_gw_wait_for_traffic ( struct ipsec_security_gw_config app_cfg,
struct ipsec_security_gw_ports_map ports[] 
)
static

Definition at line 624 of file ipsec_security_gw.c.

◆ is_fwd_syndrome_rss()

static bool is_fwd_syndrome_rss ( struct ipsec_security_gw_config app_cfg)
inlinestatic

Definition at line 241 of file ipsec_security_gw.c.

◆ is_insertion_rate()

static bool is_insertion_rate ( struct ipsec_security_gw_config app_cfg)
inlinestatic

Definition at line 907 of file ipsec_security_gw.c.

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 1035 of file ipsec_security_gw.c.

◆ process_queue_packets()

static void process_queue_packets ( void *  args)
static

Definition at line 304 of file ipsec_security_gw.c.

◆ process_syndrome_packets()

static void process_syndrome_packets ( void *  args)
static

Definition at line 208 of file ipsec_security_gw.c.

◆ query_bad_syndrome()

static void query_bad_syndrome ( struct decrypt_rule decrypt_rule)
static

Definition at line 123 of file ipsec_security_gw.c.

◆ query_decrypt_pipes()

static void query_decrypt_pipes ( struct ipsec_security_gw_config app_cfg)
static

Definition at line 189 of file ipsec_security_gw.c.

◆ query_encrypt_pipes()

static void query_encrypt_pipes ( struct ipsec_security_gw_config app_cfg)
static

Definition at line 162 of file ipsec_security_gw.c.

◆ query_pipe_info()

static bool query_pipe_info ( struct security_gateway_pipe_info pipe)
static

Definition at line 90 of file ipsec_security_gw.c.

◆ read_message_from_socket()

static doca_error_t read_message_from_socket ( struct ipsec_security_gw_config app_cfg,
struct ipsec_security_gw_ipsec_policy policy 
)
static

Definition at line 560 of file ipsec_security_gw.c.

◆ read_message_length()

static doca_error_t read_message_length ( struct ipsec_security_gw_config app_cfg,
uint32_t *  length 
)
static

Definition at line 529 of file ipsec_security_gw.c.

◆ rule_inserter_worker()

static void rule_inserter_worker ( void *  args)
static

Definition at line 865 of file ipsec_security_gw.c.

◆ run_multithread_insertion()

static doca_error_t run_multithread_insertion ( struct ipsec_security_gw_config app_cfg,
struct ipsec_security_gw_ports_map ports[],
int  nb_queues 
)
static

Definition at line 921 of file ipsec_security_gw.c.

◆ signal_handler()

static void signal_handler ( int  signum)
static

Definition at line 76 of file ipsec_security_gw.c.

◆ sw_handling_antireplay()

static void sw_handling_antireplay ( struct ipsec_security_gw_config app_cfg,
struct decrypt_rule decrypt_rules,
int  decrypt_array_size 
)
static

Definition at line 603 of file ipsec_security_gw.c.

◆ sw_handling_sn_inc()

static void sw_handling_sn_inc ( struct ipsec_security_gw_config app_cfg,
struct encrypt_rule encrypt_rules,
int  encrypt_array_size 
)
static

Definition at line 585 of file ipsec_security_gw.c.

◆ unpack_policy_buffer()

static doca_error_t unpack_policy_buffer ( uint8_t *  buf,
uint32_t  nb_bytes,
struct ipsec_security_gw_ipsec_policy policy 
)
static

Definition at line 460 of file ipsec_security_gw.c.

Variable Documentation

◆ force_quit

bool force_quit
static

Definition at line 65 of file ipsec_security_gw.c.

◆ syndrome_list

char* syndrome_list[NUM_OF_SYNDROMES]
static
Initial value:
= {"Authentication failed",
"Trailer length exceeded ESP payload",
"Replay protection failed",
"IPsec offload context reached its hard lifetime threshold"}

Definition at line 66 of file ipsec_security_gw.c.