aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
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 /drivers/net/wireless/iwlwifi/iwl-4965-rs.c
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>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-4965-rs.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965-rs.c65
1 files changed, 9 insertions, 56 deletions
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;