Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0+ */
0002 /*
0003  *  IPv6 IOAM implementation
0004  *
0005  *  Author:
0006  *  Justin Iurman <justin.iurman@uliege.be>
0007  */
0008 
0009 #ifndef _NET_IOAM6_H
0010 #define _NET_IOAM6_H
0011 
0012 #include <linux/net.h>
0013 #include <linux/ipv6.h>
0014 #include <linux/ioam6.h>
0015 #include <linux/rhashtable-types.h>
0016 
0017 struct ioam6_namespace {
0018     struct rhash_head head;
0019     struct rcu_head rcu;
0020 
0021     struct ioam6_schema __rcu *schema;
0022 
0023     __be16 id;
0024     __be32 data;
0025     __be64 data_wide;
0026 };
0027 
0028 struct ioam6_schema {
0029     struct rhash_head head;
0030     struct rcu_head rcu;
0031 
0032     struct ioam6_namespace __rcu *ns;
0033 
0034     u32 id;
0035     int len;
0036     __be32 hdr;
0037 
0038     u8 data[];
0039 };
0040 
0041 struct ioam6_pernet_data {
0042     struct mutex lock;
0043     struct rhashtable namespaces;
0044     struct rhashtable schemas;
0045 };
0046 
0047 static inline struct ioam6_pernet_data *ioam6_pernet(struct net *net)
0048 {
0049 #if IS_ENABLED(CONFIG_IPV6)
0050     return net->ipv6.ioam6_data;
0051 #else
0052     return NULL;
0053 #endif
0054 }
0055 
0056 struct ioam6_namespace *ioam6_namespace(struct net *net, __be16 id);
0057 void ioam6_fill_trace_data(struct sk_buff *skb,
0058                struct ioam6_namespace *ns,
0059                struct ioam6_trace_hdr *trace,
0060                bool is_input);
0061 
0062 int ioam6_init(void);
0063 void ioam6_exit(void);
0064 
0065 int ioam6_iptunnel_init(void);
0066 void ioam6_iptunnel_exit(void);
0067 
0068 #endif /* _NET_IOAM6_H */