DPDK  24.11.0-rc0
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 {
266  union {
267  struct {
270 
273  } cipher_auth;
274 
277  };
278 
280  int is_aead;
281  } crypto;
282 
285 };
286 
299 __rte_experimental
300 int
301 rte_swx_ipsec_sa_add(struct rte_swx_ipsec *ipsec,
302  struct rte_swx_ipsec_sa_params *sa_params,
303  uint32_t *sa_id);
304 
316 __rte_experimental
317 void
318 rte_swx_ipsec_sa_delete(struct rte_swx_ipsec *ipsec,
319  uint32_t sa_id);
320 
369 __rte_experimental
371 rte_swx_ipsec_sa_read(struct rte_swx_ipsec *ipsec,
372  const char *string,
373  int *is_blank_or_comment,
374  const char **errmsg);
375 
376 #ifdef __cplusplus
377 }
378 #endif
379 
380 #endif
__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)
__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)
__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