diff --git a/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c b/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c index ef9167f67a1a..d42025672638 100644 --- a/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c +++ b/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c @@ -311,7 +311,7 @@ static void lim_handle_join_rsp_status(struct mac_context *mac_ctx, if (mac_ctx->roam.configParam.is_force_1x1 && is_vendor_ap_1_present && (session_entry->nss == 2) && (mac_ctx->lteCoexAntShare == 0 || - IS_5G_CH(session_entry->currentOperChannel))) { + wlan_reg_is_5ghz_ch_freq(session_entry->curr_op_freq))) { /* SET vdev param */ pe_debug("sending SMPS intolrent vdev_param"); wma_cli_set_command(session_entry->smeSessionId, @@ -548,11 +548,10 @@ void lim_send_sme_start_bss_rsp(struct mac_context *mac, nwType, pe_session); pSirSmeRsp->bssDescription.channelId = - pe_session->currentOperChannel; + wlan_reg_freq_to_chan( + mac->pdev, pe_session->curr_op_freq); pSirSmeRsp->bssDescription.chan_freq = - wlan_reg_chan_to_freq(mac->pdev, - pe_session-> - currentOperChannel); + pe_session->curr_op_freq; if (!LIM_IS_NDI_ROLE(pe_session)) { curLen = pe_session->schBeaconOffsetBegin - ieOffset; @@ -1787,9 +1786,11 @@ void lim_handle_csa_offload_msg(struct mac_context *mac_ctx, } pe_debug("new ch width: %d space: %d", session_entry->gLimChannelSwitch.ch_width, chan_space); - if ((session_entry->currentOperChannel == csa_params->channel) && - (session_entry->ch_width == - session_entry->gLimChannelSwitch.ch_width)) { + if ((wlan_reg_freq_to_chan(mac_ctx->pdev, + session_entry->curr_op_freq) == + csa_params->channel) && + session_entry->ch_width == + session_entry->gLimChannelSwitch.ch_width) { pe_debug("Ignore CSA, no change in ch and bw"); goto err; } @@ -1985,7 +1986,8 @@ lim_send_sme_ap_channel_switch_resp(struct mac_context *mac, } if (!is_ch_dfs) { - if (channelId == pe_session->currentOperChannel) { + if (channelId == wlan_reg_freq_to_chan( + mac->pdev, pe_session->curr_op_freq)) { lim_apply_configuration(mac, pe_session); lim_send_beacon(mac, pe_session); } else { diff --git a/core/mac/src/pe/lim/lim_session.c b/core/mac/src/pe/lim/lim_session.c index bc2d91098fe3..25d9a3da7b4a 100644 --- a/core/mac/src/pe/lim/lim_session.c +++ b/core/mac/src/pe/lim/lim_session.c @@ -515,7 +515,8 @@ void lim_update_bcn_probe_filter(struct mac_context *mac_ctx, filter = &mac_ctx->bcn_filter; if (eSIR_INFRA_AP_MODE == bss_type) { - filter->sap_channel[session_id] = session->currentOperChannel; + filter->sap_channel[session_id] = wlan_reg_freq_to_chan( + mac_ctx->pdev, session->curr_op_freq); pe_debug("Updated SAP Filter for session %d channel %d", session_id, filter->sap_channel[session_id]); } else { diff --git a/core/mac/src/pe/lim/lim_session_utils.c b/core/mac/src/pe/lim/lim_session_utils.c index ea6240c3e006..f7288b6cf955 100644 --- a/core/mac/src/pe/lim/lim_session_utils.c +++ b/core/mac/src/pe/lim/lim_session_utils.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2011-2019 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -58,8 +58,8 @@ uint8_t is_lim_session_off_channel(struct mac_context *mac_ctx, uint8_t session_ * then it is an off channel operation. */ if ((mac_ctx->lim.gpSession[i].valid) && - (mac_ctx->lim.gpSession[i].currentOperChannel != - mac_ctx->lim.gpSession[session_id].currentOperChannel)) + (mac_ctx->lim.gpSession[i].curr_op_freq != + mac_ctx->lim.gpSession[session_id].curr_op_freq)) return true; } return false; @@ -95,8 +95,8 @@ uint8_t lim_is_chan_switch_running(struct mac_context *mac_ctx) uint8_t lim_is_in_mcc(struct mac_context *mac_ctx) { uint8_t i; - uint8_t chan = 0; - uint8_t curr_oper_channel = 0; + uint32_t freq = 0; + uint32_t curr_oper_freq = 0; for (i = 0; i < mac_ctx->lim.maxBssId; i++) { /* @@ -104,13 +104,13 @@ uint8_t lim_is_in_mcc(struct mac_context *mac_ctx) * it is an off channel operation. */ if ((mac_ctx->lim.gpSession[i].valid)) { - curr_oper_channel = - mac_ctx->lim.gpSession[i].currentOperChannel; - if (curr_oper_channel == 0) + curr_oper_freq = + mac_ctx->lim.gpSession[i].curr_op_freq; + if (curr_oper_freq == 0) continue; - if (chan == 0) - chan = curr_oper_channel; - else if (chan != curr_oper_channel) + if (freq == 0) + freq = curr_oper_freq; + else if (freq != curr_oper_freq) return true; } } diff --git a/core/mac/src/pe/lim/lim_utils.c b/core/mac/src/pe/lim/lim_utils.c index 155881d9bb44..486d2b673b20 100644 --- a/core/mac/src/pe/lim/lim_utils.c +++ b/core/mac/src/pe/lim/lim_utils.c @@ -2259,8 +2259,9 @@ void lim_switch_channel_cback(struct mac_context *mac, QDF_STATUS status, void lim_switch_primary_channel(struct mac_context *mac, uint8_t new_channel, struct pe_session *pe_session) { - pe_debug("old chnl: %d --> new chnl: %d", - pe_session->currentOperChannel, new_channel); + pe_debug("old chnl freq: %d --> new chnl freq: %d", + pe_session->curr_op_freq, + wlan_reg_chan_to_freq(mac->pdev, new_channel)); pe_session->curr_req_chan_freq = wlan_reg_chan_to_freq(mac->pdev, new_channel); @@ -2319,9 +2320,11 @@ void lim_switch_primary_secondary_channel(struct mac_context *mac, false, 0, 0); /* Store the new primary and secondary channel in session entries if different */ - if (pe_session->currentOperChannel != new_channel) { - pe_warn("switch old chnl: %d --> new chnl: %d", - pe_session->currentOperChannel, new_channel); + if (wlan_reg_freq_to_chan(mac->pdev, pe_session->curr_op_freq) != + new_channel) { + pe_warn("switch old chnl freq: %d --> new chnl freq: %d", + pe_session->curr_op_freq, wlan_reg_chan_to_freq( + mac->pdev, new_channel)); pe_session->curr_op_freq = wlan_reg_chan_to_freq( mac->pdev, new_channel); pe_session->currentOperChannel = wlan_reg_freq_to_chan( @@ -3951,8 +3954,8 @@ void lim_update_sta_run_time_ht_switch_chnl_params(struct mac_context *mac, (mac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, pe_session)) return; - if (WLAN_REG_IS_24GHZ_CH(pe_session->currentOperChannel) && - pe_session->force_24ghz_in_ht20) { + if (wlan_reg_is_24ghz_ch_freq(pe_session->curr_op_freq) && + pe_session->force_24ghz_in_ht20) { pe_debug("force_24ghz_in_ht20 is set and channel is 2.4 Ghz"); return; } @@ -3974,7 +3977,8 @@ void lim_update_sta_run_time_ht_switch_chnl_params(struct mac_context *mac, } /* If channel mismatch the CSA will take care of this change */ - if (pHTInfo->primaryChannel != pe_session->currentOperChannel) { + if (pHTInfo->primaryChannel != wlan_reg_freq_to_chan( + mac->pdev, pe_session->curr_op_freq)) { pe_debug("Current channel doesnt match HT info ignore"); return; } @@ -4945,7 +4949,8 @@ static void lim_diag_fill_mgmt_event_report(struct mac_context *mac_ctx, length = WLAN_SSID_MAX_LEN; qdf_mem_copy(mgmt_event->ssid, session->ssId.ssId, length); mgmt_event->ssid_len = length; - mgmt_event->operating_channel = session->currentOperChannel; + mgmt_event->operating_channel = wlan_reg_freq_to_chan( + mac_ctx->pdev, session->curr_op_freq); mgmt_event->result_code = result_code; mgmt_event->reason_code = reason_code; } @@ -7369,7 +7374,7 @@ QDF_STATUS lim_populate_he_mcs_set(struct mac_context *mac_ctx, if (session_entry && session_entry->nss == NSS_2x2_MODE) { if (mac_ctx->lteCoexAntShare && - IS_24G_CH(session_entry->currentOperChannel)) { + wlan_reg_is_24ghz_ch_freq(session_entry->curr_op_freq)) { if (IS_2X2_CHAIN(session_entry->chainMask)) support_2x2 = true; else @@ -8078,7 +8083,9 @@ QDF_STATUS lim_ap_mlme_vdev_restart_send(struct vdev_mlme_obj *vdev_mlme, lim_send_vdev_restart(session->mac_ctx, session, session->smeSessionId); else - lim_set_channel(session->mac_ctx, session->currentOperChannel, + lim_set_channel(session->mac_ctx, + wlan_reg_freq_to_chan( + session->mac_ctx->pdev, session->curr_op_freq), session->ch_center_freq_seg0, session->ch_center_freq_seg1, session->ch_width, session->maxTxPower, @@ -8123,7 +8130,9 @@ QDF_STATUS lim_mon_mlme_vdev_start_send(struct vdev_mlme_obj *vdev_mlme, return QDF_STATUS_E_INVAL; } - lim_set_channel(mac_ctx, session->currentOperChannel, + lim_set_channel(mac_ctx, + wlan_reg_freq_to_chan( + mac_ctx->pdev, session->curr_op_freq), session->ch_center_freq_seg0, session->ch_center_freq_seg1, session->ch_width, diff --git a/core/mac/src/pe/sch/sch_beacon_gen.c b/core/mac/src/pe/sch/sch_beacon_gen.c index 35c98bcb906b..7448ab0b8c25 100644 --- a/core/mac/src/pe/sch/sch_beacon_gen.c +++ b/core/mac/src/pe/sch/sch_beacon_gen.c @@ -301,7 +301,8 @@ sch_set_fixed_beacon_fields(struct mac_context *mac_ctx, struct pe_session *sess populate_dot11f_supp_rates(mac_ctx, POPULATE_DOT11F_RATES_OPERATIONAL, &bcn_1->SuppRates, session); populate_dot11f_ds_params(mac_ctx, &bcn_1->DSParams, - session->currentOperChannel); + wlan_reg_freq_to_chan( + mac_ctx->pdev, session->curr_op_freq)); populate_dot11f_ibss_params(mac_ctx, &bcn_1->IBSSParams, session); offset = sizeof(tAniBeaconStruct); @@ -458,7 +459,9 @@ sch_set_fixed_beacon_fields(struct mac_context *mac_ctx, struct pe_session *sess populate_dot11f_vht_tx_power_env(mac_ctx, &bcn_2->vht_transmit_power_env, session->ch_width, - session->currentOperChannel); + wlan_reg_freq_to_chan( + mac_ctx->pdev, + session->curr_op_freq)); } if (lim_is_session_he_capable(session)) { diff --git a/core/mac/src/pe/sch/sch_beacon_process.c b/core/mac/src/pe/sch/sch_beacon_process.c index b8ad24346ca7..deffcd9e968c 100644 --- a/core/mac/src/pe/sch/sch_beacon_process.c +++ b/core/mac/src/pe/sch/sch_beacon_process.c @@ -59,7 +59,8 @@ ap_beacon_process_5_ghz(struct mac_context *mac_ctx, uint8_t *rx_pkt_info, if (!session->htCapability) return; - if (bcn_struct->channelNumber != session->currentOperChannel) + if (bcn_struct->channelNumber != wlan_reg_freq_to_chan( + mac_ctx->pdev, session->curr_op_freq)) return; /* 11a (non HT) AP overlaps or */ @@ -102,7 +103,8 @@ ap_beacon_process_24_ghz(struct mac_context *mac_ctx, uint8_t *rx_pkt_info, /* We are 11G AP. */ if ((phy_mode == WNI_CFG_PHY_MODE_11G) && (false == session->htCapability)) { - if (bcn_struct->channelNumber != session->currentOperChannel) + if (bcn_struct->channelNumber != wlan_reg_freq_to_chan( + mac_ctx->pdev, session->curr_op_freq)) return; tmp_exp = (!bcn_struct->erpPresent && @@ -131,7 +133,8 @@ ap_beacon_process_24_ghz(struct mac_context *mac_ctx, uint8_t *rx_pkt_info, if (!session->htCapability) return; - if (bcn_struct->channelNumber != session->currentOperChannel) + if (bcn_struct->channelNumber != wlan_reg_freq_to_chan( + mac_ctx->pdev, session->curr_op_freq)) return; tmp_exp = (!bcn_struct->erpPresent && !bcn_struct->HTInfo.present) || @@ -353,10 +356,12 @@ sch_bcn_process_sta(struct mac_context *mac_ctx, * This is the Beacon received from the AP we're currently associated * with. Check if there are any changes in AP's capabilities */ - if ((uint8_t) bcn->channelNumber != session->currentOperChannel) { - pe_err("Channel Change from %d --> %d - Ignoring beacon!", - session->currentOperChannel, - bcn->channelNumber); + if (bcn->channelNumber != wlan_reg_freq_to_chan( + mac_ctx->pdev, session->curr_op_freq)) { + pe_err("Channel Change freq from %d --> %d - Ignoring beacon!", + session->curr_op_freq, + wlan_reg_chan_to_freq( + mac_ctx->pdev, bcn->channelNumber)); return false; } @@ -724,7 +729,7 @@ sch_bcn_process_sta_ibss(struct mac_context *mac_ctx, uint16_t aid; uint8_t cb_mode; - if (CHAN_ENUM_14 >= session->currentOperChannel) { + if (wlan_reg_is_24ghz_ch_freq(session->curr_op_freq)) { if (session->force_24ghz_in_ht20) cb_mode = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE; else @@ -869,7 +874,8 @@ static void __sch_beacon_process_for_session(struct mac_context *mac_ctx, &beaconParams, &sendProbeReq, pMh); /* Obtain the Max Tx power for the current regulatory */ regMax = lim_get_regulatory_max_transmit_power( - mac_ctx, session->currentOperChannel); + mac_ctx, wlan_reg_freq_to_chan( + mac_ctx->pdev, session->curr_op_freq)); local_constraint = regMax; @@ -891,9 +897,7 @@ static void __sch_beacon_process_for_session(struct mac_context *mac_ctx, tx_pwr_attr.reg_max = regMax; tx_pwr_attr.ap_tx_power = local_constraint; tx_pwr_attr.ini_tx_power = mac_ctx->mlme_cfg->power.max_tx_power; - tx_pwr_attr.frequency = - wlan_reg_get_channel_freq(mac_ctx->pdev, - session->currentOperChannel); + tx_pwr_attr.frequency = session->curr_op_freq; maxTxPower = lim_get_max_tx_power(mac_ctx, &tx_pwr_attr); @@ -924,7 +928,8 @@ static void __sch_beacon_process_for_session(struct mac_context *mac_ctx, */ if (sendProbeReq) lim_send_probe_req_mgmt_frame(mac_ctx, &session->ssId, - session->bssId, session->currentOperChannel, + session->bssId, wlan_reg_freq_to_chan( + mac_ctx->pdev, session->curr_op_freq), session->self_mac_addr, session->dot11mode, NULL, NULL); if ((false == mac_ctx->sap.SapDfsInfo.is_dfs_cac_timer_running) diff --git a/core/mac/src/pe/sch/sch_message.c b/core/mac/src/pe/sch/sch_message.c index 3a9b5711994b..d7c7743c6f71 100644 --- a/core/mac/src/pe/sch/sch_message.c +++ b/core/mac/src/pe/sch/sch_message.c @@ -212,11 +212,11 @@ broadcast_wmm_of_concurrent_sta_session(struct mac_context *mac_ctx, */ if (!((mac_ctx->lim.gpSession[i].valid == true) && (mac_ctx->lim.gpSession[i].peSessionId != - session->peSessionId) - && (mac_ctx->lim.gpSession[i].currentOperChannel == - session->currentOperChannel) - && (mac_ctx->lim.gpSession[i].limSystemRole - == eLIM_STA_ROLE))) + session->peSessionId) && + (mac_ctx->lim.gpSession[i].curr_op_freq == + session->curr_op_freq) && + (mac_ctx->lim.gpSession[i].limSystemRole == + eLIM_STA_ROLE))) continue; concurrent_session = &(mac_ctx->lim.gpSession[i]); 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 5a4ecc5bb7e9..9bb643fc76c8 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 @@ -254,7 +254,9 @@ populate_dot11_supp_operating_classes(struct mac_context *mac_ptr, &dot_11_ptr->classes[1]); dot_11_ptr->classes[0] = wlan_reg_dmn_get_opclass_from_channel( mac_ptr->scan.countryCodeCurrent, - session_entry->currentOperChannel, + wlan_reg_freq_to_chan( + mac_ptr->pdev, + session_entry->curr_op_freq), ch_bandwidth); dot_11_ptr->num_classes++; dot_11_ptr->present = 1; @@ -374,7 +376,8 @@ populate_dot11f_avoid_channel_ie(struct mac_context *mac_ctx, dot11f->present = true; dot11f->type = QCOM_VENDOR_IE_MCC_AVOID_CH; - dot11f->channel = pe_session->currentOperChannel; + dot11f->channel = wlan_reg_freq_to_chan( + mac_ctx->pdev, pe_session->curr_op_freq); } #endif /* FEATURE_AP_MCC_CH_AVOIDANCE */ @@ -713,12 +716,13 @@ populate_dot11f_ht_caps(struct mac_context *mac, disable_high_ht_mcs_2x2); if (pe_session->nss == NSS_1x1_MODE) { pDot11f->supportedMCSSet[1] = 0; - } else if (IS_24G_CH(pe_session->currentOperChannel) && + } else if (wlan_reg_is_24ghz_ch_freq( + pe_session->curr_op_freq) && disable_high_ht_mcs_2x2 && (pe_session->opmode == QDF_STA_MODE)) { - pe_debug("Disabling high HT MCS [%d]", - disable_high_ht_mcs_2x2); - pDot11f->supportedMCSSet[1] = + pe_debug("Disabling high HT MCS [%d]", + disable_high_ht_mcs_2x2); + pDot11f->supportedMCSSet[1] = (pDot11f->supportedMCSSet[1] >> disable_high_ht_mcs_2x2); } @@ -1190,7 +1194,8 @@ populate_dot11f_ht_info(struct mac_context *mac, return QDF_STATUS_E_FAILURE; } - pDot11f->primaryChannel = pe_session->currentOperChannel; + pDot11f->primaryChannel = wlan_reg_freq_to_chan( + mac->pdev, pe_session->curr_op_freq); pDot11f->secondaryChannelOffset = pe_session->htSecondaryChannelOffset; @@ -1699,7 +1704,8 @@ populate_dot11f_tpc_report(struct mac_context *mac, return QDF_STATUS_E_FAILURE; } tx_power = lim_get_regulatory_max_transmit_power( - mac, pe_session->currentOperChannel); + mac, wlan_reg_freq_to_chan( + mac->pdev, pe_session->curr_op_freq)); pDot11f->tx_power = tx_power; pDot11f->link_margin = 0; pDot11f->present = 1; @@ -5942,14 +5948,14 @@ QDF_STATUS populate_dot11f_he_caps(struct mac_context *mac_ctx, struct pe_sessio if (he_cap->ppet_present) { value = WNI_CFG_HE_PPET_LEN; /* if session is present, populate PPET based on band */ - if (IS_5G_CH(session->currentOperChannel)) - qdf_mem_copy(he_cap->ppet.ppe_threshold.ppe_th, - mac_ctx->mlme_cfg->he_caps.he_ppet_5g, - value); + if (wlan_reg_is_5ghz_ch_freq(session->curr_op_freq)) + qdf_mem_copy(he_cap->ppet.ppe_threshold.ppe_th, + mac_ctx->mlme_cfg->he_caps.he_ppet_5g, + value); else - qdf_mem_copy(he_cap->ppet.ppe_threshold.ppe_th, - mac_ctx->mlme_cfg->he_caps.he_ppet_2g, - value); + qdf_mem_copy(he_cap->ppet.ppe_threshold.ppe_th, + mac_ctx->mlme_cfg->he_caps.he_ppet_2g, + value); ppet = he_cap->ppet.ppe_threshold.ppe_th; he_cap->ppet.ppe_threshold.num_ppe_th =