25 #include <rte_ethdev.h>
38 #define ENCAP_DST_IP_IDX_IP4 30
39 #define ENCAP_DST_IP_IDX_IP6 38
40 #define ENCAP_IP_ID_IDX_IP4 18
41 #define ENCAP_IDX_SRC_MAC 6
42 #define ENCAP_DST_UDP_PORT_IDX 2
43 #define ENCAP_ESP_SPI_IDX_TUNNEL_IP4 34
44 #define ENCAP_ESP_SPI_IDX_TUNNEL_IP6 54
45 #define ENCAP_ESP_SPI_IDX_TRANSPORT 0
46 #define ENCAP_ESP_SPI_IDX_UDP_TRANSPORT 8
47 #define ENCAP_ESP_SN_IDX_TUNNEL_IP4 38
48 #define ENCAP_ESP_SN_IDX_TUNNEL_IP6 58
49 #define ENCAP_ESP_SN_IDX_TRANSPORT 4
50 #define ENCAP_ESP_SN_IDX_UDP_TRANSPORT 12
52 #define ENCAP_MARKER_HEADER_SIZE 8
53 #define PADDING_ALIGN 4
85 uint8_t *reformat_data,
86 uint16_t *reformat_data_sz)
88 uint8_t reformat_encap_data[16] = {
112 if (sw_sn_inc ==
true) {
119 memcpy(reformat_data, reformat_encap_data,
sizeof(reformat_encap_data));
120 *reformat_data_sz =
sizeof(reformat_encap_data);
133 uint8_t *reformat_data,
134 uint16_t *reformat_data_sz)
136 uint16_t udp_dst_port = 4500;
137 uint8_t reformat_encap_data[24] = {
138 0x30, 0x39, 0x00, 0x00,
139 0x00, 0xa4, 0x00, 0x00,
140 0x00, 0x00, 0x00, 0x00,
141 0x00, 0x00, 0x00, 0x00,
142 0x00, 0x00, 0x00, 0x00,
143 0x00, 0x00, 0x00, 0x00,
154 if (sw_sn_inc ==
true) {
161 memcpy(reformat_data, reformat_encap_data,
sizeof(reformat_encap_data));
162 *reformat_data_sz =
sizeof(reformat_encap_data);
177 uint8_t *reformat_data,
178 uint16_t *reformat_data_sz)
180 uint8_t reformat_encap_data[50] = {
181 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff,
182 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
184 0x45, 0x00, 0x00, 0x00, 0x00, 0x00,
185 0x00, 0x00, 0x00, 0x32, 0x00, 0x00,
186 0x02, 0x02, 0x02, 0x02,
187 0x00, 0x00, 0x00, 0x00,
188 0x00, 0x00, 0x00, 0x00,
189 0x00, 0x00, 0x00, 0x00,
190 0x00, 0x00, 0x00, 0x00,
191 0x00, 0x00, 0x00, 0x00,
216 if (sw_sn_inc ==
true) {
223 memcpy(reformat_data, reformat_encap_data,
sizeof(reformat_encap_data));
224 *reformat_data_sz =
sizeof(reformat_encap_data);
239 uint8_t *reformat_data,
240 uint16_t *reformat_data_sz)
242 uint8_t reformat_encap_data[70] = {
243 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff,
244 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
246 0x60, 0x00, 0x00, 0x00,
247 0x00, 0x00, 0x32, 0x40,
248 0x02, 0x02, 0x02, 0x02,
249 0x02, 0x02, 0x02, 0x02,
250 0x02, 0x02, 0x02, 0x02,
251 0x02, 0x02, 0x02, 0x02,
252 0x01, 0x01, 0x01, 0x01,
253 0x01, 0x01, 0x01, 0x01,
254 0x01, 0x01, 0x01, 0x01,
255 0x01, 0x01, 0x01, 0x01,
256 0x00, 0x00, 0x00, 0x00,
257 0x00, 0x00, 0x00, 0x00,
258 0x00, 0x00, 0x00, 0x00,
259 0x00, 0x00, 0x00, 0x00,
292 if (sw_sn_inc ==
true) {
299 memcpy(reformat_data, reformat_encap_data,
sizeof(reformat_encap_data));
300 *reformat_data_sz =
sizeof(reformat_encap_data);
322 struct doca_flow_pipe_cfg *pipe_cfg;
324 struct doca_flow_pipe_entry **
entry =
NULL;
326 int num_of_entries = 2;
328 memset(&match, 0,
sizeof(match));
330 memset(&
fwd, 0,
sizeof(
fwd));
331 memset(&
app_cfg->secured_status[0], 0,
sizeof(
app_cfg->secured_status[0]));
443 if (
app_cfg->secured_status[0].nb_processed != num_of_entries ||
app_cfg->secured_status[0].failure)
465 int num_of_entries = 1;
468 struct doca_flow_pipe_entry **
entry =
NULL;
471 memset(&match, 0,
sizeof(match));
473 memset(&
app_cfg->secured_status[0], 0,
sizeof(
app_cfg->secured_status[0]));
513 if (
app_cfg->secured_status[0].nb_processed != num_of_entries ||
app_cfg->secured_status[0].failure)
537 struct doca_flow_pipe_cfg *pipe_cfg;
540 memset(&match, 0,
sizeof(match));
543 memset(&
fwd, 0,
sizeof(
fwd));
636 struct doca_flow_pipe_cfg *pipe_cfg;
638 struct doca_flow_pipe_entry *
entry =
NULL;
646 memset(&match, 0,
sizeof(match));
650 memset(&
fwd, 0,
sizeof(
fwd));
651 memset(&
app_cfg->secured_status[0], 0,
sizeof(
app_cfg->secured_status[0]));
661 strcpy(
pipe_info->name,
"MARKER_ENCAP_PIPE");
752 if (
app_cfg->secured_status[0].nb_processed != 1 ||
app_cfg->secured_status[0].failure)
778 int expected_entries,
789 struct doca_flow_pipe_cfg *pipe_cfg;
793 memset(&match, 0,
sizeof(match));
797 memset(&
fwd, 0,
sizeof(
fwd));
812 if (!
app_cfg->sw_sn_inc_enable) {
823 memset(actions_arr[0].crypto_encap.encap_data, 0xff, 50);
826 memset(actions_arr[1].crypto_encap.encap_data, 0xff, 70);
903 if (
app_cfg->marker_encap &&
app_cfg->encrypt_pipes.marker_insert_pipe.pipe !=
NULL) {
949 int expected_entries,
951 struct doca_flow_pipe *hairpin_pipe,
959 struct doca_flow_pipe_cfg *pipe_cfg;
962 memset(&match, 0,
sizeof(match));
964 memset(&
fwd, 0,
sizeof(
fwd));
1059 int expected_entries,
1069 struct doca_flow_pipe_cfg *pipe_cfg;
1072 memset(&match, 0,
sizeof(match));
1082 match.
meta.
u32[0] = UINT32_MAX;
1172 struct doca_flow_pipe_cfg *pipe_cfg;
1250 struct doca_flow_pipe_entry **
entry =
NULL;
1258 memset(&match, 0,
sizeof(match));
1260 memset(&
fwd, 0,
sizeof(
fwd));
1262 if (debug_mode && !is_root) {
1300 memset(&match, 0,
sizeof(match));
1333 memset(&match, 0,
sizeof(match));
1370 memset(&match, 0,
sizeof(match));
1466 memset(&
cfg, 0,
sizeof(
cfg));
1468 cfg.ipsec_sa_cfg.icv_len =
app_cfg->icv_length;
1469 cfg.ipsec_sa_cfg.salt = app_sa_attrs->
salt;
1470 cfg.ipsec_sa_cfg.implicit_iv = app_sa_attrs->
iv;
1471 cfg.ipsec_sa_cfg.key_cfg.key_type = app_sa_attrs->
key_type;
1473 cfg.ipsec_sa_cfg.sn_initial =
app_cfg->sn_initial;
1474 cfg.ipsec_sa_cfg.esn_en = app_sa_attrs->
esn_en;
1548 struct doca_flow_pipe_entry **
entry =
NULL;
1551 memset(&match, 0,
sizeof(match));
1619 struct doca_flow_pipe_entry **
entry =
NULL;
1621 memset(&match, 0,
sizeof(match));
1625 src_ip_id = rte_hash_lookup(
app_cfg->ip6_table, (
void *)&rule->
ip6.
dst_ip);
1626 if (src_ip_id < 0) {
1701 struct doca_flow_pipe_entry **
entry =
NULL;
1703 struct doca_flow_port *secured_port =
NULL;
1704 struct doca_flow_port *unsecured_port =
NULL;
1716 memset(&
app_cfg->unsecured_status[0], 0,
sizeof(
app_cfg->unsecured_status[0]));
1717 memset(&
app_cfg->secured_status[0], 0,
sizeof(
app_cfg->secured_status[0]));
1718 memset(&match, 0,
sizeof(match));
1725 encrypt_pipe = &
app_cfg->encrypt_pipes.ipv4_encrypt_pipe;
1727 encrypt_pipe = &
app_cfg->encrypt_pipes.ipv6_encrypt_pipe;
1730 encrypt_pipe = &
app_cfg->encrypt_pipes.ipv4_encrypt_pipe;
1732 encrypt_pipe = &
app_cfg->encrypt_pipes.ipv6_encrypt_pipe;
1741 &
app_cfg->unsecured_status[0]);
1752 memset(&match, 0,
sizeof(match));
1788 app_cfg->secured_status[0].entries_in_queue++;
1795 }
while (
app_cfg->secured_status[0].entries_in_queue > 0);
1802 }
while (
app_cfg->unsecured_status[0].entries_in_queue > 0);
1809 int i, array_len = nb_rules;
1810 uint32_t *res_array;
1814 res_array = (uint32_t *)malloc(array_len *
sizeof(uint32_t));
1815 if (res_array ==
NULL) {
1820 for (i = 0; i < nb_rules; i++) {
1826 DOCA_LOG_ERR(
"Failed to bind encrypt IDs to the port");
1843 struct doca_flow_pipe_entry **
entry =
NULL;
1846 struct doca_flow_port *secured_port =
NULL;
1847 struct doca_flow_port *unsecured_port =
NULL;
1864 memset(&match, 0,
sizeof(match));
1867 for (i = 0; i < nb_rules; i++) {
1901 memset(&match, 0,
sizeof(match));
1976 struct doca_flow_port *secured_port =
NULL;
1979 int expected_entries;
1981 if (
app_cfg->socket_ctx.socket_conf)
1983 else if (
app_cfg->app_rules.nb_encrypt_rules > 0)
1984 expected_entries =
app_cfg->app_rules.nb_encrypt_rules;
1998 DOCA_LOG_ERR(
"Non-ESP marker is not supported over VXLAN encapsulation");
2006 }
else if (
app_cfg->marker_encap) {
2020 &
app_cfg->encrypt_pipes.ipv4_encrypt_pipe);
2030 &
app_cfg->encrypt_pipes.ipv6_encrypt_pipe);
2034 snprintf(
app_cfg->encrypt_pipes.egress_ip_classifier.name,
MAX_NAME_LEN,
"ip_classifier");
2049 uint32_t nb_queues =
app_cfg->dpdk_config->port_config.nb_queues;
2052 struct doca_flow_port *unsecured_port =
NULL;
2057 int expected_entries;
2059 if (
app_cfg->socket_ctx.socket_conf)
2061 else if (
app_cfg->app_rules.nb_encrypt_rules > 0)
2062 expected_entries =
app_cfg->app_rules.nb_encrypt_rules;
2085 &
app_cfg->encrypt_pipes.ipv4_tcp_pipe);
2102 &
app_cfg->encrypt_pipes.ipv4_udp_pipe);
2119 &
app_cfg->encrypt_pipes.ipv6_tcp_pipe);
2136 &
app_cfg->encrypt_pipes.ipv6_udp_pipe);
2150 app_cfg->encrypt_pipes.ipv6_tcp_pipe.pipe,
2151 &
app_cfg->encrypt_pipes.ipv6_src_tcp_pipe);
2153 DOCA_LOG_ERR(
"Failed create source ip6 TCP hairpin pipe");
2163 app_cfg->encrypt_pipes.ipv6_udp_pipe.pipe,
2164 &
app_cfg->encrypt_pipes.ipv6_src_udp_pipe);
2166 DOCA_LOG_ERR(
"Failed create source ip6 UDP hairpin pipe");
2201 struct rte_ether_hdr *nh;
2202 struct rte_esp_tail *esp_tail;
2203 struct rte_ipv4_hdr *ipv4;
2204 struct rte_ipv6_hdr *ipv6;
2205 struct rte_mbuf *last_seg;
2208 bool sw_sn_inc =
ctx->config->sw_sn_inc_enable;
2209 void *trailer_pointer;
2210 uint32_t payload_len, esp_len, encrypted_len, padding_len, trailer_len, padding_offset;
2211 uint16_t reformat_encap_data_len;
2214 reformat_encap_data_len = 50;
2216 reformat_encap_data_len = 70;
2222 payload_len = (*m)->pkt_len -
sizeof(
struct rte_ether_hdr);
2224 esp_len = reformat_encap_data_len -
sizeof(
struct rte_ether_hdr);
2226 encrypted_len = payload_len + (
sizeof(
struct rte_esp_tail));
2228 encrypted_len = RTE_ALIGN_CEIL(encrypted_len,
PADDING_ALIGN);
2230 padding_len = encrypted_len - payload_len;
2232 trailer_len = padding_len + icv_len;
2235 nh = (
struct rte_ether_hdr *)(
void *)rte_pktmbuf_prepend(*m, esp_len);
2239 last_seg = rte_pktmbuf_lastseg(*m);
2242 padding_offset = last_seg->data_len;
2243 last_seg->data_len += trailer_len;
2244 (*m)->pkt_len += trailer_len;
2245 trailer_pointer = rte_pktmbuf_mtod_offset(last_seg, typeof(trailer_pointer), padding_offset);
2253 &reformat_encap_data_len);
2254 ipv4 = (
void *)(nh + 1);
2255 ipv4->total_length = rte_cpu_to_be_16((*m)->pkt_len -
sizeof(
struct rte_ether_hdr));
2256 ipv4->hdr_checksum = 0;
2257 ipv4->hdr_checksum = rte_ipv4_cksum(ipv4);
2263 &reformat_encap_data_len);
2264 ipv6 = (
void *)(nh + 1);
2265 ipv6->payload_len = rte_cpu_to_be_16((*m)->pkt_len -
sizeof(
struct rte_ether_hdr) -
sizeof(*ipv6));
2268 padding_len -=
sizeof(
struct rte_esp_tail);
2271 if (padding_len > 0)
2274 esp_tail = (
struct rte_esp_tail *)(trailer_pointer + padding_len);
2275 esp_tail->pad_len = padding_len;
2278 esp_tail->next_proto = 4;
2280 esp_tail->next_proto = 41;
2282 ctx->encrypt_rules[rule_idx].current_sn++;
2300 struct rte_ether_hdr *oh, *nh;
2301 struct rte_esp_tail *esp_tail;
2302 struct rte_ipv4_hdr *ipv4;
2303 struct rte_ipv6_hdr *ipv6;
2304 struct rte_mbuf *last_seg;
2307 void *trailer_pointer;
2308 uint32_t payload_len, esp_len, encrypted_len, padding_len, trailer_len, padding_offset, l2_l3_len;
2309 uint16_t reformat_encap_data_len;
2311 bool sw_sn_inc =
ctx->config->sw_sn_inc_enable;
2313 if (udp_transport) {
2314 reformat_encap_data_len = 24;
2317 reformat_encap_data_len = 16;
2325 oh = rte_pktmbuf_mtod(*m,
struct rte_ether_hdr *);
2327 if (RTE_ETH_IS_IPV4_HDR((*m)->packet_type)) {
2328 ipv4 = (
void *)(oh + 1);
2329 l2_l3_len = rte_ipv4_hdr_len(ipv4) +
sizeof(
struct rte_ether_hdr);
2331 l2_l3_len =
sizeof(
struct rte_ipv6_hdr) + sizeof(struct rte_ether_hdr);
2334 payload_len = (*m)->pkt_len - l2_l3_len;
2336 esp_len = reformat_encap_data_len;
2338 encrypted_len = payload_len + (
sizeof(
struct rte_esp_tail));
2340 encrypted_len = RTE_ALIGN_CEIL(encrypted_len,
PADDING_ALIGN);
2342 padding_len = encrypted_len - payload_len;
2344 trailer_len = padding_len + icv_len;
2346 nh = (
struct rte_ether_hdr *)(
void *)rte_pktmbuf_prepend(*m, esp_len);
2350 last_seg = rte_pktmbuf_lastseg(*m);
2353 padding_offset = last_seg->data_len;
2354 last_seg->data_len += trailer_len;
2355 (*m)->pkt_len += trailer_len;
2356 trailer_pointer = rte_pktmbuf_mtod_offset(last_seg, typeof(trailer_pointer), padding_offset);
2359 memmove(nh, oh, l2_l3_len);
2366 if (RTE_ETH_IS_IPV4_HDR((*m)->packet_type)) {
2367 ipv4 = (
void *)(nh + 1);
2368 next_protocol = ipv4->next_proto_id;
2370 ipv4->total_length = rte_cpu_to_be_16((*m)->pkt_len -
sizeof(
struct rte_ether_hdr));
2371 ipv4->hdr_checksum = 0;
2372 ipv4->hdr_checksum = rte_ipv4_cksum(ipv4);
2373 if (udp_transport) {
2374 struct rte_udp_hdr *
udp = (
void *)(ipv4 + 1);
2375 uint16_t udp_len = (*m)->pkt_len -
sizeof(
struct rte_ether_hdr) - sizeof(struct rte_ipv4_hdr);
2377 udp->dgram_len = rte_cpu_to_be_16(udp_len);
2378 udp->dgram_cksum = RTE_BE16(0);
2380 }
else if (RTE_ETH_IS_IPV6_HDR((*m)->packet_type)) {
2381 ipv6 = (
void *)(nh + 1);
2382 next_protocol = ipv6->proto;
2384 ipv6->payload_len = rte_cpu_to_be_16((*m)->pkt_len -
sizeof(
struct rte_ether_hdr) -
sizeof(*ipv6));
2385 if (udp_transport) {
2386 struct rte_udp_hdr *
udp = (
void *)(ipv6 + 1);
2387 uint16_t udp_len = (*m)->pkt_len -
sizeof(
struct rte_ether_hdr) - sizeof(struct rte_ipv6_hdr);
2389 udp->dgram_len = rte_cpu_to_be_16(udp_len);
2390 udp->dgram_cksum = RTE_BE16(0);
2394 padding_len -=
sizeof(
struct rte_esp_tail);
2397 if (padding_len > 0)
2401 esp_tail = (
struct rte_esp_tail *)(trailer_pointer + padding_len);
2402 esp_tail->pad_len = padding_len;
2403 esp_tail->next_proto = next_protocol;
2405 ctx->encrypt_rules[rule_idx].current_sn++;
2415 pkt_meta = *RTE_FLOW_DYNF_METADATA(*packet);
void remove_ethernet_padding(struct rte_mbuf **m)
doca_error_t process_entries(struct doca_flow_port *port, struct entries_status *status, int timeout, uint16_t pipe_queue)
void create_hairpin_pipe_fwd(struct ipsec_security_gw_config *app_cfg, int port_id, bool encrypt, uint16_t *rss_queues, uint32_t rss_flags, struct doca_flow_fwd *fwd)
uint32_t get_icv_len_int(enum doca_flow_crypto_icv_len icv_len)
#define DEF_EXPECTED_ENTRIES
#define SET_MAC_ADDR(addr, a, b, c, d, e, f)
#define SET_IP6_ADDR(addr, a, b, c, d)
if(bitoffset % 64+bitlength > 64) result|
static doca_error_t create_ipsec_src_ip6_pipe(struct doca_flow_port *port, bool debug_mode, int expected_entries, enum doca_flow_l4_type_ext protocol_type, struct doca_flow_pipe *hairpin_pipe, struct security_gateway_pipe_info *pipe_info)
static doca_error_t add_five_tuple_match_entry(struct doca_flow_port *port, struct encrypt_rule *rule, struct ipsec_security_gw_config *app_cfg, int nb_rules, int i, uint16_t queue_id, struct entries_status *hairpin_status)
doca_error_t ipsec_security_gw_create_encrypt_egress(struct ipsec_security_gw_ports_map *ports[], struct ipsec_security_gw_config *app_cfg)
static void get_pipe_for_rule(struct encrypt_rule *rule, struct encrypt_pipes *pipes, bool src_ip6, struct security_gateway_pipe_info **pipe)
#define ENCAP_ESP_SPI_IDX_TUNNEL_IP6
static doca_error_t create_control_pipe(struct doca_flow_port *port, bool is_root, bool debug_mode, struct security_gateway_pipe_info *pipe_info)
static bool is_perf_bw(struct ipsec_security_gw_config *app_cfg)
#define ENCAP_DST_UDP_PORT_IDX
doca_error_t bind_encrypt_ids(int nb_rules, struct doca_flow_port *port)
static doca_error_t add_control_pipe_entries(struct security_gateway_pipe_info *control_pipe, struct encrypt_pipes *pipes, bool perf_bw, bool debug_mode, bool is_root)
static doca_error_t prepare_packet_tunnel(struct rte_mbuf **m, struct ipsec_security_gw_core_ctx *ctx, uint32_t rule_idx)
doca_error_t ipsec_security_gw_insert_encrypt_rules(struct ipsec_security_gw_ports_map *ports[], struct ipsec_security_gw_config *app_cfg)
static void create_ipsec_encrypt_shared_object_tunnel(struct doca_flow_crypto_encap_action *crypto_cfg, struct encrypt_rule *rule, struct doca_flow_header_eth *eth_header)
static uint16_t current_ip_id
static const uint8_t esp_pad_bytes[15]
static void create_ipv6_tunnel_encap(struct encrypt_rule *rule, bool sw_sn_inc, struct doca_flow_header_eth *eth_header, uint8_t *reformat_data, uint16_t *reformat_data_sz)
static void create_transport_encap(struct encrypt_rule *rule, bool sw_sn_inc, uint8_t *reformat_data, uint16_t *reformat_data_sz)
#define ENCAP_IDX_SRC_MAC
static void create_ipv4_tunnel_encap(struct encrypt_rule *rule, bool sw_sn_inc, struct doca_flow_header_eth *eth_header, uint8_t *reformat_data, uint16_t *reformat_data_sz)
#define ENCAP_ESP_SN_IDX_TUNNEL_IP6
static doca_error_t prepare_packet_transport(struct rte_mbuf **m, struct ipsec_security_gw_core_ctx *ctx, uint32_t rule_idx, bool udp_transport)
static doca_error_t create_marker_encap_pipe(struct doca_flow_port *port, uint16_t port_id, 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)
static doca_error_t create_ipsec_hairpin_pipe(struct doca_flow_port *port, bool debug_mode, int expected_entries, enum doca_flow_l4_type_ext protocol_type, enum doca_flow_l3_type l3_type, struct doca_flow_fwd *fwd, struct security_gateway_pipe_info *pipe_info)
#define ENCAP_DST_IP_IDX_IP6
static doca_error_t create_ipsec_encrypt_shared_object(struct ipsec_security_gw_sa_attrs *app_sa_attrs, struct ipsec_security_gw_config *app_cfg, uint32_t ipsec_id)
static doca_error_t create_egress_ip_classifier(struct doca_flow_port *port, bool is_root, bool debug_mode, struct encrypt_pipes *encrypt_pipes, struct ipsec_security_gw_config *app_cfg)
#define ENCAP_MARKER_HEADER_SIZE
static doca_error_t add_src_ip6_entry(struct doca_flow_port *port, struct encrypt_rule *rule, struct encrypt_pipes *pipes, struct entries_status *hairpin_status, uint32_t src_ip_id, uint16_t queue_id, bool debug_mode, int i)
DOCA_LOG_REGISTER(IPSEC_SECURITY_GW::flow_encrypt)
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)
#define ENCAP_IP_ID_IDX_IP4
static void create_udp_transport_encap(struct encrypt_rule *rule, bool sw_sn_inc, uint8_t *reformat_data, uint16_t *reformat_data_sz)
static doca_error_t create_ipsec_encrypt_pipe(struct doca_flow_port *port, uint16_t port_id, int expected_entries, struct ipsec_security_gw_config *app_cfg, enum doca_flow_l3_meta l3_type, struct security_gateway_pipe_info *pipe_info)
static doca_error_t create_vxlan_encap_pipe(struct doca_flow_port *port, int port_id, struct ipsec_security_gw_config *app_cfg)
doca_error_t handle_unsecured_packets_received(struct rte_mbuf **packet, struct ipsec_security_gw_core_ctx *ctx)
#define ENCAP_ESP_SN_IDX_TRANSPORT
static void create_ipsec_encrypt_shared_object_transport(struct doca_flow_crypto_encap_action *crypto_cfg, struct encrypt_rule *rule)
#define ENCAP_DST_IP_IDX_IP4
static void create_ipsec_encrypt_shared_object_transport_over_udp(struct doca_flow_crypto_encap_action *crypto_cfg, struct encrypt_rule *rule)
#define ENCAP_ESP_SPI_IDX_TRANSPORT
#define ENCAP_ESP_SN_IDX_UDP_TRANSPORT
#define ENCAP_ESP_SN_IDX_TUNNEL_IP4
static doca_error_t add_vxlan_encap_pipe_entry(struct doca_flow_port *port, struct security_gateway_pipe_info *pipe, struct ipsec_security_gw_config *app_cfg)
#define ENCAP_ESP_SPI_IDX_UDP_TRANSPORT
#define ENCAP_ESP_SPI_IDX_TUNNEL_IP4
static doca_error_t destroy_pipe_cfg(struct doca_flow_pipe_cfg *cfg)
static uint16_t * rss_queues
#define SET_L4_PORT(layer, port, value)
static struct doca_flow_actions actions
#define BE_IPV4_ADDR(a, b, c, d)
static struct doca_flow_monitor monitor
static struct doca_flow_fwd fwd
static struct doca_flow_match match_mask
static struct doca_flow_pipe_entry * entry[MAX_ENTRIES]
#define DEFAULT_TIMEOUT_US
static struct app_gpu_cfg app_cfg
enum doca_error doca_error_t
DOCA API return codes.
DOCA_STABLE const char * doca_error_get_descr(doca_error_t error)
Returns the description string of an error code.
@ DOCA_ERROR_NOT_SUPPORTED
DOCA_EXPERIMENTAL doca_error_t doca_flow_crypto_ipsec_update_sn(uint32_t shared_res_id, uint64_t sequence_number)
Update the sequence number state for specific resource.
@ DOCA_FLOW_CRYPTO_SN_OFFLOAD_INC
@ DOCA_FLOW_CRYPTO_HEADER_ESP_OVER_IPV6
@ DOCA_FLOW_CRYPTO_HEADER_UDP_ESP_OVER_IPV4
@ DOCA_FLOW_CRYPTO_HEADER_NON_ESP_MARKER
@ DOCA_FLOW_CRYPTO_HEADER_ESP_OVER_IPV4
@ DOCA_FLOW_CRYPTO_HEADER_ESP_TUNNEL
@ DOCA_FLOW_CRYPTO_HEADER_UDP_ESP_OVER_IPV6
@ DOCA_FLOW_CRYPTO_RESOURCE_IPSEC_SA
@ DOCA_FLOW_CRYPTO_REFORMAT_ENCAP
@ DOCA_FLOW_CRYPTO_ACTION_ENCRYPT
doca_flow_l4_type_ext
doca flow layer 4 packet extend type
#define DOCA_FLOW_VXLAN_DEFAULT_PORT
doca_flow_l3_type
doca flow layer 3 packet type
#define DOCA_FLOW_PROTO_UDP
#define DOCA_FLOW_ETHER_TYPE_IPV6
#define DOCA_FLOW_PROTO_TCP
#define DOCA_FLOW_ETHER_TYPE_IPV4
@ DOCA_FLOW_L4_TYPE_EXT_TCP
@ DOCA_FLOW_L4_TYPE_EXT_UDP
@ DOCA_FLOW_IP4_FLAG_DONT_FRAGMENT
DOCA_STABLE doca_error_t doca_flow_pipe_cfg_destroy(struct doca_flow_pipe_cfg *cfg)
Destroy DOCA Flow pipe configuration struct.
DOCA_STABLE doca_error_t doca_flow_pipe_cfg_create(struct doca_flow_pipe_cfg **cfg, struct doca_flow_port *port)
Create DOCA Flow pipe configuration struct.
DOCA_STABLE doca_error_t doca_flow_entries_process(struct doca_flow_port *port, uint16_t pipe_queue, uint64_t timeout, uint32_t max_processed_entries)
Process entries in queue.
DOCA_STABLE doca_error_t doca_flow_pipe_cfg_set_name(struct doca_flow_pipe_cfg *cfg, const char *name)
Set pipe's name.
DOCA_EXPERIMENTAL doca_error_t doca_flow_pipe_cfg_set_match(struct doca_flow_pipe_cfg *cfg, const struct doca_flow_match *match, const struct doca_flow_match *match_mask)
Set pipe's match and match mask.
DOCA_STABLE doca_error_t doca_flow_shared_resources_bind(enum doca_flow_shared_resource_type type, uint32_t *res_array, uint32_t res_array_len, void *bindable_obj)
Binds a bulk of shared resources to a bindable object.
DOCA_EXPERIMENTAL doca_error_t doca_flow_pipe_control_add_entry(uint16_t pipe_queue, uint32_t priority, struct doca_flow_pipe *pipe, const struct doca_flow_match *match, const struct doca_flow_match *match_mask, const struct doca_flow_match_condition *condition, const struct doca_flow_actions *actions, const struct doca_flow_actions *actions_mask, const struct doca_flow_action_descs *action_descs, const struct doca_flow_monitor *monitor, const struct doca_flow_fwd *fwd, void *usr_ctx, struct doca_flow_pipe_entry **entry)
Add one new entry to a control pipe.
DOCA_STABLE doca_error_t doca_flow_pipe_cfg_set_is_root(struct doca_flow_pipe_cfg *cfg, bool is_root)
Set if pipe is root or not.
DOCA_EXPERIMENTAL doca_error_t doca_flow_pipe_create(const struct doca_flow_pipe_cfg *cfg, const struct doca_flow_fwd *fwd, const struct doca_flow_fwd *fwd_miss, struct doca_flow_pipe **pipe)
Create one new pipe.
doca_flow_l3_meta
doca flow l3 valid type for parser meta
DOCA_STABLE doca_error_t doca_flow_pipe_cfg_set_type(struct doca_flow_pipe_cfg *cfg, enum doca_flow_pipe_type type)
Set pipe's type.
doca_flow_flags_type
doca flow flags type
DOCA_EXPERIMENTAL doca_error_t doca_flow_shared_resource_set_cfg(enum doca_flow_shared_resource_type type, uint32_t id, struct doca_flow_shared_resource_cfg *cfg)
Configure a single shared resource.
DOCA_EXPERIMENTAL doca_error_t doca_flow_pipe_cfg_set_actions(struct doca_flow_pipe_cfg *cfg, struct doca_flow_actions *const *actions, struct doca_flow_actions *const *actions_masks, struct doca_flow_action_descs *const *action_descs, size_t nr_actions)
Set pipe's actions, actions mask and actions descriptor.
DOCA_EXPERIMENTAL doca_error_t doca_flow_pipe_cfg_set_monitor(struct doca_flow_pipe_cfg *cfg, const struct doca_flow_monitor *monitor)
Set pipe's monitor.
DOCA_EXPERIMENTAL doca_error_t doca_flow_pipe_add_entry(uint16_t pipe_queue, struct doca_flow_pipe *pipe, const struct doca_flow_match *match, const struct doca_flow_actions *actions, const struct doca_flow_monitor *monitor, const struct doca_flow_fwd *fwd, uint32_t flags, void *usr_ctx, struct doca_flow_pipe_entry **entry)
Add one new entry to a pipe.
DOCA_STABLE doca_error_t doca_flow_pipe_cfg_set_nr_entries(struct doca_flow_pipe_cfg *cfg, uint32_t nr_entries)
Set pipe's maximum number of flow rules.
DOCA_EXPERIMENTAL doca_error_t doca_flow_pipe_cfg_set_dir_info(struct doca_flow_pipe_cfg *cfg, enum doca_flow_direction_info dir_info)
Set pipe's Direction info.
DOCA_STABLE struct doca_flow_port * doca_flow_port_switch_get(const struct doca_flow_port *port)
Get doca flow switch port.
DOCA_STABLE doca_error_t doca_flow_pipe_cfg_set_domain(struct doca_flow_pipe_cfg *cfg, enum doca_flow_pipe_domain domain)
Set pipe's domain.
@ DOCA_FLOW_SHARED_RESOURCE_IPSEC_SA
@ DOCA_FLOW_DIRECTION_HOST_TO_NETWORK
@ DOCA_FLOW_WAIT_FOR_BATCH
@ DOCA_FLOW_RESOURCE_TYPE_NON_SHARED
@ DOCA_FLOW_PIPE_DOMAIN_EGRESS
@ DOCA_FLOW_PIPE_DOMAIN_SECURE_EGRESS
#define DOCA_LOG_ERR(format,...)
Generates an ERROR application log message.
#define DOCA_LOG_DBG(format,...)
Generates a DEBUG application log message.
const struct ip_frag_config * cfg
@ IPSEC_SECURITY_GW_UDP_TRANSPORT
@ IPSEC_SECURITY_GW_TUNNEL
@ IPSEC_SECURITY_GW_TRANSPORT
@ IPSEC_SECURITY_GW_SWITCH
@ IPSEC_SECURITY_GW_ESP_OFFLOAD_ENCAP
@ IPSEC_SECURITY_GW_ESP_OFFLOAD_DECAP
@ IPSEC_SECURITY_GW_ESP_OFFLOAD_BOTH
@ IPSEC_SECURITY_GW_ESP_OFFLOAD_NONE
@ IPSEC_SECURITY_GW_PERF_BW
@ IPSEC_SECURITY_GW_PERF_BOTH
doca flow actions information
struct doca_flow_crypto_encap_action crypto_encap
struct doca_flow_resource_encap_cfg encap_cfg
enum doca_flow_resource_type encap_type
struct doca_flow_meta meta
struct doca_flow_crypto_action crypto
struct doca_flow_crypto_action::@73::@75 ipsec_sa
enum doca_flow_crypto_action_type action_type
enum doca_flow_crypto_resource_type resource_type
doca flow crypto encap action information
enum doca_flow_crypto_encap_action_type action_type
enum doca_flow_crypto_encap_net_type net_type
uint8_t encap_data[DOCA_FLOW_CRYPTO_HEADER_LEN_MAX]
struct doca_flow_header_format outer
struct doca_flow_pipe * next_pipe
enum doca_flow_fwd_type type
doca flow matcher information
struct doca_flow_parser_meta parser_meta
struct doca_flow_header_format outer
struct doca_flow_meta meta
doca monitor action configuration
enum doca_flow_resource_type counter_type
struct doca_flow_encap_action encap
doca flow shared resource configuration
enum doca_flow_tun_type type
struct security_gateway_pipe_info ipv4_encrypt_pipe
struct security_gateway_pipe_info ipv6_tcp_pipe
struct security_gateway_pipe_info ipv6_src_udp_pipe
struct security_gateway_pipe_info ipv4_udp_pipe
struct security_gateway_pipe_info egress_ip_classifier
struct security_gateway_pipe_info ipv6_udp_pipe
struct security_gateway_pipe_info ipv6_src_tcp_pipe
struct security_gateway_pipe_info ipv6_encrypt_pipe
struct security_gateway_pipe_info ipv4_tcp_pipe
enum doca_flow_l4_type_ext protocol
struct ipsec_security_gw_sa_attrs sa_attrs
doca_be32_t encap_dst_ip4
struct ipsec_security_gw_ip6 ip6
enum doca_flow_l3_type encap_l3_type
doca_be32_t encap_dst_ip6[4]
struct ipsec_security_gw_ip4 ip4
enum doca_flow_l3_type l3_type
user context struct that will be used in entries process callback
uint32_t lifetime_threshold
uint8_t enc_key_data[MAX_KEY_LEN]
enum doca_flow_crypto_key_type key_type
struct doca_flow_pipe * pipe
char name[MAX_NAME_LEN+1]
struct doca_flow_pipe_entry * entry
struct doca_flow_pipe * pipe
struct security_gateway_entry_info * entries_info
struct doca_flow_port * ports[UPF_ACCEL_PORTS_MAX]
static struct doca_flow_port * ports[FLOW_SWITCH_PORTS_MAX]
struct upf_accel_ctx * ctx