honor net80211 mcast tx rate

MFC after:	2 weeks
This commit is contained in:
Sam Leffler 2006-02-09 21:15:36 +00:00
parent 6f890873fb
commit 8b5341de05
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=155483
2 changed files with 47 additions and 6 deletions

View file

@ -3144,6 +3144,20 @@ ath_defrag(struct mbuf *m0, int how, int maxfrags)
return NULL;
}
/*
* Return h/w rate index for an IEEE rate (w/o basic rate bit).
*/
static int
ath_tx_findrix(const HAL_RATE_TABLE *rt, int rate)
{
int i;
for (i = 0; i < rt->rateCount; i++)
if ((rt->info[i].dot11Rate & IEEE80211_RATE_VAL) == rate)
return i;
return 0; /* NB: lowest rate */
}
static int
ath_tx_start(struct ath_softc *sc, struct ieee80211_node *ni, struct ath_buf *bf,
struct mbuf *m0)
@ -3342,13 +3356,32 @@ ath_tx_start(struct ath_softc *sc, struct ieee80211_node *ni, struct ath_buf *bf
case IEEE80211_FC0_TYPE_DATA:
atype = HAL_PKT_TYPE_NORMAL; /* default */
/*
* Data frames; consult the rate control module.
* Data frames: multicast frames go out at a fixed rate,
* otherwise consult the rate control module for the
* rate to use.
*/
ath_rate_findrate(sc, an, shortPreamble, pktlen,
&rix, &try0, &txrate);
sc->sc_txrate = txrate; /* for LED blinking */
if (try0 != ATH_TXMAXTRY)
ismrr = 1;
if (ismcast) {
/*
* Check mcast rate setting in case it's changed.
* XXX move out of fastpath
*/
if (ic->ic_mcast_rate != sc->sc_mcastrate) {
sc->sc_mcastrix =
ath_tx_findrix(rt, ic->ic_mcast_rate);
sc->sc_mcastrate = ic->ic_mcast_rate;
}
rix = sc->sc_mcastrix;
txrate = rt->info[rix].rateCode;
if (shortPreamble)
txrate |= rt->info[rix].shortPreamble;
try0 = 1;
} else {
ath_rate_findrate(sc, an, shortPreamble, pktlen,
&rix, &try0, &txrate);
sc->sc_txrate = txrate; /* for LED blinking */
if (try0 != ATH_TXMAXTRY)
ismrr = 1;
}
/*
* Default all non-QoS traffic to the background queue.
*/
@ -4514,6 +4547,12 @@ ath_setcurmode(struct ath_softc *sc, enum ieee80211_phymode mode)
sc->sc_protrix = (mode == IEEE80211_MODE_11G ? 1 : 0);
/* rate index used to send management frames */
sc->sc_minrateix = 0;
/*
* Setup multicast rate state.
*/
/* XXX layering violation */
sc->sc_mcastrix = ath_tx_findrix(rt, sc->sc_ic.ic_mcast_rate);
sc->sc_mcastrate = sc->sc_ic.ic_mcast_rate;
/* NB: caller is responsible for reseting rate control state */
#undef N
}

View file

@ -213,7 +213,9 @@ struct ath_softc {
u_int16_t ledoff; /* softled off time */
} sc_hwmap[32]; /* h/w rate ix mappings */
u_int8_t sc_minrateix; /* min h/w rate index */
u_int8_t sc_mcastrix; /* mcast h/w rate index */
u_int8_t sc_protrix; /* protection rate index */
u_int sc_mcastrate; /* ieee rate for mcastrateix */
u_int sc_txantenna; /* tx antenna (fixed or auto) */
HAL_INT sc_imask; /* interrupt mask copy */
u_int sc_keymax; /* size of key cache */