aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSujith <Sujith.Manoharan@atheros.com>2009-01-30 03:59:15 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-02-09 15:03:44 -0500
commit3900898c7a3d563d14a1288f483f8a589bd38299 (patch)
treebae80390c43e36f081a7b274faaeab4cb6b582e1 /drivers
parenta6c8d375f539d450bf8d45e8ccbb7c9e26dffbef (diff)
ath9k: Cleanup get_rate() interface
The interface to calculate the TX rate for a data frame was convoluted with lots of redundant arguments being passed around. Remove all of that and make it simple. Signed-off-by: Sujith <Sujith.Manoharan@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/ath9k/rc.c67
1 files changed, 28 insertions, 39 deletions
diff --git a/drivers/net/wireless/ath9k/rc.c b/drivers/net/wireless/ath9k/rc.c
index 61c86c4f9fc4..8bc7bb50c7fc 100644
--- a/drivers/net/wireless/ath9k/rc.c
+++ b/drivers/net/wireless/ath9k/rc.c
@@ -631,8 +631,7 @@ static u8 ath_rc_setvalid_htrates(struct ath_rate_priv *ath_rc_priv,
631static u8 ath_rc_ratefind_ht(struct ath_softc *sc, 631static u8 ath_rc_ratefind_ht(struct ath_softc *sc,
632 struct ath_rate_priv *ath_rc_priv, 632 struct ath_rate_priv *ath_rc_priv,
633 struct ath_rate_table *rate_table, 633 struct ath_rate_table *rate_table,
634 int probe_allowed, int *is_probing, 634 int *is_probing)
635 int is_retry)
636{ 635{
637 u32 dt, best_thruput, this_thruput, now_msec; 636 u32 dt, best_thruput, this_thruput, now_msec;
638 u8 rate, next_rate, best_rate, maxindex, minindex; 637 u8 rate, next_rate, best_rate, maxindex, minindex;
@@ -714,13 +713,6 @@ static u8 ath_rc_ratefind_ht(struct ath_softc *sc,
714 } 713 }
715 714
716 rate = best_rate; 715 rate = best_rate;
717
718 /* if we are retrying for more than half the number
719 * of max retries, use the min rate for the next retry
720 */
721 if (is_retry)
722 rate = ath_rc_priv->valid_rate_index[minindex];
723
724 ath_rc_priv->rssi_last_lookup = rssi_last; 716 ath_rc_priv->rssi_last_lookup = rssi_last;
725 717
726 /* 718 /*
@@ -728,13 +720,12 @@ static u8 ath_rc_ratefind_ht(struct ath_softc *sc,
728 * non-monoticity of 11g's rate table 720 * non-monoticity of 11g's rate table
729 */ 721 */
730 722
731 if (rate >= ath_rc_priv->rate_max_phy && probe_allowed) { 723 if (rate >= ath_rc_priv->rate_max_phy) {
732 rate = ath_rc_priv->rate_max_phy; 724 rate = ath_rc_priv->rate_max_phy;
733 725
734 /* Probe the next allowed phy state */ 726 /* Probe the next allowed phy state */
735 /* FIXME:XXXX Check to make sure ratMax is checked properly */
736 if (ath_rc_get_nextvalid_txrate(rate_table, 727 if (ath_rc_get_nextvalid_txrate(rate_table,
737 ath_rc_priv, rate, &next_rate) && 728 ath_rc_priv, rate, &next_rate) &&
738 (now_msec - ath_rc_priv->probe_time > 729 (now_msec - ath_rc_priv->probe_time >
739 rate_table->probe_interval) && 730 rate_table->probe_interval) &&
740 (ath_rc_priv->hw_maxretry_pktcnt >= 1)) { 731 (ath_rc_priv->hw_maxretry_pktcnt >= 1)) {
@@ -804,54 +795,54 @@ static u8 ath_rc_rate_getidx(struct ath_softc *sc,
804 795
805static void ath_rc_ratefind(struct ath_softc *sc, 796static void ath_rc_ratefind(struct ath_softc *sc,
806 struct ath_rate_priv *ath_rc_priv, 797 struct ath_rate_priv *ath_rc_priv,
807 int num_tries, int num_rates, 798 struct ieee80211_tx_rate_control *txrc)
808 struct ieee80211_tx_info *tx_info, int *is_probe,
809 int is_retry)
810{ 799{
811 u8 try_per_rate = 0, i = 0, rix, nrix;
812 struct ath_rate_table *rate_table; 800 struct ath_rate_table *rate_table;
801 struct sk_buff *skb = txrc->skb;
802 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
813 struct ieee80211_tx_rate *rates = tx_info->control.rates; 803 struct ieee80211_tx_rate *rates = tx_info->control.rates;
804 u8 try_per_rate = 0, i = 0, rix, nrix;
805 int is_probe = 0;
814 806
815 rate_table = sc->cur_rate_table; 807 rate_table = sc->cur_rate_table;
816 rix = ath_rc_ratefind_ht(sc, ath_rc_priv, rate_table, 1, 808 rix = ath_rc_ratefind_ht(sc, ath_rc_priv, rate_table, &is_probe);
817 is_probe, is_retry);
818 nrix = rix; 809 nrix = rix;
819 810
820 if (*is_probe) { 811 if (is_probe) {
821 /* set one try for probe rates. For the 812 /* set one try for probe rates. For the
822 * probes don't enable rts */ 813 * probes don't enable rts */
823 ath_rc_rate_set_series(rate_table, 814 ath_rc_rate_set_series(rate_table, &rates[i++],
824 &rates[i++], 1, nrix, 0); 815 1, nrix, 0);
825 816
826 try_per_rate = (num_tries/num_rates); 817 try_per_rate = (ATH_11N_TXMAXTRY/4);
827 /* Get the next tried/allowed rate. No RTS for the next series 818 /* Get the next tried/allowed rate. No RTS for the next series
828 * after the probe rate 819 * after the probe rate
829 */ 820 */
830 nrix = ath_rc_rate_getidx(sc, 821 nrix = ath_rc_rate_getidx(sc, ath_rc_priv,
831 ath_rc_priv, rate_table, nrix, 1, 0); 822 rate_table, nrix, 1, 0);
832 ath_rc_rate_set_series(rate_table, 823 ath_rc_rate_set_series(rate_table, &rates[i++],
833 &rates[i++], try_per_rate, nrix, 0); 824 try_per_rate, nrix, 0);
834 } else { 825 } else {
835 try_per_rate = (num_tries/num_rates); 826 try_per_rate = (ATH_11N_TXMAXTRY/4);
836 /* Set the choosen rate. No RTS for first series entry. */ 827 /* Set the choosen rate. No RTS for first series entry. */
837 ath_rc_rate_set_series(rate_table, 828 ath_rc_rate_set_series(rate_table, &rates[i++],
838 &rates[i++], try_per_rate, nrix, 0); 829 try_per_rate, nrix, 0);
839 } 830 }
840 831
841 /* Fill in the other rates for multirate retry */ 832 /* Fill in the other rates for multirate retry */
842 for ( ; i < num_rates; i++) { 833 for ( ; i < 4; i++) {
843 u8 try_num; 834 u8 try_num;
844 u8 min_rate; 835 u8 min_rate;
845 836
846 try_num = ((i + 1) == num_rates) ? 837 try_num = ((i + 1) == 4) ?
847 num_tries - (try_per_rate * i) : try_per_rate ; 838 ATH_11N_TXMAXTRY - (try_per_rate * i) : try_per_rate ;
848 min_rate = (((i + 1) == num_rates) && 0); 839 min_rate = (((i + 1) == 4) && 0);
849 840
850 nrix = ath_rc_rate_getidx(sc, ath_rc_priv, 841 nrix = ath_rc_rate_getidx(sc, ath_rc_priv,
851 rate_table, nrix, 1, min_rate); 842 rate_table, nrix, 1, min_rate);
852 /* All other rates in the series have RTS enabled */ 843 /* All other rates in the series have RTS enabled */
853 ath_rc_rate_set_series(rate_table, 844 ath_rc_rate_set_series(rate_table, &rates[i],
854 &rates[i], try_num, nrix, 1); 845 try_num, nrix, 1);
855 } 846 }
856 847
857 /* 848 /*
@@ -1503,10 +1494,9 @@ static void ath_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta,
1503 struct ieee80211_supported_band *sband = txrc->sband; 1494 struct ieee80211_supported_band *sband = txrc->sband;
1504 struct sk_buff *skb = txrc->skb; 1495 struct sk_buff *skb = txrc->skb;
1505 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 1496 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
1497 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
1506 struct ath_softc *sc = priv; 1498 struct ath_softc *sc = priv;
1507 struct ath_rate_priv *ath_rc_priv = priv_sta; 1499 struct ath_rate_priv *ath_rc_priv = priv_sta;
1508 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
1509 int is_probe = 0;
1510 __le16 fc = hdr->frame_control; 1500 __le16 fc = hdr->frame_control;
1511 1501
1512 /* lowest rate for management and multicast/broadcast frames */ 1502 /* lowest rate for management and multicast/broadcast frames */
@@ -1519,8 +1509,7 @@ static void ath_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta,
1519 } 1509 }
1520 1510
1521 /* Find tx rate for unicast frames */ 1511 /* Find tx rate for unicast frames */
1522 ath_rc_ratefind(sc, ath_rc_priv, ATH_11N_TXMAXTRY, 4, 1512 ath_rc_ratefind(sc, ath_rc_priv, txrc);
1523 tx_info, &is_probe, false);
1524} 1513}
1525 1514
1526static void ath_rate_init(void *priv, struct ieee80211_supported_band *sband, 1515static void ath_rate_init(void *priv, struct ieee80211_supported_band *sband,