aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-3945-rs.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945-rs.c74
1 files changed, 37 insertions, 37 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
index 45ce3ff653ab..7db8198c6253 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
@@ -197,7 +197,7 @@ static int iwl3945_rate_scale_flush_windows(struct iwl3945_rs_sta *rs_sta)
197 spin_lock_irqsave(&rs_sta->lock, flags); 197 spin_lock_irqsave(&rs_sta->lock, flags);
198 if (time_after(jiffies, rs_sta->win[i].stamp + 198 if (time_after(jiffies, rs_sta->win[i].stamp +
199 IWL_RATE_WIN_FLUSH)) { 199 IWL_RATE_WIN_FLUSH)) {
200 IWL_DEBUG_RATE("flushing %d samples of rate " 200 IWL_DEBUG_RATE(priv, "flushing %d samples of rate "
201 "index %d\n", 201 "index %d\n",
202 rs_sta->win[i].counter, i); 202 rs_sta->win[i].counter, i);
203 iwl3945_clear_window(&rs_sta->win[i]); 203 iwl3945_clear_window(&rs_sta->win[i]);
@@ -221,7 +221,7 @@ static void iwl3945_bg_rate_scale_flush(unsigned long data)
221 unsigned long flags; 221 unsigned long flags;
222 u32 packet_count, duration, pps; 222 u32 packet_count, duration, pps;
223 223
224 IWL_DEBUG_RATE("enter\n"); 224 IWL_DEBUG_RATE(priv, "enter\n");
225 225
226 unflushed = iwl3945_rate_scale_flush_windows(rs_sta); 226 unflushed = iwl3945_rate_scale_flush_windows(rs_sta);
227 227
@@ -236,7 +236,7 @@ static void iwl3945_bg_rate_scale_flush(unsigned long data)
236 duration = 236 duration =
237 jiffies_to_msecs(jiffies - rs_sta->last_partial_flush); 237 jiffies_to_msecs(jiffies - rs_sta->last_partial_flush);
238 238
239 IWL_DEBUG_RATE("Tx'd %d packets in %dms\n", 239 IWL_DEBUG_RATE(priv, "Tx'd %d packets in %dms\n",
240 packet_count, duration); 240 packet_count, duration);
241 241
242 /* Determine packets per second */ 242 /* Determine packets per second */
@@ -256,7 +256,7 @@ static void iwl3945_bg_rate_scale_flush(unsigned long data)
256 256
257 rs_sta->flush_time = msecs_to_jiffies(duration); 257 rs_sta->flush_time = msecs_to_jiffies(duration);
258 258
259 IWL_DEBUG_RATE("new flush period: %d msec ave %d\n", 259 IWL_DEBUG_RATE(priv, "new flush period: %d msec ave %d\n",
260 duration, packet_count); 260 duration, packet_count);
261 261
262 mod_timer(&rs_sta->rate_scale_flush, jiffies + 262 mod_timer(&rs_sta->rate_scale_flush, jiffies +
@@ -274,7 +274,7 @@ static void iwl3945_bg_rate_scale_flush(unsigned long data)
274 274
275 spin_unlock_irqrestore(&rs_sta->lock, flags); 275 spin_unlock_irqrestore(&rs_sta->lock, flags);
276 276
277 IWL_DEBUG_RATE("leave\n"); 277 IWL_DEBUG_RATE(priv, "leave\n");
278} 278}
279 279
280/** 280/**
@@ -293,7 +293,7 @@ static void iwl3945_collect_tx_data(struct iwl3945_rs_sta *rs_sta,
293 struct iwl_priv *priv __maybe_unused = rs_sta->priv; 293 struct iwl_priv *priv __maybe_unused = rs_sta->priv;
294 294
295 if (!retries) { 295 if (!retries) {
296 IWL_DEBUG_RATE("leave: retries == 0 -- should be at least 1\n"); 296 IWL_DEBUG_RATE(priv, "leave: retries == 0 -- should be at least 1\n");
297 return; 297 return;
298 } 298 }
299 299
@@ -347,7 +347,7 @@ static void rs_rate_init(void *priv_r, struct ieee80211_supported_band *sband,
347 struct iwl_priv *priv = (struct iwl_priv *)priv_r; 347 struct iwl_priv *priv = (struct iwl_priv *)priv_r;
348 int i; 348 int i;
349 349
350 IWL_DEBUG_RATE("enter\n"); 350 IWL_DEBUG_RATE(priv, "enter\n");
351 351
352 /* TODO: what is a good starting rate for STA? About middle? Maybe not 352 /* TODO: what is a good starting rate for STA? About middle? Maybe not
353 * the lowest or the highest rate.. Could consider using RSSI from 353 * the lowest or the highest rate.. Could consider using RSSI from
@@ -370,7 +370,7 @@ static void rs_rate_init(void *priv_r, struct ieee80211_supported_band *sband,
370 } 370 }
371 371
372 372
373 IWL_DEBUG_RATE("leave\n"); 373 IWL_DEBUG_RATE(priv, "leave\n");
374} 374}
375 375
376static void *rs_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) 376static void *rs_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir)
@@ -396,11 +396,11 @@ static void *rs_alloc_sta(void *iwl_priv, struct ieee80211_sta *sta, gfp_t gfp)
396 * as well just put all the information there. 396 * as well just put all the information there.
397 */ 397 */
398 398
399 IWL_DEBUG_RATE("enter\n"); 399 IWL_DEBUG_RATE(priv, "enter\n");
400 400
401 rs_sta = kzalloc(sizeof(struct iwl3945_rs_sta), gfp); 401 rs_sta = kzalloc(sizeof(struct iwl3945_rs_sta), gfp);
402 if (!rs_sta) { 402 if (!rs_sta) {
403 IWL_DEBUG_RATE("leave: ENOMEM\n"); 403 IWL_DEBUG_RATE(priv, "leave: ENOMEM\n");
404 return NULL; 404 return NULL;
405 } 405 }
406 406
@@ -428,7 +428,7 @@ static void *rs_alloc_sta(void *iwl_priv, struct ieee80211_sta *sta, gfp_t gfp)
428 for (i = 0; i < IWL_RATE_COUNT_3945; i++) 428 for (i = 0; i < IWL_RATE_COUNT_3945; i++)
429 iwl3945_clear_window(&rs_sta->win[i]); 429 iwl3945_clear_window(&rs_sta->win[i]);
430 430
431 IWL_DEBUG_RATE("leave\n"); 431 IWL_DEBUG_RATE(priv, "leave\n");
432 432
433 return rs_sta; 433 return rs_sta;
434} 434}
@@ -442,10 +442,10 @@ static void rs_free_sta(void *iwl_priv, struct ieee80211_sta *sta,
442 442
443 psta->rs_sta = NULL; 443 psta->rs_sta = NULL;
444 444
445 IWL_DEBUG_RATE("enter\n"); 445 IWL_DEBUG_RATE(priv, "enter\n");
446 del_timer_sync(&rs_sta->rate_scale_flush); 446 del_timer_sync(&rs_sta->rate_scale_flush);
447 kfree(rs_sta); 447 kfree(rs_sta);
448 IWL_DEBUG_RATE("leave\n"); 448 IWL_DEBUG_RATE(priv, "leave\n");
449} 449}
450 450
451 451
@@ -466,18 +466,18 @@ static void rs_tx_status(void *priv_rate, struct ieee80211_supported_band *sband
466 struct iwl3945_rs_sta *rs_sta = priv_sta; 466 struct iwl3945_rs_sta *rs_sta = priv_sta;
467 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 467 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
468 468
469 IWL_DEBUG_RATE("enter\n"); 469 IWL_DEBUG_RATE(priv, "enter\n");
470 470
471 retries = info->status.rates[0].count; 471 retries = info->status.rates[0].count;
472 472
473 first_index = sband->bitrates[info->status.rates[0].idx].hw_value; 473 first_index = sband->bitrates[info->status.rates[0].idx].hw_value;
474 if ((first_index < 0) || (first_index >= IWL_RATE_COUNT_3945)) { 474 if ((first_index < 0) || (first_index >= IWL_RATE_COUNT_3945)) {
475 IWL_DEBUG_RATE("leave: Rate out of bounds: %d\n", first_index); 475 IWL_DEBUG_RATE(priv, "leave: Rate out of bounds: %d\n", first_index);
476 return; 476 return;
477 } 477 }
478 478
479 if (!priv_sta) { 479 if (!priv_sta) {
480 IWL_DEBUG_RATE("leave: No STA priv data to update!\n"); 480 IWL_DEBUG_RATE(priv, "leave: No STA priv data to update!\n");
481 return; 481 return;
482 } 482 }
483 483
@@ -511,7 +511,7 @@ static void rs_tx_status(void *priv_rate, struct ieee80211_supported_band *sband
511 iwl3945_collect_tx_data(rs_sta, 511 iwl3945_collect_tx_data(rs_sta,
512 &rs_sta->win[scale_rate_index], 512 &rs_sta->win[scale_rate_index],
513 0, current_count, scale_rate_index); 513 0, current_count, scale_rate_index);
514 IWL_DEBUG_RATE("Update rate %d for %d retries.\n", 514 IWL_DEBUG_RATE(priv, "Update rate %d for %d retries.\n",
515 scale_rate_index, current_count); 515 scale_rate_index, current_count);
516 516
517 retries -= current_count; 517 retries -= current_count;
@@ -521,7 +521,7 @@ static void rs_tx_status(void *priv_rate, struct ieee80211_supported_band *sband
521 521
522 522
523 /* Update the last index window with success/failure based on ACK */ 523 /* Update the last index window with success/failure based on ACK */
524 IWL_DEBUG_RATE("Update rate %d with %s.\n", 524 IWL_DEBUG_RATE(priv, "Update rate %d with %s.\n",
525 last_index, 525 last_index,
526 (info->flags & IEEE80211_TX_STAT_ACK) ? 526 (info->flags & IEEE80211_TX_STAT_ACK) ?
527 "success" : "failure"); 527 "success" : "failure");
@@ -546,7 +546,7 @@ static void rs_tx_status(void *priv_rate, struct ieee80211_supported_band *sband
546 546
547 spin_unlock_irqrestore(&rs_sta->lock, flags); 547 spin_unlock_irqrestore(&rs_sta->lock, flags);
548 548
549 IWL_DEBUG_RATE("leave\n"); 549 IWL_DEBUG_RATE(priv, "leave\n");
550 550
551 return; 551 return;
552} 552}
@@ -596,7 +596,7 @@ static u16 iwl3945_get_adjacent_rate(struct iwl3945_rs_sta *rs_sta,
596 break; 596 break;
597 if (rate_mask & (1 << low)) 597 if (rate_mask & (1 << low))
598 break; 598 break;
599 IWL_DEBUG_RATE("Skipping masked lower rate: %d\n", low); 599 IWL_DEBUG_RATE(priv, "Skipping masked lower rate: %d\n", low);
600 } 600 }
601 601
602 high = index; 602 high = index;
@@ -609,7 +609,7 @@ static u16 iwl3945_get_adjacent_rate(struct iwl3945_rs_sta *rs_sta,
609 break; 609 break;
610 if (rate_mask & (1 << high)) 610 if (rate_mask & (1 << high))
611 break; 611 break;
612 IWL_DEBUG_RATE("Skipping masked higher rate: %d\n", high); 612 IWL_DEBUG_RATE(priv, "Skipping masked higher rate: %d\n", high);
613 } 613 }
614 614
615 return (high << 8) | low; 615 return (high << 8) | low;
@@ -655,7 +655,7 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
655 struct iwl_priv *priv = (struct iwl_priv *)priv_r; 655 struct iwl_priv *priv = (struct iwl_priv *)priv_r;
656 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 656 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
657 657
658 IWL_DEBUG_RATE("enter\n"); 658 IWL_DEBUG_RATE(priv, "enter\n");
659 659
660 if (sta) 660 if (sta)
661 rate_mask = sta->supp_rates[sband->band]; 661 rate_mask = sta->supp_rates[sband->band];
@@ -666,7 +666,7 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
666 if ((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA || 666 if ((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA ||
667 is_multicast_ether_addr(hdr->addr1) || 667 is_multicast_ether_addr(hdr->addr1) ||
668 !sta || !priv_sta) { 668 !sta || !priv_sta) {
669 IWL_DEBUG_RATE("leave: No STA priv data to update!\n"); 669 IWL_DEBUG_RATE(priv, "leave: No STA priv data to update!\n");
670 if (!rate_mask) 670 if (!rate_mask)
671 info->control.rates[0].idx = 671 info->control.rates[0].idx =
672 rate_lowest_index(sband, NULL); 672 rate_lowest_index(sband, NULL);
@@ -693,7 +693,7 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
693 u8 sta_id = iwl3945_hw_find_station(priv, hdr->addr1); 693 u8 sta_id = iwl3945_hw_find_station(priv, hdr->addr1);
694 694
695 if (sta_id == IWL_INVALID_STATION) { 695 if (sta_id == IWL_INVALID_STATION) {
696 IWL_DEBUG_RATE("LQ: ADD station %pm\n", 696 IWL_DEBUG_RATE(priv, "LQ: ADD station %pm\n",
697 hdr->addr1); 697 hdr->addr1);
698 sta_id = iwl3945_add_station(priv, 698 sta_id = iwl3945_add_station(priv,
699 hdr->addr1, 0, CMD_ASYNC); 699 hdr->addr1, 0, CMD_ASYNC);
@@ -728,7 +728,7 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
728 (window->success_counter < IWL_RATE_MIN_SUCCESS_TH))) { 728 (window->success_counter < IWL_RATE_MIN_SUCCESS_TH))) {
729 spin_unlock_irqrestore(&rs_sta->lock, flags); 729 spin_unlock_irqrestore(&rs_sta->lock, flags);
730 730
731 IWL_DEBUG_RATE("Invalid average_tpt on rate %d: " 731 IWL_DEBUG_RATE(priv, "Invalid average_tpt on rate %d: "
732 "counter: %d, success_counter: %d, " 732 "counter: %d, success_counter: %d, "
733 "expected_tpt is %sNULL\n", 733 "expected_tpt is %sNULL\n",
734 index, 734 index,
@@ -761,7 +761,7 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
761 scale_action = 1; 761 scale_action = 1;
762 762
763 if ((window->success_ratio < IWL_RATE_DECREASE_TH) || !current_tpt) { 763 if ((window->success_ratio < IWL_RATE_DECREASE_TH) || !current_tpt) {
764 IWL_DEBUG_RATE("decrease rate because of low success_ratio\n"); 764 IWL_DEBUG_RATE(priv, "decrease rate because of low success_ratio\n");
765 scale_action = -1; 765 scale_action = -1;
766 } else if ((low_tpt == IWL_INVALID_VALUE) && 766 } else if ((low_tpt == IWL_INVALID_VALUE) &&
767 (high_tpt == IWL_INVALID_VALUE)) 767 (high_tpt == IWL_INVALID_VALUE))
@@ -769,7 +769,7 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
769 else if ((low_tpt != IWL_INVALID_VALUE) && 769 else if ((low_tpt != IWL_INVALID_VALUE) &&
770 (high_tpt != IWL_INVALID_VALUE) && 770 (high_tpt != IWL_INVALID_VALUE) &&
771 (low_tpt < current_tpt) && (high_tpt < current_tpt)) { 771 (low_tpt < current_tpt) && (high_tpt < current_tpt)) {
772 IWL_DEBUG_RATE("No action -- low [%d] & high [%d] < " 772 IWL_DEBUG_RATE(priv, "No action -- low [%d] & high [%d] < "
773 "current_tpt [%d]\n", 773 "current_tpt [%d]\n",
774 low_tpt, high_tpt, current_tpt); 774 low_tpt, high_tpt, current_tpt);
775 scale_action = 0; 775 scale_action = 0;
@@ -778,14 +778,14 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
778 if (high_tpt > current_tpt) 778 if (high_tpt > current_tpt)
779 scale_action = 1; 779 scale_action = 1;
780 else { 780 else {
781 IWL_DEBUG_RATE 781 IWL_DEBUG_RATE(priv,
782 ("decrease rate because of high tpt\n"); 782 "decrease rate because of high tpt\n");
783 scale_action = -1; 783 scale_action = -1;
784 } 784 }
785 } else if (low_tpt != IWL_INVALID_VALUE) { 785 } else if (low_tpt != IWL_INVALID_VALUE) {
786 if (low_tpt > current_tpt) { 786 if (low_tpt > current_tpt) {
787 IWL_DEBUG_RATE 787 IWL_DEBUG_RATE(priv,
788 ("decrease rate because of low tpt\n"); 788 "decrease rate because of low tpt\n");
789 scale_action = -1; 789 scale_action = -1;
790 } else 790 } else
791 scale_action = 1; 791 scale_action = 1;
@@ -797,7 +797,7 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
797 scale_action = 0; 797 scale_action = 0;
798 } else if (scale_action == 1) { 798 } else if (scale_action == 1) {
799 if (window->success_ratio < IWL_SUCCESS_UP_TH) { 799 if (window->success_ratio < IWL_SUCCESS_UP_TH) {
800 IWL_DEBUG_RATE("No action -- success_ratio [%d] < " 800 IWL_DEBUG_RATE(priv, "No action -- success_ratio [%d] < "
801 "SUCCESS UP\n", window->success_ratio); 801 "SUCCESS UP\n", window->success_ratio);
802 scale_action = 0; 802 scale_action = 0;
803 } 803 }
@@ -820,7 +820,7 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
820 break; 820 break;
821 } 821 }
822 822
823 IWL_DEBUG_RATE("Selected %d (action %d) - low %d high %d\n", 823 IWL_DEBUG_RATE(priv, "Selected %d (action %d) - low %d high %d\n",
824 index, scale_action, low, high); 824 index, scale_action, low, high);
825 825
826 out: 826 out:
@@ -832,7 +832,7 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
832 else 832 else
833 info->control.rates[0].idx = rs_sta->last_txrate_idx; 833 info->control.rates[0].idx = rs_sta->last_txrate_idx;
834 834
835 IWL_DEBUG_RATE("leave: %d\n", index); 835 IWL_DEBUG_RATE(priv, "leave: %d\n", index);
836} 836}
837 837
838#ifdef CONFIG_MAC80211_DEBUGFS 838#ifdef CONFIG_MAC80211_DEBUGFS
@@ -915,7 +915,7 @@ void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
915 struct ieee80211_sta *sta; 915 struct ieee80211_sta *sta;
916 struct iwl3945_sta_priv *psta; 916 struct iwl3945_sta_priv *psta;
917 917
918 IWL_DEBUG_RATE("enter\n"); 918 IWL_DEBUG_RATE(priv, "enter\n");
919 919
920 rcu_read_lock(); 920 rcu_read_lock();
921 921
@@ -955,11 +955,11 @@ void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
955 if (rssi == 0) 955 if (rssi == 0)
956 rssi = IWL_MIN_RSSI_VAL; 956 rssi = IWL_MIN_RSSI_VAL;
957 957
958 IWL_DEBUG(IWL_DL_INFO | IWL_DL_RATE, "Network RSSI: %d\n", rssi); 958 IWL_DEBUG_RATE(priv, "Network RSSI: %d\n", rssi);
959 959
960 rs_sta->start_rate = iwl3945_get_rate_index_by_rssi(rssi, priv->band); 960 rs_sta->start_rate = iwl3945_get_rate_index_by_rssi(rssi, priv->band);
961 961
962 IWL_DEBUG_RATE("leave: rssi %d assign rate index: " 962 IWL_DEBUG_RATE(priv, "leave: rssi %d assign rate index: "
963 "%d (plcp 0x%x)\n", rssi, rs_sta->start_rate, 963 "%d (plcp 0x%x)\n", rssi, rs_sta->start_rate,
964 iwl3945_rates[rs_sta->start_rate].plcp); 964 iwl3945_rates[rs_sta->start_rate].plcp);
965 rcu_read_unlock(); 965 rcu_read_unlock();