wireless: mwifiex: initial commit for Marvell mwifiex driver
[pandora-kernel.git] / drivers / net / wireless / mwifiex / ioctl.h
1 /*
2  * Marvell Wireless LAN device driver: ioctl data structures & APIs
3  *
4  * Copyright (C) 2011, Marvell International Ltd.
5  *
6  * This software file (the "File") is distributed by Marvell International
7  * Ltd. under the terms of the GNU General Public License Version 2, June 1991
8  * (the "License").  You may use, redistribute and/or modify this File in
9  * accordance with the terms and conditions of the License, a copy of which
10  * is available by writing to the Free Software Foundation, Inc.,
11  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
12  * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
13  *
14  * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
15  * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
16  * ARE EXPRESSLY DISCLAIMED.  The License provides additional details about
17  * this warranty disclaimer.
18  */
19
20 #ifndef _MWIFIEX_IOCTL_H_
21 #define _MWIFIEX_IOCTL_H_
22
23 #include <net/mac80211.h>
24
25 enum {
26         MWIFIEX_SCAN_MODE_UNCHANGED = 0,
27         MWIFIEX_SCAN_MODE_BSS,
28         MWIFIEX_SCAN_MODE_IBSS,
29         MWIFIEX_SCAN_MODE_ANY
30 };
31
32 enum {
33         MWIFIEX_SCAN_TYPE_UNCHANGED = 0,
34         MWIFIEX_SCAN_TYPE_ACTIVE,
35         MWIFIEX_SCAN_TYPE_PASSIVE
36 };
37
38 struct mwifiex_get_scan_table_fixed {
39         u8 bssid[ETH_ALEN];
40         u8 channel;
41         u8 rssi;
42         long long network_tsf;
43 };
44
45 struct mwifiex_scan_time_params {
46         u32 specific_scan_time;
47         u32 active_scan_time;
48         u32 passive_scan_time;
49 };
50
51 struct mwifiex_user_scan {
52         u32 scan_cfg_len;
53         u8 scan_cfg_buf[1];
54 };
55
56 struct mwifiex_scan_req {
57         u32 scan_mode;
58         u32 scan_type;
59         struct mwifiex_802_11_ssid scan_ssid;
60         struct mwifiex_scan_time_params scan_time;
61         struct mwifiex_user_scan user_scan;
62 };
63
64 struct mwifiex_scan_resp {
65         u32 num_in_scan_table;
66         u8 *scan_table;
67 };
68
69 enum {
70         MWIFIEX_BSS_MODE_INFRA = 1,
71         MWIFIEX_BSS_MODE_IBSS,
72         MWIFIEX_BSS_MODE_AUTO
73 };
74
75 #define MWIFIEX_PROMISC_MODE            1
76 #define MWIFIEX_MULTICAST_MODE          2
77 #define MWIFIEX_ALL_MULTI_MODE          4
78 #define MWIFIEX_MAX_MULTICAST_LIST_SIZE 32
79
80 struct mwifiex_multicast_list {
81         u32 mode;
82         u32 num_multicast_addr;
83         u8 mac_list[MWIFIEX_MAX_MULTICAST_LIST_SIZE][ETH_ALEN];
84 };
85
86 #define MWIFIEX_MAX_CHANNEL_NUM         128
87
88 struct mwifiex_chan_freq {
89         u32 channel;
90         u32 freq;
91 };
92
93 struct mwifiex_chan_list {
94         u32 num_of_chan;
95         struct mwifiex_chan_freq cf[MWIFIEX_MAX_CHANNEL_NUM];
96 };
97
98 struct mwifiex_ssid_bssid {
99         struct mwifiex_802_11_ssid ssid;
100         u8 bssid[ETH_ALEN];
101 };
102
103 enum {
104         BAND_B = 1,
105         BAND_G = 2,
106         BAND_A = 4,
107         BAND_GN = 8,
108         BAND_AN = 16,
109 };
110
111 #define NO_SEC_CHANNEL               0
112 #define SEC_CHANNEL_ABOVE            1
113 #define SEC_CHANNEL_BELOW            3
114
115 struct mwifiex_ds_band_cfg {
116         u32 config_bands;
117         u32 adhoc_start_band;
118         u32 adhoc_channel;
119         u32 sec_chan_offset;
120 };
121
122 enum {
123         ADHOC_IDLE,
124         ADHOC_STARTED,
125         ADHOC_JOINED,
126         ADHOC_COALESCED
127 };
128
129 struct mwifiex_ds_get_stats {
130         u32 mcast_tx_frame;
131         u32 failed;
132         u32 retry;
133         u32 multi_retry;
134         u32 frame_dup;
135         u32 rts_success;
136         u32 rts_failure;
137         u32 ack_failure;
138         u32 rx_frag;
139         u32 mcast_rx_frame;
140         u32 fcs_error;
141         u32 tx_frame;
142         u32 wep_icv_error[4];
143 };
144
145 #define BCN_RSSI_LAST_MASK              0x00000001
146 #define BCN_RSSI_AVG_MASK               0x00000002
147 #define DATA_RSSI_LAST_MASK             0x00000004
148 #define DATA_RSSI_AVG_MASK              0x00000008
149 #define BCN_SNR_LAST_MASK               0x00000010
150 #define BCN_SNR_AVG_MASK                0x00000020
151 #define DATA_SNR_LAST_MASK              0x00000040
152 #define DATA_SNR_AVG_MASK               0x00000080
153 #define BCN_NF_LAST_MASK                0x00000100
154 #define BCN_NF_AVG_MASK                 0x00000200
155 #define DATA_NF_LAST_MASK               0x00000400
156 #define DATA_NF_AVG_MASK                0x00000800
157 #define ALL_RSSI_INFO_MASK              0x00000fff
158
159 struct mwifiex_ds_get_signal {
160         /*
161          * Bit0:  Last Beacon RSSI,  Bit1:  Average Beacon RSSI,
162          * Bit2:  Last Data RSSI,    Bit3:  Average Data RSSI,
163          * Bit4:  Last Beacon SNR,   Bit5:  Average Beacon SNR,
164          * Bit6:  Last Data SNR,     Bit7:  Average Data SNR,
165          * Bit8:  Last Beacon NF,    Bit9:  Average Beacon NF,
166          * Bit10: Last Data NF,      Bit11: Average Data NF
167          */
168         u16 selector;
169         s16 bcn_rssi_last;
170         s16 bcn_rssi_avg;
171         s16 data_rssi_last;
172         s16 data_rssi_avg;
173         s16 bcn_snr_last;
174         s16 bcn_snr_avg;
175         s16 data_snr_last;
176         s16 data_snr_avg;
177         s16 bcn_nf_last;
178         s16 bcn_nf_avg;
179         s16 data_nf_last;
180         s16 data_nf_avg;
181 };
182
183 struct mwifiex_fw_info {
184         u32 fw_ver;
185         u8 mac_addr[ETH_ALEN];
186 };
187
188 #define MWIFIEX_MAX_VER_STR_LEN    128
189
190 struct mwifiex_ver_ext {
191         u32 version_str_sel;
192         char version_str[MWIFIEX_MAX_VER_STR_LEN];
193 };
194
195 struct mwifiex_bss_info {
196         u32 bss_mode;
197         struct mwifiex_802_11_ssid ssid;
198         u32 scan_table_idx;
199         u32 bss_chan;
200         u32 region_code;
201         u32 media_connected;
202         u32 radio_on;
203         u32 max_power_level;
204         u32 min_power_level;
205         u32 adhoc_state;
206         signed int bcn_nf_last;
207         u32 wep_status;
208         u32 is_hs_configured;
209         u32 is_deep_sleep;
210         u8 bssid[ETH_ALEN];
211 };
212
213 #define MAX_NUM_TID     8
214
215 #define MAX_RX_WINSIZE  64
216
217 struct mwifiex_ds_rx_reorder_tbl {
218         u16 tid;
219         u8 ta[ETH_ALEN];
220         u32 start_win;
221         u32 win_size;
222         u32 buffer[MAX_RX_WINSIZE];
223 };
224
225 struct mwifiex_ds_tx_ba_stream_tbl {
226         u16 tid;
227         u8 ra[ETH_ALEN];
228 };
229
230 #define DBG_CMD_NUM     5
231
232 struct mwifiex_debug_info {
233         u32 int_counter;
234         u32 packets_out[MAX_NUM_TID];
235         u32 max_tx_buf_size;
236         u32 tx_buf_size;
237         u32 curr_tx_buf_size;
238         u32 tx_tbl_num;
239         struct mwifiex_ds_tx_ba_stream_tbl
240                 tx_tbl[MWIFIEX_MAX_TX_BASTREAM_SUPPORTED];
241         u32 rx_tbl_num;
242         struct mwifiex_ds_rx_reorder_tbl rx_tbl
243                 [MWIFIEX_MAX_RX_BASTREAM_SUPPORTED];
244         u16 ps_mode;
245         u32 ps_state;
246         u8 is_deep_sleep;
247         u8 pm_wakeup_card_req;
248         u32 pm_wakeup_fw_try;
249         u8 is_hs_configured;
250         u8 hs_activated;
251         u32 num_cmd_host_to_card_failure;
252         u32 num_cmd_sleep_cfm_host_to_card_failure;
253         u32 num_tx_host_to_card_failure;
254         u32 num_event_deauth;
255         u32 num_event_disassoc;
256         u32 num_event_link_lost;
257         u32 num_cmd_deauth;
258         u32 num_cmd_assoc_success;
259         u32 num_cmd_assoc_failure;
260         u32 num_tx_timeout;
261         u32 num_cmd_timeout;
262         u16 timeout_cmd_id;
263         u16 timeout_cmd_act;
264         u16 last_cmd_id[DBG_CMD_NUM];
265         u16 last_cmd_act[DBG_CMD_NUM];
266         u16 last_cmd_index;
267         u16 last_cmd_resp_id[DBG_CMD_NUM];
268         u16 last_cmd_resp_index;
269         u16 last_event[DBG_CMD_NUM];
270         u16 last_event_index;
271         u8 data_sent;
272         u8 cmd_sent;
273         u8 cmd_resp_received;
274         u8 event_received;
275 };
276
277 enum {
278         MWIFIEX_AUTH_MODE_OPEN = 0x00,
279         MWIFIEX_AUTH_MODE_SHARED = 0x01,
280         MWIFIEX_AUTH_MODE_NETWORKEAP = 0x80,
281         MWIFIEX_AUTH_MODE_AUTO = 0xFF,
282 };
283
284 enum {
285         MWIFIEX_ENCRYPTION_MODE_NONE = 0,
286         MWIFIEX_ENCRYPTION_MODE_WEP40 = 1,
287         MWIFIEX_ENCRYPTION_MODE_TKIP = 2,
288         MWIFIEX_ENCRYPTION_MODE_CCMP = 3,
289         MWIFIEX_ENCRYPTION_MODE_WEP104 = 4,
290 };
291
292 #define MWIFIEX_KEY_INDEX_UNICAST       0x40000000
293 #define MWIFIEX_MAX_KEY_LENGTH          32
294 #define WAPI_RXPN_LEN                   16
295
296 struct mwifiex_ds_encrypt_key {
297         u32 key_disable;
298         u32 key_index;
299         u32 key_len;
300         u8 key_material[MWIFIEX_MAX_KEY_LENGTH];
301         u8 mac_addr[ETH_ALEN];
302         u32 is_wapi_key;
303         u8 wapi_rxpn[WAPI_RXPN_LEN];
304 };
305
306 struct mwifiex_rate_cfg {
307         u32 action;
308         u32 is_rate_auto;
309         u32 rate;
310 };
311
312 struct mwifiex_data_rate {
313         u32 tx_data_rate;
314         u32 rx_data_rate;
315 };
316
317 struct mwifiex_power_cfg {
318         u32 is_power_auto;
319         u32 power_level;
320 };
321
322 struct mwifiex_ds_hs_cfg {
323         u32 is_invoke_hostcmd;
324         /*  Bit0: non-unicast data
325          *  Bit1: unicast data
326          *  Bit2: mac events
327          *  Bit3: magic packet
328          */
329         u32 conditions;
330         u32 gpio;
331         u32 gap;
332 };
333
334 #define DEEP_SLEEP_ON  1
335 #define DEEP_SLEEP_OFF 0
336
337 #define DEEP_SLEEP_IDLE_TIME    100
338
339 struct mwifiex_ds_auto_ds {
340         u16 auto_ds;
341         u16 idle_time;
342 };
343
344 #define PS_MODE_UNCHANGED                       0
345 #define PS_MODE_AUTO                            1
346 #define PS_MODE_POLL                            2
347 #define PS_MODE_NULL                            3
348
349
350 struct mwifiex_ds_pm_cfg {
351         union {
352                 u32 ps_mode;
353                 struct mwifiex_ds_hs_cfg hs_cfg;
354                 struct mwifiex_ds_auto_ds auto_deep_sleep;
355                 u32 sleep_period;
356         } param;
357 };
358
359 struct mwifiex_ioctl_wmm_queue_status_ac {
360         u8 wmm_acm;
361         u8 flow_required;
362         u8 flow_created;
363         u8 disabled;
364 };
365
366 struct mwifiex_ds_wmm_queue_status {
367         struct mwifiex_ioctl_wmm_queue_status_ac
368                 ac_status[IEEE80211_MAX_QUEUES];
369 };
370
371 struct mwifiex_ds_11n_tx_cfg {
372         u16 tx_htcap;
373         u16 tx_htinfo;
374 };
375
376 struct mwifiex_ds_11n_amsdu_aggr_ctrl {
377         u16 enable;
378         u16 curr_buf_size;
379 };
380
381 #define MWIFIEX_NUM_OF_CMD_BUFFER       20
382 #define MWIFIEX_SIZE_OF_CMD_BUFFER      2048
383
384 enum {
385         MWIFIEX_IE_TYPE_GEN_IE = 0,
386         MWIFIEX_IE_TYPE_ARP_FILTER,
387 };
388
389 enum {
390         MWIFIEX_REG_MAC = 1,
391         MWIFIEX_REG_BBP,
392         MWIFIEX_REG_RF,
393         MWIFIEX_REG_PMIC,
394         MWIFIEX_REG_CAU,
395 };
396
397 struct mwifiex_ds_reg_rw {
398         __le32 type;
399         __le32 offset;
400         __le32 value;
401 };
402
403 #define MAX_EEPROM_DATA 256
404
405 struct mwifiex_ds_read_eeprom {
406         __le16 offset;
407         __le16 byte_count;
408         u8 value[MAX_EEPROM_DATA];
409 };
410
411 struct mwifiex_ds_misc_gen_ie {
412         u32 type;
413         u32 len;
414         u8 ie_data[IW_CUSTOM_MAX];
415 };
416
417 struct mwifiex_ds_misc_cmd {
418         u32 len;
419         u8 cmd[MWIFIEX_SIZE_OF_CMD_BUFFER];
420 };
421
422 #define MWIFIEX_MAX_VSIE_LEN       (256)
423 #define MWIFIEX_MAX_VSIE_NUM       (8)
424 #define MWIFIEX_VSIE_MASK_SCAN     0x01
425 #define MWIFIEX_VSIE_MASK_ASSOC    0x02
426 #define MWIFIEX_VSIE_MASK_ADHOC    0x04
427
428 enum {
429         MWIFIEX_FUNC_INIT = 1,
430         MWIFIEX_FUNC_SHUTDOWN,
431 };
432
433 #endif /* !_MWIFIEX_IOCTL_H_ */