Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Gopichand Nakkala | 92f07d8 | 2013-01-08 21:16:34 -0800 | [diff] [blame^] | 2 | * Copyright (c) 2012-2013, 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 | */ |
| 21 | /* |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 22 | * Copyright (c) 2012, The Linux Foundation. All rights reserved. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 23 | * |
| 24 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 25 | * |
| 26 | * |
| 27 | * Permission to use, copy, modify, and/or distribute this software for |
| 28 | * any purpose with or without fee is hereby granted, provided that the |
| 29 | * above copyright notice and this permission notice appear in all |
| 30 | * copies. |
| 31 | * |
| 32 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 33 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 34 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 35 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 36 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 37 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 38 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 39 | * PERFORMANCE OF THIS SOFTWARE. |
| 40 | */ |
| 41 | |
| 42 | /* |
| 43 | * |
| 44 | * Airgo Networks, Inc proprietary. All rights reserved. |
| 45 | * This file contains the source code for CFG API functions. |
| 46 | * |
| 47 | * Author: Kevin Nguyen |
| 48 | * Date: 04/09/02 |
| 49 | * History:- |
| 50 | * 04/09/02 Created. |
| 51 | * -------------------------------------------------------------------- |
| 52 | */ |
| 53 | |
| 54 | #include "palTypes.h" |
| 55 | #include "cfgPriv.h" |
| 56 | #include "cfgDebug.h" |
| 57 | #include "wlan_qct_wda.h" |
| 58 | |
| 59 | //--------------------------------------------------------------------- |
| 60 | // Static Variables |
| 61 | //---------------------------------------------------------------------- |
| 62 | static tCfgCtl __gCfgEntry[CFG_PARAM_MAX_NUM] ; |
| 63 | static tANI_U32 __gCfgIBufMin[CFG_STA_IBUF_MAX_SIZE] ; |
| 64 | static tANI_U32 __gCfgIBufMax[CFG_STA_IBUF_MAX_SIZE] ; |
| 65 | static tANI_U32 __gCfgIBuf[CFG_STA_IBUF_MAX_SIZE] ; |
| 66 | static tANI_U8 __gCfgSBuf[CFG_STA_SBUF_MAX_SIZE] ; |
| 67 | static tANI_U8 __gSBuffer[CFG_MAX_STR_LEN] ; |
| 68 | static tANI_U32 __gParamList[WNI_CFG_MAX_PARAM_NUM + |
| 69 | WNI_CFG_GET_PER_STA_STAT_RSP_NUM]; |
| 70 | |
| 71 | static void Notify(tpAniSirGlobal, tANI_U16, tANI_U32); |
| 72 | |
| 73 | |
| 74 | // --------------------------------------------------------------------- |
| 75 | tANI_U32 cfgNeedRestart(tpAniSirGlobal pMac, tANI_U16 cfgId) |
| 76 | { |
| 77 | return !!(pMac->cfg.gCfgEntry[cfgId].control & CFG_CTL_RESTART) ; |
| 78 | } |
| 79 | |
| 80 | // --------------------------------------------------------------------- |
| 81 | tANI_U32 cfgNeedReload(tpAniSirGlobal pMac, tANI_U16 cfgId) |
| 82 | { |
| 83 | return !!(pMac->cfg.gCfgEntry[cfgId].control & CFG_CTL_RELOAD) ; |
| 84 | } |
| 85 | |
| 86 | // --------------------------------------------------------------------- |
| 87 | /** |
| 88 | * wlan_cfgInit() |
| 89 | * |
| 90 | * FUNCTION: |
| 91 | * CFG initialization function. |
| 92 | * |
| 93 | * LOGIC: |
| 94 | * Please see Configuration & Statistic Collection Micro-Architecture |
| 95 | * specification for the pseudocode. |
| 96 | * |
| 97 | * ASSUMPTIONS: |
| 98 | * None. |
| 99 | * |
| 100 | * NOTE: |
| 101 | * This function must be called during system initialization. |
| 102 | * |
| 103 | * @param None |
| 104 | * @return None. |
| 105 | */ |
| 106 | |
| 107 | void |
| 108 | wlan_cfgInit(tpAniSirGlobal pMac) |
| 109 | { |
| 110 | // Set status to not-ready |
| 111 | pMac->cfg.gCfgStatus = CFG_INCOMPLETE; |
| 112 | |
| 113 | // Send CFG_DNLD_REQ to host |
| 114 | PELOGW(cfgLog(pMac, LOGW, FL("Sending CFG_DNLD_REQ\n"));) |
| 115 | cfgSendHostMsg(pMac, WNI_CFG_DNLD_REQ, WNI_CFG_DNLD_REQ_LEN, |
| 116 | WNI_CFG_DNLD_REQ_NUM, 0, 0, 0); |
| 117 | |
| 118 | } /*** end wlan_cfgInit() ***/ |
| 119 | |
| 120 | |
| 121 | //--------------------------------------------------------------------- |
| 122 | #if (WNI_POLARIS_FW_PRODUCT != AP) |
| 123 | tSirRetStatus cfgInit(tpAniSirGlobal pMac) |
| 124 | { |
| 125 | pMac->cfg.gCfgIBufMin = __gCfgIBufMin; |
| 126 | pMac->cfg.gCfgIBufMax = __gCfgIBufMax; |
| 127 | pMac->cfg.gCfgIBuf = __gCfgIBuf; |
| 128 | pMac->cfg.gCfgSBuf = __gCfgSBuf; |
| 129 | pMac->cfg.gSBuffer = __gSBuffer; |
| 130 | pMac->cfg.gCfgEntry = __gCfgEntry; |
| 131 | pMac->cfg.gParamList = __gParamList; |
| 132 | |
| 133 | return (eSIR_SUCCESS); |
| 134 | } |
| 135 | |
| 136 | //---------------------------------------------------------------------- |
| 137 | void cfgDeInit(tpAniSirGlobal pMac) |
| 138 | { |
| 139 | pMac->cfg.gCfgIBufMin = NULL; |
| 140 | pMac->cfg.gCfgIBufMax = NULL; |
| 141 | pMac->cfg.gCfgIBuf = NULL; |
| 142 | pMac->cfg.gCfgSBuf = NULL; |
| 143 | pMac->cfg.gSBuffer = NULL; |
| 144 | pMac->cfg.gCfgEntry = NULL; |
| 145 | pMac->cfg.gParamList = NULL; |
| 146 | } |
| 147 | #endif |
| 148 | |
| 149 | // --------------------------------------------------------------------- |
| 150 | /** |
| 151 | * cfgSetInt() |
| 152 | * |
| 153 | * FUNCTION: |
| 154 | * This function is called to update an integer parameter. |
| 155 | * |
| 156 | * LOGIC: |
| 157 | * |
| 158 | * ASSUMPTIONS: |
| 159 | * - Range checking is performed by the calling function. In case this |
| 160 | * function call is being triggered by a request from host, then host |
| 161 | * is responsible for performing range checking before sending the |
| 162 | * request. |
| 163 | * |
| 164 | * - Host RW permission checking should already be done prior to calling |
| 165 | * this function by the message processing function. |
| 166 | * |
| 167 | * NOTE: |
| 168 | * |
| 169 | * @param cfgId: 16-bit CFG parameter ID |
| 170 | * @param value: 32-bit unsigned value |
| 171 | * |
| 172 | * @return eSIR_SUCCESS : request completed successfully \n |
| 173 | * @return eSIR_CFG_INVALID_ID: invalid CFG parameter ID \n |
| 174 | */ |
| 175 | |
| 176 | tSirRetStatus |
| 177 | cfgSetInt(tpAniSirGlobal pMac, tANI_U16 cfgId, tANI_U32 value) |
| 178 | { |
| 179 | tANI_U32 index; |
| 180 | tANI_U32 control, mask; |
| 181 | tSirRetStatus retVal; |
| 182 | |
| 183 | if (cfgId >= CFG_PARAM_MAX_NUM) |
| 184 | { |
| 185 | PELOGE(cfgLog(pMac, LOGE, FL("Invalid cfg id %d\n"), cfgId);) |
| 186 | return eSIR_CFG_INVALID_ID; |
| 187 | } |
| 188 | |
| 189 | control = pMac->cfg.gCfgEntry[cfgId].control; |
| 190 | index = control & CFG_BUF_INDX_MASK; |
| 191 | retVal = eSIR_SUCCESS; |
| 192 | |
| 193 | #if (WNI_POLARIS_FW_PRODUCT == AP) |
| 194 | if (index >= CFG_AP_IBUF_MAX_SIZE) |
| 195 | #else |
| 196 | if (index >= CFG_STA_IBUF_MAX_SIZE) |
| 197 | #endif |
| 198 | { |
| 199 | PELOGE(cfgLog(pMac, LOGE, FL("cfg index out of bounds %d\n"), index);) |
| 200 | retVal = eSIR_CFG_INVALID_ID; |
| 201 | return retVal; |
| 202 | } |
| 203 | |
| 204 | // Check if parameter is valid |
| 205 | if ((control & CFG_CTL_VALID) == 0) |
| 206 | { |
| 207 | PELOGE(cfgLog(pMac, LOGE, FL("Not valid cfg id %d\n"), cfgId);) |
| 208 | retVal = eSIR_CFG_INVALID_ID; |
| 209 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 210 | else if ((pMac->cfg.gCfgIBufMin[index] > value) || |
| 211 | (pMac->cfg.gCfgIBufMax[index] < value)) |
| 212 | { |
| 213 | PELOGE(cfgLog(pMac, LOGE, FL("Value %d out of range [%d,%d] cfg id %d\n"), |
| 214 | value, pMac->cfg.gCfgIBufMin[index], |
| 215 | pMac->cfg.gCfgIBufMax[index], cfgId);) |
| 216 | retVal = eSIR_CFG_INVALID_ID; |
| 217 | } |
| 218 | else |
| 219 | { |
| 220 | // Write integer value |
| 221 | pMac->cfg.gCfgIBuf[index] = value; |
| 222 | |
| 223 | // Update hardware if necessary |
| 224 | mask = control & CFG_CTL_NTF_MASK; |
| 225 | if ((mask & CFG_CTL_NTF_HW) != 0) |
| 226 | PELOGE(cfgLog(pMac, LOGE, FL("CFG Notify HW not supported!!!\n"));) |
| 227 | |
| 228 | // Notify other modules if necessary |
| 229 | if ((mask & CFG_CTL_NTF_MASK) != 0) |
| 230 | Notify(pMac, cfgId, mask); |
| 231 | |
| 232 | } |
| 233 | |
| 234 | return (retVal); |
| 235 | |
| 236 | } /*** end cfgSetInt ***/ |
| 237 | |
| 238 | // --------------------------------------------------------------------- |
| 239 | /** |
| 240 | * cfgCheckValid() |
| 241 | * |
| 242 | * FUNCTION: |
| 243 | * This function is called to check if a parameter is valid |
| 244 | * |
| 245 | * LOGIC: |
| 246 | * |
| 247 | * ASSUMPTIONS: |
| 248 | * |
| 249 | * NOTE: |
| 250 | * |
| 251 | * @param cfgId: 16-bit CFG parameter ID |
| 252 | * |
| 253 | * @return eSIR_SUCCESS: request completed successfully |
| 254 | * @return eSIR_CFG_INVALID_ID: invalid CFG parameter ID |
| 255 | */ |
| 256 | |
| 257 | tSirRetStatus |
| 258 | cfgCheckValid(tpAniSirGlobal pMac, tANI_U16 cfgId) |
| 259 | { |
| 260 | tANI_U32 control; |
| 261 | |
| 262 | if (cfgId >= CFG_PARAM_MAX_NUM) |
| 263 | { |
| 264 | PELOG3(cfgLog(pMac, LOG3, FL("Invalid cfg id %d\n"), cfgId);) |
| 265 | return(eSIR_CFG_INVALID_ID); |
| 266 | } |
| 267 | |
| 268 | control = pMac->cfg.gCfgEntry[cfgId].control; |
| 269 | |
| 270 | // Check if parameter is valid |
| 271 | if ((control & CFG_CTL_VALID) == 0) |
| 272 | { |
| 273 | PELOG3(cfgLog(pMac, LOG3, FL("Not valid cfg id %d\n"), cfgId);) |
| 274 | return(eSIR_CFG_INVALID_ID); |
| 275 | } |
| 276 | else |
| 277 | return(eSIR_SUCCESS); |
| 278 | |
| 279 | } /*** end cfgCheckValid() ***/ |
| 280 | |
| 281 | // --------------------------------------------------------------------- |
| 282 | /** |
| 283 | * wlan_cfgGetInt() |
| 284 | * |
| 285 | * FUNCTION: |
| 286 | * This function is called to read an integer parameter. |
| 287 | * |
| 288 | * LOGIC: |
| 289 | * |
| 290 | * ASSUMPTIONS: |
| 291 | * |
| 292 | * NOTE: |
| 293 | * |
| 294 | * @param cfgId: 16-bit CFG parameter ID |
| 295 | * @param pVal: address where parameter value will be written |
| 296 | * |
| 297 | * @return eSIR_SUCCESS: request completed successfully |
| 298 | * @return eSIR_CFG_INVALID_ID: invalid CFG parameter ID |
| 299 | */ |
| 300 | |
| 301 | tSirRetStatus |
| 302 | wlan_cfgGetInt(tpAniSirGlobal pMac, tANI_U16 cfgId, tANI_U32 *pValue) |
| 303 | { |
| 304 | tANI_U32 index; |
| 305 | tANI_U32 control; |
| 306 | tSirRetStatus retVal; |
| 307 | |
| 308 | if (cfgId >= CFG_PARAM_MAX_NUM) |
| 309 | { |
| 310 | PELOGE(cfgLog(pMac, LOGE, FL("Invalid cfg id %d\n"), cfgId);) |
| 311 | retVal = eSIR_CFG_INVALID_ID; |
| 312 | return retVal; |
| 313 | } |
| 314 | |
| 315 | control = pMac->cfg.gCfgEntry[cfgId].control; |
| 316 | index = control & CFG_BUF_INDX_MASK; |
| 317 | retVal = eSIR_SUCCESS; |
| 318 | |
| 319 | #if (WNI_POLARIS_FW_PRODUCT == AP) |
| 320 | if (index >= CFG_AP_IBUF_MAX_SIZE) |
| 321 | #else |
| 322 | if (index >= CFG_STA_IBUF_MAX_SIZE) |
| 323 | #endif |
| 324 | { |
| 325 | PELOGE(cfgLog(pMac, LOGE, FL("cfg index out of bounds %d\n"), index);) |
| 326 | retVal = eSIR_CFG_INVALID_ID; |
| 327 | return retVal; |
| 328 | } |
| 329 | |
| 330 | // Check if parameter is valid |
| 331 | if ((control & CFG_CTL_VALID) == 0) |
| 332 | { |
| 333 | PELOGE(cfgLog(pMac, LOGE, FL("Not valid cfg id %d\n"), cfgId);) |
| 334 | retVal = eSIR_CFG_INVALID_ID; |
| 335 | } |
| 336 | else { |
| 337 | // Get integer value |
| 338 | if(index < CFG_AP_IBUF_MAX_SIZE) |
| 339 | *pValue = pMac->cfg.gCfgIBuf[index]; |
| 340 | } |
| 341 | |
| 342 | return (retVal); |
| 343 | |
| 344 | } /*** end wlan_cfgGetInt() ***/ |
| 345 | |
| 346 | #ifdef NOT_CURRENTLY_USED |
| 347 | // --------------------------------------------------------------------- |
| 348 | /** |
| 349 | * cfgIncrementInt() |
| 350 | * |
| 351 | * FUNCTION: |
| 352 | * This function is called to increment an integer parameter by n. |
| 353 | * |
| 354 | * LOGIC: |
| 355 | * |
| 356 | * ASSUMPTIONS: |
| 357 | * - No range checking will be performed. |
| 358 | * - Host RW permission should be checked prior to calling this |
| 359 | * function. |
| 360 | * |
| 361 | * NOTE: |
| 362 | * |
| 363 | * @param cfgId: 16-bit CFG parameter ID |
| 364 | * @param value: increment value |
| 365 | * |
| 366 | * @return eSIR_SUCCESS: request completed successfully |
| 367 | * @return eSIR_CFG_INVALID_ID: invalid CFG parameter ID |
| 368 | */ |
| 369 | |
| 370 | tSirRetStatus |
| 371 | cfgIncrementInt(tpAniSirGlobal pMac, tANI_U16 cfgId, tANI_U32 value) |
| 372 | { |
| 373 | tANI_U32 index; |
| 374 | tANI_U32 control; |
| 375 | tSirRetStatus retVal; |
| 376 | |
| 377 | if (cfgId >= CFG_PARAM_MAX_NUM) |
| 378 | { |
| 379 | PELOGE(cfgLog(pMac, LOGE, FL("Invalid cfg id %d\n"), cfgId);) |
| 380 | retVal = eSIR_CFG_INVALID_ID; |
| 381 | } |
| 382 | |
| 383 | control = pMac->cfg.gCfgEntry[cfgId].control; |
| 384 | index = control & CFG_BUF_INDX_MASK; |
| 385 | retVal = eSIR_SUCCESS; |
| 386 | |
| 387 | // Check if parameter is valid |
| 388 | if ((control & CFG_CTL_VALID) == 0) |
| 389 | { |
| 390 | PELOGE(cfgLog(pMac, LOGE, FL("Not valid cfg id %d\n"), cfgId);) |
| 391 | retVal = eSIR_CFG_INVALID_ID; |
| 392 | } |
| 393 | else |
| 394 | { |
| 395 | // Increment integer value |
| 396 | pMac->cfg.gCfgIBuf[index] += value; |
| 397 | |
| 398 | } |
| 399 | |
| 400 | return (retVal); |
| 401 | } |
| 402 | #endif // NOT_CURRENTLY_USED |
| 403 | |
| 404 | // --------------------------------------------------------------------- |
| 405 | /** |
| 406 | * cfgSetStr() |
| 407 | * |
| 408 | * FUNCTION: |
| 409 | * This function is called to set a string parameter. |
| 410 | * |
| 411 | * LOGIC: |
| 412 | * This function invokes the cfgSetStrNotify function passing the notify |
| 413 | * boolean value set to TRUE. This basically means that HAL needs to be |
| 414 | * notified. This is true in the case of non-integrated SOC's or Libra/Volans. |
| 415 | * In the case of Prima the cfgSetStrNotify is invoked with the boolean value |
| 416 | * set to FALSE. |
| 417 | * |
| 418 | * ASSUMPTIONS: |
| 419 | * - always Notify has to be called |
| 420 | * |
| 421 | * NOTE: |
| 422 | * |
| 423 | * @param cfgId: 16-bit CFG parameter ID |
| 424 | * @param pStr: address of string data |
| 425 | * @param len: string length |
| 426 | * |
| 427 | * @return eSIR_SUCCESS: request completed successfully |
| 428 | * @return eSIR_CFG_INVALID_ID: invalid CFG parameter ID |
| 429 | * @return eSIR_CFG_INVALID_LEN: invalid parameter length |
| 430 | * |
| 431 | */ |
| 432 | |
| 433 | tSirRetStatus cfgSetStr(tpAniSirGlobal pMac, tANI_U16 cfgId, tANI_U8 *pStr, |
| 434 | tANI_U32 length) |
| 435 | { |
| 436 | return cfgSetStrNotify( pMac, cfgId, pStr, length, TRUE ); |
| 437 | } |
| 438 | |
| 439 | // --------------------------------------------------------------------- |
| 440 | /** |
| 441 | * cfgSetStrNotify() |
| 442 | * |
| 443 | * FUNCTION: |
| 444 | * This function is called to set a string parameter. |
| 445 | * |
| 446 | * LOGIC: |
| 447 | * |
| 448 | * ASSUMPTIONS: |
| 449 | * - No length checking will be performed. Should be done by calling |
| 450 | * module. |
| 451 | * - Host RW permission should be checked prior to calling this |
| 452 | * function. |
| 453 | * |
| 454 | * NOTE: |
| 455 | * |
| 456 | * @param cfgId: 16-bit CFG parameter ID |
| 457 | * @param pStr: address of string data |
| 458 | * @param len: string length |
| 459 | * @param notifyMod. Notify respective Module |
| 460 | * |
| 461 | * @return eSIR_SUCCESS: request completed successfully |
| 462 | * @return eSIR_CFG_INVALID_ID: invalid CFG parameter ID |
| 463 | * @return eSIR_CFG_INVALID_LEN: invalid parameter length |
| 464 | * |
| 465 | */ |
| 466 | |
| 467 | tSirRetStatus |
| 468 | cfgSetStrNotify(tpAniSirGlobal pMac, tANI_U16 cfgId, tANI_U8 *pStr, |
| 469 | tANI_U32 length, int notifyMod) |
| 470 | { |
| 471 | tANI_U8 *pDst, *pDstEnd; |
| 472 | tANI_U32 index, paramLen, control, mask; |
| 473 | tSirRetStatus retVal; |
| 474 | |
| 475 | if (cfgId >= CFG_PARAM_MAX_NUM) |
| 476 | { |
| 477 | PELOGE(cfgLog(pMac, LOGE, FL("Invalid cfg id %d\n"), cfgId);) |
| 478 | return eSIR_CFG_INVALID_ID; |
| 479 | } |
| 480 | |
| 481 | control = pMac->cfg.gCfgEntry[cfgId].control; |
| 482 | index = control & CFG_BUF_INDX_MASK; |
| 483 | retVal = eSIR_SUCCESS; |
| 484 | |
| 485 | // Check if parameter is valid |
| 486 | if ((control & CFG_CTL_VALID) == 0) |
| 487 | { |
| 488 | PELOGE(cfgLog(pMac, LOGE, FL("Invalid cfg id %d\n"), cfgId);) |
| 489 | retVal = eSIR_CFG_INVALID_ID; |
| 490 | } |
| 491 | else if (index >= CFG_STA_SBUF_MAX_SIZE) |
| 492 | { |
| 493 | PELOGE(cfgLog(pMac, LOGE, FL("Invalid Sbuf index %d (max size %d)\n"), |
| 494 | index, CFG_STA_SBUF_MAX_SIZE);) |
| 495 | retVal = eSIR_CFG_INVALID_ID; |
| 496 | } |
| 497 | else |
| 498 | { |
| 499 | pDst = &pMac->cfg.gCfgSBuf[index]; |
| 500 | paramLen = *pDst++; |
| 501 | if (length > paramLen) |
| 502 | { |
| 503 | PELOGE(cfgLog(pMac, LOGE, FL("Invalid length %d (>%d) cfg id %d\n"), |
| 504 | length, paramLen, cfgId);) |
| 505 | retVal = eSIR_CFG_INVALID_LEN; |
| 506 | } |
| 507 | else |
| 508 | { |
| 509 | *pDst++ = (tANI_U8)length; |
| 510 | pDstEnd = pDst + length; |
| 511 | while (pDst < pDstEnd) |
| 512 | { |
| 513 | *pDst++ = *pStr++; |
| 514 | } |
| 515 | |
| 516 | if(notifyMod) |
| 517 | { |
| 518 | // Update hardware if necessary |
| 519 | mask = control & CFG_CTL_NTF_MASK; |
| 520 | if ((mask & CFG_CTL_NTF_HW) != 0) |
| 521 | { |
| 522 | PELOGE(cfgLog(pMac, LOGE, FL("CFG Notify HW not supported!!!\n"));) |
| 523 | } |
| 524 | |
| 525 | // Notify other modules if necessary |
| 526 | if ( (mask & CFG_CTL_NTF_MASK) != 0) |
| 527 | { |
| 528 | Notify(pMac, cfgId, mask); |
| 529 | } |
| 530 | } |
| 531 | } |
| 532 | |
| 533 | } |
| 534 | |
| 535 | return (retVal); |
| 536 | |
| 537 | } /*** end cfgSetStrNotify() ***/ |
| 538 | |
| 539 | // --------------------------------------------------------------------- |
| 540 | /** |
| 541 | * wlan_cfgGetStr() |
| 542 | * |
| 543 | * FUNCTION: |
| 544 | * This function is called to get a string parameter. |
| 545 | * |
| 546 | * LOGIC: |
| 547 | * |
| 548 | * ASSUMPTIONS: |
| 549 | * - Host RW permission should be checked prior to calling this |
| 550 | * function. |
| 551 | * |
| 552 | * NOTE: |
| 553 | * |
| 554 | * @param cfgId: 16-bit CFG parameter ID |
| 555 | * @param pBuf: address of string buffer |
| 556 | * @param pLen: address of max buffer length |
| 557 | * actual length will be returned at this address |
| 558 | * |
| 559 | * @return eSIR_SUCCESS: request completed successfully |
| 560 | * @return eSIR_CFG_INVALID_ID: invalid CFG parameter ID |
| 561 | * @return eSIR_CFG_INVALID_LEN: invalid parameter length |
| 562 | * |
| 563 | */ |
| 564 | |
| 565 | tSirRetStatus |
| 566 | wlan_cfgGetStr(tpAniSirGlobal pMac, tANI_U16 cfgId, tANI_U8 *pBuf, tANI_U32 *pLength) |
| 567 | { |
| 568 | tANI_U8 *pSrc, *pSrcEnd; |
| 569 | tANI_U32 index, control; |
| 570 | tSirRetStatus retVal; |
| 571 | |
| 572 | if (cfgId >= CFG_PARAM_MAX_NUM) |
| 573 | { |
| 574 | PELOGE(cfgLog(pMac, LOGE, FL("Invalid cfg id %d\n"), cfgId);) |
| 575 | retVal = eSIR_CFG_INVALID_ID; |
| 576 | return retVal; |
| 577 | } |
| 578 | |
| 579 | control = pMac->cfg.gCfgEntry[cfgId].control; |
| 580 | index = control & CFG_BUF_INDX_MASK; |
| 581 | retVal = eSIR_SUCCESS; |
| 582 | |
| 583 | #if (WNI_POLARIS_FW_PRODUCT == AP) |
| 584 | if (index >= CFG_AP_SBUF_MAX_SIZE) |
| 585 | #else |
| 586 | if (index >= CFG_STA_SBUF_MAX_SIZE) |
| 587 | #endif |
| 588 | { |
| 589 | PELOGE(cfgLog(pMac, LOGE, FL("cfg index out of bounds %d\n"), index);) |
| 590 | retVal = eSIR_CFG_INVALID_ID; |
| 591 | return retVal; |
| 592 | } |
| 593 | |
| 594 | // Check if parameter is valid |
| 595 | if ((control & CFG_CTL_VALID) == 0) |
| 596 | { |
| 597 | PELOGE(cfgLog(pMac, LOGE, FL("Not valid cfg id %d\n"), cfgId);) |
| 598 | retVal = eSIR_CFG_INVALID_ID; |
| 599 | } |
| 600 | else |
| 601 | { |
| 602 | // Get string |
| 603 | pSrc = &pMac->cfg.gCfgSBuf[index]; |
| 604 | pSrc++; // skip over max length |
| 605 | if (*pLength < *pSrc) |
| 606 | { |
| 607 | PELOGE(cfgLog(pMac, LOGE, FL("Invalid length %d (<%d) cfg id %d\n"), |
| 608 | *pLength, *pSrc, cfgId);) |
| 609 | retVal = eSIR_CFG_INVALID_LEN; |
| 610 | } |
| 611 | else |
| 612 | { |
| 613 | *pLength = *pSrc++; // save parameter length |
| 614 | pSrcEnd = pSrc + *pLength; |
| 615 | while (pSrc < pSrcEnd) |
| 616 | *pBuf++ = *pSrc++; |
| 617 | } |
| 618 | } |
| 619 | |
| 620 | return (retVal); |
| 621 | |
| 622 | } /*** end wlan_cfgGetStr() ***/ |
| 623 | |
| 624 | // --------------------------------------------------------------------- |
| 625 | /** |
| 626 | * wlan_cfgGetStrMaxLen() |
| 627 | * |
| 628 | * FUNCTION: |
| 629 | * This function is called to get a string maximum length. |
| 630 | * |
| 631 | * LOGIC: |
| 632 | * |
| 633 | * ASSUMPTIONS: |
| 634 | * - Host RW permission should be checked prior to calling this |
| 635 | * function. |
| 636 | * |
| 637 | * NOTE: |
| 638 | * |
| 639 | * @param cfgId: 16-bit CFG parameter ID |
| 640 | * @param pLen: maximum length will be returned at this address |
| 641 | * |
| 642 | * @return eSIR_SUCCESS: request completed successfully |
| 643 | * @return eSIR_CFG_INVALID_ID: invalid CFG parameter ID |
| 644 | * |
| 645 | */ |
| 646 | |
| 647 | tSirRetStatus |
| 648 | wlan_cfgGetStrMaxLen(tpAniSirGlobal pMac, tANI_U16 cfgId, tANI_U32 *pLength) |
| 649 | { |
| 650 | tANI_U32 index, control; |
| 651 | tSirRetStatus retVal; |
| 652 | |
| 653 | if (cfgId >= CFG_PARAM_MAX_NUM) |
| 654 | { |
| 655 | PELOGE(cfgLog(pMac, LOGE, FL("Invalid cfg id %d\n"), cfgId);) |
| 656 | retVal = eSIR_CFG_INVALID_ID; |
| 657 | } |
| 658 | |
| 659 | control = pMac->cfg.gCfgEntry[cfgId].control; |
| 660 | index = control & CFG_BUF_INDX_MASK; |
| 661 | retVal = eSIR_SUCCESS; |
| 662 | |
| 663 | #if (WNI_POLARIS_FW_PRODUCT == AP) |
| 664 | if (index >= CFG_AP_SBUF_MAX_SIZE) |
| 665 | #else |
| 666 | if (index >= CFG_STA_SBUF_MAX_SIZE) |
| 667 | #endif |
| 668 | { |
| 669 | PELOGE(cfgLog(pMac, LOGE, FL("cfg index out of bounds %d\n"), index);) |
| 670 | retVal = eSIR_CFG_INVALID_ID; |
| 671 | return retVal; |
| 672 | } |
| 673 | |
| 674 | // Check if parameter is valid |
| 675 | if ((control & CFG_CTL_VALID) == 0) |
| 676 | { |
| 677 | PELOGE(cfgLog(pMac, LOGE, FL("Not valid cfg id %d\n"), cfgId);) |
| 678 | retVal = eSIR_CFG_INVALID_ID; |
| 679 | } |
| 680 | else |
| 681 | { |
| 682 | *pLength = pMac->cfg.gCfgSBuf[index]; |
| 683 | } |
| 684 | |
| 685 | return (retVal); |
| 686 | |
| 687 | } /*** end wlan_cfgGetStrMaxLen() ***/ |
| 688 | |
| 689 | // --------------------------------------------------------------------- |
| 690 | /** |
| 691 | * wlan_cfgGetStrLen() |
| 692 | * |
| 693 | * FUNCTION: |
| 694 | * This function is called to get a string length. |
| 695 | * |
| 696 | * LOGIC: |
| 697 | * |
| 698 | * ASSUMPTIONS: |
| 699 | * - Host RW permission should be checked prior to calling this |
| 700 | * function. |
| 701 | * |
| 702 | * NOTE: |
| 703 | * |
| 704 | * @param cfgId: 16-bit CFG parameter ID |
| 705 | * @param pLen: current length will be returned at this address |
| 706 | * |
| 707 | * @return eSIR_SUCCESS: request completed successfully |
| 708 | * @return eSIR_CFG_INVALID_ID: invalid CFG parameter ID |
| 709 | * |
| 710 | */ |
| 711 | |
| 712 | tSirRetStatus |
| 713 | wlan_cfgGetStrLen(tpAniSirGlobal pMac, tANI_U16 cfgId, tANI_U32 *pLength) |
| 714 | { |
| 715 | tANI_U32 index, control; |
| 716 | tSirRetStatus retVal; |
| 717 | |
| 718 | if (cfgId >= CFG_PARAM_MAX_NUM) |
| 719 | { |
| 720 | PELOGE(cfgLog(pMac, LOGE, FL("Invalid cfg id %d\n"), cfgId);) |
| 721 | retVal = eSIR_CFG_INVALID_ID; |
| 722 | } |
| 723 | |
| 724 | control = pMac->cfg.gCfgEntry[cfgId].control; |
| 725 | index = control & CFG_BUF_INDX_MASK; |
| 726 | retVal = eSIR_SUCCESS; |
| 727 | |
| 728 | #if (WNI_POLARIS_FW_PRODUCT == AP) |
| 729 | if (index >= CFG_AP_SBUF_MAX_SIZE-1) |
| 730 | #else |
| 731 | if (index >= CFG_STA_SBUF_MAX_SIZE-1) |
| 732 | #endif |
| 733 | { |
| 734 | PELOGE(cfgLog(pMac, LOGE, FL("cfg index out of bounds %d\n"), index);) |
| 735 | retVal = eSIR_CFG_INVALID_ID; |
| 736 | return retVal; |
| 737 | } |
| 738 | |
| 739 | // Check if parameter is valid |
| 740 | if ((control & CFG_CTL_VALID) == 0) |
| 741 | { |
| 742 | PELOGE(cfgLog(pMac, LOGE, FL("Not valid cfg id %d\n"), cfgId);) |
| 743 | retVal = eSIR_CFG_INVALID_ID; |
| 744 | } |
| 745 | else |
| 746 | { |
| 747 | *pLength = pMac->cfg.gCfgSBuf[index+1]; |
| 748 | } |
| 749 | |
| 750 | return (retVal); |
| 751 | |
| 752 | } /*** end wlan_cfgGetStrLen() ***/ |
| 753 | |
| 754 | |
| 755 | |
| 756 | /*------------------------------------------------------------- |
| 757 | \fn cfgGetDot11dTransmitPower |
| 758 | \brief This function returns the regulatory max transmit power |
| 759 | \param pMac |
| 760 | \return tPowerdBm - Power |
| 761 | \-------------------------------------------------------------*/ |
| 762 | static tPowerdBm |
| 763 | cfgGetDot11dTransmitPower(tpAniSirGlobal pMac, tANI_U16 cfgId, |
| 764 | tANI_U32 cfgLength, tANI_U8 channel) |
| 765 | { |
| 766 | tANI_U8 *pCountryInfo = NULL; |
| 767 | tANI_U8 count = 0; |
| 768 | tPowerdBm maxTxPwr = WDA_MAX_TXPOWER_INVALID; |
| 769 | eHalStatus status; |
| 770 | |
| 771 | /* At least one element is present */ |
| 772 | if(cfgLength < sizeof(tSirMacChanInfo)) |
| 773 | { |
| 774 | PELOGE(cfgLog(pMac, LOGE, FL("Invalid CFGLENGTH %d while getting 11d txpower"), cfgLength);) |
| 775 | goto error; |
| 776 | } |
| 777 | |
| 778 | status = palAllocateMemory(pMac->hHdd, (void **)&pCountryInfo, cfgLength); |
| 779 | if (status != eHAL_STATUS_SUCCESS) |
| 780 | { |
| 781 | cfgLog(pMac, LOGP, FL(" palAllocateMemory() failed, status = %d"), status); |
| 782 | goto error; |
| 783 | } |
| 784 | /* The CSR will always update this CFG. The contents will be from country IE if regulatory domain |
| 785 | * is enabled on AP else will contain EEPROM contents |
| 786 | */ |
| 787 | if (wlan_cfgGetStr(pMac, cfgId, pCountryInfo, &cfgLength) != eSIR_SUCCESS) |
| 788 | { |
| 789 | palFreeMemory(pMac->hHdd, pCountryInfo); |
| 790 | pCountryInfo = NULL; |
| 791 | |
| 792 | cfgLog(pMac, LOGP, FL("Failed to retrieve 11d configuration parameters while retrieving 11d tuples")); |
| 793 | goto error; |
| 794 | } |
| 795 | /* Identify the channel and maxtxpower */ |
| 796 | while(count <= (cfgLength - (sizeof(tSirMacChanInfo)))) |
| 797 | { |
| 798 | tANI_U8 firstChannel, maxChannels; |
| 799 | |
| 800 | firstChannel = pCountryInfo[count++]; |
| 801 | maxChannels = pCountryInfo[count++]; |
| 802 | maxTxPwr = pCountryInfo[count++]; |
| 803 | |
| 804 | if((channel >= firstChannel) && |
| 805 | (channel < (firstChannel + maxChannels))) |
| 806 | { |
| 807 | break; |
| 808 | } |
| 809 | } |
| 810 | |
| 811 | error: |
| 812 | if(NULL != pCountryInfo) |
| 813 | palFreeMemory(pMac->hHdd, pCountryInfo); |
| 814 | |
| 815 | return maxTxPwr; |
| 816 | } |
| 817 | |
| 818 | |
| 819 | /**---------------------------------------------------------------------- |
| 820 | \fn cfgGetRegulatoryMaxTransmitPower |
| 821 | |
| 822 | \brief Gets regulatory tx power on the current channel. |
| 823 | |
| 824 | \param pMac |
| 825 | \param channel |
| 826 | \param rfBand |
| 827 | -----------------------------------------------------------------------*/ |
| 828 | tPowerdBm cfgGetRegulatoryMaxTransmitPower(tpAniSirGlobal pMac, tANI_U8 channel) |
| 829 | { |
| 830 | tANI_U32 cfgLength = 0; |
| 831 | tANI_U16 cfgId = 0; |
| 832 | tPowerdBm maxTxPwr; |
| 833 | eRfBandMode rfBand = eRF_BAND_UNKNOWN; |
| 834 | |
| 835 | if ((channel >= SIR_11A_CHANNEL_BEGIN) && |
| 836 | (channel <= SIR_11A_CHANNEL_END)) |
| 837 | rfBand = eRF_BAND_5_GHZ; |
| 838 | else |
| 839 | rfBand = eRF_BAND_2_4_GHZ; |
| 840 | |
| 841 | |
| 842 | /* Get the max transmit power for current channel for the current regulatory domain */ |
| 843 | switch (rfBand) |
| 844 | { |
| 845 | case eRF_BAND_2_4_GHZ: |
| 846 | cfgId = WNI_CFG_MAX_TX_POWER_2_4; |
| 847 | cfgLength = WNI_CFG_MAX_TX_POWER_2_4_LEN; |
| 848 | PELOG2(cfgLog(pMac, LOG2, FL("HAL: Reading CFG for 2.4 GHz channels to get regulatory max tx power"));) |
| 849 | break; |
| 850 | |
| 851 | case eRF_BAND_5_GHZ: |
| 852 | cfgId = WNI_CFG_MAX_TX_POWER_5; |
| 853 | cfgLength = WNI_CFG_MAX_TX_POWER_5_LEN; |
| 854 | PELOG2(cfgLog(pMac, LOG2, FL("HAL: Reading CFG for 5.0 GHz channels to get regulatory max tx power"));) |
| 855 | break; |
| 856 | |
| 857 | case eRF_BAND_UNKNOWN: |
| 858 | default: |
| 859 | PELOG2(cfgLog(pMac, LOG2, FL("HAL: Invalid current working band for the device"));) |
| 860 | return WDA_MAX_TXPOWER_INVALID; //Its return, not break. |
| 861 | } |
| 862 | |
| 863 | maxTxPwr = cfgGetDot11dTransmitPower(pMac, cfgId, cfgLength, channel); |
| 864 | |
| 865 | return (maxTxPwr); |
| 866 | } |
| 867 | |
| 868 | // --------------------------------------------------------------------- |
| 869 | /** |
| 870 | * cfgGetCapabilityInfo |
| 871 | * |
| 872 | * FUNCTION: |
| 873 | * |
| 874 | * LOGIC: |
| 875 | * |
| 876 | * ASSUMPTIONS: |
| 877 | * |
| 878 | * NOTE: |
| 879 | * |
| 880 | * @param None |
| 881 | * @return None |
| 882 | */ |
| 883 | |
| 884 | tSirRetStatus |
| 885 | cfgGetCapabilityInfo(tpAniSirGlobal pMac, tANI_U16 *pCap,tpPESession sessionEntry) |
| 886 | { |
| 887 | tANI_U32 val = 0; |
| 888 | tpSirMacCapabilityInfo pCapInfo; |
| 889 | tLimSystemRole systemRole = limGetSystemRole(sessionEntry); |
| 890 | |
| 891 | *pCap = 0; |
| 892 | pCapInfo = (tpSirMacCapabilityInfo) pCap; |
| 893 | |
| 894 | if (systemRole == eLIM_STA_IN_IBSS_ROLE) |
| 895 | pCapInfo->ibss = 1; // IBSS bit |
| 896 | else if ( (systemRole == eLIM_AP_ROLE) ||(systemRole == eLIM_BT_AMP_AP_ROLE)||(systemRole == eLIM_BT_AMP_STA_ROLE) || |
| 897 | (systemRole == eLIM_STA_ROLE) ) |
| 898 | pCapInfo->ess = 1; // ESS bit |
| 899 | #if defined WLAN_FEATURE_P2P |
| 900 | else if (limGetSystemRole(sessionEntry) == eLIM_P2P_DEVICE_ROLE ) |
| 901 | { |
| 902 | pCapInfo->ess = 0; |
| 903 | pCapInfo->ibss = 0; |
| 904 | } |
| 905 | #endif |
| 906 | else |
| 907 | cfgLog(pMac, LOGP, FL("can't get capability, role is UNKNOWN!!\n")); |
| 908 | |
| 909 | #if (WNI_POLARIS_FW_PRODUCT == AP) |
| 910 | if( (systemRole == eLIM_AP_ROLE) ) |
| 911 | { |
| 912 | // CF-pollable bit |
| 913 | if (wlan_cfgGetInt(pMac, WNI_CFG_CF_POLLABLE, &val) != eSIR_SUCCESS) |
| 914 | { |
| 915 | cfgLog(pMac, LOGP, FL("cfg get WNI_CFG_CF_POLLABLE failed\n")); |
| 916 | return eSIR_FAILURE; |
| 917 | } |
| 918 | if (val) |
| 919 | pCapInfo->cfPollable = 1; |
| 920 | |
| 921 | // CF-poll request bit |
| 922 | if (wlan_cfgGetInt(pMac, WNI_CFG_CF_POLL_REQUEST, &val) != eSIR_SUCCESS) |
| 923 | { |
| 924 | cfgLog(pMac, LOGP, FL("cfg get WNI_CFG_CF_POLL_REQUEST failed\n")); |
| 925 | return eSIR_FAILURE; |
| 926 | } |
| 927 | if (val) |
| 928 | pCapInfo->cfPollReq = 1; |
| 929 | } |
| 930 | #endif |
| 931 | |
| 932 | #ifdef WLAN_SOFTAP_FEATURE |
| 933 | if(systemRole == eLIM_AP_ROLE) |
| 934 | { |
| 935 | val = sessionEntry->privacy; |
| 936 | } |
| 937 | else |
| 938 | { |
| 939 | #endif |
| 940 | // PRIVACY bit |
| 941 | if (wlan_cfgGetInt(pMac, WNI_CFG_PRIVACY_ENABLED, &val) != eSIR_SUCCESS) |
| 942 | { |
| 943 | cfgLog(pMac, LOGP, FL("cfg get WNI_CFG_PRIVACY_ENABLED failed\n")); |
| 944 | return eSIR_FAILURE; |
| 945 | } |
| 946 | #ifdef WLAN_SOFTAP_FEATURE |
| 947 | } |
| 948 | #endif |
| 949 | if (val) |
| 950 | pCapInfo->privacy = 1; |
| 951 | |
| 952 | // Short preamble bit |
| 953 | if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_PREAMBLE, &val) != eSIR_SUCCESS) |
| 954 | { |
| 955 | cfgLog(pMac, LOGP, FL("cfg get WNI_CFG_SHORT_PREAMBLE failed\n")); |
| 956 | return eSIR_FAILURE; |
| 957 | } |
| 958 | if (val) |
| 959 | pCapInfo->shortPreamble = 1; |
| 960 | |
| 961 | |
| 962 | // PBCC bit |
| 963 | pCapInfo->pbcc = 0; |
| 964 | |
| 965 | // Channel agility bit |
| 966 | pCapInfo->channelAgility = 0; |
| 967 | //If STA/AP operating in 11B mode, don't set rest of the capability info bits. |
| 968 | if(sessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11B) |
| 969 | return eSIR_SUCCESS; |
| 970 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 971 | // Short slot time bit |
| 972 | if (systemRole == eLIM_AP_ROLE) |
| 973 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 974 | pCapInfo->shortSlotTime = sessionEntry->shortSlotTimeSupported; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 975 | } |
| 976 | else |
| 977 | { |
| 978 | if (wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val) |
| 979 | != eSIR_SUCCESS) |
| 980 | { |
| 981 | cfgLog(pMac, LOGP, |
| 982 | FL("cfg get WNI_CFG_11G_SHORT_SLOT_TIME failed\n")); |
| 983 | return eSIR_FAILURE; |
| 984 | } |
| 985 | /* When in STA mode, we need to check if short slot is enabled as well as check if the current operating |
| 986 | * mode is short slot time and then decide whether to enable short slot or not. It is safe to check both |
| 987 | * cfg values to determine short slot value in this funcn since this funcn is always used after assoc when |
| 988 | * these cfg values are already set based on peer's capability. Even in case of IBSS, its value is set to |
| 989 | * correct value either in delBSS as part of deleting the previous IBSS or in start BSS as part of coalescing |
| 990 | */ |
| 991 | if (val) |
| 992 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 993 | pCapInfo->shortSlotTime = sessionEntry->shortSlotTimeSupported; |
| 994 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 995 | } |
| 996 | |
| 997 | // Spectrum Management bit |
| 998 | if((eLIM_STA_IN_IBSS_ROLE != systemRole) && |
| 999 | sessionEntry->lim11hEnable ) |
| 1000 | { |
| 1001 | if (wlan_cfgGetInt(pMac, WNI_CFG_11H_ENABLED, &val) != eSIR_SUCCESS) |
| 1002 | { |
| 1003 | cfgLog(pMac, LOGP, FL("cfg get WNI_CFG_11H_ENABLED failed\n")); |
| 1004 | return eSIR_FAILURE; |
| 1005 | } |
| 1006 | if (val) |
| 1007 | pCapInfo->spectrumMgt = 1; |
| 1008 | } |
| 1009 | |
| 1010 | // QoS bit |
| 1011 | if (wlan_cfgGetInt(pMac, WNI_CFG_QOS_ENABLED, &val) != eSIR_SUCCESS) |
| 1012 | { |
| 1013 | cfgLog(pMac, LOGP, FL("cfg get WNI_CFG_QOS_ENABLED failed\n")); |
| 1014 | return eSIR_FAILURE; |
| 1015 | } |
| 1016 | if (val) |
| 1017 | pCapInfo->qos = 1; |
| 1018 | |
| 1019 | // APSD bit |
| 1020 | if (wlan_cfgGetInt(pMac, WNI_CFG_APSD_ENABLED, &val) != eSIR_SUCCESS) |
| 1021 | { |
| 1022 | cfgLog(pMac, LOGP, FL("cfg get WNI_CFG_APSD_ENABLED failed\n")); |
| 1023 | return eSIR_FAILURE; |
| 1024 | } |
| 1025 | if (val) |
| 1026 | pCapInfo->apsd = 1; |
| 1027 | |
| 1028 | #if defined WLAN_FEATURE_VOWIFI |
| 1029 | if ((limGetSystemRole(sessionEntry) == eLIM_STA_ROLE) ) |
| 1030 | { |
| 1031 | if (wlan_cfgGetInt(pMac, WNI_CFG_RRM_ENABLED, &val) != eSIR_SUCCESS) |
| 1032 | { |
| 1033 | cfgLog(pMac, LOGP, FL("cfg get WNI_CFG_RRM_ENABLED failed\n")); |
| 1034 | return eSIR_FAILURE; |
| 1035 | } |
| 1036 | #if defined WLAN_VOWIFI_DEBUG |
| 1037 | PELOGE(cfgLog( pMac, LOGE, "RRM = %d\n",val );) |
| 1038 | #endif |
| 1039 | if (val) |
| 1040 | pCapInfo->rrm = 1; |
| 1041 | } |
| 1042 | #endif |
| 1043 | //DSSS-OFDM |
| 1044 | //FIXME : no config defined yet. |
| 1045 | |
| 1046 | // Block ack bit |
| 1047 | if (wlan_cfgGetInt(pMac, WNI_CFG_BLOCK_ACK_ENABLED, &val) != eSIR_SUCCESS) |
| 1048 | { |
| 1049 | cfgLog(pMac, LOGP, FL("cfg get WNI_CFG_BLOCK_ACK_ENABLED failed\n")); |
| 1050 | return eSIR_FAILURE; |
| 1051 | } |
| 1052 | pCapInfo->delayedBA = (tANI_U16)((val >> WNI_CFG_BLOCK_ACK_ENABLED_DELAYED) & 1); |
| 1053 | pCapInfo->immediateBA = (tANI_U16)((val >> WNI_CFG_BLOCK_ACK_ENABLED_IMMEDIATE) & 1); |
| 1054 | |
| 1055 | return eSIR_SUCCESS; |
| 1056 | } |
| 1057 | |
| 1058 | // -------------------------------------------------------------------- |
| 1059 | /** |
| 1060 | * cfgSetCapabilityInfo |
| 1061 | * |
| 1062 | * FUNCTION: |
| 1063 | * This function is called on BP based on the capabilities |
| 1064 | * received in SME_JOIN/REASSOC_REQ message. |
| 1065 | * |
| 1066 | * LOGIC: |
| 1067 | * |
| 1068 | * ASSUMPTIONS: |
| 1069 | * |
| 1070 | * NOTE: 1. ESS/IBSS capabilities are based on system role. |
| 1071 | * 2. Since PBCC, Channel agility and Extended capabilities |
| 1072 | * are not supported, they're not set at CFG |
| 1073 | * |
| 1074 | * @param pMac Pointer to global MAC structure |
| 1075 | * @param caps 16-bit Capability Info field |
| 1076 | * @return None |
| 1077 | */ |
| 1078 | |
| 1079 | void |
| 1080 | cfgSetCapabilityInfo(tpAniSirGlobal pMac, tANI_U16 caps) |
| 1081 | { |
| 1082 | #if (defined(ANI_PRODUCT_TYPE_AP)) |
| 1083 | |
| 1084 | if (cfgSetInt(pMac, WNI_CFG_PRIVACY_ENABLED, |
| 1085 | SIR_MAC_GET_PRIVACY(caps)) != eSIR_SUCCESS) |
| 1086 | cfgLog(pMac, LOGP, FL("could not set privacy at CFG\n")); |
| 1087 | |
| 1088 | if (cfgSetInt(pMac, WNI_CFG_SHORT_PREAMBLE, |
| 1089 | SIR_MAC_GET_SHORT_PREAMBLE(caps)) != eSIR_SUCCESS) |
| 1090 | cfgLog(pMac, LOGP, FL("could not set short preamble at CFG\n")); |
| 1091 | |
| 1092 | if (cfgSetInt(pMac, WNI_CFG_QOS_ENABLED, |
| 1093 | SIR_MAC_GET_QOS(caps)) != eSIR_SUCCESS) |
| 1094 | cfgLog(pMac, LOGP, FL("could not set qos at CFG\n")); |
| 1095 | |
| 1096 | if (cfgSetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, |
| 1097 | SIR_MAC_GET_SHORT_SLOT_TIME(caps)) != eSIR_SUCCESS) |
| 1098 | cfgLog(pMac, LOGP, FL("could not set short slot time at CFG\n")); |
| 1099 | |
| 1100 | if (cfgSetInt(pMac, WNI_CFG_APSD_ENABLED, |
| 1101 | SIR_MAC_GET_APSD(caps)) != eSIR_SUCCESS) |
| 1102 | cfgLog(pMac, LOGP, FL("could not set apsd at CFG\n")); |
| 1103 | |
| 1104 | if (cfgSetInt(pMac, WNI_CFG_BLOCK_ACK_ENABLED, |
| 1105 | SIR_MAC_GET_BLOCK_ACK(caps)) != eSIR_SUCCESS) |
| 1106 | cfgLog(pMac, LOGP, FL("could not set BlockAck at CFG\n")); |
| 1107 | #endif |
| 1108 | } |
| 1109 | |
| 1110 | |
| 1111 | // --------------------------------------------------------------------- |
| 1112 | /** |
| 1113 | * cfgCleanup() |
| 1114 | * |
| 1115 | * FUNCTION: |
| 1116 | * CFG cleanup function. |
| 1117 | * |
| 1118 | * LOGIC: |
| 1119 | * |
| 1120 | * ASSUMPTIONS: |
| 1121 | * None. |
| 1122 | * |
| 1123 | * NOTE: |
| 1124 | * This function must be called during system shutdown. |
| 1125 | * |
| 1126 | * @param None |
| 1127 | * |
| 1128 | * @return None. |
| 1129 | * |
| 1130 | */ |
| 1131 | |
| 1132 | void |
| 1133 | cfgCleanup(tpAniSirGlobal pMac) |
| 1134 | { |
| 1135 | // Set status to not-ready |
| 1136 | pMac->cfg.gCfgStatus = CFG_INCOMPLETE; |
| 1137 | |
| 1138 | } /*** end CfgCleanup() ***/ |
| 1139 | |
| 1140 | // --------------------------------------------------------------------- |
| 1141 | /** |
| 1142 | * Notify() |
| 1143 | * |
| 1144 | * FUNCTION: |
| 1145 | * This function is called to notify other modules of parameter update. |
| 1146 | * |
| 1147 | * LOGIC: |
| 1148 | * |
| 1149 | * ASSUMPTIONS: |
| 1150 | * |
| 1151 | * NOTE: |
| 1152 | * |
| 1153 | * @param cfgId: configuration parameter ID |
| 1154 | * @param mask: notification mask |
| 1155 | * |
| 1156 | * @return None. |
| 1157 | * |
| 1158 | */ |
| 1159 | |
| 1160 | static void |
| 1161 | Notify(tpAniSirGlobal pMac, tANI_U16 cfgId, tANI_U32 ntfMask) |
| 1162 | { |
| 1163 | |
| 1164 | tSirMsgQ mmhMsg; |
| 1165 | |
| 1166 | mmhMsg.type = SIR_CFG_PARAM_UPDATE_IND; |
| 1167 | mmhMsg.bodyval = (tANI_U32)cfgId; |
| 1168 | mmhMsg.bodyptr = NULL; |
| 1169 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1170 | MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1171 | |
| 1172 | if ((ntfMask & CFG_CTL_NTF_SCH) != 0) |
| 1173 | schPostMessage(pMac, &mmhMsg); |
| 1174 | |
| 1175 | if ((ntfMask & CFG_CTL_NTF_LIM) != 0) |
| 1176 | limPostMsgApi(pMac, &mmhMsg); |
| 1177 | |
| 1178 | if ((ntfMask & CFG_CTL_NTF_HAL) != 0) |
| 1179 | wdaPostCtrlMsg(pMac, &mmhMsg); |
| 1180 | |
| 1181 | // Notify ARQ |
| 1182 | |
| 1183 | } /*** end Notify() ***/ |
| 1184 | |
| 1185 | // --------------------------------------------------------------------- |
| 1186 | |
| 1187 | |
| 1188 | |
| 1189 | |
| 1190 | |
| 1191 | |
| 1192 | |