diff options
author | sam <sam@FreeBSD.org> | 2007-03-11 22:37:32 +0000 |
---|---|---|
committer | sam <sam@FreeBSD.org> | 2007-03-11 22:37:32 +0000 |
commit | 35a6c17cb8cd2d9c814d2cff98b00a26fae9b9e6 (patch) | |
tree | 7601409f400bd2d60403c79b2eb23f78587868c2 /sys/net80211 | |
parent | c77fb6f45fa6f27fca46baa53d66769e9246d705 (diff) | |
download | FreeBSD-src-35a6c17cb8cd2d9c814d2cff98b00a26fae9b9e6.zip FreeBSD-src-35a6c17cb8cd2d9c814d2cff98b00a26fae9b9e6.tar.gz |
change ic_modecaps to a bit vector and use setbit, et. al.
Diffstat (limited to 'sys/net80211')
-rw-r--r-- | sys/net80211/ieee80211.c | 28 | ||||
-rw-r--r-- | sys/net80211/ieee80211_ioctl.c | 2 | ||||
-rw-r--r-- | sys/net80211/ieee80211_var.h | 2 |
3 files changed, 16 insertions, 16 deletions
diff --git a/sys/net80211/ieee80211.c b/sys/net80211/ieee80211.c index bcef214..c96465c 100644 --- a/sys/net80211/ieee80211.c +++ b/sys/net80211/ieee80211.c @@ -144,7 +144,7 @@ static void ieee80211_chan_init(struct ieee80211com *ic) { #define DEFAULTRATES(m, def) do { \ - if ((ic->ic_modecaps & (1<<m)) && ic->ic_sup_rates[m].rs_nrates == 0) \ + if (isset(ic->ic_modecaps, m) && ic->ic_sup_rates[m].rs_nrates == 0) \ ic->ic_sup_rates[m] = def; \ } while (0) struct ifnet *ifp = ic->ic_ifp; @@ -152,7 +152,7 @@ ieee80211_chan_init(struct ieee80211com *ic) int i; memset(ic->ic_chan_avail, 0, sizeof(ic->ic_chan_avail)); - ic->ic_modecaps = 1<<IEEE80211_MODE_AUTO; + setbit(ic->ic_modecaps, IEEE80211_MODE_AUTO); for (i = 0; i <= IEEE80211_CHAN_MAX; i++) { c = &ic->ic_channels[i]; if (c->ic_flags) { @@ -171,17 +171,17 @@ ieee80211_chan_init(struct ieee80211com *ic) * Identify mode capabilities. */ if (IEEE80211_IS_CHAN_A(c)) - ic->ic_modecaps |= 1<<IEEE80211_MODE_11A; + setbit(ic->ic_modecaps, IEEE80211_MODE_11A); if (IEEE80211_IS_CHAN_B(c)) - ic->ic_modecaps |= 1<<IEEE80211_MODE_11B; + setbit(ic->ic_modecaps, IEEE80211_MODE_11B); if (IEEE80211_IS_CHAN_ANYG(c)) - ic->ic_modecaps |= 1<<IEEE80211_MODE_11G; + setbit(ic->ic_modecaps, IEEE80211_MODE_11G); if (IEEE80211_IS_CHAN_FHSS(c)) - ic->ic_modecaps |= 1<<IEEE80211_MODE_FH; + setbit(ic->ic_modecaps, IEEE80211_MODE_FH); if (IEEE80211_IS_CHAN_T(c)) - ic->ic_modecaps |= 1<<IEEE80211_MODE_TURBO_A; + setbit(ic->ic_modecaps, IEEE80211_MODE_TURBO_A); if (IEEE80211_IS_CHAN_108G(c)) - ic->ic_modecaps |= 1<<IEEE80211_MODE_TURBO_G; + setbit(ic->ic_modecaps, IEEE80211_MODE_TURBO_G); if (ic->ic_curchan == NULL) { /* arbitrarily pick the first channel */ ic->ic_curchan = &ic->ic_channels[i]; @@ -447,7 +447,7 @@ ieee80211_media_init(struct ieee80211com *ic, IFM_IEEE80211_11A | IFM_IEEE80211_TURBO, IFM_IEEE80211_11G | IFM_IEEE80211_TURBO, }; - if ((ic->ic_modecaps & (1<<mode)) == 0) + if (isclr(ic->ic_modecaps, mode)) continue; mopt = mopts[mode]; ADD(ic, IFM_AUTO, mopt); /* e.g. 11a auto */ @@ -537,7 +537,7 @@ ieee80211_announce(struct ieee80211com *ic) struct ieee80211_rateset *rs; for (mode = IEEE80211_MODE_11A; mode < IEEE80211_MODE_MAX; mode++) { - if ((ic->ic_modecaps & (1<<mode)) == 0) + if (isclr(ic->ic_modecaps, mode)) continue; if_printf(ifp, "%s rates: ", ieee80211_phymode_name[mode]); rs = &ic->ic_sup_rates[mode]; @@ -650,7 +650,7 @@ ieee80211_media_change(struct ifnet *ifp) /* * Validate requested mode is available. */ - if ((ic->ic_modecaps & (1<<newphymode)) == 0) + if (isclr(ic->ic_modecaps, newphymode)) return EINVAL; /* @@ -673,7 +673,7 @@ ieee80211_media_change(struct ifnet *ifp) */ for (j = IEEE80211_MODE_11A; j < IEEE80211_MODE_MAX; j++) { - if ((ic->ic_modecaps & (1<<j)) == 0) + if (isclr(ic->ic_modecaps, j)) continue; i = findrate(ic, j, newrate); if (i != -1) { @@ -714,7 +714,7 @@ ieee80211_media_change(struct ifnet *ifp) if (newopmode == IEEE80211_M_HOSTAP && newphymode == IEEE80211_MODE_AUTO) { for (j = IEEE80211_MODE_11A; j < IEEE80211_MODE_MAX; j++) - if (ic->ic_modecaps & (1<<j)) { + if (isset(ic->ic_modecaps, j)) { newphymode = j; break; } @@ -894,7 +894,7 @@ ieee80211_setmode(struct ieee80211com *ic, enum ieee80211_phymode mode) int i; /* validate new mode */ - if ((ic->ic_modecaps & (1<<mode)) == 0) { + if (isclr(ic->ic_modecaps, mode)) { IEEE80211_DPRINTF(ic, IEEE80211_MSG_ANY, "%s: mode %u not supported (caps 0x%x)\n", __func__, mode, ic->ic_modecaps); diff --git a/sys/net80211/ieee80211_ioctl.c b/sys/net80211/ieee80211_ioctl.c index 1f19ff5..0499bcb 100644 --- a/sys/net80211/ieee80211_ioctl.c +++ b/sys/net80211/ieee80211_ioctl.c @@ -595,7 +595,7 @@ ieee80211_cfgset(struct ieee80211com *ic, u_long cmd, caddr_t data) */ for (j = IEEE80211_MODE_11A; j < IEEE80211_MODE_MAX; j++) { - if ((ic->ic_modecaps & (1<<j)) == 0) + if (isclr(ic->ic_modecaps, j)) continue; i = findrate(ic, j, rate); if (i != -1) { diff --git a/sys/net80211/ieee80211_var.h b/sys/net80211/ieee80211_var.h index 1ebd6ef..ea15e5e 100644 --- a/sys/net80211/ieee80211_var.h +++ b/sys/net80211/ieee80211_var.h @@ -117,7 +117,7 @@ struct ieee80211com { u_int32_t ic_flags; /* state flags */ u_int32_t ic_flags_ext; /* extended state flags */ u_int32_t ic_caps; /* capabilities */ - u_int16_t ic_modecaps; /* set of mode capabilities */ + u_int8_t ic_modecaps[2]; /* set of mode capabilities */ u_int16_t ic_curmode; /* current mode */ enum ieee80211_phytype ic_phytype; /* XXX wrong for multi-mode */ enum ieee80211_opmode ic_opmode; /* operation mode */ |