wlan: Changes in HDD logs from numerical values to string
As a part of logging enhancement,to make logs more
interactive, changed device_mode from numericals values
to human readable string in HDD module.
Change-Id: I66043f1cc93baf70ea9956a00c01eba0a72cfae7
CRs-Fixed: 638916
diff --git a/CORE/HDD/inc/wlan_hdd_main.h b/CORE/HDD/inc/wlan_hdd_main.h
index 335ab8c..7067b72 100644
--- a/CORE/HDD/inc/wlan_hdd_main.h
+++ b/CORE/HDD/inc/wlan_hdd_main.h
@@ -1297,7 +1297,8 @@
(WLAN_HDD_LOAD_IN_PROGRESS | WLAN_HDD_UNLOAD_IN_PROGRESS))
/*---------------------------------------------------------------------------
Function declarations and documenation
- -------------------------------------------------------------------------*/
+ -------------------------------------------------------------------------*/
+const char * hdd_device_modetoString(v_U8_t device_mode);
VOS_STATUS hdd_get_front_adapter( hdd_context_t *pHddCtx,
hdd_adapter_list_node_t** ppAdapterNode);
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index 4c2d1c7..7db1f95 100644
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -1046,8 +1046,9 @@
tANI_U8 *pKeyPtr = NULL;
int n = 0;
- hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d",
- __func__,pAdapter->device_mode);
+ hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s(%d)",
+ __func__, hdd_device_modetoString(pAdapter->device_mode),
+ pAdapter->device_mode);
vos_mem_zero(&setKey, sizeof(tCsrRoamSetKey));
setKey.keyId = key_index; // Store Key ID
@@ -1774,8 +1775,9 @@
TRACE_CODE_HDD_CFG80211_SET_CHANNEL, pAdapter->sessionId,
channel_type ));
hddLog(VOS_TRACE_LEVEL_INFO,
- "%s: device_mode = %d freq = %d", __func__,
- pAdapter->device_mode, chan->center_freq);
+ "%s: device_mode = %s (%d) freq = %d", __func__,
+ hdd_device_modetoString(pAdapter->device_mode),
+ pAdapter->device_mode, chan->center_freq);
pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
status = wlan_hdd_validate_context(pHddCtx);
@@ -1868,8 +1870,9 @@
(WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel =
AUTO_CHANNEL_SELECT;
hddLog(VOS_TRACE_LEVEL_INFO_HIGH,
- "%s: set channel to auto channel (0) for device mode =%d",
- __func__, pAdapter->device_mode);
+ "%s: set channel to auto channel (0) for device mode =%s (%d)",
+ __func__, hdd_device_modetoString(pAdapter->device_mode),
+ pAdapter->device_mode);
}
else
{
@@ -2351,7 +2354,9 @@
MTRACE(vos_trace(VOS_MODULE_ID_HDD,
TRACE_CODE_HDD_CFG80211_ADD_BEACON,
pAdapter->sessionId, params->interval));
- hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "device mode=%d",pAdapter->device_mode);
+ hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "device mode=%s (%d)",
+ hdd_device_modetoString(pAdapter->device_mode),
+ pAdapter->device_mode);
pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
status = wlan_hdd_validate_context(pHddCtx);
@@ -2410,8 +2415,9 @@
MTRACE(vos_trace(VOS_MODULE_ID_HDD,
TRACE_CODE_HDD_CFG80211_SET_BEACON,
pAdapter->sessionId, pHddStaCtx->conn_info.authType));
- hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d",
- __func__,pAdapter->device_mode);
+ hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)",
+ __func__, hdd_device_modetoString(pAdapter->device_mode),
+ pAdapter->device_mode);
pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
status = wlan_hdd_validate_context(pHddCtx);
@@ -2508,8 +2514,9 @@
pScanInfo = &pHddCtx->scan_info;
- hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d",
- __func__,pAdapter->device_mode);
+ hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)",
+ __func__, hdd_device_modetoString(pAdapter->device_mode),
+ pAdapter->device_mode);
if ((pScanInfo != NULL) && pScanInfo->mScanPending && staAdapter)
{
@@ -2668,8 +2675,9 @@
return status;
}
- hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: device mode = %d",
- __func__, pAdapter->device_mode);
+ hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: device mode = %s (%d)",
+ __func__, hdd_device_modetoString(pAdapter->device_mode),
+ pAdapter->device_mode);
if ((pAdapter->device_mode == WLAN_HDD_SOFTAP)
|| (pAdapter->device_mode == WLAN_HDD_P2P_GO)
@@ -2786,8 +2794,9 @@
MTRACE(vos_trace(VOS_MODULE_ID_HDD,
TRACE_CODE_HDD_CFG80211_CHANGE_BSS,
pAdapter->sessionId, params->ap_isolate));
- hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d",
- __func__,pAdapter->device_mode);
+ hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)",
+ __func__, hdd_device_modetoString(pAdapter->device_mode),
+ pAdapter->device_mode);
if((pAdapter->device_mode == WLAN_HDD_SOFTAP)
|| (pAdapter->device_mode == WLAN_HDD_P2P_GO)
@@ -2866,8 +2875,9 @@
return status;
}
- hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d",
- __func__, pAdapter->device_mode);
+ hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)",
+ __func__, hdd_device_modetoString(pAdapter->device_mode),
+ pAdapter->device_mode);
pConfig = pHddCtx->cfg_ini;
wdev = ndev->ieee80211_ptr;
@@ -3179,8 +3189,9 @@
}
else
{
- hddLog(VOS_TRACE_LEVEL_ERROR,"%s: unsupported device mode(%d)",
- __func__, pAdapter->device_mode);
+ hddLog(VOS_TRACE_LEVEL_ERROR,"%s: unsupported device mode(%s (%d))",
+ __func__, hdd_device_modetoString(pAdapter->device_mode),
+ pAdapter->device_mode);
return -EOPNOTSUPP;
}
@@ -3669,8 +3680,9 @@
return status;
}
- hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d",
- __func__, pAdapter->device_mode);
+ hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)",
+ __func__, hdd_device_modetoString(pAdapter->device_mode),
+ pAdapter->device_mode);
if (CSR_MAX_NUM_KEY <= key_index)
{
@@ -4024,8 +4036,9 @@
MTRACE(vos_trace(VOS_MODULE_ID_HDD,
TRACE_CODE_HDD_CFG80211_GET_KEY,
pAdapter->sessionId, params.cipher));
- hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d",
- __func__,pAdapter->device_mode);
+ hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)",
+ __func__, hdd_device_modetoString(pAdapter->device_mode),
+ pAdapter->device_mode);
memset(¶ms, 0, sizeof(params));
@@ -5070,8 +5083,9 @@
if( pAdapter )
{
hddLog(VOS_TRACE_LEVEL_INFO,
- "%s: Adapter with device mode %d exists",
- __func__, pAdapter->device_mode);
+ "%s: Adapter with device mode %s (%d) exists",
+ __func__, hdd_device_modetoString(pAdapter->device_mode),
+ pAdapter->device_mode);
if (((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) ||
(WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) ||
(WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) &&
@@ -5084,12 +5098,12 @@
return VOS_TRUE;
}
if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) ||
- (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) ||
- (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode))
+ (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) ||
+ (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode))
{
pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
if ((eConnectionState_Associated == pHddStaCtx->conn_info.connState) &&
- (VOS_FALSE == pHddStaCtx->conn_info.uIsAuthenticated))
+ (VOS_FALSE == pHddStaCtx->conn_info.uIsAuthenticated))
{
staMac = (v_U8_t *) &(pAdapter->macAddressCurrent.bytes[0]);
hddLog(VOS_TRACE_LEVEL_ERROR,
@@ -5155,8 +5169,9 @@
TRACE_CODE_HDD_CFG80211_SCAN,
pAdapter->sessionId, request->n_channels));
- hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d",
- __func__,pAdapter->device_mode);
+ hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)",
+ __func__, hdd_device_modetoString(pAdapter->device_mode),
+ pAdapter->device_mode);
status = wlan_hdd_validate_context(pHddCtx);
@@ -5183,8 +5198,9 @@
if (pAdapter->device_mode == WLAN_HDD_SOFTAP)
{
hddLog(VOS_TRACE_LEVEL_ERROR,
- "%s: Not scanning on device_mode = %d",
- __func__, pAdapter->device_mode);
+ "%s: Not scanning on device_mode = %s (%d)",
+ __func__, hdd_device_modetoString(pAdapter->device_mode),
+ pAdapter->device_mode);
return -EOPNOTSUPP;
}
@@ -5491,8 +5507,9 @@
hddLog(VOS_TRACE_LEVEL_INFO_HIGH,
"requestType %d, scanType %d, minChnTime %d, maxChnTime %d,"
- "p2pSearch %d, skipDfsChnlInP2pSearch %d", scanRequest.requestType,
- scanRequest.scanType, scanRequest.minChnTime, scanRequest.maxChnTime,
+ "p2pSearch %d, skipDfsChnlInP2pSearch %d",
+ scanRequest.requestType, scanRequest.scanType,
+ scanRequest.minChnTime, scanRequest.maxChnTime,
scanRequest.p2pSearch, scanRequest.skipDfsChnlInP2pSearch);
status = sme_ScanRequest( WLAN_HDD_GET_HAL_CTX(pAdapter),
@@ -6574,7 +6591,9 @@
TRACE_CODE_HDD_CFG80211_CONNECT,
pAdapter->sessionId, pAdapter->device_mode));
hddLog(VOS_TRACE_LEVEL_INFO,
- "%s: device_mode = %d",__func__,pAdapter->device_mode);
+ "%s: device_mode = %s (%d)", __func__,
+ hdd_device_modetoString(pAdapter->device_mode),
+ pAdapter->device_mode);
pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
if (!pHddCtx)
@@ -6746,8 +6765,9 @@
MTRACE(vos_trace(VOS_MODULE_ID_HDD,
TRACE_CODE_HDD_CFG80211_DISCONNECT,
pAdapter->sessionId, reason));
- hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d\n",
- __func__,pAdapter->device_mode);
+ hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s(%d)",
+ __func__, hdd_device_modetoString(pAdapter->device_mode),
+ pAdapter->device_mode);
hddLog(VOS_TRACE_LEVEL_INFO, "%s: Disconnect called with reason code %d",
__func__, reason);
@@ -6956,7 +6976,9 @@
TRACE_CODE_HDD_CFG80211_JOIN_IBSS,
pAdapter->sessionId, pAdapter->device_mode));
hddLog(VOS_TRACE_LEVEL_INFO,
- "%s: device_mode = %d",__func__,pAdapter->device_mode);
+ "%s: device_mode = %s (%d)", __func__,
+ hdd_device_modetoString(pAdapter->device_mode),
+ pAdapter->device_mode);
status = wlan_hdd_validate_context(pHddCtx);
@@ -7133,7 +7155,9 @@
return status;
}
- hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d",__func__,pAdapter->device_mode);
+ hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", __func__,
+ hdd_device_modetoString(pAdapter->device_mode),
+ pAdapter->device_mode);
if (NULL == pWextState)
{
hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: Data Storage Corruption",
@@ -9591,8 +9615,9 @@
else
{
VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
- "%s: Invalid device_mode = %d",
- __func__, pAdapter->device_mode);
+ "%s: Invalid device_mode = %s (%d)",
+ __func__, hdd_device_modetoString(pAdapter->device_mode),
+ pAdapter->device_mode);
return -EINVAL;
}
diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c
index 1c27647..3961af7 100644
--- a/CORE/HDD/src/wlan_hdd_main.c
+++ b/CORE/HDD/src/wlan_hdd_main.c
@@ -235,6 +235,22 @@
#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
static VOS_STATUS wlan_hdd_init_channels(hdd_context_t *pHddCtx);
+const char * hdd_device_modetoString(v_U8_t device_mode)
+{
+ switch(device_mode)
+ {
+ CASE_RETURN_STRING( WLAN_HDD_INFRA_STATION );
+ CASE_RETURN_STRING( WLAN_HDD_SOFTAP );
+ CASE_RETURN_STRING( WLAN_HDD_P2P_CLIENT );
+ CASE_RETURN_STRING( WLAN_HDD_P2P_GO );
+ CASE_RETURN_STRING( WLAN_HDD_MONITOR);
+ CASE_RETURN_STRING( WLAN_HDD_FTM );
+ CASE_RETURN_STRING( WLAN_HDD_IBSS );
+ CASE_RETURN_STRING( WLAN_HDD_P2P_DEVICE );
+ default:
+ return "device_mode Unknown";
+ }
+}
static int hdd_netdev_notifier_call(struct notifier_block * nb,
unsigned long state,
@@ -1734,9 +1750,10 @@
(WLAN_HDD_P2P_DEVICE != pAdapter->device_mode))
{
VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
- "Received WLS_BATCHING SET command in invalid mode %d "
+ "Received WLS_BATCHING SET command in invalid mode %s (%d) "
"WLS_BATCHING_SET is only allowed in infra STA/P2P client mode",
- pAdapter->device_mode);
+ hdd_device_modetoString(pAdapter->device_mode),
+ pAdapter->device_mode);
ret = -EINVAL;
goto exit;
}