Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 2 | * Copyright (c) 2012, The Linux Foundation. All rights reserved. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | |
| 22 | /*============================================================================ |
| 23 | Copyright (c) 2007 QUALCOMM Incorporated. |
| 24 | All Rights Reserved. |
| 25 | Qualcomm Confidential and Proprietary |
| 26 | |
| 27 | logDump.c |
| 28 | */ |
| 29 | |
| 30 | /* |
| 31 | * Woodside Networks, Inc proprietary. All rights reserved. |
| 32 | * This file contains the utility functions to dump various |
| 33 | * MAC states and to enable/disable certain features during |
| 34 | * debugging. |
| 35 | * Author: Sandesh Goel |
| 36 | * Date: 02/27/02 |
| 37 | * History:- |
| 38 | * 02/11/02 Created. |
| 39 | * -------------------------------------------------------------------- |
| 40 | * |
| 41 | */ |
| 42 | |
| 43 | /* |
| 44 | * @note : Bytes is to print overflow message information. |
| 45 | */ |
| 46 | |
| 47 | #include "palTypes.h" |
| 48 | |
| 49 | #ifdef ANI_LOGDUMP |
| 50 | |
| 51 | #define MAX_OVERFLOW_MSG 400 |
| 52 | #if defined(ANI_OS_TYPE_WINDOWS) |
| 53 | #define MAX_LOGDUMP_SIZE ((4*1024) - MAX_OVERFLOW_MSG) |
| 54 | #else |
| 55 | #define MAX_LOGDUMP_SIZE ((4*1024) - MAX_OVERFLOW_MSG) |
| 56 | #endif |
| 57 | |
| 58 | #ifdef FEATURE_WLAN_NON_INTEGRATED_SOC |
| 59 | #include "halDebug.h" |
| 60 | #include "halInterrupts.h" |
| 61 | #endif |
| 62 | #if defined (ANI_OS_TYPE_LINUX) |
| 63 | |
| 64 | #include <sysDebug.h> |
| 65 | |
| 66 | #elif defined(ANI_OS_TYPE_WINDOWS) |
| 67 | |
| 68 | #include "stdarg.h" |
| 69 | #include "sirTypes.h" |
| 70 | |
| 71 | |
| 72 | #ifdef ANI_DVT_DEBUG |
| 73 | #include "dvtModuleApi.h" |
| 74 | #endif |
| 75 | |
| 76 | #include "pmmApi.h" |
| 77 | #ifdef FEATURE_WLAN_NON_INTEGRATED_SOC |
| 78 | #include "halInternal.h" |
| 79 | #endif |
| 80 | #include "csrApi.h" |
| 81 | |
| 82 | #elif defined(ANI_OS_TYPE_OSX) |
| 83 | |
| 84 | #include "stdarg.h" |
| 85 | |
| 86 | #elif defined(ANI_OS_TYPE_AMSS) |
| 87 | |
| 88 | #include "comdef.h" |
| 89 | #include "string.h" |
| 90 | |
| 91 | #include "AEEstd.h" |
| 92 | |
| 93 | #include "sirTypes.h" |
| 94 | #include "halInterrupts.h" |
| 95 | |
| 96 | #include "pmmApi.h" |
| 97 | #include "halInternal.h" |
| 98 | #include "csrApi.h" |
| 99 | |
| 100 | #elif defined(ANI_OS_TYPE_ANDROID) |
| 101 | |
| 102 | #include <linux/kernel.h> |
| 103 | |
| 104 | #endif |
| 105 | |
| 106 | |
| 107 | #include "palApi.h" |
| 108 | #include "aniGlobal.h" |
| 109 | #include "sirCommon.h" |
| 110 | #include <sirDebug.h> |
| 111 | #include <utilsApi.h> |
| 112 | |
| 113 | #include <limApi.h> |
| 114 | #ifdef FEATURE_WLAN_NON_INTEGRATED_SOC |
| 115 | #include <halCommonApi.h> |
| 116 | #endif |
| 117 | #include <cfgApi.h> |
| 118 | #include <utilsGlobal.h> |
| 119 | #include <dphGlobal.h> |
| 120 | #include <limGlobal.h> |
| 121 | #include "limUtils.h" |
| 122 | #include "schApi.h" |
| 123 | |
| 124 | #include "pmmApi.h" |
| 125 | #include "limSerDesUtils.h" |
| 126 | #ifdef FEATURE_WLAN_NON_INTEGRATED_SOC |
| 127 | #include "halLogDump.h" |
| 128 | //#include "testHalMsgApi.h" |
| 129 | #include "halMailbox.h" |
| 130 | #include "halRxp.h" |
| 131 | #include "halMTU.h" |
| 132 | #include "halPhyApi.h" |
| 133 | #endif |
| 134 | #include "limAssocUtils.h" |
| 135 | #include "limSendMessages.h" |
| 136 | #ifdef FEATURE_WLAN_NON_INTEGRATED_SOC |
| 137 | #include "halUtils.h" |
| 138 | #endif |
| 139 | #include "limSecurityUtils.h" |
| 140 | //#include "halRadar.h" |
| 141 | #include "logDump.h" |
| 142 | #include "sysDebug.h" |
| 143 | #include "wlan_qct_wda.h" |
| 144 | |
| 145 | #define HAL_LOG_DUMP_CMD_START 0 |
| 146 | #define HAL_LOG_DUMP_CMD_END 299 |
| 147 | |
| 148 | static int debug = 0; |
| 149 | |
| 150 | void |
| 151 | logPrintf(tpAniSirGlobal pMac, tANI_U32 cmd, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4) |
| 152 | { |
| 153 | static tANI_U8 buf[MAX_LOGDUMP_SIZE + MAX_OVERFLOW_MSG]; |
| 154 | tANI_U16 bufLen; |
| 155 | pMac->gCurrentLogSize = 0; |
| 156 | |
| 157 | bufLen = (tANI_U16)logRtaiDump(pMac, cmd, arg1, arg2, arg3, arg4, buf); |
| 158 | } |
| 159 | |
| 160 | /** |
| 161 | @brief: This function is used to Aggregate the formated buffer, this |
| 162 | also check the overflow condition and adds the overflow message |
| 163 | to the end of the log Dump buffer reserved of MAX_OVERFLOW_MSG size. |
| 164 | @param: tpAniSirGlobal pMac |
| 165 | @param: char *pBuf |
| 166 | @param: variable arguments... |
| 167 | @return: Returns the number of bytes added to the buffer. |
| 168 | Returns 0 incase of overflow. |
| 169 | |
| 170 | @note: Currently in windows we do not print the Aggregated buffer as there |
| 171 | is a limitation on the number of bytes that can be displayed by DbgPrint |
| 172 | So we print the buffer immediately and we would also aggregate where |
| 173 | the TestDbg might use this buffer to print out at the application level. |
| 174 | */ |
| 175 | int log_sprintf(tpAniSirGlobal pMac, char *pBuf, char *fmt, ...) |
| 176 | { |
| 177 | tANI_S32 ret = 0; |
| 178 | #ifdef WLAN_DEBUG |
| 179 | |
| 180 | #if defined(ANI_OS_TYPE_AMSS) |
| 181 | AEEVaList args; |
| 182 | AEEVA_START(args, fmt); |
| 183 | #else |
| 184 | va_list args; |
| 185 | va_start(args, fmt); |
| 186 | #endif |
| 187 | |
| 188 | if (pMac->gCurrentLogSize >= MAX_LOGDUMP_SIZE) |
| 189 | return 0; |
| 190 | |
| 191 | #if defined (ANI_OS_TYPE_WINDOWS) |
| 192 | ret = _vsnprintf(pBuf, (MAX_LOGDUMP_SIZE - pMac->gCurrentLogSize), fmt, args); |
| 193 | #elif (defined (ANI_OS_TYPE_LINUX) || defined (ANI_OS_TYPE_ANDROID)) |
| 194 | ret = vsnprintf(pBuf, (MAX_LOGDUMP_SIZE - pMac->gCurrentLogSize), fmt, args); |
| 195 | #elif defined (ANI_OS_TYPE_OSX) |
| 196 | ret = vsnprintf(pBuf, (MAX_LOGDUMP_SIZE - pMac->gCurrentLogSize), fmt, args); |
| 197 | /* BSD kernel has a bug that vsnprintf() always return 0. |
| 198 | * See bsd/kern/subr_prf.c |
| 199 | * Need to verify ... |
| 200 | */ |
| 201 | if (ret >= 0) |
| 202 | ret = strlen(pBuf); |
| 203 | #elif defined (ANI_OS_TYPE_AMSS) |
| 204 | ret = std_vstrlprintf(pBuf, (MAX_LOGDUMP_SIZE - pMac->gCurrentLogSize), fmt, args); |
| 205 | #endif |
| 206 | |
| 207 | #if defined(ANI_OS_TYPE_AMSS) |
| 208 | AEEVA_END(args); |
| 209 | #else |
| 210 | va_end(args); |
| 211 | #endif |
| 212 | |
| 213 | /* If an output error is encountered, a negative value is returned by vsnprintf */ |
| 214 | if (ret < 0) |
| 215 | return 0; |
| 216 | |
| 217 | |
| 218 | if ((tANI_U32) ret > (MAX_LOGDUMP_SIZE - pMac->gCurrentLogSize)) { |
| 219 | pBuf += (MAX_LOGDUMP_SIZE - pMac->gCurrentLogSize); |
| 220 | pMac->gCurrentLogSize = MAX_LOGDUMP_SIZE; |
| 221 | |
| 222 | #if defined (ANI_OS_TYPE_WINDOWS) |
| 223 | ret = _snprintf(pBuf, MAX_OVERFLOW_MSG, "\n-> ***********" |
| 224 | "\nOutput Exceeded the Buffer Size, message truncated!!\n<- ***********\n"); |
| 225 | #elif (defined (ANI_OS_TYPE_LINUX) || defined (ANI_OS_TYPE_ANDROID)) |
| 226 | ret = snprintf(pBuf, MAX_OVERFLOW_MSG, "\n-> ***********" |
| 227 | "\nOutput Exceeded the Buffer Size, message truncated!!\n<- ***********\n"); |
| 228 | #elif defined (ANI_OS_TYPE_OSX) |
| 229 | ret = snprintf(pBuf, MAX_OVERFLOW_MSG, "\n-> ***********" |
| 230 | "\nOutput Exceeded the Buffer Size, message truncated!!\n<- ***********\n"); |
| 231 | /* BSD kernel has a bug that snprintf() always return 0. |
| 232 | * See bsd/kern/subr_prf.c |
| 233 | * but NEED TO VERIFY ... |
| 234 | */ |
| 235 | if (ret >= 0) |
| 236 | ret = strlen(pBuf); |
| 237 | #elif defined (ANI_OS_TYPE_AMSS) |
| 238 | ret = snprintf(pBuf, MAX_OVERFLOW_MSG, "\n-> ***********" |
| 239 | "\nOutput Exceeded the Buffer Size, message truncated!!\n<- ***********\n"); |
| 240 | #endif |
| 241 | /* If an output error is encountered, a negative value is returned by snprintf */ |
| 242 | if (ret < 0) |
| 243 | return 0; |
| 244 | |
| 245 | if (ret > MAX_OVERFLOW_MSG) |
| 246 | ret = MAX_OVERFLOW_MSG; |
| 247 | } |
| 248 | |
| 249 | pMac->gCurrentLogSize += ret; |
| 250 | |
| 251 | |
| 252 | #if defined (ANI_OS_TYPE_WINDOWS) |
| 253 | //DbgPrint("%s", pBuf); |
| 254 | sysLog(pMac, LOGE, FL("%s"), pBuf); |
| 255 | #endif |
| 256 | #endif //for #ifdef WLAN_DEBUG |
| 257 | return ret; |
| 258 | } |
| 259 | |
| 260 | |
| 261 | char* dumpLOG( tpAniSirGlobal pMac, char *p ) |
| 262 | { |
| 263 | tANI_U32 i; |
| 264 | |
| 265 | for( i = SIR_FIRST_MODULE_ID; i <= SIR_LAST_MODULE_ID; i++ ) { |
| 266 | p += log_sprintf(pMac, p, "[0x%2x]", i); |
| 267 | switch (i) |
| 268 | { |
| 269 | case SIR_HAL_MODULE_ID: p += log_sprintf( pMac, p, "HAL "); break; |
| 270 | case SIR_CFG_MODULE_ID: p += log_sprintf( pMac, p, "CFG "); break; |
| 271 | case SIR_LIM_MODULE_ID: p += log_sprintf( pMac, p, "LIM "); break; |
| 272 | case SIR_ARQ_MODULE_ID: p += log_sprintf( pMac, p, "ARQ "); break; |
| 273 | case SIR_SCH_MODULE_ID: p += log_sprintf( pMac, p, "SCH "); break; |
| 274 | case SIR_PMM_MODULE_ID: p += log_sprintf( pMac, p, "PMM "); break; |
| 275 | case SIR_MNT_MODULE_ID: p += log_sprintf( pMac, p, "MNT "); break; |
| 276 | case SIR_DBG_MODULE_ID: p += log_sprintf( pMac, p, "DBG "); break; |
| 277 | case SIR_DPH_MODULE_ID: p += log_sprintf( pMac, p, "DPH "); break; |
| 278 | case SIR_SYS_MODULE_ID: p += log_sprintf( pMac, p, "SYS "); break; |
| 279 | case SIR_PHY_MODULE_ID: p += log_sprintf( pMac, p, "PHY "); break; |
| 280 | case SIR_DVT_MODULE_ID: p += log_sprintf( pMac, p, "DVT "); break; |
| 281 | case SIR_SMS_MODULE_ID: p += log_sprintf( pMac, p, "SMS "); break; |
| 282 | default: p += log_sprintf( pMac, p, "UNK ", i); break; |
| 283 | } |
| 284 | |
| 285 | p += log_sprintf( pMac, p, |
| 286 | ": debug level is [0x%x] ", |
| 287 | pMac->utils.gLogDbgLevel[i - SIR_FIRST_MODULE_ID]); |
| 288 | |
| 289 | switch( pMac->utils.gLogDbgLevel[i - SIR_FIRST_MODULE_ID] ) |
| 290 | { |
| 291 | case LOGOFF: p += log_sprintf( pMac, p, "LOG disabled\n"); break; |
| 292 | case LOGP: p += log_sprintf( pMac, p, "LOGP(Panic only)\n"); break; |
| 293 | case LOGE: p += log_sprintf( pMac, p, "LOGE(Errors only)\n"); break; |
| 294 | case LOGW: p += log_sprintf( pMac, p, "LOGW(Warnings)\n"); break; |
| 295 | case LOG1: p += log_sprintf( pMac, p, "LOG1(Minimal debug)\n"); break; |
| 296 | case LOG2: p += log_sprintf( pMac, p, "LOG2(Verbose)\n"); break; |
| 297 | case LOG3: p += log_sprintf( pMac, p, "LOG3(Very Verbose)\n"); break; |
| 298 | case LOG4: p += log_sprintf( pMac, p, "LOG4(Very Very Verbose)\n"); break; |
| 299 | default: p += log_sprintf( pMac, p, "Unknown\n"); break; |
| 300 | } |
| 301 | } |
| 302 | |
| 303 | return p; |
| 304 | } |
| 305 | |
| 306 | char* setLOGLevel( tpAniSirGlobal pMac, char *p, tANI_U32 module, tANI_U32 level ) |
| 307 | { |
| 308 | tANI_U32 i; |
| 309 | |
| 310 | if((module > SIR_LAST_MODULE_ID || module < SIR_FIRST_MODULE_ID) && module != 0xff ) { |
| 311 | p += log_sprintf( pMac, p, "Invalid module id 0x%x\n", module ); |
| 312 | return p; |
| 313 | } |
| 314 | |
| 315 | if( 0xff == module ) { |
| 316 | for( i = SIR_FIRST_MODULE_ID; i <= SIR_LAST_MODULE_ID; i++ ) |
| 317 | pMac->utils.gLogDbgLevel[i - SIR_FIRST_MODULE_ID] = level; |
| 318 | } else { |
| 319 | pMac->utils.gLogDbgLevel[module - SIR_FIRST_MODULE_ID] = level; |
| 320 | } |
| 321 | |
| 322 | #ifdef ANI_PHY_DEBUG |
| 323 | if (module == 0xff || module == SIR_PHY_MODULE_ID) { |
| 324 | pMac->hphy.phy.phyDebugLogLevel = level; |
| 325 | } |
| 326 | #endif |
| 327 | |
| 328 | return dumpLOG( pMac, p ); |
| 329 | } |
| 330 | |
| 331 | static void Log_getCfg(tpAniSirGlobal pMac, tANI_U16 cfgId) |
| 332 | { |
| 333 | #define CFG_CTL_INT 0x00080000 |
| 334 | if ((pMac->cfg.gCfgEntry[cfgId].control & CFG_CTL_INT) != 0) |
| 335 | { |
| 336 | tANI_U32 val; |
| 337 | |
| 338 | // Get integer parameter |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 339 | if (wlan_cfgGetInt(pMac, (tANI_U16)cfgId, &val) != eSIR_SUCCESS) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 340 | { |
| 341 | sysLog(pMac, LOGE, FL("Get cfgId 0x%x failed\n"), cfgId); |
| 342 | } |
| 343 | else |
| 344 | { |
| 345 | sysLog( pMac, LOGE, FL("WNI_CFG_%s(%d 0x%x) = %ld\n"), gCfgParamName[cfgId], cfgId, cfgId, val ); |
| 346 | } |
| 347 | } |
| 348 | else |
| 349 | { |
| 350 | tANI_U8 buf[CFG_MAX_STR_LEN] = {0} ; |
| 351 | tANI_U32 valueLen ; |
| 352 | |
| 353 | // Get string parameter |
| 354 | valueLen = CFG_MAX_STR_LEN ; |
| 355 | if (wlan_cfgGetStr(pMac, cfgId, buf, &valueLen) != eSIR_SUCCESS) |
| 356 | { |
| 357 | sysLog(pMac, LOGE, FL("Get cfgId 0x%x failed\n"), cfgId); |
| 358 | } |
| 359 | else |
| 360 | { |
| 361 | sysLog( pMac, LOGE, FL("WNI_CFG_%s(%d 0x%x) len=%ld\n"), gCfgParamName[cfgId], cfgId, cfgId, valueLen ); |
| 362 | sirDumpBuf(pMac, SIR_WDA_MODULE_ID, LOGW, buf, valueLen) ; |
| 363 | } |
| 364 | } |
| 365 | |
| 366 | return; |
| 367 | } |
| 368 | |
| 369 | static void Log_setCfg(tpAniSirGlobal pMac, tANI_U16 cfgId, tANI_U32 val) |
| 370 | { |
| 371 | sysLog(pMac, LOGE, FL("Set %s(0x%x) to value 0x%x\n"), |
| 372 | gCfgParamName[cfgId], cfgId, val); |
| 373 | |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 374 | if (cfgSetInt(pMac, (tANI_U16)cfgId, val) != eSIR_SUCCESS) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 375 | sysLog(pMac, LOGE, FL("setting cfgId 0x%x to value 0x%x failed \n"), |
| 376 | cfgId, val); |
| 377 | return; |
| 378 | } |
| 379 | |
| 380 | |
| 381 | char * dump_cfg_get( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p) |
| 382 | { |
| 383 | (void) arg2; (void) arg3; (void) arg4; |
| 384 | Log_getCfg(pMac, (tANI_U16) arg1); |
| 385 | return p; |
| 386 | } |
| 387 | |
| 388 | char * dump_cfg_group_get( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p) |
| 389 | { |
| 390 | tANI_U32 i, startId, endId; |
| 391 | |
| 392 | (void) arg3; (void) arg4; |
| 393 | |
| 394 | if (arg1 < CFG_PARAM_MAX_NUM) { |
| 395 | startId = arg1; |
| 396 | } else { |
| 397 | p += log_sprintf( pMac, p, "Start CFGID must be less than %d\n", CFG_PARAM_MAX_NUM); |
| 398 | return p; |
| 399 | } |
| 400 | |
| 401 | if ((arg2 == 0) || (arg2 > CFG_PARAM_MAX_NUM)) |
| 402 | arg2 = 30; |
| 403 | |
| 404 | endId = ((startId + arg2) < CFG_PARAM_MAX_NUM) ? (startId + arg2) : CFG_PARAM_MAX_NUM; |
| 405 | |
| 406 | for (i=startId; i < endId; i++) |
| 407 | Log_getCfg(pMac, (tANI_U16) i); |
| 408 | |
| 409 | return p; |
| 410 | } |
| 411 | char * dump_cfg_set( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p) |
| 412 | { |
| 413 | (void) arg3; (void) arg4; |
| 414 | Log_setCfg(pMac, (tANI_U16) arg1, arg2); |
| 415 | return p; |
| 416 | } |
| 417 | |
| 418 | char * dump_log_level_set( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p) |
| 419 | { |
| 420 | (void) arg1; (void) arg2; (void) arg3; (void) arg4; |
| 421 | p = setLOGLevel( pMac, p, arg1, arg2 ); |
| 422 | return p; |
| 423 | } |
| 424 | |
| 425 | #ifdef WLAN_DEBUG |
| 426 | static tLogdRegList dataType[] = |
| 427 | { |
| 428 | {SIR_MAC_DATA_DATA, "DATA "}, |
| 429 | {SIR_MAC_DATA_DATA_ACK, "D+A "}, |
| 430 | {SIR_MAC_DATA_DATA_POLL, "D+P "}, |
| 431 | {SIR_MAC_DATA_DATA_ACK_POLL, "D+A+P"}, |
| 432 | {SIR_MAC_DATA_NULL, "NULL "}, |
| 433 | {SIR_MAC_DATA_NULL_ACK, "ACK "}, |
| 434 | {SIR_MAC_DATA_NULL_POLL, "POLL "}, |
| 435 | {SIR_MAC_DATA_NULL_ACK_POLL, "A+P "}, |
| 436 | {SIR_MAC_DATA_QOS_DATA, "QDATA"}, |
| 437 | {SIR_MAC_DATA_QOS_DATA_ACK, "QD+A "}, |
| 438 | {SIR_MAC_DATA_QOS_DATA_POLL, "QD+P "}, |
| 439 | {SIR_MAC_DATA_QOS_DATA_ACK_POLL, "QD+AP"}, |
| 440 | {SIR_MAC_DATA_QOS_NULL, "QNULL"}, |
| 441 | {SIR_MAC_DATA_QOS_NULL_POLL, "QACK "}, |
| 442 | {SIR_MAC_DATA_QOS_NULL_ACK_POLL, "Q+A+P"} |
| 443 | }; |
| 444 | |
| 445 | static tLogdRegList mgmtType[] = { |
| 446 | {SIR_MAC_MGMT_BEACON, "BEACON "}, |
| 447 | {SIR_MAC_MGMT_ASSOC_REQ, "ASSOCREQ "}, |
| 448 | {SIR_MAC_MGMT_ASSOC_RSP, "ASSOCRSP "}, |
| 449 | {SIR_MAC_MGMT_REASSOC_RSP, "REASSRSP "}, |
| 450 | {SIR_MAC_MGMT_REASSOC_REQ, "REASSREQ "}, |
| 451 | {SIR_MAC_MGMT_PROBE_REQ, "PROBEREQ "}, |
| 452 | {SIR_MAC_MGMT_PROBE_RSP, "PROBERSP "}, |
| 453 | {SIR_MAC_MGMT_AUTH, "AUTH "}, |
| 454 | {SIR_MAC_MGMT_DEAUTH, "DEAUTH "}, |
| 455 | {SIR_MAC_MGMT_DISASSOC, "DISASSOC "}, |
| 456 | {SIR_MAC_MGMT_ACTION, "ACTION "} |
| 457 | }; |
| 458 | |
| 459 | static tLogdRegList ctlType[] = { |
| 460 | {SIR_MAC_CTRL_RTS, "RTS(CTL) "}, |
| 461 | {SIR_MAC_CTRL_CTS, "CTS(CTL) "}, |
| 462 | {SIR_MAC_CTRL_ACK, "ACK(CTL) "}, |
| 463 | {SIR_MAC_CTRL_PS_POLL, "PS-POLL "}, |
| 464 | {SIR_MAC_CTRL_BAR, "BAR "}, |
| 465 | {SIR_MAC_CTRL_BA, "BA "}, |
| 466 | {SIR_MAC_CTRL_CF_END,"CF-END "}, |
| 467 | {SIR_MAC_CTRL_CF_END_ACK,"CFE+ACK "} |
| 468 | }; |
| 469 | |
| 470 | static char * printMesgName(tpAniSirGlobal pMac, char *p, tANI_U32 type, tANI_U32 subType, tANI_U32 tcId) |
| 471 | { |
| 472 | tLogdRegList *pEntry = NULL; |
| 473 | tANI_U32 nEntries, i; |
| 474 | |
| 475 | switch (type) |
| 476 | { |
| 477 | case SIR_MAC_DATA_FRAME: |
| 478 | pEntry = &dataType[0]; |
| 479 | nEntries = sizeof(dataType)/sizeof(dataType[0]); |
| 480 | break; |
| 481 | case SIR_MAC_MGMT_FRAME: |
| 482 | pEntry = &mgmtType[0]; |
| 483 | nEntries = sizeof(mgmtType)/sizeof(mgmtType[0]); |
| 484 | break; |
| 485 | case SIR_MAC_CTRL_FRAME: |
| 486 | pEntry = &ctlType[0]; |
| 487 | nEntries = sizeof(ctlType)/sizeof(ctlType[0]); |
| 488 | break; |
| 489 | default: |
| 490 | p += log_sprintf( pMac, p, "RESERVED "); |
| 491 | return p; |
| 492 | } |
| 493 | |
| 494 | for (i=0; i < nEntries; i++, pEntry++) { |
| 495 | if (pEntry->addr == subType) { |
| 496 | p += log_sprintf( pMac, p, "%s", pEntry->name); |
| 497 | break; |
| 498 | } |
| 499 | } |
| 500 | |
| 501 | if (i >= nEntries) |
| 502 | p += log_sprintf( pMac, p, "RESERVED "); |
| 503 | |
| 504 | if (type == SIR_MAC_DATA_FRAME) |
| 505 | p += log_sprintf( pMac, p, "(%d) ", tcId); |
| 506 | return p; |
| 507 | } |
| 508 | |
| 509 | char * dump_thread_info( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p) |
| 510 | { |
| 511 | tANI_U32 i, j; |
| 512 | |
| 513 | p += log_sprintf( pMac, p, "\n**** BBT RECEIVE **** \n"); |
| 514 | p += log_sprintf( pMac, p, "\nBBT CRC errors received : %d\n", |
| 515 | pMac->sys.gSysBbtCrcFail); |
| 516 | p += log_sprintf( pMac, p, "BBT duplicates received : %d\n", |
| 517 | pMac->sys.gSysBbtDuplicates); |
| 518 | p += log_sprintf( pMac, p, "BBT total frames received : %d\n", |
| 519 | pMac->sys.gSysBbtReceived); |
| 520 | p += log_sprintf( pMac, p, "\tPosted to LIM : %d\n", |
| 521 | pMac->sys.gSysBbtPostedToLim); |
| 522 | p += log_sprintf( pMac, p, "\tPosted to SCH : %d\n", |
| 523 | pMac->sys.gSysBbtPostedToSch); |
| 524 | p += log_sprintf( pMac, p, "\tPosted to PMM : %d\n", |
| 525 | pMac->sys.gSysBbtPostedToPmm); |
| 526 | p += log_sprintf( pMac, p, "\tPosted to HAL : %d\n", |
| 527 | pMac->sys.gSysBbtPostedToHal); |
| 528 | p += log_sprintf( pMac, p, "\tDropped : %d\n", |
| 529 | pMac->sys.gSysBbtDropped); |
| 530 | p += log_sprintf( pMac, p, "\t\tLearn mode frame out of learn mode : %d\n", |
| 531 | pMac->sys.gSysBbtLearnFrameInv); |
| 532 | p += log_sprintf( pMac, p, "\t\tNon-learn mode frame in learn mode : %d\n", |
| 533 | pMac->sys.gSysBbtNonLearnFrameInv); |
| 534 | |
| 535 | p += log_sprintf( pMac, p, "\nMGMT RX frame counts\n"); |
| 536 | for (i = 0; i < 16; i++) { |
| 537 | if (pMac->sys.gSysFrameCount[0][i]) { |
| 538 | p += log_sprintf( pMac, p, "\t"); |
| 539 | p = printMesgName( pMac, p, 0, i, 0); |
| 540 | p += log_sprintf( pMac, p, "[%d] %d\n", i, pMac->sys.gSysFrameCount[0][i]); |
| 541 | } |
| 542 | } |
| 543 | |
| 544 | p += log_sprintf( pMac, p, "CTRL RX frame counts\n"); |
| 545 | |
| 546 | for (i = 0; i < 16; i++) { |
| 547 | if (pMac->sys.gSysFrameCount[1][i]) { |
| 548 | p += log_sprintf( pMac, p, "\t"); |
| 549 | p = printMesgName(pMac, p, 1, i, 0); |
| 550 | p += log_sprintf( pMac, p, "[%d] %d\n", i, pMac->sys.gSysFrameCount[1][i]); |
| 551 | } |
| 552 | } |
| 553 | |
| 554 | p += log_sprintf( pMac, p, "DATA RX frame counts\n"); |
| 555 | for (i = 0; i < 16; i++) { |
| 556 | if (pMac->sys.gSysFrameCount[2][i]) { |
| 557 | p += log_sprintf( pMac, p, "\t"); |
| 558 | p = printMesgName(pMac, p, 2, i, 0); |
| 559 | p += log_sprintf( pMac, p, "[%d] %d\n", i, |
| 560 | pMac->sys.gSysFrameCount[2][i]); |
| 561 | } |
| 562 | } |
| 563 | |
| 564 | if (pMac->sch.gSchBBXportRcvCnt) { |
| 565 | p += log_sprintf( pMac, p, "\nSCH processed messages : %d\n", |
| 566 | pMac->sch.gSchBBXportRcvCnt); |
| 567 | p += log_sprintf( pMac, p, "\tBeacons : %d\n", pMac->sch.gSchBcnRcvCnt); |
| 568 | p += log_sprintf( pMac, p, "\t\tignored : %d\n", pMac->sch.gSchBcnIgnored); |
| 569 | p += log_sprintf( pMac, p, "\t\tin error : %d\n", pMac->sch.gSchBcnParseErrorCnt); |
| 570 | p += log_sprintf( pMac, p, "\tQoS null : %d\n", pMac->sch.gSchRRRcvCnt); |
| 571 | p += log_sprintf( pMac, p, "\tDropped : %d\n", pMac->sch.gSchUnknownRcvCnt); |
| 572 | } |
| 573 | |
| 574 | |
| 575 | p += log_sprintf( pMac, p, "\nLIM processed messages : %d\n", pMac->lim.numTot); |
| 576 | if (pMac->lim.numTot) { |
| 577 | p += log_sprintf( pMac, p, "\tSME Messages (HDD) : %d\n", pMac->lim.numSme); |
| 578 | p += log_sprintf( pMac, p, "\tMAC Messages (BBT) : %d\n", pMac->lim.numBbt); |
| 579 | p += log_sprintf( pMac, p, "\t\tBad Protocol\t: %d\n", pMac->lim.numProtErr); |
| 580 | p += log_sprintf( pMac, p, "\t\tIn Learn mode\t: %d (ignored %d)\n", |
| 581 | pMac->lim.numLearn, pMac->lim.numLearnIgnore); |
| 582 | |
| 583 | for (i=0; i<4; i++) { |
| 584 | for (j=0; j<16; j++) { |
| 585 | if (pMac->lim.numMAC[i][j]) { |
| 586 | p += log_sprintf( pMac, p, "\t\t"); |
| 587 | p = printMesgName(pMac, p, i, j, 0); |
| 588 | p += log_sprintf( pMac, p, "\t: %d\n", pMac->lim.numMAC[i][j]); |
| 589 | } |
| 590 | } |
| 591 | } |
| 592 | |
| 593 | p += log_sprintf( pMac, p, "\tBeacons received : %d\n", pMac->lim.gLimNumBeaconsRcvd); |
| 594 | p += log_sprintf( pMac, p, "\t\tIgnored : %d\n", pMac->lim.gLimNumBeaconsIgnored); |
| 595 | } |
| 596 | |
| 597 | if (pMac->sys.gSysFrameCount[SIR_MAC_MGMT_FRAME][SIR_MAC_MGMT_PROBE_REQ]) { |
| 598 | p += log_sprintf( pMac, p, "\nProbe Requests Received: %d\n", |
| 599 | pMac->sys.gSysFrameCount[SIR_MAC_MGMT_FRAME][SIR_MAC_MGMT_PROBE_REQ]); |
| 600 | p += log_sprintf( pMac, p, "\tIgnored \t: %d\n", pMac->sys.probeIgnore); |
| 601 | p += log_sprintf( pMac, p, "\tSSID miss\t: %d\n", pMac->sys.probeBadSsid); |
| 602 | p += log_sprintf( pMac, p, "\tParse err\t: %d\n", pMac->sys.probeError); |
| 603 | p += log_sprintf( pMac, p, "\tResponded\t: %d\n", pMac->sys.probeRespond); |
| 604 | } |
| 605 | |
| 606 | return p; |
| 607 | } |
| 608 | #endif |
| 609 | |
| 610 | /* Initialize the index */ |
| 611 | void logDumpInit(tpAniSirGlobal pMac) |
| 612 | { |
| 613 | pMac->dumpTablecurrentId = 0; |
| 614 | |
| 615 | } |
| 616 | |
| 617 | void logDumpRegisterTable( tpAniSirGlobal pMac, tDumpFuncEntry *pEntry, tANI_U32 nItems ) |
| 618 | { |
| 619 | |
| 620 | pMac->dumpTableEntry[pMac->dumpTablecurrentId]->nItems = nItems; |
| 621 | pMac->dumpTableEntry[pMac->dumpTablecurrentId]->mindumpid = pEntry->id; |
| 622 | pMac->dumpTableEntry[pMac->dumpTablecurrentId]->maxdumpid = (pEntry + (nItems-1))->id; |
| 623 | pMac->dumpTableEntry[pMac->dumpTablecurrentId]->dumpTable = pEntry; |
| 624 | pMac->dumpTablecurrentId++; |
| 625 | } |
| 626 | |
| 627 | |
| 628 | /* |
| 629 | * print nItems from the menu list ponted to by m |
| 630 | */ |
| 631 | static tANI_U32 print_menu(tpAniSirGlobal pMac, char *p, tANI_U32 startId) |
| 632 | { |
| 633 | tANI_U32 currentId = 0; |
| 634 | tANI_U32 i, j; |
| 635 | tANI_S32 ret = 0; |
| 636 | tDumpFuncEntry *pEntry = NULL; |
| 637 | tANI_U32 nItems = 0; |
| 638 | |
| 639 | for(i = 0; i < pMac->dumpTablecurrentId; i++) { |
| 640 | pEntry = pMac->dumpTableEntry[i]->dumpTable; |
| 641 | nItems = pMac->dumpTableEntry[i]->nItems; |
| 642 | |
| 643 | for (j = 0; j < nItems; j++, pEntry++) { |
| 644 | if (pEntry->description == NULL) |
| 645 | continue; |
| 646 | |
| 647 | if (pEntry->id == 0) { |
| 648 | ret = log_sprintf( pMac,p, "---- %s\n", pEntry->description); |
| 649 | |
| 650 | if (ret <= 0) |
| 651 | break; |
| 652 | |
| 653 | p += ret; |
| 654 | continue; |
| 655 | } |
| 656 | |
| 657 | if (pEntry->id < startId) |
| 658 | continue; |
| 659 | |
| 660 | ret = log_sprintf(pMac, p, "%4d\t%s\n", pEntry->id, pEntry->description); |
| 661 | |
| 662 | if (ret <= 0) |
| 663 | break; |
| 664 | |
| 665 | currentId = pEntry->id; |
| 666 | p += ret; |
| 667 | } |
| 668 | |
| 669 | if (ret <= 0) |
| 670 | break; |
| 671 | } |
| 672 | |
| 673 | return currentId; |
| 674 | } |
| 675 | |
| 676 | int logRtaiDump( tpAniSirGlobal pMac, tANI_U32 cmd, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, tANI_U8 *pBuf) |
| 677 | { |
| 678 | char *p = (char *)pBuf; |
| 679 | tANI_U32 i; |
| 680 | tANI_U32 nItems = 0; |
| 681 | tDumpFuncEntry *pEntry = NULL; |
| 682 | |
| 683 | pMac->gCurrentLogSize = 0; |
| 684 | if (debug) { |
| 685 | p += log_sprintf( pMac,p, "Cmd = %d Args (0x%x,0x%x,0x%x,0x%x)\n\n", |
| 686 | cmd, arg1, arg2, arg3, arg4); |
| 687 | } |
| 688 | |
| 689 | if( cmd == MAX_DUMP_CMD || cmd == 0 ) { |
| 690 | pMac->menuCurrent = print_menu(pMac, p, pMac->menuCurrent); |
| 691 | return pMac->gCurrentLogSize; |
| 692 | } |
| 693 | if(cmd <= HAL_LOG_DUMP_CMD_END) |
| 694 | { |
| 695 | WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, p); |
| 696 | } |
| 697 | else |
| 698 | { |
| 699 | for(i = 0; i < pMac->dumpTablecurrentId; i++) { |
| 700 | if( (cmd > pMac->dumpTableEntry[i]->mindumpid) && (cmd <= pMac->dumpTableEntry[i]->maxdumpid)) { |
| 701 | pEntry = pMac->dumpTableEntry[i]->dumpTable; |
| 702 | nItems = pMac->dumpTableEntry[i]->nItems; |
| 703 | break; |
| 704 | } else { |
| 705 | continue; |
| 706 | } |
| 707 | } |
| 708 | |
| 709 | if((nItems > 0) && (pEntry != NULL)) { |
| 710 | for (i = 0; i < nItems; i++, pEntry++) { |
| 711 | if( cmd == pEntry->id ) { |
| 712 | if ( pEntry->func != NULL ) { |
| 713 | pEntry->func(pMac, arg1, arg2, arg3, arg4, p); |
| 714 | } else { |
| 715 | p += log_sprintf( pMac,p, "Cmd not supported\n"); |
| 716 | } |
| 717 | break; |
| 718 | } |
| 719 | } |
| 720 | } else { |
| 721 | p += log_sprintf( pMac,p, "Cmd not found \n"); |
| 722 | } |
| 723 | } |
| 724 | if (debug) |
| 725 | p += log_sprintf( pMac,p, "Returned %d bytes\n", pMac->gCurrentLogSize); |
| 726 | |
| 727 | return pMac->gCurrentLogSize; |
| 728 | |
| 729 | } |
| 730 | |
| 731 | #endif |