diff reduction against p4: define IEEE80211_FIXED_RATE_NONE and use

it instead of -1
This commit is contained in:
Sam Leffler 2005-07-22 16:50:18 +00:00
parent af8d224ec0
commit 2c39b32c94
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=148290
11 changed files with 22 additions and 17 deletions

View File

@ -284,7 +284,7 @@ ath_rate_ctl_start(struct ath_softc *sc, struct ieee80211_node *ni)
int srate;
KASSERT(ni->ni_rates.rs_nrates > 0, ("no rates"));
if (ic->ic_fixed_rate == -1) {
if (ic->ic_fixed_rate == IEEE80211_FIXED_RATE_NONE) {
/*
* No fixed rate is requested. For 11b start with
* the highest negotiated rate; otherwise, for 11g
@ -366,7 +366,8 @@ ath_rate_newstate(struct ath_softc *sc, enum ieee80211_state state)
ieee80211_iterate_nodes(&ic->ic_sta, ath_rate_cb, sc);
ath_rate_update(sc, ic->ic_bss, 0);
}
if (ic->ic_fixed_rate == -1 && state == IEEE80211_S_RUN) {
if (ic->ic_fixed_rate == IEEE80211_FIXED_RATE_NONE &&
state == IEEE80211_S_RUN) {
int interval;
/*
* Start the background rate control thread if we

View File

@ -268,7 +268,7 @@ ath_rate_ctl_start(struct ath_softc *sc, struct ieee80211_node *ni)
int srate;
KASSERT(ni->ni_rates.rs_nrates > 0, ("no rates"));
if (ic->ic_fixed_rate == -1) {
if (ic->ic_fixed_rate == IEEE80211_FIXED_RATE_NONE) {
/*
* No fixed rate is requested. For 11b start with
* the highest negotiated rate; otherwise, for 11g
@ -350,7 +350,8 @@ ath_rate_newstate(struct ath_softc *sc, enum ieee80211_state state)
ieee80211_iterate_nodes(&ic->ic_sta, ath_rate_cb, sc);
ath_rate_update(sc, ic->ic_bss, 0);
}
if (ic->ic_fixed_rate == -1 && state == IEEE80211_S_RUN) {
if (ic->ic_fixed_rate == IEEE80211_FIXED_RATE_NONE &&
state == IEEE80211_S_RUN) {
int interval;
/*
* Start the background rate control thread if we

View File

@ -684,7 +684,7 @@ ath_rate_ctl_reset(struct ath_softc *sc, struct ieee80211_node *ni)
KASSERT(rt != NULL, ("no rate table, mode %u", sc->sc_curmode));
sn->static_rate_ndx = -1;
if (ic->ic_fixed_rate != -1) {
if (ic->ic_fixed_rate != IEEE80211_FIXED_RATE_NONE) {
/*
* A fixed rate is to be used; ic_fixed_rate is an
* index into the supported rate set. Convert this

View File

@ -605,7 +605,7 @@ awi_init(struct ifnet *ifp)
rs = &ic->ic_sup_rates[IEEE80211_MODE_FH];
else
rs = &ic->ic_sup_rates[IEEE80211_MODE_11B];
if (ic->ic_fixed_rate != -1) {
if (ic->ic_fixed_rate != IEEE80211_FIXED_RATE_NONE) {
rate = rs->rs_rates[ic->ic_fixed_rate] & IEEE80211_RATE_VAL;
} else {
rate = 0;
@ -1095,7 +1095,7 @@ awi_media_status(struct ifnet *ifp, struct ifmediareq *imr)
rate = ic->ic_bss->ni_rates.rs_rates[ic->ic_bss->ni_txrate] &
IEEE80211_RATE_VAL;
} else {
if (ic->ic_fixed_rate == -1)
if (ic->ic_fixed_rate == IEEE80211_FIXED_RATE_NONE)
rate = 0;
else
rate = ic->ic_sup_rates[mode].

View File

@ -1875,7 +1875,7 @@ ral_tx_data(struct ral_softc *sc, struct mbuf *m0, struct ieee80211_node *ni)
wh = mtod(m0, struct ieee80211_frame *);
if (ic->ic_fixed_rate != -1) {
if (ic->ic_fixed_rate != IEEE80211_FIXED_RATE_NONE) {
rs = &ic->ic_sup_rates[ic->ic_curmode];
rate = rs->rs_rates[ic->ic_fixed_rate];
} else {
@ -2009,7 +2009,7 @@ ral_tx_data(struct ral_softc *sc, struct mbuf *m0, struct ieee80211_node *ni)
data->ni = ni;
/* remember link conditions for rate adaptation algorithm */
if (ic->ic_fixed_rate == -1) {
if (ic->ic_fixed_rate == IEEE80211_FIXED_RATE_NONE) {
data->id.id_len = m0->m_pkthdr.len;
data->id.id_rateidx = ni->ni_txrate;
data->id.id_node = ni;

View File

@ -1195,7 +1195,7 @@ ural_tx_data(struct ural_softc *sc, struct mbuf *m0, struct ieee80211_node *ni)
wh = mtod(m0, struct ieee80211_frame *);
/* XXX should do automatic rate adaptation */
if (ic->ic_fixed_rate != -1)
if (ic->ic_fixed_rate != IEEE80211_FIXED_RATE_NONE)
rate = ic->ic_bss->ni_rates.rs_rates[ic->ic_fixed_rate];
else
rate = ni->ni_rates.rs_rates[ni->ni_txrate];

View File

@ -2166,7 +2166,7 @@ wi_set_cfg(struct ifnet *ifp, u_long cmd, caddr_t data)
WI_LOCK(sc);
switch (le16toh(wreq.wi_val[0])) {
case 3:
ic->ic_fixed_rate = -1;
ic->ic_fixed_rate = IEEE80211_FIXED_RATE_NONE;
break;
default:
rs = &ic->ic_sup_rates[IEEE80211_MODE_11B];
@ -2272,7 +2272,7 @@ wi_write_txrate(struct wi_softc *sc)
int i;
u_int16_t rate;
if (ic->ic_fixed_rate < 0)
if (ic->ic_fixed_rate == IEEE80211_FIXED_RATE_NONE)
rate = 0; /* auto */
else
rate = (ic->ic_sup_rates[IEEE80211_MODE_11B].rs_rates[ic->ic_fixed_rate] &

View File

@ -665,7 +665,7 @@ ieee80211_media_status(struct ifnet *ifp, struct ifmediareq *imr)
/*
* Calculate a current rate if possible.
*/
if (ic->ic_fixed_rate != -1) {
if (ic->ic_fixed_rate != IEEE80211_FIXED_RATE_NONE) {
/*
* A fixed rate is set, report that.
*/

View File

@ -273,7 +273,7 @@ ieee80211_cfgget(struct ieee80211com *ic, u_long cmd, caddr_t data)
wreq.wi_len = IEEE80211_ADDR_LEN / 2;
break;
case WI_RID_TX_RATE:
if (ic->ic_fixed_rate == -1)
if (ic->ic_fixed_rate == IEEE80211_FIXED_RATE_NONE)
wreq.wi_val[0] = 0; /* auto */
else
wreq.wi_val[0] = htole16(
@ -592,7 +592,7 @@ ieee80211_cfgset(struct ieee80211com *ic, u_long cmd, caddr_t data)
return EINVAL;
if (wreq.wi_val[0] == 0) {
/* auto */
ic->ic_fixed_rate = -1;
ic->ic_fixed_rate = IEEE80211_FIXED_RATE_NONE;
break;
}
rate = 2 * le16toh(wreq.wi_val[0]);

View File

@ -100,7 +100,7 @@ ieee80211_proto_attach(struct ieee80211com *ic)
ic->ic_rtsthreshold = IEEE80211_RTS_MAX;
#endif
ic->ic_fragthreshold = 2346; /* XXX not used yet */
ic->ic_fixed_rate = -1; /* no fixed rate */
ic->ic_fixed_rate = IEEE80211_FIXED_RATE_NONE;
ic->ic_protmode = IEEE80211_PROT_CTSONLY;
ic->ic_roaming = IEEE80211_ROAMING_AUTO;
@ -335,7 +335,8 @@ ieee80211_fix_rate(struct ieee80211com *ic, struct ieee80211_node *ni, int flags
* If the fixed rate check was requested but no
* fixed has been defined then just remove it.
*/
if ((flags & IEEE80211_F_DOFRATE) && ic->ic_fixed_rate < 0)
if ((flags & IEEE80211_F_DOFRATE) &&
ic->ic_fixed_rate == IEEE80211_FIXED_RATE_NONE)
flags &= ~IEEE80211_F_DOFRATE;
error = 0;
okrate = badrate = fixedrate = 0;

View File

@ -72,6 +72,8 @@
#define IEEE80211_PS_SLEEP 0x1 /* STA is in power saving mode */
#define IEEE80211_PS_MAX_QUEUE 50 /* maximum saved packets */
#define IEEE80211_FIXED_RATE_NONE -1
#define IEEE80211_MS_TO_TU(x) (((x) * 1000) / 1024)
#define IEEE80211_TU_TO_MS(x) (((x) * 1024) / 1000)