diff --git a/core/hdd/src/wlan_hdd_data_stall_detection.c b/core/hdd/src/wlan_hdd_data_stall_detection.c index 9f82edbb7dcc..ce7bd944e9e3 100644 --- a/core/hdd/src/wlan_hdd_data_stall_detection.c +++ b/core/hdd/src/wlan_hdd_data_stall_detection.c @@ -65,12 +65,20 @@ static inline void hdd_data_stall_send_event(uint32_t reason) * * Process data stall message * - * Return: void + * Return: QDF_STATUS */ -static void hdd_data_stall_process_event( - struct data_stall_event_info *data_stall_info) +static QDF_STATUS hdd_data_stall_process_event(struct scheduler_msg *msg) { + struct data_stall_event_info *data_stall_info; + + if (!msg) + return QDF_STATUS_E_FAILURE; + + data_stall_info = msg->bodyptr; + hdd_data_stall_send_event(data_stall_info->data_stall_type); + + return QDF_STATUS_SUCCESS; } /** diff --git a/core/mac/inc/mac_init_api.h b/core/mac/inc/mac_init_api.h index 1190df8e306c..2750c6d87c04 100644 --- a/core/mac/inc/mac_init_api.h +++ b/core/mac/inc/mac_init_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2011-2020 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -111,4 +111,20 @@ void mac_register_sesssion_open_close_cb(mac_handle_t mac_handle, csr_session_close_cb close_session, csr_roam_complete_cb callback); +#ifdef WLAN_BCN_RECV_FEATURE +/** + * mac_register_bcn_report_send_cb() - Register bcn receive start + * indication handler callback + * @mac: Pointer to Global MAC structure + * @cb: A pointer to store the callback + * + * Once driver gets QCA_NL80211_VENDOR_SUBCMD_BEACON_REPORTING vendor + * command with attribute for start only. MAC layer register a sme + * callback through this function. + * + * Return: None. + */ +void mac_register_bcn_report_send_cb(struct mac_context *mac, + beacon_report_cb cb); +#endif /* WLAN_BCN_RECV_FEATURE */ #endif /* __MAC_INIT_API_H */ diff --git a/core/mac/inc/wni_api.h b/core/mac/inc/wni_api.h index fd588fc2aff4..fbe542d985b4 100644 --- a/core/mac/inc/wni_api.h +++ b/core/mac/inc/wni_api.h @@ -233,7 +233,7 @@ enum eWniMsgTypes { eWNI_SME_HIDDEN_SSID_RESTART_RSP = SIR_SME_MSG_TYPES_BEGIN + 151, eWNI_SME_FW_STATUS_IND = SIR_SME_MSG_TYPES_BEGIN + 152, eWNI_SME_STA_CSA_CONTINUE_REQ = SIR_SME_MSG_TYPES_BEGIN + 153, - WNI_SME_REGISTER_BCN_REPORT_SEND_CB = SIR_SME_MSG_TYPES_BEGIN + 154, + /* 154 unused */ eWNI_SME_ANTENNA_ISOLATION_RSP = SIR_SME_MSG_TYPES_BEGIN + 155, eWNI_SME_MON_DEINIT_SESSION = SIR_SME_MSG_TYPES_BEGIN + 156, eWNI_SME_VDEV_DELETE_RSP = SIR_SME_MSG_TYPES_BEGIN + 157, diff --git a/core/mac/src/pe/lim/lim_process_message_queue.c b/core/mac/src/pe/lim/lim_process_message_queue.c index 414f47d1907d..3c6bdcc40686 100644 --- a/core/mac/src/pe/lim/lim_process_message_queue.c +++ b/core/mac/src/pe/lim/lim_process_message_queue.c @@ -1765,7 +1765,6 @@ static void lim_process_messages(struct mac_context *mac_ctx, case WNI_SME_UPDATE_MU_EDCA_PARAMS: case eWNI_SME_UPDATE_SESSION_EDCA_TXQ_PARAMS: case WNI_SME_CFG_ACTION_FRM_HE_TB_PPDU: - case WNI_SME_REGISTER_BCN_REPORT_SEND_CB: /* These messages are from HDD.No need to respond to HDD */ lim_process_normal_hdd_msg(mac_ctx, msg, false); break; diff --git a/core/mac/src/pe/lim/lim_process_sme_req_messages.c b/core/mac/src/pe/lim/lim_process_sme_req_messages.c index 0b8d9203e985..a9f665f19bbd 100644 --- a/core/mac/src/pe/lim/lim_process_sme_req_messages.c +++ b/core/mac/src/pe/lim/lim_process_sme_req_messages.c @@ -386,36 +386,6 @@ static bool __lim_process_sme_sys_ready_ind(struct mac_context *mac, return false; } -#ifdef WLAN_BCN_RECV_FEATURE -/** - * lim_register_bcn_report_send_cb() - Register bcn receive start - * indication handler callback - * @mac: Pointer to Global MAC structure - * @msg: A pointer to the SME message buffer - * - * Once driver gets QCA_NL80211_VENDOR_SUBCMD_BEACON_REPORTING vendor - * command with attribute for start only. LIM layer register a sme - * callback through this function. - * - * Return: None. - */ -static void lim_register_bcn_report_send_cb(struct mac_context *mac, - struct scheduler_msg *msg) -{ - if (!msg) { - pe_err("Invalid message"); - return; - } - - mac->lim.sme_bcn_rcv_callback = msg->callback; -} -#else -static inline -void lim_register_bcn_report_send_cb(struct mac_context *mac, - struct scheduler_msg *msg) -{ -} -#endif /** *lim_configure_ap_start_bss_session() - Configure the AP Start BSS in session. *@mac_ctx: Pointer to Global MAC structure @@ -4685,9 +4655,6 @@ bool lim_process_sme_req_messages(struct mac_context *mac, lim_process_sme_cfg_action_frm_in_tb_ppdu(mac, (struct sir_cfg_action_frm_tb_ppdu *)msg_buf); break; - case WNI_SME_REGISTER_BCN_REPORT_SEND_CB: - lim_register_bcn_report_send_cb(mac, pMsg); - break; default: qdf_mem_free((void *)pMsg->bodyptr); pMsg->bodyptr = NULL; diff --git a/core/mac/src/pe/sch/sch_beacon_process.c b/core/mac/src/pe/sch/sch_beacon_process.c index caed6f9a6524..9ef471810f3b 100644 --- a/core/mac/src/pe/sch/sch_beacon_process.c +++ b/core/mac/src/pe/sch/sch_beacon_process.c @@ -952,8 +952,10 @@ void sch_send_beacon_report(struct mac_context *mac_ctx, struct pe_session *session) { struct wlan_beacon_report beacon_report; + beacon_report_cb sme_bcn_cb; - if (!mac_ctx->lim.sme_bcn_rcv_callback) + sme_bcn_cb = mac_ctx->lim.sme_bcn_rcv_callback; + if (!sme_bcn_cb) return; if (!LIM_IS_STA_ROLE(session)) @@ -981,8 +983,7 @@ void sch_send_beacon_report(struct mac_context *mac_ctx, beacon_report.vdev_id = session->vdev_id; /* Send report to upper layer */ - mac_ctx->lim.sme_bcn_rcv_callback(mac_ctx->hdd_handle, - &beacon_report); + sme_bcn_cb(mac_ctx->hdd_handle, &beacon_report); } } diff --git a/core/mac/src/sys/common/src/wlan_qct_sys.c b/core/mac/src/sys/common/src/wlan_qct_sys.c index 2e9f8490c6ea..aab6febcb983 100644 --- a/core/mac/src/sys/common/src/wlan_qct_sys.c +++ b/core/mac/src/sys/common/src/wlan_qct_sys.c @@ -50,24 +50,26 @@ QDF_STATUS sys_build_message_header(SYS_MSG_ID msg_id, /** * umac_stop_complete_cb() - a callback when system stop completes - * @user_data: pointer to user provided data context + * @msg: pointer to actual message being handled * * this callback is used once system stop is completed. * - * Return: none + * Return: QDF_STATUS */ #ifdef QDF_ENABLE_TRACING -static void umac_stop_complete_cb(void *user_data) +static QDF_STATUS umac_stop_complete_cb(struct scheduler_msg *msg) { - qdf_event_t *stop_evt = (qdf_event_t *) user_data; + qdf_event_t *stop_evt = msg->bodyptr; QDF_STATUS qdf_status = qdf_event_set(stop_evt); QDF_ASSERT(QDF_IS_STATUS_SUCCESS(qdf_status)); + + return qdf_status; } #else -static void umac_stop_complete_cb(void *user_data) +static QDF_STATUS umac_stop_complete_cb(struct scheduler_msg *msg) { - return; + return QDF_STATUS_SUCCESS; } #endif @@ -129,7 +131,6 @@ QDF_STATUS umac_stop(void) static QDF_STATUS sys_mc_process_msg(struct scheduler_msg *pMsg) { QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; - data_stall_detect_cb data_stall_detect_callback; mac_handle_t mac_handle; if (!pMsg) { @@ -163,14 +164,12 @@ static QDF_STATUS sys_mc_process_msg(struct scheduler_msg *pMsg) QDF_ASSERT(QDF_IS_STATUS_SUCCESS(qdf_status)); qdf_status = mac_stop(mac_handle); QDF_ASSERT(QDF_IS_STATUS_SUCCESS(qdf_status)); - ((sys_rsp_cb) pMsg->callback)(pMsg->bodyptr); - qdf_status = QDF_STATUS_SUCCESS; + qdf_status = pMsg->callback(pMsg); break; - case SYS_MSG_ID_DATA_STALL_MSG: - data_stall_detect_callback = pMsg->callback; - if (data_stall_detect_callback) - data_stall_detect_callback(pMsg->bodyptr); + if (pMsg->callback) + qdf_status = pMsg->callback(pMsg); + qdf_mem_free(pMsg->bodyptr); break; default: diff --git a/core/mac/src/sys/legacy/src/system/src/mac_init_api.c b/core/mac/src/sys/legacy/src/system/src/mac_init_api.c index 7437189b1be6..94103e4957d3 100644 --- a/core/mac/src/sys/legacy/src/system/src/mac_init_api.c +++ b/core/mac/src/sys/legacy/src/system/src/mac_init_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2011-2020 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -196,3 +196,17 @@ void mac_register_sesssion_open_close_cb(mac_handle_t mac_handle, mac->session_close_cb = close_session; mac->session_roam_complete_cb = callback; } + +#ifdef WLAN_BCN_RECV_FEATURE +void mac_register_bcn_report_send_cb(struct mac_context *mac, + beacon_report_cb cb) +{ + if (!mac) { + pe_err("Invalid MAC"); + return; + } + + mac->lim.sme_bcn_rcv_callback = cb; +} +#endif + diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c index e6bce3d5b533..a973ffe48e88 100644 --- a/core/sme/src/common/sme_api.c +++ b/core/sme/src/common/sme_api.c @@ -63,6 +63,7 @@ #include "wlan_crypto_global_api.h" #include "wlan_mlme_ucfg_api.h" #include "wlan_psoc_mlme_api.h" +#include "mac_init_api.h" static QDF_STATUS init_sme_cmd_list(struct mac_context *mac); @@ -1117,17 +1118,19 @@ QDF_STATUS sme_hdd_ready_ind(mac_handle_t mac_handle) QDF_STATUS sme_register_bcn_report_pe_cb(mac_handle_t mac_handle, beacon_report_cb cb) { - struct scheduler_msg msg = {0}; QDF_STATUS status; + struct mac_context *mac = MAC_CONTEXT(mac_handle); - msg.type = WNI_SME_REGISTER_BCN_REPORT_SEND_CB; - msg.callback = cb; + if (!mac) { + sme_err("Invalid mac context"); + return QDF_STATUS_E_INVAL; + } - status = scheduler_post_message(QDF_MODULE_ID_SME, - QDF_MODULE_ID_PE, - QDF_MODULE_ID_PE, &msg); - if (QDF_IS_STATUS_ERROR(status)) - sme_err("Failed to post message to LIM"); + status = sme_acquire_global_lock(&mac->sme); + if (QDF_IS_STATUS_SUCCESS(status)) { + mac_register_bcn_report_send_cb(mac, cb); + sme_release_global_lock(&mac->sme); + } return status; }