From a7776a9fdde47dc79e146c6f92adfe1d507f7ffc Mon Sep 17 00:00:00 2001 From: Krishna Kumaar Natarajan Date: Tue, 3 Nov 2015 11:44:03 -0800 Subject: [PATCH] qcacld-3.0: Support to configure RM enabled capability IE qcacld-2.0 to qcacld-3.0 propagation Add support to configure RM enabled capbility information element through INI. Using the introduced INI config option(rm_capability), we can set or unset any bit in the IE. Default value for the config parameter is set based on rrmInitialize routine. Change-Id: Ia2a4352760db77ab71dad4757eb603d7539ffefa CRs-Fixed: 918667 --- core/hdd/inc/wlan_hdd_cfg.h | 17 +++ core/hdd/src/wlan_hdd_cfg.c | 119 ++++++++++------- core/mac/inc/sir_api.h | 9 ++ core/mac/src/pe/include/rrm_api.h | 13 +- core/mac/src/pe/include/rrm_global.h | 123 ++++++++++++++++++ core/mac/src/pe/lim/lim_process_cfg_updates.c | 3 - .../src/pe/lim/lim_process_sme_req_messages.c | 36 ++--- core/mac/src/pe/rrm/rrm_api.c | 73 ++++------- .../src/sys/legacy/src/utils/src/parser_api.c | 5 + core/sme/inc/sme_api.h | 2 +- core/sme/inc/sme_rrm_api.h | 2 +- core/sme/inc/sme_rrm_internal.h | 7 +- core/sme/src/csr/csr_api_roam.c | 5 + core/sme/src/rrm/sme_rrm.c | 10 +- 14 files changed, 285 insertions(+), 139 deletions(-) diff --git a/core/hdd/inc/wlan_hdd_cfg.h b/core/hdd/inc/wlan_hdd_cfg.h index 0e2e2fd236c3..198a5a0e3675 100644 --- a/core/hdd/inc/wlan_hdd_cfg.h +++ b/core/hdd/inc/wlan_hdd_cfg.h @@ -818,6 +818,18 @@ typedef enum { #define CFG_RRM_MEAS_RANDOMIZATION_INTVL_MIN (10) #define CFG_RRM_MEAS_RANDOMIZATION_INTVL_MAX (100) #define CFG_RRM_MEAS_RANDOMIZATION_INTVL_DEFAULT (100) + +/** + * This INI is used to configure RM enabled capabilities IE. + * Using this INI, we can set/unset any of the bits in 5 bytes + * (last 4bytes are reserved). Bit details are updated as per + * Draft version of 11mc spec. (Draft P802.11REVmc_D4.2) + * + * Bitwise details are defined as bit mask in rrmGlobal.h + * Comma is used as a separator for each byte. + */ +#define CFG_RM_CAPABILITY_NAME "rm_capability" +#define CFG_RM_CAPABILITY_DEFAULT "73,00,6D,00,04" #endif #define CFG_QOS_IMPLICIT_SETUP_ENABLED_NAME "ImplicitQosIsEnabled" @@ -2808,6 +2820,8 @@ struct hdd_config { uint8_t nInChanMeasMaxDuration; uint8_t nOutChanMeasMaxDuration; uint16_t nRrmRandnIntvl; + /* length includes separator */ + char rm_capability[3 * DOT11F_IE_RRMENABLEDCAP_MAX_LEN]; #endif #ifdef WLAN_FEATURE_VOWIFI_11R @@ -3442,6 +3456,9 @@ void hdd_dfs_indicate_radar(void *context, void *param); CDF_STATUS hdd_string_to_u8_array(char *str, uint8_t *intArray, uint8_t *len, uint8_t intArrayMaxLen); +CDF_STATUS hdd_hex_string_to_u16_array(char *str, uint16_t *int_array, + uint8_t *len, uint8_t int_array_max_len); + void hdd_cfg_print(hdd_context_t *pHddCtx); CDF_STATUS hdd_update_nss(hdd_context_t *hdd_ctx, uint8_t nss); diff --git a/core/hdd/src/wlan_hdd_cfg.c b/core/hdd/src/wlan_hdd_cfg.c index 1ba3b80c8444..da08ff7e621e 100644 --- a/core/hdd/src/wlan_hdd_cfg.c +++ b/core/hdd/src/wlan_hdd_cfg.c @@ -1333,6 +1333,11 @@ REG_TABLE_ENTRY g_registry_table[] = { CFG_RRM_MEAS_RANDOMIZATION_INTVL_DEFAULT, CFG_RRM_MEAS_RANDOMIZATION_INTVL_MIN, CFG_RRM_MEAS_RANDOMIZATION_INTVL_MAX), + + REG_VARIABLE_STRING(CFG_RM_CAPABILITY_NAME, WLAN_PARAM_String, + struct hdd_config, rm_capability, + VAR_FLAGS_OPTIONAL, + (void *) CFG_RM_CAPABILITY_DEFAULT), #endif #ifdef WLAN_FEATURE_VOWIFI_11R @@ -5403,40 +5408,85 @@ static void hdd_set_fine_time_meas_cap(hdd_context_t *hdd_ctx, } /** - * hdd_string_to_u8_array() - scan the string and convert to u8 array - * @str: the pointer to the string - * @intArray: the pointer of buffer to store the u8 value - * @len: size of the buffer + * hdd_convert_string_to_u8_array() - used to convert string into u8 array + * @str: String to be converted + * @hex_array: Array where converted value is stored + * @len: Length of the populated array + * @array_max_len: Maximum length of the array + * @to_hex: true, if conversion required for hex string * - * Return: CDF_STATUS_SUCCESS if the conversion is done, - * otherwise CDF_STATUS_E_INVAL + * This API is called to convert string (each byte separated by + * a comma) into an u8 array + * + * Return: CDF_STATUS */ -CDF_STATUS hdd_string_to_u8_array(char *str, uint8_t *intArray, uint8_t *len, - uint8_t intArrayMaxLen) + +static CDF_STATUS hdd_convert_string_to_array(char *str, uint8_t *array, + uint8_t *len, uint8_t array_max_len, bool to_hex) { - char *s = str; + char *format, *s = str; - if (str == NULL || intArray == NULL || len == NULL) { + if (str == NULL || array == NULL || len == NULL) return CDF_STATUS_E_INVAL; - } - *len = 0; - while ((s != NULL) && (*len < intArrayMaxLen)) { + format = (to_hex) ? "%02x" : "%d"; + + *len = 0; + while ((s != NULL) && (*len < array_max_len)) { int val; - /* Increment length only if sscanf succesfully extracted one element. - * Any other return value means error. Ignore it. - */ - if (sscanf(s, "%d", &val) == 1) { - intArray[*len] = (uint8_t) val; + /* Increment length only if sscanf successfully extracted + * one element. Any other return value means error. + * Ignore it. */ + if (sscanf(s, format, &val) == 1) { + array[*len] = (uint8_t) val; *len += 1; } + s = strpbrk(s, ","); if (s) s++; } return CDF_STATUS_SUCCESS; +} +/** + * hdd_hex_string_to_u8_array() - used to convert hex string into u8 array + * @str: Hexadecimal string + * @hex_array: Array where converted value is stored + * @len: Length of the populated array + * @array_max_len: Maximum length of the array + * + * This API is called to convert hexadecimal string (each byte separated by + * a comma) into an u8 array + * + * Return: CDF_STATUS + */ +CDF_STATUS hdd_hex_string_to_u8_array(char *str, uint8_t *hex_array, + uint8_t *len, uint8_t array_max_len) +{ + return hdd_convert_string_to_array(str, hex_array, len, + array_max_len, true); +} + +/** + * hdd_string_to_u8_array() - used to convert decimal string into u8 array + * @str: Decimal string + * @hex_array: Array where converted value is stored + * @len: Length of the populated array + * @array_max_len: Maximum length of the array + * + * This API is called to convert decimal string (each byte separated by + * a comma) into an u8 array + * + * Return: CDF_STATUS + */ + +CDF_STATUS hdd_string_to_u8_array(char *str, uint8_t *array, + uint8_t *len, uint8_t array_max_len) +{ + return hdd_convert_string_to_array(str, array, len, + array_max_len, false); } /** @@ -5636,31 +5686,6 @@ bool hdd_update_config_dat(hdd_context_t *pHddCtx) } #if defined WLAN_FEATURE_VOWIFI - if (sme_cfg_set_int - (pHddCtx->hHal, WNI_CFG_RRM_ENABLED, pConfig->fRrmEnable) - == CDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_RRM_ENABLE to CFG"); - } - - if (sme_cfg_set_int - (pHddCtx->hHal, WNI_CFG_RRM_OPERATING_CHAN_MAX, - pConfig->nInChanMeasMaxDuration) == CDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_RRM_OPERATING_CHAN_MAX to CFG"); - } - - if (sme_cfg_set_int - (pHddCtx->hHal, WNI_CFG_RRM_NON_OPERATING_CHAN_MAX, - pConfig->nOutChanMeasMaxDuration) == - CDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_RRM_OUT_CHAN_MAX to CFG"); - } - if (sme_cfg_set_int (pHddCtx->hHal, WNI_CFG_MCAST_BCAST_FILTER_SETTING, pConfig->mcastBcastFilterSetting) == CDF_STATUS_E_FAILURE) @@ -6215,6 +6240,7 @@ CDF_STATUS hdd_set_sme_config(hdd_context_t *pHddCtx) { CDF_STATUS status = CDF_STATUS_SUCCESS; tSmeConfigParams *smeConfig; + uint8_t rrm_capab_len; struct hdd_config *pConfig = pHddCtx->config; @@ -6299,8 +6325,11 @@ CDF_STATUS hdd_set_sme_config(hdd_context_t *pHddCtx) smeConfig->csrConfig.WMMSupportMode = pConfig->WmmMode; #if defined WLAN_FEATURE_VOWIFI - smeConfig->rrmConfig.rrmEnabled = pConfig->fRrmEnable; - smeConfig->rrmConfig.maxRandnInterval = pConfig->nRrmRandnIntvl; + smeConfig->rrmConfig.rrm_enabled = pConfig->fRrmEnable; + smeConfig->rrmConfig.max_randn_interval = pConfig->nRrmRandnIntvl; + hdd_hex_string_to_u8_array(pConfig->rm_capability, + smeConfig->rrmConfig.rm_capability, &rrm_capab_len, + DOT11F_IE_RRMENABLEDCAP_MAX_LEN); #endif /* Remaining config params not obtained from registry * On RF EVB beacon using channel 1. diff --git a/core/mac/inc/sir_api.h b/core/mac/inc/sir_api.h index ba16dd997141..7f1f5232bb0c 100644 --- a/core/mac/inc/sir_api.h +++ b/core/mac/inc/sir_api.h @@ -278,6 +278,14 @@ typedef enum eSirResultCodes { eSIR_DONOT_USE_RESULT_CODE = SIR_MAX_ENUM_SIZE } tSirResultCodes; +#define RMENABLEDCAP_MAX_LEN 5 + +struct rrm_config_param { + uint8_t rrm_enabled; + uint8_t max_randn_interval; + uint8_t rm_capability[RMENABLEDCAP_MAX_LEN]; +}; + /* each station added has a rate mode which specifies the sta attributes */ typedef enum eStaRateMode { eSTA_TAURUS = 0, @@ -973,6 +981,7 @@ typedef struct sSirSmeJoinReq { tAniBool isWMEenabled; tAniBool isQosEnabled; tAniBool isOSENConnection; + struct rrm_config_param rrm_config; tAniBool spectrumMgtIndicator; tSirMacPowerCapInfo powerCap; tSirSupChnl supportedChannels; diff --git a/core/mac/src/pe/include/rrm_api.h b/core/mac/src/pe/include/rrm_api.h index 05466c00423c..849fa5c17919 100644 --- a/core/mac/src/pe/include/rrm_api.h +++ b/core/mac/src/pe/include/rrm_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2012, 2014 The Linux Foundation. All rights reserved. + * Copyright (c) 2011-2012, 2014-2015 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -38,6 +38,7 @@ #ifndef __RRM_API_H__ #define __RRM_API_H__ +#ifdef WLAN_FEATURE_VOWIFI #define RRM_MIN_TX_PWR_CAP 13 #define RRM_MAX_TX_PWR_CAP 19 @@ -86,8 +87,6 @@ extern void rrm_cache_mgmt_tx_power(tpAniSirGlobal pMac, extern tpRRMCaps rrm_get_capabilities(tpAniSirGlobal pMac, tpPESession pSessionEntry); -extern void rrm_update_config(tpAniSirGlobal pMac, tpPESession pSessionEntry); - extern void rrm_get_start_tsf(tpAniSirGlobal pMac, uint32_t *pStartTSF); extern void rrm_update_start_tsf(tpAniSirGlobal pMac, uint32_t startTSF[2]); @@ -101,4 +100,12 @@ rrm_process_neighbor_report_req(tpAniSirGlobal pMac, extern tSirRetStatus rrm_process_beacon_report_xmit(tpAniSirGlobal pMac, tpSirBeaconReportXmitInd pBcnReport); +extern void lim_update_rrm_capability(tpAniSirGlobal mac_ctx, + tpSirSmeJoinReq join_req); +#else +void lim_update_rrm_capability(tpAniSirGlobal mac_ctx, + tpSirSmeJoinReq join_req) +{ +} +#endif #endif diff --git a/core/mac/src/pe/include/rrm_global.h b/core/mac/src/pe/include/rrm_global.h index 053848d1f0c5..a1db83544444 100644 --- a/core/mac/src/pe/include/rrm_global.h +++ b/core/mac/src/pe/include/rrm_global.h @@ -225,4 +225,127 @@ typedef struct sRrmPEContext { #define RCPI_MAX_VALUE (220) #define CALCULATE_RCPI(rssi) (((rssi) + 110) * 2) +/* Bit mask are defined as per Draft P802.11REVmc_D4.2 */ + +/** + * enum mask_rm_capability_byte1 - mask for supported capability + * @RM_CAP_LINK_MEASUREMENT: Link Measurement capability + * @RM_CAP_NEIGHBOR_REPORT: Neighbor report capability + * @RM_CAP_PARALLEL_MEASUREMENT: Parallel Measurement capability + * @RM_CAP_REPEATED_MEASUREMENT: Repeated Measurement capability + * @RM_CAP_BCN_PASSIVE_MEASUREMENT: Beacon passive measurement capability + * @RM_CAP_BCN_ACTIVE_MEASUREMENT: Beacon active measurement capability + * @RM_CAP_BCN_TABLE_MEASUREMENT: Beacon table measurement capability + * @RM_CAP_BCN_MEAS_REPORTING_COND: Beacon measurement reporting conditions + */ +enum mask_rm_capability_byte1 { + RM_CAP_LINK_MEASUREMENT = (1 << (0)), + RM_CAP_NEIGHBOR_REPORT = (1 << (1)), + RM_CAP_PARALLEL_MEASUREMENT = (1 << (2)), + RM_CAP_REPEATED_MEASUREMENT = (1 << (3)), + RM_CAP_BCN_PASSIVE_MEASUREMENT = (1 << (4)), + RM_CAP_BCN_ACTIVE_MEASUREMENT = (1 << (5)), + RM_CAP_BCN_TABLE_MEASUREMENT = (1 << (6)), + RM_CAP_BCN_MEAS_REPORTING_COND = (1 << (7)), +}; + +/** + * enum mask_rm_capability_byte2 - mask for supported capability + * @RM_CAP_FRAME_MEASUREMENT: Frame Measurement capability + * @RM_CAP_CHAN_LOAD_MEASUREMENT: Channel load measurement capability + * @RM_CAP_NOISE_HIST_MEASUREMENT: Noise Histogram Measurement capability + * @RM_CAP_STATISTICS_MEASUREMENT: Statistics Measurement capability + * @RM_CAP_LCI_MEASUREMENT: LCI measurement capability + * @RM_CAP_LCI_AZIMUTH: LCI Azimuth capability + * @RM_CAP_TX_CATEGORY_MEASUREMENT: Transmit category measurement capability + * @RM_CAP_TRIG_TX_CATEGORY_MEASUREMENT: + * Triggered Transmit category measurement capability + */ +enum mask_rm_capability_byte2 { + RM_CAP_FRAME_MEASUREMENT = (1 << (0)), + RM_CAP_CHAN_LOAD_MEASUREMENT = (1 << (1)), + RM_CAP_NOISE_HIST_MEASUREMENT = (1 << (2)), + RM_CAP_STATISTICS_MEASUREMENT = (1 << (3)), + RM_CAP_LCI_MEASUREMENT = (1 << (4)), + RM_CAP_LCI_AZIMUTH = (1 << (5)), + RM_CAP_TX_CATEGORY_MEASUREMENT = (1 << (6)), + RM_CAP_TRIG_TX_CATEGORY_MEASUREMENT = (1 << (7)), +}; + +/** + * enum mask_rm_capability_byte3 - mask for supported capability + * @RM_CAP_AP_CHAN_REPORT: AP channel report capability + * @RM_CAP_RM_MIB: RM MIB capability + * @RM_CAP_OPER_CHAN_MAX_DURATION_1: OPER_CHAN_MAX_DURATION bit1 + * @RM_CAP_OPER_CHAN_MAX_DURATION_2: OPER_CHAN_MAX_DURATION bit2 + * @RM_CAP_OPER_CHAN_MAX_DURATION_3: OPER_CHAN_MAX_DURATION bit3 + * @RM_CAP_NONOPER_CHAN_MAX_DURATION_1: NONOPER_CHAN_MAX bit1 + * @RM_CAP_NONOPER_CHAN_MAX_DURATION_2: NONOPER_CHAN_MAX bit2 + * @RM_CAP_NONOPER_CHAN_MAX_DURATION_3: NONOPER_CHAN_MAX bit3 + * @RM_CAP_OPER_CHAN_MAX_DURATION: Operating Channel Max Measurement Duration + * @RM_CAP_NONOPER_CHAN_MAX_DURATION: + * Nonoperating Channel Max Measurement Duration + */ + +enum mask_rm_capability_byte3 { + RM_CAP_AP_CHAN_REPORT = (1 << (0)), + RM_CAP_RM_MIB = (1 << (1)), + RM_CAP_OPER_CHAN_MAX_DURATION_1 = (1 << (2)), + RM_CAP_OPER_CHAN_MAX_DURATION_2 = (1 << (3)), + RM_CAP_OPER_CHAN_MAX_DURATION_3 = (1 << (4)), + RM_CAP_NONOPER_CHAN_MAX_DURATION_1 = (1 << (5)), + RM_CAP_NONOPER_CHAN_MAX_DURATION_2 = (1 << (6)), + RM_CAP_NONOPER_CHAN_MAX_DURATION_3 = (1 << (7)), + RM_CAP_OPER_CHAN_MAX_DURATION = (RM_CAP_OPER_CHAN_MAX_DURATION_1 || + RM_CAP_OPER_CHAN_MAX_DURATION_2 || + RM_CAP_OPER_CHAN_MAX_DURATION_3), + RM_CAP_NONOPER_CHAN_MAX_DURATION = + (RM_CAP_NONOPER_CHAN_MAX_DURATION_1 || + RM_CAP_NONOPER_CHAN_MAX_DURATION_2 || + RM_CAP_NONOPER_CHAN_MAX_DURATION_3), +}; + +/** + * enum mask_rm_capability_byte4 - mask for supported capability + * @RM_CAP_MEASUREMENT_PILOT_1: MEASUREMENT_PILOT bit1 + * @RM_CAP_MEASUREMENT_PILOT_2: MEASUREMENT_PILOT bit2 + * @RM_CAP_MEASUREMENT_PILOT_3: MEASUREMENT_PILOT bit3 + * @RM_CAP_MEAS_PILOT_TX_INFO: Measurement Pilot Transmission Capability + * @RM_CAP_NEIGHBOR_RPT_TSF_OFFSET: Neighbor Report TSF Offset Capability + * @RM_CAP_RCPI_MEASUREMENT: RCPI Measurement Capability + * @RM_CAP_RSNI_MEASUREMENT: RSNI Measurement Capability + * @RM_CAP_BSS_AVG_ACCESS_DELAY: BSS Average Access Delay Capability + * @RM_CAP_MEASUREMENT_PILOT: Measurement pilot capability + */ + +enum mask_rm_capability_byte4 { + RM_CAP_MEASUREMENT_PILOT_1 = (1 << (0)), + RM_CAP_MEASUREMENT_PILOT_2 = (1 << (1)), + RM_CAP_MEASUREMENT_PILOT_3 = (1 << (2)), + RM_CAP_MEAS_PILOT_TX_INFO = (1 << (3)), + RM_CAP_NEIGHBOR_RPT_TSF_OFFSET = (1 << (4)), + RM_CAP_RCPI_MEASUREMENT1 = (1 << (5)), + RM_CAP_RSNI_MEASUREMENT = (1 << (6)), + RM_CAP_BSS_AVG_ACCESS_DELAY = (1 << (7)), + RM_CAP_MEASUREMENT_PILOT = (RM_CAP_MEASUREMENT_PILOT_1 || + RM_CAP_MEASUREMENT_PILOT_2 || + RM_CAP_MEASUREMENT_PILOT_3), +}; + +/** + * enum mask_rm_capability_byte5 - mask for supported capability + * @RM_CAP_BSS_AVAIL_ADMISSION: BSS Available Admission Capacity Capability + * @RM_CAP_ANTENNA: Antenna Capability + * @RM_CAP_FTM_RANGE_REPORT: FTM Range Report Capability + * @RM_CAP_CIVIC_LOC_MEASUREMENT: Civic Location Measurement capability + * + * 4 bits are reserved + */ +enum mask_rm_capability_byte5 { + RM_CAP_BSS_AVAIL_ADMISSION = (1 << (0)), + RM_CAP_ANTENNA = (1 << (1)), + RM_CAP_FTM_RANGE_REPORT = (1 << (2)), + RM_CAP_CIVIC_LOC_MEASUREMENT = (1 << (3)), +}; + #endif /* #if defined __RRMGLOBAL_H */ diff --git a/core/mac/src/pe/lim/lim_process_cfg_updates.c b/core/mac/src/pe/lim/lim_process_cfg_updates.c index e1a645e1ac8c..ae1cf2a3c804 100644 --- a/core/mac/src/pe/lim/lim_process_cfg_updates.c +++ b/core/mac/src/pe/lim/lim_process_cfg_updates.c @@ -641,8 +641,5 @@ static void lim_update_config(tpAniSirGlobal pMac, tpPESession psessionEntry) } pMac->lim.gLimAssocStaLimit = (uint16_t) val; -#if defined WLAN_FEATURE_VOWIFI - rrm_update_config(pMac, psessionEntry); -#endif PELOG1(lim_log(pMac, LOG1, FL("Updated Lim shadow state based on CFG"));) } diff --git a/core/mac/src/pe/lim/lim_process_sme_req_messages.c b/core/mac/src/pe/lim/lim_process_sme_req_messages.c index b06e32d060fa..6bae1ccd9b32 100644 --- a/core/mac/src/pe/lim/lim_process_sme_req_messages.c +++ b/core/mac/src/pe/lim/lim_process_sme_req_messages.c @@ -56,12 +56,10 @@ #include "lim_api.h" #include "wmm_apsd.h" #include "sir_mac_prot_def.h" +#include "rrm_api.h" #include "sap_api.h" -#if defined WLAN_FEATURE_VOWIFI -#include "rrm_api.h" -#endif #if defined WLAN_FEATURE_VOWIFI_11R #include @@ -1575,23 +1573,6 @@ __lim_process_sme_join_req(tpAniSirGlobal mac_ctx, uint32_t *msg_buf) #endif /* FEATURE_WLAN_DIAG_SUPPORT */ lim_log(mac_ctx, LOG1, FL("Received SME_JOIN_REQ")); -#ifdef WLAN_FEATURE_VOWIFI - /* - * Need to read the CFG here itself as this is - * used in limExtractAPCapability() below. - * This CFG is actually read in rrm_update_config() - * which is called later. Because this is not - * read, RRM related path before calling rrm_update_config() - * is not getting executed causing issues - * like not honoring power constraint on 1st association - * after driver loading. - */ - if (wlan_cfg_get_int(mac_ctx, WNI_CFG_RRM_ENABLED, &val) != - eSIR_SUCCESS) - lim_log(mac_ctx, LOGP, FL("cfg get rrm enabled failed")); - mac_ctx->rrm.rrmPEContext.rrmEnable = (val) ? 1 : 0; - val = 0; -#endif /* WLAN_FEATURE_VOWIFI */ /* * Expect Join request in idle state. @@ -1624,9 +1605,16 @@ __lim_process_sme_join_req(tpAniSirGlobal mac_ctx, uint32_t *msg_buf) goto end; } + /* + * Update the capability here itself as this is used in + * lim_extract_ap_capability() below. If not updated issues + * like not honoring power constraint on 1st association after + * driver loading might occur. + */ + lim_update_rrm_capability(mac_ctx, sme_join_req); + bss_desc = sme_join_req->bssDescription; /* check for the existence of start BSS session */ - session = pe_find_session_by_bssid(mac_ctx, bss_desc.bssId, &session_id); @@ -4497,10 +4485,10 @@ void __lim_process_report_message(tpAniSirGlobal pMac, tpSirMsgQ pMsg) rrm_process_neighbor_report_req(pMac, pMsg->bodyptr); break; case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND: - { rrm_process_beacon_report_xmit(pMac, pMsg->bodyptr); - } - break; + break; + default: + lim_log(pMac, LOGE, FL("Invalid msg type:%d"), pMsg->type); } #endif } diff --git a/core/mac/src/pe/rrm/rrm_api.c b/core/mac/src/pe/rrm/rrm_api.c index 5b85bf9a73c8..3f2f96f26c4f 100644 --- a/core/mac/src/pe/rrm/rrm_api.c +++ b/core/mac/src/pe/rrm/rrm_api.c @@ -1334,57 +1334,6 @@ tpRRMCaps rrm_get_capabilities(tpAniSirGlobal pMac, tpPESession pSessionEntry) return &pMac->rrm.rrmPEContext.rrmEnabledCaps; } -/* -------------------------------------------------------------------- */ -/** - * rrm_update_config - * - * FUNCTION: - * Update the configuration. This is called from lim_update_config. - * - * LOGIC: - * - * ASSUMPTIONS: - * - * NOTE: - * - * @param pSessionEntry - * @return pointer to tRRMCaps - */ -void rrm_update_config(tpAniSirGlobal pMac, tpPESession pSessionEntry) -{ - uint32_t val; - tpRRMCaps pRRMCaps = &pMac->rrm.rrmPEContext.rrmEnabledCaps; - - if (wlan_cfg_get_int(pMac, WNI_CFG_RRM_ENABLED, &val) != eSIR_SUCCESS) { - lim_log(pMac, LOGP, FL("cfg get rrm enabled failed")); - return; - } - pMac->rrm.rrmPEContext.rrmEnable = (val) ? 1 : 0; - - if (wlan_cfg_get_int(pMac, WNI_CFG_RRM_OPERATING_CHAN_MAX, &val) != - eSIR_SUCCESS) { - lim_log(pMac, LOGP, - FL - ("cfg get rrm operating channel max measurement duration failed")); - return; - } - pRRMCaps->operatingChanMax = (uint8_t) val; - - if (wlan_cfg_get_int(pMac, WNI_CFG_RRM_NON_OPERATING_CHAN_MAX, &val) != - eSIR_SUCCESS) { - lim_log(pMac, LOGP, - FL - ("cfg get rrm non-operating channel max measurement duration failed")); - return; - } - pRRMCaps->nonOperatingChanMax = (uint8_t) val; - - lim_log(pMac, LOG1, - "RRM enabled = %d OperatingChanMax = %d NonOperatingMax = %d", - pMac->rrm.rrmPEContext.rrmEnable, - pRRMCaps->operatingChanMax, pRRMCaps->nonOperatingChanMax); -} - /* -------------------------------------------------------------------- */ /** * rrm_initialize @@ -1488,8 +1437,30 @@ void rrm_process_message(tpAniSirGlobal pMac, tpSirMsgQ pMsg) case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND: rrm_process_beacon_report_xmit(pMac, pMsg->bodyptr); break; + default: + lim_log(pMac, LOGE, FL("Invalid msg type:%d"), pMsg->type); } } +/** + * lim_update_rrm_capability() - Update PE context's rrm capability + * @mac_ctx: Global pointer to MAC context + * @join_req: Pointer to SME join request. + * + * Update PE context's rrm capability based on SME join request. + * + * Return: None + */ +void lim_update_rrm_capability(tpAniSirGlobal mac_ctx, + tpSirSmeJoinReq join_req) +{ + mac_ctx->rrm.rrmPEContext.rrmEnable = join_req->rrm_config.rrm_enabled; + cdf_mem_copy(&mac_ctx->rrm.rrmPEContext.rrmEnabledCaps, + &join_req->rrm_config.rm_capability, + RMENABLEDCAP_MAX_LEN); + + return; +} + #endif 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 16bd125f1f88..3062e7561d05 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 @@ -5492,6 +5492,7 @@ tSirRetStatus populate_dot11f_rrm_ie(tpAniSirGlobal pMac, tpPESession psessionEntry) { tpRRMCaps pRrmCaps; + uint8_t *bytes; pRrmCaps = rrm_get_capabilities(pMac, psessionEntry); @@ -5527,6 +5528,10 @@ tSirRetStatus populate_dot11f_rrm_ie(tpAniSirGlobal pMac, pDot11f->lci_capability = pRrmCaps->lci_capability; pDot11f->reserved = pRrmCaps->reserved; + bytes = (uint8_t *) pDot11f + 1; /* ignore present field */ + lim_log(pMac, LOG1, FL("RRM Enabled Cap IE: %02x %02x %02x %02x %02x"), + bytes[0], bytes[1], bytes[2], bytes[3], bytes[4]); + pDot11f->present = 1; return eSIR_SUCCESS; } diff --git a/core/sme/inc/sme_api.h b/core/sme/inc/sme_api.h index e81aac929972..43a6e8d8b1d9 100644 --- a/core/sme/inc/sme_api.h +++ b/core/sme/inc/sme_api.h @@ -95,7 +95,7 @@ typedef void (*hdd_ftm_msg_processor)(void *); typedef struct _smeConfigParams { tCsrConfigParam csrConfig; #if defined WLAN_FEATURE_VOWIFI - tRrmConfigParam rrmConfig; + struct rrm_config_param rrmConfig; #endif #if defined FEATURE_WLAN_LFR uint8_t isFastRoamIniFeatureEnabled; diff --git a/core/sme/inc/sme_rrm_api.h b/core/sme/inc/sme_rrm_api.h index 743c77e8b23a..d0098447014a 100644 --- a/core/sme/inc/sme_rrm_api.h +++ b/core/sme/inc/sme_rrm_api.h @@ -52,7 +52,7 @@ CDF_STATUS rrm_close(tpAniSirGlobal pMac); CDF_STATUS rrm_ready(tpAniSirGlobal pMac); CDF_STATUS rrm_open(tpAniSirGlobal pMac); CDF_STATUS rrm_change_default_config_param(tpAniSirGlobal pMac, - tpRrmConfigParam pRrmConfig); + struct rrm_config_param *rrm_config); CDF_STATUS sme_rrm_neighbor_report_request(tpAniSirGlobal pMac, uint8_t sessionId, tpRrmNeighborReq pNeighborReq, tpRrmNeighborRspCallbackInfo callbackInfo); diff --git a/core/sme/inc/sme_rrm_internal.h b/core/sme/inc/sme_rrm_internal.h index 76415d5c84ff..e3926374f702 100644 --- a/core/sme/inc/sme_rrm_internal.h +++ b/core/sme/inc/sme_rrm_internal.h @@ -46,11 +46,6 @@ /*-------------------------------------------------------------------------- Type declarations ------------------------------------------------------------------------*/ -typedef struct sRrmConfigParam { - uint8_t rrmEnabled; - uint8_t maxRandnInterval; -} tRrmConfigParam, *tpRrmConfigParam; - typedef struct sRrmNeighborReportDesc { tListElem List; tSirNeighborBssDescription *pNeighborBssDescription; @@ -88,7 +83,7 @@ typedef struct sRrmSMEContext { uint16_t randnIntvl; uint16_t duration[SIR_ESE_MAX_MEAS_IE_REQS]; uint8_t measMode[SIR_ESE_MAX_MEAS_IE_REQS]; - tRrmConfigParam rrmConfig; + struct rrm_config_param rrmConfig; cdf_mc_timer_t IterMeasTimer; tDblLinkList neighborReportCache; tRrmNeighborRequestControlInfo neighborReqControlInfo; diff --git a/core/sme/src/csr/csr_api_roam.c b/core/sme/src/csr/csr_api_roam.c index 2860c034a1ed..22df06520af6 100644 --- a/core/sme/src/csr/csr_api_roam.c +++ b/core/sme/src/csr/csr_api_roam.c @@ -13976,6 +13976,11 @@ CDF_STATUS csr_send_join_req_msg(tpAniSirGlobal pMac, uint32_t sessionId, else csr_join_req->isOSENConnection = false; + /* Fill rrm config parameters */ + cdf_mem_copy(&csr_join_req->rrm_config, + &pMac->rrm.rrmSmeContext.rrmConfig, + sizeof(struct rrm_config_param)); + pAP_capabilityInfo = (tSirMacCapabilityInfo *) &pBssDescription->capabilityInfo; diff --git a/core/sme/src/rrm/sme_rrm.c b/core/sme/src/rrm/sme_rrm.c index a68f71c09d68..88168bf5afc6 100644 --- a/core/sme/src/rrm/sme_rrm.c +++ b/core/sme/src/rrm/sme_rrm.c @@ -906,7 +906,7 @@ CDF_STATUS sme_rrm_process_beacon_report_req_ind(tpAniSirGlobal pMac, void *pMsg pSmeRrmContext->regClass = pBeaconReq->channelInfo.regulatoryClass; pSmeRrmContext->randnIntvl = CDF_MAX(pBeaconReq->randomizationInterval, - pSmeRrmContext->rrmConfig.maxRandnInterval); + pSmeRrmContext->rrmConfig.max_randn_interval); pSmeRrmContext->currentIndex = 0; pSmeRrmContext->msgSource = pBeaconReq->msgSource; cdf_mem_copy((uint8_t *) &pSmeRrmContext->measMode, @@ -1357,7 +1357,7 @@ CDF_STATUS rrm_open(tpAniSirGlobal pMac) tpRrmSMEContext pSmeRrmContext = &pMac->rrm.rrmSmeContext; CDF_STATUS cdf_ret_status = CDF_STATUS_SUCCESS; - pSmeRrmContext->rrmConfig.maxRandnInterval = 50; /* ms */ + pSmeRrmContext->rrmConfig.max_randn_interval = 50; /* ms */ cdf_status = cdf_mc_timer_init(&pSmeRrmContext->IterMeasTimer, CDF_TIMER_TYPE_SW, @@ -1491,10 +1491,10 @@ CDF_STATUS rrm_ready(tpAniSirGlobal pMac) ---------------------------------------------------------------------------*/ CDF_STATUS rrm_change_default_config_param(tpAniSirGlobal pMac, - tpRrmConfigParam pRrmConfig) + struct rrm_config_param *rrm_config) { - cdf_mem_copy(&pMac->rrm.rrmSmeContext.rrmConfig, pRrmConfig, - sizeof(tRrmConfigParam)); + cdf_mem_copy(&pMac->rrm.rrmSmeContext.rrmConfig, rrm_config, + sizeof(struct rrm_config_param)); return CDF_STATUS_SUCCESS; }