aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath
diff options
context:
space:
mode:
authorSujith Manoharan <c_manoha@qca.qualcomm.com>2013-08-14 11:45:56 -0400
committerJohn W. Linville <linville@tuxdriver.com>2013-08-15 16:08:07 -0400
commitc3124df7962f7a58177073d54d451e1661ffb71f (patch)
treec8645128ff5e15576704ab4e6c1612dd14226321 /drivers/net/wireless/ath
parent009af8fb69c9d6274b3a49377be5ba2379e188d6 (diff)
ath9k: Optimize LNA check
The documentation for antenna diversity says: "The decision of diversity is done at 802.11 preamble. So, for 11G/11B, for every MAC packet hardware will do a decision. But in 11N with aggregation, the decision is made only at the preamble and all other MPDUs will use the same LNA as the first MPDU." Make use of rs_firstaggr to avoid needlessly scanning for LNA changes. 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/recv.c77
1 files changed, 47 insertions, 30 deletions
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c
index 6ad7d6196b2e..6161d148cd0c 100644
--- a/drivers/net/wireless/ath/ath9k/recv.c
+++ b/drivers/net/wireless/ath/ath9k/recv.c
@@ -1238,6 +1238,52 @@ static void ath9k_rx_skb_postprocess(struct ath_common *common,
1238 rxs->flag &= ~RX_FLAG_DECRYPTED; 1238 rxs->flag &= ~RX_FLAG_DECRYPTED;
1239} 1239}
1240 1240
1241/*
1242 * Run the LNA combining algorithm only in these cases:
1243 *
1244 * Standalone WLAN cards with both LNA/Antenna diversity
1245 * enabled in the EEPROM.
1246 *
1247 * WLAN+BT cards which are in the supported card list
1248 * in ath_pci_id_table and the user has loaded the
1249 * driver with "bt_ant_diversity" set to true.
1250 */
1251static void ath9k_antenna_check(struct ath_softc *sc,
1252 struct ath_rx_status *rs)
1253{
1254 struct ath_hw *ah = sc->sc_ah;
1255 struct ath9k_hw_capabilities *pCap = &ah->caps;
1256 struct ath_common *common = ath9k_hw_common(ah);
1257
1258 if (!(ah->caps.hw_caps & ATH9K_HW_CAP_ANT_DIV_COMB))
1259 return;
1260
1261 /*
1262 * All MPDUs in an aggregate will use the same LNA
1263 * as the first MPDU.
1264 */
1265 if (rs->rs_isaggr && !rs->rs_firstaggr)
1266 return;
1267
1268 /*
1269 * Change the default rx antenna if rx diversity
1270 * chooses the other antenna 3 times in a row.
1271 */
1272 if (sc->rx.defant != rs->rs_antenna) {
1273 if (++sc->rx.rxotherant >= 3)
1274 ath_setdefantenna(sc, rs->rs_antenna);
1275 } else {
1276 sc->rx.rxotherant = 0;
1277 }
1278
1279 if (pCap->hw_caps & ATH9K_HW_CAP_BT_ANT_DIV) {
1280 if (common->bt_ant_diversity)
1281 ath_ant_comb_scan(sc, rs);
1282 } else {
1283 ath_ant_comb_scan(sc, rs);
1284 }
1285}
1286
1241static void ath9k_apply_ampdu_details(struct ath_softc *sc, 1287static void ath9k_apply_ampdu_details(struct ath_softc *sc,
1242 struct ath_rx_status *rs, struct ieee80211_rx_status *rxs) 1288 struct ath_rx_status *rs, struct ieee80211_rx_status *rxs)
1243{ 1289{
@@ -1262,7 +1308,6 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp)
1262 struct sk_buff *skb = NULL, *requeue_skb, *hdr_skb; 1308 struct sk_buff *skb = NULL, *requeue_skb, *hdr_skb;
1263 struct ieee80211_rx_status *rxs; 1309 struct ieee80211_rx_status *rxs;
1264 struct ath_hw *ah = sc->sc_ah; 1310 struct ath_hw *ah = sc->sc_ah;
1265 struct ath9k_hw_capabilities *pCap = &ah->caps;
1266 struct ath_common *common = ath9k_hw_common(ah); 1311 struct ath_common *common = ath9k_hw_common(ah);
1267 struct ieee80211_hw *hw = sc->hw; 1312 struct ieee80211_hw *hw = sc->hw;
1268 int retval; 1313 int retval;
@@ -1398,35 +1443,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp)
1398 ath_rx_ps(sc, skb, rs.is_mybeacon); 1443 ath_rx_ps(sc, skb, rs.is_mybeacon);
1399 spin_unlock_irqrestore(&sc->sc_pm_lock, flags); 1444 spin_unlock_irqrestore(&sc->sc_pm_lock, flags);
1400 1445
1401 /* 1446 ath9k_antenna_check(sc, &rs);
1402 * Run the LNA combining algorithm only in these cases:
1403 *
1404 * Standalone WLAN cards with both LNA/Antenna diversity
1405 * enabled in the EEPROM.
1406 *
1407 * WLAN+BT cards which are in the supported card list
1408 * in ath_pci_id_table and the user has loaded the
1409 * driver with "bt_ant_diversity" set to true.
1410 */
1411 if (ah->caps.hw_caps & ATH9K_HW_CAP_ANT_DIV_COMB) {
1412 /*
1413 * Change the default rx antenna if rx diversity
1414 * chooses the other antenna 3 times in a row.
1415 */
1416 if (sc->rx.defant != rs.rs_antenna) {
1417 if (++sc->rx.rxotherant >= 3)
1418 ath_setdefantenna(sc, rs.rs_antenna);
1419 } else {
1420 sc->rx.rxotherant = 0;
1421 }
1422
1423 if (pCap->hw_caps & ATH9K_HW_CAP_BT_ANT_DIV) {
1424 if (common->bt_ant_diversity)
1425 ath_ant_comb_scan(sc, &rs);
1426 } else {
1427 ath_ant_comb_scan(sc, &rs);
1428 }
1429 }
1430 1447
1431 ath9k_apply_ampdu_details(sc, &rs, rxs); 1448 ath9k_apply_ampdu_details(sc, &rs, rxs);
1432 1449