Date: Sat, 21 Jan 2017 15:03:58 +0000 (UTC) From: Andriy Voskoboinyk <avos@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312597 - in head/sys/dev/rtwn: . rtl8812a rtl8812a/usb rtl8821a/usb Message-ID: <201701211503.v0LF3wtD084216@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: avos Date: Sat Jan 21 15:03:58 2017 New Revision: 312597 URL: https://svnweb.freebsd.org/changeset/base/312597 Log: rtwn: enable LDPC support where possible Tested with RTL8821AU, STA mode. Modified: head/sys/dev/rtwn/if_rtwn.c head/sys/dev/rtwn/rtl8812a/r12a_rx.c head/sys/dev/rtwn/rtl8812a/r12a_tx.c head/sys/dev/rtwn/rtl8812a/usb/r12au_attach.c head/sys/dev/rtwn/rtl8821a/usb/r21au_attach.c Modified: head/sys/dev/rtwn/if_rtwn.c ============================================================================== --- head/sys/dev/rtwn/if_rtwn.c Sat Jan 21 14:19:06 2017 (r312596) +++ head/sys/dev/rtwn/if_rtwn.c Sat Jan 21 15:03:58 2017 (r312597) @@ -695,6 +695,7 @@ rtwn_ioctl_reset(struct ieee80211vap *va case IEEE80211_IOC_RTSTHRESHOLD: case IEEE80211_IOC_PROTMODE: case IEEE80211_IOC_HTPROTMODE: + case IEEE80211_IOC_LDPC: error = 0; break; default: Modified: head/sys/dev/rtwn/rtl8812a/r12a_rx.c ============================================================================== --- head/sys/dev/rtwn/rtl8812a/r12a_rx.c Sat Jan 21 14:19:06 2017 (r312596) +++ head/sys/dev/rtwn/rtl8812a/r12a_rx.c Sat Jan 21 15:03:58 2017 (r312597) @@ -252,7 +252,9 @@ r12a_get_rx_stats(struct rtwn_softc *sc, rxdw4 = le32toh(stat->rxdw4); rate = MS(rxdw3, R12A_RXDW3_RATE); - /* TODO: STBC, LDPC */ + /* TODO: STBC */ + if (rxdw4 & R12A_RXDW4_LDPC) + rxs->c_pktflags |= IEEE80211_RX_F_LDPC; if (rxdw1 & R12A_RXDW1_AMPDU) { if (rxdw0 & R92C_RXDW0_PHYST) rxs->c_pktflags |= IEEE80211_RX_F_AMPDU; Modified: head/sys/dev/rtwn/rtl8812a/r12a_tx.c ============================================================================== --- head/sys/dev/rtwn/rtl8812a/r12a_tx.c Sat Jan 21 14:19:06 2017 (r312596) +++ head/sys/dev/rtwn/rtl8812a/r12a_tx.c Sat Jan 21 15:03:58 2017 (r312597) @@ -214,6 +214,17 @@ r12a_tx_set_sgi(struct rtwn_softc *sc, v txd->txdw5 |= htole32(R12A_TXDW5_DATA_SHORT); } +static void +r12a_tx_set_ldpc(struct rtwn_softc *sc, struct r12a_tx_desc *txd, + struct ieee80211_node *ni) +{ + struct ieee80211vap *vap = ni->ni_vap; + + if ((vap->iv_flags_ht & IEEE80211_FHT_LDPC_TX) && + (ni->ni_htcap & IEEE80211_HTCAP_LDPC)) + txd->txdw5 |= htole32(R12A_TXDW5_DATA_LDPC); +} + void r12a_fill_tx_desc(struct rtwn_softc *sc, struct ieee80211_node *ni, struct mbuf *m, void *buf, uint8_t ridx, int maxretry) @@ -284,6 +295,7 @@ r12a_fill_tx_desc(struct rtwn_softc *sc, if (ridx >= RTWN_RIDX_MCS(0)) { r12a_tx_set_ht40(sc, txd, ni); r12a_tx_set_sgi(sc, txd, ni); + r12a_tx_set_ldpc(sc, txd, ni); prot = ic->ic_htprotmode; } else if (ic->ic_flags & IEEE80211_F_USEPROT) prot = ic->ic_protmode; Modified: head/sys/dev/rtwn/rtl8812a/usb/r12au_attach.c ============================================================================== --- head/sys/dev/rtwn/rtl8812a/usb/r12au_attach.c Sat Jan 21 14:19:06 2017 (r312596) +++ head/sys/dev/rtwn/rtl8812a/usb/r12au_attach.c Sat Jan 21 15:03:58 2017 (r312597) @@ -168,7 +168,15 @@ r12a_read_chipid_vendor(struct rtwn_soft static void r12au_adj_devcaps(struct rtwn_softc *sc) { - /* TODO: LDPC, STBC etc */ + struct r12a_softc *rs = sc->sc_priv; + struct ieee80211com *ic = &sc->sc_ic; + + if (rs->chip & R12A_CHIP_C_CUT) { + ic->ic_htcaps |= IEEE80211_HTCAP_LDPC | + IEEE80211_HTC_TXLDPC; + } + + /* TODO: STBC, VHT etc */ } void Modified: head/sys/dev/rtwn/rtl8821a/usb/r21au_attach.c ============================================================================== --- head/sys/dev/rtwn/rtl8821a/usb/r21au_attach.c Sat Jan 21 14:19:06 2017 (r312596) +++ head/sys/dev/rtwn/rtl8821a/usb/r21au_attach.c Sat Jan 21 15:03:58 2017 (r312597) @@ -157,10 +157,11 @@ r21au_adj_devcaps(struct rtwn_softc *sc) struct ieee80211com *ic = &sc->sc_ic; struct r12a_softc *rs = sc->sc_priv; + ic->ic_htcaps |= IEEE80211_HTC_TXLDPC; if (rs->rs_radar != 0) ic->ic_caps |= IEEE80211_C_DFS; - /* TODO: LDPC etc */ + /* TODO: VHT */ } void
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201701211503.v0LF3wtD084216>