DPDK  20.11.0
rte_ipsec_sad.h
Go to the documentation of this file.
1 
2 /* SPDX-License-Identifier: BSD-3-Clause
3  * Copyright(c) 2019 Intel Corporation
4  */
5 
6 #ifndef _RTE_IPSEC_SAD_H_
7 #define _RTE_IPSEC_SAD_H_
8 
9 #include <rte_compat.h>
10 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 struct rte_ipsec_sad;
23 
25 enum {
26  RTE_IPSEC_SAD_SPI_ONLY = 0,
27  RTE_IPSEC_SAD_SPI_DIP,
28  RTE_IPSEC_SAD_SPI_DIP_SIP,
29  RTE_IPSEC_SAD_KEY_TYPE_MASK,
30 };
31 
32 struct rte_ipsec_sadv4_key {
33  uint32_t spi;
34  uint32_t dip;
35  uint32_t sip;
36 };
37 
38 struct rte_ipsec_sadv6_key {
39  uint32_t spi;
40  uint8_t dip[16];
41  uint8_t sip[16];
42 };
43 
44 union rte_ipsec_sad_key {
45  struct rte_ipsec_sadv4_key v4;
46  struct rte_ipsec_sadv6_key v6;
47 };
48 
50 #define RTE_IPSEC_SAD_NAMESIZE 64
51 
52 #define RTE_IPSEC_SAD_FLAG_IPV6 0x1
53 
54 #define RTE_IPSEC_SAD_FLAG_RW_CONCURRENCY 0x2
55 
59  int socket_id;
61  uint32_t max_sa[RTE_IPSEC_SAD_KEY_TYPE_MASK];
63  uint32_t flags;
64 };
65 
84 int
85 rte_ipsec_sad_add(struct rte_ipsec_sad *sad,
86  const union rte_ipsec_sad_key *key,
87  int key_type, void *sa);
88 
104 int
105 rte_ipsec_sad_del(struct rte_ipsec_sad *sad,
106  const union rte_ipsec_sad_key *key,
107  int key_type);
108 /*
109  * Create SAD
110  *
111  * @param name
112  * SAD name
113  * @param conf
114  * Structure containing the configuration
115  * @return
116  * Handle to SAD object on success
117  * NULL otherwise with rte_errno set to an appropriate values.
118  */
119 struct rte_ipsec_sad *
120 rte_ipsec_sad_create(const char *name, const struct rte_ipsec_sad_conf *conf);
121 
132 struct rte_ipsec_sad *
133 rte_ipsec_sad_find_existing(const char *name);
134 
143 void
144 rte_ipsec_sad_destroy(struct rte_ipsec_sad *sad);
145 
162 int
163 rte_ipsec_sad_lookup(const struct rte_ipsec_sad *sad,
164  const union rte_ipsec_sad_key *keys[],
165  void *sa[], uint32_t n);
166 
167 #ifdef __cplusplus
168 }
169 #endif
170 
171 #endif /* _RTE_IPSEC_SAD_H_ */
void rte_ipsec_sad_destroy(struct rte_ipsec_sad *sad)
int rte_ipsec_sad_add(struct rte_ipsec_sad *sad, const union rte_ipsec_sad_key *key, int key_type, void *sa)
int rte_ipsec_sad_lookup(const struct rte_ipsec_sad *sad, const union rte_ipsec_sad_key *keys[], void *sa[], uint32_t n)
int rte_ipsec_sad_del(struct rte_ipsec_sad *sad, const union rte_ipsec_sad_key *key, int key_type)
struct rte_ipsec_sad * rte_ipsec_sad_find_existing(const char *name)