bgscan: Add new channel condition parameters to signal change events

bgscan modules can potentially get a richer feel for the channel
condition and make better choices about scan/no-scan and roam/no-roam.
This commit is contained in:
Paul Stewart 2010-10-12 20:03:36 +03:00 committed by Jouni Malinen
parent 7ee35bf395
commit 174fa7898e
5 changed files with 28 additions and 10 deletions

View file

@ -112,9 +112,12 @@ void bgscan_notify_beacon_loss(struct wpa_supplicant *wpa_s)
void bgscan_notify_signal_change(struct wpa_supplicant *wpa_s, int above, void bgscan_notify_signal_change(struct wpa_supplicant *wpa_s, int above,
int current_signal) int current_signal, int current_noise,
int current_txrate)
{ {
if (wpa_s->bgscan && wpa_s->bgscan_priv) if (wpa_s->bgscan && wpa_s->bgscan_priv)
wpa_s->bgscan->notify_signal_change(wpa_s->bgscan_priv, above, wpa_s->bgscan->notify_signal_change(wpa_s->bgscan_priv, above,
current_signal); current_signal,
current_noise,
current_txrate);
} }

View file

@ -28,7 +28,9 @@ struct bgscan_ops {
int (*notify_scan)(void *priv, struct wpa_scan_results *scan_res); int (*notify_scan)(void *priv, struct wpa_scan_results *scan_res);
void (*notify_beacon_loss)(void *priv); void (*notify_beacon_loss)(void *priv);
void (*notify_signal_change)(void *priv, int above, void (*notify_signal_change)(void *priv, int above,
int current_signal); int current_signal,
int current_noise,
int current_txrate);
}; };
#ifdef CONFIG_BGSCAN #ifdef CONFIG_BGSCAN
@ -39,7 +41,8 @@ int bgscan_notify_scan(struct wpa_supplicant *wpa_s,
struct wpa_scan_results *scan_res); struct wpa_scan_results *scan_res);
void bgscan_notify_beacon_loss(struct wpa_supplicant *wpa_s); void bgscan_notify_beacon_loss(struct wpa_supplicant *wpa_s);
void bgscan_notify_signal_change(struct wpa_supplicant *wpa_s, int above, void bgscan_notify_signal_change(struct wpa_supplicant *wpa_s, int above,
int current_signal); int current_signal, int current_noise,
int current_txrate);
#else /* CONFIG_BGSCAN */ #else /* CONFIG_BGSCAN */
@ -64,7 +67,9 @@ static inline void bgscan_notify_beacon_loss(struct wpa_supplicant *wpa_s)
} }
static inline void bgscan_notify_signal_change(struct wpa_supplicant *wpa_s, static inline void bgscan_notify_signal_change(struct wpa_supplicant *wpa_s,
int above, int current_signal) int above, int current_signal,
int current_noise,
int current_txrate)
{ {
} }

View file

@ -556,7 +556,9 @@ static void bgscan_learn_notify_beacon_loss(void *priv)
static void bgscan_learn_notify_signal_change(void *priv, int above, static void bgscan_learn_notify_signal_change(void *priv, int above,
int current_signal) int current_signal,
int current_noise,
int current_txrate)
{ {
struct bgscan_learn_data *data = priv; struct bgscan_learn_data *data = priv;
int scan = 0; int scan = 0;
@ -567,7 +569,9 @@ static void bgscan_learn_notify_signal_change(void *priv, int above,
return; return;
wpa_printf(MSG_DEBUG, "bgscan learn: signal level changed " wpa_printf(MSG_DEBUG, "bgscan learn: signal level changed "
"(above=%d current_signal=%d)", above, current_signal); "(above=%d current_signal=%d current_noise=%d "
"current_txrate=%d)", above, current_signal,
current_noise, current_txrate);
if (data->scan_interval == data->long_interval && !above) { if (data->scan_interval == data->long_interval && !above) {
wpa_printf(MSG_DEBUG, "bgscan learn: Start using short bgscan " wpa_printf(MSG_DEBUG, "bgscan learn: Start using short bgscan "
"interval"); "interval");

View file

@ -177,7 +177,9 @@ static void bgscan_simple_notify_beacon_loss(void *priv)
static void bgscan_simple_notify_signal_change(void *priv, int above, static void bgscan_simple_notify_signal_change(void *priv, int above,
int current_signal) int current_signal,
int current_noise,
int current_txrate)
{ {
struct bgscan_simple_data *data = priv; struct bgscan_simple_data *data = priv;
int scan = 0; int scan = 0;
@ -188,7 +190,9 @@ static void bgscan_simple_notify_signal_change(void *priv, int above,
return; return;
wpa_printf(MSG_DEBUG, "bgscan simple: signal level changed " wpa_printf(MSG_DEBUG, "bgscan simple: signal level changed "
"(above=%d current_signal=%d)", above, current_signal); "(above=%d current_signal=%d current_noise=%d "
"current_txrate=%d))", above, current_signal,
current_noise, current_txrate);
if (data->scan_interval == data->long_interval && !above) { if (data->scan_interval == data->long_interval && !above) {
wpa_printf(MSG_DEBUG, "bgscan simple: Start using short " wpa_printf(MSG_DEBUG, "bgscan simple: Start using short "
"bgscan interval"); "bgscan interval");

View file

@ -1803,7 +1803,9 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
case EVENT_SIGNAL_CHANGE: case EVENT_SIGNAL_CHANGE:
bgscan_notify_signal_change( bgscan_notify_signal_change(
wpa_s, data->signal_change.above_threshold, wpa_s, data->signal_change.above_threshold,
data->signal_change.current_signal); data->signal_change.current_signal,
data->signal_change.current_noise,
data->signal_change.current_txrate);
break; break;
case EVENT_INTERFACE_ENABLED: case EVENT_INTERFACE_ENABLED:
wpa_printf(MSG_DEBUG, "Interface was enabled"); wpa_printf(MSG_DEBUG, "Interface was enabled");