Add the rt linux 4.1.3-rt3 as base
[kvmfornfv.git] / kernel / drivers / net / wireless / ti / wlcore / conf.h
1 /*
2  * This file is part of wl1271
3  *
4  * Copyright (C) 2009 Nokia Corporation
5  *
6  * Contact: Luciano Coelho <luciano.coelho@nokia.com>
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  *
22  */
23
24 #ifndef __CONF_H__
25 #define __CONF_H__
26
27 enum {
28         CONF_HW_BIT_RATE_1MBPS   = BIT(0),
29         CONF_HW_BIT_RATE_2MBPS   = BIT(1),
30         CONF_HW_BIT_RATE_5_5MBPS = BIT(2),
31         CONF_HW_BIT_RATE_6MBPS   = BIT(3),
32         CONF_HW_BIT_RATE_9MBPS   = BIT(4),
33         CONF_HW_BIT_RATE_11MBPS  = BIT(5),
34         CONF_HW_BIT_RATE_12MBPS  = BIT(6),
35         CONF_HW_BIT_RATE_18MBPS  = BIT(7),
36         CONF_HW_BIT_RATE_22MBPS  = BIT(8),
37         CONF_HW_BIT_RATE_24MBPS  = BIT(9),
38         CONF_HW_BIT_RATE_36MBPS  = BIT(10),
39         CONF_HW_BIT_RATE_48MBPS  = BIT(11),
40         CONF_HW_BIT_RATE_54MBPS  = BIT(12),
41         CONF_HW_BIT_RATE_MCS_0   = BIT(13),
42         CONF_HW_BIT_RATE_MCS_1   = BIT(14),
43         CONF_HW_BIT_RATE_MCS_2   = BIT(15),
44         CONF_HW_BIT_RATE_MCS_3   = BIT(16),
45         CONF_HW_BIT_RATE_MCS_4   = BIT(17),
46         CONF_HW_BIT_RATE_MCS_5   = BIT(18),
47         CONF_HW_BIT_RATE_MCS_6   = BIT(19),
48         CONF_HW_BIT_RATE_MCS_7   = BIT(20),
49         CONF_HW_BIT_RATE_MCS_8   = BIT(21),
50         CONF_HW_BIT_RATE_MCS_9   = BIT(22),
51         CONF_HW_BIT_RATE_MCS_10  = BIT(23),
52         CONF_HW_BIT_RATE_MCS_11  = BIT(24),
53         CONF_HW_BIT_RATE_MCS_12  = BIT(25),
54         CONF_HW_BIT_RATE_MCS_13  = BIT(26),
55         CONF_HW_BIT_RATE_MCS_14  = BIT(27),
56         CONF_HW_BIT_RATE_MCS_15  = BIT(28),
57 };
58
59 enum {
60         CONF_HW_RATE_INDEX_1MBPS      = 0,
61         CONF_HW_RATE_INDEX_2MBPS      = 1,
62         CONF_HW_RATE_INDEX_5_5MBPS    = 2,
63         CONF_HW_RATE_INDEX_11MBPS     = 3,
64         CONF_HW_RATE_INDEX_6MBPS      = 4,
65         CONF_HW_RATE_INDEX_9MBPS      = 5,
66         CONF_HW_RATE_INDEX_12MBPS     = 6,
67         CONF_HW_RATE_INDEX_18MBPS     = 7,
68         CONF_HW_RATE_INDEX_24MBPS     = 8,
69         CONF_HW_RATE_INDEX_36MBPS     = 9,
70         CONF_HW_RATE_INDEX_48MBPS     = 10,
71         CONF_HW_RATE_INDEX_54MBPS     = 11,
72         CONF_HW_RATE_INDEX_MCS0       = 12,
73         CONF_HW_RATE_INDEX_MCS1       = 13,
74         CONF_HW_RATE_INDEX_MCS2       = 14,
75         CONF_HW_RATE_INDEX_MCS3       = 15,
76         CONF_HW_RATE_INDEX_MCS4       = 16,
77         CONF_HW_RATE_INDEX_MCS5       = 17,
78         CONF_HW_RATE_INDEX_MCS6       = 18,
79         CONF_HW_RATE_INDEX_MCS7       = 19,
80         CONF_HW_RATE_INDEX_MCS7_SGI   = 20,
81         CONF_HW_RATE_INDEX_MCS0_40MHZ = 21,
82         CONF_HW_RATE_INDEX_MCS1_40MHZ = 22,
83         CONF_HW_RATE_INDEX_MCS2_40MHZ = 23,
84         CONF_HW_RATE_INDEX_MCS3_40MHZ = 24,
85         CONF_HW_RATE_INDEX_MCS4_40MHZ = 25,
86         CONF_HW_RATE_INDEX_MCS5_40MHZ = 26,
87         CONF_HW_RATE_INDEX_MCS6_40MHZ = 27,
88         CONF_HW_RATE_INDEX_MCS7_40MHZ = 28,
89         CONF_HW_RATE_INDEX_MCS7_40MHZ_SGI = 29,
90
91         /* MCS8+ rates overlap with 40Mhz rates */
92         CONF_HW_RATE_INDEX_MCS8       = 21,
93         CONF_HW_RATE_INDEX_MCS9       = 22,
94         CONF_HW_RATE_INDEX_MCS10      = 23,
95         CONF_HW_RATE_INDEX_MCS11      = 24,
96         CONF_HW_RATE_INDEX_MCS12      = 25,
97         CONF_HW_RATE_INDEX_MCS13      = 26,
98         CONF_HW_RATE_INDEX_MCS14      = 27,
99         CONF_HW_RATE_INDEX_MCS15      = 28,
100         CONF_HW_RATE_INDEX_MCS15_SGI  = 29,
101
102         CONF_HW_RATE_INDEX_MAX        = CONF_HW_RATE_INDEX_MCS7_40MHZ_SGI,
103 };
104
105 #define CONF_HW_RXTX_RATE_UNSUPPORTED 0xff
106
107 enum {
108         CONF_SG_DISABLE = 0,
109         CONF_SG_PROTECTIVE,
110         CONF_SG_OPPORTUNISTIC
111 };
112
113 enum {
114         /*
115          * Configure the min and max time BT gains the antenna
116          * in WLAN / BT master basic rate
117          *
118          * Range: 0 - 255 (ms)
119          */
120         CONF_SG_ACL_BT_MASTER_MIN_BR = 0,
121         CONF_SG_ACL_BT_MASTER_MAX_BR,
122
123         /*
124          * Configure the min and max time BT gains the antenna
125          * in WLAN / BT slave basic rate
126          *
127          * Range: 0 - 255 (ms)
128          */
129         CONF_SG_ACL_BT_SLAVE_MIN_BR,
130         CONF_SG_ACL_BT_SLAVE_MAX_BR,
131
132         /*
133          * Configure the min and max time BT gains the antenna
134          * in WLAN / BT master EDR
135          *
136          * Range: 0 - 255 (ms)
137          */
138         CONF_SG_ACL_BT_MASTER_MIN_EDR,
139         CONF_SG_ACL_BT_MASTER_MAX_EDR,
140
141         /*
142          * Configure the min and max time BT gains the antenna
143          * in WLAN / BT slave EDR
144          *
145          * Range: 0 - 255 (ms)
146          */
147         CONF_SG_ACL_BT_SLAVE_MIN_EDR,
148         CONF_SG_ACL_BT_SLAVE_MAX_EDR,
149
150         /*
151          * The maximum time WLAN can gain the antenna
152          * in WLAN PSM / BT master/slave BR
153          *
154          * Range: 0 - 255 (ms)
155          */
156         CONF_SG_ACL_WLAN_PS_MASTER_BR,
157         CONF_SG_ACL_WLAN_PS_SLAVE_BR,
158
159         /*
160          * The maximum time WLAN can gain the antenna
161          * in WLAN PSM / BT master/slave EDR
162          *
163          * Range: 0 - 255 (ms)
164          */
165         CONF_SG_ACL_WLAN_PS_MASTER_EDR,
166         CONF_SG_ACL_WLAN_PS_SLAVE_EDR,
167
168         /* TODO: explain these values */
169         CONF_SG_ACL_WLAN_ACTIVE_MASTER_MIN_BR,
170         CONF_SG_ACL_WLAN_ACTIVE_MASTER_MAX_BR,
171         CONF_SG_ACL_WLAN_ACTIVE_SLAVE_MIN_BR,
172         CONF_SG_ACL_WLAN_ACTIVE_SLAVE_MAX_BR,
173         CONF_SG_ACL_WLAN_ACTIVE_MASTER_MIN_EDR,
174         CONF_SG_ACL_WLAN_ACTIVE_MASTER_MAX_EDR,
175         CONF_SG_ACL_WLAN_ACTIVE_SLAVE_MIN_EDR,
176         CONF_SG_ACL_WLAN_ACTIVE_SLAVE_MAX_EDR,
177
178         CONF_SG_ACL_ACTIVE_SCAN_WLAN_BR,
179         CONF_SG_ACL_ACTIVE_SCAN_WLAN_EDR,
180         CONF_SG_ACL_PASSIVE_SCAN_BT_BR,
181         CONF_SG_ACL_PASSIVE_SCAN_WLAN_BR,
182         CONF_SG_ACL_PASSIVE_SCAN_BT_EDR,
183         CONF_SG_ACL_PASSIVE_SCAN_WLAN_EDR,
184
185         /*
186          * Compensation percentage of probe requests when scan initiated
187          * during BT voice/ACL link.
188          *
189          * Range: 0 - 255 (%)
190          */
191         CONF_SG_AUTO_SCAN_PROBE_REQ,
192
193         /*
194          * Compensation percentage of probe requests when active scan initiated
195          * during BT voice
196          *
197          * Range: 0 - 255 (%)
198          */
199         CONF_SG_ACTIVE_SCAN_DURATION_FACTOR_HV3,
200
201         /*
202          * Compensation percentage of WLAN active scan window if initiated
203          * during BT A2DP
204          *
205          * Range: 0 - 1000 (%)
206          */
207         CONF_SG_ACTIVE_SCAN_DURATION_FACTOR_A2DP,
208
209         /*
210          * Compensation percentage of WLAN passive scan window if initiated
211          * during BT A2DP BR
212          *
213          * Range: 0 - 1000 (%)
214          */
215         CONF_SG_PASSIVE_SCAN_DURATION_FACTOR_A2DP_BR,
216
217         /*
218          * Compensation percentage of WLAN passive scan window if initiated
219          * during BT A2DP EDR
220          *
221          * Range: 0 - 1000 (%)
222          */
223         CONF_SG_PASSIVE_SCAN_DURATION_FACTOR_A2DP_EDR,
224
225         /*
226          * Compensation percentage of WLAN passive scan window if initiated
227          * during BT voice
228          *
229          * Range: 0 - 1000 (%)
230          */
231         CONF_SG_PASSIVE_SCAN_DURATION_FACTOR_HV3,
232
233         /* TODO: explain these values */
234         CONF_SG_CONSECUTIVE_HV3_IN_PASSIVE_SCAN,
235         CONF_SG_BCN_HV3_COLLISION_THRESH_IN_PASSIVE_SCAN,
236         CONF_SG_TX_RX_PROTECTION_BWIDTH_IN_PASSIVE_SCAN,
237
238         /*
239          * Defines whether the SG will force WLAN host to enter/exit PSM
240          *
241          * Range: 1 - SG can force, 0 - host handles PSM
242          */
243         CONF_SG_STA_FORCE_PS_IN_BT_SCO,
244
245         /*
246          * Defines antenna configuration (single/dual antenna)
247          *
248          * Range: 0 - single antenna, 1 - dual antenna
249          */
250         CONF_SG_ANTENNA_CONFIGURATION,
251
252         /*
253          * The threshold (percent) of max consecutive beacon misses before
254          * increasing priority of beacon reception.
255          *
256          * Range: 0 - 100 (%)
257          */
258         CONF_SG_BEACON_MISS_PERCENT,
259
260         /*
261          * Protection time of the DHCP procedure.
262          *
263          * Range: 0 - 100000 (ms)
264          */
265         CONF_SG_DHCP_TIME,
266
267         /*
268          * RX guard time before the beginning of a new BT voice frame during
269          * which no new WLAN trigger frame is transmitted.
270          *
271          * Range: 0 - 100000 (us)
272          */
273         CONF_SG_RXT,
274
275         /*
276          * TX guard time before the beginning of a new BT voice frame during
277          * which no new WLAN frame is transmitted.
278          *
279          * Range: 0 - 100000 (us)
280          */
281
282         CONF_SG_TXT,
283
284         /*
285          * Enable adaptive RXT/TXT algorithm. If disabled, the host values
286          * will be utilized.
287          *
288          * Range: 0 - disable, 1 - enable
289          */
290         CONF_SG_ADAPTIVE_RXT_TXT,
291
292         /* TODO: explain this value */
293         CONF_SG_GENERAL_USAGE_BIT_MAP,
294
295         /*
296          * Number of consecutive BT voice frames not interrupted by WLAN
297          *
298          * Range: 0 - 100
299          */
300         CONF_SG_HV3_MAX_SERVED,
301
302         /*
303          * The used WLAN legacy service period during active BT ACL link
304          *
305          * Range: 0 - 255 (ms)
306          */
307         CONF_SG_PS_POLL_TIMEOUT,
308
309         /*
310          * The used WLAN UPSD service period during active BT ACL link
311          *
312          * Range: 0 - 255 (ms)
313          */
314         CONF_SG_UPSD_TIMEOUT,
315
316         CONF_SG_CONSECUTIVE_CTS_THRESHOLD,
317         CONF_SG_STA_RX_WINDOW_AFTER_DTIM,
318         CONF_SG_STA_CONNECTION_PROTECTION_TIME,
319
320         /* AP params */
321         CONF_AP_BEACON_MISS_TX,
322         CONF_AP_RX_WINDOW_AFTER_BEACON,
323         CONF_AP_BEACON_WINDOW_INTERVAL,
324         CONF_AP_CONNECTION_PROTECTION_TIME,
325         CONF_AP_BT_ACL_VAL_BT_SERVE_TIME,
326         CONF_AP_BT_ACL_VAL_WL_SERVE_TIME,
327
328         /* CTS Diluting params */
329         CONF_SG_CTS_DILUTED_BAD_RX_PACKETS_TH,
330         CONF_SG_CTS_CHOP_IN_DUAL_ANT_SCO_MASTER,
331
332         CONF_SG_TEMP_PARAM_1,
333         CONF_SG_TEMP_PARAM_2,
334         CONF_SG_TEMP_PARAM_3,
335         CONF_SG_TEMP_PARAM_4,
336         CONF_SG_TEMP_PARAM_5,
337         CONF_SG_TEMP_PARAM_6,
338         CONF_SG_TEMP_PARAM_7,
339         CONF_SG_TEMP_PARAM_8,
340         CONF_SG_TEMP_PARAM_9,
341         CONF_SG_TEMP_PARAM_10,
342
343         CONF_SG_PARAMS_MAX,
344         CONF_SG_PARAMS_ALL = 0xff
345 };
346
347 struct conf_sg_settings {
348         u32 params[CONF_SG_PARAMS_MAX];
349         u8 state;
350 } __packed;
351
352 enum conf_rx_queue_type {
353         CONF_RX_QUEUE_TYPE_LOW_PRIORITY,  /* All except the high priority */
354         CONF_RX_QUEUE_TYPE_HIGH_PRIORITY, /* Management and voice packets */
355 };
356
357 struct conf_rx_settings {
358         /*
359          * The maximum amount of time, in TU, before the
360          * firmware discards the MSDU.
361          *
362          * Range: 0 - 0xFFFFFFFF
363          */
364         u32 rx_msdu_life_time;
365
366         /*
367          * Packet detection threshold in the PHY.
368          *
369          * FIXME: details unknown.
370          */
371         u32 packet_detection_threshold;
372
373         /*
374          * The longest time the STA will wait to receive traffic from the AP
375          * after a PS-poll has been transmitted.
376          *
377          * Range: 0 - 200000
378          */
379         u16 ps_poll_timeout;
380         /*
381          * The longest time the STA will wait to receive traffic from the AP
382          * after a frame has been sent from an UPSD enabled queue.
383          *
384          * Range: 0 - 200000
385          */
386         u16 upsd_timeout;
387
388         /*
389          * The number of octets in an MPDU, below which an RTS/CTS
390          * handshake is not performed.
391          *
392          * Range: 0 - 4096
393          */
394         u16 rts_threshold;
395
396         /*
397          * The RX Clear Channel Assessment threshold in the PHY
398          * (the energy threshold).
399          *
400          * Range: ENABLE_ENERGY_D  == 0x140A
401          *        DISABLE_ENERGY_D == 0xFFEF
402          */
403         u16 rx_cca_threshold;
404
405         /*
406          * Occupied Rx mem-blocks number which requires interrupting the host
407          * (0 = no buffering, 0xffff = disabled).
408          *
409          * Range: u16
410          */
411         u16 irq_blk_threshold;
412
413         /*
414          * Rx packets number which requires interrupting the host
415          * (0 = no buffering).
416          *
417          * Range: u16
418          */
419         u16 irq_pkt_threshold;
420
421         /*
422          * Max time in msec the FW may delay RX-Complete interrupt.
423          *
424          * Range: 1 - 100
425          */
426         u16 irq_timeout;
427
428         /*
429          * The RX queue type.
430          *
431          * Range: RX_QUEUE_TYPE_RX_LOW_PRIORITY, RX_QUEUE_TYPE_RX_HIGH_PRIORITY,
432          */
433         u8 queue_type;
434 } __packed;
435
436 #define CONF_TX_MAX_RATE_CLASSES       10
437
438 #define CONF_TX_RATE_MASK_UNSPECIFIED  0
439 #define CONF_TX_RATE_MASK_BASIC        (CONF_HW_BIT_RATE_1MBPS | \
440                                         CONF_HW_BIT_RATE_2MBPS)
441 #define CONF_TX_RATE_RETRY_LIMIT       10
442
443 /* basic rates for p2p operations (probe req/resp, etc.) */
444 #define CONF_TX_RATE_MASK_BASIC_P2P    CONF_HW_BIT_RATE_6MBPS
445
446 /*
447  * Rates supported for data packets when operating as STA/AP. Note the absence
448  * of the 22Mbps rate. There is a FW limitation on 12 rates so we must drop
449  * one. The rate dropped is not mandatory under any operating mode.
450  */
451 #define CONF_TX_ENABLED_RATES       (CONF_HW_BIT_RATE_1MBPS |    \
452         CONF_HW_BIT_RATE_2MBPS | CONF_HW_BIT_RATE_5_5MBPS |      \
453         CONF_HW_BIT_RATE_6MBPS | CONF_HW_BIT_RATE_9MBPS |        \
454         CONF_HW_BIT_RATE_11MBPS | CONF_HW_BIT_RATE_12MBPS |      \
455         CONF_HW_BIT_RATE_18MBPS | CONF_HW_BIT_RATE_24MBPS |      \
456         CONF_HW_BIT_RATE_36MBPS | CONF_HW_BIT_RATE_48MBPS |      \
457         CONF_HW_BIT_RATE_54MBPS)
458
459 #define CONF_TX_CCK_RATES  (CONF_HW_BIT_RATE_1MBPS |            \
460         CONF_HW_BIT_RATE_2MBPS | CONF_HW_BIT_RATE_5_5MBPS |     \
461         CONF_HW_BIT_RATE_11MBPS)
462
463 #define CONF_TX_OFDM_RATES (CONF_HW_BIT_RATE_6MBPS |             \
464         CONF_HW_BIT_RATE_12MBPS | CONF_HW_BIT_RATE_24MBPS |      \
465         CONF_HW_BIT_RATE_36MBPS | CONF_HW_BIT_RATE_48MBPS |      \
466         CONF_HW_BIT_RATE_54MBPS)
467
468 #define CONF_TX_MCS_RATES (CONF_HW_BIT_RATE_MCS_0 |              \
469         CONF_HW_BIT_RATE_MCS_1 | CONF_HW_BIT_RATE_MCS_2 |        \
470         CONF_HW_BIT_RATE_MCS_3 | CONF_HW_BIT_RATE_MCS_4 |        \
471         CONF_HW_BIT_RATE_MCS_5 | CONF_HW_BIT_RATE_MCS_6 |        \
472         CONF_HW_BIT_RATE_MCS_7)
473
474 #define CONF_TX_MIMO_RATES (CONF_HW_BIT_RATE_MCS_8 |             \
475         CONF_HW_BIT_RATE_MCS_9 | CONF_HW_BIT_RATE_MCS_10 |       \
476         CONF_HW_BIT_RATE_MCS_11 | CONF_HW_BIT_RATE_MCS_12 |      \
477         CONF_HW_BIT_RATE_MCS_13 | CONF_HW_BIT_RATE_MCS_14 |      \
478         CONF_HW_BIT_RATE_MCS_15)
479
480 /*
481  * Default rates for management traffic when operating in AP mode. This
482  * should be configured according to the basic rate set of the AP
483  */
484 #define CONF_TX_AP_DEFAULT_MGMT_RATES  (CONF_HW_BIT_RATE_1MBPS | \
485         CONF_HW_BIT_RATE_2MBPS | CONF_HW_BIT_RATE_5_5MBPS)
486
487 /* default rates for working as IBSS (11b and OFDM) */
488 #define CONF_TX_IBSS_DEFAULT_RATES  (CONF_HW_BIT_RATE_1MBPS |       \
489                 CONF_HW_BIT_RATE_2MBPS | CONF_HW_BIT_RATE_5_5MBPS | \
490                 CONF_HW_BIT_RATE_11MBPS | CONF_TX_OFDM_RATES);
491
492 struct conf_tx_rate_class {
493
494         /*
495          * The rates enabled for this rate class.
496          *
497          * Range: CONF_HW_BIT_RATE_* bit mask
498          */
499         u32 enabled_rates;
500
501         /*
502          * The dot11 short retry limit used for TX retries.
503          *
504          * Range: u8
505          */
506         u8 short_retry_limit;
507
508         /*
509          * The dot11 long retry limit used for TX retries.
510          *
511          * Range: u8
512          */
513         u8 long_retry_limit;
514
515         /*
516          * Flags controlling the attributes of TX transmission.
517          *
518          * Range: bit 0: Truncate - when set, FW attempts to send a frame stop
519          *               when the total valid per-rate attempts have
520          *               been exhausted; otherwise transmissions
521          *               will continue at the lowest available rate
522          *               until the appropriate one of the
523          *               short_retry_limit, long_retry_limit,
524          *               dot11_max_transmit_msdu_life_time, or
525          *               max_tx_life_time, is exhausted.
526          *            1: Preamble Override - indicates if the preamble type
527          *               should be used in TX.
528          *            2: Preamble Type - the type of the preamble to be used by
529          *               the policy (0 - long preamble, 1 - short preamble.
530          */
531         u8 aflags;
532 } __packed;
533
534 #define CONF_TX_MAX_AC_COUNT 4
535
536 /* Slot number setting to start transmission at PIFS interval */
537 #define CONF_TX_AIFS_PIFS 1
538 /* Slot number setting to start transmission at DIFS interval normal
539  * DCF access */
540 #define CONF_TX_AIFS_DIFS 2
541
542
543 enum conf_tx_ac {
544         CONF_TX_AC_BE = 0,         /* best effort / legacy */
545         CONF_TX_AC_BK = 1,         /* background */
546         CONF_TX_AC_VI = 2,         /* video */
547         CONF_TX_AC_VO = 3,         /* voice */
548         CONF_TX_AC_CTS2SELF = 4,   /* fictitious AC, follows AC_VO */
549         CONF_TX_AC_ANY_TID = 0xff
550 };
551
552 struct conf_tx_ac_category {
553         /*
554          * The AC class identifier.
555          *
556          * Range: enum conf_tx_ac
557          */
558         u8 ac;
559
560         /*
561          * The contention window minimum size (in slots) for the access
562          * class.
563          *
564          * Range: u8
565          */
566         u8 cw_min;
567
568         /*
569          * The contention window maximum size (in slots) for the access
570          * class.
571          *
572          * Range: u8
573          */
574         u16 cw_max;
575
576         /*
577          * The AIF value (in slots) for the access class.
578          *
579          * Range: u8
580          */
581         u8 aifsn;
582
583         /*
584          * The TX Op Limit (in microseconds) for the access class.
585          *
586          * Range: u16
587          */
588         u16 tx_op_limit;
589 } __packed;
590
591 #define CONF_TX_MAX_TID_COUNT 8
592
593 /* Allow TX BA on all TIDs but 6,7. These are currently reserved in the FW */
594 #define CONF_TX_BA_ENABLED_TID_BITMAP 0x3F
595
596 enum {
597         CONF_CHANNEL_TYPE_DCF = 0,   /* DC/LEGACY*/
598         CONF_CHANNEL_TYPE_EDCF = 1,  /* EDCA*/
599         CONF_CHANNEL_TYPE_HCCA = 2,  /* HCCA*/
600 };
601
602 enum {
603         CONF_PS_SCHEME_LEGACY = 0,
604         CONF_PS_SCHEME_UPSD_TRIGGER = 1,
605         CONF_PS_SCHEME_LEGACY_PSPOLL = 2,
606         CONF_PS_SCHEME_SAPSD = 3,
607 };
608
609 enum {
610         CONF_ACK_POLICY_LEGACY = 0,
611         CONF_ACK_POLICY_NO_ACK = 1,
612         CONF_ACK_POLICY_BLOCK = 2,
613 };
614
615
616 struct conf_tx_tid {
617         u8 queue_id;
618         u8 channel_type;
619         u8 tsid;
620         u8 ps_scheme;
621         u8 ack_policy;
622         u32 apsd_conf[2];
623 } __packed;
624
625 struct conf_tx_settings {
626         /*
627          * The TX ED value for TELEC Enable/Disable.
628          *
629          * Range: 0, 1
630          */
631         u8 tx_energy_detection;
632
633         /*
634          * Configuration for rate classes for TX (currently only one
635          * rate class supported). Used in non-AP mode.
636          */
637         struct conf_tx_rate_class sta_rc_conf;
638
639         /*
640          * Configuration for access categories for TX rate control.
641          */
642         u8 ac_conf_count;
643         struct conf_tx_ac_category ac_conf[CONF_TX_MAX_AC_COUNT];
644
645         /*
646          * AP-mode - allow this number of TX retries to a station before an
647          * event is triggered from FW.
648          * In AP-mode the hlids of unreachable stations are given in the
649          * "sta_tx_retry_exceeded" member in the event mailbox.
650          */
651         u8 max_tx_retries;
652
653         /*
654          * AP-mode - after this number of seconds a connected station is
655          * considered inactive.
656          */
657         u16 ap_aging_period;
658
659         /*
660          * Configuration for TID parameters.
661          */
662         u8 tid_conf_count;
663         struct conf_tx_tid tid_conf[CONF_TX_MAX_TID_COUNT];
664
665         /*
666          * The TX fragmentation threshold.
667          *
668          * Range: u16
669          */
670         u16 frag_threshold;
671
672         /*
673          * Max time in msec the FW may delay frame TX-Complete interrupt.
674          *
675          * Range: u16
676          */
677         u16 tx_compl_timeout;
678
679         /*
680          * Completed TX packet count which requires to issue the TX-Complete
681          * interrupt.
682          *
683          * Range: u16
684          */
685         u16 tx_compl_threshold;
686
687         /*
688          * The rate used for control messages and scanning on the 2.4GHz band
689          *
690          * Range: CONF_HW_BIT_RATE_* bit mask
691          */
692         u32 basic_rate;
693
694         /*
695          * The rate used for control messages and scanning on the 5GHz band
696          *
697          * Range: CONF_HW_BIT_RATE_* bit mask
698          */
699         u32 basic_rate_5;
700
701         /*
702          * TX retry limits for templates
703          */
704         u8 tmpl_short_retry_limit;
705         u8 tmpl_long_retry_limit;
706
707         /* Time in ms for Tx watchdog timer to expire */
708         u32 tx_watchdog_timeout;
709
710         /*
711          * when a slow link has this much packets pending, it becomes a low
712          * priority link, scheduling-wise
713          */
714         u8 slow_link_thold;
715
716         /*
717          * when a fast link has this much packets pending, it becomes a low
718          * priority link, scheduling-wise
719          */
720         u8 fast_link_thold;
721 } __packed;
722
723 enum {
724         CONF_WAKE_UP_EVENT_BEACON    = 0x01, /* Wake on every Beacon*/
725         CONF_WAKE_UP_EVENT_DTIM      = 0x02, /* Wake on every DTIM*/
726         CONF_WAKE_UP_EVENT_N_DTIM    = 0x04, /* Wake every Nth DTIM */
727         CONF_WAKE_UP_EVENT_N_BEACONS = 0x08, /* Wake every Nth beacon */
728         CONF_WAKE_UP_EVENT_BITS_MASK = 0x0F
729 };
730
731 #define CONF_MAX_BCN_FILT_IE_COUNT 32
732
733 #define CONF_BCN_RULE_PASS_ON_CHANGE         BIT(0)
734 #define CONF_BCN_RULE_PASS_ON_APPEARANCE     BIT(1)
735
736 #define CONF_BCN_IE_OUI_LEN    3
737 #define CONF_BCN_IE_VER_LEN    2
738
739 struct conf_bcn_filt_rule {
740         /*
741          * IE number to which to associate a rule.
742          *
743          * Range: u8
744          */
745         u8 ie;
746
747         /*
748          * Rule to associate with the specific ie.
749          *
750          * Range: CONF_BCN_RULE_PASS_ON_*
751          */
752         u8 rule;
753
754         /*
755          * OUI for the vendor specifie IE (221)
756          */
757         u8 oui[CONF_BCN_IE_OUI_LEN];
758
759         /*
760          * Type for the vendor specifie IE (221)
761          */
762         u8 type;
763
764         /*
765          * Version for the vendor specifie IE (221)
766          */
767         u8 version[CONF_BCN_IE_VER_LEN];
768 } __packed;
769
770 #define CONF_MAX_RSSI_SNR_TRIGGERS 8
771
772 enum {
773         CONF_TRIG_METRIC_RSSI_BEACON = 0,
774         CONF_TRIG_METRIC_RSSI_DATA,
775         CONF_TRIG_METRIC_SNR_BEACON,
776         CONF_TRIG_METRIC_SNR_DATA
777 };
778
779 enum {
780         CONF_TRIG_EVENT_TYPE_LEVEL = 0,
781         CONF_TRIG_EVENT_TYPE_EDGE
782 };
783
784 enum {
785         CONF_TRIG_EVENT_DIR_LOW = 0,
786         CONF_TRIG_EVENT_DIR_HIGH,
787         CONF_TRIG_EVENT_DIR_BIDIR
788 };
789
790 struct conf_sig_weights {
791
792         /*
793          * RSSI from beacons average weight.
794          *
795          * Range: u8
796          */
797         u8 rssi_bcn_avg_weight;
798
799         /*
800          * RSSI from data average weight.
801          *
802          * Range: u8
803          */
804         u8 rssi_pkt_avg_weight;
805
806         /*
807          * SNR from beacons average weight.
808          *
809          * Range: u8
810          */
811         u8 snr_bcn_avg_weight;
812
813         /*
814          * SNR from data average weight.
815          *
816          * Range: u8
817          */
818         u8 snr_pkt_avg_weight;
819 } __packed;
820
821 enum conf_bcn_filt_mode {
822         CONF_BCN_FILT_MODE_DISABLED = 0,
823         CONF_BCN_FILT_MODE_ENABLED = 1
824 };
825
826 enum conf_bet_mode {
827         CONF_BET_MODE_DISABLE = 0,
828         CONF_BET_MODE_ENABLE = 1,
829 };
830
831 struct conf_conn_settings {
832         /*
833          * Firmware wakeup conditions configuration. The host may set only
834          * one bit.
835          *
836          * Range: CONF_WAKE_UP_EVENT_*
837          */
838         u8 wake_up_event;
839
840         /*
841          * Listen interval for beacons or Dtims.
842          *
843          * Range: 0 for beacon and Dtim wakeup
844          *        1-10 for x Dtims
845          *        1-255 for x beacons
846          */
847         u8 listen_interval;
848
849         /*
850          * Firmware wakeup conditions during suspend
851          * Range: CONF_WAKE_UP_EVENT_*
852          */
853         u8 suspend_wake_up_event;
854
855         /*
856          * Listen interval during suspend.
857          * Currently will be in DTIMs (1-10)
858          *
859          */
860         u8 suspend_listen_interval;
861
862         /*
863          * Enable or disable the beacon filtering.
864          *
865          * Range: CONF_BCN_FILT_MODE_*
866          */
867         u8 bcn_filt_mode;
868
869         /*
870          * Configure Beacon filter pass-thru rules.
871          */
872         u8 bcn_filt_ie_count;
873         struct conf_bcn_filt_rule bcn_filt_ie[CONF_MAX_BCN_FILT_IE_COUNT];
874
875         /*
876          * The number of consecutive beacons to lose, before the firmware
877          * becomes out of synch.
878          *
879          * Range: u32
880          */
881         u32 synch_fail_thold;
882
883         /*
884          * After out-of-synch, the number of TU's to wait without a further
885          * received beacon (or probe response) before issuing the BSS_EVENT_LOSE
886          * event.
887          *
888          * Range: u32
889          */
890         u32 bss_lose_timeout;
891
892         /*
893          * Beacon receive timeout.
894          *
895          * Range: u32
896          */
897         u32 beacon_rx_timeout;
898
899         /*
900          * Broadcast receive timeout.
901          *
902          * Range: u32
903          */
904         u32 broadcast_timeout;
905
906         /*
907          * Enable/disable reception of broadcast packets in power save mode
908          *
909          * Range: 1 - enable, 0 - disable
910          */
911         u8 rx_broadcast_in_ps;
912
913         /*
914          * Consecutive PS Poll failures before sending event to driver
915          *
916          * Range: u8
917          */
918         u8 ps_poll_threshold;
919
920         /*
921          * Configuration of signal average weights.
922          */
923         struct conf_sig_weights sig_weights;
924
925         /*
926          * Specifies if beacon early termination procedure is enabled or
927          * disabled.
928          *
929          * Range: CONF_BET_MODE_*
930          */
931         u8 bet_enable;
932
933         /*
934          * Specifies the maximum number of consecutive beacons that may be
935          * early terminated. After this number is reached at least one full
936          * beacon must be correctly received in FW before beacon ET
937          * resumes.
938          *
939          * Range 0 - 255
940          */
941         u8 bet_max_consecutive;
942
943         /*
944          * Specifies the maximum number of times to try PSM entry if it fails
945          * (if sending the appropriate null-func message fails.)
946          *
947          * Range 0 - 255
948          */
949         u8 psm_entry_retries;
950
951         /*
952          * Specifies the maximum number of times to try PSM exit if it fails
953          * (if sending the appropriate null-func message fails.)
954          *
955          * Range 0 - 255
956          */
957         u8 psm_exit_retries;
958
959         /*
960          * Specifies the maximum number of times to try transmit the PSM entry
961          * null-func frame for each PSM entry attempt
962          *
963          * Range 0 - 255
964          */
965         u8 psm_entry_nullfunc_retries;
966
967         /*
968          * Specifies the dynamic PS timeout in ms that will be used
969          * by the FW when in AUTO_PS mode
970          */
971         u16 dynamic_ps_timeout;
972
973         /*
974          * Specifies whether dynamic PS should be disabled and PSM forced.
975          * This is required for certain WiFi certification tests.
976          */
977         u8 forced_ps;
978
979         /*
980          *
981          * Specifies the interval of the connection keep-alive null-func
982          * frame in ms.
983          *
984          * Range: 1000 - 3600000
985          */
986         u32 keep_alive_interval;
987
988         /*
989          * Maximum listen interval supported by the driver in units of beacons.
990          *
991          * Range: u16
992          */
993         u8 max_listen_interval;
994
995         /*
996          * Default sleep authorization for a new STA interface. This determines
997          * whether we can go to ELP.
998          */
999         u8 sta_sleep_auth;
1000
1001         /*
1002          * Default RX BA Activity filter configuration
1003          */
1004         u8 suspend_rx_ba_activity;
1005 } __packed;
1006
1007 enum {
1008         CONF_REF_CLK_19_2_E,
1009         CONF_REF_CLK_26_E,
1010         CONF_REF_CLK_38_4_E,
1011         CONF_REF_CLK_52_E,
1012         CONF_REF_CLK_38_4_M_XTAL,
1013         CONF_REF_CLK_26_M_XTAL,
1014 };
1015
1016 enum single_dual_band_enum {
1017         CONF_SINGLE_BAND,
1018         CONF_DUAL_BAND
1019 };
1020
1021 #define CONF_RSSI_AND_PROCESS_COMPENSATION_SIZE 15
1022 #define CONF_NUMBER_OF_SUB_BANDS_5  7
1023 #define CONF_NUMBER_OF_RATE_GROUPS  6
1024 #define CONF_NUMBER_OF_CHANNELS_2_4 14
1025 #define CONF_NUMBER_OF_CHANNELS_5   35
1026
1027 struct conf_itrim_settings {
1028         /* enable dco itrim */
1029         u8 enable;
1030
1031         /* moderation timeout in microsecs from the last TX */
1032         u32 timeout;
1033 } __packed;
1034
1035 enum conf_fast_wakeup {
1036         CONF_FAST_WAKEUP_ENABLE,
1037         CONF_FAST_WAKEUP_DISABLE,
1038 };
1039
1040 struct conf_pm_config_settings {
1041         /*
1042          * Host clock settling time
1043          *
1044          * Range: 0 - 30000 us
1045          */
1046         u32 host_clk_settling_time;
1047
1048         /*
1049          * Host fast wakeup support
1050          *
1051          * Range: enum conf_fast_wakeup
1052          */
1053         u8 host_fast_wakeup_support;
1054 } __packed;
1055
1056 struct conf_roam_trigger_settings {
1057         /*
1058          * The minimum interval between two trigger events.
1059          *
1060          * Range: 0 - 60000 ms
1061          */
1062         u16 trigger_pacing;
1063
1064         /*
1065          * The weight for rssi/beacon average calculation
1066          *
1067          * Range: 0 - 255
1068          */
1069         u8 avg_weight_rssi_beacon;
1070
1071         /*
1072          * The weight for rssi/data frame average calculation
1073          *
1074          * Range: 0 - 255
1075          */
1076         u8 avg_weight_rssi_data;
1077
1078         /*
1079          * The weight for snr/beacon average calculation
1080          *
1081          * Range: 0 - 255
1082          */
1083         u8 avg_weight_snr_beacon;
1084
1085         /*
1086          * The weight for snr/data frame average calculation
1087          *
1088          * Range: 0 - 255
1089          */
1090         u8 avg_weight_snr_data;
1091 } __packed;
1092
1093 struct conf_scan_settings {
1094         /*
1095          * The minimum time to wait on each channel for active scans
1096          * This value will be used whenever there's a connected interface.
1097          *
1098          * Range: u32 tu/1000
1099          */
1100         u32 min_dwell_time_active;
1101
1102         /*
1103          * The maximum time to wait on each channel for active scans
1104          * This value will be currently used whenever there's a
1105          * connected interface. It shouldn't exceed 30000 (~30ms) to avoid
1106          * possible interference of voip traffic going on while scanning.
1107          *
1108          * Range: u32 tu/1000
1109          */
1110         u32 max_dwell_time_active;
1111
1112         /* The minimum time to wait on each channel for active scans
1113          * when it's possible to have longer scan dwell times.
1114          * Currently this is used whenever we're idle on all interfaces.
1115          * Longer dwell times improve detection of networks within a
1116          * single scan.
1117          *
1118          * Range: u32 tu/1000
1119          */
1120         u32 min_dwell_time_active_long;
1121
1122         /* The maximum time to wait on each channel for active scans
1123          * when it's possible to have longer scan dwell times.
1124          * See min_dwell_time_active_long
1125          *
1126          * Range: u32 tu/1000
1127          */
1128         u32 max_dwell_time_active_long;
1129
1130         /* time to wait on the channel for passive scans (in TU/1000) */
1131         u32 dwell_time_passive;
1132
1133         /* time to wait on the channel for DFS scans (in TU/1000) */
1134         u32 dwell_time_dfs;
1135
1136         /*
1137          * Number of probe requests to transmit on each active scan channel
1138          *
1139          * Range: u8
1140          */
1141         u16 num_probe_reqs;
1142
1143         /*
1144          * Scan trigger (split scan) timeout. The FW will split the scan
1145          * operation into slices of the given time and allow the FW to schedule
1146          * other tasks in between.
1147          *
1148          * Range: u32 Microsecs
1149          */
1150         u32 split_scan_timeout;
1151 } __packed;
1152
1153 struct conf_sched_scan_settings {
1154         /*
1155          * The base time to wait on the channel for active scans (in TU/1000).
1156          * The minimum dwell time is calculated according to this:
1157          * min_dwell_time = base + num_of_probes_to_be_sent * delta_per_probe
1158          * The maximum dwell time is calculated according to this:
1159          * max_dwell_time = min_dwell_time + max_dwell_time_delta
1160          */
1161         u32 base_dwell_time;
1162
1163         /* The delta between the min dwell time and max dwell time for
1164          * active scans (in TU/1000s). The max dwell time is used by the FW once
1165          * traffic is detected on the channel.
1166          */
1167         u32 max_dwell_time_delta;
1168
1169         /* Delta added to min dwell time per each probe in 2.4 GHz (TU/1000) */
1170         u32 dwell_time_delta_per_probe;
1171
1172         /* Delta added to min dwell time per each probe in 5 GHz (TU/1000) */
1173         u32 dwell_time_delta_per_probe_5;
1174
1175         /* time to wait on the channel for passive scans (in TU/1000) */
1176         u32 dwell_time_passive;
1177
1178         /* time to wait on the channel for DFS scans (in TU/1000) */
1179         u32 dwell_time_dfs;
1180
1181         /* number of probe requests to send on each channel in active scans */
1182         u8 num_probe_reqs;
1183
1184         /* RSSI threshold to be used for filtering */
1185         s8 rssi_threshold;
1186
1187         /* SNR threshold to be used for filtering */
1188         s8 snr_threshold;
1189 } __packed;
1190
1191 struct conf_ht_setting {
1192         u8 rx_ba_win_size;
1193         u8 tx_ba_win_size;
1194         u16 inactivity_timeout;
1195
1196         /* bitmap of enabled TIDs for TX BA sessions */
1197         u8 tx_ba_tid_bitmap;
1198 } __packed;
1199
1200 struct conf_memory_settings {
1201         /* Number of stations supported in IBSS mode */
1202         u8 num_stations;
1203
1204         /* Number of ssid profiles used in IBSS mode */
1205         u8 ssid_profiles;
1206
1207         /* Number of memory buffers allocated to rx pool */
1208         u8 rx_block_num;
1209
1210         /* Minimum number of blocks allocated to tx pool */
1211         u8 tx_min_block_num;
1212
1213         /* Disable/Enable dynamic memory */
1214         u8 dynamic_memory;
1215
1216         /*
1217          * Minimum required free tx memory blocks in order to assure optimum
1218          * performance
1219          *
1220          * Range: 0-120
1221          */
1222         u8 min_req_tx_blocks;
1223
1224         /*
1225          * Minimum required free rx memory blocks in order to assure optimum
1226          * performance
1227          *
1228          * Range: 0-120
1229          */
1230         u8 min_req_rx_blocks;
1231
1232         /*
1233          * Minimum number of mem blocks (free+used) guaranteed for TX
1234          *
1235          * Range: 0-120
1236          */
1237         u8 tx_min;
1238 } __packed;
1239
1240 struct conf_fm_coex {
1241         u8 enable;
1242         u8 swallow_period;
1243         u8 n_divider_fref_set_1;
1244         u8 n_divider_fref_set_2;
1245         u16 m_divider_fref_set_1;
1246         u16 m_divider_fref_set_2;
1247         u32 coex_pll_stabilization_time;
1248         u16 ldo_stabilization_time;
1249         u8 fm_disturbed_band_margin;
1250         u8 swallow_clk_diff;
1251 } __packed;
1252
1253 struct conf_rx_streaming_settings {
1254         /*
1255          * RX Streaming duration (in msec) from last tx/rx
1256          *
1257          * Range: u32
1258          */
1259         u32 duration;
1260
1261         /*
1262          * Bitmap of tids to be polled during RX streaming.
1263          * (Note: it doesn't look like it really matters)
1264          *
1265          * Range: 0x1-0xff
1266          */
1267         u8 queues;
1268
1269         /*
1270          * RX Streaming interval.
1271          * (Note:this value is also used as the rx streaming timeout)
1272          * Range: 0 (disabled), 10 - 100
1273          */
1274         u8 interval;
1275
1276         /*
1277          * enable rx streaming also when there is no coex activity
1278          */
1279         u8 always;
1280 } __packed;
1281
1282 #define CONF_FWLOG_MIN_MEM_BLOCKS       2
1283 #define CONF_FWLOG_MAX_MEM_BLOCKS       16
1284
1285 struct conf_fwlog {
1286         /* Continuous or on-demand */
1287         u8 mode;
1288
1289         /*
1290          * Number of memory blocks dedicated for the FW logger
1291          *
1292          * Range: 2-16, or 0 to disable the FW logger
1293          */
1294         u8 mem_blocks;
1295
1296         /* Minimum log level threshold */
1297         u8 severity;
1298
1299         /* Include/exclude timestamps from the log messages */
1300         u8 timestamp;
1301
1302         /* See enum wl1271_fwlogger_output */
1303         u8 output;
1304
1305         /* Regulates the frequency of log messages */
1306         u8 threshold;
1307 } __packed;
1308
1309 #define ACX_RATE_MGMT_NUM_OF_RATES 13
1310 struct conf_rate_policy_settings {
1311         u16 rate_retry_score;
1312         u16 per_add;
1313         u16 per_th1;
1314         u16 per_th2;
1315         u16 max_per;
1316         u8 inverse_curiosity_factor;
1317         u8 tx_fail_low_th;
1318         u8 tx_fail_high_th;
1319         u8 per_alpha_shift;
1320         u8 per_add_shift;
1321         u8 per_beta1_shift;
1322         u8 per_beta2_shift;
1323         u8 rate_check_up;
1324         u8 rate_check_down;
1325         u8 rate_retry_policy[ACX_RATE_MGMT_NUM_OF_RATES];
1326 } __packed;
1327
1328 struct conf_hangover_settings {
1329         u32 recover_time;
1330         u8 hangover_period;
1331         u8 dynamic_mode;
1332         u8 early_termination_mode;
1333         u8 max_period;
1334         u8 min_period;
1335         u8 increase_delta;
1336         u8 decrease_delta;
1337         u8 quiet_time;
1338         u8 increase_time;
1339         u8 window_size;
1340 } __packed;
1341
1342 struct conf_recovery_settings {
1343         /* BUG() on fw recovery */
1344         u8 bug_on_recovery;
1345
1346         /* Prevent HW recovery. FW will remain stuck. */
1347         u8 no_recovery;
1348 } __packed;
1349
1350 /*
1351  * The conf version consists of 4 bytes.  The two MSB are the wlcore
1352  * version, the two LSB are the lower driver's private conf
1353  * version.
1354  */
1355 #define WLCORE_CONF_VERSION     (0x0006 << 16)
1356 #define WLCORE_CONF_MASK        0xffff0000
1357 #define WLCORE_CONF_SIZE        (sizeof(struct wlcore_conf_header) +    \
1358                                  sizeof(struct wlcore_conf))
1359
1360 struct wlcore_conf_header {
1361         __le32 magic;
1362         __le32 version;
1363         __le32 checksum;
1364 } __packed;
1365
1366 struct wlcore_conf {
1367         struct conf_sg_settings sg;
1368         struct conf_rx_settings rx;
1369         struct conf_tx_settings tx;
1370         struct conf_conn_settings conn;
1371         struct conf_itrim_settings itrim;
1372         struct conf_pm_config_settings pm_config;
1373         struct conf_roam_trigger_settings roam_trigger;
1374         struct conf_scan_settings scan;
1375         struct conf_sched_scan_settings sched_scan;
1376         struct conf_ht_setting ht;
1377         struct conf_memory_settings mem;
1378         struct conf_fm_coex fm_coex;
1379         struct conf_rx_streaming_settings rx_streaming;
1380         struct conf_fwlog fwlog;
1381         struct conf_rate_policy_settings rate;
1382         struct conf_hangover_settings hangover;
1383         struct conf_recovery_settings recovery;
1384 } __packed;
1385
1386 struct wlcore_conf_file {
1387         struct wlcore_conf_header header;
1388         struct wlcore_conf core;
1389         u8 priv[0];
1390 } __packed;
1391
1392 #endif