summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authoradrian <adrian@FreeBSD.org>2016-04-29 01:53:45 +0000
committeradrian <adrian@FreeBSD.org>2016-04-29 01:53:45 +0000
commit695162c3413a87933c9895e4de9fb4fda8cb7ac9 (patch)
tree34ffd5aea373d46ab4be1e9d130b2683b62495d2 /sys/dev
parent60521cf89415f7b9e12e5312c69ad90b54fef834 (diff)
downloadFreeBSD-src-695162c3413a87933c9895e4de9fb4fda8cb7ac9.zip
FreeBSD-src-695162c3413a87933c9895e4de9fb4fda8cb7ac9.tar.gz
[ath] Add LDPC transmit support.
LDPC adds better transmit reliability if both ends support it. You in theory can do both STBC and LDPC at the same time. If I see issues I'll disable it. * Only enable it if both ends of a connection negotiate it. * Disable it if any rate is non-11n. * Count both LDPC TX and STBC TX. Tested: * AR9380, STA mode
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ath/if_ath_tx_ht.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/sys/dev/ath/if_ath_tx_ht.c b/sys/dev/ath/if_ath_tx_ht.c
index a20607e..4106c92 100644
--- a/sys/dev/ath/if_ath_tx_ht.c
+++ b/sys/dev/ath/if_ath_tx_ht.c
@@ -227,6 +227,20 @@ ath_tx_rate_fill_rcflags(struct ath_softc *sc, struct ath_buf *bf)
struct ath_rc_series *rc = bf->bf_state.bfs_rc;
uint8_t rate;
int i;
+ int do_ldpc;
+ int do_stbc;
+
+ /*
+ * We only do LDPC if the rate is 11n, both we and the
+ * receiver support LDPC and it's enabled.
+ *
+ * It's a global flag, not a per-try flag, so we clear
+ * it if any of the rate entries aren't 11n.
+ */
+ if ((ni->ni_vap->iv_htcaps & IEEE80211_HTCAP_LDPC) &&
+ (ni->ni_htcap & IEEE80211_HTCAP_LDPC))
+ do_ldpc = 1;
+ do_stbc = 0;
for (i = 0; i < ATH_RC_NUM; i++) {
rc[i].flags = 0;
@@ -250,6 +264,12 @@ ath_tx_rate_fill_rcflags(struct ath_softc *sc, struct ath_buf *bf)
(HAL_TXDESC_RTSENA | HAL_TXDESC_CTSENA))
rc[i].flags |= ATH_RC_RTSCTS_FLAG;
+ /*
+ * If we can't do LDPC, don't.
+ */
+ if (! IS_HT_RATE(rate))
+ do_ldpc = 0;
+
/* Only enable shortgi, 2040, dual-stream if HT is set */
if (IS_HT_RATE(rate)) {
rc[i].flags |= ATH_RC_HT_FLAG;
@@ -281,6 +301,7 @@ ath_tx_rate_fill_rcflags(struct ath_softc *sc, struct ath_buf *bf)
(sc->sc_cur_txchainmask > 1) &&
HT_RC_2_STREAMS(rate) == 1) {
rc[i].flags |= ATH_RC_STBC_FLAG;
+ do_stbc = 1;
}
/*
@@ -324,6 +345,18 @@ ath_tx_rate_fill_rcflags(struct ath_softc *sc, struct ath_buf *bf)
"%s: i=%d, rate=0x%x, flags=0x%x, max4ms=%d\n",
__func__, i, rate, rc[i].flags, rc[i].max4msframelen);
}
+
+ /*
+ * LDPC is a global flag, so ...
+ */
+ if (do_ldpc) {
+ bf->bf_state.bfs_txflags |= HAL_TXDESC_LDPC;
+ sc->sc_stats.ast_tx_ldpc++;
+ }
+
+ if (do_stbc) {
+ sc->sc_stats.ast_tx_stbc++;
+ }
}
/*
OpenPOWER on IntegriCloud