logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

nexthop.h (4066B)


  1. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2. #ifndef _LINUX_NEXTHOP_H
  3. #define _LINUX_NEXTHOP_H
  4. #include <linux/types.h>
  5. struct nhmsg {
  6. unsigned char nh_family;
  7. unsigned char nh_scope; /* return only */
  8. unsigned char nh_protocol; /* Routing protocol that installed nh */
  9. unsigned char resvd;
  10. unsigned int nh_flags; /* RTNH_F flags */
  11. };
  12. /* entry in a nexthop group */
  13. struct nexthop_grp {
  14. __u32 id; /* nexthop id - must exist */
  15. __u8 weight; /* weight of this nexthop */
  16. __u8 weight_high; /* high order bits of weight */
  17. __u16 resvd2;
  18. };
  19. static __inline__ __u16 nexthop_grp_weight(const struct nexthop_grp *entry)
  20. {
  21. return ((entry->weight_high << 8) | entry->weight) + 1;
  22. }
  23. enum {
  24. NEXTHOP_GRP_TYPE_MPATH, /* hash-threshold nexthop group
  25. * default type if not specified
  26. */
  27. NEXTHOP_GRP_TYPE_RES, /* resilient nexthop group */
  28. __NEXTHOP_GRP_TYPE_MAX,
  29. };
  30. #define NEXTHOP_GRP_TYPE_MAX (__NEXTHOP_GRP_TYPE_MAX - 1)
  31. #define NHA_OP_FLAG_DUMP_STATS BIT(0)
  32. #define NHA_OP_FLAG_DUMP_HW_STATS BIT(1)
  33. /* Response OP_FLAGS. */
  34. #define NHA_OP_FLAG_RESP_GRP_RESVD_0 BIT(31) /* Dump clears resvd fields. */
  35. enum {
  36. NHA_UNSPEC,
  37. NHA_ID, /* u32; id for nexthop. id == 0 means auto-assign */
  38. NHA_GROUP, /* array of nexthop_grp */
  39. NHA_GROUP_TYPE, /* u16 one of NEXTHOP_GRP_TYPE */
  40. /* if NHA_GROUP attribute is added, no other attributes can be set */
  41. NHA_BLACKHOLE, /* flag; nexthop used to blackhole packets */
  42. /* if NHA_BLACKHOLE is added, OIF, GATEWAY, ENCAP can not be set */
  43. NHA_OIF, /* u32; nexthop device */
  44. NHA_GATEWAY, /* be32 (IPv4) or in6_addr (IPv6) gw address */
  45. NHA_ENCAP_TYPE, /* u16; lwt encap type */
  46. NHA_ENCAP, /* lwt encap data */
  47. /* NHA_OIF can be appended to dump request to return only
  48. * nexthops using given device
  49. */
  50. NHA_GROUPS, /* flag; only return nexthop groups in dump */
  51. NHA_MASTER, /* u32; only return nexthops with given master dev */
  52. NHA_FDB, /* flag; nexthop belongs to a bridge fdb */
  53. /* if NHA_FDB is added, OIF, BLACKHOLE, ENCAP cannot be set */
  54. /* nested; resilient nexthop group attributes */
  55. NHA_RES_GROUP,
  56. /* nested; nexthop bucket attributes */
  57. NHA_RES_BUCKET,
  58. /* u32; operation-specific flags */
  59. NHA_OP_FLAGS,
  60. /* nested; nexthop group stats */
  61. NHA_GROUP_STATS,
  62. /* u32; nexthop hardware stats enable */
  63. NHA_HW_STATS_ENABLE,
  64. /* u32; read-only; whether any driver collects HW stats */
  65. NHA_HW_STATS_USED,
  66. __NHA_MAX,
  67. };
  68. #define NHA_MAX (__NHA_MAX - 1)
  69. enum {
  70. NHA_RES_GROUP_UNSPEC,
  71. /* Pad attribute for 64-bit alignment. */
  72. NHA_RES_GROUP_PAD = NHA_RES_GROUP_UNSPEC,
  73. /* u16; number of nexthop buckets in a resilient nexthop group */
  74. NHA_RES_GROUP_BUCKETS,
  75. /* clock_t as u32; nexthop bucket idle timer (per-group) */
  76. NHA_RES_GROUP_IDLE_TIMER,
  77. /* clock_t as u32; nexthop unbalanced timer */
  78. NHA_RES_GROUP_UNBALANCED_TIMER,
  79. /* clock_t as u64; nexthop unbalanced time */
  80. NHA_RES_GROUP_UNBALANCED_TIME,
  81. __NHA_RES_GROUP_MAX,
  82. };
  83. #define NHA_RES_GROUP_MAX (__NHA_RES_GROUP_MAX - 1)
  84. enum {
  85. NHA_RES_BUCKET_UNSPEC,
  86. /* Pad attribute for 64-bit alignment. */
  87. NHA_RES_BUCKET_PAD = NHA_RES_BUCKET_UNSPEC,
  88. /* u16; nexthop bucket index */
  89. NHA_RES_BUCKET_INDEX,
  90. /* clock_t as u64; nexthop bucket idle time */
  91. NHA_RES_BUCKET_IDLE_TIME,
  92. /* u32; nexthop id assigned to the nexthop bucket */
  93. NHA_RES_BUCKET_NH_ID,
  94. __NHA_RES_BUCKET_MAX,
  95. };
  96. #define NHA_RES_BUCKET_MAX (__NHA_RES_BUCKET_MAX - 1)
  97. enum {
  98. NHA_GROUP_STATS_UNSPEC,
  99. /* nested; nexthop group entry stats */
  100. NHA_GROUP_STATS_ENTRY,
  101. __NHA_GROUP_STATS_MAX,
  102. };
  103. #define NHA_GROUP_STATS_MAX (__NHA_GROUP_STATS_MAX - 1)
  104. enum {
  105. NHA_GROUP_STATS_ENTRY_UNSPEC,
  106. /* u32; nexthop id of the nexthop group entry */
  107. NHA_GROUP_STATS_ENTRY_ID,
  108. /* uint; number of packets forwarded via the nexthop group entry */
  109. NHA_GROUP_STATS_ENTRY_PACKETS,
  110. /* uint; number of packets forwarded via the nexthop group entry in
  111. * hardware
  112. */
  113. NHA_GROUP_STATS_ENTRY_PACKETS_HW,
  114. __NHA_GROUP_STATS_ENTRY_MAX,
  115. };
  116. #define NHA_GROUP_STATS_ENTRY_MAX (__NHA_GROUP_STATS_ENTRY_MAX - 1)
  117. #endif