summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/ath
diff options
context:
space:
mode:
authorMichal Kazior <michal.kazior@tieto.com>2015-03-30 09:51:54 +0300
committerKalle Valo <kvalo@qca.qualcomm.com>2015-03-30 15:08:36 +0300
commit486017ccbd79d9b5b40bf39ed82a359b6afb2140 (patch)
tree129d804834d3ca20928fcc5f6767493a81640a75 /drivers/net/wireless/ath
parentdcc330987fed1b8a893cc0e7e71e6413028a6d56 (diff)
ath10k: derive rate from bitrate
There's no need to store rate values in hw_value. This frees up the hw_value for better future use. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Diffstat (limited to 'drivers/net/wireless/ath')
-rw-r--r--drivers/net/wireless/ath/ath10k/mac.c47
1 files changed, 34 insertions, 13 deletions
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 36afe7cb3fc6..9474fc8a341d 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -43,19 +43,19 @@
static struct ieee80211_rate ath10k_rates[] = {
/* CCK */
- RATETAB_ENT(10, 0x82, 0),
- RATETAB_ENT(20, 0x84, 0),
- RATETAB_ENT(55, 0x8b, 0),
- RATETAB_ENT(110, 0x96, 0),
+ RATETAB_ENT(10, 0, 0),
+ RATETAB_ENT(20, 0, 0),
+ RATETAB_ENT(55, 0, 0),
+ RATETAB_ENT(110, 0, 0),
/* OFDM */
- RATETAB_ENT(60, 0x0c, 0),
- RATETAB_ENT(90, 0x12, 0),
- RATETAB_ENT(120, 0x18, 0),
- RATETAB_ENT(180, 0x24, 0),
- RATETAB_ENT(240, 0x30, 0),
- RATETAB_ENT(360, 0x48, 0),
- RATETAB_ENT(480, 0x60, 0),
- RATETAB_ENT(540, 0x6c, 0),
+ RATETAB_ENT(60, 0, 0),
+ RATETAB_ENT(90, 0, 0),
+ RATETAB_ENT(120, 0, 0),
+ RATETAB_ENT(180, 0, 0),
+ RATETAB_ENT(240, 0, 0),
+ RATETAB_ENT(360, 0, 0),
+ RATETAB_ENT(480, 0, 0),
+ RATETAB_ENT(540, 0, 0),
};
#define ath10k_a_rates (ath10k_rates + 4)
@@ -63,6 +63,25 @@ static struct ieee80211_rate ath10k_rates[] = {
#define ath10k_g_rates (ath10k_rates + 0)
#define ath10k_g_rates_size (ARRAY_SIZE(ath10k_rates))
+static bool ath10k_mac_bitrate_is_cck(int bitrate)
+{
+ switch (bitrate) {
+ case 10:
+ case 20:
+ case 55:
+ case 110:
+ return true;
+ }
+
+ return false;
+}
+
+static u8 ath10k_mac_bitrate_to_rate(int bitrate)
+{
+ return DIV_ROUND_UP(bitrate, 5) |
+ (ath10k_mac_bitrate_is_cck(bitrate) ? BIT(7) : 0);
+}
+
/**********/
/* Crypto */
/**********/
@@ -1736,6 +1755,7 @@ static void ath10k_peer_assoc_h_rates(struct ath10k *ar,
const struct ieee80211_supported_band *sband;
const struct ieee80211_rate *rates;
u32 ratemask;
+ u8 rate;
int i;
lockdep_assert_held(&ar->conf_mutex);
@@ -1750,7 +1770,8 @@ static void ath10k_peer_assoc_h_rates(struct ath10k *ar,
if (!(ratemask & 1))
continue;
- rateset->rates[rateset->num_rates] = rates->hw_value;
+ rate = ath10k_mac_bitrate_to_rate(rates->bitrate);
+ rateset->rates[rateset->num_rates] = rate;
rateset->num_rates++;
}
}