diff options
Diffstat (limited to 'include/linux/ieee80211.h')
-rw-r--r-- | include/linux/ieee80211.h | 540 |
1 files changed, 499 insertions, 41 deletions
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h index 0b5e03eae6d2..14126bc36641 100644 --- a/include/linux/ieee80211.h +++ b/include/linux/ieee80211.h | |||
@@ -98,6 +98,9 @@ | |||
98 | 98 | ||
99 | #define IEEE80211_MAX_SSID_LEN 32 | 99 | #define IEEE80211_MAX_SSID_LEN 32 |
100 | #define IEEE80211_MAX_MESH_ID_LEN 32 | 100 | #define IEEE80211_MAX_MESH_ID_LEN 32 |
101 | #define IEEE80211_QOS_CTL_LEN 2 | ||
102 | #define IEEE80211_QOS_CTL_TID_MASK 0x000F | ||
103 | #define IEEE80211_QOS_CTL_TAG1D_MASK 0x0007 | ||
101 | 104 | ||
102 | struct ieee80211_hdr { | 105 | struct ieee80211_hdr { |
103 | __le16 frame_control; | 106 | __le16 frame_control; |
@@ -109,6 +112,355 @@ struct ieee80211_hdr { | |||
109 | u8 addr4[6]; | 112 | u8 addr4[6]; |
110 | } __attribute__ ((packed)); | 113 | } __attribute__ ((packed)); |
111 | 114 | ||
115 | /** | ||
116 | * ieee80211_has_tods - check if IEEE80211_FCTL_TODS is set | ||
117 | * @fc: frame control bytes in little-endian byteorder | ||
118 | */ | ||
119 | static inline int ieee80211_has_tods(__le16 fc) | ||
120 | { | ||
121 | return (fc & cpu_to_le16(IEEE80211_FCTL_TODS)) != 0; | ||
122 | } | ||
123 | |||
124 | /** | ||
125 | * ieee80211_has_fromds - check if IEEE80211_FCTL_FROMDS is set | ||
126 | * @fc: frame control bytes in little-endian byteorder | ||
127 | */ | ||
128 | static inline int ieee80211_has_fromds(__le16 fc) | ||
129 | { | ||
130 | return (fc & cpu_to_le16(IEEE80211_FCTL_FROMDS)) != 0; | ||
131 | } | ||
132 | |||
133 | /** | ||
134 | * ieee80211_has_a4 - check if IEEE80211_FCTL_TODS and IEEE80211_FCTL_FROMDS are set | ||
135 | * @fc: frame control bytes in little-endian byteorder | ||
136 | */ | ||
137 | static inline int ieee80211_has_a4(__le16 fc) | ||
138 | { | ||
139 | __le16 tmp = cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS); | ||
140 | return (fc & tmp) == tmp; | ||
141 | } | ||
142 | |||
143 | /** | ||
144 | * ieee80211_has_morefrags - check if IEEE80211_FCTL_MOREFRAGS is set | ||
145 | * @fc: frame control bytes in little-endian byteorder | ||
146 | */ | ||
147 | static inline int ieee80211_has_morefrags(__le16 fc) | ||
148 | { | ||
149 | return (fc & cpu_to_le16(IEEE80211_FCTL_MOREFRAGS)) != 0; | ||
150 | } | ||
151 | |||
152 | /** | ||
153 | * ieee80211_has_retry - check if IEEE80211_FCTL_RETRY is set | ||
154 | * @fc: frame control bytes in little-endian byteorder | ||
155 | */ | ||
156 | static inline int ieee80211_has_retry(__le16 fc) | ||
157 | { | ||
158 | return (fc & cpu_to_le16(IEEE80211_FCTL_RETRY)) != 0; | ||
159 | } | ||
160 | |||
161 | /** | ||
162 | * ieee80211_has_pm - check if IEEE80211_FCTL_PM is set | ||
163 | * @fc: frame control bytes in little-endian byteorder | ||
164 | */ | ||
165 | static inline int ieee80211_has_pm(__le16 fc) | ||
166 | { | ||
167 | return (fc & cpu_to_le16(IEEE80211_FCTL_PM)) != 0; | ||
168 | } | ||
169 | |||
170 | /** | ||
171 | * ieee80211_has_moredata - check if IEEE80211_FCTL_MOREDATA is set | ||
172 | * @fc: frame control bytes in little-endian byteorder | ||
173 | */ | ||
174 | static inline int ieee80211_has_moredata(__le16 fc) | ||
175 | { | ||
176 | return (fc & cpu_to_le16(IEEE80211_FCTL_MOREDATA)) != 0; | ||
177 | } | ||
178 | |||
179 | /** | ||
180 | * ieee80211_has_protected - check if IEEE80211_FCTL_PROTECTED is set | ||
181 | * @fc: frame control bytes in little-endian byteorder | ||
182 | */ | ||
183 | static inline int ieee80211_has_protected(__le16 fc) | ||
184 | { | ||
185 | return (fc & cpu_to_le16(IEEE80211_FCTL_PROTECTED)) != 0; | ||
186 | } | ||
187 | |||
188 | /** | ||
189 | * ieee80211_has_order - check if IEEE80211_FCTL_ORDER is set | ||
190 | * @fc: frame control bytes in little-endian byteorder | ||
191 | */ | ||
192 | static inline int ieee80211_has_order(__le16 fc) | ||
193 | { | ||
194 | return (fc & cpu_to_le16(IEEE80211_FCTL_ORDER)) != 0; | ||
195 | } | ||
196 | |||
197 | /** | ||
198 | * ieee80211_is_mgmt - check if type is IEEE80211_FTYPE_MGMT | ||
199 | * @fc: frame control bytes in little-endian byteorder | ||
200 | */ | ||
201 | static inline int ieee80211_is_mgmt(__le16 fc) | ||
202 | { | ||
203 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE)) == | ||
204 | cpu_to_le16(IEEE80211_FTYPE_MGMT); | ||
205 | } | ||
206 | |||
207 | /** | ||
208 | * ieee80211_is_ctl - check if type is IEEE80211_FTYPE_CTL | ||
209 | * @fc: frame control bytes in little-endian byteorder | ||
210 | */ | ||
211 | static inline int ieee80211_is_ctl(__le16 fc) | ||
212 | { | ||
213 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE)) == | ||
214 | cpu_to_le16(IEEE80211_FTYPE_CTL); | ||
215 | } | ||
216 | |||
217 | /** | ||
218 | * ieee80211_is_data - check if type is IEEE80211_FTYPE_DATA | ||
219 | * @fc: frame control bytes in little-endian byteorder | ||
220 | */ | ||
221 | static inline int ieee80211_is_data(__le16 fc) | ||
222 | { | ||
223 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE)) == | ||
224 | cpu_to_le16(IEEE80211_FTYPE_DATA); | ||
225 | } | ||
226 | |||
227 | /** | ||
228 | * ieee80211_is_data_qos - check if type is IEEE80211_FTYPE_DATA and IEEE80211_STYPE_QOS_DATA is set | ||
229 | * @fc: frame control bytes in little-endian byteorder | ||
230 | */ | ||
231 | static inline int ieee80211_is_data_qos(__le16 fc) | ||
232 | { | ||
233 | /* | ||
234 | * mask with QOS_DATA rather than IEEE80211_FCTL_STYPE as we just need | ||
235 | * to check the one bit | ||
236 | */ | ||
237 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_STYPE_QOS_DATA)) == | ||
238 | cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_DATA); | ||
239 | } | ||
240 | |||
241 | /** | ||
242 | * ieee80211_is_data_present - check if type is IEEE80211_FTYPE_DATA and has data | ||
243 | * @fc: frame control bytes in little-endian byteorder | ||
244 | */ | ||
245 | static inline int ieee80211_is_data_present(__le16 fc) | ||
246 | { | ||
247 | /* | ||
248 | * mask with 0x40 and test that that bit is clear to only return true | ||
249 | * for the data-containing substypes. | ||
250 | */ | ||
251 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | 0x40)) == | ||
252 | cpu_to_le16(IEEE80211_FTYPE_DATA); | ||
253 | } | ||
254 | |||
255 | /** | ||
256 | * ieee80211_is_assoc_req - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_ASSOC_REQ | ||
257 | * @fc: frame control bytes in little-endian byteorder | ||
258 | */ | ||
259 | static inline int ieee80211_is_assoc_req(__le16 fc) | ||
260 | { | ||
261 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
262 | cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ASSOC_REQ); | ||
263 | } | ||
264 | |||
265 | /** | ||
266 | * ieee80211_is_assoc_resp - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_ASSOC_RESP | ||
267 | * @fc: frame control bytes in little-endian byteorder | ||
268 | */ | ||
269 | static inline int ieee80211_is_assoc_resp(__le16 fc) | ||
270 | { | ||
271 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
272 | cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ASSOC_RESP); | ||
273 | } | ||
274 | |||
275 | /** | ||
276 | * ieee80211_is_reassoc_req - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_REASSOC_REQ | ||
277 | * @fc: frame control bytes in little-endian byteorder | ||
278 | */ | ||
279 | static inline int ieee80211_is_reassoc_req(__le16 fc) | ||
280 | { | ||
281 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
282 | cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_REASSOC_REQ); | ||
283 | } | ||
284 | |||
285 | /** | ||
286 | * ieee80211_is_reassoc_resp - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_REASSOC_RESP | ||
287 | * @fc: frame control bytes in little-endian byteorder | ||
288 | */ | ||
289 | static inline int ieee80211_is_reassoc_resp(__le16 fc) | ||
290 | { | ||
291 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
292 | cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_REASSOC_RESP); | ||
293 | } | ||
294 | |||
295 | /** | ||
296 | * ieee80211_is_probe_req - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_PROBE_REQ | ||
297 | * @fc: frame control bytes in little-endian byteorder | ||
298 | */ | ||
299 | static inline int ieee80211_is_probe_req(__le16 fc) | ||
300 | { | ||
301 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
302 | cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_REQ); | ||
303 | } | ||
304 | |||
305 | /** | ||
306 | * ieee80211_is_probe_resp - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_PROBE_RESP | ||
307 | * @fc: frame control bytes in little-endian byteorder | ||
308 | */ | ||
309 | static inline int ieee80211_is_probe_resp(__le16 fc) | ||
310 | { | ||
311 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
312 | cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_RESP); | ||
313 | } | ||
314 | |||
315 | /** | ||
316 | * ieee80211_is_beacon - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_BEACON | ||
317 | * @fc: frame control bytes in little-endian byteorder | ||
318 | */ | ||
319 | static inline int ieee80211_is_beacon(__le16 fc) | ||
320 | { | ||
321 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
322 | cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON); | ||
323 | } | ||
324 | |||
325 | /** | ||
326 | * ieee80211_is_atim - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_ATIM | ||
327 | * @fc: frame control bytes in little-endian byteorder | ||
328 | */ | ||
329 | static inline int ieee80211_is_atim(__le16 fc) | ||
330 | { | ||
331 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
332 | cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ATIM); | ||
333 | } | ||
334 | |||
335 | /** | ||
336 | * ieee80211_is_disassoc - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_DISASSOC | ||
337 | * @fc: frame control bytes in little-endian byteorder | ||
338 | */ | ||
339 | static inline int ieee80211_is_disassoc(__le16 fc) | ||
340 | { | ||
341 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
342 | cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_DISASSOC); | ||
343 | } | ||
344 | |||
345 | /** | ||
346 | * ieee80211_is_auth - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_AUTH | ||
347 | * @fc: frame control bytes in little-endian byteorder | ||
348 | */ | ||
349 | static inline int ieee80211_is_auth(__le16 fc) | ||
350 | { | ||
351 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
352 | cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_AUTH); | ||
353 | } | ||
354 | |||
355 | /** | ||
356 | * ieee80211_is_deauth - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_DEAUTH | ||
357 | * @fc: frame control bytes in little-endian byteorder | ||
358 | */ | ||
359 | static inline int ieee80211_is_deauth(__le16 fc) | ||
360 | { | ||
361 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
362 | cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_DEAUTH); | ||
363 | } | ||
364 | |||
365 | /** | ||
366 | * ieee80211_is_action - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_ACTION | ||
367 | * @fc: frame control bytes in little-endian byteorder | ||
368 | */ | ||
369 | static inline int ieee80211_is_action(__le16 fc) | ||
370 | { | ||
371 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
372 | cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ACTION); | ||
373 | } | ||
374 | |||
375 | /** | ||
376 | * ieee80211_is_back_req - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_BACK_REQ | ||
377 | * @fc: frame control bytes in little-endian byteorder | ||
378 | */ | ||
379 | static inline int ieee80211_is_back_req(__le16 fc) | ||
380 | { | ||
381 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
382 | cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_BACK_REQ); | ||
383 | } | ||
384 | |||
385 | /** | ||
386 | * ieee80211_is_back - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_BACK | ||
387 | * @fc: frame control bytes in little-endian byteorder | ||
388 | */ | ||
389 | static inline int ieee80211_is_back(__le16 fc) | ||
390 | { | ||
391 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
392 | cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_BACK); | ||
393 | } | ||
394 | |||
395 | /** | ||
396 | * ieee80211_is_pspoll - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_PSPOLL | ||
397 | * @fc: frame control bytes in little-endian byteorder | ||
398 | */ | ||
399 | static inline int ieee80211_is_pspoll(__le16 fc) | ||
400 | { | ||
401 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
402 | cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_PSPOLL); | ||
403 | } | ||
404 | |||
405 | /** | ||
406 | * ieee80211_is_rts - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_RTS | ||
407 | * @fc: frame control bytes in little-endian byteorder | ||
408 | */ | ||
409 | static inline int ieee80211_is_rts(__le16 fc) | ||
410 | { | ||
411 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
412 | cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_RTS); | ||
413 | } | ||
414 | |||
415 | /** | ||
416 | * ieee80211_is_cts - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_CTS | ||
417 | * @fc: frame control bytes in little-endian byteorder | ||
418 | */ | ||
419 | static inline int ieee80211_is_cts(__le16 fc) | ||
420 | { | ||
421 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
422 | cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CTS); | ||
423 | } | ||
424 | |||
425 | /** | ||
426 | * ieee80211_is_ack - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_ACK | ||
427 | * @fc: frame control bytes in little-endian byteorder | ||
428 | */ | ||
429 | static inline int ieee80211_is_ack(__le16 fc) | ||
430 | { | ||
431 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
432 | cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_ACK); | ||
433 | } | ||
434 | |||
435 | /** | ||
436 | * ieee80211_is_cfend - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_CFEND | ||
437 | * @fc: frame control bytes in little-endian byteorder | ||
438 | */ | ||
439 | static inline int ieee80211_is_cfend(__le16 fc) | ||
440 | { | ||
441 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
442 | cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CFEND); | ||
443 | } | ||
444 | |||
445 | /** | ||
446 | * ieee80211_is_cfendack - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_CFENDACK | ||
447 | * @fc: frame control bytes in little-endian byteorder | ||
448 | */ | ||
449 | static inline int ieee80211_is_cfendack(__le16 fc) | ||
450 | { | ||
451 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
452 | cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CFENDACK); | ||
453 | } | ||
454 | |||
455 | /** | ||
456 | * ieee80211_is_nullfunc - check if FTYPE=IEEE80211_FTYPE_DATA and STYPE=IEEE80211_STYPE_NULLFUNC | ||
457 | * @fc: frame control bytes in little-endian byteorder | ||
458 | */ | ||
459 | static inline int ieee80211_is_nullfunc(__le16 fc) | ||
460 | { | ||
461 | return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == | ||
462 | cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_NULLFUNC); | ||
463 | } | ||
112 | 464 | ||
113 | struct ieee80211s_hdr { | 465 | struct ieee80211s_hdr { |
114 | u8 flags; | 466 | u8 flags; |
@@ -119,6 +471,58 @@ struct ieee80211s_hdr { | |||
119 | u8 eaddr3[6]; | 471 | u8 eaddr3[6]; |
120 | } __attribute__ ((packed)); | 472 | } __attribute__ ((packed)); |
121 | 473 | ||
474 | /* Mesh flags */ | ||
475 | #define MESH_FLAGS_AE_A4 0x1 | ||
476 | #define MESH_FLAGS_AE_A5_A6 0x2 | ||
477 | #define MESH_FLAGS_PS_DEEP 0x4 | ||
478 | |||
479 | /** | ||
480 | * struct ieee80211_quiet_ie | ||
481 | * | ||
482 | * This structure refers to "Quiet information element" | ||
483 | */ | ||
484 | struct ieee80211_quiet_ie { | ||
485 | u8 count; | ||
486 | u8 period; | ||
487 | __le16 duration; | ||
488 | __le16 offset; | ||
489 | } __attribute__ ((packed)); | ||
490 | |||
491 | /** | ||
492 | * struct ieee80211_msrment_ie | ||
493 | * | ||
494 | * This structure refers to "Measurement Request/Report information element" | ||
495 | */ | ||
496 | struct ieee80211_msrment_ie { | ||
497 | u8 token; | ||
498 | u8 mode; | ||
499 | u8 type; | ||
500 | u8 request[0]; | ||
501 | } __attribute__ ((packed)); | ||
502 | |||
503 | /** | ||
504 | * struct ieee80211_channel_sw_ie | ||
505 | * | ||
506 | * This structure refers to "Channel Switch Announcement information element" | ||
507 | */ | ||
508 | struct ieee80211_channel_sw_ie { | ||
509 | u8 mode; | ||
510 | u8 new_ch_num; | ||
511 | u8 count; | ||
512 | } __attribute__ ((packed)); | ||
513 | |||
514 | /** | ||
515 | * struct ieee80211_tim | ||
516 | * | ||
517 | * This structure refers to "Traffic Indication Map information element" | ||
518 | */ | ||
519 | struct ieee80211_tim_ie { | ||
520 | u8 dtim_count; | ||
521 | u8 dtim_period; | ||
522 | u8 bitmap_ctrl; | ||
523 | /* variable size: 1 - 251 bytes */ | ||
524 | u8 virtual_map[0]; | ||
525 | } __attribute__ ((packed)); | ||
122 | 526 | ||
123 | struct ieee80211_mgmt { | 527 | struct ieee80211_mgmt { |
124 | __le16 frame_control; | 528 | __le16 frame_control; |
@@ -194,13 +598,18 @@ struct ieee80211_mgmt { | |||
194 | u8 action_code; | 598 | u8 action_code; |
195 | u8 element_id; | 599 | u8 element_id; |
196 | u8 length; | 600 | u8 length; |
197 | u8 switch_mode; | 601 | struct ieee80211_channel_sw_ie sw_elem; |
198 | u8 new_chan; | ||
199 | u8 switch_count; | ||
200 | } __attribute__((packed)) chan_switch; | 602 | } __attribute__((packed)) chan_switch; |
201 | struct{ | 603 | struct{ |
202 | u8 action_code; | 604 | u8 action_code; |
203 | u8 dialog_token; | 605 | u8 dialog_token; |
606 | u8 element_id; | ||
607 | u8 length; | ||
608 | struct ieee80211_msrment_ie msr_elem; | ||
609 | } __attribute__((packed)) measurement; | ||
610 | struct{ | ||
611 | u8 action_code; | ||
612 | u8 dialog_token; | ||
204 | __le16 capab; | 613 | __le16 capab; |
205 | __le16 timeout; | 614 | __le16 timeout; |
206 | __le16 start_seq_num; | 615 | __le16 start_seq_num; |
@@ -239,6 +648,9 @@ struct ieee80211_mgmt { | |||
239 | } u; | 648 | } u; |
240 | } __attribute__ ((packed)); | 649 | } __attribute__ ((packed)); |
241 | 650 | ||
651 | /* mgmt header + 1 byte category code */ | ||
652 | #define IEEE80211_MIN_ACTION_SIZE offsetof(struct ieee80211_mgmt, u.action.u) | ||
653 | |||
242 | 654 | ||
243 | /* Control frames */ | 655 | /* Control frames */ |
244 | struct ieee80211_rts { | 656 | struct ieee80211_rts { |
@@ -269,6 +681,10 @@ struct ieee80211_bar { | |||
269 | __le16 start_seq_num; | 681 | __le16 start_seq_num; |
270 | } __attribute__((packed)); | 682 | } __attribute__((packed)); |
271 | 683 | ||
684 | /* 802.11 BAR control masks */ | ||
685 | #define IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL 0x0000 | ||
686 | #define IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA 0x0004 | ||
687 | |||
272 | /** | 688 | /** |
273 | * struct ieee80211_ht_cap - HT capabilities | 689 | * struct ieee80211_ht_cap - HT capabilities |
274 | * | 690 | * |
@@ -300,26 +716,55 @@ struct ieee80211_ht_addt_info { | |||
300 | 716 | ||
301 | /* 802.11n HT capabilities masks */ | 717 | /* 802.11n HT capabilities masks */ |
302 | #define IEEE80211_HT_CAP_SUP_WIDTH 0x0002 | 718 | #define IEEE80211_HT_CAP_SUP_WIDTH 0x0002 |
303 | #define IEEE80211_HT_CAP_MIMO_PS 0x000C | 719 | #define IEEE80211_HT_CAP_SM_PS 0x000C |
304 | #define IEEE80211_HT_CAP_GRN_FLD 0x0010 | 720 | #define IEEE80211_HT_CAP_GRN_FLD 0x0010 |
305 | #define IEEE80211_HT_CAP_SGI_20 0x0020 | 721 | #define IEEE80211_HT_CAP_SGI_20 0x0020 |
306 | #define IEEE80211_HT_CAP_SGI_40 0x0040 | 722 | #define IEEE80211_HT_CAP_SGI_40 0x0040 |
307 | #define IEEE80211_HT_CAP_DELAY_BA 0x0400 | 723 | #define IEEE80211_HT_CAP_DELAY_BA 0x0400 |
308 | #define IEEE80211_HT_CAP_MAX_AMSDU 0x0800 | 724 | #define IEEE80211_HT_CAP_MAX_AMSDU 0x0800 |
725 | #define IEEE80211_HT_CAP_DSSSCCK40 0x1000 | ||
726 | /* 802.11n HT capability AMPDU settings */ | ||
309 | #define IEEE80211_HT_CAP_AMPDU_FACTOR 0x03 | 727 | #define IEEE80211_HT_CAP_AMPDU_FACTOR 0x03 |
310 | #define IEEE80211_HT_CAP_AMPDU_DENSITY 0x1C | 728 | #define IEEE80211_HT_CAP_AMPDU_DENSITY 0x1C |
729 | /* 802.11n HT capability MSC set */ | ||
730 | #define IEEE80211_SUPP_MCS_SET_UEQM 4 | ||
731 | #define IEEE80211_HT_CAP_MAX_STREAMS 4 | ||
732 | #define IEEE80211_SUPP_MCS_SET_LEN 10 | ||
733 | /* maximum streams the spec allows */ | ||
734 | #define IEEE80211_HT_CAP_MCS_TX_DEFINED 0x01 | ||
735 | #define IEEE80211_HT_CAP_MCS_TX_RX_DIFF 0x02 | ||
736 | #define IEEE80211_HT_CAP_MCS_TX_STREAMS 0x0C | ||
737 | #define IEEE80211_HT_CAP_MCS_TX_UEQM 0x10 | ||
311 | /* 802.11n HT IE masks */ | 738 | /* 802.11n HT IE masks */ |
312 | #define IEEE80211_HT_IE_CHA_SEC_OFFSET 0x03 | 739 | #define IEEE80211_HT_IE_CHA_SEC_OFFSET 0x03 |
740 | #define IEEE80211_HT_IE_CHA_SEC_NONE 0x00 | ||
741 | #define IEEE80211_HT_IE_CHA_SEC_ABOVE 0x01 | ||
742 | #define IEEE80211_HT_IE_CHA_SEC_BELOW 0x03 | ||
313 | #define IEEE80211_HT_IE_CHA_WIDTH 0x04 | 743 | #define IEEE80211_HT_IE_CHA_WIDTH 0x04 |
314 | #define IEEE80211_HT_IE_HT_PROTECTION 0x0003 | 744 | #define IEEE80211_HT_IE_HT_PROTECTION 0x0003 |
315 | #define IEEE80211_HT_IE_NON_GF_STA_PRSNT 0x0004 | 745 | #define IEEE80211_HT_IE_NON_GF_STA_PRSNT 0x0004 |
316 | #define IEEE80211_HT_IE_NON_HT_STA_PRSNT 0x0010 | 746 | #define IEEE80211_HT_IE_NON_HT_STA_PRSNT 0x0010 |
317 | 747 | ||
318 | /* MIMO Power Save Modes */ | 748 | /* block-ack parameters */ |
319 | #define WLAN_HT_CAP_MIMO_PS_STATIC 0 | 749 | #define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002 |
320 | #define WLAN_HT_CAP_MIMO_PS_DYNAMIC 1 | 750 | #define IEEE80211_ADDBA_PARAM_TID_MASK 0x003C |
321 | #define WLAN_HT_CAP_MIMO_PS_INVALID 2 | 751 | #define IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK 0xFFA0 |
322 | #define WLAN_HT_CAP_MIMO_PS_DISABLED 3 | 752 | #define IEEE80211_DELBA_PARAM_TID_MASK 0xF000 |
753 | #define IEEE80211_DELBA_PARAM_INITIATOR_MASK 0x0800 | ||
754 | |||
755 | /* | ||
756 | * A-PMDU buffer sizes | ||
757 | * According to IEEE802.11n spec size varies from 8K to 64K (in powers of 2) | ||
758 | */ | ||
759 | #define IEEE80211_MIN_AMPDU_BUF 0x8 | ||
760 | #define IEEE80211_MAX_AMPDU_BUF 0x40 | ||
761 | |||
762 | |||
763 | /* Spatial Multiplexing Power Save Modes */ | ||
764 | #define WLAN_HT_CAP_SM_PS_STATIC 0 | ||
765 | #define WLAN_HT_CAP_SM_PS_DYNAMIC 1 | ||
766 | #define WLAN_HT_CAP_SM_PS_INVALID 2 | ||
767 | #define WLAN_HT_CAP_SM_PS_DISABLED 3 | ||
323 | 768 | ||
324 | /* Authentication algorithms */ | 769 | /* Authentication algorithms */ |
325 | #define WLAN_AUTH_OPEN 0 | 770 | #define WLAN_AUTH_OPEN 0 |
@@ -337,11 +782,21 @@ struct ieee80211_ht_addt_info { | |||
337 | #define WLAN_CAPABILITY_SHORT_PREAMBLE (1<<5) | 782 | #define WLAN_CAPABILITY_SHORT_PREAMBLE (1<<5) |
338 | #define WLAN_CAPABILITY_PBCC (1<<6) | 783 | #define WLAN_CAPABILITY_PBCC (1<<6) |
339 | #define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7) | 784 | #define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7) |
785 | |||
340 | /* 802.11h */ | 786 | /* 802.11h */ |
341 | #define WLAN_CAPABILITY_SPECTRUM_MGMT (1<<8) | 787 | #define WLAN_CAPABILITY_SPECTRUM_MGMT (1<<8) |
342 | #define WLAN_CAPABILITY_QOS (1<<9) | 788 | #define WLAN_CAPABILITY_QOS (1<<9) |
343 | #define WLAN_CAPABILITY_SHORT_SLOT_TIME (1<<10) | 789 | #define WLAN_CAPABILITY_SHORT_SLOT_TIME (1<<10) |
344 | #define WLAN_CAPABILITY_DSSS_OFDM (1<<13) | 790 | #define WLAN_CAPABILITY_DSSS_OFDM (1<<13) |
791 | /* measurement */ | ||
792 | #define IEEE80211_SPCT_MSR_RPRT_MODE_LATE (1<<0) | ||
793 | #define IEEE80211_SPCT_MSR_RPRT_MODE_INCAPABLE (1<<1) | ||
794 | #define IEEE80211_SPCT_MSR_RPRT_MODE_REFUSED (1<<2) | ||
795 | |||
796 | #define IEEE80211_SPCT_MSR_RPRT_TYPE_BASIC 0 | ||
797 | #define IEEE80211_SPCT_MSR_RPRT_TYPE_CCA 1 | ||
798 | #define IEEE80211_SPCT_MSR_RPRT_TYPE_RPI 2 | ||
799 | |||
345 | 800 | ||
346 | /* 802.11g ERP information element */ | 801 | /* 802.11g ERP information element */ |
347 | #define WLAN_ERP_NON_ERP_PRESENT (1<<0) | 802 | #define WLAN_ERP_NON_ERP_PRESENT (1<<0) |
@@ -512,6 +967,15 @@ enum ieee80211_category { | |||
512 | WLAN_CATEGORY_WMM = 17, | 967 | WLAN_CATEGORY_WMM = 17, |
513 | }; | 968 | }; |
514 | 969 | ||
970 | /* SPECTRUM_MGMT action code */ | ||
971 | enum ieee80211_spectrum_mgmt_actioncode { | ||
972 | WLAN_ACTION_SPCT_MSR_REQ = 0, | ||
973 | WLAN_ACTION_SPCT_MSR_RPRT = 1, | ||
974 | WLAN_ACTION_SPCT_TPC_REQ = 2, | ||
975 | WLAN_ACTION_SPCT_TPC_RPRT = 3, | ||
976 | WLAN_ACTION_SPCT_CHL_SWITCH = 4, | ||
977 | }; | ||
978 | |||
515 | /* BACK action code */ | 979 | /* BACK action code */ |
516 | enum ieee80211_back_actioncode { | 980 | enum ieee80211_back_actioncode { |
517 | WLAN_ACTION_ADDBA_REQ = 0, | 981 | WLAN_ACTION_ADDBA_REQ = 0, |
@@ -540,63 +1004,57 @@ enum ieee80211_back_parties { | |||
540 | #define WLAN_MAX_KEY_LEN 32 | 1004 | #define WLAN_MAX_KEY_LEN 32 |
541 | 1005 | ||
542 | /** | 1006 | /** |
1007 | * ieee80211_get_qos_ctl - get pointer to qos control bytes | ||
1008 | * @hdr: the frame | ||
1009 | * | ||
1010 | * The qos ctrl bytes come after the frame_control, duration, seq_num | ||
1011 | * and 3 or 4 addresses of length ETH_ALEN. | ||
1012 | * 3 addr: 2 + 2 + 2 + 3*6 = 24 | ||
1013 | * 4 addr: 2 + 2 + 2 + 4*6 = 30 | ||
1014 | */ | ||
1015 | static inline u8 *ieee80211_get_qos_ctl(struct ieee80211_hdr *hdr) | ||
1016 | { | ||
1017 | if (ieee80211_has_a4(hdr->frame_control)) | ||
1018 | return (u8 *)hdr + 30; | ||
1019 | else | ||
1020 | return (u8 *)hdr + 24; | ||
1021 | } | ||
1022 | |||
1023 | /** | ||
543 | * ieee80211_get_SA - get pointer to SA | 1024 | * ieee80211_get_SA - get pointer to SA |
1025 | * @hdr: the frame | ||
544 | * | 1026 | * |
545 | * Given an 802.11 frame, this function returns the offset | 1027 | * Given an 802.11 frame, this function returns the offset |
546 | * to the source address (SA). It does not verify that the | 1028 | * to the source address (SA). It does not verify that the |
547 | * header is long enough to contain the address, and the | 1029 | * header is long enough to contain the address, and the |
548 | * header must be long enough to contain the frame control | 1030 | * header must be long enough to contain the frame control |
549 | * field. | 1031 | * field. |
550 | * | ||
551 | * @hdr: the frame | ||
552 | */ | 1032 | */ |
553 | static inline u8 *ieee80211_get_SA(struct ieee80211_hdr *hdr) | 1033 | static inline u8 *ieee80211_get_SA(struct ieee80211_hdr *hdr) |
554 | { | 1034 | { |
555 | u8 *raw = (u8 *) hdr; | 1035 | if (ieee80211_has_a4(hdr->frame_control)) |
556 | u8 tofrom = (*(raw+1)) & 3; /* get the TODS and FROMDS bits */ | 1036 | return hdr->addr4; |
557 | 1037 | if (ieee80211_has_fromds(hdr->frame_control)) | |
558 | switch (tofrom) { | 1038 | return hdr->addr3; |
559 | case 2: | ||
560 | return hdr->addr3; | ||
561 | case 3: | ||
562 | return hdr->addr4; | ||
563 | } | ||
564 | return hdr->addr2; | 1039 | return hdr->addr2; |
565 | } | 1040 | } |
566 | 1041 | ||
567 | /** | 1042 | /** |
568 | * ieee80211_get_DA - get pointer to DA | 1043 | * ieee80211_get_DA - get pointer to DA |
1044 | * @hdr: the frame | ||
569 | * | 1045 | * |
570 | * Given an 802.11 frame, this function returns the offset | 1046 | * Given an 802.11 frame, this function returns the offset |
571 | * to the destination address (DA). It does not verify that | 1047 | * to the destination address (DA). It does not verify that |
572 | * the header is long enough to contain the address, and the | 1048 | * the header is long enough to contain the address, and the |
573 | * header must be long enough to contain the frame control | 1049 | * header must be long enough to contain the frame control |
574 | * field. | 1050 | * field. |
575 | * | ||
576 | * @hdr: the frame | ||
577 | */ | 1051 | */ |
578 | static inline u8 *ieee80211_get_DA(struct ieee80211_hdr *hdr) | 1052 | static inline u8 *ieee80211_get_DA(struct ieee80211_hdr *hdr) |
579 | { | 1053 | { |
580 | u8 *raw = (u8 *) hdr; | 1054 | if (ieee80211_has_tods(hdr->frame_control)) |
581 | u8 to_ds = (*(raw+1)) & 1; /* get the TODS bit */ | ||
582 | |||
583 | if (to_ds) | ||
584 | return hdr->addr3; | 1055 | return hdr->addr3; |
585 | return hdr->addr1; | 1056 | else |
586 | } | 1057 | return hdr->addr1; |
587 | |||
588 | /** | ||
589 | * ieee80211_get_morefrag - determine whether the MOREFRAGS bit is set | ||
590 | * | ||
591 | * This function determines whether the "more fragments" bit is set | ||
592 | * in the frame. | ||
593 | * | ||
594 | * @hdr: the frame | ||
595 | */ | ||
596 | static inline int ieee80211_get_morefrag(struct ieee80211_hdr *hdr) | ||
597 | { | ||
598 | return (le16_to_cpu(hdr->frame_control) & | ||
599 | IEEE80211_FCTL_MOREFRAGS) != 0; | ||
600 | } | 1058 | } |
601 | 1059 | ||
602 | #endif /* IEEE80211_H */ | 1060 | #endif /* IEEE80211_H */ |