From 4b55da70d6086b87832e50487ae65467aaa08337 Mon Sep 17 00:00:00 2001 From: Arun Khandavalli Date: Tue, 19 Jul 2016 19:55:01 +0530 Subject: [PATCH] qcacld-3.0: Refactor hdd callback (de)registration into a single function As part of "load once unload never" architecture, cds modules can be opened and closed several times. Refactor the hdd callback registration/ de-registration into hdd_register_cb/hdd_deregister_cb which can be invoked during the open/close of the modules respectively. Change-Id: I2da9018ff2fa6188e61e007c896bc13e8fddcb7d CRs-Fixed: 1026817 --- core/cds/inc/cds_concurrency.h | 1 + core/cds/src/cds_concurrency.c | 23 +++ core/hdd/inc/wlan_hdd_main.h | 2 + core/hdd/inc/wlan_hdd_memdump.h | 7 +- core/hdd/inc/wlan_hdd_nan.h | 10 +- core/hdd/inc/wlan_hdd_tsf.h | 7 +- core/hdd/src/wlan_hdd_main.c | 153 ++++++++++++++++---- core/hdd/src/wlan_hdd_memdump.c | 5 +- core/hdd/src/wlan_hdd_nan.c | 17 +-- core/hdd/src/wlan_hdd_ocb.c | 2 +- core/hdd/src/wlan_hdd_ocb.h | 5 +- core/hdd/src/wlan_hdd_power.c | 14 +- core/hdd/src/wlan_hdd_stats.c | 28 +--- core/hdd/src/wlan_hdd_stats.h | 13 +- core/hdd/src/wlan_hdd_tsf.c | 2 +- core/sme/inc/nan_api.h | 1 + core/sme/inc/sme_api.h | 23 +++ core/sme/src/common/sme_api.c | 242 +++++++++++++++++++++++++++++++- core/sme/src/nan/nan_api.c | 22 +++ 19 files changed, 475 insertions(+), 102 deletions(-) diff --git a/core/cds/inc/cds_concurrency.h b/core/cds/inc/cds_concurrency.h index 558014a49396..a5b643e263d5 100644 --- a/core/cds/inc/cds_concurrency.h +++ b/core/cds/inc/cds_concurrency.h @@ -772,6 +772,7 @@ QDF_STATUS cds_reset_sap_mandatory_channels(void); #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH QDF_STATUS cds_register_sap_restart_channel_switch_cb( void (*sap_restart_chan_switch_cb)(void *, uint32_t, uint32_t)); +QDF_STATUS cds_deregister_sap_restart_channel_switch_cb(void); #endif QDF_STATUS cds_get_pcl_for_existing_conn(enum cds_con_mode mode, uint8_t *pcl_ch, uint32_t *len, diff --git a/core/cds/src/cds_concurrency.c b/core/cds/src/cds_concurrency.c index da72c7eb015c..5a2993b45549 100644 --- a/core/cds/src/cds_concurrency.c +++ b/core/cds/src/cds_concurrency.c @@ -8262,6 +8262,29 @@ QDF_STATUS cds_register_sap_restart_channel_switch_cb( cds_ctx->sap_restart_chan_switch_cb = sap_restart_chan_switch_cb; return QDF_STATUS_SUCCESS; } + +/** + * cds_deregister_sap_restart_channel_switch_cb() - De-Register callback for SAP + * channel switch without restart + * + * De Registers callback to perform channel switch + * + * Return: QDF_STATUS Enumeration + */ +QDF_STATUS cds_deregister_sap_restart_channel_switch_cb(void) +{ + p_cds_contextType cds_ctx; + + cds_ctx = cds_get_global_context(); + if (!cds_ctx) { + cds_err("Invalid CDS context"); + return QDF_STATUS_E_FAILURE; + } + + cds_ctx->sap_restart_chan_switch_cb = NULL; + return QDF_STATUS_SUCCESS; +} + #endif diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h index a4671978ce80..161f56dda14b 100644 --- a/core/hdd/inc/wlan_hdd_main.h +++ b/core/hdd/inc/wlan_hdd_main.h @@ -1740,4 +1740,6 @@ QDF_STATUS hdd_sme_close_session_callback(void *pContext); int hdd_reassoc(hdd_adapter_t *adapter, const uint8_t *bssid, const uint8_t channel, const handoff_src src); +int hdd_register_cb(hdd_context_t *hdd_ctx); +void hdd_deregister_cb(hdd_context_t *hdd_ctx); #endif /* end #if !defined(WLAN_HDD_MAIN_H) */ diff --git a/core/hdd/inc/wlan_hdd_memdump.h b/core/hdd/inc/wlan_hdd_memdump.h index c3fa8391a9ea..2100768ef69b 100644 --- a/core/hdd/inc/wlan_hdd_memdump.h +++ b/core/hdd/inc/wlan_hdd_memdump.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 The Linux Foundation. All rights reserved. + * Copyright (c) 2015-2016 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -71,6 +71,7 @@ void memdump_deinit(void); int wlan_hdd_cfg80211_get_fw_mem_dump(struct wiphy *wiphy, struct wireless_dev *wdev, const void *data, int data_len); +void wlan_hdd_cfg80211_fw_mem_dump_cb(void *ctx, struct fw_dump_rsp *dump_rsp); #else static inline int memdump_init(void) { @@ -87,6 +88,10 @@ static inline int wlan_hdd_cfg80211_get_fw_mem_dump(struct wiphy *wiphy, { return -ENOTSUPP; } +static inline void wlan_hdd_cfg80211_fw_mem_dump_cb(void *ctx, + struct fw_dump_rsp *dump_rsp) +{ +} #endif #endif /* if !defined(WLAN_HDD_MEMDUMP_H)*/ diff --git a/core/hdd/inc/wlan_hdd_nan.h b/core/hdd/inc/wlan_hdd_nan.h index 87b1de590b21..02947164e359 100644 --- a/core/hdd/inc/wlan_hdd_nan.h +++ b/core/hdd/inc/wlan_hdd_nan.h @@ -46,7 +46,6 @@ int wlan_hdd_cfg80211_nan_request(struct wiphy *wiphy, int data_len); bool wlan_hdd_nan_is_supported(void); -void wlan_hdd_nan_init(struct hdd_context_s *hdd_ctx); /** * hdd_nan_populate_cds_config() - Populate NAN cds configuration * @cds_cfg: CDS Configuration @@ -59,18 +58,19 @@ static inline void hdd_nan_populate_cds_config(struct cds_config_info *cds_cfg, { cds_cfg->is_nan_enabled = hdd_ctx->config->enable_nan_support; } - +void wlan_hdd_cfg80211_nan_callback(void *ctx, tSirNanEvent *msg); #else static inline bool wlan_hdd_nan_is_supported(void) { return false; } -static inline void wlan_hdd_nan_init(struct hdd_context_s *hdd_ctx) -{ -} static inline void hdd_nan_populate_cds_config(struct cds_config_info *cds_cfg, hdd_context_t *hdd_ctx) { } +static inline void wlan_hdd_cfg80211_nan_callback(void *ctx, + tSirNanEvent *msg) +{ +} #endif /* WLAN_FEATURE_NAN */ #endif /* __WLAN_HDD_NAN_H */ diff --git a/core/hdd/inc/wlan_hdd_tsf.h b/core/hdd/inc/wlan_hdd_tsf.h index 6d7ba787acee..d53741ef1825 100644 --- a/core/hdd/inc/wlan_hdd_tsf.h +++ b/core/hdd/inc/wlan_hdd_tsf.h @@ -61,13 +61,13 @@ enum hdd_tsf_capture_state { }; #ifdef WLAN_FEATURE_TSF -void wlan_hdd_tsf_init(struct hdd_context_s *hdd_ctx); int hdd_capture_tsf(struct hdd_adapter_s *adapter, uint32_t *buf, int len); int hdd_indicate_tsf(struct hdd_adapter_s *adapter, uint32_t *buf, int len); int wlan_hdd_cfg80211_handle_tsf_cmd(struct wiphy *wiphy, struct wireless_dev *wdev, const void *data, int data_len); +int hdd_get_tsf_cb(void *pcb_cxt, struct stsf *ptsf); #else static inline void wlan_hdd_tsf_init(struct hdd_context_s *hdd_ctx) { @@ -93,6 +93,11 @@ static inline int wlan_hdd_cfg80211_handle_tsf_cmd(struct wiphy *wiphy, { return -ENOTSUPP; } +static inline int hdd_get_tsf_cb(void *pcb_cxt, struct stsf *ptsf) +{ + return -ENOTSUPP; +} + #endif #endif diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index c2f45c42be92..c4f0c8b98f7b 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -104,6 +104,7 @@ #include #include "ol_rx_fwd.h" #include "wlan_hdd_lpass.h" +#include "nan_api.h" #ifdef MODULE #define WLAN_MODULE_NAME module_name(THIS_MODULE) @@ -4218,6 +4219,9 @@ void hdd_wlan_exit(hdd_context_t *hdd_ctx) */ hdd_stop_all_adapters(hdd_ctx); + /* De-register the SME callbacks */ + hdd_deregister_cb(hdd_ctx); + /* Stop all the modules */ qdf_status = cds_disable(p_cds_context); if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { @@ -6818,11 +6822,6 @@ int hdd_wlan_startup(struct device *dev, void *hif_sc) if (ret) goto err_close_adapter; - sme_register11d_scan_done_callback(hdd_ctx->hHal, hdd_11d_scan_done); - - sme_register_oem_data_rsp_callback(hdd_ctx->hHal, - hdd_send_oem_data_rsp_msg); - /* FW capabilities received, Set the Dot11 mode */ sme_setdef_dot11mode(hdd_ctx->hHal); @@ -6859,7 +6858,6 @@ int hdd_wlan_startup(struct device *dev, void *hif_sc) hddLog(LOGE, FL("Failed to init ACS Skip timer")); #endif - wlan_hdd_nan_init(hdd_ctx); sme_cbacks.sme_get_valid_channels = sme_get_cfg_valid_channels; sme_cbacks.sme_get_nss_for_vdev = sme_get_vdev_type_nss; status = cds_init_policy_mgr(&sme_cbacks); @@ -6895,32 +6893,11 @@ int hdd_wlan_startup(struct device *dev, void *hif_sc) hdd_bus_bw_compute_cbk, (void *)hdd_ctx); #endif - wlan_hdd_cfg80211_stats_ext_init(hdd_ctx); - - sme_ext_scan_register_callback(hdd_ctx->hHal, - wlan_hdd_cfg80211_extscan_callback); - - status = hdd_register_for_sap_restart_with_channel_switch(); - if (!QDF_IS_STATUS_SUCCESS(status)) - goto err_exit_nl_srv; - - sme_set_rssi_threshold_breached_cb(hdd_ctx->hHal, - hdd_rssi_threshold_breached); - - status = sme_bpf_offload_register_callback(hdd_ctx->hHal, - hdd_get_bpf_offload_cb); - if (QDF_IS_STATUS_SUCCESS(status)) - hdd_err("set bpf offload callback failed"); - - hdd_cfg80211_link_layer_stats_init(hdd_ctx); - wlan_hdd_tsf_init(hdd_ctx); wlan_hdd_send_all_scan_intf_info(hdd_ctx); wlan_hdd_send_version_pkg(hdd_ctx->target_fw_version, hdd_ctx->target_hw_version, hdd_ctx->target_hw_name); - wlan_hdd_dcc_register_for_dcc_stats_event(hdd_ctx); - if (hdd_ctx->config->dual_mac_feature_disable) { status = wlan_hdd_disable_all_dual_mac_features(hdd_ctx); if (status != QDF_STATUS_SUCCESS) { @@ -6944,6 +6921,12 @@ int hdd_wlan_startup(struct device *dev, void *hif_sc) memdump_init(); + ret = hdd_register_cb(hdd_ctx); + if (ret) { + hdd_err("Failed to register HDD callbacks!"); + goto err_exit_nl_srv; + } + goto success; err_debugfs_exit: @@ -6992,6 +6975,122 @@ success: return 0; } +/** + * hdd_register_cb() - Register HDD callbacks. + * @hdd_ctx: HDD context + * + * Register the HDD callbacks to CDS/SME. + * + * Return: 0 for success or Error code for failure + */ +int hdd_register_cb(hdd_context_t *hdd_ctx) +{ + QDF_STATUS status; + int ret = 0; + + ENTER(); + + sme_register11d_scan_done_callback(hdd_ctx->hHal, hdd_11d_scan_done); + + sme_register_oem_data_rsp_callback(hdd_ctx->hHal, + hdd_send_oem_data_rsp_msg); + + status = sme_fw_mem_dump_register_cb(hdd_ctx->hHal, + wlan_hdd_cfg80211_fw_mem_dump_cb); + if (!QDF_IS_STATUS_SUCCESS(status)) { + hdd_err("Failed to register memdump callback"); + ret = -EINVAL; + return ret; + } + + sme_set_tsfcb(hdd_ctx->hHal, hdd_get_tsf_cb, hdd_ctx); + sme_nan_register_callback(hdd_ctx->hHal, + wlan_hdd_cfg80211_nan_callback); + sme_stats_ext_register_callback(hdd_ctx->hHal, + wlan_hdd_cfg80211_stats_ext_callback); + + sme_ext_scan_register_callback(hdd_ctx->hHal, + wlan_hdd_cfg80211_extscan_callback); + + status = cds_register_sap_restart_channel_switch_cb( + (void *)hdd_sap_restart_with_channel_switch); + if (!QDF_IS_STATUS_SUCCESS(status)) { + hdd_err("restart cb registration failed"); + ret = -EINVAL; + return ret; + } + + sme_set_rssi_threshold_breached_cb(hdd_ctx->hHal, + hdd_rssi_threshold_breached); + + status = sme_bpf_offload_register_callback(hdd_ctx->hHal, + hdd_get_bpf_offload_cb); + if (!QDF_IS_STATUS_SUCCESS(status)) { + hdd_err("set bpf offload callback failed"); + ret = -EINVAL; + return ret; + } + + sme_set_link_layer_stats_ind_cb(hdd_ctx->hHal, + wlan_hdd_cfg80211_link_layer_stats_callback); + + wlan_hdd_dcc_register_for_dcc_stats_event(hdd_ctx); + + EXIT(); + + return ret; +} + +/** + * hdd_deregister_cb() - De-Register HDD callbacks. + * @hdd_ctx: HDD context + * + * De-Register the HDD callbacks to CDS/SME. + * + * Return: void + */ +void hdd_deregister_cb(hdd_context_t *hdd_ctx) +{ + QDF_STATUS status; + + ENTER(); + + status = sme_deregister_for_dcc_stats_event(hdd_ctx->hHal); + if (!QDF_IS_STATUS_SUCCESS(status)) + hdd_err("De-register of dcc stats callback failed: %d", + status); + + sme_reset_link_layer_stats_ind_cb(hdd_ctx->hHal); + status = sme_bpf_offload_deregister_callback(hdd_ctx->hHal); + if (!QDF_IS_STATUS_SUCCESS(status)) + hdd_err("De-register bpf offload callback failed: %d", + status); + sme_reset_rssi_threshold_breached_cb(hdd_ctx->hHal); + + status = cds_deregister_sap_restart_channel_switch_cb(); + if (!QDF_IS_STATUS_SUCCESS(status)) + hdd_err("De-register restart cb registration failed: %d", + status); + + sme_stats_ext_register_callback(hdd_ctx->hHal, + wlan_hdd_cfg80211_stats_ext_callback); + + sme_nan_deregister_callback(hdd_ctx->hHal); + status = sme_reset_tsfcb(hdd_ctx->hHal); + if (!QDF_IS_STATUS_SUCCESS(status)) + hdd_err("Failed to de-register tsfcb the callback:%d", + status); + status = sme_fw_mem_dump_unregister_cb(hdd_ctx->hHal); + if (!QDF_IS_STATUS_SUCCESS(status)) + hdd_err("Failed to de-register the fw mem dump callback: %d", + status); + + sme_deregister_oem_data_rsp_callback(hdd_ctx->hHal); + sme_deregister11d_scan_done_callback(hdd_ctx->hHal); + + EXIT(); +} + /** * hdd_softap_sta_deauth() - handle deauth req from HDD * @adapter: Pointer to the HDD diff --git a/core/hdd/src/wlan_hdd_memdump.c b/core/hdd/src/wlan_hdd_memdump.c index 0434a69d5608..2e13649614fd 100644 --- a/core/hdd/src/wlan_hdd_memdump.c +++ b/core/hdd/src/wlan_hdd_memdump.c @@ -100,14 +100,14 @@ static void memdump_cleanup_timer_cb(void *data) /** * wlan_hdd_cfg80211_fw_mem_dump_cb() - Callback to receive FW memory dump * @ctx: pointer to HDD context. - * @rsp: pointer to fw dump copy complete response + * @dump_rsp: pointer to fw dump copy complete response * * This is a callback function used to indicate user space about the * availability for firmware memory dump via vendor event. * * Return: None */ -static void wlan_hdd_cfg80211_fw_mem_dump_cb(void *ctx, +void wlan_hdd_cfg80211_fw_mem_dump_cb(void *ctx, struct fw_dump_rsp *dump_rsp) { hdd_context_t *hdd_ctx = ctx; @@ -611,7 +611,6 @@ void memdump_deinit(void) } memdump_procfs_remove(); - sme_fw_mem_dump_unregister_cb(hdd_ctx->hHal); mutex_lock(&hdd_ctx->memdump_lock); if (hdd_ctx->fw_dump_loc) { diff --git a/core/hdd/src/wlan_hdd_nan.c b/core/hdd/src/wlan_hdd_nan.c index cbf3a68d5072..ad01978322e3 100644 --- a/core/hdd/src/wlan_hdd_nan.c +++ b/core/hdd/src/wlan_hdd_nan.c @@ -127,7 +127,7 @@ int wlan_hdd_cfg80211_nan_request(struct wiphy *wiphy, * * Return: nothing */ -static void wlan_hdd_cfg80211_nan_callback(void *ctx, tSirNanEvent *msg) +void wlan_hdd_cfg80211_nan_callback(void *ctx, tSirNanEvent *msg) { hdd_context_t *hdd_ctx = ctx; struct sk_buff *vendor_event; @@ -174,18 +174,3 @@ bool wlan_hdd_nan_is_supported(void) { return sme_is_feature_supported_by_fw(NAN); } - -/** - * wlan_hdd_nan_init() - HDD NAN initialization function - * @hdd_ctx: Global HDD context - * - * This function is called to initialize the HDD NAN feature. Currently - * the only operation required is to register a callback with SME. - * - * Return: void - */ -void wlan_hdd_nan_init(hdd_context_t *hdd_ctx) -{ - sme_nan_register_callback(hdd_ctx->hHal, - wlan_hdd_cfg80211_nan_callback); -} diff --git a/core/hdd/src/wlan_hdd_ocb.c b/core/hdd/src/wlan_hdd_ocb.c index 69e936e7b3a7..9b435ce7dac3 100644 --- a/core/hdd/src/wlan_hdd_ocb.c +++ b/core/hdd/src/wlan_hdd_ocb.c @@ -1988,7 +1988,7 @@ void wlan_hdd_dcc_register_for_dcc_stats_event(hdd_context_t *hdd_ctx) int rc; rc = sme_register_for_dcc_stats_event(hdd_ctx->hHal, hdd_ctx, - wlan_hdd_dcc_stats_event_callback); + wlan_hdd_dcc_stats_event_callback); if (rc) hdd_err("Register callback failed: %d", rc); } diff --git a/core/hdd/src/wlan_hdd_ocb.h b/core/hdd/src/wlan_hdd_ocb.h index 0ca97bf607fb..73f700bdba0b 100644 --- a/core/hdd/src/wlan_hdd_ocb.h +++ b/core/hdd/src/wlan_hdd_ocb.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2015 The Linux Foundation. All rights reserved. + * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -289,4 +289,7 @@ int wlan_hdd_cfg80211_dcc_update_ndl(struct wiphy *wiphy, void wlan_hdd_dcc_register_for_dcc_stats_event(hdd_context_t *hdd_ctx); +void wlan_hdd_dcc_stats_event(void *context_ptr, void *response_ptr); + + #endif /* __WLAN_HDD_OCB_H */ diff --git a/core/hdd/src/wlan_hdd_power.c b/core/hdd/src/wlan_hdd_power.c index c4321ebecdcc..a38ba51a4ca7 100644 --- a/core/hdd/src/wlan_hdd_power.c +++ b/core/hdd/src/wlan_hdd_power.c @@ -1326,6 +1326,8 @@ QDF_STATUS hdd_wlan_shutdown(void) hdd_cleanup_scan_queue(pHddCtx); hdd_reset_all_adapters(pHddCtx); + /* De-register the HDD callbacks */ + hdd_deregister_cb(pHddCtx); hdd_ipa_uc_ssr_deinit(); cds_sched_context = get_cds_sched_ctxt(); @@ -1615,15 +1617,11 @@ QDF_STATUS hdd_wlan_re_init(void *hif_sc) /* Allow the phone to go to sleep */ hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_DRIVER_REINIT); - sme_ext_scan_register_callback(pHddCtx->hHal, - wlan_hdd_cfg80211_extscan_callback); - - qdf_status = hdd_register_for_sap_restart_with_channel_switch(); - if (!QDF_IS_STATUS_SUCCESS(qdf_status)) - /* Error already logged */ + ret = hdd_register_cb(pHddCtx); + if (ret) { + hdd_err("Failed to register HDD callbacks!"); goto err_cds_disable; - - sme_set_rssi_threshold_breached_cb(pHddCtx->hHal, hdd_rssi_threshold_breached); + } wlan_hdd_send_all_scan_intf_info(pHddCtx); wlan_hdd_send_version_pkg(pHddCtx->target_fw_version, diff --git a/core/hdd/src/wlan_hdd_stats.c b/core/hdd/src/wlan_hdd_stats.c index c91d516226a2..fce9d96d26b0 100644 --- a/core/hdd/src/wlan_hdd_stats.c +++ b/core/hdd/src/wlan_hdd_stats.c @@ -962,7 +962,7 @@ static void hdd_link_layer_process_radio_stats(hdd_adapter_t *pAdapter, * * Return: None */ -static void wlan_hdd_cfg80211_link_layer_stats_callback(void *ctx, +void wlan_hdd_cfg80211_link_layer_stats_callback(void *ctx, int indType, void *pRsp) { hdd_context_t *pHddCtx = (hdd_context_t *) ctx; @@ -1071,18 +1071,6 @@ static void wlan_hdd_cfg80211_link_layer_stats_callback(void *ctx, return; } -/** - * hdd_cfg80211_link_layer_stats_init() - Initialize link layer stats - * @pHddCtx: Pointer to hdd context - * - * Return: None - */ -void hdd_cfg80211_link_layer_stats_init(hdd_context_t *pHddCtx) -{ - sme_set_link_layer_stats_ind_cb(pHddCtx->hHal, - wlan_hdd_cfg80211_link_layer_stats_callback); -} - const struct nla_policy qca_wlan_vendor_ll_set_policy[QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_MAX + 1] = { @@ -1557,7 +1545,7 @@ int wlan_hdd_cfg80211_stats_ext_request(struct wiphy *wiphy, * * Return: nothing */ -static void wlan_hdd_cfg80211_stats_ext_callback(void *ctx, +void wlan_hdd_cfg80211_stats_ext_callback(void *ctx, tStatsExtEvent *msg) { @@ -1614,18 +1602,6 @@ static void wlan_hdd_cfg80211_stats_ext_callback(void *ctx, cfg80211_vendor_event(vendor_event, GFP_KERNEL); } - -/** - * wlan_hdd_cfg80211_stats_ext_init() - ext stats init - * @ctx: Pointer to HDD context - * - * Return: nothing - */ -void wlan_hdd_cfg80211_stats_ext_init(hdd_context_t *pHddCtx) -{ - sme_stats_ext_register_callback(pHddCtx->hHal, - wlan_hdd_cfg80211_stats_ext_callback); -} #endif /* End of WLAN_FEATURE_STATS_EXT */ /** diff --git a/core/hdd/src/wlan_hdd_stats.h b/core/hdd/src/wlan_hdd_stats.h index 8055f15e56e5..2c2fefc5b31b 100644 --- a/core/hdd/src/wlan_hdd_stats.h +++ b/core/hdd/src/wlan_hdd_stats.h @@ -88,8 +88,6 @@ struct index_data_rate_type { */ #define LL_STATS_EVENT_BUF_SIZE 4096 -void hdd_cfg80211_link_layer_stats_init(hdd_context_t *pHddCtx); - /** * wlan_hdd_cfg80211_ll_stats_set() - set link layer stats * @wiphy: Pointer to wiphy @@ -142,11 +140,6 @@ static inline bool hdd_link_layer_stats_supported(void) #else -static inline void hdd_cfg80211_link_layer_stats_init(hdd_context_t *pHddCtx) -{ - return; -} - static inline void hdd_init_ll_stats_ctx(void) { return; @@ -174,7 +167,6 @@ int wlan_hdd_cfg80211_stats_ext_request(struct wiphy *wiphy, const void *data, int data_len); -void wlan_hdd_cfg80211_stats_ext_init(hdd_context_t *pHddCtx); #else static inline void wlan_hdd_cfg80211_stats_ext_init(hdd_context_t *pHddCtx) {} #endif /* End of WLAN_FEATURE_STATS_EXT */ @@ -207,5 +199,10 @@ int wlan_hdd_cfg80211_dump_survey(struct wiphy *wiphy, void hdd_display_hif_stats(void); void hdd_clear_hif_stats(void); +void wlan_hdd_cfg80211_stats_ext_callback(void *ctx, + tStatsExtEvent *msg); + +void wlan_hdd_cfg80211_link_layer_stats_callback(void *ctx, + int indType, void *pRsp); #endif /* end #if !defined(WLAN_HDD_STATS_H) */ diff --git a/core/hdd/src/wlan_hdd_tsf.c b/core/hdd/src/wlan_hdd_tsf.c index e98759ae22f1..e230925a7cd7 100644 --- a/core/hdd/src/wlan_hdd_tsf.c +++ b/core/hdd/src/wlan_hdd_tsf.c @@ -201,7 +201,7 @@ int hdd_indicate_tsf(struct hdd_adapter_s *adapter, uint32_t *buf, int len) * * Return: 0 for success or non-zero negative failure code */ -static int hdd_get_tsf_cb(void *pcb_cxt, struct stsf *ptsf) +int hdd_get_tsf_cb(void *pcb_cxt, struct stsf *ptsf) { struct hdd_context_s *hddctx; struct hdd_adapter_s *adapter; diff --git a/core/sme/inc/nan_api.h b/core/sme/inc/nan_api.h index 1c0722b2ae94..6552df8aa63e 100644 --- a/core/sme/inc/nan_api.h +++ b/core/sme/inc/nan_api.h @@ -45,6 +45,7 @@ typedef struct sNanRequestReq { typedef void (*NanCallback)(void *, tSirNanEvent *); void sme_nan_register_callback(tHalHandle hHal, NanCallback callback); +void sme_nan_deregister_callback(tHalHandle hHal); QDF_STATUS sme_nan_request(tpNanRequestReq input); #endif /* __NAN_API_H__ */ diff --git a/core/sme/inc/sme_api.h b/core/sme/inc/sme_api.h index 015d1ca1f940..f24d6ec88ad8 100644 --- a/core/sme/inc/sme_api.h +++ b/core/sme/inc/sme_api.h @@ -365,15 +365,23 @@ extern QDF_STATUS sme_set_host_power_save(tHalHandle hHal, bool psMode); void sme_set_dhcp_till_power_active_flag(tHalHandle hHal, uint8_t flag); extern QDF_STATUS sme_register11d_scan_done_callback(tHalHandle hHal, csr_scan_completeCallback); +void sme_deregister11d_scan_done_callback(tHalHandle hHal); + #ifdef FEATURE_OEM_DATA_SUPPORT extern QDF_STATUS sme_register_oem_data_rsp_callback(tHalHandle h_hal, sme_send_oem_data_rsp_msg callback); +void sme_deregister_oem_data_rsp_callback(tHalHandle h_hal); + #else static inline QDF_STATUS sme_register_oem_data_rsp_callback(tHalHandle h_hal, sme_send_oem_data_rsp_msg callback) { return QDF_STATUS_SUCCESS; } +static inline void sme_deregister_oem_data_rsp_callback(tHalHandle h_hal) +{ +} + #endif extern QDF_STATUS sme_wow_add_pattern(tHalHandle hHal, @@ -812,6 +820,7 @@ typedef struct sStatsExtRequestReq { typedef void (*StatsExtCallback)(void *, tStatsExtEvent *); void sme_stats_ext_register_callback(tHalHandle hHal, StatsExtCallback callback); +void sme_stats_ext_deregister_callback(tHalHandle hhal); QDF_STATUS sme_stats_ext_request(uint8_t session_id, tpStatsExtRequestReq input); QDF_STATUS sme_stats_ext_event(tHalHandle hHal, void *pMsg); @@ -878,6 +887,7 @@ QDF_STATUS sme_ll_stats_get_req(tHalHandle hHal, QDF_STATUS sme_set_link_layer_stats_ind_cb(tHalHandle hHal, void (*callbackRoutine)(void *callbackCtx, int indType, void *pRsp)); +QDF_STATUS sme_reset_link_layer_stats_ind_cb(tHalHandle hhal); #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ QDF_STATUS sme_fw_mem_dump(tHalHandle hHal, void *recvd_req); @@ -973,6 +983,7 @@ QDF_STATUS sme_set_rssi_monitoring(tHalHandle hal, struct rssi_monitor_req *input); QDF_STATUS sme_set_rssi_threshold_breached_cb(tHalHandle hal, void (*cb)(void *, struct rssi_breach_event *)); +QDF_STATUS sme_reset_rssi_threshold_breached_cb(tHalHandle hal); QDF_STATUS sme_register_mgmt_frame_ind_callback(tHalHandle hal, sir_mgmt_frame_ind_callback callback); @@ -1050,6 +1061,8 @@ QDF_STATUS sme_dcc_update_ndl(tHalHandle hHal, void *context, QDF_STATUS sme_register_for_dcc_stats_event(tHalHandle hHal, void *context, ocb_callback callback); +QDF_STATUS sme_deregister_for_dcc_stats_event(tHalHandle hHal); + void sme_add_set_thermal_level_callback(tHalHandle hal, sme_set_thermal_level_callback callback); @@ -1096,13 +1109,22 @@ QDF_STATUS sme_ht40_stop_obss_scan(tHalHandle hHal, uint32_t vdev_id); QDF_STATUS sme_set_tsfcb(tHalHandle hHal, int (*cb_fn)(void *cb_ctx, struct stsf *ptsf), void *cb_ctx); +QDF_STATUS sme_reset_tsfcb(tHalHandle h_hal); + #ifdef WLAN_FEATURE_TSF QDF_STATUS sme_set_tsf_gpio(tHalHandle h_hal, uint32_t pinvalue); +QDF_STATUS sme_reset_tsf_gpio(tHalHandle h_hal); + #else static inline QDF_STATUS sme_set_tsf_gpio(tHalHandle h_hal, uint32_t pinvalue) { return QDF_STATUS_E_FAILURE; } +static inline QDF_STATUS sme_reset_tsf_gpio(tHalHandle h_hal) +{ + return QDF_STATUS_E_FAILURE; +} + #endif QDF_STATUS sme_update_mimo_power_save(tHalHandle hHal, @@ -1117,6 +1139,7 @@ QDF_STATUS sme_remove_beacon_filter(tHalHandle hal, uint32_t session_id); QDF_STATUS sme_bpf_offload_register_callback(tHalHandle hal, void (*pbpf_get_offload_cb)(void *, struct sir_bpf_get_offload *)); +QDF_STATUS sme_bpf_offload_deregister_callback(tHalHandle hal); QDF_STATUS sme_get_bpf_offload_capabilities(tHalHandle hal); QDF_STATUS sme_set_bpf_instructions(tHalHandle hal, diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c index 3674fb1f62de..aa646355c871 100644 --- a/core/sme/src/common/sme_api.c +++ b/core/sme/src/common/sme_api.c @@ -4728,6 +4728,29 @@ QDF_STATUS sme_register11d_scan_done_callback(tHalHandle hHal, return status; } +/** + * sme_deregister11d_scan_done_callback() - De-register scandone callback + * @h_hal: Handler return by mac_open + * + * This function De-registers the scandone callback to SME + * + * Return: None + */ +void sme_deregister11d_scan_done_callback(tHalHandle h_hal) +{ + tpAniSirGlobal pmac; + + if (!h_hal) { + QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, + FL("hHal is not valid")); + return; + } + + pmac = PMAC_STRUCT(h_hal); + pmac->scan.callback11dScanDone = NULL; +} + + #ifdef FEATURE_OEM_DATA_SUPPORT /** * sme_register_oem_data_rsp_callback() - Register a routine of @@ -4752,6 +4775,27 @@ QDF_STATUS sme_register_oem_data_rsp_callback(tHalHandle h_hal, return status; } + +/** + * sme_deregister_oem_data_rsp_callback() - De-register OEM datarsp callback + * @h_hal: Handler return by mac_open + * This function De-registers the OEM data response callback to SME + * + * Return: None + */ +void sme_deregister_oem_data_rsp_callback(tHalHandle h_hal) +{ + tpAniSirGlobal pmac; + + if (!h_hal) { + QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, + FL("hHal is not valid")); + return; + } + pmac = PMAC_STRUCT(h_hal); + + pmac->oemData.oem_data_rsp_callback = NULL; +} #endif /** @@ -7330,7 +7374,7 @@ QDF_STATUS sme_preferred_network_found_ind(tHalHandle hHal, void *pMsg) #endif /* FEATURE_WLAN_SCAN_PNO */ -/* +/** * sme_set_tsfcb() - Set callback for TSF capture * @h_hal: Handler return by mac_open * @cb_fn: Callback function pointer @@ -7353,6 +7397,35 @@ QDF_STATUS sme_set_tsfcb(tHalHandle h_hal, return status; } +/** + * sme_reset_tsfcb() - Reset callback for TSF capture + * @h_hal: Handler return by mac_open + * + * This function reset the tsf capture callback to SME + * + * Return: QDF_STATUS + */ +QDF_STATUS sme_reset_tsfcb(tHalHandle h_hal) +{ + tpAniSirGlobal mac; + QDF_STATUS status; + + if (!h_hal) { + QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, + FL("h_hal is not valid")); + return QDF_STATUS_E_INVAL; + } + mac = PMAC_STRUCT(h_hal); + + status = sme_acquire_global_lock(&mac->sme); + if (QDF_IS_STATUS_SUCCESS(status)) { + mac->sme.get_tsf_cb = NULL; + mac->sme.get_tsf_cxt = NULL; + sme_release_global_lock(&mac->sme); + } + return status; +} + #ifdef WLAN_FEATURE_TSF /* * sme_set_tsf_gpio() - set gpio pin that be toggled when capture tef @@ -11420,6 +11493,40 @@ QDF_STATUS sme_register_for_dcc_stats_event(tHalHandle hHal, void *context, return 0; } +/** + * sme_deregister_for_dcc_stats_event() - De-Register for the periodic DCC stats + * event + * @h_hal: Hal Handle + * + * This function de-registers the DCC perioc stats callback + * + * Return: QDF_STATUS Enumeration + */ +QDF_STATUS sme_deregister_for_dcc_stats_event(tHalHandle h_hal) +{ + tpAniSirGlobal mac; + QDF_STATUS status; + + if (!h_hal) { + QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, + FL("h_hal is not valid")); + return QDF_STATUS_E_INVAL; + } + mac = PMAC_STRUCT(h_hal); + + status = sme_acquire_global_lock(&mac->sme); + if (!QDF_IS_STATUS_SUCCESS(status)) { + QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, + FL("Failed to acquire global lock")); + return status; + } + mac->sme.dcc_stats_event_callback = NULL; + mac->sme.dcc_stats_event_context = NULL; + sme_release_global_lock(&mac->sme); + + return status; +} + void sme_get_recovery_stats(tHalHandle hHal) { uint8_t i; @@ -12513,6 +12620,30 @@ void sme_stats_ext_register_callback(tHalHandle hHal, StatsExtCallback callback) pMac->sme.StatsExtCallback = callback; } +/** + * sme_stats_ext_deregister_callback() - De-register ext stats callback + * @h_hal: Hal Handle + * + * This function is called to de initialize the HDD NAN feature. Currently + * the only operation required is to de-register a callback with SME. + * + * Return: None + */ +void sme_stats_ext_deregister_callback(tHalHandle h_hal) +{ + tpAniSirGlobal pmac; + + if (!h_hal) { + QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, + FL("hHal is not valid")); + return; + } + + pmac = PMAC_STRUCT(h_hal); + pmac->sme.StatsExtCallback = NULL; +} + + /****************************************************************************** \fn sme_stats_ext_request @@ -13683,6 +13814,41 @@ QDF_STATUS sme_set_link_layer_stats_ind_cb return status; } +/** + * sme_reset_link_layer_stats_ind_cb() - SME API to reset link layer stats + * indication + * @h_hal: Hal Handle + * + * This function reset's the link layer stats indication + * + * Return: QDF_STATUS Enumeration + */ + +QDF_STATUS sme_reset_link_layer_stats_ind_cb(tHalHandle h_hal) +{ + QDF_STATUS status; + tpAniSirGlobal pmac; + + if (!h_hal) { + QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, + FL("hHal is not valid")); + return QDF_STATUS_E_INVAL; + } + pmac = PMAC_STRUCT(h_hal); + + status = sme_acquire_global_lock(&pmac->sme); + if (QDF_IS_STATUS_SUCCESS(status)) { + pmac->sme.pLinkLayerStatsIndCallback = NULL; + sme_release_global_lock(&pmac->sme); + } else { + QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, "%s: sme_acquire_global_lock error", + __func__); + } + + return status; +} + + #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ /** @@ -14530,17 +14696,50 @@ void sme_update_user_configured_nss(tHalHandle hal, uint8_t nss) /** * sme_set_rssi_threshold_breached_cb() - set rssi threshold breached callback - * @hal: global hal handle + * @h_hal: global hal handle * @cb: callback function pointer * * This function stores the rssi threshold breached callback function. * * Return: QDF_STATUS enumeration. */ -QDF_STATUS sme_set_rssi_threshold_breached_cb(tHalHandle hal, +QDF_STATUS sme_set_rssi_threshold_breached_cb(tHalHandle h_hal, void (*cb)(void *, struct rssi_breach_event *)) { QDF_STATUS status = QDF_STATUS_SUCCESS; + tpAniSirGlobal mac; + + if (!h_hal) { + QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, + FL("hHal is not valid")); + return QDF_STATUS_E_INVAL; + } + mac = PMAC_STRUCT(h_hal); + + status = sme_acquire_global_lock(&mac->sme); + if (!QDF_IS_STATUS_SUCCESS(status)) { + QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, + FL("sme_acquire_global_lock failed!(status=%d)"), + status); + return status; + } + + mac->sme.rssi_threshold_breached_cb = cb; + sme_release_global_lock(&mac->sme); + return status; +} + +/** + * sme_set_rssi_threshold_breached_cb() - Reset rssi threshold breached callback + * @hal: global hal handle + * + * This function de-registers the rssi threshold breached callback function. + * + * Return: QDF_STATUS enumeration. + */ +QDF_STATUS sme_reset_rssi_threshold_breached_cb(tHalHandle hal) +{ + QDF_STATUS status; tpAniSirGlobal mac = PMAC_STRUCT(hal); status = sme_acquire_global_lock(&mac->sme); @@ -14551,7 +14750,7 @@ QDF_STATUS sme_set_rssi_threshold_breached_cb(tHalHandle hal, return status; } - mac->sme.rssi_threshold_breached_cb = cb; + mac->sme.rssi_threshold_breached_cb = NULL; sme_release_global_lock(&mac->sme); return status; } @@ -15626,6 +15825,41 @@ uint32_t sme_get_wni_dot11_mode(tHalHandle hal) mac_ctx->roam.configParam.uCfgDot11Mode); } +/** + * sme_bpf_offload_deregister_callback() - Register get bpf offload callbacK + * + * @h_hal - MAC global handle + * @callback_routine - callback routine from HDD + * + * This API is invoked by HDD to de-register its callback in SME + * + * Return: QDF_STATUS Enumeration + */ +QDF_STATUS sme_bpf_offload_deregister_callback(tHalHandle h_hal) +{ + QDF_STATUS status = QDF_STATUS_SUCCESS; + tpAniSirGlobal mac; + + if (!h_hal) { + QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, + FL("hHal is not valid")); + return QDF_STATUS_E_INVAL; + } + + mac = PMAC_STRUCT(h_hal); + + status = sme_acquire_global_lock(&mac->sme); + if (QDF_IS_STATUS_SUCCESS(status)) { + mac->sme.pbpf_get_offload_cb = NULL; + sme_release_global_lock(&mac->sme); + } else { + QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, + FL("sme_acquire_global_lock failed")); + } + return status; +} + + /** * sme_create_mon_session() - post message to create PE session for monitormode * operation diff --git a/core/sme/src/nan/nan_api.c b/core/sme/src/nan/nan_api.c index 5398ffa3398c..83d7fe64b103 100644 --- a/core/sme/src/nan/nan_api.c +++ b/core/sme/src/nan/nan_api.c @@ -59,6 +59,28 @@ void sme_nan_register_callback(tHalHandle hHal, NanCallback callback) pMac->sme.nanCallback = callback; } +/** + * sme_nan_deregister_callback() - NAN De-register cb function + * @h_hal: Hal handle + * + * De-register nan rsp callback with sme layer. + * + * Return: void + */ +void sme_nan_deregister_callback(tHalHandle h_hal) +{ + tpAniSirGlobal pmac; + + if (!h_hal) { + QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, + FL("hHal is not valid")); + return; + } + pmac = PMAC_STRUCT(h_hal); + pmac->sme.nanCallback = NULL; +} + + /****************************************************************************** * Function: sme_nan_request *