1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-03 09:00:21 +00:00

simplify setting up the roaming parameters; writing default parameters only

for active modes hasn't turned out to be useful so just define a const table
and copy it in place
This commit is contained in:
Sam Leffler 2009-02-19 04:37:44 +00:00
parent 566d825ba7
commit 82c990a4ef
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=188776

View File

@ -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 ieee80211com *ic)
}
}
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