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