diff --git a/htc/htc.c b/htc/htc.c index d2457f1c73..dc02a63011 100644 --- a/htc/htc.c +++ b/htc/htc.c @@ -363,6 +363,14 @@ HTC_HANDLE htc_create(void *ol_sc, struct htc_init_info *pInfo, target->osdev = osdev; target->con_mode = con_mode; + /* If htc_ready_timeout_ms is not configured from CFG, + * assign the default timeout value here. + */ + + if (!target->HTCInitInfo.htc_ready_timeout_ms) + target->HTCInitInfo.htc_ready_timeout_ms = + HTC_CONTROL_RX_TIMEOUT; + reset_endpoint_states(target); INIT_HTC_PACKET_QUEUE(&target->ControlBufferTXFreeList); diff --git a/htc/htc_api.h b/htc/htc_api.h index 18fd830b0b..3543b4f245 100644 --- a/htc/htc_api.h +++ b/htc/htc_api.h @@ -57,6 +57,8 @@ struct htc_init_info { void (*target_initial_wakeup_cb)(void *cb_ctx); void *target_psoc; uint32_t cfg_wmi_credit_cnt; + /* HTC Pipe Ready Timeout in msecs */ + uint32_t htc_ready_timeout_ms; }; /* Struct for HTC layer packet stats*/ diff --git a/htc/htc_internal.h b/htc/htc_internal.h index 1b60255925..8119ab1a6e 100644 --- a/htc/htc_internal.h +++ b/htc/htc_internal.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2013-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 @@ -400,6 +400,9 @@ htc_send_complete_check(HTC_ENDPOINT *pEndpoint, int force) { #define DEBUG_BUNDLE 0 #endif +/* HTC Control message receive timeout msec */ +#define HTC_CONTROL_RX_TIMEOUT 6000 + #if defined(HIF_SDIO) || defined(HIF_USB) #ifndef ENABLE_BUNDLE_TX #define ENABLE_BUNDLE_TX 1 diff --git a/htc/htc_recv.c b/htc/htc_recv.c index 2d6047da83..747505b331 100644 --- a/htc/htc_recv.c +++ b/htc/htc_recv.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2013-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 @@ -21,9 +21,6 @@ #include "htc_credit_history.h" #include /* qdf_nbuf_t */ -/* HTC Control message receive timeout msec */ -#define HTC_CONTROL_RX_TIMEOUT 6000 - #if defined(WLAN_DEBUG) || defined(DEBUG) void debug_dump_bytes(uint8_t *buffer, uint16_t length, char *pDescription) { @@ -433,7 +430,6 @@ QDF_STATUS htc_rx_completion_handler(void *Context, qdf_nbuf_t netbuf, /* Requester will clear this flag */ target->CtrlResponseProcessing = true; UNLOCK_HTC_RX(target); - qdf_event_set(&target->ctrl_response_valid); break; #ifdef HTC_MSG_WAKEUP_FROM_SUSPEND_ID @@ -619,7 +615,7 @@ QDF_STATUS htc_wait_recv_ctrl_message(HTC_TARGET *target) /* Wait for BMI request/response transaction to complete */ if (qdf_wait_single_event(&target->ctrl_response_valid, - HTC_CONTROL_RX_TIMEOUT)) { + (target->HTCInitInfo.htc_ready_timeout_ms))) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Failed to receive control message\n")); return QDF_STATUS_E_FAILURE;