diff options
author | Luis R. Rodriguez <lrodriguez@atheros.com> | 2010-05-06 22:41:12 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-05-07 14:57:16 -0400 |
commit | 8e1559949928d4d8bfe044bfcf57879faff82e19 (patch) | |
tree | a1fbbf54e2092a150a1df4ed577765142037f9e4 /drivers/net/wireless | |
parent | c809e86c11a64488acc85ddf12ece3c9b879ccb6 (diff) |
ath9k_common: move the rate status setting into ath9k_process_rate()
This has no real functional change, this just moves the setting the
the mac80211 rate index into ath9k_process_rate(). This allows us
to eventually make ath9k_process_rate() return a negative value
in case we have detected a specific case rate situation which should
have been ignored.
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/common.c | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/drivers/net/wireless/ath/ath9k/common.c b/drivers/net/wireless/ath/ath9k/common.c index 579e15fb4143..254dcbdbc061 100644 --- a/drivers/net/wireless/ath/ath9k/common.c +++ b/drivers/net/wireless/ath/ath9k/common.c | |||
@@ -108,11 +108,11 @@ static bool ath9k_rx_accept(struct ath_common *common, | |||
108 | return true; | 108 | return true; |
109 | } | 109 | } |
110 | 110 | ||
111 | static u8 ath9k_process_rate(struct ath_common *common, | 111 | static int ath9k_process_rate(struct ath_common *common, |
112 | struct ieee80211_hw *hw, | 112 | struct ieee80211_hw *hw, |
113 | struct ath_rx_status *rx_stats, | 113 | struct ath_rx_status *rx_stats, |
114 | struct ieee80211_rx_status *rxs, | 114 | struct ieee80211_rx_status *rxs, |
115 | struct sk_buff *skb) | 115 | struct sk_buff *skb) |
116 | { | 116 | { |
117 | struct ieee80211_supported_band *sband; | 117 | struct ieee80211_supported_band *sband; |
118 | enum ieee80211_band band; | 118 | enum ieee80211_band band; |
@@ -128,25 +128,33 @@ static u8 ath9k_process_rate(struct ath_common *common, | |||
128 | rxs->flag |= RX_FLAG_40MHZ; | 128 | rxs->flag |= RX_FLAG_40MHZ; |
129 | if (rx_stats->rs_flags & ATH9K_RX_GI) | 129 | if (rx_stats->rs_flags & ATH9K_RX_GI) |
130 | rxs->flag |= RX_FLAG_SHORT_GI; | 130 | rxs->flag |= RX_FLAG_SHORT_GI; |
131 | return rx_stats->rs_rate & 0x7f; | 131 | rxs->rate_idx = rx_stats->rs_rate & 0x7f; |
132 | return 0; | ||
132 | } | 133 | } |
133 | 134 | ||
134 | for (i = 0; i < sband->n_bitrates; i++) { | 135 | for (i = 0; i < sband->n_bitrates; i++) { |
135 | if (sband->bitrates[i].hw_value == rx_stats->rs_rate) | 136 | if (sband->bitrates[i].hw_value == rx_stats->rs_rate) { |
136 | return i; | 137 | rxs->rate_idx = i; |
138 | return 0; | ||
139 | } | ||
137 | if (sband->bitrates[i].hw_value_short == rx_stats->rs_rate) { | 140 | if (sband->bitrates[i].hw_value_short == rx_stats->rs_rate) { |
138 | rxs->flag |= RX_FLAG_SHORTPRE; | 141 | rxs->flag |= RX_FLAG_SHORTPRE; |
139 | return i; | 142 | rxs->rate_idx = i; |
143 | return 0; | ||
140 | } | 144 | } |
141 | } | 145 | } |
142 | 146 | ||
143 | /* No valid hardware bitrate found -- we should not get here */ | 147 | /* |
148 | * No valid hardware bitrate found -- we should not get here | ||
149 | * because hardware has already validated this frame as OK. | ||
150 | */ | ||
144 | ath_print(common, ATH_DBG_XMIT, "unsupported hw bitrate detected " | 151 | ath_print(common, ATH_DBG_XMIT, "unsupported hw bitrate detected " |
145 | "0x%02x using 1 Mbit\n", rx_stats->rs_rate); | 152 | "0x%02x using 1 Mbit\n", rx_stats->rs_rate); |
146 | if ((common->debug_mask & ATH_DBG_XMIT)) | 153 | if ((common->debug_mask & ATH_DBG_XMIT)) |
147 | print_hex_dump_bytes("", DUMP_PREFIX_NONE, skb->data, skb->len); | 154 | print_hex_dump_bytes("", DUMP_PREFIX_NONE, skb->data, skb->len); |
148 | 155 | ||
149 | return 0; | 156 | rxs->rate_idx = 0; |
157 | return 0; | ||
150 | } | 158 | } |
151 | 159 | ||
152 | static void ath9k_process_rssi(struct ath_common *common, | 160 | static void ath9k_process_rssi(struct ath_common *common, |
@@ -208,13 +216,19 @@ int ath9k_cmn_rx_skb_preprocess(struct ath_common *common, | |||
208 | struct ath_hw *ah = common->ah; | 216 | struct ath_hw *ah = common->ah; |
209 | 217 | ||
210 | memset(rx_status, 0, sizeof(struct ieee80211_rx_status)); | 218 | memset(rx_status, 0, sizeof(struct ieee80211_rx_status)); |
219 | |||
220 | /* | ||
221 | * everything but the rate is checked here, the rate check is done | ||
222 | * separately to avoid doing two lookups for a rate for each frame. | ||
223 | */ | ||
211 | if (!ath9k_rx_accept(common, skb, rx_status, rx_stats, decrypt_error)) | 224 | if (!ath9k_rx_accept(common, skb, rx_status, rx_stats, decrypt_error)) |
212 | return -EINVAL; | 225 | return -EINVAL; |
213 | 226 | ||
214 | ath9k_process_rssi(common, hw, skb, rx_stats); | 227 | ath9k_process_rssi(common, hw, skb, rx_stats); |
215 | 228 | ||
216 | rx_status->rate_idx = ath9k_process_rate(common, hw, | 229 | if (ath9k_process_rate(common, hw, rx_stats, rx_status, skb)) |
217 | rx_stats, rx_status, skb); | 230 | return -EINVAL; |
231 | |||
218 | rx_status->mactime = ath9k_hw_extend_tsf(ah, rx_stats->rs_tstamp); | 232 | rx_status->mactime = ath9k_hw_extend_tsf(ah, rx_stats->rs_tstamp); |
219 | rx_status->band = hw->conf.channel->band; | 233 | rx_status->band = hw->conf.channel->band; |
220 | rx_status->freq = hw->conf.channel->center_freq; | 234 | rx_status->freq = hw->conf.channel->center_freq; |