svn commit: r188793 - in projects/vap7/sys: . contrib/pf dev
dev/ath dev/ath/ath_hal dev/ath/ath_hal/ar5210
dev/ath/ath_hal/ar5211 dev/ath/ath_hal/ar5212
dev/ath/ath_hal/ar5312 dev/ath/ath_hal/ar54...
Sam Leffler
sam at FreeBSD.org
Wed Feb 18 21:48:23 PST 2009
Author: sam
Date: Thu Feb 19 05:48:23 2009
New Revision: 188793
URL: http://svn.freebsd.org/changeset/base/188793
Log:
merge r188776: simplify setting up the roaming parameters
Modified:
projects/vap7/sys/ (props changed)
projects/vap7/sys/contrib/pf/ (props changed)
projects/vap7/sys/dev/ (props changed)
projects/vap7/sys/dev/ath/ (props changed)
projects/vap7/sys/dev/ath/ath_hal/ (props changed)
projects/vap7/sys/dev/ath/ath_hal/ar5210/ (props changed)
projects/vap7/sys/dev/ath/ath_hal/ar5211/ (props changed)
projects/vap7/sys/dev/ath/ath_hal/ar5212/ (props changed)
projects/vap7/sys/dev/ath/ath_hal/ar5312/ (props changed)
projects/vap7/sys/dev/ath/ath_hal/ar5416/ (props changed)
projects/vap7/sys/dev/cxgb/ (props changed)
projects/vap7/sys/dev/usb2/ (props changed)
projects/vap7/sys/i386/conf/USB2 (props changed)
projects/vap7/sys/modules/usb2/ (props changed)
projects/vap7/sys/net80211/ (props changed)
projects/vap7/sys/net80211/ieee80211_scan.c
Modified: projects/vap7/sys/net80211/ieee80211_scan.c
==============================================================================
--- projects/vap7/sys/net80211/ieee80211_scan.c Thu Feb 19 05:47:50 2009 (r188792)
+++ projects/vap7/sys/net80211/ieee80211_scan.c Thu Feb 19 05:48:23 2009 (r188793)
@@ -73,16 +73,18 @@ struct scan_state {
/*
* Roaming-related defaults. RSSI thresholds are as returned by the
- * driver (dBm). Transmit rate thresholds are IEEE rate codes (i.e
+ * driver (.5dBm). Transmit rate thresholds are IEEE rate codes (i.e
* .5M units) or MCS.
*/
-#define ROAM_RSSI_11A_DEFAULT 14 /* rssi threshold for 11a bss */
-#define ROAM_RSSI_11B_DEFAULT 14 /* rssi threshold for 11b bss */
-#define ROAM_RSSI_11BONLY_DEFAULT 14 /* rssi threshold for 11b-only bss */
-#define ROAM_RATE_11A_DEFAULT 2*12 /* tx rate thresh for 11a bss */
-#define ROAM_RATE_11B_DEFAULT 2*5 /* tx rate thresh for 11b bss */
-#define ROAM_RATE_11BONLY_DEFAULT 2*1 /* tx rate thresh for 11b-only bss */
-#define ROAM_MCS_11N_DEFAULT 1 /* tx MCS thresh for 11n bss*/
+/* rssi thresholds */
+#define ROAM_RSSI_11A_DEFAULT 14 /* 11a bss */
+#define ROAM_RSSI_11B_DEFAULT 14 /* 11b bss */
+#define ROAM_RSSI_11BONLY_DEFAULT 14 /* 11b-only bss */
+/* transmit rate thresholds */
+#define ROAM_RATE_11A_DEFAULT 2*12 /* 11a bss */
+#define ROAM_RATE_11B_DEFAULT 2*5 /* 11b bss */
+#define ROAM_RATE_11BONLY_DEFAULT 2*1 /* 11b-only bss */
+#define ROAM_MCS_11N_DEFAULT (1 | IEEE80211_RATE_MCS) /* 11n bss */
static void scan_restart_pwrsav(void *);
static void scan_curchan(struct ieee80211_scan_state *, unsigned long);
@@ -126,50 +128,34 @@ ieee80211_scan_detach(struct ieee80211co
}
}
-static __inline void
-setparams(struct ieee80211_roamparam *rp, int8_t rssi, uint8_t txrate)
-{
- rp->rssi = rssi;
- rp->rate = txrate;
-}
+static const struct ieee80211_roamparam defroam[IEEE80211_MODE_MAX] = {
+ [IEEE80211_MODE_11A] = { .rssi = ROAM_RSSI_11A_DEFAULT,
+ .rate = ROAM_RATE_11A_DEFAULT },
+ [IEEE80211_MODE_11G] = { .rssi = ROAM_RSSI_11B_DEFAULT,
+ .rate = ROAM_RATE_11B_DEFAULT },
+ [IEEE80211_MODE_11B] = { .rssi = ROAM_RSSI_11BONLY_DEFAULT,
+ .rate = ROAM_RATE_11BONLY_DEFAULT },
+ [IEEE80211_MODE_TURBO_A]= { .rssi = ROAM_RSSI_11A_DEFAULT,
+ .rate = ROAM_RATE_11A_DEFAULT },
+ [IEEE80211_MODE_TURBO_G]= { .rssi = ROAM_RSSI_11A_DEFAULT,
+ .rate = ROAM_RATE_11A_DEFAULT },
+ [IEEE80211_MODE_STURBO_A]={ .rssi = ROAM_RSSI_11A_DEFAULT,
+ .rate = ROAM_RATE_11A_DEFAULT },
+ [IEEE80211_MODE_11NA] = { .rssi = ROAM_RSSI_11A_DEFAULT,
+ .rate = ROAM_MCS_11N_DEFAULT },
+ [IEEE80211_MODE_11NG] = { .rssi = ROAM_RSSI_11B_DEFAULT,
+ .rate = ROAM_MCS_11N_DEFAULT },
+};
void
ieee80211_scan_vattach(struct ieee80211vap *vap)
{
- struct ieee80211com *ic = vap->iv_ic;
-
vap->iv_bgscanidle = (IEEE80211_BGSCAN_IDLE_DEFAULT*1000)/hz;
vap->iv_bgscanintvl = IEEE80211_BGSCAN_INTVAL_DEFAULT*hz;
vap->iv_scanvalid = IEEE80211_SCAN_VALID_DEFAULT*hz;
vap->iv_roaming = IEEE80211_ROAMING_AUTO;
-
- /* NB: only set supported modes so user apps can identify */
- if (isset(ic->ic_modecaps, IEEE80211_MODE_11A))
- setparams(&vap->iv_roamparms[IEEE80211_MODE_11A],
- ROAM_RSSI_11A_DEFAULT, ROAM_RATE_11A_DEFAULT);
- if (isset(ic->ic_modecaps, IEEE80211_MODE_11G))
- setparams(&vap->iv_roamparms[IEEE80211_MODE_11G],
- ROAM_RSSI_11B_DEFAULT, ROAM_RATE_11B_DEFAULT);
- if (isset(ic->ic_modecaps, IEEE80211_MODE_11B))
- setparams(&vap->iv_roamparms[IEEE80211_MODE_11B],
- ROAM_RSSI_11BONLY_DEFAULT, ROAM_RATE_11BONLY_DEFAULT);
- /* NB: default turbo controls to be the same as !turbo */
- if (isset(ic->ic_modecaps, IEEE80211_MODE_TURBO_A))
- vap->iv_roamparms[IEEE80211_MODE_TURBO_A] =
- vap->iv_roamparms[IEEE80211_MODE_11A];
- if (isset(ic->ic_modecaps, IEEE80211_MODE_TURBO_G))
- vap->iv_roamparms[IEEE80211_MODE_TURBO_G] =
- vap->iv_roamparms[IEEE80211_MODE_11G];
- if (isset(ic->ic_modecaps, IEEE80211_MODE_STURBO_A))
- vap->iv_roamparms[IEEE80211_MODE_STURBO_A] =
- vap->iv_roamparms[IEEE80211_MODE_11A];
- if (isset(ic->ic_modecaps, IEEE80211_MODE_11NA))
- setparams(&vap->iv_roamparms[IEEE80211_MODE_11NA],
- ROAM_RSSI_11A_DEFAULT, ROAM_MCS_11N_DEFAULT | 0x80);
- if (isset(ic->ic_modecaps, IEEE80211_MODE_11NG))
- setparams(&vap->iv_roamparms[IEEE80211_MODE_11NG],
- ROAM_RSSI_11B_DEFAULT, ROAM_MCS_11N_DEFAULT | 0x80);
+ memcpy(vap->iv_roamparms, defroam, sizeof(defroam));
}
void
More information about the svn-src-projects
mailing list