iPXE
eth_slow.h
Go to the documentation of this file.
00001 #ifndef _IPXE_ETH_SLOW_H
00002 #define _IPXE_ETH_SLOW_H
00003 
00004 /** @file
00005  *
00006  * Ethernet slow protocols
00007  *
00008  */
00009 
00010 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
00011 
00012 /** Slow protocols header */
00013 struct eth_slow_header {
00014         /** Slow protocols subtype */
00015         uint8_t subtype;
00016         /** Subtype version number */
00017         uint8_t version;
00018 } __attribute__ (( packed ));
00019 
00020 /** LACP subtype */
00021 #define ETH_SLOW_SUBTYPE_LACP 1
00022 
00023 /** LACP version number */
00024 #define ETH_SLOW_LACP_VERSION 1
00025 
00026 /** Marker subtype */
00027 #define ETH_SLOW_SUBTYPE_MARKER 2
00028 
00029 /** Marker version number */
00030 #define ETH_SLOW_MARKER_VERSION 1
00031 
00032 /** TLV (type, length, value) header */
00033 struct eth_slow_tlv_header {
00034         /** Type
00035          *
00036          * This is an ETH_SLOW_TLV_XXX constant.
00037          */
00038         uint8_t type;
00039         /** Length
00040          *
00041          * The length includes the TLV header (except for a TLV
00042          * terminator, which has a length of zero).
00043          */
00044         uint8_t length;
00045 } __attribute__ (( packed ));
00046 
00047 /** Terminator type */
00048 #define ETH_SLOW_TLV_TERMINATOR 0
00049 
00050 /** Terminator length */
00051 #define ETH_SLOW_TLV_TERMINATOR_LEN 0
00052 
00053 /** LACP actor type */
00054 #define ETH_SLOW_TLV_LACP_ACTOR 1
00055 
00056 /** LACP actor length */
00057 #define ETH_SLOW_TLV_LACP_ACTOR_LEN \
00058         ( sizeof ( struct eth_slow_lacp_entity_tlv ) )
00059 
00060 /** LACP partner type */
00061 #define ETH_SLOW_TLV_LACP_PARTNER 2
00062 
00063 /** LACP partner length */
00064 #define ETH_SLOW_TLV_LACP_PARTNER_LEN \
00065         ( sizeof ( struct eth_slow_lacp_entity_tlv ) )
00066 
00067 /** LACP collector type */
00068 #define ETH_SLOW_TLV_LACP_COLLECTOR 3
00069 
00070 /** LACP collector length */
00071 #define ETH_SLOW_TLV_LACP_COLLECTOR_LEN \
00072         ( sizeof ( struct eth_slow_lacp_collector_tlv ) )
00073 
00074 /** Marker request type */
00075 #define ETH_SLOW_TLV_MARKER_REQUEST 1
00076 
00077 /** Marker request length */
00078 #define ETH_SLOW_TLV_MARKER_REQUEST_LEN \
00079         ( sizeof ( struct eth_slow_marker_tlv ) )
00080 
00081 /** Marker response type */
00082 #define ETH_SLOW_TLV_MARKER_RESPONSE 2
00083 
00084 /** Marker response length */
00085 #define ETH_SLOW_TLV_MARKER_RESPONSE_LEN \
00086         ( sizeof ( struct eth_slow_marker_tlv ) )
00087 
00088 /** Terminator TLV */
00089 struct eth_slow_terminator_tlv {
00090         /** TLV header */
00091         struct eth_slow_tlv_header tlv;
00092 } __attribute__ (( packed ));
00093 
00094 /** LACP entity (actor or partner) TLV */
00095 struct eth_slow_lacp_entity_tlv {
00096         /** TLV header */
00097         struct eth_slow_tlv_header tlv;
00098         /** System priority
00099          *
00100          * Used to determine the order in which ports are selected for
00101          * aggregation.
00102          */
00103         uint16_t system_priority;
00104         /** System identifier
00105          *
00106          * Used to uniquely identify the system (i.e. the entity with
00107          * potentially multiple ports).
00108          */
00109         uint8_t system[ETH_ALEN];
00110         /** Key
00111          *
00112          * Used to uniquely identify a group of aggregatable ports
00113          * within a system.
00114          */
00115         uint16_t key;
00116         /** Port priority
00117          *
00118          * Used to determine the order in which ports are selected for
00119          * aggregation.
00120          */
00121         uint16_t port_priority;
00122         /** Port identifier
00123          *
00124          * Used to uniquely identify a port within a system.
00125          */
00126         uint16_t port;
00127         /** State
00128          *
00129          * This is the bitwise OR of zero or more LACP_STATE_XXX
00130          * constants.
00131          */
00132         uint8_t state;
00133         /** Reserved */
00134         uint8_t reserved[3];
00135 } __attribute__ (( packed ));
00136 
00137 /** Maximum system priority */
00138 #define LACP_SYSTEM_PRIORITY_MAX 0xffff
00139 
00140 /** Maximum port priority */
00141 #define LACP_PORT_PRIORITY_MAX 0xff
00142 
00143 /** LACP entity is active
00144  *
00145  * Represented by the state character "A"/"a"
00146  */
00147 #define LACP_STATE_ACTIVE 0x01
00148 
00149 /** LACP timeout is short
00150  *
00151  * Short timeout is one second, long timeout is 30s
00152  *
00153  * Represented by the state character "F"/"f"
00154  */
00155 #define LACP_STATE_FAST 0x02
00156 
00157 /** LACP link is aggregateable
00158  *
00159  * Represented by the state characters "G"/"g"
00160  */
00161 #define LACP_STATE_AGGREGATABLE 0x04
00162 
00163 /** LACP link is in synchronisation
00164  *
00165  * Represented by the state characters "S"/"s"
00166  */
00167 #define LACP_STATE_IN_SYNC 0x08
00168 
00169 /** LACP link is collecting (receiving)
00170  *
00171  * Represented by the state characters "C"/"c"
00172  */
00173 #define LACP_STATE_COLLECTING 0x10
00174 
00175 /** LACP link is distributing (transmitting)
00176  *
00177  * Represented by the state characters "D"/"d"
00178  */
00179 #define LACP_STATE_DISTRIBUTING 0x20
00180 
00181 /** LACP entity is using defaulted partner information
00182  *
00183  * Represented by the state characters "L"/"l"
00184  */
00185 #define LACP_STATE_DEFAULTED 0x40
00186 
00187 /** LACP entity receive state machine is in EXPIRED
00188  *
00189  * Represented by the state characters "X"/"x"
00190  */
00191 #define LACP_STATE_EXPIRED 0x80
00192 
00193 /** LACP fast interval (1 second) */
00194 #define LACP_INTERVAL_FAST 1
00195 
00196 /** LACP slow interval (30 seconds) */
00197 #define LACP_INTERVAL_SLOW 30
00198 
00199 /** LACP collector TLV */
00200 struct eth_slow_lacp_collector_tlv {
00201         /** TLV header */
00202         struct eth_slow_tlv_header tlv;
00203         /** Maximum delay (in 10us increments) */
00204         uint16_t max_delay;
00205         /** Reserved */
00206         uint8_t reserved[12];
00207 } __attribute__ (( packed ));
00208 
00209 /** Marker TLV */
00210 struct eth_slow_marker_tlv {
00211         /** TLV header */
00212         struct eth_slow_tlv_header tlv;
00213         /** Requester port */
00214         uint16_t port;
00215         /** Requester system */
00216         uint8_t system[ETH_ALEN];
00217         /** Requester transaction ID */
00218         uint32_t xact;
00219         /** Padding */
00220         uint16_t pad;
00221 } __attribute__ (( packed ));
00222 
00223 /** LACP packet */
00224 struct eth_slow_lacp {
00225         /** Slow protocols header */
00226         struct eth_slow_header header;
00227         /** Actor information */
00228         struct eth_slow_lacp_entity_tlv actor;
00229         /** Partner information */
00230         struct eth_slow_lacp_entity_tlv partner;
00231         /** Collector information */
00232         struct eth_slow_lacp_collector_tlv collector;
00233         /** Terminator */
00234         struct eth_slow_terminator_tlv terminator;
00235         /** Reserved */
00236         uint8_t reserved[50];
00237 } __attribute__ (( packed ));
00238 
00239 /** Marker packet */
00240 struct eth_slow_marker {
00241         /** Slow protocols header */
00242         struct eth_slow_header header;
00243         /** Marker information */
00244         struct eth_slow_marker_tlv marker;
00245         /** Terminator */
00246         struct eth_slow_terminator_tlv terminator;
00247         /** Reserved */
00248         uint8_t reserved[90];
00249 } __attribute__ (( packed ));
00250 
00251 /** Slow protocols packet */
00252 union eth_slow_packet {
00253         /** Slow protocols header */
00254         struct eth_slow_header header;
00255         /** LACP packet */
00256         struct eth_slow_lacp lacp;
00257         /** Marker packet */
00258         struct eth_slow_marker marker;
00259 } __attribute__ (( packed ));
00260 
00261 #endif /* _IPXE_ETH_SLOW_H */