geneve.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __NET_GENEVE_H
  3. #define __NET_GENEVE_H 1
  4. #include <net/udp_tunnel.h>
  5. #define GENEVE_UDP_PORT 6081
  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. static inline bool netif_is_geneve(const struct net_device *dev)
  59. {
  60. return dev->rtnl_link_ops &&
  61. !strcmp(dev->rtnl_link_ops->kind, "geneve");
  62. }
  63. #ifdef CONFIG_INET
  64. struct net_device *geneve_dev_create_fb(struct net *net, const char *name,
  65. u8 name_assign_type, u16 dst_port);
  66. #endif /*ifdef CONFIG_INET */
  67. #endif /*ifdef__NET_GENEVE_H */