CHROMIUM: Remove SNR considersation in need_to_roam

This partially reverts commit
5e7a79df1e581eeca3b5b976c54e32d3e015078c.

BUG=None (TBD)
TEST=None (TBD)

Change-Id: I9bb507102c928b443a6d08d315dd34af3d952675
Signed-off-by: Kirtika Ruchandani <kirtika@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/896391
Commit-Ready: Matthew Wang <matthewmwang@chromium.org>
Tested-by: Matthew Wang <matthewmwang@chromium.org>
Reviewed-by: Matthew Wang <matthewmwang@chromium.org>
(cherry picked from commit 67df2c8a3ee26e67b2f13008b40277d88e51b938)
Reviewed-on: https://chromium-review.googlesource.com/898187
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index 843b9d1..4783482 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -1425,6 +1425,16 @@
 		return 1; /* current BSS not seen in the last scan */
 
 #ifndef CONFIG_NO_ROAMING
+	wpa_dbg(wpa_s, MSG_DEBUG, "Considering within-ESS reassociation");
+	wpa_dbg(wpa_s, MSG_DEBUG, "Current BSS: " MACSTR
+		" level=%d snr=%d est_throughput=%u",
+		MAC2STR(current_bss->bssid), current_bss->level,
+		current_bss->snr, current_bss->est_throughput);
+	wpa_dbg(wpa_s, MSG_DEBUG, "Selected BSS: " MACSTR
+		" level=%d snr=%d est_throughput=%u",
+		MAC2STR(selected->bssid), selected->level,
+		selected->snr, selected->est_throughput);
+
 	if (wpa_s->current_ssid->bssid_set &&
 	    os_memcmp(selected->bssid, wpa_s->current_ssid->bssid, ETH_ALEN) ==
 	    0) {
@@ -1448,82 +1458,32 @@
 		return 0;
 	}
 
-	if (current_bss->noise && selected->noise) {
-		int current_snr, selected_snr;
-		/*
-		 * We have the noise floor for both stations; use SNR
-		 * instead of signal level to decide whether to roam.
-		 */
-		current_snr = MIN(current_bss->level - current_bss->noise,
-		    GREAT_SNR);
-		/* TOD0(sleffler) depends on band? */
-		if (current_snr >= wpa_s->conf->roam_threshold) {
-			/*
-			 * Never roam unless signal is "weak".
-			 */
-			wpa_dbg(wpa_s, MSG_DEBUG, "Skip roam - current snr %d "
-				"exceeds weak threshold", current_snr);
-			return 0;
-		}
-		selected_snr = MIN(selected->level - selected->noise,
-		    GREAT_SNR);
+	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;
+	}
 
-		wpa_dbg(wpa_s, MSG_DEBUG, "Considering within-ESS reassociation");
-		wpa_dbg(wpa_s, MSG_DEBUG, "Current BSS: " MACSTR " snr=%d",
-			MAC2STR(current_bss->bssid), current_snr);
-		wpa_dbg(wpa_s, MSG_DEBUG, "Selected BSS: " MACSTR " snr=%d",
-			MAC2STR(selected->bssid), selected_snr);
+	if (to_5ghz) {
+		/* Make it easier to move to 5 GHz band */
+		if (min_diff > 2)
+			min_diff -= 2;
+		else
+			min_diff = 0;
+	}
 
-		/*
-		 * Never roam for less than ROAM_SNR_MIN_DIFF improvement
-		 * (should be at least 3dBm); that represents at least 2x
-		 * signal strength.  Note that we know the SNR for the
-		 * current AP is <= ROAM_SNR_WEAK_THRESHOLD so ROAM_SNR_MIN_DIFF
-		 * should represent a significant improvement.
-		 *
-		 * NB: wpa_scan_result_compar usually sorts scan results by
-		 *     SNR but under some rare occurences this may not be
-		 *     true and this is handled here
-		 */
-		if ((selected_snr - current_snr) < wpa_s->conf->roam_min) {
-			wpa_dbg(wpa_s, MSG_DEBUG, "Skip roam - selected snr "
-				"not enough better than current");
-			return 0;
-		}
-	} else {
-		int min_diff;
-
-		wpa_dbg(wpa_s, MSG_DEBUG, "Considering within-ESS reassociation");
-		wpa_dbg(wpa_s, MSG_DEBUG, "Current BSS: " MACSTR " level=%d",
-			MAC2STR(current_bss->bssid), current_bss->level);
-		wpa_dbg(wpa_s, MSG_DEBUG, "Selected BSS: " MACSTR " level=%d",
-			MAC2STR(selected->bssid), selected->level);
-
-		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 (to_5ghz) {
-			/* Make it easier to move to 5 GHz band */
-			if (min_diff > 2)
-				min_diff -= 2;
-			else
-				min_diff = 0;
-		}
-		if (abs(current_bss->level - selected->level) < min_diff) {
-			wpa_dbg(wpa_s, MSG_DEBUG, "Skip roam - too small "
-				"difference in signal level");
-			return 0;
-		}
+	if (abs(current_bss->level - selected->level) < min_diff) {
+		wpa_dbg(wpa_s, MSG_DEBUG, "Skip roam - too small difference "
+			"in signal level");
+		return 0;
 	}
 
 	return 1;