From 40f76b57f878ed20bd2e2c3df7553dd672c8541a Mon Sep 17 00:00:00 2001 From: Mohit Khanna Date: Fri, 30 Nov 2018 14:10:55 -0800 Subject: [PATCH] qcacmn: Fix regression from DP init-deinit path changes MCL DP initialization path is running into issues due to change I5732453f617bdc16995fda916b645c41845c3ecb. Fix the same. Move flow control lock variables to re-use region. This is needed since flow control deinit happens in dp_soc_detach, while in dp_soc_deinit, the soc memory is being partially reset. De-init HTT memory in dp_soc_deinit and free HTT handle in dp_soc_detach. The existing code was not freeing HTT packets for MCL case and freeing the HTT handle twice. CRs-Fixed: 2359409 Change-Id: I52dcccc0444d4ce139a29ffcb884598bbacda88f --- dp/wifi3.0/dp_htt.c | 28 +++++++++++++--------------- dp/wifi3.0/dp_htt.h | 11 +++++++++-- dp/wifi3.0/dp_main.c | 4 ++-- dp/wifi3.0/dp_types.h | 27 +++++++++++++++++---------- 4 files changed, 41 insertions(+), 29 deletions(-) diff --git a/dp/wifi3.0/dp_htt.c b/dp/wifi3.0/dp_htt.c index e22d373a1f..8508a2f310 100644 --- a/dp/wifi3.0/dp_htt.c +++ b/dp/wifi3.0/dp_htt.c @@ -3272,6 +3272,12 @@ fail2: return NULL; } +void htt_soc_htc_dealloc(struct htt_soc *htt_handle) +{ + htt_htc_misc_pkt_pool_free(htt_handle); + htt_htc_pkt_pool_free(htt_handle); +} + /* * htt_soc_htc_prealloc() - HTC memory prealloc * @htt_soc: SOC level HTT handle @@ -3279,8 +3285,7 @@ fail2: * Return: QDF_STATUS_SUCCESS on Success or * QDF_STATUS_E_NOMEM on allocation failure */ -QDF_STATUS -htt_soc_htc_prealloc(struct htt_soc *soc) +QDF_STATUS htt_soc_htc_prealloc(struct htt_soc *soc) { int i; @@ -3300,22 +3305,15 @@ htt_soc_htc_prealloc(struct htt_soc *soc) } /* - * htt_soc_detach() - Detach SOC level HTT - * @htt_soc: HTT SOC handle + * htt_soc_detach() - Free SOC level HTT handle + * @htt_hdl: HTT SOC handle */ -void -htt_soc_detach(void *htt_soc) +void htt_soc_detach(void *htt_hdl) { - struct htt_soc *soc = (struct htt_soc *)htt_soc; - struct dp_soc *dpsoc = soc->dp_soc; + struct htt_soc *htt_handle = (struct htt_soc *)htt_hdl; - if (dpsoc->dp_soc_reinit) { - htt_htc_misc_pkt_pool_free(soc); - htt_htc_pkt_pool_free(soc); - } else { - HTT_TX_MUTEX_DESTROY(&soc->htt_tx_mutex); - qdf_mem_free(soc); - } + HTT_TX_MUTEX_DESTROY(&htt_handle->htt_tx_mutex); + qdf_mem_free(htt_handle); } /** diff --git a/dp/wifi3.0/dp_htt.h b/dp/wifi3.0/dp_htt.h index 680b3dcf90..32e8d079a7 100644 --- a/dp/wifi3.0/dp_htt.h +++ b/dp/wifi3.0/dp_htt.h @@ -151,6 +151,14 @@ void * htt_soc_initialize(void *htt_soc, void *ctrl_psoc, HTC_HANDLE htc_soc, void *hal_soc, qdf_device_t osdev); +/* + * htt_soc_htc_dealloc() - HTC memory de-alloc + * @htt_soc: SOC level HTT handle + * + * Return: None + */ +void htt_soc_htc_dealloc(struct htt_soc *htt_handle); + /* * htt_soc_htc_prealloc() - HTC memory prealloc * @htt_soc: SOC level HTT handle @@ -158,8 +166,7 @@ htt_soc_initialize(void *htt_soc, void *ctrl_psoc, HTC_HANDLE htc_soc, * Return: QDF_STATUS_SUCCESS on success or * QDF_STATUS_E_NO_MEM on allocation failure */ -QDF_STATUS -htt_soc_htc_prealloc(struct htt_soc *htt_soc); +QDF_STATUS htt_soc_htc_prealloc(struct htt_soc *htt_soc); void htt_soc_detach(void *soc); diff --git a/dp/wifi3.0/dp_main.c b/dp/wifi3.0/dp_main.c index 80531c4c3e..4d100b0c38 100644 --- a/dp/wifi3.0/dp_main.c +++ b/dp/wifi3.0/dp_main.c @@ -3658,7 +3658,7 @@ static void dp_soc_deinit(void *txrx_soc) qdf_spinlock_destroy(&soc->peer_ref_mutex); qdf_spinlock_destroy(&soc->htt_stats.lock); - htt_soc_detach(soc->htt_handle); + htt_soc_htc_dealloc(soc->htt_handle); qdf_spinlock_destroy(&soc->rx.defrag.defrag_lock); @@ -3758,8 +3758,8 @@ static void dp_soc_detach(void *txrx_soc) dp_srng_cleanup(soc, &soc->reo_status_ring, REO_STATUS, 0); dp_hw_link_desc_pool_cleanup(soc); - soc->dp_soc_reinit = 0; htt_soc_detach(soc->htt_handle); + soc->dp_soc_reinit = 0; wlan_cfg_soc_detach(soc->wlan_cfg_ctx); diff --git a/dp/wifi3.0/dp_types.h b/dp/wifi3.0/dp_types.h index ae23bbb527..fa64020b12 100644 --- a/dp/wifi3.0/dp_types.h +++ b/dp/wifi3.0/dp_types.h @@ -821,22 +821,29 @@ struct dp_soc { /* Number of REO destination rings */ uint8_t num_reo_dest_rings; + +#ifdef QCA_LL_TX_FLOW_CONTROL_V2 + /* lock to control access to soc TX descriptors */ + qdf_spinlock_t flow_pool_array_lock; + + /* pause callback to pause TX queues as per flow control */ + tx_pause_callback pause_cb; + + /* flow pool related statistics */ + struct dp_txrx_pool_stats pool_stats; +#endif /* !QCA_LL_TX_FLOW_CONTROL_V2 */ + /* - * re-use memory section ends - * reuse memory indicator - * - * DO NOT CHANGE NAME OR MOVE THIS VARIABLE + * Re-use memory section ends. reuse memory indicator. + * Everything above this variable "dp_soc_reinit" is retained across + * WiFi up/down for AP use-cases. + * Everything below this variable "dp_soc_reinit" is reset during + * dp_soc_deinit. */ bool dp_soc_reinit; uint32_t wbm_idle_scatter_buf_size; -#ifdef QCA_LL_TX_FLOW_CONTROL_V2 - qdf_spinlock_t flow_pool_array_lock; - tx_pause_callback pause_cb; - struct dp_txrx_pool_stats pool_stats; -#endif /* !QCA_LL_TX_FLOW_CONTROL_V2 */ - /* Tx H/W queues lock */ qdf_spinlock_t tx_queue_lock[MAX_TX_HW_QUEUES];