Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Agrawal Ashish | 01c6634 | 2017-01-27 12:52:25 +0530 | [diff] [blame] | 2 | * Copyright (c) 2012-2015, 2017 The Linux Foundation. All rights reserved. |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
Gopichand Nakkala | c6c9190 | 2013-05-29 18:53:35 +0530 | [diff] [blame] | 21 | |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 22 | /* |
| 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
| 26 | */ |
Gopichand Nakkala | c6c9190 | 2013-05-29 18:53:35 +0530 | [diff] [blame] | 27 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 28 | /**========================================================================= |
| 29 | |
| 30 | \file rrmApi.c |
| 31 | |
| 32 | \brief implementation for PE RRM APIs |
| 33 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 34 | |
| 35 | ========================================================================*/ |
| 36 | |
| 37 | /* $Header$ */ |
| 38 | |
| 39 | #if defined WLAN_FEATURE_VOWIFI |
| 40 | |
| 41 | /*-------------------------------------------------------------------------- |
| 42 | Include Files |
| 43 | ------------------------------------------------------------------------*/ |
| 44 | #include "palTypes.h" |
| 45 | #include "wniApi.h" |
| 46 | #include "sirApi.h" |
| 47 | #include "aniGlobal.h" |
Satyanarayana Dash | 6f43827 | 2015-03-03 18:01:06 +0530 | [diff] [blame] | 48 | #include "wniCfg.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 49 | #include "limTypes.h" |
| 50 | #include "limUtils.h" |
| 51 | #include "limSendSmeRspMessages.h" |
| 52 | #include "parserApi.h" |
| 53 | #include "limSendMessages.h" |
| 54 | #include "rrmGlobal.h" |
| 55 | #include "rrmApi.h" |
| 56 | |
Gopichand Nakkala | 41b56fd | 2013-02-28 15:26:52 +0530 | [diff] [blame] | 57 | tANI_U8 |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 58 | rrmGetMinOfMaxTxPower(tpAniSirGlobal pMac, |
| 59 | tPowerdBm regMax, tPowerdBm apTxPower) |
Gopichand Nakkala | 41b56fd | 2013-02-28 15:26:52 +0530 | [diff] [blame] | 60 | { |
| 61 | tANI_U8 maxTxPower = 0; |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 62 | tANI_U8 txPower = VOS_MIN( regMax, (apTxPower) ); |
Gopichand Nakkala | 41b56fd | 2013-02-28 15:26:52 +0530 | [diff] [blame] | 63 | if((txPower >= RRM_MIN_TX_PWR_CAP) && (txPower <= RRM_MAX_TX_PWR_CAP)) |
| 64 | maxTxPower = txPower; |
| 65 | else if (txPower < RRM_MIN_TX_PWR_CAP) |
| 66 | maxTxPower = RRM_MIN_TX_PWR_CAP; |
| 67 | else |
| 68 | maxTxPower = RRM_MAX_TX_PWR_CAP; |
| 69 | |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 70 | limLog( pMac, LOG3, |
| 71 | "%s: regulatoryMax = %d, apTxPwr = %d, maxTxpwr = %d", |
| 72 | __func__, regMax, apTxPower, maxTxPower ); |
Gopichand Nakkala | 41b56fd | 2013-02-28 15:26:52 +0530 | [diff] [blame] | 73 | return maxTxPower; |
| 74 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 75 | |
| 76 | // -------------------------------------------------------------------- |
| 77 | /** |
| 78 | * rrmCacheMgmtTxPower |
| 79 | ** |
| 80 | * FUNCTION: Store Tx power for management frames. |
| 81 | * |
| 82 | * LOGIC: |
| 83 | * |
| 84 | * ASSUMPTIONS: |
| 85 | * |
| 86 | * NOTE: |
| 87 | * |
| 88 | * @param pSessionEntry session entry. |
| 89 | * @return None |
| 90 | */ |
| 91 | void |
| 92 | rrmCacheMgmtTxPower ( tpAniSirGlobal pMac, tPowerdBm txPower, tpPESession pSessionEntry ) |
| 93 | { |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 94 | limLog( pMac, LOG3, "Cache Mgmt Tx Power = %d", txPower ); |
| 95 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 96 | if( pSessionEntry == NULL ) |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 97 | { |
| 98 | limLog( pMac, LOG3, "%s: pSessionEntry is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 99 | pMac->rrm.rrmPEContext.txMgmtPower = txPower; |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 100 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 101 | else |
| 102 | pSessionEntry->txMgmtPower = txPower; |
| 103 | } |
| 104 | |
| 105 | // -------------------------------------------------------------------- |
| 106 | /** |
| 107 | * rrmGetMgmtTxPower |
| 108 | * |
| 109 | * FUNCTION: Get the Tx power for management frames. |
| 110 | * |
| 111 | * LOGIC: |
| 112 | * |
| 113 | * ASSUMPTIONS: |
| 114 | * |
| 115 | * NOTE: |
| 116 | * |
| 117 | * @param pSessionEntry session entry. |
| 118 | * @return txPower |
| 119 | */ |
| 120 | tPowerdBm |
| 121 | rrmGetMgmtTxPower ( tpAniSirGlobal pMac, tpPESession pSessionEntry ) |
| 122 | { |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 123 | limLog( pMac, LOG3, "RrmGetMgmtTxPower called" ); |
| 124 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 125 | if( pSessionEntry == NULL ) |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 126 | { |
DARAM SUDHA | 26e0027 | 2014-02-12 11:50:39 +0530 | [diff] [blame] | 127 | limLog( pMac, LOG3, "%s: txpower from rrmPEContext: %d", |
| 128 | __func__, pMac->rrm.rrmPEContext.txMgmtPower); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 129 | return pMac->rrm.rrmPEContext.txMgmtPower; |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 130 | } |
| 131 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 132 | return pSessionEntry->txMgmtPower; |
| 133 | } |
| 134 | |
| 135 | // -------------------------------------------------------------------- |
| 136 | /** |
| 137 | * rrmSendSetMaxTxPowerReq |
| 138 | * |
| 139 | * FUNCTION: Send WDA_SET_MAX_TX_POWER_REQ message to change the max tx power. |
| 140 | * |
| 141 | * LOGIC: |
| 142 | * |
| 143 | * ASSUMPTIONS: |
| 144 | * |
| 145 | * NOTE: |
| 146 | * |
| 147 | * @param txPower txPower to be set. |
| 148 | * @param pSessionEntry session entry. |
| 149 | * @return None |
| 150 | */ |
| 151 | tSirRetStatus |
| 152 | rrmSendSetMaxTxPowerReq ( tpAniSirGlobal pMac, tPowerdBm txPower, tpPESession pSessionEntry ) |
| 153 | { |
| 154 | tpMaxTxPowerParams pMaxTxParams; |
| 155 | tSirRetStatus retCode = eSIR_SUCCESS; |
| 156 | tSirMsgQ msgQ; |
| 157 | |
| 158 | if( pSessionEntry == NULL ) |
| 159 | { |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 160 | PELOGE(limLog(pMac, LOGE, FL(" Inavalid parameters"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 161 | return eSIR_FAILURE; |
| 162 | } |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 163 | pMaxTxParams = vos_mem_malloc(sizeof(tMaxTxPowerParams)); |
| 164 | if ( NULL == pMaxTxParams ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 165 | { |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 166 | limLog( pMac, LOGP, FL("Unable to allocate memory for pMaxTxParams ") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 167 | return eSIR_MEM_ALLOC_FAILED; |
| 168 | |
| 169 | } |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 170 | /* Allocated memory for pMaxTxParams...will be freed in other module */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 171 | pMaxTxParams->power = txPower; |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 172 | vos_mem_copy(pMaxTxParams->bssId, pSessionEntry->bssId, sizeof(tSirMacAddr)); |
| 173 | vos_mem_copy(pMaxTxParams->selfStaMacAddr, pSessionEntry->selfMacAddr, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 174 | |
| 175 | |
| 176 | msgQ.type = WDA_SET_MAX_TX_POWER_REQ; |
| 177 | msgQ.reserved = 0; |
| 178 | msgQ.bodyptr = pMaxTxParams; |
| 179 | msgQ.bodyval = 0; |
| 180 | |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 181 | limLog(pMac, LOG3, |
| 182 | FL( "Sending WDA_SET_MAX_TX_POWER_REQ with power(%d) to HAL"), |
| 183 | txPower); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 184 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 185 | MTRACE(macTraceMsgTx(pMac, pSessionEntry->peSessionId, msgQ.type)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 186 | if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ ))) |
| 187 | { |
| 188 | limLog( pMac, LOGP, FL("Posting WDA_SET_MAX_TX_POWER_REQ to HAL failed, reason=%X"), retCode ); |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 189 | vos_mem_free(pMaxTxParams); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 190 | return retCode; |
| 191 | } |
| 192 | return retCode; |
| 193 | } |
| 194 | |
| 195 | |
| 196 | // -------------------------------------------------------------------- |
| 197 | /** |
| 198 | * rrmSetMaxTxPowerRsp |
| 199 | * |
| 200 | * FUNCTION: Process WDA_SET_MAX_TX_POWER_RSP message. |
| 201 | * |
| 202 | * LOGIC: |
| 203 | * |
| 204 | * ASSUMPTIONS: |
| 205 | * |
| 206 | * NOTE: |
| 207 | * |
| 208 | * @param txPower txPower to be set. |
| 209 | * @param pSessionEntry session entry. |
| 210 | * @return None |
| 211 | */ |
| 212 | tSirRetStatus |
| 213 | rrmSetMaxTxPowerRsp ( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ) |
| 214 | { |
| 215 | tSirRetStatus retCode = eSIR_SUCCESS; |
| 216 | tpMaxTxPowerParams pMaxTxParams = (tpMaxTxPowerParams) limMsgQ->bodyptr; |
| 217 | tpPESession pSessionEntry; |
Venkata Prathyusha Kuntupalli | 74cd99f | 2013-05-09 16:50:39 -0700 | [diff] [blame] | 218 | tANI_U8 sessionId, i; |
| 219 | tSirMacAddr bssid = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 220 | |
Kiet Lam | 842c3e1 | 2013-11-16 22:40:57 +0530 | [diff] [blame] | 221 | if( vos_mem_compare(bssid, pMaxTxParams->bssId, sizeof(tSirMacAddr))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 222 | { |
Venkata Prathyusha Kuntupalli | 74cd99f | 2013-05-09 16:50:39 -0700 | [diff] [blame] | 223 | for (i =0;i < pMac->lim.maxBssId;i++) |
| 224 | { |
| 225 | if ( (pMac->lim.gpSession[i].valid == TRUE )) |
| 226 | { |
| 227 | pSessionEntry = &pMac->lim.gpSession[i]; |
| 228 | rrmCacheMgmtTxPower ( pMac, pMaxTxParams->power, pSessionEntry ); |
| 229 | } |
| 230 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 231 | } |
| 232 | else |
| 233 | { |
Venkata Prathyusha Kuntupalli | 74cd99f | 2013-05-09 16:50:39 -0700 | [diff] [blame] | 234 | if((pSessionEntry = peFindSessionByBssid(pMac, pMaxTxParams->bssId, &sessionId))==NULL) |
| 235 | { |
| 236 | PELOGE(limLog(pMac, LOGE, FL("Unable to find session:") );) |
| 237 | retCode = eSIR_FAILURE; |
| 238 | } |
| 239 | else |
| 240 | { |
| 241 | rrmCacheMgmtTxPower ( pMac, pMaxTxParams->power, pSessionEntry ); |
| 242 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 243 | } |
| 244 | |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 245 | vos_mem_free(limMsgQ->bodyptr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 246 | limMsgQ->bodyptr = NULL; |
| 247 | return retCode; |
| 248 | } |
| 249 | // -------------------------------------------------------------------- |
| 250 | /** |
| 251 | * rrmProcessLinkMeasurementRequest |
| 252 | * |
| 253 | * FUNCTION: Processes the Link measurement request and send the report. |
| 254 | * |
| 255 | * LOGIC: |
| 256 | * |
| 257 | * ASSUMPTIONS: |
| 258 | * |
| 259 | * NOTE: |
| 260 | * |
| 261 | * @param pBd pointer to BD to extract RSSI and SNR |
| 262 | * @param pLinkReq pointer to the Link request frame structure. |
| 263 | * @param pSessionEntry session entry. |
| 264 | * @return None |
| 265 | */ |
| 266 | tSirRetStatus |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 267 | rrmProcessLinkMeasurementRequest( tpAniSirGlobal pMac, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 268 | tANI_U8 *pRxPacketInfo, |
| 269 | tDot11fLinkMeasurementRequest *pLinkReq, |
| 270 | tpPESession pSessionEntry ) |
| 271 | { |
| 272 | tSirMacLinkReport LinkReport; |
| 273 | tpSirMacMgmtHdr pHdr; |
| 274 | v_S7_t currentRSSI = 0; |
| 275 | |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 276 | limLog( pMac, LOG3, "Received Link measurement request"); |
| 277 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 278 | if( pRxPacketInfo == NULL || pLinkReq == NULL || pSessionEntry == NULL ) |
| 279 | { |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 280 | PELOGE(limLog( pMac, LOGE, |
| 281 | "%s Invalid parameters - Ignoring the request", __func__);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 282 | return eSIR_FAILURE; |
| 283 | } |
| 284 | pHdr = WDA_GET_RX_MAC_HEADER( pRxPacketInfo ); |
Abhinav Kumar | 5deb9cd | 2018-05-10 11:04:59 +0530 | [diff] [blame] | 285 | LinkReport.txPower = limGetMaxTxPower (pSessionEntry->def_max_tx_pwr, |
Agrawal Ashish | 01c6634 | 2017-01-27 12:52:25 +0530 | [diff] [blame] | 286 | pLinkReq->MaxTxPower.maxTxPower, |
| 287 | pMac->roam.configParam.nTxPowerCap); |
Madan Mohan Koyyalamudi | ab675df | 2013-07-24 02:57:41 +0530 | [diff] [blame] | 288 | |
Agrawal Ashish | 01c6634 | 2017-01-27 12:52:25 +0530 | [diff] [blame] | 289 | if ((LinkReport.txPower != (uint8)(pSessionEntry->maxTxPower)) && |
| 290 | (eSIR_SUCCESS == rrmSendSetMaxTxPowerReq (pMac, |
| 291 | (tPowerdBm)(LinkReport.txPower), |
| 292 | pSessionEntry))) |
Madan Mohan Koyyalamudi | ba0a3f4 | 2013-08-13 20:37:34 +0530 | [diff] [blame] | 293 | { |
Agrawal Ashish | 01c6634 | 2017-01-27 12:52:25 +0530 | [diff] [blame] | 294 | PELOGW (limLog (pMac, |
| 295 | LOGW, |
| 296 | FL(" maxTx power in link report is not same as local..." |
| 297 | " Local = %d Link Request TxPower = %d" |
| 298 | " Link Report TxPower = %d"), |
| 299 | pSessionEntry->maxTxPower, |
| 300 | LinkReport.txPower, |
| 301 | pLinkReq->MaxTxPower.maxTxPower);) |
| 302 | pSessionEntry->maxTxPower = (tPowerdBm)(LinkReport.txPower); |
Madan Mohan Koyyalamudi | ba0a3f4 | 2013-08-13 20:37:34 +0530 | [diff] [blame] | 303 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 304 | LinkReport.dialogToken = pLinkReq->DialogToken.token; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 305 | LinkReport.rxAntenna = 0; |
| 306 | LinkReport.txAntenna = 0; |
| 307 | currentRSSI = WDA_GET_RX_RSSI_DB(pRxPacketInfo); |
| 308 | |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 309 | limLog( pMac, LOG1, |
| 310 | "Received Link report frame with %d", currentRSSI); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 311 | |
| 312 | // 2008 11k spec reference: 18.4.8.5 RCPI Measurement |
| 313 | if ((currentRSSI) <= RCPI_LOW_RSSI_VALUE) |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 314 | LinkReport.rcpi = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 315 | else if ((currentRSSI > RCPI_LOW_RSSI_VALUE) && (currentRSSI <= 0)) |
| 316 | LinkReport.rcpi = CALCULATE_RCPI(currentRSSI); |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 317 | else |
| 318 | LinkReport.rcpi = RCPI_MAX_VALUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 319 | |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 320 | LinkReport.rsni = WDA_GET_RX_SNR(pRxPacketInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 321 | |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 322 | limLog( pMac, LOG3, "Sending Link report frame"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 323 | |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 324 | return limSendLinkReportActionFrame( pMac, &LinkReport, pHdr->sa, pSessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 325 | } |
| 326 | |
| 327 | // -------------------------------------------------------------------- |
| 328 | /** |
| 329 | * rrmProcessNeighborReportResponse |
| 330 | * |
| 331 | * FUNCTION: Processes the Neighbor Report response from the peer AP. |
| 332 | * |
| 333 | * LOGIC: |
| 334 | * |
| 335 | * ASSUMPTIONS: |
| 336 | * |
| 337 | * NOTE: |
| 338 | * |
| 339 | * @param pNeighborRep pointer to the Neighbor report frame structure. |
| 340 | * @param pSessionEntry session entry. |
| 341 | * @return None |
| 342 | */ |
| 343 | tSirRetStatus |
| 344 | rrmProcessNeighborReportResponse( tpAniSirGlobal pMac, |
| 345 | tDot11fNeighborReportResponse *pNeighborRep, |
| 346 | tpPESession pSessionEntry ) |
| 347 | { |
| 348 | tSirRetStatus status = eSIR_FAILURE; |
| 349 | tpSirNeighborReportInd pSmeNeighborRpt = NULL; |
| 350 | tANI_U16 length; |
| 351 | tANI_U8 i; |
| 352 | tSirMsgQ mmhMsg; |
| 353 | |
| 354 | if( pNeighborRep == NULL || pSessionEntry == NULL ) |
| 355 | { |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 356 | PELOGE(limLog( pMac, LOGE, FL(" Invalid parameters") );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 357 | return status; |
| 358 | } |
| 359 | |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 360 | limLog( pMac, LOG3, FL("Neighbor report response received ") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 361 | |
| 362 | // Dialog token |
| 363 | if( pMac->rrm.rrmPEContext.DialogToken != pNeighborRep->DialogToken.token ) |
| 364 | { |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 365 | PELOGE(limLog( pMac, LOGE, |
| 366 | "Dialog token mismatch in the received Neighbor report");) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 367 | return eSIR_FAILURE; |
| 368 | } |
| 369 | if( pNeighborRep->num_NeighborReport == 0 ) |
| 370 | { |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 371 | PELOGE(limLog( pMac, LOGE, "No neighbor report in the frame...Dropping it");) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 372 | return eSIR_FAILURE; |
| 373 | } |
| 374 | length = (sizeof( tSirNeighborReportInd )) + |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 375 | (sizeof( tSirNeighborBssDescription ) * (pNeighborRep->num_NeighborReport - 1) ) ; |
| 376 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 377 | //Prepare the request to send to SME. |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 378 | pSmeNeighborRpt = vos_mem_malloc(length); |
| 379 | if( NULL == pSmeNeighborRpt ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 380 | { |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 381 | PELOGE(limLog( pMac, LOGP, FL("Unable to allocate memory") );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 382 | return eSIR_MEM_ALLOC_FAILED; |
| 383 | |
| 384 | } |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 385 | vos_mem_set(pSmeNeighborRpt, length, 0); |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 386 | |
| 387 | /* Allocated memory for pSmeNeighborRpt...will be freed by other module */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 388 | |
| 389 | for( i = 0 ; i < pNeighborRep->num_NeighborReport ; i++ ) |
| 390 | { |
| 391 | pSmeNeighborRpt->sNeighborBssDescription[i].length = sizeof( tSirNeighborBssDescription ); /*+ any optional ies */ |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 392 | vos_mem_copy(pSmeNeighborRpt->sNeighborBssDescription[i].bssId, |
| 393 | pNeighborRep->NeighborReport[i].bssid, |
| 394 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 395 | pSmeNeighborRpt->sNeighborBssDescription[i].bssidInfo.rrmInfo.fApPreauthReachable = pNeighborRep->NeighborReport[i].APReachability; |
| 396 | pSmeNeighborRpt->sNeighborBssDescription[i].bssidInfo.rrmInfo.fSameSecurityMode = pNeighborRep->NeighborReport[i].Security; |
| 397 | pSmeNeighborRpt->sNeighborBssDescription[i].bssidInfo.rrmInfo.fSameAuthenticator = pNeighborRep->NeighborReport[i].KeyScope; |
| 398 | pSmeNeighborRpt->sNeighborBssDescription[i].bssidInfo.rrmInfo.fCapSpectrumMeasurement = pNeighborRep->NeighborReport[i].SpecMgmtCap; |
| 399 | pSmeNeighborRpt->sNeighborBssDescription[i].bssidInfo.rrmInfo.fCapQos = pNeighborRep->NeighborReport[i].QosCap; |
| 400 | pSmeNeighborRpt->sNeighborBssDescription[i].bssidInfo.rrmInfo.fCapApsd = pNeighborRep->NeighborReport[i].apsd; |
| 401 | pSmeNeighborRpt->sNeighborBssDescription[i].bssidInfo.rrmInfo.fCapRadioMeasurement = pNeighborRep->NeighborReport[i].rrm; |
| 402 | pSmeNeighborRpt->sNeighborBssDescription[i].bssidInfo.rrmInfo.fCapDelayedBlockAck = pNeighborRep->NeighborReport[i].DelayedBA; |
| 403 | pSmeNeighborRpt->sNeighborBssDescription[i].bssidInfo.rrmInfo.fCapImmediateBlockAck = pNeighborRep->NeighborReport[i].ImmBA; |
| 404 | pSmeNeighborRpt->sNeighborBssDescription[i].bssidInfo.rrmInfo.fMobilityDomain = pNeighborRep->NeighborReport[i].MobilityDomain; |
| 405 | |
| 406 | pSmeNeighborRpt->sNeighborBssDescription[i].regClass = pNeighborRep->NeighborReport[i].regulatoryClass; |
| 407 | pSmeNeighborRpt->sNeighborBssDescription[i].channel = pNeighborRep->NeighborReport[i].channel; |
| 408 | pSmeNeighborRpt->sNeighborBssDescription[i].phyType = pNeighborRep->NeighborReport[i].PhyType; |
| 409 | } |
| 410 | |
| 411 | pSmeNeighborRpt->messageType = eWNI_SME_NEIGHBOR_REPORT_IND; |
| 412 | pSmeNeighborRpt->length = length; |
| 413 | pSmeNeighborRpt->numNeighborReports = pNeighborRep->num_NeighborReport; |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 414 | vos_mem_copy(pSmeNeighborRpt->bssId, pSessionEntry->bssId, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 415 | |
| 416 | //Send request to SME. |
| 417 | mmhMsg.type = pSmeNeighborRpt->messageType; |
| 418 | mmhMsg.bodyptr = pSmeNeighborRpt; |
Konamki, Sreelakshmi | 824f93e | 2015-07-31 12:55:48 +0530 | [diff] [blame] | 419 | MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, pSessionEntry->peSessionId, |
| 420 | mmhMsg.type)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 421 | status = limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT); |
| 422 | |
| 423 | return status; |
| 424 | |
| 425 | } |
| 426 | |
| 427 | // -------------------------------------------------------------------- |
| 428 | /** |
| 429 | * rrmProcessNeighborReportReq |
| 430 | * |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 431 | * FUNCTION: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 432 | * |
| 433 | * LOGIC: Create a Neighbor report request and send it to peer. |
| 434 | * |
| 435 | * ASSUMPTIONS: |
| 436 | * |
| 437 | * NOTE: |
| 438 | * |
| 439 | * @param pNeighborReq Neighbor report request params . |
| 440 | * @return None |
| 441 | */ |
| 442 | tSirRetStatus |
| 443 | rrmProcessNeighborReportReq( tpAniSirGlobal pMac, |
| 444 | tpSirNeighborReportReqInd pNeighborReq ) |
| 445 | { |
| 446 | tSirRetStatus status = eSIR_SUCCESS; |
| 447 | tSirMacNeighborReportReq NeighborReportReq; |
| 448 | tpPESession pSessionEntry ; |
| 449 | tANI_U8 sessionId; |
| 450 | |
| 451 | if( pNeighborReq == NULL ) |
| 452 | { |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 453 | PELOGE(limLog( pMac, LOGE, "NeighborReq is NULL" );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 454 | return eSIR_FAILURE; |
| 455 | } |
| 456 | if ((pSessionEntry = peFindSessionByBssid(pMac,pNeighborReq->bssId,&sessionId))==NULL) |
| 457 | { |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 458 | PELOGE(limLog(pMac, LOGE,FL("session does not exist for given bssId"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 459 | return eSIR_FAILURE; |
| 460 | } |
| 461 | |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 462 | limLog( pMac, LOG1, FL("SSID present = %d "), pNeighborReq->noSSID ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 463 | |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 464 | vos_mem_set(&NeighborReportReq,sizeof( tSirMacNeighborReportReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 465 | |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 466 | NeighborReportReq.dialogToken = ++pMac->rrm.rrmPEContext.DialogToken; |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 467 | NeighborReportReq.ssid_present = !pNeighborReq->noSSID; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 468 | if( NeighborReportReq.ssid_present ) |
| 469 | { |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 470 | vos_mem_copy(&NeighborReportReq.ssid, &pNeighborReq->ucSSID, sizeof(tSirMacSSid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 471 | PELOGE(sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOGE, (tANI_U8*) NeighborReportReq.ssid.ssId, NeighborReportReq.ssid.length );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 472 | } |
| 473 | |
| 474 | status = limSendNeighborReportRequestFrame( pMac, &NeighborReportReq, pNeighborReq->bssId, pSessionEntry ); |
| 475 | |
| 476 | return status; |
| 477 | } |
| 478 | |
| 479 | #define ABS(x) ((x < 0) ? -x : x) |
| 480 | // -------------------------------------------------------------------- |
| 481 | /** |
| 482 | * rrmProcessBeaconReportReq |
| 483 | * |
| 484 | * FUNCTION: Processes the Beacon report request from the peer AP. |
| 485 | * |
| 486 | * LOGIC: |
| 487 | * |
| 488 | * ASSUMPTIONS: |
| 489 | * |
| 490 | * NOTE: |
| 491 | * |
| 492 | * @param pCurrentReq pointer to the current Req comtext. |
| 493 | * @param pBeaconReq pointer to the beacon report request IE from the peer. |
| 494 | * @param pSessionEntry session entry. |
| 495 | * @return None |
| 496 | */ |
| 497 | static tRrmRetStatus |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 498 | rrmProcessBeaconReportReq( tpAniSirGlobal pMac, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 499 | tpRRMReq pCurrentReq, |
| 500 | tDot11fIEMeasurementRequest *pBeaconReq, |
| 501 | tpPESession pSessionEntry ) |
| 502 | { |
| 503 | tSirMsgQ mmhMsg; |
| 504 | tpSirBeaconReportReqInd pSmeBcnReportReq; |
| 505 | tANI_U8 num_channels = 0, num_APChanReport; |
| 506 | tANI_U16 measDuration, maxMeasduration; |
| 507 | tANI_S8 maxDuration; |
| 508 | tANI_U8 sign; |
| 509 | |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 510 | if( pBeaconReq->measurement_request.Beacon.BeaconReporting.present && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 511 | (pBeaconReq->measurement_request.Beacon.BeaconReporting.reportingCondition != 0) ) |
| 512 | { |
| 513 | //Repeated measurement is not supported. This means number of repetitions should be zero.(Already checked) |
| 514 | //All test case in VoWifi(as of version 0.36) use zero for number of repetitions. |
| 515 | //Beacon reporting should not be included in request if number of repetitons is zero. |
| 516 | // IEEE Std 802.11k-2008 Table 7-29g and section 11.10.8.1 |
| 517 | |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 518 | PELOGE(limLog( pMac, LOGE, "Dropping the request: Reporting condition included in beacon report request and it is not zero");) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 519 | return eRRM_INCAPABLE; |
| 520 | } |
| 521 | |
| 522 | /* The logic here is to check the measurement duration passed in the beacon request. Following are the cases handled. |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 523 | Case 1: If measurement duration received in the beacon request is greater than the max measurement duration advertised |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 524 | in the RRM capabilities(Assoc Req), and Duration Mandatory bit is set to 1, REFUSE the beacon request |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 525 | Case 2: If measurement duration received in the beacon request is greater than the max measurement duration advertised |
| 526 | in the RRM capabilities(Assoc Req), and Duration Mandatory bit is set to 0, perform measurement for |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 527 | the duration advertised in the RRM capabilities |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 528 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 529 | maxMeasurementDuration = 2^(nonOperatingChanMax - 4) * BeaconInterval |
| 530 | */ |
| 531 | maxDuration = pMac->rrm.rrmPEContext.rrmEnabledCaps.nonOperatingChanMax - 4; |
| 532 | sign = (maxDuration < 0) ? 1 : 0; |
| 533 | maxDuration = (1L << ABS(maxDuration)); |
| 534 | if (!sign) |
| 535 | maxMeasduration = maxDuration * pSessionEntry->beaconParams.beaconInterval; |
| 536 | else |
| 537 | maxMeasduration = pSessionEntry->beaconParams.beaconInterval / maxDuration; |
| 538 | |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 539 | measDuration = pBeaconReq->measurement_request.Beacon.meas_duration; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 540 | |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 541 | limLog( pMac, LOG3, |
| 542 | "maxDuration = %d sign = %d maxMeasduration = %d measDuration = %d", |
| 543 | maxDuration, sign, maxMeasduration, measDuration ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 544 | |
| 545 | if( maxMeasduration < measDuration ) |
| 546 | { |
| 547 | if( pBeaconReq->durationMandatory ) |
| 548 | { |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 549 | PELOGE(limLog( pMac, LOGE, "Dropping the request: duration mandatory and maxduration > measduration");) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 550 | return eRRM_REFUSED; |
| 551 | } |
| 552 | else |
| 553 | measDuration = maxMeasduration; |
| 554 | } |
| 555 | |
| 556 | //Cache the data required for sending report. |
| 557 | pCurrentReq->request.Beacon.reportingDetail = pBeaconReq->measurement_request.Beacon.BcnReportingDetail.present ? |
| 558 | pBeaconReq->measurement_request.Beacon.BcnReportingDetail.reportingDetail : |
| 559 | BEACON_REPORTING_DETAIL_ALL_FF_IE ; |
| 560 | |
| 561 | if( pBeaconReq->measurement_request.Beacon.RequestedInfo.present ) |
| 562 | { |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 563 | pCurrentReq->request.Beacon.reqIes.pElementIds = vos_mem_malloc(sizeof(tANI_U8) * |
| 564 | pBeaconReq->measurement_request.Beacon.RequestedInfo.num_requested_eids); |
| 565 | if ( NULL == pCurrentReq->request.Beacon.reqIes.pElementIds ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 566 | { |
| 567 | limLog( pMac, LOGP, |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 568 | FL( "Unable to allocate memory for request IEs buffer" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 569 | return eRRM_FAILURE; |
| 570 | } |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 571 | limLog( pMac, LOG3, FL(" Allocated memory for pElementIds") ); |
| 572 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 573 | pCurrentReq->request.Beacon.reqIes.num = pBeaconReq->measurement_request.Beacon.RequestedInfo.num_requested_eids; |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 574 | vos_mem_copy(pCurrentReq->request.Beacon.reqIes.pElementIds, |
| 575 | pBeaconReq->measurement_request.Beacon.RequestedInfo.requested_eids, |
| 576 | pCurrentReq->request.Beacon.reqIes.num); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 577 | } |
| 578 | |
| 579 | if( pBeaconReq->measurement_request.Beacon.num_APChannelReport ) |
| 580 | { |
| 581 | for( num_APChanReport = 0 ; num_APChanReport < pBeaconReq->measurement_request.Beacon.num_APChannelReport ; num_APChanReport++ ) |
| 582 | num_channels += pBeaconReq->measurement_request.Beacon.APChannelReport[num_APChanReport].num_channelList; |
| 583 | } |
| 584 | |
| 585 | //Prepare the request to send to SME. |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 586 | pSmeBcnReportReq = vos_mem_malloc(sizeof( tSirBeaconReportReqInd )); |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 587 | if ( NULL == pSmeBcnReportReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 588 | { |
| 589 | limLog( pMac, LOGP, |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 590 | FL( "Unable to allocate memory during Beacon Report Req Ind to SME" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 591 | |
| 592 | return eRRM_FAILURE; |
| 593 | |
| 594 | } |
| 595 | |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 596 | vos_mem_set(pSmeBcnReportReq,sizeof( tSirBeaconReportReqInd ),0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 597 | |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 598 | /* Allocated memory for pSmeBcnReportReq....will be freed by other modulea*/ |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 599 | vos_mem_copy(pSmeBcnReportReq->bssId, pSessionEntry->bssId, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 600 | pSmeBcnReportReq->messageType = eWNI_SME_BEACON_REPORT_REQ_IND; |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 601 | pSmeBcnReportReq->length = sizeof( tSirBeaconReportReqInd ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 602 | pSmeBcnReportReq->uDialogToken = pBeaconReq->measurement_token; |
Kanchanapally, Vidyullatha | 5dbeaf2 | 2014-03-05 20:18:33 +0530 | [diff] [blame] | 603 | pSmeBcnReportReq->msgSource = eRRM_MSG_SOURCE_11K; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 604 | pSmeBcnReportReq->randomizationInterval = SYS_TU_TO_MS (pBeaconReq->measurement_request.Beacon.randomization); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 605 | pSmeBcnReportReq->channelInfo.regulatoryClass = pBeaconReq->measurement_request.Beacon.regClass; |
| 606 | pSmeBcnReportReq->channelInfo.channelNum = pBeaconReq->measurement_request.Beacon.channel; |
Kanchanapally, Vidyullatha | 5dbeaf2 | 2014-03-05 20:18:33 +0530 | [diff] [blame] | 607 | pSmeBcnReportReq->measurementDuration[0] = SYS_TU_TO_MS(measDuration); |
| 608 | pSmeBcnReportReq->fMeasurementtype[0] = pBeaconReq->measurement_request.Beacon.meas_mode; |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 609 | vos_mem_copy(pSmeBcnReportReq->macaddrBssid, pBeaconReq->measurement_request.Beacon.BSSID, |
| 610 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 611 | |
| 612 | if( pBeaconReq->measurement_request.Beacon.SSID.present ) |
| 613 | { |
| 614 | pSmeBcnReportReq->ssId.length = pBeaconReq->measurement_request.Beacon.SSID.num_ssid; |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 615 | vos_mem_copy(pSmeBcnReportReq->ssId.ssId, |
| 616 | pBeaconReq->measurement_request.Beacon.SSID.ssid, |
| 617 | pSmeBcnReportReq->ssId.length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 618 | } |
| 619 | |
| 620 | pCurrentReq->token = pBeaconReq->measurement_token; |
| 621 | |
| 622 | pSmeBcnReportReq->channelList.numChannels = num_channels; |
| 623 | if( pBeaconReq->measurement_request.Beacon.num_APChannelReport ) |
| 624 | { |
Nishank Aggarwal | 2018268 | 2017-06-27 12:24:19 +0530 | [diff] [blame] | 625 | tANI_U8 *ch_lst = pSmeBcnReportReq->channelList.channelNumber; |
| 626 | tANI_U8 len; |
| 627 | tANI_U16 ch_ctr = 0; |
| 628 | for(num_APChanReport = 0; |
| 629 | num_APChanReport < |
| 630 | pBeaconReq->measurement_request.Beacon.num_APChannelReport; |
| 631 | num_APChanReport++) { |
| 632 | len = pBeaconReq->measurement_request.Beacon. |
| 633 | APChannelReport[num_APChanReport].num_channelList; |
| 634 | if (ch_ctr + len > |
| 635 | sizeof(pSmeBcnReportReq->channelList.channelNumber)) |
| 636 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 637 | |
Nishank Aggarwal | 2018268 | 2017-06-27 12:24:19 +0530 | [diff] [blame] | 638 | vos_mem_copy(&ch_lst[ch_ctr], |
| 639 | pBeaconReq->measurement_request.Beacon. |
| 640 | APChannelReport[num_APChanReport].channelList, |
| 641 | len); |
| 642 | |
| 643 | ch_ctr += len; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 644 | } |
| 645 | } |
| 646 | |
| 647 | //Send request to SME. |
| 648 | mmhMsg.type = eWNI_SME_BEACON_REPORT_REQ_IND; |
| 649 | mmhMsg.bodyptr = pSmeBcnReportReq; |
Konamki, Sreelakshmi | 824f93e | 2015-07-31 12:55:48 +0530 | [diff] [blame] | 650 | MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, pSessionEntry->peSessionId, |
| 651 | mmhMsg.type)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 652 | return limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT); |
| 653 | } |
| 654 | |
| 655 | // -------------------------------------------------------------------- |
| 656 | /** |
| 657 | * rrmFillBeaconIes |
| 658 | * |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 659 | * FUNCTION: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 660 | * |
| 661 | * LOGIC: Fills Fixed fields and Ies in bss description to an array of tANI_U8. |
| 662 | * |
| 663 | * ASSUMPTIONS: |
| 664 | * |
| 665 | * NOTE: |
| 666 | * |
| 667 | * @param pIes - pointer to the buffer that should be populated with ies. |
| 668 | * @param pNumIes - returns the num of ies filled in this param. |
| 669 | * @param pIesMaxSize - Max size of the buffer pIes. |
| 670 | * @param eids - pointer to array of eids. If NULL, all ies will be populated. |
| 671 | * @param numEids - number of elements in array eids. |
| 672 | * @param pBssDesc - pointer to Bss Description. |
| 673 | * @return None |
| 674 | */ |
| 675 | static void |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 676 | rrmFillBeaconIes( tpAniSirGlobal pMac, |
| 677 | tANI_U8 *pIes, tANI_U8 *pNumIes, tANI_U8 pIesMaxSize, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 678 | tANI_U8 *eids, tANI_U8 numEids, |
| 679 | tpSirBssDescription pBssDesc ) |
| 680 | { |
Pragaspathi Thilagaraj | a3d700f | 2020-02-12 16:07:38 +0530 | [diff] [blame^] | 681 | tANI_U8 len, *pBcnIes, count = 0, i; |
| 682 | tANI_U16 BcnNumIes = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 683 | |
| 684 | if( (pIes == NULL) || (pNumIes == NULL) || (pBssDesc == NULL) ) |
| 685 | { |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 686 | PELOGE(limLog( pMac, LOGE, FL(" Invalid parameters") );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 687 | return; |
| 688 | } |
| 689 | |
| 690 | //Make sure that if eid is null, numEids is set to zero. |
| 691 | numEids = (eids == NULL) ? 0 : numEids; |
| 692 | |
| 693 | pBcnIes = (tANI_U8*) &pBssDesc->ieFields[0]; |
| 694 | BcnNumIes = (tANI_U8)GET_IE_LEN_IN_BSS( pBssDesc->length ); |
| 695 | |
| 696 | *pNumIes = 0; |
| 697 | |
| 698 | *((tANI_U32*)pIes) = pBssDesc->timeStamp[0]; |
| 699 | *pNumIes+=sizeof(tANI_U32); pIes+=sizeof(tANI_U32); |
| 700 | *((tANI_U32*)pIes) = pBssDesc->timeStamp[1]; |
| 701 | *pNumIes+=sizeof(tANI_U32); pIes+=sizeof(tANI_U32); |
| 702 | *((tANI_U16*)pIes) = pBssDesc->beaconInterval; |
| 703 | *pNumIes+=sizeof(tANI_U16); pIes+=sizeof(tANI_U16); |
| 704 | *((tANI_U16*)pIes) = pBssDesc->capabilityInfo; |
| 705 | *pNumIes+=sizeof(tANI_U16); pIes+=sizeof(tANI_U16); |
| 706 | |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 707 | while ( BcnNumIes > 0 ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 708 | { |
Pragaspathi Thilagaraj | a3d700f | 2020-02-12 16:07:38 +0530 | [diff] [blame^] | 709 | len = *(pBcnIes + 1); //element id + length. |
| 710 | len += 2; |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 711 | limLog( pMac, LOG3, "EID = %d, len = %d total = %d", |
| 712 | *pBcnIes, *(pBcnIes+1), len ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 713 | |
Pragaspathi Thilagaraj | a3d700f | 2020-02-12 16:07:38 +0530 | [diff] [blame^] | 714 | if (BcnNumIes < len || len <= 2) { |
| 715 | limLog(pMac, LOGE, "RRM: Invalid IE len:%d exp_len:%d", |
| 716 | len, BcnNumIes); |
| 717 | break; |
| 718 | } |
| 719 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 720 | i = 0; |
| 721 | do |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 722 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 723 | if( ( (eids == NULL) || ( *pBcnIes == eids[i] ) ) && |
| 724 | ( (*pNumIes) + len) < pIesMaxSize ) |
| 725 | { |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 726 | limLog( pMac, LOG3, "Adding Eid %d, len=%d", *pBcnIes, len ); |
| 727 | |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 728 | vos_mem_copy(pIes, pBcnIes, len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 729 | pIes += len; |
| 730 | *pNumIes += len; |
| 731 | count++; |
| 732 | break; |
| 733 | } |
| 734 | i++; |
| 735 | }while( i < numEids ); |
| 736 | |
| 737 | pBcnIes += len; |
| 738 | BcnNumIes -= len; |
| 739 | } |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 740 | limLog( pMac, LOG1, "Total length of Ies added = %d", *pNumIes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 741 | } |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 742 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 743 | // -------------------------------------------------------------------- |
| 744 | /** |
| 745 | * rrmProcessBeaconReportXmit |
| 746 | * |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 747 | * FUNCTION: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 748 | * |
| 749 | * LOGIC: Create a Radio measurement report action frame and send it to peer. |
| 750 | * |
| 751 | * ASSUMPTIONS: |
| 752 | * |
| 753 | * NOTE: |
| 754 | * |
| 755 | * @param pBcnReport Data for beacon report IE from SME. |
| 756 | * @return None |
| 757 | */ |
| 758 | tSirRetStatus |
| 759 | rrmProcessBeaconReportXmit( tpAniSirGlobal pMac, |
| 760 | tpSirBeaconReportXmitInd pBcnReport) |
| 761 | { |
| 762 | tSirRetStatus status = eSIR_SUCCESS; |
Kanchanapally, Vidyullatha | ced2f42 | 2014-02-04 20:45:38 +0530 | [diff] [blame] | 763 | tSirMacRadioMeasureReport *pReport = NULL; |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 764 | tpRRMReq pCurrentReq = pMac->rrm.rrmPEContext.pCurrentReq; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 765 | tpPESession pSessionEntry ; |
| 766 | tANI_U8 sessionId; |
Madan Mohan Koyyalamudi | c6a1d88 | 2013-09-28 22:24:21 +0530 | [diff] [blame] | 767 | v_U8_t flagBSSPresent = FALSE, bssDescCnt = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 768 | |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 769 | limLog( pMac, LOG1, "Received beacon report xmit indication"); |
Madan Mohan Koyyalamudi | c6a1d88 | 2013-09-28 22:24:21 +0530 | [diff] [blame] | 770 | |
| 771 | if (NULL == pBcnReport) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 772 | { |
Madan Mohan Koyyalamudi | c6a1d88 | 2013-09-28 22:24:21 +0530 | [diff] [blame] | 773 | PELOGE(limLog( pMac, LOGE, |
| 774 | "Received pBcnReport is NULL in PE");) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 775 | return eSIR_FAILURE; |
| 776 | } |
Madan Mohan Koyyalamudi | c6a1d88 | 2013-09-28 22:24:21 +0530 | [diff] [blame] | 777 | |
| 778 | if (NULL == pCurrentReq) |
| 779 | { |
| 780 | PELOGE(limLog( pMac, LOGE, |
| 781 | "Received report xmit while there is no request pending in PE");) |
| 782 | return eSIR_FAILURE; |
| 783 | } |
| 784 | |
Kanchanapally, Vidyullatha | ced2f42 | 2014-02-04 20:45:38 +0530 | [diff] [blame] | 785 | if( (pBcnReport->numBssDesc) || |
| 786 | (!pBcnReport->numBssDesc && pCurrentReq->sendEmptyBcnRpt) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 787 | { |
Kanchanapally, Vidyullatha | ced2f42 | 2014-02-04 20:45:38 +0530 | [diff] [blame] | 788 | pBcnReport->numBssDesc = (pBcnReport->numBssDesc == RRM_BCN_RPT_NO_BSS_INFO)? |
| 789 | RRM_BCN_RPT_MIN_RPT : pBcnReport->numBssDesc; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 790 | |
Kanchanapally, Vidyullatha | ced2f42 | 2014-02-04 20:45:38 +0530 | [diff] [blame] | 791 | if (NULL == (pSessionEntry = peFindSessionByBssid(pMac, |
| 792 | pBcnReport->bssId, |
| 793 | &sessionId))) |
| 794 | { |
| 795 | PELOGE(limLog(pMac, LOGE, FL("session does not exist for given bssId"));) |
| 796 | return eSIR_FAILURE; |
| 797 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 798 | |
Kanchanapally, Vidyullatha | ced2f42 | 2014-02-04 20:45:38 +0530 | [diff] [blame] | 799 | pReport = vos_mem_malloc(pBcnReport->numBssDesc * |
| 800 | sizeof(tSirMacRadioMeasureReport)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 801 | |
Kanchanapally, Vidyullatha | ced2f42 | 2014-02-04 20:45:38 +0530 | [diff] [blame] | 802 | if (NULL == pReport) |
| 803 | { |
| 804 | PELOGE(limLog(pMac, LOGE, FL("RRM Report is NULL, allocation failed"));) |
| 805 | return eSIR_FAILURE; |
| 806 | } |
Madan Mohan Koyyalamudi | c6a1d88 | 2013-09-28 22:24:21 +0530 | [diff] [blame] | 807 | |
Kanchanapally, Vidyullatha | ced2f42 | 2014-02-04 20:45:38 +0530 | [diff] [blame] | 808 | vos_mem_zero( pReport, |
| 809 | pBcnReport->numBssDesc * sizeof(tSirMacRadioMeasureReport) ); |
Gopichand Nakkala | 72717fd | 2013-02-08 12:23:45 +0530 | [diff] [blame] | 810 | |
Kanchanapally, Vidyullatha | ced2f42 | 2014-02-04 20:45:38 +0530 | [diff] [blame] | 811 | for (bssDescCnt = 0; bssDescCnt < pBcnReport->numBssDesc; bssDescCnt++) |
| 812 | { |
| 813 | //Prepare the beacon report and send it to the peer. |
| 814 | pReport[bssDescCnt].token = pBcnReport->uDialogToken; |
| 815 | pReport[bssDescCnt].refused = 0; |
| 816 | pReport[bssDescCnt].incapable = 0; |
| 817 | pReport[bssDescCnt].type = SIR_MAC_RRM_BEACON_TYPE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 818 | |
Kanchanapally, Vidyullatha | ced2f42 | 2014-02-04 20:45:38 +0530 | [diff] [blame] | 819 | //If the scan result is NULL then send report request with |
| 820 | //option subelement as NULL.. |
| 821 | if ( NULL != pBcnReport->pBssDescription[bssDescCnt] ) |
| 822 | { |
| 823 | flagBSSPresent = TRUE; |
| 824 | } |
| 825 | |
| 826 | //Valid response is included if the size of beacon xmit |
| 827 | //is == size of beacon xmit ind + ies |
| 828 | if ( pBcnReport->length >= sizeof( tSirBeaconReportXmitInd ) ) |
| 829 | { |
| 830 | pReport[bssDescCnt].report.beaconReport.regClass = pBcnReport->regClass; |
| 831 | if ( flagBSSPresent ) |
| 832 | { |
Madan Mohan Koyyalamudi | c6a1d88 | 2013-09-28 22:24:21 +0530 | [diff] [blame] | 833 | pReport[bssDescCnt].report.beaconReport.channel = |
| 834 | pBcnReport->pBssDescription[bssDescCnt]->channelId; |
| 835 | vos_mem_copy( pReport[bssDescCnt].report.beaconReport.measStartTime, |
| 836 | pBcnReport->pBssDescription[bssDescCnt]->startTSF, |
| 837 | sizeof( pBcnReport->pBssDescription[bssDescCnt]->startTSF) ); |
| 838 | pReport[bssDescCnt].report.beaconReport.measDuration = |
| 839 | SYS_MS_TO_TU(pBcnReport->duration); |
| 840 | pReport[bssDescCnt].report.beaconReport.phyType = |
| 841 | pBcnReport->pBssDescription[bssDescCnt]->nwType; |
| 842 | pReport[bssDescCnt].report.beaconReport.bcnProbeRsp = 1; |
| 843 | pReport[bssDescCnt].report.beaconReport.rsni = |
| 844 | pBcnReport->pBssDescription[bssDescCnt]->sinr; |
| 845 | pReport[bssDescCnt].report.beaconReport.rcpi = |
| 846 | pBcnReport->pBssDescription[bssDescCnt]->rssi; |
| 847 | |
| 848 | pReport[bssDescCnt].report.beaconReport.antennaId = 0; |
| 849 | pReport[bssDescCnt].report.beaconReport.parentTSF = |
| 850 | pBcnReport->pBssDescription[bssDescCnt]->parentTSF; |
| 851 | vos_mem_copy( pReport[bssDescCnt].report.beaconReport.bssid, |
| 852 | pBcnReport->pBssDescription[bssDescCnt]->bssId, |
| 853 | sizeof(tSirMacAddr)); |
Kanchanapally, Vidyullatha | ced2f42 | 2014-02-04 20:45:38 +0530 | [diff] [blame] | 854 | } |
Madan Mohan Koyyalamudi | c6a1d88 | 2013-09-28 22:24:21 +0530 | [diff] [blame] | 855 | |
Kanchanapally, Vidyullatha | ced2f42 | 2014-02-04 20:45:38 +0530 | [diff] [blame] | 856 | switch ( pCurrentReq->request.Beacon.reportingDetail ) |
| 857 | { |
Madan Mohan Koyyalamudi | c6a1d88 | 2013-09-28 22:24:21 +0530 | [diff] [blame] | 858 | case BEACON_REPORTING_DETAIL_NO_FF_IE: |
| 859 | //0 No need to include any elements. |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 860 | limLog(pMac, LOG3, "No reporting detail requested"); |
Madan Mohan Koyyalamudi | c6a1d88 | 2013-09-28 22:24:21 +0530 | [diff] [blame] | 861 | break; |
| 862 | case BEACON_REPORTING_DETAIL_ALL_FF_REQ_IE: |
| 863 | //1: Include all FFs and Requested Ies. |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 864 | limLog(pMac, LOG3, |
| 865 | "Only requested IEs in reporting detail requested"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 866 | |
Madan Mohan Koyyalamudi | c6a1d88 | 2013-09-28 22:24:21 +0530 | [diff] [blame] | 867 | if ( flagBSSPresent ) |
| 868 | { |
| 869 | rrmFillBeaconIes( pMac, |
| 870 | (tANI_U8*) &pReport[bssDescCnt].report.beaconReport.Ies[0], |
| 871 | (tANI_U8*) &pReport[bssDescCnt].report.beaconReport.numIes, |
| 872 | BEACON_REPORT_MAX_IES, |
| 873 | pCurrentReq->request.Beacon.reqIes.pElementIds, |
| 874 | pCurrentReq->request.Beacon.reqIes.num, |
| 875 | pBcnReport->pBssDescription[bssDescCnt] ); |
| 876 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 877 | |
Madan Mohan Koyyalamudi | c6a1d88 | 2013-09-28 22:24:21 +0530 | [diff] [blame] | 878 | break; |
| 879 | case BEACON_REPORTING_DETAIL_ALL_FF_IE: |
| 880 | //2 / default - Include all FFs and all Ies. |
| 881 | default: |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 882 | limLog(pMac, LOG3, "Default all IEs and FFs"); |
Madan Mohan Koyyalamudi | c6a1d88 | 2013-09-28 22:24:21 +0530 | [diff] [blame] | 883 | if ( flagBSSPresent ) |
| 884 | { |
| 885 | rrmFillBeaconIes( pMac, |
| 886 | (tANI_U8*) &pReport[bssDescCnt].report.beaconReport.Ies[0], |
| 887 | (tANI_U8*) &pReport[bssDescCnt].report.beaconReport.numIes, |
| 888 | BEACON_REPORT_MAX_IES, |
Gopichand Nakkala | 72717fd | 2013-02-08 12:23:45 +0530 | [diff] [blame] | 889 | NULL, 0, |
Madan Mohan Koyyalamudi | c6a1d88 | 2013-09-28 22:24:21 +0530 | [diff] [blame] | 890 | pBcnReport->pBssDescription[bssDescCnt] ); |
| 891 | } |
| 892 | break; |
Kanchanapally, Vidyullatha | ced2f42 | 2014-02-04 20:45:38 +0530 | [diff] [blame] | 893 | } |
| 894 | } |
| 895 | } |
| 896 | |
| 897 | limLog( pMac, LOG1, "Sending Action frame with %d bss info", bssDescCnt); |
| 898 | limSendRadioMeasureReportActionFrame( pMac, |
| 899 | pCurrentReq->dialog_token, |
| 900 | bssDescCnt, |
| 901 | pReport, |
| 902 | pBcnReport->bssId, |
| 903 | pSessionEntry ); |
| 904 | |
| 905 | pCurrentReq->sendEmptyBcnRpt = false; |
Madan Mohan Koyyalamudi | c6a1d88 | 2013-09-28 22:24:21 +0530 | [diff] [blame] | 906 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 907 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 908 | if( pBcnReport->fMeasureDone ) |
| 909 | { |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 910 | limLog( pMac, LOG3, "Measurement done....cleanup the context"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 911 | |
| 912 | rrmCleanup(pMac); |
| 913 | } |
Madan Mohan Koyyalamudi | c6a1d88 | 2013-09-28 22:24:21 +0530 | [diff] [blame] | 914 | |
Kanchanapally, Vidyullatha | ced2f42 | 2014-02-04 20:45:38 +0530 | [diff] [blame] | 915 | if( NULL != pReport ) |
| 916 | vos_mem_free(pReport); |
Madan Mohan Koyyalamudi | c6a1d88 | 2013-09-28 22:24:21 +0530 | [diff] [blame] | 917 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 918 | return status; |
| 919 | } |
| 920 | |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 921 | void rrmProcessBeaconRequestFailure(tpAniSirGlobal pMac, tpPESession pSessionEntry, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 922 | tSirMacAddr peer, tRrmRetStatus status) |
| 923 | { |
| 924 | tpSirMacRadioMeasureReport pReport = NULL; |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 925 | tpRRMReq pCurrentReq = pMac->rrm.rrmPEContext.pCurrentReq; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 926 | |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 927 | pReport = vos_mem_malloc(sizeof( tSirMacRadioMeasureReport )); |
| 928 | if ( NULL == pReport ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 929 | { |
| 930 | limLog( pMac, LOGP, |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 931 | FL( "Unable to allocate memory during RRM Req processing" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 932 | return; |
| 933 | } |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 934 | vos_mem_set(pReport, sizeof(tSirMacRadioMeasureReport), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 935 | pReport->token = pCurrentReq->token; |
| 936 | pReport->type = SIR_MAC_RRM_BEACON_TYPE; |
| 937 | |
| 938 | switch (status) |
| 939 | { |
| 940 | case eRRM_REFUSED: |
| 941 | pReport->refused = 1; |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 942 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 943 | case eRRM_INCAPABLE: |
| 944 | pReport->incapable = 1; |
| 945 | break; |
| 946 | default: |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 947 | PELOGE(limLog( pMac, LOGE, |
| 948 | FL(" Beacon request processing failed no report sent with status %d "), |
| 949 | status);); |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 950 | vos_mem_free(pReport); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 951 | return; |
| 952 | } |
| 953 | |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 954 | limSendRadioMeasureReportActionFrame( pMac, pCurrentReq->dialog_token, 1, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 955 | pReport, peer, pSessionEntry ); |
| 956 | |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 957 | vos_mem_free(pReport); |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 958 | limLog( pMac, LOG3, FL(" Free memory for pReport") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 959 | return; |
| 960 | } |
| 961 | |
| 962 | // -------------------------------------------------------------------- |
| 963 | /** |
| 964 | * rrmProcessRadioMeasurementRequest |
| 965 | * |
| 966 | * FUNCTION: Processes the Radio Resource Measurement request. |
| 967 | * |
| 968 | * LOGIC: |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 969 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 970 | |
| 971 | * |
| 972 | * ASSUMPTIONS: |
| 973 | * |
| 974 | * NOTE: |
| 975 | * |
| 976 | * @param peer Macaddress of the peer requesting the radio measurement. |
| 977 | * @param pRRMReq Array of Measurement request IEs |
| 978 | * @param pSessionEntry session entry. |
| 979 | * @return None |
| 980 | */ |
| 981 | tSirRetStatus |
Gopichand Nakkala | 72717fd | 2013-02-08 12:23:45 +0530 | [diff] [blame] | 982 | rrmProcessRadioMeasurementRequest( tpAniSirGlobal pMac, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 983 | tSirMacAddr peer, |
| 984 | tDot11fRadioMeasurementRequest *pRRMReq, |
| 985 | tpPESession pSessionEntry ) |
| 986 | { |
| 987 | tANI_U8 i; |
| 988 | tSirRetStatus status = eSIR_SUCCESS; |
| 989 | tpSirMacRadioMeasureReport pReport = NULL; |
| 990 | tANI_U8 num_report = 0; |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 991 | tpRRMReq pCurrentReq = pMac->rrm.rrmPEContext.pCurrentReq; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 992 | tRrmRetStatus rrmStatus = eRRM_SUCCESS; |
| 993 | |
| 994 | if( !pRRMReq->num_MeasurementRequest ) |
| 995 | { |
| 996 | //No measurement requests.... |
| 997 | // |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 998 | pReport = vos_mem_malloc(sizeof( tSirMacRadioMeasureReport )); |
| 999 | if ( NULL == pReport ) |
Gopichand Nakkala | 72717fd | 2013-02-08 12:23:45 +0530 | [diff] [blame] | 1000 | { |
| 1001 | limLog( pMac, LOGP, |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1002 | FL( "Unable to allocate memory during RRM Req processing" )); |
Gopichand Nakkala | 72717fd | 2013-02-08 12:23:45 +0530 | [diff] [blame] | 1003 | return eSIR_MEM_ALLOC_FAILED; |
| 1004 | } |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1005 | vos_mem_set(pReport, sizeof(tSirMacRadioMeasureReport),0); |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 1006 | PELOGE(limLog( pMac, LOGE, |
| 1007 | FL("No requestIes in the measurement request, sending incapable report"));) |
Gopichand Nakkala | 72717fd | 2013-02-08 12:23:45 +0530 | [diff] [blame] | 1008 | pReport->incapable = 1; |
| 1009 | num_report = 1; |
| 1010 | limSendRadioMeasureReportActionFrame( pMac, pRRMReq->DialogToken.token, num_report, |
| 1011 | pReport, peer, pSessionEntry ); |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1012 | vos_mem_free(pReport); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1013 | return eSIR_FAILURE; |
| 1014 | } |
| 1015 | |
| 1016 | // PF Fix |
| 1017 | if( pRRMReq->NumOfRepetitions.repetitions > 0 ) |
| 1018 | { |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 1019 | limLog( pMac, LOG1, |
| 1020 | FL(" number of repetitions %d"), |
| 1021 | pRRMReq->NumOfRepetitions.repetitions ); |
| 1022 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1023 | //Send a report with incapable bit set. Not supporting repetitions. |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1024 | pReport = vos_mem_malloc(sizeof( tSirMacRadioMeasureReport )); |
| 1025 | if ( NULL == pReport ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1026 | { |
| 1027 | limLog( pMac, LOGP, |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1028 | FL( "Unable to allocate memory during RRM Req processing" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1029 | return eSIR_MEM_ALLOC_FAILED; |
| 1030 | } |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1031 | vos_mem_set(pReport, sizeof(tSirMacRadioMeasureReport), 0); |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 1032 | PELOGE(limLog( pMac, LOGE, FL(" Allocated memory for pReport") );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1033 | pReport->incapable = 1; |
| 1034 | pReport->type = pRRMReq->MeasurementRequest[0].measurement_type; |
| 1035 | num_report = 1; |
| 1036 | goto end; |
| 1037 | |
| 1038 | } |
| 1039 | |
| 1040 | for( i= 0; i < pRRMReq->num_MeasurementRequest; i++ ) |
| 1041 | { |
| 1042 | switch( pRRMReq->MeasurementRequest[i].measurement_type ) |
| 1043 | { |
| 1044 | case SIR_MAC_RRM_BEACON_TYPE: |
| 1045 | //Process beacon request. |
| 1046 | if( pCurrentReq ) |
| 1047 | { |
| 1048 | if ( pReport == NULL ) //Allocate memory to send reports for any subsequent requests. |
| 1049 | { |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1050 | pReport = vos_mem_malloc(sizeof( tSirMacRadioMeasureReport ) |
| 1051 | * (pRRMReq->num_MeasurementRequest - i)); |
| 1052 | if ( NULL == pReport ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1053 | { |
| 1054 | limLog( pMac, LOGP, |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1055 | FL( "Unable to allocate memory during RRM Req processing" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1056 | return eSIR_MEM_ALLOC_FAILED; |
| 1057 | } |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1058 | vos_mem_set(pReport, |
| 1059 | sizeof( tSirMacRadioMeasureReport ) |
| 1060 | * (pRRMReq->num_MeasurementRequest - i), |
| 1061 | 0); |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 1062 | limLog( pMac, LOG3, |
| 1063 | FL(" rrm beacon type refused of %d report in beacon table"), |
| 1064 | num_report ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1065 | |
| 1066 | } |
| 1067 | pReport[num_report].refused = 1; |
| 1068 | pReport[num_report].type = SIR_MAC_RRM_BEACON_TYPE; |
| 1069 | pReport[num_report].token = pRRMReq->MeasurementRequest[i].measurement_token; |
| 1070 | num_report++; |
| 1071 | continue; |
| 1072 | } |
| 1073 | else |
| 1074 | { |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1075 | pCurrentReq = vos_mem_malloc(sizeof( *pCurrentReq )); |
| 1076 | if ( NULL == pCurrentReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1077 | { |
| 1078 | limLog( pMac, LOGP, |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1079 | FL( "Unable to allocate memory during RRM Req processing" )); |
| 1080 | vos_mem_free(pReport); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1081 | return eSIR_MEM_ALLOC_FAILED; |
| 1082 | } |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 1083 | limLog( pMac, LOG3, FL(" Processing Beacon Report request") ); |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1084 | vos_mem_set(pCurrentReq, sizeof( *pCurrentReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1085 | pCurrentReq->dialog_token = pRRMReq->DialogToken.token; |
| 1086 | pCurrentReq->token = pRRMReq->MeasurementRequest[i].measurement_token; |
Kanchanapally, Vidyullatha | ced2f42 | 2014-02-04 20:45:38 +0530 | [diff] [blame] | 1087 | pCurrentReq->sendEmptyBcnRpt = true; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1088 | pMac->rrm.rrmPEContext.pCurrentReq = pCurrentReq; |
| 1089 | rrmStatus = rrmProcessBeaconReportReq( pMac, pCurrentReq, &pRRMReq->MeasurementRequest[i], pSessionEntry ); |
| 1090 | if (eRRM_SUCCESS != rrmStatus) |
| 1091 | { |
| 1092 | rrmProcessBeaconRequestFailure(pMac, pSessionEntry, peer, rrmStatus); |
| 1093 | rrmCleanup(pMac); |
| 1094 | } |
| 1095 | } |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 1096 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1097 | default: |
| 1098 | //Send a report with incapabale bit set. |
| 1099 | if ( pReport == NULL ) //Allocate memory to send reports for any subsequent requests. |
| 1100 | { |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1101 | pReport = vos_mem_malloc(sizeof( tSirMacRadioMeasureReport ) |
| 1102 | * (pRRMReq->num_MeasurementRequest - i)); |
| 1103 | if ( NULL == pReport ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1104 | { |
| 1105 | limLog( pMac, LOGP, |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1106 | FL( "Unable to allocate memory during RRM Req processing" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1107 | return eSIR_MEM_ALLOC_FAILED; |
| 1108 | } |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1109 | vos_mem_set(pReport, |
| 1110 | sizeof( tSirMacRadioMeasureReport ) |
| 1111 | * (pRRMReq->num_MeasurementRequest - i), |
| 1112 | 0); |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 1113 | limLog( pMac, LOG3, |
| 1114 | FL(" rrm beacon type incapble of %d report "), |
| 1115 | num_report ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1116 | } |
| 1117 | pReport[num_report].incapable = 1; |
| 1118 | pReport[num_report].type = pRRMReq->MeasurementRequest[i].measurement_type; |
| 1119 | pReport[num_report].token = pRRMReq->MeasurementRequest[i].measurement_token; |
| 1120 | num_report++; |
| 1121 | break; |
| 1122 | } |
| 1123 | } |
| 1124 | |
| 1125 | end: |
| 1126 | if( pReport ) |
| 1127 | { |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 1128 | limSendRadioMeasureReportActionFrame( pMac, pRRMReq->DialogToken.token, num_report, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1129 | pReport, peer, pSessionEntry ); |
| 1130 | |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1131 | vos_mem_free(pReport); |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 1132 | limLog( pMac, LOG3, FL(" Free memory for pReport") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1133 | } |
| 1134 | return status; |
| 1135 | |
| 1136 | } |
| 1137 | |
| 1138 | // -------------------------------------------------------------------- |
| 1139 | /** |
| 1140 | * rrmUpdateStartTSF |
| 1141 | ** |
| 1142 | * FUNCTION: Store start TSF of measurement. |
| 1143 | * |
| 1144 | * LOGIC: |
| 1145 | * |
| 1146 | * ASSUMPTIONS: |
| 1147 | * |
| 1148 | * NOTE: |
| 1149 | * |
| 1150 | * @param startTSF - TSF value at the start of measurement. |
| 1151 | * @return None |
| 1152 | */ |
| 1153 | void |
| 1154 | rrmUpdateStartTSF ( tpAniSirGlobal pMac, tANI_U32 startTSF[2] ) |
| 1155 | { |
| 1156 | #if 0 //defined WLAN_VOWIFI_DEBUG |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 1157 | limLog( pMac, LOGE, "Update Start TSF = %d %d", startTSF[0], startTSF[1] ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1158 | #endif |
| 1159 | pMac->rrm.rrmPEContext.startTSF[0] = startTSF[0]; |
| 1160 | pMac->rrm.rrmPEContext.startTSF[1] = startTSF[1]; |
| 1161 | } |
| 1162 | |
| 1163 | // -------------------------------------------------------------------- |
| 1164 | /** |
| 1165 | * rrmGetStartTSF |
| 1166 | * |
| 1167 | * FUNCTION: Get the Start TSF. |
| 1168 | * |
| 1169 | * LOGIC: |
| 1170 | * |
| 1171 | * ASSUMPTIONS: |
| 1172 | * |
| 1173 | * NOTE: |
| 1174 | * |
| 1175 | * @param startTSF - store star TSF in this buffer. |
| 1176 | * @return txPower |
| 1177 | */ |
| 1178 | void |
| 1179 | rrmGetStartTSF ( tpAniSirGlobal pMac, tANI_U32 *pStartTSF ) |
| 1180 | { |
| 1181 | #if 0 //defined WLAN_VOWIFI_DEBUG |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 1182 | limLog( pMac, LOGE, "Get the start TSF, TSF = %d %d ", pMac->rrm.rrmPEContext.startTSF[0], pMac->rrm.rrmPEContext.startTSF[1] ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1183 | #endif |
| 1184 | pStartTSF[0] = pMac->rrm.rrmPEContext.startTSF[0]; |
| 1185 | pStartTSF[1] = pMac->rrm.rrmPEContext.startTSF[1]; |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 1186 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1187 | } |
| 1188 | // -------------------------------------------------------------------- |
| 1189 | /** |
| 1190 | * rrmGetCapabilities |
| 1191 | * |
| 1192 | * FUNCTION: |
| 1193 | * Returns a pointer to tpRRMCaps with all the caps enabled in RRM |
| 1194 | * |
| 1195 | * LOGIC: |
| 1196 | * |
| 1197 | * ASSUMPTIONS: |
| 1198 | * |
| 1199 | * NOTE: |
| 1200 | * |
| 1201 | * @param pSessionEntry |
| 1202 | * @return pointer to tRRMCaps |
| 1203 | */ |
| 1204 | tpRRMCaps rrmGetCapabilities ( tpAniSirGlobal pMac, |
| 1205 | tpPESession pSessionEntry ) |
| 1206 | { |
| 1207 | return &pMac->rrm.rrmPEContext.rrmEnabledCaps; |
| 1208 | } |
| 1209 | |
| 1210 | // -------------------------------------------------------------------- |
| 1211 | /** |
| 1212 | * rrmUpdateConfig |
| 1213 | * |
| 1214 | * FUNCTION: |
| 1215 | * Update the configuration. This is called from limUpdateConfig. |
| 1216 | * |
| 1217 | * LOGIC: |
| 1218 | * |
| 1219 | * ASSUMPTIONS: |
| 1220 | * |
| 1221 | * NOTE: |
| 1222 | * |
| 1223 | * @param pSessionEntry |
| 1224 | * @return pointer to tRRMCaps |
| 1225 | */ |
| 1226 | void rrmUpdateConfig ( tpAniSirGlobal pMac, |
| 1227 | tpPESession pSessionEntry ) |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 1228 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1229 | tANI_U32 val; |
| 1230 | tpRRMCaps pRRMCaps = &pMac->rrm.rrmPEContext.rrmEnabledCaps; |
| 1231 | |
| 1232 | if (wlan_cfgGetInt(pMac, WNI_CFG_RRM_ENABLED, &val) != eSIR_SUCCESS) |
| 1233 | { |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 1234 | limLog(pMac, LOGP, FL("cfg get rrm enabled failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1235 | return; |
| 1236 | } |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 1237 | pMac->rrm.rrmPEContext.rrmEnable = (val) ? 1 : 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1238 | |
| 1239 | if (wlan_cfgGetInt(pMac, WNI_CFG_RRM_OPERATING_CHAN_MAX, &val) != eSIR_SUCCESS) |
| 1240 | { |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 1241 | limLog(pMac, LOGP, FL("cfg get rrm operating channel max measurement duration failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1242 | return; |
| 1243 | } |
| 1244 | pRRMCaps->operatingChanMax = (tANI_U8)val; |
| 1245 | |
| 1246 | if (wlan_cfgGetInt(pMac, WNI_CFG_RRM_NON_OPERATING_CHAN_MAX, &val) != eSIR_SUCCESS) |
| 1247 | { |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 1248 | limLog(pMac, LOGP, FL("cfg get rrm non-operating channel max measurement duration failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1249 | return; |
| 1250 | } |
| 1251 | pRRMCaps->nonOperatingChanMax =(tANI_U8) val; |
| 1252 | |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 1253 | limLog( pMac, LOG1, |
| 1254 | "RRM enabled = %d OperatingChanMax = %d NonOperatingMax = %d", |
| 1255 | pMac->rrm.rrmPEContext.rrmEnable, |
| 1256 | pRRMCaps->operatingChanMax, pRRMCaps->nonOperatingChanMax ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1257 | } |
| 1258 | // -------------------------------------------------------------------- |
| 1259 | /** |
| 1260 | * rrmInitialize |
| 1261 | * |
| 1262 | * FUNCTION: |
| 1263 | * Initialize RRM module |
| 1264 | * |
| 1265 | * LOGIC: |
| 1266 | * |
| 1267 | * ASSUMPTIONS: |
| 1268 | * |
| 1269 | * NOTE: |
| 1270 | * |
| 1271 | * @return None |
| 1272 | */ |
| 1273 | |
| 1274 | tSirRetStatus |
| 1275 | rrmInitialize(tpAniSirGlobal pMac) |
| 1276 | { |
| 1277 | tpRRMCaps pRRMCaps = &pMac->rrm.rrmPEContext.rrmEnabledCaps; |
| 1278 | |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 1279 | pMac->rrm.rrmPEContext.pCurrentReq = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1280 | pMac->rrm.rrmPEContext.txMgmtPower = 0; |
| 1281 | pMac->rrm.rrmPEContext.DialogToken = 0; |
| 1282 | |
| 1283 | pMac->rrm.rrmPEContext.rrmEnable = 0; |
| 1284 | |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1285 | vos_mem_set(pRRMCaps, sizeof(tRRMCaps), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1286 | pRRMCaps->LinkMeasurement = 1; |
| 1287 | pRRMCaps->NeighborRpt = 1; |
| 1288 | pRRMCaps->BeaconPassive = 1; |
| 1289 | pRRMCaps->BeaconActive = 1; |
| 1290 | pRRMCaps->BeaconTable = 1; |
| 1291 | pRRMCaps->APChanReport = 1; |
| 1292 | |
| 1293 | //pRRMCaps->TCMCapability = 1; |
| 1294 | //pRRMCaps->triggeredTCM = 1; |
| 1295 | pRRMCaps->operatingChanMax = 3; |
| 1296 | pRRMCaps->nonOperatingChanMax = 3; |
| 1297 | |
| 1298 | return eSIR_SUCCESS; |
| 1299 | } |
| 1300 | |
| 1301 | // -------------------------------------------------------------------- |
| 1302 | /** |
| 1303 | * rrmCleanup |
| 1304 | * |
| 1305 | * FUNCTION: |
| 1306 | * cleanup RRM module |
| 1307 | * |
| 1308 | * LOGIC: |
| 1309 | * |
| 1310 | * ASSUMPTIONS: |
| 1311 | * |
| 1312 | * NOTE: |
| 1313 | * |
| 1314 | * @param mode |
| 1315 | * @param rate |
| 1316 | * @return None |
| 1317 | */ |
| 1318 | |
| 1319 | tSirRetStatus |
| 1320 | rrmCleanup(tpAniSirGlobal pMac) |
| 1321 | { |
| 1322 | if( pMac->rrm.rrmPEContext.pCurrentReq ) |
| 1323 | { |
| 1324 | if( pMac->rrm.rrmPEContext.pCurrentReq->request.Beacon.reqIes.pElementIds ) |
| 1325 | { |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1326 | vos_mem_free(pMac->rrm.rrmPEContext.pCurrentReq->request.Beacon.reqIes.pElementIds); |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 1327 | limLog( pMac, LOG4, FL(" Free memory for pElementIds") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1328 | } |
| 1329 | |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1330 | vos_mem_free(pMac->rrm.rrmPEContext.pCurrentReq); |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 1331 | limLog( pMac, LOG4, FL(" Free memory for pCurrentReq") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1332 | } |
| 1333 | |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 1334 | pMac->rrm.rrmPEContext.pCurrentReq = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1335 | return eSIR_SUCCESS; |
| 1336 | } |
| 1337 | |
| 1338 | // -------------------------------------------------------------------- |
| 1339 | /** |
| 1340 | * rrmProcessMessage |
| 1341 | * |
| 1342 | * FUNCTION: Processes the next received Radio Resource Management message |
| 1343 | * |
| 1344 | * LOGIC: |
| 1345 | * |
| 1346 | * ASSUMPTIONS: |
| 1347 | * |
| 1348 | * NOTE: |
| 1349 | * |
| 1350 | * @param None |
| 1351 | * @return None |
| 1352 | */ |
| 1353 | |
| 1354 | void rrmProcessMessage(tpAniSirGlobal pMac, tpSirMsgQ pMsg) |
| 1355 | { |
| 1356 | switch (pMsg->type) |
| 1357 | { |
| 1358 | case eWNI_SME_NEIGHBOR_REPORT_REQ_IND: |
| 1359 | rrmProcessNeighborReportReq( pMac, pMsg->bodyptr ); |
| 1360 | break; |
| 1361 | case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND: |
| 1362 | rrmProcessBeaconReportXmit( pMac, pMsg->bodyptr ); |
| 1363 | break; |
| 1364 | } |
| 1365 | |
| 1366 | } |
| 1367 | |
| 1368 | #endif |