1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-30 12:04:07 +00:00

move mgt frame tx rate responsibility from the rate control modules

to the driver; this avoids redundant logic and will be necessary
for future additions

MFC after:	2 weeks
This commit is contained in:
Sam Leffler 2006-02-09 20:49:55 +00:00
parent b91bf513f3
commit 55f63772e8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=155477
5 changed files with 19 additions and 42 deletions

View File

@ -210,9 +210,6 @@ ath_rate_update(struct ath_softc *sc, struct ieee80211_node *ni, int rate)
(ni->ni_rates.rs_rates[rate] & IEEE80211_RATE_VAL) / 2 : 0);
ni->ni_txrate = rate;
/* XXX management/control frames always go at the lowest speed */
an->an_tx_mgtrate = rt->info[0].rateCode;
an->an_tx_mgtratesp = an->an_tx_mgtrate | rt->info[0].shortPreamble;
/*
* Before associating a node has no rate set setup
* so we can't calculate any transmit codes to use.
@ -253,7 +250,7 @@ ath_rate_update(struct ath_softc *sc, struct ieee80211_node *ni, int rate)
/* NB: only do this if we didn't already do it above */
amn->amn_tx_rate3 = rt->info[0].rateCode;
amn->amn_tx_rate3sp =
an->an_tx_mgtrate | rt->info[0].shortPreamble;
amn->amn_tx_rate3 | rt->info[0].shortPreamble;
} else {
amn->amn_tx_rate3 = amn->amn_tx_rate3sp = 0;
}

View File

@ -194,9 +194,6 @@ ath_rate_update(struct ath_softc *sc, struct ieee80211_node *ni, int rate)
(ni->ni_rates.rs_rates[rate] & IEEE80211_RATE_VAL) / 2 : 0);
ni->ni_txrate = rate;
/* XXX management/control frames always go at the lowest speed */
an->an_tx_mgtrate = rt->info[0].rateCode;
an->an_tx_mgtratesp = an->an_tx_mgtrate | rt->info[0].shortPreamble;
/*
* Before associating a node has no rate set setup
* so we can't calculate any transmit codes to use.
@ -243,7 +240,7 @@ ath_rate_update(struct ath_softc *sc, struct ieee80211_node *ni, int rate)
/* NB: only do this if we didn't already do it above */
on->on_tx_rate3 = rt->info[0].rateCode;
on->on_tx_rate3sp =
an->an_tx_mgtrate | rt->info[0].shortPreamble;
on->on_tx_rate3 | rt->info[0].shortPreamble;
} else {
on->on_tx_rate3 = on->on_tx_rate3sp = 0;
}

View File

@ -144,28 +144,11 @@ rate_to_ndx(struct sample_node *sn, int rate) {
return -1;
}
/*
* Setup rate codes for management/control frames. We force
* all such frames to the lowest rate.
*/
static void
ath_rate_setmgtrates(struct ath_softc *sc, struct ath_node *an)
{
const HAL_RATE_TABLE *rt = sc->sc_currates;
/* setup rates for management frames */
/* XXX management/control frames always go at lowest speed */
an->an_tx_mgtrate = rt->info[0].rateCode;
an->an_tx_mgtratesp = an->an_tx_mgtrate
| rt->info[0].shortPreamble;
}
void
ath_rate_node_init(struct ath_softc *sc, struct ath_node *an)
{
DPRINTF(sc, "%s:\n", __func__);
/* NB: assumed to be zero'd by caller */
ath_rate_setmgtrates(sc, an);
}
void

View File

@ -1823,10 +1823,10 @@ ath_beacon_setup(struct ath_softc *sc, struct ath_buf *bf)
struct ieee80211com *ic = ni->ni_ic;
struct mbuf *m = bf->bf_m;
struct ath_hal *ah = sc->sc_ah;
struct ath_node *an = ATH_NODE(ni);
struct ath_desc *ds;
int flags, antenna;
u_int8_t rate;
const HAL_RATE_TABLE *rt;
u_int8_t rix, rate;
DPRINTF(sc, ATH_DEBUG_BEACON, "%s: m %p len %u\n",
__func__, m, m->m_len);
@ -1858,10 +1858,11 @@ ath_beacon_setup(struct ath_softc *sc, struct ath_buf *bf)
* Calculate rate code.
* XXX everything at min xmit rate
*/
rix = sc->sc_minrateix;
rt = sc->sc_currates;
rate = rt->info[rix].rateCode;
if (USE_SHPREAMBLE(ic))
rate = an->an_tx_mgtratesp;
else
rate = an->an_tx_mgtrate;
rate |= rt->info[rix].shortPreamble;
ath_hal_setuptxdesc(ah, ds
, m->m_len + IEEE80211_CRC_LEN /* frame length */
, sizeof(struct ieee80211_frame)/* header length */
@ -3299,12 +3300,11 @@ ath_tx_start(struct ath_softc *sc, struct ieee80211_node *ni, struct ath_buf *bf
atype = HAL_PKT_TYPE_ATIM;
else
atype = HAL_PKT_TYPE_NORMAL; /* XXX */
rix = 0; /* XXX lowest rate */
try0 = ATH_TXMAXTRY;
rix = sc->sc_minrateix;
txrate = rt->info[rix].rateCode;
if (shortPreamble)
txrate = an->an_tx_mgtratesp;
else
txrate = an->an_tx_mgtrate;
txrate |= rt->info[rix].shortPreamble;
try0 = ATH_TXMAXTRY;
/* NB: force all management frames to highest queue */
if (ni->ni_flags & IEEE80211_NODE_QOS) {
/* NB: force all management frames to highest queue */
@ -3315,12 +3315,11 @@ ath_tx_start(struct ath_softc *sc, struct ieee80211_node *ni, struct ath_buf *bf
break;
case IEEE80211_FC0_TYPE_CTL:
atype = HAL_PKT_TYPE_PSPOLL; /* stop setting of duration */
rix = 0; /* XXX lowest rate */
try0 = ATH_TXMAXTRY;
rix = sc->sc_minrateix;
txrate = rt->info[rix].rateCode;
if (shortPreamble)
txrate = an->an_tx_mgtratesp;
else
txrate = an->an_tx_mgtrate;
txrate |= rt->info[rix].shortPreamble;
try0 = ATH_TXMAXTRY;
/* NB: force all ctl frames to highest queue */
if (ni->ni_flags & IEEE80211_NODE_QOS) {
/* NB: force all ctl frames to highest queue */
@ -4499,6 +4498,8 @@ ath_setcurmode(struct ath_softc *sc, enum ieee80211_phymode mode)
* XXX select protection rate index from rate table.
*/
sc->sc_protrix = (mode == IEEE80211_MODE_11G ? 1 : 0);
/* rate index used to send management frames */
sc->sc_minrateix = 0;
/* NB: caller is responsible for reseting rate control state */
#undef N
}

View File

@ -75,8 +75,6 @@
/* driver-specific node state */
struct ath_node {
struct ieee80211_node an_node; /* base class */
u_int8_t an_tx_mgtrate; /* h/w rate for management/ctl frames */
u_int8_t an_tx_mgtratesp;/* short preamble h/w rate for " " */
u_int32_t an_avgrssi; /* average rssi over all rx frames */
HAL_NODE_STATS an_halstats; /* rssi statistics used by hal */
/* variable-length rate control state follows */
@ -206,6 +204,7 @@ struct ath_softc {
u_int16_t ledon; /* softled on time */
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_protrix; /* protection rate index */
u_int sc_txantenna; /* tx antenna (fixed or auto) */
HAL_INT sc_imask; /* interrupt mask copy */