blob: 4282ed553b927da115820a40cb2ce5c79e8156ac [file] [log] [blame]
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001/******************************************************************************
2 *
3 * Copyright(c) 2003 - 2011 Intel Corporation. All rights reserved.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
17 *
18 * The full GNU General Public License is included in this distribution in the
19 * file called LICENSE.
20 *
21 * Contact Information:
22 * Intel Linux Wireless <ilw@linux.intel.com>
23 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
24 *
25 *****************************************************************************/
26
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +020027#ifndef __il_rs_h__
28#define __il_rs_h__
Wey-Yi Guybe663ab2011-02-21 11:27:26 -080029
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +020030struct il_rate_info {
31 u8 plcp; /* uCode API: IL_RATE_6M_PLCP, etc. */
32 u8 plcp_siso; /* uCode API: IL_RATE_SISO_6M_PLCP, etc. */
33 u8 plcp_mimo2; /* uCode API: IL_RATE_MIMO2_6M_PLCP, etc. */
34 u8 ieee; /* MAC header: IL_RATE_6M_IEEE, etc. */
Wey-Yi Guybe663ab2011-02-21 11:27:26 -080035 u8 prev_ieee; /* previous rate in IEEE speeds */
36 u8 next_ieee; /* next rate in IEEE speeds */
37 u8 prev_rs; /* previous rate used in rs algo */
38 u8 next_rs; /* next rate used in rs algo */
39 u8 prev_rs_tgg; /* previous rate used in TGG rs algo */
40 u8 next_rs_tgg; /* next rate used in TGG rs algo */
41};
42
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +020043struct il3945_rate_info {
44 u8 plcp; /* uCode API: IL_RATE_6M_PLCP, etc. */
45 u8 ieee; /* MAC header: IL_RATE_6M_IEEE, etc. */
Wey-Yi Guybe663ab2011-02-21 11:27:26 -080046 u8 prev_ieee; /* previous rate in IEEE speeds */
47 u8 next_ieee; /* next rate in IEEE speeds */
48 u8 prev_rs; /* previous rate used in rs algo */
49 u8 next_rs; /* next rate used in rs algo */
50 u8 prev_rs_tgg; /* previous rate used in TGG rs algo */
51 u8 next_rs_tgg; /* next rate used in TGG rs algo */
52 u8 table_rs_index; /* index in rate scale table cmd */
53 u8 prev_table_rs; /* prev in rate table cmd */
54};
55
56
57/*
58 * These serve as indexes into
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +020059 * struct il_rate_info iwlegacy_rates[IL_RATE_COUNT];
Wey-Yi Guybe663ab2011-02-21 11:27:26 -080060 */
61enum {
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +020062 IL_RATE_1M_INDEX = 0,
63 IL_RATE_2M_INDEX,
64 IL_RATE_5M_INDEX,
65 IL_RATE_11M_INDEX,
66 IL_RATE_6M_INDEX,
67 IL_RATE_9M_INDEX,
68 IL_RATE_12M_INDEX,
69 IL_RATE_18M_INDEX,
70 IL_RATE_24M_INDEX,
71 IL_RATE_36M_INDEX,
72 IL_RATE_48M_INDEX,
73 IL_RATE_54M_INDEX,
74 IL_RATE_60M_INDEX,
75 IL_RATE_COUNT,
76 IL_RATE_COUNT_LEGACY = IL_RATE_COUNT - 1, /* Excluding 60M */
77 IL_RATE_COUNT_3945 = IL_RATE_COUNT - 1,
78 IL_RATE_INVM_INDEX = IL_RATE_COUNT,
79 IL_RATE_INVALID = IL_RATE_COUNT,
Wey-Yi Guybe663ab2011-02-21 11:27:26 -080080};
81
82enum {
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +020083 IL_RATE_6M_INDEX_TABLE = 0,
84 IL_RATE_9M_INDEX_TABLE,
85 IL_RATE_12M_INDEX_TABLE,
86 IL_RATE_18M_INDEX_TABLE,
87 IL_RATE_24M_INDEX_TABLE,
88 IL_RATE_36M_INDEX_TABLE,
89 IL_RATE_48M_INDEX_TABLE,
90 IL_RATE_54M_INDEX_TABLE,
91 IL_RATE_1M_INDEX_TABLE,
92 IL_RATE_2M_INDEX_TABLE,
93 IL_RATE_5M_INDEX_TABLE,
94 IL_RATE_11M_INDEX_TABLE,
95 IL_RATE_INVM_INDEX_TABLE = IL_RATE_INVM_INDEX - 1,
Wey-Yi Guybe663ab2011-02-21 11:27:26 -080096};
97
98enum {
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +020099 IL_FIRST_OFDM_RATE = IL_RATE_6M_INDEX,
100 IWL39_LAST_OFDM_RATE = IL_RATE_54M_INDEX,
101 IL_LAST_OFDM_RATE = IL_RATE_60M_INDEX,
102 IL_FIRST_CCK_RATE = IL_RATE_1M_INDEX,
103 IL_LAST_CCK_RATE = IL_RATE_11M_INDEX,
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800104};
105
106/* #define vs. enum to keep from defaulting to 'large integer' */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200107#define IL_RATE_6M_MASK (1 << IL_RATE_6M_INDEX)
108#define IL_RATE_9M_MASK (1 << IL_RATE_9M_INDEX)
109#define IL_RATE_12M_MASK (1 << IL_RATE_12M_INDEX)
110#define IL_RATE_18M_MASK (1 << IL_RATE_18M_INDEX)
111#define IL_RATE_24M_MASK (1 << IL_RATE_24M_INDEX)
112#define IL_RATE_36M_MASK (1 << IL_RATE_36M_INDEX)
113#define IL_RATE_48M_MASK (1 << IL_RATE_48M_INDEX)
114#define IL_RATE_54M_MASK (1 << IL_RATE_54M_INDEX)
115#define IL_RATE_60M_MASK (1 << IL_RATE_60M_INDEX)
116#define IL_RATE_1M_MASK (1 << IL_RATE_1M_INDEX)
117#define IL_RATE_2M_MASK (1 << IL_RATE_2M_INDEX)
118#define IL_RATE_5M_MASK (1 << IL_RATE_5M_INDEX)
119#define IL_RATE_11M_MASK (1 << IL_RATE_11M_INDEX)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800120
121/* uCode API values for legacy bit rates, both OFDM and CCK */
122enum {
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200123 IL_RATE_6M_PLCP = 13,
124 IL_RATE_9M_PLCP = 15,
125 IL_RATE_12M_PLCP = 5,
126 IL_RATE_18M_PLCP = 7,
127 IL_RATE_24M_PLCP = 9,
128 IL_RATE_36M_PLCP = 11,
129 IL_RATE_48M_PLCP = 1,
130 IL_RATE_54M_PLCP = 3,
131 IL_RATE_60M_PLCP = 3,/*FIXME:RS:should be removed*/
132 IL_RATE_1M_PLCP = 10,
133 IL_RATE_2M_PLCP = 20,
134 IL_RATE_5M_PLCP = 55,
135 IL_RATE_11M_PLCP = 110,
136 /*FIXME:RS:add IL_RATE_LEGACY_INVM_PLCP = 0,*/
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800137};
138
139/* uCode API values for OFDM high-throughput (HT) bit rates */
140enum {
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200141 IL_RATE_SISO_6M_PLCP = 0,
142 IL_RATE_SISO_12M_PLCP = 1,
143 IL_RATE_SISO_18M_PLCP = 2,
144 IL_RATE_SISO_24M_PLCP = 3,
145 IL_RATE_SISO_36M_PLCP = 4,
146 IL_RATE_SISO_48M_PLCP = 5,
147 IL_RATE_SISO_54M_PLCP = 6,
148 IL_RATE_SISO_60M_PLCP = 7,
149 IL_RATE_MIMO2_6M_PLCP = 0x8,
150 IL_RATE_MIMO2_12M_PLCP = 0x9,
151 IL_RATE_MIMO2_18M_PLCP = 0xa,
152 IL_RATE_MIMO2_24M_PLCP = 0xb,
153 IL_RATE_MIMO2_36M_PLCP = 0xc,
154 IL_RATE_MIMO2_48M_PLCP = 0xd,
155 IL_RATE_MIMO2_54M_PLCP = 0xe,
156 IL_RATE_MIMO2_60M_PLCP = 0xf,
157 IL_RATE_SISO_INVM_PLCP,
158 IL_RATE_MIMO2_INVM_PLCP = IL_RATE_SISO_INVM_PLCP,
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800159};
160
161/* MAC header values for bit rates */
162enum {
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200163 IL_RATE_6M_IEEE = 12,
164 IL_RATE_9M_IEEE = 18,
165 IL_RATE_12M_IEEE = 24,
166 IL_RATE_18M_IEEE = 36,
167 IL_RATE_24M_IEEE = 48,
168 IL_RATE_36M_IEEE = 72,
169 IL_RATE_48M_IEEE = 96,
170 IL_RATE_54M_IEEE = 108,
171 IL_RATE_60M_IEEE = 120,
172 IL_RATE_1M_IEEE = 2,
173 IL_RATE_2M_IEEE = 4,
174 IL_RATE_5M_IEEE = 11,
175 IL_RATE_11M_IEEE = 22,
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800176};
177
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200178#define IL_CCK_BASIC_RATES_MASK \
179 (IL_RATE_1M_MASK | \
180 IL_RATE_2M_MASK)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800181
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200182#define IL_CCK_RATES_MASK \
183 (IL_CCK_BASIC_RATES_MASK | \
184 IL_RATE_5M_MASK | \
185 IL_RATE_11M_MASK)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800186
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200187#define IL_OFDM_BASIC_RATES_MASK \
188 (IL_RATE_6M_MASK | \
189 IL_RATE_12M_MASK | \
190 IL_RATE_24M_MASK)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800191
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200192#define IL_OFDM_RATES_MASK \
193 (IL_OFDM_BASIC_RATES_MASK | \
194 IL_RATE_9M_MASK | \
195 IL_RATE_18M_MASK | \
196 IL_RATE_36M_MASK | \
197 IL_RATE_48M_MASK | \
198 IL_RATE_54M_MASK)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800199
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200200#define IL_BASIC_RATES_MASK \
201 (IL_OFDM_BASIC_RATES_MASK | \
202 IL_CCK_BASIC_RATES_MASK)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800203
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200204#define IL_RATES_MASK ((1 << IL_RATE_COUNT) - 1)
205#define IL_RATES_MASK_3945 ((1 << IL_RATE_COUNT_3945) - 1)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800206
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200207#define IL_INVALID_VALUE -1
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800208
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200209#define IL_MIN_RSSI_VAL -100
210#define IL_MAX_RSSI_VAL 0
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800211
212/* These values specify how many Tx frame attempts before
213 * searching for a new modulation mode */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200214#define IL_LEGACY_FAILURE_LIMIT 160
215#define IL_LEGACY_SUCCESS_LIMIT 480
216#define IL_LEGACY_TABLE_COUNT 160
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800217
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200218#define IL_NONE_LEGACY_FAILURE_LIMIT 400
219#define IL_NONE_LEGACY_SUCCESS_LIMIT 4500
220#define IL_NONE_LEGACY_TABLE_COUNT 1500
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800221
222/* Success ratio (ACKed / attempted tx frames) values (perfect is 128 * 100) */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200223#define IL_RS_GOOD_RATIO 12800 /* 100% */
224#define IL_RATE_SCALE_SWITCH 10880 /* 85% */
225#define IL_RATE_HIGH_TH 10880 /* 85% */
226#define IL_RATE_INCREASE_TH 6400 /* 50% */
227#define IL_RATE_DECREASE_TH 1920 /* 15% */
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800228
229/* possible actions when in legacy mode */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200230#define IL_LEGACY_SWITCH_ANTENNA1 0
231#define IL_LEGACY_SWITCH_ANTENNA2 1
232#define IL_LEGACY_SWITCH_SISO 2
233#define IL_LEGACY_SWITCH_MIMO2_AB 3
234#define IL_LEGACY_SWITCH_MIMO2_AC 4
235#define IL_LEGACY_SWITCH_MIMO2_BC 5
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800236
237/* possible actions when in siso mode */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200238#define IL_SISO_SWITCH_ANTENNA1 0
239#define IL_SISO_SWITCH_ANTENNA2 1
240#define IL_SISO_SWITCH_MIMO2_AB 2
241#define IL_SISO_SWITCH_MIMO2_AC 3
242#define IL_SISO_SWITCH_MIMO2_BC 4
243#define IL_SISO_SWITCH_GI 5
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800244
245/* possible actions when in mimo mode */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200246#define IL_MIMO2_SWITCH_ANTENNA1 0
247#define IL_MIMO2_SWITCH_ANTENNA2 1
248#define IL_MIMO2_SWITCH_SISO_A 2
249#define IL_MIMO2_SWITCH_SISO_B 3
250#define IL_MIMO2_SWITCH_SISO_C 4
251#define IL_MIMO2_SWITCH_GI 5
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800252
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200253#define IL_MAX_SEARCH IL_MIMO2_SWITCH_GI
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800254
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200255#define IL_ACTION_LIMIT 3 /* # possible actions */
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800256
257#define LQ_SIZE 2 /* 2 mode tables: "Active" and "Search" */
258
259/* load per tid defines for A-MPDU activation */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200260#define IL_AGG_TPT_THREHOLD 0
261#define IL_AGG_LOAD_THRESHOLD 10
262#define IL_AGG_ALL_TID 0xff
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800263#define TID_QUEUE_CELL_SPACING 50 /*mS */
264#define TID_QUEUE_MAX_SIZE 20
265#define TID_ROUND_VALUE 5 /* mS */
266#define TID_MAX_LOAD_COUNT 8
267
268#define TID_MAX_TIME_DIFF ((TID_QUEUE_MAX_SIZE - 1) * TID_QUEUE_CELL_SPACING)
269#define TIME_WRAP_AROUND(x, y) (((y) > (x)) ? (y) - (x) : (0-(x)) + (y))
270
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200271extern const struct il_rate_info iwlegacy_rates[IL_RATE_COUNT];
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800272
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200273enum il_table_type {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800274 LQ_NONE,
275 LQ_G, /* legacy types */
276 LQ_A,
277 LQ_SISO, /* high-throughput types */
278 LQ_MIMO2,
279 LQ_MAX,
280};
281
282#define is_legacy(tbl) (((tbl) == LQ_G) || ((tbl) == LQ_A))
283#define is_siso(tbl) ((tbl) == LQ_SISO)
284#define is_mimo2(tbl) ((tbl) == LQ_MIMO2)
285#define is_mimo(tbl) (is_mimo2(tbl))
286#define is_Ht(tbl) (is_siso(tbl) || is_mimo(tbl))
287#define is_a_band(tbl) ((tbl) == LQ_A)
288#define is_g_and(tbl) ((tbl) == LQ_G)
289
290#define ANT_NONE 0x0
291#define ANT_A BIT(0)
292#define ANT_B BIT(1)
293#define ANT_AB (ANT_A | ANT_B)
294#define ANT_C BIT(2)
295#define ANT_AC (ANT_A | ANT_C)
296#define ANT_BC (ANT_B | ANT_C)
297#define ANT_ABC (ANT_AB | ANT_C)
298
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200299#define IL_MAX_MCS_DISPLAY_SIZE 12
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800300
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200301struct il_rate_mcs_info {
302 char mbps[IL_MAX_MCS_DISPLAY_SIZE];
303 char mcs[IL_MAX_MCS_DISPLAY_SIZE];
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800304};
305
306/**
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200307 * struct il_rate_scale_data -- tx success history for one rate
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800308 */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200309struct il_rate_scale_data {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800310 u64 data; /* bitmap of successful frames */
311 s32 success_counter; /* number of frames successful */
312 s32 success_ratio; /* per-cent * 128 */
313 s32 counter; /* number of frames attempted */
314 s32 average_tpt; /* success ratio * expected throughput */
315 unsigned long stamp;
316};
317
318/**
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200319 * struct il_scale_tbl_info -- tx params and success history for all rates
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800320 *
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200321 * There are two of these in struct il_lq_sta,
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800322 * one for "active", and one for "search".
323 */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200324struct il_scale_tbl_info {
325 enum il_table_type lq_type;
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800326 u8 ant_type;
327 u8 is_SGI; /* 1 = short guard interval */
328 u8 is_ht40; /* 1 = 40 MHz channel width */
329 u8 is_dup; /* 1 = duplicated data streams */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200330 u8 action; /* change modulation; IL_[LEGACY/SISO/MIMO]_SWITCH_* */
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800331 u8 max_search; /* maximun number of tables we can search */
332 s32 *expected_tpt; /* throughput metrics; expected_tpt_G, etc. */
333 u32 current_rate; /* rate_n_flags, uCode API format */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200334 struct il_rate_scale_data win[IL_RATE_COUNT]; /* rate histories */
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800335};
336
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200337struct il_traffic_load {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800338 unsigned long time_stamp; /* age of the oldest statistics */
339 u32 packet_count[TID_QUEUE_MAX_SIZE]; /* packet count in this time
340 * slice */
341 u32 total; /* total num of packets during the
342 * last TID_MAX_TIME_DIFF */
343 u8 queue_count; /* number of queues that has
344 * been used since the last cleanup */
345 u8 head; /* start of the circular buffer */
346};
347
348/**
Stanislaw Gruszka46bc8d42011-10-24 16:49:25 +0200349 * struct il_lq_sta -- driver's rate scaling ilate structure
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800350 *
351 * Pointer to this gets passed back and forth between driver and mac80211.
352 */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200353struct il_lq_sta {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800354 u8 active_tbl; /* index of active table, range 0-1 */
355 u8 enable_counter; /* indicates HT mode */
356 u8 stay_in_tbl; /* 1: disallow, 0: allow search for new mode */
357 u8 search_better_tbl; /* 1: currently trying alternate mode */
358 s32 last_tpt;
359
360 /* The following determine when to search for a new mode */
361 u32 table_count_limit;
362 u32 max_failure_limit; /* # failed frames before new search */
363 u32 max_success_limit; /* # successful frames before new search */
364 u32 table_count;
365 u32 total_failed; /* total failed frames, any/all rates */
366 u32 total_success; /* total successful frames, any/all rates */
367 u64 flush_timer; /* time staying in mode before new search */
368
369 u8 action_counter; /* # mode-switch actions tried */
370 u8 is_green;
371 u8 is_dup;
372 enum ieee80211_band band;
373
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200374 /* The following are bitmaps of rates; IL_RATE_6M_MASK, etc. */
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800375 u32 supp_rates;
376 u16 active_legacy_rate;
377 u16 active_siso_rate;
378 u16 active_mimo2_rate;
379 s8 max_rate_idx; /* Max rate set by user */
380 u8 missed_rate_counter;
381
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200382 struct il_link_quality_cmd lq;
383 struct il_scale_tbl_info lq_info[LQ_SIZE]; /* "active", "search" */
384 struct il_traffic_load load[TID_MAX_LOAD_COUNT];
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800385 u8 tx_agg_tid_en;
386#ifdef CONFIG_MAC80211_DEBUGFS
387 struct dentry *rs_sta_dbgfs_scale_table_file;
388 struct dentry *rs_sta_dbgfs_stats_table_file;
389 struct dentry *rs_sta_dbgfs_rate_scale_data_file;
390 struct dentry *rs_sta_dbgfs_tx_agg_tid_en_file;
391 u32 dbg_fixed_rate;
392#endif
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200393 struct il_priv *drv;
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800394
395 /* used to be in sta_info */
396 int last_txrate_idx;
397 /* last tx rate_n_flags */
398 u32 last_rate_n_flags;
399 /* packets destined for this STA are aggregated */
400 u8 is_agg;
401};
402
Stanislaw Gruszka46bc8d42011-10-24 16:49:25 +0200403static inline u8 il4965_num_of_ant(u8 m)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800404{
Stanislaw Gruszka46bc8d42011-10-24 16:49:25 +0200405 return !!(m & ANT_A) + !!(m & ANT_B) + !!(m & ANT_C);
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800406}
407
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200408static inline u8 il4965_first_antenna(u8 mask)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800409{
410 if (mask & ANT_A)
411 return ANT_A;
412 if (mask & ANT_B)
413 return ANT_B;
414 return ANT_C;
415}
416
417
418/**
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200419 * il3945_rate_scale_init - Initialize the rate scale table based on assoc info
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800420 *
421 * The specific throughput table used is based on the type of network
422 * the associated with, including A, B, G, and G w/ TGG protection
423 */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200424extern void il3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id);
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800425
426/* Initialize station's rate scaling information after adding station */
Stanislaw Gruszka46bc8d42011-10-24 16:49:25 +0200427extern void il4965_rs_rate_init(struct il_priv *il,
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800428 struct ieee80211_sta *sta, u8 sta_id);
Stanislaw Gruszka46bc8d42011-10-24 16:49:25 +0200429extern void il3945_rs_rate_init(struct il_priv *il,
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800430 struct ieee80211_sta *sta, u8 sta_id);
431
432/**
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200433 * il_rate_control_register - Register the rate control algorithm callbacks
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800434 *
435 * Since the rate control algorithm is hardware specific, there is no need
436 * or reason to place it as a stand alone module. The driver can call
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200437 * il_rate_control_register in order to register the rate control callbacks
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800438 * with the mac80211 subsystem. This should be performed prior to calling
439 * ieee80211_register_hw
440 *
441 */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200442extern int il4965_rate_control_register(void);
443extern int il3945_rate_control_register(void);
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800444
445/**
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200446 * il_rate_control_unregister - Unregister the rate control callbacks
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800447 *
448 * This should be called after calling ieee80211_unregister_hw, but before
449 * the driver is unloaded.
450 */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200451extern void il4965_rate_control_unregister(void);
452extern void il3945_rate_control_unregister(void);
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800453
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200454#endif /* __il_rs__ */