From 4ec6ff9760e1a7aa7c65919378b6931c9879f0e4 Mon Sep 17 00:00:00 2001 From: Govind Singh Date: Wed, 9 Mar 2016 12:03:29 +0530 Subject: [PATCH] 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 --- wmi_unified_api.h | 33 +++++++++++++++++++++++---------- wmi_unified_priv.h | 5 +++-- wmi_version_whitelist.h | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+), 12 deletions(-) create mode 100644 wmi_version_whitelist.h diff --git a/wmi_unified_api.h b/wmi_unified_api.h index c1d6e0f115..7e86d2c48f 100644 --- a/wmi_unified_api.h +++ b/wmi_unified_api.h @@ -51,11 +51,9 @@ typedef cdf_nbuf_t wmi_buf_t; * @wma_process_fw_event_handler_cbk: generic event handler callback */ 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, - void *ev); + void *ev, uint8_t rx_ctx); }; /** @@ -69,6 +67,17 @@ enum wmi_target_type { 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 * @@ -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 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. */ int wmi_unified_register_event_handler(wmi_unified_t wmi_handle, 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 @@ -179,7 +192,6 @@ int wmi_get_pending_cmds(wmi_unified_t wmi_handle); /** WMI API to set target suspend state */ - void wmi_set_target_suspend(wmi_unified_t wmi_handle, bool val); #ifdef FEATURE_RUNTIME_PM @@ -198,6 +210,7 @@ static inline bool wmi_get_runtime_pm_inprogress(wmi_unified_t wmi_handle) } #endif + /** * WMA Callback to process fw event. */ diff --git a/wmi_unified_priv.h b/wmi_unified_priv.h index c530f1cbe5..ec7b37886a 100644 --- a/wmi_unified_priv.h +++ b/wmi_unified_priv.h @@ -48,13 +48,13 @@ typedef cdf_nbuf_t wmi_buf_t; struct wmi_command_debug { 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; }; struct wmi_event_debug { 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; }; @@ -179,6 +179,7 @@ struct wmi_unified { uint16_t max_msg_len; WMI_EVT_ID event_id[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; void *htc_handle; cdf_spinlock_t eventq_lock; diff --git a/wmi_version_whitelist.h b/wmi_version_whitelist.h new file mode 100644 index 0000000000..6ec33d4be3 --- /dev/null +++ b/wmi_version_whitelist.h @@ -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) */ +};