[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
This commit is contained in:
Adrian Chadd 2016-04-29 01:53:45 +00:00
parent 82525db1eb
commit ce725c8e00

View File

@ -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++;
}
}
/*