diff options
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-agn-rs.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn-rs.c | 208 |
1 files changed, 102 insertions, 106 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c index 1460116d329f..cf4a95bae4ff 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c | |||
@@ -295,11 +295,11 @@ static u32 rs_tl_get_load(struct iwl_lq_sta *lq_data, u8 tid) | |||
295 | return tl->total; | 295 | return tl->total; |
296 | } | 296 | } |
297 | 297 | ||
298 | static void rs_tl_turn_on_agg_for_tid(struct iwl_priv *priv, | 298 | static int rs_tl_turn_on_agg_for_tid(struct iwl_priv *priv, |
299 | struct iwl_lq_sta *lq_data, u8 tid, | 299 | struct iwl_lq_sta *lq_data, u8 tid, |
300 | struct ieee80211_sta *sta) | 300 | struct ieee80211_sta *sta) |
301 | { | 301 | { |
302 | int ret; | 302 | int ret = -EAGAIN; |
303 | 303 | ||
304 | if (rs_tl_get_load(lq_data, tid) > IWL_AGG_LOAD_THRESHOLD) { | 304 | if (rs_tl_get_load(lq_data, tid) > IWL_AGG_LOAD_THRESHOLD) { |
305 | IWL_DEBUG_HT(priv, "Starting Tx agg: STA: %pM tid: %d\n", | 305 | IWL_DEBUG_HT(priv, "Starting Tx agg: STA: %pM tid: %d\n", |
@@ -313,29 +313,29 @@ static void rs_tl_turn_on_agg_for_tid(struct iwl_priv *priv, | |||
313 | */ | 313 | */ |
314 | IWL_DEBUG_HT(priv, "Fail start Tx agg on tid: %d\n", | 314 | IWL_DEBUG_HT(priv, "Fail start Tx agg on tid: %d\n", |
315 | tid); | 315 | tid); |
316 | ret = ieee80211_stop_tx_ba_session(sta, tid, | 316 | ieee80211_stop_tx_ba_session(sta, tid, |
317 | WLAN_BACK_INITIATOR); | 317 | WLAN_BACK_INITIATOR); |
318 | } | 318 | } |
319 | } | 319 | } else |
320 | IWL_ERR(priv, "Fail finding valid aggregation tid: %d\n", tid); | ||
321 | return ret; | ||
320 | } | 322 | } |
321 | 323 | ||
322 | static void rs_tl_turn_on_agg(struct iwl_priv *priv, u8 tid, | 324 | static void rs_tl_turn_on_agg(struct iwl_priv *priv, u8 tid, |
323 | struct iwl_lq_sta *lq_data, | 325 | struct iwl_lq_sta *lq_data, |
324 | struct ieee80211_sta *sta) | 326 | struct ieee80211_sta *sta) |
325 | { | 327 | { |
326 | if ((tid < TID_MAX_LOAD_COUNT)) | 328 | if ((tid < TID_MAX_LOAD_COUNT) && |
327 | rs_tl_turn_on_agg_for_tid(priv, lq_data, tid, sta); | 329 | !rs_tl_turn_on_agg_for_tid(priv, lq_data, tid, sta)) { |
328 | else if (tid == IWL_AGG_ALL_TID) | 330 | if (priv->cfg->use_rts_for_ht) { |
329 | for (tid = 0; tid < TID_MAX_LOAD_COUNT; tid++) | 331 | /* |
330 | rs_tl_turn_on_agg_for_tid(priv, lq_data, tid, sta); | 332 | * switch to RTS/CTS if it is the prefer protection |
331 | if (priv->cfg->use_rts_for_ht) { | 333 | * method for HT traffic |
332 | /* | 334 | */ |
333 | * switch to RTS/CTS if it is the prefer protection method | 335 | IWL_DEBUG_HT(priv, "use RTS/CTS protection for HT\n"); |
334 | * for HT traffic | 336 | priv->staging_rxon.flags &= ~RXON_FLG_SELF_CTS_EN; |
335 | */ | 337 | iwlcore_commit_rxon(priv); |
336 | IWL_DEBUG_HT(priv, "use RTS/CTS protection for HT\n"); | 338 | } |
337 | priv->staging_rxon.flags &= ~RXON_FLG_SELF_CTS_EN; | ||
338 | iwlcore_commit_rxon(priv); | ||
339 | } | 339 | } |
340 | } | 340 | } |
341 | 341 | ||
@@ -611,10 +611,6 @@ static u16 rs_get_supported_rates(struct iwl_lq_sta *lq_sta, | |||
611 | struct ieee80211_hdr *hdr, | 611 | struct ieee80211_hdr *hdr, |
612 | enum iwl_table_type rate_type) | 612 | enum iwl_table_type rate_type) |
613 | { | 613 | { |
614 | if (hdr && is_multicast_ether_addr(hdr->addr1) && | ||
615 | lq_sta->active_rate_basic) | ||
616 | return lq_sta->active_rate_basic; | ||
617 | |||
618 | if (is_legacy(rate_type)) { | 614 | if (is_legacy(rate_type)) { |
619 | return lq_sta->active_legacy_rate; | 615 | return lq_sta->active_legacy_rate; |
620 | } else { | 616 | } else { |
@@ -775,6 +771,15 @@ static void rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband, | |||
775 | 771 | ||
776 | IWL_DEBUG_RATE_LIMIT(priv, "get frame ack response, update rate scale window\n"); | 772 | IWL_DEBUG_RATE_LIMIT(priv, "get frame ack response, update rate scale window\n"); |
777 | 773 | ||
774 | /* Treat uninitialized rate scaling data same as non-existing. */ | ||
775 | if (!lq_sta) { | ||
776 | IWL_DEBUG_RATE(priv, "Station rate scaling not created yet.\n"); | ||
777 | return; | ||
778 | } else if (!lq_sta->drv) { | ||
779 | IWL_DEBUG_RATE(priv, "Rate scaling not initialized yet.\n"); | ||
780 | return; | ||
781 | } | ||
782 | |||
778 | if (!ieee80211_is_data(hdr->frame_control) || | 783 | if (!ieee80211_is_data(hdr->frame_control) || |
779 | info->flags & IEEE80211_TX_CTL_NO_ACK) | 784 | info->flags & IEEE80211_TX_CTL_NO_ACK) |
780 | return; | 785 | return; |
@@ -784,10 +789,6 @@ static void rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband, | |||
784 | !(info->flags & IEEE80211_TX_STAT_AMPDU)) | 789 | !(info->flags & IEEE80211_TX_STAT_AMPDU)) |
785 | return; | 790 | return; |
786 | 791 | ||
787 | if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) && | ||
788 | !lq_sta->ibss_sta_added) | ||
789 | return; | ||
790 | |||
791 | /* | 792 | /* |
792 | * Ignore this Tx frame response if its initial rate doesn't match | 793 | * Ignore this Tx frame response if its initial rate doesn't match |
793 | * that of latest Link Quality command. There may be stragglers | 794 | * that of latest Link Quality command. There may be stragglers |
@@ -833,7 +834,7 @@ static void rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband, | |||
833 | lq_sta->missed_rate_counter++; | 834 | lq_sta->missed_rate_counter++; |
834 | if (lq_sta->missed_rate_counter > IWL_MISSED_RATE_MAX) { | 835 | if (lq_sta->missed_rate_counter > IWL_MISSED_RATE_MAX) { |
835 | lq_sta->missed_rate_counter = 0; | 836 | lq_sta->missed_rate_counter = 0; |
836 | iwl_send_lq_cmd(priv, &lq_sta->lq, CMD_ASYNC); | 837 | iwl_send_lq_cmd(priv, &lq_sta->lq, CMD_ASYNC, false); |
837 | } | 838 | } |
838 | /* Regardless, ignore this status info for outdated rate */ | 839 | /* Regardless, ignore this status info for outdated rate */ |
839 | return; | 840 | return; |
@@ -867,14 +868,14 @@ static void rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband, | |||
867 | rs_get_tbl_info_from_mcs(tx_rate, priv->band, &tbl_type, | 868 | rs_get_tbl_info_from_mcs(tx_rate, priv->band, &tbl_type, |
868 | &rs_index); | 869 | &rs_index); |
869 | rs_collect_tx_data(curr_tbl, rs_index, | 870 | rs_collect_tx_data(curr_tbl, rs_index, |
870 | info->status.ampdu_ack_len, | 871 | info->status.ampdu_len, |
871 | info->status.ampdu_ack_map); | 872 | info->status.ampdu_ack_len); |
872 | 873 | ||
873 | /* Update success/fail counts if not searching for new mode */ | 874 | /* Update success/fail counts if not searching for new mode */ |
874 | if (lq_sta->stay_in_tbl) { | 875 | if (lq_sta->stay_in_tbl) { |
875 | lq_sta->total_success += info->status.ampdu_ack_map; | 876 | lq_sta->total_success += info->status.ampdu_ack_len; |
876 | lq_sta->total_failed += (info->status.ampdu_ack_len - | 877 | lq_sta->total_failed += (info->status.ampdu_len - |
877 | info->status.ampdu_ack_map); | 878 | info->status.ampdu_ack_len); |
878 | } | 879 | } |
879 | } else { | 880 | } else { |
880 | /* | 881 | /* |
@@ -1913,7 +1914,7 @@ static u32 rs_update_rate_tbl(struct iwl_priv *priv, | |||
1913 | /* Update uCode's rate table. */ | 1914 | /* Update uCode's rate table. */ |
1914 | rate = rate_n_flags_from_tbl(priv, tbl, index, is_green); | 1915 | rate = rate_n_flags_from_tbl(priv, tbl, index, is_green); |
1915 | rs_fill_link_cmd(priv, lq_sta, rate); | 1916 | rs_fill_link_cmd(priv, lq_sta, rate); |
1916 | iwl_send_lq_cmd(priv, &lq_sta->lq, CMD_ASYNC); | 1917 | iwl_send_lq_cmd(priv, &lq_sta->lq, CMD_ASYNC, false); |
1917 | 1918 | ||
1918 | return rate; | 1919 | return rate; |
1919 | } | 1920 | } |
@@ -2002,7 +2003,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, | |||
2002 | /* rates available for this association, and for modulation mode */ | 2003 | /* rates available for this association, and for modulation mode */ |
2003 | rate_mask = rs_get_supported_rates(lq_sta, hdr, tbl->lq_type); | 2004 | rate_mask = rs_get_supported_rates(lq_sta, hdr, tbl->lq_type); |
2004 | 2005 | ||
2005 | IWL_DEBUG_RATE(priv, "mask 0x%04X \n", rate_mask); | 2006 | IWL_DEBUG_RATE(priv, "mask 0x%04X\n", rate_mask); |
2006 | 2007 | ||
2007 | /* mask with station rate restriction */ | 2008 | /* mask with station rate restriction */ |
2008 | if (is_legacy(tbl->lq_type)) { | 2009 | if (is_legacy(tbl->lq_type)) { |
@@ -2077,10 +2078,12 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, | |||
2077 | } | 2078 | } |
2078 | /* Else we have enough samples; calculate estimate of | 2079 | /* Else we have enough samples; calculate estimate of |
2079 | * actual average throughput */ | 2080 | * actual average throughput */ |
2080 | 2081 | if (window->average_tpt != ((window->success_ratio * | |
2081 | /* Sanity-check TPT calculations */ | 2082 | tbl->expected_tpt[index] + 64) / 128)) { |
2082 | BUG_ON(window->average_tpt != ((window->success_ratio * | 2083 | IWL_ERR(priv, "expected_tpt should have been calculated by now\n"); |
2083 | tbl->expected_tpt[index] + 64) / 128)); | 2084 | window->average_tpt = ((window->success_ratio * |
2085 | tbl->expected_tpt[index] + 64) / 128); | ||
2086 | } | ||
2084 | 2087 | ||
2085 | /* If we are searching for better modulation mode, check success. */ | 2088 | /* If we are searching for better modulation mode, check success. */ |
2086 | if (lq_sta->search_better_tbl && | 2089 | if (lq_sta->search_better_tbl && |
@@ -2289,7 +2292,7 @@ lq_update: | |||
2289 | IWL_DEBUG_RATE(priv, "Switch current mcs: %X index: %d\n", | 2292 | IWL_DEBUG_RATE(priv, "Switch current mcs: %X index: %d\n", |
2290 | tbl->current_rate, index); | 2293 | tbl->current_rate, index); |
2291 | rs_fill_link_cmd(priv, lq_sta, tbl->current_rate); | 2294 | rs_fill_link_cmd(priv, lq_sta, tbl->current_rate); |
2292 | iwl_send_lq_cmd(priv, &lq_sta->lq, CMD_ASYNC); | 2295 | iwl_send_lq_cmd(priv, &lq_sta->lq, CMD_ASYNC, false); |
2293 | } else | 2296 | } else |
2294 | done_search = 1; | 2297 | done_search = 1; |
2295 | } | 2298 | } |
@@ -2334,11 +2337,22 @@ out: | |||
2334 | tbl->current_rate = rate_n_flags_from_tbl(priv, tbl, index, is_green); | 2337 | tbl->current_rate = rate_n_flags_from_tbl(priv, tbl, index, is_green); |
2335 | i = index; | 2338 | i = index; |
2336 | lq_sta->last_txrate_idx = i; | 2339 | lq_sta->last_txrate_idx = i; |
2337 | |||
2338 | return; | ||
2339 | } | 2340 | } |
2340 | 2341 | ||
2341 | 2342 | /** | |
2343 | * rs_initialize_lq - Initialize a station's hardware rate table | ||
2344 | * | ||
2345 | * The uCode's station table contains a table of fallback rates | ||
2346 | * for automatic fallback during transmission. | ||
2347 | * | ||
2348 | * NOTE: This sets up a default set of values. These will be replaced later | ||
2349 | * if the driver's iwl-agn-rs rate scaling algorithm is used, instead of | ||
2350 | * rc80211_simple. | ||
2351 | * | ||
2352 | * NOTE: Run REPLY_ADD_STA command to set up station table entry, before | ||
2353 | * calling this function (which runs REPLY_TX_LINK_QUALITY_CMD, | ||
2354 | * which requires station table entry to exist). | ||
2355 | */ | ||
2342 | static void rs_initialize_lq(struct iwl_priv *priv, | 2356 | static void rs_initialize_lq(struct iwl_priv *priv, |
2343 | struct ieee80211_conf *conf, | 2357 | struct ieee80211_conf *conf, |
2344 | struct ieee80211_sta *sta, | 2358 | struct ieee80211_sta *sta, |
@@ -2357,10 +2371,6 @@ static void rs_initialize_lq(struct iwl_priv *priv, | |||
2357 | 2371 | ||
2358 | i = lq_sta->last_txrate_idx; | 2372 | i = lq_sta->last_txrate_idx; |
2359 | 2373 | ||
2360 | if ((lq_sta->lq.sta_id == 0xff) && | ||
2361 | (priv->iw_mode == NL80211_IFTYPE_ADHOC)) | ||
2362 | goto out; | ||
2363 | |||
2364 | valid_tx_ant = priv->hw_params.valid_tx_ant; | 2374 | valid_tx_ant = priv->hw_params.valid_tx_ant; |
2365 | 2375 | ||
2366 | if (!lq_sta->search_better_tbl) | 2376 | if (!lq_sta->search_better_tbl) |
@@ -2388,7 +2398,8 @@ static void rs_initialize_lq(struct iwl_priv *priv, | |||
2388 | tbl->current_rate = rate; | 2398 | tbl->current_rate = rate; |
2389 | rs_set_expected_tpt_table(lq_sta, tbl); | 2399 | rs_set_expected_tpt_table(lq_sta, tbl); |
2390 | rs_fill_link_cmd(NULL, lq_sta, rate); | 2400 | rs_fill_link_cmd(NULL, lq_sta, rate); |
2391 | iwl_send_lq_cmd(priv, &lq_sta->lq, CMD_ASYNC); | 2401 | priv->stations[lq_sta->lq.sta_id].lq = &lq_sta->lq; |
2402 | iwl_send_lq_cmd(priv, &lq_sta->lq, CMD_SYNC, true); | ||
2392 | out: | 2403 | out: |
2393 | return; | 2404 | return; |
2394 | } | 2405 | } |
@@ -2399,10 +2410,7 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta, | |||
2399 | 2410 | ||
2400 | struct sk_buff *skb = txrc->skb; | 2411 | struct sk_buff *skb = txrc->skb; |
2401 | struct ieee80211_supported_band *sband = txrc->sband; | 2412 | struct ieee80211_supported_band *sband = txrc->sband; |
2402 | struct iwl_priv *priv = (struct iwl_priv *)priv_r; | 2413 | struct iwl_priv *priv __maybe_unused = (struct iwl_priv *)priv_r; |
2403 | struct ieee80211_conf *conf = &priv->hw->conf; | ||
2404 | struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; | ||
2405 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | ||
2406 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 2414 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
2407 | struct iwl_lq_sta *lq_sta = priv_sta; | 2415 | struct iwl_lq_sta *lq_sta = priv_sta; |
2408 | int rate_idx; | 2416 | int rate_idx; |
@@ -2420,30 +2428,18 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta, | |||
2420 | lq_sta->max_rate_idx = -1; | 2428 | lq_sta->max_rate_idx = -1; |
2421 | } | 2429 | } |
2422 | 2430 | ||
2431 | /* Treat uninitialized rate scaling data same as non-existing. */ | ||
2432 | if (lq_sta && !lq_sta->drv) { | ||
2433 | IWL_DEBUG_RATE(priv, "Rate scaling not initialized yet.\n"); | ||
2434 | priv_sta = NULL; | ||
2435 | } | ||
2436 | |||
2423 | /* Send management frames and NO_ACK data using lowest rate. */ | 2437 | /* Send management frames and NO_ACK data using lowest rate. */ |
2424 | if (rate_control_send_low(sta, priv_sta, txrc)) | 2438 | if (rate_control_send_low(sta, priv_sta, txrc)) |
2425 | return; | 2439 | return; |
2426 | 2440 | ||
2427 | rate_idx = lq_sta->last_txrate_idx; | 2441 | rate_idx = lq_sta->last_txrate_idx; |
2428 | 2442 | ||
2429 | if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) && | ||
2430 | !lq_sta->ibss_sta_added) { | ||
2431 | u8 sta_id = iwl_find_station(priv, hdr->addr1); | ||
2432 | |||
2433 | if (sta_id == IWL_INVALID_STATION) { | ||
2434 | IWL_DEBUG_RATE(priv, "LQ: ADD station %pM\n", | ||
2435 | hdr->addr1); | ||
2436 | sta_id = iwl_add_station(priv, hdr->addr1, | ||
2437 | false, CMD_ASYNC, ht_cap); | ||
2438 | } | ||
2439 | if ((sta_id != IWL_INVALID_STATION)) { | ||
2440 | lq_sta->lq.sta_id = sta_id; | ||
2441 | lq_sta->lq.rs_table[0].rate_n_flags = 0; | ||
2442 | lq_sta->ibss_sta_added = 1; | ||
2443 | rs_initialize_lq(priv, conf, sta, lq_sta); | ||
2444 | } | ||
2445 | } | ||
2446 | |||
2447 | if (lq_sta->last_rate_n_flags & RATE_MCS_HT_MSK) { | 2443 | if (lq_sta->last_rate_n_flags & RATE_MCS_HT_MSK) { |
2448 | rate_idx -= IWL_FIRST_OFDM_RATE; | 2444 | rate_idx -= IWL_FIRST_OFDM_RATE; |
2449 | /* 6M and 9M shared same MCS index */ | 2445 | /* 6M and 9M shared same MCS index */ |
@@ -2493,16 +2489,25 @@ static void *rs_alloc_sta(void *priv_rate, struct ieee80211_sta *sta, | |||
2493 | return lq_sta; | 2489 | return lq_sta; |
2494 | } | 2490 | } |
2495 | 2491 | ||
2496 | static void rs_rate_init(void *priv_r, struct ieee80211_supported_band *sband, | 2492 | /* |
2497 | struct ieee80211_sta *sta, void *priv_sta) | 2493 | * Called after adding a new station to initialize rate scaling |
2494 | */ | ||
2495 | void iwl_rs_rate_init(struct iwl_priv *priv, struct ieee80211_sta *sta, u8 sta_id) | ||
2498 | { | 2496 | { |
2499 | int i, j; | 2497 | int i, j; |
2500 | struct iwl_priv *priv = (struct iwl_priv *)priv_r; | 2498 | struct ieee80211_hw *hw = priv->hw; |
2501 | struct ieee80211_conf *conf = &priv->hw->conf; | 2499 | struct ieee80211_conf *conf = &priv->hw->conf; |
2502 | struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; | 2500 | struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; |
2503 | struct iwl_lq_sta *lq_sta = priv_sta; | 2501 | struct iwl_station_priv *sta_priv; |
2502 | struct iwl_lq_sta *lq_sta; | ||
2503 | struct ieee80211_supported_band *sband; | ||
2504 | |||
2505 | sta_priv = (struct iwl_station_priv *) sta->drv_priv; | ||
2506 | lq_sta = &sta_priv->lq_sta; | ||
2507 | sband = hw->wiphy->bands[conf->channel->band]; | ||
2504 | 2508 | ||
2505 | lq_sta->lq.sta_id = 0xff; | 2509 | |
2510 | lq_sta->lq.sta_id = sta_id; | ||
2506 | 2511 | ||
2507 | for (j = 0; j < LQ_SIZE; j++) | 2512 | for (j = 0; j < LQ_SIZE; j++) |
2508 | for (i = 0; i < IWL_RATE_COUNT; i++) | 2513 | for (i = 0; i < IWL_RATE_COUNT; i++) |
@@ -2514,39 +2519,18 @@ static void rs_rate_init(void *priv_r, struct ieee80211_supported_band *sband, | |||
2514 | for (i = 0; i < IWL_RATE_COUNT; i++) | 2519 | for (i = 0; i < IWL_RATE_COUNT; i++) |
2515 | rs_rate_scale_clear_window(&lq_sta->lq_info[j].win[i]); | 2520 | rs_rate_scale_clear_window(&lq_sta->lq_info[j].win[i]); |
2516 | 2521 | ||
2517 | IWL_DEBUG_RATE(priv, "LQ: *** rate scale station global init ***\n"); | 2522 | IWL_DEBUG_RATE(priv, "LQ: *** rate scale station global init for station %d ***\n", |
2523 | sta_id); | ||
2518 | /* TODO: what is a good starting rate for STA? About middle? Maybe not | 2524 | /* TODO: what is a good starting rate for STA? About middle? Maybe not |
2519 | * the lowest or the highest rate.. Could consider using RSSI from | 2525 | * the lowest or the highest rate.. Could consider using RSSI from |
2520 | * previous packets? Need to have IEEE 802.1X auth succeed immediately | 2526 | * previous packets? Need to have IEEE 802.1X auth succeed immediately |
2521 | * after assoc.. */ | 2527 | * after assoc.. */ |
2522 | 2528 | ||
2523 | lq_sta->ibss_sta_added = 0; | ||
2524 | if (priv->iw_mode == NL80211_IFTYPE_AP) { | ||
2525 | u8 sta_id = iwl_find_station(priv, | ||
2526 | sta->addr); | ||
2527 | |||
2528 | /* for IBSS the call are from tasklet */ | ||
2529 | IWL_DEBUG_RATE(priv, "LQ: ADD station %pM\n", sta->addr); | ||
2530 | |||
2531 | if (sta_id == IWL_INVALID_STATION) { | ||
2532 | IWL_DEBUG_RATE(priv, "LQ: ADD station %pM\n", sta->addr); | ||
2533 | sta_id = iwl_add_station(priv, sta->addr, false, | ||
2534 | CMD_ASYNC, ht_cap); | ||
2535 | } | ||
2536 | if ((sta_id != IWL_INVALID_STATION)) { | ||
2537 | lq_sta->lq.sta_id = sta_id; | ||
2538 | lq_sta->lq.rs_table[0].rate_n_flags = 0; | ||
2539 | } | ||
2540 | /* FIXME: this is w/a remove it later */ | ||
2541 | priv->assoc_station_added = 1; | ||
2542 | } | ||
2543 | |||
2544 | lq_sta->is_dup = 0; | 2529 | lq_sta->is_dup = 0; |
2545 | lq_sta->max_rate_idx = -1; | 2530 | lq_sta->max_rate_idx = -1; |
2546 | lq_sta->missed_rate_counter = IWL_MISSED_RATE_MAX; | 2531 | lq_sta->missed_rate_counter = IWL_MISSED_RATE_MAX; |
2547 | lq_sta->is_green = rs_use_green(sta, &priv->current_ht_config); | 2532 | lq_sta->is_green = rs_use_green(sta, &priv->current_ht_config); |
2548 | lq_sta->active_legacy_rate = priv->active_rate & ~(0x1000); | 2533 | lq_sta->active_legacy_rate = priv->active_rate & ~(0x1000); |
2549 | lq_sta->active_rate_basic = priv->active_rate_basic; | ||
2550 | lq_sta->band = priv->band; | 2534 | lq_sta->band = priv->band; |
2551 | /* | 2535 | /* |
2552 | * active_siso_rate mask includes 9 MBits (bit 5), and CCK (bits 0-3), | 2536 | * active_siso_rate mask includes 9 MBits (bit 5), and CCK (bits 0-3), |
@@ -2574,8 +2558,17 @@ static void rs_rate_init(void *priv_r, struct ieee80211_supported_band *sband, | |||
2574 | lq_sta->active_mimo3_rate); | 2558 | lq_sta->active_mimo3_rate); |
2575 | 2559 | ||
2576 | /* These values will be overridden later */ | 2560 | /* These values will be overridden later */ |
2577 | lq_sta->lq.general_params.single_stream_ant_msk = ANT_A; | 2561 | lq_sta->lq.general_params.single_stream_ant_msk = |
2578 | lq_sta->lq.general_params.dual_stream_ant_msk = ANT_AB; | 2562 | first_antenna(priv->hw_params.valid_tx_ant); |
2563 | lq_sta->lq.general_params.dual_stream_ant_msk = | ||
2564 | priv->hw_params.valid_tx_ant & | ||
2565 | ~first_antenna(priv->hw_params.valid_tx_ant); | ||
2566 | if (!lq_sta->lq.general_params.dual_stream_ant_msk) { | ||
2567 | lq_sta->lq.general_params.dual_stream_ant_msk = ANT_AB; | ||
2568 | } else if (num_of_ant(priv->hw_params.valid_tx_ant) == 2) { | ||
2569 | lq_sta->lq.general_params.dual_stream_ant_msk = | ||
2570 | priv->hw_params.valid_tx_ant; | ||
2571 | } | ||
2579 | 2572 | ||
2580 | /* as default allow aggregation for all tids */ | 2573 | /* as default allow aggregation for all tids */ |
2581 | lq_sta->tx_agg_tid_en = IWL_AGG_ALL_TID; | 2574 | lq_sta->tx_agg_tid_en = IWL_AGG_ALL_TID; |
@@ -2794,7 +2787,7 @@ static ssize_t rs_sta_dbgfs_scale_table_write(struct file *file, | |||
2794 | 2787 | ||
2795 | if (lq_sta->dbg_fixed_rate) { | 2788 | if (lq_sta->dbg_fixed_rate) { |
2796 | rs_fill_link_cmd(NULL, lq_sta, lq_sta->dbg_fixed_rate); | 2789 | rs_fill_link_cmd(NULL, lq_sta, lq_sta->dbg_fixed_rate); |
2797 | iwl_send_lq_cmd(lq_sta->drv, &lq_sta->lq, CMD_ASYNC); | 2790 | iwl_send_lq_cmd(lq_sta->drv, &lq_sta->lq, CMD_ASYNC, false); |
2798 | } | 2791 | } |
2799 | 2792 | ||
2800 | return count; | 2793 | return count; |
@@ -2950,12 +2943,6 @@ static ssize_t rs_sta_dbgfs_rate_scale_data_read(struct file *file, | |||
2950 | desc += sprintf(buff+desc, | 2943 | desc += sprintf(buff+desc, |
2951 | "Bit Rate= %d Mb/s\n", | 2944 | "Bit Rate= %d Mb/s\n", |
2952 | iwl_rates[lq_sta->last_txrate_idx].ieee >> 1); | 2945 | iwl_rates[lq_sta->last_txrate_idx].ieee >> 1); |
2953 | desc += sprintf(buff+desc, | ||
2954 | "Signal Level= %d dBm\tNoise Level= %d dBm\n", | ||
2955 | priv->last_rx_rssi, priv->last_rx_noise); | ||
2956 | desc += sprintf(buff+desc, | ||
2957 | "Tsf= 0x%llx\tBeacon time= 0x%08X\n", | ||
2958 | priv->last_tsf, priv->last_beacon_time); | ||
2959 | 2946 | ||
2960 | ret = simple_read_from_buffer(user_buf, count, ppos, buff, desc); | 2947 | ret = simple_read_from_buffer(user_buf, count, ppos, buff, desc); |
2961 | return ret; | 2948 | return ret; |
@@ -2995,12 +2982,21 @@ static void rs_remove_debugfs(void *priv, void *priv_sta) | |||
2995 | } | 2982 | } |
2996 | #endif | 2983 | #endif |
2997 | 2984 | ||
2985 | /* | ||
2986 | * Initialization of rate scaling information is done by driver after | ||
2987 | * the station is added. Since mac80211 calls this function before a | ||
2988 | * station is added we ignore it. | ||
2989 | */ | ||
2990 | static void rs_rate_init_stub(void *priv_r, struct ieee80211_supported_band *sband, | ||
2991 | struct ieee80211_sta *sta, void *priv_sta) | ||
2992 | { | ||
2993 | } | ||
2998 | static struct rate_control_ops rs_ops = { | 2994 | static struct rate_control_ops rs_ops = { |
2999 | .module = NULL, | 2995 | .module = NULL, |
3000 | .name = RS_NAME, | 2996 | .name = RS_NAME, |
3001 | .tx_status = rs_tx_status, | 2997 | .tx_status = rs_tx_status, |
3002 | .get_rate = rs_get_rate, | 2998 | .get_rate = rs_get_rate, |
3003 | .rate_init = rs_rate_init, | 2999 | .rate_init = rs_rate_init_stub, |
3004 | .alloc = rs_alloc, | 3000 | .alloc = rs_alloc, |
3005 | .free = rs_free, | 3001 | .free = rs_free, |
3006 | .alloc_sta = rs_alloc_sta, | 3002 | .alloc_sta = rs_alloc_sta, |