diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index 921fb14965..7e1d4b336d 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -4118,9 +4118,6 @@ int wlan_hdd_cfg80211_update_apies(struct hdd_adapter *adapter) mac_handle = adapter->hdd_ctx->mac_handle; - wlan_hdd_add_extra_ie(adapter, genie, &total_ielen, - WLAN_EID_VHT_TX_POWER_ENVELOPE); - /* Extract and add the extended capabilities and interworking IE */ wlan_hdd_add_extra_ie(adapter, genie, &total_ielen, WLAN_EID_EXT_CAPABILITY); diff --git a/core/mac/src/cfg/cfgUtil/dot11f.frms b/core/mac/src/cfg/cfgUtil/dot11f.frms index db188008cc..3f4f5d0cc8 100644 --- a/core/mac/src/cfg/cfgUtil/dot11f.frms +++ b/core/mac/src/cfg/cfgUtil/dot11f.frms @@ -3547,6 +3547,8 @@ FRAME Beacon2 OPTIE P2PBeacon; OPTIE VHTCaps; OPTIE VHTOperation; + OPTIE vht_transmit_power_env; + OPTIE ChannelSwitchWrapper; OPTIE VHTExtBssLoad; OPTIE ExtCap; OPTIE OperatingMode; @@ -3557,7 +3559,6 @@ FRAME Beacon2 OPTIE vendor_vht_ie; OPTIE Vendor3IE; OPTIE hs20vendor_ie; - OPTIE ChannelSwitchWrapper; OPTIE QComVendorIE; OPTIE ESEVersion; OPTIE QCN_IE; diff --git a/core/mac/src/include/dot11f.h b/core/mac/src/include/dot11f.h index efa5372a95..20b7f30b0a 100644 --- a/core/mac/src/include/dot11f.h +++ b/core/mac/src/include/dot11f.h @@ -26,7 +26,7 @@ * * * This file was automatically generated by 'framesc' - * Wed Apr 24 14:55:45 2019 from the following file(s): + * Fri May 31 20:00:27 2019 from the following file(s): * * dot11f.frms * @@ -9752,54 +9752,55 @@ uint32_t dot11f_get_packed_beacon1_size(tpAniSirGlobal pCtx, #endif /* C++ */ typedef struct sDot11fBeacon2{ - tDot11fIECountry Country; - tDot11fIEPowerConstraints PowerConstraints; - tDot11fIEChanSwitchAnn ChanSwitchAnn; - tDot11fIEext_chan_switch_ann ext_chan_switch_ann; - tDot11fIESuppOperatingClasses SuppOperatingClasses; - tDot11fIEQuiet Quiet; - tDot11fIETPCReport TPCReport; - tDot11fIEERPInfo ERPInfo; - tDot11fIEExtSuppRates ExtSuppRates; - tDot11fIERSNOpaque RSNOpaque; - tDot11fIEEDCAParamSet EDCAParamSet; - tDot11fIEAPChannelReport APChannelReport; - tDot11fIERRMEnabledCap RRMEnabledCap; - tDot11fIEMobilityDomain MobilityDomain; - tDot11fIEWPA WPA; - tDot11fIEHTCaps HTCaps; - tDot11fIEHTInfo HTInfo; - tDot11fIEsec_chan_offset_ele sec_chan_offset_ele; - tDot11fIEWMMInfoAp WMMInfoAp; - tDot11fIEWMMParams WMMParams; - tDot11fIEWMMCaps WMMCaps; - tDot11fIEWscBeacon WscBeacon; - tDot11fIEWAPI WAPI; - tDot11fIEESERadMgmtCap ESERadMgmtCap; - tDot11fIEESETrafStrmMet ESETrafStrmMet; - tDot11fIEESETxmitPower ESETxmitPower; - tDot11fIEP2PBeacon P2PBeacon; - tDot11fIEVHTCaps VHTCaps; - tDot11fIEVHTOperation VHTOperation; - tDot11fIEVHTExtBssLoad VHTExtBssLoad; - tDot11fIEExtCap ExtCap; - tDot11fIEOperatingMode OperatingMode; - tDot11fIEWiderBWChanSwitchAnn WiderBWChanSwitchAnn; - tDot11fIEOBSSScanParameters OBSSScanParameters; - tDot11fIEfils_indication fils_indication; - tDot11fIEVendor1IE Vendor1IE; - tDot11fIEvendor_vht_ie vendor_vht_ie; - tDot11fIEVendor3IE Vendor3IE; - tDot11fIEhs20vendor_ie hs20vendor_ie; - tDot11fIEChannelSwitchWrapper ChannelSwitchWrapper; - tDot11fIEQComVendorIE QComVendorIE; - tDot11fIEESEVersion ESEVersion; - tDot11fIEQCN_IE QCN_IE; - tDot11fIEhe_cap he_cap; - tDot11fIEhe_op he_op; - tDot11fIEbss_color_change bss_color_change; - tDot11fIEmu_edca_param_set mu_edca_param_set; - tDot11fIEesp_information esp_information; + tDot11fIECountry Country; + tDot11fIEPowerConstraints PowerConstraints; + tDot11fIEChanSwitchAnn ChanSwitchAnn; + tDot11fIEext_chan_switch_ann ext_chan_switch_ann; + tDot11fIESuppOperatingClasses SuppOperatingClasses; + tDot11fIEQuiet Quiet; + tDot11fIETPCReport TPCReport; + tDot11fIEERPInfo ERPInfo; + tDot11fIEExtSuppRates ExtSuppRates; + tDot11fIERSNOpaque RSNOpaque; + tDot11fIEEDCAParamSet EDCAParamSet; + tDot11fIEAPChannelReport APChannelReport; + tDot11fIERRMEnabledCap RRMEnabledCap; + tDot11fIEMobilityDomain MobilityDomain; + tDot11fIEWPA WPA; + tDot11fIEHTCaps HTCaps; + tDot11fIEHTInfo HTInfo; + tDot11fIEsec_chan_offset_ele sec_chan_offset_ele; + tDot11fIEWMMInfoAp WMMInfoAp; + tDot11fIEWMMParams WMMParams; + tDot11fIEWMMCaps WMMCaps; + tDot11fIEWscBeacon WscBeacon; + tDot11fIEWAPI WAPI; + tDot11fIEESERadMgmtCap ESERadMgmtCap; + tDot11fIEESETrafStrmMet ESETrafStrmMet; + tDot11fIEESETxmitPower ESETxmitPower; + tDot11fIEP2PBeacon P2PBeacon; + tDot11fIEVHTCaps VHTCaps; + tDot11fIEVHTOperation VHTOperation; + tDot11fIEvht_transmit_power_env vht_transmit_power_env; + tDot11fIEChannelSwitchWrapper ChannelSwitchWrapper; + tDot11fIEVHTExtBssLoad VHTExtBssLoad; + tDot11fIEExtCap ExtCap; + tDot11fIEOperatingMode OperatingMode; + tDot11fIEWiderBWChanSwitchAnn WiderBWChanSwitchAnn; + tDot11fIEOBSSScanParameters OBSSScanParameters; + tDot11fIEfils_indication fils_indication; + tDot11fIEVendor1IE Vendor1IE; + tDot11fIEvendor_vht_ie vendor_vht_ie; + tDot11fIEVendor3IE Vendor3IE; + tDot11fIEhs20vendor_ie hs20vendor_ie; + tDot11fIEQComVendorIE QComVendorIE; + tDot11fIEESEVersion ESEVersion; + tDot11fIEQCN_IE QCN_IE; + tDot11fIEhe_cap he_cap; + tDot11fIEhe_op he_op; + tDot11fIEbss_color_change bss_color_change; + tDot11fIEmu_edca_param_set mu_edca_param_set; + tDot11fIEesp_information esp_information; } tDot11fBeacon2; #define DOT11F_BEACON2 (8) diff --git a/core/mac/src/include/parser_api.h b/core/mac/src/include/parser_api.h index 82424520ba..4237484b5a 100644 --- a/core/mac/src/include/parser_api.h +++ b/core/mac/src/include/parser_api.h @@ -695,6 +695,10 @@ populate_dot_11_f_ext_chann_switch_ann(struct mac_context *mac_ptr, tDot11fIEext_chan_switch_ann *dot_11_ptr, struct pe_session *session_entry); +void +populate_dot11f_vht_tx_power_env(struct mac_context *mac, + tDot11fIEvht_transmit_power_env *pDot11f, + enum phy_ch_width ch_width, uint8_t chan); /* / Populate a tDot11fIEChannelSwitchWrapper */ void populate_dot11f_chan_switch_wrapper(struct mac_context *mac, diff --git a/core/mac/src/pe/sch/sch_beacon_gen.c b/core/mac/src/pe/sch/sch_beacon_gen.c index 2b1fe2841f..ac1a6c003e 100644 --- a/core/mac/src/pe/sch/sch_beacon_gen.c +++ b/core/mac/src/pe/sch/sch_beacon_gen.c @@ -455,6 +455,10 @@ sch_set_fixed_beacon_fields(struct mac_context *mac_ctx, struct pe_session *sess /* populate_dot11f_vht_ext_bss_load( mac_ctx, &bcn2.VHTExtBssLoad); */ + populate_dot11f_vht_tx_power_env(mac_ctx, + &bcn_2->vht_transmit_power_env, + session->ch_width, + session->currentOperChannel); } if (lim_is_session_he_capable(session)) { diff --git a/core/mac/src/sys/legacy/src/utils/src/dot11f.c b/core/mac/src/sys/legacy/src/utils/src/dot11f.c index 3473a442cf..df595dada9 100644 --- a/core/mac/src/sys/legacy/src/utils/src/dot11f.c +++ b/core/mac/src/sys/legacy/src/utils/src/dot11f.c @@ -24,7 +24,7 @@ * * * This file was automatically generated by 'framesc' - * Wed Apr 24 14:55:45 2019 from the following file(s): + * Fri May 31 20:00:27 2019 from the following file(s): * * dot11f.frms * @@ -10302,6 +10302,14 @@ static const tIEDefn IES_Beacon2[] = { { offsetof(tDot11fBeacon2, VHTOperation), offsetof(tDot11fIEVHTOperation, present), 0, "VHTOperation", 0, 7, 7, SigIeVHTOperation, {0, 0, 0, 0, 0}, 0, DOT11F_EID_VHTOPERATION, 0, 0, }, + { offsetof(tDot11fBeacon2, vht_transmit_power_env), + offsetof(tDot11fIEvht_transmit_power_env, present), 0, + "vht_transmit_power_env", 0, 4, 7, SigIevht_transmit_power_env, + {0, 0, 0, 0, 0}, 0, DOT11F_EID_VHT_TRANSMIT_POWER_ENV, 0, 0, }, + { offsetof(tDot11fBeacon2, ChannelSwitchWrapper), + offsetof(tDot11fIEChannelSwitchWrapper, present), 0, + "ChannelSwitchWrapper", 0, 2, 14, SigIeChannelSwitchWrapper, + {0, 0, 0, 0, 0}, 0, DOT11F_EID_CHANNELSWITCHWRAPPER, 0, 0, }, { offsetof(tDot11fBeacon2, VHTExtBssLoad), offsetof(tDot11fIEVHTExtBssLoad, present), 0, "VHTExtBssLoad", 0, 7, 7, SigIeVHTExtBssLoad, {0, 0, 0, 0, 0}, @@ -10339,10 +10347,6 @@ static const tIEDefn IES_Beacon2[] = { offsetof(tDot11fIEhs20vendor_ie, present), 0, "hs20vendor_ie", 0, 7, 9, SigIehs20vendor_ie, {80, 111, 154, 16, 0}, 4, DOT11F_EID_HS20VENDOR_IE, 0, 0, }, - { offsetof(tDot11fBeacon2, ChannelSwitchWrapper), - offsetof(tDot11fIEChannelSwitchWrapper, present), 0, - "ChannelSwitchWrapper", 0, 2, 14, SigIeChannelSwitchWrapper, - {0, 0, 0, 0, 0}, 0, DOT11F_EID_CHANNELSWITCHWRAPPER, 0, 0, }, { offsetof(tDot11fBeacon2, QComVendorIE), offsetof(tDot11fIEQComVendorIE, present), 0, "QComVendorIE", 0, 7, 7, SigIeQComVendorIE, {0, 160, 198, 0, 0}, 3, DOT11F_EID_QCOMVENDORIE, 0, 0, }, 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 e6094e66a8..c58dcdb671 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 @@ -260,13 +260,69 @@ populate_dot11_supp_operating_classes(struct mac_context *mac_ptr, dot_11_ptr->present = 1; } +void +populate_dot11f_vht_tx_power_env(struct mac_context *mac, + tDot11fIEvht_transmit_power_env *pDot11f, + enum phy_ch_width ch_width, uint8_t chan) +{ + uint8_t num_tx_power, i, tx_power; + int reg_max; + + switch (ch_width) { + case CH_WIDTH_20MHZ: + /* Max Transmit Power count = 0 (20 MHz) */ + num_tx_power = 0; + break; + case CH_WIDTH_40MHZ: + /* Max Transmit Power count = 1 (20, 40 MHz) */ + num_tx_power = 1; + break; + case CH_WIDTH_80MHZ: + /* Max Transmit Power count = 2 (20, 40, and 80 MHz) */ + num_tx_power = 2; + break; + case CH_WIDTH_160MHZ: + case CH_WIDTH_80P80MHZ: + /* Max Transmit Power count = 3 (20, 40, 80, 160/80+80 MHz) */ + num_tx_power = 3; + break; + default: + return; + } + + reg_max = lim_get_regulatory_max_transmit_power(mac, chan); + + /* in 0.5 dB steps */ + reg_max *= 2; + if (reg_max > 127) + /* 63.5 has special meaning of 63.5 dBm or higher */ + reg_max = 127; + + if (reg_max < -128) + reg_max = -128; + + if (reg_max < 0) + tx_power = 0x80 + reg_max + 128; + else + tx_power = reg_max; + + /* Ignore EID field */ + pDot11f->present = 1; + pDot11f->num_bytes = num_tx_power + 2; + /* + * Max Transmit Power count and + * Max Transmit Power units = 0 (EIRP) + */ + pDot11f->bytes[0] = num_tx_power; + for (i = 0; i <= num_tx_power; i++) + pDot11f->bytes[i + 1] = tx_power; +} + void populate_dot11f_chan_switch_wrapper(struct mac_context *mac, tDot11fIEChannelSwitchWrapper *pDot11f, struct pe_session *pe_session) { - const uint8_t *ie_ptr = NULL; - /* * The new country subelement is present only when * 1. AP performs Extended Channel switching to new country. @@ -299,18 +355,12 @@ populate_dot11f_chan_switch_wrapper(struct mac_context *mac, /* * Add the VHT Transmit power Envelope Sublement. */ - ie_ptr = wlan_get_ie_ptr_from_eid( - DOT11F_EID_VHT_TRANSMIT_POWER_ENV, - pe_session->add_ie_params.probeRespBCNData_buff, - pe_session->add_ie_params.probeRespBCNDataLen); - if (ie_ptr) { - /* Ignore EID field */ - pDot11f->vht_transmit_power_env.present = 1; - pDot11f->vht_transmit_power_env.num_bytes = ie_ptr[1]; - qdf_mem_copy(pDot11f->vht_transmit_power_env.bytes, - &ie_ptr[2], pDot11f->vht_transmit_power_env.num_bytes); + if (pe_session->vhtCapability) { + populate_dot11f_vht_tx_power_env(mac, + &pDot11f->vht_transmit_power_env, + pe_session->gLimChannelSwitch.ch_width, + pe_session->gLimChannelSwitch.primaryChannel); } - } #ifdef FEATURE_AP_MCC_CH_AVOIDANCE