diff --git a/sys/dev/rtwn/rtl8192c/r92c_tx.c b/sys/dev/rtwn/rtl8192c/r92c_tx.c --- a/sys/dev/rtwn/rtl8192c/r92c_tx.c +++ b/sys/dev/rtwn/rtl8192c/r92c_tx.c @@ -267,10 +267,24 @@ rtwn_r92c_tx_enable_ampdu(sc, buf, (m->m_flags & M_AMPDU_MPDU) != 0); if (m->m_flags & M_AMPDU_MPDU) { + struct ieee80211_tx_ampdu *tap = + &ni->ni_tx_ampdu[tid]; + int wnd; + txd->txdw2 |= htole32(SM(R92C_TXDW2_AMPDU_DEN, - vap->iv_ampdu_density)); + ieee80211_ht_get_node_ampdu_density(ni))); + /* + * BAW is (MAX_AGG * 2) + 1, hence the / 2 + * here. Ensure we don't send 0 or more than + * 31. + */ + wnd = tap->txa_wnd / 2; + if (wnd == 0) + wnd = 1; + if (wnd > 0x1f) + wnd = 0x1f; txd->txdw6 |= htole32(SM(R92C_TXDW6_MAX_AGG, - 0x1f)); /* XXX */ + wnd)); } if (sc->sc_ratectl == RTWN_RATECTL_NET80211) { txd->txdw2 |= htole32(R92C_TXDW2_CCX_RPT); diff --git a/sys/dev/rtwn/rtl8812a/r12a_tx.c b/sys/dev/rtwn/rtl8812a/r12a_tx.c --- a/sys/dev/rtwn/rtl8812a/r12a_tx.c +++ b/sys/dev/rtwn/rtl8812a/r12a_tx.c @@ -270,11 +270,25 @@ qsel = tid % RTWN_MAX_TID; if (m->m_flags & M_AMPDU_MPDU) { + struct ieee80211_tx_ampdu *tap = + &ni->ni_tx_ampdu[tid]; + int wnd; + txd->txdw2 |= htole32(R12A_TXDW2_AGGEN); txd->txdw2 |= htole32(SM(R12A_TXDW2_AMPDU_DEN, - vap->iv_ampdu_density)); + ieee80211_ht_get_node_ampdu_density(ni))); + /* + * BAW is (MAX_AGG * 2) + 1, hence the / 2 + * here. Ensure we don't send 0 or more than + * 31. + */ + wnd = tap->txa_wnd / 2; + if (wnd == 0) + wnd = 1; + if (wnd > 0x1f) + wnd = 0x1f; txd->txdw3 |= htole32(SM(R12A_TXDW3_MAX_AGG, - 0x1f)); /* XXX */ + wnd)); } else txd->txdw2 |= htole32(R12A_TXDW2_AGGBK);