qcacmn: Move HTT usage from core DP

Remove dereferencing of htt_soc structure from dp layer
and instead use HTT APIs.

Change-Id: I6b796f9b6504c763e6df2cf49b15bf3eecfbdf69
CRs-Fixed: 2483401
This commit is contained in:
Akshay Kosigi
2019-07-12 12:24:30 +05:30
committed by nshrivas
parent 6eef9e3c6e
commit 383b6d5095
4 changed files with 63 additions and 15 deletions

View File

@@ -3130,6 +3130,31 @@ int htt_soc_attach_target(void *htt_soc)
return htt_h2t_ver_req_msg(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) #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; int i;
HTT_TX_MUTEX_INIT(&soc->htt_tx_mutex);
soc->htt_htc_pkt_freelist = NULL; soc->htt_htc_pkt_freelist = NULL;
/* pre-allocate some HTC_PACKET objects */ /* pre-allocate some HTC_PACKET objects */
for (i = 0; i < HTT_HTC_PKT_POOL_INIT_SIZE; i++) { for (i = 0; i < HTT_HTC_PKT_POOL_INIT_SIZE; i++) {

View File

@@ -221,6 +221,32 @@ void *
htt_soc_initialize(void *htt_soc, void *ctrl_psoc, HTC_HANDLE htc_soc, htt_soc_initialize(void *htt_soc, void *ctrl_psoc, HTC_HANDLE htc_soc,
void *hal_soc, qdf_device_t osdev); 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_htc_dealloc() - HTC memory de-alloc
* @htt_soc: SOC level HTT handle * @htt_soc: SOC level HTT handle

View File

@@ -45,8 +45,8 @@
#include "dp_peer.h" #include "dp_peer.h"
#include "dp_rx_mon.h" #include "dp_rx_mon.h"
#include "htt_stats.h" #include "htt_stats.h"
#include "htt_ppdu_stats.h"
#include "dp_htt.h" #include "dp_htt.h"
#include "htt_ppdu_stats.h"
#include "qdf_mem.h" /* qdf_mem_malloc,free */ #include "qdf_mem.h" /* qdf_mem_malloc,free */
#include "cfg_ucfg_api.h" #include "cfg_ucfg_api.h"
#ifdef QCA_LL_TX_FLOW_CONTROL_V2 #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; int int_ctx;
struct dp_soc *soc = NULL; struct dp_soc *soc = NULL;
struct htt_soc *htt_soc = NULL; struct htt_soc *htt_soc;
soc = qdf_mem_malloc(sizeof(*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"); dp_err("wlan_cfg_ctx failed\n");
goto fail1; goto fail1;
} }
htt_soc = qdf_mem_malloc(sizeof(*htt_soc)); htt_soc = htt_soc_attach(soc, htc_handle);
if (!htt_soc) {
dp_err("HTT attach failed"); if (!htt_soc)
goto fail1; goto fail1;
}
soc->htt_handle = htt_soc; 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) if (htt_soc_htc_prealloc(htt_soc) != QDF_STATUS_SUCCESS)
goto fail2; goto fail2;
return (void *)soc; return (void *)soc;
fail2: fail2:
qdf_mem_free(htt_soc); htt_soc_detach(htt_soc);
fail1: fail1:
qdf_mem_free(soc); qdf_mem_free(soc);
fail0: fail0:
@@ -9539,16 +9537,17 @@ void *dp_soc_init(void *dpsoc, HTC_HANDLE htc_handle, void *hif_handle)
{ {
int target_type; int target_type;
struct dp_soc *soc = (struct dp_soc *)dpsoc; 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->hif_handle = hif_handle;
soc->hal_soc = hif_get_hal_handle(soc->hif_handle); soc->hal_soc = hif_get_hal_handle(soc->hif_handle);
if (!soc->hal_soc) if (!soc->hal_soc)
return NULL; 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); soc->hal_soc, soc->osdev);
target_type = hal_get_target_type(soc->hal_soc); target_type = hal_get_target_type(soc->hal_soc);
switch (target_type) { switch (target_type) {

View File

@@ -838,7 +838,7 @@ struct dp_soc {
struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx; struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx;
/* HTT handle for host-fw interaction */ /* HTT handle for host-fw interaction */
void *htt_handle; struct htt_soc *htt_handle;
/* Commint init done */ /* Commint init done */
qdf_atomic_t cmn_init_done; qdf_atomic_t cmn_init_done;