aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath
diff options
context:
space:
mode:
authorSujith Manoharan <c_manoha@qca.qualcomm.com>2012-08-10 07:16:11 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-08-10 15:27:08 -0400
commitc05ea151770f6508e611b789f84c8bf57fa267cd (patch)
treecde48851beb5c1339cc91a0c67ecec9692ca7d9a /drivers/net/wireless/ath
parentea2771f642315847cdc0d392602fa3039af41743 (diff)
ath9k: Cleanup ath_rc_setvalid_rates
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath')
-rw-r--r--drivers/net/wireless/ath/ath9k/rc.c49
1 files changed, 21 insertions, 28 deletions
diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c
index 49c71da9edb2..a34f678fc57b 100644
--- a/drivers/net/wireless/ath/ath9k/rc.c
+++ b/drivers/net/wireless/ath/ath9k/rc.c
@@ -516,39 +516,32 @@ static u8 ath_rc_setvalid_rates(struct ath_rate_priv *ath_rc_priv)
516{ 516{
517 const struct ath_rate_table *rate_table = ath_rc_priv->rate_table; 517 const struct ath_rate_table *rate_table = ath_rc_priv->rate_table;
518 struct ath_rateset *rateset = &ath_rc_priv->neg_rates; 518 struct ath_rateset *rateset = &ath_rc_priv->neg_rates;
519 u32 capflag = ath_rc_priv->ht_cap; 519 u32 phy, capflag = ath_rc_priv->ht_cap;
520 u8 i, j, hi = 0; 520 u16 rate_flags;
521 u8 i, j, hi = 0, rate, dot11rate, valid_rate_count;
521 522
522 for (i = 0; i < rateset->rs_nrates; i++) { 523 for (i = 0; i < rateset->rs_nrates; i++) {
523 for (j = 0; j < rate_table->rate_cnt; j++) { 524 for (j = 0; j < rate_table->rate_cnt; j++) {
524 u32 phy = rate_table->info[j].phy; 525 phy = rate_table->info[j].phy;
525 u16 rate_flags = rate_table->info[j].rate_flags; 526 rate_flags = rate_table->info[j].rate_flags;
526 u8 rate = rateset->rs_rates[i]; 527 rate = rateset->rs_rates[i];
527 u8 dot11rate = rate_table->info[j].dot11rate; 528 dot11rate = rate_table->info[j].dot11rate;
528 529
529 /* We allow a rate only if its valid and the 530 if (rate != dot11rate
530 * capflag matches one of the validity 531 || ((rate_flags & WLAN_RC_CAP_MODE(capflag)) !=
531 * (VALID/VALID_20/VALID_40) flags */ 532 WLAN_RC_CAP_MODE(capflag))
532 533 || !(rate_flags & WLAN_RC_CAP_STREAM(capflag))
533 if ((rate == dot11rate) && 534 || WLAN_RC_PHY_HT(phy))
534 (rate_flags & WLAN_RC_CAP_MODE(capflag)) == 535 continue;
535 WLAN_RC_CAP_MODE(capflag) &&
536 (rate_flags & WLAN_RC_CAP_STREAM(capflag)) &&
537 !WLAN_RC_PHY_HT(phy)) {
538 u8 valid_rate_count = 0;
539
540 if (!ath_rc_valid_phyrate(phy, capflag, 0))
541 continue;
542 536
543 valid_rate_count = 537 if (!ath_rc_valid_phyrate(phy, capflag, 0))
544 ath_rc_priv->valid_phy_ratecnt[phy]; 538 continue;
545 539
546 ath_rc_priv->valid_phy_rateidx[phy] 540 valid_rate_count = ath_rc_priv->valid_phy_ratecnt[phy];
547 [valid_rate_count] = j; 541 ath_rc_priv->valid_phy_rateidx[phy][valid_rate_count] = j;
548 ath_rc_priv->valid_phy_ratecnt[phy] += 1; 542 ath_rc_priv->valid_phy_ratecnt[phy] += 1;
549 ath_rc_set_valid_rate_idx(ath_rc_priv, j, 1); 543 ath_rc_set_valid_rate_idx(ath_rc_priv, j, 1);
550 hi = max(hi, j); 544 hi = max(hi, j);
551 }
552 } 545 }
553 } 546 }
554 547