Date: Wed, 26 Feb 2025 19:31:40 GMT From: Adrian Chadd <adrian@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: fdc884161187 - main - rtwn: move to using ieee80211_node_get_txrate() Message-ID: <202502261931.51QJVemW017654@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=fdc88416118759692fb1773deffe298e86cc902b commit fdc88416118759692fb1773deffe298e86cc902b Author: Adrian Chadd <adrian@FreeBSD.org> AuthorDate: 2025-01-13 02:15:05 +0000 Commit: Adrian Chadd <adrian@FreeBSD.org> CommitDate: 2025-02-26 19:30:01 +0000 rtwn: move to using ieee80211_node_get_txrate() Migrate the transmit path to use ieee80211_node_get_txrate(), and handle VHT rates. Nothing is currently setting VHT rates, but the driver should now be ready. Differential Revision: https://reviews.freebsd.org/D48606 Reviewed by: bz --- sys/dev/rtwn/if_rtwn_tx.c | 49 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 38 insertions(+), 11 deletions(-) diff --git a/sys/dev/rtwn/if_rtwn_tx.c b/sys/dev/rtwn/if_rtwn_tx.c index f355bc589143..2c9c246dfbb4 100644 --- a/sys/dev/rtwn/if_rtwn_tx.c +++ b/sys/dev/rtwn/if_rtwn_tx.c @@ -105,6 +105,33 @@ rtwn_get_cipher(u_int ic_cipher) return (cipher); } +static uint8_t +rtwn_tx_ratectl_to_ridx(struct rtwn_softc *sc, struct ieee80211_node *ni, + struct ieee80211_node_txrate *txr) +{ + /* TODO: this should be based on the node channel */ + struct ieee80211com *ic = &sc->sc_ic; + uint8_t ridx; + + switch (txr->type) { + case IEEE80211_NODE_TXRATE_LEGACY: + case IEEE80211_NODE_TXRATE_HT: + ridx = rate2ridx(txr->dot11rate); + break; + case IEEE80211_NODE_TXRATE_VHT: + ridx = RTWN_RIDX_VHT_MCS(txr->nss - 1, txr->mcs); + break; + default: + if (ic->ic_curmode != IEEE80211_MODE_11B) + ridx = RTWN_RIDX_OFDM36; + else + ridx = RTWN_RIDX_CCK55; + break; + } + + return (ridx); +} + static int rtwn_tx_data(struct rtwn_softc *sc, struct ieee80211_node *ni, struct mbuf *m) @@ -116,7 +143,7 @@ rtwn_tx_data(struct rtwn_softc *sc, struct ieee80211_node *ni, struct ieee80211_frame *wh; struct rtwn_tx_desc_common *txd; struct rtwn_tx_buf buf; - uint8_t rate, ridx, type; + uint8_t ridx, type; bool force_rate = false; u_int cipher; int ismcast; @@ -131,31 +158,31 @@ rtwn_tx_data(struct rtwn_softc *sc, struct ieee80211_node *ni, if (type == IEEE80211_FC0_TYPE_MGT || type == IEEE80211_FC0_TYPE_CTL || (m->m_flags & M_EAPOL) != 0) { - rate = tp->mgmtrate; + ridx = rate2ridx(tp->mgmtrate); force_rate = true; } else if (ismcast) { + ridx = rate2ridx(tp->mcastrate); force_rate = true; - rate = tp->mcastrate; } else if (tp->ucastrate != IEEE80211_FIXED_RATE_NONE) { + ridx = rate2ridx(tp->ucastrate); force_rate = true; - rate = tp->ucastrate; } else { if (sc->sc_ratectl == RTWN_RATECTL_NET80211) { + struct ieee80211_node_txrate txr = { 0 }; /* XXX pass pktlen */ - (void) ieee80211_ratectl_rate(ni, NULL, 0); - rate = ieee80211_node_get_txrate_dot11rate(ni); + ieee80211_ratectl_rate(ni, NULL, 0); + ieee80211_node_get_txrate(ni, &txr); + ridx = rtwn_tx_ratectl_to_ridx(sc, ni, &txr); } else { if (ni->ni_flags & IEEE80211_NODE_HT) - rate = IEEE80211_RATE_MCS | 0x4; /* MCS4 */ + ridx = rate2ridx(IEEE80211_RATE_MCS | 0x4); /* MCS4 */ else if (ic->ic_curmode != IEEE80211_MODE_11B) - rate = ridx2rate[RTWN_RIDX_OFDM36]; + ridx = RTWN_RIDX_OFDM36; else - rate = ridx2rate[RTWN_RIDX_CCK55]; + ridx = RTWN_RIDX_CCK55; } } - ridx = rate2ridx(rate); - cipher = IEEE80211_CIPHER_NONE; if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { k = ieee80211_crypto_encap(ni, m);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202502261931.51QJVemW017654>