git: 2014462da5b3 - main - amrr: remove duplicate logic, use ieee80211_ht_check_tx_ht()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 03 Dec 2024 05:32:38 UTC
The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=2014462da5b3e630cdbf687d918bbfc0c3a344a4 commit 2014462da5b3e630cdbf687d918bbfc0c3a344a4 Author: Adrian Chadd <adrian@FreeBSD.org> AuthorDate: 2024-11-26 01:40:12 +0000 Commit: Adrian Chadd <adrian@FreeBSD.org> CommitDate: 2024-12-03 05:32:08 +0000 amrr: remove duplicate logic, use ieee80211_ht_check_tx_ht() This uses the new net80211 helper function to indicate that nodes can actually receive transmitted HT rates. Differential Revision: https://reviews.freebsd.org/D47754 Reviewed by: bz --- sys/net80211/ieee80211_amrr.c | 37 +++++++++---------------------------- 1 file changed, 9 insertions(+), 28 deletions(-) diff --git a/sys/net80211/ieee80211_amrr.c b/sys/net80211/ieee80211_amrr.c index 461554d75ea1..386a3de92a74 100644 --- a/sys/net80211/ieee80211_amrr.c +++ b/sys/net80211/ieee80211_amrr.c @@ -138,25 +138,6 @@ amrr_deinit(struct ieee80211vap *vap) nrefs--; /* XXX locking */ } -/* - * Return whether 11n rates are possible. - * - * Some 11n devices may return HT information but no HT rates. - * Thus, we shouldn't treat them as an 11n node. - */ -static int -amrr_node_is_11n(struct ieee80211_node *ni) -{ - - if (ni->ni_chan == NULL) - return (0); - if (ni->ni_chan == IEEE80211_CHAN_ANYC) - return (0); - if (IEEE80211_IS_CHAN_HT(ni->ni_chan) && ni->ni_htrates.rs_nrates == 0) - return (0); - return (IEEE80211_IS_CHAN_HT(ni->ni_chan)); -} - static void amrr_node_init(struct ieee80211_node *ni) { @@ -189,7 +170,7 @@ amrr_node_init(struct ieee80211_node *ni) amn->amn_success_threshold = amrr->amrr_min_success_threshold; /* 11n or not? Pick the right rateset */ - if (amrr_node_is_11n(ni)) { + if (ieee80211_ht_check_tx_ht(ni)) { /* XXX ew */ IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni, "%s: 11n node", __func__); @@ -204,7 +185,7 @@ amrr_node_init(struct ieee80211_node *ni) rate = rs->rs_rates[0]; /* XXX clear the basic rate flag if it's not 11n */ - if (! amrr_node_is_11n(ni)) + if (! ieee80211_ht_check_tx_ht(ni)) rate &= IEEE80211_RATE_VAL; /* pick initial rate from the rateset - HT or otherwise */ @@ -213,7 +194,7 @@ amrr_node_init(struct ieee80211_node *ni) amn->amn_rix--) { /* legacy - anything < 36mbit, stop searching */ /* 11n - stop at MCS4 */ - if (amrr_node_is_11n(ni)) { + if (ieee80211_ht_check_tx_ht(ni)) { if ((rs->rs_rates[amn->amn_rix] & 0x1f) < 4) break; } else if ((rs->rs_rates[amn->amn_rix] & IEEE80211_RATE_VAL) <= 72) @@ -222,7 +203,7 @@ amrr_node_init(struct ieee80211_node *ni) rate = rs->rs_rates[amn->amn_rix] & IEEE80211_RATE_VAL; /* if the rate is an 11n rate, ensure the MCS bit is set */ - if (amrr_node_is_11n(ni)) + if (ieee80211_ht_check_tx_ht(ni)) rate |= IEEE80211_RATE_MCS; /* Assign initial rate from the rateset */ @@ -234,7 +215,7 @@ amrr_node_init(struct ieee80211_node *ni) IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_RATECTL, ni, "AMRR: nrates=%d, initial rate %s%d", rs->rs_nrates, - amrr_node_is_11n(ni) ? "MCS " : "", + ieee80211_ht_check_tx_ht(ni) ? "MCS " : "", rate & IEEE80211_RATE_VAL); } @@ -254,7 +235,7 @@ amrr_update(struct ieee80211_amrr *amrr, struct ieee80211_amrr_node *amn, KASSERT(is_enough(amn), ("txcnt %d", amn->amn_txcnt)); /* 11n or not? Pick the right rateset */ - if (amrr_node_is_11n(ni)) { + if (ieee80211_ht_check_tx_ht(ni)) { /* XXX ew */ rs = (struct ieee80211_rateset *) &ni->ni_htrates; } else { @@ -347,7 +328,7 @@ amrr_rate(struct ieee80211_node *ni, void *arg __unused, uint32_t iarg __unused) amrr = amn->amn_amrr; /* 11n or not? Pick the right rateset */ - if (amrr_node_is_11n(ni)) { + if (ieee80211_ht_check_tx_ht(ni)) { /* XXX ew */ rs = (struct ieee80211_rateset *) &ni->ni_htrates; } else { @@ -360,7 +341,7 @@ amrr_rate(struct ieee80211_node *ni, void *arg __unused, uint32_t iarg __unused) /* update public rate */ ni->ni_txrate = rs->rs_rates[rix]; /* XXX strip basic rate flag from txrate, if non-11n */ - if (amrr_node_is_11n(ni)) + if (ieee80211_ht_check_tx_ht(ni)) ni->ni_txrate |= IEEE80211_RATE_MCS; else ni->ni_txrate &= IEEE80211_RATE_VAL; @@ -482,7 +463,7 @@ amrr_print_node_rate(struct ieee80211_amrr_node *amn, int rate; struct ieee80211_rateset *rs; - if (amrr_node_is_11n(ni)) { + if (ieee80211_ht_check_tx_ht(ni)) { rs = (struct ieee80211_rateset *) &ni->ni_htrates; rate = rs->rs_rates[amn->amn_rix] & IEEE80211_RATE_VAL; sbuf_printf(s, "rate: MCS %d\n", rate);