diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2008-01-14 20:46:21 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:09:59 -0500 |
commit | c33104f0a782a7746e5d3b975288a4fb3b8293ed (patch) | |
tree | c48dbe1f17e8fd8c46d0891e3a89ac010d576459 /drivers | |
parent | 98c92211462bb78fe0e869b43e1662e549e35fed (diff) |
iwlwifi: 4965 unify rate scale variable names for station data
1, This patch renames iwl4965_rate_scale_priv to iwl4965_lq_sta.
This type represents a station's link quality.
2. The names of the variables of this type were rs_priv, lq_data, lq, crl
across the file. All are now unified under the name lq_sta.
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-4965-rs.c | 609 |
1 files changed, 308 insertions, 301 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c index 5081e287b129..d06462264147 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c | |||
@@ -103,7 +103,7 @@ struct iwl4965_scale_tbl_info { | |||
103 | * | 103 | * |
104 | * Pointer to this gets passed back and forth between driver and mac80211. | 104 | * Pointer to this gets passed back and forth between driver and mac80211. |
105 | */ | 105 | */ |
106 | struct iwl4965_rate_scale_priv { | 106 | struct iwl4965_lq_sta { |
107 | u8 active_tbl; /* index of active table, range 0-1 */ | 107 | u8 active_tbl; /* index of active table, range 0-1 */ |
108 | u8 enable_counter; /* indicates HT mode */ | 108 | u8 enable_counter; /* indicates HT mode */ |
109 | u8 stay_in_tbl; /* 1: disallow, 0: allow search for new mode */ | 109 | u8 stay_in_tbl; /* 1: disallow, 0: allow search for new mode */ |
@@ -148,16 +148,16 @@ static void rs_rate_scale_perform(struct iwl4965_priv *priv, | |||
148 | struct net_device *dev, | 148 | struct net_device *dev, |
149 | struct ieee80211_hdr *hdr, | 149 | struct ieee80211_hdr *hdr, |
150 | struct sta_info *sta); | 150 | struct sta_info *sta); |
151 | static void rs_fill_link_cmd(struct iwl4965_rate_scale_priv *lq_data, | 151 | static void rs_fill_link_cmd(struct iwl4965_lq_sta *lq_sta, |
152 | struct iwl4965_rate *tx_mcs, | 152 | struct iwl4965_rate *tx_mcs, |
153 | struct iwl4965_link_quality_cmd *tbl); | 153 | struct iwl4965_link_quality_cmd *tbl); |
154 | 154 | ||
155 | 155 | ||
156 | #ifdef CONFIG_MAC80211_DEBUGFS | 156 | #ifdef CONFIG_MAC80211_DEBUGFS |
157 | static void rs_dbgfs_set_mcs(struct iwl4965_rate_scale_priv *rs_priv, | 157 | static void rs_dbgfs_set_mcs(struct iwl4965_lq_sta *lq_sta, |
158 | struct iwl4965_rate *mcs, int index); | 158 | struct iwl4965_rate *mcs, int index); |
159 | #else | 159 | #else |
160 | static void rs_dbgfs_set_mcs(struct iwl4965_rate_scale_priv *rs_priv, | 160 | static void rs_dbgfs_set_mcs(struct iwl4965_lq_sta *lq_sta, |
161 | struct iwl4965_rate *mcs, int index) | 161 | struct iwl4965_rate *mcs, int index) |
162 | {} | 162 | {} |
163 | #endif | 163 | #endif |
@@ -516,23 +516,24 @@ static inline u8 rs_use_green(struct iwl4965_priv *priv, | |||
516 | * basic available rates. | 516 | * basic available rates. |
517 | * | 517 | * |
518 | */ | 518 | */ |
519 | static void rs_get_supported_rates(struct iwl4965_rate_scale_priv *lq_data, | 519 | static void rs_get_supported_rates(struct iwl4965_lq_sta *lq_sta, |
520 | struct ieee80211_hdr *hdr, | 520 | struct ieee80211_hdr *hdr, |
521 | enum iwl4965_table_type rate_type, | 521 | enum iwl4965_table_type rate_type, |
522 | u16 *data_rate) | 522 | u16 *data_rate) |
523 | { | 523 | { |
524 | if (is_legacy(rate_type)) | 524 | if (is_legacy(rate_type)) |
525 | *data_rate = lq_data->active_rate; | 525 | *data_rate = lq_sta->active_rate; |
526 | else { | 526 | else { |
527 | if (is_siso(rate_type)) | 527 | if (is_siso(rate_type)) |
528 | *data_rate = lq_data->active_siso_rate; | 528 | *data_rate = lq_sta->active_siso_rate; |
529 | else | 529 | else |
530 | *data_rate = lq_data->active_mimo_rate; | 530 | *data_rate = lq_sta->active_mimo_rate; |
531 | } | 531 | } |
532 | 532 | ||
533 | if (hdr && is_multicast_ether_addr(hdr->addr1) && | 533 | if (hdr && is_multicast_ether_addr(hdr->addr1) && |
534 | lq_data->active_rate_basic) | 534 | lq_sta->active_rate_basic) { |
535 | *data_rate = lq_data->active_rate_basic; | 535 | *data_rate = lq_sta->active_rate_basic; |
536 | } | ||
536 | } | 537 | } |
537 | 538 | ||
538 | static u16 rs_get_adjacent_rate(u8 index, u16 rate_mask, int rate_type) | 539 | static u16 rs_get_adjacent_rate(u8 index, u16 rate_mask, int rate_type) |
@@ -590,7 +591,7 @@ static u16 rs_get_adjacent_rate(u8 index, u16 rate_mask, int rate_type) | |||
590 | return (high << 8) | low; | 591 | return (high << 8) | low; |
591 | } | 592 | } |
592 | 593 | ||
593 | static void rs_get_lower_rate(struct iwl4965_rate_scale_priv *lq_data, | 594 | static void rs_get_lower_rate(struct iwl4965_lq_sta *lq_sta, |
594 | struct iwl4965_scale_tbl_info *tbl, u8 scale_index, | 595 | struct iwl4965_scale_tbl_info *tbl, u8 scale_index, |
595 | u8 ht_possible, struct iwl4965_rate *mcs_rate) | 596 | u8 ht_possible, struct iwl4965_rate *mcs_rate) |
596 | { | 597 | { |
@@ -598,7 +599,7 @@ static void rs_get_lower_rate(struct iwl4965_rate_scale_priv *lq_data, | |||
598 | u16 rate_mask; | 599 | u16 rate_mask; |
599 | u16 high_low; | 600 | u16 high_low; |
600 | u8 switch_to_legacy = 0; | 601 | u8 switch_to_legacy = 0; |
601 | u8 is_green = lq_data->is_green; | 602 | u8 is_green = lq_sta->is_green; |
602 | 603 | ||
603 | /* check if we need to switch from HT to legacy rates. | 604 | /* check if we need to switch from HT to legacy rates. |
604 | * assumption is that mandatory rates (1Mbps or 6Mbps) | 605 | * assumption is that mandatory rates (1Mbps or 6Mbps) |
@@ -606,7 +607,7 @@ static void rs_get_lower_rate(struct iwl4965_rate_scale_priv *lq_data, | |||
606 | if (!is_legacy(tbl->lq_type) && (!ht_possible || !scale_index)) { | 607 | if (!is_legacy(tbl->lq_type) && (!ht_possible || !scale_index)) { |
607 | switch_to_legacy = 1; | 608 | switch_to_legacy = 1; |
608 | scale_index = rs_ht_to_legacy[scale_index]; | 609 | scale_index = rs_ht_to_legacy[scale_index]; |
609 | if (lq_data->phymode == MODE_IEEE80211A) | 610 | if (lq_sta->phymode == MODE_IEEE80211A) |
610 | tbl->lq_type = LQ_A; | 611 | tbl->lq_type = LQ_A; |
611 | else | 612 | else |
612 | tbl->lq_type = LQ_G; | 613 | tbl->lq_type = LQ_G; |
@@ -619,16 +620,16 @@ static void rs_get_lower_rate(struct iwl4965_rate_scale_priv *lq_data, | |||
619 | tbl->is_SGI = 0; | 620 | tbl->is_SGI = 0; |
620 | } | 621 | } |
621 | 622 | ||
622 | rs_get_supported_rates(lq_data, NULL, tbl->lq_type, &rate_mask); | 623 | rs_get_supported_rates(lq_sta, NULL, tbl->lq_type, &rate_mask); |
623 | 624 | ||
624 | /* Mask with station rate restriction */ | 625 | /* Mask with station rate restriction */ |
625 | if (is_legacy(tbl->lq_type)) { | 626 | if (is_legacy(tbl->lq_type)) { |
626 | /* supp_rates has no CCK bits in A mode */ | 627 | /* supp_rates has no CCK bits in A mode */ |
627 | if (lq_data->phymode == (u8) MODE_IEEE80211A) | 628 | if (lq_sta->phymode == (u8) MODE_IEEE80211A) |
628 | rate_mask = (u16)(rate_mask & | 629 | rate_mask = (u16)(rate_mask & |
629 | (lq_data->supp_rates << IWL_FIRST_OFDM_RATE)); | 630 | (lq_sta->supp_rates << IWL_FIRST_OFDM_RATE)); |
630 | else | 631 | else |
631 | rate_mask = (u16)(rate_mask & lq_data->supp_rates); | 632 | rate_mask = (u16)(rate_mask & lq_sta->supp_rates); |
632 | } | 633 | } |
633 | 634 | ||
634 | /* If we switched from HT to legacy, check current rate */ | 635 | /* If we switched from HT to legacy, check current rate */ |
@@ -649,15 +650,14 @@ static void rs_get_lower_rate(struct iwl4965_rate_scale_priv *lq_data, | |||
649 | /* | 650 | /* |
650 | * mac80211 sends us Tx status | 651 | * mac80211 sends us Tx status |
651 | */ | 652 | */ |
652 | static void rs_tx_status(void *priv_rate, | 653 | static void rs_tx_status(void *priv_rate, struct net_device *dev, |
653 | struct net_device *dev, | ||
654 | struct sk_buff *skb, | 654 | struct sk_buff *skb, |
655 | struct ieee80211_tx_status *tx_resp) | 655 | struct ieee80211_tx_status *tx_resp) |
656 | { | 656 | { |
657 | int status; | 657 | int status; |
658 | u8 retries; | 658 | u8 retries; |
659 | int rs_index, index = 0; | 659 | int rs_index, index = 0; |
660 | struct iwl4965_rate_scale_priv *lq; | 660 | struct iwl4965_lq_sta *lq_sta; |
661 | struct iwl4965_link_quality_cmd *table; | 661 | struct iwl4965_link_quality_cmd *table; |
662 | struct sta_info *sta; | 662 | struct sta_info *sta; |
663 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 663 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
@@ -691,27 +691,29 @@ static void rs_tx_status(void *priv_rate, | |||
691 | return; | 691 | return; |
692 | } | 692 | } |
693 | 693 | ||
694 | lq = (struct iwl4965_rate_scale_priv *)sta->rate_ctrl_priv; | 694 | lq_sta = (struct iwl4965_lq_sta *)sta->rate_ctrl_priv; |
695 | 695 | ||
696 | if (!priv->lq_mngr.lq_ready) | 696 | if (!priv->lq_mngr.lq_ready) |
697 | return; | 697 | return; |
698 | 698 | ||
699 | if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) && !lq->ibss_sta_added) | 699 | if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) && |
700 | !lq_sta->ibss_sta_added) | ||
700 | return; | 701 | return; |
701 | 702 | ||
702 | table = &lq->lq; | 703 | table = &lq_sta->lq; |
703 | active_index = lq->active_tbl; | 704 | active_index = lq_sta->active_tbl; |
704 | 705 | ||
705 | /* Get mac80211 antenna info */ | 706 | /* Get mac80211 antenna info */ |
706 | lq->antenna = (lq->valid_antenna & local->hw.conf.antenna_sel_tx); | 707 | lq_sta->antenna = |
707 | if (!lq->antenna) | 708 | (lq_sta->valid_antenna & local->hw.conf.antenna_sel_tx); |
708 | lq->antenna = lq->valid_antenna; | 709 | if (!lq_sta->antenna) |
710 | lq_sta->antenna = lq_sta->valid_antenna; | ||
709 | 711 | ||
710 | /* Ignore mac80211 antenna info for now */ | 712 | /* Ignore mac80211 antenna info for now */ |
711 | lq->antenna = lq->valid_antenna; | 713 | lq_sta->antenna = lq_sta->valid_antenna; |
712 | 714 | ||
713 | curr_tbl = &(lq->lq_info[active_index]); | 715 | curr_tbl = &(lq_sta->lq_info[active_index]); |
714 | search_tbl = &(lq->lq_info[(1 - active_index)]); | 716 | search_tbl = &(lq_sta->lq_info[(1 - active_index)]); |
715 | window = (struct iwl4965_rate_scale_data *) | 717 | window = (struct iwl4965_rate_scale_data *) |
716 | &(curr_tbl->win[0]); | 718 | &(curr_tbl->win[0]); |
717 | search_win = (struct iwl4965_rate_scale_data *) | 719 | search_win = (struct iwl4965_rate_scale_data *) |
@@ -780,8 +782,8 @@ static void rs_tx_status(void *priv_rate, | |||
780 | 782 | ||
781 | /* If not searching for a new mode, increment failed counter | 783 | /* If not searching for a new mode, increment failed counter |
782 | * ... this helps determine when to start searching again */ | 784 | * ... this helps determine when to start searching again */ |
783 | if (lq->stay_in_tbl) | 785 | if (lq_sta->stay_in_tbl) |
784 | lq->total_failed++; | 786 | lq_sta->total_failed++; |
785 | --retries; | 787 | --retries; |
786 | index++; | 788 | index++; |
787 | 789 | ||
@@ -833,11 +835,11 @@ static void rs_tx_status(void *priv_rate, | |||
833 | 835 | ||
834 | /* If not searching for new mode, increment success/failed counter | 836 | /* If not searching for new mode, increment success/failed counter |
835 | * ... these help determine when to start searching again */ | 837 | * ... these help determine when to start searching again */ |
836 | if (lq->stay_in_tbl) { | 838 | if (lq_sta->stay_in_tbl) { |
837 | if (status) | 839 | if (status) |
838 | lq->total_success++; | 840 | lq_sta->total_success++; |
839 | else | 841 | else |
840 | lq->total_failed++; | 842 | lq_sta->total_failed++; |
841 | } | 843 | } |
842 | 844 | ||
843 | /* See if there's a better rate or modulation mode to try. */ | 845 | /* See if there's a better rate or modulation mode to try. */ |
@@ -879,28 +881,28 @@ static u8 rs_is_other_ant_connected(u8 valid_antenna, | |||
879 | * searching for a new mode. | 881 | * searching for a new mode. |
880 | */ | 882 | */ |
881 | static void rs_set_stay_in_table(u8 is_legacy, | 883 | static void rs_set_stay_in_table(u8 is_legacy, |
882 | struct iwl4965_rate_scale_priv *lq_data) | 884 | struct iwl4965_lq_sta *lq_sta) |
883 | { | 885 | { |
884 | IWL_DEBUG_HT("we are staying in the same table\n"); | 886 | IWL_DEBUG_HT("we are staying in the same table\n"); |
885 | lq_data->stay_in_tbl = 1; /* only place this gets set */ | 887 | lq_sta->stay_in_tbl = 1; /* only place this gets set */ |
886 | if (is_legacy) { | 888 | if (is_legacy) { |
887 | lq_data->table_count_limit = IWL_LEGACY_TABLE_COUNT; | 889 | lq_sta->table_count_limit = IWL_LEGACY_TABLE_COUNT; |
888 | lq_data->max_failure_limit = IWL_LEGACY_FAILURE_LIMIT; | 890 | lq_sta->max_failure_limit = IWL_LEGACY_FAILURE_LIMIT; |
889 | lq_data->max_success_limit = IWL_LEGACY_SUCCESS_LIMIT; | 891 | lq_sta->max_success_limit = IWL_LEGACY_SUCCESS_LIMIT; |
890 | } else { | 892 | } else { |
891 | lq_data->table_count_limit = IWL_NONE_LEGACY_TABLE_COUNT; | 893 | lq_sta->table_count_limit = IWL_NONE_LEGACY_TABLE_COUNT; |
892 | lq_data->max_failure_limit = IWL_NONE_LEGACY_FAILURE_LIMIT; | 894 | lq_sta->max_failure_limit = IWL_NONE_LEGACY_FAILURE_LIMIT; |
893 | lq_data->max_success_limit = IWL_NONE_LEGACY_SUCCESS_LIMIT; | 895 | lq_sta->max_success_limit = IWL_NONE_LEGACY_SUCCESS_LIMIT; |
894 | } | 896 | } |
895 | lq_data->table_count = 0; | 897 | lq_sta->table_count = 0; |
896 | lq_data->total_failed = 0; | 898 | lq_sta->total_failed = 0; |
897 | lq_data->total_success = 0; | 899 | lq_sta->total_success = 0; |
898 | } | 900 | } |
899 | 901 | ||
900 | /* | 902 | /* |
901 | * Find correct throughput table for given mode of modulation | 903 | * Find correct throughput table for given mode of modulation |
902 | */ | 904 | */ |
903 | static void rs_get_expected_tpt_table(struct iwl4965_rate_scale_priv *lq_data, | 905 | static void rs_get_expected_tpt_table(struct iwl4965_lq_sta *lq_sta, |
904 | struct iwl4965_scale_tbl_info *tbl) | 906 | struct iwl4965_scale_tbl_info *tbl) |
905 | { | 907 | { |
906 | if (is_legacy(tbl->lq_type)) { | 908 | if (is_legacy(tbl->lq_type)) { |
@@ -909,7 +911,7 @@ static void rs_get_expected_tpt_table(struct iwl4965_rate_scale_priv *lq_data, | |||
909 | else | 911 | else |
910 | tbl->expected_tpt = expected_tpt_A; | 912 | tbl->expected_tpt = expected_tpt_A; |
911 | } else if (is_siso(tbl->lq_type)) { | 913 | } else if (is_siso(tbl->lq_type)) { |
912 | if (tbl->is_fat && !lq_data->is_dup) | 914 | if (tbl->is_fat && !lq_sta->is_dup) |
913 | if (tbl->is_SGI) | 915 | if (tbl->is_SGI) |
914 | tbl->expected_tpt = expected_tpt_siso40MHzSGI; | 916 | tbl->expected_tpt = expected_tpt_siso40MHzSGI; |
915 | else | 917 | else |
@@ -920,7 +922,7 @@ static void rs_get_expected_tpt_table(struct iwl4965_rate_scale_priv *lq_data, | |||
920 | tbl->expected_tpt = expected_tpt_siso20MHz; | 922 | tbl->expected_tpt = expected_tpt_siso20MHz; |
921 | 923 | ||
922 | } else if (is_mimo(tbl->lq_type)) { | 924 | } else if (is_mimo(tbl->lq_type)) { |
923 | if (tbl->is_fat && !lq_data->is_dup) | 925 | if (tbl->is_fat && !lq_sta->is_dup) |
924 | if (tbl->is_SGI) | 926 | if (tbl->is_SGI) |
925 | tbl->expected_tpt = expected_tpt_mimo40MHzSGI; | 927 | tbl->expected_tpt = expected_tpt_mimo40MHzSGI; |
926 | else | 928 | else |
@@ -947,13 +949,13 @@ static void rs_get_expected_tpt_table(struct iwl4965_rate_scale_priv *lq_data, | |||
947 | * bit rate will typically need to increase, but not if performance was bad. | 949 | * bit rate will typically need to increase, but not if performance was bad. |
948 | */ | 950 | */ |
949 | static s32 rs_get_best_rate(struct iwl4965_priv *priv, | 951 | static s32 rs_get_best_rate(struct iwl4965_priv *priv, |
950 | struct iwl4965_rate_scale_priv *lq_data, | 952 | struct iwl4965_lq_sta *lq_sta, |
951 | struct iwl4965_scale_tbl_info *tbl, /* "search" */ | 953 | struct iwl4965_scale_tbl_info *tbl, /* "search" */ |
952 | u16 rate_mask, s8 index, s8 rate) | 954 | u16 rate_mask, s8 index, s8 rate) |
953 | { | 955 | { |
954 | /* "active" values */ | 956 | /* "active" values */ |
955 | struct iwl4965_scale_tbl_info *active_tbl = | 957 | struct iwl4965_scale_tbl_info *active_tbl = |
956 | &(lq_data->lq_info[lq_data->active_tbl]); | 958 | &(lq_sta->lq_info[lq_sta->active_tbl]); |
957 | s32 active_sr = active_tbl->win[index].success_ratio; | 959 | s32 active_sr = active_tbl->win[index].success_ratio; |
958 | s32 active_tpt = active_tbl->expected_tpt[index]; | 960 | s32 active_tpt = active_tbl->expected_tpt[index]; |
959 | 961 | ||
@@ -986,7 +988,7 @@ static s32 rs_get_best_rate(struct iwl4965_priv *priv, | |||
986 | * conditions) at candidate rate is above expected | 988 | * conditions) at candidate rate is above expected |
987 | * "active" throughput (under perfect conditions). | 989 | * "active" throughput (under perfect conditions). |
988 | */ | 990 | */ |
989 | if ((((100 * tpt_tbl[rate]) > lq_data->last_tpt) && | 991 | if ((((100 * tpt_tbl[rate]) > lq_sta->last_tpt) && |
990 | ((active_sr > IWL_RATE_DECREASE_TH) && | 992 | ((active_sr > IWL_RATE_DECREASE_TH) && |
991 | (active_sr <= IWL_RATE_HIGH_TH) && | 993 | (active_sr <= IWL_RATE_HIGH_TH) && |
992 | (tpt_tbl[rate] <= active_tpt))) || | 994 | (tpt_tbl[rate] <= active_tpt))) || |
@@ -1045,7 +1047,7 @@ static inline u8 rs_is_both_ant_supp(u8 valid_antenna) | |||
1045 | * Set up search table for MIMO | 1047 | * Set up search table for MIMO |
1046 | */ | 1048 | */ |
1047 | static int rs_switch_to_mimo(struct iwl4965_priv *priv, | 1049 | static int rs_switch_to_mimo(struct iwl4965_priv *priv, |
1048 | struct iwl4965_rate_scale_priv *lq_data, | 1050 | struct iwl4965_lq_sta *lq_sta, |
1049 | struct ieee80211_conf *conf, | 1051 | struct ieee80211_conf *conf, |
1050 | struct sta_info *sta, | 1052 | struct sta_info *sta, |
1051 | struct iwl4965_scale_tbl_info *tbl, int index) | 1053 | struct iwl4965_scale_tbl_info *tbl, int index) |
@@ -1053,7 +1055,7 @@ static int rs_switch_to_mimo(struct iwl4965_priv *priv, | |||
1053 | #ifdef CONFIG_IWL4965_HT | 1055 | #ifdef CONFIG_IWL4965_HT |
1054 | u16 rate_mask; | 1056 | u16 rate_mask; |
1055 | s32 rate; | 1057 | s32 rate; |
1056 | s8 is_green = lq_data->is_green; | 1058 | s8 is_green = lq_sta->is_green; |
1057 | 1059 | ||
1058 | if (!(conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) || | 1060 | if (!(conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE) || |
1059 | !sta->ht_info.ht_supported) | 1061 | !sta->ht_info.ht_supported) |
@@ -1061,17 +1063,17 @@ static int rs_switch_to_mimo(struct iwl4965_priv *priv, | |||
1061 | 1063 | ||
1062 | IWL_DEBUG_HT("LQ: try to switch to MIMO\n"); | 1064 | IWL_DEBUG_HT("LQ: try to switch to MIMO\n"); |
1063 | tbl->lq_type = LQ_MIMO; | 1065 | tbl->lq_type = LQ_MIMO; |
1064 | rs_get_supported_rates(lq_data, NULL, tbl->lq_type, | 1066 | rs_get_supported_rates(lq_sta, NULL, tbl->lq_type, |
1065 | &rate_mask); | 1067 | &rate_mask); |
1066 | 1068 | ||
1067 | if (priv->current_ht_config.tx_mimo_ps_mode == IWL_MIMO_PS_STATIC) | 1069 | if (priv->current_ht_config.tx_mimo_ps_mode == IWL_MIMO_PS_STATIC) |
1068 | return -1; | 1070 | return -1; |
1069 | 1071 | ||
1070 | /* Need both Tx chains/antennas to support MIMO */ | 1072 | /* Need both Tx chains/antennas to support MIMO */ |
1071 | if (!rs_is_both_ant_supp(lq_data->antenna)) | 1073 | if (!rs_is_both_ant_supp(lq_sta->antenna)) |
1072 | return -1; | 1074 | return -1; |
1073 | 1075 | ||
1074 | tbl->is_dup = lq_data->is_dup; | 1076 | tbl->is_dup = lq_sta->is_dup; |
1075 | tbl->action = 0; | 1077 | tbl->action = 0; |
1076 | if (priv->current_ht_config.supported_chan_width | 1078 | if (priv->current_ht_config.supported_chan_width |
1077 | == IWL_CHANNEL_WIDTH_40MHZ) | 1079 | == IWL_CHANNEL_WIDTH_40MHZ) |
@@ -1089,9 +1091,9 @@ static int rs_switch_to_mimo(struct iwl4965_priv *priv, | |||
1089 | else | 1091 | else |
1090 | tbl->is_SGI = 0; | 1092 | tbl->is_SGI = 0; |
1091 | 1093 | ||
1092 | rs_get_expected_tpt_table(lq_data, tbl); | 1094 | rs_get_expected_tpt_table(lq_sta, tbl); |
1093 | 1095 | ||
1094 | rate = rs_get_best_rate(priv, lq_data, tbl, rate_mask, index, index); | 1096 | rate = rs_get_best_rate(priv, lq_sta, tbl, rate_mask, index, index); |
1095 | 1097 | ||
1096 | IWL_DEBUG_HT("LQ: MIMO best rate %d mask %X\n", rate, rate_mask); | 1098 | IWL_DEBUG_HT("LQ: MIMO best rate %d mask %X\n", rate, rate_mask); |
1097 | if ((rate == IWL_RATE_INVALID) || !((1 << rate) & rate_mask)) | 1099 | if ((rate == IWL_RATE_INVALID) || !((1 << rate) & rate_mask)) |
@@ -1110,14 +1112,14 @@ static int rs_switch_to_mimo(struct iwl4965_priv *priv, | |||
1110 | * Set up search table for SISO | 1112 | * Set up search table for SISO |
1111 | */ | 1113 | */ |
1112 | static int rs_switch_to_siso(struct iwl4965_priv *priv, | 1114 | static int rs_switch_to_siso(struct iwl4965_priv *priv, |
1113 | struct iwl4965_rate_scale_priv *lq_data, | 1115 | struct iwl4965_lq_sta *lq_sta, |
1114 | struct ieee80211_conf *conf, | 1116 | struct ieee80211_conf *conf, |
1115 | struct sta_info *sta, | 1117 | struct sta_info *sta, |
1116 | struct iwl4965_scale_tbl_info *tbl, int index) | 1118 | struct iwl4965_scale_tbl_info *tbl, int index) |
1117 | { | 1119 | { |
1118 | #ifdef CONFIG_IWL4965_HT | 1120 | #ifdef CONFIG_IWL4965_HT |
1119 | u16 rate_mask; | 1121 | u16 rate_mask; |
1120 | u8 is_green = lq_data->is_green; | 1122 | u8 is_green = lq_sta->is_green; |
1121 | s32 rate; | 1123 | s32 rate; |
1122 | 1124 | ||
1123 | IWL_DEBUG_HT("LQ: try to switch to SISO\n"); | 1125 | IWL_DEBUG_HT("LQ: try to switch to SISO\n"); |
@@ -1125,10 +1127,10 @@ static int rs_switch_to_siso(struct iwl4965_priv *priv, | |||
1125 | !sta->ht_info.ht_supported) | 1127 | !sta->ht_info.ht_supported) |
1126 | return -1; | 1128 | return -1; |
1127 | 1129 | ||
1128 | tbl->is_dup = lq_data->is_dup; | 1130 | tbl->is_dup = lq_sta->is_dup; |
1129 | tbl->lq_type = LQ_SISO; | 1131 | tbl->lq_type = LQ_SISO; |
1130 | tbl->action = 0; | 1132 | tbl->action = 0; |
1131 | rs_get_supported_rates(lq_data, NULL, tbl->lq_type, | 1133 | rs_get_supported_rates(lq_sta, NULL, tbl->lq_type, |
1132 | &rate_mask); | 1134 | &rate_mask); |
1133 | 1135 | ||
1134 | if (priv->current_ht_config.supported_chan_width | 1136 | if (priv->current_ht_config.supported_chan_width |
@@ -1150,8 +1152,8 @@ static int rs_switch_to_siso(struct iwl4965_priv *priv, | |||
1150 | if (is_green) | 1152 | if (is_green) |
1151 | tbl->is_SGI = 0; | 1153 | tbl->is_SGI = 0; |
1152 | 1154 | ||
1153 | rs_get_expected_tpt_table(lq_data, tbl); | 1155 | rs_get_expected_tpt_table(lq_sta, tbl); |
1154 | rate = rs_get_best_rate(priv, lq_data, tbl, rate_mask, index, index); | 1156 | rate = rs_get_best_rate(priv, lq_sta, tbl, rate_mask, index, index); |
1155 | 1157 | ||
1156 | IWL_DEBUG_HT("LQ: get best rate %d mask %X\n", rate, rate_mask); | 1158 | IWL_DEBUG_HT("LQ: get best rate %d mask %X\n", rate, rate_mask); |
1157 | if ((rate == IWL_RATE_INVALID) || !((1 << rate) & rate_mask)) { | 1159 | if ((rate == IWL_RATE_INVALID) || !((1 << rate) & rate_mask)) { |
@@ -1173,16 +1175,16 @@ static int rs_switch_to_siso(struct iwl4965_priv *priv, | |||
1173 | * Try to switch to new modulation mode from legacy | 1175 | * Try to switch to new modulation mode from legacy |
1174 | */ | 1176 | */ |
1175 | static int rs_move_legacy_other(struct iwl4965_priv *priv, | 1177 | static int rs_move_legacy_other(struct iwl4965_priv *priv, |
1176 | struct iwl4965_rate_scale_priv *lq_data, | 1178 | struct iwl4965_lq_sta *lq_sta, |
1177 | struct ieee80211_conf *conf, | 1179 | struct ieee80211_conf *conf, |
1178 | struct sta_info *sta, | 1180 | struct sta_info *sta, |
1179 | int index) | 1181 | int index) |
1180 | { | 1182 | { |
1181 | int ret = 0; | 1183 | int ret = 0; |
1182 | struct iwl4965_scale_tbl_info *tbl = | 1184 | struct iwl4965_scale_tbl_info *tbl = |
1183 | &(lq_data->lq_info[lq_data->active_tbl]); | 1185 | &(lq_sta->lq_info[lq_sta->active_tbl]); |
1184 | struct iwl4965_scale_tbl_info *search_tbl = | 1186 | struct iwl4965_scale_tbl_info *search_tbl = |
1185 | &(lq_data->lq_info[(1 - lq_data->active_tbl)]); | 1187 | &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); |
1186 | struct iwl4965_rate_scale_data *window = &(tbl->win[index]); | 1188 | struct iwl4965_rate_scale_data *window = &(tbl->win[index]); |
1187 | u32 sz = (sizeof(struct iwl4965_scale_tbl_info) - | 1189 | u32 sz = (sizeof(struct iwl4965_scale_tbl_info) - |
1188 | (sizeof(struct iwl4965_rate_scale_data) * IWL_RATE_COUNT)); | 1190 | (sizeof(struct iwl4965_rate_scale_data) * IWL_RATE_COUNT)); |
@@ -1194,14 +1196,14 @@ static int rs_move_legacy_other(struct iwl4965_priv *priv, | |||
1194 | IWL_DEBUG_HT("LQ Legacy switch Antenna\n"); | 1196 | IWL_DEBUG_HT("LQ Legacy switch Antenna\n"); |
1195 | 1197 | ||
1196 | search_tbl->lq_type = LQ_NONE; | 1198 | search_tbl->lq_type = LQ_NONE; |
1197 | lq_data->action_counter++; | 1199 | lq_sta->action_counter++; |
1198 | 1200 | ||
1199 | /* Don't change antenna if success has been great */ | 1201 | /* Don't change antenna if success has been great */ |
1200 | if (window->success_ratio >= IWL_RS_GOOD_RATIO) | 1202 | if (window->success_ratio >= IWL_RS_GOOD_RATIO) |
1201 | break; | 1203 | break; |
1202 | 1204 | ||
1203 | /* Don't change antenna if other one is not connected */ | 1205 | /* Don't change antenna if other one is not connected */ |
1204 | if (!rs_is_other_ant_connected(lq_data->antenna, | 1206 | if (!rs_is_other_ant_connected(lq_sta->antenna, |
1205 | tbl->antenna_type)) | 1207 | tbl->antenna_type)) |
1206 | break; | 1208 | break; |
1207 | 1209 | ||
@@ -1210,8 +1212,8 @@ static int rs_move_legacy_other(struct iwl4965_priv *priv, | |||
1210 | 1212 | ||
1211 | rs_toggle_antenna(&(search_tbl->current_rate), | 1213 | rs_toggle_antenna(&(search_tbl->current_rate), |
1212 | search_tbl); | 1214 | search_tbl); |
1213 | rs_get_expected_tpt_table(lq_data, search_tbl); | 1215 | rs_get_expected_tpt_table(lq_sta, search_tbl); |
1214 | lq_data->search_better_tbl = 1; | 1216 | lq_sta->search_better_tbl = 1; |
1215 | goto out; | 1217 | goto out; |
1216 | 1218 | ||
1217 | case IWL_LEGACY_SWITCH_SISO: | 1219 | case IWL_LEGACY_SWITCH_SISO: |
@@ -1222,11 +1224,11 @@ static int rs_move_legacy_other(struct iwl4965_priv *priv, | |||
1222 | search_tbl->lq_type = LQ_SISO; | 1224 | search_tbl->lq_type = LQ_SISO; |
1223 | search_tbl->is_SGI = 0; | 1225 | search_tbl->is_SGI = 0; |
1224 | search_tbl->is_fat = 0; | 1226 | search_tbl->is_fat = 0; |
1225 | ret = rs_switch_to_siso(priv, lq_data, conf, sta, | 1227 | ret = rs_switch_to_siso(priv, lq_sta, conf, sta, |
1226 | search_tbl, index); | 1228 | search_tbl, index); |
1227 | if (!ret) { | 1229 | if (!ret) { |
1228 | lq_data->search_better_tbl = 1; | 1230 | lq_sta->search_better_tbl = 1; |
1229 | lq_data->action_counter = 0; | 1231 | lq_sta->action_counter = 0; |
1230 | goto out; | 1232 | goto out; |
1231 | } | 1233 | } |
1232 | 1234 | ||
@@ -1240,11 +1242,11 @@ static int rs_move_legacy_other(struct iwl4965_priv *priv, | |||
1240 | search_tbl->is_SGI = 0; | 1242 | search_tbl->is_SGI = 0; |
1241 | search_tbl->is_fat = 0; | 1243 | search_tbl->is_fat = 0; |
1242 | search_tbl->antenna_type = ANT_BOTH; | 1244 | search_tbl->antenna_type = ANT_BOTH; |
1243 | ret = rs_switch_to_mimo(priv, lq_data, conf, sta, | 1245 | ret = rs_switch_to_mimo(priv, lq_sta, conf, sta, |
1244 | search_tbl, index); | 1246 | search_tbl, index); |
1245 | if (!ret) { | 1247 | if (!ret) { |
1246 | lq_data->search_better_tbl = 1; | 1248 | lq_sta->search_better_tbl = 1; |
1247 | lq_data->action_counter = 0; | 1249 | lq_sta->action_counter = 0; |
1248 | goto out; | 1250 | goto out; |
1249 | } | 1251 | } |
1250 | break; | 1252 | break; |
@@ -1271,31 +1273,31 @@ static int rs_move_legacy_other(struct iwl4965_priv *priv, | |||
1271 | * Try to switch to new modulation mode from SISO | 1273 | * Try to switch to new modulation mode from SISO |
1272 | */ | 1274 | */ |
1273 | static int rs_move_siso_to_other(struct iwl4965_priv *priv, | 1275 | static int rs_move_siso_to_other(struct iwl4965_priv *priv, |
1274 | struct iwl4965_rate_scale_priv *lq_data, | 1276 | struct iwl4965_lq_sta *lq_sta, |
1275 | struct ieee80211_conf *conf, | 1277 | struct ieee80211_conf *conf, |
1276 | struct sta_info *sta, | 1278 | struct sta_info *sta, |
1277 | int index) | 1279 | int index) |
1278 | { | 1280 | { |
1279 | int ret; | 1281 | int ret; |
1280 | u8 is_green = lq_data->is_green; | 1282 | u8 is_green = lq_sta->is_green; |
1281 | struct iwl4965_scale_tbl_info *tbl = | 1283 | struct iwl4965_scale_tbl_info *tbl = |
1282 | &(lq_data->lq_info[lq_data->active_tbl]); | 1284 | &(lq_sta->lq_info[lq_sta->active_tbl]); |
1283 | struct iwl4965_scale_tbl_info *search_tbl = | 1285 | struct iwl4965_scale_tbl_info *search_tbl = |
1284 | &(lq_data->lq_info[(1 - lq_data->active_tbl)]); | 1286 | &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); |
1285 | struct iwl4965_rate_scale_data *window = &(tbl->win[index]); | 1287 | struct iwl4965_rate_scale_data *window = &(tbl->win[index]); |
1286 | u32 sz = (sizeof(struct iwl4965_scale_tbl_info) - | 1288 | u32 sz = (sizeof(struct iwl4965_scale_tbl_info) - |
1287 | (sizeof(struct iwl4965_rate_scale_data) * IWL_RATE_COUNT)); | 1289 | (sizeof(struct iwl4965_rate_scale_data) * IWL_RATE_COUNT)); |
1288 | u8 start_action = tbl->action; | 1290 | u8 start_action = tbl->action; |
1289 | 1291 | ||
1290 | for (;;) { | 1292 | for (;;) { |
1291 | lq_data->action_counter++; | 1293 | lq_sta->action_counter++; |
1292 | switch (tbl->action) { | 1294 | switch (tbl->action) { |
1293 | case IWL_SISO_SWITCH_ANTENNA: | 1295 | case IWL_SISO_SWITCH_ANTENNA: |
1294 | IWL_DEBUG_HT("LQ: SISO SWITCH ANTENNA SISO\n"); | 1296 | IWL_DEBUG_HT("LQ: SISO SWITCH ANTENNA SISO\n"); |
1295 | search_tbl->lq_type = LQ_NONE; | 1297 | search_tbl->lq_type = LQ_NONE; |
1296 | if (window->success_ratio >= IWL_RS_GOOD_RATIO) | 1298 | if (window->success_ratio >= IWL_RS_GOOD_RATIO) |
1297 | break; | 1299 | break; |
1298 | if (!rs_is_other_ant_connected(lq_data->antenna, | 1300 | if (!rs_is_other_ant_connected(lq_sta->antenna, |
1299 | tbl->antenna_type)) | 1301 | tbl->antenna_type)) |
1300 | break; | 1302 | break; |
1301 | 1303 | ||
@@ -1303,7 +1305,7 @@ static int rs_move_siso_to_other(struct iwl4965_priv *priv, | |||
1303 | search_tbl->action = IWL_SISO_SWITCH_MIMO; | 1305 | search_tbl->action = IWL_SISO_SWITCH_MIMO; |
1304 | rs_toggle_antenna(&(search_tbl->current_rate), | 1306 | rs_toggle_antenna(&(search_tbl->current_rate), |
1305 | search_tbl); | 1307 | search_tbl); |
1306 | lq_data->search_better_tbl = 1; | 1308 | lq_sta->search_better_tbl = 1; |
1307 | 1309 | ||
1308 | goto out; | 1310 | goto out; |
1309 | 1311 | ||
@@ -1314,10 +1316,10 @@ static int rs_move_siso_to_other(struct iwl4965_priv *priv, | |||
1314 | search_tbl->is_SGI = 0; | 1316 | search_tbl->is_SGI = 0; |
1315 | search_tbl->is_fat = 0; | 1317 | search_tbl->is_fat = 0; |
1316 | search_tbl->antenna_type = ANT_BOTH; | 1318 | search_tbl->antenna_type = ANT_BOTH; |
1317 | ret = rs_switch_to_mimo(priv, lq_data, conf, sta, | 1319 | ret = rs_switch_to_mimo(priv, lq_sta, conf, sta, |
1318 | search_tbl, index); | 1320 | search_tbl, index); |
1319 | if (!ret) { | 1321 | if (!ret) { |
1320 | lq_data->search_better_tbl = 1; | 1322 | lq_sta->search_better_tbl = 1; |
1321 | goto out; | 1323 | goto out; |
1322 | } | 1324 | } |
1323 | break; | 1325 | break; |
@@ -1331,17 +1333,17 @@ static int rs_move_siso_to_other(struct iwl4965_priv *priv, | |||
1331 | search_tbl->is_SGI = 1; | 1333 | search_tbl->is_SGI = 1; |
1332 | else | 1334 | else |
1333 | break; | 1335 | break; |
1334 | lq_data->search_better_tbl = 1; | 1336 | lq_sta->search_better_tbl = 1; |
1335 | if ((tbl->lq_type == LQ_SISO) && | 1337 | if ((tbl->lq_type == LQ_SISO) && |
1336 | (tbl->is_SGI)) { | 1338 | (tbl->is_SGI)) { |
1337 | s32 tpt = lq_data->last_tpt / 100; | 1339 | s32 tpt = lq_sta->last_tpt / 100; |
1338 | if (((!tbl->is_fat) && | 1340 | if (((!tbl->is_fat) && |
1339 | (tpt >= expected_tpt_siso20MHz[index])) || | 1341 | (tpt >= expected_tpt_siso20MHz[index])) || |
1340 | ((tbl->is_fat) && | 1342 | ((tbl->is_fat) && |
1341 | (tpt >= expected_tpt_siso40MHz[index]))) | 1343 | (tpt >= expected_tpt_siso40MHz[index]))) |
1342 | lq_data->search_better_tbl = 0; | 1344 | lq_sta->search_better_tbl = 0; |
1343 | } | 1345 | } |
1344 | rs_get_expected_tpt_table(lq_data, search_tbl); | 1346 | rs_get_expected_tpt_table(lq_sta, search_tbl); |
1345 | rs_mcs_from_tbl(&search_tbl->current_rate, | 1347 | rs_mcs_from_tbl(&search_tbl->current_rate, |
1346 | search_tbl, index, is_green); | 1348 | search_tbl, index, is_green); |
1347 | goto out; | 1349 | goto out; |
@@ -1366,23 +1368,23 @@ static int rs_move_siso_to_other(struct iwl4965_priv *priv, | |||
1366 | * Try to switch to new modulation mode from MIMO | 1368 | * Try to switch to new modulation mode from MIMO |
1367 | */ | 1369 | */ |
1368 | static int rs_move_mimo_to_other(struct iwl4965_priv *priv, | 1370 | static int rs_move_mimo_to_other(struct iwl4965_priv *priv, |
1369 | struct iwl4965_rate_scale_priv *lq_data, | 1371 | struct iwl4965_lq_sta *lq_sta, |
1370 | struct ieee80211_conf *conf, | 1372 | struct ieee80211_conf *conf, |
1371 | struct sta_info *sta, | 1373 | struct sta_info *sta, |
1372 | int index) | 1374 | int index) |
1373 | { | 1375 | { |
1374 | int ret; | 1376 | int ret; |
1375 | s8 is_green = lq_data->is_green; | 1377 | s8 is_green = lq_sta->is_green; |
1376 | struct iwl4965_scale_tbl_info *tbl = | 1378 | struct iwl4965_scale_tbl_info *tbl = |
1377 | &(lq_data->lq_info[lq_data->active_tbl]); | 1379 | &(lq_sta->lq_info[lq_sta->active_tbl]); |
1378 | struct iwl4965_scale_tbl_info *search_tbl = | 1380 | struct iwl4965_scale_tbl_info *search_tbl = |
1379 | &(lq_data->lq_info[(1 - lq_data->active_tbl)]); | 1381 | &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); |
1380 | u32 sz = (sizeof(struct iwl4965_scale_tbl_info) - | 1382 | u32 sz = (sizeof(struct iwl4965_scale_tbl_info) - |
1381 | (sizeof(struct iwl4965_rate_scale_data) * IWL_RATE_COUNT)); | 1383 | (sizeof(struct iwl4965_rate_scale_data) * IWL_RATE_COUNT)); |
1382 | u8 start_action = tbl->action; | 1384 | u8 start_action = tbl->action; |
1383 | 1385 | ||
1384 | for (;;) { | 1386 | for (;;) { |
1385 | lq_data->action_counter++; | 1387 | lq_sta->action_counter++; |
1386 | switch (tbl->action) { | 1388 | switch (tbl->action) { |
1387 | case IWL_MIMO_SWITCH_ANTENNA_A: | 1389 | case IWL_MIMO_SWITCH_ANTENNA_A: |
1388 | case IWL_MIMO_SWITCH_ANTENNA_B: | 1390 | case IWL_MIMO_SWITCH_ANTENNA_B: |
@@ -1398,10 +1400,10 @@ static int rs_move_mimo_to_other(struct iwl4965_priv *priv, | |||
1398 | else | 1400 | else |
1399 | search_tbl->antenna_type = ANT_AUX; | 1401 | search_tbl->antenna_type = ANT_AUX; |
1400 | 1402 | ||
1401 | ret = rs_switch_to_siso(priv, lq_data, conf, sta, | 1403 | ret = rs_switch_to_siso(priv, lq_sta, conf, sta, |
1402 | search_tbl, index); | 1404 | search_tbl, index); |
1403 | if (!ret) { | 1405 | if (!ret) { |
1404 | lq_data->search_better_tbl = 1; | 1406 | lq_sta->search_better_tbl = 1; |
1405 | goto out; | 1407 | goto out; |
1406 | } | 1408 | } |
1407 | break; | 1409 | break; |
@@ -1418,7 +1420,7 @@ static int rs_move_mimo_to_other(struct iwl4965_priv *priv, | |||
1418 | search_tbl->is_SGI = 0; | 1420 | search_tbl->is_SGI = 0; |
1419 | else | 1421 | else |
1420 | search_tbl->is_SGI = 1; | 1422 | search_tbl->is_SGI = 1; |
1421 | lq_data->search_better_tbl = 1; | 1423 | lq_sta->search_better_tbl = 1; |
1422 | 1424 | ||
1423 | /* | 1425 | /* |
1424 | * If active table already uses the fastest possible | 1426 | * If active table already uses the fastest possible |
@@ -1428,14 +1430,14 @@ static int rs_move_mimo_to_other(struct iwl4965_priv *priv, | |||
1428 | */ | 1430 | */ |
1429 | if ((tbl->lq_type == LQ_MIMO) && | 1431 | if ((tbl->lq_type == LQ_MIMO) && |
1430 | (tbl->is_SGI)) { | 1432 | (tbl->is_SGI)) { |
1431 | s32 tpt = lq_data->last_tpt / 100; | 1433 | s32 tpt = lq_sta->last_tpt / 100; |
1432 | if (((!tbl->is_fat) && | 1434 | if (((!tbl->is_fat) && |
1433 | (tpt >= expected_tpt_mimo20MHz[index])) || | 1435 | (tpt >= expected_tpt_mimo20MHz[index])) || |
1434 | ((tbl->is_fat) && | 1436 | ((tbl->is_fat) && |
1435 | (tpt >= expected_tpt_mimo40MHz[index]))) | 1437 | (tpt >= expected_tpt_mimo40MHz[index]))) |
1436 | lq_data->search_better_tbl = 0; | 1438 | lq_sta->search_better_tbl = 0; |
1437 | } | 1439 | } |
1438 | rs_get_expected_tpt_table(lq_data, search_tbl); | 1440 | rs_get_expected_tpt_table(lq_sta, search_tbl); |
1439 | rs_mcs_from_tbl(&search_tbl->current_rate, | 1441 | rs_mcs_from_tbl(&search_tbl->current_rate, |
1440 | search_tbl, index, is_green); | 1442 | search_tbl, index, is_green); |
1441 | goto out; | 1443 | goto out; |
@@ -1465,25 +1467,25 @@ static int rs_move_mimo_to_other(struct iwl4965_priv *priv, | |||
1465 | * 2) # times calling this function | 1467 | * 2) # times calling this function |
1466 | * 3) elapsed time in this mode (not used, for now) | 1468 | * 3) elapsed time in this mode (not used, for now) |
1467 | */ | 1469 | */ |
1468 | static void rs_stay_in_table(struct iwl4965_rate_scale_priv *lq_data) | 1470 | static void rs_stay_in_table(struct iwl4965_lq_sta *lq_sta) |
1469 | { | 1471 | { |
1470 | struct iwl4965_scale_tbl_info *tbl; | 1472 | struct iwl4965_scale_tbl_info *tbl; |
1471 | int i; | 1473 | int i; |
1472 | int active_tbl; | 1474 | int active_tbl; |
1473 | int flush_interval_passed = 0; | 1475 | int flush_interval_passed = 0; |
1474 | 1476 | ||
1475 | active_tbl = lq_data->active_tbl; | 1477 | active_tbl = lq_sta->active_tbl; |
1476 | 1478 | ||
1477 | tbl = &(lq_data->lq_info[active_tbl]); | 1479 | tbl = &(lq_sta->lq_info[active_tbl]); |
1478 | 1480 | ||
1479 | /* If we've been disallowing search, see if we should now allow it */ | 1481 | /* If we've been disallowing search, see if we should now allow it */ |
1480 | if (lq_data->stay_in_tbl) { | 1482 | if (lq_sta->stay_in_tbl) { |
1481 | 1483 | ||
1482 | /* Elapsed time using current modulation mode */ | 1484 | /* Elapsed time using current modulation mode */ |
1483 | if (lq_data->flush_timer) | 1485 | if (lq_sta->flush_timer) |
1484 | flush_interval_passed = | 1486 | flush_interval_passed = |
1485 | time_after(jiffies, | 1487 | time_after(jiffies, |
1486 | (unsigned long)(lq_data->flush_timer + | 1488 | (unsigned long)(lq_sta->flush_timer + |
1487 | IWL_RATE_SCALE_FLUSH_INTVL)); | 1489 | IWL_RATE_SCALE_FLUSH_INTVL)); |
1488 | 1490 | ||
1489 | /* For now, disable the elapsed time criterion */ | 1491 | /* For now, disable the elapsed time criterion */ |
@@ -1497,20 +1499,20 @@ static void rs_stay_in_table(struct iwl4965_rate_scale_priv *lq_data) | |||
1497 | * allow a new search. Also (below) reset all bitmaps and | 1499 | * allow a new search. Also (below) reset all bitmaps and |
1498 | * stats in active history. | 1500 | * stats in active history. |
1499 | */ | 1501 | */ |
1500 | if ((lq_data->total_failed > lq_data->max_failure_limit) || | 1502 | if ((lq_sta->total_failed > lq_sta->max_failure_limit) || |
1501 | (lq_data->total_success > lq_data->max_success_limit) || | 1503 | (lq_sta->total_success > lq_sta->max_success_limit) || |
1502 | ((!lq_data->search_better_tbl) && (lq_data->flush_timer) | 1504 | ((!lq_sta->search_better_tbl) && (lq_sta->flush_timer) |
1503 | && (flush_interval_passed))) { | 1505 | && (flush_interval_passed))) { |
1504 | IWL_DEBUG_HT("LQ: stay is expired %d %d %d\n:", | 1506 | IWL_DEBUG_HT("LQ: stay is expired %d %d %d\n:", |
1505 | lq_data->total_failed, | 1507 | lq_sta->total_failed, |
1506 | lq_data->total_success, | 1508 | lq_sta->total_success, |
1507 | flush_interval_passed); | 1509 | flush_interval_passed); |
1508 | 1510 | ||
1509 | /* Allow search for new mode */ | 1511 | /* Allow search for new mode */ |
1510 | lq_data->stay_in_tbl = 0; /* only place reset */ | 1512 | lq_sta->stay_in_tbl = 0; /* only place reset */ |
1511 | lq_data->total_failed = 0; | 1513 | lq_sta->total_failed = 0; |
1512 | lq_data->total_success = 0; | 1514 | lq_sta->total_success = 0; |
1513 | lq_data->flush_timer = 0; | 1515 | lq_sta->flush_timer = 0; |
1514 | 1516 | ||
1515 | /* | 1517 | /* |
1516 | * Else if we've used this modulation mode enough repetitions | 1518 | * Else if we've used this modulation mode enough repetitions |
@@ -1519,10 +1521,10 @@ static void rs_stay_in_table(struct iwl4965_rate_scale_priv *lq_data) | |||
1519 | * active table. | 1521 | * active table. |
1520 | */ | 1522 | */ |
1521 | } else { | 1523 | } else { |
1522 | lq_data->table_count++; | 1524 | lq_sta->table_count++; |
1523 | if (lq_data->table_count >= | 1525 | if (lq_sta->table_count >= |
1524 | lq_data->table_count_limit) { | 1526 | lq_sta->table_count_limit) { |
1525 | lq_data->table_count = 0; | 1527 | lq_sta->table_count = 0; |
1526 | 1528 | ||
1527 | IWL_DEBUG_HT("LQ: stay in table clear win\n"); | 1529 | IWL_DEBUG_HT("LQ: stay in table clear win\n"); |
1528 | for (i = 0; i < IWL_RATE_COUNT; i++) | 1530 | for (i = 0; i < IWL_RATE_COUNT; i++) |
@@ -1534,7 +1536,7 @@ static void rs_stay_in_table(struct iwl4965_rate_scale_priv *lq_data) | |||
1534 | /* If transitioning to allow "search", reset all history | 1536 | /* If transitioning to allow "search", reset all history |
1535 | * bitmaps and stats in active table (this will become the new | 1537 | * bitmaps and stats in active table (this will become the new |
1536 | * "search" table). */ | 1538 | * "search" table). */ |
1537 | if (!lq_data->stay_in_tbl) { | 1539 | if (!lq_sta->stay_in_tbl) { |
1538 | for (i = 0; i < IWL_RATE_COUNT; i++) | 1540 | for (i = 0; i < IWL_RATE_COUNT; i++) |
1539 | rs_rate_scale_clear_window(&(tbl->win[i])); | 1541 | rs_rate_scale_clear_window(&(tbl->win[i])); |
1540 | } | 1542 | } |
@@ -1564,7 +1566,7 @@ static void rs_rate_scale_perform(struct iwl4965_priv *priv, | |||
1564 | s8 scale_action = 0; | 1566 | s8 scale_action = 0; |
1565 | u16 fc, rate_mask; | 1567 | u16 fc, rate_mask; |
1566 | u8 update_lq = 0; | 1568 | u8 update_lq = 0; |
1567 | struct iwl4965_rate_scale_priv *lq_data; | 1569 | struct iwl4965_lq_sta *lq_sta; |
1568 | struct iwl4965_scale_tbl_info *tbl, *tbl1; | 1570 | struct iwl4965_scale_tbl_info *tbl, *tbl1; |
1569 | u16 rate_scale_index_msk = 0; | 1571 | u16 rate_scale_index_msk = 0; |
1570 | struct iwl4965_rate mcs_rate; | 1572 | struct iwl4965_rate mcs_rate; |
@@ -1590,20 +1592,20 @@ static void rs_rate_scale_perform(struct iwl4965_priv *priv, | |||
1590 | IWL_DEBUG_RATE("still rate scaling not ready\n"); | 1592 | IWL_DEBUG_RATE("still rate scaling not ready\n"); |
1591 | return; | 1593 | return; |
1592 | } | 1594 | } |
1593 | lq_data = (struct iwl4965_rate_scale_priv *)sta->rate_ctrl_priv; | 1595 | lq_sta = (struct iwl4965_lq_sta *)sta->rate_ctrl_priv; |
1594 | 1596 | ||
1595 | /* | 1597 | /* |
1596 | * Select rate-scale / modulation-mode table to work with in | 1598 | * Select rate-scale / modulation-mode table to work with in |
1597 | * the rest of this function: "search" if searching for better | 1599 | * the rest of this function: "search" if searching for better |
1598 | * modulation mode, or "active" if doing rate scaling within a mode. | 1600 | * modulation mode, or "active" if doing rate scaling within a mode. |
1599 | */ | 1601 | */ |
1600 | if (!lq_data->search_better_tbl) | 1602 | if (!lq_sta->search_better_tbl) |
1601 | active_tbl = lq_data->active_tbl; | 1603 | active_tbl = lq_sta->active_tbl; |
1602 | else | 1604 | else |
1603 | active_tbl = 1 - lq_data->active_tbl; | 1605 | active_tbl = 1 - lq_sta->active_tbl; |
1604 | 1606 | ||
1605 | tbl = &(lq_data->lq_info[active_tbl]); | 1607 | tbl = &(lq_sta->lq_info[active_tbl]); |
1606 | is_green = lq_data->is_green; | 1608 | is_green = lq_sta->is_green; |
1607 | 1609 | ||
1608 | /* current tx rate */ | 1610 | /* current tx rate */ |
1609 | index = sta->last_txrate; | 1611 | index = sta->last_txrate; |
@@ -1612,20 +1614,20 @@ static void rs_rate_scale_perform(struct iwl4965_priv *priv, | |||
1612 | tbl->lq_type); | 1614 | tbl->lq_type); |
1613 | 1615 | ||
1614 | /* rates available for this association, and for modulation mode */ | 1616 | /* rates available for this association, and for modulation mode */ |
1615 | rs_get_supported_rates(lq_data, hdr, tbl->lq_type, | 1617 | rs_get_supported_rates(lq_sta, hdr, tbl->lq_type, |
1616 | &rate_mask); | 1618 | &rate_mask); |
1617 | 1619 | ||
1618 | IWL_DEBUG_RATE("mask 0x%04X \n", rate_mask); | 1620 | IWL_DEBUG_RATE("mask 0x%04X \n", rate_mask); |
1619 | 1621 | ||
1620 | /* mask with station rate restriction */ | 1622 | /* mask with station rate restriction */ |
1621 | if (is_legacy(tbl->lq_type)) { | 1623 | if (is_legacy(tbl->lq_type)) { |
1622 | if (lq_data->phymode == (u8) MODE_IEEE80211A) | 1624 | if (lq_sta->phymode == (u8) MODE_IEEE80211A) |
1623 | /* supp_rates has no CCK bits in A mode */ | 1625 | /* supp_rates has no CCK bits in A mode */ |
1624 | rate_scale_index_msk = (u16) (rate_mask & | 1626 | rate_scale_index_msk = (u16) (rate_mask & |
1625 | (lq_data->supp_rates << IWL_FIRST_OFDM_RATE)); | 1627 | (lq_sta->supp_rates << IWL_FIRST_OFDM_RATE)); |
1626 | else | 1628 | else |
1627 | rate_scale_index_msk = (u16) (rate_mask & | 1629 | rate_scale_index_msk = (u16) (rate_mask & |
1628 | lq_data->supp_rates); | 1630 | lq_sta->supp_rates); |
1629 | 1631 | ||
1630 | } else | 1632 | } else |
1631 | rate_scale_index_msk = rate_mask; | 1633 | rate_scale_index_msk = rate_mask; |
@@ -1653,7 +1655,7 @@ static void rs_rate_scale_perform(struct iwl4965_priv *priv, | |||
1653 | 1655 | ||
1654 | /* Get expected throughput table and history window for current rate */ | 1656 | /* Get expected throughput table and history window for current rate */ |
1655 | if (!tbl->expected_tpt) | 1657 | if (!tbl->expected_tpt) |
1656 | rs_get_expected_tpt_table(lq_data, tbl); | 1658 | rs_get_expected_tpt_table(lq_sta, tbl); |
1657 | 1659 | ||
1658 | window = &(tbl->win[index]); | 1660 | window = &(tbl->win[index]); |
1659 | 1661 | ||
@@ -1677,13 +1679,13 @@ static void rs_rate_scale_perform(struct iwl4965_priv *priv, | |||
1677 | 1679 | ||
1678 | /* Should we stay with this modulation mode, | 1680 | /* Should we stay with this modulation mode, |
1679 | * or search for a new one? */ | 1681 | * or search for a new one? */ |
1680 | rs_stay_in_table(lq_data); | 1682 | rs_stay_in_table(lq_sta); |
1681 | 1683 | ||
1682 | /* Set up new rate table in uCode, if needed */ | 1684 | /* Set up new rate table in uCode, if needed */ |
1683 | if (update_lq) { | 1685 | if (update_lq) { |
1684 | rs_mcs_from_tbl(&mcs_rate, tbl, index, is_green); | 1686 | rs_mcs_from_tbl(&mcs_rate, tbl, index, is_green); |
1685 | rs_fill_link_cmd(lq_data, &mcs_rate, &lq_data->lq); | 1687 | rs_fill_link_cmd(lq_sta, &mcs_rate, &lq_sta->lq); |
1686 | rs_send_lq_cmd(priv, &lq_data->lq, CMD_ASYNC); | 1688 | rs_send_lq_cmd(priv, &lq_sta->lq, CMD_ASYNC); |
1687 | } | 1689 | } |
1688 | goto out; | 1690 | goto out; |
1689 | 1691 | ||
@@ -1694,25 +1696,25 @@ static void rs_rate_scale_perform(struct iwl4965_priv *priv, | |||
1694 | tbl->expected_tpt[index] + 64) / 128); | 1696 | tbl->expected_tpt[index] + 64) / 128); |
1695 | 1697 | ||
1696 | /* If we are searching for better modulation mode, check success. */ | 1698 | /* If we are searching for better modulation mode, check success. */ |
1697 | if (lq_data->search_better_tbl) { | 1699 | if (lq_sta->search_better_tbl) { |
1698 | int success_limit = IWL_RATE_SCALE_SWITCH; | 1700 | int success_limit = IWL_RATE_SCALE_SWITCH; |
1699 | 1701 | ||
1700 | /* If good success, continue using the "search" mode; | 1702 | /* If good success, continue using the "search" mode; |
1701 | * no need to send new link quality command, since we're | 1703 | * no need to send new link quality command, since we're |
1702 | * continuing to use the setup that we've been trying. */ | 1704 | * continuing to use the setup that we've been trying. */ |
1703 | if ((window->success_ratio > success_limit) || | 1705 | if ((window->success_ratio > success_limit) || |
1704 | (window->average_tpt > lq_data->last_tpt)) { | 1706 | (window->average_tpt > lq_sta->last_tpt)) { |
1705 | if (!is_legacy(tbl->lq_type)) { | 1707 | if (!is_legacy(tbl->lq_type)) { |
1706 | IWL_DEBUG_HT("LQ: we are switching to HT" | 1708 | IWL_DEBUG_HT("LQ: we are switching to HT" |
1707 | " rate suc %d current tpt %d" | 1709 | " rate suc %d current tpt %d" |
1708 | " old tpt %d\n", | 1710 | " old tpt %d\n", |
1709 | window->success_ratio, | 1711 | window->success_ratio, |
1710 | window->average_tpt, | 1712 | window->average_tpt, |
1711 | lq_data->last_tpt); | 1713 | lq_sta->last_tpt); |
1712 | lq_data->enable_counter = 1; | 1714 | lq_sta->enable_counter = 1; |
1713 | } | 1715 | } |
1714 | /* Swap tables; "search" becomes "active" */ | 1716 | /* Swap tables; "search" becomes "active" */ |
1715 | lq_data->active_tbl = active_tbl; | 1717 | lq_sta->active_tbl = active_tbl; |
1716 | current_tpt = window->average_tpt; | 1718 | current_tpt = window->average_tpt; |
1717 | 1719 | ||
1718 | /* Else poor success; go back to mode in "active" table */ | 1720 | /* Else poor success; go back to mode in "active" table */ |
@@ -1721,13 +1723,13 @@ static void rs_rate_scale_perform(struct iwl4965_priv *priv, | |||
1721 | tbl->lq_type = LQ_NONE; | 1723 | tbl->lq_type = LQ_NONE; |
1722 | 1724 | ||
1723 | /* Revert to "active" table */ | 1725 | /* Revert to "active" table */ |
1724 | active_tbl = lq_data->active_tbl; | 1726 | active_tbl = lq_sta->active_tbl; |
1725 | tbl = &(lq_data->lq_info[active_tbl]); | 1727 | tbl = &(lq_sta->lq_info[active_tbl]); |
1726 | 1728 | ||
1727 | /* Revert to "active" rate and throughput info */ | 1729 | /* Revert to "active" rate and throughput info */ |
1728 | index = iwl4965_rate_index_from_plcp( | 1730 | index = iwl4965_rate_index_from_plcp( |
1729 | tbl->current_rate.rate_n_flags); | 1731 | tbl->current_rate.rate_n_flags); |
1730 | current_tpt = lq_data->last_tpt; | 1732 | current_tpt = lq_sta->last_tpt; |
1731 | 1733 | ||
1732 | /* Need to set up a new rate table in uCode */ | 1734 | /* Need to set up a new rate table in uCode */ |
1733 | update_lq = 1; | 1735 | update_lq = 1; |
@@ -1736,7 +1738,7 @@ static void rs_rate_scale_perform(struct iwl4965_priv *priv, | |||
1736 | 1738 | ||
1737 | /* Either way, we've made a decision; modulation mode | 1739 | /* Either way, we've made a decision; modulation mode |
1738 | * search is done, allow rate adjustment next time. */ | 1740 | * search is done, allow rate adjustment next time. */ |
1739 | lq_data->search_better_tbl = 0; | 1741 | lq_sta->search_better_tbl = 0; |
1740 | done_search = 1; /* Don't switch modes below! */ | 1742 | done_search = 1; /* Don't switch modes below! */ |
1741 | goto lq_update; | 1743 | goto lq_update; |
1742 | } | 1744 | } |
@@ -1847,12 +1849,12 @@ static void rs_rate_scale_perform(struct iwl4965_priv *priv, | |||
1847 | /* Replace uCode's rate table for the destination station. */ | 1849 | /* Replace uCode's rate table for the destination station. */ |
1848 | if (update_lq) { | 1850 | if (update_lq) { |
1849 | rs_mcs_from_tbl(&mcs_rate, tbl, index, is_green); | 1851 | rs_mcs_from_tbl(&mcs_rate, tbl, index, is_green); |
1850 | rs_fill_link_cmd(lq_data, &mcs_rate, &lq_data->lq); | 1852 | rs_fill_link_cmd(lq_sta, &mcs_rate, &lq_sta->lq); |
1851 | rs_send_lq_cmd(priv, &lq_data->lq, CMD_ASYNC); | 1853 | rs_send_lq_cmd(priv, &lq_sta->lq, CMD_ASYNC); |
1852 | } | 1854 | } |
1853 | 1855 | ||
1854 | /* Should we stay with this modulation mode, or search for a new one? */ | 1856 | /* Should we stay with this modulation mode, or search for a new one? */ |
1855 | rs_stay_in_table(lq_data); | 1857 | rs_stay_in_table(lq_sta); |
1856 | 1858 | ||
1857 | /* | 1859 | /* |
1858 | * Search for new modulation mode if we're: | 1860 | * Search for new modulation mode if we're: |
@@ -1860,23 +1862,23 @@ static void rs_rate_scale_perform(struct iwl4965_priv *priv, | |||
1860 | * 2) Not just finishing up a search | 1862 | * 2) Not just finishing up a search |
1861 | * 3) Allowing a new search | 1863 | * 3) Allowing a new search |
1862 | */ | 1864 | */ |
1863 | if (!update_lq && !done_search && !lq_data->stay_in_tbl) { | 1865 | if (!update_lq && !done_search && !lq_sta->stay_in_tbl) { |
1864 | /* Save current throughput to compare with "search" throughput*/ | 1866 | /* Save current throughput to compare with "search" throughput*/ |
1865 | lq_data->last_tpt = current_tpt; | 1867 | lq_sta->last_tpt = current_tpt; |
1866 | 1868 | ||
1867 | /* Select a new "search" modulation mode to try. | 1869 | /* Select a new "search" modulation mode to try. |
1868 | * If one is found, set up the new "search" table. */ | 1870 | * If one is found, set up the new "search" table. */ |
1869 | if (is_legacy(tbl->lq_type)) | 1871 | if (is_legacy(tbl->lq_type)) |
1870 | rs_move_legacy_other(priv, lq_data, conf, sta, index); | 1872 | rs_move_legacy_other(priv, lq_sta, conf, sta, index); |
1871 | else if (is_siso(tbl->lq_type)) | 1873 | else if (is_siso(tbl->lq_type)) |
1872 | rs_move_siso_to_other(priv, lq_data, conf, sta, index); | 1874 | rs_move_siso_to_other(priv, lq_sta, conf, sta, index); |
1873 | else | 1875 | else |
1874 | rs_move_mimo_to_other(priv, lq_data, conf, sta, index); | 1876 | rs_move_mimo_to_other(priv, lq_sta, conf, sta, index); |
1875 | 1877 | ||
1876 | /* If new "search" mode was selected, set up in uCode table */ | 1878 | /* If new "search" mode was selected, set up in uCode table */ |
1877 | if (lq_data->search_better_tbl) { | 1879 | if (lq_sta->search_better_tbl) { |
1878 | /* Access the "search" table, clear its history. */ | 1880 | /* Access the "search" table, clear its history. */ |
1879 | tbl = &(lq_data->lq_info[(1 - lq_data->active_tbl)]); | 1881 | tbl = &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); |
1880 | for (i = 0; i < IWL_RATE_COUNT; i++) | 1882 | for (i = 0; i < IWL_RATE_COUNT; i++) |
1881 | rs_rate_scale_clear_window(&(tbl->win[i])); | 1883 | rs_rate_scale_clear_window(&(tbl->win[i])); |
1882 | 1884 | ||
@@ -1886,9 +1888,9 @@ static void rs_rate_scale_perform(struct iwl4965_priv *priv, | |||
1886 | 1888 | ||
1887 | IWL_DEBUG_HT("Switch current mcs: %X index: %d\n", | 1889 | IWL_DEBUG_HT("Switch current mcs: %X index: %d\n", |
1888 | tbl->current_rate.rate_n_flags, index); | 1890 | tbl->current_rate.rate_n_flags, index); |
1889 | rs_fill_link_cmd(lq_data, &tbl->current_rate, | 1891 | rs_fill_link_cmd(lq_sta, &tbl->current_rate, |
1890 | &lq_data->lq); | 1892 | &lq_sta->lq); |
1891 | rs_send_lq_cmd(priv, &lq_data->lq, CMD_ASYNC); | 1893 | rs_send_lq_cmd(priv, &lq_sta->lq, CMD_ASYNC); |
1892 | } | 1894 | } |
1893 | 1895 | ||
1894 | /* If the "active" (non-search) mode was legacy, | 1896 | /* If the "active" (non-search) mode was legacy, |
@@ -1896,33 +1898,33 @@ static void rs_rate_scale_perform(struct iwl4965_priv *priv, | |||
1896 | * but we haven't been able to try HT modes (not available), | 1898 | * but we haven't been able to try HT modes (not available), |
1897 | * stay with best antenna legacy modulation for a while | 1899 | * stay with best antenna legacy modulation for a while |
1898 | * before next round of mode comparisons. */ | 1900 | * before next round of mode comparisons. */ |
1899 | tbl1 = &(lq_data->lq_info[lq_data->active_tbl]); | 1901 | tbl1 = &(lq_sta->lq_info[lq_sta->active_tbl]); |
1900 | if (is_legacy(tbl1->lq_type) && | 1902 | if (is_legacy(tbl1->lq_type) && |
1901 | #ifdef CONFIG_IWL4965_HT | 1903 | #ifdef CONFIG_IWL4965_HT |
1902 | (!(conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE)) && | 1904 | (!(conf->flags & IEEE80211_CONF_SUPPORT_HT_MODE)) && |
1903 | #endif | 1905 | #endif |
1904 | (lq_data->action_counter >= 1)) { | 1906 | (lq_sta->action_counter >= 1)) { |
1905 | lq_data->action_counter = 0; | 1907 | lq_sta->action_counter = 0; |
1906 | IWL_DEBUG_HT("LQ: STAY in legacy table\n"); | 1908 | IWL_DEBUG_HT("LQ: STAY in legacy table\n"); |
1907 | rs_set_stay_in_table(1, lq_data); | 1909 | rs_set_stay_in_table(1, lq_sta); |
1908 | } | 1910 | } |
1909 | 1911 | ||
1910 | /* If we're in an HT mode, and all 3 mode switch actions | 1912 | /* If we're in an HT mode, and all 3 mode switch actions |
1911 | * have been tried and compared, stay in this best modulation | 1913 | * have been tried and compared, stay in this best modulation |
1912 | * mode for a while before next round of mode comparisons. */ | 1914 | * mode for a while before next round of mode comparisons. */ |
1913 | if (lq_data->enable_counter && | 1915 | if (lq_sta->enable_counter && |
1914 | (lq_data->action_counter >= IWL_ACTION_LIMIT)) { | 1916 | (lq_sta->action_counter >= IWL_ACTION_LIMIT)) { |
1915 | #ifdef CONFIG_IWL4965_HT_AGG | 1917 | #ifdef CONFIG_IWL4965_HT_AGG |
1916 | /* If appropriate, set up aggregation! */ | 1918 | /* If appropriate, set up aggregation! */ |
1917 | if ((lq_data->last_tpt > TID_AGG_TPT_THREHOLD) && | 1919 | if ((lq_sta->last_tpt > TID_AGG_TPT_THREHOLD) && |
1918 | (priv->lq_mngr.agg_ctrl.auto_agg)) { | 1920 | (priv->lq_mngr.agg_ctrl.auto_agg)) { |
1919 | priv->lq_mngr.agg_ctrl.tid_retry = | 1921 | priv->lq_mngr.agg_ctrl.tid_retry = |
1920 | TID_ALL_SPECIFIED; | 1922 | TID_ALL_SPECIFIED; |
1921 | schedule_work(&priv->agg_work); | 1923 | schedule_work(&priv->agg_work); |
1922 | } | 1924 | } |
1923 | #endif /*CONFIG_IWL4965_HT_AGG */ | 1925 | #endif /*CONFIG_IWL4965_HT_AGG */ |
1924 | lq_data->action_counter = 0; | 1926 | lq_sta->action_counter = 0; |
1925 | rs_set_stay_in_table(0, lq_data); | 1927 | rs_set_stay_in_table(0, lq_sta); |
1926 | } | 1928 | } |
1927 | 1929 | ||
1928 | /* | 1930 | /* |
@@ -1933,8 +1935,8 @@ static void rs_rate_scale_perform(struct iwl4965_priv *priv, | |||
1933 | * 3) flush timer is empty | 1935 | * 3) flush timer is empty |
1934 | */ | 1936 | */ |
1935 | } else { | 1937 | } else { |
1936 | if ((!update_lq) && (!done_search) && (!lq_data->flush_timer)) | 1938 | if ((!update_lq) && (!done_search) && (!lq_sta->flush_timer)) |
1937 | lq_data->flush_timer = jiffies; | 1939 | lq_sta->flush_timer = jiffies; |
1938 | } | 1940 | } |
1939 | 1941 | ||
1940 | out: | 1942 | out: |
@@ -1945,7 +1947,7 @@ out: | |||
1945 | /* sta->txrate is an index to A mode rates which start | 1947 | /* sta->txrate is an index to A mode rates which start |
1946 | * at IWL_FIRST_OFDM_RATE | 1948 | * at IWL_FIRST_OFDM_RATE |
1947 | */ | 1949 | */ |
1948 | if (lq_data->phymode == (u8) MODE_IEEE80211A) | 1950 | if (lq_sta->phymode == (u8) MODE_IEEE80211A) |
1949 | sta->txrate = i - IWL_FIRST_OFDM_RATE; | 1951 | sta->txrate = i - IWL_FIRST_OFDM_RATE; |
1950 | else | 1952 | else |
1951 | sta->txrate = i; | 1953 | sta->txrate = i; |
@@ -1959,7 +1961,7 @@ static void rs_initialize_lq(struct iwl4965_priv *priv, | |||
1959 | struct sta_info *sta) | 1961 | struct sta_info *sta) |
1960 | { | 1962 | { |
1961 | int i; | 1963 | int i; |
1962 | struct iwl4965_rate_scale_priv *lq; | 1964 | struct iwl4965_lq_sta *lq_sta; |
1963 | struct iwl4965_scale_tbl_info *tbl; | 1965 | struct iwl4965_scale_tbl_info *tbl; |
1964 | u8 active_tbl = 0; | 1966 | u8 active_tbl = 0; |
1965 | int rate_idx; | 1967 | int rate_idx; |
@@ -1969,19 +1971,19 @@ static void rs_initialize_lq(struct iwl4965_priv *priv, | |||
1969 | if (!sta || !sta->rate_ctrl_priv) | 1971 | if (!sta || !sta->rate_ctrl_priv) |
1970 | goto out; | 1972 | goto out; |
1971 | 1973 | ||
1972 | lq = (struct iwl4965_rate_scale_priv *)sta->rate_ctrl_priv; | 1974 | lq_sta = (struct iwl4965_lq_sta *)sta->rate_ctrl_priv; |
1973 | i = sta->last_txrate; | 1975 | i = sta->last_txrate; |
1974 | 1976 | ||
1975 | if ((lq->lq.sta_id == 0xff) && | 1977 | if ((lq_sta->lq.sta_id == 0xff) && |
1976 | (priv->iw_mode == IEEE80211_IF_TYPE_IBSS)) | 1978 | (priv->iw_mode == IEEE80211_IF_TYPE_IBSS)) |
1977 | goto out; | 1979 | goto out; |
1978 | 1980 | ||
1979 | if (!lq->search_better_tbl) | 1981 | if (!lq_sta->search_better_tbl) |
1980 | active_tbl = lq->active_tbl; | 1982 | active_tbl = lq_sta->active_tbl; |
1981 | else | 1983 | else |
1982 | active_tbl = 1 - lq->active_tbl; | 1984 | active_tbl = 1 - lq_sta->active_tbl; |
1983 | 1985 | ||
1984 | tbl = &(lq->lq_info[active_tbl]); | 1986 | tbl = &(lq_sta->lq_info[active_tbl]); |
1985 | 1987 | ||
1986 | if ((i < 0) || (i >= IWL_RATE_COUNT)) | 1988 | if ((i < 0) || (i >= IWL_RATE_COUNT)) |
1987 | i = 0; | 1989 | i = 0; |
@@ -2000,9 +2002,9 @@ static void rs_initialize_lq(struct iwl4965_priv *priv, | |||
2000 | 2002 | ||
2001 | rs_mcs_from_tbl(&mcs_rate, tbl, rate_idx, use_green); | 2003 | rs_mcs_from_tbl(&mcs_rate, tbl, rate_idx, use_green); |
2002 | tbl->current_rate.rate_n_flags = mcs_rate.rate_n_flags; | 2004 | tbl->current_rate.rate_n_flags = mcs_rate.rate_n_flags; |
2003 | rs_get_expected_tpt_table(lq, tbl); | 2005 | rs_get_expected_tpt_table(lq_sta, tbl); |
2004 | rs_fill_link_cmd(lq, &mcs_rate, &lq->lq); | 2006 | rs_fill_link_cmd(lq_sta, &mcs_rate, &lq_sta->lq); |
2005 | rs_send_lq_cmd(priv, &lq->lq, CMD_ASYNC); | 2007 | rs_send_lq_cmd(priv, &lq_sta->lq, CMD_ASYNC); |
2006 | out: | 2008 | out: |
2007 | return; | 2009 | return; |
2008 | } | 2010 | } |
@@ -2019,7 +2021,7 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev, | |||
2019 | struct sta_info *sta; | 2021 | struct sta_info *sta; |
2020 | u16 fc; | 2022 | u16 fc; |
2021 | struct iwl4965_priv *priv = (struct iwl4965_priv *)priv_rate; | 2023 | struct iwl4965_priv *priv = (struct iwl4965_priv *)priv_rate; |
2022 | struct iwl4965_rate_scale_priv *lq; | 2024 | struct iwl4965_lq_sta *lq_sta; |
2023 | 2025 | ||
2024 | IWL_DEBUG_RATE_LIMIT("rate scale calculate new rate for skb\n"); | 2026 | IWL_DEBUG_RATE_LIMIT("rate scale calculate new rate for skb\n"); |
2025 | 2027 | ||
@@ -2036,10 +2038,11 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev, | |||
2036 | return; | 2038 | return; |
2037 | } | 2039 | } |
2038 | 2040 | ||
2039 | lq = (struct iwl4965_rate_scale_priv *)sta->rate_ctrl_priv; | 2041 | lq_sta = (struct iwl4965_lq_sta *)sta->rate_ctrl_priv; |
2040 | i = sta->last_txrate; | 2042 | i = sta->last_txrate; |
2041 | 2043 | ||
2042 | if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) && !lq->ibss_sta_added) { | 2044 | if ((priv->iw_mode == IEEE80211_IF_TYPE_IBSS) && |
2045 | !lq_sta->ibss_sta_added) { | ||
2043 | u8 sta_id = iwl4965_hw_find_station(priv, hdr->addr1); | 2046 | u8 sta_id = iwl4965_hw_find_station(priv, hdr->addr1); |
2044 | DECLARE_MAC_BUF(mac); | 2047 | DECLARE_MAC_BUF(mac); |
2045 | 2048 | ||
@@ -2050,12 +2053,12 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev, | |||
2050 | 0, CMD_ASYNC, NULL); | 2053 | 0, CMD_ASYNC, NULL); |
2051 | } | 2054 | } |
2052 | if ((sta_id != IWL_INVALID_STATION)) { | 2055 | if ((sta_id != IWL_INVALID_STATION)) { |
2053 | lq->lq.sta_id = sta_id; | 2056 | lq_sta->lq.sta_id = sta_id; |
2054 | lq->lq.rs_table[0].rate_n_flags = 0; | 2057 | lq_sta->lq.rs_table[0].rate_n_flags = 0; |
2055 | lq->ibss_sta_added = 1; | 2058 | lq_sta->ibss_sta_added = 1; |
2056 | rs_initialize_lq(priv, conf, sta); | 2059 | rs_initialize_lq(priv, conf, sta); |
2057 | } | 2060 | } |
2058 | if (!lq->ibss_sta_added) | 2061 | if (!lq_sta->ibss_sta_added) |
2059 | goto done; | 2062 | goto done; |
2060 | } | 2063 | } |
2061 | 2064 | ||
@@ -2071,23 +2074,23 @@ static void rs_get_rate(void *priv_rate, struct net_device *dev, | |||
2071 | 2074 | ||
2072 | static void *rs_alloc_sta(void *priv, gfp_t gfp) | 2075 | static void *rs_alloc_sta(void *priv, gfp_t gfp) |
2073 | { | 2076 | { |
2074 | struct iwl4965_rate_scale_priv *crl; | 2077 | struct iwl4965_lq_sta *lq_sta; |
2075 | int i, j; | 2078 | int i, j; |
2076 | 2079 | ||
2077 | IWL_DEBUG_RATE("create station rate scale window\n"); | 2080 | IWL_DEBUG_RATE("create station rate scale window\n"); |
2078 | 2081 | ||
2079 | crl = kzalloc(sizeof(struct iwl4965_rate_scale_priv), gfp); | 2082 | lq_sta = kzalloc(sizeof(struct iwl4965_lq_sta), gfp); |
2080 | 2083 | ||
2081 | if (crl == NULL) | 2084 | if (lq_sta == NULL) |
2082 | return NULL; | 2085 | return NULL; |
2083 | crl->lq.sta_id = 0xff; | 2086 | lq_sta->lq.sta_id = 0xff; |
2084 | 2087 | ||
2085 | 2088 | ||
2086 | for (j = 0; j < LQ_SIZE; j++) | 2089 | for (j = 0; j < LQ_SIZE; j++) |
2087 | for (i = 0; i < IWL_RATE_COUNT; i++) | 2090 | for (i = 0; i < IWL_RATE_COUNT; i++) |
2088 | rs_rate_scale_clear_window(&(crl->lq_info[j].win[i])); | 2091 | rs_rate_scale_clear_window(&(lq_sta->lq_info[j].win[i])); |
2089 | 2092 | ||
2090 | return crl; | 2093 | return lq_sta; |
2091 | } | 2094 | } |
2092 | 2095 | ||
2093 | static void rs_rate_init(void *priv_rate, void *priv_sta, | 2096 | static void rs_rate_init(void *priv_rate, void *priv_sta, |
@@ -2098,14 +2101,14 @@ static void rs_rate_init(void *priv_rate, void *priv_sta, | |||
2098 | struct ieee80211_conf *conf = &local->hw.conf; | 2101 | struct ieee80211_conf *conf = &local->hw.conf; |
2099 | struct ieee80211_hw_mode *mode = local->oper_hw_mode; | 2102 | struct ieee80211_hw_mode *mode = local->oper_hw_mode; |
2100 | struct iwl4965_priv *priv = (struct iwl4965_priv *)priv_rate; | 2103 | struct iwl4965_priv *priv = (struct iwl4965_priv *)priv_rate; |
2101 | struct iwl4965_rate_scale_priv *crl = priv_sta; | 2104 | struct iwl4965_lq_sta *lq_sta = priv_sta; |
2102 | 2105 | ||
2103 | crl->flush_timer = 0; | 2106 | lq_sta->flush_timer = 0; |
2104 | crl->supp_rates = sta->supp_rates; | 2107 | lq_sta->supp_rates = sta->supp_rates; |
2105 | sta->txrate = 3; | 2108 | sta->txrate = 3; |
2106 | for (j = 0; j < LQ_SIZE; j++) | 2109 | for (j = 0; j < LQ_SIZE; j++) |
2107 | for (i = 0; i < IWL_RATE_COUNT; i++) | 2110 | for (i = 0; i < IWL_RATE_COUNT; i++) |
2108 | rs_rate_scale_clear_window(&(crl->lq_info[j].win[i])); | 2111 | rs_rate_scale_clear_window(&(lq_sta->lq_info[j].win[i])); |
2109 | 2112 | ||
2110 | IWL_DEBUG_RATE("rate scale global init\n"); | 2113 | IWL_DEBUG_RATE("rate scale global init\n"); |
2111 | /* TODO: what is a good starting rate for STA? About middle? Maybe not | 2114 | /* TODO: what is a good starting rate for STA? About middle? Maybe not |
@@ -2113,7 +2116,7 @@ static void rs_rate_init(void *priv_rate, void *priv_sta, | |||
2113 | * previous packets? Need to have IEEE 802.1X auth succeed immediately | 2116 | * previous packets? Need to have IEEE 802.1X auth succeed immediately |
2114 | * after assoc.. */ | 2117 | * after assoc.. */ |
2115 | 2118 | ||
2116 | crl->ibss_sta_added = 0; | 2119 | lq_sta->ibss_sta_added = 0; |
2117 | if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { | 2120 | if (priv->iw_mode == IEEE80211_IF_TYPE_AP) { |
2118 | u8 sta_id = iwl4965_hw_find_station(priv, sta->addr); | 2121 | u8 sta_id = iwl4965_hw_find_station(priv, sta->addr); |
2119 | DECLARE_MAC_BUF(mac); | 2122 | DECLARE_MAC_BUF(mac); |
@@ -2129,8 +2132,8 @@ static void rs_rate_init(void *priv_rate, void *priv_sta, | |||
2129 | 0, CMD_ASYNC, NULL); | 2132 | 0, CMD_ASYNC, NULL); |
2130 | } | 2133 | } |
2131 | if ((sta_id != IWL_INVALID_STATION)) { | 2134 | if ((sta_id != IWL_INVALID_STATION)) { |
2132 | crl->lq.sta_id = sta_id; | 2135 | lq_sta->lq.sta_id = sta_id; |
2133 | crl->lq.rs_table[0].rate_n_flags = 0; | 2136 | lq_sta->lq.rs_table[0].rate_n_flags = 0; |
2134 | } | 2137 | } |
2135 | /* FIXME: this is w/a remove it later */ | 2138 | /* FIXME: this is w/a remove it later */ |
2136 | priv->assoc_station_added = 1; | 2139 | priv->assoc_station_added = 1; |
@@ -2147,36 +2150,39 @@ static void rs_rate_init(void *priv_rate, void *priv_sta, | |||
2147 | if (local->hw.conf.phymode == MODE_IEEE80211A) | 2150 | if (local->hw.conf.phymode == MODE_IEEE80211A) |
2148 | sta->last_txrate += IWL_FIRST_OFDM_RATE; | 2151 | sta->last_txrate += IWL_FIRST_OFDM_RATE; |
2149 | 2152 | ||
2150 | crl->is_dup = 0; | 2153 | lq_sta->is_dup = 0; |
2151 | crl->valid_antenna = priv->valid_antenna; | 2154 | lq_sta->valid_antenna = priv->valid_antenna; |
2152 | crl->antenna = priv->antenna; | 2155 | lq_sta->antenna = priv->antenna; |
2153 | crl->is_green = rs_use_green(priv, conf); | 2156 | lq_sta->is_green = rs_use_green(priv, conf); |
2154 | crl->active_rate = priv->active_rate; | 2157 | lq_sta->active_rate = priv->active_rate; |
2155 | crl->active_rate &= ~(0x1000); | 2158 | lq_sta->active_rate &= ~(0x1000); |
2156 | crl->active_rate_basic = priv->active_rate_basic; | 2159 | lq_sta->active_rate_basic = priv->active_rate_basic; |
2157 | crl->phymode = priv->phymode; | 2160 | lq_sta->phymode = priv->phymode; |
2158 | #ifdef CONFIG_IWL4965_HT | 2161 | #ifdef CONFIG_IWL4965_HT |
2159 | /* | 2162 | /* |
2160 | * active_siso_rate mask includes 9 MBits (bit 5), and CCK (bits 0-3), | 2163 | * active_siso_rate mask includes 9 MBits (bit 5), and CCK (bits 0-3), |
2161 | * supp_rates[] does not; shift to convert format, force 9 MBits off. | 2164 | * supp_rates[] does not; shift to convert format, force 9 MBits off. |
2162 | */ | 2165 | */ |
2163 | crl->active_siso_rate = (priv->current_ht_config.supp_mcs_set[0] << 1); | 2166 | lq_sta->active_siso_rate = (priv->current_ht_config.supp_mcs_set[0] << 1); |
2164 | crl->active_siso_rate |= | 2167 | lq_sta->active_siso_rate |= |
2165 | (priv->current_ht_config.supp_mcs_set[0] & 0x1); | 2168 | (priv->current_ht_config.supp_mcs_set[0] & 0x1); |
2166 | crl->active_siso_rate &= ~((u16)0x2); | 2169 | lq_sta->active_siso_rate &= ~((u16)0x2); |
2167 | crl->active_siso_rate = crl->active_siso_rate << IWL_FIRST_OFDM_RATE; | 2170 | lq_sta->active_siso_rate = |
2171 | lq_sta->active_siso_rate << IWL_FIRST_OFDM_RATE; | ||
2168 | 2172 | ||
2169 | /* Same here */ | 2173 | /* Same here */ |
2170 | crl->active_mimo_rate = (priv->current_ht_config.supp_mcs_set[1] << 1); | 2174 | lq_sta->active_mimo_rate = (priv->current_ht_config.supp_mcs_set[1] << 1); |
2171 | crl->active_mimo_rate |= | 2175 | lq_sta->active_mimo_rate |= |
2172 | (priv->current_ht_config.supp_mcs_set[1] & 0x1); | 2176 | (priv->current_ht_config.supp_mcs_set[1] & 0x1); |
2173 | crl->active_mimo_rate &= ~((u16)0x2); | 2177 | lq_sta->active_mimo_rate &= ~((u16)0x2); |
2174 | crl->active_mimo_rate = crl->active_mimo_rate << IWL_FIRST_OFDM_RATE; | 2178 | lq_sta->active_mimo_rate = |
2175 | IWL_DEBUG_HT("MIMO RATE 0x%X SISO MASK 0x%X\n", crl->active_siso_rate, | 2179 | lq_sta->active_mimo_rate << IWL_FIRST_OFDM_RATE; |
2176 | crl->active_mimo_rate); | 2180 | IWL_DEBUG_HT("SISO RATE 0x%X MIMO RATE 0x%X\n", |
2181 | lq_sta->active_siso_rate, | ||
2182 | lq_sta->active_mimo_rate); | ||
2177 | #endif /*CONFIG_IWL4965_HT*/ | 2183 | #endif /*CONFIG_IWL4965_HT*/ |
2178 | #ifdef CONFIG_MAC80211_DEBUGFS | 2184 | #ifdef CONFIG_MAC80211_DEBUGFS |
2179 | crl->drv = priv; | 2185 | lq_sta->drv = priv; |
2180 | #endif | 2186 | #endif |
2181 | 2187 | ||
2182 | if (priv->assoc_station_added) | 2188 | if (priv->assoc_station_added) |
@@ -2185,7 +2191,7 @@ static void rs_rate_init(void *priv_rate, void *priv_sta, | |||
2185 | rs_initialize_lq(priv, conf, sta); | 2191 | rs_initialize_lq(priv, conf, sta); |
2186 | } | 2192 | } |
2187 | 2193 | ||
2188 | static void rs_fill_link_cmd(struct iwl4965_rate_scale_priv *lq_data, | 2194 | static void rs_fill_link_cmd(struct iwl4965_lq_sta *lq_sta, |
2189 | struct iwl4965_rate *tx_mcs, | 2195 | struct iwl4965_rate *tx_mcs, |
2190 | struct iwl4965_link_quality_cmd *lq_cmd) | 2196 | struct iwl4965_link_quality_cmd *lq_cmd) |
2191 | { | 2197 | { |
@@ -2198,10 +2204,10 @@ static void rs_fill_link_cmd(struct iwl4965_rate_scale_priv *lq_data, | |||
2198 | struct iwl4965_scale_tbl_info tbl_type = { 0 }; | 2204 | struct iwl4965_scale_tbl_info tbl_type = { 0 }; |
2199 | 2205 | ||
2200 | /* Override starting rate (index 0) if needed for debug purposes */ | 2206 | /* Override starting rate (index 0) if needed for debug purposes */ |
2201 | rs_dbgfs_set_mcs(lq_data, tx_mcs, index); | 2207 | rs_dbgfs_set_mcs(lq_sta, tx_mcs, index); |
2202 | 2208 | ||
2203 | /* Interpret rate_n_flags */ | 2209 | /* Interpret rate_n_flags */ |
2204 | rs_get_tbl_info_from_mcs(tx_mcs, lq_data->phymode, | 2210 | rs_get_tbl_info_from_mcs(tx_mcs, lq_sta->phymode, |
2205 | &tbl_type, &rate_idx); | 2211 | &tbl_type, &rate_idx); |
2206 | 2212 | ||
2207 | /* How many times should we repeat the initial rate? */ | 2213 | /* How many times should we repeat the initial rate? */ |
@@ -2246,7 +2252,7 @@ static void rs_fill_link_cmd(struct iwl4965_rate_scale_priv *lq_data, | |||
2246 | } | 2252 | } |
2247 | 2253 | ||
2248 | /* Override next rate if needed for debug purposes */ | 2254 | /* Override next rate if needed for debug purposes */ |
2249 | rs_dbgfs_set_mcs(lq_data, &new_rate, index); | 2255 | rs_dbgfs_set_mcs(lq_sta, &new_rate, index); |
2250 | 2256 | ||
2251 | /* Fill next table entry */ | 2257 | /* Fill next table entry */ |
2252 | lq_cmd->rs_table[index].rate_n_flags = | 2258 | lq_cmd->rs_table[index].rate_n_flags = |
@@ -2255,7 +2261,7 @@ static void rs_fill_link_cmd(struct iwl4965_rate_scale_priv *lq_data, | |||
2255 | index++; | 2261 | index++; |
2256 | } | 2262 | } |
2257 | 2263 | ||
2258 | rs_get_tbl_info_from_mcs(&new_rate, lq_data->phymode, &tbl_type, | 2264 | rs_get_tbl_info_from_mcs(&new_rate, lq_sta->phymode, &tbl_type, |
2259 | &rate_idx); | 2265 | &rate_idx); |
2260 | 2266 | ||
2261 | /* Indicate to uCode which entries might be MIMO. | 2267 | /* Indicate to uCode which entries might be MIMO. |
@@ -2265,7 +2271,7 @@ static void rs_fill_link_cmd(struct iwl4965_rate_scale_priv *lq_data, | |||
2265 | lq_cmd->general_params.mimo_delimiter = index; | 2271 | lq_cmd->general_params.mimo_delimiter = index; |
2266 | 2272 | ||
2267 | /* Get next rate */ | 2273 | /* Get next rate */ |
2268 | rs_get_lower_rate(lq_data, &tbl_type, rate_idx, | 2274 | rs_get_lower_rate(lq_sta, &tbl_type, rate_idx, |
2269 | use_ht_possible, &new_rate); | 2275 | use_ht_possible, &new_rate); |
2270 | 2276 | ||
2271 | /* How many times should we repeat the next rate? */ | 2277 | /* How many times should we repeat the next rate? */ |
@@ -2285,7 +2291,7 @@ static void rs_fill_link_cmd(struct iwl4965_rate_scale_priv *lq_data, | |||
2285 | use_ht_possible = 0; | 2291 | use_ht_possible = 0; |
2286 | 2292 | ||
2287 | /* Override next rate if needed for debug purposes */ | 2293 | /* Override next rate if needed for debug purposes */ |
2288 | rs_dbgfs_set_mcs(lq_data, &new_rate, index); | 2294 | rs_dbgfs_set_mcs(lq_sta, &new_rate, index); |
2289 | 2295 | ||
2290 | /* Fill next table entry */ | 2296 | /* Fill next table entry */ |
2291 | lq_cmd->rs_table[index].rate_n_flags = | 2297 | lq_cmd->rs_table[index].rate_n_flags = |
@@ -2329,10 +2335,10 @@ static void rs_clear(void *priv_rate) | |||
2329 | 2335 | ||
2330 | static void rs_free_sta(void *priv, void *priv_sta) | 2336 | static void rs_free_sta(void *priv, void *priv_sta) |
2331 | { | 2337 | { |
2332 | struct iwl4965_rate_scale_priv *rs_priv = priv_sta; | 2338 | struct iwl4965_lq_sta *lq_sta = priv_sta; |
2333 | 2339 | ||
2334 | IWL_DEBUG_RATE("enter\n"); | 2340 | IWL_DEBUG_RATE("enter\n"); |
2335 | kfree(rs_priv); | 2341 | kfree(lq_sta); |
2336 | IWL_DEBUG_RATE("leave\n"); | 2342 | IWL_DEBUG_RATE("leave\n"); |
2337 | } | 2343 | } |
2338 | 2344 | ||
@@ -2343,19 +2349,19 @@ static int open_file_generic(struct inode *inode, struct file *file) | |||
2343 | file->private_data = inode->i_private; | 2349 | file->private_data = inode->i_private; |
2344 | return 0; | 2350 | return 0; |
2345 | } | 2351 | } |
2346 | static void rs_dbgfs_set_mcs(struct iwl4965_rate_scale_priv *rs_priv, | 2352 | static void rs_dbgfs_set_mcs(struct iwl4965_lq_sta *lq_sta, |
2347 | struct iwl4965_rate *mcs, int index) | 2353 | struct iwl4965_rate *mcs, int index) |
2348 | { | 2354 | { |
2349 | u32 base_rate; | 2355 | u32 base_rate; |
2350 | 2356 | ||
2351 | if (rs_priv->phymode == (u8) MODE_IEEE80211A) | 2357 | if (lq_sta->phymode == (u8) MODE_IEEE80211A) |
2352 | base_rate = 0x800D; | 2358 | base_rate = 0x800D; |
2353 | else | 2359 | else |
2354 | base_rate = 0x820A; | 2360 | base_rate = 0x820A; |
2355 | 2361 | ||
2356 | if (rs_priv->dbg_fixed.rate_n_flags) { | 2362 | if (lq_sta->dbg_fixed.rate_n_flags) { |
2357 | if (index < 12) | 2363 | if (index < 12) |
2358 | mcs->rate_n_flags = rs_priv->dbg_fixed.rate_n_flags; | 2364 | mcs->rate_n_flags = lq_sta->dbg_fixed.rate_n_flags; |
2359 | else | 2365 | else |
2360 | mcs->rate_n_flags = base_rate; | 2366 | mcs->rate_n_flags = base_rate; |
2361 | IWL_DEBUG_RATE("Fixed rate ON\n"); | 2367 | IWL_DEBUG_RATE("Fixed rate ON\n"); |
@@ -2368,7 +2374,7 @@ static void rs_dbgfs_set_mcs(struct iwl4965_rate_scale_priv *rs_priv, | |||
2368 | static ssize_t rs_sta_dbgfs_scale_table_write(struct file *file, | 2374 | static ssize_t rs_sta_dbgfs_scale_table_write(struct file *file, |
2369 | const char __user *user_buf, size_t count, loff_t *ppos) | 2375 | const char __user *user_buf, size_t count, loff_t *ppos) |
2370 | { | 2376 | { |
2371 | struct iwl4965_rate_scale_priv *rs_priv = file->private_data; | 2377 | struct iwl4965_lq_sta *lq_sta = file->private_data; |
2372 | char buf[64]; | 2378 | char buf[64]; |
2373 | int buf_size; | 2379 | int buf_size; |
2374 | u32 parsed_rate; | 2380 | u32 parsed_rate; |
@@ -2379,20 +2385,20 @@ static ssize_t rs_sta_dbgfs_scale_table_write(struct file *file, | |||
2379 | return -EFAULT; | 2385 | return -EFAULT; |
2380 | 2386 | ||
2381 | if (sscanf(buf, "%x", &parsed_rate) == 1) | 2387 | if (sscanf(buf, "%x", &parsed_rate) == 1) |
2382 | rs_priv->dbg_fixed.rate_n_flags = parsed_rate; | 2388 | lq_sta->dbg_fixed.rate_n_flags = parsed_rate; |
2383 | else | 2389 | else |
2384 | rs_priv->dbg_fixed.rate_n_flags = 0; | 2390 | lq_sta->dbg_fixed.rate_n_flags = 0; |
2385 | 2391 | ||
2386 | rs_priv->active_rate = 0x0FFF; /* 1 - 54 MBits, includes CCK */ | 2392 | lq_sta->active_rate = 0x0FFF; /* 1 - 54 MBits, includes CCK */ |
2387 | rs_priv->active_siso_rate = 0x1FD0; /* 6 - 60 MBits, no 9, no CCK */ | 2393 | lq_sta->active_siso_rate = 0x1FD0; /* 6 - 60 MBits, no 9, no CCK */ |
2388 | rs_priv->active_mimo_rate = 0x1FD0; /* 6 - 60 MBits, no 9, no CCK */ | 2394 | lq_sta->active_mimo_rate = 0x1FD0; /* 6 - 60 MBits, no 9, no CCK */ |
2389 | 2395 | ||
2390 | IWL_DEBUG_RATE("sta_id %d rate 0x%X\n", | 2396 | IWL_DEBUG_RATE("sta_id %d rate 0x%X\n", |
2391 | rs_priv->lq.sta_id, rs_priv->dbg_fixed.rate_n_flags); | 2397 | lq_sta->lq.sta_id, lq_sta->dbg_fixed.rate_n_flags); |
2392 | 2398 | ||
2393 | if (rs_priv->dbg_fixed.rate_n_flags) { | 2399 | if (lq_sta->dbg_fixed.rate_n_flags) { |
2394 | rs_fill_link_cmd(rs_priv, &rs_priv->dbg_fixed, &rs_priv->lq); | 2400 | rs_fill_link_cmd(lq_sta, &lq_sta->dbg_fixed, &lq_sta->lq); |
2395 | rs_send_lq_cmd(rs_priv->drv, &rs_priv->lq, CMD_ASYNC); | 2401 | rs_send_lq_cmd(lq_sta->drv, &lq_sta->lq, CMD_ASYNC); |
2396 | } | 2402 | } |
2397 | 2403 | ||
2398 | return count; | 2404 | return count; |
@@ -2405,38 +2411,38 @@ static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file, | |||
2405 | int desc = 0; | 2411 | int desc = 0; |
2406 | int i = 0; | 2412 | int i = 0; |
2407 | 2413 | ||
2408 | struct iwl4965_rate_scale_priv *rs_priv = file->private_data; | 2414 | struct iwl4965_lq_sta *lq_sta = file->private_data; |
2409 | 2415 | ||
2410 | desc += sprintf(buff+desc, "sta_id %d\n", rs_priv->lq.sta_id); | 2416 | desc += sprintf(buff+desc, "sta_id %d\n", lq_sta->lq.sta_id); |
2411 | desc += sprintf(buff+desc, "failed=%d success=%d rate=0%X\n", | 2417 | desc += sprintf(buff+desc, "failed=%d success=%d rate=0%X\n", |
2412 | rs_priv->total_failed, rs_priv->total_success, | 2418 | lq_sta->total_failed, lq_sta->total_success, |
2413 | rs_priv->active_rate); | 2419 | lq_sta->active_rate); |
2414 | desc += sprintf(buff+desc, "fixed rate 0x%X\n", | 2420 | desc += sprintf(buff+desc, "fixed rate 0x%X\n", |
2415 | rs_priv->dbg_fixed.rate_n_flags); | 2421 | lq_sta->dbg_fixed.rate_n_flags); |
2416 | desc += sprintf(buff+desc, "general:" | 2422 | desc += sprintf(buff+desc, "general:" |
2417 | "flags=0x%X mimo-d=%d s-ant0x%x d-ant=0x%x\n", | 2423 | "flags=0x%X mimo-d=%d s-ant0x%x d-ant=0x%x\n", |
2418 | rs_priv->lq.general_params.flags, | 2424 | lq_sta->lq.general_params.flags, |
2419 | rs_priv->lq.general_params.mimo_delimiter, | 2425 | lq_sta->lq.general_params.mimo_delimiter, |
2420 | rs_priv->lq.general_params.single_stream_ant_msk, | 2426 | lq_sta->lq.general_params.single_stream_ant_msk, |
2421 | rs_priv->lq.general_params.dual_stream_ant_msk); | 2427 | lq_sta->lq.general_params.dual_stream_ant_msk); |
2422 | 2428 | ||
2423 | desc += sprintf(buff+desc, "agg:" | 2429 | desc += sprintf(buff+desc, "agg:" |
2424 | "time_limit=%d dist_start_th=%d frame_cnt_limit=%d\n", | 2430 | "time_limit=%d dist_start_th=%d frame_cnt_limit=%d\n", |
2425 | le16_to_cpu(rs_priv->lq.agg_params.agg_time_limit), | 2431 | le16_to_cpu(lq_sta->lq.agg_params.agg_time_limit), |
2426 | rs_priv->lq.agg_params.agg_dis_start_th, | 2432 | lq_sta->lq.agg_params.agg_dis_start_th, |
2427 | rs_priv->lq.agg_params.agg_frame_cnt_limit); | 2433 | lq_sta->lq.agg_params.agg_frame_cnt_limit); |
2428 | 2434 | ||
2429 | desc += sprintf(buff+desc, | 2435 | desc += sprintf(buff+desc, |
2430 | "Start idx [0]=0x%x [1]=0x%x [2]=0x%x [3]=0x%x\n", | 2436 | "Start idx [0]=0x%x [1]=0x%x [2]=0x%x [3]=0x%x\n", |
2431 | rs_priv->lq.general_params.start_rate_index[0], | 2437 | lq_sta->lq.general_params.start_rate_index[0], |
2432 | rs_priv->lq.general_params.start_rate_index[1], | 2438 | lq_sta->lq.general_params.start_rate_index[1], |
2433 | rs_priv->lq.general_params.start_rate_index[2], | 2439 | lq_sta->lq.general_params.start_rate_index[2], |
2434 | rs_priv->lq.general_params.start_rate_index[3]); | 2440 | lq_sta->lq.general_params.start_rate_index[3]); |
2435 | 2441 | ||
2436 | 2442 | ||
2437 | for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) | 2443 | for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++) |
2438 | desc += sprintf(buff+desc, " rate[%d] 0x%X\n", | 2444 | desc += sprintf(buff+desc, " rate[%d] 0x%X\n", |
2439 | i, le32_to_cpu(rs_priv->lq.rs_table[i].rate_n_flags)); | 2445 | i, le32_to_cpu(lq_sta->lq.rs_table[i].rate_n_flags)); |
2440 | 2446 | ||
2441 | return simple_read_from_buffer(user_buf, count, ppos, buff, desc); | 2447 | return simple_read_from_buffer(user_buf, count, ppos, buff, desc); |
2442 | } | 2448 | } |
@@ -2453,22 +2459,22 @@ static ssize_t rs_sta_dbgfs_stats_table_read(struct file *file, | |||
2453 | int desc = 0; | 2459 | int desc = 0; |
2454 | int i, j; | 2460 | int i, j; |
2455 | 2461 | ||
2456 | struct iwl4965_rate_scale_priv *rs_priv = file->private_data; | 2462 | struct iwl4965_lq_sta *lq_sta = file->private_data; |
2457 | for (i = 0; i < LQ_SIZE; i++) { | 2463 | for (i = 0; i < LQ_SIZE; i++) { |
2458 | desc += sprintf(buff+desc, "%s type=%d SGI=%d FAT=%d DUP=%d\n" | 2464 | desc += sprintf(buff+desc, "%s type=%d SGI=%d FAT=%d DUP=%d\n" |
2459 | "rate=0x%X\n", | 2465 | "rate=0x%X\n", |
2460 | rs_priv->active_tbl == i?"*":"x", | 2466 | lq_sta->active_tbl == i?"*":"x", |
2461 | rs_priv->lq_info[i].lq_type, | 2467 | lq_sta->lq_info[i].lq_type, |
2462 | rs_priv->lq_info[i].is_SGI, | 2468 | lq_sta->lq_info[i].is_SGI, |
2463 | rs_priv->lq_info[i].is_fat, | 2469 | lq_sta->lq_info[i].is_fat, |
2464 | rs_priv->lq_info[i].is_dup, | 2470 | lq_sta->lq_info[i].is_dup, |
2465 | rs_priv->lq_info[i].current_rate.rate_n_flags); | 2471 | lq_sta->lq_info[i].current_rate.rate_n_flags); |
2466 | for (j = 0; j < IWL_RATE_COUNT; j++) { | 2472 | for (j = 0; j < IWL_RATE_COUNT; j++) { |
2467 | desc += sprintf(buff+desc, | 2473 | desc += sprintf(buff+desc, |
2468 | "counter=%d success=%d %%=%d\n", | 2474 | "counter=%d success=%d %%=%d\n", |
2469 | rs_priv->lq_info[i].win[j].counter, | 2475 | lq_sta->lq_info[i].win[j].counter, |
2470 | rs_priv->lq_info[i].win[j].success_counter, | 2476 | lq_sta->lq_info[i].win[j].success_counter, |
2471 | rs_priv->lq_info[i].win[j].success_ratio); | 2477 | lq_sta->lq_info[i].win[j].success_ratio); |
2472 | } | 2478 | } |
2473 | } | 2479 | } |
2474 | return simple_read_from_buffer(user_buf, count, ppos, buff, desc); | 2480 | return simple_read_from_buffer(user_buf, count, ppos, buff, desc); |
@@ -2482,20 +2488,20 @@ static const struct file_operations rs_sta_dbgfs_stats_table_ops = { | |||
2482 | static void rs_add_debugfs(void *priv, void *priv_sta, | 2488 | static void rs_add_debugfs(void *priv, void *priv_sta, |
2483 | struct dentry *dir) | 2489 | struct dentry *dir) |
2484 | { | 2490 | { |
2485 | struct iwl4965_rate_scale_priv *rs_priv = priv_sta; | 2491 | struct iwl4965_lq_sta *lq_sta = priv_sta; |
2486 | rs_priv->rs_sta_dbgfs_scale_table_file = | 2492 | lq_sta->rs_sta_dbgfs_scale_table_file = |
2487 | debugfs_create_file("rate_scale_table", 0600, dir, | 2493 | debugfs_create_file("rate_scale_table", 0600, dir, |
2488 | rs_priv, &rs_sta_dbgfs_scale_table_ops); | 2494 | lq_sta, &rs_sta_dbgfs_scale_table_ops); |
2489 | rs_priv->rs_sta_dbgfs_stats_table_file = | 2495 | lq_sta->rs_sta_dbgfs_stats_table_file = |
2490 | debugfs_create_file("rate_stats_table", 0600, dir, | 2496 | debugfs_create_file("rate_stats_table", 0600, dir, |
2491 | rs_priv, &rs_sta_dbgfs_stats_table_ops); | 2497 | lq_sta, &rs_sta_dbgfs_stats_table_ops); |
2492 | } | 2498 | } |
2493 | 2499 | ||
2494 | static void rs_remove_debugfs(void *priv, void *priv_sta) | 2500 | static void rs_remove_debugfs(void *priv, void *priv_sta) |
2495 | { | 2501 | { |
2496 | struct iwl4965_rate_scale_priv *rs_priv = priv_sta; | 2502 | struct iwl4965_lq_sta *lq_sta = priv_sta; |
2497 | debugfs_remove(rs_priv->rs_sta_dbgfs_scale_table_file); | 2503 | debugfs_remove(lq_sta->rs_sta_dbgfs_scale_table_file); |
2498 | debugfs_remove(rs_priv->rs_sta_dbgfs_stats_table_file); | 2504 | debugfs_remove(lq_sta->rs_sta_dbgfs_stats_table_file); |
2499 | } | 2505 | } |
2500 | #endif | 2506 | #endif |
2501 | 2507 | ||
@@ -2520,9 +2526,9 @@ int iwl4965_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id) | |||
2520 | { | 2526 | { |
2521 | struct ieee80211_local *local = hw_to_local(hw); | 2527 | struct ieee80211_local *local = hw_to_local(hw); |
2522 | struct iwl4965_priv *priv = hw->priv; | 2528 | struct iwl4965_priv *priv = hw->priv; |
2523 | struct iwl4965_rate_scale_priv *rs_priv; | 2529 | struct iwl4965_lq_sta *lq_sta; |
2524 | struct sta_info *sta; | 2530 | struct sta_info *sta; |
2525 | int count = 0, i; | 2531 | int cnt = 0, i; |
2526 | u32 samples = 0, success = 0, good = 0; | 2532 | u32 samples = 0, success = 0, good = 0; |
2527 | unsigned long now = jiffies; | 2533 | unsigned long now = jiffies; |
2528 | u32 max_time = 0; | 2534 | u32 max_time = 0; |
@@ -2538,10 +2544,10 @@ int iwl4965_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id) | |||
2538 | return sprintf(buf, "station %d not found\n", sta_id); | 2544 | return sprintf(buf, "station %d not found\n", sta_id); |
2539 | } | 2545 | } |
2540 | 2546 | ||
2541 | rs_priv = (void *)sta->rate_ctrl_priv; | 2547 | lq_sta = (void *)sta->rate_ctrl_priv; |
2542 | 2548 | ||
2543 | lq_type = rs_priv->lq_info[rs_priv->active_tbl].lq_type; | 2549 | lq_type = lq_sta->lq_info[lq_sta->active_tbl].lq_type; |
2544 | antenna = rs_priv->lq_info[rs_priv->active_tbl].antenna_type; | 2550 | antenna = lq_sta->lq_info[lq_sta->active_tbl].antenna_type; |
2545 | 2551 | ||
2546 | if (is_legacy(lq_type)) | 2552 | if (is_legacy(lq_type)) |
2547 | i = IWL_RATE_54M_INDEX; | 2553 | i = IWL_RATE_54M_INDEX; |
@@ -2550,33 +2556,33 @@ int iwl4965_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id) | |||
2550 | while (1) { | 2556 | while (1) { |
2551 | u64 mask; | 2557 | u64 mask; |
2552 | int j; | 2558 | int j; |
2553 | int active = rs_priv->active_tbl; | 2559 | int active = lq_sta->active_tbl; |
2554 | 2560 | ||
2555 | count += | 2561 | cnt += |
2556 | sprintf(&buf[count], " %2dMbs: ", iwl4965_rates[i].ieee / 2); | 2562 | sprintf(&buf[cnt], " %2dMbs: ", iwl4965_rates[i].ieee / 2); |
2557 | 2563 | ||
2558 | mask = (1ULL << (IWL_RATE_MAX_WINDOW - 1)); | 2564 | mask = (1ULL << (IWL_RATE_MAX_WINDOW - 1)); |
2559 | for (j = 0; j < IWL_RATE_MAX_WINDOW; j++, mask >>= 1) | 2565 | for (j = 0; j < IWL_RATE_MAX_WINDOW; j++, mask >>= 1) |
2560 | buf[count++] = | 2566 | buf[cnt++] = |
2561 | (rs_priv->lq_info[active].win[i].data & mask) | 2567 | (lq_sta->lq_info[active].win[i].data & mask) |
2562 | ? '1' : '0'; | 2568 | ? '1' : '0'; |
2563 | 2569 | ||
2564 | samples += rs_priv->lq_info[active].win[i].counter; | 2570 | samples += lq_sta->lq_info[active].win[i].counter; |
2565 | good += rs_priv->lq_info[active].win[i].success_counter; | 2571 | good += lq_sta->lq_info[active].win[i].success_counter; |
2566 | success += rs_priv->lq_info[active].win[i].success_counter * | 2572 | success += lq_sta->lq_info[active].win[i].success_counter * |
2567 | iwl4965_rates[i].ieee; | 2573 | iwl4965_rates[i].ieee; |
2568 | 2574 | ||
2569 | if (rs_priv->lq_info[active].win[i].stamp) { | 2575 | if (lq_sta->lq_info[active].win[i].stamp) { |
2570 | int delta = | 2576 | int delta = |
2571 | jiffies_to_msecs(now - | 2577 | jiffies_to_msecs(now - |
2572 | rs_priv->lq_info[active].win[i].stamp); | 2578 | lq_sta->lq_info[active].win[i].stamp); |
2573 | 2579 | ||
2574 | if (delta > max_time) | 2580 | if (delta > max_time) |
2575 | max_time = delta; | 2581 | max_time = delta; |
2576 | 2582 | ||
2577 | count += sprintf(&buf[count], "%5dms\n", delta); | 2583 | cnt += sprintf(&buf[cnt], "%5dms\n", delta); |
2578 | } else | 2584 | } else |
2579 | buf[count++] = '\n'; | 2585 | buf[cnt++] = '\n'; |
2580 | 2586 | ||
2581 | j = iwl4965_get_prev_ieee_rate(i); | 2587 | j = iwl4965_get_prev_ieee_rate(i); |
2582 | if (j == i) | 2588 | if (j == i) |
@@ -2589,19 +2595,20 @@ int iwl4965_fill_rs_info(struct ieee80211_hw *hw, char *buf, u8 sta_id) | |||
2589 | * NOTE: We multiply # of samples by 2 since the IEEE measurement | 2595 | * NOTE: We multiply # of samples by 2 since the IEEE measurement |
2590 | * added from iwl4965_rates is actually 2X the rate */ | 2596 | * added from iwl4965_rates is actually 2X the rate */ |
2591 | if (samples) | 2597 | if (samples) |
2592 | count += sprintf(&buf[count], | 2598 | cnt += sprintf(&buf[cnt], |
2593 | "\nAverage rate is %3d.%02dMbs over last %4dms\n" | 2599 | "\nAverage rate is %3d.%02dMbs over last %4dms\n" |
2594 | "%3d%% success (%d good packets over %d tries)\n", | 2600 | "%3d%% success (%d good packets over %d tries)\n", |
2595 | success / (2 * samples), (success * 5 / samples) % 10, | 2601 | success / (2 * samples), (success * 5 / samples) % 10, |
2596 | max_time, good * 100 / samples, good, samples); | 2602 | max_time, good * 100 / samples, good, samples); |
2597 | else | 2603 | else |
2598 | count += sprintf(&buf[count], "\nAverage rate: 0Mbs\n"); | 2604 | cnt += sprintf(&buf[cnt], "\nAverage rate: 0Mbs\n"); |
2599 | count += sprintf(&buf[count], "\nrate scale type %d antenna %d " | 2605 | |
2606 | cnt += sprintf(&buf[cnt], "\nrate scale type %d antenna %d " | ||
2600 | "active_search %d rate index %d\n", lq_type, antenna, | 2607 | "active_search %d rate index %d\n", lq_type, antenna, |
2601 | rs_priv->search_better_tbl, sta->last_txrate); | 2608 | lq_sta->search_better_tbl, sta->last_txrate); |
2602 | 2609 | ||
2603 | sta_info_put(sta); | 2610 | sta_info_put(sta); |
2604 | return count; | 2611 | return cnt; |
2605 | } | 2612 | } |
2606 | 2613 | ||
2607 | void iwl4965_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id) | 2614 | void iwl4965_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id) |