Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 2 | * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved. |
| 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" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 48 | #include "wniCfgSta.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 ); |
Madan Mohan Koyyalamudi | ba0a3f4 | 2013-08-13 20:37:34 +0530 | [diff] [blame] | 285 | if( (uint8)(pSessionEntry->maxTxPower) != pLinkReq->MaxTxPower.maxTxPower ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 286 | { |
Madan Mohan Koyyalamudi | ba0a3f4 | 2013-08-13 20:37:34 +0530 | [diff] [blame] | 287 | PELOGW(limLog( pMac, |
| 288 | LOGW, |
Madan Mohan Koyyalamudi | ab675df | 2013-07-24 02:57:41 +0530 | [diff] [blame] | 289 | FL(" maxTx power in link request is not same as local... " |
| 290 | " Local = %d LinkReq = %d"), |
| 291 | pSessionEntry->maxTxPower, |
| 292 | pLinkReq->MaxTxPower.maxTxPower );) |
Madan Mohan Koyyalamudi | ba0a3f4 | 2013-08-13 20:37:34 +0530 | [diff] [blame] | 293 | if( (MIN_STA_PWR_CAP_DBM <= pLinkReq->MaxTxPower.maxTxPower) && |
| 294 | (MAX_STA_PWR_CAP_DBM >= pLinkReq->MaxTxPower.maxTxPower) ) |
| 295 | { |
| 296 | LinkReport.txPower = pLinkReq->MaxTxPower.maxTxPower; |
| 297 | } |
| 298 | else if( MIN_STA_PWR_CAP_DBM > pLinkReq->MaxTxPower.maxTxPower ) |
| 299 | { |
| 300 | LinkReport.txPower = MIN_STA_PWR_CAP_DBM; |
| 301 | } |
| 302 | else if( MAX_STA_PWR_CAP_DBM < pLinkReq->MaxTxPower.maxTxPower ) |
| 303 | { |
| 304 | LinkReport.txPower = MAX_STA_PWR_CAP_DBM; |
| 305 | } |
Madan Mohan Koyyalamudi | ab675df | 2013-07-24 02:57:41 +0530 | [diff] [blame] | 306 | |
Madan Mohan Koyyalamudi | ba0a3f4 | 2013-08-13 20:37:34 +0530 | [diff] [blame] | 307 | if( (LinkReport.txPower != (uint8)(pSessionEntry->maxTxPower)) && |
Madan Mohan Koyyalamudi | ab675df | 2013-07-24 02:57:41 +0530 | [diff] [blame] | 308 | (eSIR_SUCCESS == rrmSendSetMaxTxPowerReq ( pMac, |
Madan Mohan Koyyalamudi | ba0a3f4 | 2013-08-13 20:37:34 +0530 | [diff] [blame] | 309 | (tPowerdBm)(LinkReport.txPower), |
Madan Mohan Koyyalamudi | ab675df | 2013-07-24 02:57:41 +0530 | [diff] [blame] | 310 | pSessionEntry)) ) |
| 311 | { |
Madan Mohan Koyyalamudi | ba0a3f4 | 2013-08-13 20:37:34 +0530 | [diff] [blame] | 312 | pSessionEntry->maxTxPower = (tPowerdBm)(LinkReport.txPower); |
Madan Mohan Koyyalamudi | ab675df | 2013-07-24 02:57:41 +0530 | [diff] [blame] | 313 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 314 | } |
Madan Mohan Koyyalamudi | ba0a3f4 | 2013-08-13 20:37:34 +0530 | [diff] [blame] | 315 | else |
| 316 | { |
| 317 | if( (MIN_STA_PWR_CAP_DBM <= (uint8)(pSessionEntry->maxTxPower)) && |
| 318 | (MAX_STA_PWR_CAP_DBM >= (uint8)(pSessionEntry->maxTxPower)) ) |
| 319 | { |
| 320 | LinkReport.txPower = (uint8)(pSessionEntry->maxTxPower); |
| 321 | } |
| 322 | else if( MIN_STA_PWR_CAP_DBM > (uint8)(pSessionEntry->maxTxPower) ) |
| 323 | { |
| 324 | LinkReport.txPower = MIN_STA_PWR_CAP_DBM; |
| 325 | } |
| 326 | else if( MAX_STA_PWR_CAP_DBM < (uint8)(pSessionEntry->maxTxPower) ) |
| 327 | { |
| 328 | LinkReport.txPower = MAX_STA_PWR_CAP_DBM; |
| 329 | } |
| 330 | } |
| 331 | PELOGW(limLog( pMac, |
| 332 | LOGW, |
| 333 | FL(" maxTx power in link request is not same as local... " |
| 334 | " Local = %d Link Report TxPower = %d"), |
| 335 | pSessionEntry->maxTxPower, |
| 336 | LinkReport.txPower );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 337 | |
| 338 | LinkReport.dialogToken = pLinkReq->DialogToken.token; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 339 | LinkReport.rxAntenna = 0; |
| 340 | LinkReport.txAntenna = 0; |
| 341 | currentRSSI = WDA_GET_RX_RSSI_DB(pRxPacketInfo); |
| 342 | |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 343 | limLog( pMac, LOG1, |
| 344 | "Received Link report frame with %d", currentRSSI); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 345 | |
| 346 | // 2008 11k spec reference: 18.4.8.5 RCPI Measurement |
| 347 | if ((currentRSSI) <= RCPI_LOW_RSSI_VALUE) |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 348 | LinkReport.rcpi = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 349 | else if ((currentRSSI > RCPI_LOW_RSSI_VALUE) && (currentRSSI <= 0)) |
| 350 | LinkReport.rcpi = CALCULATE_RCPI(currentRSSI); |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 351 | else |
| 352 | LinkReport.rcpi = RCPI_MAX_VALUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 353 | |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 354 | LinkReport.rsni = WDA_GET_RX_SNR(pRxPacketInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 355 | |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 356 | limLog( pMac, LOG3, "Sending Link report frame"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 357 | |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 358 | return limSendLinkReportActionFrame( pMac, &LinkReport, pHdr->sa, pSessionEntry ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 359 | } |
| 360 | |
| 361 | // -------------------------------------------------------------------- |
| 362 | /** |
| 363 | * rrmProcessNeighborReportResponse |
| 364 | * |
| 365 | * FUNCTION: Processes the Neighbor Report response from the peer AP. |
| 366 | * |
| 367 | * LOGIC: |
| 368 | * |
| 369 | * ASSUMPTIONS: |
| 370 | * |
| 371 | * NOTE: |
| 372 | * |
| 373 | * @param pNeighborRep pointer to the Neighbor report frame structure. |
| 374 | * @param pSessionEntry session entry. |
| 375 | * @return None |
| 376 | */ |
| 377 | tSirRetStatus |
| 378 | rrmProcessNeighborReportResponse( tpAniSirGlobal pMac, |
| 379 | tDot11fNeighborReportResponse *pNeighborRep, |
| 380 | tpPESession pSessionEntry ) |
| 381 | { |
| 382 | tSirRetStatus status = eSIR_FAILURE; |
| 383 | tpSirNeighborReportInd pSmeNeighborRpt = NULL; |
| 384 | tANI_U16 length; |
| 385 | tANI_U8 i; |
| 386 | tSirMsgQ mmhMsg; |
| 387 | |
| 388 | if( pNeighborRep == NULL || pSessionEntry == NULL ) |
| 389 | { |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 390 | PELOGE(limLog( pMac, LOGE, FL(" Invalid parameters") );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 391 | return status; |
| 392 | } |
| 393 | |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 394 | limLog( pMac, LOG3, FL("Neighbor report response received ") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 395 | |
| 396 | // Dialog token |
| 397 | if( pMac->rrm.rrmPEContext.DialogToken != pNeighborRep->DialogToken.token ) |
| 398 | { |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 399 | PELOGE(limLog( pMac, LOGE, |
| 400 | "Dialog token mismatch in the received Neighbor report");) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 401 | return eSIR_FAILURE; |
| 402 | } |
| 403 | if( pNeighborRep->num_NeighborReport == 0 ) |
| 404 | { |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 405 | PELOGE(limLog( pMac, LOGE, "No neighbor report in the frame...Dropping it");) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 406 | return eSIR_FAILURE; |
| 407 | } |
| 408 | length = (sizeof( tSirNeighborReportInd )) + |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 409 | (sizeof( tSirNeighborBssDescription ) * (pNeighborRep->num_NeighborReport - 1) ) ; |
| 410 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 411 | //Prepare the request to send to SME. |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 412 | pSmeNeighborRpt = vos_mem_malloc(length); |
| 413 | if( NULL == pSmeNeighborRpt ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 414 | { |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 415 | PELOGE(limLog( pMac, LOGP, FL("Unable to allocate memory") );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 416 | return eSIR_MEM_ALLOC_FAILED; |
| 417 | |
| 418 | } |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 419 | vos_mem_set(pSmeNeighborRpt, length, 0); |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 420 | |
| 421 | /* Allocated memory for pSmeNeighborRpt...will be freed by other module */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 422 | |
| 423 | for( i = 0 ; i < pNeighborRep->num_NeighborReport ; i++ ) |
| 424 | { |
| 425 | pSmeNeighborRpt->sNeighborBssDescription[i].length = sizeof( tSirNeighborBssDescription ); /*+ any optional ies */ |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 426 | vos_mem_copy(pSmeNeighborRpt->sNeighborBssDescription[i].bssId, |
| 427 | pNeighborRep->NeighborReport[i].bssid, |
| 428 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 429 | pSmeNeighborRpt->sNeighborBssDescription[i].bssidInfo.rrmInfo.fApPreauthReachable = pNeighborRep->NeighborReport[i].APReachability; |
| 430 | pSmeNeighborRpt->sNeighborBssDescription[i].bssidInfo.rrmInfo.fSameSecurityMode = pNeighborRep->NeighborReport[i].Security; |
| 431 | pSmeNeighborRpt->sNeighborBssDescription[i].bssidInfo.rrmInfo.fSameAuthenticator = pNeighborRep->NeighborReport[i].KeyScope; |
| 432 | pSmeNeighborRpt->sNeighborBssDescription[i].bssidInfo.rrmInfo.fCapSpectrumMeasurement = pNeighborRep->NeighborReport[i].SpecMgmtCap; |
| 433 | pSmeNeighborRpt->sNeighborBssDescription[i].bssidInfo.rrmInfo.fCapQos = pNeighborRep->NeighborReport[i].QosCap; |
| 434 | pSmeNeighborRpt->sNeighborBssDescription[i].bssidInfo.rrmInfo.fCapApsd = pNeighborRep->NeighborReport[i].apsd; |
| 435 | pSmeNeighborRpt->sNeighborBssDescription[i].bssidInfo.rrmInfo.fCapRadioMeasurement = pNeighborRep->NeighborReport[i].rrm; |
| 436 | pSmeNeighborRpt->sNeighborBssDescription[i].bssidInfo.rrmInfo.fCapDelayedBlockAck = pNeighborRep->NeighborReport[i].DelayedBA; |
| 437 | pSmeNeighborRpt->sNeighborBssDescription[i].bssidInfo.rrmInfo.fCapImmediateBlockAck = pNeighborRep->NeighborReport[i].ImmBA; |
| 438 | pSmeNeighborRpt->sNeighborBssDescription[i].bssidInfo.rrmInfo.fMobilityDomain = pNeighborRep->NeighborReport[i].MobilityDomain; |
| 439 | |
| 440 | pSmeNeighborRpt->sNeighborBssDescription[i].regClass = pNeighborRep->NeighborReport[i].regulatoryClass; |
| 441 | pSmeNeighborRpt->sNeighborBssDescription[i].channel = pNeighborRep->NeighborReport[i].channel; |
| 442 | pSmeNeighborRpt->sNeighborBssDescription[i].phyType = pNeighborRep->NeighborReport[i].PhyType; |
| 443 | } |
| 444 | |
| 445 | pSmeNeighborRpt->messageType = eWNI_SME_NEIGHBOR_REPORT_IND; |
| 446 | pSmeNeighborRpt->length = length; |
| 447 | pSmeNeighborRpt->numNeighborReports = pNeighborRep->num_NeighborReport; |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 448 | vos_mem_copy(pSmeNeighborRpt->bssId, pSessionEntry->bssId, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 449 | |
| 450 | //Send request to SME. |
| 451 | mmhMsg.type = pSmeNeighborRpt->messageType; |
| 452 | mmhMsg.bodyptr = pSmeNeighborRpt; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 453 | MTRACE(macTraceMsgTx(pMac, pSessionEntry->peSessionId, mmhMsg.type)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 454 | status = limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT); |
| 455 | |
| 456 | return status; |
| 457 | |
| 458 | } |
| 459 | |
| 460 | // -------------------------------------------------------------------- |
| 461 | /** |
| 462 | * rrmProcessNeighborReportReq |
| 463 | * |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 464 | * FUNCTION: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 465 | * |
| 466 | * LOGIC: Create a Neighbor report request and send it to peer. |
| 467 | * |
| 468 | * ASSUMPTIONS: |
| 469 | * |
| 470 | * NOTE: |
| 471 | * |
| 472 | * @param pNeighborReq Neighbor report request params . |
| 473 | * @return None |
| 474 | */ |
| 475 | tSirRetStatus |
| 476 | rrmProcessNeighborReportReq( tpAniSirGlobal pMac, |
| 477 | tpSirNeighborReportReqInd pNeighborReq ) |
| 478 | { |
| 479 | tSirRetStatus status = eSIR_SUCCESS; |
| 480 | tSirMacNeighborReportReq NeighborReportReq; |
| 481 | tpPESession pSessionEntry ; |
| 482 | tANI_U8 sessionId; |
| 483 | |
| 484 | if( pNeighborReq == NULL ) |
| 485 | { |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 486 | PELOGE(limLog( pMac, LOGE, "NeighborReq is NULL" );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 487 | return eSIR_FAILURE; |
| 488 | } |
| 489 | if ((pSessionEntry = peFindSessionByBssid(pMac,pNeighborReq->bssId,&sessionId))==NULL) |
| 490 | { |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 491 | PELOGE(limLog(pMac, LOGE,FL("session does not exist for given bssId"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 492 | return eSIR_FAILURE; |
| 493 | } |
| 494 | |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 495 | limLog( pMac, LOG1, FL("SSID present = %d "), pNeighborReq->noSSID ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 496 | |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 497 | vos_mem_set(&NeighborReportReq,sizeof( tSirMacNeighborReportReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 498 | |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 499 | NeighborReportReq.dialogToken = ++pMac->rrm.rrmPEContext.DialogToken; |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 500 | NeighborReportReq.ssid_present = !pNeighborReq->noSSID; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 501 | if( NeighborReportReq.ssid_present ) |
| 502 | { |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 503 | vos_mem_copy(&NeighborReportReq.ssid, &pNeighborReq->ucSSID, sizeof(tSirMacSSid)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 504 | 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] | 505 | } |
| 506 | |
| 507 | status = limSendNeighborReportRequestFrame( pMac, &NeighborReportReq, pNeighborReq->bssId, pSessionEntry ); |
| 508 | |
| 509 | return status; |
| 510 | } |
| 511 | |
| 512 | #define ABS(x) ((x < 0) ? -x : x) |
| 513 | // -------------------------------------------------------------------- |
| 514 | /** |
| 515 | * rrmProcessBeaconReportReq |
| 516 | * |
| 517 | * FUNCTION: Processes the Beacon report request from the peer AP. |
| 518 | * |
| 519 | * LOGIC: |
| 520 | * |
| 521 | * ASSUMPTIONS: |
| 522 | * |
| 523 | * NOTE: |
| 524 | * |
| 525 | * @param pCurrentReq pointer to the current Req comtext. |
| 526 | * @param pBeaconReq pointer to the beacon report request IE from the peer. |
| 527 | * @param pSessionEntry session entry. |
| 528 | * @return None |
| 529 | */ |
| 530 | static tRrmRetStatus |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 531 | rrmProcessBeaconReportReq( tpAniSirGlobal pMac, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 532 | tpRRMReq pCurrentReq, |
| 533 | tDot11fIEMeasurementRequest *pBeaconReq, |
| 534 | tpPESession pSessionEntry ) |
| 535 | { |
| 536 | tSirMsgQ mmhMsg; |
| 537 | tpSirBeaconReportReqInd pSmeBcnReportReq; |
| 538 | tANI_U8 num_channels = 0, num_APChanReport; |
| 539 | tANI_U16 measDuration, maxMeasduration; |
| 540 | tANI_S8 maxDuration; |
| 541 | tANI_U8 sign; |
Kanchanapally, Vidyullatha | ced2f42 | 2014-02-04 20:45:38 +0530 | [diff] [blame] | 542 | tANI_U16 index; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 543 | |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 544 | if( pBeaconReq->measurement_request.Beacon.BeaconReporting.present && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 545 | (pBeaconReq->measurement_request.Beacon.BeaconReporting.reportingCondition != 0) ) |
| 546 | { |
| 547 | //Repeated measurement is not supported. This means number of repetitions should be zero.(Already checked) |
| 548 | //All test case in VoWifi(as of version 0.36) use zero for number of repetitions. |
| 549 | //Beacon reporting should not be included in request if number of repetitons is zero. |
| 550 | // IEEE Std 802.11k-2008 Table 7-29g and section 11.10.8.1 |
| 551 | |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 552 | 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] | 553 | return eRRM_INCAPABLE; |
| 554 | } |
| 555 | |
| 556 | /* 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] | 557 | 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] | 558 | 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] | 559 | Case 2: If measurement duration received in the beacon request is greater than the max measurement duration advertised |
| 560 | 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] | 561 | the duration advertised in the RRM capabilities |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 562 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 563 | maxMeasurementDuration = 2^(nonOperatingChanMax - 4) * BeaconInterval |
| 564 | */ |
| 565 | maxDuration = pMac->rrm.rrmPEContext.rrmEnabledCaps.nonOperatingChanMax - 4; |
| 566 | sign = (maxDuration < 0) ? 1 : 0; |
| 567 | maxDuration = (1L << ABS(maxDuration)); |
| 568 | if (!sign) |
| 569 | maxMeasduration = maxDuration * pSessionEntry->beaconParams.beaconInterval; |
| 570 | else |
| 571 | maxMeasduration = pSessionEntry->beaconParams.beaconInterval / maxDuration; |
| 572 | |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 573 | measDuration = pBeaconReq->measurement_request.Beacon.meas_duration; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 574 | |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 575 | limLog( pMac, LOG3, |
| 576 | "maxDuration = %d sign = %d maxMeasduration = %d measDuration = %d", |
| 577 | maxDuration, sign, maxMeasduration, measDuration ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 578 | |
| 579 | if( maxMeasduration < measDuration ) |
| 580 | { |
| 581 | if( pBeaconReq->durationMandatory ) |
| 582 | { |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 583 | PELOGE(limLog( pMac, LOGE, "Dropping the request: duration mandatory and maxduration > measduration");) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 584 | return eRRM_REFUSED; |
| 585 | } |
| 586 | else |
| 587 | measDuration = maxMeasduration; |
| 588 | } |
| 589 | |
| 590 | //Cache the data required for sending report. |
| 591 | pCurrentReq->request.Beacon.reportingDetail = pBeaconReq->measurement_request.Beacon.BcnReportingDetail.present ? |
| 592 | pBeaconReq->measurement_request.Beacon.BcnReportingDetail.reportingDetail : |
| 593 | BEACON_REPORTING_DETAIL_ALL_FF_IE ; |
| 594 | |
| 595 | if( pBeaconReq->measurement_request.Beacon.RequestedInfo.present ) |
| 596 | { |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 597 | pCurrentReq->request.Beacon.reqIes.pElementIds = vos_mem_malloc(sizeof(tANI_U8) * |
| 598 | pBeaconReq->measurement_request.Beacon.RequestedInfo.num_requested_eids); |
| 599 | if ( NULL == pCurrentReq->request.Beacon.reqIes.pElementIds ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 600 | { |
| 601 | limLog( pMac, LOGP, |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 602 | FL( "Unable to allocate memory for request IEs buffer" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 603 | return eRRM_FAILURE; |
| 604 | } |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 605 | limLog( pMac, LOG3, FL(" Allocated memory for pElementIds") ); |
| 606 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 607 | 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] | 608 | vos_mem_copy(pCurrentReq->request.Beacon.reqIes.pElementIds, |
| 609 | pBeaconReq->measurement_request.Beacon.RequestedInfo.requested_eids, |
| 610 | pCurrentReq->request.Beacon.reqIes.num); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 611 | } |
| 612 | |
| 613 | if( pBeaconReq->measurement_request.Beacon.num_APChannelReport ) |
| 614 | { |
| 615 | for( num_APChanReport = 0 ; num_APChanReport < pBeaconReq->measurement_request.Beacon.num_APChannelReport ; num_APChanReport++ ) |
| 616 | num_channels += pBeaconReq->measurement_request.Beacon.APChannelReport[num_APChanReport].num_channelList; |
| 617 | } |
| 618 | |
| 619 | //Prepare the request to send to SME. |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 620 | pSmeBcnReportReq = vos_mem_malloc(sizeof( tSirBeaconReportReqInd )); |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 621 | if ( NULL == pSmeBcnReportReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 622 | { |
| 623 | limLog( pMac, LOGP, |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 624 | FL( "Unable to allocate memory during Beacon Report Req Ind to SME" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 625 | |
| 626 | return eRRM_FAILURE; |
| 627 | |
| 628 | } |
| 629 | |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 630 | vos_mem_set(pSmeBcnReportReq,sizeof( tSirBeaconReportReqInd ),0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 631 | |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 632 | /* Allocated memory for pSmeBcnReportReq....will be freed by other modulea*/ |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 633 | vos_mem_copy(pSmeBcnReportReq->bssId, pSessionEntry->bssId, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 634 | pSmeBcnReportReq->messageType = eWNI_SME_BEACON_REPORT_REQ_IND; |
Srinivas Girigowda | 91ccbe8 | 2013-11-10 16:37:38 -0800 | [diff] [blame] | 635 | pSmeBcnReportReq->length = sizeof( tSirBeaconReportReqInd ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 636 | pSmeBcnReportReq->uDialogToken = pBeaconReq->measurement_token; |
Srinivas Girigowda | 6d1f906 | 2014-02-03 18:15:54 -0800 | [diff] [blame] | 637 | pSmeBcnReportReq->msgSource = eRRM_MSG_SOURCE_DRV; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 638 | pSmeBcnReportReq->randomizationInterval = SYS_TU_TO_MS (pBeaconReq->measurement_request.Beacon.randomization); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 639 | pSmeBcnReportReq->channelInfo.regulatoryClass = pBeaconReq->measurement_request.Beacon.regClass; |
| 640 | pSmeBcnReportReq->channelInfo.channelNum = pBeaconReq->measurement_request.Beacon.channel; |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 641 | vos_mem_copy(pSmeBcnReportReq->macaddrBssid, pBeaconReq->measurement_request.Beacon.BSSID, |
| 642 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 643 | |
| 644 | if( pBeaconReq->measurement_request.Beacon.SSID.present ) |
| 645 | { |
| 646 | pSmeBcnReportReq->ssId.length = pBeaconReq->measurement_request.Beacon.SSID.num_ssid; |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 647 | vos_mem_copy(pSmeBcnReportReq->ssId.ssId, |
| 648 | pBeaconReq->measurement_request.Beacon.SSID.ssid, |
| 649 | pSmeBcnReportReq->ssId.length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 650 | } |
| 651 | |
| 652 | pCurrentReq->token = pBeaconReq->measurement_token; |
| 653 | |
| 654 | pSmeBcnReportReq->channelList.numChannels = num_channels; |
| 655 | if( pBeaconReq->measurement_request.Beacon.num_APChannelReport ) |
| 656 | { |
Kanchanapally, Vidyullatha | ced2f42 | 2014-02-04 20:45:38 +0530 | [diff] [blame] | 657 | tANI_U16 index2 = 0; |
| 658 | tANI_U8 *pChanList = pSmeBcnReportReq->channelList.channelNumber; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 659 | for( num_APChanReport = 0 ; num_APChanReport < pBeaconReq->measurement_request.Beacon.num_APChannelReport ; num_APChanReport++ ) |
| 660 | { |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 661 | vos_mem_copy(pChanList, |
| 662 | pBeaconReq->measurement_request.Beacon.APChannelReport[num_APChanReport].channelList, |
| 663 | pBeaconReq->measurement_request.Beacon.APChannelReport[num_APChanReport].num_channelList); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 664 | |
| 665 | pChanList += pBeaconReq->measurement_request.Beacon.APChannelReport[num_APChanReport].num_channelList; |
Kanchanapally, Vidyullatha | ced2f42 | 2014-02-04 20:45:38 +0530 | [diff] [blame] | 666 | for( index = 0; index < (pBeaconReq->measurement_request.Beacon.APChannelReport[num_APChanReport].num_channelList); index++ ) |
| 667 | { |
| 668 | pSmeBcnReportReq->measurementDuration[index2] = SYS_TU_TO_MS(measDuration); |
| 669 | pSmeBcnReportReq->fMeasurementtype[index2++] = pBeaconReq->measurement_request.Beacon.meas_mode; |
| 670 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 671 | } |
| 672 | } |
Kanchanapally, Vidyullatha | e7bce2c | 2014-01-16 12:19:26 +0530 | [diff] [blame] | 673 | else |
| 674 | { |
| 675 | pSmeBcnReportReq->measurementDuration[0] = SYS_TU_TO_MS(measDuration); |
| 676 | pSmeBcnReportReq->fMeasurementtype[0] = pBeaconReq->measurement_request.Beacon.meas_mode; |
| 677 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 678 | |
| 679 | //Send request to SME. |
| 680 | mmhMsg.type = eWNI_SME_BEACON_REPORT_REQ_IND; |
| 681 | mmhMsg.bodyptr = pSmeBcnReportReq; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 682 | MTRACE(macTraceMsgTx(pMac, pSessionEntry->peSessionId, mmhMsg.type)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 683 | return limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT); |
| 684 | } |
| 685 | |
| 686 | // -------------------------------------------------------------------- |
| 687 | /** |
| 688 | * rrmFillBeaconIes |
| 689 | * |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 690 | * FUNCTION: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 691 | * |
| 692 | * LOGIC: Fills Fixed fields and Ies in bss description to an array of tANI_U8. |
| 693 | * |
| 694 | * ASSUMPTIONS: |
| 695 | * |
| 696 | * NOTE: |
| 697 | * |
| 698 | * @param pIes - pointer to the buffer that should be populated with ies. |
| 699 | * @param pNumIes - returns the num of ies filled in this param. |
| 700 | * @param pIesMaxSize - Max size of the buffer pIes. |
| 701 | * @param eids - pointer to array of eids. If NULL, all ies will be populated. |
| 702 | * @param numEids - number of elements in array eids. |
| 703 | * @param pBssDesc - pointer to Bss Description. |
| 704 | * @return None |
| 705 | */ |
| 706 | static void |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 707 | rrmFillBeaconIes( tpAniSirGlobal pMac, |
| 708 | tANI_U8 *pIes, tANI_U8 *pNumIes, tANI_U8 pIesMaxSize, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 709 | tANI_U8 *eids, tANI_U8 numEids, |
| 710 | tpSirBssDescription pBssDesc ) |
| 711 | { |
| 712 | tANI_U8 len, *pBcnIes, BcnNumIes, count = 0, i; |
| 713 | |
| 714 | if( (pIes == NULL) || (pNumIes == NULL) || (pBssDesc == NULL) ) |
| 715 | { |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 716 | PELOGE(limLog( pMac, LOGE, FL(" Invalid parameters") );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 717 | return; |
| 718 | } |
| 719 | |
| 720 | //Make sure that if eid is null, numEids is set to zero. |
| 721 | numEids = (eids == NULL) ? 0 : numEids; |
| 722 | |
| 723 | pBcnIes = (tANI_U8*) &pBssDesc->ieFields[0]; |
| 724 | BcnNumIes = (tANI_U8)GET_IE_LEN_IN_BSS( pBssDesc->length ); |
| 725 | |
| 726 | *pNumIes = 0; |
| 727 | |
| 728 | *((tANI_U32*)pIes) = pBssDesc->timeStamp[0]; |
| 729 | *pNumIes+=sizeof(tANI_U32); pIes+=sizeof(tANI_U32); |
| 730 | *((tANI_U32*)pIes) = pBssDesc->timeStamp[1]; |
| 731 | *pNumIes+=sizeof(tANI_U32); pIes+=sizeof(tANI_U32); |
| 732 | *((tANI_U16*)pIes) = pBssDesc->beaconInterval; |
| 733 | *pNumIes+=sizeof(tANI_U16); pIes+=sizeof(tANI_U16); |
| 734 | *((tANI_U16*)pIes) = pBssDesc->capabilityInfo; |
| 735 | *pNumIes+=sizeof(tANI_U16); pIes+=sizeof(tANI_U16); |
| 736 | |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 737 | while ( BcnNumIes > 0 ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 738 | { |
| 739 | len = *(pBcnIes + 1) + 2; //element id + length. |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 740 | limLog( pMac, LOG3, "EID = %d, len = %d total = %d", |
| 741 | *pBcnIes, *(pBcnIes+1), len ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 742 | |
| 743 | i = 0; |
| 744 | do |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 745 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 746 | if( ( (eids == NULL) || ( *pBcnIes == eids[i] ) ) && |
| 747 | ( (*pNumIes) + len) < pIesMaxSize ) |
| 748 | { |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 749 | limLog( pMac, LOG3, "Adding Eid %d, len=%d", *pBcnIes, len ); |
| 750 | |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 751 | vos_mem_copy(pIes, pBcnIes, len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 752 | pIes += len; |
| 753 | *pNumIes += len; |
| 754 | count++; |
| 755 | break; |
| 756 | } |
| 757 | i++; |
| 758 | }while( i < numEids ); |
| 759 | |
| 760 | pBcnIes += len; |
| 761 | BcnNumIes -= len; |
| 762 | } |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 763 | limLog( pMac, LOG1, "Total length of Ies added = %d", *pNumIes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 764 | } |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 765 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 766 | // -------------------------------------------------------------------- |
| 767 | /** |
| 768 | * rrmProcessBeaconReportXmit |
| 769 | * |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 770 | * FUNCTION: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 771 | * |
| 772 | * LOGIC: Create a Radio measurement report action frame and send it to peer. |
| 773 | * |
| 774 | * ASSUMPTIONS: |
| 775 | * |
| 776 | * NOTE: |
| 777 | * |
| 778 | * @param pBcnReport Data for beacon report IE from SME. |
| 779 | * @return None |
| 780 | */ |
| 781 | tSirRetStatus |
| 782 | rrmProcessBeaconReportXmit( tpAniSirGlobal pMac, |
| 783 | tpSirBeaconReportXmitInd pBcnReport) |
| 784 | { |
| 785 | tSirRetStatus status = eSIR_SUCCESS; |
Kanchanapally, Vidyullatha | ced2f42 | 2014-02-04 20:45:38 +0530 | [diff] [blame] | 786 | tSirMacRadioMeasureReport *pReport = NULL; |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 787 | tpRRMReq pCurrentReq = pMac->rrm.rrmPEContext.pCurrentReq; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 788 | tpPESession pSessionEntry ; |
| 789 | tANI_U8 sessionId; |
Madan Mohan Koyyalamudi | c6a1d88 | 2013-09-28 22:24:21 +0530 | [diff] [blame] | 790 | v_U8_t flagBSSPresent = FALSE, bssDescCnt = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 791 | |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 792 | limLog( pMac, LOG1, "Received beacon report xmit indication"); |
Madan Mohan Koyyalamudi | c6a1d88 | 2013-09-28 22:24:21 +0530 | [diff] [blame] | 793 | |
| 794 | if (NULL == pBcnReport) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 795 | { |
Madan Mohan Koyyalamudi | c6a1d88 | 2013-09-28 22:24:21 +0530 | [diff] [blame] | 796 | PELOGE(limLog( pMac, LOGE, |
| 797 | "Received pBcnReport is NULL in PE");) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 798 | return eSIR_FAILURE; |
| 799 | } |
Madan Mohan Koyyalamudi | c6a1d88 | 2013-09-28 22:24:21 +0530 | [diff] [blame] | 800 | |
| 801 | if (NULL == pCurrentReq) |
| 802 | { |
| 803 | PELOGE(limLog( pMac, LOGE, |
| 804 | "Received report xmit while there is no request pending in PE");) |
| 805 | return eSIR_FAILURE; |
| 806 | } |
| 807 | |
Kanchanapally, Vidyullatha | ced2f42 | 2014-02-04 20:45:38 +0530 | [diff] [blame] | 808 | if( (pBcnReport->numBssDesc) || |
| 809 | (!pBcnReport->numBssDesc && pCurrentReq->sendEmptyBcnRpt) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 810 | { |
Kanchanapally, Vidyullatha | ced2f42 | 2014-02-04 20:45:38 +0530 | [diff] [blame] | 811 | pBcnReport->numBssDesc = (pBcnReport->numBssDesc == RRM_BCN_RPT_NO_BSS_INFO)? |
| 812 | RRM_BCN_RPT_MIN_RPT : pBcnReport->numBssDesc; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 813 | |
Kanchanapally, Vidyullatha | ced2f42 | 2014-02-04 20:45:38 +0530 | [diff] [blame] | 814 | if (NULL == (pSessionEntry = peFindSessionByBssid(pMac, |
| 815 | pBcnReport->bssId, |
| 816 | &sessionId))) |
| 817 | { |
| 818 | PELOGE(limLog(pMac, LOGE, FL("session does not exist for given bssId"));) |
| 819 | return eSIR_FAILURE; |
| 820 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 821 | |
Kanchanapally, Vidyullatha | ced2f42 | 2014-02-04 20:45:38 +0530 | [diff] [blame] | 822 | pReport = vos_mem_malloc(pBcnReport->numBssDesc * |
| 823 | sizeof(tSirMacRadioMeasureReport)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 824 | |
Kanchanapally, Vidyullatha | ced2f42 | 2014-02-04 20:45:38 +0530 | [diff] [blame] | 825 | if (NULL == pReport) |
| 826 | { |
| 827 | PELOGE(limLog(pMac, LOGE, FL("RRM Report is NULL, allocation failed"));) |
| 828 | return eSIR_FAILURE; |
| 829 | } |
Madan Mohan Koyyalamudi | c6a1d88 | 2013-09-28 22:24:21 +0530 | [diff] [blame] | 830 | |
Kanchanapally, Vidyullatha | ced2f42 | 2014-02-04 20:45:38 +0530 | [diff] [blame] | 831 | vos_mem_zero( pReport, |
| 832 | pBcnReport->numBssDesc * sizeof(tSirMacRadioMeasureReport) ); |
Gopichand Nakkala | 72717fd | 2013-02-08 12:23:45 +0530 | [diff] [blame] | 833 | |
Kanchanapally, Vidyullatha | ced2f42 | 2014-02-04 20:45:38 +0530 | [diff] [blame] | 834 | for (bssDescCnt = 0; bssDescCnt < pBcnReport->numBssDesc; bssDescCnt++) |
| 835 | { |
| 836 | //Prepare the beacon report and send it to the peer. |
| 837 | pReport[bssDescCnt].token = pBcnReport->uDialogToken; |
| 838 | pReport[bssDescCnt].refused = 0; |
| 839 | pReport[bssDescCnt].incapable = 0; |
| 840 | pReport[bssDescCnt].type = SIR_MAC_RRM_BEACON_TYPE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 841 | |
Kanchanapally, Vidyullatha | ced2f42 | 2014-02-04 20:45:38 +0530 | [diff] [blame] | 842 | //If the scan result is NULL then send report request with |
| 843 | //option subelement as NULL.. |
| 844 | if ( NULL != pBcnReport->pBssDescription[bssDescCnt] ) |
| 845 | { |
| 846 | flagBSSPresent = TRUE; |
| 847 | } |
| 848 | |
| 849 | //Valid response is included if the size of beacon xmit |
| 850 | //is == size of beacon xmit ind + ies |
| 851 | if ( pBcnReport->length >= sizeof( tSirBeaconReportXmitInd ) ) |
| 852 | { |
| 853 | pReport[bssDescCnt].report.beaconReport.regClass = pBcnReport->regClass; |
| 854 | if ( flagBSSPresent ) |
| 855 | { |
Madan Mohan Koyyalamudi | c6a1d88 | 2013-09-28 22:24:21 +0530 | [diff] [blame] | 856 | pReport[bssDescCnt].report.beaconReport.channel = |
| 857 | pBcnReport->pBssDescription[bssDescCnt]->channelId; |
| 858 | vos_mem_copy( pReport[bssDescCnt].report.beaconReport.measStartTime, |
| 859 | pBcnReport->pBssDescription[bssDescCnt]->startTSF, |
| 860 | sizeof( pBcnReport->pBssDescription[bssDescCnt]->startTSF) ); |
| 861 | pReport[bssDescCnt].report.beaconReport.measDuration = |
| 862 | SYS_MS_TO_TU(pBcnReport->duration); |
| 863 | pReport[bssDescCnt].report.beaconReport.phyType = |
| 864 | pBcnReport->pBssDescription[bssDescCnt]->nwType; |
| 865 | pReport[bssDescCnt].report.beaconReport.bcnProbeRsp = 1; |
| 866 | pReport[bssDescCnt].report.beaconReport.rsni = |
| 867 | pBcnReport->pBssDescription[bssDescCnt]->sinr; |
| 868 | pReport[bssDescCnt].report.beaconReport.rcpi = |
| 869 | pBcnReport->pBssDescription[bssDescCnt]->rssi; |
| 870 | |
| 871 | pReport[bssDescCnt].report.beaconReport.antennaId = 0; |
| 872 | pReport[bssDescCnt].report.beaconReport.parentTSF = |
| 873 | pBcnReport->pBssDescription[bssDescCnt]->parentTSF; |
| 874 | vos_mem_copy( pReport[bssDescCnt].report.beaconReport.bssid, |
| 875 | pBcnReport->pBssDescription[bssDescCnt]->bssId, |
| 876 | sizeof(tSirMacAddr)); |
Kanchanapally, Vidyullatha | ced2f42 | 2014-02-04 20:45:38 +0530 | [diff] [blame] | 877 | } |
Madan Mohan Koyyalamudi | c6a1d88 | 2013-09-28 22:24:21 +0530 | [diff] [blame] | 878 | |
Kanchanapally, Vidyullatha | ced2f42 | 2014-02-04 20:45:38 +0530 | [diff] [blame] | 879 | switch ( pCurrentReq->request.Beacon.reportingDetail ) |
| 880 | { |
Madan Mohan Koyyalamudi | c6a1d88 | 2013-09-28 22:24:21 +0530 | [diff] [blame] | 881 | case BEACON_REPORTING_DETAIL_NO_FF_IE: |
| 882 | //0 No need to include any elements. |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 883 | limLog(pMac, LOG3, "No reporting detail requested"); |
Madan Mohan Koyyalamudi | c6a1d88 | 2013-09-28 22:24:21 +0530 | [diff] [blame] | 884 | break; |
| 885 | case BEACON_REPORTING_DETAIL_ALL_FF_REQ_IE: |
| 886 | //1: Include all FFs and Requested Ies. |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 887 | limLog(pMac, LOG3, |
| 888 | "Only requested IEs in reporting detail requested"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 889 | |
Madan Mohan Koyyalamudi | c6a1d88 | 2013-09-28 22:24:21 +0530 | [diff] [blame] | 890 | if ( flagBSSPresent ) |
| 891 | { |
| 892 | rrmFillBeaconIes( pMac, |
| 893 | (tANI_U8*) &pReport[bssDescCnt].report.beaconReport.Ies[0], |
| 894 | (tANI_U8*) &pReport[bssDescCnt].report.beaconReport.numIes, |
| 895 | BEACON_REPORT_MAX_IES, |
| 896 | pCurrentReq->request.Beacon.reqIes.pElementIds, |
| 897 | pCurrentReq->request.Beacon.reqIes.num, |
| 898 | pBcnReport->pBssDescription[bssDescCnt] ); |
| 899 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 900 | |
Madan Mohan Koyyalamudi | c6a1d88 | 2013-09-28 22:24:21 +0530 | [diff] [blame] | 901 | break; |
| 902 | case BEACON_REPORTING_DETAIL_ALL_FF_IE: |
| 903 | //2 / default - Include all FFs and all Ies. |
| 904 | default: |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 905 | limLog(pMac, LOG3, "Default all IEs and FFs"); |
Madan Mohan Koyyalamudi | c6a1d88 | 2013-09-28 22:24:21 +0530 | [diff] [blame] | 906 | if ( flagBSSPresent ) |
| 907 | { |
| 908 | rrmFillBeaconIes( pMac, |
| 909 | (tANI_U8*) &pReport[bssDescCnt].report.beaconReport.Ies[0], |
| 910 | (tANI_U8*) &pReport[bssDescCnt].report.beaconReport.numIes, |
| 911 | BEACON_REPORT_MAX_IES, |
Gopichand Nakkala | 72717fd | 2013-02-08 12:23:45 +0530 | [diff] [blame] | 912 | NULL, 0, |
Madan Mohan Koyyalamudi | c6a1d88 | 2013-09-28 22:24:21 +0530 | [diff] [blame] | 913 | pBcnReport->pBssDescription[bssDescCnt] ); |
| 914 | } |
| 915 | break; |
Kanchanapally, Vidyullatha | ced2f42 | 2014-02-04 20:45:38 +0530 | [diff] [blame] | 916 | } |
| 917 | } |
| 918 | } |
| 919 | |
| 920 | limLog( pMac, LOG1, "Sending Action frame with %d bss info", bssDescCnt); |
| 921 | limSendRadioMeasureReportActionFrame( pMac, |
| 922 | pCurrentReq->dialog_token, |
| 923 | bssDescCnt, |
| 924 | pReport, |
| 925 | pBcnReport->bssId, |
| 926 | pSessionEntry ); |
| 927 | |
| 928 | pCurrentReq->sendEmptyBcnRpt = false; |
Madan Mohan Koyyalamudi | c6a1d88 | 2013-09-28 22:24:21 +0530 | [diff] [blame] | 929 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 930 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 931 | if( pBcnReport->fMeasureDone ) |
| 932 | { |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 933 | limLog( pMac, LOG3, "Measurement done....cleanup the context"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 934 | |
| 935 | rrmCleanup(pMac); |
| 936 | } |
Madan Mohan Koyyalamudi | c6a1d88 | 2013-09-28 22:24:21 +0530 | [diff] [blame] | 937 | |
Kanchanapally, Vidyullatha | ced2f42 | 2014-02-04 20:45:38 +0530 | [diff] [blame] | 938 | if( NULL != pReport ) |
| 939 | vos_mem_free(pReport); |
Madan Mohan Koyyalamudi | c6a1d88 | 2013-09-28 22:24:21 +0530 | [diff] [blame] | 940 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 941 | return status; |
| 942 | } |
| 943 | |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 944 | void rrmProcessBeaconRequestFailure(tpAniSirGlobal pMac, tpPESession pSessionEntry, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 945 | tSirMacAddr peer, tRrmRetStatus status) |
| 946 | { |
| 947 | tpSirMacRadioMeasureReport pReport = NULL; |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 948 | tpRRMReq pCurrentReq = pMac->rrm.rrmPEContext.pCurrentReq; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 949 | |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 950 | pReport = vos_mem_malloc(sizeof( tSirMacRadioMeasureReport )); |
| 951 | if ( NULL == pReport ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 952 | { |
| 953 | limLog( pMac, LOGP, |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 954 | FL( "Unable to allocate memory during RRM Req processing" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 955 | return; |
| 956 | } |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 957 | vos_mem_set(pReport, sizeof(tSirMacRadioMeasureReport), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 958 | pReport->token = pCurrentReq->token; |
| 959 | pReport->type = SIR_MAC_RRM_BEACON_TYPE; |
| 960 | |
| 961 | switch (status) |
| 962 | { |
| 963 | case eRRM_REFUSED: |
| 964 | pReport->refused = 1; |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 965 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 966 | case eRRM_INCAPABLE: |
| 967 | pReport->incapable = 1; |
| 968 | break; |
| 969 | default: |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 970 | PELOGE(limLog( pMac, LOGE, |
| 971 | FL(" Beacon request processing failed no report sent with status %d "), |
| 972 | status);); |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 973 | vos_mem_free(pReport); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 974 | return; |
| 975 | } |
| 976 | |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 977 | limSendRadioMeasureReportActionFrame( pMac, pCurrentReq->dialog_token, 1, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 978 | pReport, peer, pSessionEntry ); |
| 979 | |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 980 | vos_mem_free(pReport); |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 981 | limLog( pMac, LOG3, FL(" Free memory for pReport") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 982 | return; |
| 983 | } |
| 984 | |
| 985 | // -------------------------------------------------------------------- |
| 986 | /** |
| 987 | * rrmProcessRadioMeasurementRequest |
| 988 | * |
| 989 | * FUNCTION: Processes the Radio Resource Measurement request. |
| 990 | * |
| 991 | * LOGIC: |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 992 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 993 | |
| 994 | * |
| 995 | * ASSUMPTIONS: |
| 996 | * |
| 997 | * NOTE: |
| 998 | * |
| 999 | * @param peer Macaddress of the peer requesting the radio measurement. |
| 1000 | * @param pRRMReq Array of Measurement request IEs |
| 1001 | * @param pSessionEntry session entry. |
| 1002 | * @return None |
| 1003 | */ |
| 1004 | tSirRetStatus |
Gopichand Nakkala | 72717fd | 2013-02-08 12:23:45 +0530 | [diff] [blame] | 1005 | rrmProcessRadioMeasurementRequest( tpAniSirGlobal pMac, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1006 | tSirMacAddr peer, |
| 1007 | tDot11fRadioMeasurementRequest *pRRMReq, |
| 1008 | tpPESession pSessionEntry ) |
| 1009 | { |
| 1010 | tANI_U8 i; |
| 1011 | tSirRetStatus status = eSIR_SUCCESS; |
| 1012 | tpSirMacRadioMeasureReport pReport = NULL; |
| 1013 | tANI_U8 num_report = 0; |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 1014 | tpRRMReq pCurrentReq = pMac->rrm.rrmPEContext.pCurrentReq; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1015 | tRrmRetStatus rrmStatus = eRRM_SUCCESS; |
| 1016 | |
| 1017 | if( !pRRMReq->num_MeasurementRequest ) |
| 1018 | { |
| 1019 | //No measurement requests.... |
| 1020 | // |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1021 | pReport = vos_mem_malloc(sizeof( tSirMacRadioMeasureReport )); |
| 1022 | if ( NULL == pReport ) |
Gopichand Nakkala | 72717fd | 2013-02-08 12:23:45 +0530 | [diff] [blame] | 1023 | { |
| 1024 | limLog( pMac, LOGP, |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1025 | FL( "Unable to allocate memory during RRM Req processing" )); |
Gopichand Nakkala | 72717fd | 2013-02-08 12:23:45 +0530 | [diff] [blame] | 1026 | return eSIR_MEM_ALLOC_FAILED; |
| 1027 | } |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1028 | vos_mem_set(pReport, sizeof(tSirMacRadioMeasureReport),0); |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 1029 | PELOGE(limLog( pMac, LOGE, |
| 1030 | FL("No requestIes in the measurement request, sending incapable report"));) |
Gopichand Nakkala | 72717fd | 2013-02-08 12:23:45 +0530 | [diff] [blame] | 1031 | pReport->incapable = 1; |
| 1032 | num_report = 1; |
| 1033 | limSendRadioMeasureReportActionFrame( pMac, pRRMReq->DialogToken.token, num_report, |
| 1034 | pReport, peer, pSessionEntry ); |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1035 | vos_mem_free(pReport); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1036 | return eSIR_FAILURE; |
| 1037 | } |
| 1038 | |
| 1039 | // PF Fix |
| 1040 | if( pRRMReq->NumOfRepetitions.repetitions > 0 ) |
| 1041 | { |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 1042 | limLog( pMac, LOG1, |
| 1043 | FL(" number of repetitions %d"), |
| 1044 | pRRMReq->NumOfRepetitions.repetitions ); |
| 1045 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1046 | //Send a report with incapable bit set. Not supporting repetitions. |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1047 | pReport = vos_mem_malloc(sizeof( tSirMacRadioMeasureReport )); |
| 1048 | if ( NULL == pReport ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1049 | { |
| 1050 | limLog( pMac, LOGP, |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1051 | FL( "Unable to allocate memory during RRM Req processing" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1052 | return eSIR_MEM_ALLOC_FAILED; |
| 1053 | } |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1054 | vos_mem_set(pReport, sizeof(tSirMacRadioMeasureReport), 0); |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 1055 | PELOGE(limLog( pMac, LOGE, FL(" Allocated memory for pReport") );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1056 | pReport->incapable = 1; |
| 1057 | pReport->type = pRRMReq->MeasurementRequest[0].measurement_type; |
| 1058 | num_report = 1; |
| 1059 | goto end; |
| 1060 | |
| 1061 | } |
| 1062 | |
| 1063 | for( i= 0; i < pRRMReq->num_MeasurementRequest; i++ ) |
| 1064 | { |
| 1065 | switch( pRRMReq->MeasurementRequest[i].measurement_type ) |
| 1066 | { |
| 1067 | case SIR_MAC_RRM_BEACON_TYPE: |
| 1068 | //Process beacon request. |
| 1069 | if( pCurrentReq ) |
| 1070 | { |
| 1071 | if ( pReport == NULL ) //Allocate memory to send reports for any subsequent requests. |
| 1072 | { |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1073 | pReport = vos_mem_malloc(sizeof( tSirMacRadioMeasureReport ) |
| 1074 | * (pRRMReq->num_MeasurementRequest - i)); |
| 1075 | if ( NULL == pReport ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1076 | { |
| 1077 | limLog( pMac, LOGP, |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1078 | FL( "Unable to allocate memory during RRM Req processing" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1079 | return eSIR_MEM_ALLOC_FAILED; |
| 1080 | } |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1081 | vos_mem_set(pReport, |
| 1082 | sizeof( tSirMacRadioMeasureReport ) |
| 1083 | * (pRRMReq->num_MeasurementRequest - i), |
| 1084 | 0); |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 1085 | limLog( pMac, LOG3, |
| 1086 | FL(" rrm beacon type refused of %d report in beacon table"), |
| 1087 | num_report ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1088 | |
| 1089 | } |
| 1090 | pReport[num_report].refused = 1; |
| 1091 | pReport[num_report].type = SIR_MAC_RRM_BEACON_TYPE; |
| 1092 | pReport[num_report].token = pRRMReq->MeasurementRequest[i].measurement_token; |
| 1093 | num_report++; |
| 1094 | continue; |
| 1095 | } |
| 1096 | else |
| 1097 | { |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1098 | pCurrentReq = vos_mem_malloc(sizeof( *pCurrentReq )); |
| 1099 | if ( NULL == pCurrentReq ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1100 | { |
| 1101 | limLog( pMac, LOGP, |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1102 | FL( "Unable to allocate memory during RRM Req processing" )); |
| 1103 | vos_mem_free(pReport); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1104 | return eSIR_MEM_ALLOC_FAILED; |
| 1105 | } |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 1106 | limLog( pMac, LOG3, FL(" Processing Beacon Report request") ); |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1107 | vos_mem_set(pCurrentReq, sizeof( *pCurrentReq ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1108 | pCurrentReq->dialog_token = pRRMReq->DialogToken.token; |
| 1109 | pCurrentReq->token = pRRMReq->MeasurementRequest[i].measurement_token; |
Kanchanapally, Vidyullatha | ced2f42 | 2014-02-04 20:45:38 +0530 | [diff] [blame] | 1110 | pCurrentReq->sendEmptyBcnRpt = true; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1111 | pMac->rrm.rrmPEContext.pCurrentReq = pCurrentReq; |
| 1112 | rrmStatus = rrmProcessBeaconReportReq( pMac, pCurrentReq, &pRRMReq->MeasurementRequest[i], pSessionEntry ); |
| 1113 | if (eRRM_SUCCESS != rrmStatus) |
| 1114 | { |
| 1115 | rrmProcessBeaconRequestFailure(pMac, pSessionEntry, peer, rrmStatus); |
| 1116 | rrmCleanup(pMac); |
| 1117 | } |
| 1118 | } |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 1119 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1120 | default: |
| 1121 | //Send a report with incapabale bit set. |
| 1122 | if ( pReport == NULL ) //Allocate memory to send reports for any subsequent requests. |
| 1123 | { |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1124 | pReport = vos_mem_malloc(sizeof( tSirMacRadioMeasureReport ) |
| 1125 | * (pRRMReq->num_MeasurementRequest - i)); |
| 1126 | if ( NULL == pReport ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1127 | { |
| 1128 | limLog( pMac, LOGP, |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1129 | FL( "Unable to allocate memory during RRM Req processing" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1130 | return eSIR_MEM_ALLOC_FAILED; |
| 1131 | } |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1132 | vos_mem_set(pReport, |
| 1133 | sizeof( tSirMacRadioMeasureReport ) |
| 1134 | * (pRRMReq->num_MeasurementRequest - i), |
| 1135 | 0); |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 1136 | limLog( pMac, LOG3, |
| 1137 | FL(" rrm beacon type incapble of %d report "), |
| 1138 | num_report ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1139 | } |
| 1140 | pReport[num_report].incapable = 1; |
| 1141 | pReport[num_report].type = pRRMReq->MeasurementRequest[i].measurement_type; |
| 1142 | pReport[num_report].token = pRRMReq->MeasurementRequest[i].measurement_token; |
| 1143 | num_report++; |
| 1144 | break; |
| 1145 | } |
| 1146 | } |
| 1147 | |
| 1148 | end: |
| 1149 | if( pReport ) |
| 1150 | { |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 1151 | limSendRadioMeasureReportActionFrame( pMac, pRRMReq->DialogToken.token, num_report, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1152 | pReport, peer, pSessionEntry ); |
| 1153 | |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1154 | vos_mem_free(pReport); |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 1155 | limLog( pMac, LOG3, FL(" Free memory for pReport") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1156 | } |
| 1157 | return status; |
| 1158 | |
| 1159 | } |
| 1160 | |
| 1161 | // -------------------------------------------------------------------- |
| 1162 | /** |
| 1163 | * rrmUpdateStartTSF |
| 1164 | ** |
| 1165 | * FUNCTION: Store start TSF of measurement. |
| 1166 | * |
| 1167 | * LOGIC: |
| 1168 | * |
| 1169 | * ASSUMPTIONS: |
| 1170 | * |
| 1171 | * NOTE: |
| 1172 | * |
| 1173 | * @param startTSF - TSF value at the start of measurement. |
| 1174 | * @return None |
| 1175 | */ |
| 1176 | void |
| 1177 | rrmUpdateStartTSF ( tpAniSirGlobal pMac, tANI_U32 startTSF[2] ) |
| 1178 | { |
| 1179 | #if 0 //defined WLAN_VOWIFI_DEBUG |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 1180 | limLog( pMac, LOGE, "Update Start TSF = %d %d", startTSF[0], startTSF[1] ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1181 | #endif |
| 1182 | pMac->rrm.rrmPEContext.startTSF[0] = startTSF[0]; |
| 1183 | pMac->rrm.rrmPEContext.startTSF[1] = startTSF[1]; |
| 1184 | } |
| 1185 | |
| 1186 | // -------------------------------------------------------------------- |
| 1187 | /** |
| 1188 | * rrmGetStartTSF |
| 1189 | * |
| 1190 | * FUNCTION: Get the Start TSF. |
| 1191 | * |
| 1192 | * LOGIC: |
| 1193 | * |
| 1194 | * ASSUMPTIONS: |
| 1195 | * |
| 1196 | * NOTE: |
| 1197 | * |
| 1198 | * @param startTSF - store star TSF in this buffer. |
| 1199 | * @return txPower |
| 1200 | */ |
| 1201 | void |
| 1202 | rrmGetStartTSF ( tpAniSirGlobal pMac, tANI_U32 *pStartTSF ) |
| 1203 | { |
| 1204 | #if 0 //defined WLAN_VOWIFI_DEBUG |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 1205 | 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] | 1206 | #endif |
| 1207 | pStartTSF[0] = pMac->rrm.rrmPEContext.startTSF[0]; |
| 1208 | pStartTSF[1] = pMac->rrm.rrmPEContext.startTSF[1]; |
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 | } |
| 1211 | // -------------------------------------------------------------------- |
| 1212 | /** |
| 1213 | * rrmGetCapabilities |
| 1214 | * |
| 1215 | * FUNCTION: |
| 1216 | * Returns a pointer to tpRRMCaps with all the caps enabled in RRM |
| 1217 | * |
| 1218 | * LOGIC: |
| 1219 | * |
| 1220 | * ASSUMPTIONS: |
| 1221 | * |
| 1222 | * NOTE: |
| 1223 | * |
| 1224 | * @param pSessionEntry |
| 1225 | * @return pointer to tRRMCaps |
| 1226 | */ |
| 1227 | tpRRMCaps rrmGetCapabilities ( tpAniSirGlobal pMac, |
| 1228 | tpPESession pSessionEntry ) |
| 1229 | { |
| 1230 | return &pMac->rrm.rrmPEContext.rrmEnabledCaps; |
| 1231 | } |
| 1232 | |
| 1233 | // -------------------------------------------------------------------- |
| 1234 | /** |
| 1235 | * rrmUpdateConfig |
| 1236 | * |
| 1237 | * FUNCTION: |
| 1238 | * Update the configuration. This is called from limUpdateConfig. |
| 1239 | * |
| 1240 | * LOGIC: |
| 1241 | * |
| 1242 | * ASSUMPTIONS: |
| 1243 | * |
| 1244 | * NOTE: |
| 1245 | * |
| 1246 | * @param pSessionEntry |
| 1247 | * @return pointer to tRRMCaps |
| 1248 | */ |
| 1249 | void rrmUpdateConfig ( tpAniSirGlobal pMac, |
| 1250 | tpPESession pSessionEntry ) |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 1251 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1252 | tANI_U32 val; |
| 1253 | tpRRMCaps pRRMCaps = &pMac->rrm.rrmPEContext.rrmEnabledCaps; |
| 1254 | |
| 1255 | if (wlan_cfgGetInt(pMac, WNI_CFG_RRM_ENABLED, &val) != eSIR_SUCCESS) |
| 1256 | { |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 1257 | limLog(pMac, LOGP, FL("cfg get rrm enabled failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1258 | return; |
| 1259 | } |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 1260 | pMac->rrm.rrmPEContext.rrmEnable = (val) ? 1 : 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1261 | |
| 1262 | if (wlan_cfgGetInt(pMac, WNI_CFG_RRM_OPERATING_CHAN_MAX, &val) != eSIR_SUCCESS) |
| 1263 | { |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 1264 | 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] | 1265 | return; |
| 1266 | } |
| 1267 | pRRMCaps->operatingChanMax = (tANI_U8)val; |
| 1268 | |
| 1269 | if (wlan_cfgGetInt(pMac, WNI_CFG_RRM_NON_OPERATING_CHAN_MAX, &val) != eSIR_SUCCESS) |
| 1270 | { |
Kiran Kumar Lokere | af882c8 | 2013-03-18 16:07:05 -0700 | [diff] [blame] | 1271 | 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] | 1272 | return; |
| 1273 | } |
| 1274 | pRRMCaps->nonOperatingChanMax =(tANI_U8) val; |
| 1275 | |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 1276 | limLog( pMac, LOG1, |
| 1277 | "RRM enabled = %d OperatingChanMax = %d NonOperatingMax = %d", |
| 1278 | pMac->rrm.rrmPEContext.rrmEnable, |
| 1279 | pRRMCaps->operatingChanMax, pRRMCaps->nonOperatingChanMax ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1280 | } |
| 1281 | // -------------------------------------------------------------------- |
| 1282 | /** |
| 1283 | * rrmInitialize |
| 1284 | * |
| 1285 | * FUNCTION: |
| 1286 | * Initialize RRM module |
| 1287 | * |
| 1288 | * LOGIC: |
| 1289 | * |
| 1290 | * ASSUMPTIONS: |
| 1291 | * |
| 1292 | * NOTE: |
| 1293 | * |
| 1294 | * @return None |
| 1295 | */ |
| 1296 | |
| 1297 | tSirRetStatus |
| 1298 | rrmInitialize(tpAniSirGlobal pMac) |
| 1299 | { |
| 1300 | tpRRMCaps pRRMCaps = &pMac->rrm.rrmPEContext.rrmEnabledCaps; |
| 1301 | |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 1302 | pMac->rrm.rrmPEContext.pCurrentReq = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1303 | pMac->rrm.rrmPEContext.txMgmtPower = 0; |
| 1304 | pMac->rrm.rrmPEContext.DialogToken = 0; |
| 1305 | |
| 1306 | pMac->rrm.rrmPEContext.rrmEnable = 0; |
| 1307 | |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1308 | vos_mem_set(pRRMCaps, sizeof(tRRMCaps), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1309 | pRRMCaps->LinkMeasurement = 1; |
| 1310 | pRRMCaps->NeighborRpt = 1; |
| 1311 | pRRMCaps->BeaconPassive = 1; |
| 1312 | pRRMCaps->BeaconActive = 1; |
| 1313 | pRRMCaps->BeaconTable = 1; |
| 1314 | pRRMCaps->APChanReport = 1; |
| 1315 | |
| 1316 | //pRRMCaps->TCMCapability = 1; |
| 1317 | //pRRMCaps->triggeredTCM = 1; |
| 1318 | pRRMCaps->operatingChanMax = 3; |
| 1319 | pRRMCaps->nonOperatingChanMax = 3; |
| 1320 | |
| 1321 | return eSIR_SUCCESS; |
| 1322 | } |
| 1323 | |
| 1324 | // -------------------------------------------------------------------- |
| 1325 | /** |
| 1326 | * rrmCleanup |
| 1327 | * |
| 1328 | * FUNCTION: |
| 1329 | * cleanup RRM module |
| 1330 | * |
| 1331 | * LOGIC: |
| 1332 | * |
| 1333 | * ASSUMPTIONS: |
| 1334 | * |
| 1335 | * NOTE: |
| 1336 | * |
| 1337 | * @param mode |
| 1338 | * @param rate |
| 1339 | * @return None |
| 1340 | */ |
| 1341 | |
| 1342 | tSirRetStatus |
| 1343 | rrmCleanup(tpAniSirGlobal pMac) |
| 1344 | { |
| 1345 | if( pMac->rrm.rrmPEContext.pCurrentReq ) |
| 1346 | { |
| 1347 | if( pMac->rrm.rrmPEContext.pCurrentReq->request.Beacon.reqIes.pElementIds ) |
| 1348 | { |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1349 | vos_mem_free(pMac->rrm.rrmPEContext.pCurrentReq->request.Beacon.reqIes.pElementIds); |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 1350 | limLog( pMac, LOG4, FL(" Free memory for pElementIds") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1351 | } |
| 1352 | |
Madan Mohan Koyyalamudi | fff03f2 | 2013-07-11 11:32:07 +0530 | [diff] [blame] | 1353 | vos_mem_free(pMac->rrm.rrmPEContext.pCurrentReq); |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 1354 | limLog( pMac, LOG4, FL(" Free memory for pCurrentReq") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1355 | } |
| 1356 | |
DARAM SUDHA | 588ae87 | 2013-12-08 07:54:56 +0530 | [diff] [blame] | 1357 | pMac->rrm.rrmPEContext.pCurrentReq = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1358 | return eSIR_SUCCESS; |
| 1359 | } |
| 1360 | |
| 1361 | // -------------------------------------------------------------------- |
| 1362 | /** |
| 1363 | * rrmProcessMessage |
| 1364 | * |
| 1365 | * FUNCTION: Processes the next received Radio Resource Management message |
| 1366 | * |
| 1367 | * LOGIC: |
| 1368 | * |
| 1369 | * ASSUMPTIONS: |
| 1370 | * |
| 1371 | * NOTE: |
| 1372 | * |
| 1373 | * @param None |
| 1374 | * @return None |
| 1375 | */ |
| 1376 | |
| 1377 | void rrmProcessMessage(tpAniSirGlobal pMac, tpSirMsgQ pMsg) |
| 1378 | { |
| 1379 | switch (pMsg->type) |
| 1380 | { |
| 1381 | case eWNI_SME_NEIGHBOR_REPORT_REQ_IND: |
| 1382 | rrmProcessNeighborReportReq( pMac, pMsg->bodyptr ); |
| 1383 | break; |
| 1384 | case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND: |
| 1385 | rrmProcessBeaconReportXmit( pMac, pMsg->bodyptr ); |
| 1386 | break; |
| 1387 | } |
| 1388 | |
| 1389 | } |
| 1390 | |
| 1391 | #endif |