ioam6.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * IPv6 IOAM implementation
  4. *
  5. * Author:
  6. * Justin Iurman <[email protected]>
  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/rhashtable-types.h>
  14. struct ioam6_namespace {
  15. struct rhash_head head;
  16. struct rcu_head rcu;
  17. struct ioam6_schema __rcu *schema;
  18. __be16 id;
  19. __be32 data;
  20. __be64 data_wide;
  21. };
  22. struct ioam6_schema {
  23. struct rhash_head head;
  24. struct rcu_head rcu;
  25. struct ioam6_namespace __rcu *ns;
  26. u32 id;
  27. int len;
  28. __be32 hdr;
  29. u8 data[];
  30. };
  31. struct ioam6_pernet_data {
  32. struct mutex lock;
  33. struct rhashtable namespaces;
  34. struct rhashtable schemas;
  35. };
  36. static inline struct ioam6_pernet_data *ioam6_pernet(struct net *net)
  37. {
  38. #if IS_ENABLED(CONFIG_IPV6)
  39. return net->ipv6.ioam6_data;
  40. #else
  41. return NULL;
  42. #endif
  43. }
  44. struct ioam6_namespace *ioam6_namespace(struct net *net, __be16 id);
  45. void ioam6_fill_trace_data(struct sk_buff *skb,
  46. struct ioam6_namespace *ns,
  47. struct ioam6_trace_hdr *trace,
  48. bool is_input);
  49. int ioam6_init(void);
  50. void ioam6_exit(void);
  51. int ioam6_iptunnel_init(void);
  52. void ioam6_iptunnel_exit(void);
  53. #endif /* _NET_IOAM6_H */