Warning, cross-references for /kernel/include/drivers/net/ieee80211_standard.h need to be fixed.
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032 #ifndef STANDARD_IEEE80211_H
0033 #define STANDARD_IEEE80211_H
0034
0035 #include <types.h>
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053 #define FCS_LEN 4
0054
0055 #define IEEE80211_FCTL_VERS 0x0003
0056 #define IEEE80211_FCTL_FTYPE 0x000c
0057 #define IEEE80211_FCTL_STYPE 0x00f0
0058 #define IEEE80211_FCTL_TODS 0x0100
0059 #define IEEE80211_FCTL_FROMDS 0x0200
0060 #define IEEE80211_FCTL_MOREFRAGS 0x0400
0061 #define IEEE80211_FCTL_RETRY 0x0800
0062 #define IEEE80211_FCTL_PM 0x1000
0063 #define IEEE80211_FCTL_MOREDATA 0x2000
0064 #define IEEE80211_FCTL_PROTECTED 0x4000
0065 #define IEEE80211_FCTL_ORDER 0x8000
0066
0067 #define IEEE80211_SCTL_FRAG 0x000F
0068 #define IEEE80211_SCTL_SEQ 0xFFF0
0069
0070 #define IEEE80211_FTYPE_MGMT 0x0000
0071 #define IEEE80211_FTYPE_CTL 0x0004
0072 #define IEEE80211_FTYPE_DATA 0x0008
0073
0074
0075 #define IEEE80211_STYPE_ASSOC_REQ 0x0000
0076 #define IEEE80211_STYPE_ASSOC_RESP 0x0010
0077 #define IEEE80211_STYPE_REASSOC_REQ 0x0020
0078 #define IEEE80211_STYPE_REASSOC_RESP 0x0030
0079 #define IEEE80211_STYPE_PROBE_REQ 0x0040
0080 #define IEEE80211_STYPE_PROBE_RESP 0x0050
0081 #define IEEE80211_STYPE_BEACON 0x0080
0082 #define IEEE80211_STYPE_ATIM 0x0090
0083 #define IEEE80211_STYPE_DISASSOC 0x00A0
0084 #define IEEE80211_STYPE_AUTH 0x00B0
0085 #define IEEE80211_STYPE_DEAUTH 0x00C0
0086 #define IEEE80211_STYPE_ACTION 0x00D0
0087
0088
0089 #define IEEE80211_STYPE_BACK_REQ 0x0080
0090 #define IEEE80211_STYPE_BACK 0x0090
0091 #define IEEE80211_STYPE_PSPOLL 0x00A0
0092 #define IEEE80211_STYPE_RTS 0x00B0
0093 #define IEEE80211_STYPE_CTS 0x00C0
0094 #define IEEE80211_STYPE_ACK 0x00D0
0095 #define IEEE80211_STYPE_CFEND 0x00E0
0096 #define IEEE80211_STYPE_CFENDACK 0x00F0
0097
0098
0099 #define IEEE80211_STYPE_DATA 0x0000
0100 #define IEEE80211_STYPE_DATA_CFACK 0x0010
0101 #define IEEE80211_STYPE_DATA_CFPOLL 0x0020
0102 #define IEEE80211_STYPE_DATA_CFACKPOLL 0x0030
0103 #define IEEE80211_STYPE_NULLFUNC 0x0040
0104 #define IEEE80211_STYPE_CFACK 0x0050
0105 #define IEEE80211_STYPE_CFPOLL 0x0060
0106 #define IEEE80211_STYPE_CFACKPOLL 0x0070
0107 #define IEEE80211_STYPE_QOS_DATA 0x0080
0108 #define IEEE80211_STYPE_QOS_DATA_CFACK 0x0090
0109 #define IEEE80211_STYPE_QOS_DATA_CFPOLL 0x00A0
0110 #define IEEE80211_STYPE_QOS_DATA_CFACKPOLL 0x00B0
0111 #define IEEE80211_STYPE_QOS_NULLFUNC 0x00C0
0112 #define IEEE80211_STYPE_QOS_CFACK 0x00D0
0113 #define IEEE80211_STYPE_QOS_CFPOLL 0x00E0
0114 #define IEEE80211_STYPE_QOS_CFACKPOLL 0x00F0
0115
0116
0117
0118 #define IEEE80211_MAX_FRAG_THRESHOLD 2352
0119 #define IEEE80211_MAX_RTS_THRESHOLD 2353
0120 #define IEEE80211_MAX_AID 2007
0121 #define IEEE80211_MAX_TIM_LEN 251
0122
0123
0124
0125
0126
0127 #define IEEE80211_MAX_DATA_LEN 2304
0128
0129 #define IEEE80211_MAX_FRAME_LEN 2352
0130
0131 #define IEEE80211_MAX_SSID_LEN 32
0132
0133 #define IEEE80211_MAX_MESH_ID_LEN 32
0134 #define IEEE80211_MESH_CONFIG_LEN 24
0135
0136 #define IEEE80211_QOS_CTL_LEN 2
0137 #define IEEE80211_QOS_CTL_TID_MASK 0x000F
0138 #define IEEE80211_QOS_CTL_TAG1D_MASK 0x0007
0139
0140 struct ieee80211_hdr {
0141 __le16 frame_control;
0142 __le16 duration_id;
0143 u8 addr1[6];
0144 u8 addr2[6];
0145 u8 addr3[6];
0146 __le16 seq_ctrl;
0147 u8 addr4[6];
0148 } __attribute__ ((packed));
0149
0150
0151
0152
0153
0154 static inline int ieee80211_has_tods(__le16 fc)
0155 {
0156 return (fc & cpu_to_le16(IEEE80211_FCTL_TODS)) != 0;
0157 }
0158
0159
0160
0161
0162
0163 static inline int ieee80211_has_fromds(__le16 fc)
0164 {
0165 return (fc & cpu_to_le16(IEEE80211_FCTL_FROMDS)) != 0;
0166 }
0167
0168
0169
0170
0171
0172 static inline int ieee80211_has_a4(__le16 fc)
0173 {
0174 __le16 tmp = cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS);
0175 return (fc & tmp) == tmp;
0176 }
0177
0178
0179
0180
0181
0182 static inline int ieee80211_has_morefrags(__le16 fc)
0183 {
0184 return (fc & cpu_to_le16(IEEE80211_FCTL_MOREFRAGS)) != 0;
0185 }
0186
0187
0188
0189
0190
0191 static inline int ieee80211_has_retry(__le16 fc)
0192 {
0193 return (fc & cpu_to_le16(IEEE80211_FCTL_RETRY)) != 0;
0194 }
0195
0196
0197
0198
0199
0200 static inline int ieee80211_has_pm(__le16 fc)
0201 {
0202 return (fc & cpu_to_le16(IEEE80211_FCTL_PM)) != 0;
0203 }
0204
0205
0206
0207
0208
0209 static inline int ieee80211_has_moredata(__le16 fc)
0210 {
0211 return (fc & cpu_to_le16(IEEE80211_FCTL_MOREDATA)) != 0;
0212 }
0213
0214
0215
0216
0217
0218 static inline int ieee80211_has_protected(__le16 fc)
0219 {
0220 return (fc & cpu_to_le16(IEEE80211_FCTL_PROTECTED)) != 0;
0221 }
0222
0223
0224
0225
0226
0227 static inline int ieee80211_has_order(__le16 fc)
0228 {
0229 return (fc & cpu_to_le16(IEEE80211_FCTL_ORDER)) != 0;
0230 }
0231
0232
0233
0234
0235
0236 static inline int ieee80211_is_mgmt(__le16 fc)
0237 {
0238 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE)) ==
0239 cpu_to_le16(IEEE80211_FTYPE_MGMT);
0240 }
0241
0242
0243
0244
0245
0246 static inline int ieee80211_is_ctl(__le16 fc)
0247 {
0248 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE)) ==
0249 cpu_to_le16(IEEE80211_FTYPE_CTL);
0250 }
0251
0252
0253
0254
0255
0256 static inline int ieee80211_is_data(__le16 fc)
0257 {
0258 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE)) ==
0259 cpu_to_le16(IEEE80211_FTYPE_DATA);
0260 }
0261
0262
0263
0264
0265
0266 static inline int ieee80211_is_data_qos(__le16 fc)
0267 {
0268
0269
0270
0271
0272 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_STYPE_QOS_DATA)) ==
0273 cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_DATA);
0274 }
0275
0276
0277
0278
0279
0280 static inline int ieee80211_is_data_present(__le16 fc)
0281 {
0282
0283
0284
0285
0286 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | 0x40)) ==
0287 cpu_to_le16(IEEE80211_FTYPE_DATA);
0288 }
0289
0290
0291
0292
0293
0294 static inline int ieee80211_is_assoc_req(__le16 fc)
0295 {
0296 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
0297 cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ASSOC_REQ);
0298 }
0299
0300
0301
0302
0303
0304 static inline int ieee80211_is_assoc_resp(__le16 fc)
0305 {
0306 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
0307 cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ASSOC_RESP);
0308 }
0309
0310
0311
0312
0313
0314 static inline int ieee80211_is_reassoc_req(__le16 fc)
0315 {
0316 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
0317 cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_REASSOC_REQ);
0318 }
0319
0320
0321
0322
0323
0324 static inline int ieee80211_is_reassoc_resp(__le16 fc)
0325 {
0326 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
0327 cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_REASSOC_RESP);
0328 }
0329
0330
0331
0332
0333
0334 static inline int ieee80211_is_probe_req(__le16 fc)
0335 {
0336 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
0337 cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_REQ);
0338 }
0339
0340
0341
0342
0343
0344 static inline int ieee80211_is_probe_resp(__le16 fc)
0345 {
0346 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
0347 cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_RESP);
0348 }
0349
0350
0351
0352
0353
0354 static inline int ieee80211_is_beacon(__le16 fc)
0355 {
0356 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
0357 cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON);
0358 }
0359
0360
0361
0362
0363
0364 static inline int ieee80211_is_atim(__le16 fc)
0365 {
0366 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
0367 cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ATIM);
0368 }
0369
0370
0371
0372
0373
0374 static inline int ieee80211_is_disassoc(__le16 fc)
0375 {
0376 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
0377 cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_DISASSOC);
0378 }
0379
0380
0381
0382
0383
0384 static inline int ieee80211_is_auth(__le16 fc)
0385 {
0386 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
0387 cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_AUTH);
0388 }
0389
0390
0391
0392
0393
0394 static inline int ieee80211_is_deauth(__le16 fc)
0395 {
0396 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
0397 cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_DEAUTH);
0398 }
0399
0400
0401
0402
0403
0404 static inline int ieee80211_is_action(__le16 fc)
0405 {
0406 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
0407 cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ACTION);
0408 }
0409
0410
0411
0412
0413
0414 static inline int ieee80211_is_back_req(__le16 fc)
0415 {
0416 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
0417 cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_BACK_REQ);
0418 }
0419
0420
0421
0422
0423
0424 static inline int ieee80211_is_back(__le16 fc)
0425 {
0426 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
0427 cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_BACK);
0428 }
0429
0430
0431
0432
0433
0434 static inline int ieee80211_is_pspoll(__le16 fc)
0435 {
0436 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
0437 cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_PSPOLL);
0438 }
0439
0440
0441
0442
0443
0444 static inline int ieee80211_is_rts(__le16 fc)
0445 {
0446 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
0447 cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_RTS);
0448 }
0449
0450
0451
0452
0453
0454 static inline int ieee80211_is_cts(__le16 fc)
0455 {
0456 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
0457 cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CTS);
0458 }
0459
0460
0461
0462
0463
0464 static inline int ieee80211_is_ack(__le16 fc)
0465 {
0466 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
0467 cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_ACK);
0468 }
0469
0470
0471
0472
0473
0474 static inline int ieee80211_is_cfend(__le16 fc)
0475 {
0476 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
0477 cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CFEND);
0478 }
0479
0480
0481
0482
0483
0484 static inline int ieee80211_is_cfendack(__le16 fc)
0485 {
0486 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
0487 cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CFENDACK);
0488 }
0489
0490
0491
0492
0493
0494 static inline int ieee80211_is_nullfunc(__le16 fc)
0495 {
0496 return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
0497 cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_NULLFUNC);
0498 }
0499
0500 struct ieee80211s_hdr {
0501 u8 flags;
0502 u8 ttl;
0503 __le32 seqnum;
0504 u8 eaddr1[6];
0505 u8 eaddr2[6];
0506 u8 eaddr3[6];
0507 } __attribute__ ((packed));
0508
0509
0510 #define MESH_FLAGS_AE_A4 0x1
0511 #define MESH_FLAGS_AE_A5_A6 0x2
0512 #define MESH_FLAGS_AE 0x3
0513 #define MESH_FLAGS_PS_DEEP 0x4
0514
0515
0516
0517
0518
0519
0520 struct ieee80211_quiet_ie {
0521 u8 count;
0522 u8 period;
0523 __le16 duration;
0524 __le16 offset;
0525 } __attribute__ ((packed));
0526
0527
0528
0529
0530
0531
0532 struct ieee80211_msrment_ie {
0533 u8 token;
0534 u8 mode;
0535 u8 type;
0536 u8 request[0];
0537 } __attribute__ ((packed));
0538
0539
0540
0541
0542
0543
0544 struct ieee80211_channel_sw_ie {
0545 u8 mode;
0546 u8 new_ch_num;
0547 u8 count;
0548 } __attribute__ ((packed));
0549
0550
0551
0552
0553
0554
0555 struct ieee80211_tim_ie {
0556 u8 dtim_count;
0557 u8 dtim_period;
0558 u8 bitmap_ctrl;
0559
0560 u8 virtual_map[1];
0561 } __attribute__ ((packed));
0562
0563 #define WLAN_SA_QUERY_TR_ID_LEN 2
0564
0565 struct ieee80211_mgmt {
0566 __le16 frame_control;
0567 __le16 duration;
0568 u8 da[6];
0569 u8 sa[6];
0570 u8 bssid[6];
0571 __le16 seq_ctrl;
0572 union {
0573 struct {
0574 __le16 auth_alg;
0575 __le16 auth_transaction;
0576 __le16 status_code;
0577
0578 u8 variable[0];
0579 } __attribute__ ((packed)) auth;
0580 struct {
0581 __le16 reason_code;
0582 } __attribute__ ((packed)) deauth;
0583 struct {
0584 __le16 capab_info;
0585 __le16 listen_interval;
0586
0587 u8 variable[0];
0588 } __attribute__ ((packed)) assoc_req;
0589 struct {
0590 __le16 capab_info;
0591 __le16 status_code;
0592 __le16 aid;
0593
0594 u8 variable[0];
0595 } __attribute__ ((packed)) assoc_resp, reassoc_resp;
0596 struct {
0597 __le16 capab_info;
0598 __le16 listen_interval;
0599 u8 current_ap[6];
0600
0601 u8 variable[0];
0602 } __attribute__ ((packed)) reassoc_req;
0603 struct {
0604 __le16 reason_code;
0605 } __attribute__ ((packed)) disassoc;
0606 struct {
0607 __le64 timestamp;
0608 __le16 beacon_int;
0609 __le16 capab_info;
0610
0611
0612 u8 variable[0];
0613 } __attribute__ ((packed)) beacon;
0614 struct {
0615
0616 u8 variable[0];
0617 } __attribute__ ((packed)) probe_req;
0618 struct {
0619 __le64 timestamp;
0620 __le16 beacon_int;
0621 __le16 capab_info;
0622
0623
0624 u8 variable[0];
0625 } __attribute__ ((packed)) probe_resp;
0626 struct {
0627 u8 category;
0628 union {
0629 struct {
0630 u8 action_code;
0631 u8 dialog_token;
0632 u8 status_code;
0633 u8 variable[0];
0634 } __attribute__ ((packed)) wme_action;
0635 struct{
0636 u8 action_code;
0637 u8 element_id;
0638 u8 length;
0639 struct ieee80211_channel_sw_ie sw_elem;
0640 } __attribute__((packed)) chan_switch;
0641 struct{
0642 u8 action_code;
0643 u8 dialog_token;
0644 u8 element_id;
0645 u8 length;
0646 struct ieee80211_msrment_ie msr_elem;
0647 } __attribute__((packed)) measurement;
0648 struct{
0649 u8 action_code;
0650 u8 dialog_token;
0651 __le16 capab;
0652 __le16 timeout;
0653 __le16 start_seq_num;
0654 } __attribute__((packed)) addba_req;
0655 struct{
0656 u8 action_code;
0657 u8 dialog_token;
0658 __le16 status;
0659 __le16 capab;
0660 __le16 timeout;
0661 } __attribute__((packed)) addba_resp;
0662 struct{
0663 u8 action_code;
0664 __le16 params;
0665 __le16 reason_code;
0666 } __attribute__((packed)) delba;
0667 struct{
0668 u8 action_code;
0669
0670
0671
0672 __le16 aux;
0673
0674
0675
0676
0677
0678 u8 variable[0];
0679 } __attribute__((packed)) plink_action;
0680 struct{
0681 u8 action_code;
0682 u8 variable[0];
0683 } __attribute__((packed)) mesh_action;
0684 struct {
0685 u8 action;
0686 u8 trans_id[WLAN_SA_QUERY_TR_ID_LEN];
0687 } __attribute__ ((packed)) sa_query;
0688 } u;
0689 } __attribute__ ((packed)) action;
0690 } u;
0691 } __attribute__ ((packed));
0692
0693
0694 #define IEEE80211_MIN_ACTION_SIZE offsetof(struct ieee80211_mgmt, u.action.u)
0695
0696
0697
0698 struct ieee80211_mmie {
0699 u8 element_id;
0700 u8 length;
0701 __le16 key_id;
0702 u8 sequence_number[6];
0703 u8 mic[8];
0704 } __attribute__ ((packed));
0705
0706
0707 struct ieee80211_rts {
0708 __le16 frame_control;
0709 __le16 duration;
0710 u8 ra[6];
0711 u8 ta[6];
0712 } __attribute__ ((packed));
0713
0714 struct ieee80211_cts {
0715 __le16 frame_control;
0716 __le16 duration;
0717 u8 ra[6];
0718 } __attribute__ ((packed));
0719
0720 struct ieee80211_pspoll {
0721 __le16 frame_control;
0722 __le16 aid;
0723 u8 bssid[6];
0724 u8 ta[6];
0725 } __attribute__ ((packed));
0726
0727
0728
0729
0730
0731
0732
0733 struct ieee80211_bar {
0734 __le16 frame_control;
0735 __le16 duration;
0736 u8 ra[6];
0737 u8 ta[6];
0738 __le16 control;
0739 __le16 start_seq_num;
0740 } __attribute__((packed));
0741
0742
0743 #define IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL 0x0000
0744 #define IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA 0x0004
0745
0746
0747 #define IEEE80211_HT_MCS_MASK_LEN 10
0748
0749
0750
0751
0752
0753
0754
0755 struct ieee80211_mcs_info {
0756 u8 rx_mask[IEEE80211_HT_MCS_MASK_LEN];
0757 __le16 rx_highest;
0758 u8 tx_params;
0759 u8 reserved[3];
0760 } __attribute__((packed));
0761
0762
0763 #define IEEE80211_HT_MCS_RX_HIGHEST_MASK 0x3ff
0764 #define IEEE80211_HT_MCS_TX_DEFINED 0x01
0765 #define IEEE80211_HT_MCS_TX_RX_DIFF 0x02
0766
0767 #define IEEE80211_HT_MCS_TX_MAX_STREAMS_MASK 0x0C
0768 #define IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT 2
0769 #define IEEE80211_HT_MCS_TX_MAX_STREAMS 4
0770 #define IEEE80211_HT_MCS_TX_UNEQUAL_MODULATION 0x10
0771
0772
0773
0774
0775
0776
0777
0778
0779 #define IEEE80211_HT_MCS_UNEQUAL_MODULATION_START 33
0780 #define IEEE80211_HT_MCS_UNEQUAL_MODULATION_START_BYTE \
0781 (IEEE80211_HT_MCS_UNEQUAL_MODULATION_START / 8)
0782
0783
0784
0785
0786
0787
0788
0789 struct ieee80211_ht_cap {
0790 __le16 cap_info;
0791 u8 ampdu_params_info;
0792
0793
0794 struct ieee80211_mcs_info mcs;
0795
0796 __le16 extended_ht_cap_info;
0797 __le32 tx_BF_cap_info;
0798 u8 antenna_selection_info;
0799 } __attribute__ ((packed));
0800
0801
0802 #define IEEE80211_HT_CAP_LDPC_CODING 0x0001
0803 #define IEEE80211_HT_CAP_SUP_WIDTH_20_40 0x0002
0804 #define IEEE80211_HT_CAP_SM_PS 0x000C
0805 #define IEEE80211_HT_CAP_GRN_FLD 0x0010
0806 #define IEEE80211_HT_CAP_SGI_20 0x0020
0807 #define IEEE80211_HT_CAP_SGI_40 0x0040
0808 #define IEEE80211_HT_CAP_TX_STBC 0x0080
0809 #define IEEE80211_HT_CAP_RX_STBC 0x0300
0810 #define IEEE80211_HT_CAP_DELAY_BA 0x0400
0811 #define IEEE80211_HT_CAP_MAX_AMSDU 0x0800
0812 #define IEEE80211_HT_CAP_DSSSCCK40 0x1000
0813 #define IEEE80211_HT_CAP_PSMP_SUPPORT 0x2000
0814 #define IEEE80211_HT_CAP_40MHZ_INTOLERANT 0x4000
0815 #define IEEE80211_HT_CAP_LSIG_TXOP_PROT 0x8000
0816
0817
0818 #define IEEE80211_HT_AMPDU_PARM_FACTOR 0x03
0819 #define IEEE80211_HT_AMPDU_PARM_DENSITY 0x1C
0820
0821
0822
0823
0824
0825 enum ieee80211_max_ampdu_length_exp {
0826 IEEE80211_HT_MAX_AMPDU_8K = 0,
0827 IEEE80211_HT_MAX_AMPDU_16K = 1,
0828 IEEE80211_HT_MAX_AMPDU_32K = 2,
0829 IEEE80211_HT_MAX_AMPDU_64K = 3
0830 };
0831
0832 #define IEEE80211_HT_MAX_AMPDU_FACTOR 13
0833
0834
0835 enum ieee80211_min_mpdu_spacing {
0836 IEEE80211_HT_MPDU_DENSITY_NONE = 0,
0837 IEEE80211_HT_MPDU_DENSITY_0_25 = 1,
0838 IEEE80211_HT_MPDU_DENSITY_0_5 = 2,
0839 IEEE80211_HT_MPDU_DENSITY_1 = 3,
0840 IEEE80211_HT_MPDU_DENSITY_2 = 4,
0841 IEEE80211_HT_MPDU_DENSITY_4 = 5,
0842 IEEE80211_HT_MPDU_DENSITY_8 = 6,
0843 IEEE80211_HT_MPDU_DENSITY_16 = 7
0844 };
0845
0846
0847
0848
0849
0850
0851
0852 struct ieee80211_ht_info {
0853 u8 control_chan;
0854 u8 ht_param;
0855 __le16 operation_mode;
0856 __le16 stbc_param;
0857 u8 basic_set[16];
0858 } __attribute__ ((packed));
0859
0860
0861 #define IEEE80211_HT_PARAM_CHA_SEC_OFFSET 0x03
0862 #define IEEE80211_HT_PARAM_CHA_SEC_NONE 0x00
0863 #define IEEE80211_HT_PARAM_CHA_SEC_ABOVE 0x01
0864 #define IEEE80211_HT_PARAM_CHA_SEC_BELOW 0x03
0865 #define IEEE80211_HT_PARAM_CHAN_WIDTH_ANY 0x04
0866 #define IEEE80211_HT_PARAM_RIFS_MODE 0x08
0867 #define IEEE80211_HT_PARAM_SPSMP_SUPPORT 0x10
0868 #define IEEE80211_HT_PARAM_SERV_INTERVAL_GRAN 0xE0
0869
0870
0871 #define IEEE80211_HT_OP_MODE_PROTECTION 0x0003
0872 #define IEEE80211_HT_OP_MODE_PROTECTION_NONE 0
0873 #define IEEE80211_HT_OP_MODE_PROTECTION_NONMEMBER 1
0874 #define IEEE80211_HT_OP_MODE_PROTECTION_20MHZ 2
0875 #define IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED 3
0876 #define IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT 0x0004
0877 #define IEEE80211_HT_OP_MODE_NON_HT_STA_PRSNT 0x0010
0878
0879
0880 #define IEEE80211_HT_STBC_PARAM_DUAL_BEACON 0x0040
0881 #define IEEE80211_HT_STBC_PARAM_DUAL_CTS_PROT 0x0080
0882 #define IEEE80211_HT_STBC_PARAM_STBC_BEACON 0x0100
0883 #define IEEE80211_HT_STBC_PARAM_LSIG_TXOP_FULLPROT 0x0200
0884 #define IEEE80211_HT_STBC_PARAM_PCO_ACTIVE 0x0400
0885 #define IEEE80211_HT_STBC_PARAM_PCO_PHASE 0x0800
0886
0887
0888
0889 #define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002
0890 #define IEEE80211_ADDBA_PARAM_TID_MASK 0x003C
0891 #define IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK 0xFFA0
0892 #define IEEE80211_DELBA_PARAM_TID_MASK 0xF000
0893 #define IEEE80211_DELBA_PARAM_INITIATOR_MASK 0x0800
0894
0895
0896
0897
0898
0899 #define IEEE80211_MIN_AMPDU_BUF 0x8
0900 #define IEEE80211_MAX_AMPDU_BUF 0x40
0901
0902
0903
0904 #define WLAN_HT_CAP_SM_PS_STATIC 0
0905 #define WLAN_HT_CAP_SM_PS_DYNAMIC 1
0906 #define WLAN_HT_CAP_SM_PS_INVALID 2
0907 #define WLAN_HT_CAP_SM_PS_DISABLED 3
0908
0909
0910 #define WLAN_AUTH_OPEN 0
0911 #define WLAN_AUTH_SHARED_KEY 1
0912 #define WLAN_AUTH_FT 2
0913 #define WLAN_AUTH_LEAP 128
0914
0915 #define WLAN_AUTH_CHALLENGE_LEN 128
0916
0917 #define WLAN_CAPABILITY_ESS (1<<0)
0918 #define WLAN_CAPABILITY_IBSS (1<<1)
0919 #define WLAN_CAPABILITY_CF_POLLABLE (1<<2)
0920 #define WLAN_CAPABILITY_CF_POLL_REQUEST (1<<3)
0921 #define WLAN_CAPABILITY_PRIVACY (1<<4)
0922 #define WLAN_CAPABILITY_SHORT_PREAMBLE (1<<5)
0923 #define WLAN_CAPABILITY_PBCC (1<<6)
0924 #define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7)
0925
0926
0927 #define WLAN_CAPABILITY_SPECTRUM_MGMT (1<<8)
0928 #define WLAN_CAPABILITY_QOS (1<<9)
0929 #define WLAN_CAPABILITY_SHORT_SLOT_TIME (1<<10)
0930 #define WLAN_CAPABILITY_DSSS_OFDM (1<<13)
0931
0932 #define IEEE80211_SPCT_MSR_RPRT_MODE_LATE (1<<0)
0933 #define IEEE80211_SPCT_MSR_RPRT_MODE_INCAPABLE (1<<1)
0934 #define IEEE80211_SPCT_MSR_RPRT_MODE_REFUSED (1<<2)
0935
0936 #define IEEE80211_SPCT_MSR_RPRT_TYPE_BASIC 0
0937 #define IEEE80211_SPCT_MSR_RPRT_TYPE_CCA 1
0938 #define IEEE80211_SPCT_MSR_RPRT_TYPE_RPI 2
0939
0940
0941
0942 #define WLAN_ERP_NON_ERP_PRESENT (1<<0)
0943 #define WLAN_ERP_USE_PROTECTION (1<<1)
0944 #define WLAN_ERP_BARKER_PREAMBLE (1<<2)
0945
0946
0947 enum {
0948 WLAN_ERP_PREAMBLE_SHORT = 0,
0949 WLAN_ERP_PREAMBLE_LONG = 1,
0950 };
0951
0952
0953 enum ieee80211_statuscode {
0954 WLAN_STATUS_SUCCESS = 0,
0955 WLAN_STATUS_UNSPECIFIED_FAILURE = 1,
0956 WLAN_STATUS_CAPS_UNSUPPORTED = 10,
0957 WLAN_STATUS_REASSOC_NO_ASSOC = 11,
0958 WLAN_STATUS_ASSOC_DENIED_UNSPEC = 12,
0959 WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG = 13,
0960 WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION = 14,
0961 WLAN_STATUS_CHALLENGE_FAIL = 15,
0962 WLAN_STATUS_AUTH_TIMEOUT = 16,
0963 WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA = 17,
0964 WLAN_STATUS_ASSOC_DENIED_RATES = 18,
0965
0966 WLAN_STATUS_ASSOC_DENIED_NOSHORTPREAMBLE = 19,
0967 WLAN_STATUS_ASSOC_DENIED_NOPBCC = 20,
0968 WLAN_STATUS_ASSOC_DENIED_NOAGILITY = 21,
0969
0970 WLAN_STATUS_ASSOC_DENIED_NOSPECTRUM = 22,
0971 WLAN_STATUS_ASSOC_REJECTED_BAD_POWER = 23,
0972 WLAN_STATUS_ASSOC_REJECTED_BAD_SUPP_CHAN = 24,
0973
0974 WLAN_STATUS_ASSOC_DENIED_NOSHORTTIME = 25,
0975 WLAN_STATUS_ASSOC_DENIED_NODSSSOFDM = 26,
0976
0977 WLAN_STATUS_ASSOC_REJECTED_TEMPORARILY = 30,
0978 WLAN_STATUS_ROBUST_MGMT_FRAME_POLICY_VIOLATION = 31,
0979
0980 WLAN_STATUS_INVALID_IE = 40,
0981 WLAN_STATUS_INVALID_GROUP_CIPHER = 41,
0982 WLAN_STATUS_INVALID_PAIRWISE_CIPHER = 42,
0983 WLAN_STATUS_INVALID_AKMP = 43,
0984 WLAN_STATUS_UNSUPP_RSN_VERSION = 44,
0985 WLAN_STATUS_INVALID_RSN_IE_CAP = 45,
0986 WLAN_STATUS_CIPHER_SUITE_REJECTED = 46,
0987
0988 WLAN_STATUS_UNSPECIFIED_QOS = 32,
0989 WLAN_STATUS_ASSOC_DENIED_NOBANDWIDTH = 33,
0990 WLAN_STATUS_ASSOC_DENIED_LOWACK = 34,
0991 WLAN_STATUS_ASSOC_DENIED_UNSUPP_QOS = 35,
0992 WLAN_STATUS_REQUEST_DECLINED = 37,
0993 WLAN_STATUS_INVALID_QOS_PARAM = 38,
0994 WLAN_STATUS_CHANGE_TSPEC = 39,
0995 WLAN_STATUS_WAIT_TS_DELAY = 47,
0996 WLAN_STATUS_NO_DIRECT_LINK = 48,
0997 WLAN_STATUS_STA_NOT_PRESENT = 49,
0998 WLAN_STATUS_STA_NOT_QSTA = 50,
0999 };
1000
1001
1002
1003 enum ieee80211_reasoncode {
1004 WLAN_REASON_UNSPECIFIED = 1,
1005 WLAN_REASON_PREV_AUTH_NOT_VALID = 2,
1006 WLAN_REASON_DEAUTH_LEAVING = 3,
1007 WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY = 4,
1008 WLAN_REASON_DISASSOC_AP_BUSY = 5,
1009 WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA = 6,
1010 WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA = 7,
1011 WLAN_REASON_DISASSOC_STA_HAS_LEFT = 8,
1012 WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH = 9,
1013
1014 WLAN_REASON_DISASSOC_BAD_POWER = 10,
1015 WLAN_REASON_DISASSOC_BAD_SUPP_CHAN = 11,
1016
1017 WLAN_REASON_INVALID_IE = 13,
1018 WLAN_REASON_MIC_FAILURE = 14,
1019 WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT = 15,
1020 WLAN_REASON_GROUP_KEY_HANDSHAKE_TIMEOUT = 16,
1021 WLAN_REASON_IE_DIFFERENT = 17,
1022 WLAN_REASON_INVALID_GROUP_CIPHER = 18,
1023 WLAN_REASON_INVALID_PAIRWISE_CIPHER = 19,
1024 WLAN_REASON_INVALID_AKMP = 20,
1025 WLAN_REASON_UNSUPP_RSN_VERSION = 21,
1026 WLAN_REASON_INVALID_RSN_IE_CAP = 22,
1027 WLAN_REASON_IEEE8021X_FAILED = 23,
1028 WLAN_REASON_CIPHER_SUITE_REJECTED = 24,
1029
1030 WLAN_REASON_DISASSOC_UNSPECIFIED_QOS = 32,
1031 WLAN_REASON_DISASSOC_QAP_NO_BANDWIDTH = 33,
1032 WLAN_REASON_DISASSOC_LOW_ACK = 34,
1033 WLAN_REASON_DISASSOC_QAP_EXCEED_TXOP = 35,
1034 WLAN_REASON_QSTA_LEAVE_QBSS = 36,
1035 WLAN_REASON_QSTA_NOT_USE = 37,
1036 WLAN_REASON_QSTA_REQUIRE_SETUP = 38,
1037 WLAN_REASON_QSTA_TIMEOUT = 39,
1038 WLAN_REASON_QSTA_CIPHER_NOT_SUPP = 45,
1039 };
1040
1041
1042
1043 enum ieee80211_eid {
1044 WLAN_EID_SSID = 0,
1045 WLAN_EID_SUPP_RATES = 1,
1046 WLAN_EID_FH_PARAMS = 2,
1047 WLAN_EID_DS_PARAMS = 3,
1048 WLAN_EID_CF_PARAMS = 4,
1049 WLAN_EID_TIM = 5,
1050 WLAN_EID_IBSS_PARAMS = 6,
1051 WLAN_EID_CHALLENGE = 16,
1052
1053 WLAN_EID_COUNTRY = 7,
1054 WLAN_EID_HP_PARAMS = 8,
1055 WLAN_EID_HP_TABLE = 9,
1056 WLAN_EID_REQUEST = 10,
1057
1058 WLAN_EID_QBSS_LOAD = 11,
1059 WLAN_EID_EDCA_PARAM_SET = 12,
1060 WLAN_EID_TSPEC = 13,
1061 WLAN_EID_TCLAS = 14,
1062 WLAN_EID_SCHEDULE = 15,
1063 WLAN_EID_TS_DELAY = 43,
1064 WLAN_EID_TCLAS_PROCESSING = 44,
1065 WLAN_EID_QOS_CAPA = 46,
1066
1067
1068
1069
1070
1071
1072
1073 WLAN_EID_MESH_CONFIG = 51,
1074 WLAN_EID_MESH_ID = 52,
1075 WLAN_EID_PEER_LINK = 55,
1076 WLAN_EID_PREQ = 68,
1077 WLAN_EID_PREP = 69,
1078 WLAN_EID_PERR = 70,
1079
1080 WLAN_EID_PWR_CONSTRAINT = 32,
1081 WLAN_EID_PWR_CAPABILITY = 33,
1082 WLAN_EID_TPC_REQUEST = 34,
1083 WLAN_EID_TPC_REPORT = 35,
1084 WLAN_EID_SUPPORTED_CHANNELS = 36,
1085 WLAN_EID_CHANNEL_SWITCH = 37,
1086 WLAN_EID_MEASURE_REQUEST = 38,
1087 WLAN_EID_MEASURE_REPORT = 39,
1088 WLAN_EID_QUIET = 40,
1089 WLAN_EID_IBSS_DFS = 41,
1090
1091 WLAN_EID_ERP_INFO = 42,
1092 WLAN_EID_EXT_SUPP_RATES = 50,
1093
1094 WLAN_EID_HT_CAPABILITY = 45,
1095 WLAN_EID_HT_INFORMATION = 61,
1096
1097 WLAN_EID_RSN = 48,
1098 WLAN_EID_TIMEOUT_INTERVAL = 56,
1099 WLAN_EID_MMIE = 76 ,
1100 WLAN_EID_WPA = 221,
1101 WLAN_EID_GENERIC = 221,
1102 WLAN_EID_VENDOR_SPECIFIC = 221,
1103 WLAN_EID_QOS_PARAMETER = 222
1104 };
1105
1106
1107 enum ieee80211_category {
1108 WLAN_CATEGORY_SPECTRUM_MGMT = 0,
1109 WLAN_CATEGORY_QOS = 1,
1110 WLAN_CATEGORY_DLS = 2,
1111 WLAN_CATEGORY_BACK = 3,
1112 WLAN_CATEGORY_PUBLIC = 4,
1113 WLAN_CATEGORY_HT = 7,
1114 WLAN_CATEGORY_SA_QUERY = 8,
1115 WLAN_CATEGORY_PROTECTED_DUAL_OF_ACTION = 9,
1116 WLAN_CATEGORY_WMM = 17,
1117 WLAN_CATEGORY_VENDOR_SPECIFIC_PROTECTED = 126,
1118 WLAN_CATEGORY_VENDOR_SPECIFIC = 127,
1119 };
1120
1121
1122 enum ieee80211_spectrum_mgmt_actioncode {
1123 WLAN_ACTION_SPCT_MSR_REQ = 0,
1124 WLAN_ACTION_SPCT_MSR_RPRT = 1,
1125 WLAN_ACTION_SPCT_TPC_REQ = 2,
1126 WLAN_ACTION_SPCT_TPC_RPRT = 3,
1127 WLAN_ACTION_SPCT_CHL_SWITCH = 4,
1128 };
1129
1130
1131 enum ieee80211_key_len {
1132 WLAN_KEY_LEN_WEP40 = 5,
1133 WLAN_KEY_LEN_WEP104 = 13,
1134 WLAN_KEY_LEN_CCMP = 16,
1135 WLAN_KEY_LEN_TKIP = 32,
1136 WLAN_KEY_LEN_AES_CMAC = 16,
1137 };
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147 #define IEEE80211_COUNTRY_IE_MIN_LEN 6
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172 #define IEEE80211_COUNTRY_EXTENSION_ID 201
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186 struct ieee80211_country_ie_triplet {
1187 union {
1188 struct {
1189 u8 first_channel;
1190 u8 num_channels;
1191 s8 max_power;
1192 } __attribute__ ((packed)) chans;
1193 struct {
1194 u8 reg_extension_id;
1195 u8 reg_class;
1196 u8 coverage_class;
1197 } __attribute__ ((packed)) ext;
1198 };
1199 } __attribute__ ((packed));
1200
1201 enum ieee80211_timeout_interval_type {
1202 WLAN_TIMEOUT_REASSOC_DEADLINE = 1 ,
1203 WLAN_TIMEOUT_KEY_LIFETIME = 2 ,
1204 WLAN_TIMEOUT_ASSOC_COMEBACK = 3 ,
1205 };
1206
1207
1208 enum ieee80211_back_actioncode {
1209 WLAN_ACTION_ADDBA_REQ = 0,
1210 WLAN_ACTION_ADDBA_RESP = 1,
1211 WLAN_ACTION_DELBA = 2,
1212 };
1213
1214
1215 enum ieee80211_back_parties {
1216 WLAN_BACK_RECIPIENT = 0,
1217 WLAN_BACK_INITIATOR = 1,
1218 WLAN_BACK_TIMER = 2,
1219 };
1220
1221
1222 enum ieee80211_sa_query_action {
1223 WLAN_ACTION_SA_QUERY_REQUEST = 0,
1224 WLAN_ACTION_SA_QUERY_RESPONSE = 1,
1225 };
1226
1227
1228
1229 #define IEEE80211_QOS_CONTROL_A_MSDU_PRESENT 0x0080
1230
1231
1232 #define WLAN_CIPHER_SUITE_USE_GROUP 0x000FAC00
1233 #define WLAN_CIPHER_SUITE_WEP40 0x000FAC01
1234 #define WLAN_CIPHER_SUITE_TKIP 0x000FAC02
1235
1236 #define WLAN_CIPHER_SUITE_CCMP 0x000FAC04
1237 #define WLAN_CIPHER_SUITE_WEP104 0x000FAC05
1238 #define WLAN_CIPHER_SUITE_AES_CMAC 0x000FAC06
1239
1240
1241 #define WLAN_AKM_SUITE_8021X 0x000FAC01
1242 #define WLAN_AKM_SUITE_PSK 0x000FAC02
1243
1244 #define WLAN_MAX_KEY_LEN 32
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255 static inline u8 *ieee80211_get_qos_ctl(struct ieee80211_hdr *hdr)
1256 {
1257 if (ieee80211_has_a4(hdr->frame_control))
1258 return (u8 *)hdr + 30;
1259 else
1260 return (u8 *)hdr + 24;
1261 }
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273 static inline u8 *ieee80211_get_SA(struct ieee80211_hdr *hdr)
1274 {
1275 if (ieee80211_has_a4(hdr->frame_control))
1276 return hdr->addr4;
1277 if (ieee80211_has_fromds(hdr->frame_control))
1278 return hdr->addr3;
1279 return hdr->addr2;
1280 }
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292 static inline u8 *ieee80211_get_DA(struct ieee80211_hdr *hdr)
1293 {
1294 if (ieee80211_has_tods(hdr->frame_control))
1295 return hdr->addr3;
1296 else
1297 return hdr->addr1;
1298 }
1299
1300
1301
1302
1303
1304 static inline bool ieee80211_is_robust_mgmt_frame(struct ieee80211_hdr *hdr)
1305 {
1306 if (ieee80211_is_disassoc(hdr->frame_control) ||
1307 ieee80211_is_deauth(hdr->frame_control))
1308 return TRUE;
1309
1310 if (ieee80211_is_action(hdr->frame_control)) {
1311 u8 *category;
1312
1313
1314
1315
1316
1317
1318
1319
1320 if (ieee80211_has_protected(hdr->frame_control))
1321 return TRUE;
1322 category = ((u8 *) hdr) + 24;
1323 return *category != WLAN_CATEGORY_PUBLIC &&
1324 *category != WLAN_CATEGORY_HT &&
1325 *category != WLAN_CATEGORY_VENDOR_SPECIFIC;
1326 }
1327
1328 return FALSE;
1329 }
1330
1331
1332
1333
1334
1335
1336
1337
1338 static inline int ieee80211_fhss_chan_to_freq(int channel)
1339 {
1340 if ((channel > 1) && (channel < 96))
1341 return channel + 2400;
1342 else
1343 return -1;
1344 }
1345
1346
1347
1348
1349
1350
1351
1352
1353 static inline int ieee80211_freq_to_fhss_chan(int freq)
1354 {
1355 if ((freq > 2401) && (freq < 2496))
1356 return freq - 2400;
1357 else
1358 return -1;
1359 }
1360
1361
1362
1363
1364
1365
1366
1367
1368 static inline int ieee80211_dsss_chan_to_freq(int channel)
1369 {
1370 if ((channel > 0) && (channel < 14))
1371 return 2407 + (channel * 5);
1372 else if (channel == 14)
1373 return 2484;
1374 else
1375 return -1;
1376 }
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387 static inline int ieee80211_freq_to_dsss_chan(int freq)
1388 {
1389 if ((freq >= 2410) && (freq < 2475))
1390 return (freq - 2405) / 5;
1391 else if ((freq >= 2482) && (freq < 2487))
1392 return 14;
1393 else
1394 return -1;
1395 }
1396
1397
1398
1399
1400
1401
1402 #define ieee80211_hr_chan_to_freq(chan) ieee80211_dsss_chan_to_freq(chan)
1403 #define ieee80211_freq_to_hr_chan(freq) ieee80211_freq_to_dsss_chan(freq)
1404
1405
1406
1407
1408 #define ieee80211_erp_chan_to_freq(chan) ieee80211_hr_chan_to_freq(chan)
1409 #define ieee80211_freq_to_erp_chan(freq) ieee80211_freq_to_hr_chan(freq)
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419 static inline int ieee80211_ofdm_chan_to_freq(int s_freq, int channel)
1420 {
1421 if ((channel > 0) && (channel <= 200) &&
1422 (s_freq >= 4000))
1423 return s_freq + (channel * 5);
1424 else
1425 return -1;
1426 }
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438 static inline int ieee80211_freq_to_ofdm_chan(int s_freq, int freq)
1439 {
1440 if ((freq > (s_freq + 2)) && (freq <= (s_freq + 1202)) &&
1441 (s_freq >= 4000))
1442 return (freq + 2 - s_freq) / 5;
1443 else
1444 return -1;
1445 }
1446
1447
1448
1449
1450
1451 static inline unsigned long ieee80211_tu_to_usec(unsigned long tu)
1452 {
1453 return 1024 * tu;
1454 }
1455
1456
1457
1458
1459
1460
1461
1462 static inline bool ieee80211_check_tim(struct ieee80211_tim_ie *tim,
1463 u8 tim_len, u16 aid)
1464 {
1465 u8 mask;
1466 u8 index, indexn1, indexn2;
1467
1468 if (unlikely(!tim || tim_len < sizeof(*tim)))
1469 return FALSE;
1470
1471 aid &= 0x3fff;
1472 index = aid / 8;
1473 mask = 1 << (aid & 7);
1474
1475 indexn1 = tim->bitmap_ctrl & 0xfe;
1476 indexn2 = tim_len + indexn1 - 4;
1477
1478 if (index < indexn1 || index > indexn2)
1479 return FALSE;
1480
1481 index -= indexn1;
1482
1483 return !!(tim->virtual_map[index] & mask);
1484 }
1485
1486 #endif
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497