diff --git a/umac/scan/core/src/wlan_scan_cache_db.c b/umac/scan/core/src/wlan_scan_cache_db.c index 50b33ceaa5..e801e28674 100644 --- a/umac/scan/core/src/wlan_scan_cache_db.c +++ b/umac/scan/core/src/wlan_scan_cache_db.c @@ -206,32 +206,39 @@ scm_get_next_node(struct scan_dbs *scan_db, * scm_check_and_age_out() - check and age out the old entries * @scan_db: scan db * @scan_node: node to check for age out + * @scan_aging_time: scan cache aging time * * Return: void */ static void scm_check_and_age_out(struct scan_dbs *scan_db, - struct scan_cache_node *node) + struct scan_cache_node *node, + uint32_t scan_aging_time) { if (util_scan_entry_age(node->entry) >= - SCAN_CACHE_AGING_TIME) { - scm_err("Aging out BSSID: %pM with age %d ms", + scan_aging_time) { + scm_info("Aging out BSSID: %pM with age %d ms", node->entry->bssid.bytes, util_scan_entry_age(node->entry)); scm_scan_entry_put_ref(scan_db, node, true); } } -void scm_age_out_entries(struct scan_dbs *scan_db) +void scm_age_out_entries(struct wlan_objmgr_psoc *psoc, + struct scan_dbs *scan_db) { int i; struct scan_cache_node *cur_node = NULL; struct scan_cache_node *next_node = NULL; + struct scan_default_params *def_param; + + def_param = wlan_scan_psoc_get_def_params(psoc); for (i = 0 ; i < SCAN_HASH_SIZE; i++) { cur_node = scm_get_next_node(scan_db, &scan_db->scan_hash_tbl[i], NULL); while (cur_node) { - scm_check_and_age_out(scan_db, cur_node); + scm_check_and_age_out(scan_db, cur_node, + def_param->scan_cache_aging_time); next_node = scm_get_next_node(scan_db, &scan_db->scan_hash_tbl[i], cur_node); cur_node = next_node; @@ -597,6 +604,7 @@ free_nbuf: /** * scm_list_insert_sorted() - add the entries in scan_list in sorted way + * @psoc: psoc ptr * @filter: scan filter * @scan_node: node entry to be inserted * @scan_list: Temp scan list @@ -607,21 +615,19 @@ free_nbuf: * * Return: void */ -static void scm_list_insert_sorted(struct scan_filter *filter, +static void scm_list_insert_sorted(struct wlan_objmgr_psoc *psoc, + struct scan_filter *filter, struct scan_cache_node *scan_node, qdf_list_t *scan_list) { struct scan_cache_node *cur_node; qdf_list_node_t *cur_lst = NULL, *next_lst = NULL; + struct scan_default_params *params; - scan_node->entry->cap_val = - scm_get_bss_cap_value(filter, scan_node->entry); + params = wlan_scan_psoc_get_def_params(psoc); - scan_node->entry->prefer_value = - scm_get_bss_prefer_value(filter, scan_node->entry); - - if (filter->num_of_pcl_channels) - scm_calc_pref_val_by_pcl(filter, scan_node->entry); + scm_calculate_bss_score(params, filter, + scan_node->entry); if (qdf_list_empty(scan_list)) { qdf_list_insert_front(scan_list, &scan_node->node); @@ -633,7 +639,7 @@ static void scm_list_insert_sorted(struct scan_filter *filter, while (cur_lst) { cur_node = qdf_container_of(cur_lst, struct scan_cache_node, node); - if (scm_is_better_bss(filter, + if (scm_is_better_bss(params, scan_node->entry, cur_node->entry)) { qdf_list_insert_before(scan_list, &scan_node->node, @@ -655,6 +661,7 @@ static void scm_list_insert_sorted(struct scan_filter *filter, /** * scm_scan_apply_filter_get_entry() - apply filter and get the * scan entry + * @psoc: psoc pointer * @db_entry: scan entry * @filter: filter to be applied * @scan_list: scan list to which entry is added @@ -662,7 +669,8 @@ static void scm_list_insert_sorted(struct scan_filter *filter, * Return: QDF_STATUS */ static QDF_STATUS -scm_scan_apply_filter_get_entry(struct scan_cache_entry *db_entry, +scm_scan_apply_filter_get_entry(struct wlan_objmgr_psoc *psoc, + struct scan_cache_entry *db_entry, struct scan_filter *filter, qdf_list_t *scan_list) { @@ -673,7 +681,8 @@ scm_scan_apply_filter_get_entry(struct scan_cache_entry *db_entry, if (!filter) match = true; else - match = scm_filter_match(db_entry, filter, &security); + match = scm_filter_match(psoc, db_entry, + filter, &security); if (!match) return QDF_STATUS_SUCCESS; @@ -697,21 +706,22 @@ scm_scan_apply_filter_get_entry(struct scan_cache_entry *db_entry, qdf_list_insert_front(scan_list, &scan_node->node); else - scm_list_insert_sorted(filter, scan_node, scan_list); + scm_list_insert_sorted(psoc, filter, scan_node, scan_list); return QDF_STATUS_SUCCESS; } /** * scm_get_results() - Iterate and get scan results + * @psoc: psoc ptr * @scan_db: scan db * @filter: filter to be applied * @scan_list: scan list to which entry is added * * Return: void */ -static void scm_get_results(struct scan_dbs *scan_db, - struct scan_filter *filter, +static void scm_get_results(struct wlan_objmgr_psoc *psoc, + struct scan_dbs *scan_db, struct scan_filter *filter, qdf_list_t *scan_list) { int i, count; @@ -725,7 +735,7 @@ static void scm_get_results(struct scan_dbs *scan_db, if (!count) continue; while (cur_node) { - scm_scan_apply_filter_get_entry( + scm_scan_apply_filter_get_entry(psoc, cur_node->entry, filter, scan_list); next_node = scm_get_next_node(scan_db, &scan_db->scan_hash_tbl[i], cur_node); @@ -787,6 +797,7 @@ qdf_list_t *scm_get_scan_result(struct wlan_objmgr_pdev *pdev, scm_err("psoc is NULL"); return NULL; } + scan_db = wlan_pdev_get_scan_db(psoc, pdev); if (!scan_db) { scm_err("scan_db is NULL"); @@ -801,8 +812,8 @@ qdf_list_t *scm_get_scan_result(struct wlan_objmgr_pdev *pdev, qdf_list_create(tmp_list, MAX_SCAN_CACHE_SIZE); - scm_age_out_entries(scan_db); - scm_get_results(scan_db, filter, tmp_list); + scm_age_out_entries(psoc, scan_db); + scm_get_results(psoc, scan_db, filter, tmp_list); return tmp_list; } @@ -877,7 +888,7 @@ scm_iterate_scan_db(struct wlan_objmgr_pdev *pdev, return QDF_STATUS_E_INVAL; } - scm_age_out_entries(scan_db); + scm_age_out_entries(psoc, scan_db); status = scm_iterate_db_and_call_func(scan_db, func, arg); return status; @@ -886,6 +897,7 @@ scm_iterate_scan_db(struct wlan_objmgr_pdev *pdev, /** * scm_scan_apply_filter_flush_entry() -flush scan entries depending * on filter + * @psoc: psoc ptr * @scan_db: scan db * @db_node: node on which filters are applied * @filter: filter to be applied @@ -893,7 +905,8 @@ scm_iterate_scan_db(struct wlan_objmgr_pdev *pdev, * Return: QDF_STATUS */ static QDF_STATUS -scm_scan_apply_filter_flush_entry(struct scan_dbs *scan_db, +scm_scan_apply_filter_flush_entry(struct wlan_objmgr_psoc *psoc, + struct scan_dbs *scan_db, struct scan_cache_node *db_node, struct scan_filter *filter) { @@ -903,7 +916,8 @@ scm_scan_apply_filter_flush_entry(struct scan_dbs *scan_db, if (!filter) match = true; else - match = scm_filter_match(db_node->entry, filter, &security); + match = scm_filter_match(psoc, db_node->entry, + filter, &security); if (!match) return QDF_STATUS_SUCCESS; @@ -915,12 +929,14 @@ scm_scan_apply_filter_flush_entry(struct scan_dbs *scan_db, /** * scm_flush_scan_entries() - API to flush scan entries depending on filters + * @psoc: psoc ptr * @scan_db: scan db * @filter: filter * * Return: void */ -static void scm_flush_scan_entries(struct scan_dbs *scan_db, +static void scm_flush_scan_entries(struct wlan_objmgr_psoc *psoc, + struct scan_dbs *scan_db, struct scan_filter *filter) { int i; @@ -931,7 +947,7 @@ static void scm_flush_scan_entries(struct scan_dbs *scan_db, cur_node = scm_get_next_node(scan_db, &scan_db->scan_hash_tbl[i], NULL); while (cur_node) { - scm_scan_apply_filter_flush_entry(scan_db, + scm_scan_apply_filter_flush_entry(psoc, scan_db, cur_node, filter); next_node = scm_get_next_node(scan_db, &scan_db->scan_hash_tbl[i], cur_node); @@ -966,7 +982,7 @@ QDF_STATUS scm_flush_results(struct wlan_objmgr_pdev *pdev, return QDF_STATUS_E_INVAL; } - scm_flush_scan_entries(scan_db, filter); + scm_flush_scan_entries(psoc, scan_db, filter); return status; } @@ -1112,7 +1128,7 @@ QDF_STATUS scm_db_deinit(struct wlan_objmgr_psoc *psoc) continue; } - scm_flush_scan_entries(scan_db, NULL); + scm_flush_scan_entries(psoc, scan_db, NULL); for (j = 0; j < SCAN_HASH_SIZE; j++) qdf_list_destroy(&scan_db->scan_hash_tbl[j]); qdf_spinlock_destroy(&scan_db->scan_db_lock); diff --git a/umac/scan/core/src/wlan_scan_cache_db.h b/umac/scan/core/src/wlan_scan_cache_db.h index b22634d5af..ed4e8314b3 100644 --- a/umac/scan/core/src/wlan_scan_cache_db.h +++ b/umac/scan/core/src/wlan_scan_cache_db.h @@ -73,11 +73,13 @@ QDF_STATUS scm_handle_bcn_probe(struct scheduler_msg *msg); /** * scm_age_out_entries() - Age out entries older than aging time + * @psoc: psoc pointer * @scan_db: scan database * * Return: void. */ -void scm_age_out_entries(struct scan_dbs *scan_db); +void scm_age_out_entries(struct wlan_objmgr_psoc *psoc, + struct scan_dbs *scan_db); /** * scm_get_scan_result() - fetches scan result diff --git a/umac/scan/core/src/wlan_scan_cache_db_i.h b/umac/scan/core/src/wlan_scan_cache_db_i.h index 3b6fdfce01..d863eb2e63 100644 --- a/umac/scan/core/src/wlan_scan_cache_db_i.h +++ b/umac/scan/core/src/wlan_scan_cache_db_i.h @@ -25,33 +25,21 @@ /** * scm_filter_match() - private API to check if entry is match to filter + * psoc: psoc ptr; * @db_entry: db entry * @filter: filter * @security: negotiated security if match is found * * Return: true if entry match filter */ -bool scm_filter_match(struct scan_cache_entry *db_entry, +bool scm_filter_match(struct wlan_objmgr_psoc *psoc, + struct scan_cache_entry *db_entry, struct scan_filter *filter, struct security_info *security); -/** - * scm_get_bss_prefer_value() - Get the preference value for BSS - * @filter: scan filter - * @entry: entry - * - * Each BSS should be assigned a preference value ranging from - * 14-0, which will be used as an RSSI bucket score while sorting the - * scan results. - * - * Return: Preference value for the BSSID - */ -uint32_t scm_get_bss_prefer_value(struct scan_filter *filter, - struct scan_cache_entry *entry); - /** * scm_is_better_bss() - Is bss1 better than bss2 - * @filter: scan filter + * @params: scan params * @bss1: Pointer to the first BSS. * @bss2: Pointer to the second BSS. * @@ -62,20 +50,10 @@ uint32_t scm_get_bss_prefer_value(struct scan_filter *filter, * Return: true, if bss1 is better than bss2 * false, if bss2 is better than bss1. */ -bool scm_is_better_bss(struct scan_filter *filter, +bool scm_is_better_bss(struct scan_default_params *params, struct scan_cache_entry *bss1, struct scan_cache_entry *bss2); -/** - * scm_get_bss_cap_value() - get bss capability value - * @filter: filter - * @entry: scan entry entry - * - * Return: CapValue base on the capabilities of a BSS - */ -uint32_t scm_get_bss_cap_value(struct scan_filter *filter, - struct scan_cache_entry *entry); - /** * is_channel_found_in_pcl() - to check if channel is present in pcl * @channel_id: channel of bss @@ -106,6 +84,7 @@ static inline bool is_channel_found_in_pcl(int channel_id, /** * scm_derive_prefer_value_from_rssi() - to derive prefer value + * @params: scan params * @filter: filter * @rssi: RSSI of the BSS * @@ -113,14 +92,15 @@ static inline bool is_channel_found_in_pcl(int channel_id, * * Return: value between 0 to 14 */ -static inline int scm_derive_prefer_value_from_rssi(struct scan_filter *filter, +static inline int +scm_derive_prefer_value_from_rssi(struct scan_default_params *params, int rssi) { int i = SCM_NUM_RSSI_CAT - 1, pref_val = 0; while (i >= 0) { - if (rssi >= filter->rssi_cat[i]) { - pref_val = filter->bss_prefer_val[i]; + if (rssi >= params->rssi_cat[i]) { + pref_val = params->bss_prefer_val[i]; break; } i--; @@ -130,17 +110,16 @@ static inline int scm_derive_prefer_value_from_rssi(struct scan_filter *filter, } /** - * scm_calc_pref_val_by_pcl() - to calculate preferred value + * scm_calculate_bss_score() - calculate BSS score used to get + * the preference + * @params: scan params * @filter: filter to find match from scan result - * @bss_descr: pointer to bss descriptor + * @entry: scan entry for which score needs to be calculated * - * this routine calculates the new preferred value to be given to - * provided bss if its channel falls under preferred channel list. - * Thump rule is higer the RSSI better the boost. - * - * Return: success or failure + * Return: scan db for the pdev id */ -QDF_STATUS scm_calc_pref_val_by_pcl(struct scan_filter *filter, +void scm_calculate_bss_score(struct scan_default_params *params, + struct scan_filter *filter, struct scan_cache_entry *entry); /** diff --git a/umac/scan/core/src/wlan_scan_cache_db_ops.c b/umac/scan/core/src/wlan_scan_cache_db_ops.c index 2d4c533231..8dd50b9a9a 100644 --- a/umac/scan/core/src/wlan_scan_cache_db_ops.c +++ b/umac/scan/core/src/wlan_scan_cache_db_ops.c @@ -28,7 +28,7 @@ /** * scm_get_altered_rssi() - Artificially increase/decrease RSSI - * @filter: scan filter + * @params: scan params * @rssi: Actual RSSI of the AP. * @channel_id: Channel on which the AP is parked. * @bssid: BSSID of the AP to connect to. @@ -40,7 +40,7 @@ * * Return: The modified RSSI Value */ -static int scm_get_altered_rssi(struct scan_filter *filter, +static int scm_get_altered_rssi(struct scan_default_params *params, int rssi, uint8_t channel_id, struct qdf_mac_addr *bssid) { int modified_rssi; @@ -49,7 +49,7 @@ static int scm_get_altered_rssi(struct scan_filter *filter, int i; struct roam_filter_params *roam_params; - roam_params = &filter->roam_params; + roam_params = ¶ms->roam_params; modified_rssi = rssi; /* @@ -94,7 +94,7 @@ static int scm_get_altered_rssi(struct scan_filter *filter, /** * scm_is_better_rssi() - Is bss1 better than bss2 - * @filter: scan filter + * @params: scan params * @bss1: Pointer to the first BSS. * @bss2: Pointer to the second BSS. * @@ -105,7 +105,7 @@ static int scm_get_altered_rssi(struct scan_filter *filter, * Return: true, if bss1 is better than bss2 * false, if bss2 is better than bss1. */ -static bool scm_is_better_rssi(struct scan_filter *filter, +static bool scm_is_better_rssi(struct scan_default_params *params, struct scan_cache_entry *bss1, struct scan_cache_entry *bss2) { bool ret; @@ -120,12 +120,12 @@ static bool scm_is_better_rssi(struct scan_filter *filter, */ qdf_mem_copy(local_mac.bytes, bss1->bssid.bytes, QDF_MAC_ADDR_SIZE); - rssi1 = scm_get_altered_rssi(filter, rssi1, + rssi1 = scm_get_altered_rssi(params, rssi1, bss1->channel.chan_idx, &local_mac); qdf_mem_copy(local_mac.bytes, bss2->bssid.bytes, QDF_MAC_ADDR_SIZE); - rssi2 = scm_get_altered_rssi(filter, rssi2, + rssi2 = scm_get_altered_rssi(params, rssi2, bss2->channel.chan_idx, &local_mac); if (rssi1 > rssi2) @@ -136,7 +136,7 @@ static bool scm_is_better_rssi(struct scan_filter *filter, return ret; } -bool scm_is_better_bss(struct scan_filter *filter, +bool scm_is_better_bss(struct scan_default_params *params, struct scan_cache_entry *bss1, struct scan_cache_entry *bss2) { @@ -149,7 +149,7 @@ bool scm_is_better_bss(struct scan_filter *filter, if (bss1->cap_val > bss2->cap_val) ret = true; else if (bss1->cap_val == bss2->cap_val) { - if (scm_is_better_rssi(filter, bss1, bss2)) + if (scm_is_better_rssi(params, bss1, bss2)) ret = true; else ret = false; @@ -163,7 +163,18 @@ bool scm_is_better_bss(struct scan_filter *filter, return ret; } -uint32_t scm_get_bss_prefer_value(struct scan_filter *filter, +/** + * scm_get_bss_prefer_value() - Get the preference value for BSS + * @params: scan params + * @entry: entry + * + * Each entry should be assigned a preference value ranging from + * 14-0, which will be used as an RSSI bucket score while sorting the + * scan results. + * + * Return: Preference value for the BSSID + */ +static uint32_t scm_get_bss_prefer_value(struct scan_default_params *params, struct scan_cache_entry *entry) { uint32_t ret = 0; @@ -173,27 +184,35 @@ uint32_t scm_get_bss_prefer_value(struct scan_filter *filter, * The RSSI does not get modified in case the 5G * preference or preferred BSSID is not applicable */ - modified_rssi = scm_get_altered_rssi(filter, + modified_rssi = scm_get_altered_rssi(params, entry->rssi_raw, entry->channel.chan_idx, &entry->bssid); - ret = scm_derive_prefer_value_from_rssi(filter, modified_rssi); + ret = scm_derive_prefer_value_from_rssi(params, modified_rssi); return ret; } -uint32_t scm_get_bss_cap_value(struct scan_filter *filter, +/** + * scm_get_bss_cap_value() - get bss capability value + * @params: def scan params + * @entry: scan entry entry + * + * Return: CapValue base on the capabilities of a BSS + */ +static uint32_t scm_get_bss_cap_value(struct scan_default_params *params, struct scan_cache_entry *entry) { uint32_t ret = SCM_BSS_CAP_VALUE_NONE; - if (filter->roam_params.is_5g_pref_enabled) + if (params->prefer_5ghz || + params->roam_params.is_5g_pref_enabled) if (WLAN_CHAN_IS_5GHZ(entry->channel.chan_idx)) ret += SCM_BSS_CAP_VALUE_5GHZ; /* * if strict select 5GHz is set then ignore * the capability checking */ - if (!filter->strict_sel_5g) { + if (!params->select_5ghz_margin) { /* We only care about 11N capability */ if (entry->ie_list.vhtcap) ret += SCM_BSS_CAP_VALUE_VHT; @@ -209,7 +228,20 @@ uint32_t scm_get_bss_cap_value(struct scan_filter *filter, return ret; } -QDF_STATUS scm_calc_pref_val_by_pcl(struct scan_filter *filter, +/** + * scm_calc_pref_val_by_pcl() - to calculate preferred value + * @params: scan params + * @filter: filter to find match from scan result + * @entry: scan entry for which score needs to be calculated + * + * this routine calculates the new preferred value to be given to + * provided bss if its channel falls under preferred channel list. + * Thump rule is higer the RSSI better the boost. + * + * Return: success or failure + */ +static QDF_STATUS scm_calc_pref_val_by_pcl(struct scan_default_params *params, + struct scan_filter *filter, struct scan_cache_entry *entry) { int temp_rssi = 0, new_pref_val = 0; @@ -225,14 +257,14 @@ QDF_STATUS scm_calc_pref_val_by_pcl(struct scan_filter *filter, if (is_channel_found_in_pcl(entry->channel.chan_idx, filter) && (entry->rssi_raw > SCM_PCL_RSSI_THRESHOLD)) { - orig_pref_val = scm_derive_prefer_value_from_rssi(filter, + orig_pref_val = scm_derive_prefer_value_from_rssi(params, entry->rssi_raw); temp_rssi = entry->rssi_raw + (SCM_PCL_ADVANTAGE/(SCM_NUM_RSSI_CAT - orig_pref_val)); if (temp_rssi > 0) temp_rssi = 0; - new_pref_val = scm_derive_prefer_value_from_rssi(filter, + new_pref_val = scm_derive_prefer_value_from_rssi(params, temp_rssi); entry->prefer_value = @@ -242,6 +274,18 @@ QDF_STATUS scm_calc_pref_val_by_pcl(struct scan_filter *filter, return QDF_STATUS_SUCCESS; } +void scm_calculate_bss_score(struct scan_default_params *params, + struct scan_filter *filter, struct scan_cache_entry *entry) +{ + entry->cap_val = + scm_get_bss_cap_value(params, entry); + + entry->prefer_value = + scm_get_bss_prefer_value(params, entry); + + if (filter->num_of_pcl_channels) + scm_calc_pref_val_by_pcl(params, filter, entry); +} /** * scm_is_open_security() - Check if scan entry support open security @@ -933,15 +977,18 @@ static bool scm_is_security_match(struct scan_filter *filter, return match; } -bool scm_filter_match(struct scan_cache_entry *db_entry, +bool scm_filter_match(struct wlan_objmgr_psoc *psoc, + struct scan_cache_entry *db_entry, struct scan_filter *filter, struct security_info *security) { int i; bool match = false; struct roam_filter_params *roam_params; + struct scan_default_params *def_param; - roam_params = &filter->roam_params; + def_param = wlan_scan_psoc_get_def_params(psoc); + roam_params = &def_param->roam_params; if (filter->p2p_results && !db_entry->is_p2p) return false; diff --git a/umac/scan/core/src/wlan_scan_main.h b/umac/scan/core/src/wlan_scan_main.h index af30de29b0..d5111b39f0 100644 --- a/umac/scan/core/src/wlan_scan_main.h +++ b/umac/scan/core/src/wlan_scan_main.h @@ -54,6 +54,8 @@ #define WLAN_HOST_SCAN_REQ_ID_PREFIX 0x0000A000 #define WLAN_SCAN_REQUESTER_ID_PREFIX 0x0000A000 +#define SCM_NUM_RSSI_CAT 15 + #ifdef CONFIG_MCL #define SCAN_ACTIVE_DWELL_TIME 40 #define SCAN_PASSIVE_DWELL_TIME 110 @@ -92,7 +94,7 @@ #define SCAN_TIMEOUT_GRACE_PERIOD 10 /* scan age time in millisec */ -#define SCAN_CACHE_AGING_TIME (300*1000) +#define SCAN_CACHE_AGING_TIME (30 * 1000) #define SCAN_MAX_BSS_PDEV 100 #define SCAN_PRIORITY SCAN_PRIORITY_LOW @@ -198,6 +200,12 @@ struct pno_def_config { * @max_scan_time: default max scan time * @num_probes: default maximum number of probes to sent * @cache_aging_time: default scan cache aging time + * @prefer_5ghz: Prefer 5ghz AP over 2.4Ghz AP + * @select_5gh_margin: Prefer connecting to 5G AP even if + * its RSSI is lower by select_5gh_margin dbm than 2.4G AP. + * applicable if prefer_5ghz is set. + * @bss_prefer_val: bss prefer value for the RSSI category + * @rssi_cat: RSSI category * @max_bss_per_pdev: maximum number of bss entries to be maintained per pdev * @max_active_scans_allowed: maximum number of active parallel scan allowed * per psoc @@ -240,6 +248,7 @@ struct pno_def_config { * @scan_ev_resumed: notify scan resumed event * @scan_events: variable to read and set scan_ev_* flags in one shot * can be used to dump all scan_ev_* flags for debug + * @roam_params: roam related params */ struct scan_default_params { uint32_t active_dwell; @@ -259,6 +268,11 @@ struct scan_default_params { uint32_t max_scan_time; uint32_t num_probes; uint32_t scan_cache_aging_time; + uint32_t prefer_5ghz; + uint32_t select_5ghz_margin; + /* each RSSI category has one value */ + uint32_t bss_prefer_val[SCM_NUM_RSSI_CAT]; + int rssi_cat[SCM_NUM_RSSI_CAT]; uint16_t max_bss_per_pdev; uint32_t max_active_scans_allowed; enum scan_priority scan_priority; @@ -311,6 +325,7 @@ struct scan_default_params { }; uint32_t scan_events; }; + struct roam_filter_params roam_params; }; /** diff --git a/umac/scan/dispatcher/inc/wlan_scan_public_structs.h b/umac/scan/dispatcher/inc/wlan_scan_public_structs.h index ad1f6b865d..3baef39b31 100644 --- a/umac/scan/dispatcher/inc/wlan_scan_public_structs.h +++ b/umac/scan/dispatcher/inc/wlan_scan_public_structs.h @@ -37,7 +37,6 @@ typedef uint32_t wlan_scan_id; #define SCM_PCL_ADVANTAGE 30 #define SCM_PCL_RSSI_THRESHOLD -75 -#define SCM_NUM_RSSI_CAT 15 #define SCM_BSS_CAP_VALUE_NONE 0/* not much value */ #define SCM_BSS_CAP_VALUE_HT 1 @@ -336,11 +335,7 @@ struct roam_filter_params { * @num_of_mc_enc_type: number of multicast enc type * @pmf_cap: Pmf capability * @num_of_pcl_channels: number of pcl channels - * @bss_prefer_val: bss prefer value for the RSSI category - * @rssi_cat: RSSI category - * @strict_sel_5g: only 5G AP * @bss_type: bss type BSS/IBSS etc - * @country[3]: Ap with specific country code * @dot11_mode: operating modes 0 mean any * 11a , 11g, 11n , 11ac , 11b etc * @band: to get specific band 2.4G, 5G or 4.9 G @@ -350,13 +345,13 @@ struct roam_filter_params { * @ignore_auth_enc_type: Ignore enc type if * this is set (For WPS/OSEN connection) * @mobility_domain: Mobility domain for 11r - * @roam_params: roam related params + * @country[3]: Ap with specific country code * @bssid_list: bssid list * @ssid_list: ssid list * @channel_list: channel list - * @auth_type_list: auth type list - * @enc_type_list: unicast enc type list - * @mc_enc_type_list: multicast cast enc type list + * @auth_type: auth type list + * @enc_type: unicast enc type list + * @mc_enc_type: multicast cast enc type list * @pcl_channel_list: PCL channel list */ struct scan_filter { @@ -371,10 +366,6 @@ struct scan_filter { uint32_t num_of_mc_enc_type; enum wlan_pmf_cap pmf_cap; uint32_t num_of_pcl_channels; - /* each RSSI category has one value */ - uint32_t bss_prefer_val[SCM_NUM_RSSI_CAT]; - int rssi_cat[SCM_NUM_RSSI_CAT]; - uint32_t strict_sel_5g; enum wlan_bss_type bss_type; enum wlan_phymode dot11_mode; enum wlan_band band; @@ -384,7 +375,6 @@ struct scan_filter { uint32_t mobility_domain; /* Variable params list */ uint8_t country[3]; - struct roam_filter_params roam_params; struct qdf_mac_addr bssid_list[WLAN_SCAN_FILTER_NUM_BSSID]; struct wlan_ssid ssid_list[WLAN_SCAN_FILTER_NUM_SSID]; uint8_t channel_list[QDF_MAX_NUM_CHAN]; @@ -937,6 +927,15 @@ struct pno_user_cfg { * @conc_idle_time: default concurrent idle time * @scan_cache_aging_time: default scan cache aging time * @is_snr_monitoring_enabled: whether snr monitoring enabled or not + * @prefer_5ghz: Prefer 5ghz AP over 2.4Ghz AP + * @select_5gh_margin: Prefer connecting to 5G AP even if + * its RSSI is lower by select_5gh_margin dbm than 2.4G AP. + * applicable if prefer_5ghz is set. + * @scan_bucket_threshold: first scan bucket + * threshold to the mentioned value and all the AP's which + * have RSSI under this threshold will fall under this + * bucket + * @rssi_cat_gap: set rssi category gap * @scan_dwell_time_mode: Adaptive dweltime mode * @pno_cfg: Pno related config params */ @@ -950,6 +949,10 @@ struct scan_user_cfg { uint32_t conc_idle_time; uint32_t scan_cache_aging_time; bool is_snr_monitoring_enabled; + uint32_t prefer_5ghz; + uint32_t select_5ghz_margin; + int32_t scan_bucket_threshold; + uint32_t rssi_cat_gap; enum scan_dwelltime_adaptive_mode scan_dwell_time_mode; struct pno_user_cfg pno_cfg; }; diff --git a/umac/scan/dispatcher/inc/wlan_scan_ucfg_api.h b/umac/scan/dispatcher/inc/wlan_scan_ucfg_api.h index f28cb5fb01..503c566ae5 100644 --- a/umac/scan/dispatcher/inc/wlan_scan_ucfg_api.h +++ b/umac/scan/dispatcher/inc/wlan_scan_ucfg_api.h @@ -387,6 +387,16 @@ QDF_STATUS ucfg_scan_register_bcn_cb(struct wlan_objmgr_psoc *psoc, QDF_STATUS ucfg_scan_update_user_config(struct wlan_objmgr_psoc *psoc, struct scan_user_cfg *scan_cfg); +/** + * ucfg_scan_update_roam_params() - Store/Update the roam params + * @psoc: psoc + * @roam_params: roam params + * + * Return: QDF_STATUS + */ +QDF_STATUS ucfg_scan_update_roam_params(struct wlan_objmgr_psoc *psoc, + struct roam_filter_params *roam_params); + /* * ucfg_scan_init() - Scan module initialization API * diff --git a/umac/scan/dispatcher/src/wlan_scan_ucfg_api.c b/umac/scan/dispatcher/src/wlan_scan_ucfg_api.c index fe89800f14..f0ddd4085b 100644 --- a/umac/scan/dispatcher/src/wlan_scan_ucfg_api.c +++ b/umac/scan/dispatcher/src/wlan_scan_ucfg_api.c @@ -926,6 +926,22 @@ ucfg_scan_register_unregister_bcn_cb(struct wlan_objmgr_psoc *psoc, enable ? "Registering" : "Deregistering"); } +static void ucfg_scan_assign_rssi_category(struct scan_default_params *params, + int32_t best_ap_rssi, uint32_t cat_offset) +{ + int i; + + scm_info("best AP RSSI:%d, cat offset: %d", best_ap_rssi, cat_offset); + if (cat_offset) + for (i = 0; i < SCM_NUM_RSSI_CAT; i++) { + params->rssi_cat[SCM_NUM_RSSI_CAT - i - 1] = + (best_ap_rssi - + params->select_5ghz_margin - + (int)(i * cat_offset)); + params->bss_prefer_val[i] = i; + } +} + QDF_STATUS ucfg_scan_update_user_config(struct wlan_objmgr_psoc *psoc, struct scan_user_cfg *scan_cfg) { @@ -951,13 +967,40 @@ QDF_STATUS ucfg_scan_update_user_config(struct wlan_objmgr_psoc *psoc, scan_def->conc_min_rest_time = scan_cfg->conc_min_rest_time; scan_def->conc_idle_time = scan_cfg->conc_idle_time; scan_def->scan_cache_aging_time = scan_cfg->scan_cache_aging_time; + scan_def->prefer_5ghz = scan_cfg->prefer_5ghz; + scan_def->select_5ghz_margin = scan_cfg->select_5ghz_margin; scan_def->adaptive_dwell_time_mode = scan_cfg->scan_dwell_time_mode; scan_def->scan_f_chan_stat_evnt = scan_cfg->is_snr_monitoring_enabled; + ucfg_scan_assign_rssi_category(scan_def, + scan_cfg->scan_bucket_threshold, + scan_cfg->rssi_cat_gap); + return ucfg_scan_update_pno_config(&scan_obj->pno_cfg, &scan_cfg->pno_cfg); } +QDF_STATUS ucfg_scan_update_roam_params(struct wlan_objmgr_psoc *psoc, + struct roam_filter_params *roam_params) +{ + struct scan_default_params *scan_def; + + if (!psoc) { + scm_err("null psoc"); + return QDF_STATUS_E_FAILURE; + } + scan_def = wlan_scan_psoc_get_def_params(psoc); + if (!scan_def) { + scm_err("Failed to get scan object"); + return QDF_STATUS_E_FAILURE; + } + + qdf_mem_copy(&scan_def->roam_params, roam_params, + sizeof(struct roam_filter_params)); + + return QDF_STATUS_SUCCESS; +} + QDF_STATUS ucfg_scan_psoc_open(struct wlan_objmgr_psoc *psoc) {