wpa_supplicant roaming algorithm

Message ID CANMK_o6100vuYk-jK2XSZSs4WRosADuQDcg2c7mHpR7ALoW65g@mail.gmail.com
State New
Headers show
Series
  • wpa_supplicant roaming algorithm
Related show

Commit Message

Iyad Qumei Aug. 1, 2018, 7:56 p.m.
Greetings,

The current roaming algorithm appears incorrect.  I would like your
opinion on the following proposed change.  I understand the patch is
for the 2.6 release.  I checked the master branch the RSSI roaming
criteria are still the same.  Will update the patch for the master
branch once I hear your opinion.

There are roaming gaps, identified for specific current signal levels.
In these gaps, no roaming occurs.  However, outside of these gaps
which include worse selected signals roaming occurs.

Also, I don't believe the operating condition current_bss->level > 0
is physically possible.

All values in the tables are in dBm.

Proposed alternative:
=====================
(standard)
----------
      Current Level < -85      selected - current >= 1   min_diff = 1
-85 < Current Level < -80      selected - current >= 2   min_diff = 2
-80 < Current Level < -75      selected - current >= 3   min_diff = 3
-75 < Current Level < -70      selected - current >= 4   min_diff = 4
      Current Level > -70      selected - current >= 5   min_diff = 5

2.4 to 5.0 GHz
--------------
      Current Level < -85      selected - current >= -2   min_diff = -2
-85 < Current Level < -80      selected - current >= -2   min_diff = -2
-80 < Current Level < -75      selected - current >=  1   min_diff =  1
-75 < Current Level < -70      selected - current >=  2   min_diff =  2
      Current Level > -70      selected - current >=  3   min_diff =  3

Current implementation
======================
(standard)
----------
      Current Level < -85      selected - current >= 1   min_diff = 1
-85 < Current Level < -80      selected - current >= 2   min_diff = 2
-80 < Current Level < -75      selected - current >= 3   min_diff = 3
-75 < Current Level < -70      selected - current >= 4   min_diff = 4
-70 < Current Level <   0      selected - current >= 5   min_diff = 5
      Current Level > 0        selected - current >= 2   min_diff = 2
(Roaming gap < -2, > 2)

2.4 to 5.0 GHz
--------------
      Current Level < -85      selected - current >= -2   min_diff = 0
-85 < Current Level < -80      selected - current >= -2   min_diff = 0
-80 < Current Level < -75      selected - current >=  1   min_diff = 1
 (Roaming gap -2,-1, > 1)
-75 < Current Level < -70      selected - current >=  2   min_diff = 2
 (Roaming gap -2,-1, > 2)
-70 < Current Level <   0      selected - current >=  3   min_diff = 3
      Current Level > 0        selected - current >= any   min_diff = 0

Regards,

Patch

From 0f6f3d777ae2a8712ff4374cd482fe1c99a66fee Mon Sep 17 00:00:00 2001
From: Iyad Qumei <iyad.qumei@verizon.com>
Date: Wed, 1 Aug 2018 12:24:07 -0700
Subject: [PATCH] wpa: fix roaming algorithm

The current roaming algorithm is incorrect.  There are roaming gaps,
identified for specific current signal levels.  In these gaps no roaming
occurs.  However, outside of these gaps which include worse selected
signals roaming occurs.

All values in the tables are in dBm.

Proposed alternative:
=====================
(standard)
----------
      Current Level < -85      selected - current >= 1   min_diff = 1
-85 < Current Level < -80      selected - current >= 2   min_diff = 2
-80 < Current Level < -75      selected - current >= 3   min_diff = 3
-75 < Current Level < -70      selected - current >= 4   min_diff = 4
      Current Level > -70      selected - current >= 5   min_diff = 5

2.4 to 5.0 GHz
--------------
      Current Level < -85      selected - current >= -2   min_diff = -2
-85 < Current Level < -80      selected - current >= -2   min_diff = -2
-80 < Current Level < -75      selected - current >=  1   min_diff =  1
-75 < Current Level < -70      selected - current >=  2   min_diff =  2
      Current Level > -70      selected - current >=  3   min_diff =  3

Current implementation
======================
(standard)
----------
      Current Level < -85      selected - current >= 1   min_diff = 1
-85 < Current Level < -80      selected - current >= 2   min_diff = 2
-80 < Current Level < -75      selected - current >= 3   min_diff = 3
-75 < Current Level < -70      selected - current >= 4   min_diff = 4
-70 < Current Level <   0      selected - current >= 5   min_diff = 5
      Current Level > 0        selected - current >= 2   min_diff = 2  (Roaming gap < -2, > 2)

2.4 to 5.0 GHz
--------------
      Current Level < -85      selected - current >= -2   min_diff = 0
-85 < Current Level < -80      selected - current >= -2   min_diff = 0
-80 < Current Level < -75      selected - current >=  1   min_diff = 1  (Roaming gap -2,-1, > 1)
-75 < Current Level < -70      selected - current >=  2   min_diff = 2  (Roaming gap -2,-1, > 2)
-70 < Current Level <   0      selected - current >=  3   min_diff = 3
      Current Level > 0        selected - current >= any   min_diff = 0
---
 .pc/applied-patches     |  1 +
 wpa_supplicant/events.c | 27 +++++++++++++--------------
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/.pc/applied-patches b/.pc/applied-patches
index e5913f2..72f582c 100644
--- a/.pc/applied-patches
+++ b/.pc/applied-patches
@@ -2,3 +2,4 @@  key-replay-cve-multiple.patch
 allow-wpa-cli-with-dbus.patch
 wpa_supplicant_ap_selection.patch
 wpa-ptk-error-code.patch
+wpa-correct-roaming-algorithm.patch
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index 41057cc..962d81f 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -1470,26 +1470,25 @@  static int wpa_supplicant_need_to_roam(struct wpa_supplicant *wpa_s,
 	}
 
 	min_diff = 2;
-	if (current_bss->level < 0) {
-		if (current_bss->level < -85)
-			min_diff = 1;
-		else if (current_bss->level < -80)
-			min_diff = 2;
-		else if (current_bss->level < -75)
-			min_diff = 3;
-		else if (current_bss->level < -70)
-			min_diff = 4;
-		else
-			min_diff = 5;
-	}
+        if (current_bss->level < -85)
+                min_diff = 1;
+        else if (current_bss->level < -80)
+                min_diff = 2;
+        else if (current_bss->level < -75)
+                min_diff = 3;
+        else if (current_bss->level < -70)
+                min_diff = 4;
+        else
+                min_diff = 5;
+
 	if (to_5ghz) {
 		/* Make it easier to move to 5 GHz band */
 		if (min_diff > 2)
 			min_diff -= 2;
 		else
-			min_diff = 0;
+			min_diff = -2;
 	}
-	if (abs(current_bss->level - selected->level) < min_diff) {
+	if ((selected->level -current_bss->level) < min_diff) {
 		wpa_dbg(wpa_s, MSG_INFO, "Skip roam - too small difference "
 			"in signal level");
 		return 0;
-- 
2.7.4