diff options
author | Sujith Manoharan <c_manoha@qca.qualcomm.com> | 2013-08-14 11:45:54 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2013-08-15 16:08:06 -0400 |
commit | e3acd13d2141fa25566877e8f575065f204317f5 (patch) | |
tree | 1cf3b151867ae62da2a74ee0bb45b4fbf64105a4 /drivers/net/wireless/ath/ath9k/recv.c | |
parent | ea3ef101d750f78dc1e532bcf759ab9afea295df (diff) |
ath9k: Handle invalid RSSI
The combined RSSI can be invalid which is indicated by
the value -128. Use RX_FLAG_NO_SIGNAL_VAL for such cases.
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/ath9k/recv.c')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/recv.c | 49 |
1 files changed, 33 insertions, 16 deletions
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c index 3b47198239f9..6ad7d6196b2e 100644 --- a/drivers/net/wireless/ath/ath9k/recv.c +++ b/drivers/net/wireless/ath/ath9k/recv.c | |||
@@ -885,29 +885,49 @@ static int ath9k_process_rate(struct ath_common *common, | |||
885 | 885 | ||
886 | static void ath9k_process_rssi(struct ath_common *common, | 886 | static void ath9k_process_rssi(struct ath_common *common, |
887 | struct ieee80211_hw *hw, | 887 | struct ieee80211_hw *hw, |
888 | struct ath_rx_status *rx_stats) | 888 | struct ath_rx_status *rx_stats, |
889 | struct ieee80211_rx_status *rxs) | ||
889 | { | 890 | { |
890 | struct ath_softc *sc = hw->priv; | 891 | struct ath_softc *sc = hw->priv; |
891 | struct ath_hw *ah = common->ah; | 892 | struct ath_hw *ah = common->ah; |
892 | int last_rssi; | 893 | int last_rssi; |
893 | int rssi = rx_stats->rs_rssi; | 894 | int rssi = rx_stats->rs_rssi; |
894 | 895 | ||
895 | if (!rx_stats->is_mybeacon || | 896 | /* |
896 | ((ah->opmode != NL80211_IFTYPE_STATION) && | 897 | * RSSI is not available for subframes in an A-MPDU. |
897 | (ah->opmode != NL80211_IFTYPE_ADHOC))) | 898 | */ |
899 | if (rx_stats->rs_moreaggr) { | ||
900 | rxs->flag |= RX_FLAG_NO_SIGNAL_VAL; | ||
901 | return; | ||
902 | } | ||
903 | |||
904 | /* | ||
905 | * Check if the RSSI for the last subframe in an A-MPDU | ||
906 | * or an unaggregated frame is valid. | ||
907 | */ | ||
908 | if (rx_stats->rs_rssi == ATH9K_RSSI_BAD) { | ||
909 | rxs->flag |= RX_FLAG_NO_SIGNAL_VAL; | ||
898 | return; | 910 | return; |
911 | } | ||
899 | 912 | ||
900 | if (rx_stats->rs_rssi != ATH9K_RSSI_BAD && !rx_stats->rs_moreaggr) | 913 | /* |
914 | * Update Beacon RSSI, this is used by ANI. | ||
915 | */ | ||
916 | if (rx_stats->is_mybeacon && | ||
917 | ((ah->opmode == NL80211_IFTYPE_STATION) || | ||
918 | (ah->opmode == NL80211_IFTYPE_ADHOC))) { | ||
901 | ATH_RSSI_LPF(sc->last_rssi, rx_stats->rs_rssi); | 919 | ATH_RSSI_LPF(sc->last_rssi, rx_stats->rs_rssi); |
920 | last_rssi = sc->last_rssi; | ||
921 | |||
922 | if (likely(last_rssi != ATH_RSSI_DUMMY_MARKER)) | ||
923 | rssi = ATH_EP_RND(last_rssi, ATH_RSSI_EP_MULTIPLIER); | ||
924 | if (rssi < 0) | ||
925 | rssi = 0; | ||
902 | 926 | ||
903 | last_rssi = sc->last_rssi; | 927 | ah->stats.avgbrssi = rssi; |
904 | if (likely(last_rssi != ATH_RSSI_DUMMY_MARKER)) | 928 | } |
905 | rssi = ATH_EP_RND(last_rssi, ATH_RSSI_EP_MULTIPLIER); | ||
906 | if (rssi < 0) | ||
907 | rssi = 0; | ||
908 | 929 | ||
909 | /* Update Beacon RSSI, this is used by ANI. */ | 930 | rxs->signal = ah->noise + rx_stats->rs_rssi; |
910 | ah->stats.avgbrssi = rssi; | ||
911 | } | 931 | } |
912 | 932 | ||
913 | static void ath9k_process_tsf(struct ath_rx_status *rs, | 933 | static void ath9k_process_tsf(struct ath_rx_status *rs, |
@@ -1149,15 +1169,12 @@ static int ath9k_rx_skb_preprocess(struct ath_softc *sc, | |||
1149 | goto exit; | 1169 | goto exit; |
1150 | } | 1170 | } |
1151 | 1171 | ||
1152 | ath9k_process_rssi(common, hw, rx_stats); | 1172 | ath9k_process_rssi(common, hw, rx_stats, rx_status); |
1153 | 1173 | ||
1154 | rx_status->band = hw->conf.chandef.chan->band; | 1174 | rx_status->band = hw->conf.chandef.chan->band; |
1155 | rx_status->freq = hw->conf.chandef.chan->center_freq; | 1175 | rx_status->freq = hw->conf.chandef.chan->center_freq; |
1156 | rx_status->signal = ah->noise + rx_stats->rs_rssi; | ||
1157 | rx_status->antenna = rx_stats->rs_antenna; | 1176 | rx_status->antenna = rx_stats->rs_antenna; |
1158 | rx_status->flag |= RX_FLAG_MACTIME_END; | 1177 | rx_status->flag |= RX_FLAG_MACTIME_END; |
1159 | if (rx_stats->rs_moreaggr) | ||
1160 | rx_status->flag |= RX_FLAG_NO_SIGNAL_VAL; | ||
1161 | 1178 | ||
1162 | #ifdef CONFIG_ATH9K_BTCOEX_SUPPORT | 1179 | #ifdef CONFIG_ATH9K_BTCOEX_SUPPORT |
1163 | if (ieee80211_is_data_present(hdr->frame_control) && | 1180 | if (ieee80211_is_data_present(hdr->frame_control) && |