geneve.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #ifndef __NET_GENEVE_H
  2. #define __NET_GENEVE_H 1
  3. #ifdef CONFIG_INET
  4. #include <net/udp_tunnel.h>
  5. #endif
  6. /* Geneve Header:
  7. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  8. * |Ver| Opt Len |O|C| Rsvd. | Protocol Type |
  9. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  10. * | Virtual Network Identifier (VNI) | Reserved |
  11. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  12. * | Variable Length Options |
  13. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  14. *
  15. * Option Header:
  16. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  17. * | Option Class | Type |R|R|R| Length |
  18. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  19. * | Variable Option Data |
  20. * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  21. */
  22. struct geneve_opt {
  23. __be16 opt_class;
  24. u8 type;
  25. #ifdef __LITTLE_ENDIAN_BITFIELD
  26. u8 length:5;
  27. u8 r3:1;
  28. u8 r2:1;
  29. u8 r1:1;
  30. #else
  31. u8 r1:1;
  32. u8 r2:1;
  33. u8 r3:1;
  34. u8 length:5;
  35. #endif
  36. u8 opt_data[];
  37. };
  38. #define GENEVE_CRIT_OPT_TYPE (1 << 7)
  39. struct genevehdr {
  40. #ifdef __LITTLE_ENDIAN_BITFIELD
  41. u8 opt_len:6;
  42. u8 ver:2;
  43. u8 rsvd1:6;
  44. u8 critical:1;
  45. u8 oam:1;
  46. #else
  47. u8 ver:2;
  48. u8 opt_len:6;
  49. u8 oam:1;
  50. u8 critical:1;
  51. u8 rsvd1:6;
  52. #endif
  53. __be16 proto_type;
  54. u8 vni[3];
  55. u8 rsvd2;
  56. struct geneve_opt options[];
  57. };
  58. #if IS_ENABLED(CONFIG_GENEVE)
  59. void geneve_get_rx_port(struct net_device *netdev);
  60. #else
  61. static inline void geneve_get_rx_port(struct net_device *netdev)
  62. {
  63. }
  64. #endif
  65. #ifdef CONFIG_INET
  66. struct net_device *geneve_dev_create_fb(struct net *net, const char *name,
  67. u8 name_assign_type, u16 dst_port);
  68. #endif /*ifdef CONFIG_INET */
  69. #endif /*ifdef__NET_GENEVE_H */