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 ); |
Agrawal Ashish | 01c6634 | 2017-01-27 12:52:25 +0530 | [diff] [blame^] | 285 | LinkReport.txPower = limGetMaxTxPower (pSessionEntry->maxTxPower, |
| 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 | { |
Kanchanapally, Vidyullatha | 5dbeaf2 | 2014-03-05 20:18:33 +0530 | [diff] [blame] | 625 | tANI_U8 *pChanList = pSmeBcnReportReq->channelList.channelNumber; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 626 | for( num_APChanReport = 0 ; num_APChanReport < pBeaconReq->measurement_request.Beacon.num_APChannelReport ; num_APChanReport++ ) |
| 627 | { |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 628 | vos_mem_copy(pChanList, |
| 629 | pBeaconReq->measurement_request.Beacon.APChannelReport[num_APChanReport].channelList, |
| 630 | pBeaconReq->measurement_request.Beacon.APChannelReport[num_APChanReport].num_channelList); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 631 | |
| 632 | pChanList += pBeaconReq->measurement_request.Beacon.APChannelReport[num_APChanReport].num_channelList; |
| 633 | } |
| 634 | } |
| 635 | |
| 636 | //Send request to SME. |
| 637 | mmhMsg.type = eWNI_SME_BEACON_REPORT_REQ_IND; |
| 638 | mmhMsg.bodyptr = pSmeBcnReportReq; |
Konamki, Sreelakshmi | 824f93e | 2015-07-31 12:55:48 +0530 | [diff] [blame] | 639 | MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, pSessionEntry->peSessionId, |
| 640 | mmhMsg.type)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 641 | return limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT); |
| 642 | } |
| 643 | |
| 644 | // -------------------------------------------------------------------- |
| 645 | /** |
| 646 | * rrmFillBeaconIes |
| 647 | * |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 648 | * FUNCTION: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 649 | * |
| 650 | * LOGIC: Fills Fixed fields and Ies in bss description to an array of tANI_U8. |
| 651 | * |
| 652 | * ASSUMPTIONS: |
| 653 | * |
| 654 | * NOTE: |
| 655 | * |
| 656 | * @param pIes - pointer to the buffer that should be populated with ies. |
| 657 | * @param pNumIes - returns the num of ies filled in this param. |
| 658 | * @param pIesMaxSize - Max size of the buffer pIes. |
| 659 | * @param eids - pointer to array of eids. If NULL, all ies will be populated. |
| 660 | * @param numEids - number of elements in array eids. |
| 661 | * @param pBssDesc - pointer to Bss Description. |
| 662 | * @return None |
| 663 | */ |
| 664 | static void |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 665 | rrmFillBeaconIes( tpAniSirGlobal pMac, |
| 666 | tANI_U8 *pIes, tANI_U8 *pNumIes, tANI_U8 pIesMaxSize, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 667 | tANI_U8 *eids, tANI_U8 numEids, |
| 668 | tpSirBssDescription pBssDesc ) |
| 669 | { |
| 670 | tANI_U8 len, *pBcnIes, BcnNumIes, count = 0, i; |
| 671 | |
| 672 | if( (pIes == NULL) || (pNumIes == NULL) || (pBssDesc == NULL) ) |
| 673 | { |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 674 | PELOGE(limLog( pMac, LOGE, FL(" Invalid parameters") );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 675 | return; |
| 676 | } |
| 677 | |
| 678 | //Make sure that if eid is null, numEids is set to zero. |
| 679 | numEids = (eids == NULL) ? 0 : numEids; |
| 680 | |
| 681 | pBcnIes = (tANI_U8*) &pBssDesc->ieFields[0]; |
| 682 | BcnNumIes = (tANI_U8)GET_IE_LEN_IN_BSS( pBssDesc->length ); |
| 683 | |
| 684 | *pNumIes = 0; |
| 685 | |
| 686 | *((tANI_U32*)pIes) = pBssDesc->timeStamp[0]; |
| 687 | *pNumIes+=sizeof(tANI_U32); pIes+=sizeof(tANI_U32); |
| 688 | *((tANI_U32*)pIes) = pBssDesc->timeStamp[1]; |
| 689 | *pNumIes+=sizeof(tANI_U32); pIes+=sizeof(tANI_U32); |
| 690 | *((tANI_U16*)pIes) = pBssDesc->beaconInterval; |
| 691 | *pNumIes+=sizeof(tANI_U16); pIes+=sizeof(tANI_U16); |
| 692 | *((tANI_U16*)pIes) = pBssDesc->capabilityInfo; |
| 693 | *pNumIes+=sizeof(tANI_U16); pIes+=sizeof(tANI_U16); |
| 694 | |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 695 | while ( BcnNumIes > 0 ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 696 | { |
| 697 | len = *(pBcnIes + 1) + 2; //element id + length. |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 698 | limLog( pMac, LOG3, "EID = %d, len = %d total = %d", |
| 699 | *pBcnIes, *(pBcnIes+1), len ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 700 | |
| 701 | i = 0; |
| 702 | do |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 703 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 704 | if( ( (eids == NULL) || ( *pBcnIes == eids[i] ) ) && |
| 705 | ( (*pNumIes) + len) < pIesMaxSize ) |
| 706 | { |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 707 | limLog( pMac, LOG3, "Adding Eid %d, len=%d", *pBcnIes, len ); |
| 708 | |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 709 | vos_mem_copy(pIes, pBcnIes, len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 710 | pIes += len; |
| 711 | *pNumIes += len; |
| 712 | count++; |
| 713 | break; |
| 714 | } |
| 715 | i++; |
| 716 | }while( i < numEids ); |
| 717 | |
| 718 | pBcnIes += len; |
| 719 | BcnNumIes -= len; |
| 720 | } |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 721 | limLog( pMac, LOG1, "Total length of Ies added = %d", *pNumIes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 722 | } |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 723 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 724 | // -------------------------------------------------------------------- |
| 725 | /** |
| 726 | * rrmProcessBeaconReportXmit |
| 727 | * |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 728 | * FUNCTION: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 729 | * |
| 730 | * LOGIC: Create a Radio measurement report action frame and send it to peer. |
| 731 | * |
| 732 | * ASSUMPTIONS: |
| 733 | * |
| 734 | * NOTE: |
| 735 | * |
| 736 | * @param pBcnReport Data for beacon report IE from SME. |
| 737 | * @return None |
| 738 | */ |
| 739 | tSirRetStatus |
| 740 | rrmProcessBeaconReportXmit( tpAniSirGlobal pMac, |
| 741 | tpSirBeaconReportXmitInd pBcnReport) |
| 742 | { |
| 743 | tSirRetStatus status = eSIR_SUCCESS; |
Kanchanapally, Vidyullatha | ced2f42 | 2014-02-04 20:45:38 +0530 | [diff] [blame] | 744 | tSirMacRadioMeasureReport *pReport = NULL; |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 745 | tpRRMReq pCurrentReq = pMac->rrm.rrmPEContext.pCurrentReq; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 746 | tpPESession pSessionEntry ; |
| 747 | tANI_U8 sessionId; |
Madan Mohan Koyyalamudi | c6a1d88 | 2013-09-28 22:24:21 +0530 | [diff] [blame] | 748 | v_U8_t flagBSSPresent = FALSE, bssDescCnt = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 749 | |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 750 | limLog( pMac, LOG1, "Received beacon report xmit indication"); |
Madan Mohan Koyyalamudi | c6a1d88 | 2013-09-28 22:24:21 +0530 | [diff] [blame] | 751 | |
| 752 | if (NULL == pBcnReport) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 753 | { |
Madan Mohan Koyyalamudi | c6a1d88 | 2013-09-28 22:24:21 +0530 | [diff] [blame] | 754 | PELOGE(limLog( pMac, LOGE, |
| 755 | "Received pBcnReport is NULL in PE");) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 756 | return eSIR_FAILURE; |
| 757 | } |
Madan Mohan Koyyalamudi | c6a1d88 | 2013-09-28 22:24:21 +0530 | [diff] [blame] | 758 | |
| 759 | if (NULL == pCurrentReq) |
| 760 | { |
| 761 | PELOGE(limLog( pMac, LOGE, |
| 762 | "Received report xmit while there is no request pending in PE");) |
| 763 | return eSIR_FAILURE; |
| 764 | } |
| 765 | |
Kanchanapally, Vidyullatha | ced2f42 | 2014-02-04 20:45:38 +0530 | [diff] [blame] | 766 | if( (pBcnReport->numBssDesc) || |
| 767 | (!pBcnReport->numBssDesc && pCurrentReq->sendEmptyBcnRpt) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 768 | { |
Kanchanapally, Vidyullatha | ced2f42 | 2014-02-04 20:45:38 +0530 | [diff] [blame] | 769 | pBcnReport->numBssDesc = (pBcnReport->numBssDesc == RRM_BCN_RPT_NO_BSS_INFO)? |
| 770 | RRM_BCN_RPT_MIN_RPT : pBcnReport->numBssDesc; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 771 | |
Kanchanapally, Vidyullatha | ced2f42 | 2014-02-04 20:45:38 +0530 | [diff] [blame] | 772 | if (NULL == (pSessionEntry = peFindSessionByBssid(pMac, |
| 773 | pBcnReport->bssId, |
| 774 | &sessionId))) |
| 775 | { |
| 776 | PELOGE(limLog(pMac, LOGE, FL("session does not exist for given bssId"));) |
| 777 | return eSIR_FAILURE; |
| 778 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 779 | |
Kanchanapally, Vidyullatha | ced2f42 | 2014-02-04 20:45:38 +0530 | [diff] [blame] | 780 | pReport = vos_mem_malloc(pBcnReport->numBssDesc * |
| 781 | sizeof(tSirMacRadioMeasureReport)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 782 | |
Kanchanapally, Vidyullatha | ced2f42 | 2014-02-04 20:45:38 +0530 | [diff] [blame] | 783 | if (NULL == pReport) |
| 784 | { |
| 785 | PELOGE(limLog(pMac, LOGE, FL("RRM Report is NULL, allocation failed"));) |
| 786 | return eSIR_FAILURE; |
| 787 | } |
Madan Mohan Koyyalamudi | c6a1d88 | 2013-09-28 22:24:21 +0530 | [diff] [blame] | 788 | |
Kanchanapally, Vidyullatha | ced2f42 | 2014-02-04 20:45:38 +0530 | [diff] [blame] | 789 | vos_mem_zero( pReport, |
| 790 | pBcnReport->numBssDesc * sizeof(tSirMacRadioMeasureReport) ); |
Gopichand Nakkala | 72717fd | 2013-02-08 12:23:45 +0530 | [diff] [blame] | 791 | |
Kanchanapally, Vidyullatha | ced2f42 | 2014-02-04 20:45:38 +0530 | [diff] [blame] | 792 | for (bssDescCnt = 0; bssDescCnt < pBcnReport->numBssDesc; bssDescCnt++) |
| 793 | { |
| 794 | //Prepare the beacon report and send it to the peer. |
| 795 | pReport[bssDescCnt].token = pBcnReport->uDialogToken; |
| 796 | pReport[bssDescCnt].refused = 0; |
| 797 | pReport[bssDescCnt].incapable = 0; |
| 798 | pReport[bssDescCnt].type = SIR_MAC_RRM_BEACON_TYPE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 799 | |
Kanchanapally, Vidyullatha | ced2f42 | 2014-02-04 20:45:38 +0530 | [diff] [blame] | 800 | //If the scan result is NULL then send report request with |
| 801 | //option subelement as NULL.. |
| 802 | if ( NULL != pBcnReport->pBssDescription[bssDescCnt] ) |
| 803 | { |
| 804 | flagBSSPresent = TRUE; |
| 805 | } |
| 806 | |
| 807 | //Valid response is included if the size of beacon xmit |
| 808 | //is == size of beacon xmit ind + ies |
| 809 | if ( pBcnReport->length >= sizeof( tSirBeaconReportXmitInd ) ) |
| 810 | { |
| 811 | pReport[bssDescCnt].report.beaconReport.regClass = pBcnReport->regClass; |
| 812 | if ( flagBSSPresent ) |
| 813 | { |
Madan Mohan Koyyalamudi | c6a1d88 | 2013-09-28 22:24:21 +0530 | [diff] [blame] | 814 | pReport[bssDescCnt].report.beaconReport.channel = |
| 815 | pBcnReport->pBssDescription[bssDescCnt]->channelId; |
| 816 | vos_mem_copy( pReport[bssDescCnt].report.beaconReport.measStartTime, |
| 817 | pBcnReport->pBssDescription[bssDescCnt]->startTSF, |
| 818 | sizeof( pBcnReport->pBssDescription[bssDescCnt]->startTSF) ); |
| 819 | pReport[bssDescCnt].report.beaconReport.measDuration = |
| 820 | SYS_MS_TO_TU(pBcnReport->duration); |
| 821 | pReport[bssDescCnt].report.beaconReport.phyType = |
| 822 | pBcnReport->pBssDescription[bssDescCnt]->nwType; |
| 823 | pReport[bssDescCnt].report.beaconReport.bcnProbeRsp = 1; |
| 824 | pReport[bssDescCnt].report.beaconReport.rsni = |
| 825 | pBcnReport->pBssDescription[bssDescCnt]->sinr; |
| 826 | pReport[bssDescCnt].report.beaconReport.rcpi = |
| 827 | pBcnReport->pBssDescription[bssDescCnt]->rssi; |
| 828 | |
| 829 | pReport[bssDescCnt].report.beaconReport.antennaId = 0; |
| 830 | pReport[bssDescCnt].report.beaconReport.parentTSF = |
| 831 | pBcnReport->pBssDescription[bssDescCnt]->parentTSF; |
| 832 | vos_mem_copy( pReport[bssDescCnt].report.beaconReport.bssid, |
| 833 | pBcnReport->pBssDescription[bssDescCnt]->bssId, |
| 834 | sizeof(tSirMacAddr)); |
Kanchanapally, Vidyullatha | ced2f42 | 2014-02-04 20:45:38 +0530 | [diff] [blame] | 835 | } |
Madan Mohan Koyyalamudi | c6a1d88 | 2013-09-28 22:24:21 +0530 | [diff] [blame] | 836 | |
Kanchanapally, Vidyullatha | ced2f42 | 2014-02-04 20:45:38 +0530 | [diff] [blame] | 837 | switch ( pCurrentReq->request.Beacon.reportingDetail ) |
| 838 | { |
Madan Mohan Koyyalamudi | c6a1d88 | 2013-09-28 22:24:21 +0530 | [diff] [blame] | 839 | case BEACON_REPORTING_DETAIL_NO_FF_IE: |
| 840 | //0 No need to include any elements. |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 841 | limLog(pMac, LOG3, "No reporting detail requested"); |
Madan Mohan Koyyalamudi | c6a1d88 | 2013-09-28 22:24:21 +0530 | [diff] [blame] | 842 | break; |
| 843 | case BEACON_REPORTING_DETAIL_ALL_FF_REQ_IE: |
| 844 | //1: Include all FFs and Requested Ies. |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 845 | limLog(pMac, LOG3, |
| 846 | "Only requested IEs in reporting detail requested"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 847 | |
Madan Mohan Koyyalamudi | c6a1d88 | 2013-09-28 22:24:21 +0530 | [diff] [blame] | 848 | if ( flagBSSPresent ) |
| 849 | { |
| 850 | rrmFillBeaconIes( pMac, |
| 851 | (tANI_U8*) &pReport[bssDescCnt].report.beaconReport.Ies[0], |
| 852 | (tANI_U8*) &pReport[bssDescCnt].report.beaconReport.numIes, |
| 853 | BEACON_REPORT_MAX_IES, |
| 854 | pCurrentReq->request.Beacon.reqIes.pElementIds, |
| 855 | pCurrentReq->request.Beacon.reqIes.num, |
| 856 | pBcnReport->pBssDescription[bssDescCnt] ); |
| 857 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 858 | |
Madan Mohan Koyyalamudi | c6a1d88 | 2013-09-28 22:24:21 +0530 | [diff] [blame] | 859 | break; |
| 860 | case BEACON_REPORTING_DETAIL_ALL_FF_IE: |
| 861 | //2 / default - Include all FFs and all Ies. |
| 862 | default: |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 863 | limLog(pMac, LOG3, "Default all IEs and FFs"); |
Madan Mohan Koyyalamudi | c6a1d88 | 2013-09-28 22:24:21 +0530 | [diff] [blame] | 864 | if ( flagBSSPresent ) |
| 865 | { |
| 866 | rrmFillBeaconIes( pMac, |
| 867 | (tANI_U8*) &pReport[bssDescCnt].report.beaconReport.Ies[0], |
| 868 | (tANI_U8*) &pReport[bssDescCnt].report.beaconReport.numIes, |
| 869 | BEACON_REPORT_MAX_IES, |
Gopichand Nakkala | 72717fd | 2013-02-08 12:23:45 +0530 | [diff] [blame] | 870 | NULL, 0, |
Madan Mohan Koyyalamudi | c6a1d88 | 2013-09-28 22:24:21 +0530 | [diff] [blame] | 871 | pBcnReport->pBssDescription[bssDescCnt] ); |
| 872 | } |
| 873 | break; |
Kanchanapally, Vidyullatha | ced2f42 | 2014-02-04 20:45:38 +0530 | [diff] [blame] | 874 | } |
| 875 | } |
| 876 | } |
| 877 | |
| 878 | limLog( pMac, LOG1, "Sending Action frame with %d bss info", bssDescCnt); |
| 879 | limSendRadioMeasureReportActionFrame( pMac, |
| 880 | pCurrentReq->dialog_token, |
| 881 | bssDescCnt, |
| 882 | pReport, |
| 883 | pBcnReport->bssId, |
| 884 | pSessionEntry ); |
| 885 | |
| 886 | pCurrentReq->sendEmptyBcnRpt = false; |
Madan Mohan Koyyalamudi | c6a1d88 | 2013-09-28 22:24:21 +0530 | [diff] [blame] | 887 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 888 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 889 | if( pBcnReport->fMeasureDone ) |
| 890 | { |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 891 | limLog( pMac, LOG3, "Measurement done....cleanup the context"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 892 | |
| 893 | rrmCleanup(pMac); |
| 894 | } |
Madan Mohan Koyyalamudi | c6a1d88 | 2013-09-28 22:24:21 +0530 | [diff] [blame] | 895 | |
Kanchanapally, Vidyullatha | ced2f42 | 2014-02-04 20:45:38 +0530 | [diff] [blame] | 896 | if( NULL != pReport ) |
| 897 | vos_mem_free(pReport); |
Madan Mohan Koyyalamudi | c6a1d88 | 2013-09-28 22:24:21 +0530 | [diff] [blame] | 898 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 899 | return status; |
| 900 | } |
| 901 | |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 902 | void rrmProcessBeaconRequestFailure(tpAniSirGlobal pMac, tpPESession pSessionEntry, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 903 | tSirMacAddr peer, tRrmRetStatus status) |
| 904 | { |
| 905 | tpSirMacRadioMeasureReport pReport = NULL; |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 906 | tpRRMReq pCurrentReq = pMac->rrm.rrmPEContext.pCurrentReq; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 907 | |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 908 | pReport = vos_mem_malloc(sizeof( tSirMacRadioMeasureReport )); |
| 909 | if ( NULL == pReport ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 910 | { |
| 911 | limLog( pMac, LOGP, |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 912 | FL( "Unable to allocate memory during RRM Req processing" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 913 | return; |
| 914 | } |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 915 | vos_mem_set(pReport, sizeof(tSirMacRadioMeasureReport), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 916 | pReport->token = pCurrentReq->token; |
| 917 | pReport->type = SIR_MAC_RRM_BEACON_TYPE; |
| 918 | |
| 919 | switch (status) |
| 920 | { |
| 921 | case eRRM_REFUSED: |
| 922 | pReport->refused = 1; |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 923 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 924 | case eRRM_INCAPABLE: |
| 925 | pReport->incapable = 1; |
| 926 | break; |
| 927 | default: |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 928 | PELOGE(limLog( pMac, LOGE, |
| 929 | FL(" Beacon request processing failed no report sent with status %d "), |
| 930 | status);); |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 931 | vos_mem_free(pReport); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 932 | return; |
| 933 | } |
| 934 | |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 935 | limSendRadioMeasureReportActionFrame( pMac, pCurrentReq->dialog_token, 1, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 936 | pReport, peer, pSessionEntry ); |
| 937 | |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 938 | vos_mem_free(pReport); |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 939 | limLog( pMac, LOG3, FL(" Free memory for pReport") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 940 | return; |
| 941 | } |
| 942 | |
| 943 | // -------------------------------------------------------------------- |
| 944 | /** |
| 945 | * rrmProcessRadioMeasurementRequest |
| 946 | * |
| 947 | * FUNCTION: Processes the Radio Resource Measurement request. |
| 948 | * |
| 949 | * LOGIC: |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 950 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 951 | |
| 952 | * |
| 953 | * ASSUMPTIONS: |
| 954 | * |
| 955 | * NOTE: |
| 956 | * |
| 957 | * @param peer Macaddress of the peer requesting the radio measurement. |
| 958 | * @param pRRMReq Array of Measurement request IEs |
| 959 | * @param pSessionEntry session entry. |
| 960 | * @return None |
| 961 | */ |
| 962 | tSirRetStatus |
Gopichand Nakkala | 72717fd | 2013-02-08 12:23:45 +0530 | [diff] [blame] | 963 | rrmProcessRadioMeasurementRequest( tpAniSirGlobal pMac, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 964 | tSirMacAddr peer, |
| 965 | tDot11fRadioMeasurementRequest *pRRMReq, |
| 966 | tpPESession pSessionEntry ) |
| 967 | { |
| 968 | tANI_U8 i; |
| 969 | tSirRetStatus status = eSIR_SUCCESS; |
| 970 | tpSirMacRadioMeasureReport pReport = NULL; |
| 971 | tANI_U8 num_report = 0; |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 972 | tpRRMReq pCurrentReq = pMac->rrm.rrmPEContext.pCurrentReq; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 973 | tRrmRetStatus rrmStatus = eRRM_SUCCESS; |
| 974 | |
| 975 | if( !pRRMReq->num_MeasurementRequest ) |
| 976 | { |
| 977 | //No measurement requests.... |
| 978 | // |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 979 | pReport = vos_mem_malloc(sizeof( tSirMacRadioMeasureReport )); |
| 980 | if ( NULL == pReport ) |
Gopichand Nakkala | 72717fd | 2013-02-08 12:23:45 +0530 | [diff] [blame] | 981 | { |
| 982 | limLog( pMac, LOGP, |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 983 | FL( "Unable to allocate memory during RRM Req processing" )); |
Gopichand Nakkala | 72717fd | 2013-02-08 12:23:45 +0530 | [diff] [blame] | 984 | return eSIR_MEM_ALLOC_FAILED; |
| 985 | } |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 986 | vos_mem_set(pReport, sizeof(tSirMacRadioMeasureReport),0); |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 987 | PELOGE(limLog( pMac, LOGE, |
| 988 | FL("No requestIes in the measurement request, sending incapable report"));) |
Gopichand Nakkala | 72717fd | 2013-02-08 12:23:45 +0530 | [diff] [blame] | 989 | pReport->incapable = 1; |
| 990 | num_report = 1; |
| 991 | limSendRadioMeasureReportActionFrame( pMac, pRRMReq->DialogToken.token, num_report, |
| 992 | pReport, peer, pSessionEntry ); |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 993 | vos_mem_free(pReport); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 994 | return eSIR_FAILURE; |
| 995 | } |
| 996 | |
| 997 | // PF Fix |
| 998 | if( pRRMReq->NumOfRepetitions.repetitions > 0 ) |
| 999 | { |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 1000 | limLog( pMac, LOG1, |
| 1001 | FL(" number of repetitions %d"), |
| 1002 | pRRMReq->NumOfRepetitions.repetitions ); |
| 1003 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1004 | //Send a report with incapable bit set. Not supporting repetitions. |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1005 | pReport = vos_mem_malloc(sizeof( tSirMacRadioMeasureReport )); |
| 1006 | if ( NULL == pReport ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1007 | { |
| 1008 | limLog( pMac, LOGP, |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1009 | FL( "Unable to allocate memory during RRM Req processing" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1010 | return eSIR_MEM_ALLOC_FAILED; |
| 1011 | } |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1012 | vos_mem_set(pReport, sizeof(tSirMacRadioMeasureReport), 0); |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 1013 | PELOGE(limLog( pMac, LOGE, FL(" Allocated memory for pReport") );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1014 | pReport->incapable = 1; |
| 1015 | pReport->type = pRRMReq->MeasurementRequest[0].measurement_type; |
| 1016 | num_report = 1; |
| 1017 | goto end; |
| 1018 | |
| 1019 | } |
| 1020 | |
| 1021 | for( i= 0; i < pRRMReq->num_MeasurementRequest; i++ ) |
| 1022 | { |
| 1023 | switch( pRRMReq->MeasurementRequest[i].measurement_type ) |
| 1024 | { |
| 1025 | case SIR_MAC_RRM_BEACON_TYPE: |
| 1026 | //Process beacon request. |
| 1027 | if( pCurrentReq ) |
| 1028 | { |
| 1029 | if ( pReport == NULL ) //Allocate memory to send reports for any subsequent requests. |
| 1030 | { |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1031 | pReport = vos_mem_malloc(sizeof( tSirMacRadioMeasureReport ) |
| 1032 | * (pRRMReq->num_MeasurementRequest - i)); |
| 1033 | if ( NULL == pReport ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1034 | { |
| 1035 | limLog( pMac, LOGP, |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1036 | FL( "Unable to allocate memory during RRM Req processing" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1037 | return eSIR_MEM_ALLOC_FAILED; |
| 1038 | } |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1039 | vos_mem_set(pReport, |
| 1040 | sizeof( tSirMacRadioMeasureReport ) |
| 1041 | * (pRRMReq->num_MeasurementRequest - i), |
| 1042 | 0); |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 1043 | limLog( pMac, LOG3, |
| 1044 | FL(" rrm beacon type refused of %d report in beacon table"), |
| 1045 | num_report ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1046 | |
| 1047 | } |
| 1048 | pReport[num_report].refused = 1; |
| 1049 | pReport[num_report].type = SIR_MAC_RRM_BEACON_TYPE; |
| 1050 | pReport[num_report].token = pRRMReq->MeasurementRequest[i].measurement_token; |
| 1051 | num_report++; |
| 1052 | continue; |
| 1053 | } |
| 1054 | else |
| 1055 | { |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1056 | pCurrentReq = vos_mem_malloc(sizeof( *pCurrentReq )); |
| 1057 | if ( NULL == pCurrentReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1058 | { |
| 1059 | limLog( pMac, LOGP, |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1060 | FL( "Unable to allocate memory during RRM Req processing" )); |
| 1061 | vos_mem_free(pReport); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1062 | return eSIR_MEM_ALLOC_FAILED; |
| 1063 | } |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 1064 | limLog( pMac, LOG3, FL(" Processing Beacon Report request") ); |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1065 | vos_mem_set(pCurrentReq, sizeof( *pCurrentReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1066 | pCurrentReq->dialog_token = pRRMReq->DialogToken.token; |
| 1067 | pCurrentReq->token = pRRMReq->MeasurementRequest[i].measurement_token; |
Kanchanapally, Vidyullatha | ced2f42 | 2014-02-04 20:45:38 +0530 | [diff] [blame] | 1068 | pCurrentReq->sendEmptyBcnRpt = true; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1069 | pMac->rrm.rrmPEContext.pCurrentReq = pCurrentReq; |
| 1070 | rrmStatus = rrmProcessBeaconReportReq( pMac, pCurrentReq, &pRRMReq->MeasurementRequest[i], pSessionEntry ); |
| 1071 | if (eRRM_SUCCESS != rrmStatus) |
| 1072 | { |
| 1073 | rrmProcessBeaconRequestFailure(pMac, pSessionEntry, peer, rrmStatus); |
| 1074 | rrmCleanup(pMac); |
| 1075 | } |
| 1076 | } |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 1077 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1078 | default: |
| 1079 | //Send a report with incapabale bit set. |
| 1080 | if ( pReport == NULL ) //Allocate memory to send reports for any subsequent requests. |
| 1081 | { |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1082 | pReport = vos_mem_malloc(sizeof( tSirMacRadioMeasureReport ) |
| 1083 | * (pRRMReq->num_MeasurementRequest - i)); |
| 1084 | if ( NULL == pReport ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1085 | { |
| 1086 | limLog( pMac, LOGP, |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1087 | FL( "Unable to allocate memory during RRM Req processing" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1088 | return eSIR_MEM_ALLOC_FAILED; |
| 1089 | } |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1090 | vos_mem_set(pReport, |
| 1091 | sizeof( tSirMacRadioMeasureReport ) |
| 1092 | * (pRRMReq->num_MeasurementRequest - i), |
| 1093 | 0); |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 1094 | limLog( pMac, LOG3, |
| 1095 | FL(" rrm beacon type incapble of %d report "), |
| 1096 | num_report ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1097 | } |
| 1098 | pReport[num_report].incapable = 1; |
| 1099 | pReport[num_report].type = pRRMReq->MeasurementRequest[i].measurement_type; |
| 1100 | pReport[num_report].token = pRRMReq->MeasurementRequest[i].measurement_token; |
| 1101 | num_report++; |
| 1102 | break; |
| 1103 | } |
| 1104 | } |
| 1105 | |
| 1106 | end: |
| 1107 | if( pReport ) |
| 1108 | { |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 1109 | limSendRadioMeasureReportActionFrame( pMac, pRRMReq->DialogToken.token, num_report, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1110 | pReport, peer, pSessionEntry ); |
| 1111 | |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1112 | vos_mem_free(pReport); |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 1113 | limLog( pMac, LOG3, FL(" Free memory for pReport") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1114 | } |
| 1115 | return status; |
| 1116 | |
| 1117 | } |
| 1118 | |
| 1119 | // -------------------------------------------------------------------- |
| 1120 | /** |
| 1121 | * rrmUpdateStartTSF |
| 1122 | ** |
| 1123 | * FUNCTION: Store start TSF of measurement. |
| 1124 | * |
| 1125 | * LOGIC: |
| 1126 | * |
| 1127 | * ASSUMPTIONS: |
| 1128 | * |
| 1129 | * NOTE: |
| 1130 | * |
| 1131 | * @param startTSF - TSF value at the start of measurement. |
| 1132 | * @return None |
| 1133 | */ |
| 1134 | void |
| 1135 | rrmUpdateStartTSF ( tpAniSirGlobal pMac, tANI_U32 startTSF[2] ) |
| 1136 | { |
| 1137 | #if 0 //defined WLAN_VOWIFI_DEBUG |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 1138 | limLog( pMac, LOGE, "Update Start TSF = %d %d", startTSF[0], startTSF[1] ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1139 | #endif |
| 1140 | pMac->rrm.rrmPEContext.startTSF[0] = startTSF[0]; |
| 1141 | pMac->rrm.rrmPEContext.startTSF[1] = startTSF[1]; |
| 1142 | } |
| 1143 | |
| 1144 | // -------------------------------------------------------------------- |
| 1145 | /** |
| 1146 | * rrmGetStartTSF |
| 1147 | * |
| 1148 | * FUNCTION: Get the Start TSF. |
| 1149 | * |
| 1150 | * LOGIC: |
| 1151 | * |
| 1152 | * ASSUMPTIONS: |
| 1153 | * |
| 1154 | * NOTE: |
| 1155 | * |
| 1156 | * @param startTSF - store star TSF in this buffer. |
| 1157 | * @return txPower |
| 1158 | */ |
| 1159 | void |
| 1160 | rrmGetStartTSF ( tpAniSirGlobal pMac, tANI_U32 *pStartTSF ) |
| 1161 | { |
| 1162 | #if 0 //defined WLAN_VOWIFI_DEBUG |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 1163 | 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] | 1164 | #endif |
| 1165 | pStartTSF[0] = pMac->rrm.rrmPEContext.startTSF[0]; |
| 1166 | pStartTSF[1] = pMac->rrm.rrmPEContext.startTSF[1]; |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 1167 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1168 | } |
| 1169 | // -------------------------------------------------------------------- |
| 1170 | /** |
| 1171 | * rrmGetCapabilities |
| 1172 | * |
| 1173 | * FUNCTION: |
| 1174 | * Returns a pointer to tpRRMCaps with all the caps enabled in RRM |
| 1175 | * |
| 1176 | * LOGIC: |
| 1177 | * |
| 1178 | * ASSUMPTIONS: |
| 1179 | * |
| 1180 | * NOTE: |
| 1181 | * |
| 1182 | * @param pSessionEntry |
| 1183 | * @return pointer to tRRMCaps |
| 1184 | */ |
| 1185 | tpRRMCaps rrmGetCapabilities ( tpAniSirGlobal pMac, |
| 1186 | tpPESession pSessionEntry ) |
| 1187 | { |
| 1188 | return &pMac->rrm.rrmPEContext.rrmEnabledCaps; |
| 1189 | } |
| 1190 | |
| 1191 | // -------------------------------------------------------------------- |
| 1192 | /** |
| 1193 | * rrmUpdateConfig |
| 1194 | * |
| 1195 | * FUNCTION: |
| 1196 | * Update the configuration. This is called from limUpdateConfig. |
| 1197 | * |
| 1198 | * LOGIC: |
| 1199 | * |
| 1200 | * ASSUMPTIONS: |
| 1201 | * |
| 1202 | * NOTE: |
| 1203 | * |
| 1204 | * @param pSessionEntry |
| 1205 | * @return pointer to tRRMCaps |
| 1206 | */ |
| 1207 | void rrmUpdateConfig ( tpAniSirGlobal pMac, |
| 1208 | tpPESession pSessionEntry ) |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 1209 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1210 | tANI_U32 val; |
| 1211 | tpRRMCaps pRRMCaps = &pMac->rrm.rrmPEContext.rrmEnabledCaps; |
| 1212 | |
| 1213 | if (wlan_cfgGetInt(pMac, WNI_CFG_RRM_ENABLED, &val) != eSIR_SUCCESS) |
| 1214 | { |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 1215 | limLog(pMac, LOGP, FL("cfg get rrm enabled failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1216 | return; |
| 1217 | } |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 1218 | pMac->rrm.rrmPEContext.rrmEnable = (val) ? 1 : 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1219 | |
| 1220 | if (wlan_cfgGetInt(pMac, WNI_CFG_RRM_OPERATING_CHAN_MAX, &val) != eSIR_SUCCESS) |
| 1221 | { |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 1222 | 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] | 1223 | return; |
| 1224 | } |
| 1225 | pRRMCaps->operatingChanMax = (tANI_U8)val; |
| 1226 | |
| 1227 | if (wlan_cfgGetInt(pMac, WNI_CFG_RRM_NON_OPERATING_CHAN_MAX, &val) != eSIR_SUCCESS) |
| 1228 | { |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 1229 | 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] | 1230 | return; |
| 1231 | } |
| 1232 | pRRMCaps->nonOperatingChanMax =(tANI_U8) val; |
| 1233 | |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 1234 | limLog( pMac, LOG1, |
| 1235 | "RRM enabled = %d OperatingChanMax = %d NonOperatingMax = %d", |
| 1236 | pMac->rrm.rrmPEContext.rrmEnable, |
| 1237 | pRRMCaps->operatingChanMax, pRRMCaps->nonOperatingChanMax ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1238 | } |
| 1239 | // -------------------------------------------------------------------- |
| 1240 | /** |
| 1241 | * rrmInitialize |
| 1242 | * |
| 1243 | * FUNCTION: |
| 1244 | * Initialize RRM module |
| 1245 | * |
| 1246 | * LOGIC: |
| 1247 | * |
| 1248 | * ASSUMPTIONS: |
| 1249 | * |
| 1250 | * NOTE: |
| 1251 | * |
| 1252 | * @return None |
| 1253 | */ |
| 1254 | |
| 1255 | tSirRetStatus |
| 1256 | rrmInitialize(tpAniSirGlobal pMac) |
| 1257 | { |
| 1258 | tpRRMCaps pRRMCaps = &pMac->rrm.rrmPEContext.rrmEnabledCaps; |
| 1259 | |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 1260 | pMac->rrm.rrmPEContext.pCurrentReq = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1261 | pMac->rrm.rrmPEContext.txMgmtPower = 0; |
| 1262 | pMac->rrm.rrmPEContext.DialogToken = 0; |
| 1263 | |
| 1264 | pMac->rrm.rrmPEContext.rrmEnable = 0; |
| 1265 | |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1266 | vos_mem_set(pRRMCaps, sizeof(tRRMCaps), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1267 | pRRMCaps->LinkMeasurement = 1; |
| 1268 | pRRMCaps->NeighborRpt = 1; |
| 1269 | pRRMCaps->BeaconPassive = 1; |
| 1270 | pRRMCaps->BeaconActive = 1; |
| 1271 | pRRMCaps->BeaconTable = 1; |
| 1272 | pRRMCaps->APChanReport = 1; |
| 1273 | |
| 1274 | //pRRMCaps->TCMCapability = 1; |
| 1275 | //pRRMCaps->triggeredTCM = 1; |
| 1276 | pRRMCaps->operatingChanMax = 3; |
| 1277 | pRRMCaps->nonOperatingChanMax = 3; |
| 1278 | |
| 1279 | return eSIR_SUCCESS; |
| 1280 | } |
| 1281 | |
| 1282 | // -------------------------------------------------------------------- |
| 1283 | /** |
| 1284 | * rrmCleanup |
| 1285 | * |
| 1286 | * FUNCTION: |
| 1287 | * cleanup RRM module |
| 1288 | * |
| 1289 | * LOGIC: |
| 1290 | * |
| 1291 | * ASSUMPTIONS: |
| 1292 | * |
| 1293 | * NOTE: |
| 1294 | * |
| 1295 | * @param mode |
| 1296 | * @param rate |
| 1297 | * @return None |
| 1298 | */ |
| 1299 | |
| 1300 | tSirRetStatus |
| 1301 | rrmCleanup(tpAniSirGlobal pMac) |
| 1302 | { |
| 1303 | if( pMac->rrm.rrmPEContext.pCurrentReq ) |
| 1304 | { |
| 1305 | if( pMac->rrm.rrmPEContext.pCurrentReq->request.Beacon.reqIes.pElementIds ) |
| 1306 | { |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1307 | vos_mem_free(pMac->rrm.rrmPEContext.pCurrentReq->request.Beacon.reqIes.pElementIds); |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 1308 | limLog( pMac, LOG4, FL(" Free memory for pElementIds") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1309 | } |
| 1310 | |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1311 | vos_mem_free(pMac->rrm.rrmPEContext.pCurrentReq); |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 1312 | limLog( pMac, LOG4, FL(" Free memory for pCurrentReq") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1313 | } |
| 1314 | |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 1315 | pMac->rrm.rrmPEContext.pCurrentReq = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1316 | return eSIR_SUCCESS; |
| 1317 | } |
| 1318 | |
| 1319 | // -------------------------------------------------------------------- |
| 1320 | /** |
| 1321 | * rrmProcessMessage |
| 1322 | * |
| 1323 | * FUNCTION: Processes the next received Radio Resource Management message |
| 1324 | * |
| 1325 | * LOGIC: |
| 1326 | * |
| 1327 | * ASSUMPTIONS: |
| 1328 | * |
| 1329 | * NOTE: |
| 1330 | * |
| 1331 | * @param None |
| 1332 | * @return None |
| 1333 | */ |
| 1334 | |
| 1335 | void rrmProcessMessage(tpAniSirGlobal pMac, tpSirMsgQ pMsg) |
| 1336 | { |
| 1337 | switch (pMsg->type) |
| 1338 | { |
| 1339 | case eWNI_SME_NEIGHBOR_REPORT_REQ_IND: |
| 1340 | rrmProcessNeighborReportReq( pMac, pMsg->bodyptr ); |
| 1341 | break; |
| 1342 | case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND: |
| 1343 | rrmProcessBeaconReportXmit( pMac, pMsg->bodyptr ); |
| 1344 | break; |
| 1345 | } |
| 1346 | |
| 1347 | } |
| 1348 | |
| 1349 | #endif |