From f22263c8e0b85576d17a05e01c440bbcad07dd4c Mon Sep 17 00:00:00 2001 From: Sandeep Puligilla Date: Mon, 28 Aug 2017 13:15:15 -0700 Subject: [PATCH] qcacld-3.0: Decrease tx drain wait time during del bss wma_delete_bss is stuck for more than 400ms in failure scenario due to pending tx packets to drain. -Decrease the wait time to 20ms(2ms*max_wait_iterations) to avoid the delete bss stuck issue. -Tx drain wait feature added for LFR2.0 feature so moved the code under the LFR2.0 macro. Change-Id: I33b56bb627ac914ca6fe96949de373b015853fc9 CRs-Fixed: 2097269 --- core/wma/src/wma_dev_if.c | 51 ++++++++++++++++++++++++++++++--------- 1 file changed, 39 insertions(+), 12 deletions(-) diff --git a/core/wma/src/wma_dev_if.c b/core/wma/src/wma_dev_if.c index 43204a3af3c0..ea7f9a0e5c98 100644 --- a/core/wma/src/wma_dev_if.c +++ b/core/wma/src/wma_dev_if.c @@ -4928,6 +4928,44 @@ fail_del_bss_ho_fail: (void *)params, 0); } +#ifdef WLAN_FEATURE_HOST_ROAM +/** + * wma_wait_tx_complete() - Wait till tx packets are drained + * @wma: wma handle + * @session_id: vdev id + * + * Return: none + */ +static void wma_wait_tx_complete(tp_wma_handle wma, + uint32_t session_id) +{ + struct cdp_pdev *pdev; + uint8_t max_wait_iterations = 0; + void *soc = cds_get_context(QDF_MODULE_ID_SOC); + + if (!wma->interfaces[session_id].is_vdev_valid) { + WMA_LOGE("%s: Vdev is not valid: %d", + __func__, session_id); + return; + } + + pdev = cds_get_context(QDF_MODULE_ID_TXRX); + max_wait_iterations = + wma->interfaces[session_id].delay_before_vdev_stop / + WMA_TX_Q_RECHECK_TIMER_WAIT; + + while (cdp_get_tx_pending(soc, pdev) && max_wait_iterations) { + WMA_LOGW(FL("Waiting for outstanding packet to drain.")); + qdf_wait_single_event(&wma->tx_queue_empty_event, + WMA_TX_Q_RECHECK_TIMER_WAIT); + max_wait_iterations--; + } +} +#else +static void wma_wait_tx_complete(tp_wma_handle wma) +{ +} +#endif /** * wma_delete_bss() - process delete bss request from upper layer * @wma: wma handle @@ -4942,7 +4980,6 @@ void wma_delete_bss(tp_wma_handle wma, tpDeleteBssParams params) struct wma_target_req *msg; QDF_STATUS status = QDF_STATUS_SUCCESS; uint8_t peer_id; - uint8_t max_wait_iterations = 0; struct cdp_vdev *txrx_vdev = NULL; bool roam_synch_in_progress = false; struct wma_txrx_node *iface; @@ -5028,17 +5065,7 @@ void wma_delete_bss(tp_wma_handle wma, tpDeleteBssParams params) WMA_LOGW(FL("Outstanding msdu packets: %d"), cdp_get_tx_pending(soc, pdev)); - - max_wait_iterations = - wma->interfaces[params->smesessionId].delay_before_vdev_stop / - WMA_TX_Q_RECHECK_TIMER_WAIT; - - while (cdp_get_tx_pending(soc, pdev) && max_wait_iterations) { - WMA_LOGW(FL("Waiting for outstanding packet to drain.")); - qdf_wait_single_event(&wma->tx_queue_empty_event, - WMA_TX_Q_RECHECK_TIMER_MAX_WAIT); - max_wait_iterations--; - } + wma_wait_tx_complete(wma, params->smesessionId); if (cdp_get_tx_pending(soc, pdev)) { WMA_LOGW(FL("Outstanding msdu packets before VDEV_STOP : %d"),