aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/libertas/main.c')
-rw-r--r--drivers/net/wireless/libertas/main.c57
1 files changed, 44 insertions, 13 deletions
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index 26948595d952..03217f5537ad 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -150,29 +150,60 @@ static struct region_cfp_table region_cfp_table[] = {
150}; 150};
151 151
152/** 152/**
153 * the rates supported 153 * the table to keep region code
154 */ 154 */
155u8 libertas_supported_rates[G_SUPPORTED_RATES] = 155u16 libertas_region_code_to_index[MRVDRV_MAX_REGION_CODE] =
156 { 0x82, 0x84, 0x8b, 0x96, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6c, 156 { 0x10, 0x20, 0x30, 0x31, 0x32, 0x40 };
1570 };
158 157
159/** 158/**
160 * the rates supported for ad-hoc G mode 159 * 802.11b/g supported bitrates (in 500Kb/s units)
161 */ 160 */
162u8 libertas_adhoc_rates_g[G_SUPPORTED_RATES] = 161u8 libertas_bg_rates[MAX_RATES] =
163 { 0x82, 0x84, 0x8b, 0x96, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6c, 162 { 0x02, 0x04, 0x0b, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6c,
1640 }; 1630x00, 0x00 };
165 164
166/** 165/**
167 * the rates supported for ad-hoc B mode 166 * FW rate table. FW refers to rates by their index in this table, not by the
167 * rate value itself. Values of 0x00 are
168 * reserved positions.
168 */ 169 */
169u8 libertas_adhoc_rates_b[4] = { 0x82, 0x84, 0x8b, 0x96 }; 170static u8 fw_data_rates[MAX_RATES] =
171 { 0x02, 0x04, 0x0B, 0x16, 0x00, 0x0C, 0x12,
172 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x00
173};
170 174
171/** 175/**
172 * the table to keep region code 176 * @brief use index to get the data rate
177 *
178 * @param idx The index of data rate
179 * @return data rate or 0
173 */ 180 */
174u16 libertas_region_code_to_index[MRVDRV_MAX_REGION_CODE] = 181u32 libertas_fw_index_to_data_rate(u8 idx)
175 { 0x10, 0x20, 0x30, 0x31, 0x32, 0x40 }; 182{
183 if (idx >= sizeof(fw_data_rates))
184 idx = 0;
185 return fw_data_rates[idx];
186}
187
188/**
189 * @brief use rate to get the index
190 *
191 * @param rate data rate
192 * @return index or 0
193 */
194u8 libertas_data_rate_to_fw_index(u32 rate)
195{
196 u8 i;
197
198 if (!rate)
199 return 0;
200
201 for (i = 0; i < sizeof(fw_data_rates); i++) {
202 if (rate == fw_data_rates[i])
203 return i;
204 }
205 return 0;
206}
176 207
177/** 208/**
178 * Attributes exported through sysfs 209 * Attributes exported through sysfs