Browse Source

qcacmn: Fix OCE WAN scoring logic for initial connection

Set the range of score index to 1-15 as 0 is used for the AP
which does not advertise the OCE WAN. Also if OCE WAN downlink
capability is 0 return 0 score.

Change-Id: I8c6757458c542050a6a31cb03fad0ce17d60aa16
CRs-Fixed: 2208282
Abhishek Singh 7 years ago
parent
commit
dba772b9c8
1 changed files with 6 additions and 5 deletions
  1. 6 5
      umac/scan/core/src/wlan_scan_bss_score.c

+ 6 - 5
umac/scan/core/src/wlan_scan_bss_score.c

@@ -59,8 +59,6 @@
 #define SCM_MAX_ESTIMATED_AIR_TIME_FRACTION 255
 #define MAX_AP_LOAD 255
 
-#define SCM_MAX_OCE_WAN_DL_CAP 16
-
 #define SCM_MAX_WEIGHT_OF_PCL_CHANNELS 255
 #define SCM_PCL_GROUPS_WEIGHT_DIFFERENCE 20
 
@@ -612,15 +610,18 @@ static int32_t scm_calculate_oce_wan_score(
 		score_params->oce_wan_scoring.num_slot =
 			SCM_SCORE_MAX_INDEX;
 
-	window_size = SCM_MAX_OCE_WAN_DL_CAP/
+	window_size = SCM_SCORE_MAX_INDEX/
 			score_params->oce_wan_scoring.num_slot;
 	mbo_oce_ie = util_scan_entry_mbo_oce(entry);
 	if (wlan_parse_oce_reduced_wan_metrics_ie(mbo_oce_ie,
 	    &wan_metrics)) {
 		scm_err("downlink_av_cap %d", wan_metrics.downlink_av_cap);
-		/* Desired values are from 1 to 15, as 0 is for not present.*/
+		/* if capacity is 0 return 0 score */
+		if (!wan_metrics.downlink_av_cap)
+			return 0;
+		/* Desired values are from 1 to WLAN_SCORE_MAX_INDEX */
 		index = qdf_do_div(wan_metrics.downlink_av_cap,
-				   window_size) + 1;
+				   window_size);
 	} else {
 		index = SCM_SCORE_INDEX_0;
 	}