ioam6.h 1.4 KB

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