qcacmn: Redefine pdev and vdev param to remove CONFIG_MCL

Convert pdev and vdev param conversion array to pointers
and allocate them only if conversion is required.Use run-time
NULL check of pdev and vdev param pointers for conversion
and remove CONFIG_MCL compiler flag.

CRs-Fixed: 2393422
Change-Id: Ica1c81f5f3c3a4b7e31dcb70c63471898c36933d
This commit is contained in:
Surya Prakash Raajen
2019-02-21 19:24:35 +05:30
committed by nshrivas
szülő 5d32743e83
commit 80638517c2
4 fájl változott, egészen pontosan 59 új sor hozzáadva és 62 régi sor törölve

Fájl megtekintése

@@ -164,6 +164,9 @@ enum wmi_rx_exec_ctx {
* @param osdev : NIC device
* @param target_type : type of supported wmi command
* @param use_cookie : flag to indicate cookie based allocation
* @param enable_vdev_pdev_param_conversion : To enable pdev vdev parametric
* id conversion from host type to
* target type
* @param ops : handle to wmi ops
* @psoc : objmgr psoc
* @max_commands : max commands
@@ -173,6 +176,7 @@ struct wmi_unified_attach_params {
enum wmi_target_type target_type;
bool use_cookie;
bool is_async_ep;
bool enable_vdev_pdev_param_conversion;
struct wmi_rx_ops *rx_ops;
struct wlan_objmgr_psoc *psoc;
uint16_t max_commands;

Fájl megtekintése

@@ -2001,10 +2001,6 @@ struct wmi_unified {
bool use_cookie;
bool wmi_stopinprogress;
uint32_t *wmi_events;
#ifndef CONFIG_MCL
uint32_t *pdev_param;
uint32_t *vdev_param;
#endif
uint32_t *services;
struct wmi_soc *soc;
uint16_t wmi_max_cmds;
@@ -2039,10 +2035,8 @@ struct wmi_soc {
/* WMI service bitmap received from target */
uint32_t *wmi_service_bitmap;
uint32_t *wmi_ext_service_bitmap;
#ifndef CONFIG_MCL
uint32_t pdev_param[wmi_pdev_param_max];
uint32_t vdev_param[wmi_vdev_param_max];
#endif
uint32_t *pdev_param;
uint32_t *vdev_param;
uint32_t services[wmi_services_max];
uint16_t wmi_max_cmds;
uint32_t soc_idx;

Fájl megtekintése

@@ -2397,29 +2397,6 @@ static inline void wmi_interface_logging_init(struct wmi_unified *wmi_handle,
}
#endif
/**
* wmi_target_params_init: Target specific params init
* @param wmi_soc: Pointer to wmi soc object
* @param wmi_handle: Pointer to wmi handle object
*
* return: None
*/
#ifndef CONFIG_MCL
static inline void wmi_target_params_init(struct wmi_soc *soc,
struct wmi_unified *wmi_handle)
{
wmi_handle->pdev_param = soc->pdev_param;
wmi_handle->vdev_param = soc->vdev_param;
wmi_handle->services = soc->services;
}
#else
static inline void wmi_target_params_init(struct wmi_soc *soc,
struct wmi_unified *wmi_handle)
{
wmi_handle->services = soc->services;
}
#endif
/**
* wmi_unified_get_pdev_handle: Get WMI SoC handle
* @param wmi_soc: Pointer to wmi soc object
@@ -2458,7 +2435,7 @@ void *wmi_unified_get_pdev_handle(struct wmi_soc *soc, uint32_t pdev_idx)
goto error;
}
wmi_handle->wmi_events = soc->wmi_events;
wmi_target_params_init(soc, wmi_handle);
wmi_handle->services = soc->services;
wmi_handle->soc = soc;
wmi_interface_logging_init(wmi_handle, pdev_idx);
qdf_atomic_init(&wmi_handle->pending_cmds);
@@ -2566,8 +2543,23 @@ void *wmi_unified_attach(void *scn_handle,
wmi_handle->event_handler = soc->event_handler;
wmi_handle->ctx = soc->ctx;
wmi_handle->wmi_events = soc->wmi_events;
wmi_target_params_init(soc, wmi_handle);
wmi_handle->services = soc->services;
wmi_handle->scn_handle = scn_handle;
if (param->enable_vdev_pdev_param_conversion) {
if (wmi_pdev_param_max > SIZE_MAX / sizeof(uint32_t))
goto error;
soc->pdev_param = qdf_mem_malloc(
wmi_pdev_param_max * sizeof(uint32_t));
if (!soc->pdev_param)
goto error;
if (wmi_vdev_param_max > SIZE_MAX / sizeof(uint32_t))
goto error;
soc->vdev_param = qdf_mem_malloc(
wmi_vdev_param_max * sizeof(uint32_t));
if (!soc->vdev_param)
goto error;
}
soc->scn_handle = scn_handle;
qdf_atomic_init(&wmi_handle->pending_cmds);
qdf_atomic_init(&wmi_handle->is_target_suspended);
@@ -2618,6 +2610,14 @@ void *wmi_unified_attach(void *scn_handle,
return wmi_handle;
error:
if (soc->pdev_param) {
qdf_mem_free(soc->pdev_param);
soc->pdev_param = NULL;
}
if (soc->vdev_param) {
qdf_mem_free(soc->vdev_param);
soc->vdev_param = NULL;
}
qdf_mem_free(soc);
qdf_mem_free(wmi_handle);
@@ -2670,6 +2670,16 @@ void wmi_unified_detach(struct wmi_unified *wmi_handle)
}
qdf_spinlock_destroy(&soc->ctx_lock);
if (soc->pdev_param) {
qdf_mem_free(soc->pdev_param);
soc->pdev_param = NULL;
}
if (soc->vdev_param) {
qdf_mem_free(soc->vdev_param);
soc->vdev_param = NULL;
}
if (soc->wmi_service_bitmap) {
qdf_mem_free(soc->wmi_service_bitmap);
soc->wmi_service_bitmap = NULL;

Fájl megtekintése

@@ -1206,22 +1206,19 @@ send_pdev_utf_cmd_tlv(wmi_unified_t wmi_handle,
return ret;
}
#ifdef CONFIG_MCL
static inline uint32_t convert_host_pdev_param_tlv(wmi_unified_t wmi_handle,
uint32_t host_param)
{
if (wmi_handle->soc->pdev_param) {
if (host_param < wmi_pdev_param_max)
return wmi_handle->soc->pdev_param[host_param];
return WMI_UNAVAILABLE_PARAM;
}
return host_param;
}
#else
static inline uint32_t convert_host_pdev_param_tlv(wmi_unified_t wmi_handle,
uint32_t host_param)
{
if (host_param < wmi_pdev_param_max)
return wmi_handle->pdev_param[host_param];
return WMI_UNAVAILABLE_PARAM;
}
#endif
/**
* send_pdev_param_cmd_tlv() - set pdev parameters
* @wmi_handle: wmi handle
@@ -1597,22 +1594,18 @@ send_dbglog_cmd_tlv(wmi_unified_t wmi_handle,
}
#endif
#ifdef CONFIG_MCL
static inline uint32_t convert_host_vdev_param_tlv(wmi_unified_t wmi_handle,
uint32_t host_param)
{
if (wmi_handle->soc->vdev_param) {
if (host_param < wmi_vdev_param_max)
return wmi_handle->soc->vdev_param[host_param];
return WMI_UNAVAILABLE_PARAM;
}
return host_param;
}
#else
static inline uint32_t convert_host_vdev_param_tlv(wmi_unified_t wmi_handle,
uint32_t host_param)
{
if (host_param < wmi_vdev_param_max)
return wmi_handle->vdev_param[host_param];
return WMI_UNAVAILABLE_PARAM;
}
#endif
/**
* send_vdev_set_param_cmd_tlv() - WMI vdev set parameter function
* @param wmi_handle : handle to WMI.
@@ -11952,7 +11945,6 @@ static void populate_tlv_service(uint32_t *wmi_service)
wmi_service[wmi_service_cfr_capture_support] =
WMI_SERVICE_CFR_CAPTURE_SUPPORT;
}
#ifndef CONFIG_MCL
/**
* populate_pdev_param_tlv() - populates pdev params
@@ -12401,7 +12393,6 @@ static void populate_vdev_param_tlv(uint32_t *vdev_param)
vdev_param[wmi_vdev_param_rawmode_open_war] =
WMI_VDEV_PARAM_RAW_IS_ENCRYPTED;
}
#endif
/**
* populate_target_defines_tlv() - Populate target defines and params
@@ -12409,16 +12400,14 @@ static void populate_vdev_param_tlv(uint32_t *vdev_param)
*
* Return: None
*/
#ifndef CONFIG_MCL
static void populate_target_defines_tlv(struct wmi_unified *wmi_handle)
{
populate_pdev_param_tlv(wmi_handle->pdev_param);
populate_vdev_param_tlv(wmi_handle->vdev_param);
if (wmi_handle->soc->pdev_param)
populate_pdev_param_tlv(wmi_handle->soc->pdev_param);
if (wmi_handle->soc->vdev_param)
populate_vdev_param_tlv(wmi_handle->soc->vdev_param);
}
#else
static void populate_target_defines_tlv(struct wmi_unified *wmi_handle)
{ }
#endif
/**
* wmi_ocb_ut_attach() - Attach OCB test framework