qcacmn: Converge on wmi event registration / unregistration

Converge on wmi event registration / unregistration method.

Change-Id: If03a38d74a47cc1d900bc5734a7c8f950513efaa
CRs-Fixed: 2148479
This commit is contained in:
Mukul Sharma
2017-11-03 19:26:54 +05:30
committed by snandini
parent 78e34459fd
commit 396cef7bcf
8 changed files with 90 additions and 49 deletions

View File

@@ -1112,7 +1112,7 @@ QDF_STATUS target_if_nan_register_events(struct wlan_objmgr_psoc *psoc)
wmi_unified_t handle = GET_WMI_HDL_FROM_PSOC(psoc);
ret = wmi_unified_register_event_handler(handle,
WMI_NDP_INITIATOR_RSP_EVENTID,
wmi_ndp_initiator_rsp_event_id,
target_if_ndp_initiator_rsp_handler,
WMI_RX_UMAC_CTX);
if (ret) {
@@ -1121,7 +1121,7 @@ QDF_STATUS target_if_nan_register_events(struct wlan_objmgr_psoc *psoc)
}
ret = wmi_unified_register_event_handler(handle,
WMI_NDP_INDICATION_EVENTID,
wmi_ndp_indication_event_id,
target_if_ndp_ind_handler,
WMI_RX_UMAC_CTX);
if (ret) {
@@ -1131,7 +1131,7 @@ QDF_STATUS target_if_nan_register_events(struct wlan_objmgr_psoc *psoc)
}
ret = wmi_unified_register_event_handler(handle,
WMI_NDP_CONFIRM_EVENTID,
wmi_ndp_confirm_event_id,
target_if_ndp_confirm_handler,
WMI_RX_UMAC_CTX);
if (ret) {
@@ -1141,7 +1141,7 @@ QDF_STATUS target_if_nan_register_events(struct wlan_objmgr_psoc *psoc)
}
ret = wmi_unified_register_event_handler(handle,
WMI_NDP_RESPONDER_RSP_EVENTID,
wmi_ndp_responder_rsp_event_id,
target_if_ndp_responder_rsp_handler,
WMI_RX_UMAC_CTX);
if (ret) {
@@ -1151,7 +1151,7 @@ QDF_STATUS target_if_nan_register_events(struct wlan_objmgr_psoc *psoc)
}
ret = wmi_unified_register_event_handler(handle,
WMI_NDP_END_INDICATION_EVENTID,
wmi_ndp_end_indication_event_id,
target_if_ndp_end_ind_handler,
WMI_RX_UMAC_CTX);
if (ret) {
@@ -1161,7 +1161,7 @@ QDF_STATUS target_if_nan_register_events(struct wlan_objmgr_psoc *psoc)
}
ret = wmi_unified_register_event_handler(handle,
WMI_NDP_END_RSP_EVENTID,
wmi_ndp_end_rsp_event_id,
target_if_ndp_end_rsp_handler,
WMI_RX_UMAC_CTX);
if (ret) {
@@ -1179,42 +1179,42 @@ QDF_STATUS target_if_nan_deregister_events(struct wlan_objmgr_psoc *psoc)
wmi_unified_t handle = GET_WMI_HDL_FROM_PSOC(psoc);
ret = wmi_unified_unregister_event_handler(handle,
WMI_NDP_INITIATOR_RSP_EVENTID);
wmi_ndp_initiator_rsp_event_id);
if (ret) {
target_if_err("wmi event deregistration failed, ret: %d", ret);
status = ret;
}
ret = wmi_unified_unregister_event_handler(handle,
WMI_NDP_INDICATION_EVENTID);
wmi_ndp_indication_event_id);
if (ret) {
target_if_err("wmi event deregistration failed, ret: %d", ret);
status = ret;
}
ret = wmi_unified_unregister_event_handler(handle,
WMI_NDP_CONFIRM_EVENTID);
wmi_ndp_confirm_event_id);
if (ret) {
target_if_err("wmi event deregistration failed, ret: %d", ret);
status = ret;
}
ret = wmi_unified_unregister_event_handler(handle,
WMI_NDP_RESPONDER_RSP_EVENTID);
wmi_ndp_responder_rsp_event_id);
if (ret) {
target_if_err("wmi event deregistration failed, ret: %d", ret);
status = ret;
}
ret = wmi_unified_unregister_event_handler(handle,
WMI_NDP_END_INDICATION_EVENTID);
wmi_ndp_end_indication_event_id);
if (ret) {
target_if_err("wmi event deregistration failed, ret: %d", ret);
status = ret;
}
ret = wmi_unified_unregister_event_handler(handle,
WMI_NDP_END_RSP_EVENTID);
wmi_ndp_end_rsp_event_id);
if (ret) {
target_if_err("wmi event deregistration failed, ret: %d", ret);
status = ret;

View File

@@ -31,11 +31,6 @@
#include <wmi_unified_reg_api.h>
#ifdef CONFIG_MCL
static inline uint32_t get_chan_list_cc_event_id(void)
{
return WMI_REG_CHAN_LIST_CC_EVENTID;
}
static bool tgt_if_regulatory_is_11d_offloaded(struct wlan_objmgr_psoc
*psoc)
{
@@ -58,11 +53,6 @@ static bool tgt_if_regulatory_is_there_serv_ready_extn(struct wlan_objmgr_psoc
}
#else
static inline uint32_t get_chan_list_cc_event_id(void)
{
return wmi_reg_chan_list_cc_event_id;
}
static bool tgt_if_regulatory_is_11d_offloaded(struct wlan_objmgr_psoc
*psoc)
{
@@ -269,7 +259,7 @@ static QDF_STATUS tgt_if_regulatory_register_master_list_handler(
wmi_unified_t wmi_handle = GET_WMI_HDL_FROM_PSOC(psoc);
return wmi_unified_register_event_handler(wmi_handle,
get_chan_list_cc_event_id(),
wmi_reg_chan_list_cc_event_id,
tgt_reg_chan_list_update_handler,
WMI_RX_UMAC_CTX);
@@ -281,7 +271,7 @@ static QDF_STATUS tgt_if_regulatory_unregister_master_list_handler(
wmi_unified_t wmi_handle = GET_WMI_HDL_FROM_PSOC(psoc);
return wmi_unified_unregister_event_handler(wmi_handle,
get_chan_list_cc_event_id());
wmi_reg_chan_list_cc_event_id);
}
static QDF_STATUS tgt_if_regulatory_set_country_code(

View File

@@ -347,7 +347,7 @@ QDF_STATUS target_if_wifi_pos_register_events(struct wlan_objmgr_psoc *psoc)
}
ret = wmi_unified_register_event_handler(GET_WMI_HDL_FROM_PSOC(psoc),
WMI_OEM_RESPONSE_EVENTID,
wmi_oem_response_event_id,
target_if_wifi_pos_oem_rsp_ev_handler,
WMI_RX_WORK_CTX);
if (ret) {
@@ -393,7 +393,7 @@ QDF_STATUS target_if_wifi_pos_deregister_events(struct wlan_objmgr_psoc *psoc)
}
wmi_unified_unregister_event_handler(GET_WMI_HDL_FROM_PSOC(psoc),
WMI_OEM_RESPONSE_EVENTID);
wmi_oem_response_event_id);
wmi_unified_unregister_event_handler(GET_WMI_HDL_FROM_PSOC(psoc),
wmi_oem_cap_event_id);
wmi_unified_unregister_event_handler(GET_WMI_HDL_FROM_PSOC(psoc),

View File

@@ -4482,7 +4482,7 @@ int dbglog_init(wmi_unified_t wmi_handle)
/* Register handler for F3 or debug messages */
res =
wmi_unified_register_event_handler(wmi_handle,
WMI_DEBUG_MESG_EVENTID,
wmi_dbg_msg_event_id,
dbglog_parse_debug_logs,
WMA_RX_WORK_CTX);
if (res != 0)
@@ -4490,14 +4490,14 @@ int dbglog_init(wmi_unified_t wmi_handle)
/* Register handler for FW diag events */
res = wmi_unified_register_event_handler(wmi_handle,
WMI_DIAG_DATA_CONTAINER_EVENTID,
wmi_diag_container_event_id,
fw_diag_data_event_handler,
WMA_RX_WORK_CTX);
if (res != 0)
return res;
/* Register handler for new FW diag Event, LOG, MSG combined */
res = wmi_unified_register_event_handler(wmi_handle, WMI_DIAG_EVENTID,
res = wmi_unified_register_event_handler(wmi_handle, wmi_diag_event_id,
diag_fw_handler,
WMA_RX_WORK_CTX);
if (res != 0)
@@ -4530,7 +4530,7 @@ int dbglog_deinit(wmi_unified_t wmi_handle)
tgt_assert_enable = 0;
res =
wmi_unified_unregister_event_handler(wmi_handle,
WMI_DEBUG_MESG_EVENTID);
wmi_dbg_msg_event_id);
if (res != 0)
return res;

View File

@@ -214,7 +214,7 @@ wmi_unified_register_event(wmi_unified_t wmi_handle,
*/
int
wmi_unified_register_event_handler(wmi_unified_t wmi_handle,
uint32_t event_id,
wmi_conv_event_id event_id,
wmi_unified_event_handler handler_func,
uint8_t rx_ctx);
@@ -238,7 +238,7 @@ wmi_unified_unregister_event(wmi_unified_t wmi_handle,
*/
int
wmi_unified_unregister_event_handler(wmi_unified_t wmi_handle,
uint32_t event_id);
wmi_conv_event_id event_id);
/**
* request wmi to connet its htc service.

View File

@@ -5455,6 +5455,30 @@ typedef enum {
wmi_service_available_event_id,
wmi_update_rcpi_event_id,
wmi_pdev_wds_entry_list_event_id,
wmi_ndp_initiator_rsp_event_id,
wmi_ndp_indication_event_id,
wmi_ndp_confirm_event_id,
wmi_ndp_responder_rsp_event_id,
wmi_ndp_end_indication_event_id,
wmi_ndp_end_rsp_event_id,
wmi_oem_response_event_id,
wmi_peer_stats_info_event_id,
wmi_pdev_chip_power_stats_event_id,
wmi_ap_ps_egap_info_event_id,
wmi_peer_assoc_conf_event_id,
wmi_vdev_delete_resp_event_id,
wmi_bpf_capability_info_event_id,
wmi_vdev_encrypt_decrypt_data_rsp_event_id,
wmi_report_rx_aggr_failure_event_id,
wmi_pdev_chip_pwr_save_failure_detect_event_id,
wmi_peer_antdiv_info_event_id,
wmi_pdev_set_hw_mode_rsp_event_id,
wmi_pdev_hw_mode_transition_event_id,
wmi_pdev_set_mac_config_resp_event_id,
wmi_coex_bt_activity_event_id,
wmi_mgmt_tx_bundle_completion_event_id,
wmi_radio_tx_power_level_stats_event_id,
wmi_report_stats_event_id,
wmi_events_max,
} wmi_conv_event_id;

View File

@@ -1514,7 +1514,7 @@ int wmi_unified_register_event(wmi_unified_t wmi_handle,
* Return: 0 on success
*/
int wmi_unified_register_event_handler(wmi_unified_t wmi_handle,
uint32_t event_id,
wmi_conv_event_id event_id,
wmi_unified_event_handler handler_func,
uint8_t rx_ctx)
{
@@ -1522,7 +1522,6 @@ int wmi_unified_register_event_handler(wmi_unified_t wmi_handle,
uint32_t evt_id;
struct wmi_soc *soc = wmi_handle->soc;
#ifndef CONFIG_MCL
if (event_id >= wmi_events_max ||
wmi_handle->wmi_events[event_id] == WMI_EVENT_ID_INVALID) {
qdf_print("%s: Event id %d is unavailable\n",
@@ -1530,9 +1529,7 @@ int wmi_unified_register_event_handler(wmi_unified_t wmi_handle,
return QDF_STATUS_E_FAILURE;
}
evt_id = wmi_handle->wmi_events[event_id];
#else
evt_id = event_id;
#endif
if (wmi_unified_get_event_handler_ix(wmi_handle, evt_id) != -1) {
qdf_print("%s : event handler already registered 0x%x\n",
__func__, evt_id);
@@ -1603,13 +1600,12 @@ int wmi_unified_unregister_event(wmi_unified_t wmi_handle,
* Return: 0 on success
*/
int wmi_unified_unregister_event_handler(wmi_unified_t wmi_handle,
uint32_t event_id)
wmi_conv_event_id event_id)
{
uint32_t idx = 0;
uint32_t evt_id;
struct wmi_soc *soc = wmi_handle->soc;
#ifndef CONFIG_MCL
if (event_id >= wmi_events_max ||
wmi_handle->wmi_events[event_id] == WMI_EVENT_ID_INVALID) {
qdf_print("%s: Event id %d is unavailable\n",
@@ -1617,9 +1613,6 @@ int wmi_unified_unregister_event_handler(wmi_unified_t wmi_handle,
return QDF_STATUS_E_FAILURE;
}
evt_id = wmi_handle->wmi_events[event_id];
#else
evt_id = event_id;
#endif
idx = wmi_unified_get_event_handler_ix(wmi_handle, evt_id);
if (idx == -1) {
@@ -2112,16 +2105,10 @@ void *wmi_unified_attach(void *scn_handle,
sizeof(struct wmi_soc));
return NULL;
}
#ifdef CONFIG_MCL
wmi_handle =
(struct wmi_unified *)os_malloc(NULL,
sizeof(struct wmi_unified),
GFP_ATOMIC);
#else
wmi_handle =
(struct wmi_unified *) qdf_mem_malloc(
sizeof(struct wmi_unified));
#endif
if (wmi_handle == NULL) {
qdf_mem_free(soc);
qdf_print("allocation of wmi handle failed %zu\n",

View File

@@ -20581,6 +20581,46 @@ static void populate_tlv_events_id(uint32_t *event_ids)
WMI_SERVICE_AVAILABLE_EVENTID;
event_ids[wmi_update_rcpi_event_id] = WMI_UPDATE_RCPI_EVENTID;
event_ids[wmi_pdev_check_cal_version_event_id] = WMI_PDEV_CHECK_CAL_VERSION_EVENTID;
/* NDP events */
event_ids[wmi_ndp_initiator_rsp_event_id] =
WMI_NDP_INITIATOR_RSP_EVENTID;
event_ids[wmi_ndp_indication_event_id] = WMI_NDP_INDICATION_EVENTID;
event_ids[wmi_ndp_confirm_event_id] = WMI_NDP_CONFIRM_EVENTID;
event_ids[wmi_ndp_responder_rsp_event_id] =
WMI_NDP_RESPONDER_RSP_EVENTID;
event_ids[wmi_ndp_end_indication_event_id] =
WMI_NDP_END_INDICATION_EVENTID;
event_ids[wmi_ndp_end_rsp_event_id] = WMI_NDP_END_RSP_EVENTID;
event_ids[wmi_oem_response_event_id] = WMI_OEM_RESPONSE_EVENTID;
event_ids[wmi_peer_stats_info_event_id] = WMI_PEER_STATS_INFO_EVENTID;
event_ids[wmi_pdev_chip_power_stats_event_id] =
WMI_PDEV_CHIP_POWER_STATS_EVENTID;
event_ids[wmi_ap_ps_egap_info_event_id] = WMI_AP_PS_EGAP_INFO_EVENTID;
event_ids[wmi_peer_assoc_conf_event_id] = WMI_PEER_ASSOC_CONF_EVENTID;
event_ids[wmi_vdev_delete_resp_event_id] = WMI_VDEV_DELETE_RESP_EVENTID;
event_ids[wmi_bpf_capability_info_event_id] =
WMI_BPF_CAPABILIY_INFO_EVENTID;
event_ids[wmi_vdev_encrypt_decrypt_data_rsp_event_id] =
WMI_VDEV_ENCRYPT_DECRYPT_DATA_RESP_EVENTID;
event_ids[wmi_report_rx_aggr_failure_event_id] =
WMI_REPORT_RX_AGGR_FAILURE_EVENTID;
event_ids[wmi_pdev_chip_pwr_save_failure_detect_event_id] =
WMI_PDEV_CHIP_POWER_SAVE_FAILURE_DETECTED_EVENTID;
event_ids[wmi_peer_antdiv_info_event_id] = WMI_PEER_ANTDIV_INFO_EVENTID;
event_ids[wmi_pdev_set_hw_mode_rsp_event_id] =
WMI_PDEV_SET_HW_MODE_RESP_EVENTID;
event_ids[wmi_pdev_hw_mode_transition_event_id] =
WMI_PDEV_HW_MODE_TRANSITION_EVENTID;
event_ids[wmi_pdev_set_mac_config_resp_event_id] =
WMI_PDEV_SET_MAC_CONFIG_RESP_EVENTID;
event_ids[wmi_coex_bt_activity_event_id] =
WMI_WLAN_COEX_BT_ACTIVITY_EVENTID;
event_ids[wmi_mgmt_tx_bundle_completion_event_id] =
WMI_MGMT_TX_BUNDLE_COMPLETION_EVENTID;
event_ids[wmi_radio_tx_power_level_stats_event_id] =
WMI_RADIO_TX_POWER_LEVEL_STATS_EVENTID;
event_ids[wmi_report_stats_event_id] = WMI_REPORT_STATS_EVENTID;
}
#ifndef CONFIG_MCL