qcacld-3.0: Add logic to log pause/unpause time

Add logic to calculate pause and unpause time for
network queues to debug data path issues.

Change-Id: I825b10837d999384a91ca3c2271e472a71fd8863
CRs-Fixed: 999861
This commit is contained in:
Nirav Shah 2016-04-25 10:24:24 +05:30 • committed by Gerrit - the friendly Code Review server
commit 617cff9d7f
4 changed files with 77 additions and 13 deletions

View file

@ -1035,7 +1035,10 @@ struct hdd_adapter_s {
/* BITMAP indicating pause reason */
uint32_t pause_map;
spinlock_t pause_map_lock;
qdf_time_t start_time;
qdf_time_t last_time;
qdf_time_t total_pause_time;
qdf_time_t total_unpause_time;
uint8_t history_index;
struct hdd_netif_queue_history
queue_oper_history[WLAN_HDD_MAX_HISTORY_ENTRY];

View file

@ -6409,6 +6409,8 @@ hdd_adapter_t *hdd_wlan_create_ap_dev(hdd_context_t *pHddCtx,
SET_NETDEV_DEV(pWlanHostapdDev, pHddCtx->parent_dev);
spin_lock_init(&pHostapdAdapter->pause_map_lock);
pHostapdAdapter->start_time =
pHostapdAdapter->last_time = qdf_system_ticks();
}
return pHostapdAdapter;
}

View file

@ -2060,6 +2060,7 @@ static hdd_adapter_t *hdd_alloc_station_adapter(hdd_context_t *hdd_ctx,
SET_NETDEV_DEV(pWlanDev, hdd_ctx->parent_dev);
hdd_wmm_init(adapter);
spin_lock_init(&adapter->pause_map_lock);
adapter->start_time = adapter->last_time = qdf_system_ticks();
}
return adapter;
@ -4819,24 +4820,40 @@ void wlan_hdd_display_netif_queue_history(hdd_context_t *hdd_ctx)
hdd_adapter_list_node_t *adapter_node = NULL, *next = NULL;
QDF_STATUS status;
int i;
qdf_time_t total, pause, unpause, curr_time;
status = hdd_get_front_adapter(hdd_ctx, &adapter_node);
while (NULL != adapter_node && QDF_STATUS_SUCCESS == status) {
adapter = adapter_node->pAdapter;
hddLog(QDF_TRACE_LEVEL_ERROR,
"Session_id %d device mode %d current index %d",
adapter->sessionId, adapter->device_mode,
adapter->history_index);
"Session_id %d device mode %d",
adapter->sessionId, adapter->device_mode);
hddLog(QDF_TRACE_LEVEL_ERROR,
"Netif queue operation statistics:");
hddLog(QDF_TRACE_LEVEL_ERROR,
"Current pause_map value %x", adapter->pause_map);
curr_time = qdf_system_ticks();
total = curr_time - adapter->start_time;
if (adapter->pause_map) {
pause = adapter->total_pause_time +
curr_time - adapter->last_time;
unpause = adapter->total_unpause_time;
} else {
unpause = adapter->total_unpause_time +
curr_time - adapter->last_time;
pause = adapter->total_pause_time;
}
hddLog(QDF_TRACE_LEVEL_ERROR,
" reason_type: pause_cnt: unpause_cnt");
"Total: %ums Pause: %ums Unpause: %ums",
qdf_system_ticks_to_msecs(total),
qdf_system_ticks_to_msecs(pause),
qdf_system_ticks_to_msecs(unpause));
hddLog(QDF_TRACE_LEVEL_ERROR,
"reason_type: pause_cnt: unpause_cnt");
for (i = 0; i < WLAN_REASON_TYPE_MAX; i++) {
for (i = 1; i < WLAN_REASON_TYPE_MAX; i++) {
hddLog(QDF_TRACE_LEVEL_ERROR,
"%s: %d: %d",
hdd_reason_type_to_string(i),
@ -4845,7 +4862,8 @@ void wlan_hdd_display_netif_queue_history(hdd_context_t *hdd_ctx)
}
hddLog(QDF_TRACE_LEVEL_ERROR,
"Netif queue operation history:");
"Netif queue operation history: current index %d",
adapter->history_index);
hddLog(QDF_TRACE_LEVEL_ERROR,
"index: time: action_type: reason_type: pause_map");
@ -4888,7 +4906,10 @@ void wlan_hdd_clear_netif_queue_history(hdd_context_t *hdd_ctx)
sizeof(adapter->queue_oper_stats));
qdf_mem_zero(adapter->queue_oper_history,
sizeof(adapter->queue_oper_history));
adapter->history_index = 0;
adapter->start_time = adapter->last_time = qdf_system_ticks();
adapter->total_pause_time = 0;
adapter->total_unpause_time = 0;
status = hdd_get_next_adapter(hdd_ctx, adapter_node, &next);
adapter_node = next;
}

View file

@ -983,7 +983,7 @@ const char *hdd_reason_type_to_string(enum netif_reason_type reason)
CASE_RETURN_STRING(WLAN_PEER_UNAUTHORISED);
CASE_RETURN_STRING(WLAN_THERMAL_MITIGATION);
default:
return "Unknown";
return "Invalid";
}
}
@ -1010,7 +1010,7 @@ const char *hdd_action_type_to_string(enum netif_action_type action)
CASE_RETURN_STRING(WLAN_NETIF_CARRIER_ON);
CASE_RETURN_STRING(WLAN_NETIF_CARRIER_OFF);
default:
return "Unknown";
return "Invalid";
}
}
@ -1063,6 +1063,34 @@ void wlan_hdd_update_txq_timestamp(struct net_device *dev)
}
}
/**
* wlan_hdd_update_unpause_time() - update unpause time
* @adapter: adapter handle
*
* Return: none
*/
static void wlan_hdd_update_unpause_time(hdd_adapter_t *adapter)
{
qdf_time_t curr_time = qdf_system_ticks();
adapter->total_unpause_time += curr_time - adapter->last_time;
adapter->last_time = curr_time;
}
/**
* wlan_hdd_update_pause_time() - update pause time
* @adapter: adapter handle
*
* Return: none
*/
static void wlan_hdd_update_pause_time(hdd_adapter_t *adapter)
{
qdf_time_t curr_time = qdf_system_ticks();
adapter->total_pause_time += curr_time - adapter->last_time;
adapter->last_time = curr_time;
}
/**
* wlan_hdd_netif_queue_control() - Use for netif_queue related actions
* @adapter: adapter handle
@ -1100,6 +1128,7 @@ void wlan_hdd_netif_queue_control(hdd_adapter_t *adapter,
if (!adapter->pause_map) {
netif_tx_stop_all_queues(adapter->dev);
wlan_hdd_update_txq_timestamp(adapter->dev);
wlan_hdd_update_unpause_time(adapter);
}
adapter->pause_map |= (1 << reason);
spin_unlock_bh(&adapter->pause_map_lock);
@ -1108,16 +1137,20 @@ void wlan_hdd_netif_queue_control(hdd_adapter_t *adapter,
case WLAN_START_ALL_NETIF_QUEUE:
spin_lock_bh(&adapter->pause_map_lock);
adapter->pause_map &= ~(1 << reason);
if (!adapter->pause_map)
if (!adapter->pause_map) {
netif_tx_start_all_queues(adapter->dev);
wlan_hdd_update_pause_time(adapter);
}
spin_unlock_bh(&adapter->pause_map_lock);
break;
case WLAN_WAKE_ALL_NETIF_QUEUE:
spin_lock_bh(&adapter->pause_map_lock);
adapter->pause_map &= ~(1 << reason);
if (!adapter->pause_map)
if (!adapter->pause_map) {
netif_tx_wake_all_queues(adapter->dev);
wlan_hdd_update_pause_time(adapter);
}
spin_unlock_bh(&adapter->pause_map_lock);
break;
@ -1126,6 +1159,7 @@ void wlan_hdd_netif_queue_control(hdd_adapter_t *adapter,
if (!adapter->pause_map) {
netif_tx_stop_all_queues(adapter->dev);
wlan_hdd_update_txq_timestamp(adapter->dev);
wlan_hdd_update_unpause_time(adapter);
}
adapter->pause_map |= (1 << reason);
netif_carrier_off(adapter->dev);
@ -1136,8 +1170,10 @@ void wlan_hdd_netif_queue_control(hdd_adapter_t *adapter,
spin_lock_bh(&adapter->pause_map_lock);
netif_carrier_on(adapter->dev);
adapter->pause_map &= ~(1 << reason);
if (!adapter->pause_map)
if (!adapter->pause_map) {
netif_tx_start_all_queues(adapter->dev);
wlan_hdd_update_pause_time(adapter);
}
spin_unlock_bh(&adapter->pause_map_lock);
break;
@ -1146,6 +1182,7 @@ void wlan_hdd_netif_queue_control(hdd_adapter_t *adapter,
if (!adapter->pause_map) {
netif_tx_disable(adapter->dev);
wlan_hdd_update_txq_timestamp(adapter->dev);
wlan_hdd_update_unpause_time(adapter);
}
adapter->pause_map |= (1 << reason);
spin_unlock_bh(&adapter->pause_map_lock);
@ -1156,6 +1193,7 @@ void wlan_hdd_netif_queue_control(hdd_adapter_t *adapter,
if (!adapter->pause_map) {
netif_tx_disable(adapter->dev);
wlan_hdd_update_txq_timestamp(adapter->dev);
wlan_hdd_update_unpause_time(adapter);
}
adapter->pause_map |= (1 << reason);
netif_carrier_off(adapter->dev);