Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. #ifndef _IPXE_ETH_SLOW_H
  2. #define _IPXE_ETH_SLOW_H
  3. /** @file
  4. *
  5. * Ethernet slow protocols
  6. *
  7. */
  8. FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
  9. /** Slow protocols header */
  10. struct eth_slow_header {
  11. /** Slow protocols subtype */
  12. uint8_t subtype;
  13. /** Subtype version number */
  14. uint8_t version;
  15. } __attribute__ (( packed ));
  16. /** LACP subtype */
  17. #define ETH_SLOW_SUBTYPE_LACP 1
  18. /** LACP version number */
  19. #define ETH_SLOW_LACP_VERSION 1
  20. /** Marker subtype */
  21. #define ETH_SLOW_SUBTYPE_MARKER 2
  22. /** Marker version number */
  23. #define ETH_SLOW_MARKER_VERSION 1
  24. /** TLV (type, length, value) header */
  25. struct eth_slow_tlv_header {
  26. /** Type
  27. *
  28. * This is an ETH_SLOW_TLV_XXX constant.
  29. */
  30. uint8_t type;
  31. /** Length
  32. *
  33. * The length includes the TLV header (except for a TLV
  34. * terminator, which has a length of zero).
  35. */
  36. uint8_t length;
  37. } __attribute__ (( packed ));
  38. /** Terminator type */
  39. #define ETH_SLOW_TLV_TERMINATOR 0
  40. /** Terminator length */
  41. #define ETH_SLOW_TLV_TERMINATOR_LEN 0
  42. /** LACP actor type */
  43. #define ETH_SLOW_TLV_LACP_ACTOR 1
  44. /** LACP actor length */
  45. #define ETH_SLOW_TLV_LACP_ACTOR_LEN \
  46. ( sizeof ( struct eth_slow_lacp_entity_tlv ) )
  47. /** LACP partner type */
  48. #define ETH_SLOW_TLV_LACP_PARTNER 2
  49. /** LACP partner length */
  50. #define ETH_SLOW_TLV_LACP_PARTNER_LEN \
  51. ( sizeof ( struct eth_slow_lacp_entity_tlv ) )
  52. /** LACP collector type */
  53. #define ETH_SLOW_TLV_LACP_COLLECTOR 3
  54. /** LACP collector length */
  55. #define ETH_SLOW_TLV_LACP_COLLECTOR_LEN \
  56. ( sizeof ( struct eth_slow_lacp_collector_tlv ) )
  57. /** Marker request type */
  58. #define ETH_SLOW_TLV_MARKER_REQUEST 1
  59. /** Marker request length */
  60. #define ETH_SLOW_TLV_MARKER_REQUEST_LEN \
  61. ( sizeof ( struct eth_slow_marker_tlv ) )
  62. /** Marker response type */
  63. #define ETH_SLOW_TLV_MARKER_RESPONSE 2
  64. /** Marker response length */
  65. #define ETH_SLOW_TLV_MARKER_RESPONSE_LEN \
  66. ( sizeof ( struct eth_slow_marker_tlv ) )
  67. /** Terminator TLV */
  68. struct eth_slow_terminator_tlv {
  69. /** TLV header */
  70. struct eth_slow_tlv_header tlv;
  71. } __attribute__ (( packed ));
  72. /** LACP entity (actor or partner) TLV */
  73. struct eth_slow_lacp_entity_tlv {
  74. /** TLV header */
  75. struct eth_slow_tlv_header tlv;
  76. /** System priority
  77. *
  78. * Used to determine the order in which ports are selected for
  79. * aggregation.
  80. */
  81. uint16_t system_priority;
  82. /** System identifier
  83. *
  84. * Used to uniquely identify the system (i.e. the entity with
  85. * potentially multiple ports).
  86. */
  87. uint8_t system[ETH_ALEN];
  88. /** Key
  89. *
  90. * Used to uniquely identify a group of aggregatable ports
  91. * within a system.
  92. */
  93. uint16_t key;
  94. /** Port priority
  95. *
  96. * Used to determine the order in which ports are selected for
  97. * aggregation.
  98. */
  99. uint16_t port_priority;
  100. /** Port identifier
  101. *
  102. * Used to uniquely identify a port within a system.
  103. */
  104. uint16_t port;
  105. /** State
  106. *
  107. * This is the bitwise OR of zero or more LACP_STATE_XXX
  108. * constants.
  109. */
  110. uint8_t state;
  111. /** Reserved */
  112. uint8_t reserved[3];
  113. } __attribute__ (( packed ));
  114. /** Maximum system priority */
  115. #define LACP_SYSTEM_PRIORITY_MAX 0xffff
  116. /** Maximum port priority */
  117. #define LACP_PORT_PRIORITY_MAX 0xff
  118. /** LACP entity is active
  119. *
  120. * Represented by the state character "A"/"a"
  121. */
  122. #define LACP_STATE_ACTIVE 0x01
  123. /** LACP timeout is short
  124. *
  125. * Short timeout is one second, long timeout is 30s
  126. *
  127. * Represented by the state character "F"/"f"
  128. */
  129. #define LACP_STATE_FAST 0x02
  130. /** LACP link is aggregateable
  131. *
  132. * Represented by the state characters "G"/"g"
  133. */
  134. #define LACP_STATE_AGGREGATABLE 0x04
  135. /** LACP link is in synchronisation
  136. *
  137. * Represented by the state characters "S"/"s"
  138. */
  139. #define LACP_STATE_IN_SYNC 0x08
  140. /** LACP link is collecting (receiving)
  141. *
  142. * Represented by the state characters "C"/"c"
  143. */
  144. #define LACP_STATE_COLLECTING 0x10
  145. /** LACP link is distributing (transmitting)
  146. *
  147. * Represented by the state characters "D"/"d"
  148. */
  149. #define LACP_STATE_DISTRIBUTING 0x20
  150. /** LACP entity is using defaulted partner information
  151. *
  152. * Represented by the state characters "L"/"l"
  153. */
  154. #define LACP_STATE_DEFAULTED 0x40
  155. /** LACP entity receive state machine is in EXPIRED
  156. *
  157. * Represented by the state characters "X"/"x"
  158. */
  159. #define LACP_STATE_EXPIRED 0x80
  160. /** LACP fast interval (1 second) */
  161. #define LACP_INTERVAL_FAST 1
  162. /** LACP slow interval (30 seconds) */
  163. #define LACP_INTERVAL_SLOW 30
  164. /** LACP collector TLV */
  165. struct eth_slow_lacp_collector_tlv {
  166. /** TLV header */
  167. struct eth_slow_tlv_header tlv;
  168. /** Maximum delay (in 10us increments) */
  169. uint16_t max_delay;
  170. /** Reserved */
  171. uint8_t reserved[12];
  172. } __attribute__ (( packed ));
  173. /** Marker TLV */
  174. struct eth_slow_marker_tlv {
  175. /** TLV header */
  176. struct eth_slow_tlv_header tlv;
  177. /** Requester port */
  178. uint16_t port;
  179. /** Requester system */
  180. uint8_t system[ETH_ALEN];
  181. /** Requester transaction ID */
  182. uint32_t xact;
  183. /** Padding */
  184. uint16_t pad;
  185. } __attribute__ (( packed ));
  186. /** LACP packet */
  187. struct eth_slow_lacp {
  188. /** Slow protocols header */
  189. struct eth_slow_header header;
  190. /** Actor information */
  191. struct eth_slow_lacp_entity_tlv actor;
  192. /** Partner information */
  193. struct eth_slow_lacp_entity_tlv partner;
  194. /** Collector information */
  195. struct eth_slow_lacp_collector_tlv collector;
  196. /** Terminator */
  197. struct eth_slow_terminator_tlv terminator;
  198. /** Reserved */
  199. uint8_t reserved[50];
  200. } __attribute__ (( packed ));
  201. /** Marker packet */
  202. struct eth_slow_marker {
  203. /** Slow protocols header */
  204. struct eth_slow_header header;
  205. /** Marker information */
  206. struct eth_slow_marker_tlv marker;
  207. /** Terminator */
  208. struct eth_slow_terminator_tlv terminator;
  209. /** Reserved */
  210. uint8_t reserved[90];
  211. } __attribute__ (( packed ));
  212. /** Slow protocols packet */
  213. union eth_slow_packet {
  214. /** Slow protocols header */
  215. struct eth_slow_header header;
  216. /** LACP packet */
  217. struct eth_slow_lacp lacp;
  218. /** Marker packet */
  219. struct eth_slow_marker marker;
  220. } __attribute__ (( packed ));
  221. #endif /* _IPXE_ETH_SLOW_H */