diff options
| author | CNSS_WLAN Service <cnssbldsw@qualcomm.com> | 2017-08-17 00:26:10 -0700 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2017-08-17 00:26:10 -0700 |
| commit | 71f9fa952e8989b32f542d693bd4d4b09edc0c35 (patch) | |
| tree | 43a8564770b88668e08955eaeafed29ea11e9908 | |
| parent | 68a7d060e3736766341bc2fbca0ea4949a0b8cb3 (diff) | |
| parent | b04183b7f6d040feb87d1928a4525214dcfae6c3 (diff) | |
Merge "qcacld-3.0: Add ESP and NSS param for candidate select algo" into wlan-cld3.driver.lnx.1.1
| -rw-r--r-- | core/mac/inc/ani_global.h | 1 | ||||
| -rw-r--r-- | core/mac/inc/sir_api.h | 11 | ||||
| -rw-r--r-- | core/mac/src/include/parser_api.h | 48 | ||||
| -rw-r--r-- | core/mac/src/pe/lim/lim_prop_exts_utils.c | 14 | ||||
| -rw-r--r-- | core/mac/src/pe/lim/lim_scan_result_utils.c | 2 | ||||
| -rw-r--r-- | core/mac/src/sys/legacy/src/utils/src/parser_api.c | 8 | ||||
| -rw-r--r-- | core/sme/src/csr/csr_api_scan.c | 120 | ||||
| -rw-r--r-- | core/sme/src/csr/csr_inside_api.h | 25 |
8 files changed, 132 insertions, 97 deletions
diff --git a/core/mac/inc/ani_global.h b/core/mac/inc/ani_global.h index 72808f82ff9b..ddcd5963aae1 100644 --- a/core/mac/inc/ani_global.h +++ b/core/mac/inc/ani_global.h @@ -974,7 +974,6 @@ typedef struct sAniSirGlobal { bool sta_prefer_80MHz_over_160MHz; enum country_src reg_hint_src; uint32_t rx_packet_drop_counter; - struct candidate_chan_info candidate_channel_info[QDF_MAX_NUM_CHAN]; bool snr_monitor_enabled; /* channel information callback */ void (*chan_info_cb)(struct scan_chan_info *chan_info); diff --git a/core/mac/inc/sir_api.h b/core/mac/inc/sir_api.h index 8cf2b92bcb57..9caeeaf110f6 100644 --- a/core/mac/inc/sir_api.h +++ b/core/mac/inc/sir_api.h @@ -3188,17 +3188,6 @@ typedef struct { #endif /* FEATURE_WLAN_SCAN_PNO */ -/** - * struct candidate_chan_info - channel information for candidate - * @channel_num: channel number. - * @other_ap_count: other ap count on candidate channel. - * @max_rssi_on_channel: Max best rssi on candiate channel - */ -struct candidate_chan_info { - uint8_t channel_num; - uint8_t ap_count; -}; - /* * ALLOWED_ACTION_FRAMES_BITMAP * diff --git a/core/mac/src/include/parser_api.h b/core/mac/src/include/parser_api.h index 6d110ed64b1c..03254a484df3 100644 --- a/core/mac/src/include/parser_api.h +++ b/core/mac/src/include/parser_api.h @@ -193,6 +193,13 @@ struct sir_fils_indication { }; #endif #define ESP_INFORMATION_LIST_LENGTH 24 +/* + * enum access_category: tells about access category in ESP paramameter + * @ESP_AC_BK: ESP access category for background + * @ESP_AC_BE: ESP access category for best effort + * @ESP_AC_VI: ESP access category for video + * @ESP_AC_VO: ESP access category for Voice + */ enum access_category { ESP_AC_BK, ESP_AC_BE, @@ -200,6 +207,38 @@ enum access_category { ESP_AC_VO, }; +/* + * struct sir_esp_info: structure for Esp information parameter + * @access_category: access category info + * @reserved: reserved + * @data_format: two bits in length and tells about data format + * i.e. 0 = No aggregation is expected to be performed for MSDUs or MPDUs with + * the Type subfield equal to Data for the corresponding AC + * 1 = A-MSDU aggregation is expected to be performed for MSDUs for the + * corresponding AC, but A-MPDU aggregation is not expected to be performed + * for MPDUs with the Type subfield equal to Data for the corresponding AC + * 2 = A-MPDU aggregation is expected to be performed for MPDUs with the Type + * subfield equal to Data for the corresponding AC, but A-MSDU aggregation is + * not expected to be performed for MSDUs for the corresponding AC + * 3 = A-MSDU aggregation is expected to be performed for MSDUs for the + * corresponding AC and A-MPDU aggregation is expected to be performed for + * MPDUs with the Type subfield equal to Data for the corresponding AC + * @ba_window_size: BA Window Size subfield is three bits in length and + * indicates the size of the Block Ack window that is + * expected for the corresponding access category + * @estimated_air_fraction: Estimated Air Time Fraction subfield is 8 bits in + * length and contains an unsigned integer that represents + * the predicted percentage of time, linearly scaled with 255 representing + * 100%, that a new STA joining the + * BSS will be allocated for PPDUs that contain only MPDUs with the Type + * subfield equal to Data of the + * corresponding access category for that STA. + * @ppdu_duration: Data PPDU Duration Target field is 8 bits in length and is + * an unsigned integer that indicates the + * expected target duration of PPDUs that contain only MPDUs with the Type + * subfield equal to Data for the + * corresponding access category in units of 50 μs. + */ struct sir_esp_info { uint8_t access_category:2; uint8_t reserved:1; @@ -208,7 +247,14 @@ struct sir_esp_info { uint8_t estimated_air_fraction; uint8_t ppdu_duration; }; - +/* + * struct sir_esp_information: struct for ESP information + * @is_present: If ESP information is present or not + * @esp_info_AC_BK: ESP information related to BK category + * @esp_info_AC_BE: ESP information related to BE category + * @esp_info_AC_VI: ESP information related to VI category + * @esp_info_AC_VO: ESP information related to VO category + */ struct sir_esp_information { bool is_present; struct sir_esp_info esp_info_AC_BK; diff --git a/core/mac/src/pe/lim/lim_prop_exts_utils.c b/core/mac/src/pe/lim/lim_prop_exts_utils.c index 9f8222cfa387..9b09e6a060ff 100644 --- a/core/mac/src/pe/lim/lim_prop_exts_utils.c +++ b/core/mac/src/pe/lim/lim_prop_exts_utils.c @@ -110,13 +110,14 @@ static inline void get_ese_version_ie_probe_response(tpAniSirGlobal mac_ctx, #endif /** - * lim_get_nss_supported_by_beacon() - finds out nss from beacom + * lim_get_nss_supported_by_sta_and_ap() - finds out nss from session + * and beacon from AP * @bcn: beacon structure pointer * @session: pointer to pe session * * Return: number of nss advertised by beacon */ -static uint8_t lim_get_nss_supported_by_beacon(tpSchBeaconStruct bcn, +static uint8_t lim_get_nss_supported_by_sta_and_ap(tpSchBeaconStruct bcn, tpPESession session) { if (session->vhtCapability && bcn->VHTCaps.present) { @@ -196,7 +197,8 @@ lim_extract_ap_capability(tpAniSirGlobal mac_ctx, uint8_t *p_ie, if (mac_ctx->roam.configParam.is_force_1x1 && cfg_get_vendor_ie_ptr_from_oui(mac_ctx, SIR_MAC_VENDOR_AP_1_OUI, SIR_MAC_VENDOR_AP_1_OUI_LEN, p_ie, ie_len) && - lim_get_nss_supported_by_beacon(beacon_struct, session) == 2 && + lim_get_nss_supported_by_sta_and_ap( + beacon_struct, session) == 2 && mac_ctx->lteCoexAntShare && IS_24G_CH(session->currentOperChannel)) { session->supported_nss_1x1 = true; @@ -205,10 +207,10 @@ lim_extract_ap_capability(tpAniSirGlobal mac_ctx, uint8_t *p_ie, pe_debug("For special ap, NSS: %d", session->nss); } - if (session->nss > lim_get_nss_supported_by_beacon(beacon_struct, + if (session->nss > lim_get_nss_supported_by_sta_and_ap(beacon_struct, session)) { - session->nss = lim_get_nss_supported_by_beacon(beacon_struct, - session); + session->nss = lim_get_nss_supported_by_sta_and_ap( + beacon_struct, session); session->vdev_nss = session->nss; } diff --git a/core/mac/src/pe/lim/lim_scan_result_utils.c b/core/mac/src/pe/lim/lim_scan_result_utils.c index 52c3d4296755..7cf92d4fac32 100644 --- a/core/mac/src/pe/lim/lim_scan_result_utils.c +++ b/core/mac/src/pe/lim/lim_scan_result_utils.c @@ -101,7 +101,7 @@ static inline void populate_qbss_load_status(tSirBssDescription *pBssDescr, #endif /** - * lim_get_nss_supported_by_beacon() - finds out nss from beacom + * lim_get_nss_supported_by_ap() - finds out nss from AP * @bcn: beacon structure pointer * * Return: number of nss advertised by AP diff --git a/core/mac/src/sys/legacy/src/utils/src/parser_api.c b/core/mac/src/sys/legacy/src/utils/src/parser_api.c index b5f36f82760a..6768830dd7aa 100644 --- a/core/mac/src/sys/legacy/src/utils/src/parser_api.c +++ b/core/mac/src/sys/legacy/src/utils/src/parser_api.c @@ -2299,25 +2299,25 @@ static void update_esp_data(struct sir_esp_information *esp_information, esp_info = (struct sir_esp_info *)data; if (esp_info->access_category == ESP_AC_BK) { qdf_mem_copy(&esp_information->esp_info_AC_BK, - data, ESP_INFORMATION_LIST_LENGTH); + data, 3); data = data + ESP_INFORMATION_LIST_LENGTH; continue; } if (esp_info->access_category == ESP_AC_BE) { qdf_mem_copy(&esp_information->esp_info_AC_BE, - data, ESP_INFORMATION_LIST_LENGTH); + data, 3); data = data + ESP_INFORMATION_LIST_LENGTH; continue; } if (esp_info->access_category == ESP_AC_VI) { qdf_mem_copy(&esp_information->esp_info_AC_VI, - data, ESP_INFORMATION_LIST_LENGTH); + data, 3); data = data + ESP_INFORMATION_LIST_LENGTH; continue; } if (esp_info->access_category == ESP_AC_VO) { qdf_mem_copy(&esp_information->esp_info_AC_VO, - data, ESP_INFORMATION_LIST_LENGTH); + data, 3); data = data + ESP_INFORMATION_LIST_LENGTH; break; } diff --git a/core/sme/src/csr/csr_api_scan.c b/core/sme/src/csr/csr_api_scan.c index 72f244c1e370..eec7c39995e5 100644 --- a/core/sme/src/csr/csr_api_scan.c +++ b/core/sme/src/csr/csr_api_scan.c @@ -1676,8 +1676,8 @@ csr_save_ies(tpAniSirGlobal pMac, * and channel condition for best candidate * selection * @bss_info: bss information - * @ap_cnt: No of AP count on BSS channel * @pcl_chan_weight: pcl weight of BSS channel + * @nss: NSS supported by station * * Return : int32_t */ @@ -1687,14 +1687,13 @@ static int32_t _csr_calculate_bss_score(tSirBssDescription *bss_info, int32_t score = 0; int32_t ap_load = 0; int32_t normalised_width = BEST_CANDIDATE_20MHZ; - int32_t normalised_rssi = 0; int32_t pcl_score = 0; - int32_t modified_rssi = 0; int32_t temp_pcl_chan_weight = 0; int8_t ap_nss = 0; int32_t est_air_time_percentage = 0; int32_t congestion = 0; - int32_t congestion_penalty = 0; + int32_t rssi_diff = 0; + int32_t rssi_weight = 0; /* * Total weight of a BSSID is calculated on basis of 100 in which @@ -1705,25 +1704,20 @@ static int32_t _csr_calculate_bss_score(tSirBssDescription *bss_info, * BEAMFORMING_CAP_WEIGHTAGE: 2 * CHAN_WIDTH_WEIGHTAGE:10 * CHAN_BAND_WEIGHTAGE: 5 - * CCA_WEIGHTAGE: 8 - * OTHER_AP_WEIGHT: 28 + * NSS: 5 * PCL: 10 - * - * Rssi_weightage is again divided in another factors like if Rssi is - * very good, very less or medium. - * According to this FR, best rssi is being considered as -40. - * EXCELLENT_RSSI = -40 - * GOOD_RSSI = -55 - * POOR_RSSI = -65 - * BAD_RSSI = -80 - * - * And weightage to all the RSSI type is given like this. - * ROAM_EXCELLENT_RSSI_WEIGHT = 100 - * ROAM_GOOD_RSSI_WEIGHT = 80 - * ROAM_BAD_RSSI_WEIGHT = 60 - * + * CHANNEL_CONGESTION: 5 + * Reserved : 31 + */ + /* + * Further bucketization of rssi is also done out of 25 score. + * RSSI > -55=> weight = 2500 + * RSSI > -60=> weight = 2250 + * RSSI >-65 =>weight = 2000 + * RSSI > -70=> weight = 1750 + * RSSI > -75=> weight = 1500 + * RSSI > -80=> weight = 1250 */ - if (bss_info->rssi) { /* * if RSSI of AP is less then -80, driver should ignore that @@ -1736,32 +1730,21 @@ static int32_t _csr_calculate_bss_score(tSirBssDescription *bss_info, score = 0; return score; } - /* If BSS is in PCL list, give a boost of -20dbm */ - if (pcl_chan_weight) - modified_rssi = bss_info->rssi + PCL_ADVANTAGE; - else - modified_rssi = bss_info->rssi; - /* - * Calculate % of rssi we are getting - * max = 100 - * min = 0 - * less than -40 = 100% - * -40 - -55 = 80% - * -55 - -65 = 60% - * below that = 100 - value - **/ - if (modified_rssi >= BEST_CANDIDATE_EXCELLENT_RSSI) - normalised_rssi = BEST_CANDIDATE_EXCELLENT_RSSI_WEIGHT; - else if (modified_rssi >= BEST_CANDIDATE_GOOD_RSSI) - normalised_rssi = BEST_CANDIDATE_GOOD_RSSI_WEIGHT; - else if (modified_rssi >= BEST_CANDIDATE_POOR_RSSI) - normalised_rssi = BEST_CANDIDATE_BAD_RSSI_WEIGHT; - else - normalised_rssi = modified_rssi - MIN_RSSI; + if (bss_info->rssi >= EXCELLENT_RSSI) { + rssi_weight = EXCELLENT_RSSI_WEIGHT * + RSSI_WEIGHTAGE; + } else { + rssi_diff = EXCELLENT_RSSI - + bss_info->rssi; + do_div(rssi_diff, 5); + rssi_weight = (rssi_diff + 1) * RSSI_WEIGHT_BUCKET; + rssi_weight = (EXCELLENT_RSSI_WEIGHT * + RSSI_WEIGHTAGE) - rssi_weight; - /* Calculate score part for rssi */ - score += (normalised_rssi * RSSI_WEIGHTAGE); + } + score += rssi_weight; } + /* If BSS is in PCL list extra pcl Weight is added n % */ if (pcl_chan_weight) { temp_pcl_chan_weight = @@ -1807,13 +1790,37 @@ static int32_t _csr_calculate_bss_score(tSirBssDescription *bss_info, if (get_rf_band(bss_info->channelId) == SIR_BAND_5_GHZ && bss_info->rssi > RSSI_THRESHOLD_5GHZ) score += BEST_CANDIDATE_MAX_WEIGHT * CHAN_BAND_WEIGHTAGE; + /* + * If ESP is being transmitted by the AP, use the estimated airtime for + * AC_BE from that, Estimated airtime 0-25% = 120, 25-50% = 250, 50-75% + * = 370, 75-100% = 500. + * Else if QBSSLoad is being transmitted and QBSSLoad < 25% = 500 + * else assing default weight of 370 + */ if (bss_info->air_time_fraction) { + /* Convert 0-255 range to percentage */ est_air_time_percentage = bss_info->air_time_fraction * ROAM_MAX_CHANNEL_WEIGHT; do_div(est_air_time_percentage, MAX_ESTIMATED_AIR_TIME_FRACTION); + /* + * Calculate channel congestion from estimated air time + * fraction. + */ congestion = MAX_CHANNEL_UTILIZATION - est_air_time_percentage; + + if (congestion >= LOW_CHANNEL_CONGESTION && + congestion < MODERATE_CHANNEL_CONGESTION) + score += LOW_CHANNEL_CONGESTION_WEIGHT; + else if (congestion >= MODERATE_CHANNEL_CONGESTION && + congestion < CONSIDERABLE_CHANNEL_CONGESTION) + score += MODERATE_CHANNEL_CONGESTION_WEIGHT; + else if (congestion >= CONSIDERABLE_CHANNEL_CONGESTION && + congestion < HIGH_CHANNEL_CONGESTION) + score += CONSIDERABLE_CHANNEL_CONGESTION_WEIGHT; + else + score += HIGH_CHANNEL_CONGESTION_WEIGHT; } else if (bss_info->QBSSLoad_present) { ap_load = (bss_info->qbss_chan_load * BEST_CANDIDATE_MAX_WEIGHT); @@ -1823,17 +1830,13 @@ static int32_t _csr_calculate_bss_score(tSirBssDescription *bss_info, */ do_div(ap_load, MAX_AP_LOAD); congestion = ap_load; + if (congestion < MODERATE_CHANNEL_CONGESTION) + score += LOW_CHANNEL_CONGESTION_WEIGHT; + else + score += HIGH_CHANNEL_CONGESTION_WEIGHT; + } else { + score += MODERATE_CHANNEL_CONGESTION_WEIGHT; } - if (congestion >= CONSIDERABLE_CHANNEL_CONGESTION && - congestion <= HIGH_CHANNEL_CONGESTION) - congestion_penalty = 25; - else if (congestion > HIGH_CHANNEL_CONGESTION && - congestion <= EXTREME_CHANNEL_CONGESTION) - congestion_penalty = 50; - else congestion_penalty = 0; - if (congestion_penalty) - score -= congestion_penalty*10; - ap_nss = bss_info->nss; if (wma_is_current_hwmode_dbs()) nss--; @@ -1843,9 +1846,9 @@ static int32_t _csr_calculate_bss_score(tSirBssDescription *bss_info, score += BEST_CANDIDATE_MAX_WEIGHT * NSS_WEIGHTAGE; QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, - FL("BSSID:"MAC_ADDRESS_STR" rssi=%d normalized_rssi=%d htcaps=%d vht=%d bw=%d channel=%d beamforming=%d ap_load=%d est_air_time_percentage=%d pcl_score %d Final Score %d ap_NSS %d nss %d"), + FL("BSSID:"MAC_ADDRESS_STR" rssi=%d htcaps=%d vht=%d bw=%d channel=%d beamforming=%d ap_load=%d est_air_time_percentage=%d pcl_score %d Final Score %d ap_NSS %d nss %d"), MAC_ADDR_ARRAY(bss_info->bssId), - bss_info->rssi, normalised_rssi, bss_info->ht_caps_present, + bss_info->rssi, bss_info->ht_caps_present, bss_info->vht_caps_present, bss_info->chan_width, bss_info->channelId, bss_info->beacomforming_capable, ap_load, @@ -2200,9 +2203,6 @@ QDF_STATUS csr_scan_get_result(tpAniSirGlobal pMac, if (phResult) *phResult = CSR_INVALID_SCANRESULT_HANDLE; - qdf_mem_set(&pMac->candidate_channel_info, - sizeof(struct candidate_chan_info), 0); - pRetList = qdf_mem_malloc(sizeof(struct scan_result_list)); if (NULL == pRetList) { sme_err("pRetList is NULL"); diff --git a/core/sme/src/csr/csr_inside_api.h b/core/sme/src/csr/csr_inside_api.h index aade11665281..c9abfc3da367 100644 --- a/core/sme/src/csr/csr_inside_api.h +++ b/core/sme/src/csr/csr_inside_api.h @@ -109,14 +109,16 @@ bool csr_is_supported_channel(tpAniSirGlobal pMac, uint8_t channelId); #define BEST_CANDIDATE_RSSI_WEIGHT 50 #define MIN_RSSI (-100) #define MAX_RSSI 0 -#define BEST_CANDIDATE_AP_COUNT_WEIGHT 50 -#define BEST_CANDIDATE_MAX_COUNT 30 -#define BEST_CANDIDATE_MIN_COUNT 0 #define ROAM_MAX_CHANNEL_WEIGHT 100 -#define DEFAULT_CHANNEL_UTILIZATION 50 #define MAX_CHANNEL_UTILIZATION 100 #define NSS_1X1_WEIGHTAGE 3 #define MAX_ESTIMATED_AIR_TIME_FRACTION 255 +#define MAX_AP_LOAD 255 + +#define LOW_CHANNEL_CONGESTION_WEIGHT 500 +#define MODERATE_CHANNEL_CONGESTION_WEIGHT 370 +#define CONSIDERABLE_CHANNEL_CONGESTION_WEIGHT 250 +#define HIGH_CHANNEL_CONGESTION_WEIGHT 120 #define LOW_CHANNEL_CONGESTION 0 #define MODERATE_CHANNEL_CONGESTION 25 @@ -132,22 +134,19 @@ bool csr_is_supported_channel(tpAniSirGlobal pMac, uint8_t channelId); #define NSS_WEIGHTAGE 5 #define BEAMFORMING_CAP_WEIGHTAGE 2 #define PCL_WEIGHT 10 +#define CHANNEL_CONGESTION_WEIGHTAGE 5 #define RESERVED_WEIGHT 31 -#define CHANNEL_CONGESTION_PENALTY 5 -#define MAX_AP_LOAD 255 -#define BEST_CANDIDATE_EXCELLENT_RSSI -40 -#define BEST_CANDIDATE_GOOD_RSSI -55 -#define BEST_CANDIDATE_POOR_RSSI -65 +#define EXCELLENT_RSSI -55 #define BAD_RSSI -80 -#define BEST_CANDIDATE_EXCELLENT_RSSI_WEIGHT 100 -#define BEST_CANDIDATE_GOOD_RSSI_WEIGHT 80 -#define BEST_CANDIDATE_BAD_RSSI_WEIGHT 60 +#define EXCELLENT_RSSI_WEIGHT 100 +#define RSSI_BUCKET 5 +#define RSSI_WEIGHT_BUCKET 250 + #define BEST_CANDIDATE_MAX_WEIGHT 100 #define BEST_CANDIDATE_80MHZ 100 #define BEST_CANDIDATE_40MHZ 70 #define BEST_CANDIDATE_20MHZ 30 -#define BEST_CANDIDATE_PENALTY (3/10) #define BEST_CANDIDATE_MAX_BSS_SCORE 10000 |
