qcacmn: Add debug log to print link vote id

Add debug log to print details about the link vote id.

Change-Id: I2e89a3d6f06a0f3ec38ea9e8345d854553dbe86d
CRs-Fixed: 2964961
This commit is contained in:
Alan Chen
2021-06-08 13:30:36 -07:00
committed by Madan Koyyalamudi
parent 1dd538e4b9
commit 75c2cf25ab
4 changed files with 141 additions and 41 deletions

102
htc/htc.c
View File

@@ -322,6 +322,70 @@ void htc_update_rx_bundle_stats(void *ctx, uint8_t no_of_pkt_in_bundle)
}
#endif
#ifdef WLAN_DEBUG_LINK_VOTE
static qdf_atomic_t htc_link_vote_ids[HTC_LINK_VOTE_INVALID_MAX_USER_ID];
static void htc_init_link_vote_ids(void)
{
uint32_t i;
for (i = HTC_LINK_VOTE_INVALID_MIN_USER_ID;
i < HTC_LINK_VOTE_INVALID_MAX_USER_ID; i++)
qdf_atomic_init(&htc_link_vote_ids[i]);
}
void htc_log_link_user_votes(void)
{
uint32_t i;
uint32_t link_vote;
for (i = HTC_LINK_VOTE_INVALID_MIN_USER_ID + 1;
i < HTC_LINK_VOTE_INVALID_MAX_USER_ID; i++) {
link_vote = qdf_atomic_read(&htc_link_vote_ids[i]);
if (link_vote)
HTC_NOFL_INFO("Link vote %d user id: %d",
link_vote, i);
}
}
void htc_vote_link_down(HTC_HANDLE htc_handle, enum htc_link_vote_user_id id)
{
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(htc_handle);
if (!target->hif_dev)
return;
if (id >= HTC_LINK_VOTE_INVALID_MAX_USER_ID ||
id <= HTC_LINK_VOTE_INVALID_MIN_USER_ID) {
HTC_ERROR("invalid id: %d", id);
return;
}
hif_vote_link_down(target->hif_dev);
qdf_atomic_dec(&htc_link_vote_ids[id]);
}
void htc_vote_link_up(HTC_HANDLE htc_handle, enum htc_link_vote_user_id id)
{
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(htc_handle);
if (!target->hif_dev)
return;
if (id >= HTC_LINK_VOTE_INVALID_MAX_USER_ID ||
id <= HTC_LINK_VOTE_INVALID_MIN_USER_ID) {
HTC_ERROR("invalid link vote user id: %d", id);
return;
}
hif_vote_link_up(target->hif_dev);
qdf_atomic_inc(&htc_link_vote_ids[id]);
}
#else
static inline
void htc_init_link_vote_ids(void)
{
}
#endif
/* registered target arrival callback from the HIF layer */
HTC_HANDLE htc_create(void *ol_sc, struct htc_init_info *pInfo,
qdf_device_t osdev, uint32_t con_mode)
@@ -421,6 +485,8 @@ HTC_HANDLE htc_create(void *ol_sc, struct htc_init_info *pInfo,
htc_hang_event_notifier_register(target);
htc_init_link_vote_ids();
return (HTC_HANDLE) target;
}
@@ -1126,42 +1192,6 @@ void htc_clear_bundle_stats(HTC_HANDLE HTCHandle)
}
#endif
/**
* htc_vote_link_down - API to vote for link down
* @htc_handle: HTC handle
*
* API for upper layers to call HIF to vote for link down
*
* Return: void
*/
void htc_vote_link_down(HTC_HANDLE htc_handle)
{
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(htc_handle);
if (!target->hif_dev)
return;
hif_vote_link_down(target->hif_dev);
}
/**
* htc_vote_link_up - API to vote for link up
* @htc_handle: HTC Handle
*
* API for upper layers to call HIF to vote for link up
*
* Return: void
*/
void htc_vote_link_up(HTC_HANDLE htc_handle)
{
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(htc_handle);
if (!target->hif_dev)
return;
hif_vote_link_up(target->hif_dev);
}
/**
* htc_can_suspend_link - API to query HIF for link status
* @htc_handle: HTC Handle

View File

@@ -388,6 +388,26 @@ struct htc_endpoint_stats {
uint32_t RxAllocThreshBytes;
};
/**
* htc_link_vote_user_id - user ids for each link vote type
* @HTC_LINK_VOTE_INVALID_MIN_USER_ID: min user id
* @HTC_LINK_VOTE_SAP_USER_ID: sap user id
* @HTC_LINK_VOTE_GO_USER_ID: go user id
* @HTC_LINK_VOTE_NDP_USER_ID: ndp user id
* @HTC_LINK_VOTE_SAP_DFS_USER_ID: sap dfs user id
* @HTC_LINK_VOTE_STA_USER_ID: sta user id
* @HTC_LINK_VOTE_INVALID_MAX_USER_ID: max user id
*/
enum htc_link_vote_user_id {
HTC_LINK_VOTE_INVALID_MIN_USER_ID = 0,
HTC_LINK_VOTE_SAP_USER_ID = 1,
HTC_LINK_VOTE_GO_USER_ID = 2,
HTC_LINK_VOTE_NDP_USER_ID = 3,
HTC_LINK_VOTE_SAP_DFS_USER_ID = 4,
HTC_LINK_VOTE_STA_USER_ID = 5,
HTC_LINK_VOTE_INVALID_MAX_USER_ID
};
/* ------ Function Prototypes ------ */
/**
* htc_create - Create an instance of HTC over the underlying HIF device
@@ -758,8 +778,7 @@ void htc_global_credit_flow_enable(void);
/* Disable ASPM : Disable PCIe low power */
bool htc_can_suspend_link(HTC_HANDLE HTCHandle);
void htc_vote_link_down(HTC_HANDLE HTCHandle);
void htc_vote_link_up(HTC_HANDLE HTCHandle);
#ifdef IPA_OFFLOAD
void htc_ipa_get_ce_resource(HTC_HANDLE htc_handle,
qdf_shared_mem_t **ce_sr,
@@ -811,6 +830,55 @@ int32_t htc_dec_return_runtime_cnt(HTC_HANDLE htc)
}
#endif
#ifdef WLAN_DEBUG_LINK_VOTE
/**
* htc_log_link_user_votes - API to log link user votes
*
* API to log the link user votes
*
* Return: void
*/
void htc_log_link_user_votes(void);
/**
* htc_vote_link_down - API to vote for link down
* @htc_handle: HTC handle
* @id: PCIe link vote user id
*
* API for upper layers to call HIF to vote for link down
*
* Return: void
*/
void htc_vote_link_down(HTC_HANDLE htc_handle, enum htc_link_vote_user_id id);
/**
* htc_vote_link_up - API to vote for link up
* @htc_handle: HTC Handle
* @id: PCIe link vote user id
*
* API for upper layers to call HIF to vote for link up
*
* Return: void
*/
void htc_vote_link_up(HTC_HANDLE htc_handle, enum htc_link_vote_user_id id);
#else
static inline
void htc_log_link_user_votes(void)
{
}
static inline
void htc_vote_link_down(HTC_HANDLE htc_handle, enum htc_link_vote_user_id id)
{
}
static inline
void htc_vote_link_up(HTC_HANDLE htc_handle, enum htc_link_vote_user_id id)
{
}
#endif
/**
* htc_set_async_ep() - set async HTC end point
* user should call this function after htc_connect_service before

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013-2014 The Linux Foundation. All rights reserved.
* Copyright (c) 2013-2014, 2021 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@@ -38,4 +38,6 @@
QDF_TRACE(QDF_MODULE_ID_HTC, QDF_TRACE_LEVEL_INFO, ## args)
#define HTC_TRACE(args ...) \
QDF_TRACE(QDF_MODULE_ID_HTC, QDF_TRACE_LEVEL_DEBUG, ## args)
#define HTC_NOFL_INFO(args...) \
QDF_TRACE_INFO_NO_FL(QDF_MODULE_ID_HTC, ## args)
#endif /*HTC_DEBUG_H_ */

View File

@@ -166,7 +166,7 @@ target_if_vote_for_link_down(struct wlan_objmgr_psoc *psoc,
}
if (psoc_wakelock->is_link_up) {
htc_vote_link_down(htc_handle);
htc_vote_link_down(htc_handle, HTC_LINK_VOTE_SAP_DFS_USER_ID);
qdf_runtime_pm_allow_suspend(&psoc_wakelock->prevent_runtime_lock);
psoc_wakelock->is_link_up = false;
}
@@ -185,7 +185,7 @@ target_if_vote_for_link_up(struct wlan_objmgr_psoc *psoc,
}
if (!psoc_wakelock->is_link_up) {
htc_vote_link_up(htc_handle);
htc_vote_link_up(htc_handle, HTC_LINK_VOTE_SAP_DFS_USER_ID);
qdf_runtime_pm_prevent_suspend(&psoc_wakelock->prevent_runtime_lock);
psoc_wakelock->is_link_up = true;
}