diff --git a/sys/dev/ath/ath_rate/amrr/amrr.c b/sys/dev/ath/ath_rate/amrr/amrr.c index 18a3fa5c3bbe..abae54967fbe 100644 --- a/sys/dev/ath/ath_rate/amrr/amrr.c +++ b/sys/dev/ath/ath_rate/amrr/amrr.c @@ -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; } diff --git a/sys/dev/ath/ath_rate/onoe/onoe.c b/sys/dev/ath/ath_rate/onoe/onoe.c index 3cf8073d9ad1..dc4fada185bc 100644 --- a/sys/dev/ath/ath_rate/onoe/onoe.c +++ b/sys/dev/ath/ath_rate/onoe/onoe.c @@ -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; } diff --git a/sys/dev/ath/ath_rate/sample/sample.c b/sys/dev/ath/ath_rate/sample/sample.c index 33407c8c6cde..365070749d47 100644 --- a/sys/dev/ath/ath_rate/sample/sample.c +++ b/sys/dev/ath/ath_rate/sample/sample.c @@ -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 diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c index 93759ff6ed04..0a2e0e8ac1dd 100644 --- a/sys/dev/ath/if_ath.c +++ b/sys/dev/ath/if_ath.c @@ -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 } diff --git a/sys/dev/ath/if_athvar.h b/sys/dev/ath/if_athvar.h index 7203e3142ae6..ae808336f6af 100644 --- a/sys/dev/ath/if_athvar.h +++ b/sys/dev/ath/if_athvar.h @@ -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 */