Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 171700
b: refs/heads/master
c: 9878841
h: refs/heads/master
v: v3
  • Loading branch information
Luis R. Rodriguez authored and John W. Linville committed Nov 11, 2009
1 parent 0b1c49a commit f4d08ad
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 30 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 14077f5b7a28bdcd166faed2c0b36fad9f3eadda
refs/heads/master: 9878841e1360266fa4522fbdc2448fcdce95e0dd
72 changes: 43 additions & 29 deletions trunk/drivers/net/wireless/ath/ath9k/recv.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,47 @@ static bool ath9k_rx_accept(struct ath_common *common,
return true;
}

static u8 ath9k_process_rate(struct ath_common *common,
struct ieee80211_hw *hw,
struct ath_rx_status *rx_stats,
struct ieee80211_rx_status *rxs,
struct sk_buff *skb)
{
struct ieee80211_supported_band *sband;
enum ieee80211_band band;
unsigned int i = 0;

band = hw->conf.channel->band;
sband = hw->wiphy->bands[band];

if (rx_stats->rs_rate & 0x80) {
/* HT rate */
rxs->flag |= RX_FLAG_HT;
if (rx_stats->rs_flags & ATH9K_RX_2040)
rxs->flag |= RX_FLAG_40MHZ;
if (rx_stats->rs_flags & ATH9K_RX_GI)
rxs->flag |= RX_FLAG_SHORT_GI;
return rx_stats->rs_rate & 0x7f;
}

for (i = 0; i < sband->n_bitrates; i++) {
if (sband->bitrates[i].hw_value == rx_stats->rs_rate)
return i;
if (sband->bitrates[i].hw_value_short == rx_stats->rs_rate) {
rxs->flag |= RX_FLAG_SHORTPRE;
return i;
}
}

/* No valid hardware bitrate found -- we should not get here */
ath_print(common, ATH_DBG_XMIT, "unsupported hw bitrate detected "
"0x%02x using 1 Mbit\n", rx_stats->rs_rate);
if ((common->debug_mask & ATH_DBG_XMIT))
print_hex_dump_bytes("", DUMP_PREFIX_NONE, skb->data, skb->len);

return 0;
}

/*
* For Decrypt or Demic errors, we only mark packet status here and always push
* up the frame up to let mac80211 handle the actual error case, be it no
Expand All @@ -173,35 +214,6 @@ static int ath_rx_prepare(struct ath_common *common,
if (!ath9k_rx_accept(common, skb, rx_status, rx_stats, decrypt_error))
goto rx_next;

if (rx_stats->rs_rate & 0x80) {
/* HT rate */
rx_status->flag |= RX_FLAG_HT;
if (rx_stats->rs_flags & ATH9K_RX_2040)
rx_status->flag |= RX_FLAG_40MHZ;
if (rx_stats->rs_flags & ATH9K_RX_GI)
rx_status->flag |= RX_FLAG_SHORT_GI;
rx_status->rate_idx = rx_stats->rs_rate & 0x7f;
} else {
struct ieee80211_supported_band *sband;
unsigned int i = 0;
enum ieee80211_band band;

band = hw->conf.channel->band;
sband = hw->wiphy->bands[band];

for (i = 0; i < sband->n_bitrates; i++) {
if (sband->bitrates[i].hw_value == rx_stats->rs_rate) {
rx_status->rate_idx = i;
break;
}
if (sband->bitrates[i].hw_value_short ==
rx_stats->rs_rate) {
rx_status->rate_idx = i;
rx_status->flag |= RX_FLAG_SHORTPRE;
break;
}
}
}

rcu_read_lock();
/* XXX: use ieee80211_find_sta! */
Expand All @@ -227,6 +239,8 @@ static int ath_rx_prepare(struct ath_common *common,
if (ieee80211_is_beacon(fc))
ah->stats.avgbrssi = rx_stats->rs_rssi;

rx_status->rate_idx = ath9k_process_rate(common, hw,
rx_stats, rx_status, skb);
rx_status->mactime = ath9k_hw_extend_tsf(ah, rx_stats->rs_tstamp);
rx_status->band = hw->conf.channel->band;
rx_status->freq = hw->conf.channel->center_freq;
Expand Down

0 comments on commit f4d08ad

Please sign in to comment.