Date: Fri, 23 Feb 2007 23:52:54 GMT From: Sam Leffler <sam@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 114933 for review Message-ID: <200702232352.l1NNqsoF037566@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=114933 Change 114933 by sam@sam_ebb on 2007/02/23 23:52:33 Cleanup ic_modecaps: use bit twiddling macros instead of explicit mask operations. Affected files ... .. //depot/projects/wifi/sys/dev/iwi/if_iwi.c#21 edit .. //depot/projects/wifi/sys/net80211/ieee80211.c#41 edit .. //depot/projects/wifi/sys/net80211/ieee80211_var.h#48 edit Differences ... ==== //depot/projects/wifi/sys/dev/iwi/if_iwi.c#21 (text+ko) ==== @@ -2678,7 +2678,7 @@ scan_type = IWI_SCAN_TYPE_BROADCAST; ix = 0; - if (ic->ic_modecaps & IEEE80211_MODE_5GHZ) { + if (isset(ic->ic_modecaps, IEEE80211_MODE_5GHZ)) { start = ix; for (i = 0; i <= IEEE80211_CHAN_MAX; i++) { c = &ic->ic_channels[i]; @@ -2702,7 +2702,7 @@ ix++; } } - if (ic->ic_modecaps & IEEE80211_MODE_2GHZ) { + if (isset(ic->ic_modecaps, IEEE80211_MODE_2GHZ)) { start = ix; for (i = 0; i <= IEEE80211_CHAN_MAX; i++) { c = &ic->ic_channels[i]; ==== //depot/projects/wifi/sys/net80211/ieee80211.c#41 (text+ko) ==== @@ -148,7 +148,7 @@ 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 ieee80211_channel *c; @@ -157,7 +157,7 @@ KASSERT(0 < ic->ic_nchans && ic->ic_nchans < IEEE80211_CHAN_MAX, ("invalid number of channels specified: %u", ic->ic_nchans)); 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 < ic->ic_nchans; i++) { c = &ic->ic_channels[i]; KASSERT(c->ic_flags != 0, ("channel with no flags")); @@ -168,19 +168,19 @@ * 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_108A(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 (IEEE80211_IS_CHAN_ST(c)) - ic->ic_modecaps |= 1<<IEEE80211_MODE_STURBO_A; + setbit(ic->ic_modecaps, IEEE80211_MODE_STURBO_A); } /* initialize candidate channels to all available */ memcpy(ic->ic_chan_active, ic->ic_chan_avail, @@ -474,7 +474,7 @@ 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 */ @@ -565,7 +565,7 @@ 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]; @@ -681,7 +681,7 @@ * In autoselect mode search for the rate. */ for (i = IEEE80211_MODE_11A; i < IEEE80211_MODE_MAX; i++) { - if ((ic->ic_modecaps & (1<<i)) && + if (isset(ic->ic_modecaps, i) && findrate(ic, i, rate) != -1) return 1; } @@ -787,7 +787,7 @@ 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; } ==== //depot/projects/wifi/sys/net80211/ieee80211_var.h#48 (text+ko) ==== @@ -111,7 +111,7 @@ 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 */ struct ieee80211_rateset ic_sup_rates[IEEE80211_MODE_MAX]; u_int16_t ic_bintval; /* beacon interval */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200702232352.l1NNqsoF037566>
