qcacmn: Print re-queue message based on threshold

When packet tx fails at transport layer, packet is re-queued and given to
HIF layer again. In this change, print the warning message about re-queue
only when tx fails for 5 consecutive attempts due to no resources
available at HIF layer.
Since re-queuing is not fatal, it need not be printed on every attempt.

Change-Id: I00082470420e29dfe4fb7a745ac709a682ba032e
CRs-Fixed: 2621763
This commit is contained in:
Manoj Ekbote
2020-01-15 22:10:25 -08:00
committed by nshrivas
parent c6e9bd033c
commit 1c1ef8c2bd
4 changed files with 72 additions and 8 deletions

View File

@@ -726,6 +726,8 @@ static void reset_endpoint_states(HTC_TARGET *target)
INIT_HTC_PACKET_QUEUE(&pEndpoint->RxBufferHoldQueue); INIT_HTC_PACKET_QUEUE(&pEndpoint->RxBufferHoldQueue);
pEndpoint->target = target; pEndpoint->target = target;
pEndpoint->TxCreditFlowEnabled = (bool)htc_credit_flow; pEndpoint->TxCreditFlowEnabled = (bool)htc_credit_flow;
pEndpoint->num_requeues_warn = 0;
pEndpoint->total_num_requeues = 0;
qdf_atomic_init(&pEndpoint->TxProcessCount); qdf_atomic_init(&pEndpoint->TxProcessCount);
} }
} }

View File

@@ -654,6 +654,15 @@ A_STATUS htc_add_receive_pkt_multiple(HTC_HANDLE HTCHandle,
bool htc_is_endpoint_active(HTC_HANDLE HTCHandle, bool htc_is_endpoint_active(HTC_HANDLE HTCHandle,
HTC_ENDPOINT_ID Endpoint); HTC_ENDPOINT_ID Endpoint);
/**
* htc_set_pkt_dbg - Set up debug flag for HTC packets
* @HTCHandle - HTC handle
* @dbg_flag - enable or disable flag
*
* Return: none
*/
void htc_set_pkt_dbg(HTC_HANDLE handle, A_BOOL dbg_flag);
/** /**
* htc_set_nodrop_pkt - Set up nodrop pkt flag for mboxping nodrop pkt * htc_set_nodrop_pkt - Set up nodrop pkt flag for mboxping nodrop pkt
* @HTCHandle - HTC handle * @HTCHandle - HTC handle

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013-2019 The Linux Foundation. All rights reserved. * Copyright (c) 2013-2020 The Linux Foundation. All rights reserved.
* *
* Permission to use, copy, modify, and/or distribute this software for * Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the * any purpose with or without fee is hereby granted, provided that the
@@ -167,6 +167,12 @@ typedef struct _HTC_ENDPOINT {
bool TxCreditFlowEnabled; bool TxCreditFlowEnabled;
bool async_update; /* packets can be queued asynchronously */ bool async_update; /* packets can be queued asynchronously */
qdf_spinlock_t lookup_queue_lock; qdf_spinlock_t lookup_queue_lock;
/* number of consecutive requeue attempts used for print */
uint32_t num_requeues_warn;
/* total number of requeue attempts */
uint32_t total_num_requeues;
} HTC_ENDPOINT; } HTC_ENDPOINT;
#ifdef HTC_EP_STAT_PROFILING #ifdef HTC_EP_STAT_PROFILING
@@ -248,6 +254,10 @@ typedef struct _HTC_TARGET {
uint8_t wmi_ep_count; uint8_t wmi_ep_count;
/* Flag to indicate whether htc header length check is required */ /* Flag to indicate whether htc header length check is required */
bool htc_hdr_length_check; bool htc_hdr_length_check;
/* flag to enable packet send debug */
bool htc_pkt_dbg;
} HTC_TARGET; } HTC_TARGET;

View File

@@ -30,6 +30,9 @@
#define HTC_DATA_RESOURCE_THRS 256 #define HTC_DATA_RESOURCE_THRS 256
#define HTC_DATA_MINDESC_PERPACKET 2 #define HTC_DATA_MINDESC_PERPACKET 2
/* maximum number of requeue attempts before print */
#define MAX_REQUEUE_WARN 5
enum HTC_SEND_QUEUE_RESULT { enum HTC_SEND_QUEUE_RESULT {
HTC_SEND_QUEUE_OK = 0, /* packet was queued */ HTC_SEND_QUEUE_OK = 0, /* packet was queued */
HTC_SEND_QUEUE_DROP = 1, /* this packet should be dropped */ HTC_SEND_QUEUE_DROP = 1, /* this packet should be dropped */
@@ -871,6 +874,13 @@ static QDF_STATUS htc_issue_packets(HTC_TARGET *target,
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
("hif_send Failed status:%d\n", ("hif_send Failed status:%d\n",
status)); status));
} else {
if (target->htc_pkt_dbg) {
if (pEndpoint->num_requeues_warn >
MAX_REQUEUE_WARN) {
hif_print_napi_stats(target->hif_dev);
}
}
} }
/* only unmap if we mapped in this function */ /* only unmap if we mapped in this function */
@@ -907,10 +917,16 @@ static QDF_STATUS htc_issue_packets(HTC_TARGET *target,
rt_put = false; rt_put = false;
} }
} }
if (qdf_unlikely(QDF_IS_STATUS_ERROR(status))) { if (qdf_unlikely(QDF_IS_STATUS_ERROR(status))) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, if (((status == QDF_STATUS_E_RESOURCES) &&
("htc_issue_packets, failed pkt:0x%pK status:%d", (pEndpoint->num_requeues_warn > MAX_REQUEUE_WARN)) ||
pPacket, status)); (status != QDF_STATUS_E_RESOURCES)) {
QDF_TRACE(QDF_MODULE_ID_HIF, QDF_TRACE_LEVEL_INFO,
"failed pkt:0x%pK status:%d endpoint:%d",
pPacket, status, pEndpoint->Id);
}
} }
AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("-htc_issue_packets\n")); AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("-htc_issue_packets\n"));
@@ -1230,6 +1246,7 @@ static enum HTC_SEND_QUEUE_RESULT htc_try_send(HTC_TARGET *target,
int tx_resources; int tx_resources;
int overflow; int overflow;
enum HTC_SEND_QUEUE_RESULT result = HTC_SEND_QUEUE_OK; enum HTC_SEND_QUEUE_RESULT result = HTC_SEND_QUEUE_OK;
QDF_STATUS status;
AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("+htc_try_send (Queue:%pK Depth:%d)\n", AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("+htc_try_send (Queue:%pK Depth:%d)\n",
pCallersSendQueue, pCallersSendQueue,
@@ -1487,13 +1504,29 @@ static enum HTC_SEND_QUEUE_RESULT htc_try_send(HTC_TARGET *target,
UNLOCK_HTC_TX(target); UNLOCK_HTC_TX(target);
/* send what we can */ /* send what we can */
if (htc_issue_packets(target, pEndpoint, &sendQueue)) { status = htc_issue_packets(target, pEndpoint, &sendQueue);
if (status) {
int i; int i;
result = HTC_SEND_QUEUE_DROP; result = HTC_SEND_QUEUE_DROP;
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
("htc_issue_packets, failed status:%d put it back to head of callersSendQueue", switch (status) {
result)); case QDF_STATUS_E_RESOURCES:
if (pEndpoint->num_requeues_warn <= MAX_REQUEUE_WARN) {
pEndpoint->num_requeues_warn++;
pEndpoint->total_num_requeues++;
break;
} else {
pEndpoint->total_num_requeues++;
pEndpoint->num_requeues_warn = 0;
}
default:
QDF_TRACE(QDF_MODULE_ID_HIF, QDF_TRACE_LEVEL_INFO,
"htc_issue_packets, failed status:%d"
"endpoint:%d, put it back to head of"
"callersSendQueue", result, pEndpoint->Id);
break;
}
for (i = HTC_PACKET_QUEUE_DEPTH(&sendQueue); i > 0; i--) for (i = HTC_PACKET_QUEUE_DEPTH(&sendQueue); i > 0; i--)
hif_pm_runtime_put(target->hif_dev); hif_pm_runtime_put(target->hif_dev);
@@ -1503,6 +1536,9 @@ static enum HTC_SEND_QUEUE_RESULT htc_try_send(HTC_TARGET *target,
HTC_PACKET_QUEUE_TRANSFER_TO_HEAD(&pEndpoint->TxQueue, HTC_PACKET_QUEUE_TRANSFER_TO_HEAD(&pEndpoint->TxQueue,
&sendQueue); &sendQueue);
break; break;
} else {
if (pEndpoint->num_requeues_warn)
pEndpoint->num_requeues_warn = 0;
} }
if (!IS_TX_CREDIT_FLOW_ENABLED(pEndpoint)) { if (!IS_TX_CREDIT_FLOW_ENABLED(pEndpoint)) {
@@ -2441,6 +2477,13 @@ bool htc_is_endpoint_active(HTC_HANDLE HTCHandle, HTC_ENDPOINT_ID Endpoint)
return true; return true;
} }
void htc_set_pkt_dbg(HTC_HANDLE handle, A_BOOL dbg_flag)
{
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(handle);
target->htc_pkt_dbg = dbg_flag;
}
void htc_set_nodrop_pkt(HTC_HANDLE HTCHandle, A_BOOL isNodropPkt) void htc_set_nodrop_pkt(HTC_HANDLE HTCHandle, A_BOOL isNodropPkt)
{ {
HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle); HTC_TARGET *target = GET_HTC_TARGET_FROM_HANDLE(HTCHandle);