blob: 3c2993bc48c81e5e7625fcc07befcea70f6e6173 [file] [log] [blame]
Justin Iurman9ee11f02021-07-20 21:42:57 +02001/* SPDX-License-Identifier: GPL-2.0+ */
2/*
3 * IPv6 IOAM implementation
4 *
5 * Author:
6 * Justin Iurman <justin.iurman@uliege.be>
7 */
8
9#ifndef _NET_IOAM6_H
10#define _NET_IOAM6_H
11
12#include <linux/net.h>
13#include <linux/ipv6.h>
14#include <linux/ioam6.h>
15#include <linux/rhashtable-types.h>
16
17struct ioam6_namespace {
18 struct rhash_head head;
19 struct rcu_head rcu;
20
21 struct ioam6_schema __rcu *schema;
22
23 __be16 id;
24 __be32 data;
25 __be64 data_wide;
26};
27
28struct ioam6_schema {
29 struct rhash_head head;
30 struct rcu_head rcu;
31
32 struct ioam6_namespace __rcu *ns;
33
34 u32 id;
35 int len;
36 __be32 hdr;
37
38 u8 data[0];
39};
40
41struct ioam6_pernet_data {
42 struct mutex lock;
43 struct rhashtable namespaces;
44 struct rhashtable schemas;
45};
46
47static inline struct ioam6_pernet_data *ioam6_pernet(struct net *net)
48{
49#if IS_ENABLED(CONFIG_IPV6)
50 return net->ipv6.ioam6_data;
51#else
52 return NULL;
53#endif
54}
55
56struct ioam6_namespace *ioam6_namespace(struct net *net, __be16 id);
57void ioam6_fill_trace_data(struct sk_buff *skb,
58 struct ioam6_namespace *ns,
59 struct ioam6_trace_hdr *trace);
60
61int ioam6_init(void);
62void ioam6_exit(void);
63
Justin Iurman3edede02021-07-20 21:42:59 +020064int ioam6_iptunnel_init(void);
65void ioam6_iptunnel_exit(void);
66
Justin Iurman9ee11f02021-07-20 21:42:57 +020067#endif /* _NET_IOAM6_H */