diff --git a/dp/wifi3.0/dp_htt.c b/dp/wifi3.0/dp_htt.c index a644716d44..72f18b87f8 100644 --- a/dp/wifi3.0/dp_htt.c +++ b/dp/wifi3.0/dp_htt.c @@ -3130,6 +3130,31 @@ int htt_soc_attach_target(void *htt_soc) return htt_h2t_ver_req_msg(soc); } +void htt_set_htc_handle(struct htt_soc *htt_soc, HTC_HANDLE htc_soc) +{ + htt_soc->htc_soc = htc_soc; +} + +HTC_HANDLE htt_get_htc_handle(struct htt_soc *htt_soc) +{ + return htt_soc->htc_soc; +} + +struct htt_soc *htt_soc_attach(struct dp_soc *soc, HTC_HANDLE htc_handle) +{ + struct htt_soc *htt_soc = NULL; + + htt_soc = qdf_mem_malloc(sizeof(*htt_soc)); + if (!htt_soc) { + dp_err("HTT attach failed"); + return NULL; + } + htt_soc->dp_soc = soc; + htt_soc->htc_soc = htc_handle; + HTT_TX_MUTEX_INIT(&htt_soc->htt_tx_mutex); + + return htt_soc; +} #if defined(WDI_EVENT_ENABLE) && !defined(REMOVE_PKT_LOG) /* @@ -3592,8 +3617,6 @@ QDF_STATUS htt_soc_htc_prealloc(struct htt_soc *soc) { int i; - HTT_TX_MUTEX_INIT(&soc->htt_tx_mutex); - soc->htt_htc_pkt_freelist = NULL; /* pre-allocate some HTC_PACKET objects */ for (i = 0; i < HTT_HTC_PKT_POOL_INIT_SIZE; i++) { diff --git a/dp/wifi3.0/dp_htt.h b/dp/wifi3.0/dp_htt.h index 3eac37a828..69c5a3d1e7 100644 --- a/dp/wifi3.0/dp_htt.h +++ b/dp/wifi3.0/dp_htt.h @@ -221,6 +221,32 @@ void * htt_soc_initialize(void *htt_soc, void *ctrl_psoc, HTC_HANDLE htc_soc, void *hal_soc, qdf_device_t osdev); +/* + * htt_soc_attach() - attach DP and HTT SOC + * @soc: DP SOC handle + * @htc_hdl: HTC handle + * + * Return: htt_soc handle on Success, NULL on Failure + */ +struct htt_soc *htt_soc_attach(struct dp_soc *soc, HTC_HANDLE htc_hdl); + +/* + * htt_set_htc_handle_() - set HTC handle + * @htt_hdl: HTT handle/SOC + * @htc_soc: HTC handle + * + * Return: None + */ +void htt_set_htc_handle(struct htt_soc *htt_hdl, HTC_HANDLE htc_soc); + +/* + * htt_get_htc_handle_() - set HTC handle + * @htt_hdl: HTT handle/SOC + * + * Return: HTC_HANDLE + */ +HTC_HANDLE htt_get_htc_handle(struct htt_soc *htt_hdl); + /* * htt_soc_htc_dealloc() - HTC memory de-alloc * @htt_soc: SOC level HTT handle diff --git a/dp/wifi3.0/dp_main.c b/dp/wifi3.0/dp_main.c index 8c39634659..93a9359e7d 100644 --- a/dp/wifi3.0/dp_main.c +++ b/dp/wifi3.0/dp_main.c @@ -45,8 +45,8 @@ #include "dp_peer.h" #include "dp_rx_mon.h" #include "htt_stats.h" -#include "htt_ppdu_stats.h" #include "dp_htt.h" +#include "htt_ppdu_stats.h" #include "qdf_mem.h" /* qdf_mem_malloc,free */ #include "cfg_ucfg_api.h" #ifdef QCA_LL_TX_FLOW_CONTROL_V2 @@ -9482,7 +9482,7 @@ dp_soc_attach(void *ctrl_psoc, HTC_HANDLE htc_handle, qdf_device_t qdf_osdev, { int int_ctx; struct dp_soc *soc = NULL; - struct htt_soc *htt_soc = NULL; + struct htt_soc *htt_soc; soc = qdf_mem_malloc(sizeof(*soc)); @@ -9506,21 +9506,19 @@ dp_soc_attach(void *ctrl_psoc, HTC_HANDLE htc_handle, qdf_device_t qdf_osdev, dp_err("wlan_cfg_ctx failed\n"); goto fail1; } - htt_soc = qdf_mem_malloc(sizeof(*htt_soc)); - if (!htt_soc) { - dp_err("HTT attach failed"); + htt_soc = htt_soc_attach(soc, htc_handle); + + if (!htt_soc) goto fail1; - } + soc->htt_handle = htt_soc; - htt_soc->dp_soc = soc; - htt_soc->htc_soc = htc_handle; if (htt_soc_htc_prealloc(htt_soc) != QDF_STATUS_SUCCESS) goto fail2; return (void *)soc; fail2: - qdf_mem_free(htt_soc); + htt_soc_detach(htt_soc); fail1: qdf_mem_free(soc); fail0: @@ -9539,16 +9537,17 @@ void *dp_soc_init(void *dpsoc, HTC_HANDLE htc_handle, void *hif_handle) { int target_type; struct dp_soc *soc = (struct dp_soc *)dpsoc; - struct htt_soc *htt_soc = (struct htt_soc *)soc->htt_handle; + struct htt_soc *htt_soc = soc->htt_handle; - htt_soc->htc_soc = htc_handle; + htt_set_htc_handle(htt_soc, htc_handle); soc->hif_handle = hif_handle; soc->hal_soc = hif_get_hal_handle(soc->hif_handle); if (!soc->hal_soc) return NULL; - htt_soc_initialize(soc->htt_handle, soc->ctrl_psoc, htt_soc->htc_soc, + htt_soc_initialize(soc->htt_handle, soc->ctrl_psoc, + htt_get_htc_handle(htt_soc), soc->hal_soc, soc->osdev); target_type = hal_get_target_type(soc->hal_soc); switch (target_type) { diff --git a/dp/wifi3.0/dp_types.h b/dp/wifi3.0/dp_types.h index 0a9c42ae0d..af997612c1 100644 --- a/dp/wifi3.0/dp_types.h +++ b/dp/wifi3.0/dp_types.h @@ -838,7 +838,7 @@ struct dp_soc { struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx; /* HTT handle for host-fw interaction */ - void *htt_handle; + struct htt_soc *htt_handle; /* Commint init done */ qdf_atomic_t cmn_init_done;