summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYue Ma <yuem@qca.qualcomm.com>2014-08-19 18:15:44 -0700
committerAkash Patel <c_akashp@qca.qualcomm.com>2014-08-20 18:39:55 -0700
commit12e1e30caa76478f829144c364228f861dceb443 (patch)
tree8f22b37e811cb13c17527d15f5aed4669f31a1d2
parentc49176b4d93bbb4c7daa147372b05778f818d733 (diff)
qca_cld: Record HTC TX credit information for debug purpose
Add debug support to record HTC TX credit information when send WMI commands and receive credit report from FW. Change-Id: I3ec071920e129eae23697801e6c5eb2486726d36 CRs-fixed: 710278
-rw-r--r--CORE/SERVICES/HTC/htc.c2
-rw-r--r--CORE/SERVICES/HTC/htc_internal.h17
-rw-r--r--CORE/SERVICES/HTC/htc_send.c31
3 files changed, 49 insertions, 1 deletions
diff --git a/CORE/SERVICES/HTC/htc.c b/CORE/SERVICES/HTC/htc.c
index a161bd9abee8..4058e31c705a 100644
--- a/CORE/SERVICES/HTC/htc.c
+++ b/CORE/SERVICES/HTC/htc.c
@@ -180,6 +180,7 @@ static void HTCCleanup(HTC_TARGET *target)
adf_os_spinlock_destroy(&target->HTCLock);
adf_os_spinlock_destroy(&target->HTCRxLock);
adf_os_spinlock_destroy(&target->HTCTxLock);
+ adf_os_spinlock_destroy(&target->HTCCreditLock);
/* free our instance */
A_FREE(target);
@@ -208,6 +209,7 @@ HTC_HANDLE HTCCreate(void *ol_sc, HTC_INIT_INFO *pInfo, adf_os_device_t osdev)
adf_os_spinlock_init(&target->HTCLock);
adf_os_spinlock_init(&target->HTCRxLock);
adf_os_spinlock_init(&target->HTCTxLock);
+ adf_os_spinlock_init(&target->HTCCreditLock);
do {
A_MEMCPY(&target->HTCInitInfo,pInfo,sizeof(HTC_INIT_INFO));
diff --git a/CORE/SERVICES/HTC/htc_internal.h b/CORE/SERVICES/HTC/htc_internal.h
index 4ea6113a6da7..c50e61dd27d6 100644
--- a/CORE/SERVICES/HTC/htc_internal.h
+++ b/CORE/SERVICES/HTC/htc_internal.h
@@ -86,6 +86,20 @@ extern "C" {
#define HTC_SERVICE_TX_PACKET_TAG HTC_TX_PACKET_TAG_INTERNAL
+#define HTC_CREDIT_HISTORY_MAX 1024
+
+typedef enum {
+ HTC_REQUEST_CREDIT,
+ HTC_PROCESS_CREDIT_REPORT,
+} htc_credit_exchange_type;
+
+typedef struct {
+ htc_credit_exchange_type type;
+ A_UINT64 time;
+ A_UINT32 tx_credit;
+ A_UINT32 htc_tx_queue_depth;
+} HTC_CREDIT_HISTORY;
+
typedef struct _HTC_ENDPOINT {
HTC_ENDPOINT_ID Id;
HTC_SERVICE_ID ServiceID; /* service ID this endpoint is bound to
@@ -146,6 +160,7 @@ typedef struct _HTC_TARGET {
adf_os_spinlock_t HTCLock;
adf_os_spinlock_t HTCRxLock;
adf_os_spinlock_t HTCTxLock;
+ adf_os_spinlock_t HTCCreditLock;
A_UINT32 HTCStateFlags;
void *host_handle;
HTC_INIT_INFO HTCInitInfo;
@@ -189,6 +204,8 @@ typedef struct _HTC_TARGET {
#define UNLOCK_HTC_RX(t) adf_os_spin_unlock_bh(&(t)->HTCRxLock);
#define LOCK_HTC_TX(t) adf_os_spin_lock_bh(&(t)->HTCTxLock);
#define UNLOCK_HTC_TX(t) adf_os_spin_unlock_bh(&(t)->HTCTxLock);
+#define LOCK_HTC_CREDIT(t) adf_os_spin_lock_bh(&(t)->HTCCreditLock);
+#define UNLOCK_HTC_CREDIT(t) adf_os_spin_unlock_bh(&(t)->HTCCreditLock);
#define GET_HTC_TARGET_FROM_HANDLE(hnd) ((HTC_TARGET *)(hnd))
diff --git a/CORE/SERVICES/HTC/htc_send.c b/CORE/SERVICES/HTC/htc_send.c
index 4b9257f342ed..6cc7bccf0e57 100644
--- a/CORE/SERVICES/HTC/htc_send.c
+++ b/CORE/SERVICES/HTC/htc_send.c
@@ -60,6 +60,20 @@ static unsigned ep_debug_mask = (1 << ENDPOINT_0) | (1 << ENDPOINT_1) | (1 << EN
#define ENABLE_BUNDLE_TX 0
#endif
+/* HTC Control Path Credit History */
+A_UINT32 g_htc_credit_history_idx = 0;
+HTC_CREDIT_HISTORY htc_credit_history_buffer[HTC_CREDIT_HISTORY_MAX];
+
+#define HTC_CREDIT_RECORD(a, b, c) { \
+ if (HTC_CREDIT_HISTORY_MAX <= g_htc_credit_history_idx) \
+ g_htc_credit_history_idx = 0; \
+ htc_credit_history_buffer[g_htc_credit_history_idx].type = a; \
+ htc_credit_history_buffer[g_htc_credit_history_idx].time = \
+ adf_get_boottime(); \
+ htc_credit_history_buffer[g_htc_credit_history_idx].tx_credit = b; \
+ htc_credit_history_buffer[g_htc_credit_history_idx].htc_tx_queue_depth = c; \
+ g_htc_credit_history_idx++; \
+} \
void HTC_dump_counter_info(HTC_HANDLE HTCHandle)
{
@@ -577,8 +591,16 @@ void GetHTCSendPacketsCreditBased(HTC_TARGET *target,
/* check if we need credits back from the target */
if (pEndpoint->TxCredits <= pEndpoint->TxCreditsPerMaxMsg) {
- /* tell the target we need credits ASAP! */
+ /* tell the target we need credits ASAP! */
sendFlags |= HTC_FLAGS_NEED_CREDIT_UPDATE;
+
+ if (pEndpoint->ServiceID == WMI_CONTROL_SVC) {
+ LOCK_HTC_CREDIT(target);
+ HTC_CREDIT_RECORD(HTC_REQUEST_CREDIT, pEndpoint->TxCredits,
+ HTC_PACKET_QUEUE_DEPTH(&pEndpoint->TxQueue));
+ UNLOCK_HTC_CREDIT(target);
+ }
+
INC_HTC_EP_STAT(pEndpoint, TxCreditLowIndications, 1);
#if DEBUG_CREDIT
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,(" EP%d Needs Credits\n", pEndpoint->Id));
@@ -1590,6 +1612,13 @@ void HTCProcessCreditRpt(HTC_TARGET *target, HTC_CREDIT_REPORT *pRpt, int NumEnt
#else
pEndpoint->TxCredits += rpt_credits;
+ if (pEndpoint->ServiceID == WMI_CONTROL_SVC) {
+ LOCK_HTC_CREDIT(target);
+ HTC_CREDIT_RECORD(HTC_PROCESS_CREDIT_REPORT, pEndpoint->TxCredits,
+ HTC_PACKET_QUEUE_DEPTH(&pEndpoint->TxQueue));
+ UNLOCK_HTC_CREDIT(target);
+ }
+
if (pEndpoint->TxCredits && HTC_PACKET_QUEUE_DEPTH(&pEndpoint->TxQueue)) {
UNLOCK_HTC_TX(target);
#ifdef ATH_11AC_TXCOMPACT