NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
flow_encrypt.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2023 NVIDIA CORPORATION AND AFFILIATES. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without modification, are permitted
5  * provided that the following conditions are met:
6  * * Redistributions of source code must retain the above copyright notice, this list of
7  * conditions and the following disclaimer.
8  * * Redistributions in binary form must reproduce the above copyright notice, this list of
9  * conditions and the following disclaimer in the documentation and/or other materials
10  * provided with the distribution.
11  * * Neither the name of the NVIDIA CORPORATION nor the names of its contributors may be used
12  * to endorse or promote products derived from this software without specific prior written
13  * permission.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
16  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
17  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NVIDIA CORPORATION BE LIABLE
18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
19  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
20  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
21  * STRICT LIABILITY, OR TOR (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23  *
24  */
25 
26 #ifndef FLOW_ENCRYPT_H_
27 #define FLOW_ENCRYPT_H_
28 
29 #include <rte_hash.h>
30 
31 #include "flow_common.h"
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 /*
38  * Add encryption entry to the encrypt pipes:
39  * - 5 tuple rule in the TCP / UDP pipe with specific set meta data value (shared obj ID)
40  * - specific meta data match on encryption pipe (shared obj ID) with shared object ID in actions
41  *
42  * @rule [in]: rule to insert for encryption
43  * @rule_id [in]: rule id for shared obj ID
44  * @ports [in]: array of ports
45  * @app_cfg [in]: application configuration struct
46  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
47  */
49  int rule_id,
52 
53 /*
54  * Add encryption entries to the encrypt pipes:
55  * - 5 tuple rule in the TCP / UDP pipe with specific set meta data value (shared obj ID)
56  * - specific meta data match on encryption pipe (shared obj ID) with shared object ID in actions
57  *
58  * @app_cfg [in]: application configuration struct
59  * @ports [in]: ports map
60  * @queue_id [in]: queue id
61  * @nb_rules [in]: number of encryption rules
62  * @rule_offset [in]: offset of the rule in the rules array
63  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
64  */
67  uint16_t queue_id,
68  int nb_rules,
69  int rule_offset);
70 
71 /*
72  * Create encrypt pipe and entries according to the parsed rules
73  *
74  * @ports [in]: array of struct ipsec_security_gw_ports_map
75  * @app_cfg [in]: application configuration structure
76  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
77  */
80 
81 /*
82  * Create encrypt egress pipes
83  *
84  * @ports [in]: array of struct ipsec_security_gw_ports_map
85  * @app_cfg [in]: application configuration structure
86  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
87  */
90 
91 /*
92  * Handling the new received packet - print packet source IP and send them to tx queues of second port
93  *
94  * @packet [in]: packet to parse
95  * @ctx [in]: core context struct
96  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
97  */
99 
100 /*
101  * Bind encrypt IDs to the secure port
102  *
103  * @nb_rules [in]: number of decrypt rules
104  * @port [in]: secure port pointer
105  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
106  */
107 doca_error_t bind_encrypt_ids(int nb_rules, struct doca_flow_port *port);
108 
109 #ifdef __cplusplus
110 } /* extern "C" */
111 #endif
112 
113 #endif /* FLOW_ENCRYPT_H_ */
uint32_t rule_id
Definition: flow_common.h:8
doca_error_t ipsec_security_gw_create_encrypt_egress(struct ipsec_security_gw_ports_map *ports[], struct ipsec_security_gw_config *app_cfg)
doca_error_t bind_encrypt_ids(int nb_rules, struct doca_flow_port *port)
doca_error_t ipsec_security_gw_insert_encrypt_rules(struct ipsec_security_gw_ports_map *ports[], struct ipsec_security_gw_config *app_cfg)
doca_error_t add_encrypt_entry(struct encrypt_rule *rule, int rule_id, struct ipsec_security_gw_ports_map **ports, struct ipsec_security_gw_config *app_cfg)
doca_error_t add_encrypt_entries(struct ipsec_security_gw_config *app_cfg, struct ipsec_security_gw_ports_map *ports[], uint16_t queue_id, int nb_rules, int rule_offset)
doca_error_t handle_unsecured_packets_received(struct rte_mbuf **packet, struct ipsec_security_gw_core_ctx *ctx)
static struct app_gpu_cfg app_cfg
enum doca_error doca_error_t
DOCA API return codes.
uint16_t queue_id
Definition: ip_frag_dp.c:1
static struct doca_flow_port * ports[FLOW_SWITCH_PORTS_MAX]
Definition: switch_core.c:42
struct upf_accel_ctx * ctx