Browse Source

qcacld-3.0: Limit the BTM timeout duration for next connection

- Limit the timeout value of the BLM entry if it has big comeback
 value and allow connection to that BSSID.
- Fix the BLM entry time stamp boundary checks.

Change-Id: I07bf7b1fce1c1e8d349c4fc0a9b0fed07f237197
CRs-Fixed: 2741689
gaurank kathpalia 4 years ago
parent
commit
b6dc56c8cc

+ 25 - 12
components/blacklist_mgr/core/src/wlan_blm_core.c

@@ -46,7 +46,7 @@ blm_update_ap_info(struct blm_reject_ap *blm_entry, struct blm_config *cfg,
 		entry_add_time =
 			blm_entry->ap_timestamp.userspace_avoid_timestamp;
 
-		if ((cur_timestamp - entry_add_time) >
+		if ((cur_timestamp - entry_add_time) >=
 		     MINUTES_TO_MS(cfg->avoid_list_exipry_time)) {
 			/* Move AP to monitor list as avoid list time is over */
 			blm_entry->userspace_avoidlist = false;
@@ -62,7 +62,7 @@ blm_update_ap_info(struct blm_reject_ap *blm_entry, struct blm_config *cfg,
 	if (BLM_IS_AP_AVOIDED_BY_DRIVER(blm_entry)) {
 		entry_add_time = blm_entry->ap_timestamp.driver_avoid_timestamp;
 
-		if ((cur_timestamp - entry_add_time) >
+		if ((cur_timestamp - entry_add_time) >=
 		     MINUTES_TO_MS(cfg->avoid_list_exipry_time)) {
 			/* Move AP to monitor list as avoid list time is over */
 			blm_entry->driver_avoidlist = false;
@@ -79,7 +79,7 @@ blm_update_ap_info(struct blm_reject_ap *blm_entry, struct blm_config *cfg,
 		entry_add_time =
 			blm_entry->ap_timestamp.driver_blacklist_timestamp;
 
-		if ((cur_timestamp - entry_add_time) >
+		if ((cur_timestamp - entry_add_time) >=
 		     MINUTES_TO_MS(cfg->black_list_exipry_time)) {
 			/* Move AP to monitor list as black list time is over */
 			blm_entry->driver_blacklist = false;
@@ -97,8 +97,8 @@ blm_update_ap_info(struct blm_reject_ap *blm_entry, struct blm_config *cfg,
 			    blm_entry->ap_timestamp.rssi_reject_timestamp;
 
 		if ((blm_entry->rssi_reject_params.retry_delay &&
-		     entry_age > blm_entry->rssi_reject_params.retry_delay) ||
-		    (scan_entry && (scan_entry->rssi_raw > blm_entry->
+		     entry_age >= blm_entry->rssi_reject_params.retry_delay) ||
+		    (scan_entry && (scan_entry->rssi_raw >= blm_entry->
 					   rssi_reject_params.expected_rssi))) {
 			/*
 			 * Remove from the rssi reject list as:-
@@ -133,6 +133,8 @@ blm_update_ap_info(struct blm_reject_ap *blm_entry, struct blm_config *cfg,
 		  blm_entry->reject_ap_type);
 }
 
+#define MAX_BL_TIME 255000
+
 static enum cm_blacklist_action
 blm_prune_old_entries_and_get_action(struct blm_reject_ap *blm_entry,
 				     struct blm_config *cfg,
@@ -153,6 +155,15 @@ blm_prune_old_entries_and_get_action(struct blm_reject_ap *blm_entry,
 		return CM_BLM_NO_ACTION;
 	}
 
+	if (BLM_IS_AP_IN_RSSI_REJECT_LIST(blm_entry) &&
+	    blm_entry->rssi_reject_params.retry_delay > MAX_BL_TIME) {
+		blm_info("Allow BSSID %pM as the retry delay is greater than %d ms, expected RSSI = %d, current RSSI = %d, retry delay = %d ms",
+			 blm_entry->bssid.bytes, MAX_BL_TIME,
+			 blm_entry->rssi_reject_params.expected_rssi,
+			 entry ? entry->rssi_raw : 0,
+			 blm_entry->rssi_reject_params.retry_delay);
+		return CM_BLM_NO_ACTION;
+	}
 	if (BLM_IS_AP_IN_BLACKLIST(blm_entry))
 		return CM_BLM_REMOVE;
 
@@ -404,16 +415,16 @@ blm_get_delta_of_bssid(enum blm_reject_ap_type list_type,
 	 * de-blacklisting the AP from rssi reject list.
 	 */
 	case DRIVER_RSSI_REJECT_TYPE:
-		if (blm_entry->rssi_reject_params.retry_delay) {
-			return blm_entry->rssi_reject_params.retry_delay -
+		if (blm_entry->rssi_reject_params.retry_delay)
+			disallowed_time =
+				blm_entry->rssi_reject_params.retry_delay -
 				(cur_timestamp -
-				 blm_entry->ap_timestamp.rssi_reject_timestamp);
-		} else {
+				blm_entry->ap_timestamp.rssi_reject_timestamp);
+		else
 			disallowed_time = (int32_t)(MINUTES_TO_MS(RSSI_TIMEOUT_VALUE) -
 				(cur_timestamp -
 				 blm_entry->ap_timestamp.rssi_reject_timestamp));
-			return ((disallowed_time < 0) ? 0 : disallowed_time);
-		}
+		return ((disallowed_time < 0) ? 0 : disallowed_time);
 	case DRIVER_MONITOR_TYPE:
 		return cur_timestamp -
 			       blm_entry->ap_timestamp.driver_monitor_timestamp;
@@ -601,8 +612,10 @@ static void blm_fill_reject_list(qdf_list_t *reject_db_list,
 			reject_list[*num_of_reject_bssid].bssid =
 							blm_entry->bssid;
 			(*num_of_reject_bssid)++;
-			blm_debug("Adding BSSID %pM of type %d to reject ap list, total entries added yet = %d",
+			blm_debug("Adding BSSID %pM of type %d retry delay %d expected RSSI %d, entries added = %d",
 				  blm_entry->bssid.bytes, reject_ap_type,
+				  reject_list[*num_of_reject_bssid -1].reject_duration,
+				  blm_entry->rssi_reject_params.expected_rssi,
 				  *num_of_reject_bssid);
 		}
 		cur_node = next_node;

+ 2 - 0
core/mac/src/pe/lim/lim_process_sme_req_messages.c

@@ -6128,6 +6128,8 @@ void lim_add_roam_blacklist_ap(struct mac_context *mac_ctx,
 	struct sir_rssi_disallow_lst entry;
 	struct roam_blacklist_timeout *blacklist;
 
+	pe_debug("Received Blacklist event from FW num entries %d",
+		 src_lst->num_entries);
 	blacklist = &src_lst->roam_blacklist[0];
 	for (i = 0; i < src_lst->num_entries; i++) {