qcacmn: support of common wmi rx event handling for common wmi layer

Remove hard-coded rx execution context of wmi event callbacks.
UMAC layer needs to register execution context while registering
events with wmi layer.

Execute wmi rx event callbacks in following context-
1) work queue context provided by wmi layer.
2) umac provided context, umac can choose to
   execute in thread context or default tasklet context
   based on umac implementation.

CRs-Fixed: 978619
Change-Id: Id9b1f1e5157e8a203f93a62791f85a8145cc1599
This commit is contained in:
Govind Singh
2016-03-09 12:03:29 +05:30
parent 3ddda1ff37
commit 4ec6ff9760
3 changed files with 64 additions and 12 deletions

View File

@@ -51,11 +51,9 @@ typedef cdf_nbuf_t wmi_buf_t;
* @wma_process_fw_event_handler_cbk: generic event handler callback * @wma_process_fw_event_handler_cbk: generic event handler callback
*/ */
struct wmi_rx_ops { struct wmi_rx_ops {
void (*service_ready_cbk)(void *ctx, void *ev);
void (*service_ready_ext_cbk)(void *ctx, void *ev);
void (*ready_cbk)(void *ctx, void *ev);
int (*wma_process_fw_event_handler_cbk)(void *ctx, int (*wma_process_fw_event_handler_cbk)(void *ctx,
void *ev); void *ev, uint8_t rx_ctx);
}; };
/** /**
@@ -69,6 +67,17 @@ enum wmi_target_type {
WMI_NON_TLV_TARGET WMI_NON_TLV_TARGET
}; };
/**
* enum wmi_rx_exec_ctx - wmi rx execution context
* @WMI_RX_WORK_CTX: work queue context execution provided by WMI layer
* @WMI_RX_UMAC_CTX: execution context provided by umac layer
*
*/
enum wmi_rx_exec_ctx {
WMI_RX_WORK_CTX,
WMI_RX_UMAC_CTX
};
/** /**
* attach for unified WMI * attach for unified WMI
* *
@@ -126,17 +135,21 @@ wmi_unified_cmd_send(wmi_unified_t wmi_handle, wmi_buf_t buf, uint32_t buflen,
WMI_CMD_ID cmd_id); WMI_CMD_ID cmd_id);
/** /**
* WMI event handler register function * wmi_unified_register_event_handler() - WMI event handler
* registration function
*
* @wmi_handle: handle to WMI.
* @event_id: WMI event ID
* @handler_func: Event handler call back function
* @rx_ctx: rx event processing context
* *
* @param wmi_handle : handle to WMI.
* @param event_id : WMI event ID
* @param handler_func : Event handler call back function
* @return 0 on success and -ve on failure. * @return 0 on success and -ve on failure.
*/ */
int int
wmi_unified_register_event_handler(wmi_unified_t wmi_handle, wmi_unified_register_event_handler(wmi_unified_t wmi_handle,
WMI_EVT_ID event_id, WMI_EVT_ID event_id,
wmi_unified_event_handler handler_func); wmi_unified_event_handler handler_func,
uint8_t rx_ctx);
/** /**
* WMI event handler unregister function * WMI event handler unregister function
@@ -179,7 +192,6 @@ int wmi_get_pending_cmds(wmi_unified_t wmi_handle);
/** /**
WMI API to set target suspend state WMI API to set target suspend state
*/ */
void wmi_set_target_suspend(wmi_unified_t wmi_handle, bool val); void wmi_set_target_suspend(wmi_unified_t wmi_handle, bool val);
#ifdef FEATURE_RUNTIME_PM #ifdef FEATURE_RUNTIME_PM
@@ -198,6 +210,7 @@ static inline bool wmi_get_runtime_pm_inprogress(wmi_unified_t wmi_handle)
} }
#endif #endif
/** /**
* WMA Callback to process fw event. * WMA Callback to process fw event.
*/ */

View File

@@ -48,13 +48,13 @@ typedef cdf_nbuf_t wmi_buf_t;
struct wmi_command_debug { struct wmi_command_debug {
uint32_t command; uint32_t command;
uint32_t data[4]; /*16 bytes of WMI cmd excluding TLV and WMI headers */ uint32_t data[4]; /*16 bytes of WMI cmd excluding TLV and WMI headers */
uint64_t time; uint64_t time;
}; };
struct wmi_event_debug { struct wmi_event_debug {
uint32_t event; uint32_t event;
uint32_t data[4]; /*16 bytes of WMI event data excluding TLV header */ uint32_t data[4]; /*16 bytes of WMI event data excluding TLV header */
uint64_t time; uint64_t time;
}; };
@@ -179,6 +179,7 @@ struct wmi_unified {
uint16_t max_msg_len; uint16_t max_msg_len;
WMI_EVT_ID event_id[WMI_UNIFIED_MAX_EVENT]; WMI_EVT_ID event_id[WMI_UNIFIED_MAX_EVENT];
wmi_unified_event_handler event_handler[WMI_UNIFIED_MAX_EVENT]; wmi_unified_event_handler event_handler[WMI_UNIFIED_MAX_EVENT];
enum wmi_rx_exec_ctx ctx[WMI_UNIFIED_MAX_EVENT];
uint32_t max_event_idx; uint32_t max_event_idx;
void *htc_handle; void *htc_handle;
cdf_spinlock_t eventq_lock; cdf_spinlock_t eventq_lock;

38
wmi_version_whitelist.h Normal file
View File

@@ -0,0 +1,38 @@
/*
* Copyright (c) 2013-2014, 2016 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
/*
* Every Product Line or chipset or team can have its own Whitelist table.
* The following is a list of versions that the present software can support
* even though its versions are incompatible. Any entry here means that the
* indicated version does not break WMI compatibility even though it has
* a minor version change.
*/
wmi_whitelist_version_info version_whitelist[] = {
{0, 0, 0x5F414351, 0x00004C4D, 0, 0}
/* Placeholder: Major=0, Minor=0, Namespace="QCA_ML" (Dummy entry) */
};