Browse Source

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.
Paul Stewart 14 years ago
parent
commit
174fa7898e

+ 5 - 2
wpa_supplicant/bgscan.c

@@ -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,
-				 int current_signal)
+				 int current_signal, int current_noise,
+				 int current_txrate)
 {
 	if (wpa_s->bgscan && wpa_s->bgscan_priv)
 		wpa_s->bgscan->notify_signal_change(wpa_s->bgscan_priv, above,
-						    current_signal);
+						    current_signal,
+						    current_noise,
+						    current_txrate);
 }

+ 8 - 3
wpa_supplicant/bgscan.h

@@ -28,7 +28,9 @@ struct bgscan_ops {
 	int (*notify_scan)(void *priv, struct wpa_scan_results *scan_res);
 	void (*notify_beacon_loss)(void *priv);
 	void (*notify_signal_change)(void *priv, int above,
-				     int current_signal);
+				     int current_signal,
+				     int current_noise,
+				     int current_txrate);
 };
 
 #ifdef CONFIG_BGSCAN
@@ -39,7 +41,8 @@ int bgscan_notify_scan(struct wpa_supplicant *wpa_s,
 		       struct wpa_scan_results *scan_res);
 void bgscan_notify_beacon_loss(struct wpa_supplicant *wpa_s);
 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 */
 
@@ -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,
-					       int above, int current_signal)
+					       int above, int current_signal,
+					       int current_noise,
+					       int current_txrate)
 {
 }
 

+ 6 - 2
wpa_supplicant/bgscan_learn.c

@@ -556,7 +556,9 @@ static void bgscan_learn_notify_beacon_loss(void *priv)
 
 
 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;
 	int scan = 0;
@@ -567,7 +569,9 @@ static void bgscan_learn_notify_signal_change(void *priv, int above,
 		return;
 
 	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) {
 		wpa_printf(MSG_DEBUG, "bgscan learn: Start using short bgscan "
 			   "interval");

+ 6 - 2
wpa_supplicant/bgscan_simple.c

@@ -177,7 +177,9 @@ static void bgscan_simple_notify_beacon_loss(void *priv)
 
 
 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;
 	int scan = 0;
@@ -188,7 +190,9 @@ static void bgscan_simple_notify_signal_change(void *priv, int above,
 		return;
 
 	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) {
 		wpa_printf(MSG_DEBUG, "bgscan simple: Start using short "
 			   "bgscan interval");

+ 3 - 1
wpa_supplicant/events.c

@@ -1803,7 +1803,9 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
 	case EVENT_SIGNAL_CHANGE:
 		bgscan_notify_signal_change(
 			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;
 	case EVENT_INTERFACE_ENABLED:
 		wpa_printf(MSG_DEBUG, "Interface was enabled");