qcacld-3.0: Populate country IE from regulatory API

Call regulatory API to get current channel list. Populate
sub-band triplets from there. Also clean-up 11d related
cfg item enable_11d.

Change-Id: Ica6dba0dee05e7d16572ec0f0c62aa6f79aa6d4f
CRs-Fixed: 2769848
Bu işleme şunda yer alıyor:
Amar Singhal
2020-09-23 18:08:21 -07:00
işlemeyi yapan: snandini
ebeveyn 08908493a3
işleme 4992e9a67e
6 değiştirilmiş dosya ile 94 ekleme ve 122 silme

Dosyayı Görüntüle

@@ -304,7 +304,6 @@ struct pe_session {
uint8_t limWmeEnabled:1; /* WME */
uint8_t limWsmEnabled:1; /* WSM */
uint8_t limHcfEnabled:1;
uint8_t lim11dEnabled:1;
#ifdef WLAN_FEATURE_11W
uint8_t limRmfEnabled:1; /* 11W */
#endif

Dosyayı Görüntüle

@@ -231,7 +231,5 @@ static void lim_update_config(struct mac_context *mac, struct pe_session *pe_ses
if (pe_session->limWsmEnabled && LIM_IS_AP_ROLE(pe_session))
pe_session->limHcfEnabled = 1;
pe_session->lim11dEnabled = mac->mlme_cfg->gen.enabled_11d ? 1 : 0;
pe_debug("Updated Lim shadow state based on CFG");
}

Dosyayı Görüntüle

@@ -384,82 +384,112 @@ populate_dot11f_avoid_channel_ie(struct mac_context *mac_ctx,
QDF_STATUS
populate_dot11f_country(struct mac_context *mac,
tDot11fIECountry *pDot11f, struct pe_session *pe_session)
tDot11fIECountry *ctry_ie, struct pe_session *pe_session)
{
uint32_t len, j = 0;
enum reg_wifi_band rfBand;
uint8_t temp[CFG_MAX_STR_LEN], code[3];
tSirMacChanInfo *max_tx_power_data;
uint32_t rem_length = 0, copied_length = 0;
uint8_t code[REG_ALPHA2_LEN + 1];
qdf_freq_t cur_triplet_freq;
uint8_t cur_triplet_num_chans;
uint8_t cur_triplet_tx_power;
bool cur_triplet_valid;
enum reg_wifi_band cur_triplet_band;
int chan_enum;
struct regulatory_channel *cur_chan_list;
QDF_STATUS status;
if (!pe_session->lim11dEnabled)
return QDF_STATUS_SUCCESS;
cur_chan_list = qdf_mem_malloc(NUM_CHANNELS * sizeof(*cur_chan_list));
if (!cur_chan_list)
return QDF_STATUS_E_NOMEM;
lim_get_rf_band_new(mac, &rfBand, pe_session);
if (rfBand == REG_BAND_5G) {
len = mac->mlme_cfg->power.max_tx_power_5.len;
max_tx_power_data =
(tSirMacChanInfo *)mac->mlme_cfg->power.max_tx_power_5.data;
rem_length = len;
while (rem_length >= (sizeof(tSirMacChanInfo))) {
temp[copied_length++] =
(uint8_t)wlan_reg_freq_to_chan(
mac->pdev,
max_tx_power_data[j].first_freq);
temp[copied_length++] =
max_tx_power_data[j].numChannels;
temp[copied_length++] =
max_tx_power_data[j].maxTxPower;
j++;
rem_length -= (sizeof(tSirMacChanInfo));
}
} else {
len = mac->mlme_cfg->power.max_tx_power_24.len;
max_tx_power_data =
(tSirMacChanInfo *)mac->mlme_cfg->power.max_tx_power_24.data;
rem_length = len;
while (rem_length >= (sizeof(tSirMacChanInfo))) {
temp[copied_length++] =
(uint8_t)wlan_reg_freq_to_chan(
mac->pdev,
max_tx_power_data[j].first_freq);
temp[copied_length++] =
max_tx_power_data[j].numChannels;
temp[copied_length++] =
max_tx_power_data[j].maxTxPower;
j++;
rem_length -= (sizeof(tSirMacChanInfo));
}
}
if (sizeof(tSirMacChanInfo) > len) {
/* no limit on tx power, cannot include the IE because at */
/* atleast one (channel,num,tx power) must be present */
return QDF_STATUS_SUCCESS;
status = wlan_reg_get_current_chan_list(mac->pdev, cur_chan_list);
if (status != QDF_STATUS_SUCCESS) {
pe_err("failed to get cur_chan list");
qdf_mem_free(cur_chan_list);
return status;
}
wlan_reg_read_current_country(mac->psoc, code);
qdf_mem_copy(ctry_ie->country, code, REG_ALPHA2_LEN);
qdf_mem_copy(pDot11f->country, code, 2);
/* advertise global operating class */
ctry_ie->country[REG_ALPHA2_LEN] = 0x04;
/* a wi-fi agile multiband AP shall include a country */
/* element in all beacon and probe response frames */
/* where the last octet of country string field is */
/* set to 0x04 */
if (mac->mlme_cfg->oce.oce_sap_enabled)
pDot11f->country[2] = 0x04;
cur_triplet_valid = false;
ctry_ie->num_triplets = 0;
for (chan_enum = 0; chan_enum < NUM_CHANNELS; chan_enum++) {
if (wlan_reg_is_6ghz_chan_freq(
cur_chan_list[chan_enum].center_freq)) {
if (cur_triplet_valid) {
ctry_ie->triplets[ctry_ie->num_triplets][0] =
wlan_reg_freq_to_chan(mac->pdev,
cur_triplet_freq);
ctry_ie->triplets[ctry_ie->num_triplets][1] =
cur_triplet_num_chans;
ctry_ie->triplets[ctry_ie->num_triplets][2] =
cur_triplet_tx_power;
ctry_ie->num_triplets++;
cur_triplet_valid = false;
}
break;
}
if (copied_length > MAX_SIZE_OF_TRIPLETS_IN_COUNTRY_IE) {
pe_err("len:%d is out of bounds, resetting", len);
copied_length = MAX_SIZE_OF_TRIPLETS_IN_COUNTRY_IE;
if (cur_chan_list[chan_enum].chan_flags &
REGULATORY_CHAN_DISABLED) {
if (cur_triplet_valid) {
ctry_ie->triplets[ctry_ie->num_triplets][0] =
wlan_reg_freq_to_chan(mac->pdev,
cur_triplet_freq);
ctry_ie->triplets[ctry_ie->num_triplets][1] =
cur_triplet_num_chans;
ctry_ie->triplets[ctry_ie->num_triplets][2] =
cur_triplet_tx_power;
ctry_ie->num_triplets++;
cur_triplet_valid = false;
}
continue;
}
if (cur_triplet_valid) {
if ((cur_chan_list[chan_enum].tx_power ==
cur_triplet_tx_power) &&
(cur_triplet_band ==
wlan_reg_freq_to_band(cur_chan_list[chan_enum].center_freq)))
cur_triplet_num_chans++;
else {
ctry_ie->triplets[ctry_ie->num_triplets][0] =
wlan_reg_freq_to_chan(mac->pdev,
cur_triplet_freq);
ctry_ie->triplets[ctry_ie->num_triplets][1] =
cur_triplet_num_chans;
ctry_ie->triplets[ctry_ie->num_triplets][2] =
cur_triplet_tx_power;
ctry_ie->num_triplets++;
cur_triplet_freq =
cur_chan_list[chan_enum].center_freq;
cur_triplet_num_chans = 1;
cur_triplet_tx_power =
cur_chan_list[chan_enum].tx_power;
cur_triplet_band = wlan_reg_freq_to_band(cur_triplet_freq);
}
} else {
cur_triplet_freq = cur_chan_list[chan_enum].center_freq;
cur_triplet_num_chans = 1;
cur_triplet_tx_power =
cur_chan_list[chan_enum].tx_power;
cur_triplet_band = wlan_reg_freq_to_band(cur_triplet_freq);
cur_triplet_valid = true;
}
}
pDot11f->num_triplets = (uint8_t)(copied_length / 3);
if (ctry_ie->num_triplets == 0) {
/* at-least one triplet should be present */
qdf_mem_free(cur_chan_list);
return QDF_STATUS_SUCCESS;
}
qdf_mem_copy((uint8_t *)pDot11f->triplets, temp, copied_length);
pDot11f->present = 1;
ctry_ie->present = 1;
qdf_mem_free(cur_chan_list);
return QDF_STATUS_SUCCESS;
} /* End populate_dot11f_country. */

Dosyayı Görüntüle

@@ -5368,45 +5368,6 @@ sme_handle_generic_change_country_code(struct mac_context *mac_ctx,
void *msg_buf)
{
QDF_STATUS status = QDF_STATUS_SUCCESS;
v_REGDOMAIN_t reg_domain_id = 0;
bool user_ctry_priority =
mac_ctx->mlme_cfg->sap_cfg.country_code_priority;
tAniGenericChangeCountryCodeReq *msg = msg_buf;
if (SOURCE_11D != mac_ctx->reg_hint_src) {
if (SOURCE_DRIVER != mac_ctx->reg_hint_src) {
if (user_ctry_priority)
mac_ctx->mlme_cfg->gen.enabled_11d = false;
else {
if (mac_ctx->mlme_cfg->gen.enabled_11d &&
mac_ctx->scan.countryCode11d[0] != 0) {
sme_debug("restore 11d");
status =
csr_get_regulatory_domain_for_country(
mac_ctx,
mac_ctx->scan.countryCode11d,
&reg_domain_id,
SOURCE_11D);
return QDF_STATUS_E_FAILURE;
}
}
}
} else {
/* if kernel gets invalid country code; it
* resets the country code to world
*/
if (('0' != msg->countryCode[0]) ||
('0' != msg->countryCode[1]))
qdf_mem_copy(mac_ctx->scan.countryCode11d,
msg->countryCode,
REG_ALPHA2_LEN + 1);
}
qdf_mem_copy(mac_ctx->scan.countryCodeCurrent,
msg->countryCode,
REG_ALPHA2_LEN + 1);
/* get the channels based on new cc */
status = csr_get_channel_and_power_list(mac_ctx);
@@ -5421,13 +5382,6 @@ sme_handle_generic_change_country_code(struct mac_context *mac_ctx,
csr_scan_filter_results(mac_ctx);
/* scans after the country is set by User hints or
* Country IE
*/
mac_ctx->scan.curScanType = eSIR_ACTIVE_SCAN;
mac_ctx->reg_hint_src = SOURCE_UNKNOWN;
return QDF_STATUS_SUCCESS;
}

Dosyayı Görüntüle

@@ -4949,11 +4949,6 @@ QDF_STATUS csr_roam_set_bss_config_cfg(struct mac_context *mac, uint32_t session
/* short slot time */
mac->mlme_cfg->feature_flags.enable_short_slot_time_11g =
pBssConfig->uShortSlotTime;
/* 11d */
if (pBssConfig->f11hSupport)
mac->mlme_cfg->gen.enabled_11d = pBssConfig->f11hSupport;
else
mac->mlme_cfg->gen.enabled_11d = pProfile->ieee80211d;
mac->mlme_cfg->power.local_power_constraint = pBssConfig->uPowerLimit;
/* CB */

Dosyayı Görüntüle

@@ -616,11 +616,7 @@ static void csr_diag_reset_country_information(struct mac_context *mac)
mac->scan.defaultPowerTable[Index].tx_power;
}
}
if (!mac->mlme_cfg->gen.enabled_11d)
p11dLog->supportMultipleDomain = WLAN_80211D_DISABLED;
else
p11dLog->supportMultipleDomain =
WLAN_80211D_SUPPORT_MULTI_DOMAIN;
WLAN_HOST_DIAG_LOG_REPORT(p11dLog);
}
#endif /* FEATURE_WLAN_DIAG_SUPPORT_CSR */