optimize ath_tx_findrix: there's no need to walk the rates table as
sc_rixmap is an inverse map NB: could eliminate the check for an invalid rate by filling in 0 for invalid entries but the rate control modules use it to identify bogus rates so leave it for now
This commit is contained in:
parent
a8962181ad
commit
ab06fdf2a5
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=191866
@ -4222,17 +4222,15 @@ ath_tx_cleanup(struct ath_softc *sc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return h/w rate index for an IEEE rate (w/o basic rate bit).
|
* Return h/w rate index for an IEEE rate (w/o basic rate bit)
|
||||||
|
* using the current rates in sc_rixmap.
|
||||||
*/
|
*/
|
||||||
static int
|
static __inline int
|
||||||
ath_tx_findrix(const HAL_RATE_TABLE *rt, int rate)
|
ath_tx_findrix(const struct ath_softc *sc, uint8_t rate)
|
||||||
{
|
{
|
||||||
int i;
|
int rix = sc->sc_rixmap[rate];
|
||||||
|
/* NB: return lowest rix for invalid rate */
|
||||||
for (i = 0; i < rt->rateCount; i++)
|
return (rix == 0xff ? 0 : rix);
|
||||||
if ((rt->info[i].dot11Rate & IEEE80211_RATE_VAL) == rate)
|
|
||||||
return i;
|
|
||||||
return 0; /* NB: lowest rate */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -5760,8 +5758,8 @@ ath_newassoc(struct ieee80211_node *ni, int isnew)
|
|||||||
struct ath_softc *sc = vap->iv_ic->ic_ifp->if_softc;
|
struct ath_softc *sc = vap->iv_ic->ic_ifp->if_softc;
|
||||||
const struct ieee80211_txparam *tp = ni->ni_txparms;
|
const struct ieee80211_txparam *tp = ni->ni_txparms;
|
||||||
|
|
||||||
an->an_mcastrix = ath_tx_findrix(sc->sc_currates, tp->mcastrate);
|
an->an_mcastrix = ath_tx_findrix(sc, tp->mcastrate);
|
||||||
an->an_mgmtrix = ath_tx_findrix(sc->sc_currates, tp->mgmtrate);
|
an->an_mgmtrix = ath_tx_findrix(sc, tp->mgmtrate);
|
||||||
|
|
||||||
ath_rate_newassoc(sc, an, isnew);
|
ath_rate_newassoc(sc, an, isnew);
|
||||||
if (isnew &&
|
if (isnew &&
|
||||||
@ -6009,9 +6007,9 @@ ath_setcurmode(struct ath_softc *sc, enum ieee80211_phymode mode)
|
|||||||
* 11g, otherwise at 1Mb/s.
|
* 11g, otherwise at 1Mb/s.
|
||||||
*/
|
*/
|
||||||
if (mode == IEEE80211_MODE_11G)
|
if (mode == IEEE80211_MODE_11G)
|
||||||
sc->sc_protrix = ath_tx_findrix(rt, 2*2);
|
sc->sc_protrix = ath_tx_findrix(sc, 2*2);
|
||||||
else
|
else
|
||||||
sc->sc_protrix = ath_tx_findrix(rt, 2*1);
|
sc->sc_protrix = ath_tx_findrix(sc, 2*1);
|
||||||
/* NB: caller is responsible for reseting rate control state */
|
/* NB: caller is responsible for reseting rate control state */
|
||||||
#undef N
|
#undef N
|
||||||
}
|
}
|
||||||
@ -6749,7 +6747,7 @@ ath_tx_raw_start(struct ath_softc *sc, struct ieee80211_node *ni,
|
|||||||
|
|
||||||
rt = sc->sc_currates;
|
rt = sc->sc_currates;
|
||||||
KASSERT(rt != NULL, ("no rate table, mode %u", sc->sc_curmode));
|
KASSERT(rt != NULL, ("no rate table, mode %u", sc->sc_curmode));
|
||||||
rix = ath_tx_findrix(rt, params->ibp_rate0);
|
rix = ath_tx_findrix(sc, params->ibp_rate0);
|
||||||
txrate = rt->info[rix].rateCode;
|
txrate = rt->info[rix].rateCode;
|
||||||
if (params->ibp_flags & IEEE80211_BPF_SHORTPRE)
|
if (params->ibp_flags & IEEE80211_BPF_SHORTPRE)
|
||||||
txrate |= rt->info[rix].shortPreamble;
|
txrate |= rt->info[rix].shortPreamble;
|
||||||
@ -6761,7 +6759,7 @@ ath_tx_raw_start(struct ath_softc *sc, struct ieee80211_node *ni,
|
|||||||
txantenna = sc->sc_txantenna;
|
txantenna = sc->sc_txantenna;
|
||||||
ctsduration = 0;
|
ctsduration = 0;
|
||||||
if (flags & (HAL_TXDESC_CTSENA | HAL_TXDESC_RTSENA)) {
|
if (flags & (HAL_TXDESC_CTSENA | HAL_TXDESC_RTSENA)) {
|
||||||
cix = ath_tx_findrix(rt, params->ibp_ctsrate);
|
cix = ath_tx_findrix(sc, params->ibp_ctsrate);
|
||||||
ctsrate = rt->info[cix].rateCode;
|
ctsrate = rt->info[cix].rateCode;
|
||||||
if (params->ibp_flags & IEEE80211_BPF_SHORTPRE) {
|
if (params->ibp_flags & IEEE80211_BPF_SHORTPRE) {
|
||||||
ctsrate |= rt->info[cix].shortPreamble;
|
ctsrate |= rt->info[cix].shortPreamble;
|
||||||
@ -6827,19 +6825,19 @@ ath_tx_raw_start(struct ath_softc *sc, struct ieee80211_node *ni,
|
|||||||
bf->bf_txflags = flags;
|
bf->bf_txflags = flags;
|
||||||
|
|
||||||
if (ismrr) {
|
if (ismrr) {
|
||||||
rix = ath_tx_findrix(rt, params->ibp_rate1);
|
rix = ath_tx_findrix(sc, params->ibp_rate1);
|
||||||
rate1 = rt->info[rix].rateCode;
|
rate1 = rt->info[rix].rateCode;
|
||||||
if (params->ibp_flags & IEEE80211_BPF_SHORTPRE)
|
if (params->ibp_flags & IEEE80211_BPF_SHORTPRE)
|
||||||
rate1 |= rt->info[rix].shortPreamble;
|
rate1 |= rt->info[rix].shortPreamble;
|
||||||
if (params->ibp_try2) {
|
if (params->ibp_try2) {
|
||||||
rix = ath_tx_findrix(rt, params->ibp_rate2);
|
rix = ath_tx_findrix(sc, params->ibp_rate2);
|
||||||
rate2 = rt->info[rix].rateCode;
|
rate2 = rt->info[rix].rateCode;
|
||||||
if (params->ibp_flags & IEEE80211_BPF_SHORTPRE)
|
if (params->ibp_flags & IEEE80211_BPF_SHORTPRE)
|
||||||
rate2 |= rt->info[rix].shortPreamble;
|
rate2 |= rt->info[rix].shortPreamble;
|
||||||
} else
|
} else
|
||||||
rate2 = 0;
|
rate2 = 0;
|
||||||
if (params->ibp_try3) {
|
if (params->ibp_try3) {
|
||||||
rix = ath_tx_findrix(rt, params->ibp_rate3);
|
rix = ath_tx_findrix(sc, params->ibp_rate3);
|
||||||
rate3 = rt->info[rix].rateCode;
|
rate3 = rt->info[rix].rateCode;
|
||||||
if (params->ibp_flags & IEEE80211_BPF_SHORTPRE)
|
if (params->ibp_flags & IEEE80211_BPF_SHORTPRE)
|
||||||
rate3 |= rt->info[rix].shortPreamble;
|
rate3 |= rt->info[rix].shortPreamble;
|
||||||
@ -7063,9 +7061,9 @@ ath_tdma_config(struct ath_softc *sc, struct ieee80211vap *vap)
|
|||||||
*/
|
*/
|
||||||
tdma = vap->iv_tdma;
|
tdma = vap->iv_tdma;
|
||||||
if (tp->ucastrate != IEEE80211_FIXED_RATE_NONE)
|
if (tp->ucastrate != IEEE80211_FIXED_RATE_NONE)
|
||||||
rix = ath_tx_findrix(sc->sc_currates, tp->ucastrate);
|
rix = ath_tx_findrix(sc, tp->ucastrate);
|
||||||
else
|
else
|
||||||
rix = ath_tx_findrix(sc->sc_currates, tp->mcastrate);
|
rix = ath_tx_findrix(sc, tp->mcastrate);
|
||||||
/* XXX short preamble assumed */
|
/* XXX short preamble assumed */
|
||||||
sc->sc_tdmaguard = ath_hal_computetxtime(ah, sc->sc_currates,
|
sc->sc_tdmaguard = ath_hal_computetxtime(ah, sc->sc_currates,
|
||||||
ifp->if_mtu + IEEE80211_MAXOVERHEAD, rix, AH_TRUE);
|
ifp->if_mtu + IEEE80211_MAXOVERHEAD, rix, AH_TRUE);
|
||||||
|
Loading…
Reference in New Issue
Block a user