NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
flow_decrypt.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_DECRYPT_H_
27 #define FLOW_DECRYPT_H_
28 
29 #include "flow_common.h"
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 /*
36  * Add decryption entries to the decrypt pipe
37  *
38  * @app_cfg [in]: application configuration struct
39  * @port [in]: port of the entries
40  * @queue_id [in]: queue id to insert the entries
41  * @nb_rules [in]: number of rules to insert
42  * @rule_offset [in]: offset of the rules in the rules array
43  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
44  */
46  struct ipsec_security_gw_ports_map *port,
47  uint16_t queue_id,
48  int nb_rules,
49  int rule_offset);
50 
51 /*
52  * Add decryption entry to the decrypt pipe
53  *
54  * @rule [in]: rule to insert for decryption
55  * @rule_id [in]: rule id for crypto shared index
56  * @port [in]: port of the entries
57  * @app_cfg [in]: application configuration struct
58  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
59  */
61  int rule_id,
62  struct doca_flow_port *port,
64 
65 /*
66  * Create decrypt pipe and entries according to the parsed rules
67  *
68  * @ports [in]: array of struct ipsec_security_gw_ports_map
69  * @app_cfg [in]: application configuration structure
70  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
71  */
74 
75 /*
76  * Handling the new received packets - decap packet and send them to tx queues of second port
77  *
78  * @packet [in]: packet to process
79  * @bad_syndrome_check [in]: true if need to check bad syndrome in packet meta
80  * @ctx [in]: core context struct
81  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
82  */
83 doca_error_t handle_secured_packets_received(struct rte_mbuf **packet,
84  bool bad_syndrome_check,
86 
87 /*
88  * Bind decrypt IDs to the secure port
89  *
90  * @nb_rules [in]: number of decrypt rules
91  * @initial_id [in]: initial ID for the decrypt IDs (number of encrypt IDs)
92  * @port [in]: secure port pointer
93  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
94  */
95 doca_error_t bind_decrypt_ids(int nb_rules, int initial_id, struct doca_flow_port *port);
96 #ifdef __cplusplus
97 } /* extern "C" */
98 #endif
99 
100 #endif /* FLOW_DECRYPT_H_ */
uint32_t rule_id
Definition: flow_common.h:8
doca_error_t ipsec_security_gw_insert_decrypt_rules(struct ipsec_security_gw_ports_map *ports[], struct ipsec_security_gw_config *app_cfg)
doca_error_t bind_decrypt_ids(int nb_rules, int initial_id, struct doca_flow_port *port)
doca_error_t handle_secured_packets_received(struct rte_mbuf **packet, bool bad_syndrome_check, struct ipsec_security_gw_core_ctx *ctx)
doca_error_t add_decrypt_entries(struct ipsec_security_gw_config *app_cfg, struct ipsec_security_gw_ports_map *port, uint16_t queue_id, int nb_rules, int rule_offset)
doca_error_t add_decrypt_entry(struct decrypt_rule *rule, int rule_id, struct doca_flow_port *port, struct ipsec_security_gw_config *app_cfg)
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