Data Accelerator Offload
Loading...
Searching...
No Matches
dao_netlink_xfrm.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: Marvell-MIT
2 * Copyright (c) 2023 Marvell.
3 */
4
11#ifndef _DAO_LIB_NETLINK_XFRM_H
12#define _DAO_LIB_NETLINK_XFRM_H
13
14#include "dao_netlink_crypto.h"
15
16#include <rte_crypto.h>
17
18#include <netlink/xfrm/sa.h>
19#include <netlink/xfrm/sp.h>
20#include <netlink/xfrm/ae.h>
21#include <netlink/xfrm/template.h>
22#include <netlink/xfrm/selector.h>
23#include <netlink/xfrm/lifetime.h>
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29#define DAO_NETLINK_XFRM_NAME_LEN 64
30#define DAO_NETLINK_XFRM_ALG_MAX_NAME 128
31
35typedef struct dao_netlink_ip_addr {
36 int family;
37 struct in6_addr addr;
38 unsigned int prefixlen;
40
50
58
66
74
82
90
96 unsigned int key_len;
97 union {
99 unsigned int icv_len;
101 unsigned int trunc_len;
102 };
104 char key[DAO_NETLINK_CRYPTO_KEY_MAX_NAME_LEN];
106 char algo[DAO_NETLINK_XFRM_ALG_MAX_NAME];
108
109typedef struct dao_netlink_xfrm_sel {
112 uint16_t dport;
113 uint16_t dport_mask;
114 uint16_t sport;
115 uint16_t sport_mask;
116 uint16_t family;
117 uint8_t prefixlen_d;
118 uint8_t prefixlen_s;
119 uint8_t proto;
120 int32_t ifindex;
121 uint32_t user;
122} dao_netlink_xfrm_sel_t;
123
169
173 uint32_t req_id;
176 /* selector is valid */
177 int is_sel;
186 /* Selector */
187 dao_netlink_xfrm_sel_t sel;
189
212
222static inline const char *
224{
225 switch (dir) {
227 return "inb";
228 break;
229
231 return "outb";
232 break;
233
235 return "fwd";
236 break;
237
238 default:
239 return NULL;
240 }
241}
242
252static inline const char *
254{
255 switch (ip_proto) {
257 return "ipv4";
258 break;
259
261 return "ipv6";
262 break;
263
264 default:
265 return NULL;
266 }
267}
268
269/* Function declaration */
270
289 struct rte_crypto_sym_xform *cipher,
290 struct rte_crypto_sym_xform *auth);
291
305
306#ifdef __cplusplus
307}
308#endif
309#endif