diff options
| author | Linux Build Service Account <lnxbuild@localhost> | 2016-08-11 04:23:58 -0600 |
|---|---|---|
| committer | Linux Build Service Account <lnxbuild@localhost> | 2016-08-11 04:23:58 -0600 |
| commit | 527f507e400e9e07c2ecd0f0577d54a950be6e42 (patch) | |
| tree | 8d85e2c0ef9742efc61f8d3788df6b2cb9655118 | |
| parent | 209a500d04df62263fa5e5cf680cd17c292e590e (diff) | |
| parent | fae92945647176fdece9f45559e512ccb4583991 (diff) | |
Promotion of wlan-cld3.driver.lnx.1.1-00075.
CRs Change ID Subject
--------------------------------------------------------------------------------------------------------------
688141 I0ab541e388344f6635bca51386caeaa299c675ae Release 5.1.0.22W
1042205 I177a0047f460aa2a305a9e4e46fbfaa94a81dced qcacld-3.0: Add unit test framework to validate WLAN sus
1038872 I94f05833baa9b6baaf2272f63a33236437a96bbf qcacld-3.0: Remove usage of typedef for oem related stru
1038872 I95078c985c5034d9d530ad542ace129309d79886 qcacld-3.0: Remove global oem data request/response buff
865207 I473e46c1236140c780059d2877e573bbe22b1586 qcacld-3.0: CL 1548852 - update fw common interface file
688141 Iada9a919252568fa84397a90b7ccc8c2e047b50c Release 5.1.0.22Q
688141 I68afefead63233a63ceed4f442219277ba061782 Release 5.1.0.22T
865207 I2aa5983833ba2ed028a4053b292fe4b6ae66858e qcacld-3.0: CL 1596255 - update fw common interface file
1038872 I3cff10ff7bdbcee39b39bd9ba03b5eff8444b017 qcacld-3.0: Remove oem data rsp passing over multiple la
990645 I33369320de5b0aadae661d7d27fbc5ba18e9e409 qcacld-3.0: Fix crash in wlan_hdd_tdls_check_power_save_
1048116 I0a8825b44f4bcd9b05f0e1f0e6cdd0d114af0a01 qcacld-3.0: Fix memory leak in wma_roam_scan_filter
1049218 Ica49dd289d7f1f0ad0c56af76bd7bcfeca433a2e qcacld-3.0: Dynamic Mode changes
1046882 Ie710afbd6c066a3d770c6c9aac0cfd675ea57f53 qcacld-3.0: Reduce hdd_hostapd_sap_event_cb frame size
1048116 I448cf0d4bb16d4769b50c96495038684909e0739 qcacld-3.0: Fix memory leak in csr_update_lost_link1_cmd
1045626 Ife4a4d8121bdc5ef9ed92aa9aea1d92ee4554732 qcacld-3.0: Refactor initialization of cds modules
688141 I102cc524c81deafbb9737be5f63635dc1878327e Release 5.1.0.22S
1038872 I151fa771544e9f74b1b69b18d689176752760621 qcacld-3.0: Remove oem data request passing over multipl
688141 I36091d1f7d04ce2f8785fae30949424a2adf00de Release 5.1.0.22R
865207 I0832f646e76d3e883a36ce3d5d6a63ad7bf83a4c qcacld-3.0: CL 1594228 - update fw common interface file
936342 I75114b5e36b4ce6def602b9054481845ac09c56a Revert "qcacld-3.0: Allow Re-assoc to same AP only in op
1038872 Ia194f559acde6689a50c56b52078b7dc967c6159 qcacld-3.0: Remove handling of deprecated OEM related ev
1049333 Id5303ffc4004e58f6302f8692a15b8040231c3a4 qcacld-3.0: Update default INI config value for rm_capab
865207 I4aaccf1d55aa3e173e4ae2e298a8c711e4a01e31 qcacld-3.0: CL 1548360 - update fw common interface file
1018486 I4211b41b5e30d414e45691a5bab4048587cc8499 qcacld-3.0: Fix uninitialized heap and stack usage
688141 I890cb59fc99d9cbb5dfd1f64feff923521a09dab Release 5.1.0.22U
688141 I543495b76ae114969255ac92eeb553d1c55b2ddf Release 5.1.0.22Y
985562 Iaf4774865cf0698a2deebac5cea62c873146e838 qcacld-3.0: memset bpf load to zero, update the bpf enab
1017496 I3743b8fe333d3a64b01109e3e821ce44443bdafd qcacld-3.0: Export APIs for power on/off WLAN hardware
865207 I3940ffaf856fe9697818b6e56df3a49bf4750af0 qcacld-3.0: CL 1594673 - update fw common interface file
688141 Ifc771a833269139b85f26c57062fd0ab80ca1fc0 Release 5.1.0.22X
865207 Iad3c57f0b4e10e68c86cef175b8cadcfd9e7fe1e qcacld-3.0: CL 1597848 - update fw common interface file
1027738 I310bffef89b879c964a7c47a58f905503df709d2 qcacld-3.0: Fix compiler warning when p2p_debug disabled
1047209 Ifa6cab73c59aa4a7c587fa0b7d38e9b8523a3b1c qcacld-3.0: Add memory allocation failure check for BPF
1025272 I6b2fd40a5466fe5dd72d394abb682229a550e0b1 qcacld-3.0: Fix stack corruption issue in sme_RrmProcess
1048395 I61096bdbf757cd21f959fa716f35f65cd27cc9cc qcacld-3.0: Reduce unnecessary error log levels from sus
688141 I793a88218490fc765d1a9e1da80b782f9032d80c Release 5.1.0.22V
1038872 I33c5190b78ffff2bf160e57a6edaf4b67189062c qcacld-3.0: Remove unused data structures related to OEM
1042968 I31ed8edaee1a9b3715f66686a8a45d5f2ffd4532 qcacld-3.0: Fix out of bound access in convert_qos_mapse
Change-Id: I561a376955096eb7d9dee78cdd37af8e152082ed
CRs-Fixed: 985562, 1042205, 1017496, 1047209, 1018486, 1046882, 688141, 1027738, 1025272, 1048395, 1049218, 1038872, 865207, 1045626, 936342, 990645, 1049333, 1042968, 1048116
71 files changed, 2162 insertions, 3311 deletions
@@ -592,8 +592,6 @@ SME_CMN_OBJS := $(SME_SRC_DIR)/common/sme_api.o \ $(SME_SRC_DIR)/common/sme_power_save.o \ $(SME_SRC_DIR)/common/sme_trace.o -SME_OEM_DATA_OBJS := $(SME_SRC_DIR)/oem_data/oem_data_api.o - SME_P2P_OBJS = $(SME_SRC_DIR)/p2p/p2p_api.o SME_RRM_OBJS := $(SME_SRC_DIR)/rrm/sme_rrm.o @@ -608,7 +606,6 @@ endif SME_OBJS := $(SME_CMN_OBJS) \ $(SME_CSR_OBJS) \ - $(SME_OEM_DATA_OBJS) \ $(SME_P2P_OBJS) \ $(SME_QOS_OBJS) \ $(SME_RRM_OBJS) \ @@ -1252,6 +1249,7 @@ endif ifeq ($(CONFIG_HIF_SNOC), 1) CDEFINES += -DHIF_SNOC +CDEFINES += -DWLAN_SUSPEND_RESUME_TEST endif #Enable High Latency related Flags diff --git a/core/cds/inc/cds_sched.h b/core/cds/inc/cds_sched.h index 83cf40316412..0a269007a4fc 100644 --- a/core/cds/inc/cds_sched.h +++ b/core/cds/inc/cds_sched.h @@ -539,6 +539,7 @@ void cds_sched_deinit_mqs(p_cds_sched_context pSchedContext); void cds_sched_flush_mc_mqs(p_cds_sched_context pSchedContext); void qdf_timer_module_init(void); +void qdf_timer_module_deinit(void); void cds_ssr_protect_init(void); void cds_ssr_protect(const char *caller_func); void cds_ssr_unprotect(const char *caller_func); diff --git a/core/cds/src/cds_api.c b/core/cds/src/cds_api.c index 4fd6f9a07e20..82ef025f51c5 100644 --- a/core/cds/src/cds_api.c +++ b/core/cds/src/cds_api.c @@ -198,13 +198,6 @@ QDF_STATUS cds_open(void) return QDF_STATUS_E_FAILURE; } - cds_cfg = cds_get_ini_config(); - if (!cds_cfg) { - cds_err("Cds config is NULL"); - QDF_ASSERT(0); - return QDF_STATUS_E_FAILURE; - } - /* Initialize the timer module */ qdf_timer_module_init(); @@ -245,25 +238,27 @@ QDF_STATUS cds_open(void) &(gp_cds_context->aMsgWrappers[iter])); } - /* Now Open the CDS Scheduler */ - qdf_status = cds_sched_open(gp_cds_context, &gp_cds_context->qdf_sched, - sizeof(cds_sched_context)); - - if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { + pHddCtx = (hdd_context_t *) (gp_cds_context->pHDDContext); + if ((NULL == pHddCtx) || (NULL == pHddCtx->config)) { /* Critical Error ... Cannot proceed further */ - QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_FATAL, - "%s: Failed to open CDS Scheduler", __func__); + cds_err("Hdd Context is Null"); QDF_ASSERT(0); goto err_msg_queue; } + /* Now Open the CDS Scheduler */ - pHddCtx = (hdd_context_t *) (gp_cds_context->pHDDContext); - if ((NULL == pHddCtx) || (NULL == pHddCtx->config)) { - /* Critical Error ... Cannot proceed further */ - QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_FATAL, - "%s: Hdd Context is Null", __func__); - QDF_ASSERT(0); - goto err_sched_close; + if (pHddCtx->driver_status == DRIVER_MODULES_UNINITIALIZED) { + qdf_status = cds_sched_open(gp_cds_context, + &gp_cds_context->qdf_sched, + sizeof(cds_sched_context)); + + if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { + /* Critical Error ... Cannot proceed further */ + QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_FATAL, + "%s: Failed to open CDS Scheduler", __func__); + QDF_ASSERT(0); + goto err_msg_queue; + } } scn = cds_get_context(QDF_MODULE_ID_HIF); @@ -272,6 +267,17 @@ QDF_STATUS cds_open(void) "%s: scn is null!", __func__); goto err_sched_close; } + + hdd_update_config(pHddCtx); + cds_cfg = cds_get_ini_config(); + if (!cds_cfg) { + cds_err("Cds config is NULL"); + QDF_ASSERT(0); + goto err_sched_close; + } + hdd_enable_fastpath(pHddCtx->config, scn); + hdd_wlan_update_target_info(pHddCtx, scn); + ol_ctx = cds_get_context(QDF_MODULE_ID_BMI); /* Initialize BMI and Download firmware */ qdf_status = bmi_download_firmware(ol_ctx); @@ -280,7 +286,6 @@ QDF_STATUS cds_open(void) "BMI FIALED status:%d", qdf_status); goto err_bmi_close; } - htcInfo.pContext = ol_ctx; htcInfo.TargetFailure = ol_target_failure; htcInfo.TargetSendSuspendComplete = wma_target_suspend_acknowledge; @@ -338,6 +343,8 @@ QDF_STATUS cds_open(void) /* UMA is supported in hardware for performing the * frame translation 802.11 <-> 802.3 */ + cds_cfg->frame_xln_reqd = 1; + sirStatus = mac_open(&(gp_cds_context->pMACContext), gp_cds_context->pHDDContext, cds_cfg); @@ -454,8 +461,11 @@ QDF_STATUS cds_pre_enable(v_CONTEXT_t cds_context) } /* call Packetlog connect service */ - htt_pkt_log_init(gp_cds_context->pdev_txrx_ctx, scn); - pktlog_htc_attach(); + if (QDF_GLOBAL_FTM_MODE != cds_get_conparam() && + QDF_GLOBAL_EPPING_MODE != cds_get_conparam()) { + htt_pkt_log_init(gp_cds_context->pdev_txrx_ctx, scn); + pktlog_htc_attach(); + } /* Reset wma wait event */ qdf_event_reset(&gp_cds_context->wmaCompleteEvent); @@ -653,18 +663,12 @@ err_wma_stop: QDF_STATUS cds_disable(v_CONTEXT_t cds_context) { QDF_STATUS qdf_status; - - /* wma_stop is called before the SYS so that the processing of target - * pending responses will not be handled during uninitialization of - * WLAN driver - */ - qdf_event_reset(&(gp_cds_context->wmaCompleteEvent)); + void *handle; qdf_status = wma_stop(cds_context, HAL_STOP_TYPE_RF_KILL); if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { - QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR, - "%s: Failed to stop wma", __func__); + cds_err("Failed to stop wma"); QDF_ASSERT(QDF_IS_STATUS_SUCCESS(qdf_status)); wma_setneedshutdown(cds_context); } @@ -672,15 +676,23 @@ QDF_STATUS cds_disable(v_CONTEXT_t cds_context) hif_disable_isr(((cds_context_type *) cds_context)->pHIFContext); hif_reset_soc(((cds_context_type *) cds_context)->pHIFContext); - /* SYS STOP will stop SME and MAC */ - qdf_status = sys_stop(cds_context); + handle = cds_get_context(QDF_MODULE_ID_PE); + if (!handle) { + cds_err("Invalid PE context return!"); + return QDF_STATUS_E_INVAL; + } + qdf_status = sme_stop(handle, HAL_STOP_TYPE_SYS_DEEP_SLEEP); if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { - QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR, - "%s: Failed to stop SYS", __func__); + cds_err("Failed to stop SME: %d", qdf_status); QDF_ASSERT(QDF_IS_STATUS_SUCCESS(qdf_status)); } + qdf_status = mac_stop(handle, HAL_STOP_TYPE_SYS_DEEP_SLEEP); - return QDF_STATUS_SUCCESS; + if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { + cds_err("Failed to stop MAC"); + QDF_ASSERT(QDF_IS_STATUS_SUCCESS(qdf_status)); + } + return qdf_status; } /** @@ -762,10 +774,9 @@ QDF_STATUS cds_close(v_CONTEXT_t cds_context) } cds_deinit_log_completion(); - - gp_cds_context->pHDDContext = NULL; - cds_deinit_ini_config(); + qdf_timer_module_deinit(); + return QDF_STATUS_SUCCESS; } diff --git a/core/cds/src/cds_concurrency.c b/core/cds/src/cds_concurrency.c index ad89f6df623f..de14e62b8e56 100644 --- a/core/cds/src/cds_concurrency.c +++ b/core/cds/src/cds_concurrency.c @@ -3918,6 +3918,13 @@ QDF_STATUS cds_deinit_policy_mgr(void) cds_err("Invalid CDS Context"); return QDF_STATUS_E_FAILURE; } + + if (!QDF_IS_STATUS_SUCCESS(qdf_event_destroy + (&cds_ctx->connection_update_done_evt))) { + cds_err("Failed to destroy connection_update_done_evt"); + return QDF_STATUS_E_FAILURE; + } + if (!QDF_IS_STATUS_SUCCESS(qdf_mutex_destroy( &cds_ctx->qdf_conc_list_lock))) { cds_err("Failed to destroy qdf_conc_list_lock"); diff --git a/core/cds/src/cds_sched.c b/core/cds/src/cds_sched.c index d452b7ede1b2..08cebb9feb53 100644 --- a/core/cds/src/cds_sched.c +++ b/core/cds/src/cds_sched.c @@ -1176,6 +1176,7 @@ QDF_STATUS cds_sched_close(void *p_cds_context) cds_drop_rxpkt_by_staid(gp_cds_sched_context, WLAN_MAX_STA_COUNT); cds_free_ol_rx_pkt_freeq(gp_cds_sched_context); unregister_hotcpu_notifier(&cds_cpu_hotplug_notifier); + gp_cds_sched_context->cpu_hot_plug_notifier = NULL; #endif return QDF_STATUS_SUCCESS; } /* cds_sched_close() */ diff --git a/core/hdd/inc/wlan_hdd_cfg.h b/core/hdd/inc/wlan_hdd_cfg.h index 04ff01663221..c8c4ccea759e 100644 --- a/core/hdd/inc/wlan_hdd_cfg.h +++ b/core/hdd/inc/wlan_hdd_cfg.h @@ -248,6 +248,16 @@ typedef enum { #define CFG_ROAM_PREFER_5GHZ_DEFAULT (1) /* + * Timer waiting for interface up from the upper layer. If + * this timer expires all the cds modules shall be closed. + * Time Units: ms + */ +#define CFG_INTERFACE_CHANGE_WAIT_NAME "gInterfaceChangeWait" +#define CFG_INTERFACE_CHANGE_WAIT_MIN (10) +#define CFG_INTERFACE_CHANGE_WAIT_MAX (10000) +#define CFG_INTERFACE_CHANGE_WAIT_DEFAULT (50) + +/* To enable, set gRoamIntraBand=1 (Roaming within band) To disable, set gRoamIntraBand=0 (Roaming across band) */ @@ -848,7 +858,7 @@ typedef enum { * Comma is used as a separator for each byte. */ #define CFG_RM_CAPABILITY_NAME "rm_capability" -#define CFG_RM_CAPABILITY_DEFAULT "73,00,6D,00,04" +#define CFG_RM_CAPABILITY_DEFAULT "73,10,6D,00,04" #define CFG_QOS_IMPLICIT_SETUP_ENABLED_NAME "ImplicitQosIsEnabled" #define CFG_QOS_IMPLICIT_SETUP_ENABLED_MIN (0) @@ -4047,6 +4057,7 @@ struct hdd_config { bool enable_nan_datapath; uint8_t nan_datapath_ndi_channel; #endif + uint32_t iface_change_wait_time; }; #define VAR_OFFSET(_Struct, _Var) (offsetof(_Struct, _Var)) diff --git a/core/hdd/inc/wlan_hdd_driver_ops.h b/core/hdd/inc/wlan_hdd_driver_ops.h index 4619cf8a7775..3ea44449b55c 100644 --- a/core/hdd/inc/wlan_hdd_driver_ops.h +++ b/core/hdd/inc/wlan_hdd_driver_ops.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. * @@ -28,6 +28,8 @@ #ifndef __WLAN_HDD_DRIVER_OPS_H__ #define __WLAN_HDD_DRIVER_OPS_H__ +#include "hif.h" + /** * DOC: wlan_hdd_driver_ops.h * @@ -36,4 +38,8 @@ int wlan_hdd_register_driver(void); void wlan_hdd_unregister_driver(void); int wlan_hdd_bus_suspend(pm_message_t state); +int wlan_hdd_bus_resume(void); +void hdd_hif_close(void *hif_ctx); +int hdd_hif_open(struct device *dev, void *bdev, const hif_bus_id *bid, + enum qdf_bus_type bus_type, bool reinit); #endif /* __WLAN_HDD_DRIVER_OPS_H__ */ diff --git a/core/hdd/inc/wlan_hdd_ftm.h b/core/hdd/inc/wlan_hdd_ftm.h index eddce28f6131..878a22e08d53 100644 --- a/core/hdd/inc/wlan_hdd_ftm.h +++ b/core/hdd/inc/wlan_hdd_ftm.h @@ -55,15 +55,11 @@ struct wlan_hdd_ftm_status { enum wlan_hdd_ftm_state ftm_state; }; -int wlan_hdd_ftm_open(hdd_context_t *hdd_ctx); -int wlan_hdd_ftm_close(hdd_context_t *hdd_ctx); int hdd_update_cds_config_ftm(hdd_context_t *hdd_ctx); - +void hdd_ftm_mc_process_msg(void *message); #if defined(QCA_WIFI_FTM) QDF_STATUS wlan_hdd_ftm_testmode_cmd(void *data, int len); int wlan_hdd_qcmbr_unified_ioctl(hdd_adapter_t *adapter, struct ifreq *ifr); -int hdd_ftm_start(hdd_context_t *hdd_ctx); -int hdd_ftm_stop(hdd_context_t *hdd_ctx); #endif #endif diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h index cffdf54cb6e4..4fbec9b7dfbc 100644 --- a/core/hdd/inc/wlan_hdd_main.h +++ b/core/hdd/inc/wlan_hdd_main.h @@ -1184,6 +1184,20 @@ struct hdd_bpf_context { struct sir_bpf_get_offload capability_response; }; +/** + * enum driver_status: Driver Modules status + * @DRIVER_MODULES_UNINITIALIZED: Driver CDS modules uninitialized + * @DRIVER_MODULES_OPENED: Driver CDS modules opened + * @DRIVER_MODULES_ENABLED: Driver CDS modules opened + * @DRIVER_MODULES_CLOSED: Driver CDS modules closed + */ +enum driver_modules_status { + DRIVER_MODULES_UNINITIALIZED, + DRIVER_MODULES_OPENED, + DRIVER_MODULES_ENABLED, + DRIVER_MODULES_CLOSED +}; + /** Adapter structure definition */ struct hdd_context_s { @@ -1435,6 +1449,12 @@ struct hdd_context_s { #ifdef WLAN_FEATURE_NAN_DATAPATH bool nan_datapath_enabled; #endif + /* Present state of driver cds modules */ + enum driver_modules_status driver_status; + /* MC timer interface change */ + qdf_mc_timer_t iface_change_timer; + /* Interface change lock */ + struct mutex iface_change_lock; }; /*--------------------------------------------------------------------------- @@ -1539,7 +1559,7 @@ static inline void hdd_stop_bus_bw_computer_timer(hdd_adapter_t *pAdapter) int hdd_init(void); void hdd_deinit(void); -int hdd_wlan_startup(struct device *dev, void *hif_sc); +int hdd_wlan_startup(struct device *dev); void __hdd_wlan_exit(void); int hdd_wlan_notify_modem_power_state(int state); #ifdef QCA_HT_2040_COEX @@ -1746,6 +1766,21 @@ int hdd_register_cb(hdd_context_t *hdd_ctx); void hdd_deregister_cb(hdd_context_t *hdd_ctx); int hdd_start_station_adapter(hdd_adapter_t *adapter); int hdd_start_ap_adapter(hdd_adapter_t *adapter); +int hdd_configure_cds(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter); int hdd_start_ftm_adapter(hdd_adapter_t *adapter); int hdd_set_fw_params(hdd_adapter_t *adapter); +int hdd_wlan_start_modules(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter, + bool reinit); +int hdd_wlan_stop_modules(hdd_context_t *hdd_ctx, bool shutdown); +int hdd_start_adapter(hdd_adapter_t *adapter); +#ifdef WLAN_FEATURE_FASTPATH +void hdd_enable_fastpath(struct hdd_config *hdd_cfg, + void *context); +#else +static inline void hdd_enable_fastpath(struct hdd_config *hdd_cfg, + void *context) +{ +} +#endif +void hdd_wlan_update_target_info(hdd_context_t *hdd_ctx, void *context); #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 2100768ef69b..48a609396bce 100644 --- a/core/hdd/inc/wlan_hdd_memdump.h +++ b/core/hdd/inc/wlan_hdd_memdump.h @@ -88,8 +88,11 @@ 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) + struct fw_dump_rsp + *dump_rsp) { } #endif diff --git a/core/hdd/inc/wlan_hdd_oemdata.h b/core/hdd/inc/wlan_hdd_oemdata.h index fcfc4f148a2b..ed1ab4d9ca9d 100644 --- a/core/hdd/inc/wlan_hdd_oemdata.h +++ b/core/hdd/inc/wlan_hdd_oemdata.h @@ -186,7 +186,7 @@ int iw_get_oem_data_cap(struct net_device *dev, struct iw_request_info *info, int oem_activate_service(struct hdd_context_s *hdd_ctx); -void hdd_send_oem_data_rsp_msg(int length, uint8_t *oemDataRsp); +void hdd_send_oem_data_rsp_msg(struct oem_data_rsp *oem_rsp); #else static inline int oem_activate_service(struct hdd_context_s *hdd_ctx) { diff --git a/core/hdd/inc/wlan_hdd_power.h b/core/hdd/inc/wlan_hdd_power.h index d872fae107ac..a57e9b6eec7f 100644 --- a/core/hdd/inc/wlan_hdd_power.h +++ b/core/hdd/inc/wlan_hdd_power.h @@ -145,7 +145,7 @@ enum suspend_resume_state { /* SSR shutdown & re-init functions */ QDF_STATUS hdd_wlan_shutdown(void); -QDF_STATUS hdd_wlan_re_init(void *hif_sc); +QDF_STATUS hdd_wlan_re_init(void); void hdd_conf_mcastbcast_filter(hdd_context_t *pHddCtx, bool setfilter); QDF_STATUS hdd_conf_arp_offload(hdd_adapter_t *pAdapter, bool fenable); diff --git a/core/hdd/src/wlan_hdd_cfg.c b/core/hdd/src/wlan_hdd_cfg.c index 0df166a95454..d214ef603e84 100644 --- a/core/hdd/src/wlan_hdd_cfg.c +++ b/core/hdd/src/wlan_hdd_cfg.c @@ -3981,8 +3981,14 @@ REG_TABLE_ENTRY g_registry_table[] = { CFG_ADAPT_DWELL_WIFI_THRESH_DEFAULT, CFG_ADAPT_DWELL_WIFI_THRESH_MIN, CFG_ADAPT_DWELL_WIFI_THRESH_MAX), -}; + REG_VARIABLE(CFG_INTERFACE_CHANGE_WAIT_NAME, WLAN_PARAM_Integer, + struct hdd_config, iface_change_wait_time, + VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK, + CFG_INTERFACE_CHANGE_WAIT_DEFAULT, + CFG_INTERFACE_CHANGE_WAIT_MIN, + CFG_INTERFACE_CHANGE_WAIT_MAX), +}; /** * get_next_line() - find and locate the new line pointer @@ -5583,6 +5589,9 @@ void hdd_cfg_print(hdd_context_t *pHddCtx) hdd_info("Name = [%s] Value = [%u]", CFG_IDLE_TIME_NAME, pHddCtx->config->idle_time_conc); + hdd_info("Name = [%s] Value = [%u]", + CFG_INTERFACE_CHANGE_WAIT_NAME, + pHddCtx->config->iface_change_wait_time); hdd_info("Name = [%s] Value = [%u]", CFG_ENABLE_EDCA_INI_NAME, @@ -5654,6 +5663,9 @@ void hdd_cfg_print(hdd_context_t *pHddCtx) CFG_ADAPT_DWELL_WIFI_THRESH_NAME, pHddCtx->config->adapt_dwell_wifi_act_threshold); hdd_ndp_print_ini_config(pHddCtx); + hdd_info("Name = [%s] Value = [%s]", + CFG_RM_CAPABILITY_NAME, + pHddCtx->config->rm_capability); } diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 400fbe4320e4..0c6807b0ddee 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -481,16 +481,6 @@ static const struct ieee80211_iface_limit }; static struct ieee80211_iface_combination - wlan_hdd_mon_iface[] = { - { - .limits = wlan_hdd_mon_iface_limit, - .max_interfaces = 3, - .num_different_channels = 2, - .n_limits = ARRAY_SIZE(wlan_hdd_mon_iface_limit), - }, -}; - -static struct ieee80211_iface_combination wlan_hdd_iface_combination[] = { /* STA */ { @@ -567,6 +557,13 @@ static struct ieee80211_iface_combination .n_limits = ARRAY_SIZE(wlan_hdd_p2p_p2p_iface_limit), .beacon_int_infra_match = true, }, + /* Monitor */ + { + .limits = wlan_hdd_mon_iface_limit, + .max_interfaces = 3, + .num_different_channels = 2, + .n_limits = ARRAY_SIZE(wlan_hdd_mon_iface_limit), + }, }; static struct cfg80211_ops wlan_hdd_cfg80211_ops; @@ -6965,35 +6962,28 @@ int wlan_hdd_cfg80211_init(struct device *dev, wiphy->max_acl_mac_addrs = MAX_ACL_MAC_ADDRESS; - if (cds_get_conparam() != QDF_GLOBAL_MONITOR_MODE) { - /* Supports STATION & AD-HOC modes right now */ - wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) - | BIT(NL80211_IFTYPE_ADHOC) - | BIT(NL80211_IFTYPE_P2P_CLIENT) - | BIT(NL80211_IFTYPE_P2P_GO) - | BIT(NL80211_IFTYPE_AP); - - if (pCfg->advertiseConcurrentOperation) { - if (pCfg->enableMCC) { - int i; - - for (i = 0; - i < ARRAY_SIZE(wlan_hdd_iface_combination); - i++) { - if (!pCfg->allowMCCGODiffBI) - wlan_hdd_iface_combination[i]. - beacon_int_infra_match = true; - } + wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) + | BIT(NL80211_IFTYPE_ADHOC) + | BIT(NL80211_IFTYPE_P2P_CLIENT) + | BIT(NL80211_IFTYPE_P2P_GO) + | BIT(NL80211_IFTYPE_AP) + | BIT(NL80211_IFTYPE_MONITOR); + + if (pCfg->advertiseConcurrentOperation) { + if (pCfg->enableMCC) { + int i; + + for (i = 0; + i < ARRAY_SIZE(wlan_hdd_iface_combination); + i++) { + if (!pCfg->allowMCCGODiffBI) + wlan_hdd_iface_combination[i]. + beacon_int_infra_match = true; } - wiphy->n_iface_combinations = - ARRAY_SIZE(wlan_hdd_iface_combination); - wiphy->iface_combinations = wlan_hdd_iface_combination; } - } else { - wiphy->interface_modes = BIT(NL80211_IFTYPE_MONITOR); wiphy->n_iface_combinations = - ARRAY_SIZE(wlan_hdd_mon_iface); - wiphy->iface_combinations = wlan_hdd_mon_iface; + ARRAY_SIZE(wlan_hdd_iface_combination); + wiphy->iface_combinations = wlan_hdd_iface_combination; } /* Before registering we need to update the ht capabilitied based @@ -7648,6 +7638,12 @@ static int __wlan_hdd_cfg80211_change_iface(struct wiphy *wiphy, hdd_notice("Device_mode = %d, IFTYPE = 0x%x", pAdapter->device_mode, type); + status = hdd_wlan_start_modules(pHddCtx, pAdapter, false); + if (status) { + hdd_err("Failed to start modules"); + return -EINVAL; + } + if (!cds_allow_concurrency( wlan_hdd_convert_nl_iftype_to_hdd_type(type), 0, HW_MODE_20_MHZ)) { @@ -7687,15 +7683,6 @@ static int __wlan_hdd_cfg80211_change_iface(struct wiphy *wiphy, if (vstatus != QDF_STATUS_SUCCESS) return -EINVAL; - /* - * for ibss interface type flow control is not required - * so don't register tx flow control - */ - if (type != NL80211_IFTYPE_ADHOC) - hdd_register_tx_flow_control(pAdapter, - hdd_tx_resume_timer_expired_handler, - hdd_tx_resume_cb); - goto done; case NL80211_IFTYPE_AP: case NL80211_IFTYPE_P2P_GO: @@ -7710,8 +7697,8 @@ static int __wlan_hdd_cfg80211_change_iface(struct wiphy *wiphy, wlan_hdd_cancel_existing_remain_on_channel (pAdapter); } - hdd_stop_adapter(pHddCtx, pAdapter, true); + hdd_stop_adapter(pHddCtx, pAdapter, true); /* De-init the adapter */ hdd_deinit_adapter(pHddCtx, pAdapter, true); memset(&pAdapter->sessionCtx, 0, @@ -7744,16 +7731,10 @@ static int __wlan_hdd_cfg80211_change_iface(struct wiphy *wiphy, hdd_set_ap_ops(pAdapter->dev); - vstatus = hdd_init_ap_mode(pAdapter); - if (vstatus != QDF_STATUS_SUCCESS) { - hdd_alert("Error initializing the ap mode"); + if (hdd_start_adapter(pAdapter)) { + hdd_err("Error initializing the ap mode"); return -EINVAL; } - - hdd_register_tx_flow_control(pAdapter, - hdd_softap_tx_resume_timer_expired_handler, - hdd_softap_tx_resume_cb); - /* Interface type changed update in wiphy structure */ if (wdev) { wdev->iftype = type; @@ -7780,13 +7761,6 @@ static int __wlan_hdd_cfg80211_change_iface(struct wiphy *wiphy, if (status != QDF_STATUS_SUCCESS) return status; - if ((NL80211_IFTYPE_P2P_CLIENT == type) || - (NL80211_IFTYPE_STATION == type)) { - - hdd_register_tx_flow_control(pAdapter, - hdd_tx_resume_timer_expired_handler, - hdd_tx_resume_cb); - } goto done; case NL80211_IFTYPE_AP: @@ -7794,10 +7768,6 @@ static int __wlan_hdd_cfg80211_change_iface(struct wiphy *wiphy, wdev->iftype = type; pAdapter->device_mode = (type == NL80211_IFTYPE_AP) ? QDF_SAP_MODE : QDF_P2P_GO_MODE; - - hdd_register_tx_flow_control(pAdapter, - hdd_softap_tx_resume_timer_expired_handler, - hdd_softap_tx_resume_cb); goto done; default: diff --git a/core/hdd/src/wlan_hdd_driver_ops.c b/core/hdd/src/wlan_hdd_driver_ops.c index cab8f0c74472..2f9ef28f03fb 100644 --- a/core/hdd/src/wlan_hdd_driver_ops.c +++ b/core/hdd/src/wlan_hdd_driver_ops.c @@ -210,7 +210,7 @@ static enum qdf_bus_type to_bus_type(enum pld_bus_type bus_type) * * Return: 0 on success and errno on failure. */ -static int hdd_hif_open(struct device *dev, void *bdev, const hif_bus_id *bid, +int hdd_hif_open(struct device *dev, void *bdev, const hif_bus_id *bid, enum qdf_bus_type bus_type, bool reinit) { QDF_STATUS status; @@ -255,6 +255,8 @@ static int hdd_hif_open(struct device *dev, void *bdev, const hif_bus_id *bid, } } + hif_enable_power_management(hif_ctx, cds_is_packet_log_enabled()); + return 0; err_hif_close: @@ -269,11 +271,13 @@ err_hif_close: * * Helper function to close HIF */ -static void hdd_hif_close(void *hif_ctx) +void hdd_hif_close(void *hif_ctx) { if (hif_ctx == NULL) return; + hif_disable_power_management(hif_ctx); + hif_disable(hif_ctx, HIF_DISABLE_TYPE_REMOVE); hdd_napi_destroy(true); @@ -286,11 +290,13 @@ static void hdd_hif_close(void *hif_ctx) * hdd_init_qdf_ctx() - API to initialize global QDF Device structure * @dev: Device Pointer * @bdev: Bus Device pointer + * @bus_type: Underlying bus type + * @bid: Bus id passed by platform driver * * Return: void */ void hdd_init_qdf_ctx(struct device *dev, void *bdev, - enum qdf_bus_type bus_type) + enum qdf_bus_type bus_type, const struct hif_bus_id *bid) { qdf_device_t qdf_dev = cds_get_context(QDF_MODULE_ID_QDF_DEVICE); @@ -302,6 +308,7 @@ void hdd_init_qdf_ctx(struct device *dev, void *bdev, qdf_dev->dev = dev; qdf_dev->drv_hdl = bdev; qdf_dev->bus_type = bus_type; + qdf_dev->bid = bid; } /** @@ -320,11 +327,7 @@ void hdd_init_qdf_ctx(struct device *dev, void *bdev, static int wlan_hdd_probe(struct device *dev, void *bdev, const hif_bus_id *bid, enum qdf_bus_type bus_type, bool reinit) { - void *hif_ctx; - QDF_STATUS status; int ret = 0; - qdf_device_t qdf_dev; - uint32_t mode = cds_get_conparam(); pr_info("%s: %sprobing driver v%s\n", WLAN_MODULE_NAME, reinit ? "re-" : "", QWLAN_VERSIONSTR); @@ -349,42 +352,16 @@ static int wlan_hdd_probe(struct device *dev, void *bdev, const hif_bus_id *bid, cds_set_load_in_progress(true); } - if (QDF_IS_EPPING_ENABLED(mode)) { - status = epping_open(); - if (status != QDF_STATUS_SUCCESS) - goto err_hdd_deinit; - } - - hdd_init_qdf_ctx(dev, bdev, bus_type); - - ret = hdd_hif_open(dev, bdev, bid, bus_type, reinit); - - if (ret) - goto err_epping_close; - - hif_ctx = cds_get_context(QDF_MODULE_ID_HIF); - - if (NULL == hif_ctx) - goto err_epping_close; - - qdf_dev = cds_get_context(QDF_MODULE_ID_QDF_DEVICE); - - status = ol_cds_init(qdf_dev, hif_ctx); - - if (status != QDF_STATUS_SUCCESS) { - pr_err("%s No Memory to Create BMI Context\n", __func__); - goto err_hif_close; - } + hdd_init_qdf_ctx(dev, bdev, bus_type, (const struct hif_bus_id *)bid); if (reinit) - ret = hdd_wlan_re_init(hif_ctx); + ret = hdd_wlan_re_init(); else - ret = hdd_wlan_startup(dev, hif_ctx); + ret = hdd_wlan_startup(dev); if (ret) - goto err_bmi_close; + goto err_hdd_deinit; - hif_enable_power_management(hif_ctx, cds_is_packet_log_enabled()); if (reinit) { cds_set_recovery_in_progress(false); @@ -398,15 +375,12 @@ static int wlan_hdd_probe(struct device *dev, void *bdev, const hif_bus_id *bid, return 0; -err_bmi_close: - ol_cds_free(); -err_hif_close: - hdd_hif_close(hif_ctx); -err_epping_close: - if (QDF_IS_EPPING_ENABLED(mode)) - epping_close(); + err_hdd_deinit: - cds_set_load_in_progress(false); + if (reinit) + cds_set_recovery_in_progress(false); + else + cds_set_load_in_progress(false); hdd_deinit(); out: hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_DRIVER_INIT); @@ -431,6 +405,7 @@ static void wlan_hdd_remove(struct device *dev) { void *hif_ctx; + pr_info("%s: Removing driver v%s\n", WLAN_MODULE_NAME, QWLAN_VERSIONSTR); @@ -453,8 +428,6 @@ static void wlan_hdd_remove(struct device *dev) if (NULL == hif_ctx) return; - hif_disable_power_management(hif_ctx); - if (QDF_IS_EPPING_ENABLED(cds_get_conparam())) { epping_disable(); epping_close(); @@ -462,8 +435,6 @@ static void wlan_hdd_remove(struct device *dev) __hdd_wlan_exit(); } - ol_cds_free(); - hdd_hif_close(hif_ctx); hdd_deinit(); pr_info("%s: Driver Removed\n", WLAN_MODULE_NAME); @@ -495,9 +466,6 @@ static void wlan_hdd_shutdown(void) hif_disable_isr(hif_ctx); hdd_wlan_shutdown(); } - - ol_cds_free(); - hdd_hif_close(hif_ctx); } /** @@ -549,7 +517,7 @@ void wlan_hdd_notify_handler(int state) */ static int __wlan_hdd_bus_suspend(pm_message_t state) { - void *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); + hdd_context_t *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); void *hif_ctx; int err = wlan_hdd_validate_context(hdd_ctx); int status; @@ -564,6 +532,12 @@ static int __wlan_hdd_bus_suspend(pm_message_t state) err = -EINVAL; goto done; } + + if (hdd_ctx->driver_status != DRIVER_MODULES_ENABLED) { + hdd_info("Driver Module closed return success"); + return 0; + } + err = qdf_status_to_os_return( ol_txrx_bus_suspend()); if (err) @@ -627,13 +601,18 @@ int wlan_hdd_bus_suspend(pm_message_t state) */ static int __wlan_hdd_bus_resume(void) { - void *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); + hdd_context_t *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); void *hif_ctx; int status = wlan_hdd_validate_context(hdd_ctx); if (status) return status; + if (hdd_ctx->driver_status != DRIVER_MODULES_ENABLED) { + hdd_info("Driver Module closed return success"); + return 0; + } + hif_ctx = cds_get_context(QDF_MODULE_ID_HIF); if (NULL == hif_ctx) return -EINVAL; @@ -659,7 +638,7 @@ static int __wlan_hdd_bus_resume(void) * * Return: void */ -static int wlan_hdd_bus_resume(void) +int wlan_hdd_bus_resume(void) { int ret; @@ -682,7 +661,7 @@ static int wlan_hdd_bus_resume(void) */ static int __wlan_hdd_runtime_suspend(struct device *dev) { - void *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); + hdd_context_t *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); void *hif_ctx = cds_get_context(QDF_MODULE_ID_HIF); void *txrx_pdev = cds_get_context(QDF_MODULE_ID_TXRX); void *htc_ctx = cds_get_context(QDF_MODULE_ID_HTC); diff --git a/core/hdd/src/wlan_hdd_ftm.c b/core/hdd/src/wlan_hdd_ftm.c index 97a0cd2754d6..a96090e35033 100644 --- a/core/hdd/src/wlan_hdd_ftm.c +++ b/core/hdd/src/wlan_hdd_ftm.c @@ -111,32 +111,6 @@ static uint32_t wlan_ftm_postmsg(uint8_t *cmd_ptr, uint16_t cmd_len) return QDF_STATUS_SUCCESS; } -/** - * wlan_hdd_ftm_update_tgt_cfg() - Update target configuration - * @context: context registered with WMA - * @param: target configuration - * - * This function is registered with WMA via wma_open(), and is - * invoked via callback when target parameters are received - * from firmware. - * - * Return: None - */ -static void wlan_hdd_ftm_update_tgt_cfg(void *context, void *param) -{ - hdd_context_t *hdd_ctx = (hdd_context_t *) context; - struct wma_tgt_cfg *cfg = (struct wma_tgt_cfg *)param; - - if (!qdf_is_macaddr_zero(&cfg->hw_macaddr)) { - hdd_update_macaddr(hdd_ctx->config, cfg->hw_macaddr); - } else { - hddLog(QDF_TRACE_LEVEL_ERROR, - "%s: Invalid MAC passed from target, using MAC from ini file" - MAC_ADDRESS_STR, __func__, - MAC_ADDR_ARRAY(hdd_ctx->config->intfMacAddr[0].bytes)); - } -} - #ifdef WLAN_FEATURE_LPSS static inline void hdd_is_lpass_supported(struct cds_config_info *cds_cfg, hdd_context_t *hdd_ctx) @@ -180,544 +154,6 @@ int hdd_update_cds_config_ftm(hdd_context_t *hdd_ctx) return 0; } -/** - * wlan_ftm_cds_open() - Open the CDS Module in FTM mode - * @p_cds_context: pointer to the global CDS context - * @hddContextSize: Size of the HDD context to allocate. - * - * The wlan_ftm_cds_open() function opens the QDF Scheduler - * Upon successful initialization: - * - All CDS submodules should have been initialized - * - The CDS scheduler should have opened - * - All the WLAN SW components should have been opened. This includes MAC. - * - * Returns: - * QDF_STATUS_SUCCESS - Scheduler was successfully initialized and - * is ready to be used. - * QDF_STATUS_E_RESOURCES - System resources (other than memory) - * are unavailable to initialize the scheduler - * QDF_STATUS_E_FAILURE - Failure to initialize the scheduler - */ -static QDF_STATUS wlan_ftm_cds_open(v_CONTEXT_t p_cds_context, - uint32_t hddContextSize) -{ - QDF_STATUS vStatus = QDF_STATUS_SUCCESS; - int iter = 0; - tSirRetStatus sirStatus = eSIR_SUCCESS; - p_cds_contextType gp_cds_context = (p_cds_contextType) p_cds_context; - struct cds_config_info *cds_cfg; -#if defined(QCA_WIFI_FTM) - qdf_device_t qdf_ctx; - HTC_INIT_INFO htcInfo; - void *pHifContext = NULL; - void *pHtcContext = NULL; - struct ol_context *ol_ctx; -#endif - cds_context_type *cds_ctx; - hdd_context_t *hdd_ctx; - - QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_INFO_HIGH, - "%s: Opening CDS", __func__); - - cds_ctx = cds_get_context(QDF_MODULE_ID_QDF); - if (!cds_ctx) { - QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR, - "%s: Trying to open CDS without a PreOpen", __func__); - QDF_ASSERT(0); - return QDF_STATUS_E_FAILURE; - } - - cds_cfg = cds_ctx->cds_cfg; - - /* Initialize the probe event */ - if (qdf_event_create(&gp_cds_context->ProbeEvent) != QDF_STATUS_SUCCESS) { - QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR, - "%s: Unable to init probeEvent", __func__); - QDF_ASSERT(0); - return QDF_STATUS_E_FAILURE; - } - - if (qdf_event_create(&(gp_cds_context->wmaCompleteEvent)) != - QDF_STATUS_SUCCESS) { - QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR, - "%s: Unable to init wmaCompleteEvent", __func__); - QDF_ASSERT(0); - - goto err_probe_event; - } - - /* Initialize the free message queue */ - vStatus = cds_mq_init(&gp_cds_context->freeVosMq); - if (!QDF_IS_STATUS_SUCCESS(vStatus)) { - - /* Critical Error ... Cannot proceed further */ - QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR, - "%s: Failed to initialize CDS free message queue %d", - __func__, vStatus); - QDF_ASSERT(0); - goto err_wma_complete_event; - } - - for (iter = 0; iter < CDS_CORE_MAX_MESSAGES; iter++) { - (gp_cds_context->aMsgWrappers[iter]).pVosMsg = - &(gp_cds_context->aMsgBuffers[iter]); - INIT_LIST_HEAD(&gp_cds_context->aMsgWrappers[iter].msgNode); - cds_mq_put(&gp_cds_context->freeVosMq, - &(gp_cds_context->aMsgWrappers[iter])); - } - - /* Now Open the CDS Scheduler */ - vStatus = cds_sched_open(gp_cds_context, &gp_cds_context->qdf_sched, - sizeof(cds_sched_context)); - - if (!QDF_IS_STATUS_SUCCESS(vStatus)) { - /* Critical Error ... Cannot proceed further */ - QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR, - "%s: Failed to open CDS Scheduler %d", __func__, - vStatus); - QDF_ASSERT(0); - goto err_msg_queue; - } -#if defined(QCA_WIFI_FTM) - /* Initialize BMI and Download firmware */ - pHifContext = cds_get_context(QDF_MODULE_ID_HIF); - if (!pHifContext) { - QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_FATAL, - "%s: failed to get HIF context", __func__); - goto err_sched_close; - } - - ol_ctx = cds_get_context(QDF_MODULE_ID_BMI); - if (bmi_download_firmware(ol_ctx)) { - QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_FATAL, - "%s: BMI failed to download target", __func__); - goto err_bmi_close; - } - - htcInfo.pContext = ol_ctx; - htcInfo.TargetFailure = ol_target_failure; - htcInfo.TargetSendSuspendComplete = wma_target_suspend_acknowledge; - qdf_ctx = cds_get_context(QDF_MODULE_ID_QDF_DEVICE); - - /* Create HTC */ - gp_cds_context->htc_ctx = - htc_create(pHifContext, &htcInfo, qdf_ctx, hdd_get_conparam()); - if (!gp_cds_context->htc_ctx) { - QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_FATAL, - "%s: Failed to Create HTC", __func__); - goto err_bmi_close; - } - - if (bmi_done(ol_ctx)) { - QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_FATAL, - "%s: Failed to complete BMI phase", __func__); - goto err_htc_close; - } -#endif /* QCA_WIFI_FTM */ - - hdd_ctx = (hdd_context_t *) (gp_cds_context->pHDDContext); - if ((NULL == hdd_ctx) || (NULL == hdd_ctx->config)) { - /* Critical Error ... Cannot proceed further */ - QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR, - "%s: Hdd Context is Null", __func__); - QDF_ASSERT(0); - goto err_htc_close; - } - vStatus = wma_open(gp_cds_context, - wlan_hdd_ftm_update_tgt_cfg, NULL, cds_cfg); - if (!QDF_IS_STATUS_SUCCESS(vStatus)) { - /* Critical Error ... Cannot proceed further */ - QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR, - "%s: Failed to open WMA module %d", __func__, - vStatus); - QDF_ASSERT(0); - goto err_htc_close; - } -#if defined(QCA_WIFI_FTM) - hdd_update_config(hdd_ctx); - pHtcContext = cds_get_context(QDF_MODULE_ID_HTC); - if (!pHtcContext) { - QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_FATAL, - "%s: failed to get HTC context", __func__); - goto err_wma_close; - } - if (htc_wait_target(pHtcContext)) { - QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_FATAL, - "%s: Failed to complete BMI phase", __func__); - goto err_wma_close; - } -#endif - - /* Now proceed to open the MAC */ - sirStatus = - mac_open(&(gp_cds_context->pMACContext), - gp_cds_context->pHDDContext, cds_cfg); - - if (eSIR_SUCCESS != sirStatus) { - /* Critical Error ... Cannot proceed further */ - QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR, - "%s: Failed to open MAC %d", __func__, sirStatus); - QDF_ASSERT(0); - goto err_wma_close; - } -#ifndef QCA_WIFI_FTM - /* Now proceed to open the SME */ - vStatus = sme_open(gp_cds_context->pMACContext); - if (!QDF_IS_STATUS_SUCCESS(vStatus)) { - /* Critical Error ... Cannot proceed further */ - QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR, - "%s: Failed to open SME %d", __func__, vStatus); - goto err_mac_close; - } - - vStatus = sme_init_chan_list(gp_cds_context->pMACContext, - hdd_ctx->reg.alpha2, hdd_ctx->reg.cc_src); - if (!QDF_IS_STATUS_SUCCESS(vStatus)) { - QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR, - "%s: Failed to init sme channel list", __func__); - } else { - QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_INFO_HIGH, - "%s: CDS successfully Opened", __func__); - return QDF_STATUS_SUCCESS; - } -#else - return QDF_STATUS_SUCCESS; -#endif - -#ifndef QCA_WIFI_FTM -err_mac_close: -#endif - mac_close(gp_cds_context->pMACContext); - -err_wma_close: - wma_close(gp_cds_context); - -err_htc_close: -#if defined(QCA_WIFI_FTM) - if (gp_cds_context->htc_ctx) { - htc_destroy(gp_cds_context->htc_ctx); - gp_cds_context->htc_ctx = NULL; - } - -err_bmi_close: - bmi_cleanup(ol_ctx); -#endif /* QCA_WIFI_FTM */ - -err_sched_close: - cds_sched_close(gp_cds_context); -err_msg_queue: - cds_mq_deinit(&gp_cds_context->freeVosMq); - -err_wma_complete_event: - qdf_event_destroy(&gp_cds_context->wmaCompleteEvent); - -err_probe_event: - qdf_event_destroy(&gp_cds_context->ProbeEvent); - - return QDF_STATUS_E_FAILURE; - -} /* wlan_ftm_cds_open() */ - -/** - * wlan_ftm_cds_close() - Close the QDF Module in FTM mode - * @cds_context: context of cds - * - * The wlan_ftm_cds_close() function closes the QDF Module - * - * Return: QDF_STATUS_SUCCESS - successfully closed - */ -static QDF_STATUS wlan_ftm_cds_close(v_CONTEXT_t cds_context) -{ - QDF_STATUS qdf_status; - p_cds_contextType gp_cds_context = (p_cds_contextType) cds_context; - -#ifndef QCA_WIFI_FTM - qdf_status = sme_close(((p_cds_contextType) cds_context)->pMACContext); - if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { - QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR, - "%s: Failed to close SME %d", __func__, qdf_status); - QDF_ASSERT(QDF_IS_STATUS_SUCCESS(qdf_status)); - } -#endif - - qdf_status = mac_close(((p_cds_contextType) cds_context)->pMACContext); - if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { - QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR, - "%s: Failed to close MAC %d", __func__, qdf_status); - QDF_ASSERT(QDF_IS_STATUS_SUCCESS(qdf_status)); - } - - ((p_cds_contextType) cds_context)->pMACContext = NULL; - - - qdf_status = wma_close(cds_context); - if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { - QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR, - "%s: Failed to close WMA %d", __func__, qdf_status); - QDF_ASSERT(QDF_IS_STATUS_SUCCESS(qdf_status)); - } -#if defined(QCA_WIFI_FTM) - if (gp_cds_context->htc_ctx) { - htc_stop(gp_cds_context->htc_ctx); - htc_destroy(gp_cds_context->htc_ctx); - gp_cds_context->htc_ctx = NULL; - } - qdf_status = wma_wmi_service_close(cds_context); - if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { - QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR, - "%s: Failed to close wma_wmi_service", __func__); - QDF_ASSERT(QDF_IS_STATUS_SUCCESS(qdf_status)); - } - - hif_disable_isr(gp_cds_context->pHIFContext); -#endif - - cds_mq_deinit(&((p_cds_contextType) cds_context)->freeVosMq); - - qdf_status = qdf_event_destroy(&gp_cds_context->ProbeEvent); - if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { - QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR, - "%s: Failed to destroy ProbeEvent %d", __func__, - qdf_status); - QDF_ASSERT(QDF_IS_STATUS_SUCCESS(qdf_status)); - } - - qdf_status = qdf_event_destroy(&gp_cds_context->wmaCompleteEvent); - if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { - QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR, - "%s: Failed to destroy wmaCompleteEvent %d", __func__, - qdf_status); - QDF_ASSERT(QDF_IS_STATUS_SUCCESS(qdf_status)); - } - - return QDF_STATUS_SUCCESS; -} - -/** - * cds_ftm_pre_start() - Pre-start CDS Module in FTM Mode - * @cds_context: The CDS context - * - * The cds_ftm_pre_start() function performs all pre-start activities - * in FTM mode. - * - * Return: QDF_STATUS_SUCCESS if pre-start was successful, an - * appropriate QDF_STATUS_E_** error code otherwise - */ -static QDF_STATUS cds_ftm_pre_start(v_CONTEXT_t cds_context) -{ - QDF_STATUS vStatus = QDF_STATUS_SUCCESS; - QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; - p_cds_contextType p_cds_context = (p_cds_contextType) cds_context; -#if defined(QCA_WIFI_FTM) - p_cds_contextType gp_cds_context = - cds_get_global_context(); -#endif - - QDF_TRACE(QDF_MODULE_ID_SYS, QDF_TRACE_LEVEL_INFO, "cds prestart"); - if (NULL == p_cds_context->pWMAContext) { - QDF_ASSERT(0); - QDF_TRACE(QDF_MODULE_ID_SYS, QDF_TRACE_LEVEL_ERROR, - "%s: WMA NULL context", __func__); - return QDF_STATUS_E_FAILURE; - } - - /* Reset WMA wait event */ - qdf_event_reset(&p_cds_context->wmaCompleteEvent); - - /*call WMA pre start */ - vStatus = wma_pre_start(p_cds_context); - if (!QDF_IS_STATUS_SUCCESS(vStatus)) { - QDF_TRACE(QDF_MODULE_ID_SYS, QDF_TRACE_LEVEL_ERROR, - "Failed to WMA prestart "); - QDF_ASSERT(0); - return QDF_STATUS_E_FAILURE; - } - - /* Need to update time out of complete */ - qdf_status = qdf_wait_single_event(&p_cds_context->wmaCompleteEvent, - HDD_FTM_WMA_PRE_START_TIMEOUT); - if (qdf_status != QDF_STATUS_SUCCESS) { - if (qdf_status == QDF_STATUS_E_TIMEOUT) { - QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR, - "%s: Timeout occurred before WMA complete", - __func__); - } else { - QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR, - "%s: wma_pre_start reporting other error", - __func__); - } - QDF_ASSERT(0); - return QDF_STATUS_E_FAILURE; - } -#if defined(QCA_WIFI_FTM) - vStatus = htc_start(gp_cds_context->htc_ctx); - if (!QDF_IS_STATUS_SUCCESS(vStatus)) { - QDF_TRACE(QDF_MODULE_ID_SYS, QDF_TRACE_LEVEL_FATAL, - "Failed to Start HTC"); - QDF_ASSERT(0); - return QDF_STATUS_E_FAILURE; - } - wma_wait_for_ready_event(gp_cds_context->pWMAContext); -#endif /* QCA_WIFI_FTM */ - - return QDF_STATUS_SUCCESS; -} - -/** - * wlan_hdd_ftm_open() - Open HDD in FTM Mode - * @hdd_ctx: global HDD context - * - * The function hdd_wlan_startup calls this function to initialize the - * FTM specific modules. - * - * Return: 0 on success, non-zero on error - */ -int wlan_hdd_ftm_open(hdd_context_t *hdd_ctx) -{ - QDF_STATUS vStatus = QDF_STATUS_SUCCESS; - p_cds_contextType p_cds_context = NULL; - - QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_INFO_HIGH, - "%s: Opening CDS", __func__); - - p_cds_context = cds_get_global_context(); - - if (NULL == p_cds_context) { - QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR, - "%s: Trying to open CDS without a PreOpen", __func__); - QDF_ASSERT(0); - goto err_qdf_status_failure; - } - - vStatus = wlan_ftm_cds_open(p_cds_context, 0); - - if (!QDF_IS_STATUS_SUCCESS(vStatus)) { - hddLog(QDF_TRACE_LEVEL_FATAL, "%s: cds_open failed", __func__); - goto err_qdf_status_failure; - } - - /* - * only needed to start WMA, which happens in wlan_hdd_ftm_start() - */ - - /* Save the hal context in Adapter */ - hdd_ctx->hHal = - (tHalHandle) cds_get_context(QDF_MODULE_ID_SME); - - if (NULL == hdd_ctx->hHal) { - hddLog(QDF_TRACE_LEVEL_ERROR, "%s: HAL context is null", - __func__); - goto err_ftm_close; - } - - return 0; - -err_ftm_close: - wlan_ftm_cds_close(p_cds_context); - -err_qdf_status_failure: - return -EPERM; -} - -/** - * hdd_ftm_service_registration() - Register FTM service - * @hdd_ctx: global HDD context - * - * Return: 0 on success, non-zero on failure - */ -static int hdd_ftm_service_registration(hdd_context_t *hdd_ctx) -{ - hdd_adapter_t *adapter; - adapter = hdd_open_adapter(hdd_ctx, QDF_FTM_MODE, "wlan%d", - wlan_hdd_get_intf_addr(hdd_ctx), - NET_NAME_UNKNOWN, false); - if (NULL == adapter) { - hddLog(QDF_TRACE_LEVEL_ERROR, "%s: hdd_open_adapter failed", - __func__); - goto err_adapter_open_failure; - } - - hdd_ctx->ftm.ftm_state = WLAN_FTM_INITIALIZED; - - return 0; - -err_adapter_open_failure: - - return -EPERM; -} - -/** - * wlan_ftm_stop() - Stop HDD in FTM mode - * @hdd_ctx: pointer to HDD context - * - * This function stops the following modules - * WMA - * - * Return: 0 on success, non-zero on failure - */ -static int wlan_ftm_stop(hdd_context_t *hdd_ctx) -{ - if (hdd_ctx->ftm.ftm_state != WLAN_FTM_STARTED) { - hddLog(LOGP, FL("FTM has not started. No need to stop")); - return -EPERM; - } - wma_stop(hdd_ctx->pcds_context, HAL_STOP_TYPE_RF_KILL); - return 0; -} - -/** - * wlan_hdd_ftm_close() - Close HDD in FTM mode - * @hdd_ctx: pointer to HDD context - * - * Return: 0 on success, non-zero on failure - */ -int wlan_hdd_ftm_close(hdd_context_t *hdd_ctx) -{ - QDF_STATUS qdf_status; - v_CONTEXT_t cds_context = hdd_ctx->pcds_context; - - hdd_adapter_t *adapter = hdd_get_adapter(hdd_ctx, QDF_FTM_MODE); - ENTER(); - if (adapter == NULL) { - QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_FATAL, - "%s:adapter is NULL", __func__); - return -ENXIO; - } - - if (WLAN_FTM_STARTED == hdd_ctx->ftm.ftm_state) { - QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_FATAL, - "%s: Ftm has been started. stopping ftm", __func__); - wlan_ftm_stop(hdd_ctx); - } - - hdd_close_all_adapters(hdd_ctx, false); - - qdf_status = cds_sched_close(cds_context); - if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { - QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR, - "%s: Failed to close CDS Scheduler", __func__); - QDF_ASSERT(QDF_IS_STATUS_SUCCESS(qdf_status)); - } - /* Close CDS */ - wlan_ftm_cds_close(cds_context); - -#if defined(QCA_WIFI_FTM) && defined(LINUX_QCMBR) - spin_lock_bh(&qcmbr_queue_lock); - if (!list_empty(&qcmbr_queue_head)) { - qcmbr_queue_t *msg_buf, *tmp_buf; - list_for_each_entry_safe(msg_buf, tmp_buf, &qcmbr_queue_head, - list) { - list_del(&msg_buf->list); - kfree(msg_buf); - } - } - spin_unlock_bh(&qcmbr_queue_lock); -#endif - - return 0; - -} - /** * hdd_ftm_mc_process_msg() - Process FTM mailbox message @@ -727,7 +163,7 @@ int wlan_hdd_ftm_close(hdd_context_t *hdd_ctx) * * Return: void */ -static void hdd_ftm_mc_process_msg(void *message) +void hdd_ftm_mc_process_msg(void *message) { void *data; uint32_t data_len; @@ -750,107 +186,6 @@ static void hdd_ftm_mc_process_msg(void *message) return; } -/** - * wlan_hdd_ftm_start() - Start HDD in FTM mode - * @hdd_ctx: Global HDD context - * - * This function starts the following modules. - * 1) WMA Start. - * 2) HTC Start. - * 3) MAC Start to download the firmware. - * - * Return: 0 for success, non zero for failure - */ -static int wlan_hdd_ftm_start(hdd_context_t *hdd_ctx) -{ - QDF_STATUS vStatus = QDF_STATUS_SUCCESS; - p_cds_contextType p_cds_context = - (p_cds_contextType) (hdd_ctx->pcds_context); - - if (WLAN_FTM_STARTED == hdd_ctx->ftm.ftm_state) { - return 0; - } - - QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_INFO, - "%s: Starting CLD SW", __func__); - - /* We support only one instance for now ... */ - if (p_cds_context == NULL) { - QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR, - "%s: mismatch in context", __func__); - goto err_status_failure; - } - - if (p_cds_context->pMACContext == NULL) { - QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR, - "%s: MAC NULL context", __func__); - goto err_status_failure; - } - - /* Vos preStart is calling */ - if (!QDF_IS_STATUS_SUCCESS(cds_ftm_pre_start(hdd_ctx->pcds_context))) { - hddLog(QDF_TRACE_LEVEL_FATAL, "%s: cds_pre_enable failed", - __func__); - goto err_status_failure; - } - - sme_register_ftm_msg_processor(hdd_ctx->hHal, hdd_ftm_mc_process_msg); - - vStatus = wma_start(p_cds_context); - if (vStatus != QDF_STATUS_SUCCESS) { - QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR, - "%s: Failed to start WMA", __func__); - goto err_status_failure; - } - - QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_INFO, - "%s: MAC correctly started", __func__); - - if (hdd_ftm_service_registration(hdd_ctx)) { - QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR, - "%s: failed", __func__); - goto err_ftm_service_reg; - } - - hdd_ctx->ftm.ftm_state = WLAN_FTM_STARTED; - - return 0; - -err_ftm_service_reg: - wlan_hdd_ftm_close(hdd_ctx); - -err_status_failure: - - return -EPERM; - -} - -#if defined(QCA_WIFI_FTM) -/** - * hdd_ftm_start() - Start HDD in FTM mode - * @hdd_ctx: Global HDD context - * - * Return: 0 for success, non zero for failure - */ -int hdd_ftm_start(hdd_context_t *hdd_ctx) -{ - return wlan_hdd_ftm_start(hdd_ctx); -} -#endif - -#if defined(QCA_WIFI_FTM) -/** - * hdd_ftm_stop() - Stop HDD in FTM mode - * @hdd_ctx: Global HDD context - * - * Return: 0 for success, non zero for failure - */ -int hdd_ftm_stop(hdd_context_t *hdd_ctx) -{ - return wlan_ftm_stop(hdd_ctx); -} -#endif - #if defined(QCA_WIFI_FTM) #if defined(LINUX_QCMBR) /** diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index 999144621acb..ebd134d09a64 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -1325,17 +1325,22 @@ QDF_STATUS hdd_hostapd_sap_event_cb(tpSap_Event pSapEvent, HDD_SAP_WAKE_LOCK_DURATION, WIFI_POWER_EVENT_WAKELOCK_SAP); { - struct station_info staInfo; + struct station_info *sta_info; uint16_t iesLen = pSapEvent->sapevt. sapStationAssocReassocCompleteEvent.iesLen; - memset(&staInfo, 0, sizeof(staInfo)); + sta_info = qdf_mem_malloc(sizeof(*sta_info)); + if (!sta_info) { + hdd_err("Failed to allocate station info"); + return QDF_STATUS_E_FAILURE; + } + memset(sta_info, 0, sizeof(*sta_info)); if (iesLen <= MAX_ASSOC_IND_IE_LEN) { - staInfo.assoc_req_ies = + sta_info->assoc_req_ies = (const u8 *)&pSapEvent->sapevt. sapStationAssocReassocCompleteEvent.ies[0]; - staInfo.assoc_req_ies_len = iesLen; + sta_info->assoc_req_ies_len = iesLen; #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0)) && !defined(WITH_BACKPORTS) /* * After Kernel 4.0, it's no longer need to set @@ -1343,18 +1348,18 @@ QDF_STATUS hdd_hostapd_sap_event_cb(tpSap_Event pSapEvent, * changed to use assoc_req_ies_len length to * check the existance of request IE. */ - staInfo.filled |= STATION_INFO_ASSOC_REQ_IES; + sta_info->filled |= STATION_INFO_ASSOC_REQ_IES; #endif cfg80211_new_sta(dev, (const u8 *)&pSapEvent->sapevt. sapStationAssocReassocCompleteEvent. - staMac.bytes[0], &staInfo, + staMac.bytes[0], sta_info, GFP_KERNEL); } else { hdd_err("Assoc Ie length is too long"); } + qdf_mem_free(sta_info); } - pScanInfo = &pHostapdAdapter->scan_info; /* Lets do abort scan to ensure smooth authentication for client */ if ((pScanInfo != NULL) && pScanInfo->mScanPending) { @@ -1746,6 +1751,7 @@ QDF_STATUS hdd_hostapd_sap_event_cb(tpSap_Event pSapEvent, } wireless_send_event(dev, we_event, &wrqu, (char *)we_custom_event_generic); + return QDF_STATUS_SUCCESS; stopbss: diff --git a/core/hdd/src/wlan_hdd_ioctl.c b/core/hdd/src/wlan_hdd_ioctl.c index 78318563f79f..5ca71152c474 100644 --- a/core/hdd/src/wlan_hdd_ioctl.c +++ b/core/hdd/src/wlan_hdd_ioctl.c @@ -4428,6 +4428,13 @@ static int drv_cmd_fast_reassoc(hdd_adapter_t *adapter, goto exit; } + /* Check channel number is a valid channel number */ + if (QDF_STATUS_SUCCESS != + wlan_hdd_validate_operation_channel(adapter, channel)) { + hdd_err("Invalid Channel [%d]", channel); + return -EINVAL; + } + /* * if the target bssid is same as currently associated AP, * issue reassoc to same AP @@ -4435,26 +4442,20 @@ static int drv_cmd_fast_reassoc(hdd_adapter_t *adapter, if (true != qdf_mem_cmp(targetApBssid, pHddStaCtx->conn_info.bssId.bytes, QDF_MAC_ADDR_SIZE)) { - /* Reassoc to same AP, only supported for Open Security*/ - if ((pHddStaCtx->conn_info.ucEncryptionType || - pHddStaCtx->conn_info.mcEncryptionType)) { - hdd_err("Reassoc to same AP, only supported for Open Security"); - return -ENOTSUPP; - } hdd_info("Reassoc BSSID is same as currently associated AP bssid"); - sme_get_modify_profile_fields(hdd_ctx->hHal, adapter->sessionId, + if (roaming_offload_enabled(hdd_ctx)) { + hdd_wma_send_fastreassoc_cmd((int)adapter->sessionId, + targetApBssid, (int)channel); + } else { + sme_get_modify_profile_fields(hdd_ctx->hHal, + adapter->sessionId, &modProfileFields); - sme_roam_reassoc(hdd_ctx->hHal, adapter->sessionId, - NULL, modProfileFields, &roamId, 1); + sme_roam_reassoc(hdd_ctx->hHal, adapter->sessionId, + NULL, modProfileFields, &roamId, 1); + } return 0; } - /* Check channel number is a valid channel number */ - if (QDF_STATUS_SUCCESS != - wlan_hdd_validate_operation_channel(adapter, channel)) { - hdd_err("Invalid Channel [%d]", channel); - return -EINVAL; - } if (roaming_offload_enabled(hdd_ctx)) { hdd_wma_send_fastreassoc_cmd((int)adapter->sessionId, targetApBssid, (int)channel); diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 967d84747e8f..73fc47efc146 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -36,6 +36,7 @@ #include <wlan_hdd_includes.h> #include <cds_api.h> #include <cds_sched.h> +#include <linux/cpu.h> #ifdef WLAN_FEATURE_LPSS #include <cds_utils.h> #endif @@ -124,6 +125,28 @@ #define MEMORY_DEBUG_STR "" #endif +#ifndef MODULE +static struct gwlan_loader *wlan_loader; +static ssize_t wlan_boot_cb(struct kobject *kobj, + struct kobj_attribute *attr, + const char *buf, size_t count); +struct gwlan_loader { + bool loaded_state; + struct kobject *boot_wlan_obj; + struct attribute_group *attr_group; +}; + +static struct kobj_attribute wlan_boot_attribute = + __ATTR(boot_wlan, 0220, NULL, wlan_boot_cb); + +static struct attribute *attrs[] = { + &wlan_boot_attribute.attr, + NULL, +}; + +#define MODULE_INITIALIZED 1 +#endif + /* the Android framework expects this param even though we don't use it */ #define BUF_LEN 20 static char fwpath_buffer[BUF_LEN]; @@ -136,10 +159,6 @@ static char *country_code; static int enable_11d = -1; static int enable_dfs_chan_scan = -1; -#ifndef MODULE -static int wlan_hdd_inited; -#endif - /* * spinlock for synchronizing asynchronous request/response * (full description of use in wlan_hdd_main.h) @@ -1526,6 +1545,208 @@ int hdd_mon_open(struct net_device *dev) } /** + * hdd_start_adapter() - Wrapper function for device specific adapter + * @adapter: pointer to HDD adapter + * + * This function is called to start the device specific adapter for + * the mode passed in the adapter's device_mode. + * + * Return: 0 for success; non-zero for failure + */ +int hdd_start_adapter(hdd_adapter_t *adapter) +{ + + int ret; + enum tQDF_ADAPTER_MODE device_mode = adapter->device_mode; + + ENTER_DEV(adapter->dev); + hdd_info("Start_adapter for mode : %d", adapter->device_mode); + + switch (device_mode) { + case QDF_P2P_CLIENT_MODE: + case QDF_P2P_DEVICE_MODE: + case QDF_OCB_MODE: + case QDF_STA_MODE: + case QDF_MONITOR_MODE: + ret = hdd_start_station_adapter(adapter); + if (ret) + goto err_start_adapter; + break; + case QDF_P2P_GO_MODE: + case QDF_SAP_MODE: + ret = hdd_start_ap_adapter(adapter); + if (ret) + goto err_start_adapter; + break; + case QDF_FTM_MODE: + ret = hdd_start_ftm_adapter(adapter); + if (ret) + goto err_start_adapter; + break; + default: + hdd_err("Invalid session type %d", device_mode); + QDF_ASSERT(0); + goto err_start_adapter; + } + if (hdd_set_fw_params(adapter)) + hdd_err("Failed to set the FW params for the adapter!"); + + /* + * Action frame registered in one adapter which will + * applicable to all interfaces + */ + wlan_hdd_cfg80211_register_frames(adapter); + EXIT(); + return 0; +err_start_adapter: + return -EINVAL; +} + +/** + * hdd_wlan_start_modules() - Single driver state machine for starting modules + * @hdd_ctx: HDD context + * @adapter: HDD adapter + * @reinit: flag to indicate from SSR or normal path + * + * This function maintains the driver state machine it will be invoked from + * startup, reinit and change interface. Depending on the driver state shall + * perform the opening of the modules. + * + * Return: 0 for success; non-zero for failure + */ +int hdd_wlan_start_modules(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter, + bool reinit) +{ + int ret; + qdf_device_t qdf_dev; + QDF_STATUS status; + p_cds_contextType p_cds_context; + bool unint = false; + void *hif_ctx; + + ENTER(); + + p_cds_context = cds_get_global_context(); + if (!p_cds_context) { + hdd_err("Global Context is NULL"); + QDF_ASSERT(0); + return -EINVAL; + } + + hdd_info("start modules called in state! :%d reinit: %d", + hdd_ctx->driver_status, reinit); + + qdf_dev = cds_get_context(QDF_MODULE_ID_QDF_DEVICE); + if (!qdf_dev) { + hdd_err("QDF Device Context is Invalid return"); + return -EINVAL; + } + + mutex_lock(&hdd_ctx->iface_change_lock); + + if (QDF_TIMER_STATE_RUNNING == + qdf_mc_timer_get_current_state(&hdd_ctx->iface_change_timer)) { + + hdd_set_idle_ps_config(hdd_ctx, false); + hdd_info("Interface change Timer running Stop timer"); + qdf_mc_timer_stop(&hdd_ctx->iface_change_timer); + } + + switch (hdd_ctx->driver_status) { + case DRIVER_MODULES_UNINITIALIZED: + unint = true; + /* Fall through dont add break here */ + case DRIVER_MODULES_CLOSED: + if (!reinit && !unint) { + ret = pld_power_on(qdf_dev->dev); + if (ret) { + hdd_err("Failed to Powerup the device: %d", ret); + goto release_lock; + } + } + ret = hdd_hif_open(qdf_dev->dev, qdf_dev->drv_hdl, qdf_dev->bid, + qdf_dev->bus_type, + (reinit == true) ? HIF_ENABLE_TYPE_REINIT : + HIF_ENABLE_TYPE_PROBE); + if (ret) { + hdd_err("Failed to open hif: %d", ret); + goto power_down; + } + + hif_ctx = cds_get_context(QDF_MODULE_ID_HIF); + status = ol_cds_init(qdf_dev, hif_ctx); + if (status != QDF_STATUS_SUCCESS) { + hdd_err("No Memory to Create BMI Context :%d", status); + goto hif_close; + } + + status = cds_open(); + if (!QDF_IS_STATUS_SUCCESS(status)) { + hdd_err("Failed to Open CDS: %d", status); + goto ol_cds_free; + } + + hdd_ctx->driver_status = DRIVER_MODULES_OPENED; + + hdd_ctx->hHal = cds_get_context(QDF_MODULE_ID_SME); + + status = cds_pre_enable(hdd_ctx->pcds_context); + if (!QDF_IS_STATUS_SUCCESS(status)) { + hdd_err("Failed to pre-enable CDS: %d", status); + goto close; + } + + if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) { + sme_register_ftm_msg_processor(hdd_ctx->hHal, + hdd_ftm_mc_process_msg); + break; + } + if (unint) { + hdd_info("In phase-1 initialization don't enable modules"); + break; + } + /* Fall through dont add break here */ + case DRIVER_MODULES_OPENED: + if (!adapter) { + hdd_alert("adapter is Null"); + goto close; + } + if (hdd_configure_cds(hdd_ctx, adapter)) { + hdd_err("Failed to Enable cds modules"); + goto close; + } + hdd_info("Driver Modules Successfully Enabled"); + hdd_ctx->driver_status = DRIVER_MODULES_ENABLED; + break; + case DRIVER_MODULES_ENABLED: + hdd_info("Driver modules already Enabled"); + break; + default: + hdd_err("WLAN start invoked in wrong state! :%d\n", + hdd_ctx->driver_status); + goto release_lock; + } + mutex_unlock(&hdd_ctx->iface_change_lock); + EXIT(); + return 0; + +close: + cds_close(p_cds_context); + +ol_cds_free: + ol_cds_free(); + +hif_close: + hdd_hif_close(p_cds_context->pHIFContext); +power_down: + if (!reinit && !unint) + pld_power_off(qdf_dev->dev); +release_lock: + mutex_unlock(&hdd_ctx->iface_change_lock); + return -EINVAL; +} + +/** * __hdd_open() - HDD Open function * @dev: Pointer to net_device structure * @@ -1542,25 +1763,42 @@ static int __hdd_open(struct net_device *dev) ENTER_DEV(dev); MTRACE(qdf_trace(QDF_MODULE_ID_HDD, TRACE_CODE_HDD_OPEN_REQUEST, - adapter->sessionId, adapter->device_mode)); + adapter->sessionId, adapter->device_mode)); ret = wlan_hdd_validate_context(hdd_ctx); if (ret) return ret; + ret = hdd_wlan_start_modules(hdd_ctx, adapter, false); + if (ret) { + hdd_err("Failed to start WLAN modules return"); + return -ret; + } + + + if (!test_bit(SME_SESSION_OPENED, &adapter->event_flags)) { + ret = hdd_start_adapter(adapter); + if (ret) { + hdd_err("Failed to start adapter :%d", + adapter->device_mode); + return ret; + } + } + set_bit(DEVICE_IFACE_OPENED, &adapter->event_flags); if (hdd_conn_is_connected(WLAN_HDD_GET_STATION_CTX_PTR(adapter))) { - hddLog(LOG1, FL("Enabling Tx Queues")); + hdd_info("Enabling Tx Queues"); /* Enable TX queues only when we are connected */ wlan_hdd_netif_queue_control(adapter, - WLAN_START_ALL_NETIF_QUEUE, - WLAN_CONTROL_PATH); + WLAN_START_ALL_NETIF_QUEUE, + WLAN_CONTROL_PATH); } return ret; } + /** * hdd_open() - Wrapper function for __hdd_open to protect it from SSR * @dev: Pointer to net_device structure @@ -1592,7 +1830,10 @@ static int __hdd_stop(struct net_device *dev) { hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter); + hdd_adapter_list_node_t *adapternode = NULL, *next = NULL; int ret; + bool close_modules = true; + QDF_STATUS status; ENTER_DEV(dev); @@ -1632,11 +1873,36 @@ static int __hdd_stop(struct net_device *dev) * Notice that the hdd_stop_adapter is requested not to close the session * That is intentional to be able to scan if it is a STA/P2P interface */ - hdd_stop_adapter(hdd_ctx, adapter, false); + hdd_stop_adapter(hdd_ctx, adapter, true); /* DeInit the adapter. This ensures datapath cleanup as well */ hdd_deinit_adapter(hdd_ctx, adapter, true); + + /* + * Find if any iface is up. If any iface is up then can't put device to + * sleep/power save mode + */ + status = hdd_get_front_adapter(hdd_ctx, &adapternode); + while ((NULL != adapternode) && (QDF_STATUS_SUCCESS == status)) { + if (test_bit(DEVICE_IFACE_OPENED, + &adapternode->pAdapter->event_flags)) { + hdd_info("Still other ifaces are up cannot close modules"); + close_modules = false; + break; + } + status = hdd_get_next_adapter(hdd_ctx, adapternode, &next); + adapternode = next; + + } + + if (close_modules) { + hdd_info("Closing all modules from the hdd_stop"); + qdf_mc_timer_start(&hdd_ctx->iface_change_timer, + hdd_ctx->config->iface_change_wait_time + * 50000); + } + EXIT(); return 0; } @@ -2537,30 +2803,32 @@ static void hdd_set_fw_log_params(hdd_context_t *hdd_ctx, uint32_t value = 0; int ret; - /* Enable FW logs based on INI configuration */ - if ((QDF_GLOBAL_FTM_MODE == cds_get_conparam() || - (!hdd_ctx->config->enable_fw_log))) { + if (QDF_GLOBAL_FTM_MODE == cds_get_conparam() || + (!hdd_ctx->config->enable_fw_log)) { hdd_info("enable_fw_log not enabled in INI or in FTM mode return"); return; } + /* Enable FW logs based on INI configuration */ hdd_ctx->fw_log_settings.dl_type = hdd_ctx->config->enableFwLogType; ret = wma_cli_set_command(adapter->sessionId, - WMI_DBGLOG_TYPE, - hdd_ctx->config->enableFwLogType, - DBG_CMD); - if (ret) - hdd_err("Failed to enable FW log type ret %d", ret); + WMI_DBGLOG_TYPE, + hdd_ctx->config->enableFwLogType, + DBG_CMD); + if (ret != 0) + hdd_err("Failed to enable FW log type ret %d", + ret); hdd_ctx->fw_log_settings.dl_loglevel = - hdd_ctx->config->enableFwLogLevel; + hdd_ctx->config->enableFwLogLevel; ret = wma_cli_set_command(adapter->sessionId, - WMI_DBGLOG_LOG_LEVEL, - hdd_ctx->config->enableFwLogLevel, - DBG_CMD); - if (ret) - hdd_err("Failed to enable FW log level ret %d", ret); + WMI_DBGLOG_LOG_LEVEL, + hdd_ctx->config->enableFwLogLevel, + DBG_CMD); + if (ret != 0) + hdd_err("Failed to enable FW log level ret %d", + ret); hdd_string_to_u8_array( hdd_ctx->config->enableFwModuleLogLevel, @@ -2587,21 +2855,21 @@ static void hdd_set_fw_log_params(hdd_context_t *hdd_ctx, * For FW module ID 7 enable log level 6 */ - /* - * FW expects WMI command value = + /* FW expects WMI command value = * Module ID * 10 + Module Log level */ value = ((moduleloglevel[count] * 10) + moduleloglevel[count + 1]); ret = wma_cli_set_command(adapter->sessionId, - WMI_DBGLOG_MOD_LOG_LEVEL, - value, DBG_CMD); - if (ret) + WMI_DBGLOG_MOD_LOG_LEVEL, + value, DBG_CMD); + if (ret != 0) hdd_err("Failed to enable FW module log level %d ret %d", value, ret); count += 2; } + } #else static void hdd_set_fw_log_params(hdd_context_t *hdd_ctx, @@ -2631,12 +2899,11 @@ int hdd_set_fw_params(hdd_adapter_t *adapter) if (!hdd_ctx) return -EINVAL; - if ((QDF_GLOBAL_FTM_MODE == cds_get_conparam() || - (!hdd_ctx->config->enable2x2))) { + if ((cds_get_conparam() != QDF_GLOBAL_FTM_MODE) || + (!hdd_ctx->config->enable2x2)) { hdd_info("enable2x2 not enabled in INI or in FTM mode return"); return 0; } - #define HDD_DTIM_1CHAIN_RX_ID 0x5 #define HDD_SMPS_PARAM_VALUE_S 29 @@ -2677,22 +2944,24 @@ int hdd_set_fw_params(hdd_adapter_t *adapter) } #undef HDD_DTIM_1CHAIN_RX_ID #undef HDD_SMPS_PARAM_VALUE_S - - ret = wma_cli_set_command(adapter->sessionId, - WMI_PDEV_PARAM_HYST_EN, - hdd_ctx->config->enableMemDeepSleep, - PDEV_CMD); - - if (ret != 0) { - hdd_err("WMI_PDEV_PARAM_HYST_EN set failed %d", - ret); - goto error; + if (QDF_GLOBAL_FTM_MODE != cds_get_conparam()) { + ret = wma_cli_set_command(adapter->sessionId, + WMI_PDEV_PARAM_HYST_EN, + hdd_ctx->config->enableMemDeepSleep, + PDEV_CMD); + + if (ret) { + hdd_err("WMI_PDEV_PARAM_HYST_EN set failed %d", + ret); + goto error; + } } hdd_set_fw_log_params(hdd_ctx, adapter); EXIT(); return 0; + error: return -EINVAL; } @@ -2721,37 +2990,29 @@ hdd_adapter_t *hdd_open_adapter(hdd_context_t *hdd_ctx, uint8_t session_type, hdd_adapter_list_node_t *pHddAdapterNode = NULL; QDF_STATUS status = QDF_STATUS_E_FAILURE; hdd_cfg80211_state_t *cfgState; - int ret; - hddLog(LOG2, FL("iface(%s) type(%d)"), iface_name, session_type); + hdd_info("iface(%s) type(%d)", iface_name, session_type); if (hdd_ctx->current_intf_count >= hdd_ctx->max_intf_count) { /* * Max limit reached on the number of vdevs configured by the * host. Return error */ - hddLog(QDF_TRACE_LEVEL_ERROR, - FL( - "Unable to add virtual intf: currentVdevCnt=%d,hostConfiguredVdevCnt=%d" - ), - hdd_ctx->current_intf_count, hdd_ctx->max_intf_count); + hdd_err("Unable to add virtual intf: currentVdevCnt=%d,hostConfiguredVdevCnt=%d", + hdd_ctx->current_intf_count, hdd_ctx->max_intf_count); return NULL; } if (macAddr == NULL) { /* Not received valid macAddr */ - hddLog(QDF_TRACE_LEVEL_ERROR, - FL( - "Unable to add virtual intf: Not able to get valid mac address" - )); + hdd_err("Unable to add virtual intf: Not able to get valid mac address"); return NULL; } status = hdd_check_for_existing_macaddr(hdd_ctx, macAddr); if (QDF_STATUS_E_FAILURE == status) { - hddLog(QDF_TRACE_LEVEL_ERROR, - "Duplicate MAC addr: " MAC_ADDRESS_STR - " already exists", - MAC_ADDR_ARRAY(macAddr)); + hdd_err("Duplicate MAC addr: " MAC_ADDRESS_STR + " already exists", + MAC_ADDR_ARRAY(macAddr)); return NULL; } @@ -2763,17 +3024,14 @@ hdd_adapter_t *hdd_open_adapter(hdd_context_t *hdd_ctx, uint8_t session_type, case QDF_P2P_CLIENT_MODE: case QDF_P2P_DEVICE_MODE: case QDF_OCB_MODE: - case QDF_MONITOR_MODE: case QDF_NDI_MODE: - { adapter = hdd_alloc_station_adapter(hdd_ctx, macAddr, name_assign_type, iface_name); if (NULL == adapter) { - hddLog(QDF_TRACE_LEVEL_FATAL, - FL("failed to allocate adapter for session %d"), - session_type); + hdd_err("failed to allocate adapter for session %d", + session_type); return NULL; } @@ -2781,8 +3039,6 @@ hdd_adapter_t *hdd_open_adapter(hdd_context_t *hdd_ctx, uint8_t session_type, adapter->wdev.iftype = NL80211_IFTYPE_P2P_CLIENT; else if (QDF_P2P_DEVICE_MODE == session_type) adapter->wdev.iftype = NL80211_IFTYPE_P2P_DEVICE; - else if (QDF_MONITOR_MODE == session_type) - adapter->wdev.iftype = NL80211_IFTYPE_MONITOR; else adapter->wdev.iftype = NL80211_IFTYPE_STATION; @@ -2792,10 +3048,6 @@ hdd_adapter_t *hdd_open_adapter(hdd_context_t *hdd_ctx, uint8_t session_type, status = hdd_init_nan_data_mode(adapter); if (QDF_STATUS_SUCCESS != status) goto err_free_netdev; - } else { - ret = hdd_start_station_adapter(adapter); - if (ret) - goto err_free_netdev; } hdd_lro_enable(hdd_ctx, adapter); @@ -2822,28 +3074,21 @@ hdd_adapter_t *hdd_open_adapter(hdd_context_t *hdd_ctx, uint8_t session_type, } /* Stop the Interface TX queue. */ - hddLog(LOG1, FL("Disabling queues")); + hdd_info("Disabling queues"); wlan_hdd_netif_queue_control(adapter, - WLAN_NETIF_TX_DISABLE_N_CARRIER, - WLAN_CONTROL_PATH); - - hdd_register_tx_flow_control(adapter, - hdd_tx_resume_timer_expired_handler, - hdd_tx_resume_cb); - + WLAN_NETIF_TX_DISABLE_N_CARRIER, + WLAN_CONTROL_PATH); break; - } + case QDF_P2P_GO_MODE: case QDF_SAP_MODE: - { adapter = hdd_wlan_create_ap_dev(hdd_ctx, macAddr, name_assign_type, (uint8_t *) iface_name); if (NULL == adapter) { - hddLog(QDF_TRACE_LEVEL_FATAL, - FL("failed to allocate adapter for session %d"), - session_type); + hdd_alert("failed to allocate adapter for session %d", + session_type); return NULL; } @@ -2853,64 +3098,21 @@ hdd_adapter_t *hdd_open_adapter(hdd_context_t *hdd_ctx, uint8_t session_type, NL80211_IFTYPE_P2P_GO; adapter->device_mode = session_type; - ret = hdd_start_ap_adapter(adapter); - if (ret) - goto err_free_netdev; - status = hdd_register_hostapd(adapter, rtnl_held); if (QDF_STATUS_SUCCESS != status) { hdd_deinit_adapter(hdd_ctx, adapter, rtnl_held); goto err_free_netdev; } - - hddLog(LOG1, FL("Disabling queues")); + hdd_info("Disabling queues"); wlan_hdd_netif_queue_control(adapter, - WLAN_NETIF_TX_DISABLE_N_CARRIER, - WLAN_CONTROL_PATH); - + WLAN_NETIF_TX_DISABLE_N_CARRIER, + WLAN_CONTROL_PATH); break; - } - case QDF_FTM_MODE: - { - adapter = hdd_alloc_station_adapter(hdd_ctx, macAddr, - name_assign_type, - iface_name); - - if (NULL == adapter) { - hddLog(QDF_TRACE_LEVEL_FATAL, - FL("failed to allocate adapter for session %d"), - session_type); - return NULL; - } - - /* - * Assign NL80211_IFTYPE_STATION as interface type to resolve - * Kernel Warning message while loading driver in FTM mode. - */ - adapter->wdev.iftype = NL80211_IFTYPE_STATION; - adapter->device_mode = session_type; - status = hdd_register_interface(adapter, rtnl_held); - - ret = hdd_start_ftm_adapter(adapter); - if (ret) - goto err_free_netdev; - - /* Stop the Interface TX queue. */ - hddLog(LOG1, FL("Disabling queues")); - wlan_hdd_netif_queue_control(adapter, - WLAN_NETIF_TX_DISABLE_N_CARRIER, - WLAN_CONTROL_PATH); - } - break; default: - { - hddLog(QDF_TRACE_LEVEL_FATAL, - FL("Invalid session type %d"), - session_type); + hdd_alert("Invalid session type %d", session_type); QDF_ASSERT(0); return NULL; } - } cfgState = WLAN_HDD_GET_CFG_STATE_PTR(adapter); mutex_init(&cfgState->remain_on_chan_ctx_lock); @@ -2957,11 +3159,6 @@ hdd_adapter_t *hdd_open_adapter(hdd_context_t *hdd_ctx, uint8_t session_type, cds_check_and_restart_sap_with_non_dfs_acs(); } - if (hdd_set_fw_params(adapter)) { - hdd_err("Failed to set the fw parameters"); - goto err_lro_cleanup; - } - if (QDF_STATUS_SUCCESS != hdd_debugfs_init(adapter)) hdd_err("Interface %s wow debug_fs init failed", iface_name); @@ -3386,6 +3583,23 @@ QDF_STATUS hdd_reset_all_adapters(hdd_context_t *hdd_ctx) return QDF_STATUS_SUCCESS; } +/** + * hdd_is_interface_up()- Checkfor interface up before ssr + * @hdd_ctx: HDD context + * + * check if there are any wlan interfaces before SSR accordingly start + * the interface. + * + * Return: 0 if interface was opened else false + */ +static bool hdd_is_interface_up(hdd_adapter_t *adapter) +{ + if (test_bit(DEVICE_IFACE_OPENED, &adapter->event_flags)) + return true; + else + return false; +} + QDF_STATUS hdd_start_all_adapters(hdd_context_t *hdd_ctx) { hdd_adapter_list_node_t *adapterNode = NULL, *pNext = NULL; @@ -3399,10 +3613,12 @@ QDF_STATUS hdd_start_all_adapters(hdd_context_t *hdd_ctx) ENTER(); status = hdd_get_front_adapter(hdd_ctx, &adapterNode); - while (NULL != adapterNode && QDF_STATUS_SUCCESS == status) { adapter = adapterNode->pAdapter; + if (!hdd_is_interface_up(adapter)) + continue; + hdd_wmm_init(adapter); switch (adapter->device_mode) { @@ -3867,85 +4083,6 @@ static int hdd_wlan_register_ip6_notifier(hdd_context_t *hdd_ctx) } #endif -#ifdef QCA_WIFI_FTM -/** - * hdd_disable_ftm() - Disable FTM mode - * @hdd_ctx: HDD context - * - * Helper function to disable FTM mode. - * - * Return: None. - */ -static void hdd_disable_ftm(hdd_context_t *hdd_ctx) -{ - hdd_notice("Disabling FTM mode"); - - if (hdd_ftm_stop(hdd_ctx)) { - hdd_alert("hdd_ftm_stop Failed!"); - QDF_ASSERT(0); - } - - hdd_ctx->ftm.ftm_state = WLAN_FTM_STOPPED; - - wlan_hdd_ftm_close(hdd_ctx); - - return; -} - -/** - * hdd_enable_ftm() - Enable FTM mode - * @hdd_ctx: HDD context - * - * Helper function to enable FTM mode. - * - * Return: 0 on success and errno on failure. - */ -int hdd_enable_ftm(hdd_context_t *hdd_ctx) -{ - int ret; - - ret = wlan_hdd_ftm_open(hdd_ctx); - if (ret) { - hdd_alert("wlan_hdd_ftm_open Failed: %d", ret); - goto err_out; - } - - ret = hdd_ftm_start(hdd_ctx); - - if (ret) { - hdd_alert("hdd_ftm_start Failed: %d", ret); - goto err_ftm_close; - } - - ret = wiphy_register(hdd_ctx->wiphy); - if (ret) { - hdd_alert("wiphy register failed: %d", ret); - goto err_ftm_stop; - } - - hdd_err("FTM driver loaded"); - - return 0; - -err_ftm_stop: - hdd_ftm_stop(hdd_ctx); -err_ftm_close: - wlan_hdd_ftm_close(hdd_ctx); -err_out: - return ret; - -} -#else -int hdd_enable_ftm(hdd_context_t *hdd_ctx) -{ - hdd_err("Driver built without FTM feature enabled!"); - - return -ENOTSUPP; -} - -static inline void hdd_disable_ftm(hdd_context_t *hdd_ctx) { } -#endif - #ifdef WLAN_LOGGING_SOCK_SVC_ENABLE /** * hdd_logging_sock_activate_svc() - Activate logging @@ -4232,39 +4369,23 @@ void hdd_wlan_exit(hdd_context_t *hdd_ctx) v_CONTEXT_t p_cds_context = hdd_ctx->pcds_context; QDF_STATUS qdf_status; struct wiphy *wiphy = hdd_ctx->wiphy; + int driver_status; ENTER(); - hdd_unregister_wext_all_adapters(hdd_ctx); + if (QDF_TIMER_STATE_RUNNING == + qdf_mc_timer_get_current_state(&hdd_ctx->iface_change_timer)) { + hdd_info("Stpp interface change timer"); + qdf_mc_timer_stop(&hdd_ctx->iface_change_timer); + } - hdd_exit_netlink_services(hdd_ctx); + if (!QDF_IS_STATUS_SUCCESS + (qdf_mc_timer_destroy(&hdd_ctx->iface_change_timer))) + hdd_err("Cannot delete interface change timer"); - if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) { - hdd_disable_ftm(hdd_ctx); - - hdd_alert("FTM driver unloaded"); - goto free_hdd_ctx; - } hdd_unregister_notifiers(hdd_ctx); - /* - * Cancel any outstanding scan requests. We are about to close all - * of our adapters, but an adapter structure is what SME passes back - * to our callback function. Hence if there are any outstanding scan - * requests then there is a race condition between when the adapter - * is closed and when the callback is invoked. We try to resolve that - * race condition here by canceling any outstanding scans before we - * close the adapters. - * Note that the scans may be cancelled in an asynchronous manner, so - * ideally there needs to be some kind of synchronization. Rather than - * introduce a new synchronization here, we will utilize the fact that - * we are about to Request Full Power, and since that is synchronized, - * the expectation is that by the time Request Full Power has completed, - * all scans will be cancelled - */ - hdd_abort_mac_scan_all_adapters(hdd_ctx); - #ifdef MSM_PLATFORM if (QDF_TIMER_STATE_RUNNING == qdf_mc_timer_get_current_state(&hdd_ctx->bus_bw_timer)) { @@ -4291,33 +4412,40 @@ void hdd_wlan_exit(hdd_context_t *hdd_ctx) } #endif + mutex_lock(&hdd_ctx->iface_change_lock); + driver_status = hdd_ctx->driver_status; + mutex_unlock(&hdd_ctx->iface_change_lock); + /* * Powersave Offload Case * Disable Idle Power Save Mode */ hdd_set_idle_ps_config(hdd_ctx, false); - /* Unregister the Net Device Notifier */ - unregister_netdevice_notifier(&hdd_netdev_notifier); - - /* - * Stop all adapters, this will ensure the termination of active - * connections on the interface. Make sure the cds_scheduler is - * still available to handle those control messages - */ - 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)) { - hddLog(QDF_TRACE_LEVEL_FATAL, - FL("Failed to stop CDS")); - QDF_ASSERT(QDF_IS_STATUS_SUCCESS(qdf_status)); + if (driver_status != DRIVER_MODULES_CLOSED) { + hdd_unregister_wext_all_adapters(hdd_ctx); + /* + * Cancel any outstanding scan requests. We are about to close + * all of our adapters, but an adapter structure is what SME + * passes back to our callback function. Hence if there + * are any outstanding scan requests then there is a + * race condition between when the adapter is closed and + * when the callback is invoked. We try to resolve that + * race condition here by canceling any outstanding scans + * before we close the adapters. + * Note that the scans may be cancelled in an asynchronous + * manner, so ideally there needs to be some kind of + * synchronization. Rather than introduce a new + * synchronization here, we will utilize the fact that we are + * about to Request Full Power, and since that is synchronized, + * the expectation is that by the time Request Full Power has + * completed, all scans will be cancelled + */ + hdd_abort_mac_scan_all_adapters(hdd_ctx); + hdd_stop_all_adapters(hdd_ctx); } + hdd_wlan_stop_modules(hdd_ctx, false); /* * Close the scheduler before calling cds_close to make sure no thread * is scheduled after the each module close is called i.e after all the @@ -4339,7 +4467,6 @@ void hdd_wlan_exit(hdd_context_t *hdd_ctx) * This frees pMac(HAL) context. There should not be any call * that requires pMac access after this. */ - cds_close(p_cds_context); hdd_wlan_green_ap_deinit(hdd_ctx); @@ -4350,19 +4477,15 @@ void hdd_wlan_exit(hdd_context_t *hdd_ctx) /* Free up RoC request queue and flush workqueue */ cds_flush_work(&hdd_ctx->roc_req_work); - if (!QDF_IS_STATUS_SUCCESS(cds_deinit_policy_mgr())) { - hdd_err("Failed to deinit policy manager"); - /* Proceed and complete the clean up */ - } - wlansap_global_deinit(); - -free_hdd_ctx: + wlansap_global_deinit(); wlan_hdd_deinit_tx_rx_histogram(hdd_ctx); wiphy_unregister(wiphy); wlan_hdd_cfg80211_deinit(wiphy); + hdd_exit_netlink_services(hdd_ctx); + mutex_destroy(&hdd_ctx->iface_change_lock); hdd_context_destroy(hdd_ctx); } @@ -5236,17 +5359,12 @@ static void hdd_init_offloaded_packets_ctx(hdd_context_t *hdd_ctx) * * Return: none */ -static void hdd_enable_fastpath(struct hdd_config *hdd_cfg, +void hdd_enable_fastpath(struct hdd_config *hdd_cfg, void *context) { if (hdd_cfg->fastpath_enable) hif_enable_fastpath(context); } -#else -static void hdd_enable_fastpath(struct hdd_config *hdd_cfg, - void *context) -{ -} #endif #if defined(FEATURE_WLAN_CH_AVOID) @@ -5744,10 +5862,12 @@ static QDF_STATUS wlan_hdd_disable_all_dual_mac_features(hdd_context_t *hdd_ctx) return QDF_STATUS_E_FAILURE; } + if (hdd_ctx->config->dual_mac_feature_disable) + return QDF_STATUS_SUCCESS; + cfg.scan_config = 0; cfg.fw_mode_config = 0; - cfg.set_dual_mac_cb = - (void *)cds_soc_set_dual_mac_cfg_cb; + cfg.set_dual_mac_cb = cds_soc_set_dual_mac_cfg_cb; hdd_debug("Disabling all dual mac features..."); @@ -5907,21 +6027,19 @@ list_destroy: /** * hdd_context_create() - Allocate and inialize HDD context. - * @dev: Pointer to the underlying device - * @hif_sc: HIF context + * @dev: Device Pointer to the underlying device * * Allocate and initialize HDD context. HDD context is allocated as part of * wiphy allocation and then context is initialized. * * Return: HDD context on success and ERR_PTR on failure */ -hdd_context_t *hdd_context_create(struct device *dev, void *hif_sc) +hdd_context_t *hdd_context_create(struct device *dev) { QDF_STATUS status; int ret = 0; hdd_context_t *hdd_ctx; v_CONTEXT_t p_cds_context; - struct hif_target_info *tgt_info = hif_get_target_info_handle(hif_sc); ENTER(); @@ -5952,7 +6070,7 @@ hdd_context_t *hdd_context_create(struct device *dev, void *hif_sc) /* Read and parse the qcom_cfg.ini file */ status = hdd_parse_config_ini(hdd_ctx); if (QDF_STATUS_SUCCESS != status) { - hdd_alert("Error (status: %d) parsing INI file: %s", status, + hdd_err("Error (status: %d) parsing INI file: %s", status, WLAN_INI_FILE); ret = -EINVAL; goto err_free_config; @@ -5975,12 +6093,10 @@ hdd_context_t *hdd_context_create(struct device *dev, void *hif_sc) if (ret) goto err_free_config; - hdd_ctx->target_type = tgt_info->target_type; pld_set_fw_debug_mode(hdd_ctx->parent_dev, hdd_ctx->config->enable_fw_log); - hdd_enable_fastpath(hdd_ctx->config, hif_sc); /* Uses to enabled logging after SSR */ hdd_ctx->fw_log_settings.enable = hdd_ctx->config->enable_fw_log; @@ -6084,27 +6200,6 @@ static inline int hdd_open_p2p_interface(struct hdd_context_t *hdd_ctx, #endif /** - * hdd_open_monitor_interface() - Open monitor mode interface - * @hdd_ctx: HDD context - * @rtnl_held: True if RTNL lock is held - * - * Return: Primary adapter on success and PTR_ERR on failure - */ -static hdd_adapter_t *hdd_open_monitor_interface(hdd_context_t *hdd_ctx, - bool rtnl_held) -{ - hdd_adapter_t *adapter; - - adapter = hdd_open_adapter(hdd_ctx, QDF_MONITOR_MODE, "wlan%d", - wlan_hdd_get_intf_addr(hdd_ctx), - NET_NAME_UNKNOWN, rtnl_held); - if (adapter == NULL) - return ERR_PTR(-ENOSPC); - - return adapter; -} - -/** * hdd_start_station_adapter()- Start the Station Adapter * @adapter: HDD adapter * @@ -6125,6 +6220,10 @@ int hdd_start_station_adapter(hdd_adapter_t *adapter) return qdf_status_to_os_return(status); } + hdd_register_tx_flow_control(adapter, + hdd_tx_resume_timer_expired_handler, + hdd_tx_resume_cb); + EXIT(); return 0; } @@ -6150,6 +6249,10 @@ int hdd_start_ap_adapter(hdd_adapter_t *adapter) return qdf_status_to_os_return(status); } + hdd_register_tx_flow_control(adapter, + hdd_softap_tx_resume_timer_expired_handler, + hdd_softap_tx_resume_cb); + EXIT(); return 0; } @@ -6195,8 +6298,8 @@ static hdd_adapter_t *hdd_open_interfaces(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter_11p = NULL; int ret; - /* Create only 802.11p interface */ if (hdd_ctx->config->dot11p_mode == WLAN_HDD_11P_STANDALONE) { + /* Create only 802.11p interface */ adapter = hdd_open_adapter(hdd_ctx, QDF_OCB_MODE, "wlanocb%d", wlan_hdd_get_intf_addr(hdd_ctx), NET_NAME_UNKNOWN, rtnl_held); @@ -6206,7 +6309,6 @@ static hdd_adapter_t *hdd_open_interfaces(hdd_context_t *hdd_ctx, return adapter; } - adapter = hdd_open_adapter(hdd_ctx, QDF_STA_MODE, "wlan%d", wlan_hdd_get_intf_addr(hdd_ctx), NET_NAME_UNKNOWN, rtnl_held); @@ -6852,6 +6954,347 @@ static int hdd_adaptive_dwelltime_init(hdd_context_t *hdd_ctx) return 0; } +#ifdef FEATURE_WLAN_AUTO_SHUTDOWN +/** + * hdd_set_auto_shutdown_cb() - Set auto shutdown callback + * @hdd_ctx: HDD context + * + * Set auto shutdown callback to get indications from firmware to indicate + * userspace to shutdown WLAN after a configured amount of inactivity. + * + * Return: 0 on success and errno on failure. + */ +static int hdd_set_auto_shutdown_cb(hdd_context_t *hdd_ctx) +{ + QDF_STATUS status; + + if (!hdd_ctx->config->WlanAutoShutdown) + return 0; + + status = sme_set_auto_shutdown_cb(hdd_ctx->hHal, + wlan_hdd_auto_shutdown_cb); + if (status != QDF_STATUS_SUCCESS) + hdd_err("Auto shutdown feature could not be enabled: %d", + status); + + return qdf_status_to_os_return(status); +} +#else +static int hdd_set_auto_shutdown_cb(hdd_context_t *hdd_ctx) +{ + return 0; +} +#endif + +/** + * hdd_features_init() - Init features + * @hdd_ctx: HDD context + * @adapter: Primary adapter context + * + * Initialize features and their feature context after WLAN firmware is up. + * + * Return: 0 on success and errno on failure. + */ +static int hdd_features_init(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter) +{ + tSirTxPowerLimit hddtxlimit; + QDF_STATUS status; + int ret; + + ENTER(); + + ret = hdd_update_country_code(hdd_ctx, adapter); + if (ret) { + hdd_err("Failed to update country code: %d", ret); + goto out; + } + + /* FW capabilities received, Set the Dot11 mode */ + sme_setdef_dot11mode(hdd_ctx->hHal); + + + if (hdd_ctx->config->fIsImpsEnabled) + hdd_set_idle_ps_config(hdd_ctx, true); + else + hdd_set_idle_ps_config(hdd_ctx, false); + + if (hdd_lro_init(hdd_ctx)) + hdd_err("Unable to initialize LRO in fw"); + + if (hdd_adaptive_dwelltime_init(hdd_ctx)) + hdd_err("Unable to send adaptive dwelltime setting to FW"); + + ret = hdd_init_thermal_info(hdd_ctx); + if (ret) { + hdd_err("Error while initializing thermal information"); + goto deregister_frames; + } + + hddtxlimit.txPower2g = hdd_ctx->config->TxPower2g; + hddtxlimit.txPower5g = hdd_ctx->config->TxPower5g; + status = sme_txpower_limit(hdd_ctx->hHal, &hddtxlimit); + if (!QDF_IS_STATUS_SUCCESS(status)) + hdd_err("Error setting txlimit in sme: %d", status); + + hdd_tsf_init(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) { + hdd_err("Failed to disable dual mac features"); + goto deregister_frames; + } + } + + ret = hdd_register_cb(hdd_ctx); + if (ret) { + hdd_err("Failed to register HDD callbacks!"); + goto deregister_frames; + } + + if (hdd_ctx->config->dual_mac_feature_disable) { + status = wlan_hdd_disable_all_dual_mac_features(hdd_ctx); + if (status != QDF_STATUS_SUCCESS) { + hdd_err("Failed to disable dual mac features"); + goto deregister_cb; + } + } + + /* register P2P Listen Offload event callback */ + if (wma_is_p2p_lo_capable()) + sme_register_p2p_lo_event(hdd_ctx->hHal, hdd_ctx, + wlan_hdd_p2p_lo_event_callback); + + ret = hdd_set_auto_shutdown_cb(hdd_ctx); + + if (ret) + goto deregister_cb; + + EXIT(); + return 0; + +deregister_cb: + hdd_deregister_cb(hdd_ctx); +deregister_frames: + wlan_hdd_cfg80211_deregister_frames(adapter); +out: + return -EINVAL; + +} + + +/** + * hdd_configure_cds() - Configure cds modules + * @hdd_ctx: HDD context + * @adapter: Primary adapter context + * + * Enable Cds modules after WLAN firmware is up. + * + * Return: 0 on success and errno on failure. + */ +int hdd_configure_cds(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter) +{ + int ret; + QDF_STATUS status; + /* structure of function pointers to be used by CDS */ + struct cds_sme_cbacks sme_cbacks; + + ret = hdd_pre_enable_configure(hdd_ctx); + if (ret) { + hdd_err("Failed to pre-configure cds"); + goto out; + } + + /* + * Start CDS which starts up the SME/MAC/HAL modules and everything + * else + */ + status = cds_enable(hdd_ctx->pcds_context); + + if (!QDF_IS_STATUS_SUCCESS(status)) { + hdd_alert("cds_enable failed"); + goto out; + } + + status = hdd_post_cds_enable_config(hdd_ctx); + if (!QDF_IS_STATUS_SUCCESS(status)) { + hdd_alert("hdd_post_cds_enable_config failed"); + goto out; + } + + ret = hdd_features_init(hdd_ctx, adapter); + if (ret) + goto out; + + 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); + if (!QDF_IS_STATUS_SUCCESS(status)) { + hdd_err("Policy manager initialization failed"); + goto out; + } + + return 0; +out: + return -EINVAL; +} + +/** + * hdd_deconfigure_cds() -De-Configure cds + * @hdd_ctx: HDD context + * + * Deconfigure Cds modules before WLAN firmware is down. + * + * Return: 0 on success and errno on failure. + */ +int hdd_deconfigure_cds(hdd_context_t *hdd_ctx) +{ + QDF_STATUS qdf_status; + + ENTER(); + /* De-register the SME callbacks */ + hdd_deregister_cb(hdd_ctx); + + /* De-init Policy Manager */ + if (!QDF_IS_STATUS_SUCCESS(cds_deinit_policy_mgr())) { + hdd_err("Failed to deinit policy manager"); + /* Proceed and complete the clean up */ + return -EINVAL; + } + + qdf_status = cds_disable(hdd_ctx->pcds_context); + if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { + hdd_err("Failed to Disable the CDS Modules! :%d", + qdf_status); + return -EINVAL; + } + + EXIT(); + return 0; +} + + +/** + * hdd_wlan_stop_modules - Single driver state machine for stoping modules + * @hdd_ctx: HDD context + * @shutdown: flag to indicate from SSR or normal path + * + * This function maintains the driver state machine it will be invoked from + * exit, shutdown and con_mode change handler. Depending on the driver state + * shall perform the stopping/closing of the modules. + * + * Return: 0 for success; non-zero for failure + */ +int hdd_wlan_stop_modules(hdd_context_t *hdd_ctx, bool shutdown) +{ + void *hif_ctx; + qdf_device_t qdf_ctx; + QDF_STATUS qdf_status; + int ret; + p_cds_sched_context cds_sched_context = NULL; + + ENTER(); + + qdf_ctx = cds_get_context(QDF_MODULE_ID_QDF_DEVICE); + if (!qdf_ctx) { + hdd_err("QDF device context NULL"); + return -EINVAL; + } + + cds_sched_context = get_cds_sched_ctxt(); + if (!cds_sched_context) { + hdd_err("cds scheduler context NULL"); + return -EINVAL; + } + + hdd_info("Present Driver Status: %d", hdd_ctx->driver_status); + + switch (hdd_ctx->driver_status) { + case DRIVER_MODULES_UNINITIALIZED: + hdd_info("Modules not initialized just return"); + return 0; + case DRIVER_MODULES_CLOSED: + hdd_info("Modules already closed"); + return 0; + case DRIVER_MODULES_ENABLED: + if (hdd_deconfigure_cds(hdd_ctx)) { + hdd_alert("Failed to de-configure CDS"); + QDF_ASSERT(0); + return -EINVAL; + } + hdd_info("successfully Disabled the CDS modules!"); + hdd_ctx->driver_status = DRIVER_MODULES_OPENED; + break; + case DRIVER_MODULES_OPENED: + hdd_info("Closing CDS modules!"); + break; + default: + hdd_err("Trying to stop wlan in a wrong state: %d", + hdd_ctx->driver_status); + QDF_ASSERT(0); + return -EINVAL; + } + + qdf_status = cds_close(hdd_ctx->pcds_context); + if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { + hdd_warn("Failed to stop CDS:%d", qdf_status); + QDF_ASSERT(0); + } + /* Clean up message queues of TX, RX and MC thread */ + cds_sched_flush_mc_mqs(cds_sched_context); + + hif_ctx = cds_get_context(QDF_MODULE_ID_HIF); + if (!hif_ctx) { + hdd_err("Hif context is Null"); + return -EINVAL; + } + + hdd_hif_close(hif_ctx); + + ol_cds_free(); + + if (!shutdown) { + ret = pld_power_off(qdf_ctx->dev); + if (ret) + hdd_err("CNSS power down failed put device into Low power mode:%d", + ret); + } + hdd_ctx->driver_status = DRIVER_MODULES_CLOSED; + + EXIT(); + + return 0; + +} + +/** + * hdd_iface_change_callback() - Function invoked when stop modules expires + * @priv: pointer to hdd context + * + * This function is invoked when the timer waiting for the interface change + * expires, it shall cut-down the power to wlan and stop all the modules. + * + * Return: void + */ +static void hdd_iface_change_callback(void *priv) +{ + hdd_context_t *hdd_ctx = (hdd_context_t *) priv; + int ret; + int status = wlan_hdd_validate_context(hdd_ctx); + + if (status) + return; + + ENTER(); + hdd_info("Interface change timer expired close the modules!"); + mutex_lock(&hdd_ctx->iface_change_lock); + ret = hdd_wlan_stop_modules(hdd_ctx, false); + if (ret) + hdd_alert("Failed to stop modules"); + mutex_unlock(&hdd_ctx->iface_change_lock); + EXIT(); +} + /** * hdd_wlan_startup() - HDD init function * @dev: Pointer to the underlying device @@ -6860,50 +7303,40 @@ static int hdd_adaptive_dwelltime_init(hdd_context_t *hdd_ctx) * * Return: 0 for success, < 0 for failure */ -int hdd_wlan_startup(struct device *dev, void *hif_sc) +int hdd_wlan_startup(struct device *dev) { QDF_STATUS status; hdd_adapter_t *adapter = NULL; hdd_context_t *hdd_ctx = NULL; int ret; - tSirTxPowerLimit hddtxlimit; + void *hif_sc; bool rtnl_held; - /* structure of function pointers to be used by CDS */ - struct cds_sme_cbacks sme_cbacks; ENTER(); - if (QDF_IS_EPPING_ENABLED(con_mode)) { - ret = epping_enable(dev); - EXIT(); - return ret; - } - - hdd_ctx = hdd_context_create(dev, hif_sc); + hdd_ctx = hdd_context_create(dev); if (IS_ERR(hdd_ctx)) return PTR_ERR(hdd_ctx); + qdf_mc_timer_init(&hdd_ctx->iface_change_timer, QDF_TIMER_TYPE_SW, + hdd_iface_change_callback, (void *)hdd_ctx); + + mutex_init(&hdd_ctx->iface_change_lock); + ret = hdd_init_netlink_services(hdd_ctx); if (ret) goto err_hdd_free_context; + hdd_wlan_green_ap_init(hdd_ctx); + ret = hdd_update_config(hdd_ctx); if (ret) - goto err_hdd_free_context; - - if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) { - ret = hdd_enable_ftm(hdd_ctx); - if (ret) - goto err_exit_nl_srv; - - goto success; - } + goto err_exit_nl_srv; - hdd_wlan_green_ap_init(hdd_ctx); - status = cds_open(); - if (!QDF_IS_STATUS_SUCCESS(status)) { - hddLog(QDF_TRACE_LEVEL_FATAL, FL("cds_open failed")); + ret = hdd_wlan_start_modules(hdd_ctx, adapter, false); + if (ret) { + hdd_alert("Failed to start modules: %d", ret); goto err_exit_nl_srv; } @@ -6913,62 +7346,35 @@ int hdd_wlan_startup(struct device *dev, void *hif_sc) if (NULL == hdd_ctx->hHal) { hddLog(QDF_TRACE_LEVEL_FATAL, FL("HAL context is null")); - goto err_cds_close; - } - - status = cds_pre_enable(hdd_ctx->pcds_context); - if (!QDF_IS_STATUS_SUCCESS(status)) { - hddLog(QDF_TRACE_LEVEL_FATAL, FL("cds_pre_enable failed")); - goto err_cds_close; + goto err_stop_modules; } ret = hdd_wiphy_init(hdd_ctx); if (ret) { hdd_alert("Failed to initialize wiphy: %d", ret); - goto err_cds_close; + goto err_stop_modules; } - ret = hdd_pre_enable_configure(hdd_ctx); - if (ret) - goto err_wiphy_unregister; - if (hdd_ctx->config->enable_dp_trace) qdf_dp_trace_init(); if (hdd_ipa_init(hdd_ctx) == QDF_STATUS_E_FAILURE) goto err_wiphy_unregister; - /* - * Start CDS which starts up the SME/MAC/HAL modules and everything - * else - */ - status = cds_enable(hdd_ctx->pcds_context); - if (!QDF_IS_STATUS_SUCCESS(status)) { - hddLog(QDF_TRACE_LEVEL_FATAL, FL("cds_enable failed")); - goto err_ipa_cleanup; - } - - status = hdd_post_cds_enable_config(hdd_ctx); - if (!QDF_IS_STATUS_SUCCESS(status)) { - hddLog(QDF_TRACE_LEVEL_FATAL, - FL("hdd_post_cds_enable_config failed")); - goto err_cds_disable; - } rtnl_held = hdd_hold_rtnl_lock(); - if (QDF_GLOBAL_MONITOR_MODE == hdd_get_conparam()) - adapter = hdd_open_monitor_interface(hdd_ctx, rtnl_held); - else - adapter = hdd_open_interfaces(hdd_ctx, rtnl_held); + + adapter = hdd_open_interfaces(hdd_ctx, rtnl_held); if (IS_ERR(adapter)) { hddLog(QDF_TRACE_LEVEL_FATAL, FL("Failed to open interface, adapter is NULL")); ret = PTR_ERR(adapter); - goto err_cds_disable; + goto err_ipa_cleanup; } + hif_sc = cds_get_context(QDF_MODULE_ID_HIF); /* * target hw version/revision would only be retrieved after firmware * donwload @@ -6980,38 +7386,9 @@ int hdd_wlan_startup(struct device *dev, void *hif_sc) /* Get the wlan hw/fw version */ hdd_wlan_get_version(hdd_ctx, NULL, NULL); - ret = hdd_update_country_code(hdd_ctx, adapter); - - if (ret) - goto err_close_adapter; - - /* FW capabilities received, Set the Dot11 mode */ - sme_setdef_dot11mode(hdd_ctx->hHal); - - /* - * Action frame registered in one adapter which will - * applicable to all interfaces - */ - wlan_hdd_cfg80211_register_frames(adapter); - hdd_release_rtnl_lock(); rtnl_held = false; - if (hdd_ctx->config->fIsImpsEnabled) - hdd_set_idle_ps_config(hdd_ctx, true); - else - hdd_set_idle_ps_config(hdd_ctx, false); -#ifdef FEATURE_WLAN_AUTO_SHUTDOWN - if (hdd_ctx->config->WlanAutoShutdown != 0) - if (sme_set_auto_shutdown_cb - (hdd_ctx->hHal, wlan_hdd_auto_shutdown_cb) - != QDF_STATUS_SUCCESS) - hddLog(LOGE, - FL( - "Auto shutdown feature could not be enabled" - )); -#endif - #ifdef FEATURE_WLAN_AP_AP_ACS_OPTIMIZE status = qdf_mc_timer_init(&hdd_ctx->skip_acs_scan_timer, QDF_TIMER_TYPE_SW, @@ -7021,34 +7398,6 @@ int hdd_wlan_startup(struct device *dev, void *hif_sc) hddLog(LOGE, FL("Failed to init ACS Skip timer")); #endif - 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); - if (!QDF_IS_STATUS_SUCCESS(status)) { - hdd_err("Policy manager initialization failed"); - goto err_debugfs_exit; - } - - ret = hdd_init_thermal_info(hdd_ctx); - - if (ret) { - hdd_err("Error while initializing thermal information"); - goto err_debugfs_exit; - } - - if (0 != hdd_lro_init(hdd_ctx)) - hdd_err("Unable to initialize LRO in fw"); - - if (0 != hdd_adaptive_dwelltime_init(hdd_ctx)) - hdd_err("Unable to send adaptive dwelltime setting to FW"); - - hddtxlimit.txPower2g = hdd_ctx->config->TxPower2g; - hddtxlimit.txPower5g = hdd_ctx->config->TxPower5g; - status = sme_txpower_limit(hdd_ctx->hHal, &hddtxlimit); - if (QDF_IS_STATUS_SUCCESS(status)) - hdd_err("Error setting txlimit in sme: %d", status); - - hdd_tsf_init(hdd_ctx); #ifdef MSM_PLATFORM spin_lock_init(&hdd_ctx->bus_bw_lock); qdf_mc_timer_init(&hdd_ctx->bus_bw_timer, @@ -7061,18 +7410,6 @@ int hdd_wlan_startup(struct device *dev, void *hif_sc) hdd_ctx->target_hw_version, hdd_ctx->target_hw_name); - if (hdd_ctx->config->dual_mac_feature_disable) { - status = wlan_hdd_disable_all_dual_mac_features(hdd_ctx); - if (status != QDF_STATUS_SUCCESS) { - hdd_err("Failed to disable dual mac features"); - goto err_debugfs_exit; - } - } - - /* register P2P Listen Offload event callback */ - if (wma_is_p2p_lo_capable()) - sme_register_p2p_lo_event(hdd_ctx->hHal, hdd_ctx, - wlan_hdd_p2p_lo_event_callback); ret = hdd_register_notifiers(hdd_ctx); if (ret) @@ -7084,40 +7421,38 @@ 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; - } + if (hdd_ctx->config->fIsImpsEnabled) + hdd_set_idle_ps_config(hdd_ctx, true); + qdf_mc_timer_start(&hdd_ctx->iface_change_timer, + hdd_ctx->config->iface_change_wait_time * 5000); goto success; err_debugfs_exit: hdd_debugfs_exit(adapter); - -err_close_adapter: - hdd_release_rtnl_lock(); - hdd_close_all_adapters(hdd_ctx, false); -err_cds_disable: - cds_disable(hdd_ctx->pcds_context); + if (rtnl_held) + hdd_release_rtnl_lock(); -err_ipa_cleanup: - hdd_ipa_cleanup(hdd_ctx); err_wiphy_unregister: wiphy_unregister(hdd_ctx->wiphy); wlan_hdd_cfg80211_deinit(hdd_ctx->wiphy); -err_cds_close: +err_ipa_cleanup: + hdd_ipa_cleanup(hdd_ctx); + +err_stop_modules: + hdd_wlan_stop_modules(hdd_ctx, false); + + status = cds_sched_close(hdd_ctx->pcds_context); if (!QDF_IS_STATUS_SUCCESS(status)) { hddLog(QDF_TRACE_LEVEL_FATAL, FL("Failed to close CDS Scheduler")); QDF_ASSERT(QDF_IS_STATUS_SUCCESS(status)); } - cds_close(hdd_ctx->pcds_context); err_exit_nl_srv: hdd_exit_netlink_services(hdd_ctx); @@ -7128,6 +7463,8 @@ err_exit_nl_srv: } cds_deinit_ini_config(); err_hdd_free_context: + qdf_mc_timer_destroy(&hdd_ctx->iface_change_timer); + mutex_destroy(&hdd_ctx->iface_change_lock); hdd_context_destroy(hdd_ctx); QDF_BUG(1); @@ -7139,7 +7476,28 @@ success: } /** - * hdd_register_cb() - Register HDD callbacks. + * hdd_wlan_update_target_info() - update target type info + * @hdd_ctx: HDD context + * @context: hif context + * + * Update target info received from firmware in hdd context + * Return:None + */ + +void hdd_wlan_update_target_info(hdd_context_t *hdd_ctx, void *context) +{ + struct hif_target_info *tgt_info = hif_get_target_info_handle(context); + + if (!tgt_info) { + hdd_err("Target info is Null"); + return; + } + + hdd_ctx->target_type = tgt_info->target_type; +} + +/** + * hdd_register_cb - Register HDD callbacks. * @hdd_ctx: HDD context * * Register the HDD callbacks to CDS/SME. @@ -8040,7 +8398,7 @@ static int __hdd_module_init(void) { int ret = 0; - pr_info("%s: Loading driver v%s\n", WLAN_MODULE_NAME, + pr_err("%s: Loading driver v%s\n", WLAN_MODULE_NAME, QWLAN_VERSIONSTR TIMER_MANAGER_STR MEMORY_DEBUG_STR); pld_init(); @@ -8083,96 +8441,192 @@ static void __hdd_module_exit(void) return; } +#ifndef MODULE /** - * hdd_module_init() - Init Function + * wlan_boot_cb() - Wlan boot callback + * @kobj: object whose directory we're creating the link in. + * @attr: attribute the user is interacting with + * @buff: the buffer containing the user data + * @count: number of bytes in the buffer * - * This is the driver entry point (invoked when module is loaded using insmod) + * This callback is invoked when the fs is ready to start the + * wlan driver initialization. * - * Return: 0 for success, non zero for failure + * Return: 'count' on success or a negative error code in case of failure */ -#ifdef MODULE -static int __init hdd_module_init(void) -{ - return __hdd_module_init(); -} -#else /* #ifdef MODULE */ -static int __init hdd_module_init(void) +static ssize_t wlan_boot_cb(struct kobject *kobj, + struct kobj_attribute *attr, + const char *buf, + size_t count) { - /* Driver initialization is delayed to fwpath_changed_handler */ - return 0; + + int ret = 0; + + if (wlan_loader->loaded_state) { + pr_info("Wlan driver already initialized"); + return 0; + } + + + pr_err("%s: Loading driver v%s\n", WLAN_MODULE_NAME, + QWLAN_VERSIONSTR TIMER_MANAGER_STR MEMORY_DEBUG_STR); + + if (__hdd_module_init()) { + pr_err("%s: Failed to register handler\n", __func__); + ret = -EINVAL; + } else + wlan_loader->loaded_state = MODULE_INITIALIZED; + + return count; + } -#endif /* #ifdef MODULE */ /** - * hdd_module_exit() - Exit function + * wlan_init_sysfs() - Creates the sysfs to be invoked when the fs is + * ready * - * This is the driver exit point (invoked when module is unloaded using rmmod) + * This is creates the syfs entry boot_wlan. Which shall be invoked + * when the filesystem is ready. * * Return: None */ -static void __exit hdd_module_exit(void) +static int wlan_init_sysfs(void) { - __hdd_module_exit(); + int ret = -EINVAL; + + wlan_loader = kzalloc(sizeof(*wlan_loader), GFP_KERNEL); + if (!wlan_loader) { + pr_err("%s: memory alloc failed\n", __func__); + ret = -ENOMEM; + return ret; + } + + wlan_loader->boot_wlan_obj = NULL; + wlan_loader->attr_group = kzalloc(sizeof(*(wlan_loader->attr_group)), + GFP_KERNEL); + if (!wlan_loader->attr_group) { + pr_err("%s: malloc attr_group failed\n", __func__); + ret = -ENOMEM; + goto error_return; + } + + wlan_loader->loaded_state = 0; + wlan_loader->attr_group->attrs = attrs; + + wlan_loader->boot_wlan_obj = kobject_create_and_add("boot_wlan", + kernel_kobj); + if (!wlan_loader->boot_wlan_obj) { + pr_err("%s: sysfs create and add failed\n", __func__); + ret = -ENOMEM; + goto error_return; + } + + ret = sysfs_create_group(wlan_loader->boot_wlan_obj, + wlan_loader->attr_group); + if (ret) { + pr_err("%s: sysfs create group failed %d\n", __func__, ret); + goto error_return; + } + + return 0; + +error_return: + + if (wlan_loader->boot_wlan_obj) { + kobject_del(wlan_loader->boot_wlan_obj); + wlan_loader->boot_wlan_obj = NULL; + } + + return ret; } -#ifdef MODULE -static int fwpath_changed_handler(const char *kmessage, struct kernel_param *kp) +/** + * wlan_deinit_sysfs() - Removes the sysfs created to initialize the wlan + * + * Return: 0 on success or errno on failure + */ +static int wlan_deinit_sysfs(void) { - return param_set_copystring(kmessage, kp); + + if (!wlan_loader) { + hdd_alert("wlan loader context is Null!"); + return -EINVAL; + } + + if (wlan_loader->boot_wlan_obj) { + sysfs_remove_group(wlan_loader->boot_wlan_obj, + wlan_loader->attr_group); + kobject_del(wlan_loader->boot_wlan_obj); + wlan_loader->boot_wlan_obj = NULL; + } + + return 0; } -#else /* #ifdef MODULE */ +#endif + +#ifdef MODULE /** - * kickstart_driver() - driver entry point + * __hdd_module_init - Module init helper * - * This is the driver entry point - * - delayed driver initialization when driver is statically linked - * - invoked when module parameter fwpath is modified from userspace to signal - * initializing the WLAN driver or when con_mode is modified from userspace - * to signal a switch in operating mode + * Module init helper function used by both module and static driver. * - * Return: 0 for success, non zero for failure + * Return: 0 for success, errno on failure */ -static int kickstart_driver(void) +static int hdd_module_init(void) { int ret = 0; - if (!wlan_hdd_inited) { - ret = __hdd_module_init(); - wlan_hdd_inited = ret ? 0 : 1; + pr_err("%s: Loading driver v%s\n", WLAN_MODULE_NAME, + QWLAN_VERSIONSTR TIMER_MANAGER_STR MEMORY_DEBUG_STR); - return ret; + if (__hdd_module_init()) { + pr_err("%s: Failed to register handler\n", __func__); + ret = -EINVAL; } - __hdd_module_exit(); - - msleep(200); - - ret = __hdd_module_init(); + return ret; +} +#else +static int __init hdd_module_init(void) +{ + int ret = -EINVAL; - wlan_hdd_inited = ret ? 0 : 1; + ret = wlan_init_sysfs(); + if (!ret) + pr_err("Failed to create sysfs entry for loading wlan"); return ret; } +#endif + +#ifdef MODULE /** - * fwpath_changed_handler() - Handler Function + * hdd_module_exit() - Exit function * - * Handle changes to the fwpath parameter + * This is the driver exit point (invoked when module is unloaded using rmmod) * - * Return: 0 for success, non zero for failure + * Return: None */ -static int fwpath_changed_handler(const char *kmessage, struct kernel_param *kp) +static void __exit hdd_module_exit(void) { - int ret; + __hdd_module_exit(); +} +#else +static void __exit hdd_module_exit(void) +{ + __hdd_module_exit(); + wlan_deinit_sysfs(); +} +#endif - ret = param_set_copystring(kmessage, kp); - if (0 == ret) - ret = kickstart_driver(); - return ret; +static int fwpath_changed_handler(const char *kmessage, struct kernel_param *kp) +{ + return param_set_copystring(kmessage, kp); } -#ifdef QCA_WIFI_FTM + /** * con_mode_handler() - Handles module param con_mode change * @@ -8185,14 +8639,82 @@ static int fwpath_changed_handler(const char *kmessage, struct kernel_param *kp) static int con_mode_handler(const char *kmessage, struct kernel_param *kp) { int ret; + hdd_context_t *hdd_ctx; + hdd_adapter_t *adapter; + qdf_device_t qdf_dev = cds_get_context(QDF_MODULE_ID_QDF_DEVICE); + QDF_STATUS status; + hdd_info("con_mode handler: %s", kmessage); ret = param_set_int(kmessage, kp); - if (0 == ret) - ret = kickstart_driver(); + + if (!qdf_dev) { + hdd_err("qdf device context is Null return!"); + return -EINVAL; + } + + hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); + if (!hdd_ctx) { + hdd_err("Hdd context Null return!"); + return -EINVAL; + } + mutex_lock(&hdd_ctx->iface_change_lock); + ret = hdd_wlan_stop_modules(hdd_ctx, false); + mutex_unlock(&hdd_ctx->iface_change_lock); + if (ret) { + hdd_err("Stop wlan modules failed"); + return -EINVAL; + } + + adapter = hdd_get_adapter(hdd_ctx, QDF_STA_MODE); + if (!adapter) { + hdd_err("Failed to get station adapter"); + return -EINVAL; + } + + if (con_mode == QDF_GLOBAL_FTM_MODE) { + adapter->device_mode = QDF_FTM_MODE; + hdd_set_conparam(QDF_GLOBAL_FTM_MODE); + } else if (con_mode == QDF_GLOBAL_MONITOR_MODE) { + adapter->wdev.iftype = NL80211_IFTYPE_MONITOR; + adapter->device_mode = QDF_MONITOR_MODE; + hdd_set_conparam(QDF_GLOBAL_MONITOR_MODE); + hdd_set_station_ops(adapter->dev); + } else if (con_mode == QDF_GLOBAL_EPPING_MODE) { + hdd_set_conparam(QDF_GLOBAL_EPPING_MODE); + status = epping_open(); + if (status != QDF_STATUS_SUCCESS) { + hdd_err("Failed to open in eeping mode: %d", status); + return -EINVAL; + } + ret = epping_enable(qdf_dev->dev); + if (ret) { + hdd_err("Failed to enable in epping mode : %d", ret); + epping_close(); + return -EINVAL; + } + hdd_info("epping mode successfully enabled"); + return 0; + } else { + hdd_info("Con mode not supported"); + return -EINVAL; + } + + ret = hdd_wlan_start_modules(hdd_ctx, adapter, false); + if (ret) { + hdd_err("Start wlan modules failed: %d", ret); + return -EINVAL; + } + + if (hdd_start_adapter(adapter)) { + hdd_err("Failed to start %s adapter", kmessage); + return -EINVAL; + } else { + hdd_info("Mode successfully changed to %s", kmessage); + ret = 0; + } + return ret; } -#endif /* QCA_WIFI_FTM */ -#endif /* #ifdef MODULE */ /** * hdd_get_conparam() - driver exit point @@ -8315,12 +8837,8 @@ MODULE_LICENSE("Dual BSD/GPL"); MODULE_AUTHOR("Qualcomm Atheros, Inc."); MODULE_DESCRIPTION("WLAN HOST DEVICE DRIVER"); -#if !defined(MODULE) && defined(QCA_WIFI_FTM) module_param_call(con_mode, con_mode_handler, param_get_int, &con_mode, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); -#else -module_param(con_mode, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); -#endif module_param_call(fwpath, fwpath_changed_handler, param_get_string, &fwpath, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); diff --git a/core/hdd/src/wlan_hdd_memdump.c b/core/hdd/src/wlan_hdd_memdump.c index 2e13649614fd..cf35c4857f0f 100644 --- a/core/hdd/src/wlan_hdd_memdump.c +++ b/core/hdd/src/wlan_hdd_memdump.c @@ -536,7 +536,6 @@ int memdump_init(void) { hdd_context_t *hdd_ctx; int status = 0; - QDF_STATUS cb_status; QDF_STATUS qdf_status; hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); @@ -550,13 +549,6 @@ int memdump_init(void) return -EINVAL; } - cb_status = sme_fw_mem_dump_register_cb(hdd_ctx->hHal, - wlan_hdd_cfg80211_fw_mem_dump_cb); - if (QDF_STATUS_SUCCESS != cb_status) { - hddLog(LOGE , FL("Failed to register the callback")); - return -EINVAL; - } - status = memdump_procfs_init(); if (status) { hddLog(LOGE , FL("Failed to create proc file")); diff --git a/core/hdd/src/wlan_hdd_oemdata.c b/core/hdd/src/wlan_hdd_oemdata.c index 1601ce3032a4..ffa0934207f0 100644 --- a/core/hdd/src/wlan_hdd_oemdata.c +++ b/core/hdd/src/wlan_hdd_oemdata.c @@ -295,28 +295,29 @@ static void send_oem_err_rsp_nlink_msg(int32_t app_pid, uint8_t error_code) /** * hdd_send_oem_data_rsp_msg() - send oem data response - * @length: length of the OEM Data Response message - * @oemDataRsp: the actual OEM Data Response message + * @oem_data_rsp: the actual OEM Data Response message * * This function sends an OEM Data Response message to a registered * application process over the netlink socket. * * Return: 0 for success, non zero for failure */ -void hdd_send_oem_data_rsp_msg(int length, uint8_t *oemDataRsp) +void hdd_send_oem_data_rsp_msg(struct oem_data_rsp *oem_data_rsp) { struct sk_buff *skb; struct nlmsghdr *nlh; - tAniMsgHdr *aniHdr; - uint8_t *oemData; + tAniMsgHdr *ani_hdr; + uint8_t *oem_data; - /* OEM message is always to a specific process and cannot be a broadcast */ + /* + * OEM message is always to a specific process and cannot be a broadcast + */ if (p_hdd_ctx->oem_pid == 0) { hdd_err("invalid dest pid"); return; } - if (length > OEM_DATA_RSP_SIZE) { + if (oem_data_rsp->rsp_len > OEM_DATA_RSP_SIZE) { hdd_err("invalid length of Oem Data response"); return; } @@ -333,18 +334,18 @@ void hdd_send_oem_data_rsp_msg(int length, uint8_t *oemDataRsp) nlh->nlmsg_flags = 0; nlh->nlmsg_seq = 0; nlh->nlmsg_type = WLAN_NL_MSG_OEM; - aniHdr = NLMSG_DATA(nlh); - aniHdr->type = ANI_MSG_OEM_DATA_RSP; + ani_hdr = NLMSG_DATA(nlh); + ani_hdr->type = ANI_MSG_OEM_DATA_RSP; - aniHdr->length = length; - nlh->nlmsg_len = NLMSG_LENGTH((sizeof(tAniMsgHdr) + aniHdr->length)); - oemData = (uint8_t *) ((char *)aniHdr + sizeof(tAniMsgHdr)); - qdf_mem_copy(oemData, oemDataRsp, length); + ani_hdr->length = oem_data_rsp->rsp_len; + nlh->nlmsg_len = NLMSG_LENGTH((sizeof(tAniMsgHdr) + ani_hdr->length)); + oem_data = (uint8_t *) ((char *)ani_hdr + sizeof(tAniMsgHdr)); + qdf_mem_copy(oem_data, oem_data_rsp->data, oem_data_rsp->rsp_len); - skb_put(skb, NLMSG_SPACE((sizeof(tAniMsgHdr) + aniHdr->length))); + skb_put(skb, NLMSG_SPACE((sizeof(tAniMsgHdr) + ani_hdr->length))); hdd_notice("sending Oem Data Response of len (%d) to process pid (%d)", - length, p_hdd_ctx->oem_pid); + oem_data_rsp->rsp_len, p_hdd_ctx->oem_pid); (void)nl_srv_ucast(skb, p_hdd_ctx->oem_pid, MSG_DONTWAIT); @@ -353,52 +354,48 @@ void hdd_send_oem_data_rsp_msg(int length, uint8_t *oemDataRsp) /** * oem_process_data_req_msg() - process oem data request - * @oemDataLen: Length to OEM Data buffer - * @oemData: Pointer to OEM Data buffer + * @oem_data_len: Length to OEM Data buffer + * @oem_data: Pointer to OEM Data buffer * * This function sends oem message to SME * * Return: QDF_STATUS enumeration */ -static QDF_STATUS oem_process_data_req_msg(int oemDataLen, char *oemData) +static QDF_STATUS oem_process_data_req_msg(int oem_data_len, char *oem_data) { - hdd_adapter_t *pAdapter = NULL; - tOemDataReqConfig oemDataReqConfig; - uint32_t oemDataReqID = 0; + hdd_adapter_t *adapter = NULL; + struct oem_data_req oem_data_req; QDF_STATUS status = QDF_STATUS_SUCCESS; /* for now, STA interface only */ - pAdapter = hdd_get_adapter(p_hdd_ctx, QDF_STA_MODE); - if (!pAdapter) { + adapter = hdd_get_adapter(p_hdd_ctx, QDF_STA_MODE); + if (!adapter) { hdd_err("No adapter for STA mode"); return QDF_STATUS_E_FAILURE; } - if (!oemData) { - hdd_err("oemData is null"); + if (!oem_data) { + hdd_err("oem_data is null"); return QDF_STATUS_E_FAILURE; } - qdf_mem_zero(&oemDataReqConfig, sizeof(tOemDataReqConfig)); + qdf_mem_zero(&oem_data_req, sizeof(oem_data_req)); - oemDataReqConfig.data = qdf_mem_malloc(oemDataLen); - if (!oemDataReqConfig.data) { + oem_data_req.data = qdf_mem_malloc(oem_data_len); + if (!oem_data_req.data) { hdd_err("malloc failed for data req buffer"); return QDF_STATUS_E_NOMEM; } - oemDataReqConfig.data_len = oemDataLen; - qdf_mem_copy(oemDataReqConfig.data, oemData, oemDataLen); + oem_data_req.data_len = oem_data_len; + qdf_mem_copy(oem_data_req.data, oem_data, oem_data_len); hdd_notice("calling sme_oem_data_req"); - status = sme_oem_data_req(p_hdd_ctx->hHal, - pAdapter->sessionId, - &oemDataReqConfig, - &oemDataReqID); + status = sme_oem_data_req(p_hdd_ctx->hHal, &oem_data_req); - qdf_mem_free(oemDataReqConfig.data); - oemDataReqConfig.data = NULL; + qdf_mem_free(oem_data_req.data); + oem_data_req.data = NULL; return status; } diff --git a/core/hdd/src/wlan_hdd_p2p.c b/core/hdd/src/wlan_hdd_p2p.c index 58c790f3b34d..c2f7a4ef9923 100644 --- a/core/hdd/src/wlan_hdd_p2p.c +++ b/core/hdd/src/wlan_hdd_p2p.c @@ -2153,6 +2153,56 @@ int wlan_hdd_del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev) return ret; } +#ifdef WLAN_FEATURE_P2P_DEBUG +/* + * wlan_hdd_p2p_action_debug() - Log P2P state and update global status + * @actionFrmType: action frame type + * @macFrom: peer mac address + * + * return: void + */ +static void wlan_hdd_p2p_action_debug(tActionFrmType actionFrmType, + uint8_t *macFrom) +{ + if (actionFrmType >= MAX_P2P_ACTION_FRAME_TYPE) { + hdd_err("[P2P] unknown[%d] <--- OTA from " MAC_ADDRESS_STR, + actionFrmType, MAC_ADDR_ARRAY(macFrom)); + } else { + hdd_err("[P2P] %s <--- OTA from " MAC_ADDRESS_STR, + p2p_action_frame_type[actionFrmType], + MAC_ADDR_ARRAY(macFrom)); + if ((actionFrmType == WLAN_HDD_PROV_DIS_REQ) + && (global_p2p_connection_status == P2P_NOT_ACTIVE)) { + global_p2p_connection_status = P2P_GO_NEG_PROCESS; + hdd_err("[P2P State]Inactive state to GO negotiation progress state"); + } else + if ((actionFrmType == WLAN_HDD_GO_NEG_CNF) + && (global_p2p_connection_status == P2P_GO_NEG_PROCESS)) { + global_p2p_connection_status = P2P_GO_NEG_COMPLETED; + hdd_err("[P2P State]GO negotiation progress to GO negotiation completed state"); + } else + if ((actionFrmType == WLAN_HDD_INVITATION_REQ) + && (global_p2p_connection_status == P2P_NOT_ACTIVE)) { + global_p2p_connection_status = P2P_GO_NEG_COMPLETED; + hdd_err("[P2P State]Inactive state to GO negotiation completed state Autonomous GO formation"); + } + } +} +#else +/* + * wlan_hdd_p2p_action_debug() - dummy + * @actionFrmType: action frame type + * @macFrom: peer mac address + * + * return: void + */ +static void wlan_hdd_p2p_action_debug(tActionFrmType actionFrmType, + uint8_t *macFrom) +{ + +} +#endif + void __hdd_indicate_mgmt_frame(hdd_adapter_t *pAdapter, uint32_t nFrameLength, uint8_t *pbFrames, @@ -2246,59 +2296,17 @@ void __hdd_indicate_mgmt_frame(hdd_adapter_t *pAdapter, + 2], SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE)) { /* P2P action frames */ - u8 *macFrom = &pbFrames + uint8_t *macFrom = &pbFrames [WLAN_HDD_80211_PEER_ADDR_OFFSET]; actionFrmType = pbFrames [WLAN_HDD_PUBLIC_ACTION_FRAME_TYPE_OFFSET]; hddLog(LOG1, "Rx Action Frame %u", actionFrmType); -#ifdef WLAN_FEATURE_P2P_DEBUG - if (actionFrmType >= MAX_P2P_ACTION_FRAME_TYPE) { - hddLog(QDF_TRACE_LEVEL_ERROR, - "[P2P] unknown[%d] <--- OTA" - " from " MAC_ADDRESS_STR, - actionFrmType, - MAC_ADDR_ARRAY(macFrom)); - } else { - hddLog(QDF_TRACE_LEVEL_ERROR, - "[P2P] %s <--- OTA" " from " - MAC_ADDRESS_STR, - p2p_action_frame_type - [actionFrmType], - MAC_ADDR_ARRAY(macFrom)); - if ((actionFrmType == - WLAN_HDD_PROV_DIS_REQ) - && (global_p2p_connection_status == - P2P_NOT_ACTIVE)) { - global_p2p_connection_status = - P2P_GO_NEG_PROCESS; - hddLog(LOGE, - "[P2P State]Inactive state to " - "GO negotiation progress state"); - } else - if ((actionFrmType == - WLAN_HDD_GO_NEG_CNF) - && (global_p2p_connection_status == - P2P_GO_NEG_PROCESS)) { - global_p2p_connection_status = - P2P_GO_NEG_COMPLETED; - hddLog(LOGE, - "[P2P State]GO negotiation progress to " - "GO negotiation completed state"); - } else - if ((actionFrmType == - WLAN_HDD_INVITATION_REQ) - && (global_p2p_connection_status == - P2P_NOT_ACTIVE)) { - global_p2p_connection_status = - P2P_GO_NEG_COMPLETED; - hddLog(LOGE, - "[P2P State]Inactive state to GO negotiation" - " completed state Autonomous GO formation"); - } - } -#endif + + wlan_hdd_p2p_action_debug(actionFrmType, + macFrom); + mutex_lock(&cfgState->remain_on_chan_ctx_lock); pRemainChanCtx = cfgState->remain_on_chan_ctx; if (pRemainChanCtx != NULL) { diff --git a/core/hdd/src/wlan_hdd_power.c b/core/hdd/src/wlan_hdd_power.c index b0ff6cd6b5a8..a1df43603409 100644 --- a/core/hdd/src/wlan_hdd_power.c +++ b/core/hdd/src/wlan_hdd_power.c @@ -533,14 +533,14 @@ void hdd_conf_hostoffload(hdd_adapter_t *pAdapter, bool fenable) if (((QDF_STA_MODE != pAdapter->device_mode) && (QDF_P2P_CLIENT_MODE != pAdapter->device_mode))) { - hdd_err("Offloads not supported in mode %d", + hdd_info("Offloads not supported in mode %d", pAdapter->device_mode); return; } if (eConnectionState_Associated != (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState) { - hdd_err("Offloads not supported in state %d", + hdd_info("Offloads not supported in state %d", (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))-> conn_info.connState); return; @@ -1299,7 +1299,6 @@ static void hdd_ssr_timer_start(int msec) */ QDF_STATUS hdd_wlan_shutdown(void) { - QDF_STATUS qdf_status; v_CONTEXT_t p_cds_context = NULL; hdd_context_t *pHddCtx; p_cds_sched_context cds_sched_context = NULL; @@ -1350,76 +1349,8 @@ QDF_STATUS hdd_wlan_shutdown(void) } #endif - /* Stop all the threads; we do not want any messages to be a processed, - * any more and the best way to ensure that is to terminate the threads - * gracefully. - */ - /* Wait for MC to exit */ - hdd_alert("Shutting down MC thread"); - set_bit(MC_SHUTDOWN_EVENT_MASK, &cds_sched_context->mcEventFlag); - set_bit(MC_POST_EVENT_MASK, &cds_sched_context->mcEventFlag); - wake_up_interruptible(&cds_sched_context->mcWaitQueue); - wait_for_completion(&cds_sched_context->McShutdown); - -#ifdef QCA_CONFIG_SMP - /* Wait for OL RX to exit */ - hdd_alert("Shutting down OL RX thread"); - unregister_hotcpu_notifier(cds_sched_context->cpu_hot_plug_notifier); - set_bit(RX_SHUTDOWN_EVENT_MASK, &cds_sched_context->ol_rx_event_flag); - set_bit(RX_POST_EVENT_MASK, &cds_sched_context->ol_rx_event_flag); - wake_up_interruptible(&cds_sched_context->ol_rx_wait_queue); - wait_for_completion(&cds_sched_context->ol_rx_shutdown); - cds_sched_context->ol_rx_thread = NULL; - cds_drop_rxpkt_by_staid(cds_sched_context, WLAN_MAX_STA_COUNT); - cds_free_ol_rx_pkt_freeq(cds_sched_context); -#endif - - hdd_alert("Doing WMA STOP"); - qdf_status = wma_stop(p_cds_context, HAL_STOP_TYPE_RF_KILL); - - if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { - QDF_TRACE(QDF_MODULE_ID_QDF, LOGE, - "%s: Failed to stop WMA", __func__); - QDF_ASSERT(QDF_IS_STATUS_SUCCESS(qdf_status)); - wma_setneedshutdown(p_cds_context); - } - - hdd_alert("Doing SME STOP"); - /* Stop SME - Cannot invoke cds_disable as cds_disable relies - * on threads being running to process the SYS Stop - */ - qdf_status = sme_stop(pHddCtx->hHal, HAL_STOP_TYPE_SYS_RESET); - if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { - QDF_TRACE(QDF_MODULE_ID_QDF, LOGE, - "%s: Failed to stop sme %d", __func__, qdf_status); - QDF_ASSERT(0); - } - - hdd_alert("Doing MAC STOP"); - /* Stop MAC (PE and HAL) */ - qdf_status = mac_stop(pHddCtx->hHal, HAL_STOP_TYPE_SYS_RESET); - if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { - QDF_TRACE(QDF_MODULE_ID_QDF, LOGE, - "%s: Failed to stop mac %d", __func__, qdf_status); - QDF_ASSERT(0); - } - - hdd_notice("Flush Queues"); - /* Clean up message queues of TX, RX and MC thread */ - cds_sched_flush_mc_mqs(cds_sched_context); - - /* Deinit all the TX, RX and MC queues */ - cds_sched_deinit_mqs(cds_sched_context); - - hdd_notice("Doing CDS Shutdown"); - /* shutdown CDS */ - cds_shutdown(p_cds_context); - - /*mac context has already been released in mac_close call - so setting it to NULL in hdd context */ - pHddCtx->hHal = (tHalHandle) NULL; - wlansap_global_deinit(); + hdd_wlan_stop_modules(pHddCtx, true); hdd_alert("WLAN driver shutdown complete"); return QDF_STATUS_SUCCESS; @@ -1433,14 +1364,14 @@ QDF_STATUS hdd_wlan_shutdown(void) * Return: QDF_STATUS_SUCCESS if the driver was re-initialized, * or an error status otherwise */ -QDF_STATUS hdd_wlan_re_init(void *hif_sc) +QDF_STATUS hdd_wlan_re_init(void) { - QDF_STATUS qdf_status; + v_CONTEXT_t p_cds_context = NULL; hdd_context_t *pHddCtx = NULL; - QDF_STATUS qdf_ret_status; hdd_adapter_t *pAdapter; - int i, ret; + QDF_STATUS qdf_status; + int ret; hdd_prevent_suspend(WIFI_POWER_EVENT_WAKELOCK_DRIVER_REINIT); @@ -1458,93 +1389,8 @@ QDF_STATUS hdd_wlan_re_init(void *hif_sc) goto err_re_init; } - if (!hif_sc) { - hdd_alert("hif_sc is NULL"); - goto err_re_init; - } - - ((cds_context_type *) p_cds_context)->pHIFContext = hif_sc; - /* The driver should always be initialized in STA mode after SSR */ hdd_set_conparam(0); - - ret = hdd_update_config(pHddCtx); - if (ret) - goto err_re_init; - - /* Re-open CDS, it is a re-open b'se control transport was never closed. */ - qdf_status = cds_open(); - if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { - hdd_alert("cds_open failed"); - goto err_re_init; - } - - /* Save the hal context in Adapter */ - pHddCtx->hHal = cds_get_context(QDF_MODULE_ID_SME); - if (NULL == pHddCtx->hHal) { - hdd_alert("HAL context is null"); - goto err_cds_close; - } - - qdf_status = cds_pre_enable(pHddCtx->pcds_context); - if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { - hdd_alert("cds_pre_enable failed"); - goto err_cds_close; - } - - /* - * Note that the cds_pre_enable() sequence triggers the cfg download. - * The cfg download must occur before we update the SME config - * since the SME config operation must access the cfg database. - * Set the SME configuration parameters. - */ - qdf_status = hdd_set_sme_config(pHddCtx); - if (QDF_STATUS_SUCCESS != qdf_status) { - hdd_alert("Failed hdd_set_sme_config"); - goto err_cds_close; - } - - ol_txrx_register_pause_cb(wlan_hdd_txrx_pause_cb); - - qdf_status = hdd_set_sme_chan_list(pHddCtx); - if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { - hdd_alert("Failed to init channel list"); - goto err_cds_close; - } - - /* Apply the cfg.ini to cfg.dat */ - if (false == hdd_update_config_dat(pHddCtx)) { - hdd_alert("config update failed"); - goto err_cds_close; - } - - /* Set the MAC Address, currently this is used by HAL to add self sta. - * Remove this once self sta is added as part of session open. */ - qdf_ret_status = cfg_set_str(pHddCtx->hHal, WNI_CFG_STA_ID, - (uint8_t *) &pHddCtx->config-> - intfMacAddr[0], - sizeof(pHddCtx->config->intfMacAddr[0])); - if (!QDF_IS_STATUS_SUCCESS(qdf_ret_status)) { - hdd_err("Failed to set MAC Address. " - "HALStatus is %08d [x%08x]", qdf_ret_status, - qdf_ret_status); - goto err_cds_close; - } - - /* Start CDS which starts up the SME/MAC/HAL modules and everything else - Note: Firmware image will be read and downloaded inside cds_enable API */ - qdf_status = cds_enable(p_cds_context); - if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { - hdd_alert("cds_enable failed"); - goto err_cds_close; - } - - qdf_status = hdd_post_cds_enable_config(pHddCtx); - if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { - hdd_alert("hdd_post_cds_enable_config failed"); - goto err_cds_disable; - } - /* Try to get an adapter from mode ID */ pAdapter = hdd_get_adapter(pHddCtx, QDF_STA_MODE); if (!pAdapter) { @@ -1560,6 +1406,12 @@ QDF_STATUS hdd_wlan_re_init(void *hif_sc) if (pHddCtx->config->enable_dp_trace) qdf_dp_trace_init(); + ret = hdd_wlan_start_modules(pHddCtx, pAdapter, true); + if (ret) { + hdd_err("Failed to start wlan after error"); + goto err_wiphy_unregister; + } + if (hdd_ipa_uc_ssr_reinit()) hdd_err("HDD IPA UC reinit failed"); @@ -1568,50 +1420,6 @@ QDF_STATUS hdd_wlan_re_init(void *hif_sc) /* Restart all adapters */ hdd_start_all_adapters(pHddCtx); - /* Reconfigure FW logs after SSR */ - if (pAdapter) { - if (pHddCtx->fw_log_settings.enable != 0) { - wma_cli_set_command(pAdapter->sessionId, - WMI_DBGLOG_MODULE_ENABLE, - pHddCtx->fw_log_settings.enable, - DBG_CMD); - } else { - wma_cli_set_command(pAdapter->sessionId, - WMI_DBGLOG_MODULE_DISABLE, - pHddCtx->fw_log_settings.enable, - DBG_CMD); - } - - if (pHddCtx->fw_log_settings.dl_report != 0) { - wma_cli_set_command(pAdapter->sessionId, - WMI_DBGLOG_REPORT_ENABLE, - pHddCtx->fw_log_settings. - dl_report, DBG_CMD); - - wma_cli_set_command(pAdapter->sessionId, - WMI_DBGLOG_TYPE, - pHddCtx->fw_log_settings. - dl_type, DBG_CMD); - - wma_cli_set_command(pAdapter->sessionId, - WMI_DBGLOG_LOG_LEVEL, - pHddCtx->fw_log_settings. - dl_loglevel, DBG_CMD); - - for (i = 0; i < MAX_MOD_LOGLEVEL; i++) { - if (pHddCtx->fw_log_settings. - dl_mod_loglevel[i] != 0) { - wma_cli_set_command( - pAdapter->sessionId, - WMI_DBGLOG_MOD_LOG_LEVEL, - pHddCtx->fw_log_settings. - dl_mod_loglevel[i], - DBG_CMD); - } - } - } - } - pHddCtx->hdd_mcastbcast_filter_set = false; pHddCtx->btCoexModeSet = false; hdd_ssr_timer_del(); @@ -1639,16 +1447,13 @@ QDF_STATUS hdd_wlan_re_init(void *hif_sc) goto success; err_cds_disable: - cds_disable(p_cds_context); + hdd_wlan_stop_modules(pHddCtx, true); -err_cds_close: - cds_close(p_cds_context); - cds_sched_close(p_cds_context); +err_wiphy_unregister: if (pHddCtx) { /* Unregister the Net Device Notifier */ unregister_netdevice_notifier(&hdd_netdev_notifier); ptt_sock_deactivate_svc(); - nl_srv_exit(); /* Free up dynamically allocated members inside HDD Adapter */ @@ -1656,13 +1461,7 @@ err_cds_close: pHddCtx->config = NULL; wlan_hdd_deinit_tx_rx_histogram(pHddCtx); wiphy_unregister(pHddCtx->wiphy); - wlan_hdd_cfg80211_deinit(pHddCtx->wiphy); wiphy_free(pHddCtx->wiphy); - - if (!QDF_IS_STATUS_SUCCESS(cds_deinit_policy_mgr())) { - hdd_err("Failed to deinit policy manager"); - /* Proceed and complete the clean up */ - } } err_re_init: @@ -1763,6 +1562,14 @@ static int __wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy) result = wlan_hdd_validate_context(pHddCtx); if (0 != result) return result; + + mutex_lock(&pHddCtx->iface_change_lock); + if (pHddCtx->driver_status != DRIVER_MODULES_ENABLED) { + mutex_unlock(&pHddCtx->iface_change_lock); + hdd_info("Driver Module not enabled return success"); + return 0; + } + mutex_unlock(&pHddCtx->iface_change_lock); pld_request_bus_bandwidth(pHddCtx->parent_dev, PLD_BUS_WIDTH_MEDIUM); /* Resume MC thread */ @@ -1897,6 +1704,14 @@ static int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, if (0 != rc) return rc; + mutex_lock(&pHddCtx->iface_change_lock); + if (pHddCtx->driver_status != DRIVER_MODULES_ENABLED) { + mutex_unlock(&pHddCtx->iface_change_lock); + hdd_info("Driver Modules not Enabled "); + return 0; + } + mutex_unlock(&pHddCtx->iface_change_lock); + /* If RADAR detection is in progress (HDD), prevent suspend. The flag * "dfs_cac_block_tx" is set to true when RADAR is found and stay true * until CAC is done for a SoftAP which is in started state. diff --git a/core/hdd/src/wlan_hdd_tdls.c b/core/hdd/src/wlan_hdd_tdls.c index a96d9c5079e2..9c7d52e73ced 100644 --- a/core/hdd/src/wlan_hdd_tdls.c +++ b/core/hdd/src/wlan_hdd_tdls.c @@ -2456,19 +2456,17 @@ void wlan_hdd_tdls_connection_callback(hdd_adapter_t *pAdapter) */ void wlan_hdd_tdls_disconnection_callback(hdd_adapter_t *pAdapter) { - tdlsCtx_t *pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); - hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); - - if ((NULL == pHddCtx) || (NULL == pHddTdlsCtx)) { - QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR, - FL("pHddCtx or pHddTdlsCtx points to NULL")); - return; - } + tdlsCtx_t *pHddTdlsCtx; + hdd_context_t *pHddCtx; hddLog(LOG1, "%s", __func__); + pHddCtx = WLAN_HDD_GET_CTX(pAdapter); + if (0 != wlan_hdd_validate_context(pHddCtx)) + return; mutex_lock(&pHddCtx->tdls_lock); + pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); if (NULL == pHddTdlsCtx) { mutex_unlock(&pHddCtx->tdls_lock); QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR, diff --git a/core/hdd/src/wlan_hdd_wext.c b/core/hdd/src/wlan_hdd_wext.c index 9023070a1895..315ee630f119 100644 --- a/core/hdd/src/wlan_hdd_wext.c +++ b/core/hdd/src/wlan_hdd_wext.c @@ -89,6 +89,10 @@ #include "cdp_txrx_flow_ctrl_legacy.h" #include "wlan_hdd_nan_datapath.h" #include "wlan_hdd_stats.h" +#ifdef WLAN_SUSPEND_RESUME_TEST +#include "wlan_hdd_driver_ops.h" +#include "hif.h" +#endif #define HDD_FINISH_ULA_TIME_OUT 800 #define HDD_SET_MCBC_FILTERS_TO_FW 1 @@ -434,6 +438,11 @@ static const hdd_freq_chan_map_t freq_chan_map[] = { #define WE_ENABLE_FW_PROFILE 4 #define WE_SET_FW_PROFILE_HIST_INTVL 5 +#ifdef WLAN_SUSPEND_RESUME_TEST +#define WE_SET_WLAN_SUSPEND 6 +#define WE_SET_WLAN_RESUME 7 +#endif + /* (SIOCIWFIRSTPRIV + 29) is currently unused */ /* 802.11p IOCTL */ @@ -7567,22 +7576,24 @@ static int __iw_setnone_getnone(struct net_device *dev, { hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(adapter); + tSirMacAddr bssid; uint32_t roamId = 0; + uint8_t operating_ch = + adapter->sessionCtx.station.conn_info.operationChannel; tCsrRoamModifyProfileFields modProfileFields; - hdd_station_ctx_t *hdd_sta_ctx = - WLAN_HDD_GET_STATION_CTX_PTR(adapter); - - /* Reassoc to same AP, only supported for Open Security*/ - if ((hdd_sta_ctx->conn_info.ucEncryptionType || - hdd_sta_ctx->conn_info.mcEncryptionType)) { - hdd_err("Reassoc to same AP, only supported for Open Security"); - return -ENOTSUPP; - } sme_get_modify_profile_fields(hHal, adapter->sessionId, &modProfileFields); - sme_roam_reassoc(hHal, adapter->sessionId, - NULL, modProfileFields, &roamId, 1); + if (roaming_offload_enabled(hdd_ctx)) { + qdf_mem_copy(bssid, + &adapter->sessionCtx.station.conn_info.bssId, + sizeof(bssid)); + hdd_wma_send_fastreassoc_cmd((int)adapter->sessionId, + bssid, operating_ch); + } else { + sme_roam_reassoc(hdd_ctx->hHal, adapter->sessionId, + NULL, modProfileFields, &roamId, 1); + } return 0; } @@ -9587,6 +9598,25 @@ static int wlan_hdd_set_mon_chan(hdd_adapter_t *adapter, uint32_t chan, return qdf_status_to_os_return(status); } +#ifdef WLAN_SUSPEND_RESUME_TEST +static void *g_wiphy; + +/** + * hdd_wlan_trigger_resume() - resume wlan + * @val: interrupt val + * + * Resume wlan after getting very 1st CE interrupt from target + * + * Return: none + */ +static void hdd_wlan_trigger_resume(uint32_t val) +{ + hdd_err("Resume WLAN val 0x%x", val); + wlan_hdd_bus_resume(); + wlan_hdd_cfg80211_resume_wlan(g_wiphy); +} +#endif + static int __iw_set_two_ints_getnone(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) @@ -9596,6 +9626,10 @@ static int __iw_set_two_ints_getnone(struct net_device *dev, int sub_cmd = value[0]; int ret; hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); +#ifdef WLAN_SUSPEND_RESUME_TEST + pm_message_t state; +#endif + ENTER_DEV(dev); @@ -9659,6 +9693,21 @@ static int __iw_set_two_ints_getnone(struct net_device *dev, case WE_SET_MON_MODE_CHAN: ret = wlan_hdd_set_mon_chan(pAdapter, value[1], value[2]); break; +#ifdef WLAN_SUSPEND_RESUME_TEST + case WE_SET_WLAN_SUSPEND: + hdd_err("Suspend WLAN"); + g_wiphy = hdd_ctx->wiphy; + state.event = PM_EVENT_SUSPEND; + ret = wlan_hdd_cfg80211_suspend_wlan(hdd_ctx->wiphy, NULL); + wlan_hdd_bus_suspend(state); + hif_fake_apps_suspend(hdd_wlan_trigger_resume); + break; + case WE_SET_WLAN_RESUME: + hdd_err("Resume WLAN"); + wlan_hdd_bus_resume(); + ret = wlan_hdd_cfg80211_resume_wlan(hdd_ctx->wiphy); + break; +#endif default: hdd_err("Invalid IOCTL command %d", sub_cmd); break; @@ -10871,6 +10920,16 @@ static const struct iw_priv_args we_private_args[] = { 0, "crash_inject"} , #endif +#ifdef WLAN_SUSPEND_RESUME_TEST + {WE_SET_WLAN_SUSPEND, + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, + 0, "wlan_suspend"} + , + {WE_SET_WLAN_RESUME, + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, + 0, "wlan_resume"} + , +#endif {WE_ENABLE_FW_PROFILE, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, 0, "enableProfile"} diff --git a/core/mac/inc/ani_global.h b/core/mac/inc/ani_global.h index c51afa2d247e..3058535da0e9 100644 --- a/core/mac/inc/ani_global.h +++ b/core/mac/inc/ani_global.h @@ -47,10 +47,6 @@ #include "sap_api.h" #include "csr_internal.h" -#ifdef FEATURE_OEM_DATA_SUPPORT -#include "oem_data_internal.h" -#endif - #include "sme_rrm_internal.h" #include "rrm_global.h" #include "p2p_api.h" @@ -815,11 +811,6 @@ typedef struct sAniSirLim { uint8_t gSmeSessionId; uint16_t gTransactionId; -#ifdef FEATURE_OEM_DATA_SUPPORT - tLimMlmOemDataReq *gpLimMlmOemDataReq; - tLimMlmOemDataRsp *gpLimMlmOemDataRsp; -#endif - tSirRemainOnChnReq *gpLimRemainOnChanReq; /* hold remain on chan request in this buf */ qdf_mutex_t lim_frame_register_lock; qdf_list_t gLimMgmtFrameRegistratinQueue; @@ -935,9 +926,6 @@ typedef struct sAniSirGlobal { tCsrScanStruct scan; tCsrRoamStruct roam; -#ifdef FEATURE_OEM_DATA_SUPPORT - tOemDataStruct oemData; -#endif tRrmContext rrm; #ifdef WLAN_FEATURE_CONCURRENT_P2P tp2pContext p2pContext[MAX_NO_OF_P2P_SESSIONS]; diff --git a/core/mac/inc/qwlan_version.h b/core/mac/inc/qwlan_version.h index 4338c254c49a..df4126e35517 100644 --- a/core/mac/inc/qwlan_version.h +++ b/core/mac/inc/qwlan_version.h @@ -41,9 +41,9 @@ #define QWLAN_VERSION_MAJOR 5 #define QWLAN_VERSION_MINOR 1 #define QWLAN_VERSION_PATCH 0 -#define QWLAN_VERSION_EXTRA "P" +#define QWLAN_VERSION_EXTRA "Y" #define QWLAN_VERSION_BUILD 22 -#define QWLAN_VERSIONSTR "5.1.0.22P" +#define QWLAN_VERSIONSTR "5.1.0.22Y" #endif /* QWLAN_VERSION_H */ diff --git a/core/mac/inc/sir_api.h b/core/mac/inc/sir_api.h index a7e85efd5185..3e882ca20a5d 100644 --- a/core/mac/inc/sir_api.h +++ b/core/mac/inc/sir_api.h @@ -882,23 +882,15 @@ typedef struct sSirSmeScanChanReq { } tSirSmeGetScanChanReq, *tpSirSmeGetScanChanReq; #ifdef FEATURE_OEM_DATA_SUPPORT - -typedef struct sSirOemDataReq { - uint16_t messageType; /* eWNI_SME_OEM_DATA_REQ */ - uint16_t messageLen; - struct qdf_mac_addr selfMacAddr; +struct oem_data_req { uint32_t data_len; uint8_t *data; -} tSirOemDataReq, *tpSirOemDataReq; +}; -typedef struct sSirOemDataRsp { - uint16_t messageType; - uint16_t length; - bool target_rsp; +struct oem_data_rsp { uint32_t rsp_len; - uint8_t *oem_data_rsp; -} tSirOemDataRsp, *tpSirOemDataRsp; - + uint8_t *data; +}; #endif /* FEATURE_OEM_DATA_SUPPORT */ #ifdef FEATURE_WLAN_ESE diff --git a/core/mac/inc/wni_api.h b/core/mac/inc/wni_api.h index c8e5cf1ae3ec..c338a648dbc3 100644 --- a/core/mac/inc/wni_api.h +++ b/core/mac/inc/wni_api.h @@ -55,10 +55,6 @@ enum eWniMsgTypes { eWNI_SME_SCAN_REQ, eWNI_SME_SCAN_ABORT_IND, eWNI_SME_SCAN_RSP, -#ifdef FEATURE_OEM_DATA_SUPPORT - eWNI_SME_OEM_DATA_REQ, - eWNI_SME_OEM_DATA_RSP, -#endif eWNI_SME_JOIN_REQ, eWNI_SME_JOIN_RSP, eWNI_SME_SETCONTEXT_REQ, diff --git a/core/mac/src/pe/lim/lim_api.c b/core/mac/src/pe/lim/lim_api.c index f450afb4d8d6..e418fd95554b 100644 --- a/core/mac/src/pe/lim/lim_api.c +++ b/core/mac/src/pe/lim/lim_api.c @@ -257,8 +257,6 @@ static void __lim_init_vars(tpAniSirGlobal pMac) pMac->lim.gScanInPowersave = 0; pMac->lim.probeCounter = 0; pMac->lim.maxProbe = 0; - - pMac->lim.gpLimMlmOemDataReq = NULL; } static void __lim_init_assoc_vars(tpAniSirGlobal pMac) @@ -781,16 +779,6 @@ tSirRetStatus pe_close(tpAniSirGlobal pMac) qdf_mem_free(pMac->lim.limTimers.gpLimCnfWaitTimer); pMac->lim.limTimers.gpLimCnfWaitTimer = NULL; - if (pMac->lim.gpLimMlmOemDataReq) { - if (pMac->lim.gpLimMlmOemDataReq->data) { - qdf_mem_free( - pMac->lim.gpLimMlmOemDataReq->data); - pMac->lim.gpLimMlmOemDataReq->data = NULL; - } - qdf_mem_free(pMac->lim.gpLimMlmOemDataReq); - pMac->lim.gpLimMlmOemDataReq = NULL; - } - qdf_mem_free(pMac->lim.gpSession); pMac->lim.gpSession = NULL; if (!QDF_IS_STATUS_SUCCESS 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 5aa94b0df17e..c07ee89dec9d 100644 --- a/core/mac/src/pe/lim/lim_process_message_queue.c +++ b/core/mac/src/pe/lim/lim_process_message_queue.c @@ -332,9 +332,6 @@ uint8_t static def_msg_decision(tpAniSirGlobal pMac, tpSirMsgQ limMsg) && (limMsg->type != WMA_SWITCH_CHANNEL_RSP) && (limMsg->type != WMA_P2P_NOA_ATTR_IND) && (limMsg->type != WMA_P2P_NOA_START_IND) && -#ifdef FEATURE_OEM_DATA_SUPPORT - (limMsg->type != WMA_START_OEM_DATA_RSP) && -#endif (limMsg->type != WMA_ADD_TS_RSP) && /* * LIM won't process any defer queue commands if gLimAddtsSent is @@ -1163,52 +1160,6 @@ void lim_message_processor(tpAniSirGlobal mac_ctx, tpSirMsgQ msg) } } -#ifdef FEATURE_OEM_DATA_SUPPORT - -void lim_oem_data_rsp_handle_resume_link_rsp(tpAniSirGlobal pMac, QDF_STATUS status, - uint32_t *mlmOemDataRsp) -{ - if (status != QDF_STATUS_SUCCESS) { - lim_log(pMac, LOGE, - FL - ("OEM Data Rsp failed to get the response for resume link")); - } - - if (NULL != pMac->lim.gpLimMlmOemDataReq) { - qdf_mem_free(pMac->lim.gpLimMlmOemDataReq); - pMac->lim.gpLimMlmOemDataReq = NULL; - } - /* "Failure" status doesn't mean that Oem Data Rsp did not happen */ - /* and hence we need to respond to upper layers. Only Resume link is failed, but */ - /* we got the oem data response already. */ - /* Post the meessage to MLM */ - lim_post_sme_message(pMac, LIM_MLM_OEM_DATA_CNF, - (uint32_t *) (mlmOemDataRsp)); - - return; -} - -void lim_process_oem_data_rsp(tpAniSirGlobal pMac, uint32_t *body) -{ - tpLimMlmOemDataRsp mlmOemDataRsp = NULL; - - /* Process all the messages for the lim queue */ - SET_LIM_PROCESS_DEFD_MESGS(pMac, true); - - mlmOemDataRsp = (tpLimMlmOemDataRsp) body; - - PELOG1(lim_log - (pMac, LOG1, FL("%s: sending oem data response msg to sme"), - __func__); - ) - lim_post_sme_message(pMac, LIM_MLM_OEM_DATA_CNF, - (uint32_t *) (mlmOemDataRsp)); - - return; -} - -#endif - static void lim_process_sme_obss_scan_ind(tpAniSirGlobal mac_ctx, struct sSirMsgQ *msg) { @@ -1311,12 +1262,6 @@ void lim_process_messages(tpAniSirGlobal mac_ctx, tpSirMsgQ msg) lim_print_msg_name(mac_ctx, LOGE, msg->type); } break; -#ifdef FEATURE_OEM_DATA_SUPPORT - case WMA_START_OEM_DATA_RSP: - lim_process_oem_data_rsp(mac_ctx, msg->bodyptr); - msg->bodyptr = NULL; - break; -#endif case WMA_SWITCH_CHANNEL_RSP: lim_process_switch_channel_rsp(mac_ctx, msg->bodyptr); msg->bodyptr = NULL; @@ -1387,9 +1332,6 @@ void lim_process_messages(tpAniSirGlobal mac_ctx, tpSirMsgQ msg) case eWNI_SME_REMAIN_ON_CHANNEL_REQ: case eWNI_SME_DISASSOC_REQ: case eWNI_SME_DEAUTH_REQ: -#ifdef FEATURE_OEM_DATA_SUPPORT - case eWNI_SME_OEM_DATA_REQ: -#endif #ifdef FEATURE_WLAN_TDLS case eWNI_SME_TDLS_SEND_MGMT_REQ: case eWNI_SME_TDLS_ADD_STA_REQ: diff --git a/core/mac/src/pe/lim/lim_process_mlm_req_messages.c b/core/mac/src/pe/lim/lim_process_mlm_req_messages.c index c7519c6fe245..e103222c26c5 100644 --- a/core/mac/src/pe/lim/lim_process_mlm_req_messages.c +++ b/core/mac/src/pe/lim/lim_process_mlm_req_messages.c @@ -48,9 +48,6 @@ #include "wma_if.h" static void lim_process_mlm_start_req(tpAniSirGlobal, uint32_t *); -#ifdef FEATURE_OEM_DATA_SUPPORT -static void lim_process_mlm_oem_data_req(tpAniSirGlobal, uint32_t *); -#endif static void lim_process_mlm_join_req(tpAniSirGlobal, uint32_t *); static void lim_process_mlm_auth_req(tpAniSirGlobal, uint32_t *); static void lim_process_mlm_assoc_req(tpAniSirGlobal, uint32_t *); @@ -92,11 +89,6 @@ void lim_process_mlm_req_messages(tpAniSirGlobal mac_ctx, tpSirMsgQ msg) case LIM_MLM_START_REQ: lim_process_mlm_start_req(mac_ctx, msg->bodyptr); break; -#ifdef FEATURE_OEM_DATA_SUPPORT - case LIM_MLM_OEM_DATA_REQ: - lim_process_mlm_oem_data_req(mac_ctx, msg->bodyptr); - break; -#endif case LIM_MLM_JOIN_REQ: lim_process_mlm_join_req(mac_ctx, msg->bodyptr); break; @@ -348,100 +340,6 @@ void lim_restore_pre_scan_state(tpAniSirGlobal mac_ctx) (tx_time_get() - mac_ctx->lim.scanStartTime)); } -#ifdef FEATURE_OEM_DATA_SUPPORT -/** - * lim_send_hal_oem_data_req() - send oem data request - * @mac_ctx: global MAC context - * - * This function is used to send OEM data request to HAL. - * - * Return: None - */ -void lim_send_hal_oem_data_req(tpAniSirGlobal mac_ctx) -{ - tSirMsgQ msg; - tpStartOemDataReq start_oem_data_req = NULL; - tSirRetStatus rc = eSIR_SUCCESS; - tpLimMlmOemDataRsp mlm_oem_data_rsp; - - if (NULL == mac_ctx->lim.gpLimMlmOemDataReq) { - lim_log(mac_ctx, LOGE, FL("Null pointer")); - goto error; - } - - start_oem_data_req = qdf_mem_malloc(sizeof(*start_oem_data_req)); - if (NULL == start_oem_data_req) { - lim_log(mac_ctx, LOGE, FL - ("Could not allocate memory for start_oem_data_req")); - goto error; - } - - start_oem_data_req->data = - qdf_mem_malloc(mac_ctx->lim.gpLimMlmOemDataReq->data_len); - if (!start_oem_data_req->data) { - lim_log(mac_ctx, LOGE, FL("memory allocation failed")); - qdf_mem_free(start_oem_data_req); - goto error; - } - - /* Now copy over the information to the OEM DATA REQ to HAL */ - qdf_copy_macaddr(&start_oem_data_req->selfMacAddr, - &mac_ctx->lim.gpLimMlmOemDataReq->selfMacAddr); - - start_oem_data_req->data_len = - mac_ctx->lim.gpLimMlmOemDataReq->data_len; - qdf_mem_copy(start_oem_data_req->data, - mac_ctx->lim.gpLimMlmOemDataReq->data, - mac_ctx->lim.gpLimMlmOemDataReq->data_len); - - /* Create the message to be passed to HAL */ - msg.type = WMA_START_OEM_DATA_REQ; - msg.bodyptr = start_oem_data_req; - msg.bodyval = 0; - - SET_LIM_PROCESS_DEFD_MESGS(mac_ctx, false); - MTRACE(mac_trace_msg_tx(mac_ctx, NO_SESSION, msg.type)); - - rc = wma_post_ctrl_msg(mac_ctx, &msg); - if (rc == eSIR_SUCCESS) - return; - - SET_LIM_PROCESS_DEFD_MESGS(mac_ctx, true); - qdf_mem_free(start_oem_data_req->data); - qdf_mem_free(start_oem_data_req); - lim_log(mac_ctx, LOGE, - FL("OEM_DATA: posting WMA_START_OEM_DATA_REQ to HAL failed")); - -error: - mac_ctx->lim.gLimMlmState = mac_ctx->lim.gLimPrevMlmState; - MTRACE(mac_trace(mac_ctx, TRACE_CODE_MLM_STATE, NO_SESSION, - mac_ctx->lim.gLimMlmState)); - - mlm_oem_data_rsp = qdf_mem_malloc(sizeof(tLimMlmOemDataRsp)); - if (NULL == mlm_oem_data_rsp) { - lim_log(mac_ctx->hHdd, LOGP, FL - ("memory allocation for mlm_oem_data_rsp")); - return; - } - mlm_oem_data_rsp->target_rsp = false; - - if (NULL != mac_ctx->lim.gpLimMlmOemDataReq) { - if (NULL != mac_ctx->lim.gpLimMlmOemDataReq->data) { - qdf_mem_free( - mac_ctx->lim.gpLimMlmOemDataReq->data); - mac_ctx->lim.gpLimMlmOemDataReq->data = NULL; - } - qdf_mem_free(mac_ctx->lim.gpLimMlmOemDataReq); - mac_ctx->lim.gpLimMlmOemDataReq = NULL; - } - - lim_post_sme_message(mac_ctx, LIM_MLM_OEM_DATA_CNF, - (uint32_t *) mlm_oem_data_rsp); - - return; -} -#endif /* FEATURE_OEM_DATA_SUPPORT */ - /** * mlm_add_sta() - MLM add sta * @mac_ctx: global MAC context @@ -791,77 +689,6 @@ end: (uint32_t *) &mlm_start_cnf); } -#ifdef FEATURE_OEM_DATA_SUPPORT -/** - * lim_process_mlm_oem_data_req() - process MLM OEM_DATA_REQ message - * @mac_ctx: global MAC context - * @msg_buf: MLM message buffer - * - * This function process MLM OEM_DATA_REQ message. - * - * Return: None - */ -static void lim_process_mlm_oem_data_req(tpAniSirGlobal mac_ctx, - uint32_t *msg_buf) -{ - tLimMlmOemDataRsp *mlm_oem_data_rsp; - tLimMlmOemDataReq *data_req = (tLimMlmOemDataReq *) msg_buf; - - if (((mac_ctx->lim.gLimMlmState == eLIM_MLM_IDLE_STATE) || - (mac_ctx->lim.gLimMlmState == eLIM_MLM_JOINED_STATE) || - (mac_ctx->lim.gLimMlmState == eLIM_MLM_AUTHENTICATED_STATE) || - (mac_ctx->lim.gLimMlmState == eLIM_MLM_BSS_STARTED_STATE) || - (mac_ctx->lim.gLimMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE))) { - /* - * Hold onto the oem data request criteria - * Free gpLimMlmOemDataReq to avoid memory leak due to - * second OEM data request - */ - if (mac_ctx->lim.gpLimMlmOemDataReq) { - if (mac_ctx->lim.gpLimMlmOemDataReq->data) { - qdf_mem_free( - mac_ctx->lim.gpLimMlmOemDataReq->data); - mac_ctx->lim.gpLimMlmOemDataReq->data = - NULL; - } - qdf_mem_free(mac_ctx->lim.gpLimMlmOemDataReq); - mac_ctx->lim.gpLimMlmOemDataReq = NULL; - } - - mac_ctx->lim.gpLimMlmOemDataReq = data_req; - mac_ctx->lim.gpLimMlmOemDataReq->data = - data_req->data; - mac_ctx->lim.gLimPrevMlmState = mac_ctx->lim.gLimMlmState; - - lim_log(mac_ctx, LOG2, FL("Calling lim_send_hal_oem_data_req")); - lim_send_hal_oem_data_req(mac_ctx); - } else { - /* Should not have received oem data req in other states */ - lim_log(mac_ctx, LOGW, FL - ("unexpected LIM_MLM_OEM_DATA_REQ in invalid state %X"), - mac_ctx->lim.gLimMlmState); - lim_print_mlm_state(mac_ctx, LOGW, mac_ctx->lim.gLimMlmState); - - /* Free up buffer allocated */ - qdf_mem_free(msg_buf); - - /* Return Meas confirm with INVALID_PARAMETERS */ - mlm_oem_data_rsp = qdf_mem_malloc(sizeof(tLimMlmOemDataRsp)); - if (mlm_oem_data_rsp != NULL) { - mlm_oem_data_rsp->target_rsp = false; - lim_post_sme_message(mac_ctx, LIM_MLM_OEM_DATA_CNF, - (uint32_t *) mlm_oem_data_rsp); - qdf_mem_free(mlm_oem_data_rsp); - } else { - lim_log(mac_ctx, LOGP, FL - ("Could not allocate memory for mlm_oem_data_rsp")); - return; - } - } - - return; -} -#endif /* FEATURE_OEM_DATA_SUPPORT */ /** * lim_post_join_set_link_state_callback()- registered callback to perform post * peer creation operations diff --git a/core/mac/src/pe/lim/lim_process_mlm_rsp_messages.c b/core/mac/src/pe/lim/lim_process_mlm_rsp_messages.c index 5637496c2519..95cb2e245f34 100644 --- a/core/mac/src/pe/lim/lim_process_mlm_rsp_messages.c +++ b/core/mac/src/pe/lim/lim_process_mlm_rsp_messages.c @@ -55,9 +55,6 @@ static void lim_handle_sme_join_result(tpAniSirGlobal, tSirResultCodes, uint16_t, tpPESession); -#ifdef FEATURE_OEM_DATA_SUPPORT -void lim_process_mlm_oem_data_req_cnf(tpAniSirGlobal, uint32_t *); -#endif void lim_process_mlm_join_cnf(tpAniSirGlobal, uint32_t *); void lim_process_mlm_auth_cnf(tpAniSirGlobal, uint32_t *); void lim_process_mlm_start_cnf(tpAniSirGlobal, uint32_t *); @@ -102,14 +99,6 @@ lim_process_mlm_rsp_messages(tpAniSirGlobal pMac, uint32_t msgType, } MTRACE(mac_trace(pMac, TRACE_CODE_TX_LIM_MSG, 0, msgType)); switch (msgType) { - -#ifdef FEATURE_OEM_DATA_SUPPORT - case LIM_MLM_OEM_DATA_CNF: - lim_process_mlm_oem_data_req_cnf(pMac, pMsgBuf); - pMsgBuf = NULL; - break; -#endif - case LIM_MLM_AUTH_CNF: lim_process_mlm_auth_cnf(pMac, pMsgBuf); break; @@ -154,44 +143,6 @@ lim_process_mlm_rsp_messages(tpAniSirGlobal pMac, uint32_t msgType, return; } /*** end lim_process_mlm_rsp_messages() ***/ -#ifdef FEATURE_OEM_DATA_SUPPORT - -/** - * lim_process_mlm_oem_data_req_cnf() - * - ***FUNCTION: - * This function is called to processes LIM_MLM_OEM_DATA_REQ_CNF - * message from MLM State machine. - * - ***LOGIC: - * - ***ASSUMPTIONS: - * - ***NOTE: - * - * @param pMac Pointer to Global MAC structure - * @param pMsgBuf A pointer to the MLM message buffer - * - * @return None - */ - -void lim_process_mlm_oem_data_req_cnf(tpAniSirGlobal pMac, uint32_t *pMsgBuf) -{ - tLimMlmOemDataRsp *measRsp; - - tSirResultCodes resultCode = eSIR_SME_SUCCESS; - - measRsp = (tLimMlmOemDataRsp *) (pMsgBuf); - - /* Now send the meas confirm message to the sme */ - lim_send_sme_oem_data_rsp(pMac, (uint32_t *) measRsp, resultCode); - - /* Dont free the memory here. It will be freed up by the callee */ - - return; -} -#endif - /** * lim_process_mlm_start_cnf() * 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 8133c321b1a6..a4374e0aa1ef 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 @@ -1520,46 +1520,6 @@ static void __lim_process_sme_scan_req(tpAniSirGlobal mac_ctx, } } -#ifdef FEATURE_OEM_DATA_SUPPORT - -static void __lim_process_sme_oem_data_req(tpAniSirGlobal pMac, uint32_t *pMsgBuf) -{ - tpSirOemDataReq pOemDataReq; - tLimMlmOemDataReq *pMlmOemDataReq; - - pOemDataReq = (tpSirOemDataReq) pMsgBuf; - - /* post the lim mlm message now */ - pMlmOemDataReq = qdf_mem_malloc(sizeof(*pMlmOemDataReq)); - if (NULL == pMlmOemDataReq) { - lim_log(pMac, LOGP, - FL("AllocateMemory failed for mlmOemDataReq")); - return; - } - pMlmOemDataReq->data = qdf_mem_malloc(pOemDataReq->data_len); - if (!pMlmOemDataReq->data) { - lim_log(pMac, LOGP, FL("memory allocation failed")); - qdf_mem_free(pMlmOemDataReq); - return; - } - - qdf_copy_macaddr(&pMlmOemDataReq->selfMacAddr, - &pOemDataReq->selfMacAddr); - pMlmOemDataReq->data_len = pOemDataReq->data_len; - qdf_mem_copy(pMlmOemDataReq->data, pOemDataReq->data, - pOemDataReq->data_len); - /* buffer from SME copied, free it now */ - qdf_mem_free(pOemDataReq->data); - /* Issue LIM_MLM_OEM_DATA_REQ to MLM */ - lim_post_mlm_message(pMac, LIM_MLM_OEM_DATA_REQ, - (uint32_t *) pMlmOemDataReq); - - return; - -} /*** end __lim_process_sme_oem_data_req() ***/ - -#endif /* FEATURE_OEM_DATA_SUPPORT */ - /** * __lim_process_clear_dfs_channel_list() * @@ -4677,12 +4637,6 @@ void lim_process_regd_defd_sme_req_after_noa_start(tpAniSirGlobal mac_ctx) __lim_process_sme_scan_req(mac_ctx, mac_ctx->lim.gpDefdSmeMsgForNOA); break; -#ifdef FEATURE_OEM_DATA_SUPPORT - case eWNI_SME_OEM_DATA_REQ: - __lim_process_sme_oem_data_req(mac_ctx, - mac_ctx->lim.gpDefdSmeMsgForNOA); - break; -#endif case eWNI_SME_REMAIN_ON_CHANNEL_REQ: buf_consumed = lim_process_remain_on_chnl_req(mac_ctx, mac_ctx->lim.gpDefdSmeMsgForNOA); @@ -4997,11 +4951,6 @@ bool lim_process_sme_req_messages(tpAniSirGlobal pMac, tpSirMsgQ pMsg) __lim_process_sme_scan_req(pMac, pMsgBuf); break; -#ifdef FEATURE_OEM_DATA_SUPPORT - case eWNI_SME_OEM_DATA_REQ: - __lim_process_sme_oem_data_req(pMac, pMsgBuf); - break; -#endif case eWNI_SME_REMAIN_ON_CHANNEL_REQ: bufConsumed = lim_process_remain_on_chnl_req(pMac, pMsgBuf); break; diff --git a/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c b/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c index 9f6413fdec0d..7ba373852d58 100644 --- a/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c +++ b/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c @@ -785,99 +785,6 @@ lim_post_sme_scan_rsp_message(tpAniSirGlobal pMac, } /*** lim_post_sme_scan_rsp_message ***/ -#ifdef FEATURE_OEM_DATA_SUPPORT - -/** - * lim_send_sme_oem_data_rsp() - * - ***FUNCTION: - * This function is called by lim_process_sme_req_messages() to send - * eWNI_SME_OEM_DATA_RSP message to applications above MAC - * Software. - * - ***PARAMS: - * - ***LOGIC: - * - ***ASSUMPTIONS: - * NA - * - ***NOTE: - * NA - * - * @param pMac Pointer to Global MAC structure - * @param pMsgBuf Indicates the mlm message - * @param resultCode Indicates the result of previously issued - * eWNI_SME_OEM_DATA_RSP message - * - * @return None - */ - -void lim_send_sme_oem_data_rsp(tpAniSirGlobal pMac, uint32_t *pMsgBuf, - tSirResultCodes resultCode) -{ - tSirMsgQ mmhMsg; - tSirOemDataRsp *pSirSmeOemDataRsp = NULL; - tLimMlmOemDataRsp *pMlmOemDataRsp = NULL; - uint16_t msgLength; - - /* get the pointer to the mlm message */ - pMlmOemDataRsp = (tLimMlmOemDataRsp *) (pMsgBuf); - - msgLength = sizeof(*pSirSmeOemDataRsp); - /* now allocate memory for the char buffer */ - pSirSmeOemDataRsp = qdf_mem_malloc(sizeof(*pSirSmeOemDataRsp)); - if (NULL == pSirSmeOemDataRsp) { - lim_log(pMac, LOGP, - FL("malloc failed for pSirSmeOemDataRsp")); - qdf_mem_free(pMlmOemDataRsp->oem_data_rsp); - qdf_mem_free(pMlmOemDataRsp); - return; - } - - if (pMlmOemDataRsp->rsp_len) { - pSirSmeOemDataRsp->oem_data_rsp = - qdf_mem_malloc(pMlmOemDataRsp->rsp_len); - if (!pSirSmeOemDataRsp->oem_data_rsp) { - lim_log(pMac, LOGE, - FL("malloc failed for oem_data_rsp")); - qdf_mem_free(pSirSmeOemDataRsp); - qdf_mem_free(pMlmOemDataRsp->oem_data_rsp); - qdf_mem_free(pMlmOemDataRsp); - return; - } - } - -#if defined (ANI_LITTLE_BYTE_ENDIAN) - sir_store_u16_n((uint8_t *) &pSirSmeOemDataRsp->length, msgLength); - sir_store_u16_n((uint8_t *) &pSirSmeOemDataRsp->messageType, - eWNI_SME_OEM_DATA_RSP); -#else - pSirSmeOemDataRsp->length = msgLength; - pSirSmeOemDataRsp->messageType = eWNI_SME_OEM_DATA_RSP; -#endif - pSirSmeOemDataRsp->target_rsp = pMlmOemDataRsp->target_rsp; - pSirSmeOemDataRsp->rsp_len = pMlmOemDataRsp->rsp_len; - if (pSirSmeOemDataRsp->rsp_len) - qdf_mem_copy(pSirSmeOemDataRsp->oem_data_rsp, - pMlmOemDataRsp->oem_data_rsp, - pSirSmeOemDataRsp->rsp_len); - - /* Now free the memory from MLM Rsp Message */ - qdf_mem_free(pMlmOemDataRsp->oem_data_rsp); - qdf_mem_free(pMlmOemDataRsp); - - mmhMsg.type = eWNI_SME_OEM_DATA_RSP; - mmhMsg.bodyptr = pSirSmeOemDataRsp; - mmhMsg.bodyval = 0; - - lim_sys_process_mmh_msg_api(pMac, &mmhMsg, ePROT); - - return; -} /*** lim_send_sme_oem_data_rsp ***/ - -#endif - void lim_send_sme_disassoc_deauth_ntf(tpAniSirGlobal pMac, QDF_STATUS status, uint32_t *pCtx) { diff --git a/core/mac/src/pe/lim/lim_send_sme_rsp_messages.h b/core/mac/src/pe/lim/lim_send_sme_rsp_messages.h index f8997d19bc43..55a58ff0ee03 100644 --- a/core/mac/src/pe/lim/lim_send_sme_rsp_messages.h +++ b/core/mac/src/pe/lim/lim_send_sme_rsp_messages.h @@ -98,11 +98,6 @@ void lim_send_sme_ibss_peer_ind(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, uint8_t bcastIdx, uint8_t *beacon, uint16_t beaconLen, uint16_t msgType, uint8_t sessionId); -#ifdef FEATURE_OEM_DATA_SUPPORT -void lim_send_sme_oem_data_rsp(tpAniSirGlobal pMac, uint32_t *pMsgBuf, - tSirResultCodes resultCode); -#endif - void lim_send_sme_max_assoc_exceeded_ntf(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, uint8_t smesessionId); #ifdef FEATURE_WLAN_TDLS diff --git a/core/mac/src/pe/lim/lim_types.h b/core/mac/src/pe/lim/lim_types.h index c2a4bb4a4fb0..04c01e51c305 100644 --- a/core/mac/src/pe/lim/lim_types.h +++ b/core/mac/src/pe/lim/lim_types.h @@ -93,10 +93,6 @@ * Values (LIM_MLM_MSG_START + 32) through * (LIM_MLM_MSG_START + 40) are unused. */ -#ifdef FEATURE_OEM_DATA_SUPPORT -#define LIM_MLM_OEM_DATA_REQ (LIM_MLM_MSG_START + 41) -#define LIM_MLM_OEM_DATA_CNF (LIM_MLM_MSG_START + 42) -#endif #define LIM_HASH_ADD 0 #define LIM_HASH_UPDATE 1 diff --git a/core/mac/src/pe/lim/lim_utils.c b/core/mac/src/pe/lim/lim_utils.c index 49009b8ca2f8..01bdfb67ffb6 100644 --- a/core/mac/src/pe/lim/lim_utils.c +++ b/core/mac/src/pe/lim/lim_utils.c @@ -277,12 +277,6 @@ char *lim_msg_str(uint32_t msgType) return "eWNI_SME_SYS_READY_IND"; case eWNI_SME_SCAN_REQ: return "eWNI_SME_SCAN_REQ"; -#ifdef FEATURE_OEM_DATA_SUPPORT - case eWNI_SME_OEM_DATA_REQ: - return "eWNI_SME_OEM_DATA_REQ"; - case eWNI_SME_OEM_DATA_RSP: - return "eWNI_SME_OEM_DATA_RSP"; -#endif case eWNI_SME_SCAN_RSP: return "eWNI_SME_SCAN_RSP"; case eWNI_SME_JOIN_REQ: diff --git a/core/mac/src/sys/legacy/src/utils/src/mac_trace.c b/core/mac/src/sys/legacy/src/utils/src/mac_trace.c index b533658acd50..85504c609432 100644 --- a/core/mac/src/sys/legacy/src/utils/src/mac_trace.c +++ b/core/mac/src/sys/legacy/src/utils/src/mac_trace.c @@ -233,10 +233,6 @@ uint8_t *mac_trace_get_sme_msg_string(uint16_t sme_msg) CASE_RETURN_STRING(eWNI_SME_SCAN_REQ); CASE_RETURN_STRING(eWNI_SME_SCAN_ABORT_IND); CASE_RETURN_STRING(eWNI_SME_SCAN_RSP); -#ifdef FEATURE_OEM_DATA_SUPPORT - CASE_RETURN_STRING(eWNI_SME_OEM_DATA_REQ); - CASE_RETURN_STRING(eWNI_SME_OEM_DATA_RSP); -#endif CASE_RETURN_STRING(eWNI_SME_JOIN_REQ); CASE_RETURN_STRING(eWNI_SME_JOIN_RSP); CASE_RETURN_STRING(eWNI_SME_SETCONTEXT_REQ); @@ -412,10 +408,6 @@ uint8_t *mac_trace_get_wma_msg_string(uint16_t wma_msg) CASE_RETURN_STRING(WMA_BTC_SET_CFG); CASE_RETURN_STRING(WMA_HANDLE_FW_MBOX_RSP); CASE_RETURN_STRING(WMA_SEND_PROBE_RSP_TMPL); -#ifdef FEATURE_OEM_DATA_SUPPORT - CASE_RETURN_STRING(WMA_START_OEM_DATA_REQ); - CASE_RETURN_STRING(WMA_START_OEM_DATA_RSP); -#endif /* SUPPORT_BEACON_FILTER */ CASE_RETURN_STRING(WMA_SET_MAX_TX_POWER_REQ); CASE_RETURN_STRING(WMA_SET_HOST_OFFLOAD); CASE_RETURN_STRING(WMA_SET_KEEP_ALIVE); diff --git a/core/mac/src/sys/legacy/src/utils/src/utils_parser.c b/core/mac/src/sys/legacy/src/utils/src/utils_parser.c index e300de33aee2..32543fa9fc86 100644 --- a/core/mac/src/sys/legacy/src/utils/src/utils_parser.c +++ b/core/mac/src/sys/legacy/src/utils/src/utils_parser.c @@ -722,7 +722,7 @@ void convert_qos_mapset_frame(tpAniSirGlobal pMac, tSirQosMapSet *Qos, Qos->dscp_exceptions[i][1] = dot11fIE->dscp_exceptions[j]; j++; } - for (i = 0; i < 8; i++) { + for (i = 0; i < 8 && j < dot11_dscp_sz; i++) { Qos->dscp_range[i][0] = dot11fIE->dscp_exceptions[j]; j++; Qos->dscp_range[i][1] = dot11fIE->dscp_exceptions[j]; diff --git a/core/pld/inc/pld_common.h b/core/pld/inc/pld_common.h index 86789903720a..0e680504755c 100644 --- a/core/pld/inc/pld_common.h +++ b/core/pld/inc/pld_common.h @@ -366,5 +366,6 @@ int pld_get_soc_info(struct device *dev, struct pld_soc_info *info); int pld_get_ce_id(struct device *dev, int irq); void pld_lock_pm_sem(struct device *dev); void pld_release_pm_sem(struct device *dev); - +int pld_power_on(struct device *dev); +int pld_power_off(struct device *dev); #endif diff --git a/core/pld/src/pld_common.c b/core/pld/src/pld_common.c index 7b0fc45c8f3b..29458eb7853d 100644 --- a/core/pld/src/pld_common.c +++ b/core/pld/src/pld_common.c @@ -1314,3 +1314,55 @@ void pld_release_pm_sem(struct device *dev) break; } } + +/** + * pld_power_on() - Power on WLAN hardware + * @dev: device + * + * Return: 0 for success + * Non zero failure code for errors + */ +int pld_power_on(struct device *dev) +{ + int ret = 0; + + switch (pld_get_bus_type(dev)) { + case PLD_BUS_TYPE_PCIE: + ret = pld_pcie_power_on(dev); + break; + case PLD_BUS_TYPE_SNOC: + ret = pld_snoc_power_on(dev); + break; + default: + pr_err("Invalid device type\n"); + break; + } + + return ret; +} + +/** + * pld_power_off() - Power off WLAN hardware + * @dev: device + * + * Return: 0 for success + * Non zero failure code for errors + */ +int pld_power_off(struct device *dev) +{ + int ret = 0; + + switch (pld_get_bus_type(dev)) { + case PLD_BUS_TYPE_PCIE: + ret = pld_pcie_power_on(dev); + break; + case PLD_BUS_TYPE_SNOC: + ret = pld_snoc_power_off(dev); + break; + default: + pr_err("Invalid device type\n"); + break; + } + + return ret; +} diff --git a/core/pld/src/pld_pcie.c b/core/pld/src/pld_pcie.c index 0022f660dd3c..3acde4291cff 100644 --- a/core/pld/src/pld_pcie.c +++ b/core/pld/src/pld_pcie.c @@ -846,6 +846,30 @@ void pld_pcie_release_pm_sem(void) { cnss_release_pm_sem(); } + +/** + * pld_pcie_power_on() - Power on WLAN hardware + * @dev: device + * + * Return: 0 for success + * Non zero failure code for errors + */ +int pld_pcie_power_on(struct device *dev) +{ + return cnss_power_up(dev); +} + +/** + * pld_pcie_power_off() - Power off WLAN hardware + * @dev: device + * + * Return: 0 for success + * Non zero failure code for errors + */ +int pld_pcie_power_off(struct device *dev) +{ + return cnss_power_down(dev); +} #endif #endif diff --git a/core/pld/src/pld_pcie.h b/core/pld/src/pld_pcie.h index a36c316ccd76..f689b9898a17 100644 --- a/core/pld/src/pld_pcie.h +++ b/core/pld/src/pld_pcie.h @@ -199,6 +199,14 @@ static void pld_pcie_release_pm_sem(void) { return; } +static inline int pld_pcie_power_on(struct device *dev) +{ + return 0; +} +static inline int pld_pcie_power_off(struct device *dev) +{ + return 0; +} #else int pld_pcie_get_fw_files_for_target(struct pld_fw_files *pfw_files, u32 target_type, u32 target_version); @@ -224,6 +232,8 @@ int pld_pcie_auto_suspend(void); int pld_pcie_auto_resume(void); void pld_pcie_lock_pm_sem(void); void pld_pcie_release_pm_sem(void); +int pld_pcie_power_on(struct device *dev); +int pld_pcie_power_off(struct device *dev); #endif #endif diff --git a/core/pld/src/pld_snoc.c b/core/pld/src/pld_snoc.c index 2551469f219c..22297b4e7944 100644 --- a/core/pld/src/pld_snoc.c +++ b/core/pld/src/pld_snoc.c @@ -358,4 +358,27 @@ int pld_snoc_get_ce_id(int irq) return icnss_get_ce_id(irq); } +/** + * pld_snoc_power_on() - Power on WLAN hardware + * @dev: device + * + * Return: 0 for success + * Non zero failure code for errors + */ +int pld_snoc_power_on(struct device *dev) +{ + return icnss_power_on(dev); +} + +/** + * pld_snoc_power_off() - Power off WLAN hardware + * @dev: device + * + * Return: 0 for success + * Non zero failure code for errors + */ +int pld_snoc_power_off(struct device *dev) +{ + return icnss_power_off(dev); +} #endif diff --git a/core/pld/src/pld_snoc.h b/core/pld/src/pld_snoc.h index 3123bd1f83fa..75f3f1036f37 100644 --- a/core/pld/src/pld_snoc.h +++ b/core/pld/src/pld_snoc.h @@ -75,6 +75,14 @@ static inline int pld_snoc_get_ce_id(int irq) { return 0; } +static inline int pld_snoc_power_on(struct device *dev) +{ + return 0; +} +static inline int pld_snoc_power_off(struct device *dev) +{ + return 0; +} #else int pld_snoc_register_driver(void); void pld_snoc_unregister_driver(void); @@ -89,6 +97,8 @@ int pld_snoc_ce_free_irq(unsigned int ce_id, void *ctx); void pld_snoc_enable_irq(unsigned int ce_id); void pld_snoc_disable_irq(unsigned int ce_id); int pld_snoc_get_ce_id(int irq); +int pld_snoc_power_on(struct device *dev); +int pld_snoc_power_off(struct device *dev); #endif #endif diff --git a/core/sme/inc/csr_internal.h b/core/sme/inc/csr_internal.h index 93bd440cc4df..a8715ff2540b 100644 --- a/core/sme/inc/csr_internal.h +++ b/core/sme/inc/csr_internal.h @@ -1309,7 +1309,7 @@ bool csr_roam_is11r_assoc(tpAniSirGlobal pMac, uint8_t sessionId); #ifdef FEATURE_WLAN_ESE /* Returns whether the current association is a ESE assoc or not */ -bool csr_roam_is_ese_assoc(tpAniSirGlobal pMac, uint8_t sessionId); +bool csr_roam_is_ese_assoc(tpAniSirGlobal pMac, uint32_t sessionId); bool csr_roam_is_ese_ini_feature_enabled(tpAniSirGlobal pMac); QDF_STATUS csr_get_tsm_stats(tpAniSirGlobal pMac, tCsrTsmStatsCallback callback, diff --git a/core/sme/inc/oem_data_api.h b/core/sme/inc/oem_data_api.h deleted file mode 100644 index ecc2b90c3921..000000000000 --- a/core/sme/inc/oem_data_api.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2013-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. - */ - -#ifdef FEATURE_OEM_DATA_SUPPORT - -/** - * \file oem_data_api.h - * - * Exports and types for the Common OEM DATA REQ/RSP Module interfaces. - */ - -#ifndef __OEM_DATA_API_H__ -#define __OEM_DATA_API_H__ -#include "sir_api.h" -#include "sir_mac_prot_def.h" -#include "csr_link_list.h" - -/* message subtype for internal purpose */ -#define OEM_MESSAGE_SUBTYPE_INTERNAL 0xdeadbeef -#define OEM_MESSAGE_SUBTYPE_LEN 4 - -/* Structure for defining req sent to the PE */ -typedef struct tagOemDataReq { - uint8_t sessionId; - uint32_t data_len; - uint8_t *data; -} tOemDataReq, tOemDataReqConfig; - -typedef struct tagOemDataRsp { - uint32_t rsp_len; - uint8_t *oem_data_rsp; -} tOemDataRsp; - -typedef enum { - eOEM_DATA_REQ_SUCCESS = 1, - eOEM_DATA_REQ_FAILURE, - eOEM_DATA_REQ_INVALID_MODE, -} eOemDataReqStatus; -QDF_STATUS oem_data_oem_data_req_open(tHalHandle hHal); -QDF_STATUS oem_data_oem_data_req_close(tHalHandle hHal); - -/* - * HDD Callback function for the sme to callback when - * the oem data rsp is available - */ -typedef QDF_STATUS (*oem_data_oem_data_reqCompleteCallback)(tHalHandle, - void *p2, uint32_t oemDataReqID, eOemDataReqStatus status); - -QDF_STATUS oem_data_oem_data_req(tHalHandle, uint8_t, tOemDataReqConfig *, - uint32_t *pOemDataReqID); -QDF_STATUS sme_handle_oem_data_rsp(tHalHandle hHal, uint8_t *); -QDF_STATUS oem_data_is_oem_data_req_allowed(tHalHandle hHal); -typedef void (*sme_send_oem_data_rsp_msg)(int length, uint8_t *oem_data_rsp); -#endif /* _OEM_DATA_API_H__ */ - -#endif /* FEATURE_OEM_DATA_SUPPORT */ diff --git a/core/sme/inc/oem_data_internal.h b/core/sme/inc/oem_data_internal.h deleted file mode 100644 index d432d9107c4c..000000000000 --- a/core/sme/inc/oem_data_internal.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2014-2015 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. - */ - -#ifdef FEATURE_OEM_DATA_SUPPORT - -/** - * - * \file oem_data_internal.h - * - * Exports and types for the Common OEM DATA REQ/RSP Module interfaces. - */ - -#ifndef __OEM_DATA_INTERNAL_H__ -#define __OEM_DATA_INTERNAL_H__ - -#include "csr_support.h" -#include "cds_reg_service.h" -#include "oem_data_api.h" - -typedef struct tagOemDataStruct { - /* a global req id */ - uint32_t nextOemReqId; - /* indicates that currently a request has been posted and */ - bool oemDataReqActive; - /* callback function pointer for returning the response */ - oem_data_oem_data_reqCompleteCallback callback; - /* context of the original caller */ - void *pContext; - uint32_t oemDataReqID; /* original request ID */ - uint8_t sessionId; /* Session on which oem data req is active */ - /* callback for sending data response to oem application */ - sme_send_oem_data_rsp_msg oem_data_rsp_callback; -} tOemDataStruct; - -typedef struct tagOemDataCmd { - uint32_t oemDataReqID; - tOemDataReq oemDataReq; -} tOemDataCmd; -#endif /* __OEM_DATA_INTERNAL_H__ */ - -#endif /* FEATURE_OEM_DATA_SUPPORT */ diff --git a/core/sme/inc/sme_api.h b/core/sme/inc/sme_api.h index f24d6ec88ad8..366f52a1e754 100644 --- a/core/sme/inc/sme_api.h +++ b/core/sme/inc/sme_api.h @@ -48,10 +48,6 @@ #include "sme_internal.h" #include "wma_tgt_cfg.h" -#ifdef FEATURE_OEM_DATA_SUPPORT -#include "oem_data_api.h" -#endif - #include "sme_rrm_internal.h" #include "sir_types.h" /*-------------------------------------------------------------------------- @@ -459,10 +455,7 @@ QDF_STATUS sme_scan_get_bkid_candidate_list(tHalHandle hHal, uint32_t sessionId, uint32_t *pNumItems); #endif /* FEATURE_WLAN_WAPI */ #ifdef FEATURE_OEM_DATA_SUPPORT -QDF_STATUS sme_oem_data_req(tHalHandle hHal, - uint8_t sessionId, - tOemDataReqConfig *, - uint32_t *pOemDataReqID); +QDF_STATUS sme_oem_data_req(tHalHandle hHal, struct oem_data_req *); QDF_STATUS sme_oem_update_capability(tHalHandle hHal, struct sme_oem_capability *cap); QDF_STATUS sme_oem_get_capability(tHalHandle hHal, diff --git a/core/sme/inc/sme_inside.h b/core/sme/inc/sme_inside.h index cc859ed379ee..2b41976446ae 100644 --- a/core/sme/inc/sme_inside.h +++ b/core/sme/inc/sme_inside.h @@ -47,10 +47,6 @@ #include "sme_qos_api.h" #include "sme_qos_internal.h" -#ifdef FEATURE_OEM_DATA_SUPPORT -#include "oem_data_internal.h" -#endif - #include "sme_rrm_api.h" ePhyChanBondState csr_convert_cb_ini_value_to_phy_cb_state(uint32_t cbIniValue); @@ -178,9 +174,6 @@ typedef struct tagSmeCmd { tSetKeyCmd setKeyCmd; tGenericPmcCmd pmcCmd; tGenericQosCmd qosCmd; -#ifdef FEATURE_OEM_DATA_SUPPORT - tOemDataCmd oemDataCmd; -#endif tRemainChlCmd remainChlCmd; tNoACmd NoACmd; tAddStaForSessionCmd addStaSessionCmd; @@ -230,11 +223,6 @@ bool csr_roam_is_valid40_mhz_channel(tpAniSirGlobal pmac, uint8_t channel); QDF_STATUS sme_acquire_global_lock(tSmeStruct *psSme); QDF_STATUS sme_release_global_lock(tSmeStruct *psSme); -#ifdef FEATURE_OEM_DATA_SUPPORT -QDF_STATUS oem_data_process_oem_data_req_command(tpAniSirGlobal pMac, - tSmeCmd *pCommand); -#endif - QDF_STATUS csr_process_add_sta_session_command(tpAniSirGlobal pMac, tSmeCmd *pCommand); QDF_STATUS csr_process_add_sta_session_rsp(tpAniSirGlobal pMac, uint8_t *pMsg); diff --git a/core/sme/inc/sme_internal.h b/core/sme/inc/sme_internal.h index 4da807a26947..51c135ec235c 100644 --- a/core/sme/inc/sme_internal.h +++ b/core/sme/inc/sme_internal.h @@ -153,6 +153,7 @@ typedef void (*preferred_network_found_ind_cb)(void *callback_context, typedef void (*ocb_callback)(void *context, void *response); typedef void (*sme_set_thermal_level_callback)(void *context, u_int8_t level); typedef void (*p2p_lo_callback)(void *context, void *event); +typedef void (*sme_send_oem_data_rsp_msg)(struct oem_data_rsp *); typedef struct tagSmeStruct { eSmeState state; @@ -242,6 +243,7 @@ typedef struct tagSmeStruct { struct sir_bpf_get_offload *); p2p_lo_callback p2p_lo_event_callback; void *p2p_lo_event_context; + sme_send_oem_data_rsp_msg oem_data_rsp_callback; } tSmeStruct, *tpSmeStruct; #endif /* #if !defined( __SMEINTERNAL_H ) */ diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c index 34011aeda71c..47c3a85c4104 100644 --- a/core/sme/src/common/sme_api.c +++ b/core/sme/src/common/sme_api.c @@ -988,12 +988,6 @@ sme_process_cmd: csr_ll_unlock(&pMac->sme.smeCmdActiveList); csr_process_del_sta_session_command(pMac, pCommand); break; -#ifdef FEATURE_OEM_DATA_SUPPORT - case eSmeCommandOemDataReq: - csr_ll_unlock(&pMac->sme.smeCmdActiveList); - oem_data_process_oem_data_req_command(pMac, pCommand); - break; -#endif case eSmeCommandRemainOnChannel: csr_ll_unlock(&pMac->sme.smeCmdActiveList); p2p_process_remain_on_channel_cmd(pMac, pCommand); @@ -1129,15 +1123,6 @@ QDF_STATUS sme_open(tHalHandle hHal) return status; } #endif -#ifdef FEATURE_OEM_DATA_SUPPORT - status = oem_data_oem_data_req_open(pMac); - if (!QDF_IS_STATUS_SUCCESS(status)) { - sms_log(pMac, LOGE, - FL("oem_data_oem_data_req_open, status=%d"), - status); - return status; - } -#endif status = init_sme_cmd_list(pMac); if (!QDF_IS_STATUS_SUCCESS(status)) return status; @@ -2537,19 +2522,6 @@ QDF_STATUS sme_process_msg(tHalHandle hHal, cds_msg_t *pMsg) pMsg->type); } break; -#ifdef FEATURE_OEM_DATA_SUPPORT - /* Handle the eWNI_SME_OEM_DATA_RSP: */ - case eWNI_SME_OEM_DATA_RSP: - if (pMsg->bodyptr) { - status = sme_handle_oem_data_rsp(pMac, pMsg->bodyptr); - qdf_mem_free(pMsg->bodyptr); - } else { - sms_log(pMac, LOGE, FL("Empty message for %d"), - pMsg->type); - } - sme_process_pending_queue(pMac); - break; -#endif case eWNI_SME_ADD_STA_SELF_RSP: if (pMsg->bodyptr) { status = csr_process_add_sta_session_rsp(pMac, @@ -3218,15 +3190,6 @@ QDF_STATUS sme_close(tHalHandle hHal) fail_status = status; } #endif -#ifdef FEATURE_OEM_DATA_SUPPORT - status = oem_data_oem_data_req_close(hHal); - if (!QDF_IS_STATUS_SUCCESS(status)) { - sms_log(pMac, LOGE, - "OEM DATA REQ close failed during sme close with status=%d", - status); - fail_status = status; - } -#endif status = sme_ps_close(hHal); if (!QDF_IS_STATUS_SUCCESS(status)) { sms_log(pMac, LOGE, @@ -4770,7 +4733,7 @@ QDF_STATUS sme_register_oem_data_rsp_callback(tHalHandle h_hal, QDF_STATUS status = QDF_STATUS_SUCCESS; tpAniSirGlobal pmac = PMAC_STRUCT(h_hal); - pmac->oemData.oem_data_rsp_callback = callback; + pmac->sme.oem_data_rsp_callback = callback; return status; @@ -4794,7 +4757,7 @@ void sme_deregister_oem_data_rsp_callback(tHalHandle h_hal) } pmac = PMAC_STRUCT(h_hal); - pmac->oemData.oem_data_rsp_callback = NULL; + pmac->sme.oem_data_rsp_callback = NULL; } #endif @@ -5930,54 +5893,60 @@ QDF_STATUS sme_scan_get_bkid_candidate_list(tHalHandle hHal, uint32_t sessionId, #endif /* FEATURE_WLAN_WAPI */ #ifdef FEATURE_OEM_DATA_SUPPORT - -/***************************************************************************** - OEM DATA related modifications and function additions -*****************************************************************************/ - -/* --------------------------------------------------------------------------- - \fn sme_oem_data_req - \brief a wrapper function for OEM DATA REQ - \param sessionId - session id to be used. - \param pOemDataReqId - pointer to an object to get back the request ID - \return QDF_STATUS - ---------------------------------------------------------------------------*/ -QDF_STATUS sme_oem_data_req(tHalHandle hHal, - uint8_t sessionId, - tOemDataReqConfig *pOemDataReqConfig, - uint32_t *pOemDataReqID) +/** + * sme_oem_data_req() - send oem data request to WMA + * @hal: HAL handle + * @hdd_oem_req: OEM data request from HDD + * + * Return: QDF_STATUS + */ +QDF_STATUS sme_oem_data_req(tHalHandle hal, struct oem_data_req *hdd_oem_req) { QDF_STATUS status = QDF_STATUS_SUCCESS; - tpAniSirGlobal pMac = PMAC_STRUCT(hHal); + tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); + struct oem_data_req *oem_data_req; + void *wma_handle; - do { - /* acquire the lock for the sme object */ - status = sme_acquire_global_lock(&pMac->sme); - if (QDF_IS_STATUS_SUCCESS(status)) { - uint32_t lOemDataReqId = pMac->oemData.oemDataReqID++; /* let it wrap around */ + sms_log(mac_ctx, LOG1, FL("enter")); + wma_handle = cds_get_context(QDF_MODULE_ID_WMA); + if (!wma_handle) { + sms_log(mac_ctx, LOGE, FL("wma_handle is NULL")); + return QDF_STATUS_E_FAILURE; + } - if (pOemDataReqID) { - *pOemDataReqID = lOemDataReqId; - } else { - sme_release_global_lock(&pMac->sme); - return QDF_STATUS_E_FAILURE; - } + oem_data_req = qdf_mem_malloc(sizeof(*oem_data_req)); + if (!oem_data_req) { + sms_log(mac_ctx, LOGE, FL("mem alloc failed")); + return QDF_STATUS_E_NOMEM; + } - status = - oem_data_oem_data_req(hHal, sessionId, - pOemDataReqConfig, - pOemDataReqID); + oem_data_req->data_len = hdd_oem_req->data_len; + oem_data_req->data = qdf_mem_malloc(oem_data_req->data_len); + if (!oem_data_req->data) { + sms_log(mac_ctx, LOGE, FL("mem alloc failed")); + return QDF_STATUS_E_NOMEM; + } - /* release the lock for the sme object */ - sme_release_global_lock(&pMac->sme); - } - } while (0); + qdf_mem_copy(oem_data_req->data, hdd_oem_req->data, + oem_data_req->data_len); - sms_log(pMac, LOGW, "exiting function %s", __func__); + status = wma_start_oem_data_req(wma_handle, oem_data_req); + + if (!QDF_IS_STATUS_SUCCESS(status)) { + sms_log(mac_ctx, LOGE, FL("Post oem data request msg fail")); + } else { + sms_log(mac_ctx, LOG1, + FL("OEM request(length: %d) sent to WMA"), + oem_data_req->data_len); + } + + if (oem_data_req->data_len) + qdf_mem_free(oem_data_req->data); + qdf_mem_free(oem_data_req); + sms_log(mac_ctx, LOG1, FL("exit")); return status; } - #endif /*FEATURE_OEM_DATA_SUPPORT */ /*-------------------------------------------------------------------------- @@ -15750,10 +15719,16 @@ QDF_STATUS sme_set_bpf_instructions(tHalHandle hal, set_offload->filter_id = req->filter_id; set_offload->current_offset = req->current_offset; set_offload->total_length = req->total_length; + set_offload->current_length = req->current_length; if (set_offload->total_length) { - set_offload->current_length = req->current_length; set_offload->program = qdf_mem_malloc(sizeof(uint8_t) * req->current_length); + if (NULL == set_offload->program) { + QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, + FL("Failed to alloc instruction memory")); + qdf_mem_free(set_offload); + return QDF_STATUS_E_NOMEM; + } qdf_mem_copy(set_offload->program, req->program, set_offload->current_length); } diff --git a/core/sme/src/common/sme_trace.c b/core/sme/src/common/sme_trace.c index 074d0d4f3166..ac5ce3b0c376 100644 --- a/core/sme/src/common/sme_trace.c +++ b/core/sme/src/common/sme_trace.c @@ -192,9 +192,6 @@ static uint8_t *sme_trace_get_command_string(uint32_t command) CASE_RETURN_STRING(eSmeQosCommandMask); CASE_RETURN_STRING(eSmeCommandAddTs); CASE_RETURN_STRING(eSmeCommandDelTs); -#ifdef FEATURE_OEM_DATA_SUPPORT - CASE_RETURN_STRING(eSmeCommandOemDataReq); -#endif CASE_RETURN_STRING(eSmeCommandRemainOnChannel); default: return "UNKNOWN"; diff --git a/core/sme/src/csr/csr_api_roam.c b/core/sme/src/csr/csr_api_roam.c index 02d4a7b44c9b..526bfbf16589 100644 --- a/core/sme/src/csr/csr_api_roam.c +++ b/core/sme/src/csr/csr_api_roam.c @@ -1580,7 +1580,7 @@ QDF_STATUS csr_create_roam_scan_channel_list(tpAniSirGlobal pMac, * * Return: true if ese association; false otherwise */ -bool csr_roam_is_ese_assoc(tpAniSirGlobal mac_ctx, uint8_t session_id) +bool csr_roam_is_ese_assoc(tpAniSirGlobal mac_ctx, uint32_t session_id) { return mac_ctx->roam.neighborRoamInfo[session_id].isESEAssoc; } @@ -1822,7 +1822,7 @@ QDF_STATUS csr_roam_read_tsf(tpAniSirGlobal pMac, uint8_t *pTimestamp, uint8_t sessionId) { QDF_STATUS status = QDF_STATUS_SUCCESS; - tCsrNeighborRoamBSSInfo handoffNode; + tCsrNeighborRoamBSSInfo handoffNode = {{0} }; uint32_t timer_diff = 0; uint32_t timeStamp[2]; tpSirBssDescription pBssDescription = NULL; diff --git a/core/sme/src/csr/csr_api_scan.c b/core/sme/src/csr/csr_api_scan.c index 3967119f1e4f..6f960e26be16 100644 --- a/core/sme/src/csr/csr_api_scan.c +++ b/core/sme/src/csr/csr_api_scan.c @@ -869,6 +869,8 @@ csr_update_lost_link1_cmd(tpAniSirGlobal mac_ctx, tSmeCmd *cmd, pSession->connectedProfile.operationChannel; ch_info->numOfChannels = 1; } + csr_free_scan_filter(mac_ctx, scan_filter); + qdf_mem_free(scan_filter); return status; } diff --git a/core/sme/src/oem_data/oem_data_api.c b/core/sme/src/oem_data/oem_data_api.c deleted file mode 100644 index aa0923141036..000000000000 --- a/core/sme/src/oem_data/oem_data_api.c +++ /dev/null @@ -1,398 +0,0 @@ -/* - * Copyright (c) 2012-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. - */ - -#ifdef FEATURE_OEM_DATA_SUPPORT -/** ------------------------------------------------------------------------- * - ------------------------------------------------------------------------- * - - \file oem_data_api.c - - Implementation for the OEM DATA REQ/RSP interfaces. - ========================================================================== */ -#include "ani_global.h" -#include "oem_data_api.h" -#include "cds_mq.h" -#include "sme_inside.h" -#include "sms_debug.h" -#include "qdf_util.h" - -#include "csr_support.h" - -#include "host_diag_core_log.h" -#include "host_diag_core_event.h" - -/* --------------------------------------------------------------------------- - \fn oem_data_oem_data_req_open - \brief This function must be called before any API call to (OEM DATA REQ/RSP module) - \return QDF_STATUS - -------------------------------------------------------------------------------*/ - -QDF_STATUS oem_data_oem_data_req_open(tHalHandle hHal) -{ - QDF_STATUS status = QDF_STATUS_SUCCESS; - tpAniSirGlobal pMac = PMAC_STRUCT(hHal); - - do { - /* initialize all the variables to null */ - qdf_mem_set(&(pMac->oemData), sizeof(tOemDataStruct), 0); - if (!QDF_IS_STATUS_SUCCESS(status)) { - sms_log(pMac, LOGE, - "oem_data_oem_data_req_open: Cannot allocate memory for the timer function"); - break; - } - } while (0); - - return status; -} - -/* --------------------------------------------------------------------------- - \fn oem_data_oem_data_req_close - \brief This function must be called before closing the csr module - \return QDF_STATUS - -------------------------------------------------------------------------------*/ - -QDF_STATUS oem_data_oem_data_req_close(tHalHandle hHal) -{ - QDF_STATUS status = QDF_STATUS_SUCCESS; - tpAniSirGlobal pMac = PMAC_STRUCT(hHal); - - do { - if (!QDF_IS_STATUS_SUCCESS(status)) { - sms_log(pMac, LOGE, - "oem_data_oem_data_req_close: Failed in oem_data_oem_data_req_close at StopTimers"); - break; - } - - /* initialize all the variables to null */ - qdf_mem_set(&(pMac->oemData), sizeof(tOemDataStruct), 0); - - } while (0); - - return QDF_STATUS_SUCCESS; -} - -/* --------------------------------------------------------------------------- - \fn oem_data_release_oem_data_req_command - \brief This function removes the oemDataCommand from the active list and - and frees up any memory occupied by this - \return QDF_STATUS - -------------------------------------------------------------------------------*/ -void oem_data_release_oem_data_req_command(tpAniSirGlobal pMac, - tSmeCmd *pOemDataCmd, - eOemDataReqStatus oemDataReqStatus) -{ - - /* First take this command out of the active list */ - if (csr_ll_remove_entry - (&pMac->sme.smeCmdActiveList, &pOemDataCmd->Link, LL_ACCESS_LOCK)) { - if (pOemDataCmd->u.oemDataCmd.oemDataReq.data) { - qdf_mem_free( - pOemDataCmd->u.oemDataCmd.oemDataReq.data); - pOemDataCmd->u.oemDataCmd.oemDataReq.data = - NULL; - } - qdf_mem_zero(&(pOemDataCmd->u.oemDataCmd), sizeof(tOemDataCmd)); - - /* Now put this command back on the avilable command list */ - sme_release_command(pMac, pOemDataCmd); - } else { - sms_log(pMac, LOGE, - "OEM_DATA: **************** oem_data_release_oem_data_req_command cannot release the command"); - } -} - -/* --------------------------------------------------------------------------- - \fn oem_data_oem_data_req - \brief Request an OEM DATA RSP - \param sessionId - Id of session to be used - \param pOemDataReqID - pointer to an object to get back the request ID - \return QDF_STATUS - -------------------------------------------------------------------------------*/ -QDF_STATUS oem_data_oem_data_req(tHalHandle hHal, - uint8_t sessionId, - tOemDataReqConfig *oemDataReqConfig, - uint32_t *pOemDataReqID) -{ - QDF_STATUS status = QDF_STATUS_SUCCESS; - tpAniSirGlobal pMac = PMAC_STRUCT(hHal); - tSmeCmd *pOemDataCmd = NULL; - tOemDataReq *cmd_req; - - do { - if (!CSR_IS_SESSION_VALID(pMac, sessionId)) { - status = QDF_STATUS_E_FAILURE; - break; - } - - pMac->oemData.oemDataReqID = *(pOemDataReqID); - - pMac->oemData.oemDataReqActive = false; - - pOemDataCmd = sme_get_command_buffer(pMac); - - /* fill up the command before posting it. */ - if (pOemDataCmd) { - pOemDataCmd->command = eSmeCommandOemDataReq; - pOemDataCmd->u.oemDataCmd.oemDataReqID = - pMac->oemData.oemDataReqID; - - - cmd_req = &(pOemDataCmd->u.oemDataCmd.oemDataReq); - /* set the oem data request */ - cmd_req->sessionId = sessionId; - cmd_req->data_len = oemDataReqConfig->data_len; - cmd_req->data = qdf_mem_malloc(cmd_req->data_len); - - if (!cmd_req->data) { - sms_log(pMac, LOGE, FL("memory alloc failed")); - status = QDF_STATUS_E_NOMEM; - break; - } - - qdf_mem_copy((void *)(cmd_req->data), - (void *)(oemDataReqConfig->data), - cmd_req->data_len); - } else { - status = QDF_STATUS_E_FAILURE; - break; - } - - /* now queue this command in the sme command queue */ - /* Here since this is not interacting with the csr just push the command */ - /* into the sme queue. Also push this command with the normal priority */ - sme_push_command(pMac, pOemDataCmd, false); - - } while (0); - - if (!QDF_IS_STATUS_SUCCESS(status) && pOemDataCmd) { - oem_data_release_oem_data_req_command(pMac, pOemDataCmd, - eOEM_DATA_REQ_FAILURE); - pMac->oemData.oemDataReqActive = false; - } - - return status; -} - -/* --------------------------------------------------------------------------- - \fn oem_data_send_mb_oem_data_req - \brief Request an OEM DATA REQ to be passed down to PE - \param pMac: - \param pOemDataReq: Pointer to the oem data request - \return QDF_STATUS - -------------------------------------------------------------------------------*/ -QDF_STATUS oem_data_send_mb_oem_data_req(tpAniSirGlobal pMac, - tOemDataReq *pOemDataReq) -{ - QDF_STATUS status = QDF_STATUS_SUCCESS; - tSirOemDataReq *pMsg; - tCsrRoamSession *pSession; - uint16_t msgLen; - - sms_log(pMac, LOGW, "OEM_DATA: entering Function %s", __func__); - - if (!pOemDataReq) { - sms_log(pMac, LOGE, FL("oem data req is NULL")); - return QDF_STATUS_E_INVAL; - } - - pSession = CSR_GET_SESSION(pMac, pOemDataReq->sessionId); - pMsg = qdf_mem_malloc(sizeof(*pMsg)); - if (NULL == pMsg) { - sms_log(pMac, LOGP, FL("qdf_mem_malloc failed")); - return QDF_STATUS_E_NOMEM; - } - - msgLen = (uint16_t) (sizeof(*pMsg) + pOemDataReq->data_len); - pMsg->messageType = eWNI_SME_OEM_DATA_REQ; - pMsg->messageLen = msgLen; - qdf_copy_macaddr(&pMsg->selfMacAddr, &pSession->selfMacAddr); - pMsg->data_len = pOemDataReq->data_len; - pMsg->data = pOemDataReq->data; - /* Incoming buffer ptr saved, set to null to avoid free by caller */ - pOemDataReq->data = NULL; - sms_log(pMac, LOGW, "OEM_DATA: sending message to pe%s", __func__); - status = cds_send_mb_message_to_mac(pMsg); - - sms_log(pMac, LOGW, "OEM_DATA: exiting Function %s", __func__); - - return status; -} - -/** - * oem_data_process_oem_data_req_command() - process oem data request command - * @pMac: Mac context - * @pOemDataReqCmd: pointer to oem data request command - * - * This function is called by the sme_process_command when the case hits - * eSmeCommandOemDataReq. - * - * Return: QDF_STATUS - */ -QDF_STATUS oem_data_process_oem_data_req_command(tpAniSirGlobal pMac, - tSmeCmd *pOemDataReqCmd) -{ - QDF_STATUS status = QDF_STATUS_SUCCESS; - - /* check if the system is in proper mode of operation for - * oem data req/rsp to be functional. Currently, concurrency is not - * supported and the driver must be operational only as - * STA for oem data req/rsp to be functional. We return an invalid - * mode flag if it is operational as any one of the following - * in any of the active sessions - * 1. AP Mode - * 2. IBSS Mode - * 3. BTAMP Mode - */ - - if (QDF_STATUS_SUCCESS == oem_data_is_oem_data_req_allowed(pMac)) { - sms_log(pMac, LOG1, - FL("OEM_DATA REQ allowed in the current mode")); - pMac->oemData.oemDataReqActive = true; - status = oem_data_send_mb_oem_data_req(pMac, - &(pOemDataReqCmd->u.oemDataCmd.oemDataReq)); - } else { - sms_log(pMac, LOG1, - FL("OEM_DATA REQ not allowed in the current mode")); - status = QDF_STATUS_E_FAILURE; - } - - if (!QDF_IS_STATUS_SUCCESS(status)) { - sms_log(pMac, LOG1, FL("OEM_DATA Failure, Release command")); - oem_data_release_oem_data_req_command(pMac, pOemDataReqCmd, - eOEM_DATA_REQ_INVALID_MODE); - pMac->oemData.oemDataReqActive = false; - } - - return status; -} - -/** - * sme_handle_oem_data_rsp() - processes the oem data response - * @hHal: Handle returned by mac_open. - * @pMsg: Pointer to the pSirOemDataRsp - * - * This function processes the oem data response obtained from the PE - * - * Return: QDF_STATUS. - */ -QDF_STATUS sme_handle_oem_data_rsp(tHalHandle hHal, uint8_t *pMsg) -{ - QDF_STATUS status = QDF_STATUS_SUCCESS; - tpAniSirGlobal pMac; - tListElem *pEntry = NULL; - tSmeCmd *pCommand = NULL; - tSirOemDataRsp *pOemDataRsp = NULL; - tOemDataReq *req; - - pMac = PMAC_STRUCT(hHal); - - sms_log(pMac, LOG1, "%s: OEM_DATA Entering", __func__); - - do { - if (pMsg == NULL) { - sms_log(pMac, LOGE, "in %s msg ptr is NULL", __func__); - status = QDF_STATUS_E_FAILURE; - break; - } - - /* In this case, there can be multiple OEM Data Responses for one - * OEM Data request, SME does not peek into data response so SME - * can not know which response is the last one. So SME clears active - * request command on receiving first response and thereafter SME - * passes each sunsequent response to upper user layer. - */ - pEntry = - csr_ll_peek_head(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK); - if (pEntry) { - pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); - if (eSmeCommandOemDataReq == pCommand->command) { - if (csr_ll_remove_entry - (&pMac->sme.smeCmdActiveList, - &pCommand->Link, LL_ACCESS_LOCK)) { - qdf_mem_set(&(pCommand->u.oemDataCmd), - sizeof(tOemDataCmd), 0); - req = - &(pCommand->u.oemDataCmd.oemDataReq); - qdf_mem_free(req->data); - sme_release_command(pMac, pCommand); - } - } - } - - pOemDataRsp = (tSirOemDataRsp *) pMsg; - - /* Send to upper layer only if rsp is from target */ - if (pOemDataRsp->target_rsp) { - sms_log(pMac, LOG1, - FL("received target oem data resp")); - if (pMac->oemData.oem_data_rsp_callback != NULL) - pMac->oemData.oem_data_rsp_callback( - pOemDataRsp->rsp_len, - pOemDataRsp->oem_data_rsp); - } else { - sms_log(pMac, LOG1, - FL("received internal oem data resp")); - } - qdf_mem_free(pOemDataRsp->oem_data_rsp); - } while (0); - - return status; -} - -/* --------------------------------------------------------------------------- - \fn oem_data_is_oem_data_req_allowed - \brief This function checks if OEM DATA REQs can be performed in the - current driver state - \return QDF_STATUS - -------------------------------------------------------------------------------*/ -QDF_STATUS oem_data_is_oem_data_req_allowed(tHalHandle hHal) -{ - QDF_STATUS status = QDF_STATUS_SUCCESS; - uint32_t sessionId; - - tpAniSirGlobal pMac = PMAC_STRUCT(hHal); - - for (sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++) { - if (CSR_IS_SESSION_VALID(pMac, sessionId)) { - /* co-exist with IBSS mode is not supported */ - if (csr_is_conn_state_ibss(pMac, sessionId)) { - sms_log(pMac, LOGW, - "OEM DATA REQ is not allowed due to IBSS exist in session %d", - sessionId); - status = QDF_STATUS_CSR_WRONG_STATE; - break; - } - } - } - - sms_log(pMac, LOG1, "Exiting oem_data_is_oem_data_req_allowed with status %d", - status); - - return status; -} - -#endif /*FEATURE_OEM_DATA_SUPPORT */ diff --git a/core/sme/src/rrm/sme_rrm.c b/core/sme/src/rrm/sme_rrm.c index 9570ac731800..9c25f5898228 100644 --- a/core/sme/src/rrm/sme_rrm.c +++ b/core/sme/src/rrm/sme_rrm.c @@ -1111,13 +1111,13 @@ QDF_STATUS sme_rrm_process_neighbor_report(tpAniSirGlobal pMac, void *pMsgBuf) tpRrmNeighborReportDesc pNeighborReportDesc; uint8_t i = 0; QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; - uint8_t sessionId; + uint32_t sessionId; /* Get the session id */ status = csr_roam_get_session_id_from_bssid(pMac, (struct qdf_mac_addr *) pNeighborRpt->bssId, - (uint32_t *) &sessionId); + &sessionId); if (QDF_IS_STATUS_SUCCESS(status)) { #ifdef FEATURE_WLAN_ESE /* Clear the cache for ESE. */ diff --git a/core/wma/inc/wma.h b/core/wma/inc/wma.h index 9c80a51de544..2734541c6cd6 100644 --- a/core/wma/inc/wma.h +++ b/core/wma/inc/wma.h @@ -1430,6 +1430,7 @@ typedef struct { qdf_runtime_lock_t wmi_cmd_rsp_runtime_lock; qdf_runtime_lock_t wma_runtime_resume_lock; uint32_t fine_time_measurement_cap; + bool bpf_enabled; struct wma_ini_config ini_config; struct wma_valid_channels saved_chan; /* NAN datapath support enabled in firmware */ @@ -2145,3 +2146,8 @@ QDF_STATUS wma_create_peer(tp_wma_handle wma, ol_txrx_pdev_handle pdev, struct wma_ini_config *wma_get_ini_handle(tp_wma_handle wma_handle); WLAN_PHY_MODE wma_chan_phy_mode(u8 chan, enum phy_ch_width chan_width, u8 dot11_mode); + +#ifdef FEATURE_OEM_DATA_SUPPORT +QDF_STATUS wma_start_oem_data_req(tp_wma_handle wma_handle, + struct oem_data_req *oem_req); +#endif diff --git a/core/wma/inc/wma_if.h b/core/wma/inc/wma_if.h index 01e7db0179c4..c2007c5ac772 100644 --- a/core/wma/inc/wma_if.h +++ b/core/wma/inc/wma_if.h @@ -670,19 +670,6 @@ typedef struct { #endif /** - * struct tStartOemDataReq - start OEM Data request - * @selfMacAddr: self mac address - * @status: return status - * @oemDataReq: OEM Data request - */ -typedef struct { - struct qdf_mac_addr selfMacAddr; - QDF_STATUS status; - uint32_t data_len; - uint8_t *data; -} tStartOemDataReq, *tpStartOemDataReq; - -/** * struct tStartOemDataRsp - start OEM Data response * @target_rsp: Indicates if the rsp is from Target or WMA generated. * @rsp_len: oem data response length diff --git a/core/wma/inc/wma_internal.h b/core/wma/inc/wma_internal.h index 9c4cff42ed9a..6ca99ebe73fb 100644 --- a/core/wma/inc/wma_internal.h +++ b/core/wma/inc/wma_internal.h @@ -940,15 +940,6 @@ int wma_gtk_offload_status_event(void *handle, uint8_t *event, uint32_t len); #endif #ifdef FEATURE_OEM_DATA_SUPPORT -int wma_oem_capability_event_callback(void *handle, - uint8_t *datap, uint32_t len); - -int wma_oem_measurement_report_event_callback(void *handle, uint8_t *datap, - uint32_t len); - -int wma_oem_error_report_event_callback(void *handle, uint8_t *datap, - uint32_t len); - int wma_oem_data_response_handler(void *handle, uint8_t *datap, uint32_t len); #endif @@ -1011,11 +1002,6 @@ int wma_process_receive_filter_clear_filter_req(tp_wma_handle wma_handle, tSirRcvFltPktClearParam * rcv_clear_param); -#ifdef FEATURE_OEM_DATA_SUPPORT -void wma_start_oem_data_req(tp_wma_handle wma_handle, - tStartOemDataReq * startOemDataReq); -#endif - #ifdef FEATURE_WLAN_ESE QDF_STATUS wma_process_tsm_stats_req(tp_wma_handle wma_handler, void *pTsmStatsMsg); diff --git a/core/wma/inc/wma_types.h b/core/wma/inc/wma_types.h index 5c2c0c63df65..7bb5ecaa9a26 100644 --- a/core/wma/inc/wma_types.h +++ b/core/wma/inc/wma_types.h @@ -228,12 +228,6 @@ #define WMA_BTC_SET_CFG SIR_HAL_BTC_SET_CFG #define WMA_HANDLE_FW_MBOX_RSP SIR_HAL_HANDLE_FW_MBOX_RSP -#ifdef FEATURE_OEM_DATA_SUPPORT -/* PE <-> HAL OEM_DATA RELATED MESSAGES */ -#define WMA_START_OEM_DATA_REQ SIR_HAL_START_OEM_DATA_REQ -#define WMA_START_OEM_DATA_RSP SIR_HAL_START_OEM_DATA_RSP -#endif - #define WMA_SET_MAX_TX_POWER_REQ SIR_HAL_SET_MAX_TX_POWER_REQ #define WMA_SET_MAX_TX_POWER_RSP SIR_HAL_SET_MAX_TX_POWER_RSP #define WMA_SET_TX_POWER_REQ SIR_HAL_SET_TX_POWER_REQ diff --git a/core/wma/src/wma_features.c b/core/wma/src/wma_features.c index e566ce46095f..a906e0b610c7 100644 --- a/core/wma/src/wma_features.c +++ b/core/wma/src/wma_features.c @@ -1627,262 +1627,33 @@ int wma_csa_offload_handler(void *handle, uint8_t *event, uint32_t len) } #ifdef FEATURE_OEM_DATA_SUPPORT - -/** - * wma_oem_capability_event_callback() - OEM capability event handler - * @handle: wma handle - * @datap: data ptr - * @len: data length - * - * Return: 0 for success or error code - */ -int wma_oem_capability_event_callback(void *handle, - uint8_t *datap, uint32_t len) -{ - tp_wma_handle wma = (tp_wma_handle) handle; - WMI_OEM_CAPABILITY_EVENTID_param_tlvs *param_buf; - uint8_t *data; - uint32_t datalen; - uint32_t *msg_subtype; - tStartOemDataRsp *pStartOemDataRsp; - - param_buf = (WMI_OEM_CAPABILITY_EVENTID_param_tlvs *) datap; - if (!param_buf) { - WMA_LOGE("%s: Received NULL buf ptr from FW", __func__); - return -ENOMEM; - } - - data = param_buf->data; - datalen = param_buf->num_data; - - if (!data) { - WMA_LOGE("%s: Received NULL data from FW", __func__); - return -EINVAL; - } - - /* - * wma puts 4 bytes prefix for msg subtype, so length - * of data received from target should be 4 bytes less - * then max allowed - */ - if (datalen > (OEM_DATA_RSP_SIZE - OEM_MESSAGE_SUBTYPE_LEN)) { - WMA_LOGE("%s: Received data len (%d) exceeds max value (%d)", - __func__, datalen, (OEM_DATA_RSP_SIZE - 4)); - return -EINVAL; - } - - pStartOemDataRsp = qdf_mem_malloc(sizeof(*pStartOemDataRsp)); - if (!pStartOemDataRsp) { - WMA_LOGE("%s: Failed to alloc pStartOemDataRsp", __func__); - return -ENOMEM; - } - - pStartOemDataRsp->rsp_len = datalen + OEM_MESSAGE_SUBTYPE_LEN; - if (pStartOemDataRsp->rsp_len) { - pStartOemDataRsp->oem_data_rsp = - qdf_mem_malloc(pStartOemDataRsp->rsp_len); - if (!pStartOemDataRsp->oem_data_rsp) { - WMA_LOGE(FL("malloc failed for oem_data_rsp")); - qdf_mem_free(pStartOemDataRsp); - return -ENOMEM; - } - } else { - WMA_LOGE(FL("Invalid rsp length: %d"), - pStartOemDataRsp->rsp_len); - qdf_mem_free(pStartOemDataRsp); - return -EINVAL; - } - - pStartOemDataRsp->target_rsp = true; - msg_subtype = (uint32_t *) pStartOemDataRsp->oem_data_rsp; - *msg_subtype = WMI_OEM_CAPABILITY_RSP; - /* copy data after msg sub type */ - qdf_mem_copy(pStartOemDataRsp->oem_data_rsp + OEM_MESSAGE_SUBTYPE_LEN, - data, datalen); - - WMA_LOGI("%s: Sending WMA_START_OEM_DATA_RSP, data len (%d)", - __func__, pStartOemDataRsp->rsp_len); - - wma_send_msg(wma, WMA_START_OEM_DATA_RSP, (void *)pStartOemDataRsp, 0); - return 0; -} - /** - * wma_oem_measurement_report_event_callback() - OEM measurement report handler - * @handle: wma handle - * @datap: data ptr - * @len: data length - * - * Return: 0 for success or error code - */ -int wma_oem_measurement_report_event_callback(void *handle, - uint8_t *datap, - uint32_t len) -{ - tp_wma_handle wma = (tp_wma_handle) handle; - WMI_OEM_MEASUREMENT_REPORT_EVENTID_param_tlvs *param_buf; - uint8_t *data; - uint32_t datalen; - uint32_t *msg_subtype; - tStartOemDataRsp *pStartOemDataRsp; - - param_buf = (WMI_OEM_MEASUREMENT_REPORT_EVENTID_param_tlvs *) datap; - if (!param_buf) { - WMA_LOGE("%s: Received NULL buf ptr from FW", __func__); - return -ENOMEM; - } - - data = param_buf->data; - datalen = param_buf->num_data; - - if (!data) { - WMA_LOGE("%s: Received NULL data from FW", __func__); - return -EINVAL; - } - - /* - * wma puts 4 bytes prefix for msg subtype, so length - * of data received from target should be 4 bytes less - * then max allowed - */ - if (datalen > (OEM_DATA_RSP_SIZE - OEM_MESSAGE_SUBTYPE_LEN)) { - WMA_LOGE("%s: Received data len (%d) exceeds max value (%d)", - __func__, datalen, (OEM_DATA_RSP_SIZE - 4)); - return -EINVAL; - } - - pStartOemDataRsp = qdf_mem_malloc(sizeof(*pStartOemDataRsp)); - if (!pStartOemDataRsp) { - WMA_LOGE("%s: Failed to alloc pStartOemDataRsp", __func__); - return -ENOMEM; - } - - pStartOemDataRsp->rsp_len = datalen + OEM_MESSAGE_SUBTYPE_LEN; - if (pStartOemDataRsp->rsp_len) { - pStartOemDataRsp->oem_data_rsp = - qdf_mem_malloc(pStartOemDataRsp->rsp_len); - if (!pStartOemDataRsp->oem_data_rsp) { - WMA_LOGE(FL("malloc failed for oem_data_rsp")); - qdf_mem_free(pStartOemDataRsp); - return -ENOMEM; - } - } else { - WMA_LOGE(FL("Invalid rsp length: %d"), - pStartOemDataRsp->rsp_len); - qdf_mem_free(pStartOemDataRsp); - return -EINVAL; - } - - pStartOemDataRsp->target_rsp = true; - msg_subtype = (uint32_t *) pStartOemDataRsp->oem_data_rsp; - *msg_subtype = WMI_OEM_MEASUREMENT_RSP; - /* copy data after msg sub type */ - qdf_mem_copy(pStartOemDataRsp->oem_data_rsp + OEM_MESSAGE_SUBTYPE_LEN, - data, datalen); - - WMA_LOGI("%s: Sending WMA_START_OEM_DATA_RSP, data len (%d)", - __func__, pStartOemDataRsp->rsp_len); - - wma_send_msg(wma, WMA_START_OEM_DATA_RSP, (void *)pStartOemDataRsp, 0); - return 0; -} - -/** - * wma_oem_error_report_event_callback() - OEM error report handler + * wma_oem_data_response_handler() - OEM data response event handler * @handle: wma handle * @datap: data ptr * @len: data length * * Return: 0 for success or error code */ -int wma_oem_error_report_event_callback(void *handle, - uint8_t *datap, uint32_t len) +int wma_oem_data_response_handler(void *handle, + uint8_t *datap, uint32_t len) { - tp_wma_handle wma = (tp_wma_handle) handle; - WMI_OEM_ERROR_REPORT_EVENTID_param_tlvs *param_buf; + WMI_OEM_RESPONSE_EVENTID_param_tlvs *param_buf; uint8_t *data; uint32_t datalen; - uint32_t *msg_subtype; - tStartOemDataRsp *pStartOemDataRsp; - - param_buf = (WMI_OEM_ERROR_REPORT_EVENTID_param_tlvs *) datap; - if (!param_buf) { - WMA_LOGE("%s: Received NULL buf ptr from FW", __func__); - return -ENOMEM; - } - - data = param_buf->data; - datalen = param_buf->num_data; - - if (!data) { - WMA_LOGE("%s: Received NULL data from FW", __func__); - return -EINVAL; - } + struct oem_data_rsp *oem_rsp; + tpAniSirGlobal pmac = cds_get_context(QDF_MODULE_ID_PE); - /* - * wma puts 4 bytes prefix for msg subtype, so length - * of data received from target should be 4 bytes less - * then max allowed - */ - if (datalen > (OEM_DATA_RSP_SIZE - OEM_MESSAGE_SUBTYPE_LEN)) { - WMA_LOGE("%s: Received data len (%d) exceeds max value (%d)", - __func__, datalen, (OEM_DATA_RSP_SIZE - 4)); + if (!pmac) { + WMA_LOGE(FL("Invalid pmac")); return -EINVAL; } - pStartOemDataRsp = qdf_mem_malloc(sizeof(*pStartOemDataRsp)); - if (!pStartOemDataRsp) { - WMA_LOGE("%s: Failed to alloc pStartOemDataRsp", __func__); - return -ENOMEM; - } - - pStartOemDataRsp->rsp_len = datalen + OEM_MESSAGE_SUBTYPE_LEN; - if (pStartOemDataRsp->rsp_len) { - pStartOemDataRsp->oem_data_rsp = - qdf_mem_malloc(pStartOemDataRsp->rsp_len); - if (!pStartOemDataRsp->oem_data_rsp) { - WMA_LOGE(FL("malloc failed for oem_data_rsp")); - qdf_mem_free(pStartOemDataRsp); - return -ENOMEM; - } - } else { - WMA_LOGE(FL("Invalid rsp length: %d"), - pStartOemDataRsp->rsp_len); - qdf_mem_free(pStartOemDataRsp); + if (!pmac->sme.oem_data_rsp_callback) { + WMA_LOGE(FL("Callback not registered")); return -EINVAL; } - pStartOemDataRsp->target_rsp = true; - msg_subtype = (uint32_t *) pStartOemDataRsp->oem_data_rsp; - *msg_subtype = WMI_OEM_ERROR_REPORT_RSP; - /* copy data after msg sub type */ - qdf_mem_copy(pStartOemDataRsp->oem_data_rsp + OEM_MESSAGE_SUBTYPE_LEN, - data, datalen); - - WMA_LOGI("%s: Sending WMA_START_OEM_DATA_RSP, data len (%d)", - __func__, pStartOemDataRsp->rsp_len); - - wma_send_msg(wma, WMA_START_OEM_DATA_RSP, (void *)pStartOemDataRsp, 0); - return 0; -} - -/** - * wma_oem_data_response_handler() - OEM data response event handler - * @handle: wma handle - * @datap: data ptr - * @len: data length - * - * Return: 0 for success or error code - */ -int wma_oem_data_response_handler(void *handle, - uint8_t *datap, uint32_t len) -{ - tp_wma_handle wma = (tp_wma_handle) handle; - WMI_OEM_RESPONSE_EVENTID_param_tlvs *param_buf; - uint8_t *data; - uint32_t datalen; - tStartOemDataRsp *oem_rsp; - param_buf = (WMI_OEM_RESPONSE_EVENTID_param_tlvs *) datap; if (!param_buf) { WMA_LOGE(FL("Received NULL buf ptr from FW")); @@ -1910,9 +1681,9 @@ int wma_oem_data_response_handler(void *handle, } oem_rsp->rsp_len = datalen; if (oem_rsp->rsp_len) { - oem_rsp->oem_data_rsp = qdf_mem_malloc(oem_rsp->rsp_len); - if (!oem_rsp->oem_data_rsp) { - WMA_LOGE(FL("malloc failed for oem_data_rsp")); + oem_rsp->data = qdf_mem_malloc(oem_rsp->rsp_len); + if (!oem_rsp->data) { + WMA_LOGE(FL("malloc failed for data")); qdf_mem_free(oem_rsp); return -ENOMEM; } @@ -1923,78 +1694,52 @@ int wma_oem_data_response_handler(void *handle, return -EINVAL; } - oem_rsp->target_rsp = true; - qdf_mem_copy(oem_rsp->oem_data_rsp, data, datalen); + qdf_mem_copy(oem_rsp->data, data, datalen); + + WMA_LOGI(FL("Sending OEM_DATA_RSP(len: %d) to upper layer"), datalen); + + pmac->sme.oem_data_rsp_callback(oem_rsp); - WMA_LOGI(FL("Sending WMA_START_OEM_DATA_RSP, data len %d"), datalen); + if (oem_rsp->data) + qdf_mem_free(oem_rsp->data); + qdf_mem_free(oem_rsp); - wma_send_msg(wma, WMA_START_OEM_DATA_RSP, (void *)oem_rsp, 0); return 0; } /** * wma_start_oem_data_req() - start OEM data request to target * @wma_handle: wma handle - * @startOemDataReq: start request params + * @oem_data_req: start request params * - * Return: none + * Return: QDF_STATUS */ -void wma_start_oem_data_req(tp_wma_handle wma_handle, - tStartOemDataReq *startOemDataReq) +QDF_STATUS wma_start_oem_data_req(tp_wma_handle wma_handle, + struct oem_data_req *oem_data_req) { int ret = 0; - tStartOemDataRsp *pStartOemDataRsp; WMA_LOGD(FL("Send OEM Data Request to target")); - if (!startOemDataReq || !startOemDataReq->data) { - WMA_LOGE(FL("startOemDataReq is null")); - goto out; + if (!oem_data_req || !oem_data_req->data) { + WMA_LOGE(FL("oem_data_req is null")); + return QDF_STATUS_E_INVAL; } if (!wma_handle || !wma_handle->wmi_handle) { WMA_LOGE(FL("WMA - closed, can not send Oem data request cmd")); - return; + qdf_mem_free(oem_data_req->data); + return QDF_STATUS_E_INVAL; } ret = wmi_unified_start_oem_data_cmd(wma_handle->wmi_handle, - startOemDataReq->data_len, - startOemDataReq->data); + oem_data_req->data_len, + oem_data_req->data); - if (ret != EOK) { - WMA_LOGE(FL(":wmi cmd send failed")); - } + if (!QDF_IS_STATUS_SUCCESS(ret)) + WMA_LOGE(FL("wmi cmd send failed")); -out: - /* free oem data req buffer received from UMAC */ - if (startOemDataReq) { - if (startOemDataReq->data) - qdf_mem_free(startOemDataReq->data); - qdf_mem_free(startOemDataReq); - } - - /* Now send data resp back to PE/SME with message sub-type of - * WMI_OEM_INTERNAL_RSP. This is required so that PE/SME clears - * up pending active command. Later when desired oem response(s) - * comes as wmi event from target then those shall be passed - * to oem application - */ - pStartOemDataRsp = qdf_mem_malloc(sizeof(*pStartOemDataRsp)); - if (!pStartOemDataRsp) { - WMA_LOGE("%s:failed to allocate memory for OEM Data Resp to PE", - __func__); - return; - } - qdf_mem_zero(pStartOemDataRsp, sizeof(tStartOemDataRsp)); - pStartOemDataRsp->target_rsp = false; - - WMA_LOGI("%s: Sending WMA_START_OEM_DATA_RSP to clear up PE/SME pending cmd", - __func__); - - wma_send_msg(wma_handle, WMA_START_OEM_DATA_RSP, - (void *)pStartOemDataRsp, 0); - - return; + return ret; } #endif /* FEATURE_OEM_DATA_SUPPORT */ diff --git a/core/wma/src/wma_main.c b/core/wma/src/wma_main.c index 191c760afc24..b9f0ce6ecb20 100644 --- a/core/wma/src/wma_main.c +++ b/core/wma/src/wma_main.c @@ -1962,21 +1962,6 @@ QDF_STATUS wma_open(void *cds_context, #ifdef FEATURE_OEM_DATA_SUPPORT wmi_unified_register_event_handler(wma_handle->wmi_handle, - WMI_OEM_CAPABILITY_EVENTID, - wma_oem_capability_event_callback, - WMA_RX_SERIALIZER_CTX); - - wmi_unified_register_event_handler(wma_handle->wmi_handle, - WMI_OEM_MEASUREMENT_REPORT_EVENTID, - wma_oem_measurement_report_event_callback, - WMA_RX_SERIALIZER_CTX); - - wmi_unified_register_event_handler(wma_handle->wmi_handle, - WMI_OEM_ERROR_REPORT_EVENTID, - wma_oem_error_report_event_callback, - WMA_RX_SERIALIZER_CTX); - - wmi_unified_register_event_handler(wma_handle->wmi_handle, WMI_OEM_RESPONSE_EVENTID, wma_oem_data_response_handler, WMA_RX_SERIALIZER_CTX); @@ -3967,6 +3952,7 @@ static void wma_update_hdd_cfg(tp_wma_handle wma_handle) tgt_cfg.lpss_support = wma_handle->lpss_support; #endif /* WLAN_FEATURE_LPSS */ tgt_cfg.ap_arpns_support = wma_handle->ap_arpns_support; + tgt_cfg.bpf_enabled = wma_handle->bpf_enabled; tgt_cfg.fine_time_measurement_cap = wma_handle->fine_time_measurement_cap; wma_setup_egap_support(&tgt_cfg, wma_handle); @@ -4286,6 +4272,10 @@ int wma_rx_service_ready_event(void *handle, uint8_t *cmd_param_info, WMI_SERVICE_IS_ENABLED(wma_handle->wmi_service_bitmap, WMI_SERVICE_AP_ARPNS_OFFLOAD); + wma_handle->bpf_enabled = + WMI_SERVICE_IS_ENABLED(wma_handle->wmi_service_bitmap, + WMI_SERVICE_BPF_OFFLOAD); + if (WMI_SERVICE_IS_ENABLED(wma_handle->wmi_service_bitmap, WMI_SERVICE_CSA_OFFLOAD)) { WMA_LOGD("%s: FW support CSA offload capability", __func__); @@ -5523,12 +5513,6 @@ QDF_STATUS wma_mc_process_msg(void *cds_context, cds_msg_t *msg) (tpSirGtkOffloadGetInfoRspParams)msg->bodyptr); break; #endif /* WLAN_FEATURE_GTK_OFFLOAD */ -#ifdef FEATURE_OEM_DATA_SUPPORT - case WMA_START_OEM_DATA_REQ: - wma_start_oem_data_req(wma_handle, - (tStartOemDataReq *) msg->bodyptr); - break; -#endif /* FEATURE_OEM_DATA_SUPPORT */ case WMA_SET_HOST_OFFLOAD: wma_enable_arp_ns_offload(wma_handle, (tpSirHostOffloadReq) msg->bodyptr, diff --git a/core/wma/src/wma_scan_roam.c b/core/wma/src/wma_scan_roam.c index 0bd344a38af6..ea2dd675d02e 100644 --- a/core/wma/src/wma_scan_roam.c +++ b/core/wma/src/wma_scan_roam.c @@ -1567,6 +1567,7 @@ QDF_STATUS wma_roam_scan_filter(tp_wma_handle wma_handle, break; default: WMA_LOGD("%s : Roam Filter need not be sent", __func__); + qdf_mem_free(params); return QDF_STATUS_SUCCESS; } } else { diff --git a/target/inc/wlan_module_ids.h b/target/inc/wlan_module_ids.h index 0d4d2d6f4235..39b9d4db517f 100644 --- a/target/inc/wlan_module_ids.h +++ b/target/inc/wlan_module_ids.h @@ -99,6 +99,7 @@ typedef enum { WLAN_MODULE_QBOOST, /* 0x41 */ WLAN_MODULE_P2P_LISTEN_OFFLOAD, /* 0x42 */ WLAN_MODULE_HALPHY, /* 0x43 */ + WAL_MODULE_ENQ, /* 0x44 */ WLAN_MODULE_ID_MAX, WLAN_MODULE_ID_INVALID = WLAN_MODULE_ID_MAX, diff --git a/target/inc/wmi.h b/target/inc/wmi.h index e7fec58b29c4..6d760c150ff5 100644 --- a/target/inc/wmi.h +++ b/target/inc/wmi.h @@ -81,9 +81,16 @@ PREPACK struct host_app_area_s { #define WMI_SET_FIELD(_msg_buf, _msg_type, _f, _val) \ SET_FIELD(_msg_buf, _msg_type ## _ ## _f, _val) -#define WMI_EP_APASS 0x0 +/* TYPO: leave incorrect name as an alias for the correct name */ +#define WMI_EP_APASS WMI_EP_APSS +/* WLAN driver running on apps processor sub-system */ +#define WMI_EP_APSS 0x0 #define WMI_EP_LPASS 0x1 #define WMI_EP_SENSOR 0x2 +/* WLAN driver running on NANO Hub */ +#define WMI_EP_NANOHUB 0x3 +#define WMI_EP_MODEM 0x4 +#define WMI_EP_LOCATION 0x5 /* * Control Path diff --git a/target/inc/wmi_services.h b/target/inc/wmi_services.h index 7d89b6308e42..918c6bc7339a 100644 --- a/target/inc/wmi_services.h +++ b/target/inc/wmi_services.h @@ -39,157 +39,217 @@ extern "C" { #endif -typedef enum { - WMI_SERVICE_BEACON_OFFLOAD = 0, /* beacon offload */ - WMI_SERVICE_SCAN_OFFLOAD, /* scan offload */ - WMI_SERVICE_ROAM_SCAN_OFFLOAD, /* roam scan offload */ - WMI_SERVICE_BCN_MISS_OFFLOAD, /* beacon miss offload */ - WMI_SERVICE_STA_PWRSAVE, /* fake sleep + basic power save */ - WMI_SERVICE_STA_ADVANCED_PWRSAVE, /* uapsd, pspoll, force sleep */ - WMI_SERVICE_AP_UAPSD, /* uapsd on AP */ - WMI_SERVICE_AP_DFS, /* DFS on AP */ - WMI_SERVICE_11AC, /* supports 11ac */ - WMI_SERVICE_BLOCKACK, /* Supports triggering ADDBA/DELBA from host */ - WMI_SERVICE_PHYERR, /* PHY error */ - WMI_SERVICE_BCN_FILTER, /* Beacon filter support */ - WMI_SERVICE_RTT, /* RTT (round trip time) support */ - WMI_SERVICE_WOW, /* WOW Support */ - WMI_SERVICE_RATECTRL_CACHE, /* Rate-control caching */ - WMI_SERVICE_IRAM_TIDS, /* TIDs in IRAM */ - WMI_SERVICE_ARPNS_OFFLOAD, /* ARP NS Offload support for STA vdev*/ - WMI_SERVICE_NLO, /* Network list offload service */ - WMI_SERVICE_GTK_OFFLOAD, /* GTK offload */ - WMI_SERVICE_SCAN_SCH, /* Scan Scheduler Service */ - WMI_SERVICE_CSA_OFFLOAD, /* CSA offload service */ - WMI_SERVICE_CHATTER, /* Chatter service */ - WMI_SERVICE_COEX_FREQAVOID, /* FW report freq range to avoid */ - WMI_SERVICE_PACKET_POWER_SAVE, /* packet power save service */ - WMI_SERVICE_FORCE_FW_HANG, /* Service to test the firmware recovery mechanism */ - WMI_SERVICE_GPIO, /* GPIO service */ - WMI_SERVICE_STA_DTIM_PS_MODULATED_DTIM, /* Modulated DTIM support */ - WMI_STA_UAPSD_BASIC_AUTO_TRIG, /* Basic version of station UAPSD AC Trigger Generation Method with - * variable tigger periods (service, delay, and suspend intervals) */ - WMI_STA_UAPSD_VAR_AUTO_TRIG, /* Station UAPSD AC Trigger Generation Method with variable - * trigger periods (service, delay, and suspend intervals) */ - WMI_SERVICE_STA_KEEP_ALIVE, /* Serivce to support the STA KEEP ALIVE mechanism */ - WMI_SERVICE_TX_ENCAP, /* Packet type for TX encapsulation */ - WMI_SERVICE_AP_PS_DETECT_OUT_OF_SYNC, /* detect out-of-sync sleeping stations */ - WMI_SERVICE_EARLY_RX, /* adaptive early-rx feature */ - WMI_SERVICE_STA_SMPS, /* STA MIMO-PS */ - WMI_SERVICE_FWTEST, /* Firmware test service */ - WMI_SERVICE_STA_WMMAC, /* STA WMMAC */ - WMI_SERVICE_TDLS, /* TDLS support */ - WMI_SERVICE_BURST, /* SIFS spaced burst support */ - WMI_SERVICE_MCC_BCN_INTERVAL_CHANGE, /* Dynamic beaocn interval change for SAP/P2p GO in MCC scenario */ - WMI_SERVICE_ADAPTIVE_OCS, /* Service to support adaptive off-channel scheduler */ - WMI_SERVICE_BA_SSN_SUPPORT, /* target will provide Sequence number for the peer/tid combo */ - WMI_SERVICE_FILTER_IPSEC_NATKEEPALIVE, - WMI_SERVICE_WLAN_HB, /* wlan HB service */ - WMI_SERVICE_LTE_ANT_SHARE_SUPPORT, /* support LTE/WLAN antenna sharing */ - WMI_SERVICE_BATCH_SCAN, /*Service to support batch scan */ - WMI_SERVICE_QPOWER, /* QPower service */ - WMI_SERVICE_PLMREQ, - WMI_SERVICE_THERMAL_MGMT, /* thermal throttling support */ - WMI_SERVICE_RMC, /* RMC support */ - WMI_SERVICE_MHF_OFFLOAD, /* multi-hop forwarding offload */ - WMI_SERVICE_COEX_SAR, /* target support SAR tx limit from WMI_PDEV_PARAM_TXPOWER_LIMITxG */ - WMI_SERVICE_BCN_TXRATE_OVERRIDE, /* Will support the bcn/prb rsp rate override */ - WMI_SERVICE_NAN, /* Neighbor Awareness Network */ - WMI_SERVICE_L1SS_STAT, /* L1SS statistics counter report */ - WMI_SERVICE_ESTIMATE_LINKSPEED, /* Linkspeed Estimation per peer */ - WMI_SERVICE_OBSS_SCAN, /* Service to support OBSS scan */ - WMI_SERVICE_TDLS_OFFCHAN, /* TDLS off channel support */ - WMI_SERVICE_TDLS_UAPSD_BUFFER_STA, /* TDLS UAPSD Buffer STA support */ - WMI_SERVICE_TDLS_UAPSD_SLEEP_STA, /* TDLS UAPSD Sleep STA support */ - WMI_SERVICE_IBSS_PWRSAVE, /* IBSS power save support */ - WMI_SERVICE_LPASS, /*Service to support LPASS */ - WMI_SERVICE_EXTSCAN, /* Extended Scans */ - WMI_SERVICE_D0WOW, /* D0-WOW Support */ - WMI_SERVICE_HSOFFLOAD, /* Hotspot offload feature Support */ - WMI_SERVICE_ROAM_HO_OFFLOAD, /* roam handover offload */ - WMI_SERVICE_RX_FULL_REORDER, /* target-based Rx full reorder */ - WMI_SERVICE_DHCP_OFFLOAD, /* DHCP offload support */ - WMI_SERVICE_STA_RX_IPA_OFFLOAD_SUPPORT, /* STA RX DATA offload to IPA support */ - WMI_SERVICE_MDNS_OFFLOAD, /* mDNS responder offload support */ - WMI_SERVICE_SAP_AUTH_OFFLOAD, /* softap auth offload */ - WMI_SERVICE_DUAL_BAND_SIMULTANEOUS_SUPPORT, /* Dual Band Simultaneous support */ - WMI_SERVICE_OCB, /* OCB mode support */ - WMI_SERVICE_AP_ARPNS_OFFLOAD, /* arp offload support for ap mode vdev */ - WMI_SERVICE_PER_BAND_CHAINMASK_SUPPORT, /* Per band chainmask support */ - WMI_SERVICE_PACKET_FILTER_OFFLOAD, /* Per vdev packet filters */ - WMI_SERVICE_MGMT_TX_HTT, /* Mgmt Tx via HTT interface */ - WMI_SERVICE_MGMT_TX_WMI, /* Mgmt Tx via WMI interface */ - WMI_SERVICE_EXT_MSG, /* WMI_SERVICE_READY_EXT msg follows */ - WMI_SERVICE_MAWC, /* Motion Aided WiFi Connectivity (MAWC)*/ - /* target will send ASSOC_CONF after ASSOC_CMD is processed */ - WMI_SERVICE_PEER_ASSOC_CONF, - /* enhanced green ap support */ - WMI_SERVICE_EGAP, +typedef enum { + WMI_SERVICE_BEACON_OFFLOAD = 0, /* beacon offload */ + WMI_SERVICE_SCAN_OFFLOAD = 1, /* scan offload */ + WMI_SERVICE_ROAM_SCAN_OFFLOAD = 2, /* roam scan offload */ + WMI_SERVICE_BCN_MISS_OFFLOAD = 3, /* beacon miss offload */ + /* fake sleep + basic power save */ + WMI_SERVICE_STA_PWRSAVE = 4, + WMI_SERVICE_STA_ADVANCED_PWRSAVE = 5, /* uapsd, pspoll, force sleep */ + WMI_SERVICE_AP_UAPSD = 6, /* uapsd on AP */ + WMI_SERVICE_AP_DFS = 7, /* DFS on AP */ + WMI_SERVICE_11AC = 8, /* supports 11ac */ + /* Supports triggering ADDBA/DELBA from host*/ + WMI_SERVICE_BLOCKACK = 9, + WMI_SERVICE_PHYERR = 10, /* PHY error */ + WMI_SERVICE_BCN_FILTER = 11, /* Beacon filter support */ + /* RTT (round trip time) support */ + WMI_SERVICE_RTT = 12, + WMI_SERVICE_WOW = 13, /* WOW Support */ + WMI_SERVICE_RATECTRL_CACHE = 14, /* Rate-control caching */ + WMI_SERVICE_IRAM_TIDS = 15, /* TIDs in IRAM */ + /* ARP NS Offload support for STA vdev */ + WMI_SERVICE_ARPNS_OFFLOAD = 16, + /* Network list offload service */ + WMI_SERVICE_NLO = 17, + WMI_SERVICE_GTK_OFFLOAD = 18, /* GTK offload */ + WMI_SERVICE_SCAN_SCH = 19, /* Scan Scheduler Service */ + WMI_SERVICE_CSA_OFFLOAD = 20, /* CSA offload service */ + WMI_SERVICE_CHATTER = 21, /* Chatter service */ + /* FW report freq range to avoid */ + WMI_SERVICE_COEX_FREQAVOID = 22, + WMI_SERVICE_PACKET_POWER_SAVE = 23, /* packet power save service */ + /* Service to test the firmware recovery mechanism */ + WMI_SERVICE_FORCE_FW_HANG = 24, + WMI_SERVICE_GPIO = 25, /* GPIO service */ + /* Modulated DTIM support */ + WMI_SERVICE_STA_DTIM_PS_MODULATED_DTIM = 26, + /** + * Basic version of station UAPSD AC Trigger Generation Method with + * variable tigger periods (service, delay, and suspend intervals) + */ + WMI_STA_UAPSD_BASIC_AUTO_TRIG = 27, + /** + * Station UAPSD AC Trigger Generation Method with variable + * trigger periods (service, delay, and suspend intervals) + */ + WMI_STA_UAPSD_VAR_AUTO_TRIG = 28, + /* Serivce to support the STA KEEP ALIVE mechanism */ + WMI_SERVICE_STA_KEEP_ALIVE = 29, + /* Packet type for TX encapsulation */ + WMI_SERVICE_TX_ENCAP = 30, + /* detect out-of-sync sleeping stations */ + WMI_SERVICE_AP_PS_DETECT_OUT_OF_SYNC = 31, + WMI_SERVICE_EARLY_RX = 32, /* adaptive early-rx feature */ + WMI_SERVICE_STA_SMPS = 33, /* STA MIMO-PS */ + WMI_SERVICE_FWTEST = 34, /* Firmware test service */ + WMI_SERVICE_STA_WMMAC = 35, /* STA WMMAC */ + WMI_SERVICE_TDLS = 36, /* TDLS support */ + WMI_SERVICE_BURST = 37, /* SIFS spaced burst support */ + /* Dynamic beaocn interval change for SAP/P2p GO in MCC scenario */ + WMI_SERVICE_MCC_BCN_INTERVAL_CHANGE = 38, + /* Service to support adaptive off-channel scheduler */ + WMI_SERVICE_ADAPTIVE_OCS = 39, + /* target will provide Sequence number for the peer/tid combo */ + WMI_SERVICE_BA_SSN_SUPPORT = 40, + WMI_SERVICE_FILTER_IPSEC_NATKEEPALIVE = 41, + WMI_SERVICE_WLAN_HB = 42, /* wlan HB service */ + /* support LTE/WLAN antenna sharing */ + WMI_SERVICE_LTE_ANT_SHARE_SUPPORT = 43, + WMI_SERVICE_BATCH_SCAN = 44, /*Service to support batch scan*/ + WMI_SERVICE_QPOWER = 45, /* QPower service */ + WMI_SERVICE_PLMREQ = 46, + WMI_SERVICE_THERMAL_MGMT = 47, /* thermal throttling support */ + WMI_SERVICE_RMC = 48, /* RMC support */ + /* multi-hop forwarding offload */ + WMI_SERVICE_MHF_OFFLOAD = 49, + /* target support SAR tx limit from WMI_PDEV_PARAM_TXPOWER_LIMITxG */ + WMI_SERVICE_COEX_SAR = 50, + /* Will support the bcn/prb rsp rate override */ + WMI_SERVICE_BCN_TXRATE_OVERRIDE = 51, + WMI_SERVICE_NAN = 52, /* Neighbor Awareness Network */ + /* L1SS statistics counter report */ + WMI_SERVICE_L1SS_STAT = 53, + /* Linkspeed Estimation per peer */ + WMI_SERVICE_ESTIMATE_LINKSPEED = 54, + /* Service to support OBSS scan */ + WMI_SERVICE_OBSS_SCAN = 55, + WMI_SERVICE_TDLS_OFFCHAN = 56, /* TDLS off channel support */ + /* TDLS UAPSD Buffer STA support */ + WMI_SERVICE_TDLS_UAPSD_BUFFER_STA = 57, + /* TDLS UAPSD Sleep STA support */ + WMI_SERVICE_TDLS_UAPSD_SLEEP_STA = 58, + WMI_SERVICE_IBSS_PWRSAVE = 59, /* IBSS power save support */ + WMI_SERVICE_LPASS = 60, /*Service to support LPASS*/ + WMI_SERVICE_EXTSCAN = 61, /* Extended Scans */ + WMI_SERVICE_D0WOW = 62, /* D0-WOW Support */ + /* Hotspot offload feature Support */ + WMI_SERVICE_HSOFFLOAD = 63, + WMI_SERVICE_ROAM_HO_OFFLOAD = 64, /* roam handover offload */ + /* target-based Rx full reorder */ + WMI_SERVICE_RX_FULL_REORDER = 65, + WMI_SERVICE_DHCP_OFFLOAD = 66, /* DHCP offload support */ + /* STA RX DATA offload to IPA support */ + WMI_SERVICE_STA_RX_IPA_OFFLOAD_SUPPORT = 67, + /* mDNS responder offload support */ + WMI_SERVICE_MDNS_OFFLOAD = 68, + WMI_SERVICE_SAP_AUTH_OFFLOAD = 69, /* softap auth offload */ + /* Dual Band Simultaneous support */ + WMI_SERVICE_DUAL_BAND_SIMULTANEOUS_SUPPORT = 70, + WMI_SERVICE_OCB = 71, /* OCB mode support */ + /* arp offload support for ap mode vdev */ + WMI_SERVICE_AP_ARPNS_OFFLOAD = 72, + /* Per band chainmask support */ + WMI_SERVICE_PER_BAND_CHAINMASK_SUPPORT = 73, + WMI_SERVICE_PACKET_FILTER_OFFLOAD = 74, /* Per vdev packet filters */ + WMI_SERVICE_MGMT_TX_HTT = 75, /* Mgmt Tx via HTT interface */ + WMI_SERVICE_MGMT_TX_WMI = 76, /* Mgmt Tx via WMI interface */ + /* WMI_SERVICE_READY_EXT msg follows */ + WMI_SERVICE_EXT_MSG = 77, + /* Motion Aided WiFi Connectivity (MAWC)*/ + WMI_SERVICE_MAWC = 78, + /* target will send ASSOC_CONF after ASSOC_CMD is processed */ + WMI_SERVICE_PEER_ASSOC_CONF = 79, + WMI_SERVICE_EGAP = 80, /* enhanced green ap support */ /* FW supports 11W PMF Offload for STA */ - WMI_SERVICE_STA_PMF_OFFLOAD, + WMI_SERVICE_STA_PMF_OFFLOAD = 81, /* FW supports unified D0 and D3 wow */ - WMI_SERVICE_UNIFIED_WOW_CAPABILITY, - WMI_SERVICE_ENHANCED_PROXY_STA, /* Enhanced ProxySTA mode support */ - WMI_SERVICE_ATF, /* Air Time Fairness support */ - WMI_SERVICE_COEX_GPIO, /* BTCOEX GPIO support */ - WMI_SERVICE_AUX_SPECTRAL_INTF, /* Aux Radio enhancement support for ignoring spectral scan intf from main radios */ - WMI_SERVICE_AUX_CHAN_LOAD_INTF, /* Aux Radio enhancement support for ignoring chan load intf from main radios*/ - WMI_SERVICE_BSS_CHANNEL_INFO_64, /* BSS channel info (freq, noise floor, 64-bit counters) event support */ - WMI_SERVICE_ENTERPRISE_MESH, /* Enterprise MESH Service Support */ - WMI_SERVICE_RESTRT_CHNL_SUPPORT, /* Restricted Channel Support */ - WMI_SERVICE_BPF_OFFLOAD, /* FW supports bpf offload */ - WMI_SERVICE_SYNC_DELETE_CMDS, /* FW sends response event for Peer, Vdev delete commands */ - WMI_SERVICE_SMART_ANTENNA_SW_SUPPORT, - WMI_SERVICE_SMART_ANTENNA_HW_SUPPORT, + WMI_SERVICE_UNIFIED_WOW_CAPABILITY = 82, + /* Enhanced ProxySTA mode support */ + WMI_SERVICE_ENHANCED_PROXY_STA = 83, + WMI_SERVICE_ATF = 84, /* Air Time Fairness support */ + WMI_SERVICE_COEX_GPIO = 85, /* BTCOEX GPIO support */ + /** + * Aux Radio enhancement support for ignoring spectral scan intf + * from main radios + */ + WMI_SERVICE_AUX_SPECTRAL_INTF = 86, + /** + * Aux Radio enhancement support for ignoring chan load intf + * from main radios + */ + WMI_SERVICE_AUX_CHAN_LOAD_INTF = 87, + /** + * BSS channel info (freq, noise floor, 64-bit counters) + * event support + */ + WMI_SERVICE_BSS_CHANNEL_INFO_64 = 88, + /* Enterprise MESH Service Support */ + WMI_SERVICE_ENTERPRISE_MESH = 89, + WMI_SERVICE_RESTRT_CHNL_SUPPORT = 90, /* Restricted Channel Support */ + WMI_SERVICE_BPF_OFFLOAD = 91, /* FW supports bpf offload */ + /* FW sends response event for Peer, Vdev delete commands */ + WMI_SERVICE_SYNC_DELETE_CMDS = 92, + WMI_SERVICE_SMART_ANTENNA_SW_SUPPORT = 93, + WMI_SERVICE_SMART_ANTENNA_HW_SUPPORT = 94, /* allow per-peer tx MCS min/max limits by host */ - WMI_SERVICE_RATECTRL_LIMIT_MAX_MIN_RATES, - WMI_SERVICE_NAN_DATA, /* FW supports NAN data */ - WMI_SERVICE_NAN_RTT, /* FW supports NAN RTT */ - WMI_SERVICE_11AX, /* FW supports 802.11ax */ + WMI_SERVICE_RATECTRL_LIMIT_MAX_MIN_RATES = 95, + WMI_SERVICE_NAN_DATA = 96, /* FW supports NAN data */ + WMI_SERVICE_NAN_RTT = 97, /* FW supports NAN RTT */ + WMI_SERVICE_11AX = 98, /* FW supports 802.11ax */ + /* WMI_SERVICE_DEPRECATED_REPLACE * FW supports these new WMI commands, to be used rather than * deprecated matching commands: * - WMI_PDEV_SET_PCL_CMDID (vs. WMI_SOC_SET_PCL_CMDID) - * - WMI_PDEV_SET_HW_MODE_CMDID (vs. WMI_SOC_SET_HW_MODE_CMDID) + * - WMI_PDEV_SET_HW_MODE_CMDID + * (vs. WMI_SOC_SET_HW_MODE_CMDID) * - WMI_PDEV_SET_MAC_CONFIG_CMDID - * (vs. WMI_SOC_SET_DUAL_MAC_CONFIG_CMDID) + * (vs. WMI_SOC_SET_DUAL_MAC_CONFIG_CMDID) * - WMI_PDEV_SET_ANTENNA_MODE_CMDID - * (vs. WMI_SOC_SET_ANTENNA_MODE_CMDID) - * - WMI_VDEV_SET_DSCP_TID_MAP_CMDID (vs. WMI_VDEV_SET_WMM_PARAMS_CMDID) + * (vs. WMI_SOC_SET_ANTENNA_MODE_CMDID) + * - WMI_VDEV_SET_DSCP_TID_MAP_CMDID + * (vs. WMI_VDEV_SET_WMM_PARAMS_CMDID) */ - WMI_SERVICE_DEPRECATED_REPLACE, - WMI_SERVICE_TDLS_CONN_TRACKER_IN_HOST_MODE, /* FW supports a new mode that allows to run connection tracker in host */ - WMI_SERVICE_ENHANCED_MCAST_FILTER,/* FW supports enhanced multicast filtering (of mcast IP inside ucast WLAN) */ - /* periodic channel stats service */ - WMI_SERVICE_PERIODIC_CHAN_STAT_SUPPORT, - WMI_SERVICE_MESH_11S, /* 11s mesh service support */ - /* - * FW+HW supports 10 MHz(half rate) and 5 MHz(quarter rate) channel - * bandwidth + WMI_SERVICE_DEPRECATED_REPLACE = 99, + /** + * FW supports a new mode that allows to run connection tracker + * in host */ - WMI_SERVICE_HALF_RATE_QUARTER_RATE_SUPPORT, - /* - * Support per-vdev specs of which rx frames - * to filter out + WMI_SERVICE_TDLS_CONN_TRACKER_IN_HOST_MODE = 100, + /** + * FW supports enhanced multicast filtering (of mcast IP inside + * ucast WLAN) */ - WMI_SERVICE_VDEV_RX_FILTER, - WMI_SERVICE_P2P_LISTEN_OFFLOAD_SUPPORT, - /* + WMI_SERVICE_ENHANCED_MCAST_FILTER = 101, + /* periodic channel stats service */ + WMI_SERVICE_PERIODIC_CHAN_STAT_SUPPORT = 102, + WMI_SERVICE_MESH_11S = 103, + /** + * FW+HW supports 10 MHz (half rate) and 5 MHz (quarter rate) + * channel bandwidth + */ + WMI_SERVICE_HALF_RATE_QUARTER_RATE_SUPPORT = 104, + /* Support per-vdev specs of which rx frames to filter out */ + WMI_SERVICE_VDEV_RX_FILTER = 105, + WMI_SERVICE_P2P_LISTEN_OFFLOAD_SUPPORT = 106, + /** * FW supports marking the first data packet which wakes * the host from suspend */ - WMI_SERVICE_MARK_FIRST_WAKEUP_PACKET, + WMI_SERVICE_MARK_FIRST_WAKEUP_PACKET = 107, /* FW supports command that can add/delete multiple mcast filters */ - WMI_SERVICE_MULTIPLE_MCAST_FILTER_SET, + WMI_SERVICE_MULTIPLE_MCAST_FILTER_SET = 108, /* WMI_SERVICE_HOST_MANAGED_RX_REORDER - * FW supports host-managed RX reorder. * Host managed RX reorder involves RX BA state machine handling * on peer/TID basis, REO configuration for HW based reordering/PN * check and processing reorder exceptions generated by HW. */ - WMI_SERVICE_HOST_MANAGED_RX_REORDER, + WMI_SERVICE_HOST_MANAGED_RX_REORDER = 109, /* Specify whether the target supports the following WMI messages * for reading / writing its flash memory: * WMI_READ_DATA_FROM_FLASH_CMDID, @@ -197,16 +257,39 @@ typedef enum { * WMI_TRANSFER_DATA_TO_FLASH_CMDID, * WMI_TRANSFER_DATA_TO_FLASH_COMPLETE_EVENTID, */ - WMI_SERVICE_FLASH_RDWR_SUPPORT, + WMI_SERVICE_FLASH_RDWR_SUPPORT = 110, + + + /*** ADD NEW SERVICES HERE UNTIL ALL VALUES UP TO 128 ARE USED ***/ + + WMI_MAX_SERVICE = 128, /* max service */ + + /** + * NOTE: + * The above service flags are delivered in the wmi_service_bitmap + * field of the WMI_SERVICE_READY_EVENT message. + * The below service flags are delivered in a + * WMI_SERVICE_AVAILABLE_EVENT message rather than in the + * WMI_SERVICE_READY_EVENT message's wmi_service_bitmap field. + * The WMI_SERVICE_AVAILABLE_EVENT message immediately precedes the + * WMI_SERVICE_READY_EVENT message. + */ + + /*PUT 1ST EXT SERVICE HERE:*//*WMI_SERVICE_xxxxxxxx=128,*/ + /*PUT 2ND EXT SERVICE HERE:*//*WMI_SERVICE_yyyyyyyy=129,*/ + + WMI_MAX_EXT_SERVICE - WMI_MAX_SERVICE = 128 /* max service */ } WMI_SERVICE; #define WMI_SERVICE_BM_SIZE ((WMI_MAX_SERVICE + sizeof(A_UINT32)- 1)/sizeof(A_UINT32)) -/* - * depreciated the name WMI_SERVICE_ROAM_OFFLOAD, but here to help compiling - * with old host driver +#define WMI_NUM_EXT_SERVICES (WMI_MAX_EXT_SERVICE - WMI_MAX_SERVICE) +#define WMI_SERVICE_EXT_BM_SIZE32 ((WMI_NUM_EXT_SERVICES + 31) / 32) + +/** + * depreciated the name WMI_SERVICE_ROAM_OFFLOAD, but here to help + * compiling with old host driver */ #define WMI_SERVICE_ROAM_OFFLOAD WMI_SERVICE_ROAM_SCAN_OFFLOAD @@ -225,6 +308,39 @@ typedef enum { ( ((pwmi_svc_bmap)[(svc_id)/(sizeof(A_UINT32))] & \ (1 << ((svc_id)%(sizeof(A_UINT32)))) ) != 0) +#define WMI_SERVICE_EXT_ENABLE(pwmi_svc_bmap, pwmi_svc_ext_bmap, svc_id) \ + do { \ + if (svc_id < WMI_MAX_SERVICE) { \ + WMI_SERVICE_ENABLE(pwmi_svc_bmap, svc_id); \ + } else { \ + int word = ((svc_id) - WMI_MAX_SERVICE) / 32; \ + int bit = (svc_id) & 0x1f; /* svc_id mod 32 */ \ + (pwmi_svc_ext_bmap)[word] |= (1 << bit); \ + } \ + } while (0) + +#define WMI_SERVICE_EXT_DISABLE(pwmi_svc_bmap, pwmi_svc_ext_bmap, svc_id) \ + do { \ + if (svc_id < WMI_MAX_SERVICE) { \ + WMI_SERVICE_DISABLE(pwmi_svc_bmap, svc_id); \ + } else { \ + int word = ((svc_id) - WMI_MAX_SERVICE) / 32; \ + int bit = (svc_id) & 0x1f; /* svc_id mod 32 */ \ + (pwmi_svc_ext_bmap)[word] &= ~(1 << bit); \ + } \ + } while (0) + +#define WMI_SERVICE_EXT_IS_ENABLED(pwmi_svc_bmap, pwmi_svc_ext_bmap, svc_id) \ + /* If the service ID is beyond the known limit, treat it as disabled */ \ + ((svc_id) >= WMI_MAX_EXT_SERVICE ? 0 : \ + /* If service ID is in the non-extension range, use the old check */ \ + (svc_id) < WMI_MAX_SERVICE ? \ + WMI_SERVICE_IS_ENABLED(pwmi_svc_bmap, svc_id) : \ + /* If service ID is in the extended range, check ext_bmap */ \ + (pwmi_svc_ext_bmap)[((svc_id) - WMI_MAX_SERVICE) / 32] >> \ + ((svc_id) & 0x1f)) + + #ifdef __cplusplus } #endif diff --git a/target/inc/wmi_tlv_defs.h b/target/inc/wmi_tlv_defs.h index 2dbe1edd3a66..532d9123de0d 100644 --- a/target/inc/wmi_tlv_defs.h +++ b/target/inc/wmi_tlv_defs.h @@ -724,6 +724,12 @@ typedef enum { WMITLV_TAG_STRUC_wmi_peer_set_rx_blocksize_cmd_fixed_param, WMITLV_TAG_STRUC_WMI_PDEV_SET_WAKEUP_CONFIG_CMDID_fixed_param, WMITLV_TAG_STRUC_wmi_tlv_buf_len_param, + WMITLV_TAG_STRUC_wmi_service_available_event_fixed_param, + WMITLV_TAG_STRUC_wmi_peer_antdiv_info_req_cmd_fixed_param, + WMITLV_TAG_STRUC_wmi_peer_antdiv_info_event_fixed_param, + WMITLV_TAG_STRUC_wmi_peer_antdiv_info, + WMITLV_TAG_STRUC_wmi_pdev_get_antdiv_status_cmd_fixed_param, + WMITLV_TAG_STRUC_wmi_pdev_antdiv_status_event_fixed_param, } WMITLV_TAG_ID; /* @@ -1020,6 +1026,8 @@ typedef enum { OP(WMI_PDEV_SET_REORDER_TIMEOUT_VAL_CMDID) \ OP(WMI_PEER_SET_RX_BLOCKSIZE_CMDID) \ OP(WMI_PDEV_SET_WAKEUP_CONFIG_CMDID) \ + OP(WMI_PEER_ANTDIV_INFO_REQ_CMDID) \ + OP(WMI_PDEV_GET_ANTDIV_STATUS_CMDID) \ /* add new CMD_LIST elements above this line */ /* @@ -1173,6 +1181,9 @@ typedef enum { OP(WMI_P2P_LISTEN_OFFLOAD_STOPPED_EVENTID) \ OP(WMI_MGMT_TX_BUNDLE_COMPLETION_EVENTID) \ OP(WMI_READ_DATA_FROM_FLASH_EVENTID) \ + OP(WMI_SERVICE_AVAILABLE_EVENTID) \ + OP(WMI_PEER_ANTDIV_INFO_EVENTID) \ + OP(WMI_PDEV_ANTDIV_STATUS_EVENTID) \ /* add new EVT_LIST elements above this line */ /* TLV definitions of WMI commands */ @@ -2324,6 +2335,12 @@ WMITLV_CREATE_PARAM_STRUC(WMI_BATCH_SCAN_ENABLE_CMDID); WMITLV_CREATE_PARAM_STRUC(WMI_PEER_INFO_REQ_CMDID); +#define WMITLV_TABLE_WMI_PEER_ANTDIV_INFO_REQ_CMDID(id, op, buf, len) \ + WMITLV_ELEM(id, op, buf, len, WMITLV_TAG_STRUC_wmi_peer_antdiv_info_req_cmd_fixed_param, \ + wmi_peer_antdiv_info_req_cmd_fixed_param, fixed_param, WMITLV_SIZE_FIX) + +WMITLV_CREATE_PARAM_STRUC(WMI_PEER_ANTDIV_INFO_REQ_CMDID); + #define WMITLV_TABLE_WMI_RMC_SET_MODE_CMDID(id,op,buf,len) \ WMITLV_ELEM(id,op,buf,len, WMITLV_TAG_STRUC_wmi_rmc_set_mode_cmd_fixed_param, \ wmi_rmc_set_mode_cmd_fixed_param, fixed_param, WMITLV_SIZE_FIX) @@ -2532,6 +2549,11 @@ WMITLV_CREATE_PARAM_STRUC(WMI_D0_WOW_ENABLE_DISABLE_CMDID); WMITLV_ELEM(id,op,buf,len, WMITLV_TAG_STRUC_wmi_pdev_get_temperature_cmd_fixed_param, wmi_pdev_get_temperature_cmd_fixed_param, fixed_param, WMITLV_SIZE_FIX) WMITLV_CREATE_PARAM_STRUC(WMI_PDEV_GET_TEMPERATURE_CMDID); +/* Pdev get ANT DIV feature status Cmd */ +#define WMITLV_TABLE_WMI_PDEV_GET_ANTDIV_STATUS_CMDID(id, op, buf, len) \ + WMITLV_ELEM(id, op, buf, len, WMITLV_TAG_STRUC_wmi_pdev_get_antdiv_status_cmd_fixed_param, wmi_pdev_get_antdiv_status_cmd_fixed_param, fixed_param, WMITLV_SIZE_FIX) +WMITLV_CREATE_PARAM_STRUC(WMI_PDEV_GET_ANTDIV_STATUS_CMDID); + /* Set antenna diversity Cmd */ #define WMITLV_TABLE_WMI_SET_ANTENNA_DIVERSITY_CMDID(id,op,buf,len) \ WMITLV_ELEM(id, op, buf, len, WMITLV_TAG_STRUC_wmi_pdev_set_antenna_diversity_cmd_fixed_param, wmi_pdev_set_antenna_diversity_cmd_fixed_param, fixed_param, WMITLV_SIZE_FIX) @@ -2945,6 +2967,11 @@ WMITLV_CREATE_PARAM_STRUC(WMI_PEER_REORDER_QUEUE_REMOVE_CMDID); WMITLV_ELEM(id, op, buf, len, WMITLV_TAG_ARRAY_UINT32, A_UINT32, wlan_dbs_hw_mode_list, WMITLV_SIZE_VAR) WMITLV_CREATE_PARAM_STRUC(WMI_SERVICE_READY_EVENTID); +/* service available event */ +#define WMITLV_TABLE_WMI_SERVICE_AVAILABLE_EVENTID(id, op, buf, len) \ + WMITLV_ELEM(id, op, buf, len, WMITLV_TAG_STRUC_wmi_service_available_event_fixed_param, wmi_service_available_event_fixed_param, fixed_param, WMITLV_SIZE_FIX) +WMITLV_CREATE_PARAM_STRUC(WMI_SERVICE_AVAILABLE_EVENTID); + /* Service Ready Extension event */ #define WMITLV_TABLE_WMI_SERVICE_READY_EXT_EVENTID(id, op, buf, len) \ WMITLV_ELEM(id, op, buf, len, WMITLV_TAG_STRUC_wmi_service_ready_ext_event_fixed_param, wmi_service_ready_ext_event_fixed_param, fixed_param, WMITLV_SIZE_FIX) \ @@ -3436,6 +3463,11 @@ WMITLV_CREATE_PARAM_STRUC(WMI_AP_PS_EGAP_INFO_EVENTID); WMITLV_ELEM(id,op,buf,len, WMITLV_TAG_ARRAY_STRUC, wmi_peer_info, peer_info, WMITLV_SIZE_VAR) WMITLV_CREATE_PARAM_STRUC(WMI_PEER_INFO_EVENTID); +#define WMITLV_TABLE_WMI_PEER_ANTDIV_INFO_EVENTID(id, op, buf, len) \ + WMITLV_ELEM(id, op, buf, len, WMITLV_TAG_STRUC_wmi_peer_antdiv_info_event_fixed_param, wmi_peer_antdiv_info_event_fixed_param, fixed_param, WMITLV_SIZE_FIX) \ + WMITLV_ELEM(id, op, buf, len, WMITLV_TAG_ARRAY_STRUC, wmi_peer_antdiv_info, peer_info, WMITLV_SIZE_VAR) +WMITLV_CREATE_PARAM_STRUC(WMI_PEER_ANTDIV_INFO_EVENTID); + #define WMITLV_TABLE_WMI_PEER_TX_FAIL_CNT_THR_EVENTID(id,op,buf,len) \ WMITLV_ELEM(id,op,buf,len, WMITLV_TAG_STRUC_wmi_peer_tx_fail_cnt_thr_event_fixed_param, wmi_peer_tx_fail_cnt_thr_event_fixed_param, fixed_param, WMITLV_SIZE_FIX) WMITLV_CREATE_PARAM_STRUC(WMI_PEER_TX_FAIL_CNT_THR_EVENTID); @@ -3597,6 +3629,11 @@ WMITLV_CREATE_PARAM_STRUC(WMI_D0_WOW_DISABLE_ACK_EVENTID); WMITLV_ELEM(id,op,buf,len, WMITLV_TAG_STRUC_wmi_pdev_temperature_event_fixed_param, wmi_pdev_temperature_event_fixed_param, fixed_param, WMITLV_SIZE_FIX) WMITLV_CREATE_PARAM_STRUC(WMI_PDEV_TEMPERATURE_EVENTID); +/* Pdev get ANT DIV feature status event */ +#define WMITLV_TABLE_WMI_PDEV_ANTDIV_STATUS_EVENTID(id, op, buf, len) \ + WMITLV_ELEM(id, op, buf, len, WMITLV_TAG_STRUC_wmi_pdev_antdiv_status_event_fixed_param, wmi_pdev_antdiv_status_event_fixed_param, fixed_param, WMITLV_SIZE_FIX) +WMITLV_CREATE_PARAM_STRUC(WMI_PDEV_ANTDIV_STATUS_EVENTID); + /* mDNS offload stats event */ #define WMITLV_TABLE_WMI_MDNS_STATS_EVENTID(id,op,buf,len) \ WMITLV_ELEM(id,op,buf,len, WMITLV_TAG_STRUC_wmi_mdns_stats_event_fixed_param, wmi_mdns_stats_event_fixed_param, fixed_param, WMITLV_SIZE_FIX) diff --git a/target/inc/wmi_unified.h b/target/inc/wmi_unified.h index ee856a6f66e1..c91ad3e25c17 100644 --- a/target/inc/wmi_unified.h +++ b/target/inc/wmi_unified.h @@ -349,6 +349,8 @@ typedef enum { WMI_PDEV_SET_REORDER_TIMEOUT_VAL_CMDID, /** WMI command for WOW gpio and type */ WMI_PDEV_SET_WAKEUP_CONFIG_CMDID, + /* Get current ANT's per chain's RSSI info */ + WMI_PDEV_GET_ANTDIV_STATUS_CMDID, /* VDEV (virtual device) specific commands */ /** vdev create */ @@ -453,6 +455,11 @@ typedef enum { WMI_PEER_REORDER_QUEUE_REMOVE_CMDID, /** specify a limit for rx A-MPDU block size */ WMI_PEER_SET_RX_BLOCKSIZE_CMDID, + /** + * request peer antdiv info from FW. FW shall respond with + * PEER_ANTDIV_INFO_EVENTID + */ + WMI_PEER_ANTDIV_INFO_REQ_CMDID, /* beacon/management specific commands */ @@ -1002,6 +1009,13 @@ typedef enum { /** WMI is ready; after this event the wlan subsystem is initialized and can process commands. */ WMI_READY_EVENTID, + /** + * Specify what WMI services the target supports + * (for services beyond what fits in the WMI_SERVICE_READY_EVENT + * message's wmi_service_bitmap) + */ + WMI_SERVICE_AVAILABLE_EVENTID, + /** Scan specific events */ WMI_SCAN_EVENTID = WMI_EVT_GRP_START_ID(WMI_GRP_SCAN), @@ -1057,6 +1071,8 @@ typedef enum { WMI_PDEV_SET_HW_MODE_RESP_EVENTID, WMI_PDEV_HW_MODE_TRANSITION_EVENTID, WMI_PDEV_SET_MAC_CONFIG_RESP_EVENTID, + /** Report ANT DIV feature's status */ + WMI_PDEV_ANTDIV_STATUS_EVENTID, /* VDEV specific events */ /** VDEV started event in response to VDEV_START request */ @@ -1112,6 +1128,8 @@ typedef enum { WMI_PEER_RATECODE_LIST_EVENTID, WMI_WDS_PEER_EVENTID, WMI_PEER_STA_PS_STATECHG_EVENTID, + /** Peer Ant Div Info Event with rssi per chain, etc */ + WMI_PEER_ANTDIV_INFO_EVENTID, /* beacon/mgmt specific events */ /** RX management frame. the entire frame is carried along with the event. */ @@ -1898,6 +1916,26 @@ typedef struct { */ } wmi_service_ready_event_fixed_param; +#define WMI_SERVICE_SEGMENT_BM_SIZE32 4 /* 4x A_UINT32 = 128 bits */ +typedef struct { + /** + * TLV tag and len; tag equals + * WMITLV_TAG_STRUC_wmi_service_available_event_fixed_param + */ + A_UINT32 tlv_header; + /** + * The wmi_service_segment offset field specifies the position + * within the logical bitmap of WMI service flags at which the + * WMI service flags specified within this message begin. + * Since the first 128 WMI service flags are specified within + * the wmi_service_bitmap field of the WMI_SERVICE_READY_EVENT + * message, the wmi_service_segment_offset value is expected to + * be 128 or more. + */ + A_UINT32 wmi_service_segment_offset; + A_UINT32 wmi_service_segment_bitmap[WMI_SERVICE_SEGMENT_BM_SIZE32]; +} wmi_service_available_event_fixed_param; + typedef struct { /* TLV tag and len; tag equals *WMITLV_TAG_STRUC_WMI_SERVICE_EXT_READY_EVENT @@ -3756,6 +3794,27 @@ typedef enum { * Units are microseconds. */ WMI_PDEV_PARAM_PROPAGATION_DELAY, + /** + * Host can enable/disable ANT DIV feature + * if it's been enabled in BDF + */ + WMI_PDEV_PARAM_ENA_ANT_DIV, + /** Host can force one chain to select a specific ANT */ + WMI_PDEV_PARAM_FORCE_CHAIN_ANT, + /** + * Start a cycle ANT self test periodically. + * In the test, the FW would select each ANT pair + * one by one, the cycle time could be configured + * via WMI_PDEV_PARAM_ANT_DIV_SELFTEST_INTVL + */ + WMI_PDEV_PARAM_ANT_DIV_SELFTEST, + /** + * Configure the cycle time of ANT self test, + * the unit is micro second. Per the timer + * limitation, too small value could be not so + * accurate. + */ + WMI_PDEV_PARAM_ANT_DIV_SELFTEST_INTVL, } WMI_PDEV_PARAM; @@ -5685,6 +5744,13 @@ typedef enum { WMI_VDEV_PARAM_DISABLE_DYN_BW_RTS, /* + * Per ssid (vdev) based ATF strict/fair scheduling policy + * Param values are WMI_ATF_SSID_FAIR_SCHED or + * WMI_ATF_SSID_STRICT_SCHED + */ + WMI_VDEV_PARAM_ATF_SSID_SCHED_POLICY, + + /* * === ADD NEW VDEV PARAM TYPES ABOVE THIS LINE === * The below vdev param types are used for prototyping, and are * prone to change. @@ -8526,6 +8592,7 @@ typedef enum wake_reason_e { WOW_REASON_TDLS_CONN_TRACKER_EVENT, WOW_REASON_CRITICAL_LOG, WOW_REASON_P2P_LISTEN_OFFLOAD, + WOW_REASON_NAN_EVENT_WAKE_HOST, WOW_REASON_DEBUG_TEST = 0xFF, } WOW_WAKE_REASON_TYPE; @@ -11056,6 +11123,69 @@ typedef struct { */ } wmi_peer_info_event_fixed_param; +/** + * WMI_PEER_ANTDIV_INFO_REQ_CMDID + * Request FW to provide peer info + */ +typedef struct { + /** + * TLV tag and len; tag equals + * WMITLV_TAG_STRUC_wmi_peer_antdiv_info_req_cmd_fixed_param + */ + A_UINT32 tlv_header; + /** + * In order to get the peer antdiv info for a single peer, host shall + * issue the peer_mac_address of that peer. For getting the + * info all peers, the host shall issue 0xFFFFFFFF as the mac + * address. The firmware will return the peer info for all the + * peers on the specified vdev_id + */ + wmi_mac_addr peer_mac_address; + /** vdev id */ + A_UINT32 vdev_id; +} wmi_peer_antdiv_info_req_cmd_fixed_param; + +/** FW response with the peer antdiv info */ +typedef struct { + /** TLV tag and len; tag equals + * WMITLV_TAG_STRUC_wmi_peer_antdiv_info_event_fixed_param + */ + A_UINT32 tlv_header; + /** number of peers in peer_info */ + A_UINT32 num_peers; + /** VDEV to which the peer belongs to */ + A_UINT32 vdev_id; + /** + * This TLV is followed by another TLV of array of structs + * wmi_peer_antdiv_info peer_antdiv_info[]; + */ +} wmi_peer_antdiv_info_event_fixed_param; + +typedef struct { + /** + * TLV tag and len; tag equals + * WMITLV_TAG_STRUC_wmi_peer_antdiv_info + */ + A_UINT32 tlv_header; + /** mac addr of the peer */ + wmi_mac_addr peer_mac_address; + /** + * per chain rssi of the peer, for up to 8 chains. + * Each chain's entry reports the RSSI for different bandwidths: + * bits 7:0 -> primary 20 MHz + * bits 15:8 -> secondary 20 MHz of 40 MHz channel (if applicable) + * bits 23:16 -> secondary 40 MHz of 80 MHz channel (if applicable) + * bits 31:24 -> secondary 80 MHz of 160 MHz channel (if applicable) + * Each of these 8-bit RSSI reports is in dB units, with respect to + * the noise floor. + * 0x80 means invalid. + * All unused bytes within used chain_rssi indices shall be + * set to 0x80. + * All unused chain_rssi indices shall be set to 0x80808080. + */ + A_INT32 chain_rssi[8]; +} wmi_peer_antdiv_info; + /** FW response when tx failure count has reached threshold * for a peer */ typedef struct { @@ -13175,6 +13305,50 @@ typedef struct { A_UINT32 pdev_id; } wmi_pdev_temperature_event_fixed_param; +typedef enum { + ANTDIV_HW_CFG_STATUS, + ANTDIV_SW_CFG_STATUS, + ANTDIV_MAX_STATUS_TYPE_NUM +} ANTDIV_STATUS_TYPE; + +typedef struct { + /** + * TLV tag and len; tag equals + * WMITLV_TAG_STRUC_wmi_pdev_get_antdiv_status_cmd_fixed_param + */ + A_UINT32 tlv_header; + /* Status event ID - see ANTDIV_STATUS_TYPE */ + A_UINT32 status_event_id; + /** + * pdev_id for identifying the MAC + * See macros starting with WMI_PDEV_ID_ for values. + */ + A_UINT32 pdev_id; +} wmi_pdev_get_antdiv_status_cmd_fixed_param; + +typedef struct { + /** + * TLV tag and len; tag equals + * WMITLV_TAG_STRUC_wmi_pdev_antdiv_status_event_fixed_param + */ + A_UINT32 tlv_header; + /* ANT DIV feature enabled or not */ + A_UINT32 support; + A_UINT32 chain_num; /* how many chain supported */ + /* how many ANT supported, 32 max */ + A_UINT32 ant_num; + /** + * Each entry is for a tx/rx chain, and contains a bitmap + * identifying the antennas attached to that tx/rx chain. + */ + A_UINT32 selectable_ant_mask[8]; + /** + * pdev_id for identifying the MAC + * See macros starting with WMI_PDEV_ID_ for values. + */ + A_UINT32 pdev_id; +} wmi_pdev_antdiv_status_event_fixed_param; + typedef struct { A_UINT32 tlv_header; /* TLV tag and len; tag equals WMITLV_TAG_STRUC_wmi_set_dhcp_server_offload_cmd_fixed_param */ A_UINT32 vdev_id; @@ -15512,6 +15686,9 @@ typedef struct { /* Expressed in 1 part in 1000 (permille) */ #define WMI_ATF_DENOMINATION 1000 +#define WMI_ATF_SSID_FAIR_SCHED 0 /** Fair ATF scheduling for vdev */ +#define WMI_ATF_SSID_STRICT_SCHED 1 /** Strict ATF scheduling for vdev */ + typedef struct { /* * TLV tag and len; tag equals diff --git a/target/inc/wmi_version.h b/target/inc/wmi_version.h index 298387df02b3..7144897209ea 100644 --- a/target/inc/wmi_version.h +++ b/target/inc/wmi_version.h @@ -36,7 +36,7 @@ #define __WMI_VER_MINOR_ 0 /** WMI revision number has to be incremented when there is a * change that may or may not break compatibility */ -#define __WMI_REVISION_ 275 +#define __WMI_REVISION_ 280 /** The Version Namespace should not be normally changed. Only * host and firmware of the same WMI namespace will work |
