DPDK  24.11.0-rc3
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 
45 #include <stdint.h>
46 #include <stdio.h>
47 #include <netinet/in.h>
48 
49 #include <rte_compat.h>
50 #include <rte_crypto_sym.h>
51 #include <rte_ip6.h>
52 
53 #ifdef __cplusplus
54 extern "C" {
55 #endif
56 
62 struct rte_swx_ipsec;
63 
65 #ifndef RTE_SWX_IPSEC_NAME_SIZE
66 #define RTE_SWX_IPSEC_NAME_SIZE 64
67 #endif
68 
70 #ifndef RTE_SWX_IPSEC_BURST_SIZE_MAX
71 #define RTE_SWX_IPSEC_BURST_SIZE_MAX 256
72 #endif
73 
77  uint32_t ring_rd;
78 
80  uint32_t ring_wr;
81 
83  uint32_t crypto_wr;
84 
86  uint32_t crypto_rd;
87 };
88 
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 
116  /* SA ID. */
117  uint32_t sa_id;
118 };
119 
128 __rte_experimental
129 struct rte_swx_ipsec *
130 rte_swx_ipsec_find(const char *name);
131 
150 __rte_experimental
151 int
152 rte_swx_ipsec_create(struct rte_swx_ipsec **ipsec,
153  const char *name,
154  struct rte_swx_ipsec_params *params,
155  int numa_node);
156 
163 __rte_experimental
164 void
165 rte_swx_ipsec_free(struct rte_swx_ipsec *ipsec);
166 
177 __rte_experimental
178 void
179 rte_swx_ipsec_run(struct rte_swx_ipsec *ipsec);
180 
181 /*
182  * IPsec Control Plane API
183  */
184 
186 #define RTE_SWX_IPSEC_KEY_SIZE_MAX 64
187 
192 
195 
197  uint32_t key_size;
198 };
199 
204 
207 
209  uint32_t key_size;
210 };
211 
216 
219 
221  uint32_t key_size;
222 };
223 
227  struct {
229  uint32_t spi;
230  } esp;
231 
234 
237 
239  union {
241  struct {
243  struct in_addr src_addr;
244 
246  struct in_addr dst_addr;
247  } ipv4;
248 
250  struct {
252  struct rte_ipv6_addr src_addr;
253 
255  struct rte_ipv6_addr dst_addr;
256  } ipv6;
257  } tunnel;
258 };
259 
263  int encrypt;
264 
266  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
__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)
__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:94
const char * ring_out_name
Definition: rte_swx_ipsec.h:97
rte_crypto_aead_algorithm
rte_crypto_cipher_algorithm