diff --git a/umac/mlme/connection_mgr/core/src/wlan_cm_bss_scoring.c b/umac/mlme/connection_mgr/core/src/wlan_cm_bss_scoring.c index ad769daac230..4ca1b3b1cc15 100644 --- a/umac/mlme/connection_mgr/core/src/wlan_cm_bss_scoring.c +++ b/umac/mlme/connection_mgr/core/src/wlan_cm_bss_scoring.c @@ -87,6 +87,7 @@ #define CM_MAX_INDEX_PER_INI 4 #define CM_BEST_CANDIDATE_MAX_BSS_SCORE (CM_BEST_CANDIDATE_MAX_WEIGHT * 100) +#define CM_AVOID_CANDIDATE_MIN_SCORE 1 #define CM_GET_SCORE_PERCENTAGE(value32, bw_index) \ QDF_GET_BITS(value32, (8 * (bw_index)), 8) @@ -970,7 +971,7 @@ static void cm_list_insert_sorted(qdf_list_t *scan_list, qdf_list_insert_back(scan_list, &scan_entry->node); } -void wlan_cm_calculate_bss_score(struct wlan_objmgr_psoc *psoc, +void wlan_cm_calculate_bss_score(struct wlan_objmgr_pdev *pdev, struct pcl_freq_weight_list *pcl_lst, qdf_list_t *scan_list, struct qdf_mac_addr *bssid_hint) @@ -982,7 +983,15 @@ void wlan_cm_calculate_bss_score(struct wlan_objmgr_psoc *psoc, int pcl_chan_weight; QDF_STATUS status; struct psoc_phy_config *config; + enum cm_blacklist_action blacklist_action; + struct wlan_objmgr_psoc *psoc; + psoc = wlan_pdev_get_psoc(pdev); + + if (!psoc) { + mlme_err("psoc NULL"); + return; + } if (!scan_list) { mlme_err("Scan list NULL"); return; @@ -1014,7 +1023,10 @@ void wlan_cm_calculate_bss_score(struct wlan_objmgr_psoc *psoc, scan_entry = qdf_container_of(cur_node, struct scan_cache_node, node); - if (pcl_lst && pcl_lst->num_of_pcl_channels && + blacklist_action = + wlan_blacklist_action_on_bssid(pdev, scan_entry->entry); + if (blacklist_action == CM_BLM_NO_ACTION && + pcl_lst && pcl_lst->num_of_pcl_channels && scan_entry->entry->rssi_raw > CM_PCL_RSSI_THRESHOLD && score_config->weight_config.pcl_weightage) { if (cm_get_pcl_weight_of_channel( @@ -1026,8 +1038,13 @@ void wlan_cm_calculate_bss_score(struct wlan_objmgr_psoc *psoc, } } - cm_calculate_bss_score(psoc, scan_entry->entry, pcl_chan_weight, - bssid_hint); + if (blacklist_action == CM_BLM_NO_ACTION) + cm_calculate_bss_score(psoc, scan_entry->entry, + pcl_chan_weight, bssid_hint); + else if (blacklist_action == CM_BLM_AVOID) + /* add min score so that it is added back in the end */ + scan_entry->entry->bss_score = + CM_AVOID_CANDIDATE_MIN_SCORE; /* Remove node from current locaion to add node back shorted */ status = qdf_list_remove_node(scan_list, cur_node); @@ -1035,8 +1052,16 @@ void wlan_cm_calculate_bss_score(struct wlan_objmgr_psoc *psoc, mlme_err("failed to remove node from scan list"); return; } - /* Add node back shorted */ - cm_list_insert_sorted(scan_list, scan_entry); + /* + * If CM_BLM_REMOVE ie blacklisted then free the entry + * else add back to the list sorted + */ + if (blacklist_action == CM_BLM_REMOVE) { + util_scan_free_cache_entry(scan_entry->entry); + qdf_mem_free(scan_entry); + } else { + cm_list_insert_sorted(scan_list, scan_entry); + } cur_node = next_node; next_node = NULL; } diff --git a/umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_bss_score_param.h b/umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_bss_score_param.h index d4ce9fcefdcf..4b9a70aa24d3 100644 --- a/umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_bss_score_param.h +++ b/umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_bss_score_param.h @@ -148,9 +148,34 @@ struct pcl_freq_weight_list { uint8_t pcl_weight_list[NUM_CHANNELS]; }; +/** + * enum cm_blacklist_action - action taken by blacklist manager for the bssid + * @CM_BLM_NO_ACTION: No operation to be taken for the BSSID in the scan list. + * @CM_BLM_REMOVE: Remove the BSSID from the scan list (AP is blacklisted) + * @CM_BLM_AVOID: Add the Ap at last of the scan list (AP to Avoid) + */ +enum cm_blacklist_action { + CM_BLM_NO_ACTION, + CM_BLM_REMOVE, + CM_BLM_AVOID, +}; + +#ifdef FEATURE_BLACKLIST_MGR +enum cm_blacklist_action +wlan_blacklist_action_on_bssid(struct wlan_objmgr_pdev *pdev, + struct scan_cache_entry *entry); +#else +static inline enum cm_blacklist_action +wlan_blacklist_action_on_bssid(struct wlan_objmgr_pdev *pdev, + struct scan_cache_entry *entry) +{ + return CM_BLM_NO_ACTION; +} +#endif + /** * wlan_cm_calculate_bss_score() - calculate bss score for the scan list - * @psoc: pointer to psoc object + * @pdev: pointer to pdev object * @pcl_list: pcl list for scoring * @scan_list: scan list, contains the input list and after the * func it will have sorted list @@ -158,7 +183,7 @@ struct pcl_freq_weight_list { * * Return: void */ -void wlan_cm_calculate_bss_score(struct wlan_objmgr_psoc *psoc, +void wlan_cm_calculate_bss_score(struct wlan_objmgr_pdev *pdev, struct pcl_freq_weight_list *pcl_lst, qdf_list_t *scan_list, struct qdf_mac_addr *bssid_hint);