git: 64ecfc27dbd4 - main - rtwn: add forcerate flag to TX descriptor setup
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 03 Jan 2025 01:24:29 UTC
The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=64ecfc27dbd486ed764f9696b6e56f88e34ee8a1 commit 64ecfc27dbd486ed764f9696b6e56f88e34ee8a1 Author: Adrian Chadd <adrian@FreeBSD.org> AuthorDate: 2024-12-16 01:28:30 +0000 Commit: Adrian Chadd <adrian@FreeBSD.org> CommitDate: 2025-01-03 01:24:01 +0000 rtwn: add forcerate flag to TX descriptor setup When doing firmware rate control there will be situations where the rate being passed in needs to actually override the rate control selection. So add a flag to the descriptor setup path to indicate that indeed this particular rate should be forced, rather than rely on the firmware rate control. This is currently a no-op as firmware rate control isn't working in-tree, but it is working for me locally with other changes. Without this, there's no way to force low rates for management, DHCP traffic, and to allow fixed rate via "ifconfig wlanX ucastrate Y" to function. Locally tested: * RTL8192CU, STA mode (firmware and driver/net80211 rate control) Differential Revision: https://reviews.freebsd.org/D48100 Reviewed by: bz, gavin --- sys/dev/rtwn/if_rtwn_tx.c | 14 +++++++++----- sys/dev/rtwn/if_rtwnvar.h | 6 +++--- sys/dev/rtwn/rtl8192c/r92c.h | 2 +- sys/dev/rtwn/rtl8192c/r92c_tx.c | 2 +- sys/dev/rtwn/rtl8812a/r12a.h | 2 +- sys/dev/rtwn/rtl8812a/r12a_tx.c | 2 +- 6 files changed, 16 insertions(+), 12 deletions(-) diff --git a/sys/dev/rtwn/if_rtwn_tx.c b/sys/dev/rtwn/if_rtwn_tx.c index bf45d14f7edc..c59d1de1dea8 100644 --- a/sys/dev/rtwn/if_rtwn_tx.c +++ b/sys/dev/rtwn/if_rtwn_tx.c @@ -117,6 +117,7 @@ rtwn_tx_data(struct rtwn_softc *sc, struct ieee80211_node *ni, struct rtwn_tx_desc_common *txd; struct rtwn_tx_buf buf; uint8_t rate, ridx, type; + bool force_rate = false; u_int cipher; int ismcast; @@ -129,13 +130,16 @@ rtwn_tx_data(struct rtwn_softc *sc, struct ieee80211_node *ni, /* Choose a TX rate index. */ if (type == IEEE80211_FC0_TYPE_MGT || type == IEEE80211_FC0_TYPE_CTL || - (m->m_flags & M_EAPOL) != 0) + (m->m_flags & M_EAPOL) != 0) { rate = tp->mgmtrate; - else if (ismcast) + force_rate = true; + } else if (ismcast) { + force_rate = true; rate = tp->mcastrate; - else if (tp->ucastrate != IEEE80211_FIXED_RATE_NONE) + } else if (tp->ucastrate != IEEE80211_FIXED_RATE_NONE) { + force_rate = true; rate = tp->ucastrate; - else { + } else { if (sc->sc_ratectl == RTWN_RATECTL_NET80211) { /* XXX pass pktlen */ (void) ieee80211_ratectl_rate(ni, NULL, 0); @@ -172,7 +176,7 @@ rtwn_tx_data(struct rtwn_softc *sc, struct ieee80211_node *ni, memset(txd, 0, sc->txdesc_len); txd->txdw1 = htole32(SM(RTWN_TXDW1_CIPHER, rtwn_get_cipher(cipher))); - rtwn_fill_tx_desc(sc, ni, m, txd, ridx, tp->maxretry); + rtwn_fill_tx_desc(sc, ni, m, txd, ridx, force_rate, tp->maxretry); if (ieee80211_radiotap_active_vap(vap)) { struct rtwn_tx_radiotap_header *tap = &sc->sc_txtap; diff --git a/sys/dev/rtwn/if_rtwnvar.h b/sys/dev/rtwn/if_rtwnvar.h index 3913526f8c3c..fa4b6d0a5df7 100644 --- a/sys/dev/rtwn/if_rtwnvar.h +++ b/sys/dev/rtwn/if_rtwnvar.h @@ -319,7 +319,7 @@ struct rtwn_softc { void (*sc_detach_private)(struct rtwn_softc *); void (*sc_fill_tx_desc)(struct rtwn_softc *, struct ieee80211_node *, struct mbuf *, - void *, uint8_t, int); + void *, uint8_t, bool, int); void (*sc_fill_tx_desc_raw)(struct rtwn_softc *, struct ieee80211_node *, struct mbuf *, void *, const struct ieee80211_bpf_params *); @@ -527,9 +527,9 @@ void rtwn_suspend(struct rtwn_softc *); #define rtwn_detach_private(_sc) \ (((_sc)->sc_detach_private)((_sc))) #define rtwn_fill_tx_desc(_sc, _ni, _m, \ - _buf, _ridx, _maxretry) \ + _buf, _ridx, _force, _maxretry) \ (((_sc)->sc_fill_tx_desc)((_sc), (_ni), \ - (_m), (_buf), (_ridx), (_maxretry))) + (_m), (_buf), (_ridx), (_force), (_maxretry))) #define rtwn_fill_tx_desc_raw(_sc, _ni, _m, \ _buf, _params) \ (((_sc)->sc_fill_tx_desc_raw)((_sc), (_ni), \ diff --git a/sys/dev/rtwn/rtl8192c/r92c.h b/sys/dev/rtwn/rtl8192c/r92c.h index a7091be66f64..cab7393caf39 100644 --- a/sys/dev/rtwn/rtl8192c/r92c.h +++ b/sys/dev/rtwn/rtl8192c/r92c.h @@ -117,7 +117,7 @@ void r92c_tx_enable_ampdu(void *, int); void r92c_tx_setup_hwseq(void *); void r92c_tx_setup_macid(void *, int); void r92c_fill_tx_desc(struct rtwn_softc *, struct ieee80211_node *, - struct mbuf *, void *, uint8_t, int); + struct mbuf *, void *, uint8_t, bool, int); void r92c_fill_tx_desc_raw(struct rtwn_softc *, struct ieee80211_node *, struct mbuf *, void *, const struct ieee80211_bpf_params *); void r92c_fill_tx_desc_null(struct rtwn_softc *, void *, int, int, int); diff --git a/sys/dev/rtwn/rtl8192c/r92c_tx.c b/sys/dev/rtwn/rtl8192c/r92c_tx.c index 07a6a184e924..d5cbc3ad9db9 100644 --- a/sys/dev/rtwn/rtl8192c/r92c_tx.c +++ b/sys/dev/rtwn/rtl8192c/r92c_tx.c @@ -259,7 +259,7 @@ r92c_check_enable_ccx_report(struct rtwn_softc *sc, int macid) void r92c_fill_tx_desc(struct rtwn_softc *sc, struct ieee80211_node *ni, - struct mbuf *m, void *buf, uint8_t ridx, int maxretry) + struct mbuf *m, void *buf, uint8_t ridx, bool force_rate, int maxretry) { #ifndef RTWN_WITHOUT_UCODE struct r92c_softc *rs = sc->sc_priv; diff --git a/sys/dev/rtwn/rtl8812a/r12a.h b/sys/dev/rtwn/rtl8812a/r12a.h index 8bf1464b9525..e5c5c7cd6a80 100644 --- a/sys/dev/rtwn/rtl8812a/r12a.h +++ b/sys/dev/rtwn/rtl8812a/r12a.h @@ -131,7 +131,7 @@ void r12a_get_rx_stats(struct rtwn_softc *, struct ieee80211_rx_stats *, /* r12a_tx.c */ void r12a_fill_tx_desc(struct rtwn_softc *, struct ieee80211_node *, - struct mbuf *, void *, uint8_t, int); + struct mbuf *, void *, uint8_t, bool, int); void r12a_fill_tx_desc_raw(struct rtwn_softc *, struct ieee80211_node *, struct mbuf *, void *, const struct ieee80211_bpf_params *); void r12a_fill_tx_desc_null(struct rtwn_softc *, void *, int, int, int); diff --git a/sys/dev/rtwn/rtl8812a/r12a_tx.c b/sys/dev/rtwn/rtl8812a/r12a_tx.c index 822416a09618..cc686668e4a2 100644 --- a/sys/dev/rtwn/rtl8812a/r12a_tx.c +++ b/sys/dev/rtwn/rtl8812a/r12a_tx.c @@ -261,7 +261,7 @@ r12a_calculate_tx_agg_window(struct rtwn_softc *sc, void r12a_fill_tx_desc(struct rtwn_softc *sc, struct ieee80211_node *ni, - struct mbuf *m, void *buf, uint8_t ridx, int maxretry) + struct mbuf *m, void *buf, uint8_t ridx, bool force_rate, int maxretry) { struct ieee80211com *ic = &sc->sc_ic; struct ieee80211vap *vap = ni->ni_vap;