aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ieee80211.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/ieee80211.h')
-rw-r--r--include/linux/ieee80211.h429
1 files changed, 393 insertions, 36 deletions
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 0b5e03eae6d2..2998e3b5f166 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -98,6 +98,7 @@
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
101 102
102struct ieee80211_hdr { 103struct ieee80211_hdr {
103 __le16 frame_control; 104 __le16 frame_control;
@@ -109,6 +110,355 @@ struct ieee80211_hdr {
109 u8 addr4[6]; 110 u8 addr4[6];
110} __attribute__ ((packed)); 111} __attribute__ ((packed));
111 112
113/**
114 * ieee80211_has_tods - check if IEEE80211_FCTL_TODS is set
115 * @fc: frame control bytes in little-endian byteorder
116 */
117static inline int ieee80211_has_tods(__le16 fc)
118{
119 return (fc & cpu_to_le16(IEEE80211_FCTL_TODS)) != 0;
120}
121
122/**
123 * ieee80211_has_fromds - check if IEEE80211_FCTL_FROMDS is set
124 * @fc: frame control bytes in little-endian byteorder
125 */
126static inline int ieee80211_has_fromds(__le16 fc)
127{
128 return (fc & cpu_to_le16(IEEE80211_FCTL_FROMDS)) != 0;
129}
130
131/**
132 * ieee80211_has_a4 - check if IEEE80211_FCTL_TODS and IEEE80211_FCTL_FROMDS are set
133 * @fc: frame control bytes in little-endian byteorder
134 */
135static inline int ieee80211_has_a4(__le16 fc)
136{
137 __le16 tmp = cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS);
138 return (fc & tmp) == tmp;
139}
140
141/**
142 * ieee80211_has_morefrags - check if IEEE80211_FCTL_MOREFRAGS is set
143 * @fc: frame control bytes in little-endian byteorder
144 */
145static inline int ieee80211_has_morefrags(__le16 fc)
146{
147 return (fc & cpu_to_le16(IEEE80211_FCTL_MOREFRAGS)) != 0;
148}
149
150/**
151 * ieee80211_has_retry - check if IEEE80211_FCTL_RETRY is set
152 * @fc: frame control bytes in little-endian byteorder
153 */
154static inline int ieee80211_has_retry(__le16 fc)
155{
156 return (fc & cpu_to_le16(IEEE80211_FCTL_RETRY)) != 0;
157}
158
159/**
160 * ieee80211_has_pm - check if IEEE80211_FCTL_PM is set
161 * @fc: frame control bytes in little-endian byteorder
162 */
163static inline int ieee80211_has_pm(__le16 fc)
164{
165 return (fc & cpu_to_le16(IEEE80211_FCTL_PM)) != 0;
166}
167
168/**
169 * ieee80211_has_moredata - check if IEEE80211_FCTL_MOREDATA is set
170 * @fc: frame control bytes in little-endian byteorder
171 */
172static inline int ieee80211_has_moredata(__le16 fc)
173{
174 return (fc & cpu_to_le16(IEEE80211_FCTL_MOREDATA)) != 0;
175}
176
177/**
178 * ieee80211_has_protected - check if IEEE80211_FCTL_PROTECTED is set
179 * @fc: frame control bytes in little-endian byteorder
180 */
181static inline int ieee80211_has_protected(__le16 fc)
182{
183 return (fc & cpu_to_le16(IEEE80211_FCTL_PROTECTED)) != 0;
184}
185
186/**
187 * ieee80211_has_order - check if IEEE80211_FCTL_ORDER is set
188 * @fc: frame control bytes in little-endian byteorder
189 */
190static inline int ieee80211_has_order(__le16 fc)
191{
192 return (fc & cpu_to_le16(IEEE80211_FCTL_ORDER)) != 0;
193}
194
195/**
196 * ieee80211_is_mgmt - check if type is IEEE80211_FTYPE_MGMT
197 * @fc: frame control bytes in little-endian byteorder
198 */
199static inline int ieee80211_is_mgmt(__le16 fc)
200{
201 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE)) ==
202 cpu_to_le16(IEEE80211_FTYPE_MGMT);
203}
204
205/**
206 * ieee80211_is_ctl - check if type is IEEE80211_FTYPE_CTL
207 * @fc: frame control bytes in little-endian byteorder
208 */
209static inline int ieee80211_is_ctl(__le16 fc)
210{
211 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE)) ==
212 cpu_to_le16(IEEE80211_FTYPE_CTL);
213}
214
215/**
216 * ieee80211_is_data - check if type is IEEE80211_FTYPE_DATA
217 * @fc: frame control bytes in little-endian byteorder
218 */
219static inline int ieee80211_is_data(__le16 fc)
220{
221 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE)) ==
222 cpu_to_le16(IEEE80211_FTYPE_DATA);
223}
224
225/**
226 * ieee80211_is_data_qos - check if type is IEEE80211_FTYPE_DATA and IEEE80211_STYPE_QOS_DATA is set
227 * @fc: frame control bytes in little-endian byteorder
228 */
229static inline int ieee80211_is_data_qos(__le16 fc)
230{
231 /*
232 * mask with QOS_DATA rather than IEEE80211_FCTL_STYPE as we just need
233 * to check the one bit
234 */
235 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_STYPE_QOS_DATA)) ==
236 cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_DATA);
237}
238
239/**
240 * ieee80211_is_data_present - check if type is IEEE80211_FTYPE_DATA and has data
241 * @fc: frame control bytes in little-endian byteorder
242 */
243static inline int ieee80211_is_data_present(__le16 fc)
244{
245 /*
246 * mask with 0x40 and test that that bit is clear to only return true
247 * for the data-containing substypes.
248 */
249 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | 0x40)) ==
250 cpu_to_le16(IEEE80211_FTYPE_DATA);
251}
252
253/**
254 * ieee80211_is_assoc_req - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_ASSOC_REQ
255 * @fc: frame control bytes in little-endian byteorder
256 */
257static inline int ieee80211_is_assoc_req(__le16 fc)
258{
259 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
260 cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ASSOC_REQ);
261}
262
263/**
264 * ieee80211_is_assoc_resp - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_ASSOC_RESP
265 * @fc: frame control bytes in little-endian byteorder
266 */
267static inline int ieee80211_is_assoc_resp(__le16 fc)
268{
269 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
270 cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ASSOC_RESP);
271}
272
273/**
274 * ieee80211_is_reassoc_req - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_REASSOC_REQ
275 * @fc: frame control bytes in little-endian byteorder
276 */
277static inline int ieee80211_is_reassoc_req(__le16 fc)
278{
279 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
280 cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_REASSOC_REQ);
281}
282
283/**
284 * ieee80211_is_reassoc_resp - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_REASSOC_RESP
285 * @fc: frame control bytes in little-endian byteorder
286 */
287static inline int ieee80211_is_reassoc_resp(__le16 fc)
288{
289 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
290 cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_REASSOC_RESP);
291}
292
293/**
294 * ieee80211_is_probe_req - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_PROBE_REQ
295 * @fc: frame control bytes in little-endian byteorder
296 */
297static inline int ieee80211_is_probe_req(__le16 fc)
298{
299 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
300 cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_REQ);
301}
302
303/**
304 * ieee80211_is_probe_resp - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_PROBE_RESP
305 * @fc: frame control bytes in little-endian byteorder
306 */
307static inline int ieee80211_is_probe_resp(__le16 fc)
308{
309 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
310 cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_RESP);
311}
312
313/**
314 * ieee80211_is_beacon - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_BEACON
315 * @fc: frame control bytes in little-endian byteorder
316 */
317static inline int ieee80211_is_beacon(__le16 fc)
318{
319 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
320 cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON);
321}
322
323/**
324 * ieee80211_is_atim - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_ATIM
325 * @fc: frame control bytes in little-endian byteorder
326 */
327static inline int ieee80211_is_atim(__le16 fc)
328{
329 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
330 cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ATIM);
331}
332
333/**
334 * ieee80211_is_disassoc - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_DISASSOC
335 * @fc: frame control bytes in little-endian byteorder
336 */
337static inline int ieee80211_is_disassoc(__le16 fc)
338{
339 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
340 cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_DISASSOC);
341}
342
343/**
344 * ieee80211_is_auth - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_AUTH
345 * @fc: frame control bytes in little-endian byteorder
346 */
347static inline int ieee80211_is_auth(__le16 fc)
348{
349 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
350 cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_AUTH);
351}
352
353/**
354 * ieee80211_is_deauth - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_DEAUTH
355 * @fc: frame control bytes in little-endian byteorder
356 */
357static inline int ieee80211_is_deauth(__le16 fc)
358{
359 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
360 cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_DEAUTH);
361}
362
363/**
364 * ieee80211_is_action - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_ACTION
365 * @fc: frame control bytes in little-endian byteorder
366 */
367static inline int ieee80211_is_action(__le16 fc)
368{
369 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
370 cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ACTION);
371}
372
373/**
374 * ieee80211_is_back_req - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_BACK_REQ
375 * @fc: frame control bytes in little-endian byteorder
376 */
377static inline int ieee80211_is_back_req(__le16 fc)
378{
379 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
380 cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_BACK_REQ);
381}
382
383/**
384 * ieee80211_is_back - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_BACK
385 * @fc: frame control bytes in little-endian byteorder
386 */
387static inline int ieee80211_is_back(__le16 fc)
388{
389 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
390 cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_BACK);
391}
392
393/**
394 * ieee80211_is_pspoll - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_PSPOLL
395 * @fc: frame control bytes in little-endian byteorder
396 */
397static inline int ieee80211_is_pspoll(__le16 fc)
398{
399 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
400 cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_PSPOLL);
401}
402
403/**
404 * ieee80211_is_rts - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_RTS
405 * @fc: frame control bytes in little-endian byteorder
406 */
407static inline int ieee80211_is_rts(__le16 fc)
408{
409 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
410 cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_RTS);
411}
412
413/**
414 * ieee80211_is_cts - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_CTS
415 * @fc: frame control bytes in little-endian byteorder
416 */
417static inline int ieee80211_is_cts(__le16 fc)
418{
419 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
420 cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CTS);
421}
422
423/**
424 * ieee80211_is_ack - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_ACK
425 * @fc: frame control bytes in little-endian byteorder
426 */
427static inline int ieee80211_is_ack(__le16 fc)
428{
429 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
430 cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_ACK);
431}
432
433/**
434 * ieee80211_is_cfend - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_CFEND
435 * @fc: frame control bytes in little-endian byteorder
436 */
437static inline int ieee80211_is_cfend(__le16 fc)
438{
439 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
440 cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CFEND);
441}
442
443/**
444 * ieee80211_is_cfendack - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_CFENDACK
445 * @fc: frame control bytes in little-endian byteorder
446 */
447static inline int ieee80211_is_cfendack(__le16 fc)
448{
449 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
450 cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CFENDACK);
451}
452
453/**
454 * ieee80211_is_nullfunc - check if FTYPE=IEEE80211_FTYPE_DATA and STYPE=IEEE80211_STYPE_NULLFUNC
455 * @fc: frame control bytes in little-endian byteorder
456 */
457static inline int ieee80211_is_nullfunc(__le16 fc)
458{
459 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
460 cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_NULLFUNC);
461}
112 462
113struct ieee80211s_hdr { 463struct ieee80211s_hdr {
114 u8 flags; 464 u8 flags;
@@ -306,20 +656,33 @@ struct ieee80211_ht_addt_info {
306#define IEEE80211_HT_CAP_SGI_40 0x0040 656#define IEEE80211_HT_CAP_SGI_40 0x0040
307#define IEEE80211_HT_CAP_DELAY_BA 0x0400 657#define IEEE80211_HT_CAP_DELAY_BA 0x0400
308#define IEEE80211_HT_CAP_MAX_AMSDU 0x0800 658#define IEEE80211_HT_CAP_MAX_AMSDU 0x0800
659/* 802.11n HT capability AMPDU settings */
309#define IEEE80211_HT_CAP_AMPDU_FACTOR 0x03 660#define IEEE80211_HT_CAP_AMPDU_FACTOR 0x03
310#define IEEE80211_HT_CAP_AMPDU_DENSITY 0x1C 661#define IEEE80211_HT_CAP_AMPDU_DENSITY 0x1C
662/* 802.11n HT capability MSC set */
663#define IEEE80211_SUPP_MCS_SET_UEQM 4
664#define IEEE80211_HT_CAP_MAX_STREAMS 4
665#define IEEE80211_SUPP_MCS_SET_LEN 10
666/* maximum streams the spec allows */
667#define IEEE80211_HT_CAP_MCS_TX_DEFINED 0x01
668#define IEEE80211_HT_CAP_MCS_TX_RX_DIFF 0x02
669#define IEEE80211_HT_CAP_MCS_TX_STREAMS 0x0C
670#define IEEE80211_HT_CAP_MCS_TX_UEQM 0x10
311/* 802.11n HT IE masks */ 671/* 802.11n HT IE masks */
312#define IEEE80211_HT_IE_CHA_SEC_OFFSET 0x03 672#define IEEE80211_HT_IE_CHA_SEC_OFFSET 0x03
673#define IEEE80211_HT_IE_CHA_SEC_NONE 0x00
674#define IEEE80211_HT_IE_CHA_SEC_ABOVE 0x01
675#define IEEE80211_HT_IE_CHA_SEC_BELOW 0x03
313#define IEEE80211_HT_IE_CHA_WIDTH 0x04 676#define IEEE80211_HT_IE_CHA_WIDTH 0x04
314#define IEEE80211_HT_IE_HT_PROTECTION 0x0003 677#define IEEE80211_HT_IE_HT_PROTECTION 0x0003
315#define IEEE80211_HT_IE_NON_GF_STA_PRSNT 0x0004 678#define IEEE80211_HT_IE_NON_GF_STA_PRSNT 0x0004
316#define IEEE80211_HT_IE_NON_HT_STA_PRSNT 0x0010 679#define IEEE80211_HT_IE_NON_HT_STA_PRSNT 0x0010
317 680
318/* MIMO Power Save Modes */ 681/* MIMO Power Save Modes */
319#define WLAN_HT_CAP_MIMO_PS_STATIC 0 682#define WLAN_HT_CAP_MIMO_PS_STATIC 0
320#define WLAN_HT_CAP_MIMO_PS_DYNAMIC 1 683#define WLAN_HT_CAP_MIMO_PS_DYNAMIC 1
321#define WLAN_HT_CAP_MIMO_PS_INVALID 2 684#define WLAN_HT_CAP_MIMO_PS_INVALID 2
322#define WLAN_HT_CAP_MIMO_PS_DISABLED 3 685#define WLAN_HT_CAP_MIMO_PS_DISABLED 3
323 686
324/* Authentication algorithms */ 687/* Authentication algorithms */
325#define WLAN_AUTH_OPEN 0 688#define WLAN_AUTH_OPEN 0
@@ -540,63 +903,57 @@ enum ieee80211_back_parties {
540#define WLAN_MAX_KEY_LEN 32 903#define WLAN_MAX_KEY_LEN 32
541 904
542/** 905/**
906 * ieee80211_get_qos_ctl - get pointer to qos control bytes
907 * @hdr: the frame
908 *
909 * The qos ctrl bytes come after the frame_control, duration, seq_num
910 * and 3 or 4 addresses of length ETH_ALEN.
911 * 3 addr: 2 + 2 + 2 + 3*6 = 24
912 * 4 addr: 2 + 2 + 2 + 4*6 = 30
913 */
914static inline u8 *ieee80211_get_qos_ctl(struct ieee80211_hdr *hdr)
915{
916 if (ieee80211_has_a4(hdr->frame_control))
917 return (u8 *)hdr + 30;
918 else
919 return (u8 *)hdr + 24;
920}
921
922/**
543 * ieee80211_get_SA - get pointer to SA 923 * ieee80211_get_SA - get pointer to SA
924 * @hdr: the frame
544 * 925 *
545 * Given an 802.11 frame, this function returns the offset 926 * Given an 802.11 frame, this function returns the offset
546 * to the source address (SA). It does not verify that the 927 * to the source address (SA). It does not verify that the
547 * header is long enough to contain the address, and the 928 * header is long enough to contain the address, and the
548 * header must be long enough to contain the frame control 929 * header must be long enough to contain the frame control
549 * field. 930 * field.
550 *
551 * @hdr: the frame
552 */ 931 */
553static inline u8 *ieee80211_get_SA(struct ieee80211_hdr *hdr) 932static inline u8 *ieee80211_get_SA(struct ieee80211_hdr *hdr)
554{ 933{
555 u8 *raw = (u8 *) hdr; 934 if (ieee80211_has_a4(hdr->frame_control))
556 u8 tofrom = (*(raw+1)) & 3; /* get the TODS and FROMDS bits */ 935 return hdr->addr4;
557 936 if (ieee80211_has_fromds(hdr->frame_control))
558 switch (tofrom) { 937 return hdr->addr3;
559 case 2:
560 return hdr->addr3;
561 case 3:
562 return hdr->addr4;
563 }
564 return hdr->addr2; 938 return hdr->addr2;
565} 939}
566 940
567/** 941/**
568 * ieee80211_get_DA - get pointer to DA 942 * ieee80211_get_DA - get pointer to DA
943 * @hdr: the frame
569 * 944 *
570 * Given an 802.11 frame, this function returns the offset 945 * Given an 802.11 frame, this function returns the offset
571 * to the destination address (DA). It does not verify that 946 * to the destination address (DA). It does not verify that
572 * the header is long enough to contain the address, and the 947 * the header is long enough to contain the address, and the
573 * header must be long enough to contain the frame control 948 * header must be long enough to contain the frame control
574 * field. 949 * field.
575 *
576 * @hdr: the frame
577 */ 950 */
578static inline u8 *ieee80211_get_DA(struct ieee80211_hdr *hdr) 951static inline u8 *ieee80211_get_DA(struct ieee80211_hdr *hdr)
579{ 952{
580 u8 *raw = (u8 *) hdr; 953 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; 954 return hdr->addr3;
585 return hdr->addr1; 955 else
586} 956 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 */
596static inline int ieee80211_get_morefrag(struct ieee80211_hdr *hdr)
597{
598 return (le16_to_cpu(hdr->frame_control) &
599 IEEE80211_FCTL_MOREFRAGS) != 0;
600} 957}
601 958
602#endif /* IEEE80211_H */ 959#endif /* IEEE80211_H */