From 8e5c048c781918fde9bcd124c866724e799ee7b1 Mon Sep 17 00:00:00 2001 From: Lincoln Tran Date: Mon, 4 Oct 2021 15:03:09 -0700 Subject: [PATCH] qcacld-3.0: Exclude BSS membership selector from rate set When checking the total number of supported rates against the maximum value of 12, don't include BSS membership selector elements in that count. The value 12 only correspond to supported rates, not membership selector elements. Change-Id: Ic82d4dc9d324880141dfde3e3516a9b9f7f1e743 CRs-fixed: 3049216 --- core/mac/src/pe/lim/lim_assoc_utils.c | 50 ++++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 4 deletions(-) diff --git a/core/mac/src/pe/lim/lim_assoc_utils.c b/core/mac/src/pe/lim/lim_assoc_utils.c index aef9152778b3..4099a0d487ca 100644 --- a/core/mac/src/pe/lim/lim_assoc_utils.c +++ b/core/mac/src/pe/lim/lim_assoc_utils.c @@ -1587,6 +1587,41 @@ static bool lim_check_valid_mcs_for_nss(struct pe_session *session, } #endif +/** + * lim_remove_membership_selectors() - remove elements from rate set + * + * @rate_set: pointer to rate set + * + * Removes the BSS membership selector elements from the rate set, and keep + * only the rates + * + * Return: none + */ +static void lim_remove_membership_selectors(tSirMacRateSet *rate_set) +{ + int i, selector_count = 0; + + for (i = 0; i < rate_set->numRates; i++) { + if ((rate_set->rate[i] == (WLAN_BASIC_RATE_MASK | + WLAN_BSS_MEMBERSHIP_SELECTOR_HT_PHY)) || + (rate_set->rate[i] == (WLAN_BASIC_RATE_MASK | + WLAN_BSS_MEMBERSHIP_SELECTOR_VHT_PHY)) || + (rate_set->rate[i] == (WLAN_BASIC_RATE_MASK | + WLAN_BSS_MEMBERSHIP_SELECTOR_GLK)) || + (rate_set->rate[i] == (WLAN_BASIC_RATE_MASK | + WLAN_BSS_MEMBERSHIP_SELECTOR_EPD)) || + (rate_set->rate[i] == (WLAN_BASIC_RATE_MASK | + WLAN_BSS_MEMBERSHIP_SELECTOR_SAE_H2E)) || + (rate_set->rate[i] == (WLAN_BASIC_RATE_MASK | + WLAN_BSS_MEMBERSHIP_SELECTOR_HE_PHY))) + selector_count++; + + if (i + selector_count < rate_set->numRates) + rate_set->rate[i] = rate_set->rate[i + selector_count]; + } + rate_set->numRates -= selector_count; +} + QDF_STATUS lim_populate_peer_rate_set(struct mac_context *mac, struct supported_rates *pRates, uint8_t *pSupportedMCSSet, @@ -1635,6 +1670,10 @@ QDF_STATUS lim_populate_peer_rate_set(struct mac_context *mac, } } else tempRateSet2.numRates = 0; + + lim_remove_membership_selectors(&tempRateSet); + lim_remove_membership_selectors(&tempRateSet2); + if ((tempRateSet.numRates + tempRateSet2.numRates) > WLAN_SUPPORTED_RATES_IE_MAX_LEN) { pe_err("more than 12 rates in CFG"); @@ -1794,8 +1833,8 @@ QDF_STATUS lim_populate_peer_rate_set(struct mac_context *mac, * in IBSS role to process the CFG rate sets and * the rate sets received in the Assoc request on AP * - * 1. It makes the intersection between our own rate Sat - * and extemcded rate set and the ones received in the + * 1. It makes the intersection between our own rate set + * and extended rate set and the ones received in the * association request. * 2. It creates a combined rate set of 12 rates max which * comprised the basic and extended rates @@ -1845,13 +1884,16 @@ QDF_STATUS lim_populate_matching_rate_set(struct mac_context *mac_ctx, temp_rate_set2.numRates = 0; } + lim_remove_membership_selectors(&temp_rate_set); + lim_remove_membership_selectors(&temp_rate_set2); + /* * absolute sum of both num_rates should be less than 12. following - * 16-bit sum avoids false codition where 8-bit arthematic overflow + * 16-bit sum avoids false condition where 8-bit arithmetic overflow * might have caused total sum to be less than 12 */ if (((uint16_t)temp_rate_set.numRates + - (uint16_t)temp_rate_set2.numRates) > 12) { + (uint16_t)temp_rate_set2.numRates) > SIR_MAC_MAX_NUMBER_OF_RATES) { pe_err("more than 12 rates in CFG"); return QDF_STATUS_E_FAILURE; }