diff options
| author | David S. Miller <davem@davemloft.net> | 2009-03-01 01:32:16 -0500 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2009-03-01 01:32:16 -0500 |
| commit | 8010dc306ba39a8cdb3993d1e809fcb7dfdf089a (patch) | |
| tree | d1fa3fe2e1501a6780fc007f2f57b1fe0995e18e /include | |
| parent | 5d242f1cee2c85721bbe9d8205e98c1c01f5d805 (diff) | |
| parent | 2a07954b83a3d4dc93031d3ce030fb9380a8e15a (diff) | |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/nl80211.h | 5 | ||||
| -rw-r--r-- | include/net/cfg80211.h | 31 | ||||
| -rw-r--r-- | include/net/ieee80211.h | 1185 | ||||
| -rw-r--r-- | include/net/mac80211.h | 26 | ||||
| -rw-r--r-- | include/net/wireless.h | 17 |
5 files changed, 64 insertions, 1200 deletions
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h index 8802d1bda382..f6e56370ea65 100644 --- a/include/linux/nl80211.h +++ b/include/linux/nl80211.h | |||
| @@ -526,6 +526,9 @@ enum nl80211_rate_info { | |||
| 526 | * @NL80211_STA_INFO_SIGNAL: signal strength of last received PPDU (u8, dBm) | 526 | * @NL80211_STA_INFO_SIGNAL: signal strength of last received PPDU (u8, dBm) |
| 527 | * @NL80211_STA_INFO_TX_BITRATE: current unicast tx rate, nested attribute | 527 | * @NL80211_STA_INFO_TX_BITRATE: current unicast tx rate, nested attribute |
| 528 | * containing info as possible, see &enum nl80211_sta_info_txrate. | 528 | * containing info as possible, see &enum nl80211_sta_info_txrate. |
| 529 | * @NL80211_STA_INFO_RX_PACKETS: total received packet (u32, from this station) | ||
| 530 | * @NL80211_STA_INFO_TX_PACKETS: total transmitted packets (u32, to this | ||
| 531 | * station) | ||
| 529 | */ | 532 | */ |
| 530 | enum nl80211_sta_info { | 533 | enum nl80211_sta_info { |
| 531 | __NL80211_STA_INFO_INVALID, | 534 | __NL80211_STA_INFO_INVALID, |
| @@ -537,6 +540,8 @@ enum nl80211_sta_info { | |||
| 537 | NL80211_STA_INFO_PLINK_STATE, | 540 | NL80211_STA_INFO_PLINK_STATE, |
| 538 | NL80211_STA_INFO_SIGNAL, | 541 | NL80211_STA_INFO_SIGNAL, |
| 539 | NL80211_STA_INFO_TX_BITRATE, | 542 | NL80211_STA_INFO_TX_BITRATE, |
| 543 | NL80211_STA_INFO_RX_PACKETS, | ||
| 544 | NL80211_STA_INFO_TX_PACKETS, | ||
| 540 | 545 | ||
| 541 | /* keep last */ | 546 | /* keep last */ |
| 542 | __NL80211_STA_INFO_AFTER_LAST, | 547 | __NL80211_STA_INFO_AFTER_LAST, |
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index c0d1f5b708c5..75fa556728ce 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
| @@ -178,6 +178,8 @@ struct station_parameters { | |||
| 178 | * @STATION_INFO_SIGNAL: @signal filled | 178 | * @STATION_INFO_SIGNAL: @signal filled |
| 179 | * @STATION_INFO_TX_BITRATE: @tx_bitrate fields are filled | 179 | * @STATION_INFO_TX_BITRATE: @tx_bitrate fields are filled |
| 180 | * (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs) | 180 | * (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs) |
| 181 | * @STATION_INFO_RX_PACKETS: @rx_packets filled | ||
| 182 | * @STATION_INFO_TX_PACKETS: @tx_packets filled | ||
| 181 | */ | 183 | */ |
| 182 | enum station_info_flags { | 184 | enum station_info_flags { |
| 183 | STATION_INFO_INACTIVE_TIME = 1<<0, | 185 | STATION_INFO_INACTIVE_TIME = 1<<0, |
| @@ -188,6 +190,8 @@ enum station_info_flags { | |||
| 188 | STATION_INFO_PLINK_STATE = 1<<5, | 190 | STATION_INFO_PLINK_STATE = 1<<5, |
| 189 | STATION_INFO_SIGNAL = 1<<6, | 191 | STATION_INFO_SIGNAL = 1<<6, |
| 190 | STATION_INFO_TX_BITRATE = 1<<7, | 192 | STATION_INFO_TX_BITRATE = 1<<7, |
| 193 | STATION_INFO_RX_PACKETS = 1<<8, | ||
| 194 | STATION_INFO_TX_PACKETS = 1<<9, | ||
| 191 | }; | 195 | }; |
| 192 | 196 | ||
| 193 | /** | 197 | /** |
| @@ -235,6 +239,8 @@ struct rate_info { | |||
| 235 | * @plink_state: mesh peer link state | 239 | * @plink_state: mesh peer link state |
| 236 | * @signal: signal strength of last received packet in dBm | 240 | * @signal: signal strength of last received packet in dBm |
| 237 | * @txrate: current unicast bitrate to this station | 241 | * @txrate: current unicast bitrate to this station |
| 242 | * @rx_packets: packets received from this station | ||
| 243 | * @tx_packets: packets transmitted to this station | ||
| 238 | */ | 244 | */ |
| 239 | struct station_info { | 245 | struct station_info { |
| 240 | u32 filled; | 246 | u32 filled; |
| @@ -246,6 +252,8 @@ struct station_info { | |||
| 246 | u8 plink_state; | 252 | u8 plink_state; |
| 247 | s8 signal; | 253 | s8 signal; |
| 248 | struct rate_info txrate; | 254 | struct rate_info txrate; |
| 255 | u32 rx_packets; | ||
| 256 | u32 tx_packets; | ||
| 249 | }; | 257 | }; |
| 250 | 258 | ||
| 251 | /** | 259 | /** |
| @@ -375,9 +383,9 @@ enum environment_cap { | |||
| 375 | }; | 383 | }; |
| 376 | 384 | ||
| 377 | /** | 385 | /** |
| 378 | * struct regulatory_request - receipt of last regulatory request | 386 | * struct regulatory_request - used to keep track of regulatory requests |
| 379 | * | 387 | * |
| 380 | * @wiphy: this is set if this request's initiator is | 388 | * @wiphy_idx: this is set if this request's initiator is |
| 381 | * %REGDOM_SET_BY_COUNTRY_IE or %REGDOM_SET_BY_DRIVER. This | 389 | * %REGDOM_SET_BY_COUNTRY_IE or %REGDOM_SET_BY_DRIVER. This |
| 382 | * can be used by the wireless core to deal with conflicts | 390 | * can be used by the wireless core to deal with conflicts |
| 383 | * and potentially inform users of which devices specifically | 391 | * and potentially inform users of which devices specifically |
| @@ -396,14 +404,16 @@ enum environment_cap { | |||
| 396 | * country IE | 404 | * country IE |
| 397 | * @country_ie_env: lets us know if the AP is telling us we are outdoor, | 405 | * @country_ie_env: lets us know if the AP is telling us we are outdoor, |
| 398 | * indoor, or if it doesn't matter | 406 | * indoor, or if it doesn't matter |
| 407 | * @list: used to insert into the reg_requests_list linked list | ||
| 399 | */ | 408 | */ |
| 400 | struct regulatory_request { | 409 | struct regulatory_request { |
| 401 | struct wiphy *wiphy; | 410 | int wiphy_idx; |
| 402 | enum reg_set_by initiator; | 411 | enum reg_set_by initiator; |
| 403 | char alpha2[2]; | 412 | char alpha2[2]; |
| 404 | bool intersect; | 413 | bool intersect; |
| 405 | u32 country_ie_checksum; | 414 | u32 country_ie_checksum; |
| 406 | enum environment_cap country_ie_env; | 415 | enum environment_cap country_ie_env; |
| 416 | struct list_head list; | ||
| 407 | }; | 417 | }; |
| 408 | 418 | ||
| 409 | struct ieee80211_freq_range { | 419 | struct ieee80211_freq_range { |
| @@ -525,6 +535,8 @@ struct cfg80211_ssid { | |||
| 525 | * @n_ssids: number of SSIDs | 535 | * @n_ssids: number of SSIDs |
| 526 | * @channels: channels to scan on. | 536 | * @channels: channels to scan on. |
| 527 | * @n_channels: number of channels for each band | 537 | * @n_channels: number of channels for each band |
| 538 | * @ie: optional information element(s) to add into Probe Request or %NULL | ||
| 539 | * @ie_len: length of ie in octets | ||
| 528 | * @wiphy: the wiphy this was for | 540 | * @wiphy: the wiphy this was for |
| 529 | * @ifidx: the interface index | 541 | * @ifidx: the interface index |
| 530 | */ | 542 | */ |
| @@ -533,6 +545,8 @@ struct cfg80211_scan_request { | |||
| 533 | int n_ssids; | 545 | int n_ssids; |
| 534 | struct ieee80211_channel **channels; | 546 | struct ieee80211_channel **channels; |
| 535 | u32 n_channels; | 547 | u32 n_channels; |
| 548 | u8 *ie; | ||
| 549 | size_t ie_len; | ||
| 536 | 550 | ||
| 537 | /* internal */ | 551 | /* internal */ |
| 538 | struct wiphy *wiphy; | 552 | struct wiphy *wiphy; |
| @@ -565,8 +579,7 @@ enum cfg80211_signal_type { | |||
| 565 | * @information_elements: the information elements (Note that there | 579 | * @information_elements: the information elements (Note that there |
| 566 | * is no guarantee that these are well-formed!) | 580 | * is no guarantee that these are well-formed!) |
| 567 | * @len_information_elements: total length of the information elements | 581 | * @len_information_elements: total length of the information elements |
| 568 | * @signal: signal strength value | 582 | * @signal: signal strength value (type depends on the wiphy's signal_type) |
| 569 | * @signal_type: signal type | ||
| 570 | * @free_priv: function pointer to free private data | 583 | * @free_priv: function pointer to free private data |
| 571 | * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes | 584 | * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes |
| 572 | */ | 585 | */ |
| @@ -581,7 +594,6 @@ struct cfg80211_bss { | |||
| 581 | size_t len_information_elements; | 594 | size_t len_information_elements; |
| 582 | 595 | ||
| 583 | s32 signal; | 596 | s32 signal; |
| 584 | enum cfg80211_signal_type signal_type; | ||
| 585 | 597 | ||
| 586 | void (*free_priv)(struct cfg80211_bss *bss); | 598 | void (*free_priv)(struct cfg80211_bss *bss); |
| 587 | u8 priv[0] __attribute__((__aligned__(sizeof(void *)))); | 599 | u8 priv[0] __attribute__((__aligned__(sizeof(void *)))); |
| @@ -755,6 +767,9 @@ int cfg80211_wext_siwscan(struct net_device *dev, | |||
| 755 | int cfg80211_wext_giwscan(struct net_device *dev, | 767 | int cfg80211_wext_giwscan(struct net_device *dev, |
| 756 | struct iw_request_info *info, | 768 | struct iw_request_info *info, |
| 757 | struct iw_point *data, char *extra); | 769 | struct iw_point *data, char *extra); |
| 770 | int cfg80211_wext_giwrange(struct net_device *dev, | ||
| 771 | struct iw_request_info *info, | ||
| 772 | struct iw_point *data, char *extra); | ||
| 758 | 773 | ||
| 759 | /** | 774 | /** |
| 760 | * cfg80211_scan_done - notify that scan finished | 775 | * cfg80211_scan_done - notify that scan finished |
| @@ -770,6 +785,7 @@ void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted); | |||
| 770 | * | 785 | * |
| 771 | * @wiphy: the wiphy reporting the BSS | 786 | * @wiphy: the wiphy reporting the BSS |
| 772 | * @bss: the found BSS | 787 | * @bss: the found BSS |
| 788 | * @signal: the signal strength, type depends on the wiphy's signal_type | ||
| 773 | * @gfp: context flags | 789 | * @gfp: context flags |
| 774 | * | 790 | * |
| 775 | * This informs cfg80211 that BSS information was found and | 791 | * This informs cfg80211 that BSS information was found and |
| @@ -779,8 +795,7 @@ struct cfg80211_bss* | |||
| 779 | cfg80211_inform_bss_frame(struct wiphy *wiphy, | 795 | cfg80211_inform_bss_frame(struct wiphy *wiphy, |
| 780 | struct ieee80211_channel *channel, | 796 | struct ieee80211_channel *channel, |
| 781 | struct ieee80211_mgmt *mgmt, size_t len, | 797 | struct ieee80211_mgmt *mgmt, size_t len, |
| 782 | s32 signal, enum cfg80211_signal_type sigtype, | 798 | s32 signal, gfp_t gfp); |
| 783 | gfp_t gfp); | ||
| 784 | 799 | ||
| 785 | struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, | 800 | struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, |
| 786 | struct ieee80211_channel *channel, | 801 | struct ieee80211_channel *channel, |
diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h deleted file mode 100644 index adb7cf31f781..000000000000 --- a/include/net/ieee80211.h +++ /dev/null | |||
| @@ -1,1185 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Merged with mainline ieee80211.h in Aug 2004. Original ieee802_11 | ||
| 3 | * remains copyright by the original authors | ||
| 4 | * | ||
| 5 | * Portions of the merged code are based on Host AP (software wireless | ||
| 6 | * LAN access point) driver for Intersil Prism2/2.5/3. | ||
| 7 | * | ||
| 8 | * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen | ||
| 9 | * <j@w1.fi> | ||
| 10 | * Copyright (c) 2002-2003, Jouni Malinen <j@w1.fi> | ||
| 11 | * | ||
| 12 | * Adaption to a generic IEEE 802.11 stack by James Ketrenos | ||
| 13 | * <jketreno@linux.intel.com> | ||
| 14 | * Copyright (c) 2004-2005, Intel Corporation | ||
| 15 | * | ||
| 16 | * This program is free software; you can redistribute it and/or modify | ||
| 17 | * it under the terms of the GNU General Public License version 2 as | ||
| 18 | * published by the Free Software Foundation. See README and COPYING for | ||
| 19 | * more details. | ||
| 20 | * | ||
| 21 | * API Version History | ||
| 22 | * 1.0.x -- Initial version | ||
| 23 | * 1.1.x -- Added radiotap, QoS, TIM, ieee80211_geo APIs, | ||
| 24 | * various structure changes, and crypto API init method | ||
| 25 | */ | ||
| 26 | #ifndef IEEE80211_H | ||
| 27 | #define IEEE80211_H | ||
| 28 | #include <linux/if_ether.h> /* ETH_ALEN */ | ||
| 29 | #include <linux/kernel.h> /* ARRAY_SIZE */ | ||
| 30 | #include <linux/wireless.h> | ||
| 31 | #include <linux/ieee80211.h> | ||
| 32 | |||
| 33 | #include <net/lib80211.h> | ||
| 34 | |||
| 35 | #define IEEE80211_VERSION "git-1.1.13" | ||
| 36 | |||
| 37 | #define IEEE80211_DATA_LEN 2304 | ||
| 38 | /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section | ||
| 39 | 6.2.1.1.2. | ||
| 40 | |||
| 41 | The figure in section 7.1.2 suggests a body size of up to 2312 | ||
| 42 | bytes is allowed, which is a bit confusing, I suspect this | ||
| 43 | represents the 2304 bytes of real data, plus a possible 8 bytes of | ||
| 44 | WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */ | ||
| 45 | |||
| 46 | #define IEEE80211_1ADDR_LEN 10 | ||
| 47 | #define IEEE80211_2ADDR_LEN 16 | ||
| 48 | #define IEEE80211_3ADDR_LEN 24 | ||
| 49 | #define IEEE80211_4ADDR_LEN 30 | ||
| 50 | #define IEEE80211_FCS_LEN 4 | ||
| 51 | #define IEEE80211_HLEN (IEEE80211_4ADDR_LEN) | ||
| 52 | #define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN) | ||
| 53 | |||
| 54 | #define MIN_FRAG_THRESHOLD 256U | ||
| 55 | #define MAX_FRAG_THRESHOLD 2346U | ||
| 56 | |||
| 57 | /* Frame control field constants */ | ||
| 58 | #define IEEE80211_FCTL_VERS 0x0003 | ||
| 59 | #define IEEE80211_FCTL_FTYPE 0x000c | ||
| 60 | #define IEEE80211_FCTL_STYPE 0x00f0 | ||
| 61 | #define IEEE80211_FCTL_TODS 0x0100 | ||
| 62 | #define IEEE80211_FCTL_FROMDS 0x0200 | ||
| 63 | #define IEEE80211_FCTL_MOREFRAGS 0x0400 | ||
| 64 | #define IEEE80211_FCTL_RETRY 0x0800 | ||
| 65 | #define IEEE80211_FCTL_PM 0x1000 | ||
| 66 | #define IEEE80211_FCTL_MOREDATA 0x2000 | ||
| 67 | #define IEEE80211_FCTL_PROTECTED 0x4000 | ||
| 68 | #define IEEE80211_FCTL_ORDER 0x8000 | ||
| 69 | |||
| 70 | #define IEEE80211_FTYPE_MGMT 0x0000 | ||
| 71 | #define IEEE80211_FTYPE_CTL 0x0004 | ||
| 72 | #define IEEE80211_FTYPE_DATA 0x0008 | ||
| 73 | |||
| 74 | /* management */ | ||
| 75 | #define IEEE80211_STYPE_ASSOC_REQ 0x0000 | ||
| 76 | #define IEEE80211_STYPE_ASSOC_RESP 0x0010 | ||
| 77 | #define IEEE80211_STYPE_REASSOC_REQ 0x0020 | ||
| 78 | #define IEEE80211_STYPE_REASSOC_RESP 0x0030 | ||
| 79 | #define IEEE80211_STYPE_PROBE_REQ 0x0040 | ||
| 80 | #define IEEE80211_STYPE_PROBE_RESP 0x0050 | ||
| 81 | #define IEEE80211_STYPE_BEACON 0x0080 | ||
| 82 | #define IEEE80211_STYPE_ATIM 0x0090 | ||
| 83 | #define IEEE80211_STYPE_DISASSOC 0x00A0 | ||
| 84 | #define IEEE80211_STYPE_AUTH 0x00B0 | ||
| 85 | #define IEEE80211_STYPE_DEAUTH 0x00C0 | ||
| 86 | #define IEEE80211_STYPE_ACTION 0x00D0 | ||
| 87 | |||
| 88 | /* control */ | ||
| 89 | #define IEEE80211_STYPE_PSPOLL 0x00A0 | ||
| 90 | #define IEEE80211_STYPE_RTS 0x00B0 | ||
| 91 | #define IEEE80211_STYPE_CTS 0x00C0 | ||
| 92 | #define IEEE80211_STYPE_ACK 0x00D0 | ||
| 93 | #define IEEE80211_STYPE_CFEND 0x00E0 | ||
| 94 | #define IEEE80211_STYPE_CFENDACK 0x00F0 | ||
| 95 | |||
| 96 | /* data */ | ||
| 97 | #define IEEE80211_STYPE_DATA 0x0000 | ||
| 98 | #define IEEE80211_STYPE_DATA_CFACK 0x0010 | ||
| 99 | #define IEEE80211_STYPE_DATA_CFPOLL 0x0020 | ||
| 100 | #define IEEE80211_STYPE_DATA_CFACKPOLL 0x0030 | ||
| 101 | #define IEEE80211_STYPE_NULLFUNC 0x0040 | ||
| 102 | #define IEEE80211_STYPE_CFACK 0x0050 | ||
| 103 | #define IEEE80211_STYPE_CFPOLL 0x0060 | ||
| 104 | #define IEEE80211_STYPE_CFACKPOLL 0x0070 | ||
| 105 | #define IEEE80211_STYPE_QOS_DATA 0x0080 | ||
| 106 | |||
| 107 | #define IEEE80211_SCTL_FRAG 0x000F | ||
| 108 | #define IEEE80211_SCTL_SEQ 0xFFF0 | ||
| 109 | |||
| 110 | /* QOS control */ | ||
| 111 | #define IEEE80211_QCTL_TID 0x000F | ||
| 112 | |||
| 113 | /* debug macros */ | ||
| 114 | |||
| 115 | #ifdef CONFIG_IEEE80211_DEBUG | ||
| 116 | extern u32 ieee80211_debug_level; | ||
| 117 | #define IEEE80211_DEBUG(level, fmt, args...) \ | ||
| 118 | do { if (ieee80211_debug_level & (level)) \ | ||
| 119 | printk(KERN_DEBUG "ieee80211: %c %s " fmt, \ | ||
| 120 | in_interrupt() ? 'I' : 'U', __func__ , ## args); } while (0) | ||
| 121 | static inline bool ieee80211_ratelimit_debug(u32 level) | ||
| 122 | { | ||
| 123 | return (ieee80211_debug_level & level) && net_ratelimit(); | ||
| 124 | } | ||
| 125 | #else | ||
| 126 | #define IEEE80211_DEBUG(level, fmt, args...) do {} while (0) | ||
| 127 | static inline bool ieee80211_ratelimit_debug(u32 level) | ||
| 128 | { | ||
| 129 | return false; | ||
| 130 | } | ||
| 131 | #endif /* CONFIG_IEEE80211_DEBUG */ | ||
| 132 | |||
| 133 | /* | ||
| 134 | * To use the debug system: | ||
| 135 | * | ||
| 136 | * If you are defining a new debug classification, simply add it to the #define | ||
| 137 | * list here in the form of: | ||
| 138 | * | ||
| 139 | * #define IEEE80211_DL_xxxx VALUE | ||
| 140 | * | ||
| 141 | * shifting value to the left one bit from the previous entry. xxxx should be | ||
| 142 | * the name of the classification (for example, WEP) | ||
| 143 | * | ||
| 144 | * You then need to either add a IEEE80211_xxxx_DEBUG() macro definition for your | ||
| 145 | * classification, or use IEEE80211_DEBUG(IEEE80211_DL_xxxx, ...) whenever you want | ||
| 146 | * to send output to that classification. | ||
| 147 | * | ||
| 148 | * To add your debug level to the list of levels seen when you perform | ||
| 149 | * | ||
| 150 | * % cat /proc/net/ieee80211/debug_level | ||
| 151 | * | ||
| 152 | * you simply need to add your entry to the ieee80211_debug_level array. | ||
| 153 | * | ||
| 154 | * If you do not see debug_level in /proc/net/ieee80211 then you do not have | ||
| 155 | * CONFIG_IEEE80211_DEBUG defined in your kernel configuration | ||
| 156 | * | ||
| 157 | */ | ||
| 158 | |||
| 159 | #define IEEE80211_DL_INFO (1<<0) | ||
| 160 | #define IEEE80211_DL_WX (1<<1) | ||
| 161 | #define IEEE80211_DL_SCAN (1<<2) | ||
| 162 | #define IEEE80211_DL_STATE (1<<3) | ||
| 163 | #define IEEE80211_DL_MGMT (1<<4) | ||
| 164 | #define IEEE80211_DL_FRAG (1<<5) | ||
| 165 | #define IEEE80211_DL_DROP (1<<7) | ||
| 166 | |||
| 167 | #define IEEE80211_DL_TX (1<<8) | ||
| 168 | #define IEEE80211_DL_RX (1<<9) | ||
| 169 | #define IEEE80211_DL_QOS (1<<31) | ||
| 170 | |||
| 171 | #define IEEE80211_ERROR(f, a...) printk(KERN_ERR "ieee80211: " f, ## a) | ||
| 172 | #define IEEE80211_WARNING(f, a...) printk(KERN_WARNING "ieee80211: " f, ## a) | ||
| 173 | #define IEEE80211_DEBUG_INFO(f, a...) IEEE80211_DEBUG(IEEE80211_DL_INFO, f, ## a) | ||
| 174 | |||
| 175 | #define IEEE80211_DEBUG_WX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_WX, f, ## a) | ||
| 176 | #define IEEE80211_DEBUG_SCAN(f, a...) IEEE80211_DEBUG(IEEE80211_DL_SCAN, f, ## a) | ||
| 177 | #define IEEE80211_DEBUG_STATE(f, a...) IEEE80211_DEBUG(IEEE80211_DL_STATE, f, ## a) | ||
| 178 | #define IEEE80211_DEBUG_MGMT(f, a...) IEEE80211_DEBUG(IEEE80211_DL_MGMT, f, ## a) | ||
| 179 | #define IEEE80211_DEBUG_FRAG(f, a...) IEEE80211_DEBUG(IEEE80211_DL_FRAG, f, ## a) | ||
| 180 | #define IEEE80211_DEBUG_DROP(f, a...) IEEE80211_DEBUG(IEEE80211_DL_DROP, f, ## a) | ||
| 181 | #define IEEE80211_DEBUG_TX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_TX, f, ## a) | ||
| 182 | #define IEEE80211_DEBUG_RX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_RX, f, ## a) | ||
| 183 | #define IEEE80211_DEBUG_QOS(f, a...) IEEE80211_DEBUG(IEEE80211_DL_QOS, f, ## a) | ||
| 184 | #include <linux/netdevice.h> | ||
| 185 | #include <linux/if_arp.h> /* ARPHRD_ETHER */ | ||
| 186 | |||
| 187 | #ifndef WIRELESS_SPY | ||
| 188 | #define WIRELESS_SPY /* enable iwspy support */ | ||
| 189 | #endif | ||
| 190 | #include <net/iw_handler.h> /* new driver API */ | ||
| 191 | |||
| 192 | #define ETH_P_PREAUTH 0x88C7 /* IEEE 802.11i pre-authentication */ | ||
| 193 | |||
| 194 | #ifndef ETH_P_80211_RAW | ||
| 195 | #define ETH_P_80211_RAW (ETH_P_ECONET + 1) | ||
| 196 | #endif | ||
| 197 | |||
| 198 | /* IEEE 802.11 defines */ | ||
| 199 | |||
| 200 | #define P80211_OUI_LEN 3 | ||
| 201 | |||
| 202 | struct ieee80211_snap_hdr { | ||
| 203 | |||
| 204 | u8 dsap; /* always 0xAA */ | ||
| 205 | u8 ssap; /* always 0xAA */ | ||
| 206 | u8 ctrl; /* always 0x03 */ | ||
| 207 | u8 oui[P80211_OUI_LEN]; /* organizational universal id */ | ||
| 208 | |||
| 209 | } __attribute__ ((packed)); | ||
| 210 | |||
| 211 | #define SNAP_SIZE sizeof(struct ieee80211_snap_hdr) | ||
| 212 | |||
| 213 | #define WLAN_FC_GET_VERS(fc) ((fc) & IEEE80211_FCTL_VERS) | ||
| 214 | #define WLAN_FC_GET_TYPE(fc) ((fc) & IEEE80211_FCTL_FTYPE) | ||
| 215 | #define WLAN_FC_GET_STYPE(fc) ((fc) & IEEE80211_FCTL_STYPE) | ||
| 216 | |||
| 217 | #define WLAN_GET_SEQ_FRAG(seq) ((seq) & IEEE80211_SCTL_FRAG) | ||
| 218 | #define WLAN_GET_SEQ_SEQ(seq) (((seq) & IEEE80211_SCTL_SEQ) >> 4) | ||
| 219 | |||
| 220 | /* Action categories - 802.11h */ | ||
| 221 | enum ieee80211_actioncategories { | ||
| 222 | WLAN_ACTION_SPECTRUM_MGMT = 0, | ||
| 223 | /* Reserved 1-127 */ | ||
| 224 | /* Error 128-255 */ | ||
| 225 | }; | ||
| 226 | |||
| 227 | /* Action details - 802.11h */ | ||
| 228 | enum ieee80211_actiondetails { | ||
| 229 | WLAN_ACTION_CATEGORY_MEASURE_REQUEST = 0, | ||
| 230 | WLAN_ACTION_CATEGORY_MEASURE_REPORT = 1, | ||
| 231 | WLAN_ACTION_CATEGORY_TPC_REQUEST = 2, | ||
| 232 | WLAN_ACTION_CATEGORY_TPC_REPORT = 3, | ||
| 233 | WLAN_ACTION_CATEGORY_CHANNEL_SWITCH = 4, | ||
| 234 | /* 5 - 255 Reserved */ | ||
| 235 | }; | ||
| 236 | |||
| 237 | #define IEEE80211_STATMASK_SIGNAL (1<<0) | ||
| 238 | #define IEEE80211_STATMASK_RSSI (1<<1) | ||
| 239 | #define IEEE80211_STATMASK_NOISE (1<<2) | ||
| 240 | #define IEEE80211_STATMASK_RATE (1<<3) | ||
| 241 | #define IEEE80211_STATMASK_WEMASK 0x7 | ||
| 242 | |||
| 243 | #define IEEE80211_CCK_MODULATION (1<<0) | ||
| 244 | #define IEEE80211_OFDM_MODULATION (1<<1) | ||
| 245 | |||
| 246 | #define IEEE80211_24GHZ_BAND (1<<0) | ||
| 247 | #define IEEE80211_52GHZ_BAND (1<<1) | ||
| 248 | |||
| 249 | #define IEEE80211_CCK_RATE_1MB 0x02 | ||
| 250 | #define IEEE80211_CCK_RATE_2MB 0x04 | ||
| 251 | #define IEEE80211_CCK_RATE_5MB 0x0B | ||
| 252 | #define IEEE80211_CCK_RATE_11MB 0x16 | ||
| 253 | #define IEEE80211_OFDM_RATE_6MB 0x0C | ||
| 254 | #define IEEE80211_OFDM_RATE_9MB 0x12 | ||
| 255 | #define IEEE80211_OFDM_RATE_12MB 0x18 | ||
| 256 | #define IEEE80211_OFDM_RATE_18MB 0x24 | ||
| 257 | #define IEEE80211_OFDM_RATE_24MB 0x30 | ||
| 258 | #define IEEE80211_OFDM_RATE_36MB 0x48 | ||
| 259 | #define IEEE80211_OFDM_RATE_48MB 0x60 | ||
| 260 | #define IEEE80211_OFDM_RATE_54MB 0x6C | ||
| 261 | #define IEEE80211_BASIC_RATE_MASK 0x80 | ||
| 262 | |||
| 263 | #define IEEE80211_CCK_RATE_1MB_MASK (1<<0) | ||
| 264 | #define IEEE80211_CCK_RATE_2MB_MASK (1<<1) | ||
| 265 | #define IEEE80211_CCK_RATE_5MB_MASK (1<<2) | ||
| 266 | #define IEEE80211_CCK_RATE_11MB_MASK (1<<3) | ||
| 267 | #define IEEE80211_OFDM_RATE_6MB_MASK (1<<4) | ||
| 268 | #define IEEE80211_OFDM_RATE_9MB_MASK (1<<5) | ||
| 269 | #define IEEE80211_OFDM_RATE_12MB_MASK (1<<6) | ||
| 270 | #define IEEE80211_OFDM_RATE_18MB_MASK (1<<7) | ||
| 271 | #define IEEE80211_OFDM_RATE_24MB_MASK (1<<8) | ||
| 272 | #define IEEE80211_OFDM_RATE_36MB_MASK (1<<9) | ||
| 273 | #define IEEE80211_OFDM_RATE_48MB_MASK (1<<10) | ||
| 274 | #define IEEE80211_OFDM_RATE_54MB_MASK (1<<11) | ||
| 275 | |||
| 276 | #define IEEE80211_CCK_RATES_MASK 0x0000000F | ||
| 277 | #define IEEE80211_CCK_BASIC_RATES_MASK (IEEE80211_CCK_RATE_1MB_MASK | \ | ||
| 278 | IEEE80211_CCK_RATE_2MB_MASK) | ||
| 279 | #define IEEE80211_CCK_DEFAULT_RATES_MASK (IEEE80211_CCK_BASIC_RATES_MASK | \ | ||
| 280 | IEEE80211_CCK_RATE_5MB_MASK | \ | ||
| 281 | IEEE80211_CCK_RATE_11MB_MASK) | ||
| 282 | |||
| 283 | #define IEEE80211_OFDM_RATES_MASK 0x00000FF0 | ||
| 284 | #define IEEE80211_OFDM_BASIC_RATES_MASK (IEEE80211_OFDM_RATE_6MB_MASK | \ | ||
| 285 | IEEE80211_OFDM_RATE_12MB_MASK | \ | ||
| 286 | IEEE80211_OFDM_RATE_24MB_MASK) | ||
| 287 | #define IEEE80211_OFDM_DEFAULT_RATES_MASK (IEEE80211_OFDM_BASIC_RATES_MASK | \ | ||
| 288 | IEEE80211_OFDM_RATE_9MB_MASK | \ | ||
| 289 | IEEE80211_OFDM_RATE_18MB_MASK | \ | ||
| 290 | IEEE80211_OFDM_RATE_36MB_MASK | \ | ||
| 291 | IEEE80211_OFDM_RATE_48MB_MASK | \ | ||
| 292 | IEEE80211_OFDM_RATE_54MB_MASK) | ||
| 293 | #define IEEE80211_DEFAULT_RATES_MASK (IEEE80211_OFDM_DEFAULT_RATES_MASK | \ | ||
| 294 | IEEE80211_CCK_DEFAULT_RATES_MASK) | ||
| 295 | |||
| 296 | #define IEEE80211_NUM_OFDM_RATES 8 | ||
| 297 | #define IEEE80211_NUM_CCK_RATES 4 | ||
| 298 | #define IEEE80211_OFDM_SHIFT_MASK_A 4 | ||
| 299 | |||
| 300 | /* NOTE: This data is for statistical purposes; not all hardware provides this | ||
| 301 | * information for frames received. | ||
| 302 | * For ieee80211_rx_mgt, you need to set at least the 'len' parameter. | ||
| 303 | */ | ||
| 304 | struct ieee80211_rx_stats { | ||
| 305 | u32 mac_time; | ||
| 306 | s8 rssi; | ||
| 307 | u8 signal; | ||
| 308 | u8 noise; | ||
| 309 | u16 rate; /* in 100 kbps */ | ||
| 310 | u8 received_channel; | ||
| 311 | u8 control; | ||
| 312 | u8 mask; | ||
| 313 | u8 freq; | ||
| 314 | u16 len; | ||
| 315 | u64 tsf; | ||
| 316 | u32 beacon_time; | ||
| 317 | }; | ||
| 318 | |||
| 319 | /* IEEE 802.11 requires that STA supports concurrent reception of at least | ||
| 320 | * three fragmented frames. This define can be increased to support more | ||
| 321 | * concurrent frames, but it should be noted that each entry can consume about | ||
| 322 | * 2 kB of RAM and increasing cache size will slow down frame reassembly. */ | ||
| 323 | #define IEEE80211_FRAG_CACHE_LEN 4 | ||
| 324 | |||
| 325 | struct ieee80211_frag_entry { | ||
| 326 | unsigned long first_frag_time; | ||
| 327 | unsigned int seq; | ||
| 328 | unsigned int last_frag; | ||
| 329 | struct sk_buff *skb; | ||
| 330 | u8 src_addr[ETH_ALEN]; | ||
| 331 | u8 dst_addr[ETH_ALEN]; | ||
| 332 | }; | ||
| 333 | |||
| 334 | struct ieee80211_stats { | ||
| 335 | unsigned int tx_unicast_frames; | ||
| 336 | unsigned int tx_multicast_frames; | ||
| 337 | unsigned int tx_fragments; | ||
| 338 | unsigned int tx_unicast_octets; | ||
| 339 | unsigned int tx_multicast_octets; | ||
| 340 | unsigned int tx_deferred_transmissions; | ||
| 341 | unsigned int tx_single_retry_frames; | ||
| 342 | unsigned int tx_multiple_retry_frames; | ||
| 343 | unsigned int tx_retry_limit_exceeded; | ||
| 344 | unsigned int tx_discards; | ||
| 345 | unsigned int rx_unicast_frames; | ||
| 346 | unsigned int rx_multicast_frames; | ||
| 347 | unsigned int rx_fragments; | ||
| 348 | unsigned int rx_unicast_octets; | ||
| 349 | unsigned int rx_multicast_octets; | ||
| 350 | unsigned int rx_fcs_errors; | ||
| 351 | unsigned int rx_discards_no_buffer; | ||
| 352 | unsigned int tx_discards_wrong_sa; | ||
| 353 | unsigned int rx_discards_undecryptable; | ||
| 354 | unsigned int rx_message_in_msg_fragments; | ||
| 355 | unsigned int rx_message_in_bad_msg_fragments; | ||
| 356 | }; | ||
| 357 | |||
| 358 | struct ieee80211_device; | ||
| 359 | |||
| 360 | #define SEC_KEY_1 (1<<0) | ||
| 361 | #define SEC_KEY_2 (1<<1) | ||
| 362 | #define SEC_KEY_3 (1<<2) | ||
| 363 | #define SEC_KEY_4 (1<<3) | ||
| 364 | #define SEC_ACTIVE_KEY (1<<4) | ||
| 365 | #define SEC_AUTH_MODE (1<<5) | ||
| 366 | #define SEC_UNICAST_GROUP (1<<6) | ||
| 367 | #define SEC_LEVEL (1<<7) | ||
| 368 | #define SEC_ENABLED (1<<8) | ||
| 369 | #define SEC_ENCRYPT (1<<9) | ||
| 370 | |||
| 371 | #define SEC_LEVEL_0 0 /* None */ | ||
| 372 | #define SEC_LEVEL_1 1 /* WEP 40 and 104 bit */ | ||
| 373 | #define SEC_LEVEL_2 2 /* Level 1 + TKIP */ | ||
| 374 | #define SEC_LEVEL_2_CKIP 3 /* Level 1 + CKIP */ | ||
| 375 | #define SEC_LEVEL_3 4 /* Level 2 + CCMP */ | ||
| 376 | |||
| 377 | #define SEC_ALG_NONE 0 | ||
| 378 | #define SEC_ALG_WEP 1 | ||
| 379 | #define SEC_ALG_TKIP 2 | ||
| 380 | #define SEC_ALG_CCMP 3 | ||
| 381 | |||
| 382 | #define WEP_KEYS 4 | ||
| 383 | #define WEP_KEY_LEN 13 | ||
| 384 | #define SCM_KEY_LEN 32 | ||
| 385 | #define SCM_TEMPORAL_KEY_LENGTH 16 | ||
| 386 | |||
| 387 | struct ieee80211_security { | ||
| 388 | u16 active_key:2, enabled:1, unicast_uses_group:1, encrypt:1; | ||
| 389 | u8 auth_mode; | ||
| 390 | u8 encode_alg[WEP_KEYS]; | ||
| 391 | u8 key_sizes[WEP_KEYS]; | ||
| 392 | u8 keys[WEP_KEYS][SCM_KEY_LEN]; | ||
| 393 | u8 level; | ||
| 394 | u16 flags; | ||
| 395 | } __attribute__ ((packed)); | ||
| 396 | |||
| 397 | /* | ||
| 398 | |||
| 399 | 802.11 data frame from AP | ||
| 400 | |||
| 401 | ,-------------------------------------------------------------------. | ||
| 402 | Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 | | ||
| 403 | |------|------|---------|---------|---------|------|---------|------| | ||
| 404 | Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | frame | fcs | | ||
| 405 | | | tion | (BSSID) | | | ence | data | | | ||
| 406 | `-------------------------------------------------------------------' | ||
| 407 | |||
| 408 | Total: 28-2340 bytes | ||
| 409 | |||
| 410 | */ | ||
| 411 | |||
| 412 | #define BEACON_PROBE_SSID_ID_POSITION 12 | ||
| 413 | |||
| 414 | /* Management Frame Information Element Types */ | ||
| 415 | enum ieee80211_mfie { | ||
| 416 | MFIE_TYPE_SSID = 0, | ||
| 417 | MFIE_TYPE_RATES = 1, | ||
| 418 | MFIE_TYPE_FH_SET = 2, | ||
| 419 | MFIE_TYPE_DS_SET = 3, | ||
| 420 | MFIE_TYPE_CF_SET = 4, | ||
| 421 | MFIE_TYPE_TIM = 5, | ||
| 422 | MFIE_TYPE_IBSS_SET = 6, | ||
| 423 | MFIE_TYPE_COUNTRY = 7, | ||
| 424 | MFIE_TYPE_HOP_PARAMS = 8, | ||
| 425 | MFIE_TYPE_HOP_TABLE = 9, | ||
| 426 | MFIE_TYPE_REQUEST = 10, | ||
| 427 | MFIE_TYPE_CHALLENGE = 16, | ||
| 428 | MFIE_TYPE_POWER_CONSTRAINT = 32, | ||
| 429 | MFIE_TYPE_POWER_CAPABILITY = 33, | ||
| 430 | MFIE_TYPE_TPC_REQUEST = 34, | ||
| 431 | MFIE_TYPE_TPC_REPORT = 35, | ||
| 432 | MFIE_TYPE_SUPP_CHANNELS = 36, | ||
| 433 | MFIE_TYPE_CSA = 37, | ||
| 434 | MFIE_TYPE_MEASURE_REQUEST = 38, | ||
| 435 | MFIE_TYPE_MEASURE_REPORT = 39, | ||
| 436 | MFIE_TYPE_QUIET = 40, | ||
| 437 | MFIE_TYPE_IBSS_DFS = 41, | ||
| 438 | MFIE_TYPE_ERP_INFO = 42, | ||
| 439 | MFIE_TYPE_RSN = 48, | ||
| 440 | MFIE_TYPE_RATES_EX = 50, | ||
| 441 | MFIE_TYPE_GENERIC = 221, | ||
| 442 | MFIE_TYPE_QOS_PARAMETER = 222, | ||
| 443 | }; | ||
| 444 | |||
| 445 | struct ieee80211_hdr_1addr { | ||
| 446 | __le16 frame_ctl; | ||
| 447 | __le16 duration_id; | ||
| 448 | u8 addr1[ETH_ALEN]; | ||
| 449 | u8 payload[0]; | ||
| 450 | } __attribute__ ((packed)); | ||
| 451 | |||
| 452 | struct ieee80211_hdr_2addr { | ||
| 453 | __le16 frame_ctl; | ||
| 454 | __le16 duration_id; | ||
| 455 | u8 addr1[ETH_ALEN]; | ||
| 456 | u8 addr2[ETH_ALEN]; | ||
| 457 | u8 payload[0]; | ||
| 458 | } __attribute__ ((packed)); | ||
| 459 | |||
| 460 | struct ieee80211_hdr_3addr { | ||
| 461 | __le16 frame_ctl; | ||
| 462 | __le16 duration_id; | ||
| 463 | u8 addr1[ETH_ALEN]; | ||
| 464 | u8 addr2[ETH_ALEN]; | ||
| 465 | u8 addr3[ETH_ALEN]; | ||
| 466 | __le16 seq_ctl; | ||
| 467 | u8 payload[0]; | ||
| 468 | } __attribute__ ((packed)); | ||
| 469 | |||
| 470 | struct ieee80211_hdr_4addr { | ||
| 471 | __le16 frame_ctl; | ||
| 472 | __le16 duration_id; | ||
| 473 | u8 addr1[ETH_ALEN]; | ||
| 474 | u8 addr2[ETH_ALEN]; | ||
| 475 | u8 addr3[ETH_ALEN]; | ||
| 476 | __le16 seq_ctl; | ||
| 477 | u8 addr4[ETH_ALEN]; | ||
| 478 | u8 payload[0]; | ||
| 479 | } __attribute__ ((packed)); | ||
| 480 | |||
| 481 | struct ieee80211_hdr_3addrqos { | ||
| 482 | __le16 frame_ctl; | ||
| 483 | __le16 duration_id; | ||
| 484 | u8 addr1[ETH_ALEN]; | ||
| 485 | u8 addr2[ETH_ALEN]; | ||
| 486 | u8 addr3[ETH_ALEN]; | ||
| 487 | __le16 seq_ctl; | ||
| 488 | u8 payload[0]; | ||
| 489 | __le16 qos_ctl; | ||
| 490 | } __attribute__ ((packed)); | ||
| 491 | |||
| 492 | struct ieee80211_info_element { | ||
| 493 | u8 id; | ||
| 494 | u8 len; | ||
| 495 | u8 data[0]; | ||
| 496 | } __attribute__ ((packed)); | ||
| 497 | |||
| 498 | /* | ||
| 499 | * These are the data types that can make up management packets | ||
| 500 | * | ||
| 501 | u16 auth_algorithm; | ||
| 502 | u16 auth_sequence; | ||
| 503 | u16 beacon_interval; | ||
| 504 | u16 capability; | ||
| 505 | u8 current_ap[ETH_ALEN]; | ||
| 506 | u16 listen_interval; | ||
| 507 | struct { | ||
| 508 | u16 association_id:14, reserved:2; | ||
| 509 | } __attribute__ ((packed)); | ||
| 510 | u32 time_stamp[2]; | ||
| 511 | u16 reason; | ||
| 512 | u16 status; | ||
| 513 | */ | ||
| 514 | |||
| 515 | struct ieee80211_auth { | ||
| 516 | struct ieee80211_hdr_3addr header; | ||
| 517 | __le16 algorithm; | ||
| 518 | __le16 transaction; | ||
| 519 | __le16 status; | ||
| 520 | /* challenge */ | ||
| 521 | struct ieee80211_info_element info_element[0]; | ||
| 522 | } __attribute__ ((packed)); | ||
| 523 | |||
| 524 | struct ieee80211_channel_switch { | ||
| 525 | u8 id; | ||
| 526 | u8 len; | ||
| 527 | u8 mode; | ||
| 528 | u8 channel; | ||
| 529 | u8 count; | ||
| 530 | } __attribute__ ((packed)); | ||
| 531 | |||
| 532 | struct ieee80211_action { | ||
| 533 | struct ieee80211_hdr_3addr header; | ||
| 534 | u8 category; | ||
| 535 | u8 action; | ||
| 536 | union { | ||
| 537 | struct ieee80211_action_exchange { | ||
| 538 | u8 token; | ||
| 539 | struct ieee80211_info_element info_element[0]; | ||
| 540 | } exchange; | ||
| 541 | struct ieee80211_channel_switch channel_switch; | ||
| 542 | |||
| 543 | } format; | ||
| 544 | } __attribute__ ((packed)); | ||
| 545 | |||
| 546 | struct ieee80211_disassoc { | ||
| 547 | struct ieee80211_hdr_3addr header; | ||
| 548 | __le16 reason; | ||
| 549 | } __attribute__ ((packed)); | ||
| 550 | |||
| 551 | /* Alias deauth for disassoc */ | ||
| 552 | #define ieee80211_deauth ieee80211_disassoc | ||
| 553 | |||
| 554 | struct ieee80211_probe_request { | ||
| 555 | struct ieee80211_hdr_3addr header; | ||
| 556 | /* SSID, supported rates */ | ||
| 557 | struct ieee80211_info_element info_element[0]; | ||
| 558 | } __attribute__ ((packed)); | ||
| 559 | |||
| 560 | struct ieee80211_probe_response { | ||
| 561 | struct ieee80211_hdr_3addr header; | ||
| 562 | __le32 time_stamp[2]; | ||
| 563 | __le16 beacon_interval; | ||
| 564 | __le16 capability; | ||
| 565 | /* SSID, supported rates, FH params, DS params, | ||
| 566 | * CF params, IBSS params, TIM (if beacon), RSN */ | ||
| 567 | struct ieee80211_info_element info_element[0]; | ||
| 568 | } __attribute__ ((packed)); | ||
| 569 | |||
| 570 | /* Alias beacon for probe_response */ | ||
| 571 | #define ieee80211_beacon ieee80211_probe_response | ||
| 572 | |||
| 573 | struct ieee80211_assoc_request { | ||
| 574 | struct ieee80211_hdr_3addr header; | ||
| 575 | __le16 capability; | ||
| 576 | __le16 listen_interval; | ||
| 577 | /* SSID, supported rates, RSN */ | ||
| 578 | struct ieee80211_info_element info_element[0]; | ||
| 579 | } __attribute__ ((packed)); | ||
| 580 | |||
| 581 | struct ieee80211_reassoc_request { | ||
| 582 | struct ieee80211_hdr_3addr header; | ||
| 583 | __le16 capability; | ||
| 584 | __le16 listen_interval; | ||
| 585 | u8 current_ap[ETH_ALEN]; | ||
| 586 | struct ieee80211_info_element info_element[0]; | ||
| 587 | } __attribute__ ((packed)); | ||
| 588 | |||
| 589 | struct ieee80211_assoc_response { | ||
| 590 | struct ieee80211_hdr_3addr header; | ||
| 591 | __le16 capability; | ||
| 592 | __le16 status; | ||
| 593 | __le16 aid; | ||
| 594 | /* supported rates */ | ||
| 595 | struct ieee80211_info_element info_element[0]; | ||
| 596 | } __attribute__ ((packed)); | ||
| 597 | |||
| 598 | struct ieee80211_txb { | ||
| 599 | u8 nr_frags; | ||
| 600 | u8 encrypted; | ||
| 601 | u8 rts_included; | ||
| 602 | u8 reserved; | ||
| 603 | u16 frag_size; | ||
| 604 | u16 payload_size; | ||
| 605 | struct sk_buff *fragments[0]; | ||
| 606 | }; | ||
| 607 | |||
| 608 | /* SWEEP TABLE ENTRIES NUMBER */ | ||
| 609 | #define MAX_SWEEP_TAB_ENTRIES 42 | ||
| 610 | #define MAX_SWEEP_TAB_ENTRIES_PER_PACKET 7 | ||
| 611 | /* MAX_RATES_LENGTH needs to be 12. The spec says 8, and many APs | ||
| 612 | * only use 8, and then use extended rates for the remaining supported | ||
| 613 | * rates. Other APs, however, stick all of their supported rates on the | ||
| 614 | * main rates information element... */ | ||
| 615 | #define MAX_RATES_LENGTH ((u8)12) | ||
| 616 | #define MAX_RATES_EX_LENGTH ((u8)16) | ||
| 617 | #define MAX_NETWORK_COUNT 128 | ||
| 618 | |||
| 619 | #define CRC_LENGTH 4U | ||
| 620 | |||
| 621 | #define MAX_WPA_IE_LEN 64 | ||
| 622 | |||
| 623 | #define NETWORK_HAS_OFDM (1<<1) | ||
| 624 | #define NETWORK_HAS_CCK (1<<2) | ||
| 625 | |||
| 626 | /* QoS structure */ | ||
| 627 | #define NETWORK_HAS_QOS_PARAMETERS (1<<3) | ||
| 628 | #define NETWORK_HAS_QOS_INFORMATION (1<<4) | ||
| 629 | #define NETWORK_HAS_QOS_MASK (NETWORK_HAS_QOS_PARAMETERS | \ | ||
| 630 | NETWORK_HAS_QOS_INFORMATION) | ||
| 631 | |||
| 632 | /* 802.11h */ | ||
| 633 | #define NETWORK_HAS_POWER_CONSTRAINT (1<<5) | ||
| 634 | #define NETWORK_HAS_CSA (1<<6) | ||
| 635 | #define NETWORK_HAS_QUIET (1<<7) | ||
| 636 | #define NETWORK_HAS_IBSS_DFS (1<<8) | ||
| 637 | #define NETWORK_HAS_TPC_REPORT (1<<9) | ||
| 638 | |||
| 639 | #define NETWORK_HAS_ERP_VALUE (1<<10) | ||
| 640 | |||
| 641 | #define QOS_QUEUE_NUM 4 | ||
| 642 | #define QOS_OUI_LEN 3 | ||
| 643 | #define QOS_OUI_TYPE 2 | ||
| 644 | #define QOS_ELEMENT_ID 221 | ||
| 645 | #define QOS_OUI_INFO_SUB_TYPE 0 | ||
| 646 | #define QOS_OUI_PARAM_SUB_TYPE 1 | ||
| 647 | #define QOS_VERSION_1 1 | ||
| 648 | #define QOS_AIFSN_MIN_VALUE 2 | ||
| 649 | |||
| 650 | struct ieee80211_qos_information_element { | ||
| 651 | u8 elementID; | ||
| 652 | u8 length; | ||
| 653 | u8 qui[QOS_OUI_LEN]; | ||
| 654 | u8 qui_type; | ||
| 655 | u8 qui_subtype; | ||
| 656 | u8 version; | ||
| 657 | u8 ac_info; | ||
| 658 | } __attribute__ ((packed)); | ||
| 659 | |||
| 660 | struct ieee80211_qos_ac_parameter { | ||
| 661 | u8 aci_aifsn; | ||
| 662 | u8 ecw_min_max; | ||
| 663 | __le16 tx_op_limit; | ||
| 664 | } __attribute__ ((packed)); | ||
| 665 | |||
| 666 | struct ieee80211_qos_parameter_info { | ||
| 667 | struct ieee80211_qos_information_element info_element; | ||
| 668 | u8 reserved; | ||
| 669 | struct ieee80211_qos_ac_parameter ac_params_record[QOS_QUEUE_NUM]; | ||
| 670 | } __attribute__ ((packed)); | ||
| 671 | |||
| 672 | struct ieee80211_qos_parameters { | ||
| 673 | __le16 cw_min[QOS_QUEUE_NUM]; | ||
| 674 | __le16 cw_max[QOS_QUEUE_NUM]; | ||
| 675 | u8 aifs[QOS_QUEUE_NUM]; | ||
| 676 | u8 flag[QOS_QUEUE_NUM]; | ||
| 677 | __le16 tx_op_limit[QOS_QUEUE_NUM]; | ||
| 678 | } __attribute__ ((packed)); | ||
| 679 | |||
| 680 | struct ieee80211_qos_data { | ||
| 681 | struct ieee80211_qos_parameters parameters; | ||
| 682 | int active; | ||
| 683 | int supported; | ||
| 684 | u8 param_count; | ||
| 685 | u8 old_param_count; | ||
| 686 | }; | ||
| 687 | |||
| 688 | struct ieee80211_tim_parameters { | ||
| 689 | u8 tim_count; | ||
| 690 | u8 tim_period; | ||
| 691 | } __attribute__ ((packed)); | ||
| 692 | |||
| 693 | /*******************************************************/ | ||
| 694 | |||
| 695 | enum { /* ieee80211_basic_report.map */ | ||
| 696 | IEEE80211_BASIC_MAP_BSS = (1 << 0), | ||
| 697 | IEEE80211_BASIC_MAP_OFDM = (1 << 1), | ||
| 698 | IEEE80211_BASIC_MAP_UNIDENTIFIED = (1 << 2), | ||
| 699 | IEEE80211_BASIC_MAP_RADAR = (1 << 3), | ||
| 700 | IEEE80211_BASIC_MAP_UNMEASURED = (1 << 4), | ||
| 701 | /* Bits 5-7 are reserved */ | ||
| 702 | |||
| 703 | }; | ||
| 704 | struct ieee80211_basic_report { | ||
| 705 | u8 channel; | ||
| 706 | __le64 start_time; | ||
| 707 | __le16 duration; | ||
| 708 | u8 map; | ||
| 709 | } __attribute__ ((packed)); | ||
| 710 | |||
| 711 | enum { /* ieee80211_measurement_request.mode */ | ||
| 712 | /* Bit 0 is reserved */ | ||
| 713 | IEEE80211_MEASUREMENT_ENABLE = (1 << 1), | ||
| 714 | IEEE80211_MEASUREMENT_REQUEST = (1 << 2), | ||
| 715 | IEEE80211_MEASUREMENT_REPORT = (1 << 3), | ||
| 716 | /* Bits 4-7 are reserved */ | ||
| 717 | }; | ||
| 718 | |||
| 719 | enum { | ||
| 720 | IEEE80211_REPORT_BASIC = 0, /* required */ | ||
| 721 | IEEE80211_REPORT_CCA = 1, /* optional */ | ||
| 722 | IEEE80211_REPORT_RPI = 2, /* optional */ | ||
| 723 | /* 3-255 reserved */ | ||
| 724 | }; | ||
| 725 | |||
| 726 | struct ieee80211_measurement_params { | ||
| 727 | u8 channel; | ||
| 728 | __le64 start_time; | ||
| 729 | __le16 duration; | ||
| 730 | } __attribute__ ((packed)); | ||
| 731 | |||
| 732 | struct ieee80211_measurement_request { | ||
| 733 | struct ieee80211_info_element ie; | ||
| 734 | u8 token; | ||
| 735 | u8 mode; | ||
| 736 | u8 type; | ||
| 737 | struct ieee80211_measurement_params params[0]; | ||
| 738 | } __attribute__ ((packed)); | ||
| 739 | |||
| 740 | struct ieee80211_measurement_report { | ||
| 741 | struct ieee80211_info_element ie; | ||
| 742 | u8 token; | ||
| 743 | u8 mode; | ||
| 744 | u8 type; | ||
| 745 | union { | ||
| 746 | struct ieee80211_basic_report basic[0]; | ||
| 747 | } u; | ||
| 748 | } __attribute__ ((packed)); | ||
| 749 | |||
| 750 | struct ieee80211_tpc_report { | ||
| 751 | u8 transmit_power; | ||
| 752 | u8 link_margin; | ||
| 753 | } __attribute__ ((packed)); | ||
| 754 | |||
| 755 | struct ieee80211_channel_map { | ||
| 756 | u8 channel; | ||
| 757 | u8 map; | ||
| 758 | } __attribute__ ((packed)); | ||
| 759 | |||
| 760 | struct ieee80211_ibss_dfs { | ||
| 761 | struct ieee80211_info_element ie; | ||
| 762 | u8 owner[ETH_ALEN]; | ||
| 763 | u8 recovery_interval; | ||
| 764 | struct ieee80211_channel_map channel_map[0]; | ||
| 765 | }; | ||
| 766 | |||
| 767 | struct ieee80211_csa { | ||
| 768 | u8 mode; | ||
| 769 | u8 channel; | ||
| 770 | u8 count; | ||
| 771 | } __attribute__ ((packed)); | ||
| 772 | |||
| 773 | struct ieee80211_quiet { | ||
| 774 | u8 count; | ||
| 775 | u8 period; | ||
| 776 | u8 duration; | ||
| 777 | u8 offset; | ||
| 778 | } __attribute__ ((packed)); | ||
| 779 | |||
| 780 | struct ieee80211_network { | ||
| 781 | /* These entries are used to identify a unique network */ | ||
| 782 | u8 bssid[ETH_ALEN]; | ||
| 783 | u8 channel; | ||
| 784 | /* Ensure null-terminated for any debug msgs */ | ||
| 785 | u8 ssid[IW_ESSID_MAX_SIZE + 1]; | ||
| 786 | u8 ssid_len; | ||
| 787 | |||
| 788 | struct ieee80211_qos_data qos_data; | ||
| 789 | |||
| 790 | /* These are network statistics */ | ||
| 791 | struct ieee80211_rx_stats stats; | ||
| 792 | u16 capability; | ||
| 793 | u8 rates[MAX_RATES_LENGTH]; | ||
| 794 | u8 rates_len; | ||
| 795 | u8 rates_ex[MAX_RATES_EX_LENGTH]; | ||
| 796 | u8 rates_ex_len; | ||
| 797 | unsigned long last_scanned; | ||
| 798 | u8 mode; | ||
| 799 | u32 flags; | ||
| 800 | u32 last_associate; | ||
| 801 | u32 time_stamp[2]; | ||
| 802 | u16 beacon_interval; | ||
| 803 | u16 listen_interval; | ||
| 804 | u16 atim_window; | ||
| 805 | u8 erp_value; | ||
| 806 | u8 wpa_ie[MAX_WPA_IE_LEN]; | ||
| 807 | size_t wpa_ie_len; | ||
| 808 | u8 rsn_ie[MAX_WPA_IE_LEN]; | ||
| 809 | size_t rsn_ie_len; | ||
| 810 | struct ieee80211_tim_parameters tim; | ||
| 811 | |||
| 812 | /* 802.11h info */ | ||
| 813 | |||
| 814 | /* Power Constraint - mandatory if spctrm mgmt required */ | ||
| 815 | u8 power_constraint; | ||
| 816 | |||
| 817 | /* TPC Report - mandatory if spctrm mgmt required */ | ||
| 818 | struct ieee80211_tpc_report tpc_report; | ||
| 819 | |||
| 820 | /* IBSS DFS - mandatory if spctrm mgmt required and IBSS | ||
| 821 | * NOTE: This is variable length and so must be allocated dynamically */ | ||
| 822 | struct ieee80211_ibss_dfs *ibss_dfs; | ||
| 823 | |||
| 824 | /* Channel Switch Announcement - optional if spctrm mgmt required */ | ||
| 825 | struct ieee80211_csa csa; | ||
| 826 | |||
| 827 | /* Quiet - optional if spctrm mgmt required */ | ||
| 828 | struct ieee80211_quiet quiet; | ||
| 829 | |||
| 830 | struct list_head list; | ||
| 831 | }; | ||
| 832 | |||
| 833 | enum ieee80211_state { | ||
| 834 | IEEE80211_UNINITIALIZED = 0, | ||
| 835 | IEEE80211_INITIALIZED, | ||
| 836 | IEEE80211_ASSOCIATING, | ||
| 837 | IEEE80211_ASSOCIATED, | ||
| 838 | IEEE80211_AUTHENTICATING, | ||
| 839 | IEEE80211_AUTHENTICATED, | ||
| 840 | IEEE80211_SHUTDOWN | ||
| 841 | }; | ||
| 842 | |||
| 843 | #define DEFAULT_MAX_SCAN_AGE (15 * HZ) | ||
| 844 | #define DEFAULT_FTS 2346 | ||
| 845 | |||
| 846 | #define CFG_IEEE80211_RESERVE_FCS (1<<0) | ||
| 847 | #define CFG_IEEE80211_COMPUTE_FCS (1<<1) | ||
| 848 | #define CFG_IEEE80211_RTS (1<<2) | ||
| 849 | |||
| 850 | #define IEEE80211_24GHZ_MIN_CHANNEL 1 | ||
| 851 | #define IEEE80211_24GHZ_MAX_CHANNEL 14 | ||
| 852 | #define IEEE80211_24GHZ_CHANNELS (IEEE80211_24GHZ_MAX_CHANNEL - \ | ||
| 853 | IEEE80211_24GHZ_MIN_CHANNEL + 1) | ||
| 854 | |||
| 855 | #define IEEE80211_52GHZ_MIN_CHANNEL 34 | ||
| 856 | #define IEEE80211_52GHZ_MAX_CHANNEL 165 | ||
| 857 | #define IEEE80211_52GHZ_CHANNELS (IEEE80211_52GHZ_MAX_CHANNEL - \ | ||
| 858 | IEEE80211_52GHZ_MIN_CHANNEL + 1) | ||
| 859 | |||
| 860 | enum { | ||
| 861 | IEEE80211_CH_PASSIVE_ONLY = (1 << 0), | ||
| 862 | IEEE80211_CH_80211H_RULES = (1 << 1), | ||
| 863 | IEEE80211_CH_B_ONLY = (1 << 2), | ||
| 864 | IEEE80211_CH_NO_IBSS = (1 << 3), | ||
| 865 | IEEE80211_CH_UNIFORM_SPREADING = (1 << 4), | ||
| 866 | IEEE80211_CH_RADAR_DETECT = (1 << 5), | ||
| 867 | IEEE80211_CH_INVALID = (1 << 6), | ||
| 868 | }; | ||
| 869 | |||
| 870 | struct ieee80211_channel { | ||
| 871 | u32 freq; /* in MHz */ | ||
| 872 | u8 channel; | ||
| 873 | u8 flags; | ||
| 874 | u8 max_power; /* in dBm */ | ||
| 875 | }; | ||
| 876 | |||
| 877 | struct ieee80211_geo { | ||
| 878 | u8 name[4]; | ||
| 879 | u8 bg_channels; | ||
| 880 | u8 a_channels; | ||
| 881 | struct ieee80211_channel bg[IEEE80211_24GHZ_CHANNELS]; | ||
| 882 | struct ieee80211_channel a[IEEE80211_52GHZ_CHANNELS]; | ||
| 883 | }; | ||
| 884 | |||
| 885 | struct ieee80211_device { | ||
| 886 | struct net_device *dev; | ||
| 887 | struct ieee80211_security sec; | ||
| 888 | |||
| 889 | /* Bookkeeping structures */ | ||
| 890 | struct net_device_stats stats; | ||
| 891 | struct ieee80211_stats ieee_stats; | ||
| 892 | |||
| 893 | struct ieee80211_geo geo; | ||
| 894 | |||
| 895 | /* Probe / Beacon management */ | ||
| 896 | struct list_head network_free_list; | ||
| 897 | struct list_head network_list; | ||
| 898 | struct ieee80211_network *networks; | ||
| 899 | int scans; | ||
| 900 | int scan_age; | ||
| 901 | |||
| 902 | int iw_mode; /* operating mode (IW_MODE_*) */ | ||
| 903 | struct iw_spy_data spy_data; /* iwspy support */ | ||
| 904 | |||
| 905 | spinlock_t lock; | ||
| 906 | |||
| 907 | int tx_headroom; /* Set to size of any additional room needed at front | ||
| 908 | * of allocated Tx SKBs */ | ||
| 909 | u32 config; | ||
| 910 | |||
| 911 | /* WEP and other encryption related settings at the device level */ | ||
| 912 | int open_wep; /* Set to 1 to allow unencrypted frames */ | ||
| 913 | |||
| 914 | int reset_on_keychange; /* Set to 1 if the HW needs to be reset on | ||
| 915 | * WEP key changes */ | ||
| 916 | |||
| 917 | /* If the host performs {en,de}cryption, then set to 1 */ | ||
| 918 | int host_encrypt; | ||
| 919 | int host_encrypt_msdu; | ||
| 920 | int host_decrypt; | ||
| 921 | /* host performs multicast decryption */ | ||
| 922 | int host_mc_decrypt; | ||
| 923 | |||
| 924 | /* host should strip IV and ICV from protected frames */ | ||
| 925 | /* meaningful only when hardware decryption is being used */ | ||
| 926 | int host_strip_iv_icv; | ||
| 927 | |||
| 928 | int host_open_frag; | ||
| 929 | int host_build_iv; | ||
| 930 | int ieee802_1x; /* is IEEE 802.1X used */ | ||
| 931 | |||
| 932 | /* WPA data */ | ||
| 933 | int wpa_enabled; | ||
| 934 | int drop_unencrypted; | ||
| 935 | int privacy_invoked; | ||
| 936 | size_t wpa_ie_len; | ||
| 937 | u8 *wpa_ie; | ||
| 938 | |||
| 939 | struct lib80211_crypt_info crypt_info; | ||
| 940 | |||
| 941 | int bcrx_sta_key; /* use individual keys to override default keys even | ||
| 942 | * with RX of broad/multicast frames */ | ||
| 943 | |||
| 944 | /* Fragmentation structures */ | ||
| 945 | struct ieee80211_frag_entry frag_cache[IEEE80211_FRAG_CACHE_LEN]; | ||
| 946 | unsigned int frag_next_idx; | ||
| 947 | u16 fts; /* Fragmentation Threshold */ | ||
| 948 | u16 rts; /* RTS threshold */ | ||
| 949 | |||
| 950 | /* Association info */ | ||
| 951 | u8 bssid[ETH_ALEN]; | ||
| 952 | |||
| 953 | enum ieee80211_state state; | ||
| 954 | |||
| 955 | int mode; /* A, B, G */ | ||
| 956 | int modulation; /* CCK, OFDM */ | ||
| 957 | int freq_band; /* 2.4Ghz, 5.2Ghz, Mixed */ | ||
| 958 | int abg_true; /* ABG flag */ | ||
| 959 | |||
| 960 | int perfect_rssi; | ||
| 961 | int worst_rssi; | ||
| 962 | |||
| 963 | u16 prev_seq_ctl; /* used to drop duplicate frames */ | ||
| 964 | |||
| 965 | /* Callback functions */ | ||
| 966 | void (*set_security) (struct net_device * dev, | ||
| 967 | struct ieee80211_security * sec); | ||
| 968 | int (*hard_start_xmit) (struct ieee80211_txb * txb, | ||
| 969 | struct net_device * dev, int pri); | ||
| 970 | int (*reset_port) (struct net_device * dev); | ||
| 971 | int (*is_queue_full) (struct net_device * dev, int pri); | ||
| 972 | |||
| 973 | int (*handle_management) (struct net_device * dev, | ||
| 974 | struct ieee80211_network * network, u16 type); | ||
| 975 | int (*is_qos_active) (struct net_device *dev, struct sk_buff *skb); | ||
| 976 | |||
| 977 | /* Typical STA methods */ | ||
| 978 | int (*handle_auth) (struct net_device * dev, | ||
| 979 | struct ieee80211_auth * auth); | ||
| 980 | int (*handle_deauth) (struct net_device * dev, | ||
| 981 | struct ieee80211_deauth * auth); | ||
| 982 | int (*handle_action) (struct net_device * dev, | ||
| 983 | struct ieee80211_action * action, | ||
| 984 | struct ieee80211_rx_stats * stats); | ||
| 985 | int (*handle_disassoc) (struct net_device * dev, | ||
| 986 | struct ieee80211_disassoc * assoc); | ||
| 987 | int (*handle_beacon) (struct net_device * dev, | ||
| 988 | struct ieee80211_beacon * beacon, | ||
| 989 | struct ieee80211_network * network); | ||
| 990 | int (*handle_probe_response) (struct net_device * dev, | ||
| 991 | struct ieee80211_probe_response * resp, | ||
| 992 | struct ieee80211_network * network); | ||
| 993 | int (*handle_probe_request) (struct net_device * dev, | ||
| 994 | struct ieee80211_probe_request * req, | ||
| 995 | struct ieee80211_rx_stats * stats); | ||
| 996 | int (*handle_assoc_response) (struct net_device * dev, | ||
| 997 | struct ieee80211_assoc_response * resp, | ||
| 998 | struct ieee80211_network * network); | ||
| 999 | |||
| 1000 | /* Typical AP methods */ | ||
| 1001 | int (*handle_assoc_request) (struct net_device * dev); | ||
| 1002 | int (*handle_reassoc_request) (struct net_device * dev, | ||
| 1003 | struct ieee80211_reassoc_request * req); | ||
| 1004 | |||
| 1005 | /* This must be the last item so that it points to the data | ||
| 1006 | * allocated beyond this structure by alloc_ieee80211 */ | ||
| 1007 | u8 priv[0]; | ||
| 1008 | }; | ||
| 1009 | |||
| 1010 | #define IEEE_A (1<<0) | ||
| 1011 | #define IEEE_B (1<<1) | ||
| 1012 | #define IEEE_G (1<<2) | ||
| 1013 | #define IEEE_MODE_MASK (IEEE_A|IEEE_B|IEEE_G) | ||
| 1014 | |||
| 1015 | static inline void *ieee80211_priv(struct net_device *dev) | ||
| 1016 | { | ||
| 1017 | return ((struct ieee80211_device *)netdev_priv(dev))->priv; | ||
| 1018 | } | ||
| 1019 | |||
| 1020 | static inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, | ||
| 1021 | int mode) | ||
| 1022 | { | ||
| 1023 | /* | ||
| 1024 | * It is possible for both access points and our device to support | ||
| 1025 | * combinations of modes, so as long as there is one valid combination | ||
| 1026 | * of ap/device supported modes, then return success | ||
| 1027 | * | ||
| 1028 | */ | ||
| 1029 | if ((mode & IEEE_A) && | ||
| 1030 | (ieee->modulation & IEEE80211_OFDM_MODULATION) && | ||
| 1031 | (ieee->freq_band & IEEE80211_52GHZ_BAND)) | ||
| 1032 | return 1; | ||
| 1033 | |||
| 1034 | if ((mode & IEEE_G) && | ||
| 1035 | (ieee->modulation & IEEE80211_OFDM_MODULATION) && | ||
| 1036 | (ieee->freq_band & IEEE80211_24GHZ_BAND)) | ||
| 1037 | return 1; | ||
| 1038 | |||
| 1039 | if ((mode & IEEE_B) && | ||
| 1040 | (ieee->modulation & IEEE80211_CCK_MODULATION) && | ||
| 1041 | (ieee->freq_band & IEEE80211_24GHZ_BAND)) | ||
| 1042 | return 1; | ||
| 1043 | |||
| 1044 | return 0; | ||
| 1045 | } | ||
| 1046 | |||
| 1047 | static inline int ieee80211_get_hdrlen(u16 fc) | ||
| 1048 | { | ||
| 1049 | int hdrlen = IEEE80211_3ADDR_LEN; | ||
| 1050 | u16 stype = WLAN_FC_GET_STYPE(fc); | ||
| 1051 | |||
| 1052 | switch (WLAN_FC_GET_TYPE(fc)) { | ||
| 1053 | case IEEE80211_FTYPE_DATA: | ||
| 1054 | if ((fc & IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS)) | ||
| 1055 | hdrlen = IEEE80211_4ADDR_LEN; | ||
| 1056 | if (stype & IEEE80211_STYPE_QOS_DATA) | ||
| 1057 | hdrlen += 2; | ||
| 1058 | break; | ||
| 1059 | case IEEE80211_FTYPE_CTL: | ||
| 1060 | switch (WLAN_FC_GET_STYPE(fc)) { | ||
| 1061 | case IEEE80211_STYPE_CTS: | ||
| 1062 | case IEEE80211_STYPE_ACK: | ||
| 1063 | hdrlen = IEEE80211_1ADDR_LEN; | ||
| 1064 | break; | ||
| 1065 | default: | ||
| 1066 | hdrlen = IEEE80211_2ADDR_LEN; | ||
| 1067 | break; | ||
| 1068 | } | ||
| 1069 | break; | ||
| 1070 | } | ||
| 1071 | |||
| 1072 | return hdrlen; | ||
| 1073 | } | ||
| 1074 | |||
| 1075 | static inline u8 *ieee80211_get_payload(struct ieee80211_hdr *hdr) | ||
| 1076 | { | ||
| 1077 | switch (ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_control))) { | ||
| 1078 | case IEEE80211_1ADDR_LEN: | ||
| 1079 | return ((struct ieee80211_hdr_1addr *)hdr)->payload; | ||
| 1080 | case IEEE80211_2ADDR_LEN: | ||
| 1081 | return ((struct ieee80211_hdr_2addr *)hdr)->payload; | ||
| 1082 | case IEEE80211_3ADDR_LEN: | ||
| 1083 | return ((struct ieee80211_hdr_3addr *)hdr)->payload; | ||
| 1084 | case IEEE80211_4ADDR_LEN: | ||
| 1085 | return ((struct ieee80211_hdr_4addr *)hdr)->payload; | ||
| 1086 | } | ||
| 1087 | return NULL; | ||
| 1088 | } | ||
| 1089 | |||
| 1090 | static inline int ieee80211_is_ofdm_rate(u8 rate) | ||
| 1091 | { | ||
| 1092 | switch (rate & ~IEEE80211_BASIC_RATE_MASK) { | ||
| 1093 | case IEEE80211_OFDM_RATE_6MB: | ||
| 1094 | case IEEE80211_OFDM_RATE_9MB: | ||
| 1095 | case IEEE80211_OFDM_RATE_12MB: | ||
| 1096 | case IEEE80211_OFDM_RATE_18MB: | ||
| 1097 | case IEEE80211_OFDM_RATE_24MB: | ||
| 1098 | case IEEE80211_OFDM_RATE_36MB: | ||
| 1099 | case IEEE80211_OFDM_RATE_48MB: | ||
| 1100 | case IEEE80211_OFDM_RATE_54MB: | ||
| 1101 | return 1; | ||
| 1102 | } | ||
| 1103 | return 0; | ||
| 1104 | } | ||
| 1105 | |||
| 1106 | static inline int ieee80211_is_cck_rate(u8 rate) | ||
| 1107 | { | ||
| 1108 | switch (rate & ~IEEE80211_BASIC_RATE_MASK) { | ||
| 1109 | case IEEE80211_CCK_RATE_1MB: | ||
| 1110 | case IEEE80211_CCK_RATE_2MB: | ||
| 1111 | case IEEE80211_CCK_RATE_5MB: | ||
| 1112 | case IEEE80211_CCK_RATE_11MB: | ||
| 1113 | return 1; | ||
| 1114 | } | ||
| 1115 | return 0; | ||
| 1116 | } | ||
| 1117 | |||
| 1118 | /* ieee80211.c */ | ||
| 1119 | extern void free_ieee80211(struct net_device *dev); | ||
| 1120 | extern struct net_device *alloc_ieee80211(int sizeof_priv); | ||
| 1121 | |||
| 1122 | extern int ieee80211_set_encryption(struct ieee80211_device *ieee); | ||
| 1123 | |||
| 1124 | /* ieee80211_tx.c */ | ||
| 1125 | extern int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev); | ||
| 1126 | extern void ieee80211_txb_free(struct ieee80211_txb *); | ||
| 1127 | |||
| 1128 | /* ieee80211_rx.c */ | ||
| 1129 | extern void ieee80211_rx_any(struct ieee80211_device *ieee, | ||
| 1130 | struct sk_buff *skb, struct ieee80211_rx_stats *stats); | ||
| 1131 | extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | ||
| 1132 | struct ieee80211_rx_stats *rx_stats); | ||
| 1133 | /* make sure to set stats->len */ | ||
| 1134 | extern void ieee80211_rx_mgt(struct ieee80211_device *ieee, | ||
| 1135 | struct ieee80211_hdr_4addr *header, | ||
| 1136 | struct ieee80211_rx_stats *stats); | ||
| 1137 | extern void ieee80211_network_reset(struct ieee80211_network *network); | ||
| 1138 | |||
| 1139 | /* ieee80211_geo.c */ | ||
| 1140 | extern const struct ieee80211_geo *ieee80211_get_geo(struct ieee80211_device | ||
| 1141 | *ieee); | ||
| 1142 | extern int ieee80211_set_geo(struct ieee80211_device *ieee, | ||
| 1143 | const struct ieee80211_geo *geo); | ||
| 1144 | |||
| 1145 | extern int ieee80211_is_valid_channel(struct ieee80211_device *ieee, | ||
| 1146 | u8 channel); | ||
| 1147 | extern int ieee80211_channel_to_index(struct ieee80211_device *ieee, | ||
| 1148 | u8 channel); | ||
| 1149 | extern u8 ieee80211_freq_to_channel(struct ieee80211_device *ieee, u32 freq); | ||
| 1150 | extern u8 ieee80211_get_channel_flags(struct ieee80211_device *ieee, | ||
| 1151 | u8 channel); | ||
| 1152 | extern const struct ieee80211_channel *ieee80211_get_channel(struct | ||
| 1153 | ieee80211_device | ||
| 1154 | *ieee, u8 channel); | ||
| 1155 | extern u32 ieee80211_channel_to_freq(struct ieee80211_device * ieee, | ||
| 1156 | u8 channel); | ||
| 1157 | |||
| 1158 | /* ieee80211_wx.c */ | ||
| 1159 | extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee, | ||
| 1160 | struct iw_request_info *info, | ||
| 1161 | union iwreq_data *wrqu, char *key); | ||
| 1162 | extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee, | ||
| 1163 | struct iw_request_info *info, | ||
| 1164 | union iwreq_data *wrqu, char *key); | ||
| 1165 | extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee, | ||
| 1166 | struct iw_request_info *info, | ||
| 1167 | union iwreq_data *wrqu, char *key); | ||
| 1168 | extern int ieee80211_wx_set_encodeext(struct ieee80211_device *ieee, | ||
| 1169 | struct iw_request_info *info, | ||
| 1170 | union iwreq_data *wrqu, char *extra); | ||
| 1171 | extern int ieee80211_wx_get_encodeext(struct ieee80211_device *ieee, | ||
| 1172 | struct iw_request_info *info, | ||
| 1173 | union iwreq_data *wrqu, char *extra); | ||
| 1174 | |||
| 1175 | static inline void ieee80211_increment_scans(struct ieee80211_device *ieee) | ||
| 1176 | { | ||
| 1177 | ieee->scans++; | ||
| 1178 | } | ||
| 1179 | |||
| 1180 | static inline int ieee80211_get_scans(struct ieee80211_device *ieee) | ||
| 1181 | { | ||
| 1182 | return ieee->scans; | ||
| 1183 | } | ||
| 1184 | |||
| 1185 | #endif /* IEEE80211_H */ | ||
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 88fa3e03e3e9..12a52efcd0d1 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
| @@ -1022,11 +1022,6 @@ static inline int ieee80211_num_regular_queues(struct ieee80211_hw *hw) | |||
| 1022 | return hw->queues; | 1022 | return hw->queues; |
| 1023 | } | 1023 | } |
| 1024 | 1024 | ||
| 1025 | static inline int ieee80211_num_queues(struct ieee80211_hw *hw) | ||
| 1026 | { | ||
| 1027 | return hw->queues + hw->ampdu_queues; | ||
| 1028 | } | ||
| 1029 | |||
| 1030 | static inline struct ieee80211_rate * | 1025 | static inline struct ieee80211_rate * |
| 1031 | ieee80211_get_tx_rate(const struct ieee80211_hw *hw, | 1026 | ieee80211_get_tx_rate(const struct ieee80211_hw *hw, |
| 1032 | const struct ieee80211_tx_info *c) | 1027 | const struct ieee80211_tx_info *c) |
| @@ -1329,6 +1324,12 @@ enum ieee80211_ampdu_mlme_action { | |||
| 1329 | * because the hardware is turned off! Anything else is a bug! | 1324 | * because the hardware is turned off! Anything else is a bug! |
| 1330 | * Returns a negative error code which will be seen in userspace. | 1325 | * Returns a negative error code which will be seen in userspace. |
| 1331 | * | 1326 | * |
| 1327 | * @sw_scan_start: Notifier function that is called just before a software scan | ||
| 1328 | * is started. Can be NULL, if the driver doesn't need this notification. | ||
| 1329 | * | ||
| 1330 | * @sw_scan_complete: Notifier function that is called just after a software scan | ||
| 1331 | * finished. Can be NULL, if the driver doesn't need this notification. | ||
| 1332 | * | ||
| 1332 | * @get_stats: Return low-level statistics. | 1333 | * @get_stats: Return low-level statistics. |
| 1333 | * Returns zero if statistics are available. | 1334 | * Returns zero if statistics are available. |
| 1334 | * | 1335 | * |
| @@ -1408,6 +1409,8 @@ struct ieee80211_ops { | |||
| 1408 | u32 iv32, u16 *phase1key); | 1409 | u32 iv32, u16 *phase1key); |
| 1409 | int (*hw_scan)(struct ieee80211_hw *hw, | 1410 | int (*hw_scan)(struct ieee80211_hw *hw, |
| 1410 | struct cfg80211_scan_request *req); | 1411 | struct cfg80211_scan_request *req); |
| 1412 | void (*sw_scan_start)(struct ieee80211_hw *hw); | ||
| 1413 | void (*sw_scan_complete)(struct ieee80211_hw *hw); | ||
| 1411 | int (*get_stats)(struct ieee80211_hw *hw, | 1414 | int (*get_stats)(struct ieee80211_hw *hw, |
| 1412 | struct ieee80211_low_level_stats *stats); | 1415 | struct ieee80211_low_level_stats *stats); |
| 1413 | void (*get_tkip_seq)(struct ieee80211_hw *hw, u8 hw_key_idx, | 1416 | void (*get_tkip_seq)(struct ieee80211_hw *hw, u8 hw_key_idx, |
| @@ -1980,6 +1983,16 @@ struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_hw *hw, | |||
| 1980 | /* Rate control API */ | 1983 | /* Rate control API */ |
| 1981 | 1984 | ||
| 1982 | /** | 1985 | /** |
| 1986 | * enum rate_control_changed - flags to indicate which parameter changed | ||
| 1987 | * | ||
| 1988 | * @IEEE80211_RC_HT_CHANGED: The HT parameters of the operating channel have | ||
| 1989 | * changed, rate control algorithm can update its internal state if needed. | ||
| 1990 | */ | ||
| 1991 | enum rate_control_changed { | ||
| 1992 | IEEE80211_RC_HT_CHANGED = BIT(0) | ||
| 1993 | }; | ||
| 1994 | |||
| 1995 | /** | ||
| 1983 | * struct ieee80211_tx_rate_control - rate control information for/from RC algo | 1996 | * struct ieee80211_tx_rate_control - rate control information for/from RC algo |
| 1984 | * | 1997 | * |
| 1985 | * @hw: The hardware the algorithm is invoked for. | 1998 | * @hw: The hardware the algorithm is invoked for. |
| @@ -2015,6 +2028,9 @@ struct rate_control_ops { | |||
| 2015 | void *(*alloc_sta)(void *priv, struct ieee80211_sta *sta, gfp_t gfp); | 2028 | void *(*alloc_sta)(void *priv, struct ieee80211_sta *sta, gfp_t gfp); |
| 2016 | void (*rate_init)(void *priv, struct ieee80211_supported_band *sband, | 2029 | void (*rate_init)(void *priv, struct ieee80211_supported_band *sband, |
| 2017 | struct ieee80211_sta *sta, void *priv_sta); | 2030 | struct ieee80211_sta *sta, void *priv_sta); |
| 2031 | void (*rate_update)(void *priv, struct ieee80211_supported_band *sband, | ||
| 2032 | struct ieee80211_sta *sta, | ||
| 2033 | void *priv_sta, u32 changed); | ||
| 2018 | void (*free_sta)(void *priv, struct ieee80211_sta *sta, | 2034 | void (*free_sta)(void *priv, struct ieee80211_sta *sta, |
| 2019 | void *priv_sta); | 2035 | void *priv_sta); |
| 2020 | 2036 | ||
diff --git a/include/net/wireless.h b/include/net/wireless.h index 1c6285eb1666..64a76208580c 100644 --- a/include/net/wireless.h +++ b/include/net/wireless.h | |||
| @@ -69,6 +69,9 @@ enum ieee80211_channel_flags { | |||
| 69 | * @band: band this channel belongs to. | 69 | * @band: band this channel belongs to. |
| 70 | * @max_antenna_gain: maximum antenna gain in dBi | 70 | * @max_antenna_gain: maximum antenna gain in dBi |
| 71 | * @max_power: maximum transmission power (in dBm) | 71 | * @max_power: maximum transmission power (in dBm) |
| 72 | * @beacon_found: helper to regulatory code to indicate when a beacon | ||
| 73 | * has been found on this channel. Use regulatory_hint_found_beacon() | ||
| 74 | * to enable this, this is is useful only on 5 GHz band. | ||
| 72 | * @orig_mag: internal use | 75 | * @orig_mag: internal use |
| 73 | * @orig_mpwr: internal use | 76 | * @orig_mpwr: internal use |
| 74 | */ | 77 | */ |
| @@ -80,6 +83,7 @@ struct ieee80211_channel { | |||
| 80 | u32 flags; | 83 | u32 flags; |
| 81 | int max_antenna_gain; | 84 | int max_antenna_gain; |
| 82 | int max_power; | 85 | int max_power; |
| 86 | bool beacon_found; | ||
| 83 | u32 orig_flags; | 87 | u32 orig_flags; |
| 84 | int orig_mag, orig_mpwr; | 88 | int orig_mag, orig_mpwr; |
| 85 | }; | 89 | }; |
| @@ -200,6 +204,7 @@ struct ieee80211_supported_band { | |||
| 200 | * the regulatory_hint() API. This can be used by the driver | 204 | * the regulatory_hint() API. This can be used by the driver |
| 201 | * on the reg_notifier() if it chooses to ignore future | 205 | * on the reg_notifier() if it chooses to ignore future |
| 202 | * regulatory domain changes caused by other drivers. | 206 | * regulatory domain changes caused by other drivers. |
| 207 | * @signal_type: signal type reported in &struct cfg80211_bss. | ||
| 203 | */ | 208 | */ |
| 204 | struct wiphy { | 209 | struct wiphy { |
| 205 | /* assign these fields before you register the wiphy */ | 210 | /* assign these fields before you register the wiphy */ |
| @@ -213,6 +218,8 @@ struct wiphy { | |||
| 213 | bool custom_regulatory; | 218 | bool custom_regulatory; |
| 214 | bool strict_regulatory; | 219 | bool strict_regulatory; |
| 215 | 220 | ||
| 221 | enum cfg80211_signal_type signal_type; | ||
| 222 | |||
| 216 | int bss_priv_size; | 223 | int bss_priv_size; |
| 217 | u8 max_scan_ssids; | 224 | u8 max_scan_ssids; |
| 218 | 225 | ||
| @@ -398,8 +405,15 @@ ieee80211_get_response_rate(struct ieee80211_supported_band *sband, | |||
| 398 | * domain should be in or by providing a completely build regulatory domain. | 405 | * domain should be in or by providing a completely build regulatory domain. |
| 399 | * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried | 406 | * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried |
| 400 | * for a regulatory domain structure for the respective country. | 407 | * for a regulatory domain structure for the respective country. |
| 408 | * | ||
| 409 | * The wiphy must have been registered to cfg80211 prior to this call. | ||
| 410 | * For cfg80211 drivers this means you must first use wiphy_register(), | ||
| 411 | * for mac80211 drivers you must first use ieee80211_register_hw(). | ||
| 412 | * | ||
| 413 | * Drivers should check the return value, its possible you can get | ||
| 414 | * an -ENOMEM. | ||
| 401 | */ | 415 | */ |
| 402 | extern void regulatory_hint(struct wiphy *wiphy, const char *alpha2); | 416 | extern int regulatory_hint(struct wiphy *wiphy, const char *alpha2); |
| 403 | 417 | ||
| 404 | /** | 418 | /** |
| 405 | * regulatory_hint_11d - hints a country IE as a regulatory domain | 419 | * regulatory_hint_11d - hints a country IE as a regulatory domain |
| @@ -415,7 +429,6 @@ extern void regulatory_hint(struct wiphy *wiphy, const char *alpha2); | |||
| 415 | extern void regulatory_hint_11d(struct wiphy *wiphy, | 429 | extern void regulatory_hint_11d(struct wiphy *wiphy, |
| 416 | u8 *country_ie, | 430 | u8 *country_ie, |
| 417 | u8 country_ie_len); | 431 | u8 country_ie_len); |
| 418 | |||
| 419 | /** | 432 | /** |
| 420 | * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain | 433 | * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain |
| 421 | * @wiphy: the wireless device we want to process the regulatory domain on | 434 | * @wiphy: the wireless device we want to process the regulatory domain on |
