summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2005-07-22 16:50:18 +0000
committersam <sam@FreeBSD.org>2005-07-22 16:50:18 +0000
commit3876d0ac68eed6f2676486ce047b20f7cb8f3520 (patch)
treefca8cfc4073f63287b1f51121bcf1c74ccdcdeb7 /sys
parent0ad70d5aa7fbb8f1837a75c1bf95f85475e1b1ba (diff)
downloadFreeBSD-src-3876d0ac68eed6f2676486ce047b20f7cb8f3520.zip
FreeBSD-src-3876d0ac68eed6f2676486ce047b20f7cb8f3520.tar.gz
diff reduction against p4: define IEEE80211_FIXED_RATE_NONE and use
it instead of -1
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ath/ath_rate/amrr/amrr.c5
-rw-r--r--sys/dev/ath/ath_rate/onoe/onoe.c5
-rw-r--r--sys/dev/ath/ath_rate/sample/sample.c2
-rw-r--r--sys/dev/awi/awi.c4
-rw-r--r--sys/dev/ral/if_ral.c4
-rw-r--r--sys/dev/usb/if_ural.c2
-rw-r--r--sys/dev/wi/if_wi.c4
-rw-r--r--sys/net80211/ieee80211.c2
-rw-r--r--sys/net80211/ieee80211_ioctl.c4
-rw-r--r--sys/net80211/ieee80211_proto.c5
-rw-r--r--sys/net80211/ieee80211_var.h2
11 files changed, 22 insertions, 17 deletions
diff --git a/sys/dev/ath/ath_rate/amrr/amrr.c b/sys/dev/ath/ath_rate/amrr/amrr.c
index 5955e48..257a737 100644
--- a/sys/dev/ath/ath_rate/amrr/amrr.c
+++ b/sys/dev/ath/ath_rate/amrr/amrr.c
@@ -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
diff --git a/sys/dev/ath/ath_rate/onoe/onoe.c b/sys/dev/ath/ath_rate/onoe/onoe.c
index a4f0094..ac0eac7 100644
--- a/sys/dev/ath/ath_rate/onoe/onoe.c
+++ b/sys/dev/ath/ath_rate/onoe/onoe.c
@@ -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
diff --git a/sys/dev/ath/ath_rate/sample/sample.c b/sys/dev/ath/ath_rate/sample/sample.c
index fd88101..7acdc5c 100644
--- a/sys/dev/ath/ath_rate/sample/sample.c
+++ b/sys/dev/ath/ath_rate/sample/sample.c
@@ -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
diff --git a/sys/dev/awi/awi.c b/sys/dev/awi/awi.c
index 0325995..4c0ffc2 100644
--- a/sys/dev/awi/awi.c
+++ b/sys/dev/awi/awi.c
@@ -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].
diff --git a/sys/dev/ral/if_ral.c b/sys/dev/ral/if_ral.c
index 11a2ea1..429233a 100644
--- a/sys/dev/ral/if_ral.c
+++ b/sys/dev/ral/if_ral.c
@@ -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;
diff --git a/sys/dev/usb/if_ural.c b/sys/dev/usb/if_ural.c
index b09cb4a..239dc22 100644
--- a/sys/dev/usb/if_ural.c
+++ b/sys/dev/usb/if_ural.c
@@ -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];
diff --git a/sys/dev/wi/if_wi.c b/sys/dev/wi/if_wi.c
index 1cd2b9f..a4a041a 100644
--- a/sys/dev/wi/if_wi.c
+++ b/sys/dev/wi/if_wi.c
@@ -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] &
diff --git a/sys/net80211/ieee80211.c b/sys/net80211/ieee80211.c
index b25f047..ea75fa0 100644
--- a/sys/net80211/ieee80211.c
+++ b/sys/net80211/ieee80211.c
@@ -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.
*/
diff --git a/sys/net80211/ieee80211_ioctl.c b/sys/net80211/ieee80211_ioctl.c
index 83ac126..017c927 100644
--- a/sys/net80211/ieee80211_ioctl.c
+++ b/sys/net80211/ieee80211_ioctl.c
@@ -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]);
diff --git a/sys/net80211/ieee80211_proto.c b/sys/net80211/ieee80211_proto.c
index 168f410..0fe4574 100644
--- a/sys/net80211/ieee80211_proto.c
+++ b/sys/net80211/ieee80211_proto.c
@@ -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;
diff --git a/sys/net80211/ieee80211_var.h b/sys/net80211/ieee80211_var.h
index 1c34e78..d4959af 100644
--- a/sys/net80211/ieee80211_var.h
+++ b/sys/net80211/ieee80211_var.h
@@ -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)
OpenPOWER on IntegriCloud