1 /******************************************************************************
3 * Copyright(c) 2005 - 2007 Intel Corporation. All rights reserved.
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.
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
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
18 * The full GNU General Public License is included in this distribution in the
19 * file called LICENSE.
21 * Contact Information:
22 * James P. Ketrenos <ipw2100-admin@linux.intel.com>
23 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
25 *****************************************************************************/
27 #ifndef __iwl_3945_rs_h__
28 #define __iwl_3945_rs_h__
30 struct iwl_rate_info
{
33 u8 prev_ieee
; /* previous rate in IEEE speeds */
34 u8 next_ieee
; /* next rate in IEEE speeds */
35 u8 prev_rs
; /* previous rate used in rs algo */
36 u8 next_rs
; /* next rate used in rs algo */
37 u8 prev_rs_tgg
; /* previous rate used in TGG rs algo */
38 u8 next_rs_tgg
; /* next rate used in TGG rs algo */
42 IWL_RATE_6M_INDEX
= 0,
56 IWL_RATE_INVALID
= IWL_RATE_INVM_INDEX
60 IWL_FIRST_OFDM_RATE
= IWL_RATE_6M_INDEX
,
61 IWL_LAST_OFDM_RATE
= IWL_RATE_54M_INDEX
,
62 IWL_FIRST_CCK_RATE
= IWL_RATE_1M_INDEX
,
63 IWL_LAST_CCK_RATE
= IWL_RATE_11M_INDEX
,
66 /* #define vs. enum to keep from defaulting to 'large integer' */
67 #define IWL_RATE_6M_MASK (1<<IWL_RATE_6M_INDEX)
68 #define IWL_RATE_9M_MASK (1<<IWL_RATE_9M_INDEX)
69 #define IWL_RATE_12M_MASK (1<<IWL_RATE_12M_INDEX)
70 #define IWL_RATE_18M_MASK (1<<IWL_RATE_18M_INDEX)
71 #define IWL_RATE_24M_MASK (1<<IWL_RATE_24M_INDEX)
72 #define IWL_RATE_36M_MASK (1<<IWL_RATE_36M_INDEX)
73 #define IWL_RATE_48M_MASK (1<<IWL_RATE_48M_INDEX)
74 #define IWL_RATE_54M_MASK (1<<IWL_RATE_54M_INDEX)
75 #define IWL_RATE_1M_MASK (1<<IWL_RATE_1M_INDEX)
76 #define IWL_RATE_2M_MASK (1<<IWL_RATE_2M_INDEX)
77 #define IWL_RATE_5M_MASK (1<<IWL_RATE_5M_INDEX)
78 #define IWL_RATE_11M_MASK (1<<IWL_RATE_11M_INDEX)
81 IWL_RATE_6M_PLCP
= 13,
82 IWL_RATE_9M_PLCP
= 15,
83 IWL_RATE_12M_PLCP
= 5,
84 IWL_RATE_18M_PLCP
= 7,
85 IWL_RATE_24M_PLCP
= 9,
86 IWL_RATE_36M_PLCP
= 11,
87 IWL_RATE_48M_PLCP
= 1,
88 IWL_RATE_54M_PLCP
= 3,
89 IWL_RATE_1M_PLCP
= 10,
90 IWL_RATE_2M_PLCP
= 20,
91 IWL_RATE_5M_PLCP
= 55,
92 IWL_RATE_11M_PLCP
= 110,
96 IWL_RATE_6M_IEEE
= 12,
97 IWL_RATE_9M_IEEE
= 18,
98 IWL_RATE_12M_IEEE
= 24,
99 IWL_RATE_18M_IEEE
= 36,
100 IWL_RATE_24M_IEEE
= 48,
101 IWL_RATE_36M_IEEE
= 72,
102 IWL_RATE_48M_IEEE
= 96,
103 IWL_RATE_54M_IEEE
= 108,
104 IWL_RATE_1M_IEEE
= 2,
105 IWL_RATE_2M_IEEE
= 4,
106 IWL_RATE_5M_IEEE
= 11,
107 IWL_RATE_11M_IEEE
= 22,
110 #define IWL_CCK_BASIC_RATES_MASK \
111 (IWL_RATE_1M_MASK | \
114 #define IWL_CCK_RATES_MASK \
115 (IWL_BASIC_RATES_MASK | \
119 #define IWL_OFDM_BASIC_RATES_MASK \
120 (IWL_RATE_6M_MASK | \
121 IWL_RATE_12M_MASK | \
124 #define IWL_OFDM_RATES_MASK \
125 (IWL_OFDM_BASIC_RATES_MASK | \
127 IWL_RATE_18M_MASK | \
128 IWL_RATE_36M_MASK | \
129 IWL_RATE_48M_MASK | \
132 #define IWL_BASIC_RATES_MASK \
133 (IWL_OFDM_BASIC_RATES_MASK | \
134 IWL_CCK_BASIC_RATES_MASK)
136 #define IWL_RATES_MASK ((1<<IWL_RATE_COUNT)-1)
138 #define IWL_INVALID_VALUE -1
140 #define IWL_MIN_RSSI_VAL -100
141 #define IWL_MAX_RSSI_VAL 0
143 extern const struct iwl_rate_info iwl_rates
[IWL_RATE_COUNT
];
145 static inline u8
iwl_get_prev_ieee_rate(u8 rate_index
)
147 u8 rate
= iwl_rates
[rate_index
].prev_ieee
;
149 if (rate
== IWL_RATE_INVALID
)
155 * iwl_fill_rs_info - Fill an output text buffer with the rate representation
157 * NOTE: This is provided as a quick mechanism for a user to visualize
158 * the performance of the rate control alogirthm and is not meant to be
161 extern int iwl_fill_rs_info(struct ieee80211_hw
*, char *buf
, u8 sta_id
);
164 * iwl_rate_scale_init - Initialize the rate scale table based on assoc info
166 * The specific througput table used is based on the type of network
167 * the associated with, including A, B, G, and G w/ TGG protection
169 extern void iwl_rate_scale_init(struct ieee80211_hw
*hw
, s32 sta_id
);
172 * iwl_rate_control_register - Register the rate control algorithm callbacks
174 * Since the rate control algorithm is hardware specific, there is no need
175 * or reason to place it as a stand alone module. The driver can call
176 * iwl_rate_control_register in order to register the rate control callbacks
177 * with the mac80211 subsystem. This should be performed prior to calling
178 * ieee80211_register_hw
181 extern void iwl_rate_control_register(struct ieee80211_hw
*hw
);
184 * iwl_rate_control_unregister - Unregister the rate control callbacks
186 * This should be called after calling ieee80211_unregister_hw, but before
187 * the driver is unloaded.
189 extern void iwl_rate_control_unregister(struct ieee80211_hw
*hw
);