DPDK  23.07.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 
93  const char *ring_in_name;
94 
96  const char *ring_out_name;
97 
99  const char *crypto_dev_name;
100 
103 
106 
108  uint32_t n_sa_max;
109 };
110 
115  /* SA ID. */
116  uint32_t sa_id;
117 };
118 
127 __rte_experimental
128 struct rte_swx_ipsec *
129 rte_swx_ipsec_find(const char *name);
130 
149 __rte_experimental
150 int
151 rte_swx_ipsec_create(struct rte_swx_ipsec **ipsec,
152  const char *name,
153  struct rte_swx_ipsec_params *params,
154  int numa_node);
155 
162 __rte_experimental
163 void
164 rte_swx_ipsec_free(struct rte_swx_ipsec *ipsec);
165 
176 __rte_experimental
177 void
178 rte_swx_ipsec_run(struct rte_swx_ipsec *ipsec);
179 
180 /*
181  * IPsec Control Plane API
182  */
183 
185 #define RTE_SWX_IPSEC_KEY_SIZE_MAX 64
186 
191 
194 
196  uint32_t key_size;
197 };
198 
203 
206 
208  uint32_t key_size;
209 };
210 
215 
218 
220  uint32_t key_size;
221 };
222 
226  struct {
228  uint32_t spi;
229  } esp;
230 
233 
236 
238  union {
240  struct {
242  struct in_addr src_addr;
243 
245  struct in_addr dst_addr;
246  } ipv4;
247 
249  struct {
251  struct in6_addr src_addr;
252 
254  struct in6_addr dst_addr;
255  } ipv6;
256  } tunnel;
257 };
258 
262  int encrypt;
263 
265  struct {
267  union {
268  struct {
271 
274  } cipher_auth;
275 
278  };
279 
281  int is_aead;
282  } crypto;
283 
286 };
287 
300 __rte_experimental
301 int
302 rte_swx_ipsec_sa_add(struct rte_swx_ipsec *ipsec,
303  struct rte_swx_ipsec_sa_params *sa_params,
304  uint32_t *sa_id);
305 
317 __rte_experimental
318 void
319 rte_swx_ipsec_sa_delete(struct rte_swx_ipsec *ipsec,
320  uint32_t sa_id);
321 
370 __rte_experimental
372 rte_swx_ipsec_sa_read(struct rte_swx_ipsec *ipsec,
373  const char *string,
374  int *is_blank_or_comment,
375  const char **errmsg);
376 
377 #ifdef __cplusplus
378 }
379 #endif
380 
381 #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
Definition: rte_swx_ipsec.h:99
__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:93
const char * ring_out_name
Definition: rte_swx_ipsec.h:96
rte_crypto_aead_algorithm
rte_crypto_cipher_algorithm