DPDK  23.03.0
rte_swx_ipsec.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2022 Intel Corporation
3  */
4 #ifndef __INCLUDE_RTE_SWX_IPSEC_H__
5 #define __INCLUDE_RTE_SWX_IPSEC_H__
6 
7 #ifdef __cplusplus
8 extern "C" {
9 #endif
10 
49 #include <stdint.h>
50 #include <stdio.h>
51 #include <netinet/in.h>
52 
53 #include <rte_compat.h>
54 #include <rte_crypto_sym.h>
55 
61 struct rte_swx_ipsec;
62 
64 #ifndef RTE_SWX_IPSEC_NAME_SIZE
65 #define RTE_SWX_IPSEC_NAME_SIZE 64
66 #endif
67 
69 #ifndef RTE_SWX_IPSEC_BURST_SIZE_MAX
70 #define RTE_SWX_IPSEC_BURST_SIZE_MAX 256
71 #endif
72 
76  uint32_t ring_rd;
77 
79  uint32_t ring_wr;
80 
82  uint32_t crypto_wr;
83 
85  uint32_t crypto_rd;
86 };
87 
94  const char *ring_in_name;
95 
97  const char *ring_out_name;
98 
100  const char *crypto_dev_name;
101 
104 
107 
109  uint32_t n_sa_max;
110 };
111 
117  /* SA ID. */
118  uint32_t sa_id;
119 };
120 
129 __rte_experimental
130 struct rte_swx_ipsec *
131 rte_swx_ipsec_find(const char *name);
132 
151 __rte_experimental
152 int
153 rte_swx_ipsec_create(struct rte_swx_ipsec **ipsec,
154  const char *name,
155  struct rte_swx_ipsec_params *params,
156  int numa_node);
157 
164 __rte_experimental
165 void
166 rte_swx_ipsec_free(struct rte_swx_ipsec *ipsec);
167 
178 __rte_experimental
179 void
180 rte_swx_ipsec_run(struct rte_swx_ipsec *ipsec);
181 
182 /*
183  * IPsec Control Plane API
184  */
185 
187 #define RTE_SWX_IPSEC_KEY_SIZE_MAX 64
188 
193 
196 
198  uint32_t key_size;
199 };
200 
205 
208 
210  uint32_t key_size;
211 };
212 
217 
220 
222  uint32_t key_size;
223 };
224 
228  struct {
230  uint32_t spi;
231  } esp;
232 
235 
238 
240  union {
242  struct {
244  struct in_addr src_addr;
245 
247  struct in_addr dst_addr;
248  } ipv4;
249 
251  struct {
253  struct in6_addr src_addr;
254 
256  struct in6_addr dst_addr;
257  } ipv6;
258  } tunnel;
259 };
260 
264  int encrypt;
265 
267  struct {
269  union {
270  struct {
273 
276  } cipher_auth;
277 
280  };
281 
283  int is_aead;
284  } crypto;
285 
288 };
289 
302 __rte_experimental
303 int
304 rte_swx_ipsec_sa_add(struct rte_swx_ipsec *ipsec,
305  struct rte_swx_ipsec_sa_params *sa_params,
306  uint32_t *sa_id);
307 
319 __rte_experimental
320 void
321 rte_swx_ipsec_sa_delete(struct rte_swx_ipsec *ipsec,
322  uint32_t sa_id);
323 
372 __rte_experimental
374 rte_swx_ipsec_sa_read(struct rte_swx_ipsec *ipsec,
375  const char *string,
376  int *is_blank_or_comment,
377  const char **errmsg);
378 
379 #ifdef __cplusplus
380 }
381 #endif
382 
383 #endif
struct rte_ether_addr src_addr
Definition: rte_ether.h:269
__rte_experimental void rte_swx_ipsec_run(struct rte_swx_ipsec *ipsec)
const char * crypto_dev_name
__rte_experimental int rte_swx_ipsec_sa_add(struct rte_swx_ipsec *ipsec, struct rte_swx_ipsec_sa_params *sa_params, uint32_t *sa_id)
__rte_experimental void rte_swx_ipsec_free(struct rte_swx_ipsec *ipsec)
struct rte_ether_addr dst_addr
Definition: rte_ether.h:268
__rte_experimental void rte_swx_ipsec_sa_delete(struct rte_swx_ipsec *ipsec, uint32_t sa_id)
uint32_t crypto_dev_queue_pair_id
#define RTE_SWX_IPSEC_KEY_SIZE_MAX
__rte_experimental int rte_swx_ipsec_create(struct rte_swx_ipsec **ipsec, const char *name, struct rte_swx_ipsec_params *params, int numa_node)
__rte_experimental struct rte_swx_ipsec * rte_swx_ipsec_find(const char *name)
#define RTE_STD_C11
Definition: rte_common.h:39
__rte_experimental struct rte_swx_ipsec_sa_params * rte_swx_ipsec_sa_read(struct rte_swx_ipsec *ipsec, const char *string, int *is_blank_or_comment, const char **errmsg)
rte_crypto_auth_algorithm
const char * ring_in_name
Definition: rte_swx_ipsec.h:94
const char * ring_out_name
Definition: rte_swx_ipsec.h:97
rte_crypto_aead_algorithm
rte_crypto_cipher_algorithm