aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2008-04-15 19:01:40 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-04-16 16:00:00 -0400
commit66c73db7c6f7672e40c0bb1d2689f2d0d0922aad (patch)
tree0a3afbd37482fccf99f179388673e2011aec5661
parentec35cf2afb0d807c39188e3a9962ffa51f603024 (diff)
iwlwifi: move the creation of LQ host command to iwlcore
This patch moves creation of LQ host command to iwlcore from previous location in rate scaling. Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Ron Rindjunsky <ron.rindjunsky@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965-commands.h14
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965-rs.c65
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.h3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-sta.c48
5 files changed, 67 insertions, 65 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-commands.h b/drivers/net/wireless/iwlwifi/iwl-4965-commands.h
index 7aa7f0be8963..3bcd107e2d71 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965-commands.h
+++ b/drivers/net/wireless/iwlwifi/iwl-4965-commands.h
@@ -1413,11 +1413,11 @@ struct iwl4965_txpowertable_cmd {
1413 1413
1414 1414
1415/** 1415/**
1416 * struct iwl4965_link_qual_general_params 1416 * struct iwl_link_qual_general_params
1417 * 1417 *
1418 * Used in REPLY_TX_LINK_QUALITY_CMD 1418 * Used in REPLY_TX_LINK_QUALITY_CMD
1419 */ 1419 */
1420struct iwl4965_link_qual_general_params { 1420struct iwl_link_qual_general_params {
1421 u8 flags; 1421 u8 flags;
1422 1422
1423 /* No entries at or above this (driver chosen) index contain MIMO */ 1423 /* No entries at or above this (driver chosen) index contain MIMO */
@@ -1444,11 +1444,11 @@ struct iwl4965_link_qual_general_params {
1444} __attribute__ ((packed)); 1444} __attribute__ ((packed));
1445 1445
1446/** 1446/**
1447 * struct iwl4965_link_qual_agg_params 1447 * struct iwl_link_qual_agg_params
1448 * 1448 *
1449 * Used in REPLY_TX_LINK_QUALITY_CMD 1449 * Used in REPLY_TX_LINK_QUALITY_CMD
1450 */ 1450 */
1451struct iwl4965_link_qual_agg_params { 1451struct iwl_link_qual_agg_params {
1452 1452
1453 /* Maximum number of uSec in aggregation. 1453 /* Maximum number of uSec in aggregation.
1454 * Driver should set this to 4000 (4 milliseconds). */ 1454 * Driver should set this to 4000 (4 milliseconds). */
@@ -1658,14 +1658,14 @@ struct iwl4965_link_qual_agg_params {
1658 * legacy), and then repeat the search process. 1658 * legacy), and then repeat the search process.
1659 * 1659 *
1660 */ 1660 */
1661struct iwl4965_link_quality_cmd { 1661struct iwl_link_quality_cmd {
1662 1662
1663 /* Index of destination/recipient station in uCode's station table */ 1663 /* Index of destination/recipient station in uCode's station table */
1664 u8 sta_id; 1664 u8 sta_id;
1665 u8 reserved1; 1665 u8 reserved1;
1666 __le16 control; /* not used */ 1666 __le16 control; /* not used */
1667 struct iwl4965_link_qual_general_params general_params; 1667 struct iwl_link_qual_general_params general_params;
1668 struct iwl4965_link_qual_agg_params agg_params; 1668 struct iwl_link_qual_agg_params agg_params;
1669 1669
1670 /* 1670 /*
1671 * Rate info; when using rate-scaling, Tx command's initial_rate_index 1671 * Rate info; when using rate-scaling, Tx command's initial_rate_index
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
index 315b0433801e..b608e1ca8b40 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
@@ -150,7 +150,7 @@ struct iwl4965_lq_sta {
150 u16 active_mimo_rate; 150 u16 active_mimo_rate;
151 u16 active_rate_basic; 151 u16 active_rate_basic;
152 152
153 struct iwl4965_link_quality_cmd lq; 153 struct iwl_link_quality_cmd lq;
154 struct iwl4965_scale_tbl_info lq_info[LQ_SIZE]; /* "active", "search" */ 154 struct iwl4965_scale_tbl_info lq_info[LQ_SIZE]; /* "active", "search" */
155#ifdef CONFIG_IWL4965_HT 155#ifdef CONFIG_IWL4965_HT
156 struct iwl4965_traffic_load load[TID_MAX_LOAD_COUNT]; 156 struct iwl4965_traffic_load load[TID_MAX_LOAD_COUNT];
@@ -173,7 +173,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
173 struct sta_info *sta); 173 struct sta_info *sta);
174static void rs_fill_link_cmd(struct iwl4965_lq_sta *lq_sta, 174static void rs_fill_link_cmd(struct iwl4965_lq_sta *lq_sta,
175 struct iwl4965_rate *tx_mcs, 175 struct iwl4965_rate *tx_mcs,
176 struct iwl4965_link_quality_cmd *tbl); 176 struct iwl_link_quality_cmd *tbl);
177 177
178 178
179#ifdef CONFIG_MAC80211_DEBUGFS 179#ifdef CONFIG_MAC80211_DEBUGFS
@@ -230,58 +230,11 @@ static s32 expected_tpt_mimo40MHzSGI[IWL_RATE_COUNT] = {
230 0, 0, 0, 0, 131, 131, 191, 222, 242, 270, 284, 289, 293 230 0, 0, 0, 0, 131, 131, 191, 222, 242, 270, 284, 289, 293
231}; 231};
232 232
233static int iwl4965_lq_sync_callback(struct iwl_priv *priv,
234 struct iwl_cmd *cmd, struct sk_buff *skb)
235{
236 /*We didn't cache the SKB; let the caller free it */
237 return 1;
238}
239
240static inline u8 iwl4965_rate_get_rate(u32 rate_n_flags) 233static inline u8 iwl4965_rate_get_rate(u32 rate_n_flags)
241{ 234{
242 return (u8)(rate_n_flags & 0xFF); 235 return (u8)(rate_n_flags & 0xFF);
243} 236}
244 237
245static int rs_send_lq_cmd(struct iwl_priv *priv,
246 struct iwl4965_link_quality_cmd *lq, u8 flags)
247{
248#ifdef CONFIG_IWLWIFI_DEBUG
249 int i;
250#endif
251 struct iwl_host_cmd cmd = {
252 .id = REPLY_TX_LINK_QUALITY_CMD,
253 .len = sizeof(struct iwl4965_link_quality_cmd),
254 .meta.flags = flags,
255 .data = lq,
256 };
257
258 if ((lq->sta_id == 0xFF) &&
259 (priv->iw_mode == IEEE80211_IF_TYPE_IBSS))
260 return -EINVAL;
261
262 if (lq->sta_id == 0xFF)
263 lq->sta_id = IWL_AP_ID;
264
265 IWL_DEBUG_RATE("lq station id 0x%x\n", lq->sta_id);
266 IWL_DEBUG_RATE("lq dta 0x%X 0x%X\n",
267 lq->general_params.single_stream_ant_msk,
268 lq->general_params.dual_stream_ant_msk);
269#ifdef CONFIG_IWLWIFI_DEBUG
270 for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++)
271 IWL_DEBUG_RATE("lq index %d 0x%X\n",
272 i, lq->rs_table[i].rate_n_flags);
273#endif
274
275 if (flags & CMD_ASYNC)
276 cmd.meta.u.callback = iwl4965_lq_sync_callback;
277
278 if (iwl_is_associated(priv) && priv->assoc_station_added &&
279 priv->lq_mngr.lq_ready)
280 return iwl_send_cmd(priv, &cmd);
281
282 return 0;
283}
284
285static void rs_rate_scale_clear_window(struct iwl4965_rate_scale_data *window) 238static void rs_rate_scale_clear_window(struct iwl4965_rate_scale_data *window)
286{ 239{
287 window->data = 0; 240 window->data = 0;
@@ -819,7 +772,7 @@ static void rs_tx_status(void *priv_rate, struct net_device *dev,
819 u8 retries; 772 u8 retries;
820 int rs_index, index = 0; 773 int rs_index, index = 0;
821 struct iwl4965_lq_sta *lq_sta; 774 struct iwl4965_lq_sta *lq_sta;
822 struct iwl4965_link_quality_cmd *table; 775 struct iwl_link_quality_cmd *table;
823 struct sta_info *sta; 776 struct sta_info *sta;
824 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 777 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
825 struct iwl_priv *priv = (struct iwl_priv *)priv_rate; 778 struct iwl_priv *priv = (struct iwl_priv *)priv_rate;
@@ -1879,7 +1832,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
1879 if (update_lq) { 1832 if (update_lq) {
1880 rs_mcs_from_tbl(&mcs_rate, tbl, index, is_green); 1833 rs_mcs_from_tbl(&mcs_rate, tbl, index, is_green);
1881 rs_fill_link_cmd(lq_sta, &mcs_rate, &lq_sta->lq); 1834 rs_fill_link_cmd(lq_sta, &mcs_rate, &lq_sta->lq);
1882 rs_send_lq_cmd(priv, &lq_sta->lq, CMD_ASYNC); 1835 iwl_send_lq_cmd(priv, &lq_sta->lq, CMD_ASYNC);
1883 } 1836 }
1884 goto out; 1837 goto out;
1885 1838
@@ -2044,7 +1997,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
2044 if (update_lq) { 1997 if (update_lq) {
2045 rs_mcs_from_tbl(&mcs_rate, tbl, index, is_green); 1998 rs_mcs_from_tbl(&mcs_rate, tbl, index, is_green);
2046 rs_fill_link_cmd(lq_sta, &mcs_rate, &lq_sta->lq); 1999 rs_fill_link_cmd(lq_sta, &mcs_rate, &lq_sta->lq);
2047 rs_send_lq_cmd(priv, &lq_sta->lq, CMD_ASYNC); 2000 iwl_send_lq_cmd(priv, &lq_sta->lq, CMD_ASYNC);
2048 } 2001 }
2049 2002
2050 /* Should we stay with this modulation mode, or search for a new one? */ 2003 /* Should we stay with this modulation mode, or search for a new one? */
@@ -2084,7 +2037,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
2084 tbl->current_rate.rate_n_flags, index); 2037 tbl->current_rate.rate_n_flags, index);
2085 rs_fill_link_cmd(lq_sta, &tbl->current_rate, 2038 rs_fill_link_cmd(lq_sta, &tbl->current_rate,
2086 &lq_sta->lq); 2039 &lq_sta->lq);
2087 rs_send_lq_cmd(priv, &lq_sta->lq, CMD_ASYNC); 2040 iwl_send_lq_cmd(priv, &lq_sta->lq, CMD_ASYNC);
2088 } 2041 }
2089 2042
2090 /* If the "active" (non-search) mode was legacy, 2043 /* If the "active" (non-search) mode was legacy,
@@ -2197,7 +2150,7 @@ static void rs_initialize_lq(struct iwl_priv *priv,
2197 tbl->current_rate.rate_n_flags = mcs_rate.rate_n_flags; 2150 tbl->current_rate.rate_n_flags = mcs_rate.rate_n_flags;
2198 rs_get_expected_tpt_table(lq_sta, tbl); 2151 rs_get_expected_tpt_table(lq_sta, tbl);
2199 rs_fill_link_cmd(lq_sta, &mcs_rate, &lq_sta->lq); 2152 rs_fill_link_cmd(lq_sta, &mcs_rate, &lq_sta->lq);
2200 rs_send_lq_cmd(priv, &lq_sta->lq, CMD_ASYNC); 2153 iwl_send_lq_cmd(priv, &lq_sta->lq, CMD_ASYNC);
2201 out: 2154 out:
2202 return; 2155 return;
2203} 2156}
@@ -2392,7 +2345,7 @@ static void rs_rate_init(void *priv_rate, void *priv_sta,
2392 2345
2393static void rs_fill_link_cmd(struct iwl4965_lq_sta *lq_sta, 2346static void rs_fill_link_cmd(struct iwl4965_lq_sta *lq_sta,
2394 struct iwl4965_rate *tx_mcs, 2347 struct iwl4965_rate *tx_mcs,
2395 struct iwl4965_link_quality_cmd *lq_cmd) 2348 struct iwl_link_quality_cmd *lq_cmd)
2396{ 2349{
2397 int index = 0; 2350 int index = 0;
2398 int rate_idx; 2351 int rate_idx;
@@ -2591,7 +2544,7 @@ static ssize_t rs_sta_dbgfs_scale_table_write(struct file *file,
2591 2544
2592 if (lq_sta->dbg_fixed.rate_n_flags) { 2545 if (lq_sta->dbg_fixed.rate_n_flags) {
2593 rs_fill_link_cmd(lq_sta, &lq_sta->dbg_fixed, &lq_sta->lq); 2546 rs_fill_link_cmd(lq_sta, &lq_sta->dbg_fixed, &lq_sta->lq);
2594 rs_send_lq_cmd(lq_sta->drv, &lq_sta->lq, CMD_ASYNC); 2547 iwl_send_lq_cmd(lq_sta->drv, &lq_sta->lq, CMD_ASYNC);
2595 } 2548 }
2596 2549
2597 return count; 2550 return count;
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index e647be7608fc..8c8d7cffccfb 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -4484,7 +4484,7 @@ static int iwl4965_tx_queue_agg_enable(struct iwl_priv *priv, int txq_id,
4484void iwl4965_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap) 4484void iwl4965_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap)
4485{ 4485{
4486 int i, r; 4486 int i, r;
4487 struct iwl4965_link_quality_cmd link_cmd = { 4487 struct iwl_link_quality_cmd link_cmd = {
4488 .reserved1 = 0, 4488 .reserved1 = 0,
4489 }; 4489 };
4490 u16 rate_flags; 4490 u16 rate_flags;
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index 7791d2bd9645..0ff0978d6801 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -231,5 +231,6 @@ enum iwlcore_card_notify {
231int iwlcore_low_level_notify(struct iwl_priv *priv, 231int iwlcore_low_level_notify(struct iwl_priv *priv,
232 enum iwlcore_card_notify notify); 232 enum iwlcore_card_notify notify);
233extern int iwl_send_statistics_request(struct iwl_priv *priv, u8 flags); 233extern int iwl_send_statistics_request(struct iwl_priv *priv, u8 flags);
234 234int iwl_send_lq_cmd(struct iwl_priv *priv,
235 struct iwl_link_quality_cmd *lq, u8 flags);
235#endif /* __iwl_core_h__ */ 236#endif /* __iwl_core_h__ */
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c
index bc2e603efd28..0ccd1567f51f 100644
--- a/drivers/net/wireless/iwlwifi/iwl-sta.c
+++ b/drivers/net/wireless/iwlwifi/iwl-sta.c
@@ -303,3 +303,51 @@ int iwl_set_dynamic_key(struct iwl_priv *priv,
303 return ret; 303 return ret;
304} 304}
305 305
306#ifdef CONFIG_IWLWIFI_DEBUG
307static void iwl_dump_lq_cmd(struct iwl_priv *priv,
308 struct iwl_link_quality_cmd *lq)
309{
310 int i;
311 IWL_DEBUG_RATE("lq station id 0x%x\n", lq->sta_id);
312 IWL_DEBUG_RATE("lq dta 0x%X 0x%X\n",
313 lq->general_params.single_stream_ant_msk,
314 lq->general_params.dual_stream_ant_msk);
315
316 for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++)
317 IWL_DEBUG_RATE("lq index %d 0x%X\n",
318 i, lq->rs_table[i].rate_n_flags);
319}
320#else
321static inline void iwl_dump_lq_cmd(struct iwl_priv *priv,
322 struct iwl_link_quality_cmd *lq)
323{
324}
325#endif
326
327int iwl_send_lq_cmd(struct iwl_priv *priv,
328 struct iwl_link_quality_cmd *lq, u8 flags)
329{
330 struct iwl_host_cmd cmd = {
331 .id = REPLY_TX_LINK_QUALITY_CMD,
332 .len = sizeof(struct iwl_link_quality_cmd),
333 .meta.flags = flags,
334 .data = lq,
335 };
336
337 if ((lq->sta_id == 0xFF) &&
338 (priv->iw_mode == IEEE80211_IF_TYPE_IBSS))
339 return -EINVAL;
340
341 if (lq->sta_id == 0xFF)
342 lq->sta_id = IWL_AP_ID;
343
344 iwl_dump_lq_cmd(priv,lq);
345
346 if (iwl_is_associated(priv) && priv->assoc_station_added &&
347 priv->lq_mngr.lq_ready)
348 return iwl_send_cmd(priv, &cmd);
349
350 return 0;
351}
352EXPORT_SYMBOL(iwl_send_lq_cmd);
353