Kalle Valo | 2f01a1f | 2009-04-29 23:33:31 +0300 | [diff] [blame] | 1 | #ifndef __WL12XX_80211_H__ |
| 2 | #define __WL12XX_80211_H__ |
| 3 | |
| 4 | #include <linux/if_ether.h> /* ETH_ALEN */ |
Eliad Peller | c531277 | 2010-12-09 11:31:27 +0200 | [diff] [blame] | 5 | #include <linux/if_arp.h> |
Kalle Valo | 2f01a1f | 2009-04-29 23:33:31 +0300 | [diff] [blame] | 6 | |
| 7 | /* RATES */ |
| 8 | #define IEEE80211_CCK_RATE_1MB 0x02 |
| 9 | #define IEEE80211_CCK_RATE_2MB 0x04 |
| 10 | #define IEEE80211_CCK_RATE_5MB 0x0B |
| 11 | #define IEEE80211_CCK_RATE_11MB 0x16 |
| 12 | #define IEEE80211_OFDM_RATE_6MB 0x0C |
| 13 | #define IEEE80211_OFDM_RATE_9MB 0x12 |
| 14 | #define IEEE80211_OFDM_RATE_12MB 0x18 |
| 15 | #define IEEE80211_OFDM_RATE_18MB 0x24 |
| 16 | #define IEEE80211_OFDM_RATE_24MB 0x30 |
| 17 | #define IEEE80211_OFDM_RATE_36MB 0x48 |
| 18 | #define IEEE80211_OFDM_RATE_48MB 0x60 |
| 19 | #define IEEE80211_OFDM_RATE_54MB 0x6C |
| 20 | #define IEEE80211_BASIC_RATE_MASK 0x80 |
| 21 | |
| 22 | #define IEEE80211_CCK_RATE_1MB_MASK (1<<0) |
| 23 | #define IEEE80211_CCK_RATE_2MB_MASK (1<<1) |
| 24 | #define IEEE80211_CCK_RATE_5MB_MASK (1<<2) |
| 25 | #define IEEE80211_CCK_RATE_11MB_MASK (1<<3) |
| 26 | #define IEEE80211_OFDM_RATE_6MB_MASK (1<<4) |
| 27 | #define IEEE80211_OFDM_RATE_9MB_MASK (1<<5) |
| 28 | #define IEEE80211_OFDM_RATE_12MB_MASK (1<<6) |
| 29 | #define IEEE80211_OFDM_RATE_18MB_MASK (1<<7) |
| 30 | #define IEEE80211_OFDM_RATE_24MB_MASK (1<<8) |
| 31 | #define IEEE80211_OFDM_RATE_36MB_MASK (1<<9) |
| 32 | #define IEEE80211_OFDM_RATE_48MB_MASK (1<<10) |
| 33 | #define IEEE80211_OFDM_RATE_54MB_MASK (1<<11) |
| 34 | |
| 35 | #define IEEE80211_CCK_RATES_MASK 0x0000000F |
| 36 | #define IEEE80211_CCK_BASIC_RATES_MASK (IEEE80211_CCK_RATE_1MB_MASK | \ |
| 37 | IEEE80211_CCK_RATE_2MB_MASK) |
| 38 | #define IEEE80211_CCK_DEFAULT_RATES_MASK (IEEE80211_CCK_BASIC_RATES_MASK | \ |
| 39 | IEEE80211_CCK_RATE_5MB_MASK | \ |
| 40 | IEEE80211_CCK_RATE_11MB_MASK) |
| 41 | |
| 42 | #define IEEE80211_OFDM_RATES_MASK 0x00000FF0 |
| 43 | #define IEEE80211_OFDM_BASIC_RATES_MASK (IEEE80211_OFDM_RATE_6MB_MASK | \ |
| 44 | IEEE80211_OFDM_RATE_12MB_MASK | \ |
| 45 | IEEE80211_OFDM_RATE_24MB_MASK) |
| 46 | #define IEEE80211_OFDM_DEFAULT_RATES_MASK (IEEE80211_OFDM_BASIC_RATES_MASK | \ |
| 47 | IEEE80211_OFDM_RATE_9MB_MASK | \ |
| 48 | IEEE80211_OFDM_RATE_18MB_MASK | \ |
| 49 | IEEE80211_OFDM_RATE_36MB_MASK | \ |
| 50 | IEEE80211_OFDM_RATE_48MB_MASK | \ |
| 51 | IEEE80211_OFDM_RATE_54MB_MASK) |
| 52 | #define IEEE80211_DEFAULT_RATES_MASK (IEEE80211_OFDM_DEFAULT_RATES_MASK | \ |
| 53 | IEEE80211_CCK_DEFAULT_RATES_MASK) |
| 54 | |
| 55 | |
| 56 | /* This really should be 8, but not for our firmware */ |
| 57 | #define MAX_SUPPORTED_RATES 32 |
Kalle Valo | 2f01a1f | 2009-04-29 23:33:31 +0300 | [diff] [blame] | 58 | #define MAX_COUNTRY_TRIPLETS 32 |
| 59 | |
| 60 | /* Headers */ |
| 61 | struct ieee80211_header { |
| 62 | __le16 frame_ctl; |
| 63 | __le16 duration_id; |
| 64 | u8 da[ETH_ALEN]; |
| 65 | u8 sa[ETH_ALEN]; |
| 66 | u8 bssid[ETH_ALEN]; |
| 67 | __le16 seq_ctl; |
| 68 | u8 payload[0]; |
Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 69 | } __packed; |
Kalle Valo | 2f01a1f | 2009-04-29 23:33:31 +0300 | [diff] [blame] | 70 | |
| 71 | struct wl12xx_ie_header { |
| 72 | u8 id; |
| 73 | u8 len; |
Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 74 | } __packed; |
Kalle Valo | 2f01a1f | 2009-04-29 23:33:31 +0300 | [diff] [blame] | 75 | |
| 76 | /* IEs */ |
| 77 | |
| 78 | struct wl12xx_ie_ssid { |
| 79 | struct wl12xx_ie_header header; |
| 80 | char ssid[IW_ESSID_MAX_SIZE]; |
Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 81 | } __packed; |
Kalle Valo | 2f01a1f | 2009-04-29 23:33:31 +0300 | [diff] [blame] | 82 | |
| 83 | struct wl12xx_ie_rates { |
| 84 | struct wl12xx_ie_header header; |
| 85 | u8 rates[MAX_SUPPORTED_RATES]; |
Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 86 | } __packed; |
Kalle Valo | 2f01a1f | 2009-04-29 23:33:31 +0300 | [diff] [blame] | 87 | |
| 88 | struct wl12xx_ie_ds_params { |
| 89 | struct wl12xx_ie_header header; |
| 90 | u8 channel; |
Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 91 | } __packed; |
Kalle Valo | 2f01a1f | 2009-04-29 23:33:31 +0300 | [diff] [blame] | 92 | |
| 93 | struct country_triplet { |
| 94 | u8 channel; |
| 95 | u8 num_channels; |
| 96 | u8 max_tx_power; |
Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 97 | } __packed; |
Kalle Valo | 2f01a1f | 2009-04-29 23:33:31 +0300 | [diff] [blame] | 98 | |
| 99 | struct wl12xx_ie_country { |
| 100 | struct wl12xx_ie_header header; |
Bing Zhao | 80751e2 | 2011-03-07 11:14:23 -0800 | [diff] [blame] | 101 | u8 country_string[IEEE80211_COUNTRY_STRING_LEN]; |
Kalle Valo | 2f01a1f | 2009-04-29 23:33:31 +0300 | [diff] [blame] | 102 | struct country_triplet triplets[MAX_COUNTRY_TRIPLETS]; |
Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 103 | } __packed; |
Kalle Valo | 2f01a1f | 2009-04-29 23:33:31 +0300 | [diff] [blame] | 104 | |
| 105 | |
| 106 | /* Templates */ |
| 107 | |
| 108 | struct wl12xx_beacon_template { |
| 109 | struct ieee80211_header header; |
| 110 | __le32 time_stamp[2]; |
| 111 | __le16 beacon_interval; |
| 112 | __le16 capability; |
| 113 | struct wl12xx_ie_ssid ssid; |
| 114 | struct wl12xx_ie_rates rates; |
| 115 | struct wl12xx_ie_rates ext_rates; |
| 116 | struct wl12xx_ie_ds_params ds_params; |
| 117 | struct wl12xx_ie_country country; |
Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 118 | } __packed; |
Kalle Valo | 2f01a1f | 2009-04-29 23:33:31 +0300 | [diff] [blame] | 119 | |
| 120 | struct wl12xx_null_data_template { |
| 121 | struct ieee80211_header header; |
Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 122 | } __packed; |
Kalle Valo | 2f01a1f | 2009-04-29 23:33:31 +0300 | [diff] [blame] | 123 | |
| 124 | struct wl12xx_ps_poll_template { |
Luciano Coelho | d0f63b2 | 2009-10-15 10:33:29 +0300 | [diff] [blame] | 125 | __le16 fc; |
| 126 | __le16 aid; |
Kalle Valo | 2f01a1f | 2009-04-29 23:33:31 +0300 | [diff] [blame] | 127 | u8 bssid[ETH_ALEN]; |
| 128 | u8 ta[ETH_ALEN]; |
Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 129 | } __packed; |
Kalle Valo | 2f01a1f | 2009-04-29 23:33:31 +0300 | [diff] [blame] | 130 | |
| 131 | struct wl12xx_qos_null_data_template { |
| 132 | struct ieee80211_header header; |
| 133 | __le16 qos_ctl; |
Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 134 | } __packed; |
Kalle Valo | 2f01a1f | 2009-04-29 23:33:31 +0300 | [diff] [blame] | 135 | |
Eliad Peller | c531277 | 2010-12-09 11:31:27 +0200 | [diff] [blame] | 136 | struct wl12xx_arp_rsp_template { |
| 137 | struct ieee80211_hdr_3addr hdr; |
| 138 | |
| 139 | u8 llc_hdr[sizeof(rfc1042_header)]; |
Eliad Peller | 6177eae | 2010-12-22 12:38:52 +0100 | [diff] [blame] | 140 | __be16 llc_type; |
Eliad Peller | c531277 | 2010-12-09 11:31:27 +0200 | [diff] [blame] | 141 | |
| 142 | struct arphdr arp_hdr; |
| 143 | u8 sender_hw[ETH_ALEN]; |
Eliad Peller | 6177eae | 2010-12-22 12:38:52 +0100 | [diff] [blame] | 144 | __be32 sender_ip; |
Eliad Peller | c531277 | 2010-12-09 11:31:27 +0200 | [diff] [blame] | 145 | u8 target_hw[ETH_ALEN]; |
Eliad Peller | 6177eae | 2010-12-22 12:38:52 +0100 | [diff] [blame] | 146 | __be32 target_ip; |
Eliad Peller | c531277 | 2010-12-09 11:31:27 +0200 | [diff] [blame] | 147 | } __packed; |
| 148 | |
Kalle Valo | 2f01a1f | 2009-04-29 23:33:31 +0300 | [diff] [blame] | 149 | |
| 150 | struct wl12xx_probe_resp_template { |
| 151 | struct ieee80211_header header; |
| 152 | __le32 time_stamp[2]; |
| 153 | __le16 beacon_interval; |
| 154 | __le16 capability; |
| 155 | struct wl12xx_ie_ssid ssid; |
| 156 | struct wl12xx_ie_rates rates; |
| 157 | struct wl12xx_ie_rates ext_rates; |
| 158 | struct wl12xx_ie_ds_params ds_params; |
| 159 | struct wl12xx_ie_country country; |
Eric Dumazet | ba2d358 | 2010-06-02 18:10:09 +0000 | [diff] [blame] | 160 | } __packed; |
Kalle Valo | 2f01a1f | 2009-04-29 23:33:31 +0300 | [diff] [blame] | 161 | |
Arik Nemtsov | e0fe371 | 2010-10-16 18:19:53 +0200 | [diff] [blame] | 162 | struct wl12xx_disconn_template { |
| 163 | struct ieee80211_header header; |
| 164 | __le16 disconn_reason; |
| 165 | } __packed; |
| 166 | |
Kalle Valo | 2f01a1f | 2009-04-29 23:33:31 +0300 | [diff] [blame] | 167 | #endif |