diff options
98 files changed, 5047 insertions, 1845 deletions
@@ -65,6 +65,7 @@ ifeq ($(KERNEL_BUILD), 0) # builds. Other OEMs are also protected using the TARGET_BUILD_VARIANT # config. ifneq ($(TARGET_BUILD_VARIANT),user) + CONFIG_FEATURE_PKTLOG := y ifeq ($(CONFIG_SLUB_DEBUG_ON),y) CONFIG_FEATURE_DP_TRACE := y else @@ -98,6 +99,9 @@ ifeq ($(KERNEL_BUILD), 0) ifeq ($(CONFIG_MOBILE_ROUTER), y) CONFIG_QCACLD_FEATURE_GREEN_AP := y endif + ifeq ($(CONFIG_ARCH_MSMCOBALT), y) + CONFIG_QCACLD_FEATURE_GREEN_AP := y + endif #Flag to enable Fast Transition (11r) feature CONFIG_QCOM_VOWIFI_11R := y @@ -155,6 +159,9 @@ ifneq ($(CONFIG_ROME_IF),sdio) #Flag to enable memdump feature CONFIG_WLAN_FEATURE_MEMDUMP := n + #Flag to enable DISA + CONFIG_WLAN_FEATURE_DISA := y + #Flag to enable Fast Path feature CONFIG_WLAN_FASTPATH := y @@ -416,6 +423,10 @@ ifeq ($(CONFIG_WLAN_FEATURE_MEMDUMP),y) HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_memdump.o endif +ifeq ($(CONFIG_WLAN_FEATURE_DISA),y) +HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_disa.o +endif + ifeq ($(CONFIG_LFR_SUBNET_DETECTION), y) HDD_OBJS += $(HDD_SRC_DIR)/wlan_hdd_subnet_detect.o endif @@ -1114,6 +1125,10 @@ ifeq ($(CONFIG_WLAN_FASTPATH), y) CDEFINES += -DWLAN_FEATURE_FASTPATH endif +ifeq ($(CONFIG_FEATURE_PKTLOG), y) +CDEFINES += -DFEATURE_PKTLOG +endif + ifeq ($(CONFIG_FEATURE_DP_TRACE), y) CDEFINES += -DFEATURE_DP_TRACE endif @@ -1537,6 +1552,10 @@ ifeq ($(CONFIG_WLAN_FEATURE_MEMDUMP),y) CDEFINES += -DWLAN_FEATURE_MEMDUMP endif +ifeq ($(CONFIG_WLAN_FEATURE_DISA),y) +CDEFINES += -DWLAN_FEATURE_DISA +endif + ifeq ($(CONFIG_LFR_SUBNET_DETECTION), y) CDEFINES += -DFEATURE_LFR_SUBNET_DETECTION endif @@ -132,4 +132,8 @@ config FEATURE_DP_TRACE bool "Enable data path trace feature" default n +config WLAN_FEATURE_DISA + bool "Enable DISA certification feature" + default n + endif # QCA_CLD_WLAN diff --git a/core/cds/inc/cds_api.h b/core/cds/inc/cds_api.h index 5f5487711488..140a453a11af 100644 --- a/core/cds/inc/cds_api.h +++ b/core/cds/inc/cds_api.h @@ -206,6 +206,13 @@ QDF_STATUS cds_enable(v_CONTEXT_t cds_context); QDF_STATUS cds_disable(v_CONTEXT_t cds_context); +/** + * cds_flush_cache_rx_queue() - flush cache rx queue frame + * + * Return: None + */ +void cds_flush_cache_rx_queue(void); + QDF_STATUS cds_close(v_CONTEXT_t cds_context); QDF_STATUS cds_shutdown(v_CONTEXT_t cds_context); diff --git a/core/cds/inc/cds_concurrency.h b/core/cds/inc/cds_concurrency.h index a8a6a3dcd46b..efe9f70622e0 100644 --- a/core/cds/inc/cds_concurrency.h +++ b/core/cds/inc/cds_concurrency.h @@ -635,13 +635,10 @@ static inline void cds_force_sap_on_scc(eCsrRoamResult roam_result, #endif /* FEATURE_WLAN_FORCE_SAP_SCC */ #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH -void cds_check_concurrent_intf_and_restart_sap( - hdd_station_ctx_t *hdd_sta_ctx, - hdd_adapter_t *adapter); +void cds_check_concurrent_intf_and_restart_sap(hdd_adapter_t *adapter); #else static inline void cds_check_concurrent_intf_and_restart_sap( - hdd_station_ctx_t *hdd_sta_ctx, - hdd_adapter_t *adapter) + hdd_adapter_t *adapter) { } @@ -693,6 +690,7 @@ void cds_decr_session_set_pcl(enum tQDF_ADAPTER_MODE mode, uint8_t session_id); QDF_STATUS cds_init_policy_mgr(struct cds_sme_cbacks *sme_cbacks); QDF_STATUS cds_deinit_policy_mgr(void); +uint8_t cds_get_channel(enum cds_con_mode mode, uint32_t *vdev_id); QDF_STATUS cds_get_pcl(enum cds_con_mode mode, uint8_t *pcl_channels, uint32_t *len, uint8_t *pcl_weight, uint32_t weight_len); @@ -797,7 +795,7 @@ QDF_STATUS qdf_wait_for_connection_update(void); QDF_STATUS qdf_reset_connection_update(void); QDF_STATUS qdf_set_connection_update(void); QDF_STATUS qdf_init_connection_update(void); -QDF_STATUS cds_stop_start_opportunistic_timer(void); +QDF_STATUS cds_restart_opportunistic_timer(bool check_state); QDF_STATUS cds_modify_sap_pcl_based_on_mandatory_channel(uint8_t *pcl_list_org, uint8_t *weight_list_org, uint32_t *pcl_len_org); @@ -832,4 +830,8 @@ bool cds_is_hw_mode_change_after_vdev_up(void); void cds_dump_connection_status_info(void); uint32_t cds_mode_specific_connection_count(enum cds_con_mode mode, uint32_t *list); +void cds_hw_mode_transition_cb(uint32_t old_hw_mode_index, + uint32_t new_hw_mode_index, + uint32_t num_vdev_mac_entries, + struct sir_vdev_mac_map *vdev_mac_map); #endif /* __CDS_CONCURRENCY_H */ diff --git a/core/cds/src/cds_api.c b/core/cds/src/cds_api.c index e37e9c729f25..bcc146f1e1d4 100644 --- a/core/cds/src/cds_api.c +++ b/core/cds/src/cds_api.c @@ -117,14 +117,13 @@ void cds_deinit(void) if (gp_cds_context == NULL) return; + qdf_mc_timer_manager_exit(); + qdf_mem_exit(); + gp_cds_context->qdf_ctx = NULL; gp_cds_context = NULL; qdf_mem_zero(&g_cds_context, sizeof(g_cds_context)); - - qdf_mc_timer_manager_exit(); - qdf_mem_exit(); - return; } @@ -818,6 +817,22 @@ QDF_STATUS cds_close(v_CONTEXT_t cds_context) return QDF_STATUS_SUCCESS; } +void cds_flush_cache_rx_queue(void) +{ + uint8_t sta_id; + struct ol_txrx_peer_t *peer; + struct ol_txrx_pdev_t *pdev = cds_get_context(QDF_MODULE_ID_TXRX); + + for (sta_id = 0; sta_id < WLAN_MAX_STA_COUNT; sta_id++) { + peer = ol_txrx_peer_find_by_local_id(pdev, sta_id); + if (!peer) + continue; + ol_txrx_flush_rx_frames(peer, 1); + } + return; +} + + /** * cds_get_context() - get context data area * diff --git a/core/cds/src/cds_concurrency.c b/core/cds/src/cds_concurrency.c index 601e7f999408..946dc819b45a 100644 --- a/core/cds/src/cds_concurrency.c +++ b/core/cds/src/cds_concurrency.c @@ -2512,10 +2512,10 @@ static void cds_pdev_set_hw_mode_cb(uint32_t status, * * Return: None */ -static void cds_hw_mode_transition_cb(uint32_t old_hw_mode_index, - uint32_t new_hw_mode_index, - uint32_t num_vdev_mac_entries, - struct sir_vdev_mac_map *vdev_mac_map) +void cds_hw_mode_transition_cb(uint32_t old_hw_mode_index, + uint32_t new_hw_mode_index, + uint32_t num_vdev_mac_entries, + struct sir_vdev_mac_map *vdev_mac_map) { QDF_STATUS status; struct sir_hw_mode_params hw_mode; @@ -4951,6 +4951,36 @@ bool cds_map_concurrency_mode(enum tQDF_ADAPTER_MODE *old_mode, } /** + * cds_get_channel() - provide channel number of given mode and vdevid + * @mode: given CDS mode + * @vdev_id: pointer to vdev_id + * + * This API will provide channel number of matching mode and vdevid. + * If vdev_id is NULL then it will match only mode + * If vdev_id is not NULL the it will match both mode and vdev_id + * + * Return: channel number + */ +uint8_t cds_get_channel(enum cds_con_mode mode, uint32_t *vdev_id) +{ + uint32_t idx = 0; + + if (mode >= CDS_MAX_NUM_OF_MODE) { + cds_err("incorrect mode"); + return 0; + } + + for (idx = 0; idx < MAX_NUMBER_OF_CONC_CONNECTIONS; idx++) { + if ((conc_connection_list[idx].mode == mode) && + (!vdev_id || (*vdev_id == + conc_connection_list[idx].vdev_id)) + && conc_connection_list[idx].in_use) + return conc_connection_list[idx].chan; + } + return 0; +} + +/** * cds_get_pcl() - provides the preferred channel list for * new connection * @mode: Device mode @@ -6245,14 +6275,11 @@ QDF_STATUS cds_next_actions(uint32_t session_id, return status; } /** - * if already in DBS no need to request DBS or if already in - * non dbs no need request for non dbs again. Might be needed + * if already in DBS no need to request DBS. Might be needed * to extend the logic when multiple dbs HW mode is available */ if ((((CDS_DBS_DOWNGRADE == action) || (CDS_DBS == action)) - && hw_mode.dbs_cap) || - (((CDS_SINGLE_MAC_UPGRADE == action) || - (CDS_SINGLE_MAC == action)) && !hw_mode.dbs_cap)) { + && hw_mode.dbs_cap)) { cds_err("driver is already in %s mode, no further action needed", (hw_mode.dbs_cap) ? "dbs" : "non dbs"); return QDF_STATUS_E_ALREADY; @@ -7013,17 +7040,18 @@ static void cds_check_sta_ap_concurrent_ch_intf(void *data) } } + /** * cds_check_concurrent_intf_and_restart_sap() - Check concurrent change intf - * @hdd_sta_ctx: Pointer to HDD STA context + * @adapter: Pointer to HDD adapter * * Checks the concurrent change interface and restarts SAP * Return: None */ -void cds_check_concurrent_intf_and_restart_sap(hdd_station_ctx_t *hdd_sta_ctx, - hdd_adapter_t *adapter) +void cds_check_concurrent_intf_and_restart_sap(hdd_adapter_t *adapter) { hdd_context_t *hdd_ctx; + hdd_station_ctx_t *hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); if (!hdd_ctx) { @@ -8169,13 +8197,17 @@ enum cds_conc_next_action cds_get_current_pref_hw_mode(void) } /** - * cds_stop_start_opportunistic_timer() - Start and stop the opportunistic timer + * cds_restart_opportunistic_timer() - Restarts opportunistic timer + * @check_state: check timer state if this flag is set, else restart + * irrespective of state * - * Stops and starts the opportunistic timer for DBS_OPPORTUNISTIC_TIME seconds + * Restarts opportunistic timer for DBS_OPPORTUNISTIC_TIME seconds. + * Check if current state is RUNNING if check_state is set, else + * restart the timer irrespective of state. * * Return: QDF_STATUS */ -QDF_STATUS cds_stop_start_opportunistic_timer(void) +QDF_STATUS cds_restart_opportunistic_timer(bool check_state) { QDF_STATUS status = QDF_STATUS_E_FAILURE; p_cds_contextType cds_ctx; @@ -8186,6 +8218,11 @@ QDF_STATUS cds_stop_start_opportunistic_timer(void) return status; } + if (check_state && + QDF_TIMER_STATE_RUNNING != + cds_ctx->dbs_opportunistic_timer.state) + return status; + qdf_mc_timer_stop(&cds_ctx->dbs_opportunistic_timer); status = qdf_mc_timer_start( @@ -8822,7 +8859,7 @@ QDF_STATUS cds_set_hw_mode_on_channel_switch(uint8_t session_id) * as well. */ if (action == CDS_SINGLE_MAC_UPGRADE) { - qdf_status = cds_stop_start_opportunistic_timer(); + qdf_status = cds_restart_opportunistic_timer(false); if (QDF_IS_STATUS_SUCCESS(qdf_status)) cds_info("opportunistic timer for MCC upgrade"); goto done; diff --git a/core/dp/htt/htt_t2h.c b/core/dp/htt/htt_t2h.c index 9cfd7b71f703..c7863a618613 100644 --- a/core/dp/htt/htt_t2h.c +++ b/core/dp/htt/htt_t2h.c @@ -165,7 +165,7 @@ void htt_t2h_lp_msg_handler(void *context, qdf_nbuf_t htt_t2h_msg, switch (msg_type) { case HTT_T2H_MSG_TYPE_VERSION_CONF: { - htc_pm_runtime_get(pdev->htc_pdev); + htc_pm_runtime_put(pdev->htc_pdev); pdev->tgt_ver.major = HTT_VER_CONF_MAJOR_GET(*msg_word); pdev->tgt_ver.minor = HTT_VER_CONF_MINOR_GET(*msg_word); qdf_print diff --git a/core/dp/txrx/ol_rx_fwd.c b/core/dp/txrx/ol_rx_fwd.c index 65af905ee306..31ca346de900 100644 --- a/core/dp/txrx/ol_rx_fwd.c +++ b/core/dp/txrx/ol_rx_fwd.c @@ -132,6 +132,10 @@ static inline void ol_rx_fwd_to_tx(struct ol_txrx_vdev_t *vdev, qdf_nbuf_t msdu) rx_desc)); } + /* Clear the msdu control block as it will be re-interpreted */ + qdf_mem_set(msdu->cb, sizeof(msdu->cb), 0); + /* update any cb field expected by OL_TX_SEND */ + msdu = OL_TX_SEND(vdev, msdu); if (msdu) { diff --git a/core/hdd/inc/wlan_hdd_cfg.h b/core/hdd/inc/wlan_hdd_cfg.h index 65640a50fa28..9cfeeb3cf36a 100644 --- a/core/hdd/inc/wlan_hdd_cfg.h +++ b/core/hdd/inc/wlan_hdd_cfg.h @@ -396,12 +396,6 @@ typedef enum { #define CFG_BEACON_INTERVAL_MAX WNI_CFG_BEACON_INTERVAL_STAMAX #define CFG_BEACON_INTERVAL_DEFAULT WNI_CFG_BEACON_INTERVAL_STADEF -/* Additional Handoff related Parameters */ -#define CFG_ROAMING_TIME_NAME "gRoamingTime" -#define CFG_ROAMING_TIME_MIN (0) -#define CFG_ROAMING_TIME_MAX (4294967UL) -#define CFG_ROAMING_TIME_DEFAULT (10) - #define CFG_VCC_RSSI_TRIGGER_NAME "gVccRssiTrigger" #define CFG_VCC_RSSI_TRIGGER_MIN (0) #define CFG_VCC_RSSI_TRIGGER_MAX (80) @@ -515,6 +509,12 @@ typedef enum { /* Not to use CFG default because if no registry setting, this is ignored by SME. */ #define CFG_MAX_TX_POWER_DEFAULT WNI_CFG_CURRENT_TX_POWER_LEVEL_STAMAX +/* This ini controls driver to honor/dishonor power constraint from AP */ +#define CFG_TX_POWER_CTRL_NAME "gAllowTPCfromAP" +#define CFG_TX_POWER_CTRL_DEFAULT (1) +#define CFG_TX_POWER_CTRL_MIN (0) +#define CFG_TX_POWER_CTRL_MAX (1) + #define CFG_LOW_GAIN_OVERRIDE_NAME "gLowGainOverride" #define CFG_LOW_GAIN_OVERRIDE_MIN WNI_CFG_LOW_GAIN_OVERRIDE_STAMIN #define CFG_LOW_GAIN_OVERRIDE_MAX WNI_CFG_LOW_GAIN_OVERRIDE_STAMAX @@ -1246,7 +1246,13 @@ typedef enum { #define CFG_ENABLE_PACKET_LOG "gEnablePacketLog" #define CFG_ENABLE_PACKET_LOG_MIN (0) #define CFG_ENABLE_PACKET_LOG_MAX (1) +#ifdef FEATURE_PKTLOG #define CFG_ENABLE_PACKET_LOG_DEFAULT (1) +#else +#define CFG_ENABLE_PACKET_LOG_DEFAULT (0) +#endif + + /* gFwDebugLogType takes values from enum dbglog_process_t, * make default value as DBGLOG_PROCESS_NET_RAW to give the @@ -2881,14 +2887,14 @@ enum dot11p_mode { #ifdef FEATURE_WLAN_EXTSCAN /* - * This ini is added to control the enabling of extscan feature outside of code - * To enable , gExtScanEnable=1 need to be declared in ini file. - * Otherwise, Extscan feature will remain disabled. + * This ini is added to control the enabling of extscan feature outside of code. + * By default extscan feature will be enabled, to disable extscan add + * gExtScanEnable=0 in ini file. */ #define CFG_EXTSCAN_ALLOWED_NAME "gExtScanEnable" #define CFG_EXTSCAN_ALLOWED_MIN (0) #define CFG_EXTSCAN_ALLOWED_MAX (1) -#define CFG_EXTSCAN_ALLOWED_DEF (0) +#define CFG_EXTSCAN_ALLOWED_DEF (1) #define CFG_EXTSCAN_PASSIVE_MAX_CHANNEL_TIME_NAME "gExtScanPassiveMaxChannelTime" #define CFG_EXTSCAN_PASSIVE_MAX_CHANNEL_TIME_MIN (0) @@ -3482,6 +3488,11 @@ enum dot11p_mode { #define CFG_SIFS_BURST_DURATION_MAX (12) #define CFG_SIFS_BURST_DURATION_DEFAULT (8) +/* Optimize channel avoidance indication comming from firmware */ +#define CFG_OPTIMIZE_CA_EVENT_NAME "goptimize_chan_avoid_event" +#define CFG_OPTIMIZE_CA_EVENT_DISABLE (0) +#define CFG_OPTIMIZE_CA_EVENT_ENABLE (1) +#define CFG_OPTIMIZE_CA_EVENT_DEFAULT (0) /*--------------------------------------------------------------------------- Type declarations @@ -3539,6 +3550,7 @@ struct hdd_config { uint32_t goLinkMonitorPeriod; uint32_t nBeaconInterval; uint8_t nTxPowerCap; /* In dBm */ + bool allow_tpc_from_ap; bool fIsLowGainOverride; uint8_t disablePacketFilter; bool fRrmEnable; @@ -3569,7 +3581,6 @@ struct hdd_config { int32_t nhi_rssi_scan_rssi_ub; /* Additional Handoff params */ - uint32_t nRoamingTime; uint16_t nVccRssiTrigger; uint32_t nVccUlMacLossThreshold; @@ -4140,6 +4151,7 @@ struct hdd_config { bool multicast_replay_filter; /* parameter for indicating sifs burst duration to fw */ uint8_t sifs_burst_duration; + bool goptimize_chan_avoid_event; }; #define VAR_OFFSET(_Struct, _Var) (offsetof(_Struct, _Var)) @@ -4255,7 +4267,7 @@ QDF_STATUS hdd_parse_config_ini(hdd_context_t *pHddCtx); QDF_STATUS hdd_update_mac_config(hdd_context_t *pHddCtx); QDF_STATUS hdd_set_sme_config(hdd_context_t *pHddCtx); QDF_STATUS hdd_set_sme_chan_list(hdd_context_t *hdd_ctx); -bool hdd_update_config_dat(hdd_context_t *pHddCtx); +bool hdd_update_config_cfg(hdd_context_t *pHddCtx); QDF_STATUS hdd_cfg_get_global_config(hdd_context_t *pHddCtx, char *pBuf, int buflen); diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h index e0dfae71a240..577f1f9d84e0 100644 --- a/core/hdd/inc/wlan_hdd_main.h +++ b/core/hdd/inc/wlan_hdd_main.h @@ -156,6 +156,9 @@ #define MAX_CFG_STRING_LEN 255 +/* SSR Retry Count */ +#define HDD_MOD_EXIT_SSR_MAX_RETRIES 75 + #define MAC_ADDR_ARRAY(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5] /** Mac Address string **/ #define MAC_ADDRESS_STR "%02x:%02x:%02x:%02x:%02x:%02x" @@ -796,6 +799,8 @@ typedef struct hdd_scaninfo_s { /* Additional IE for scan */ tSirAddie scanAddIE; + uint8_t *default_scan_ies; + uint8_t default_scan_ies_len; /* Scan mode */ tSirScanType scan_mode; @@ -1224,6 +1229,16 @@ enum driver_modules_status { DRIVER_MODULES_CLOSED }; +/** + * struct acs_dfs_policy - Define ACS policies + * @acs_dfs_mode: Dfs mode enabled/disabled. + * @acs_channel: pre defined channel to avoid ACS. + */ +struct acs_dfs_policy { + enum dfs_mode acs_dfs_mode; + uint8_t acs_channel; +}; + /** Adapter structure definition */ struct hdd_context_s { @@ -1495,6 +1510,8 @@ struct hdd_context_s { bool stop_modules_in_progress; bool start_modules_in_progress; bool update_mac_addr_to_fw; + struct acs_dfs_policy acs_policy; + uint16_t wmi_max_len; }; /*--------------------------------------------------------------------------- @@ -1536,6 +1553,7 @@ QDF_STATUS hdd_close_adapter(hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter, bool rtnl_held); QDF_STATUS hdd_close_all_adapters(hdd_context_t *pHddCtx, bool rtnl_held); QDF_STATUS hdd_stop_all_adapters(hdd_context_t *pHddCtx); +void hdd_deinit_all_adapters(hdd_context_t *hdd_ctx, bool rtnl_held); QDF_STATUS hdd_reset_all_adapters(hdd_context_t *pHddCtx); QDF_STATUS hdd_start_all_adapters(hdd_context_t *pHddCtx); hdd_adapter_t *hdd_get_adapter_by_vdev(hdd_context_t *pHddCtx, @@ -1848,4 +1866,10 @@ static inline void hdd_enable_fastpath(struct hdd_config *hdd_cfg, #endif void hdd_wlan_update_target_info(hdd_context_t *hdd_ctx, void *context); +enum sap_acs_dfs_mode wlan_hdd_get_dfs_mode(enum dfs_mode mode); + +void hdd_ch_avoid_cb(void *hdd_context, void *indi_param); +void hdd_unsafe_channel_restart_sap(hdd_context_t *hdd_ctx); +int hdd_enable_disable_ca_event(hdd_context_t *hddctx, + uint8_t set_value); #endif /* end #if !defined(WLAN_HDD_MAIN_H) */ diff --git a/core/hdd/inc/wlan_hdd_napi.h b/core/hdd/inc/wlan_hdd_napi.h index 460af7e878e4..1ad0ef9bec04 100644 --- a/core/hdd/inc/wlan_hdd_napi.h +++ b/core/hdd/inc/wlan_hdd_napi.h @@ -93,8 +93,8 @@ static inline int hdd_napi_event(enum qca_napi_event event, void *data) return 0; } static inline struct qca_napi_data *hdd_napi_get_all(void) { return NULL; } -static inline int hdd_napi_apply_throughput_policy(struct hdd_context_s *, - uint64_t, uint64_t) +static inline int hdd_napi_apply_throughput_policy(void *hdd_ctx, + uint64_t tx_packets, uint64_t rx_packets) { return 0; } diff --git a/core/hdd/inc/wlan_hdd_power.h b/core/hdd/inc/wlan_hdd_power.h index 19536f88bd26..e173d4f517db 100644 --- a/core/hdd/inc/wlan_hdd_power.h +++ b/core/hdd/inc/wlan_hdd_power.h @@ -189,6 +189,9 @@ int wlan_hdd_ipv4_changed(struct notifier_block *nb, int wlan_hdd_ipv6_changed(struct notifier_block *nb, unsigned long data, void *arg); +int hdd_set_qpower_config(hdd_context_t *hddctx, hdd_adapter_t *adapter, + uint8_t qpower); + #ifdef FEATURE_WLAN_DIAG_SUPPORT void hdd_wlan_suspend_resume_event(uint8_t state); #else diff --git a/core/hdd/inc/wlan_hdd_wext.h b/core/hdd/inc/wlan_hdd_wext.h index eee4f440f022..8829dfa07b78 100644 --- a/core/hdd/inc/wlan_hdd_wext.h +++ b/core/hdd/inc/wlan_hdd_wext.h @@ -291,6 +291,8 @@ typedef struct ccp_freq_chan_map_s { wlan_hdd_get_vendor_oui_ie_ptr(WFD_OUI_TYPE, WFD_OUI_TYPE_SIZE, ie, ie_len) #endif +#define wlan_hdd_get_mbo_ie_ptr(ie, ie_len) \ + wlan_hdd_get_vendor_oui_ie_ptr(MBO_OUI_TYPE, MBO_OUI_TYPE_SIZE, ie, ie_len) /* * Defines for fw_test command */ diff --git a/core/hdd/src/wlan_hdd_assoc.c b/core/hdd/src/wlan_hdd_assoc.c index 93a7529b856e..312349735478 100644 --- a/core/hdd/src/wlan_hdd_assoc.c +++ b/core/hdd/src/wlan_hdd_assoc.c @@ -364,7 +364,7 @@ static int hdd_add_beacon_filter(hdd_adapter_t *adapter) hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter); for (i = 0; i < ARRAY_SIZE(beacon_filter_table); i++) - qdf_set_bit((beacon_filter_table[i] - 1), + qdf_set_bit((beacon_filter_table[i]), (unsigned long int *)ie_map); status = sme_add_beacon_filter(hdd_ctx->hHal, @@ -1392,10 +1392,7 @@ static void hdd_send_association_event(struct net_device *dev, NULL, pAdapter->device_mode); } -#ifdef WLAN_FEATURE_LPSS - pAdapter->rssi_send = false; - wlan_hdd_send_status_pkg(pAdapter, pHddStaCtx, 1, 0); -#endif + hdd_lpass_notify_disconnect(pAdapter); #ifdef FEATURE_WLAN_TDLS hdd_info("Disassoc: Check and enable or disable TDLS state "); if ((pAdapter->device_mode == QDF_STA_MODE || @@ -2482,8 +2479,7 @@ static QDF_STATUS hdd_association_completion_handler(hdd_adapter_t *pAdapter, #endif hdd_info("check for SAP restart"); - cds_check_concurrent_intf_and_restart_sap(pHddStaCtx, - pAdapter); + cds_check_concurrent_intf_and_restart_sap(pAdapter); DPTRACE(qdf_dp_trace_mgmt_pkt(QDF_DP_TRACE_MGMT_PACKET_RECORD, pAdapter->sessionId, @@ -4738,19 +4734,6 @@ hdd_sme_roam_callback(void *pContext, tCsrRoamInfo *pRoamInfo, uint32_t roamId, FL("hdd_ReassocScenario set to: %d, due to eCSR_ROAM_FT_START, session: %d"), pHddStaCtx->hdd_ReassocScenario, pAdapter->sessionId); break; - case eCSR_ROAM_DISABLE_QUEUES: - hdd_info("Disabling queues"); - wlan_hdd_netif_queue_control(pAdapter, - WLAN_NETIF_TX_DISABLE, - WLAN_CONTROL_PATH); - break; - case eCSR_ROAM_ENABLE_QUEUES: - hdd_info("Enabling queues"); - wlan_hdd_netif_queue_control(pAdapter, - WLAN_WAKE_ALL_NETIF_QUEUE, - WLAN_CONTROL_PATH); - break; - case eCSR_ROAM_SHOULD_ROAM: /* notify apps that we can't pass traffic anymore */ hddLog(LOG1, FL("Disabling queues")); @@ -5034,6 +5017,22 @@ hdd_sme_roam_callback(void *pContext, tCsrRoamInfo *pRoamInfo, uint32_t roamId, hdd_ndp_event_handler(pAdapter, pRoamInfo, roamId, roamStatus, roamResult); break; + case eCSR_ROAM_START: + hdd_info("Process ROAM_START from firmware"); + wlan_hdd_netif_queue_control(pAdapter, + WLAN_NETIF_TX_DISABLE, + WLAN_CONTROL_PATH); + cds_set_connection_in_progress(true); + cds_restart_opportunistic_timer(true); + break; + case eCSR_ROAM_ABORT: + hdd_info("Firmware aborted roaming operation, previous connection is still valid"); + wlan_hdd_netif_queue_control(pAdapter, + WLAN_WAKE_ALL_NETIF_QUEUE, + WLAN_CONTROL_PATH); + cds_set_connection_in_progress(false); + break; + default: break; } diff --git a/core/hdd/src/wlan_hdd_cfg.c b/core/hdd/src/wlan_hdd_cfg.c index f16c31324d8a..4a21c6cbf385 100644 --- a/core/hdd/src/wlan_hdd_cfg.c +++ b/core/hdd/src/wlan_hdd_cfg.c @@ -687,13 +687,6 @@ REG_TABLE_ENTRY g_registry_table[] = { CFG_BEACON_INTERVAL_MIN, CFG_BEACON_INTERVAL_MAX), - REG_VARIABLE(CFG_ROAMING_TIME_NAME, WLAN_PARAM_Integer, - struct hdd_config, nRoamingTime, - VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, - CFG_ROAMING_TIME_DEFAULT, - CFG_ROAMING_TIME_MIN, - CFG_ROAMING_TIME_MAX), - REG_VARIABLE(CFG_VCC_RSSI_TRIGGER_NAME, WLAN_PARAM_Integer, struct hdd_config, nVccRssiTrigger, VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, @@ -836,6 +829,13 @@ REG_TABLE_ENTRY g_registry_table[] = { CFG_MAX_TX_POWER_MIN, CFG_MAX_TX_POWER_MAX), + REG_VARIABLE(CFG_TX_POWER_CTRL_NAME, WLAN_PARAM_Integer, + struct hdd_config, allow_tpc_from_ap, + VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, + CFG_TX_POWER_CTRL_DEFAULT, + CFG_TX_POWER_CTRL_MIN, + CFG_TX_POWER_CTRL_MAX), + REG_VARIABLE(CFG_LOW_GAIN_OVERRIDE_NAME, WLAN_PARAM_Integer, struct hdd_config, fIsLowGainOverride, VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, @@ -3970,6 +3970,13 @@ REG_TABLE_ENTRY g_registry_table[] = { CFG_SIFS_BURST_DURATION_DEFAULT, CFG_SIFS_BURST_DURATION_MIN, CFG_SIFS_BURST_DURATION_MAX), + REG_VARIABLE(CFG_OPTIMIZE_CA_EVENT_NAME, WLAN_PARAM_Integer, + struct hdd_config, goptimize_chan_avoid_event, + VAR_FLAGS_OPTIONAL | + VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, + CFG_OPTIMIZE_CA_EVENT_DEFAULT, + CFG_OPTIMIZE_CA_EVENT_DISABLE, + CFG_OPTIMIZE_CA_EVENT_ENABLE), }; /** @@ -4945,6 +4952,9 @@ void hdd_cfg_print(hdd_context_t *pHddCtx) pHddCtx->config->nTxPowerCap); #endif QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_INFO_HIGH, + "Name = [gAllowTPCfromAP] Value = [%u] ", + pHddCtx->config->allow_tpc_from_ap); + QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_INFO_HIGH, "Name = [FastRoamEnabled] Value = [%u] ", pHddCtx->config->isFastRoamIniFeatureEnabled); QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_INFO_HIGH, @@ -5461,78 +5471,70 @@ void hdd_cfg_print(hdd_context_t *pHddCtx) QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_INFO_HIGH, "Name = [gP2PListenDeferInterval] Value = [%u]", pHddCtx->config->p2p_listen_defer_interval); - QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR, - "Name = [is_ps_enabled] value = [%d]", - pHddCtx->config->is_ps_enabled); - QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR, - "Name = [tso_enable] value = [%d]", + hdd_notice("Name = [is_ps_enabled] value = [%d]", + pHddCtx->config->is_ps_enabled); + hdd_notice("Name = [tso_enable] value = [%d]", pHddCtx->config->tso_enable); - QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR, - "Name = [LROEnable] value = [%d]", + hdd_notice("Name = [LROEnable] value = [%d]", pHddCtx->config->lro_enable); - QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR, - "Name = [active_mode_offload] value = [%d]", + hdd_notice("Name = [active_mode_offload] value = [%d]", pHddCtx->config->active_mode_offload); - QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR, - "Name = [gfine_time_meas_cap] value = [%u]", + hdd_notice("Name = [gfine_time_meas_cap] value = [%u]", pHddCtx->config->fine_time_meas_cap); #ifdef WLAN_FEATURE_FASTPATH QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_INFO_HIGH, "Name = [fastpath_enable] Value = [%u]", pHddCtx->config->fastpath_enable); #endif - QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR, - "Name = [max_scan_count] value = [%d]", + hdd_notice("Name = [max_scan_count] value = [%d]", pHddCtx->config->max_scan_count); - QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR, - "Name = [%s] value = [%d]", + hdd_notice("Name = [%s] value = [%d]", CFG_RX_MODE_NAME, pHddCtx->config->rx_mode); QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_INFO_HIGH, "Name = [%s] Value = [%u]", CFG_CE_CLASSIFY_ENABLE_NAME, pHddCtx->config->ce_classify_enabled); - QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR, - "Name = [%s] value = [%u]", + hdd_notice("Name = [%s] value = [%u]", CFG_DUAL_MAC_FEATURE_DISABLE, pHddCtx->config->dual_mac_feature_disable); #ifdef FEATURE_WLAN_SCAN_PNO - hddLog(LOGE, "Name = [%s] Value = [%u]", - CFG_PNO_CHANNEL_PREDICTION_NAME, - pHddCtx->config->pno_channel_prediction); - hddLog(LOGE, "Name = [%s] Value = [%u]", - CFG_TOP_K_NUM_OF_CHANNELS_NAME, - pHddCtx->config->top_k_num_of_channels); - hddLog(LOGE, "Name = [%s] Value = [%u]", - CFG_STATIONARY_THRESHOLD_NAME, - pHddCtx->config->stationary_thresh); - hddLog(LOGE, "Name = [%s] Value = [%u]", - CFG_CHANNEL_PREDICTION_FULL_SCAN_MS_NAME, - pHddCtx->config->channel_prediction_full_scan); - hddLog(LOGE, "Name = [%s] Value = [%u]", - CFG_ADAPTIVE_PNOSCAN_DWELL_MODE_NAME, - pHddCtx->config->pnoscan_adaptive_dwell_mode); + hdd_notice("Name = [%s] Value = [%u]", + CFG_PNO_CHANNEL_PREDICTION_NAME, + pHddCtx->config->pno_channel_prediction); + hdd_notice("Name = [%s] Value = [%u]", + CFG_TOP_K_NUM_OF_CHANNELS_NAME, + pHddCtx->config->top_k_num_of_channels); + hdd_notice("Name = [%s] Value = [%u]", + CFG_STATIONARY_THRESHOLD_NAME, + pHddCtx->config->stationary_thresh); + hdd_notice("Name = [%s] Value = [%u]", + CFG_CHANNEL_PREDICTION_FULL_SCAN_MS_NAME, + pHddCtx->config->channel_prediction_full_scan); + hdd_notice("Name = [%s] Value = [%u]", + CFG_ADAPTIVE_PNOSCAN_DWELL_MODE_NAME, + pHddCtx->config->pnoscan_adaptive_dwell_mode); #endif - hddLog(LOGE, "Name = [%s] Value = [%d]", - CFG_EARLY_STOP_SCAN_ENABLE, - pHddCtx->config->early_stop_scan_enable); - hddLog(LOGE, "Name = [%s] Value = [%d]", - CFG_EARLY_STOP_SCAN_MIN_THRESHOLD, - pHddCtx->config->early_stop_scan_min_threshold); - hddLog(LOGE, "Name = [%s] Value = [%d]", - CFG_EARLY_STOP_SCAN_MAX_THRESHOLD, - pHddCtx->config->early_stop_scan_max_threshold); - hddLog(LOGE, "Name = [%s] Value = [%d]", - CFG_FIRST_SCAN_BUCKET_THRESHOLD_NAME, - pHddCtx->config->first_scan_bucket_threshold); - hddLog(LOGE, "Name = [%s] Value = [%u]", - CFG_HT_MPDU_DENSITY_NAME, - pHddCtx->config->ht_mpdu_density); + hdd_notice("Name = [%s] Value = [%d]", + CFG_EARLY_STOP_SCAN_ENABLE, + pHddCtx->config->early_stop_scan_enable); + hdd_notice("Name = [%s] Value = [%d]", + CFG_EARLY_STOP_SCAN_MIN_THRESHOLD, + pHddCtx->config->early_stop_scan_min_threshold); + hdd_notice("Name = [%s] Value = [%d]", + CFG_EARLY_STOP_SCAN_MAX_THRESHOLD, + pHddCtx->config->early_stop_scan_max_threshold); + hdd_notice("Name = [%s] Value = [%d]", + CFG_FIRST_SCAN_BUCKET_THRESHOLD_NAME, + pHddCtx->config->first_scan_bucket_threshold); + hdd_notice("Name = [%s] Value = [%u]", + CFG_HT_MPDU_DENSITY_NAME, + pHddCtx->config->ht_mpdu_density); #ifdef FEATURE_LFR_SUBNET_DETECTION - hddLog(LOGE, "Name = [%s] Value = [%d]", - CFG_ENABLE_LFR_SUBNET_DETECTION, - pHddCtx->config->enable_lfr_subnet_detection); + hdd_notice("Name = [%s] Value = [%d]", + CFG_ENABLE_LFR_SUBNET_DETECTION, + pHddCtx->config->enable_lfr_subnet_detection); #endif hdd_info("Name = [%s] Value = [%u]", CFG_ROAM_DENSE_TRAFFIC_THRESHOLD, @@ -6161,667 +6163,596 @@ QDF_STATUS hdd_hex_string_to_u16_array(char *str, return QDF_STATUS_SUCCESS; } +/** + * hdd_update_ht_cap_in_cfg() - to update HT cap in global CFG + * @hdd_ctx: pointer to hdd context + * + * This API will update the HT config in CFG after taking intersection + * of INI and firmware capabilities provided reading CFG + * + * Return: true or false + */ +static bool hdd_update_ht_cap_in_cfg(hdd_context_t *hdd_ctx) +{ + uint32_t val32; + uint16_t val16; + bool status = true; + tSirMacHTCapabilityInfo *ht_cap_info; + + if (sme_cfg_get_int(hdd_ctx->hHal, WNI_CFG_HT_CAP_INFO, + &val32) == + QDF_STATUS_E_FAILURE) { + status = false; + hdd_err("Could not get WNI_CFG_HT_CAP_INFO"); + } + val16 = (uint16_t) val32; + ht_cap_info = (tSirMacHTCapabilityInfo *) &val16; + ht_cap_info->advCodingCap &= hdd_ctx->config->enableRxLDPC; + ht_cap_info->rxSTBC = QDF_MIN(ht_cap_info->rxSTBC, + hdd_ctx->config->enableRxSTBC); + ht_cap_info->txSTBC &= hdd_ctx->config->enableTxSTBC; + ht_cap_info->shortGI20MHz &= hdd_ctx->config->ShortGI20MhzEnable; + ht_cap_info->shortGI40MHz &= hdd_ctx->config->ShortGI40MhzEnable; + val32 = val16; + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_HT_CAP_INFO, val32) == + QDF_STATUS_E_FAILURE) { + status = false; + hdd_err("Could not set WNI_CFG_HT_CAP_INFO"); + } + return status; +} /** - * hdd_update_config_dat() - scan the string and convery to u8 array - * @str: the pointer to the string - * @intArray: the pointer of buffer to store the u8 value - * @len: size of the buffer + * hdd_update_vht_cap_in_cfg() - to update VHT cap in global CFG + * @hdd_ctx: pointer to hdd context * - * Return: QDF_STATUS_SUCCESS if the configuration could be updated corectly, - * otherwise QDF_STATUS_E_INVAL + * This API will update the VHT config in CFG after taking intersection + * of INI and firmware capabilities provided reading CFG + * + * Return: true or false */ -bool hdd_update_config_dat(hdd_context_t *pHddCtx) +static bool hdd_update_vht_cap_in_cfg(hdd_context_t *hdd_ctx) { - bool fStatus = true; + bool status = true; uint32_t val; - uint16_t val16; + struct hdd_config *config = hdd_ctx->config; - struct hdd_config *pConfig = pHddCtx->config; - tSirMacHTCapabilityInfo *phtCapInfo; + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_VHT_ENABLE_TXBF_20MHZ, + config->enableTxBFin20MHz) == + QDF_STATUS_E_FAILURE) { + status = false; + hdd_err("Couldn't set value for WNI_CFG_VHT_ENABLE_TXBF_20MHZ"); + } + /* Based on cfg.ini, update the Basic MCS set, RX/TX MCS map + * in the cfg.dat. Valid values are 0(MCS0-7), 1(MCS0-8), 2(MCS0-9) + * we update only the least significant 2 bits in the + * corresponding fields. + */ + if ((config->dot11Mode == eHDD_DOT11_MODE_AUTO) || + (config->dot11Mode == eHDD_DOT11_MODE_11ac_ONLY) || + (config->dot11Mode == eHDD_DOT11_MODE_11ac)) { + /* Currently shortGI40Mhz is used for shortGI80Mhz */ + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_VHT_SHORT_GI_80MHZ, + config->ShortGI40MhzEnable) == QDF_STATUS_E_FAILURE) { + status = false; + hdd_err("Couldn't pass WNI_VHT_SHORT_GI_80MHZ to CFG"); + } + /* Hardware is capable of doing + * 128K AMPDU in 11AC mode */ + if (sme_cfg_set_int(hdd_ctx->hHal, + WNI_CFG_VHT_AMPDU_LEN_EXPONENT, + config->fVhtAmpduLenExponent) == + QDF_STATUS_E_FAILURE) { + status = false; + hdd_err("Couldn't pass on WNI_CFG_VHT_AMPDU_LEN_EXPONENT to CFG"); + } + /* Change MU Bformee only when TxBF is enabled */ + if (config->enableTxBF) { + sme_cfg_get_int(hdd_ctx->hHal, + WNI_CFG_VHT_MU_BEAMFORMEE_CAP, &val); + + if (val != config->enableMuBformee) { + if (sme_cfg_set_int(hdd_ctx->hHal, + WNI_CFG_VHT_MU_BEAMFORMEE_CAP, + config->enableMuBformee + ) == QDF_STATUS_E_FAILURE) { + status = false; + hdd_err("Couldn't pass on WNI_CFG_VHT_MU_BEAMFORMEE_CAP to CFG"); + } + } + } + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_VHT_MAX_MPDU_LENGTH, + config->vhtMpduLen) == QDF_STATUS_E_FAILURE) { + status = false; + hdd_err("Couldn't pass on WNI_CFG_VHT_MAX_MPDU_LENGTH to CFG"); + } + + if (config->enable2x2 && config->enable_su_tx_bformer) { + if (sme_cfg_set_int(hdd_ctx->hHal, + WNI_CFG_VHT_SU_BEAMFORMER_CAP, + config->enable_su_tx_bformer) == + QDF_STATUS_E_FAILURE) { + status = false; + hdd_err("set SU_BEAMFORMER_CAP to CFG failed"); + } + if (sme_cfg_set_int(hdd_ctx->hHal, + WNI_CFG_VHT_NUM_SOUNDING_DIMENSIONS, + NUM_OF_SOUNDING_DIMENSIONS) == + QDF_STATUS_E_FAILURE) { + status = false; + hdd_err("failed to set NUM_OF_SOUNDING_DIM"); + } + } + } + + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_VHT_RXSTBC, + config->enableRxSTBC) == QDF_STATUS_E_FAILURE) { + status = false; + hdd_err("Couldn't pass on WNI_CFG_VHT_RXSTBC to CFG"); + } + + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_VHT_TXSTBC, + config->enableTxSTBC) == QDF_STATUS_E_FAILURE) { + status = false; + hdd_err("Couldn't pass on WNI_CFG_VHT_TXSTBC to CFG"); + } + + if (sme_cfg_get_int(hdd_ctx->hHal, WNI_CFG_VHT_LDPC_CODING_CAP, &val) == + QDF_STATUS_E_FAILURE) { + status &= false; + hdd_err("Could not get WNI_CFG_VHT_LDPC_CODING_CAP"); + } + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_VHT_LDPC_CODING_CAP, + config->enableRxLDPC & val) == QDF_STATUS_E_FAILURE) { + status = false; + hdd_err("Couldn't pass on WNI_CFG_VHT_LDPC_CODING_CAP to CFG"); + } + + if (sme_cfg_set_int(hdd_ctx->hHal, + WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED, + config->txBFCsnValue) == + QDF_STATUS_E_FAILURE) { + status = false; + hdd_err("Couldn't pass on WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED to CFG"); + } + return status; + +} + +/** + * hdd_update_config_cfg() - API to update INI setting based on hw/fw caps + * @hdd_ctx: pointer to hdd_ctx + * + * This API reads the cfg file which is updated with hardware/firmware + * capabilities and intersect it with INI setting provided by user. After + * taking intersection it adjust cfg it self. For example, if user has enabled + * RX LDPC through INI but hardware/firmware doesn't support it then disable + * it in CFG file here. + * + * Return: true or false based on outcome. + */ +bool hdd_update_config_cfg(hdd_context_t *hdd_ctx) +{ + bool status = true; + uint32_t val; + struct hdd_config *config = hdd_ctx->config; /* * During the initialization both 2G and 5G capabilities should be same. * So read 5G HT capablity and update 2G and 5G capablities. */ - if (sme_cfg_get_int(pHddCtx->hHal, WNI_CFG_HT_CAP_INFO, - &val) == - QDF_STATUS_E_FAILURE) { - fStatus = false; - hdd_err("Could not pass on WNI_CFG_HT_CAP_INFO to CFG"); + if (!hdd_update_ht_cap_in_cfg(hdd_ctx)) { + status = false; + hdd_err("Couldn't set HT CAP in cfg"); } - if (pConfig->ShortGI20MhzEnable) - val |= HT_CAPS_SHORT_GI20; - else - val &= ~(HT_CAPS_SHORT_GI20); - - if (pConfig->ShortGI40MhzEnable) - val |= HT_CAPS_SHORT_GI40; - else - val &= ~(HT_CAPS_SHORT_GI40); - if (sme_cfg_set_int(pHddCtx->hHal, WNI_CFG_HT_CAP_INFO, - val) == - QDF_STATUS_E_FAILURE) { - fStatus = false; - hdd_err("Could not pass on WNI_CFG_HT_CAP_INFO to CFG"); + if (!hdd_update_vht_cap_in_cfg(hdd_ctx)) { + status = false; + hdd_err("Couldn't set VHT CAP in cfg"); } - if (sme_cfg_set_int(pHddCtx->hHal, WNI_CFG_FIXED_RATE, pConfig->TxRate) + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_FIXED_RATE, config->TxRate) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, "Could not pass on WNI_CFG_FIXED_RATE to CFG"); + status = false; + hdd_err("Couldn't pass on WNI_CFG_FIXED_RATE to CFG"); } - if (sme_cfg_set_int(pHddCtx->hHal, WNI_CFG_MAX_RX_AMPDU_FACTOR, - pConfig->MaxRxAmpduFactor) == + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_MAX_RX_AMPDU_FACTOR, + config->MaxRxAmpduFactor) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_HT_AMPDU_PARAMS_MAX_RX_AMPDU_FACTOR to CFG"); + status = false; + hdd_err("Couldn't pass on WNI_CFG_HT_AMPDU_PARAMS_MAX_RX_AMPDU_FACTOR to CFG"); } - if (sme_cfg_set_int(pHddCtx->hHal, WNI_CFG_MPDU_DENSITY, - pConfig->ht_mpdu_density) == + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_MPDU_DENSITY, + config->ht_mpdu_density) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_MPDU_DENSITY to CFG"); + status = false; + hdd_err("Couldn't pass on WNI_CFG_MPDU_DENSITY to CFG"); } - if (sme_cfg_set_int - (pHddCtx->hHal, WNI_CFG_SHORT_PREAMBLE, - pConfig->fIsShortPreamble) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_SHORT_PREAMBLE to CFG"); + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_SHORT_PREAMBLE, + config->fIsShortPreamble) == QDF_STATUS_E_FAILURE) { + status = false; + hdd_err("Couldn't pass on WNI_CFG_SHORT_PREAMBLE to CFG"); } - if (sme_cfg_set_int(pHddCtx->hHal, + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME, - pConfig->nPassiveMinChnTime) + config->nPassiveMinChnTime) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME" - " to CFG"); + status = false; + hdd_err("Couldn't pass on WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME to CFG"); } - if (sme_cfg_set_int(pHddCtx->hHal, + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME, - pConfig->nPassiveMaxChnTime) + config->nPassiveMaxChnTime) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME" - " to CFG"); + status = false; + hdd_err("Couldn't pass on WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME to CFG"); } - if (sme_cfg_set_int - (pHddCtx->hHal, WNI_CFG_BEACON_INTERVAL, - pConfig->nBeaconInterval) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_BEACON_INTERVAL to CFG"); + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_BEACON_INTERVAL, + config->nBeaconInterval) == QDF_STATUS_E_FAILURE) { + status = false; + hdd_err("Couldn't pass on WNI_CFG_BEACON_INTERVAL to CFG"); } - if (sme_cfg_set_int - (pHddCtx->hHal, WNI_CFG_MAX_PS_POLL, - pConfig->nMaxPsPoll) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, "Could not pass on WNI_CFG_MAX_PS_POLL to CFG"); + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_MAX_PS_POLL, + config->nMaxPsPoll) == QDF_STATUS_E_FAILURE) { + status = false; + hdd_err("Couldn't pass on WNI_CFG_MAX_PS_POLL to CFG"); } - if (sme_cfg_set_int (pHddCtx->hHal, WNI_CFG_LOW_GAIN_OVERRIDE, - pConfig->fIsLowGainOverride) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_LOW_GAIN_OVERRIDE to HAL"); + if (sme_cfg_set_int (hdd_ctx->hHal, WNI_CFG_LOW_GAIN_OVERRIDE, + config->fIsLowGainOverride) == QDF_STATUS_E_FAILURE) { + status = false; + hdd_err("Couldn't pass on WNI_CFG_LOW_GAIN_OVERRIDE to HAL"); } - if (sme_cfg_set_int - (pHddCtx->hHal, WNI_CFG_RSSI_FILTER_PERIOD, - pConfig->nRssiFilterPeriod) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_RSSI_FILTER_PERIOD to CFG"); + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_RSSI_FILTER_PERIOD, + config->nRssiFilterPeriod) == QDF_STATUS_E_FAILURE) { + status = false; + hdd_err("Couldn't pass on WNI_CFG_RSSI_FILTER_PERIOD to CFG"); } - if (sme_cfg_set_int - (pHddCtx->hHal, WNI_CFG_IGNORE_DTIM, - pConfig->fIgnoreDtim) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_IGNORE_DTIM to CFG"); + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_IGNORE_DTIM, + config->fIgnoreDtim) == QDF_STATUS_E_FAILURE) { + status = false; + hdd_err("Couldn't pass on WNI_IGNORE_DTIM to CFG"); } - if (sme_cfg_set_int - (pHddCtx->hHal, WNI_CFG_PS_ENABLE_HEART_BEAT, - pConfig->fEnableFwHeartBeatMonitoring) + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_PS_ENABLE_HEART_BEAT, + config->fEnableFwHeartBeatMonitoring) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_PS_HEART_BEAT to CFG"); + status = false; + hdd_err("Couldn't pass on WNI_CFG_PS_HEART_BEAT to CFG"); } - if (sme_cfg_set_int - (pHddCtx->hHal, WNI_CFG_PS_ENABLE_BCN_FILTER, - pConfig->fEnableFwBeaconFiltering) == + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_PS_ENABLE_BCN_FILTER, + config->fEnableFwBeaconFiltering) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_PS_BCN_FILTER to CFG"); + status = false; + hdd_err("Couldn't pass on WNI_CFG_PS_BCN_FILTER to CFG"); } - if (sme_cfg_set_int - (pHddCtx->hHal, WNI_CFG_PS_ENABLE_RSSI_MONITOR, - pConfig->fEnableFwRssiMonitoring) == + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_PS_ENABLE_RSSI_MONITOR, + config->fEnableFwRssiMonitoring) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_PS_RSSI_MONITOR to CFG"); + status = false; + hdd_err("Couldn't pass on WNI_CFG_PS_RSSI_MONITOR to CFG"); } - if (sme_cfg_set_int - (pHddCtx->hHal, WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT, - pConfig->nDataInactivityTimeout) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT to CFG"); + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT, + config->nDataInactivityTimeout) == QDF_STATUS_E_FAILURE) { + status = false; + hdd_err("Couldn't pass on WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT to CFG"); } - if (sme_cfg_set_int - (pHddCtx->hHal, WNI_CFG_ENABLE_LTE_COEX, - pConfig->enableLTECoex) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_ENABLE_LTE_COEX to CFG"); + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_ENABLE_LTE_COEX, + config->enableLTECoex) == QDF_STATUS_E_FAILURE) { + status = false; + hdd_err("Couldn't pass on WNI_CFG_ENABLE_LTE_COEX to CFG"); } - if (sme_cfg_set_int - (pHddCtx->hHal, WNI_CFG_AP_KEEP_ALIVE_TIMEOUT, - pConfig->apKeepAlivePeriod) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_AP_KEEP_ALIVE_TIMEOUT to CFG"); + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_AP_KEEP_ALIVE_TIMEOUT, + config->apKeepAlivePeriod) == QDF_STATUS_E_FAILURE) { + status = false; + hdd_err("Couldn't pass on WNI_CFG_AP_KEEP_ALIVE_TIMEOUT to CFG"); } - if (sme_cfg_set_int - (pHddCtx->hHal, WNI_CFG_GO_KEEP_ALIVE_TIMEOUT, - pConfig->goKeepAlivePeriod) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_GO_KEEP_ALIVE_TIMEOUT to CFG"); + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_GO_KEEP_ALIVE_TIMEOUT, + config->goKeepAlivePeriod) == QDF_STATUS_E_FAILURE) { + status = false; + hdd_err("Couldn't pass on WNI_CFG_GO_KEEP_ALIVE_TIMEOUT to CFG"); } - if (sme_cfg_set_int - (pHddCtx->hHal, WNI_CFG_AP_LINK_MONITOR_TIMEOUT, - pConfig->apLinkMonitorPeriod) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_AP_LINK_MONITOR_TIMEOUT to CFG"); + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_AP_LINK_MONITOR_TIMEOUT, + config->apLinkMonitorPeriod) == QDF_STATUS_E_FAILURE) { + status = false; + hdd_err("Couldn't pass on WNI_CFG_AP_LINK_MONITOR_TIMEOUT to CFG"); } - if (sme_cfg_set_int - (pHddCtx->hHal, WNI_CFG_GO_LINK_MONITOR_TIMEOUT, - pConfig->goLinkMonitorPeriod) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_GO_LINK_MONITOR_TIMEOUT to CFG"); + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_GO_LINK_MONITOR_TIMEOUT, + config->goLinkMonitorPeriod) == QDF_STATUS_E_FAILURE) { + status = false; + hdd_err("Couldn't pass on WNI_CFG_GO_LINK_MONITOR_TIMEOUT to CFG"); } - if (sme_cfg_set_int - (pHddCtx->hHal, WNI_CFG_MCAST_BCAST_FILTER_SETTING, - pConfig->mcastBcastFilterSetting) == QDF_STATUS_E_FAILURE) - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_MCAST_BCAST_FILTER_SETTING to CFG"); + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_MCAST_BCAST_FILTER_SETTING, + config->mcastBcastFilterSetting) == QDF_STATUS_E_FAILURE) + status = false; + hdd_err("Couldn't pass on WNI_CFG_MCAST_BCAST_FILTER_SETTING to CFG"); - if (sme_cfg_set_int - (pHddCtx->hHal, WNI_CFG_SINGLE_TID_RC, - pConfig->bSingleTidRc) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_SINGLE_TID_RC to CFG"); + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_SINGLE_TID_RC, + config->bSingleTidRc) == QDF_STATUS_E_FAILURE) { + status = false; + hdd_err("Couldn't pass on WNI_CFG_SINGLE_TID_RC to CFG"); } - if (sme_cfg_set_int - (pHddCtx->hHal, WNI_CFG_TELE_BCN_WAKEUP_EN, - pConfig->teleBcnWakeupEn) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_TELE_BCN_WAKEUP_EN to CFG"); + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_TELE_BCN_WAKEUP_EN, + config->teleBcnWakeupEn) == QDF_STATUS_E_FAILURE) { + status = false; + hdd_err("Couldn't pass on WNI_CFG_TELE_BCN_WAKEUP_EN to CFG"); } - if (sme_cfg_set_int - (pHddCtx->hHal, WNI_CFG_TELE_BCN_TRANS_LI, - pConfig->nTeleBcnTransListenInterval) == + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_TELE_BCN_TRANS_LI, + config->nTeleBcnTransListenInterval) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_TELE_BCN_TRANS_LI to CFG"); + status = false; + hdd_err("Couldn't pass on WNI_CFG_TELE_BCN_TRANS_LI to CFG"); } - if (sme_cfg_set_int - (pHddCtx->hHal, WNI_CFG_TELE_BCN_MAX_LI, - pConfig->nTeleBcnMaxListenInterval) == + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_TELE_BCN_MAX_LI, + config->nTeleBcnMaxListenInterval) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_TELE_BCN_MAX_LI to CFG"); + status = false; + hdd_err("Couldn't pass on WNI_CFG_TELE_BCN_MAX_LI to CFG"); } - if (sme_cfg_set_int - (pHddCtx->hHal, WNI_CFG_TELE_BCN_TRANS_LI_IDLE_BCNS, - pConfig->nTeleBcnTransLiNumIdleBeacons) == + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_TELE_BCN_TRANS_LI_IDLE_BCNS, + config->nTeleBcnTransLiNumIdleBeacons) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_TELE_BCN_TRANS_LI_IDLE_BCNS to CFG"); + status = false; + hdd_err("Couldn't pass on WNI_CFG_TELE_BCN_TRANS_LI_IDLE_BCNS to CFG"); } - if (sme_cfg_set_int - (pHddCtx->hHal, WNI_CFG_TELE_BCN_MAX_LI_IDLE_BCNS, - pConfig->nTeleBcnMaxLiNumIdleBeacons) == + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_TELE_BCN_MAX_LI_IDLE_BCNS, + config->nTeleBcnMaxLiNumIdleBeacons) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_TELE_BCN_MAX_LI_IDLE_BCNS to CFG"); + status = false; + hdd_err("Couldn't pass on WNI_CFG_TELE_BCN_MAX_LI_IDLE_BCNS to CFG"); } - if (sme_cfg_set_int - (pHddCtx->hHal, WNI_CFG_RF_SETTLING_TIME_CLK, - pConfig->rfSettlingTimeUs) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_RF_SETTLING_TIME_CLK to CFG"); + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_RF_SETTLING_TIME_CLK, + config->rfSettlingTimeUs) == QDF_STATUS_E_FAILURE) { + status = false; + hdd_err("Couldn't pass on WNI_CFG_RF_SETTLING_TIME_CLK to CFG"); } - if (sme_cfg_set_int - (pHddCtx->hHal, WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD, - pConfig->infraStaKeepAlivePeriod) == + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD, + config->infraStaKeepAlivePeriod) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD to CFG"); + status = false; + hdd_err("Couldn't pass on WNI_CFG_INFRA_STA_KEEP_ALIVE_PERIOD to CFG"); } - if (sme_cfg_set_int - (pHddCtx->hHal, WNI_CFG_DYNAMIC_PS_POLL_VALUE, - pConfig->dynamicPsPollValue) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_DYNAMIC_PS_POLL_VALUE to CFG"); + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_DYNAMIC_PS_POLL_VALUE, + config->dynamicPsPollValue) == QDF_STATUS_E_FAILURE) { + status = false; + hdd_err("Couldn't pass on WNI_CFG_DYNAMIC_PS_POLL_VALUE to CFG"); } - if (sme_cfg_set_int - (pHddCtx->hHal, WNI_CFG_PS_NULLDATA_AP_RESP_TIMEOUT, - pConfig->nNullDataApRespTimeout) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_PS_NULLDATA_DELAY_TIMEOUT to CFG"); + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_PS_NULLDATA_AP_RESP_TIMEOUT, + config->nNullDataApRespTimeout) == QDF_STATUS_E_FAILURE) { + status = false; + hdd_err("Couldn't pass on WNI_CFG_PS_NULLDATA_DELAY_TIMEOUT to CFG"); } - if (sme_cfg_set_int - (pHddCtx->hHal, WNI_CFG_AP_DATA_AVAIL_POLL_PERIOD, - pConfig->apDataAvailPollPeriodInMs) == + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_AP_DATA_AVAIL_POLL_PERIOD, + config->apDataAvailPollPeriodInMs) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_AP_DATA_AVAIL_POLL_PERIOD to CFG"); - } - if (sme_cfg_set_int - (pHddCtx->hHal, WNI_CFG_FRAGMENTATION_THRESHOLD, - pConfig->FragmentationThreshold) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_FRAGMENTATION_THRESHOLD to CFG"); + status = false; + hdd_err("Couldn't pass on WNI_CFG_AP_DATA_AVAIL_POLL_PERIOD to CFG"); } - if (sme_cfg_set_int - (pHddCtx->hHal, WNI_CFG_RTS_THRESHOLD, - pConfig->RTSThreshold) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_RTS_THRESHOLD to CFG"); + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_FRAGMENTATION_THRESHOLD, + config->FragmentationThreshold) == QDF_STATUS_E_FAILURE) { + status = false; + hdd_err("Couldn't pass on WNI_CFG_FRAGMENTATION_THRESHOLD to CFG"); } - - if (sme_cfg_set_int - (pHddCtx->hHal, WNI_CFG_11D_ENABLED, - pConfig->Is11dSupportEnabled) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_11D_ENABLED to CFG"); + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_RTS_THRESHOLD, + config->RTSThreshold) == QDF_STATUS_E_FAILURE) { + status = false; + hdd_err("Couldn't pass on WNI_CFG_RTS_THRESHOLD to CFG"); } - if (sme_cfg_set_int(pHddCtx->hHal, WNI_CFG_DFS_MASTER_ENABLED, - pConfig->enableDFSMasterCap) == - QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Failure: Could not set value for WNI_CFG_DFS_MASTER_ENABLED"); + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_11D_ENABLED, + config->Is11dSupportEnabled) == QDF_STATUS_E_FAILURE) { + status = false; + hdd_err("Couldn't pass on WNI_CFG_11D_ENABLED to CFG"); } - if (sme_cfg_set_int(pHddCtx->hHal, WNI_CFG_VHT_ENABLE_TXBF_20MHZ, - pConfig->enableTxBFin20MHz) == + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_DFS_MASTER_ENABLED, + config->enableDFSMasterCap) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not set value for WNI_CFG_VHT_ENABLE_TXBF_20MHZ"); + status = false; + hdd_err("Failure: Couldn't set value for WNI_CFG_DFS_MASTER_ENABLED"); } - if (sme_cfg_set_int - (pHddCtx->hHal, WNI_CFG_HEART_BEAT_THRESHOLD, - pConfig->HeartbeatThresh24) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_HEART_BEAT_THRESHOLD to CFG"); + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_HEART_BEAT_THRESHOLD, + config->HeartbeatThresh24) == QDF_STATUS_E_FAILURE) { + status = false; + hdd_err("Couldn't pass on WNI_CFG_HEART_BEAT_THRESHOLD to CFG"); } - if (sme_cfg_set_int - (pHddCtx->hHal, WNI_CFG_AP_DATA_AVAIL_POLL_PERIOD, - pConfig->apDataAvailPollPeriodInMs) == + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_AP_DATA_AVAIL_POLL_PERIOD, + config->apDataAvailPollPeriodInMs) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_AP_DATA_AVAIL_POLL_PERIOD to CFG"); - } - - if (sme_cfg_set_int - (pHddCtx->hHal, WNI_CFG_ENABLE_MC_ADDR_LIST, - pConfig->fEnableMCAddrList) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_ENABLE_MC_ADDR_LIST to CFG"); - } - /* Based on cfg.ini, update the Basic MCS set, RX/TX MCS map - * in the cfg.dat. Valid values are 0(MCS0-7), 1(MCS0-8), 2(MCS0-9) - * we update only the least significant 2 bits in the - * corresponding fields. - */ - if ((pConfig->dot11Mode == eHDD_DOT11_MODE_AUTO) || - (pConfig->dot11Mode == eHDD_DOT11_MODE_11ac_ONLY) || - (pConfig->dot11Mode == eHDD_DOT11_MODE_11ac)) { - /* Currently shortGI40Mhz is used for shortGI80Mhz */ - if (sme_cfg_set_int - (pHddCtx->hHal, WNI_CFG_VHT_SHORT_GI_80MHZ, - pConfig->ShortGI40MhzEnable) == - QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass WNI_VHT_SHORT_GI_80MHZ to CFG"); - } - /* Hardware is capable of doing - * 128K AMPDU in 11AC mode */ - if (sme_cfg_set_int(pHddCtx->hHal, - WNI_CFG_VHT_AMPDU_LEN_EXPONENT, - pConfig->fVhtAmpduLenExponent) == - QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_VHT_AMPDU_LEN_EXPONENT to CFG"); - } - /* Change MU Bformee only when TxBF is enabled */ - if (pConfig->enableTxBF) { - sme_cfg_get_int(pHddCtx->hHal, - WNI_CFG_VHT_MU_BEAMFORMEE_CAP, &val); - - if (val != pConfig->enableMuBformee) { - if (sme_cfg_set_int(pHddCtx->hHal, - WNI_CFG_VHT_MU_BEAMFORMEE_CAP, - pConfig->enableMuBformee - ) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_VHT_MU_BEAMFORMEE_CAP to CFG"); - } - } - } - if (sme_cfg_set_int(pHddCtx->hHal, WNI_CFG_VHT_MAX_MPDU_LENGTH, - pConfig->vhtMpduLen) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_VHT_MAX_MPDU_LENGTH to CFG"); - } - - if (pConfig->enable2x2 && pConfig->enable_su_tx_bformer) { - if (sme_cfg_set_int(pHddCtx->hHal, - WNI_CFG_VHT_SU_BEAMFORMER_CAP, - pConfig->enable_su_tx_bformer) == - QDF_STATUS_E_FAILURE) { - fStatus = false; - hdd_err("set SU_BEAMFORMER_CAP to CFG failed"); - } - if (sme_cfg_set_int(pHddCtx->hHal, - WNI_CFG_VHT_NUM_SOUNDING_DIMENSIONS, - NUM_OF_SOUNDING_DIMENSIONS) == - QDF_STATUS_E_FAILURE) { - fStatus = false; - hdd_err("failed to set NUM_OF_SOUNDING_DIM"); - } - } - } - - sme_cfg_get_int(pHddCtx->hHal, WNI_CFG_HT_CAP_INFO, &val); - val16 = (uint16_t) val; - phtCapInfo = (tSirMacHTCapabilityInfo *) &val16; - phtCapInfo->rxSTBC = pConfig->enableRxSTBC; - phtCapInfo->advCodingCap = pConfig->enableRxLDPC; - val = val16; - if (sme_cfg_set_int(pHddCtx->hHal, WNI_CFG_HT_CAP_INFO, val) - == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, "Could not pass on WNI_CFG_HT_CAP_INFO to CFG"); - } - - if (sme_cfg_set_int(pHddCtx->hHal, WNI_CFG_VHT_RXSTBC, - pConfig->enableRxSTBC) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, "Could not pass on WNI_CFG_VHT_RXSTBC to CFG"); + status = false; + hdd_err("Couldn't pass on WNI_CFG_AP_DATA_AVAIL_POLL_PERIOD to CFG"); } - if (sme_cfg_set_int(pHddCtx->hHal, WNI_CFG_VHT_TXSTBC, - pConfig->enableTxSTBC) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, "Could not pass on WNI_CFG_VHT_TXSTBC to CFG"); + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_ENABLE_MC_ADDR_LIST, + config->fEnableMCAddrList) == QDF_STATUS_E_FAILURE) { + status = false; + hdd_err("Couldn't pass on WNI_CFG_ENABLE_MC_ADDR_LIST to CFG"); } - if (sme_cfg_set_int(pHddCtx->hHal, WNI_CFG_VHT_LDPC_CODING_CAP, - pConfig->enableRxLDPC) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_VHT_LDPC_CODING_CAP to CFG"); - } #ifdef WLAN_SOFTAP_VSTA_FEATURE - if (pConfig->fEnableVSTASupport) { - sme_cfg_get_int(pHddCtx->hHal, WNI_CFG_ASSOC_STA_LIMIT, &val); + if (config->fEnableVSTASupport) { + sme_cfg_get_int(hdd_ctx->hHal, WNI_CFG_ASSOC_STA_LIMIT, &val); if (val <= WNI_CFG_ASSOC_STA_LIMIT_STADEF) val = WNI_CFG_ASSOC_STA_LIMIT_STAMAX; } else { - val = pConfig->maxNumberOfPeers; + val = config->maxNumberOfPeers; } - if (sme_cfg_set_int(pHddCtx->hHal, WNI_CFG_ASSOC_STA_LIMIT, val) == + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_ASSOC_STA_LIMIT, val) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_ASSOC_STA_LIMIT to CFG"); + status = false; + hdd_err("Couldn't pass on WNI_CFG_ASSOC_STA_LIMIT to CFG"); } #endif - if (sme_cfg_set_int(pHddCtx->hHal, WNI_CFG_ENABLE_LPWR_IMG_TRANSITION, - pConfig->enableLpwrImgTransition) + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_ENABLE_LPWR_IMG_TRANSITION, + config->enableLpwrImgTransition) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_ENABLE_LPWR_IMG_TRANSITION to CFG"); + status = false; + hdd_err("Couldn't pass on WNI_CFG_ENABLE_LPWR_IMG_TRANSITION to CFG"); } - if (sme_cfg_set_int - (pHddCtx->hHal, WNI_CFG_ENABLE_MCC_ADAPTIVE_SCHED, - pConfig->enableMCCAdaptiveScheduler) == + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_ENABLE_MCC_ADAPTIVE_SCHED, + config->enableMCCAdaptiveScheduler) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_ENABLE_MCC_ADAPTIVE_SCHED to CFG"); + status = false; + hdd_err("Couldn't pass on WNI_CFG_ENABLE_MCC_ADAPTIVE_SCHED to CFG"); } - if (sme_cfg_set_int - (pHddCtx->hHal, WNI_CFG_DISABLE_LDPC_WITH_TXBF_AP, - pConfig->disableLDPCWithTxbfAP) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_DISABLE_LDPC_WITH_TXBF_AP to CFG"); + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_DISABLE_LDPC_WITH_TXBF_AP, + config->disableLDPCWithTxbfAP) == QDF_STATUS_E_FAILURE) { + status = false; + hdd_err("Couldn't pass on WNI_CFG_DISABLE_LDPC_WITH_TXBF_AP to CFG"); } - if (sme_cfg_set_int - (pHddCtx->hHal, WNI_CFG_DYNAMIC_THRESHOLD_ZERO, - pConfig->retryLimitZero) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_DYNAMIC_THRESHOLD_ZERO to CFG"); + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_DYNAMIC_THRESHOLD_ZERO, + config->retryLimitZero) == QDF_STATUS_E_FAILURE) { + status = false; + hdd_err("Couldn't pass on WNI_CFG_DYNAMIC_THRESHOLD_ZERO to CFG"); } - if (sme_cfg_set_int - (pHddCtx->hHal, WNI_CFG_DYNAMIC_THRESHOLD_ONE, - pConfig->retryLimitOne) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_DYNAMIC_THRESHOLD_ONE to CFG"); + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_DYNAMIC_THRESHOLD_ONE, + config->retryLimitOne) == QDF_STATUS_E_FAILURE) { + status = false; + hdd_err("Couldn't pass on WNI_CFG_DYNAMIC_THRESHOLD_ONE to CFG"); } - if (sme_cfg_set_int - (pHddCtx->hHal, WNI_CFG_DYNAMIC_THRESHOLD_TWO, - pConfig->retryLimitTwo) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_DYNAMIC_THRESHOLD_TWO to CFG"); + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_DYNAMIC_THRESHOLD_TWO, + config->retryLimitTwo) == QDF_STATUS_E_FAILURE) { + status = false; + hdd_err("Couldn't pass on WNI_CFG_DYNAMIC_THRESHOLD_TWO to CFG"); } - if (sme_cfg_set_int - (pHddCtx->hHal, WNI_CFG_MAX_MEDIUM_TIME, - pConfig->cfgMaxMediumTime) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_MAX_MEDIUM_TIME to CFG"); + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_MAX_MEDIUM_TIME, + config->cfgMaxMediumTime) == QDF_STATUS_E_FAILURE) { + status = false; + hdd_err("Couldn't pass on WNI_CFG_MAX_MEDIUM_TIME to CFG"); } #ifdef FEATURE_WLAN_TDLS - if (sme_cfg_set_int(pHddCtx->hHal, WNI_CFG_TDLS_QOS_WMM_UAPSD_MASK, - pConfig->fTDLSUapsdMask) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_TDLS_QOS_WMM_UAPSD_MASK to CFG"); + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_TDLS_QOS_WMM_UAPSD_MASK, + config->fTDLSUapsdMask) == QDF_STATUS_E_FAILURE) { + status = false; + hdd_err("Couldn't pass on WNI_CFG_TDLS_QOS_WMM_UAPSD_MASK to CFG"); } - if (sme_cfg_set_int(pHddCtx->hHal, WNI_CFG_TDLS_BUF_STA_ENABLED, - pConfig->fEnableTDLSBufferSta) == + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_TDLS_BUF_STA_ENABLED, + config->fEnableTDLSBufferSta) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_TDLS_BUF_STA_ENABLED to CFG"); + status = false; + hdd_err("Couldn't pass on WNI_CFG_TDLS_BUF_STA_ENABLED to CFG"); } - if (sme_cfg_set_int(pHddCtx->hHal, WNI_CFG_TDLS_PUAPSD_INACT_TIME, - pConfig->fTDLSPuapsdInactivityTimer) == + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_TDLS_PUAPSD_INACT_TIME, + config->fTDLSPuapsdInactivityTimer) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_TDLS_PUAPSD_INACT_TIME to CFG"); + status = false; + hdd_err("Couldn't pass on WNI_CFG_TDLS_PUAPSD_INACT_TIME to CFG"); } - if (sme_cfg_set_int(pHddCtx->hHal, WNI_CFG_TDLS_RX_FRAME_THRESHOLD, - pConfig->fTDLSRxFrameThreshold) == + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_TDLS_RX_FRAME_THRESHOLD, + config->fTDLSRxFrameThreshold) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_TDLS_RX_FRAME_THRESHOLD to CFG"); + status = false; + hdd_err("Couldn't pass on WNI_CFG_TDLS_RX_FRAME_THRESHOLD to CFG"); } - if (sme_cfg_set_int(pHddCtx->hHal, WNI_CFG_TDLS_OFF_CHANNEL_ENABLED, - pConfig->fEnableTDLSOffChannel) == + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_TDLS_OFF_CHANNEL_ENABLED, + config->fEnableTDLSOffChannel) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_TDLS_BUF_STA_ENABLED to CFG"); + status = false; + hdd_err("Couldn't pass on WNI_CFG_TDLS_BUF_STA_ENABLED to CFG"); } - if (sme_cfg_set_int(pHddCtx->hHal, WNI_CFG_TDLS_WMM_MODE_ENABLED, - pConfig->fEnableTDLSWmmMode) == + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_TDLS_WMM_MODE_ENABLED, + config->fEnableTDLSWmmMode) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_TDLS_WMM_MODE_ENABLED to CFG"); + status = false; + hdd_err("Couldn't pass on WNI_CFG_TDLS_WMM_MODE_ENABLED to CFG"); } #endif - if (sme_cfg_set_int(pHddCtx->hHal, WNI_CFG_ENABLE_ADAPT_RX_DRAIN, - pConfig->fEnableAdaptRxDrain) == + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_ENABLE_ADAPT_RX_DRAIN, + config->fEnableAdaptRxDrain) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_ENABLE_ADAPT_RX_DRAIN to CFG"); + status = false; + hdd_err("Couldn't pass on WNI_CFG_ENABLE_ADAPT_RX_DRAIN to CFG"); } - if (sme_cfg_set_int(pHddCtx->hHal, WNI_CFG_ANTENNA_DIVESITY, - pConfig->antennaDiversity) == + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_ANTENNA_DIVESITY, + config->antennaDiversity) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_ANTENNA_DIVESITY to CFG"); + status = false; + hdd_err("Couldn't pass on WNI_CFG_ANTENNA_DIVESITY to CFG"); } - if (sme_cfg_set_int(pHddCtx->hHal, + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_DEFAULT_RATE_INDEX_24GHZ, - pConfig->defaultRateIndex24Ghz) == + config->defaultRateIndex24Ghz) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_DEFAULT_RATE_INDEX_24GHZ to CFG"); + status = false; + hdd_err("Couldn't pass on WNI_CFG_DEFAULT_RATE_INDEX_24GHZ to CFG"); } - if (sme_cfg_set_int(pHddCtx->hHal, + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_DEBUG_P2P_REMAIN_ON_CHANNEL, - pConfig->debugP2pRemainOnChannel) == + config->debugP2pRemainOnChannel) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_DEBUG_P2P_REMAIN_ON_CHANNEL to CFG"); + status = false; + hdd_err("Couldn't pass on WNI_CFG_DEBUG_P2P_REMAIN_ON_CHANNEL to CFG"); } #ifdef WLAN_FEATURE_11W - if (sme_cfg_set_int(pHddCtx->hHal, WNI_CFG_PMF_SA_QUERY_MAX_RETRIES, - pConfig->pmfSaQueryMaxRetries) == + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_PMF_SA_QUERY_MAX_RETRIES, + config->pmfSaQueryMaxRetries) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_SA_QUERY_MAX_RETRIES to CFG"); + status = false; + hdd_err("Couldn't pass on WNI_CFG_SA_QUERY_MAX_RETRIES to CFG"); } - if (sme_cfg_set_int(pHddCtx->hHal, WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL, - pConfig->pmfSaQueryRetryInterval) == + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL, + config->pmfSaQueryRetryInterval) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_SA_QUERY_RETRY_INTERVAL to CFG"); + status = false; + hdd_err("Couldn't pass on WNI_CFG_SA_QUERY_RETRY_INTERVAL to CFG"); } #endif - if (sme_cfg_set_int(pHddCtx->hHal, WNI_CFG_IBSS_ATIM_WIN_SIZE, - pConfig->ibssATIMWinSize) == + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_IBSS_ATIM_WIN_SIZE, + config->ibssATIMWinSize) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_IBSS_ATIM_WIN_SIZE to CFG"); - } - - if (sme_cfg_set_int(pHddCtx->hHal, - WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED, - pConfig->txBFCsnValue) == - QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED to CFG"); + status = false; + hdd_err("Couldn't pass on WNI_CFG_IBSS_ATIM_WIN_SIZE to CFG"); } - if (sme_cfg_set_int(pHddCtx->hHal, WNI_CFG_TGT_GTX_USR_CFG, - pConfig->tgt_gtx_usr_cfg) == QDF_STATUS_E_FAILURE) { - fStatus = false; - hddLog(LOGE, - "Could not pass on WNI_CFG_TGT_GTX_USR_CFG to CCM"); + if (sme_cfg_set_int(hdd_ctx->hHal, WNI_CFG_TGT_GTX_USR_CFG, + config->tgt_gtx_usr_cfg) == QDF_STATUS_E_FAILURE) { + status = false; + hdd_err("Couldn't pass on WNI_CFG_TGT_GTX_USR_CFG to CCM"); } - return fStatus; + return status; } #ifdef FEATURE_WLAN_SCAN_PNO /** @@ -6920,7 +6851,6 @@ QDF_STATUS hdd_set_sme_config(hdd_context_t *pHddCtx) smeConfig->csrConfig.vccRssiThreshold = pConfig->nVccRssiTrigger; smeConfig->csrConfig.vccUlMacLossThreshold = pConfig->nVccUlMacLossThreshold; - smeConfig->csrConfig.nRoamingTime = pConfig->nRoamingTime; smeConfig->csrConfig.nInitialDwellTime = pConfig->nInitialDwellTime; smeConfig->csrConfig.initial_scan_no_dfs_chnl = pConfig->initial_scan_no_dfs_chnl; @@ -6985,6 +6915,7 @@ QDF_STATUS hdd_set_sme_config(hdd_context_t *pHddCtx) smeConfig->csrConfig.cbChoice = 0; smeConfig->csrConfig.eBand = pConfig->nBandCapability; smeConfig->csrConfig.nTxPowerCap = pConfig->nTxPowerCap; + smeConfig->csrConfig.allow_tpc_from_ap = pConfig->allow_tpc_from_ap; smeConfig->csrConfig.fEnableBypass11d = pConfig->enableBypass11d; smeConfig->csrConfig.fEnableDFSChnlScan = pConfig->enableDFSChnlScan; smeConfig->csrConfig.nRoamPrefer5GHz = pConfig->nRoamPrefer5GHz; @@ -7208,6 +7139,9 @@ QDF_STATUS hdd_set_sme_config(hdd_context_t *pHddCtx) pConfig->edca_bk_aifs; smeConfig->csrConfig.edca_be_aifs = pConfig->edca_be_aifs; + smeConfig->csrConfig.sta_roam_policy_params.dfs_mode = + CSR_STA_ROAM_POLICY_DFS_ENABLED; + smeConfig->csrConfig.sta_roam_policy_params.skip_unsafe_channels = 0; status = sme_update_config(pHddCtx->hHal, smeConfig); if (!QDF_IS_STATUS_SUCCESS(status)) { diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 837b9a090427..1da11ee297d6 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -74,6 +74,10 @@ #include "wlan_hdd_nan.h" #include <wlan_hdd_ipa.h> #include "wlan_logging_sock_svc.h" +#include "sap_api.h" +#include "csr_api.h" +#include "pld_common.h" + #ifdef FEATURE_WLAN_EXTSCAN #include "wlan_hdd_ext_scan.h" @@ -94,6 +98,7 @@ #include <wlan_hdd_regulatory.h> #include "wlan_hdd_lpass.h" #include "wlan_hdd_nan_datapath.h" +#include "wlan_hdd_disa.h" #define g_mode_rates_size (12) #define a_mode_rates_size (8) @@ -142,6 +147,11 @@ #define HDD_CHANNEL_14 14 +#define IS_DFS_MODE_VALID(mode) ((mode >= DFS_MODE_NONE && \ + mode <= DFS_MODE_DEPRIORITIZE)) +#define IS_CHANNEL_VALID(channel) ((channel >= 0 && channel < 15) \ + || (channel >= 36 && channel <= 184)) + #define MAX_TXPOWER_SCALE 4 #define CDS_MAX_FEATURE_SET 8 @@ -1330,7 +1340,10 @@ static int wlan_hdd_cfg80211_start_acs(hdd_adapter_t *adapter) int status; sap_config = &adapter->sessionCtx.ap.sapConfig; - sap_config->channel = AUTO_CHANNEL_SELECT; + if (hdd_ctx->acs_policy.acs_channel) + sap_config->channel = hdd_ctx->acs_policy.acs_channel; + else + sap_config->channel = AUTO_CHANNEL_SELECT; status = wlan_hdd_sap_cfg_dfs_override(adapter); if (status < 0) { @@ -3856,8 +3869,37 @@ wlan_hdd_wifi_config_policy[QCA_WLAN_VENDOR_ATTR_CONFIG_MAX + 1] = { [QCA_WLAN_VENDOR_ATTR_CONFIG_MODULATED_DTIM] = {.type = NLA_U32 }, [QCA_WLAN_VENDOR_ATTR_CONFIG_STATS_AVG_FACTOR] = {.type = NLA_U16 }, [QCA_WLAN_VENDOR_ATTR_CONFIG_GUARD_TIME] = {.type = NLA_U32 }, + [QCA_WLAN_VENDOR_ATTR_CONFIG_CHANNEL_AVOIDANCE_IND] = {.type = NLA_U8 }, }; +/** + * wlan_hdd_save_default_scan_ies() - API to store the default scan IEs + * + * @adapter: Pointer to HDD adapter + * @ie_data: Pointer to Scan IEs buffer + * @ie_len: Length of Scan IEs + * + * Return: 0 on success; error number otherwise + */ +static int wlan_hdd_save_default_scan_ies(hdd_adapter_t *adapter, + uint8_t *ie_data, uint8_t ie_len) +{ + hdd_scaninfo_t *scan_info = NULL; + scan_info = &adapter->scan_info; + + if (scan_info->default_scan_ies) { + qdf_mem_free(scan_info->default_scan_ies); + scan_info->default_scan_ies = NULL; + } + + scan_info->default_scan_ies = qdf_mem_malloc(ie_len); + if (!scan_info->default_scan_ies) + return -ENOMEM; + + memcpy(scan_info->default_scan_ies, ie_data, ie_len); + scan_info->default_scan_ies_len = ie_len; + return 0; +} /** * __wlan_hdd_cfg80211_wifi_configuration_set() - Wifi configuration @@ -3886,12 +3928,17 @@ __wlan_hdd_cfg80211_wifi_configuration_set(struct wiphy *wiphy, u32 modulated_dtim; u16 stats_avg_factor; u32 guard_time; + uint8_t set_value; u32 ftm_capab; + uint8_t qpower; QDF_STATUS status; int attr_len; int access_policy = 0; char vendor_ie[SIR_MAC_MAX_IE_LENGTH + 2]; bool vendor_ie_present = false, access_policy_present = false; + uint16_t scan_ie_len = 0; + uint8_t *scan_ie; + ENTER_DEV(dev); if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) { @@ -3935,6 +3982,13 @@ __wlan_hdd_cfg80211_wifi_configuration_set(struct wiphy *wiphy, ret_val = -EPERM; } + if (tb[QCA_WLAN_VENDOR_ATTR_CONFIG_QPOWER]) { + qpower = nla_get_u8( + tb[QCA_WLAN_VENDOR_ATTR_CONFIG_QPOWER]); + if (hdd_set_qpower_config(hdd_ctx, adapter, qpower) != 0) + ret_val = -EINVAL; + } + if (tb[QCA_WLAN_VENDOR_ATTR_CONFIG_STATS_AVG_FACTOR]) { stats_avg_factor = nla_get_u16( tb[QCA_WLAN_VENDOR_ATTR_CONFIG_STATS_AVG_FACTOR]); @@ -4011,6 +4065,37 @@ __wlan_hdd_cfg80211_wifi_configuration_set(struct wiphy *wiphy, } } + if (tb[QCA_WLAN_VENDOR_ATTR_CONFIG_CHANNEL_AVOIDANCE_IND]) { + set_value = nla_get_u8( + tb[QCA_WLAN_VENDOR_ATTR_CONFIG_CHANNEL_AVOIDANCE_IND]); + hdd_info("set_value: %d", set_value); + ret_val = hdd_enable_disable_ca_event(hdd_ctx, set_value); + } + + if (tb[QCA_WLAN_VENDOR_ATTR_CONFIG_SCAN_DEFAULT_IES]) { + scan_ie_len = nla_len( + tb[QCA_WLAN_VENDOR_ATTR_CONFIG_SCAN_DEFAULT_IES]); + hdd_info("Received default scan IE of len %d session %d device mode %d", + scan_ie_len, adapter->sessionId, + adapter->device_mode); + if (scan_ie_len && (scan_ie_len <= MAX_DEFAULT_SCAN_IE_LEN)) { + scan_ie = (uint8_t *) nla_data(tb + [QCA_WLAN_VENDOR_ATTR_CONFIG_SCAN_DEFAULT_IES]); + + if (wlan_hdd_save_default_scan_ies(adapter, scan_ie, + scan_ie_len)) + hdd_err("Failed to save default scan IEs"); + + if (adapter->device_mode == QDF_STA_MODE) { + status = sme_set_default_scan_ie(hdd_ctx->hHal, + adapter->sessionId, scan_ie, + scan_ie_len); + if (QDF_STATUS_SUCCESS != status) + ret_val = -EPERM; + } + } else + ret_val = -EPERM; + } return ret_val; } @@ -4119,9 +4204,9 @@ static int __wlan_hdd_cfg80211_wifi_logger_start(struct wiphy *wiphy, hdd_err("attr flag failed"); return -EINVAL; } - start_log.flag = nla_get_u32( + start_log.is_iwpriv_command = nla_get_u32( tb[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_FLAGS]); - hdd_info("flag=%d", start_log.flag); + hdd_info("is_iwpriv_command =%d", start_log.is_iwpriv_command); cds_set_ring_log_level(start_log.ring_id, start_log.verbose_level); @@ -6790,6 +6875,333 @@ wlan_hdd_sap_config_policy[QCA_WLAN_VENDOR_ATTR_SAP_CONFIG_MAX + 1] = { [QCA_WLAN_VENDOR_ATTR_SAP_CONFIG_CHANNEL] = {.type = NLA_U8 }, }; +static const struct nla_policy +wlan_hdd_set_acs_dfs_config_policy[QCA_WLAN_VENDOR_ATTR_ACS_DFS_MAX + 1] = { + [QCA_WLAN_VENDOR_ATTR_ACS_DFS_MODE] = {.type = NLA_U8 }, + [QCA_WLAN_VENDOR_ATTR_ACS_CHANNEL_HINT] = {.type = NLA_U8 }, +}; + +/** + * __wlan_hdd_cfg80211_acs_dfs_mode() - set ACS DFS mode and channel + * @wiphy: Pointer to wireless phy + * @wdev: Pointer to wireless device + * @data: Pointer to data + * @data_len: Length of @data + * + * This function parses the incoming NL vendor command data attributes and + * updates the SAP context about channel_hint and DFS mode. + * If channel_hint is set, SAP will choose that channel + * as operating channel. + * + * If DFS mode is enabled, driver will include DFS channels + * in ACS else driver will skip DFS channels. + * + * Return: 0 on success, negative errno on failure + */ +static int +__wlan_hdd_cfg80211_acs_dfs_mode(struct wiphy *wiphy, + struct wireless_dev *wdev, + const void *data, int data_len) +{ + hdd_context_t *hdd_ctx = wiphy_priv(wiphy); + struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_ACS_DFS_MAX + 1]; + int ret; + struct acs_dfs_policy *acs_policy; + int mode = DFS_MODE_NONE; + int channel_hint = 0; + + ENTER_DEV(wdev->netdev); + + if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) { + hdd_err("Command not allowed in FTM mode"); + return -EINVAL; + } + + ret = wlan_hdd_validate_context(hdd_ctx); + if (0 != ret) + return ret; + + if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_ACS_DFS_MAX, + data, data_len, + wlan_hdd_set_acs_dfs_config_policy)) { + hdd_err("invalid attr"); + return -EINVAL; + } + + acs_policy = &hdd_ctx->acs_policy; + /* + * SCM sends this attribute to restrict SAP from choosing + * DFS channels from ACS. + */ + if (tb[QCA_WLAN_VENDOR_ATTR_ACS_DFS_MODE]) + mode = nla_get_u8(tb[QCA_WLAN_VENDOR_ATTR_ACS_DFS_MODE]); + + if (!IS_DFS_MODE_VALID(mode)) { + hdd_err("attr acs dfs mode is not valid"); + return -EINVAL; + } + acs_policy->acs_dfs_mode = mode; + + /* + * SCM sends this attribute to provide an active channel, + * to skip redundant ACS between drivers, and save driver start up time + */ + if (tb[QCA_WLAN_VENDOR_ATTR_ACS_CHANNEL_HINT]) + channel_hint = nla_get_u8( + tb[QCA_WLAN_VENDOR_ATTR_ACS_CHANNEL_HINT]); + + if (!IS_CHANNEL_VALID(channel_hint)) { + hdd_err("acs channel is not valid"); + return -EINVAL; + } + acs_policy->acs_channel = channel_hint; + + return 0; +} + +/** + * wlan_hdd_cfg80211_acs_dfs_mode() - Wrapper to set ACS DFS mode + * @wiphy: wiphy structure pointer + * @wdev: Wireless device structure pointer + * @data: Pointer to the data received + * @data_len: Length of @data + * + * This function parses the incoming NL vendor command data attributes and + * updates the SAP context about channel_hint and DFS mode. + * + * Return: 0 on success; errno on failure + */ +static int wlan_hdd_cfg80211_acs_dfs_mode(struct wiphy *wiphy, + struct wireless_dev *wdev, + const void *data, int data_len) +{ + int ret; + + cds_ssr_protect(__func__); + ret = __wlan_hdd_cfg80211_acs_dfs_mode(wiphy, wdev, data, data_len); + cds_ssr_unprotect(__func__); + + return ret; +} + +/** + * wlan_hdd_get_sta_roam_dfs_mode() - get sta roam dfs mode policy + * @mode : cfg80211 dfs mode + * + * Return: return csr sta roam dfs mode else return NONE + */ +static enum sta_roam_policy_dfs_mode wlan_hdd_get_sta_roam_dfs_mode( + enum dfs_mode mode) +{ + switch (mode) { + case DFS_MODE_ENABLE: + return CSR_STA_ROAM_POLICY_DFS_ENABLED; + break; + case DFS_MODE_DISABLE: + return CSR_STA_ROAM_POLICY_DFS_DISABLED; + break; + case DFS_MODE_DEPRIORITIZE: + return CSR_STA_ROAM_POLICY_DFS_DEPRIORITIZE; + break; + default: + hdd_err("STA Roam policy dfs mode is NONE"); + return CSR_STA_ROAM_POLICY_NONE; + } +} + +static const struct nla_policy +wlan_hdd_set_sta_roam_config_policy[ +QCA_WLAN_VENDOR_ATTR_STA_CONNECT_ROAM_POLICY_MAX + 1] = { + [QCA_WLAN_VENDOR_ATTR_STA_DFS_MODE] = {.type = NLA_U8 }, + [QCA_WLAN_VENDOR_ATTR_STA_SKIP_UNSAFE_CHANNEL] = {.type = NLA_U8 }, +}; + +/** + * __wlan_hdd_cfg80211_sta_roam_policy() - Set params to restrict scan channels + * for station connection or roaming. + * @wiphy: Pointer to wireless phy + * @wdev: Pointer to wireless device + * @data: Pointer to data + * @data_len: Length of @data + * + * __wlan_hdd_cfg80211_sta_roam_policy will decide if DFS channels or unsafe + * channels needs to be skipped in scanning or not. + * If dfs_mode is disabled, driver will not scan DFS channels. + * If skip_unsafe_channels is set, driver will skip unsafe channels + * in Scanning. + * + * Return: 0 on success, negative errno on failure + */ +static int +__wlan_hdd_cfg80211_sta_roam_policy(struct wiphy *wiphy, + struct wireless_dev *wdev, + const void *data, int data_len) +{ + struct net_device *dev = wdev->netdev; + hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); + hdd_context_t *hdd_ctx = wiphy_priv(wiphy); + struct nlattr *tb[ + QCA_WLAN_VENDOR_ATTR_STA_CONNECT_ROAM_POLICY_MAX + 1]; + int ret; + enum sta_roam_policy_dfs_mode sta_roam_dfs_mode; + enum dfs_mode mode = DFS_MODE_NONE; + bool skip_unsafe_channels = false; + QDF_STATUS status; + + ENTER_DEV(dev); + + if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) { + hdd_err("Command not allowed in FTM mode"); + return -EINVAL; + } + + ret = wlan_hdd_validate_context(hdd_ctx); + if (0 != ret) + return ret; + if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_STA_CONNECT_ROAM_POLICY_MAX, + data, data_len, + wlan_hdd_set_sta_roam_config_policy)) { + hdd_err("invalid attr"); + return -EINVAL; + } + if (tb[QCA_WLAN_VENDOR_ATTR_STA_DFS_MODE]) + mode = nla_get_u8(tb[QCA_WLAN_VENDOR_ATTR_STA_DFS_MODE]); + if (!IS_DFS_MODE_VALID(mode)) { + hdd_err("attr sta roam dfs mode policy is not valid"); + return -EINVAL; + } + + sta_roam_dfs_mode = wlan_hdd_get_sta_roam_dfs_mode(mode); + + if (tb[QCA_WLAN_VENDOR_ATTR_STA_SKIP_UNSAFE_CHANNEL]) + skip_unsafe_channels = nla_get_u8( + tb[QCA_WLAN_VENDOR_ATTR_STA_SKIP_UNSAFE_CHANNEL]); + + status = sme_update_sta_roam_policy(hdd_ctx->hHal, sta_roam_dfs_mode, + skip_unsafe_channels, adapter->sessionId); + + if (!QDF_IS_STATUS_SUCCESS(status)) { + hdd_err("sme_update_sta_roam_policy (err=%d)", status); + return -EINVAL; + } + return 0; +} + +/** + * wlan_hdd_cfg80211_sta_roam_policy() - Wrapper to restrict scan channels, + * connection and roaming for station. + * @wiphy: wiphy structure pointer + * @wdev: Wireless device structure pointer + * @data: Pointer to the data received + * @data_len: Length of @data + * + * __wlan_hdd_cfg80211_sta_roam_policy will decide if DFS channels or unsafe + * channels needs to be skipped in scanning or not. + * If dfs_mode is disabled, driver will not scan DFS channels. + * If skip_unsafe_channels is set, driver will skip unsafe channels + * in Scanning. + * Return: 0 on success; errno on failure + */ +static int wlan_hdd_cfg80211_sta_roam_policy(struct wiphy *wiphy, + struct wireless_dev *wdev, + const void *data, int data_len) +{ + int ret; + + cds_ssr_protect(__func__); + ret = __wlan_hdd_cfg80211_sta_roam_policy(wiphy, wdev, data, data_len); + cds_ssr_unprotect(__func__); + + return ret; +} + +#ifdef FEATURE_WLAN_CH_AVOID +/** + * __wlan_hdd_cfg80211_avoid_freq() - ask driver to restart SAP if SAP + * is on unsafe channel. + * @wiphy: wiphy structure pointer + * @wdev: Wireless device structure pointer + * @data: Pointer to the data received + * @data_len: Length of @data + * + * wlan_hdd_cfg80211_avoid_freq do restart the sap if sap is already + * on any of unsafe channels. + * If sap is on any of unsafe channel, hdd_unsafe_channel_restart_sap + * will send WLAN_SVC_LTE_COEX_IND indication to userspace to restart. + * + * Return: 0 on success; errno on failure + */ +static int +__wlan_hdd_cfg80211_avoid_freq(struct wiphy *wiphy, + struct wireless_dev *wdev, + const void *data, int data_len) +{ + hdd_context_t *hdd_ctx = wiphy_priv(wiphy); + int ret; + uint16_t unsafe_channel_count; + int unsafe_channel_index; + qdf_device_t qdf_ctx = cds_get_context(QDF_MODULE_ID_QDF_DEVICE); + + ENTER_DEV(wdev->netdev); + + if (!qdf_ctx) { + cds_err("qdf_ctx is NULL"); + return -EINVAL; + } + + if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) { + hdd_err("Command not allowed in FTM mode"); + return -EINVAL; + } + + ret = wlan_hdd_validate_context(hdd_ctx); + if (0 != ret) + return ret; + pld_get_wlan_unsafe_channel(qdf_ctx->dev, hdd_ctx->unsafe_channel_list, + &(hdd_ctx->unsafe_channel_count), + sizeof(hdd_ctx->unsafe_channel_list)); + + unsafe_channel_count = QDF_MIN((uint16_t)hdd_ctx->unsafe_channel_count, + (uint16_t)NUM_CHANNELS); + for (unsafe_channel_index = 0; + unsafe_channel_index < unsafe_channel_count; + unsafe_channel_index++) { + hdd_info("Channel %d is not safe", + hdd_ctx->unsafe_channel_list[unsafe_channel_index]); + } + hdd_unsafe_channel_restart_sap(hdd_ctx); + return 0; +} + +/** + * wlan_hdd_cfg80211_avoid_freq() - ask driver to restart SAP if SAP + * is on unsafe channel. + * @wiphy: wiphy structure pointer + * @wdev: Wireless device structure pointer + * @data: Pointer to the data received + * @data_len: Length of @data + * + * wlan_hdd_cfg80211_avoid_freq do restart the sap if sap is already + * on any of unsafe channels. + * If sap is on any of unsafe channel, hdd_unsafe_channel_restart_sap + * will send WLAN_SVC_LTE_COEX_IND indication to userspace to restart. + * + * Return: 0 on success; errno on failure + */ +static int wlan_hdd_cfg80211_avoid_freq(struct wiphy *wiphy, + struct wireless_dev *wdev, + const void *data, int data_len) +{ + int ret; + + cds_ssr_protect(__func__); + ret = __wlan_hdd_cfg80211_avoid_freq(wiphy, wdev, data, data_len); + cds_ssr_unprotect(__func__); + + return ret; +} + +#endif /** * __wlan_hdd_cfg80211_sap_configuration_set() - ask driver to restart SAP if * SAP is on unsafe channel. @@ -7166,6 +7578,88 @@ static int wlan_hdd_cfg80211_get_wakelock_stats(struct wiphy *wiphy, } /** + * __wlan_hdd_cfg80211_get_bus_size() - Get WMI Bus size + * @wiphy: wiphy structure pointer + * @wdev: Wireless device structure pointer + * @data: Pointer to the data received + * @data_len: Length of @data + * + * This function reads wmi max bus size and fill in the skb with + * NL attributes and send up the NL event. + * Return: 0 on success; errno on failure + */ +static int +__wlan_hdd_cfg80211_get_bus_size(struct wiphy *wiphy, + struct wireless_dev *wdev, + const void *data, int data_len) +{ + hdd_context_t *hdd_ctx = wiphy_priv(wiphy); + int ret_val; + struct sk_buff *skb; + uint32_t nl_buf_len; + + ENTER(); + + ret_val = wlan_hdd_validate_context(hdd_ctx); + if (ret_val) + return ret_val; + + if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) { + hdd_err("Command not allowed in FTM mode"); + return -EINVAL; + } + + hdd_info("WMI Max Bus size: %d", hdd_ctx->wmi_max_len); + + nl_buf_len = NLMSG_HDRLEN; + nl_buf_len += (sizeof(hdd_ctx->wmi_max_len) + NLA_HDRLEN); + + skb = cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy, nl_buf_len); + if (!skb) { + hdd_err("cfg80211_vendor_cmd_alloc_reply_skb failed"); + return -ENOMEM; + } + + if (nla_put_u16(skb, QCA_WLAN_VENDOR_ATTR_DRV_INFO_BUS_SIZE, + hdd_ctx->wmi_max_len)) { + hdd_err("nla put failure"); + goto nla_put_failure; + } + + cfg80211_vendor_cmd_reply(skb); + + EXIT(); + + return 0; + +nla_put_failure: + kfree_skb(skb); + return -EINVAL; +} + +/** + * wlan_hdd_cfg80211_get_bus_size() - SSR Wrapper to Get Bus size + * @wiphy: wiphy structure pointer + * @wdev: Wireless device structure pointer + * @data: Pointer to the data received + * @data_len: Length of @data + * + * Return: 0 on success; errno on failure + */ +static int wlan_hdd_cfg80211_get_bus_size(struct wiphy *wiphy, + struct wireless_dev *wdev, + const void *data, int data_len) +{ + int ret; + + cds_ssr_protect(__func__); + ret = __wlan_hdd_cfg80211_get_bus_size(wiphy, wdev, data, data_len); + cds_ssr_unprotect(__func__); + + return ret; +} + +/** *__wlan_hdd_cfg80211_setband() - set band * @wiphy: Pointer to wireless phy * @wdev: Pointer to wireless device @@ -7818,6 +8312,32 @@ const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = { }, { .info.vendor_id = QCA_NL80211_VENDOR_ID, + .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_ACS_POLICY, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | + WIPHY_VENDOR_CMD_NEED_NETDEV | + WIPHY_VENDOR_CMD_NEED_RUNNING, + .doit = wlan_hdd_cfg80211_acs_dfs_mode + }, + { + .info.vendor_id = QCA_NL80211_VENDOR_ID, + .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_STA_CONNECT_ROAM_POLICY, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | + WIPHY_VENDOR_CMD_NEED_NETDEV | + WIPHY_VENDOR_CMD_NEED_RUNNING, + .doit = wlan_hdd_cfg80211_sta_roam_policy + }, +#ifdef FEATURE_WLAN_CH_AVOID + { + .info.vendor_id = QCA_NL80211_VENDOR_ID, + .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | + WIPHY_VENDOR_CMD_NEED_NETDEV | + WIPHY_VENDOR_CMD_NEED_RUNNING, + .doit = wlan_hdd_cfg80211_avoid_freq + }, +#endif + { + .info.vendor_id = QCA_NL80211_VENDOR_ID, .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_SET_SAP_CONFIG, .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV | @@ -7870,6 +8390,14 @@ const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = { .doit = wlan_hdd_cfg80211_get_wakelock_stats }, { + .info.vendor_id = QCA_NL80211_VENDOR_ID, + .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_GET_BUS_SIZE, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | + WIPHY_VENDOR_CMD_NEED_NETDEV | + WIPHY_VENDOR_CMD_NEED_RUNNING, + .doit = wlan_hdd_cfg80211_get_bus_size + }, + { .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_SETBAND, .flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV | @@ -7883,7 +8411,18 @@ const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = { WIPHY_VENDOR_CMD_NEED_NETDEV | WIPHY_VENDOR_CMD_NEED_RUNNING, .doit = wlan_hdd_cfg80211_set_fast_roaming - } + }, +#ifdef WLAN_FEATURE_DISA + { + .info.vendor_id = QCA_NL80211_VENDOR_ID, + .info.subcmd = + QCA_NL80211_VENDOR_SUBCMD_ENCRYPTION_TEST, + .flags = WIPHY_VENDOR_CMD_NEED_WDEV | + WIPHY_VENDOR_CMD_NEED_NETDEV | + WIPHY_VENDOR_CMD_NEED_RUNNING, + .doit = wlan_hdd_cfg80211_encrypt_decrypt_msg + }, +#endif }; /** @@ -8903,7 +9442,7 @@ done: /* Set bitmask based on updated value */ cds_set_concurrency_mode(pAdapter->device_mode); - wlan_hdd_send_all_scan_intf_info(pHddCtx); + hdd_lpass_notify_mode_change(pAdapter); EXIT(); return 0; @@ -11604,24 +12143,36 @@ disconnected: * @req: Pointer to the structure cfg_connect_params receieved from user space * @status: out variable for status of reassoc request * - * This function will start reassociation if bssid hint, channel hint and - * previous bssid parameters are present in the connect request + * This function will start reassociation if prev_bssid is set and bssid/ + * bssid_hint, channel/channel_hint parameters are present in connect request. * * Return: true if connect was for ReAssociation, false otherwise */ -#ifdef CFG80211_CONNECT_PREV_BSSID +#if defined(CFG80211_CONNECT_PREV_BSSID) || \ + (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)) static bool wlan_hdd_reassoc_bssid_hint(hdd_adapter_t *adapter, struct cfg80211_connect_params *req, int *status) { bool reassoc = false; - if (req->bssid_hint && req->channel_hint && req->prev_bssid) { + const uint8_t *bssid = NULL; + uint16_t channel = 0; + + if (req->bssid) + bssid = req->bssid; + else if (req->bssid_hint) + bssid = req->bssid_hint; + + if (req->channel) + channel = req->channel->hw_value; + else if (req->channel_hint) + channel = req->channel_hint->hw_value; + + if (bssid && channel && req->prev_bssid) { reassoc = true; hdd_info(FL("REASSOC Attempt on channel %d to "MAC_ADDRESS_STR), - req->channel_hint->hw_value, - MAC_ADDR_ARRAY(req->bssid_hint)); - *status = hdd_reassoc(adapter, req->bssid_hint, - req->channel_hint->hw_value, + channel, MAC_ADDR_ARRAY(bssid)); + *status = hdd_reassoc(adapter, bssid, channel, CONNECT_CMD_USERSPACE); hdd_debug("hdd_reassoc: status: %d", *status); } diff --git a/core/hdd/src/wlan_hdd_cfg80211.h b/core/hdd/src/wlan_hdd_cfg80211.h index 8910c89ff5e5..80dbc428c50b 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.h +++ b/core/hdd/src/wlan_hdd_cfg80211.h @@ -383,6 +383,7 @@ enum qca_nl80211_vendor_subcmds { QCA_NL80211_VENDOR_SUBCMD_ND_OFFLOAD = 82, QCA_NL80211_VENDOR_SUBCMD_PACKET_FILTER = 83, + QCA_NL80211_VENDOR_SUBCMD_GET_BUS_SIZE = 84, QCA_NL80211_VENDOR_SUBCMD_GET_WAKE_REASON_STATS = 85, @@ -419,6 +420,8 @@ enum qca_nl80211_vendor_subcmds { QCA_NL80211_VENDOR_SUBCMD_SET_TXPOWER_SCALE = 109, /* Tx power scaling in db subcommands */ QCA_NL80211_VENDOR_SUBCMD_SET_TXPOWER_SCALE_DECR_DB = 115, + QCA_NL80211_VENDOR_SUBCMD_ACS_POLICY = 116, + QCA_NL80211_VENDOR_SUBCMD_STA_CONNECT_ROAM_POLICY = 117, QCA_NL80211_VENDOR_SUBCMD_SET_SAP_CONFIG = 118, QCA_NL80211_VENDOR_SUBCMD_TSF = 119, QCA_NL80211_VENDOR_SUBCMD_WISA = 120, @@ -426,6 +429,9 @@ enum qca_nl80211_vendor_subcmds { QCA_NL80211_VENDOR_SUBCMD_P2P_LISTEN_OFFLOAD_START = 122, QCA_NL80211_VENDOR_SUBCMD_P2P_LISTEN_OFFLOAD_STOP = 123, QCA_NL80211_VENDOR_SUBCMD_SAP_CONDITIONAL_CHAN_SWITCH = 124, + + /* Encrypt/Decrypt command */ + QCA_NL80211_VENDOR_SUBCMD_ENCRYPTION_TEST = 137, }; /** @@ -2330,6 +2336,8 @@ enum qca_access_policy { * with access policy * @QCA_WLAN_VENDOR_ATTR_CONFIG_IFINDEX: interface index for vdev specific * parameters + * @QCA_WLAN_VENDOR_ATTR_CONFIG_QPOWER: Unsigned 8bit length attribute to update + * power save config to turn off/on qpower * @QCA_WLAN_VENDOR_ATTR_CONFIG_LAST: last config * @QCA_WLAN_VENDOR_ATTR_CONFIG_MAX: max config */ @@ -2339,6 +2347,8 @@ enum qca_wlan_vendor_config { QCA_WLAN_VENDOR_ATTR_CONFIG_STATS_AVG_FACTOR, QCA_WLAN_VENDOR_ATTR_CONFIG_GUARD_TIME, QCA_WLAN_VENDOR_ATTR_CONFIG_FINE_TIME_MEASUREMENT, + QCA_WLAN_VENDOR_ATTR_CONFIG_PENALIZE_AFTER_NCONS_BEACON_MISS, + QCA_WLAN_VENDOR_ATTR_CONFIG_CHANNEL_AVOIDANCE_IND, /* Attribute used to set scan default IEs to the driver. * * These IEs can be used by scan operations that will be initiated by @@ -2376,6 +2386,8 @@ enum qca_wlan_vendor_config { * not specified, the configurations are attributed to the respective * wiphy. */ QCA_WLAN_VENDOR_ATTR_CONFIG_IFINDEX, + /* Unsigned 8-bit, for setting qpower dynamically */ + QCA_WLAN_VENDOR_ATTR_CONFIG_QPOWER = 25, /* keep last */ QCA_WLAN_VENDOR_ATTR_CONFIG_LAST, QCA_WLAN_VENDOR_ATTR_CONFIG_MAX = @@ -2755,6 +2767,60 @@ enum qca_vendor_attr_txpower_scale_decr_db { }; /** + * enum dfs_mode - state of DFS mode + * @DFS_MODE_NONE: DFS mode attribute is none + * @DFS_MODE_ENABLE: DFS mode is enabled + * @DFS_MODE_DISABLE: DFS mode is disabled + * @DFS_MODE_DEPRIORITIZE: Deprioritize DFS channels in scanning + */ +enum dfs_mode { + DFS_MODE_NONE, + DFS_MODE_ENABLE, + DFS_MODE_DISABLE, + DFS_MODE_DEPRIORITIZE +}; + +/** + * enum qca_wlan_vendor_attr_acs_config - Config params for ACS + * @QCA_WLAN_VENDOR_ATTR_ACS_MODE_INVALID: Invalid + * @QCA_WLAN_VENDOR_ATTR_ACS_DFS_MODE: Dfs mode for ACS + * QCA_WLAN_VENDOR_ATTR_ACS_CHANNEL_HINT: channel_hint for ACS + * QCA_WLAN_VENDOR_ATTR_ACS_DFS_AFTER_LAST: after_last + * QCA_WLAN_VENDOR_ATTR_ACS_DFS_MAX: max attribute + */ +enum qca_wlan_vendor_attr_acs_config { + QCA_WLAN_VENDOR_ATTR_ACS_MODE_INVALID = 0, + QCA_WLAN_VENDOR_ATTR_ACS_DFS_MODE, + QCA_WLAN_VENDOR_ATTR_ACS_CHANNEL_HINT, + + QCA_WLAN_VENDOR_ATTR_ACS_DFS_AFTER_LAST, + QCA_WLAN_VENDOR_ATTR_ACS_DFS_MAX = + QCA_WLAN_VENDOR_ATTR_ACS_DFS_AFTER_LAST - 1, + +}; + +/** + * enum qca_wlan_vendor_attr_sta_connect_roam_policy_config - + * config params for sta roam policy + * @QCA_WLAN_VENDOR_ATTR_STA_CONNECT_ROAM_POLICY_INVALID: Invalid + * @QCA_WLAN_VENDOR_ATTR_STA_DFS_MODE: If sta should skip Dfs channels + * @QCA_WLAN_VENDOR_ATTR_STA_SKIP_UNSAFE_CHANNEL: + * If sta should skip unsafe channels or not in scanning + * @QCA_WLAN_VENDOR_ATTR_STA_CONNECT_ROAM_POLICY_LAST: + * @QCA_WLAN_VENDOR_ATTR_STA_CONNECT_ROAM_POLICY_MAX: max attribute + */ +enum qca_wlan_vendor_attr_sta_connect_roam_policy_config { + QCA_WLAN_VENDOR_ATTR_STA_CONNECT_ROAM_POLICY_INVALID = 0, + QCA_WLAN_VENDOR_ATTR_STA_DFS_MODE, + QCA_WLAN_VENDOR_ATTR_STA_SKIP_UNSAFE_CHANNEL, + + QCA_WLAN_VENDOR_ATTR_STA_CONNECT_ROAM_POLICY_AFTER_LAST, + QCA_WLAN_VENDOR_ATTR_STA_CONNECT_ROAM_POLICY_MAX = + QCA_WLAN_VENDOR_ATTR_STA_CONNECT_ROAM_POLICY_AFTER_LAST - 1, +}; + + +/** * enum qca_wlan_vendor_attr_sap_config - config params for sap configuration * @QCA_WLAN_VENDOR_ATTR_SAP_CONFIG_INVALID: invalid * @QCA_WLAN_VENDOR_ATTR_SAP_CONFIG_CHANNEL: Channel on which SAP should start @@ -2817,6 +2883,60 @@ enum qca_wlan_vendor_attr_p2p_listen_offload { QCA_WLAN_VENDOR_ATTR_P2P_LISTEN_OFFLOAD_AFTER_LAST - 1 }; +/** + * enum qca_wlan_vendor_drv_info - WLAN driver info + * @QCA_WLAN_VENDOR_ATTR_DRV_INFO_INVALID: Invalid + * @QCA_WLAN_VENDOR_ATTR_DRV_INFO_BUS_SIZE: Maximum Message size info + * between Firmware & Host. + */ +enum qca_wlan_vendor_drv_info { + QCA_WLAN_VENDOR_ATTR_DRV_INFO_INVALID = 0, + QCA_WLAN_VENDOR_ATTR_DRV_INFO_BUS_SIZE, + + /* keep last */ + QCA_WLAN_VENDOR_ATTR_DRV_INFO_AFTER_LAST, + QCA_WLAN_VENDOR_ATTR_DRV_INFO_MAX = + QCA_WLAN_VENDOR_ATTR_DRV_INFO_AFTER_LAST - 1, +}; + +/** + * enum qca_wlan_vendor_attr_encryption_test - Attributes to + * validate encryption engine + * + * @QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_NEEDS_DECRYPTION: Flag attribute. + * This will be included if the request is for decryption; if not included, + * the request is treated as a request for encryption by default. + * @QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_CIPHER: Unsigned 32-bit value + * indicating the key cipher suite. Takes same values as + * NL80211_ATTR_KEY_CIPHER. + * @QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_KEYID: Unsigned 8-bit value + * Key Id to be used for encryption + * @QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_TK: Array of 8-bit values. + * Key (TK) to be used for encryption/decryption + * @QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_PN: Array of 8-bit values. + * Packet number to be specified for encryption/decryption + * 6 bytes for TKIP/CCMP/GCMP. + * @QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_DATA: Array of 8-bit values + * representing the 802.11 packet (header + payload + FCS) that + * needs to be encrypted/decrypted. + * Encrypted/decrypted response from the driver will also be sent + * to userspace with the same attribute. + */ +enum qca_wlan_vendor_attr_encryption_test { + QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_INVALID = 0, + QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_NEEDS_DECRYPTION, + QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_CIPHER, + QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_KEYID, + QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_TK, + QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_PN, + QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_DATA, + + /* keep last */ + QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_AFTER_LAST, + QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_MAX = + QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_AFTER_LAST - 1 +}; + struct cfg80211_bss *wlan_hdd_cfg80211_update_bss_db(hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo); diff --git a/core/hdd/src/wlan_hdd_disa.c b/core/hdd/src/wlan_hdd_disa.c new file mode 100644 index 000000000000..a4153fc5f1db --- /dev/null +++ b/core/hdd/src/wlan_hdd_disa.c @@ -0,0 +1,496 @@ +/* + * Copyright (c) 2016 The Linux Foundation. All rights reserved. + * + * Permission to use, copy, modify, and/or distribute this software for + * any purpose with or without fee is hereby granted, provided that the + * 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. + */ + +/** + * DOC : wlan_hdd_disa.c + * + * WLAN Host Device Driver file for DISA certification + * + */ + +#include "wlan_hdd_disa.h" +#include "sme_api.h" + +#define ENCRYPT_DECRYPT_CONTEXT_MAGIC 0x4475354 +#define WLAN_WAIT_TIME_ENCRYPT_DECRYPT 1000 + + +/** + * hdd_encrypt_decrypt_msg_context - hdd encrypt/decrypt message context + * + * @magic: magic number + * @completion: Completion variable for encrypt/decrypt message + * @response_event: encrypt/decrypt message request wait event + */ +struct hdd_encrypt_decrypt_msg_context { + unsigned int magic; + struct completion completion; + struct sir_encrypt_decrypt_rsp_params response; +}; +static struct hdd_encrypt_decrypt_msg_context encrypt_decrypt_msg_context; + +/** + * hdd_encrypt_decrypt_msg_cb () - sends encrypt/decrypt data to user space + * @encrypt_decrypt_rsp_params: encrypt/decrypt response parameters + * + * Return: none + */ +static void hdd_encrypt_decrypt_msg_cb(void *hdd_context, + struct sir_encrypt_decrypt_rsp_params *encrypt_decrypt_rsp_params) +{ + hdd_context_t *hdd_ctx = hdd_context; + int ret; + struct hdd_encrypt_decrypt_msg_context *context; + + ENTER(); + + ret = wlan_hdd_validate_context(hdd_ctx); + if (ret) + return; + + if (!encrypt_decrypt_rsp_params) { + hdd_err("rsp params is NULL"); + return; + } + + print_hex_dump(KERN_INFO, "Data in hdd_encrypt_decrypt_msg_cb: ", + DUMP_PREFIX_NONE, 16, 1, + encrypt_decrypt_rsp_params->data, + encrypt_decrypt_rsp_params->data_length, 0); + + hdd_err("vdev_id %d,status %d data_length %d", + encrypt_decrypt_rsp_params->vdev_id, + encrypt_decrypt_rsp_params->status, + encrypt_decrypt_rsp_params->data_length); + + spin_lock(&hdd_context_lock); + + context = &encrypt_decrypt_msg_context; + /* The caller presumably timed out so there is nothing we can do */ + if (context->magic != ENCRYPT_DECRYPT_CONTEXT_MAGIC) { + spin_unlock(&hdd_context_lock); + return; + } + + /* context is valid so caller is still waiting */ + context->response = *encrypt_decrypt_rsp_params; + + if (encrypt_decrypt_rsp_params->data_length) { + context->response.data = + qdf_mem_malloc(sizeof(uint8_t) * + encrypt_decrypt_rsp_params->data_length); + if (context->response.data == NULL) { + hdd_err("cdf_mem_alloc failed for data"); + spin_unlock(&hdd_context_lock); + return; + } + qdf_mem_copy(context->response.data, + encrypt_decrypt_rsp_params->data, + encrypt_decrypt_rsp_params->data_length); + } + + /* + * Indicate to calling thread that + * response data is available + */ + context->magic = 0; + + complete(&context->completion); + + spin_unlock(&hdd_context_lock); + + + EXIT(); +} + + +/** + * hdd_encrypt_decrypt_msg_cb () - sends encrypt/decrypt data to user space + * @encrypt_decrypt_rsp_params: encrypt/decrypt response parameters + * + * Return: none + */ +static int hdd_post_encrypt_decrypt_msg_rsp(hdd_context_t *hdd_ctx, + struct sir_encrypt_decrypt_rsp_params *encrypt_decrypt_rsp_params) +{ + struct sk_buff *skb; + uint32_t nl_buf_len; + + ENTER(); + + nl_buf_len = encrypt_decrypt_rsp_params->data_length + NLA_HDRLEN; + + skb = cfg80211_vendor_cmd_alloc_reply_skb(hdd_ctx->wiphy, nl_buf_len); + if (!skb) { + hdd_err(FL("cfg80211_vendor_cmd_alloc_reply_skb failed")); + return -ENOMEM; + } + + if (encrypt_decrypt_rsp_params->data_length) { + if (nla_put(skb, QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_DATA, + encrypt_decrypt_rsp_params->data_length, + encrypt_decrypt_rsp_params->data)) { + hdd_err(FL("put fail")); + goto nla_put_failure; + } + } + + cfg80211_vendor_cmd_reply(skb); + EXIT(); + return 0; + +nla_put_failure: + kfree_skb(skb); + return -EINVAL; +} + +/** + * hdd_fill_encrypt_decrypt_params () - parses data from user space + * and fills encrypt/decrypt parameters + * @encrypt_decrypt_params: encrypt/decrypt request parameters + * @adapter : adapter context + * @data: Pointer to data + * @data_len: Data length + * + Return: 0 on success, negative errno on failure + */ +static int hdd_fill_encrypt_decrypt_params(struct encrypt_decrypt_req_params + *encrypt_decrypt_params, + hdd_adapter_t *adapter, + const void *data, + int data_len) +{ + struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_MAX + 1]; + uint8_t len, mac_hdr_len; + uint8_t *tmp; + uint8_t fc[2]; + + if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_MAX, + data, data_len, NULL)) { + hdd_err("Invalid ATTR"); + return -EINVAL; + } + + encrypt_decrypt_params->vdev_id = adapter->sessionId; + hdd_err("vdev_id : %d", encrypt_decrypt_params->vdev_id); + + if (!tb[QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_NEEDS_DECRYPTION]) { + hdd_err("attr flag NEEDS_DECRYPTION not present"); + encrypt_decrypt_params->key_flag = WMI_ENCRYPT; + } else { + hdd_err("attr flag NEEDS_DECRYPTION present"); + encrypt_decrypt_params->key_flag = WMI_DECRYPT; + } + hdd_err("Key flag : %d", encrypt_decrypt_params->key_flag); + + if (!tb[QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_KEYID]) { + hdd_err("attr key id failed"); + return -EINVAL; + } + encrypt_decrypt_params->key_idx = nla_get_u8(tb + [QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_KEYID]); + hdd_err("Key Idx : %d", encrypt_decrypt_params->key_idx); + + if (!tb[QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_CIPHER]) { + hdd_err("attr Cipher failed"); + return -EINVAL; + } + encrypt_decrypt_params->key_cipher = nla_get_u32(tb + [QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_CIPHER]); + hdd_err("key_cipher : %d", encrypt_decrypt_params->key_cipher); + + if (!tb[QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_TK]) { + hdd_err("attr TK failed"); + return -EINVAL; + } + encrypt_decrypt_params->key_len = + nla_len(tb[QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_TK]); + if (!encrypt_decrypt_params->key_len) { + hdd_err("Invalid TK length"); + return -EINVAL; + } + hdd_err("Key len : %d", encrypt_decrypt_params->key_len); + + if (encrypt_decrypt_params->key_len > SIR_MAC_MAX_KEY_LENGTH) + encrypt_decrypt_params->key_len = SIR_MAC_MAX_KEY_LENGTH; + + tmp = nla_data(tb[QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_TK]); + + qdf_mem_copy(encrypt_decrypt_params->key_data, tmp, + encrypt_decrypt_params->key_len); + + print_hex_dump(KERN_INFO, "Key : ", DUMP_PREFIX_NONE, 16, 1, + &encrypt_decrypt_params->key_data, + encrypt_decrypt_params->key_len, 0); + + if (!tb[QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_PN]) { + hdd_err("attr PN failed"); + return -EINVAL; + } + len = nla_len(tb[QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_PN]); + if (!len) { + hdd_err("Invalid PN length"); + return -EINVAL; + } + + tmp = nla_data(tb[QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_PN]); + + qdf_mem_copy(encrypt_decrypt_params->pn, tmp, len); + + print_hex_dump(KERN_INFO, "PN received : ", DUMP_PREFIX_NONE, 16, 1, + &encrypt_decrypt_params->pn, len, 0); + + if (!tb[QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_DATA]) { + hdd_err("attr header failed"); + return -EINVAL; + } + len = nla_len(tb[QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_DATA]); + if (!len) { + hdd_err("Invalid header and payload length"); + return -EINVAL; + } + + hdd_err("Header and Payload length %d ", len); + + tmp = nla_data(tb[QCA_WLAN_VENDOR_ATTR_ENCRYPTION_TEST_DATA]); + + print_hex_dump(KERN_INFO, "Header and Payload received: ", + DUMP_PREFIX_NONE, 16, 1, + tmp, len, 0); + + mac_hdr_len = MIN_MAC_HEADER_LEN; + + /* + * Check to find out address 4. Address 4 is present if ToDS and FromDS + * are 1 and data representation is little endian. + */ + fc[1] = *tmp; + fc[0] = *(tmp + 1); + if ((fc[0] & 0x03) == 0x03) { + hdd_err("Address 4 is present"); + mac_hdr_len += IEEE80211_ADDR_LEN; + } + + /* + * Check to find out Qos control field. Qos control field is present + * if msb of subtype field is 1 and data representation is + * little endian. + */ + if (fc[1] & 0x80) { + hdd_err("Qos control is present"); + mac_hdr_len += QOS_CONTROL_LEN; + } + + hdd_err("mac_hdr_len %d", mac_hdr_len); + + qdf_mem_copy(encrypt_decrypt_params->mac_header, + tmp, mac_hdr_len); + + print_hex_dump(KERN_INFO, "Header received in request: ", + DUMP_PREFIX_NONE, 16, 1, + encrypt_decrypt_params->mac_header, + mac_hdr_len, 0); + + encrypt_decrypt_params->data_len = + len - mac_hdr_len; + + hdd_err("Payload length : %d", encrypt_decrypt_params->data_len); + + if (encrypt_decrypt_params->data_len) { + encrypt_decrypt_params->data = + qdf_mem_malloc(sizeof(uint8_t) * + encrypt_decrypt_params->data_len); + + if (encrypt_decrypt_params->data == NULL) { + hdd_err("cdf_mem_alloc failed for data"); + return -ENOMEM; + } + + qdf_mem_copy(encrypt_decrypt_params->data, + tmp + mac_hdr_len, + encrypt_decrypt_params->data_len); + + print_hex_dump(KERN_INFO, "Data received in request: ", + DUMP_PREFIX_NONE, 16, 1, + encrypt_decrypt_params->data, + encrypt_decrypt_params->data_len, 0); + } + + return 0; +} + +/** + * hdd_encrypt_decrypt_msg () - process encrypt/decrypt message + * @adapter : adapter context + * @hdd_ctx: hdd context + * @data: Pointer to data + * @data_len: Data length + * + Return: 0 on success, negative errno on failure + */ +static int hdd_encrypt_decrypt_msg(hdd_adapter_t *adapter, + hdd_context_t *hdd_ctx, + const void *data, + int data_len) +{ + struct encrypt_decrypt_req_params encrypt_decrypt_params = {0}; + QDF_STATUS qdf_status; + int ret; + struct hdd_encrypt_decrypt_msg_context *context; + unsigned long rc; + + ret = hdd_fill_encrypt_decrypt_params(&encrypt_decrypt_params, + adapter, data, data_len); + if (ret) + return ret; + + spin_lock(&hdd_context_lock); + context = &encrypt_decrypt_msg_context; + context->magic = ENCRYPT_DECRYPT_CONTEXT_MAGIC; + INIT_COMPLETION(context->completion); + spin_unlock(&hdd_context_lock); + + qdf_status = sme_encrypt_decrypt_msg(hdd_ctx->hHal, + &encrypt_decrypt_params); + + qdf_mem_free(encrypt_decrypt_params.data); + + if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { + hdd_err("Unable to post encrypt/decrypt message"); + return -EINVAL; + } + + rc = wait_for_completion_timeout(&context->completion, + msecs_to_jiffies(WLAN_WAIT_TIME_ENCRYPT_DECRYPT)); + + spin_lock(&hdd_context_lock); + if (!rc && (context->magic == + ENCRYPT_DECRYPT_CONTEXT_MAGIC)) { + hdd_err("Target response timed out"); + context->magic = 0; + spin_unlock(&hdd_context_lock); + return -ETIMEDOUT; + } + + spin_unlock(&hdd_context_lock); + ret = hdd_post_encrypt_decrypt_msg_rsp(hdd_ctx, + &encrypt_decrypt_msg_context.response); + if (ret) + hdd_err("Failed to post encrypt/decrypt message response"); + + qdf_mem_free(encrypt_decrypt_msg_context.response.data); + + EXIT(); + return ret; +} + +/** + * hdd_encrypt_decrypt_init () - exposes encrypt/decrypt initialization + * functionality + * @hdd_ctx: hdd context + * + Return: 0 on success, negative errno on failure + */ +int hdd_encrypt_decrypt_init(hdd_context_t *hdd_ctx) +{ + QDF_STATUS status; + + init_completion(&encrypt_decrypt_msg_context.completion); + + status = sme_encrypt_decrypt_msg_register_callback(hdd_ctx->hHal, + hdd_encrypt_decrypt_msg_cb); + if (!QDF_IS_STATUS_SUCCESS(status)) { + hdd_err("encrypt/decrypt callback failed %d", status); + return -EINVAL; + } + return 0; +} + +/** + * hdd_encrypt_decrypt_deinit () - exposes encrypt/decrypt deinitialization + * functionality + * @hdd_ctx: hdd context + * + Return: 0 on success, negative errno on failure + */ +int hdd_encrypt_decrypt_deinit(hdd_context_t *hdd_ctx) +{ + QDF_STATUS status; + + status = sme_encrypt_decrypt_msg_deregister_callback(hdd_ctx->hHal); + if (!QDF_IS_STATUS_SUCCESS(status)) + hdd_err("De-register encrypt/decrypt callback failed: %d", + status); + return 0; +} + +/** + * __wlan_hdd_cfg80211_encrypt_decrypt_msg () - Encrypt/Decrypt msg + * @wiphy: Pointer to wireless phy + * @wdev: Pointer to wireless device + * @data: Pointer to data + * @data_len: Data length + * + * Return: 0 on success, negative errno on failure + */ +static int __wlan_hdd_cfg80211_encrypt_decrypt_msg(struct wiphy *wiphy, + struct wireless_dev *wdev, + const void *data, + int data_len) +{ + hdd_context_t *hdd_ctx = wiphy_priv(wiphy); + struct net_device *dev = wdev->netdev; + hdd_adapter_t *adapter = NULL; + int ret; + + ENTER_DEV(dev); + + ret = wlan_hdd_validate_context(hdd_ctx); + if (ret) + return ret; + + adapter = WLAN_HDD_GET_PRIV_PTR(dev); + + ret = hdd_encrypt_decrypt_msg(adapter, hdd_ctx, data, data_len); + + return ret; +} + +/** + * wlan_hdd_cfg80211_encrypt_decrypt_msg () - Encrypt/Decrypt msg + * @wiphy: Pointer to wireless phy + * @wdev: Pointer to wireless device + * @data: Pointer to data + * @data_len: Data length + * + * Return: 0 on success, negative errno on failure + */ +int wlan_hdd_cfg80211_encrypt_decrypt_msg(struct wiphy *wiphy, + struct wireless_dev *wdev, + const void *data, + int data_len) +{ + int ret; + + cds_ssr_protect(__func__); + ret = __wlan_hdd_cfg80211_encrypt_decrypt_msg(wiphy, wdev, + data, data_len); + cds_ssr_unprotect(__func__); + + return ret; +} diff --git a/core/hdd/src/wlan_hdd_disa.h b/core/hdd/src/wlan_hdd_disa.h new file mode 100644 index 000000000000..b35c02c5dbbe --- /dev/null +++ b/core/hdd/src/wlan_hdd_disa.h @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2016 The Linux Foundation. All rights reserved. + * + * Permission to use, copy, modify, and/or distribute this software for + * any purpose with or without fee is hereby granted, provided that the + * 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. + */ + +#ifndef _WLAN_HDD_DISA_H +#define _WLAN_HDD_DISA_H + +#include "wlan_hdd_main.h" +#include "sir_api.h" + +#ifdef WLAN_FEATURE_DISA +/** + * hdd_encrypt_decrypt_init () - exposes encrypt/decrypt initialization + * functionality + * @hdd_ctx: hdd context + * + Return: 0 on success, negative errno on failure + */ +int hdd_encrypt_decrypt_init(hdd_context_t *hdd_ctx); + +/** + * hdd_encrypt_decrypt_deinit () - exposes encrypt/decrypt deinitialization + * functionality + * @hdd_ctx: hdd context + * + Return: 0 on success, negative errno on failure + */ +int hdd_encrypt_decrypt_deinit(hdd_context_t *hdd_ctx); +#else +static inline int hdd_encrypt_decrypt_init(hdd_context_t *hdd_ctx) +{ + return -ENOTSUPP; +} +static inline int hdd_encrypt_decrypt_deinit(hdd_context_t *hdd_ctx) +{ + return -ENOTSUPP; +} +#endif + +#ifdef WLAN_FEATURE_DISA +/** + * wlan_hdd_cfg80211_encrypt_decrypt_msg () - Encrypt/Decrypt msg + * @wiphy: Pointer to wireless phy + * @wdev: Pointer to wireless device + * @data: Pointer to data + * @data_len: Data length + * + * Return: 0 on success, negative errno on failure + */ +int wlan_hdd_cfg80211_encrypt_decrypt_msg(struct wiphy *wiphy, + struct wireless_dev *wdev, + const void *data, + int data_len); +#endif + +#endif diff --git a/core/hdd/src/wlan_hdd_driver_ops.c b/core/hdd/src/wlan_hdd_driver_ops.c index b42be5634d69..a20fcb7b7836 100644 --- a/core/hdd/src/wlan_hdd_driver_ops.c +++ b/core/hdd/src/wlan_hdd_driver_ops.c @@ -266,8 +266,6 @@ 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: @@ -287,8 +285,6 @@ 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); @@ -417,11 +413,6 @@ static void wlan_hdd_remove(struct device *dev) pr_info("%s: Removing driver v%s\n", WLAN_MODULE_NAME, QWLAN_VERSIONSTR); - /* Wait for recovery to complete */ - while (cds_is_driver_recovering()) { - hdd_alert("Recovery in progress; wait here!!!"); - msleep(1000); - } cds_set_driver_loaded(false); cds_set_unload_in_progress(true); diff --git a/core/hdd/src/wlan_hdd_ftm.c b/core/hdd/src/wlan_hdd_ftm.c index 54b90366af87..da03cf0548ca 100644 --- a/core/hdd/src/wlan_hdd_ftm.c +++ b/core/hdd/src/wlan_hdd_ftm.c @@ -48,6 +48,7 @@ #include "i_cds_packet.h" #include "cds_reg_service.h" #include "wlan_hdd_main.h" +#include "wlan_hdd_lpass.h" #include "qwlan_version.h" #include "wma_types.h" #include "cfg_api.h" @@ -56,7 +57,6 @@ #include "bmi.h" #include "ol_fw.h" #include "wlan_hdd_cfg80211.h" -#include "wlan_hdd_main.h" #include "hif.h" #endif @@ -114,18 +114,6 @@ static uint32_t wlan_ftm_postmsg(uint8_t *cmd_ptr, uint16_t cmd_len) return QDF_STATUS_SUCCESS; } -#ifdef WLAN_FEATURE_LPSS -static inline void hdd_is_lpass_supported(struct cds_config_info *cds_cfg, - hdd_context_t *hdd_ctx) -{ - cds_cfg->is_lpass_enabled = hdd_ctx->config->enable_lpass_support; -} -#else -static inline void hdd_is_lpass_supported(struct cds_config_info *cds_cfg, - hdd_context_t *hdd_ctx) -{ } -#endif - /** * hdd_update_cds_config_ftm() - API to update cds configuration parameters * for FTM mode. @@ -138,17 +126,16 @@ int hdd_update_cds_config_ftm(hdd_context_t *hdd_ctx) { struct cds_config_info *cds_cfg; - cds_cfg = qdf_mem_malloc(sizeof(struct cds_config_info)); + cds_cfg = qdf_mem_malloc(sizeof(*cds_cfg)); if (!cds_cfg) { hdd_err("failed to allocate cds config"); return -ENOMEM; } - qdf_mem_zero(cds_cfg, sizeof(struct cds_config_info)); cds_cfg->driver_type = eDRIVER_TYPE_MFG; cds_cfg->powersave_offload_enabled = hdd_ctx->config->enablePowersaveOffload; - hdd_is_lpass_supported(cds_cfg, hdd_ctx); + hdd_lpass_populate_cds_config(cds_cfg, hdd_ctx); /* UMA is supported in hardware for performing the * frame translation 802.11 <-> 802.3 */ diff --git a/core/hdd/src/wlan_hdd_green_ap.c b/core/hdd/src/wlan_hdd_green_ap.c index 2bae7fba0b72..1dccc70ae1c6 100644 --- a/core/hdd/src/wlan_hdd_green_ap.c +++ b/core/hdd/src/wlan_hdd_green_ap.c @@ -97,16 +97,16 @@ struct hdd_green_ap_ctx { }; /** - * hdd_wlan_green_ap_update() - update the current State and Event + * hdd_green_ap_update() - update the current State and Event * @hdd_ctx: Global HDD context * @state: New state * @event: New event * * Return: none */ -static void hdd_wlan_green_ap_update(struct hdd_context_s *hdd_ctx, - enum hdd_green_ap_ps_state state, - enum hdd_green_ap_event event) +static void hdd_green_ap_update(struct hdd_context_s *hdd_ctx, + enum hdd_green_ap_ps_state state, + enum hdd_green_ap_event event) { struct hdd_green_ap_ctx *green_ap = hdd_ctx->green_ap_ctx; @@ -115,14 +115,13 @@ static void hdd_wlan_green_ap_update(struct hdd_context_s *hdd_ctx, } /** - * hdd_wlan_green_ap_enable() - Send Green AP configuration to firmware + * hdd_green_ap_enable() - Send Green AP configuration to firmware * @adapter: Adapter upon which Green AP is being configured * @enable: Flag which indicates if Green AP is being enabled or disabled * * Return: 0 upon success, non-zero upon failure */ -static int hdd_wlan_green_ap_enable(hdd_adapter_t *adapter, - uint8_t enable) +static int hdd_green_ap_enable(hdd_adapter_t *adapter, uint8_t enable) { int ret; @@ -136,14 +135,14 @@ static int hdd_wlan_green_ap_enable(hdd_adapter_t *adapter, } /** - * hdd_wlan_green_ap_mc() - Green AP state machine + * hdd_green_ap_mc() - Green AP state machine * @hdd_ctx: HDD global context * @event: New event being processed * * Return: none */ -static void hdd_wlan_green_ap_mc(struct hdd_context_s *hdd_ctx, - enum hdd_green_ap_event event) +static void hdd_green_ap_mc(struct hdd_context_s *hdd_ctx, + enum hdd_green_ap_event event) { struct hdd_green_ap_ctx *green_ap; hdd_adapter_t *adapter; @@ -187,9 +186,9 @@ static void hdd_wlan_green_ap_mc(struct hdd_context_s *hdd_ctx, /* Confirm that power save is enabled before doing state transitions */ if (!green_ap->ps_enable) { hdd_notice("Green-AP is disabled"); - hdd_wlan_green_ap_update(hdd_ctx, - GREEN_AP_PS_IDLE_STATE, - GREEN_AP_PS_WAIT_EVENT); + hdd_green_ap_update(hdd_ctx, + GREEN_AP_PS_IDLE_STATE, + GREEN_AP_PS_WAIT_EVENT); goto done; } @@ -202,16 +201,16 @@ static void hdd_wlan_green_ap_mc(struct hdd_context_s *hdd_ctx, /* handle the green ap ps state */ switch (green_ap->ps_state) { case GREEN_AP_PS_IDLE_STATE: - hdd_wlan_green_ap_update(hdd_ctx, - GREEN_AP_PS_OFF_STATE, - GREEN_AP_PS_WAIT_EVENT); + hdd_green_ap_update(hdd_ctx, + GREEN_AP_PS_OFF_STATE, + GREEN_AP_PS_WAIT_EVENT); break; case GREEN_AP_PS_OFF_STATE: if (!green_ap->num_nodes) { - hdd_wlan_green_ap_update(hdd_ctx, - GREEN_AP_PS_WAIT_STATE, - GREEN_AP_PS_WAIT_EVENT); + hdd_green_ap_update(hdd_ctx, + GREEN_AP_PS_WAIT_STATE, + GREEN_AP_PS_WAIT_EVENT); qdf_mc_timer_start(&green_ap->ps_timer, green_ap->ps_delay_time); } @@ -219,44 +218,44 @@ static void hdd_wlan_green_ap_mc(struct hdd_context_s *hdd_ctx, case GREEN_AP_PS_WAIT_STATE: if (!green_ap->num_nodes) { - hdd_wlan_green_ap_update(hdd_ctx, - GREEN_AP_PS_ON_STATE, - GREEN_AP_PS_WAIT_EVENT); + hdd_green_ap_update(hdd_ctx, + GREEN_AP_PS_ON_STATE, + GREEN_AP_PS_WAIT_EVENT); - hdd_wlan_green_ap_enable(adapter, 1); + hdd_green_ap_enable(adapter, 1); if (green_ap->ps_on_time) { - hdd_wlan_green_ap_update(hdd_ctx, - 0, - GREEN_AP_PS_WAIT_EVENT); + hdd_green_ap_update(hdd_ctx, + 0, + GREEN_AP_PS_WAIT_EVENT); qdf_mc_timer_start(&green_ap->ps_timer, green_ap->ps_on_time); } } else { - hdd_wlan_green_ap_update(hdd_ctx, - GREEN_AP_PS_OFF_STATE, - GREEN_AP_PS_WAIT_EVENT); + hdd_green_ap_update(hdd_ctx, + GREEN_AP_PS_OFF_STATE, + GREEN_AP_PS_WAIT_EVENT); } break; case GREEN_AP_PS_ON_STATE: if (green_ap->num_nodes) { - if (hdd_wlan_green_ap_enable(adapter, 0)) { + if (hdd_green_ap_enable(adapter, 0)) { hdd_err("FAILED TO SET GREEN-AP mode"); goto done; } - hdd_wlan_green_ap_update(hdd_ctx, - GREEN_AP_PS_OFF_STATE, - GREEN_AP_PS_WAIT_EVENT); + hdd_green_ap_update(hdd_ctx, + GREEN_AP_PS_OFF_STATE, + GREEN_AP_PS_WAIT_EVENT); } else if ((green_ap->ps_event == GREEN_AP_PS_WAIT_EVENT) && (green_ap->ps_on_time)) { /* ps_on_time timeout, switch to ps off */ - hdd_wlan_green_ap_update(hdd_ctx, - GREEN_AP_PS_WAIT_STATE, - GREEN_AP_PS_ON_EVENT); + hdd_green_ap_update(hdd_ctx, + GREEN_AP_PS_WAIT_STATE, + GREEN_AP_PS_ON_EVENT); - if (hdd_wlan_green_ap_enable(adapter, 0)) { + if (hdd_green_ap_enable(adapter, 0)) { hdd_err("FAILED TO SET GREEN-AP mode"); goto done; } @@ -268,8 +267,8 @@ static void hdd_wlan_green_ap_mc(struct hdd_context_s *hdd_ctx, default: hdd_err("invalid state %d", green_ap->ps_state); - hdd_wlan_green_ap_update(hdd_ctx, GREEN_AP_PS_OFF_STATE, - GREEN_AP_PS_WAIT_EVENT); + hdd_green_ap_update(hdd_ctx, GREEN_AP_PS_OFF_STATE, + GREEN_AP_PS_WAIT_EVENT); break; } @@ -278,12 +277,12 @@ done: } /** - * hdd_wlan_green_ap_timer_fn() - Green AP Timer handler + * hdd_green_ap_timer_fn() - Green AP Timer handler * @ctx: Global HDD context * * Return: none */ -static void hdd_wlan_green_ap_timer_fn(void *ctx) +static void hdd_green_ap_timer_fn(void *ctx) { struct hdd_context_s *hdd_ctx = ctx; struct hdd_green_ap_ctx *green_ap; @@ -293,16 +292,16 @@ static void hdd_wlan_green_ap_timer_fn(void *ctx) green_ap = hdd_ctx->green_ap_ctx; if (green_ap) - hdd_wlan_green_ap_mc(hdd_ctx, green_ap->ps_event); + hdd_green_ap_mc(hdd_ctx, green_ap->ps_event); } /** - * hdd_wlan_green_ap_attach() - Attach Green AP context to HDD context + * hdd_green_ap_attach() - Attach Green AP context to HDD context * @hdd_ctx: Global HDD contect * * Return: QDF_STATUS_SUCCESS on success, otherwise QDF_STATUS_E_** error */ -static QDF_STATUS hdd_wlan_green_ap_attach(struct hdd_context_s *hdd_ctx) +static QDF_STATUS hdd_green_ap_attach(struct hdd_context_s *hdd_ctx) { struct hdd_green_ap_ctx *green_ap; QDF_STATUS status = QDF_STATUS_SUCCESS; @@ -325,7 +324,7 @@ static QDF_STATUS hdd_wlan_green_ap_attach(struct hdd_context_s *hdd_ctx) qdf_mc_timer_init(&green_ap->ps_timer, QDF_TIMER_TYPE_SW, - hdd_wlan_green_ap_timer_fn, hdd_ctx); + hdd_green_ap_timer_fn, hdd_ctx); error: hdd_ctx->green_ap_ctx = green_ap; @@ -335,12 +334,12 @@ error: } /** - * hdd_wlan_green_ap_deattach() - Detach Green AP context from HDD context + * hdd_green_ap_deattach() - Detach Green AP context from HDD context * @hdd_ctx: Global HDD contect * * Return: QDF_STATUS_SUCCESS on success, otherwise QDF_STATUS_E_** error */ -static QDF_STATUS hdd_wlan_green_ap_deattach(struct hdd_context_s *hdd_ctx) +static QDF_STATUS hdd_green_ap_deattach(struct hdd_context_s *hdd_ctx) { struct hdd_green_ap_ctx *green_ap = hdd_ctx->green_ap_ctx; QDF_STATUS status = QDF_STATUS_SUCCESS; @@ -373,37 +372,31 @@ done: return status; } -/** - * hdd_wlan_green_ap_init() - Initialize Green AP feature - * @hdd_ctx: HDD global context - * - * Return: none +/* + * hdd_green_ap_init() - Initialize Green AP feature + * (public function documented in wlan_hdd_green_ap.h) */ -void hdd_wlan_green_ap_init(struct hdd_context_s *hdd_ctx) +void hdd_green_ap_init(struct hdd_context_s *hdd_ctx) { - if (!QDF_IS_STATUS_SUCCESS(hdd_wlan_green_ap_attach(hdd_ctx))) + if (!QDF_IS_STATUS_SUCCESS(hdd_green_ap_attach(hdd_ctx))) hdd_err("Failed to allocate Green-AP resource"); } -/** - * hdd_wlan_green_ap_deinit() - De-initialize Green AP feature - * @hdd_ctx: HDD global context - * - * Return: none +/* + * hdd_green_ap_deinit() - De-initialize Green AP feature + * (public function documented in wlan_hdd_green_ap.h) */ -void hdd_wlan_green_ap_deinit(struct hdd_context_s *hdd_ctx) +void hdd_green_ap_deinit(struct hdd_context_s *hdd_ctx) { - if (!QDF_IS_STATUS_SUCCESS(hdd_wlan_green_ap_deattach(hdd_ctx))) + if (!QDF_IS_STATUS_SUCCESS(hdd_green_ap_deattach(hdd_ctx))) hdd_err("Cannot deallocate Green-AP resource"); } -/** - * hdd_wlan_green_ap_start_bss() - Notify Green AP of Start BSS event - * @hdd_ctx: HDD global context - * - * Return: none +/* + * hdd_green_ap_start_bss() - Notify Green AP of Start BSS event + * (public function documented in wlan_hdd_green_ap.h) */ -void hdd_wlan_green_ap_start_bss(struct hdd_context_s *hdd_ctx) +void hdd_green_ap_start_bss(struct hdd_context_s *hdd_ctx) { struct hdd_config *cfg = hdd_ctx->config; @@ -420,7 +413,7 @@ void hdd_wlan_green_ap_start_bss(struct hdd_context_s *hdd_ctx) cfg->egap_wait_time, cfg->egap_feature_flag)) { /* EGAP is enabled, disable host GAP */ - hdd_wlan_green_ap_mc(hdd_ctx, GREEN_AP_PS_STOP_EVENT); + hdd_green_ap_mc(hdd_ctx, GREEN_AP_PS_STOP_EVENT); goto exit; } /* fall through, if send_egap_conf_params() failed, @@ -430,9 +423,9 @@ void hdd_wlan_green_ap_start_bss(struct hdd_context_s *hdd_ctx) if (!(QDF_STA_MASK & hdd_ctx->concurrency_mode) && cfg->enable2x2 && cfg->enableGreenAP) { - hdd_wlan_green_ap_mc(hdd_ctx, GREEN_AP_PS_START_EVENT); + hdd_green_ap_mc(hdd_ctx, GREEN_AP_PS_START_EVENT); } else { - hdd_wlan_green_ap_mc(hdd_ctx, GREEN_AP_PS_STOP_EVENT); + hdd_green_ap_mc(hdd_ctx, GREEN_AP_PS_STOP_EVENT); hdd_notice("Green-AP: is disabled, due to sta_concurrency: %d, enable2x2: %d, enableGreenAP: %d", QDF_STA_MASK & hdd_ctx->concurrency_mode, cfg->enable2x2, cfg->enableGreenAP); @@ -441,50 +434,44 @@ exit: return; } -/** - * hdd_wlan_green_ap_stop_bss() - Notify Green AP of Stop BSS event - * @hdd_ctx: HDD global context - * - * Return: none +/* + * hdd_green_ap_stop_bss() - Notify Green AP of Stop BSS event + * (public function documented in wlan_hdd_green_ap.h) */ -void hdd_wlan_green_ap_stop_bss(struct hdd_context_s *hdd_ctx) +void hdd_green_ap_stop_bss(struct hdd_context_s *hdd_ctx) { - hdd_wlan_green_ap_mc(hdd_ctx, GREEN_AP_PS_STOP_EVENT); + hdd_green_ap_mc(hdd_ctx, GREEN_AP_PS_STOP_EVENT); } -/** - * hdd_wlan_green_ap_add_sta() - Notify Green AP of Add Station event - * @hdd_ctx: HDD global context - * - * Return: none +/* + * hdd_green_ap_add_sta() - Notify Green AP of Add Station event + * (public function documented in wlan_hdd_green_ap.h) */ -void hdd_wlan_green_ap_add_sta(struct hdd_context_s *hdd_ctx) +void hdd_green_ap_add_sta(struct hdd_context_s *hdd_ctx) { - hdd_wlan_green_ap_mc(hdd_ctx, GREEN_AP_ADD_STA_EVENT); + hdd_green_ap_mc(hdd_ctx, GREEN_AP_ADD_STA_EVENT); } -/** - * hdd_wlan_green_ap_del_sta() - Notify Green AP of Delete Station event - * @hdd_ctx: HDD global context - * - * Return: none +/* + * hdd_green_ap_del_sta() - Notify Green AP of Delete Station event + * (public function documented in wlan_hdd_green_ap.h) */ -void hdd_wlan_green_ap_del_sta(struct hdd_context_s *hdd_ctx) +void hdd_green_ap_del_sta(struct hdd_context_s *hdd_ctx) { - hdd_wlan_green_ap_mc(hdd_ctx, GREEN_AP_DEL_STA_EVENT); + hdd_green_ap_mc(hdd_ctx, GREEN_AP_DEL_STA_EVENT); } -/** - * hdd_wlan_set_egap_support() - helper function to set egap support flag - * @hdd_ctx: pointer to hdd context - * @param: pointer to target configuration +/* + * hdd_green_ap_target_config() - Handle Green AP target configuration + * (public function documented in wlan_hdd_green_ap.h) * - * Return: None + * Implementation notes: + * Target indicates whether or not Enhanced Green AP (EGAP) is supported */ -void hdd_wlan_set_egap_support(hdd_context_t *hdd_ctx, void *param) +void hdd_green_ap_target_config(struct hdd_context_s *hdd_ctx, + struct wma_tgt_cfg *target_config) { - struct wma_tgt_cfg *cfg = (struct wma_tgt_cfg *) param; + struct hdd_green_ap_ctx *green_ap = hdd_ctx->green_ap_ctx; - if (hdd_ctx && cfg) - hdd_ctx->green_ap_ctx->egap_support = cfg->egap_support; + green_ap->egap_support = target_config->egap_support; } diff --git a/core/hdd/src/wlan_hdd_green_ap.h b/core/hdd/src/wlan_hdd_green_ap.h index a688ba0222b4..f57d1bc1eb85 100644 --- a/core/hdd/src/wlan_hdd_green_ap.h +++ b/core/hdd/src/wlan_hdd_green_ap.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -35,24 +35,79 @@ */ struct hdd_context_s; +struct wma_tgt_cfg; #ifdef FEATURE_GREEN_AP -void hdd_wlan_green_ap_init(struct hdd_context_s *hdd_ctx); -void hdd_wlan_green_ap_deinit(struct hdd_context_s *hdd_ctx); -void hdd_wlan_green_ap_start_bss(struct hdd_context_s *hdd_ctx); -void hdd_wlan_green_ap_stop_bss(struct hdd_context_s *hdd_ctx); -void hdd_wlan_green_ap_add_sta(struct hdd_context_s *hdd_ctx); -void hdd_wlan_green_ap_del_sta(struct hdd_context_s *hdd_ctx); -void hdd_wlan_set_egap_support(struct hdd_context_s *hdd_ctx, void *param); -#else -static inline void hdd_wlan_green_ap_init(struct hdd_context_s *hdd_ctx) {} -static inline void hdd_wlan_green_ap_deinit(struct hdd_context_s *hdd_ctx) {} -static inline void hdd_wlan_green_ap_start_bss(struct hdd_context_s *hdd_ctx) {} -static inline void hdd_wlan_green_ap_stop_bss(struct hdd_context_s *hdd_ctx) {} -static inline void hdd_wlan_green_ap_add_sta(struct hdd_context_s *hdd_ctx) {} -static inline void hdd_wlan_green_ap_del_sta(struct hdd_context_s *hdd_ctx) {} -static inline void hdd_wlan_set_egap_support(struct hdd_context_s *hdd_ctx, - void *param) {} +/** + * hdd_green_ap_init() - Initialize Green AP feature + * @hdd_ctx: HDD global context + * + * Return: none + */ +void hdd_green_ap_init(struct hdd_context_s *hdd_ctx); + +/** + * hdd_green_ap_deinit() - De-initialize Green AP feature + * @hdd_ctx: HDD global context + * + * Return: none + */ +void hdd_green_ap_deinit(struct hdd_context_s *hdd_ctx); +/** + * hdd_green_ap_start_bss() - Notify Green AP of Start BSS event + * @hdd_ctx: HDD global context + * + * Return: none + */ +void hdd_green_ap_start_bss(struct hdd_context_s *hdd_ctx); + +/** + * hdd_green_ap_stop_bss() - Notify Green AP of Stop BSS event + * @hdd_ctx: HDD global context + * + * Return: none + */ +void hdd_green_ap_stop_bss(struct hdd_context_s *hdd_ctx); + +/** + * hdd_green_ap_add_sta() - Notify Green AP of Add Station event + * @hdd_ctx: HDD global context + * + * Return: none + */ +void hdd_green_ap_add_sta(struct hdd_context_s *hdd_ctx); + +/** + * hdd_green_ap_del_sta() - Notify Green AP of Delete Station event + * @hdd_ctx: HDD global context + * + * Return: none + */ +void hdd_green_ap_del_sta(struct hdd_context_s *hdd_ctx); + +/** + * hdd_green_ap_target_config() - Handle Green AP target configuration + * @hdd_ctx: HDD global context where Green AP information is stored + * @target_config: Target configuration containing Green AP info + * + * This function updates the HDD context with Green AP-specific + * information provided by the target. + * + * Return: none + */ +void hdd_green_ap_target_config(struct hdd_context_s *hdd_ctx, + struct wma_tgt_cfg *target_config); +#else +static inline void hdd_green_ap_init(struct hdd_context_s *hdd_ctx) {} +static inline void hdd_green_ap_deinit(struct hdd_context_s *hdd_ctx) {} +static inline void hdd_green_ap_start_bss(struct hdd_context_s *hdd_ctx) {} +static inline void hdd_green_ap_stop_bss(struct hdd_context_s *hdd_ctx) {} +static inline void hdd_green_ap_add_sta(struct hdd_context_s *hdd_ctx) {} +static inline void hdd_green_ap_del_sta(struct hdd_context_s *hdd_ctx) {} +static inline void hdd_green_ap_target_config(struct hdd_context_s *hdd_ctx, + struct wma_tgt_cfg *target_config) +{ +} #endif /* FEATURE_GREEN_AP */ #endif /* __WLAN_HDD_GREEN_AP_H */ diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index 40403ff3d8c8..3f20e4e160af 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -1108,7 +1108,7 @@ QDF_STATUS hdd_hostapd_sap_event_cb(tpSap_Event pSapEvent, operatingChannel); pHostapdState->bssState = BSS_START; - hdd_wlan_green_ap_start_bss(pHddCtx); + hdd_green_ap_start_bss(pHddCtx); /* Set default key index */ QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_INFO, @@ -1205,7 +1205,7 @@ QDF_STATUS hdd_hostapd_sap_event_cb(tpSap_Event pSapEvent, hdd_hostapd_channel_allow_suspend(pHostapdAdapter, pHddApCtx->operatingChannel); - hdd_wlan_green_ap_stop_bss(pHddCtx); + hdd_green_ap_stop_bss(pHddCtx); /* Free up Channel List incase if it is set */ sap_cleanup_channel_list( @@ -1560,7 +1560,7 @@ QDF_STATUS hdd_hostapd_sap_event_cb(tpSap_Event pSapEvent, chan_info, pHostapdAdapter->device_mode); } - hdd_wlan_green_ap_add_sta(pHddCtx); + hdd_green_ap_add_sta(pHddCtx); break; case eSAP_STA_DISASSOC_EVENT: @@ -1684,7 +1684,7 @@ QDF_STATUS hdd_hostapd_sap_event_cb(tpSap_Event pSapEvent, hdd_stop_bus_bw_compute_timer(pHostapdAdapter); } #endif - hdd_wlan_green_ap_del_sta(pHddCtx); + hdd_green_ap_del_sta(pHddCtx); break; case eSAP_WPS_PBC_PROBE_REQ_EVENT: @@ -2553,13 +2553,13 @@ static __iw_softap_setparam(struct net_device *dev, case QCSAP_PARAM_HIDE_SSID: { - QDF_STATUS status = QDF_STATUS_SUCCESS; - status = - sme_hide_ssid(hHal, pHostapdAdapter->sessionId, - set_value); + QDF_STATUS status; + status = sme_update_session_param(hHal, + pHostapdAdapter->sessionId, + SIR_PARAM_SSID_HIDDEN, set_value); if (QDF_STATUS_SUCCESS != status) { hdd_err("QCSAP_PARAM_HIDE_SSID failed"); - return status; + return -EIO; } break; } @@ -5595,6 +5595,7 @@ QDF_STATUS hdd_init_ap_mode(hdd_adapter_t *pAdapter) int ret; enum tQDF_ADAPTER_MODE mode; uint32_t session_id = CSR_SESSION_ID_INVALID; + enum dfs_mode acs_dfs_mode; ENTER(); @@ -5605,6 +5606,11 @@ QDF_STATUS hdd_init_ap_mode(hdd_adapter_t *pAdapter) } pAdapter->sessionCtx.ap.sapContext = sapContext; + pAdapter->sessionCtx.ap.sapConfig.channel = + pHddCtx->acs_policy.acs_channel; + acs_dfs_mode = pHddCtx->acs_policy.acs_dfs_mode; + pAdapter->sessionCtx.ap.sapConfig.acs_dfs_mode = + wlan_hdd_get_dfs_mode(acs_dfs_mode); if (pAdapter->device_mode == QDF_P2P_GO_MODE) { mode = QDF_P2P_GO_MODE; @@ -6069,37 +6075,12 @@ int wlan_hdd_set_channel(struct wiphy *wiphy, case NL80211_CHAN_HT20: case NL80211_CHAN_NO_HT: smeConfig.csrConfig.obssEnabled = false; - if (channel <= 14) - smeConfig.csrConfig. - channelBondingMode24GHz = - eCSR_INI_SINGLE_CHANNEL_CENTERED; - else - smeConfig.csrConfig. - channelBondingMode5GHz = - eCSR_INI_SINGLE_CHANNEL_CENTERED; sap_config->sec_ch = 0; break; - case NL80211_CHAN_HT40MINUS: - if (channel <= 14) - smeConfig.csrConfig. - channelBondingMode24GHz = - eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY; - else - smeConfig.csrConfig. - channelBondingMode5GHz = - eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY; sap_config->sec_ch = sap_config->channel - 4; break; case NL80211_CHAN_HT40PLUS: - if (channel <= 14) - smeConfig.csrConfig. - channelBondingMode24GHz = - eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY; - else - smeConfig.csrConfig. - channelBondingMode5GHz = - eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY; sap_config->sec_ch = sap_config->channel + 4; break; default: @@ -6456,6 +6437,13 @@ int wlan_hdd_cfg80211_update_apies(hdd_adapter_t *adapter) wlan_hdd_add_extra_ie(adapter, genie, &total_ielen, WLAN_EID_VHT_TX_POWER_ENVELOPE); + /* Extract and add the extended capabilities and interworking IE */ + wlan_hdd_add_extra_ie(adapter, genie, &total_ielen, + WLAN_EID_EXT_CAPABILITY); + + wlan_hdd_add_extra_ie(adapter, genie, &total_ielen, + WLAN_EID_INTERWORKING); + if (0 != wlan_hdd_add_ie(adapter, genie, &total_ielen, WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE)) { hdd_err("Adding WPS IE failed"); @@ -6921,6 +6909,8 @@ int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter, bool MFPCapable = false; bool MFPRequired = false; uint16_t prev_rsn_length = 0; + enum dfs_mode mode; + ENTER(); if (cds_is_connection_in_progress()) { @@ -6952,6 +6942,10 @@ int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter, pConfig->enOverLapCh = iniConfig->gEnableOverLapCh; pConfig->dtim_period = pBeacon->dtim_period; + if (pHddCtx->acs_policy.acs_channel) + pConfig->channel = pHddCtx->acs_policy.acs_channel; + mode = pHddCtx->acs_policy.acs_dfs_mode; + pConfig->acs_dfs_mode = wlan_hdd_get_dfs_mode(mode); hdd_info("****pConfig->dtim_period=%d***", pConfig->dtim_period); @@ -7559,6 +7553,7 @@ static int __wlan_hdd_cfg80211_stop_ap(struct wiphy *wiphy, } hdd_cleanup_actionframe(pHddCtx, pAdapter); + wlan_hdd_cleanup_remain_on_channel_ctx(pAdapter); mutex_lock(&pHddCtx->sap_lock); if (test_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags)) { diff --git a/core/hdd/src/wlan_hdd_ioctl.c b/core/hdd/src/wlan_hdd_ioctl.c index 91b0ebef9027..fcc2f5e0e7b6 100644 --- a/core/hdd/src/wlan_hdd_ioctl.c +++ b/core/hdd/src/wlan_hdd_ioctl.c @@ -446,21 +446,24 @@ hdd_get_ibss_peer_info_cb(void *pUserData, pStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); if (NULL != pPeerInfo && QDF_STATUS_SUCCESS == pPeerInfo->status) { /* validate number of peers */ - if (pPeerInfo->numPeers < SIR_MAX_NUM_STA_IN_IBSS) { - pStaCtx->ibss_peer_info.status = pPeerInfo->status; - pStaCtx->ibss_peer_info.numPeers = pPeerInfo->numPeers; - - for (i = 0; i < pPeerInfo->numPeers; i++) { - pStaCtx->ibss_peer_info.peerInfoParams[i] = - pPeerInfo->peerInfoParams[i]; - } - hdd_info("Peer Info copied in HDD"); - } else { - hdd_info("Number of peers %d returned is more than limit %d", + if (pPeerInfo->numPeers > SIR_MAX_NUM_STA_IN_IBSS) { + hdd_warn("Limiting num_peers %u to %u", pPeerInfo->numPeers, SIR_MAX_NUM_STA_IN_IBSS); + pPeerInfo->numPeers = SIR_MAX_NUM_STA_IN_IBSS; } + pStaCtx->ibss_peer_info.status = pPeerInfo->status; + pStaCtx->ibss_peer_info.numPeers = pPeerInfo->numPeers; + + for (i = 0; i < pPeerInfo->numPeers; i++) + pStaCtx->ibss_peer_info.peerInfoParams[i] = + pPeerInfo->peerInfoParams[i]; } else { - hdd_info("peerInfo returned is NULL"); + hdd_err("peerInfo %s: status %u, numPeers %u", + pPeerInfo ? "valid" : "null", + pPeerInfo ? pPeerInfo->status : QDF_STATUS_E_FAILURE, + pPeerInfo ? pPeerInfo->numPeers : 0); + pStaCtx->ibss_peer_info.numPeers = 0; + pStaCtx->ibss_peer_info.status = QDF_STATUS_E_FAILURE; } complete(&adapter->ibss_peer_info_comp); @@ -5058,6 +5061,11 @@ static int drv_cmd_get_ibss_peer_info_all(hdd_adapter_t *adapter, tx_rate = pHddStaCtx->ibss_peer_info.peerInfoParams[idx]. txRate; + /* + * Only lower 3 bytes are rate info. Mask of the MSByte + */ + tx_rate &= 0x00FFFFFF; + rssi = pHddStaCtx->ibss_peer_info.peerInfoParams[idx]. rssi; @@ -5175,6 +5183,8 @@ static int drv_cmd_get_ibss_peer_info(hdd_adapter_t *adapter, if (QDF_STATUS_SUCCESS == status) { uint32_t txRate = pHddStaCtx->ibss_peer_info.peerInfoParams[0].txRate; + /* Only lower 3 bytes are rate info. Mask of the MSByte */ + txRate &= 0x00FFFFFF; length = scnprintf(extra, sizeof(extra), "%d %d", (int)txRate, diff --git a/core/hdd/src/wlan_hdd_lpass.c b/core/hdd/src/wlan_hdd_lpass.c index 193016a7ab5e..09cac5689c6f 100644 --- a/core/hdd/src/wlan_hdd_lpass.c +++ b/core/hdd/src/wlan_hdd_lpass.c @@ -160,9 +160,9 @@ static int wlan_hdd_gen_wlan_version_pack(struct wlan_version_data *data, * * Return: none */ -void wlan_hdd_send_status_pkg(hdd_adapter_t *adapter, - hdd_station_ctx_t *sta_ctx, - uint8_t is_on, uint8_t is_connected) +static void wlan_hdd_send_status_pkg(struct hdd_adapter_s *adapter, + struct hdd_station_ctx *sta_ctx, + uint8_t is_on, uint8_t is_connected) { int ret = 0; struct wlan_status_data data; @@ -196,8 +196,9 @@ void wlan_hdd_send_status_pkg(hdd_adapter_t *adapter, * * Return: none */ -void wlan_hdd_send_version_pkg(uint32_t fw_version, - uint32_t chip_id, const char *chip_name) +static void wlan_hdd_send_version_pkg(uint32_t fw_version, + uint32_t chip_id, + const char *chip_name) { int ret = 0; struct wlan_version_data data; @@ -228,7 +229,7 @@ void wlan_hdd_send_version_pkg(uint32_t fw_version, * * Return: none */ -void wlan_hdd_send_all_scan_intf_info(hdd_context_t *hdd_ctx) +static void wlan_hdd_send_all_scan_intf_info(struct hdd_context_s *hdd_ctx) { hdd_adapter_t *adapter = NULL; hdd_adapter_list_node_t *node = NULL, *next = NULL; @@ -259,3 +260,102 @@ void wlan_hdd_send_all_scan_intf_info(hdd_context_t *hdd_ctx) if (!scan_intf_found) wlan_hdd_send_status_pkg(adapter, NULL, 1, 0); } + +/* + * hdd_lpass_target_config() - Handle LPASS target configuration + * (public function documented in wlan_hdd_lpass.h) + */ +void hdd_lpass_target_config(struct hdd_context_s *hdd_ctx, + struct wma_tgt_cfg *target_config) +{ + hdd_ctx->lpss_support = target_config->lpss_support; +} + +/* + * hdd_lpass_populate_cds_config() - Populate LPASS configuration + * (public function documented in wlan_hdd_lpass.h) + */ +void hdd_lpass_populate_cds_config(struct cds_config_info *cds_config, + struct hdd_context_s *hdd_ctx) +{ + cds_config->is_lpass_enabled = hdd_ctx->config->enable_lpass_support; +} + +/* + * hdd_lpass_notify_connect() - Notify LPASS of interface connect + * (public function documented in wlan_hdd_lpass.h) + */ +void hdd_lpass_notify_connect(struct hdd_adapter_s *adapter) +{ + struct hdd_station_ctx *sta_ctx; + + /* only send once per connection */ + if (adapter->rssi_send) + return; + + /* don't send if driver is unloading */ + if (cds_is_driver_unloading()) + return; + + adapter->rssi_send = true; + sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); + wlan_hdd_send_status_pkg(adapter, sta_ctx, 1, 1); +} + +/* + * hdd_lpass_notify_disconnect() - Notify LPASS of interface disconnect + * (public function documented in wlan_hdd_lpass.h) + */ +void hdd_lpass_notify_disconnect(struct hdd_adapter_s *adapter) +{ + struct hdd_station_ctx *sta_ctx; + + adapter->rssi_send = false; + sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); + wlan_hdd_send_status_pkg(adapter, sta_ctx, 1, 0); +} + +/* + * hdd_lpass_notify_mode_change() - Notify LPASS of interface mode change + * (public function documented in wlan_hdd_lpass.h) + * + * implementation note: when one interfaces changes we notify the + * state of all of the interfaces. + */ +void hdd_lpass_notify_mode_change(struct hdd_adapter_s *adapter) +{ + struct hdd_context_s *hdd_ctx; + + hdd_ctx = WLAN_HDD_GET_CTX(adapter); + wlan_hdd_send_all_scan_intf_info(hdd_ctx); +} + +/* + * hdd_lpass_notify_start() - Notify LPASS of driver start + * (public function documented in wlan_hdd_lpass.h) + */ +void hdd_lpass_notify_start(struct hdd_context_s *hdd_ctx) +{ + wlan_hdd_send_all_scan_intf_info(hdd_ctx); + wlan_hdd_send_version_pkg(hdd_ctx->target_fw_version, + hdd_ctx->target_hw_version, + hdd_ctx->target_hw_name); +} + +/* + * hdd_lpass_notify_stop() - Notify LPASS of driver stop + * (public function documented in wlan_hdd_lpass.h) + */ +void hdd_lpass_notify_stop(struct hdd_context_s *hdd_ctx) +{ + wlan_hdd_send_status_pkg(NULL, NULL, 0, 0); +} + +/* + * hdd_lpass_is_supported() - Is lpass feature supported? + * (public function documented in wlan_hdd_lpass.h) + */ +bool hdd_lpass_is_supported(struct hdd_context_s *hdd_ctx) +{ + return hdd_ctx->config->enable_lpass_support; +} diff --git a/core/hdd/src/wlan_hdd_lpass.h b/core/hdd/src/wlan_hdd_lpass.h index 2fb5d70c7792..8ecc3e782df2 100644 --- a/core/hdd/src/wlan_hdd_lpass.h +++ b/core/hdd/src/wlan_hdd_lpass.h @@ -28,31 +28,126 @@ #if !defined(WLAN_HDD_LPASS_H) #define WLAN_HDD_LPASS_H +struct cds_config_info; +struct wma_tgt_cfg; +struct hdd_context_s; +struct hdd_adapter_s; + #ifdef WLAN_FEATURE_LPSS -void wlan_hdd_send_status_pkg(hdd_adapter_t *adapter, - hdd_station_ctx_t *sta_ctx, - uint8_t is_on, uint8_t is_connected); -void wlan_hdd_send_version_pkg(uint32_t fw_version, - uint32_t chip_id, const char *chip_name); -void wlan_hdd_send_all_scan_intf_info(hdd_context_t *hdd_ctx); +/** + * hdd_lpass_target_config() - Handle LPASS target configuration + * @hdd_ctx: HDD global context where lpass information is stored + * @target_config: Target configuration containing lpass info + * + * This function updates the HDD context with lpass-specific + * information provided by the target. + * + * Return: none + */ +void hdd_lpass_target_config(struct hdd_context_s *hdd_ctx, + struct wma_tgt_cfg *target_config); + +/** + * hdd_lpass_populate_cds_config() - Populate LPASS configuration + * @cds_config: CDS configuration to populate with lpass info + * @hdd_ctx: HDD global context which contains lpass information + * + * This function seeds the CDS configuration structure with + * lpass-specific information gleaned from the HDD context. + * + * Return: none + */ +void hdd_lpass_populate_cds_config(struct cds_config_info *cds_config, + struct hdd_context_s *hdd_ctx); + +/** + * hdd_lpass_notify_connect() - Notify LPASS of interface connect + * @adapter: The adapter that connected + * + * This function is used to notify the LPASS feature that an adapter + * has connected. + * + * Return: none + */ +void hdd_lpass_notify_connect(struct hdd_adapter_s *adapter); + +/** + * hdd_lpass_notify_disconnect() - Notify LPASS of interface disconnect + * @adapter: The adapter that connected + * + * This function is used to notify the LPASS feature that an adapter + * has disconnected. + * + * Return: none + */ +void hdd_lpass_notify_disconnect(struct hdd_adapter_s *adapter); + +/** + * hdd_lpass_notify_mode_change() - Notify LPASS of interface mode change + * @adapter: The adapter whose mode was changed + * + * This function is used to notify the LPASS feature that an adapter + * had its mode changed. + * + * Return: none + */ +void hdd_lpass_notify_mode_change(struct hdd_adapter_s *adapter); + +/** + * hdd_lpass_notify_start() - Notify LPASS of driver start + * @hdd_ctx: The global HDD context + * + * This function is used to notify the LPASS feature that the wlan + * driver has (re-)started. + * + * Return: none + */ +void hdd_lpass_notify_start(struct hdd_context_s *hdd_ctx); + +/** + * hdd_lpass_notify_stop() - Notify LPASS of driver stop + * @hdd_ctx: The global HDD context + * + * This function is used to notify the LPASS feature that the wlan + * driver has stopped. + * + * Return: none + */ +void hdd_lpass_notify_stop(struct hdd_context_s *hdd_ctx); + +/** + * hdd_lpass_is_supported() - Is lpass feature supported? + * @hdd_ctx: The global HDD context + * + * Return: true if feature is enabled and supported by firmware, false + * if the feature is not enabled or not supported by firmware. + */ +bool hdd_lpass_is_supported(struct hdd_context_s *hdd_ctx); + #else -static inline void wlan_hdd_send_status_pkg(hdd_adapter_t *adapter, - hdd_station_ctx_t *sta_ctx, - uint8_t is_on, uint8_t is_connected) +static inline void hdd_lpass_target_config(struct hdd_context_s *hdd_ctx, + struct wma_tgt_cfg *target_config) { - return; } - -static inline void wlan_hdd_send_version_pkg(uint32_t fw_version, - uint32_t chip_id, - const char *chip_name) +static inline +void hdd_lpass_populate_cds_config(struct cds_config_info *cds_config, + struct hdd_context_s *hdd_ctx) { - return; } - -static inline void wlan_hdd_send_all_scan_intf_info(hdd_context_t *hdd_ctx) +static inline void hdd_lpass_notify_connect(struct hdd_adapter_s *adapter) +{ +} +static inline void hdd_lpass_notify_disconnect(struct hdd_adapter_s *adapter) +{ +} +static inline void hdd_lpass_notify_mode_change(struct hdd_adapter_s *adapter) +{ +} +static inline void hdd_lpass_notify_start(struct hdd_context_s *hdd_ctx) { } +static inline void hdd_lpass_notify_stop(struct hdd_context_s *hdd_ctx) { } +static inline bool hdd_lpass_is_supported(struct hdd_context_s *hdd_ctx) { - return; + return false; } #endif diff --git a/core/hdd/src/wlan_hdd_lro.c b/core/hdd/src/wlan_hdd_lro.c index b1fe8f078d52..857d2c154a7a 100644 --- a/core/hdd/src/wlan_hdd_lro.c +++ b/core/hdd/src/wlan_hdd_lro.c @@ -214,7 +214,7 @@ static int hdd_lro_desc_find(hdd_adapter_t *adapter, struct hdd_lro_desc_table *lro_hash_table; struct list_head *ptr; struct hdd_lro_desc_entry *entry; - struct hdd_lro_desc_pool free_pool; + struct hdd_lro_desc_pool *free_pool; struct hdd_lro_desc_info *desc_info = &adapter->lro_info.lro_desc_info; *lro_desc = NULL; @@ -245,24 +245,19 @@ static int hdd_lro_desc_find(hdd_adapter_t *adapter, qdf_spin_unlock_bh(&desc_info->lro_hash_lock); /* no existing flow found, a new LRO desc needs to be allocated */ - free_pool = adapter->lro_info.lro_desc_info.lro_desc_pool; - qdf_spin_lock_bh(&free_pool.lro_pool_lock); + free_pool = &adapter->lro_info.lro_desc_info.lro_desc_pool; + qdf_spin_lock_bh(&free_pool->lro_pool_lock); entry = list_first_entry_or_null( - &free_pool.lro_free_list_head, + &free_pool->lro_free_list_head, struct hdd_lro_desc_entry, lro_node); if (NULL == entry) { hdd_err("Could not allocate LRO desc!"); - qdf_spin_unlock_bh(&free_pool.lro_pool_lock); + qdf_spin_unlock_bh(&free_pool->lro_pool_lock); return -ENOMEM; } - if (list_empty(&entry->lro_node)) { - hdd_err("Reached max supported lro_desc range\n"); - return -EINVAL; - } - list_del_init(&entry->lro_node); - qdf_spin_unlock_bh(&free_pool.lro_pool_lock); + qdf_spin_unlock_bh(&free_pool->lro_pool_lock); if (NULL == entry->lro_desc) { hdd_err("entry->lro_desc is NULL!\n"); @@ -442,20 +437,47 @@ void hdd_lro_flush_pkt(struct net_lro_mgr *lro_mgr, void hdd_lro_flush(void *data) { hdd_adapter_t *adapter = (hdd_adapter_t *)data; - struct hdd_lro_s *hdd_lro = &adapter->lro_info; + struct hdd_lro_s *hdd_lro; + struct hdd_context_s *ctx; + QDF_STATUS status; + hdd_adapter_list_node_t *adapter_node = NULL, *next = NULL; int i; - qdf_spin_lock_bh(&hdd_lro->lro_mgr_arr_access_lock); - for (i = 0; i < adapter->lro_info.lro_mgr->max_desc; i++) { - if (adapter->lro_info.lro_mgr->lro_arr[i].active) { - hdd_lro_desc_free( - &adapter->lro_info.lro_mgr->lro_arr[i], - (void *)adapter); - lro_flush_desc(adapter->lro_info.lro_mgr, - &adapter->lro_info.lro_mgr->lro_arr[i]); + /* + * There is a more comprehensive solution that refactors + * lro_mgr in the adapter into multiple instances, that + * will replace this solution. The following is an interim + * fix. + */ + + /* Loop over all adapters and flush them all */ + ctx = (struct hdd_context_s *)cds_get_context(QDF_MODULE_ID_HDD); + if (unlikely(ctx == NULL)) { + hdd_err("%s: cannot get hdd_ctx. Flushing failed", __func__); + return; + } + + status = hdd_get_front_adapter(ctx, &adapter_node); + while (NULL != adapter_node && QDF_STATUS_SUCCESS == status) { + adapter = adapter_node->pAdapter; + hdd_lro = &adapter->lro_info; + if (adapter->dev->features & NETIF_F_LRO) { + qdf_spin_lock_bh(&hdd_lro->lro_mgr_arr_access_lock); + for (i = 0; i < hdd_lro->lro_mgr->max_desc; i++) { + if (hdd_lro->lro_mgr->lro_arr[i].active) { + hdd_lro_desc_free( + &hdd_lro->lro_mgr->lro_arr[i], + (void *)adapter); + lro_flush_desc( + hdd_lro->lro_mgr, + &hdd_lro->lro_mgr->lro_arr[i]); + } + } + qdf_spin_unlock_bh(&hdd_lro->lro_mgr_arr_access_lock); } + status = hdd_get_next_adapter(ctx, adapter_node, &next); + adapter_node = next; } - qdf_spin_unlock_bh(&hdd_lro->lro_mgr_arr_access_lock); } /** diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 211603a66366..82be6b96f3f3 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -40,9 +40,6 @@ #include <cds_api.h> #include <cds_sched.h> #include <linux/cpu.h> -#ifdef WLAN_FEATURE_LPSS -#include <cds_utils.h> -#endif #include <linux/etherdevice.h> #include <linux/firmware.h> #include <wlan_hdd_tx_rx.h> @@ -80,7 +77,6 @@ #ifdef MSM_PLATFORM #include <soc/qcom/subsystem_restart.h> #endif -#include <soc/qcom/socinfo.h> #include <wlan_hdd_hostapd.h> #include <wlan_hdd_softap_tx_rx.h> #include "cfg_api.h" @@ -111,6 +107,7 @@ #include "wlan_hdd_lpass.h" #include "nan_api.h" #include <wlan_hdd_napi.h> +#include "wlan_hdd_disa.h" #ifdef MODULE #define WLAN_MODULE_NAME module_name(THIS_MODULE) @@ -1344,7 +1341,7 @@ static int hdd_generate_macaddr_auto(hdd_context_t *hdd_ctx) {0x00, 0x0A, 0xF5, 0x00, 0x00, 0x00} }; - serialno = socinfo_get_serial_number(); + serialno = pld_socinfo_get_serial_number(hdd_ctx->parent_dev); if (serialno == 0) return -EINVAL; @@ -1449,11 +1446,8 @@ void hdd_update_tgt_cfg(void *context, void *param) hdd_ctx->max_intf_count = cfg->max_intf_count; -#ifdef WLAN_FEATURE_LPSS - hdd_ctx->lpss_support = cfg->lpss_support; -#endif - - hdd_wlan_set_egap_support(hdd_ctx, cfg); + hdd_lpass_target_config(hdd_ctx, cfg); + hdd_green_ap_target_config(hdd_ctx, cfg); hdd_ctx->ap_arpns_support = cfg->ap_arpns_support; hdd_update_tgt_services(hdd_ctx, &cfg->services); @@ -1489,6 +1483,8 @@ void hdd_update_tgt_cfg(void *context, void *param) if (hdd_ctx->bpf_enabled) hdd_ctx->config->maxWoWFilters = WMA_STA_WOW_DEFAULT_PTRN_MAX; + hdd_ctx->wmi_max_len = cfg->wmi_max_len; + /* Configure NAN datapath features */ hdd_nan_datapath_target_config(hdd_ctx, cfg); } @@ -1711,6 +1707,44 @@ err_start_adapter: } /** + * hdd_enable_power_management() - API to Enable Power Management + * + * API invokes Bus Interface Layer power management functionality + * + * Return: None + */ +static void hdd_enable_power_management(void) +{ + void *hif_ctx = cds_get_context(QDF_MODULE_ID_HIF); + + if (!hif_ctx) { + hdd_err("Bus Interface Context is Invalid"); + return; + } + + hif_enable_power_management(hif_ctx, cds_is_packet_log_enabled()); +} + +/** + * hdd_disable_power_management() - API to disable Power Management + * + * API disable Bus Interface Layer Power management functionality + * + * Return: None + */ +static void hdd_disable_power_management(void) +{ + void *hif_ctx = cds_get_context(QDF_MODULE_ID_HIF); + + if (!hif_ctx) { + hdd_err("Bus Interface Context is Invalid"); + return; + } + + hif_disable_power_management(hif_ctx); +} + +/** * hdd_wlan_start_modules() - Single driver state machine for starting modules * @hdd_ctx: HDD context * @adapter: HDD adapter @@ -1831,10 +1865,15 @@ int hdd_wlan_start_modules(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter, hdd_alert("adapter is Null"); goto close; } + if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) { + hdd_err("in ftm mode, no need to configure cds modules"); + break; + } if (hdd_configure_cds(hdd_ctx, adapter)) { hdd_err("Failed to Enable cds modules"); goto close; } + hdd_enable_power_management(); hdd_info("Driver Modules Successfully Enabled"); hdd_ctx->driver_status = DRIVER_MODULES_ENABLED; break; @@ -2621,6 +2660,7 @@ QDF_STATUS hdd_init_station_mode(hdd_adapter_t *adapter) goto error_sme_open; } + sme_set_vdev_ies_per_band(hdd_ctx->hHal, adapter->sessionId); /* Register wireless extensions */ qdf_ret_status = hdd_register_wext(pWlanDev); if (QDF_STATUS_SUCCESS != qdf_ret_status) { @@ -2746,10 +2786,21 @@ void hdd_cleanup_actionframe(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter) * Return: None. */ void hdd_station_adapter_deinit(hdd_context_t *hdd_ctx, - hdd_adapter_t *adapter) + hdd_adapter_t *adapter, + bool rtnl_held) { ENTER_DEV(adapter->dev); + if (adapter->dev) { + if (rtnl_held) + adapter->dev->wireless_handlers = NULL; + else { + rtnl_lock(); + adapter->dev->wireless_handlers = NULL; + rtnl_unlock(); + } + } + if (test_bit(INIT_TX_RX_SUCCESS, &adapter->event_flags)) { hdd_deinit_tx_rx(adapter); clear_bit(INIT_TX_RX_SUCCESS, &adapter->event_flags); @@ -2802,7 +2853,7 @@ void hdd_deinit_adapter(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter, case QDF_P2P_CLIENT_MODE: case QDF_P2P_DEVICE_MODE: { - hdd_station_adapter_deinit(hdd_ctx, adapter); + hdd_station_adapter_deinit(hdd_ctx, adapter, rtnl_held); break; } @@ -2834,6 +2885,12 @@ void hdd_cleanup_adapter(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter, } hdd_debugfs_exit(adapter); + + if (adapter->scan_info.default_scan_ies) { + qdf_mem_free(adapter->scan_info.default_scan_ies); + adapter->scan_info.default_scan_ies = NULL; + } + /* * The adapter is marked as closed. When hdd_wlan_exit() call returns, * the driver is almost closed and cannot handle either control @@ -3410,8 +3467,12 @@ static void hdd_wait_for_sme_close_sesion(hdd_context_t *hdd_ctx, &adapter->session_close_comp_var, msecs_to_jiffies (WLAN_WAIT_TIME_SESSIONOPENCLOSE)); - if (!rc) + if (!rc) { hdd_err("failure waiting for session_close_comp_var"); + if (adapter->device_mode == QDF_NDI_MODE) + hdd_ndp_session_end_handler(adapter); + clear_bit(SME_SESSION_OPENED, &adapter->event_flags); + } } } @@ -3597,6 +3658,32 @@ QDF_STATUS hdd_stop_adapter(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter, return QDF_STATUS_SUCCESS; } +/** + * hdd_deinit_all_adapters - deinit all adapters + * @hdd_ctx: HDD context + * @rtnl_held: True if RTNL lock held + * + */ +void hdd_deinit_all_adapters(hdd_context_t *hdd_ctx, bool rtnl_held) +{ + hdd_adapter_list_node_t *adapter_node = NULL, *next = NULL; + QDF_STATUS status; + hdd_adapter_t *adapter; + + ENTER(); + + status = hdd_get_front_adapter(hdd_ctx, &adapter_node); + + while (NULL != adapter_node && QDF_STATUS_SUCCESS == status) { + adapter = adapter_node->pAdapter; + hdd_deinit_adapter(hdd_ctx, adapter, rtnl_held); + status = hdd_get_next_adapter(hdd_ctx, adapter_node, &next); + adapter_node = next; + } + + EXIT(); +} + QDF_STATUS hdd_stop_all_adapters(hdd_context_t *hdd_ctx) { hdd_adapter_list_node_t *adapterNode = NULL, *pNext = NULL; @@ -4669,7 +4756,7 @@ void hdd_wlan_exit(hdd_context_t *hdd_ctx) * that requires pMac access after this. */ - hdd_wlan_green_ap_deinit(hdd_ctx); + hdd_green_ap_deinit(hdd_ctx); hdd_close_all_adapters(hdd_ctx, false); @@ -4678,14 +4765,13 @@ 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); - - + hdd_encrypt_decrypt_deinit(hdd_ctx); wlansap_global_deinit(); wlan_hdd_deinit_tx_rx_histogram(hdd_ctx); wiphy_unregister(wiphy); wlan_hdd_cfg80211_deinit(wiphy); - wlan_hdd_send_status_pkg(NULL, NULL, 0, 0); + hdd_lpass_notify_stop(hdd_ctx); hdd_exit_netlink_services(hdd_ctx); mutex_destroy(&hdd_ctx->iface_change_lock); @@ -5712,7 +5798,78 @@ void hdd_restart_sap(hdd_adapter_t *adapter, uint8_t channel) cds_change_sap_channel_with_csa(adapter, hdd_ap_ctx); } +/** + * hdd_unsafe_channel_restart_sap() - restart sap if sap is on unsafe channel + * @hdd_ctx: hdd context pointer + * + * hdd_unsafe_channel_restart_sap check all unsafe channel list + * and if ACS is enabled, driver will ask userspace to restart the + * sap. User space on LTE coex indication restart driver. + * + * Return - none + */ +void hdd_unsafe_channel_restart_sap(hdd_context_t *hdd_ctxt) +{ + QDF_STATUS status; + hdd_adapter_list_node_t *adapter_node = NULL, *next = NULL; + hdd_adapter_t *adapter_temp; + uint32_t i; + bool found = false; + uint8_t restart_chan; + + status = hdd_get_front_adapter(hdd_ctxt, &adapter_node); + while (NULL != adapter_node && QDF_STATUS_SUCCESS == status) { + adapter_temp = adapter_node->pAdapter; + + if (!adapter_temp) { + hdd_err("adapter is NULL, moving to next one"); + goto next_adapater; + } + + if (!((adapter_temp->device_mode == QDF_SAP_MODE) && + (adapter_temp->sessionCtx.ap.sapConfig.acs_cfg.acs_mode))) { + hdd_info("skip device mode:%d acs:%d", + adapter_temp->device_mode, + adapter_temp->sessionCtx.ap.sapConfig. + acs_cfg.acs_mode); + goto next_adapater; + } + + found = false; + for (i = 0; i < hdd_ctxt->unsafe_channel_count; i++) { + if (cds_chan_to_freq( + adapter_temp->sessionCtx.ap.operatingChannel) == + hdd_ctxt->unsafe_channel_list[i]) { + found = true; + hdd_info("operating ch:%d is unsafe", + adapter_temp->sessionCtx.ap.operatingChannel); + break; + } + } + + if (!found) { + hdd_info("ch:%d is safe. no need to change channel", + adapter_temp->sessionCtx.ap.operatingChannel); + goto next_adapater; + } + + restart_chan = + hdd_get_safe_channel_from_pcl_and_acs_range( + adapter_temp); + if (!restart_chan) { + hdd_alert("fail to restart SAP"); + } else { + hdd_info("sending coex indication"); + wlan_hdd_send_svc_nlink_msg(hdd_ctxt->radio_index, + WLAN_SVC_LTE_COEX_IND, NULL, 0); + hdd_restart_sap(adapter_temp, restart_chan); + } +next_adapater: + status = hdd_get_next_adapter(hdd_ctxt, adapter_node, &next); + adapter_node = next; + } +} /** * hdd_ch_avoid_cb() - Avoid notified channels from FW handler * @adapter: HDD adapter pointer @@ -5724,7 +5881,7 @@ void hdd_restart_sap(hdd_adapter_t *adapter, uint8_t channel) * * Return: None */ -static void hdd_ch_avoid_cb(void *hdd_context, void *indi_param) +void hdd_ch_avoid_cb(void *hdd_context, void *indi_param) { hdd_context_t *hdd_ctxt; tSirChAvoidIndType *ch_avoid_indi; @@ -5736,11 +5893,6 @@ static void hdd_ch_avoid_cb(void *hdd_context, void *indi_param) v_CONTEXT_t cds_context; tHddAvoidFreqList hdd_avoid_freq_list; uint32_t i; - QDF_STATUS status; - hdd_adapter_list_node_t *adapter_node = NULL, *next = NULL; - hdd_adapter_t *adapter_temp; - uint8_t restart_chan; - bool found = false; /* Basic sanity */ if (!hdd_context || !indi_param) { @@ -5867,64 +6019,7 @@ static void hdd_ch_avoid_cb(void *hdd_context, void *indi_param) hdd_info("no unsafe channels - not restarting SAP"); return; } - - /* No channel change is done for fixed channel SAP. - * Loop through all ACS SAP interfaces and change the channels for - * the ones operating on unsafe channels. - */ - status = hdd_get_front_adapter(hdd_ctxt, &adapter_node); - while (NULL != adapter_node && QDF_STATUS_SUCCESS == status) { - adapter_temp = adapter_node->pAdapter; - - if (!adapter_temp) { - hdd_err("adapter is NULL, moving to next one"); - goto next_adapater; - } - - if (!((adapter_temp->device_mode == QDF_SAP_MODE) && - (adapter_temp->sessionCtx.ap.sapConfig.acs_cfg.acs_mode))) { - hdd_info("skip device mode:%d acs:%d", - adapter_temp->device_mode, - adapter_temp->sessionCtx.ap.sapConfig. - acs_cfg.acs_mode); - goto next_adapater; - } - - found = false; - for (i = 0; i < hdd_ctxt->unsafe_channel_count; i++) { - if (cds_chan_to_freq( - adapter_temp->sessionCtx.ap.operatingChannel) == - hdd_ctxt->unsafe_channel_list[i]) { - found = true; - hdd_info("operating ch:%d is unsafe", - adapter_temp->sessionCtx.ap.operatingChannel); - break; - } - } - - if (!found) { - hdd_info("ch:%d is safe. no need to change channel", - adapter_temp->sessionCtx.ap.operatingChannel); - goto next_adapater; - } - - restart_chan = - hdd_get_safe_channel_from_pcl_and_acs_range( - adapter_temp); - if (!restart_chan) { - hdd_alert("fail to restart SAP"); - } else { - hdd_info("sending coex indication"); - wlan_hdd_send_svc_nlink_msg - (hdd_ctxt->radio_index, - WLAN_SVC_LTE_COEX_IND, NULL, 0); - hdd_restart_sap(adapter_temp, restart_chan); - } - -next_adapater: - status = hdd_get_next_adapter(hdd_ctxt, adapter_node, &next); - adapter_node = next; - } + hdd_unsafe_channel_restart_sap(hdd_ctxt); return; } @@ -6736,7 +6831,7 @@ int hdd_update_cds_config(hdd_context_t *hdd_ctx) hdd_ra_populate_cds_config(cds_cfg, hdd_ctx); hdd_txrx_populate_cds_config(cds_cfg, hdd_ctx); hdd_nan_populate_cds_config(cds_cfg, hdd_ctx); - + hdd_lpass_populate_cds_config(cds_cfg, hdd_ctx); cds_init_ini_config(cds_cfg); return 0; } @@ -6887,7 +6982,15 @@ int hdd_pktlog_enable_disable(hdd_context_t *hdd_ctx, bool enable, enable ? WLAN_LOG_LEVEL_ACTIVE : WLAN_LOG_LEVEL_OFF; start_log.ini_triggered = cds_is_packet_log_enabled(); start_log.user_triggered = user_triggered; - + /* + * Use "is_iwpriv_command" flag to distinguish iwpriv command from other + * commands. Host uses this flag to decide whether to send pktlog + * disable command to fw without sending pktlog enable command + * previously. For eg, If vendor sends pktlog disable command without + * sending pktlog enable command, then host discards the packet + * but for iwpriv command, host will send it to fw. + */ + start_log.is_iwpriv_command = 1; status = sme_wifi_start_logger(hdd_ctx->hHal, start_log); if (!QDF_IS_STATUS_SUCCESS(status)) { hdd_err("sme_wifi_start_logger failed(err=%d)", status); @@ -7168,7 +7271,7 @@ static int hdd_pre_enable_configure(hdd_context_t *hdd_ctx) } /* Apply the cfg.ini to cfg.dat */ - if (!hdd_update_config_dat(hdd_ctx)) { + if (!hdd_update_config_cfg(hdd_ctx)) { hdd_alert("config update failed"); ret = -EINVAL; goto out; @@ -7537,6 +7640,7 @@ int hdd_wlan_stop_modules(hdd_context_t *hdd_ctx, bool shutdown) hdd_info("Modules already closed"); goto done; case DRIVER_MODULES_ENABLED: + hdd_disable_power_management(); if (hdd_deconfigure_cds(hdd_ctx)) { hdd_alert("Failed to de-configure CDS"); QDF_ASSERT(0); @@ -7653,7 +7757,7 @@ int hdd_wlan_startup(struct device *dev) if (ret) goto err_hdd_free_context; - hdd_wlan_green_ap_init(hdd_ctx); + hdd_green_ap_init(hdd_ctx); ret = hdd_wlan_start_modules(hdd_ctx, adapter, false); if (ret) { @@ -7729,10 +7833,7 @@ int hdd_wlan_startup(struct device *dev) hdd_bus_bw_compute_cbk, (void *)hdd_ctx); #endif - wlan_hdd_send_all_scan_intf_info(hdd_ctx); - wlan_hdd_send_version_pkg(hdd_ctx->target_fw_version, - hdd_ctx->target_hw_version, - hdd_ctx->target_hw_name); + hdd_lpass_notify_start(hdd_ctx); if (hdd_ctx->rps) hdd_set_rps_cpu_mask(hdd_ctx); @@ -7750,6 +7851,7 @@ int hdd_wlan_startup(struct device *dev) goto err_debugfs_exit; memdump_init(); + hdd_encrypt_decrypt_init(hdd_ctx); if (hdd_ctx->config->fIsImpsEnabled) hdd_set_idle_ps_config(hdd_ctx, true); @@ -7765,6 +7867,13 @@ int hdd_wlan_startup(struct device *dev) qdf_mc_timer_start(&hdd_ctx->iface_change_timer, hdd_ctx->config->iface_change_wait_time * 5000); + + if (hdd_ctx->config->goptimize_chan_avoid_event) { + status = sme_enable_disable_chanavoidind_event( + hdd_ctx->hHal, 0); + if (!QDF_IS_STATUS_SUCCESS(status)) + hdd_err("Failed to disable Chan Avoidance Indication"); + } goto success; err_debugfs_exit: @@ -8757,6 +8866,28 @@ out: } /** + * hdd_wait_for_recovery_completion() - Wait for cds recovery completion + * + * Block the unloading of the driver until the cds recovery is completed + * + * Return: None + */ +static void hdd_wait_for_recovery_completion(void) +{ + int retry = 0; + + /* Wait for recovery to complete */ + while (cds_is_driver_recovering()) { + hdd_alert("Recovery in progress; wait here!!!"); + msleep(1000); + if (retry++ == HDD_MOD_EXIT_SSR_MAX_RETRIES) { + hdd_alert("SSR never completed, fatal error"); + QDF_BUG(0); + } + } +} + +/** * __hdd_module_exit - Module exit helper * * Module exit helper function used by both module and static driver. @@ -8766,6 +8897,8 @@ static void __hdd_module_exit(void) pr_info("%s: Unloading driver v%s\n", WLAN_MODULE_NAME, QWLAN_VERSIONSTR); + hdd_wait_for_recovery_completion(); + wlan_hdd_unregister_driver(); qdf_wake_lock_destroy(&wlan_wake_lock); @@ -8960,15 +9093,59 @@ static int fwpath_changed_handler(const char *kmessage, struct kernel_param *kp) return param_set_copystring(kmessage, kp); } +/** + * is_con_mode_valid() check con mode is valid or not + * @mode: global con mode + * + * Return: TRUE on success FALSE on failure + */ +static bool is_con_mode_valid(enum tQDF_GLOBAL_CON_MODE mode) +{ + switch (mode) { + case QDF_GLOBAL_MONITOR_MODE: + case QDF_GLOBAL_FTM_MODE: + case QDF_GLOBAL_EPPING_MODE: + return true; + default: + return false; + } +} + +/** + * hdd_get_adpter_mode() - returns adapter mode based on global con mode + * @mode: global con mode + * + * Return: adapter mode + */ +static enum tQDF_ADAPTER_MODE hdd_get_adpter_mode( + enum tQDF_GLOBAL_CON_MODE mode) +{ + + switch (mode) { + case QDF_GLOBAL_MISSION_MODE: + return QDF_STA_MODE; + case QDF_GLOBAL_MONITOR_MODE: + return QDF_MONITOR_MODE; + case QDF_GLOBAL_FTM_MODE: + return QDF_FTM_MODE; + case QDF_GLOBAL_EPPING_MODE: + return QDF_EPPING_MODE; + case QDF_GLOBAL_QVIT_MODE: + return QDF_QVIT_MODE; + default: + return QDF_MAX_NO_OF_MODE; + } +} /** * con_mode_handler() - Handles module param con_mode change + * @kmessage: con mode name on which driver to be bring up + * @kp: The associated kernel parameter * - * Handler function for module param con_mode when it is changed by userspace - * Dynamically linked - do nothing - * Statically linked - exit and init driver, as in rmmod and insmod + * This function is invoked when user updates con mode using sys entry, + * to initialize and bring-up driver in that specific mode. * - * Return - + * Return - 0 on success and failure code on failure */ static int con_mode_handler(const char *kmessage, struct kernel_param *kp) { @@ -8976,6 +9153,8 @@ static int con_mode_handler(const char *kmessage, struct kernel_param *kp) hdd_context_t *hdd_ctx; hdd_adapter_t *adapter; qdf_device_t qdf_dev = cds_get_context(QDF_MODULE_ID_QDF_DEVICE); + enum tQDF_GLOBAL_CON_MODE curr_mode; + enum tQDF_ADAPTER_MODE adapter_mode; QDF_STATUS status; hdd_info("con_mode handler: %s", kmessage); @@ -8992,15 +9171,35 @@ static int con_mode_handler(const char *kmessage, struct kernel_param *kp) return -EINVAL; } + if (!(is_con_mode_valid(con_mode))) { + hdd_err("invlaid con_mode %d", con_mode); + return -EINVAL; + } + curr_mode = hdd_get_conparam(); + if (curr_mode == con_mode) { + hdd_err("curr mode: %d is same as user triggered mode %d", + curr_mode, con_mode); + return 0; + } + + adapter_mode = hdd_get_adpter_mode(curr_mode); + if (adapter_mode == QDF_MAX_NO_OF_MODE) { + hdd_err("invalid adapter"); + return -EINVAL; + } + + hdd_stop_all_adapters(hdd_ctx); + hdd_deinit_all_adapters(hdd_ctx, false); + ret = hdd_wlan_stop_modules(hdd_ctx, false); if (ret) { hdd_err("Stop wlan modules failed"); return -EINVAL; } - adapter = hdd_get_adapter(hdd_ctx, QDF_STA_MODE); + adapter = hdd_get_adapter(hdd_ctx, adapter_mode); if (!adapter) { - hdd_err("Failed to get station adapter"); + hdd_err("Failed to get adapter, mode: %d", curr_mode); return -EINVAL; } @@ -9027,9 +9226,6 @@ static int con_mode_handler(const char *kmessage, struct kernel_param *kp) } 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); @@ -9066,18 +9262,6 @@ void hdd_set_conparam(uint32_t con_param) curr_con_mode = con_param; } -#ifdef WLAN_FEATURE_LPSS -static inline bool hdd_is_lpass_supported(hdd_context_t *hdd_ctx) -{ - return hdd_ctx->config->enable_lpass_support; -} -#else -static inline bool hdd_is_lpass_supported(hdd_context_t *hdd_ctx) -{ - return false; -} -#endif - /** * hdd_clean_up_pre_cac_interface() - Clean up the pre cac interface * @hdd_ctx: HDD context @@ -9129,7 +9313,7 @@ static void hdd_update_ol_config(hdd_context_t *hdd_ctx) cfg.enable_uart_print = hdd_ctx->config->enablefwprint; cfg.enable_fw_log = hdd_ctx->config->enable_fw_log; cfg.enable_ramdump_collection = hdd_ctx->config->is_ramdump_enabled; - cfg.enable_lpass_support = hdd_is_lpass_supported(hdd_ctx); + cfg.enable_lpass_support = hdd_lpass_is_supported(hdd_ctx); ol_init_ini_config(ol_ctx, &cfg); } @@ -9195,6 +9379,63 @@ int hdd_update_config(hdd_context_t *hdd_ctx) return ret; } +/** + * wlan_hdd_get_dfs_mode() - get ACS DFS mode + * @mode : cfg80211 DFS mode + * + * Return: return SAP ACS DFS mode else return ACS_DFS_MODE_NONE + */ +enum sap_acs_dfs_mode wlan_hdd_get_dfs_mode(enum dfs_mode mode) +{ + switch (mode) { + case DFS_MODE_ENABLE: + return ACS_DFS_MODE_ENABLE; + break; + case DFS_MODE_DISABLE: + return ACS_DFS_MODE_DISABLE; + break; + case DFS_MODE_DEPRIORITIZE: + return ACS_DFS_MODE_DEPRIORITIZE; + break; + default: + hdd_err("ACS dfs mode is NONE"); + return ACS_DFS_MODE_NONE; + } +} + +/** + * hdd_enable_disable_ca_event() - enable/disable channel avoidance event + * @hddctx: pointer to hdd context + * @set_value: enable/disable + * + * When Host sends vendor command enable, FW will send *ONE* CA ind to + * Host(even though it is duplicate). When Host send vendor command + * disable,FW doesn't perform any action. Whenever any change in + * CA *and* WLAN is in SAP/P2P-GO mode, FW sends CA ind to host. + * + * return - 0 on success, appropriate error values on failure. + */ +int hdd_enable_disable_ca_event(hdd_context_t *hddctx, uint8_t set_value) +{ + QDF_STATUS status; + + if (0 != wlan_hdd_validate_context(hddctx)) { + return -EAGAIN; + } + + if (!hddctx->config->goptimize_chan_avoid_event) { + hdd_warn("goptimize_chan_avoid_event ini param disabled"); + return -EINVAL; + } + + status = sme_enable_disable_chanavoidind_event(hddctx->hHal, set_value); + if (!QDF_IS_STATUS_SUCCESS(status)) { + hdd_err("Failed to send chan avoid command to SME"); + return -EINVAL; + } + return 0; +} + /* Register the module init/exit functions */ module_init(hdd_module_init); module_exit(hdd_module_exit); diff --git a/core/hdd/src/wlan_hdd_p2p.c b/core/hdd/src/wlan_hdd_p2p.c index 8f4d5f3d7583..ea3df68c7a47 100644 --- a/core/hdd/src/wlan_hdd_p2p.c +++ b/core/hdd/src/wlan_hdd_p2p.c @@ -178,13 +178,11 @@ QDF_STATUS wlan_hdd_remain_on_channel_callback(tHalHandle hHal, void *pCtx, if (pRemainChanCtx == NULL) { mutex_unlock(&cfgState->remain_on_chan_ctx_lock); - hddLog(LOGW, - "%s: No Rem on channel pending for which Rsp is received", - __func__); + hdd_warn("No Rem on channel pending for which Rsp is received"); return QDF_STATUS_SUCCESS; } - hddLog(LOG1, "Received remain on channel rsp"); + hdd_notice("Received remain on channel rsp"); qdf_mc_timer_stop(&pRemainChanCtx->hdd_remain_on_chan_timer); qdf_mc_timer_destroy(&pRemainChanCtx->hdd_remain_on_chan_timer); @@ -271,7 +269,7 @@ void wlan_hdd_cancel_existing_remain_on_channel(hdd_adapter_t *pAdapter) mutex_lock(&cfgState->remain_on_chan_ctx_lock); if (cfgState->remain_on_chan_ctx != NULL) { - hddLog(LOGE, "Cancel Existing Remain on Channel"); + hdd_err("Cancel Existing Remain on Channel"); if (QDF_TIMER_STATE_RUNNING == qdf_mc_timer_get_current_state( &cfgState->remain_on_chan_ctx->hdd_remain_on_chan_timer)) @@ -282,17 +280,13 @@ void wlan_hdd_cancel_existing_remain_on_channel(hdd_adapter_t *pAdapter) if (pRemainChanCtx->hdd_remain_on_chan_cancel_in_progress == true) { mutex_unlock(&cfgState->remain_on_chan_ctx_lock); - hddLog(LOGE, - "ROC timer cancellation in progress," - " wait for completion"); + hdd_err("ROC timer cancellation in progress wait for completion"); rc = wait_for_completion_timeout(&pAdapter-> cancel_rem_on_chan_var, msecs_to_jiffies (WAIT_CANCEL_REM_CHAN)); if (!rc) { - hddLog(LOGE, - "%s:wait on cancel_rem_on_chan_var timed out", - __func__); + hdd_err("wait on cancel_rem_on_chan_var timed out"); } return; } @@ -308,9 +302,7 @@ void wlan_hdd_cancel_existing_remain_on_channel(hdd_adapter_t *pAdapter) msecs_to_jiffies (WAIT_REM_CHAN_READY)); if (!rc) { - hddLog(LOGE, - "%s: timeout waiting for remain on channel ready indication", - __func__); + hdd_err("timeout waiting for remain on channel ready indication"); cds_flush_logs(WLAN_LOG_TYPE_FATAL, WLAN_LOG_INDICATOR_HOST_DRIVER, WLAN_LOG_REASON_HDD_TIME_OUT, @@ -345,9 +337,7 @@ void wlan_hdd_cancel_existing_remain_on_channel(hdd_adapter_t *pAdapter) (WAIT_CANCEL_REM_CHAN)); if (!rc) { - hddLog(LOGE, - "%s: timeout waiting for cancel remain on channel ready" - " indication", __func__); + hdd_err("timeout waiting for cancel remain on channel ready indication"); } hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_ROC); } else @@ -368,8 +358,7 @@ int wlan_hdd_check_remain_on_channel(hdd_adapter_t *pAdapter) wlan_hdd_cancel_existing_remain_on_channel (pAdapter); } else { - hddLog(LOG1, - "Cannot Cancel Existing Remain on Channel"); + hdd_notice("Cannot Cancel Existing Remain on Channel"); status = -EBUSY; } } @@ -391,9 +380,7 @@ void wlan_hdd_cancel_pending_roc(hdd_adapter_t *adapter) unsigned long rc; hdd_cfg80211_state_t *cfg_state = WLAN_HDD_GET_CFG_STATE_PTR(adapter); - QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR, - "%s: ROC completion is not received.!!!", - __func__); + hdd_err("ROC completion is not received !!!"); mutex_lock(&cfg_state->remain_on_chan_ctx_lock); roc_ctx = cfg_state->remain_on_chan_ctx; @@ -429,10 +416,7 @@ wait: msecs_to_jiffies (WAIT_CANCEL_REM_CHAN)); if (!rc) { - QDF_TRACE(QDF_MODULE_ID_HDD, - QDF_TRACE_LEVEL_ERROR, - "%s: Timeout occurred while waiting for RoC Cancellation", - __func__); + hdd_err("Timeout occurred while waiting for RoC Cancellation"); mutex_lock(&cfg_state->remain_on_chan_ctx_lock); roc_ctx = cfg_state->remain_on_chan_ctx; if (roc_ctx != NULL) { @@ -463,9 +447,8 @@ void wlan_hdd_cleanup_remain_on_channel_ctx(hdd_adapter_t *pAdapter) mutex_lock(&cfgState->remain_on_chan_ctx_lock); while (pAdapter->is_roc_inprogress) { mutex_unlock(&cfgState->remain_on_chan_ctx_lock); - QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR, - "%s: ROC in progress for session %d!!!", - __func__, pAdapter->sessionId); + hdd_err("ROC in progress for session %d!!!", + pAdapter->sessionId); msleep(500); if (retry++ > 3) { wlan_hdd_cancel_pending_roc(pAdapter); @@ -497,19 +480,19 @@ void wlan_hdd_remain_on_chan_timeout(void *data) if (NULL == pRemainChanCtx) { mutex_unlock(&cfgState->remain_on_chan_ctx_lock); - hddLog(LOGE, "%s: No Remain on channel is pending", __func__); + hdd_err("No Remain on channel is pending"); return; } if (true == pRemainChanCtx->hdd_remain_on_chan_cancel_in_progress) { mutex_unlock(&cfgState->remain_on_chan_ctx_lock); - hddLog(LOGE, FL("Cancellation already in progress")); + hdd_err("Cancellation already in progress"); return; } pRemainChanCtx->hdd_remain_on_chan_cancel_in_progress = true; mutex_unlock(&cfgState->remain_on_chan_ctx_lock); - hddLog(LOG1, "%s: Cancel Remain on Channel on timeout", __func__); + hdd_notice("Cancel Remain on Channel on timeout"); if ((QDF_STA_MODE == pAdapter->device_mode) || (QDF_P2P_CLIENT_MODE == pAdapter->device_mode) || @@ -546,8 +529,7 @@ static int wlan_hdd_execute_remain_on_channel(hdd_adapter_t *pAdapter, mutex_lock(&cfgState->remain_on_chan_ctx_lock); if (pAdapter->is_roc_inprogress == true) { mutex_unlock(&cfgState->remain_on_chan_ctx_lock); - hddLog(QDF_TRACE_LEVEL_ERROR, - FL("remain on channel request is in execution")); + hdd_err("remain on channel request is in execution"); return -EBUSY; } @@ -562,8 +544,7 @@ static int wlan_hdd_execute_remain_on_channel(hdd_adapter_t *pAdapter, QDF_TIMER_TYPE_SW, wlan_hdd_remain_on_chan_timeout, pAdapter); if (qdf_status != QDF_STATUS_SUCCESS) { - hddLog(QDF_TRACE_LEVEL_ERROR, - FL("Not able to initialize remain_on_chan timer")); + hdd_err("Not able to initialize remain_on_chan timer"); mutex_lock(&cfgState->remain_on_chan_ctx_lock); cfgState->remain_on_chan_ctx = NULL; pAdapter->is_roc_inprogress = false; @@ -608,7 +589,7 @@ static int wlan_hdd_execute_remain_on_channel(hdd_adapter_t *pAdapter, (pRemainChanCtx->rem_on_chan_request == REMAIN_ON_CHANNEL_REQUEST) ? true : false, &pRemainChanCtx->scan_id)) { - hddLog(LOGE, FL("sme_remain_on_channel failed")); + hdd_err("sme_remain_on_channel failed"); mutex_lock(&cfgState->remain_on_chan_ctx_lock); cfgState->remain_on_chan_ctx = NULL; pAdapter->is_roc_inprogress = false; @@ -628,8 +609,7 @@ static int wlan_hdd_execute_remain_on_channel(hdd_adapter_t *pAdapter, (SIR_MAC_MGMT_FRAME << 2) | (SIR_MAC_MGMT_PROBE_REQ << 4), NULL, 0)) - hddLog(LOGE, - FL("sme_register_mgmt_frame failed")); + hdd_err("sme_register_mgmt_frame failed"); } } else if ((QDF_SAP_MODE == pAdapter->device_mode) || @@ -640,7 +620,7 @@ static int wlan_hdd_execute_remain_on_channel(hdd_adapter_t *pAdapter, pRemainChanCtx->chan.hw_value, duration, wlan_hdd_remain_on_channel_callback, pAdapter, &pRemainChanCtx->scan_id)) { - hddLog(LOGE, FL("wlansap_remain_on_channel failed")); + hdd_err("wlansap_remain_on_channel failed"); mutex_lock(&cfgState->remain_on_chan_ctx_lock); cfgState->remain_on_chan_ctx = NULL; pAdapter->is_roc_inprogress = false; @@ -656,8 +636,7 @@ static int wlan_hdd_execute_remain_on_channel(hdd_adapter_t *pAdapter, WLAN_HDD_GET_SAP_CTX_PTR(pAdapter), (SIR_MAC_MGMT_FRAME << 2) | (SIR_MAC_MGMT_PROBE_REQ << 4), NULL, 0)) { - QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR, - FL("wlansap_register_mgmt_frame return fail")); + hdd_err("wlansap_register_mgmt_frame return fail"); wlansap_cancel_remain_on_channel( WLAN_HDD_GET_SAP_CTX_PTR(pAdapter), pRemainChanCtx->scan_id); @@ -691,7 +670,7 @@ static int wlan_hdd_roc_request_enqueue(hdd_adapter_t *adapter, hdd_roc_req = qdf_mem_malloc(sizeof(*hdd_roc_req)); if (NULL == hdd_roc_req) { - hddLog(LOGP, FL("malloc failed for roc req context")); + hdd_alert("malloc failed for roc req context"); return -ENOMEM; } @@ -705,7 +684,7 @@ static int wlan_hdd_roc_request_enqueue(hdd_adapter_t *adapter, qdf_spin_unlock(&hdd_ctx->hdd_roc_req_q_lock); if (QDF_STATUS_SUCCESS != status) { - hddLog(LOGP, FL("Not able to enqueue RoC Req context")); + hdd_alert("Not able to enqueue RoC Req context"); qdf_mem_free(hdd_roc_req); return -EINVAL; } @@ -785,8 +764,7 @@ void wlan_hdd_roc_request_dequeue(struct work_struct *work) hdd_roc_req->pAdapter, hdd_roc_req->pRemainChanCtx); if (ret == -EBUSY) { - hddLog(QDF_TRACE_LEVEL_ERROR, - FL("dropping RoC request")); + hdd_err("dropping RoC request"); wlan_hdd_indicate_roc_drop(hdd_roc_req->pAdapter, hdd_roc_req->pRemainChanCtx); qdf_mem_free(hdd_roc_req->pRemainChanCtx); @@ -813,25 +791,22 @@ static int wlan_hdd_request_remain_on_channel(struct wiphy *wiphy, ENTER(); - hddLog(LOG1, FL("Device_mode %s(%d)"), - hdd_device_mode_to_string(pAdapter->device_mode), - pAdapter->device_mode); - hddLog(LOG1, - "chan(hw_val)0x%x chan(centerfreq) %d, duration %d", - chan->hw_value, chan->center_freq, duration); + hdd_notice("Device_mode %s(%d)", + hdd_device_mode_to_string(pAdapter->device_mode), + pAdapter->device_mode); + hdd_info("chan(hw_val)0x%x chan(centerfreq) %d, duration %d", + chan->hw_value, chan->center_freq, duration); pHddCtx = WLAN_HDD_GET_CTX(pAdapter); ret = wlan_hdd_validate_context(pHddCtx); if (0 != ret) return ret; if (cds_is_connection_in_progress()) { - hddLog(LOGE, FL("Connection is in progress")); + hdd_err("Connection is in progress"); isBusy = true; } pRemainChanCtx = qdf_mem_malloc(sizeof(hdd_remain_on_chan_ctx_t)); if (NULL == pRemainChanCtx) { - hddLog(QDF_TRACE_LEVEL_FATAL, - "%s: Not able to allocate memory for Channel context", - __func__); + hdd_alert("Not able to allocate memory for Channel context"); return -ENOMEM; } @@ -864,7 +839,7 @@ static int wlan_hdd_request_remain_on_channel(struct wiphy *wiphy, schedule_delayed_work(&pHddCtx->roc_req_work, msecs_to_jiffies( pHddCtx->config->p2p_listen_defer_interval)); - hddLog(LOG1, "Defer interval is %hu, pAdapter %p", + hdd_info("Defer interval is %hu, pAdapter %p", pHddCtx->config->p2p_listen_defer_interval, pAdapter); return 0; @@ -928,7 +903,7 @@ int __wlan_hdd_cfg80211_remain_on_channel(struct wiphy *wiphy, return ret; if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) { - hddLog(LOGE, FL("Command not allowed in FTM mode")); + hdd_err("Command not allowed in FTM mode"); return -EINVAL; } @@ -968,11 +943,11 @@ void hdd_remain_chan_ready_handler(hdd_adapter_t *pAdapter, QDF_STATUS status; if (NULL == pAdapter) { - hddLog(LOGE, FL("pAdapter is NULL")); + hdd_err("pAdapter is NULL"); return; } cfgState = WLAN_HDD_GET_CFG_STATE_PTR(pAdapter); - hddLog(LOG1, "Ready on chan ind %d", scan_id); + hdd_notice("Ready on chan ind %d", scan_id); pAdapter->start_roc_ts = qdf_mc_timer_get_system_time(); mutex_lock(&cfgState->remain_on_chan_ctx_lock); @@ -986,7 +961,7 @@ void hdd_remain_chan_ready_handler(hdd_adapter_t *pAdapter, if (QDF_TIMER_STATE_RUNNING == qdf_mc_timer_get_current_state( &pRemainChanCtx->hdd_remain_on_chan_timer)) { - hddLog(LOGE, "Timer Started before ready event!!!"); + hdd_err("Timer Started before ready event!!!"); qdf_mc_timer_stop(&pRemainChanCtx-> hdd_remain_on_chan_timer); } @@ -996,8 +971,7 @@ void hdd_remain_chan_ready_handler(hdd_adapter_t *pAdapter, (pRemainChanCtx->duration + COMPLETE_EVENT_PROPOGATE_TIME)); if (status != QDF_STATUS_SUCCESS) { - hddLog(LOGE, "%s: Remain on Channel timer start failed", - __func__); + hdd_err("Remain on Channel timer start failed"); } if (REMAIN_ON_CHANNEL_REQUEST == @@ -1016,9 +990,7 @@ void hdd_remain_chan_ready_handler(hdd_adapter_t *pAdapter, } /* Check for cached action frame */ if (pRemainChanCtx->action_pkt_buff.frame_length != 0) { - hddLog(LOGE, - "%s: Sent cached action frame to supplicant", - __func__); + hdd_err("Sent cached action frame to supplicant"); #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) cfg80211_rx_mgmt(pAdapter->dev->ieee80211_ptr, pRemainChanCtx->action_pkt_buff.freq, 0, @@ -1048,8 +1020,7 @@ void hdd_remain_chan_ready_handler(hdd_adapter_t *pAdapter, } complete(&pAdapter->rem_on_chan_ready_event); } else { - hddLog(LOGW, "%s: No Pending Remain on channel Request", - __func__); + hdd_warn("No Pending Remain on channel Request"); } mutex_unlock(&cfgState->remain_on_chan_ctx_lock); return; @@ -1073,7 +1044,7 @@ int __wlan_hdd_cfg80211_cancel_remain_on_channel(struct wiphy *wiphy, ENTER(); if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) { - hddLog(LOGE, FL("Command not allowed in FTM mode")); + hdd_err("Command not allowed in FTM mode"); return -EINVAL; } @@ -1105,9 +1076,7 @@ int __wlan_hdd_cfg80211_cancel_remain_on_channel(struct wiphy *wiphy, if ((cfgState->remain_on_chan_ctx == NULL) || (cfgState->remain_on_chan_ctx->cookie != cookie)) { mutex_unlock(&cfgState->remain_on_chan_ctx_lock); - hddLog(LOGE, - "%s: No Remain on channel pending with specified cookie value", - __func__); + hdd_err("No Remain on channel pending with specified cookie value"); return -EINVAL; } @@ -1117,17 +1086,13 @@ int __wlan_hdd_cfg80211_cancel_remain_on_channel(struct wiphy *wiphy, if (true == pRemainChanCtx->hdd_remain_on_chan_cancel_in_progress) { mutex_unlock(&cfgState->remain_on_chan_ctx_lock); - hddLog(LOG1, - FL("ROC timer cancellation in progress," - " wait for completion")); + hdd_notice("ROC timer cancellation in progress, wait for completion"); rc = wait_for_completion_timeout(&pAdapter-> cancel_rem_on_chan_var, msecs_to_jiffies (WAIT_CANCEL_REM_CHAN)); if (!rc) { - hddLog(LOGE, - "%s:wait on cancel_rem_on_chan_var timed out", - __func__); + hdd_err("wait on cancel_rem_on_chan_var timed out"); } return 0; } else @@ -1141,9 +1106,7 @@ int __wlan_hdd_cfg80211_cancel_remain_on_channel(struct wiphy *wiphy, rc = wait_for_completion_timeout(&pAdapter->rem_on_chan_ready_event, msecs_to_jiffies(WAIT_REM_CHAN_READY)); if (!rc) { - hddLog(LOGE, - "%s: timeout waiting for remain on channel ready indication", - __func__); + hdd_err("timeout waiting for remain on channel ready indication"); if (cds_is_driver_recovering()) { hdd_err("Recovery in Progress. State: 0x%x Ignore!!!", @@ -1177,18 +1140,16 @@ int __wlan_hdd_cfg80211_cancel_remain_on_channel(struct wiphy *wiphy, pRemainChanCtx->scan_id); } else { - hddLog(LOGE, FL("Invalid device_mode %s(%d)"), - hdd_device_mode_to_string(pAdapter->device_mode), - pAdapter->device_mode); + hdd_err("Invalid device_mode %s(%d)", + hdd_device_mode_to_string(pAdapter->device_mode), + pAdapter->device_mode); return -EIO; } rc = wait_for_completion_timeout(&pAdapter->cancel_rem_on_chan_var, msecs_to_jiffies (WAIT_CANCEL_REM_CHAN)); if (!rc) { - hddLog(LOGE, - "%s:wait on cancel_rem_on_chan_var timed out ", - __func__); + hdd_err("wait on cancel_rem_on_chan_var timed out"); } hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_ROC); EXIT(); @@ -1235,7 +1196,7 @@ int __wlan_hdd_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, ENTER(); if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) { - hddLog(LOGE, FL("Command not allowed in FTM mode")); + hdd_err("Command not allowed in FTM mode"); return -EINVAL; } @@ -1247,13 +1208,13 @@ int __wlan_hdd_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, if (0 != status) return status; - hddLog(LOG1, FL("Device_mode %s(%d) type: %d, wait: %d, offchan: %d, category: %d, actionId: %d"), - hdd_device_mode_to_string(pAdapter->device_mode), - pAdapter->device_mode, type, wait, offchan, - buf[WLAN_HDD_PUBLIC_ACTION_FRAME_BODY_OFFSET + - WLAN_HDD_PUBLIC_ACTION_FRAME_CATEGORY_OFFSET], - buf[WLAN_HDD_PUBLIC_ACTION_FRAME_BODY_OFFSET + - WLAN_HDD_PUBLIC_ACTION_FRAME_ACTION_OFFSET]); + hdd_notice("Device_mode %s(%d) type: %d, wait: %d, offchan: %d, category: %d, actionId: %d", + hdd_device_mode_to_string(pAdapter->device_mode), + pAdapter->device_mode, type, wait, offchan, + buf[WLAN_HDD_PUBLIC_ACTION_FRAME_BODY_OFFSET + + WLAN_HDD_PUBLIC_ACTION_FRAME_CATEGORY_OFFSET], + buf[WLAN_HDD_PUBLIC_ACTION_FRAME_BODY_OFFSET + + WLAN_HDD_PUBLIC_ACTION_FRAME_ACTION_OFFSET]); #ifdef WLAN_FEATURE_P2P_DEBUG if ((type == SIR_MAC_MGMT_FRAME) && @@ -1262,13 +1223,12 @@ int __wlan_hdd_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, [WLAN_HDD_PUBLIC_ACTION_FRAME_BODY_OFFSET])) { actionFrmType = buf[WLAN_HDD_PUBLIC_ACTION_FRAME_TYPE_OFFSET]; if (actionFrmType >= MAX_P2P_ACTION_FRAME_TYPE) { - hddLog(QDF_TRACE_LEVEL_ERROR, - "[P2P] unknown[%d] ---> OTA to " MAC_ADDRESS_STR, - actionFrmType, - MAC_ADDR_ARRAY(&buf - [WLAN_HDD_80211_FRM_DA_OFFSET])); + hdd_err("[P2P] unknown[%d] ---> OTA to " MAC_ADDRESS_STR, + actionFrmType, + MAC_ADDR_ARRAY(&buf + [WLAN_HDD_80211_FRM_DA_OFFSET])); } else { - hddLog(QDF_TRACE_LEVEL_ERROR, "[P2P] %s ---> OTA to " + hdd_err("[P2P] %s ---> OTA to " MAC_ADDRESS_STR, p2p_action_frame_type[actionFrmType], MAC_ADDR_ARRAY(&buf @@ -1276,16 +1236,13 @@ int __wlan_hdd_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, 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"); + 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; - hddLog(LOGE, - "[P2P State]GO nego progress to GO nego" - " completed state"); + hdd_err("[P2P State]GO nego progress to GO nego completed state"); } } } @@ -1345,10 +1302,9 @@ int __wlan_hdd_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, memcpy(&dstMac, &buf[WLAN_HDD_80211_FRM_DA_OFFSET], ETH_ALEN); - hddLog(QDF_TRACE_LEVEL_INFO, - "%s: Deauth/Disassoc received for STA:" - MAC_ADDRESS_STR, __func__, - MAC_ADDR_ARRAY(dstMac)); + hdd_info("Deauth/Disassoc received for STA:" + MAC_ADDRESS_STR, + MAC_ADDR_ARRAY(dstMac)); goto err_rem_channel; } } @@ -1356,32 +1312,32 @@ int __wlan_hdd_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, if (NULL != cfgState->buf) { if (!noack) { - hddLog(LOGE, - "(%s):Previous P2P Action frame packet pending", - __func__); + hdd_err("Previous P2P Action frame packet pending"); hdd_cleanup_actionframe(pAdapter->pHddCtx, pAdapter); } else { - hddLog(LOGE, - "(%s):Pending Action frame packet return EBUSY", - __func__); + hdd_err("Pending Action frame packet return EBUSY"); return -EBUSY; } } if (subType == SIR_MAC_MGMT_ACTION) { - hddLog(LOG1, "Action frame tx request : %s", - hdd_get_action_string(buf - [WLAN_HDD_PUBLIC_ACTION_FRAME_OFFSET])); + hdd_notice("Action frame tx request : %s", + hdd_get_action_string(buf + [WLAN_HDD_PUBLIC_ACTION_FRAME_OFFSET])); } - if (pAdapter->device_mode == QDF_SAP_MODE) { + if ((pAdapter->device_mode == QDF_SAP_MODE) && + (test_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags))) { home_ch = pAdapter->sessionCtx.ap.operatingChannel; - } else if (pAdapter->device_mode == QDF_STA_MODE) { + } else if ((pAdapter->device_mode == QDF_STA_MODE) && + (pAdapter->sessionCtx.station.conn_info.connState == + eConnectionState_Associated)) { home_ch = pAdapter->sessionCtx.station.conn_info.operationChannel; } else { goAdapter = hdd_get_adapter(pAdapter->pHddCtx, QDF_P2P_GO_MODE); - if (goAdapter) + if (goAdapter && + (test_bit(SOFTAP_BSS_STARTED, &goAdapter->event_flags))) home_ch = goAdapter->sessionCtx.ap.operatingChannel; } @@ -1390,8 +1346,7 @@ int __wlan_hdd_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, home_ch)) { /* if adapter is already on requested ch, no need for ROC */ wait = 0; - hddLog(LOG1, - FL("Adapter already on requested ch. No ROC needed")); + hdd_notice("Adapter already on requested ch. No ROC needed"); goto send_frame; } @@ -1451,9 +1406,7 @@ int __wlan_hdd_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, hdd_remain_on_chan_timer, wait); if (status != QDF_STATUS_SUCCESS) { - hddLog(LOGE, - "%s: Remain on Channel timer start failed", - __func__); + hdd_err("Remain on Channel timer start failed"); } mutex_unlock(&cfgState-> remain_on_chan_ctx_lock); @@ -1464,17 +1417,14 @@ int __wlan_hdd_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, true) { mutex_unlock(&cfgState-> remain_on_chan_ctx_lock); - hddLog(QDF_TRACE_LEVEL_INFO, - "action frame tx: waiting for completion of ROC "); + hdd_info("action frame tx: waiting for completion of ROC "); rc = wait_for_completion_timeout (&pAdapter->cancel_rem_on_chan_var, msecs_to_jiffies (WAIT_CANCEL_REM_CHAN)); if (!rc) { - hddLog(LOGE, - "%s:wait on cancel_rem_on_chan_var timed out", - __func__); + hdd_err("wait on cancel_rem_on_chan_var timed out"); } } else @@ -1487,7 +1437,7 @@ int __wlan_hdd_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, if ((cfgState->remain_on_chan_ctx != NULL) && (cfgState->current_freq == chan->center_freq) ) { - hddLog(LOG1, "action frame: extending the wait time"); + hdd_notice("action frame: extending the wait time"); extendedWait = (uint16_t) wait; goto send_frame; } @@ -1514,7 +1464,7 @@ int __wlan_hdd_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, msecs_to_jiffies (WAIT_CHANGE_CHANNEL_FOR_OFFCHANNEL_TX)); if (!rc) { - hddLog(LOGE, "wait on offchannel_tx_event timed out"); + hdd_err("wait on offchannel_tx_event timed out"); goto err_rem_channel; } } else if (offchan) { @@ -1568,27 +1518,24 @@ send_frame: if ((QDF_STA_MODE == pAdapter->device_mode) || (QDF_P2P_CLIENT_MODE == pAdapter->device_mode) || - (QDF_P2P_DEVICE_MODE == pAdapter->device_mode) - ) { + (QDF_P2P_DEVICE_MODE == pAdapter->device_mode)) { uint8_t sessionId = pAdapter->sessionId; if ((type == SIR_MAC_MGMT_FRAME) && (subType == SIR_MAC_MGMT_ACTION) && - (buf[WLAN_HDD_PUBLIC_ACTION_FRAME_OFFSET] == - WLAN_HDD_PUBLIC_ACTION_FRAME)) { + wlan_hdd_is_type_p2p_action(&buf + [WLAN_HDD_PUBLIC_ACTION_FRAME_BODY_OFFSET])) { actionFrmType = buf[WLAN_HDD_PUBLIC_ACTION_FRAME_TYPE_OFFSET]; - hddLog(LOG1, "Tx Action Frame %u", actionFrmType); + hdd_notice("Tx Action Frame %u", actionFrmType); if (actionFrmType == WLAN_HDD_PROV_DIS_REQ) { cfgState->actionFrmState = HDD_PD_REQ_ACK_PENDING; - hddLog(LOG1, "%s: HDD_PD_REQ_ACK_PENDING", - __func__); + hdd_notice("HDD_PD_REQ_ACK_PENDING"); } else if (actionFrmType == WLAN_HDD_GO_NEG_REQ) { cfgState->actionFrmState = HDD_GO_NEG_REQ_ACK_PENDING; - hddLog(LOG1, "%s: HDD_GO_NEG_REQ_ACK_PENDING", - __func__); + hdd_notice("HDD_GO_NEG_REQ_ACK_PENDING"); } } @@ -1596,8 +1543,7 @@ send_frame: sme_send_action(WLAN_HDD_GET_HAL_CTX(pAdapter), sessionId, buf, len, extendedWait, noack, current_freq)) { - QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR, - "%s: sme_send_action returned fail", __func__); + hdd_err("sme_send_action returned fail"); goto err; } } else if (QDF_SAP_MODE == pAdapter->device_mode || @@ -1605,8 +1551,7 @@ send_frame: if (QDF_STATUS_SUCCESS != wlansap_send_action(WLAN_HDD_GET_SAP_CTX_PTR(pAdapter), buf, len, 0, current_freq)) { - hddLog(LOGE, - FL("wlansap_send_action returned fail")); + hdd_err("wlansap_send_action returned fail"); goto err; } } @@ -1786,21 +1731,18 @@ int hdd_set_p2p_noa(struct net_device *dev, uint8_t *command) param = strnchr(command, strlen(command), ' '); if (param == NULL) { - QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR, - "%s: strnchr failed to find delimeter", __func__); + hdd_err("strnchr failed to find delimeter"); return -EINVAL; } param++; ret = sscanf(param, "%d %d %d", &count, &interval, &duration); if (ret != 3) { - QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR, - "%s: P2P_SET GO NoA: fail to read params, ret=%d", - __func__, ret); + hdd_err("P2P_SET GO NoA: fail to read params, ret=%d", + ret); return -EINVAL; } - QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_INFO, - "%s: P2P_SET GO NoA: count=%d interval=%d duration=%d", - __func__, count, interval, duration); + hdd_info("P2P_SET GO NoA: count=%d interval=%d duration=%d", + count, interval, duration); duration = MS_TO_TU_MUS(duration); /* PS Selection * Periodic NoA (2) @@ -1821,10 +1763,9 @@ int hdd_set_p2p_noa(struct net_device *dev, uint8_t *command) NoA.count = count; NoA.sessionid = pAdapter->sessionId; - QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_INFO, - "%s: P2P_PS_ATTR:oppPS %d ctWindow %d duration %d " + hdd_info("P2P_PS_ATTR:oppPS %d ctWindow %d duration %d " "interval %d count %d single noa duration %d " - "PsSelection %x", __func__, NoA.opp_ps, + "PsSelection %x", NoA.opp_ps, NoA.ctWindow, NoA.duration, NoA.interval, NoA.count, NoA.single_noa_duration, NoA.psSelection); @@ -2011,7 +1952,7 @@ struct wireless_dev *__wlan_hdd_add_virtual_intf(struct wiphy *wiphy, ENTER(); if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) { - hddLog(LOGE, FL("Command not allowed in FTM mode")); + hdd_err("Command not allowed in FTM mode"); return ERR_PTR(-EINVAL); } @@ -2032,10 +1973,8 @@ struct wireless_dev *__wlan_hdd_add_virtual_intf(struct wiphy *wiphy, && QDF_P2P_GO_MODE != session_type && QDF_P2P_CLIENT_MODE != session_type && QDF_STA_MODE != session_type) { - hddLog(LOGE, - "%s: Interface type %d already exists. " - "Two interfaces of same type are not supported currently.", - __func__, type); + hdd_err("Interface type %d already exists. Two interfaces of same type are not supported currently.", + type); return ERR_PTR(-EINVAL); } @@ -2047,8 +1986,7 @@ struct wireless_dev *__wlan_hdd_add_virtual_intf(struct wiphy *wiphy, if (scan_info->mScanPending) { hdd_abort_mac_scan(pHddCtx, pAdapter->sessionId, eCSR_SCAN_ABORT_DEFAULT); - hddLog(LOG1, - FL("Abort Scan while adding virtual interface")); + hdd_notice("Abort Scan while adding virtual interface"); } } @@ -2078,8 +2016,7 @@ struct wireless_dev *__wlan_hdd_add_virtual_intf(struct wiphy *wiphy, } if (NULL == pAdapter) { - hddLog(QDF_TRACE_LEVEL_ERROR, "%s: hdd_open_adapter failed", - __func__); + hdd_err("hdd_open_adapter failed"); return ERR_PTR(-ENOSPC); } @@ -2178,16 +2115,16 @@ int __wlan_hdd_del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev) ENTER(); if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) { - hddLog(LOGE, FL("Command not allowed in FTM mode")); + hdd_err("Command not allowed in FTM mode"); return -EINVAL; } MTRACE(qdf_trace(QDF_MODULE_ID_HDD, TRACE_CODE_HDD_DEL_VIRTUAL_INTF, pVirtAdapter->sessionId, pVirtAdapter->device_mode)); - hddLog(LOG1, FL("Device_mode %s(%d)"), - hdd_device_mode_to_string(pVirtAdapter->device_mode), - pVirtAdapter->device_mode); + hdd_notice("Device_mode %s(%d)", + hdd_device_mode_to_string(pVirtAdapter->device_mode), + pVirtAdapter->device_mode); status = wlan_hdd_validate_context(pHddCtx); @@ -2291,22 +2228,22 @@ void __hdd_indicate_mgmt_frame(hdd_adapter_t *pAdapter, hdd_remain_on_chan_ctx_t *pRemainChanCtx = NULL; hdd_context_t *pHddCtx; - hddLog(QDF_TRACE_LEVEL_INFO, "%s: Frame Type = %d Frame Length = %d", - __func__, frameType, nFrameLength); + hdd_info("Frame Type = %d Frame Length = %d", + frameType, nFrameLength); if (NULL == pAdapter) { - hddLog(LOGE, FL("pAdapter is NULL")); + hdd_err("pAdapter is NULL"); return; } pHddCtx = WLAN_HDD_GET_CTX(pAdapter); if (0 == nFrameLength) { - hddLog(LOGE, FL("Frame Length is Invalid ZERO")); + hdd_err("Frame Length is Invalid ZERO"); return; } if (NULL == pbFrames) { - hddLog(LOGE, FL("pbFrames is NULL")); + hdd_err("pbFrames is NULL"); return; } @@ -2325,25 +2262,23 @@ void __hdd_indicate_mgmt_frame(hdd_adapter_t *pAdapter, * frame with BCST as destination, * we are dropping action frame */ - hddLog(LOGP, - "pAdapter for action frame is NULL Macaddr = " - MAC_ADDRESS_STR, - MAC_ADDR_ARRAY(&pbFrames - [WLAN_HDD_80211_FRM_DA_OFFSET])); - hddLog(LOGP, - FL("Frame Type = %d Frame Length = %d subType = %d"), + hdd_alert("pAdapter for action frame is NULL Macaddr = " + MAC_ADDRESS_STR, + MAC_ADDR_ARRAY(&pbFrames + [WLAN_HDD_80211_FRM_DA_OFFSET])); + hdd_alert("Frame Type = %d Frame Length = %d subType = %d", frameType, nFrameLength, subType); return; } } if (NULL == pAdapter->dev) { - hddLog(LOGE, FL("pAdapter->dev is NULL")); + hdd_err("pAdapter->dev is NULL"); return; } if (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic) { - hddLog(LOGE, FL("pAdapter has invalid magic")); + hdd_err("pAdapter has invalid magic"); return; } @@ -2374,8 +2309,8 @@ void __hdd_indicate_mgmt_frame(hdd_adapter_t *pAdapter, actionFrmType = pbFrames [WLAN_HDD_PUBLIC_ACTION_FRAME_TYPE_OFFSET]; - hddLog(LOG1, "Rx Action Frame %u", - actionFrmType); + hdd_info("Rx Action Frame %u", + actionFrmType); wlan_hdd_p2p_action_debug(actionFrmType, macFrom); @@ -2392,8 +2327,7 @@ void __hdd_indicate_mgmt_frame(hdd_adapter_t *pAdapter, WLAN_HDD_DEV_DIS_REQ || actionFrmType == WLAN_HDD_PROV_DIS_REQ) { - hddLog(LOG1, - "Extend RoC timer on reception of Action Frame"); + hdd_notice("Extend RoC timer on reception of Action Frame"); if ((actionFrmType == WLAN_HDD_GO_NEG_REQ) @@ -2420,15 +2354,10 @@ void __hdd_indicate_mgmt_frame(hdd_adapter_t *pAdapter, extend_time); if (status != QDF_STATUS_SUCCESS) { - hddLog - (LOGE, - "%s: Remain on Channel timer start failed", - __func__); + hdd_err("Remain on Channel timer start failed"); } } else { - hddLog(LOG1, - "%s: Rcvd action frame after timer expired", - __func__); + hdd_notice("Rcvd action frame after timer expired"); } } else { /* Buffer Packet */ @@ -2454,15 +2383,9 @@ void __hdd_indicate_mgmt_frame(hdd_adapter_t *pAdapter, frame_ptr, pbFrames, nFrameLength); - hddLog(LOGE, - "%s:" - "Action Pkt Cached successfully !!!", - __func__); + hdd_err("Action Pkt Cached successfully !!!"); } else { - hddLog(LOGE, - "%s:" - "Frames are pending. dropping frame !!!", - __func__); + hdd_err("Frames are pending. dropping frame !!!"); } mutex_unlock(&cfgState-> remain_on_chan_ctx_lock); @@ -2479,9 +2402,7 @@ void __hdd_indicate_mgmt_frame(hdd_adapter_t *pAdapter, || ((actionFrmType == WLAN_HDD_GO_NEG_RESP) && (cfgState->actionFrmState == HDD_GO_NEG_REQ_ACK_PENDING))) { - hddLog(LOG1, - "%s: ACK_PENDING and But received RESP for Action frame ", - __func__); + hdd_notice("ACK_PENDING and But received RESP for Action frame "); cfgState->is_go_neg_ack_received = 1; hdd_send_action_cnf(pAdapter, true); } @@ -2493,8 +2414,7 @@ void __hdd_indicate_mgmt_frame(hdd_adapter_t *pAdapter, u8 *mac = &pbFrames [WLAN_HDD_80211_PEER_ADDR_OFFSET]; - hddLog(LOG1, - "[TDLS] TDLS Discovery Response," + hdd_notice("[TDLS] TDLS Discovery Response," MAC_ADDRESS_STR " RSSI[%d] <--- OTA", MAC_ADDR_ARRAY(mac), rxRssi); @@ -2514,13 +2434,11 @@ void __hdd_indicate_mgmt_frame(hdd_adapter_t *pAdapter, actionFrmType = pbFrames[WLAN_HDD_PUBLIC_ACTION_FRAME_OFFSET + 1]; if (actionFrmType >= MAX_TDLS_ACTION_FRAME_TYPE) { - hddLog(LOG1, - "[TDLS] unknown[%d] <--- OTA", - actionFrmType); + hdd_notice("[TDLS] unknown[%d] <--- OTA", + actionFrmType); } else { - hddLog(LOG1, - "[TDLS] %s <--- OTA", - tdls_action_frame_type[actionFrmType]); + hdd_notice("[TDLS] %s <--- OTA", + tdls_action_frame_type[actionFrmType]); } cds_tdls_tx_rx_mgmt_event(SIR_MAC_ACTION_TDLS, SIR_MAC_ACTION_RX, SIR_MAC_MGMT_ACTION, @@ -2538,8 +2456,8 @@ void __hdd_indicate_mgmt_frame(hdd_adapter_t *pAdapter, } } /* Indicate Frame Over Normal Interface */ - hddLog(LOG1, FL("Indicate Frame over NL80211 sessionid : %d, idx :%d"), - pAdapter->sessionId, pAdapter->dev->ifindex); + hdd_notice("Indicate Frame over NL80211 sessionid : %d, idx :%d", + pAdapter->sessionId, pAdapter->dev->ifindex); #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) cfg80211_rx_mgmt(pAdapter->dev->ieee80211_ptr, freq, 0, pbFrames, diff --git a/core/hdd/src/wlan_hdd_power.c b/core/hdd/src/wlan_hdd_power.c index 9e5826085f7b..7e82be6f9ae7 100644 --- a/core/hdd/src/wlan_hdd_power.c +++ b/core/hdd/src/wlan_hdd_power.c @@ -1448,6 +1448,9 @@ QDF_STATUS hdd_wlan_shutdown(void) hdd_cleanup_scan_queue(pHddCtx); hdd_reset_all_adapters(pHddCtx); + /* Flush cached rx frame queue */ + cds_flush_cache_rx_queue(); + /* De-register the HDD callbacks */ hdd_deregister_cb(pHddCtx); hdd_ipa_uc_ssr_deinit(); @@ -1469,7 +1472,7 @@ QDF_STATUS hdd_wlan_shutdown(void) wlansap_global_deinit(); hdd_wlan_stop_modules(pHddCtx, true); - wlan_hdd_send_status_pkg(NULL, NULL, 0, 0); + hdd_lpass_notify_stop(pHddCtx); hdd_alert("WLAN driver shutdown complete"); return QDF_STATUS_SUCCESS; @@ -1555,10 +1558,7 @@ QDF_STATUS hdd_wlan_re_init(void) goto err_cds_disable; } - wlan_hdd_send_all_scan_intf_info(pHddCtx); - wlan_hdd_send_version_pkg(pHddCtx->target_fw_version, - pHddCtx->target_hw_version, - pHddCtx->target_hw_name); + hdd_lpass_notify_start(pHddCtx); qdf_status = wlansap_global_init(); if (QDF_IS_STATUS_ERROR(qdf_status)) goto err_cds_disable; @@ -2304,3 +2304,48 @@ int wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy, return ret; } + +/** + * hdd_set_qpower_config() - set qpower config to firmware + * @adapter: HDD adapter + * @qpower: new qpower config value + * + * Return: 0 on success; Errno on failure + */ +int hdd_set_qpower_config(hdd_context_t *hddctx, hdd_adapter_t *adapter, + uint8_t qpower) +{ + QDF_STATUS qdf_status; + int status; + bool is_timer_running; + + if (!hddctx->config->enablePowersaveOffload) { + hdd_err("qpower is disabled in configuration"); + return -EINVAL; + } + if (qpower > PS_DUTY_CYCLING_QPOWER || + qpower < PS_LEGACY_NODEEPSLEEP) { + hdd_err("invalid qpower value=%d", qpower); + return -EINVAL; + } + hdd_info("updating qpower value=%d to wma", qpower); + qdf_status = wma_set_powersave_config(qpower); + if (qdf_status != QDF_STATUS_SUCCESS) { + hdd_err("failed to update qpower %d", + qdf_status); + return -EINVAL; + } + is_timer_running = sme_is_auto_ps_timer_running( + WLAN_HDD_GET_HAL_CTX(adapter), + adapter->sessionId); + if (!is_timer_running) { + status = wlan_hdd_set_powersave(adapter, true, 0); + + if (status != 0) { + hdd_err("failed to put device in power save mode %d", + status); + return -EINVAL; + } + } + return 0; +} diff --git a/core/hdd/src/wlan_hdd_scan.c b/core/hdd/src/wlan_hdd_scan.c index e05610d09846..20c53b3c3c97 100644 --- a/core/hdd/src/wlan_hdd_scan.c +++ b/core/hdd/src/wlan_hdd_scan.c @@ -1271,7 +1271,8 @@ static void wlan_hdd_cfg80211_scan_block_cb(struct work_struct *work) * * Return: None */ -#ifdef CFG80211_SCAN_BSSID +#if defined(CFG80211_SCAN_BSSID) || \ + (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)) static inline void wlan_hdd_copy_bssid_scan_request(tCsrScanRequest *scan_req, struct cfg80211_scan_request *request) { @@ -1284,6 +1285,59 @@ static inline void wlan_hdd_copy_bssid_scan_request(tCsrScanRequest *scan_req, } #endif +/* + * wlan_hdd_update_scan_ies() - API to update the scan IEs of scan request + * with already stored default scan IEs + * + * @adapter: Pointer to HDD adapter + * @scan_info: Pointer to scan info in HDD adapter + * @scan_ie: Pointer to scan IE in scan request + * @scan_ie_len: Pointer to scan IE length in scan request + * + * Return: 0 on success; error number otherwise + */ +static int wlan_hdd_update_scan_ies(hdd_adapter_t *adapter, + hdd_scaninfo_t *scan_info, uint8_t *scan_ie, + uint8_t *scan_ie_len) +{ + uint8_t rem_len = scan_info->default_scan_ies_len; + uint8_t *temp_ie = scan_info->default_scan_ies; + uint8_t *current_ie; + uint8_t elem_id; + uint16_t elem_len; + + if (!scan_info->default_scan_ies_len || !scan_info->default_scan_ies) + return -EINVAL; + + while (rem_len >= 2) { + current_ie = temp_ie; + elem_id = *temp_ie++; + elem_len = *temp_ie++; + rem_len -= 2; + + switch (elem_id) { + case DOT11F_EID_EXTCAP: + if (!wlan_hdd_cfg80211_get_ie_ptr(scan_ie, *scan_ie_len, + DOT11F_EID_EXTCAP)) { + qdf_mem_copy(scan_ie + (*scan_ie_len), + current_ie, elem_len + 2); + (*scan_ie_len) += (elem_len + 2); + } + break; + case DOT11F_EID_WPA: + if (!wlan_hdd_get_mbo_ie_ptr(scan_ie, *scan_ie_len)) { + qdf_mem_copy(scan_ie + (*scan_ie_len), + current_ie, elem_len + 2); + (*scan_ie_len) += (elem_len + 2); + } + break; + } + temp_ie += elem_len; + rem_len -= elem_len; + } + return 0; +} + /** * __wlan_hdd_cfg80211_scan() - API to process cfg80211 scan request * @wiphy: Pointer to wiphy @@ -1545,6 +1599,11 @@ static int __wlan_hdd_cfg80211_scan(struct wiphy *wiphy, request->ie_len); pScanInfo->scanAddIE.length = request->ie_len; + if (wlan_hdd_update_scan_ies(pAdapter, pScanInfo, + pScanInfo->scanAddIE.addIEdata, + (uint8_t *)&pScanInfo->scanAddIE.length)) + hdd_err("Update scan IEs with default Scan IEs failed"); + if ((QDF_STA_MODE == pAdapter->device_mode) || (QDF_P2P_CLIENT_MODE == pAdapter->device_mode) || (QDF_P2P_DEVICE_MODE == pAdapter->device_mode) @@ -1606,6 +1665,15 @@ static int __wlan_hdd_cfg80211_scan(struct wiphy *wiphy, } } + } else { + if (pScanInfo->default_scan_ies && + pScanInfo->default_scan_ies_len) { + qdf_mem_copy(pScanInfo->scanAddIE.addIEdata, + pScanInfo->default_scan_ies, + pScanInfo->default_scan_ies_len); + pScanInfo->scanAddIE.length = + pScanInfo->default_scan_ies_len; + } } /* acquire the wakelock to avoid the apps suspend during the scan. To diff --git a/core/hdd/src/wlan_hdd_stats.c b/core/hdd/src/wlan_hdd_stats.c index 1531f1c1b0e9..662aa3a2f5b8 100644 --- a/core/hdd/src/wlan_hdd_stats.c +++ b/core/hdd/src/wlan_hdd_stats.c @@ -1700,13 +1700,13 @@ static int __wlan_hdd_cfg80211_get_station(struct wiphy *wiphy, sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL); #endif -#ifdef WLAN_FEATURE_LPSS - if (!pAdapter->rssi_send) { - pAdapter->rssi_send = true; - if (cds_is_driver_unloading()) - wlan_hdd_send_status_pkg(pAdapter, pHddStaCtx, 1, 1); - } -#endif + /* + * we notify connect to lpass here instead of during actual + * connect processing because rssi info is not accurate during + * actual connection. lpass will ensure the notification is + * only processed once per association. + */ + hdd_lpass_notify_connect(pAdapter); wlan_hdd_get_station_stats(pAdapter); rate_flags = pAdapter->hdd_stats.ClassA_stat.tx_rate_flags; @@ -1736,6 +1736,11 @@ static int __wlan_hdd_cfg80211_get_station(struct wiphy *wiphy, (int)pCfg->linkSpeedRssiLow, (int)rate_flags, (int)pAdapter->hdd_stats.ClassA_stat.mcs_index); +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)) || defined(WITH_BACKPORTS) + /* assume basic BW. anything else will override this later */ + sinfo->txrate.bw = RATE_INFO_BW_20; +#endif + if (eHDD_LINK_SPEED_REPORT_ACTUAL != pCfg->reportMaxLinkSpeed) { /* we do not want to necessarily report the current speed */ if (eHDD_LINK_SPEED_REPORT_MAX == pCfg->reportMaxLinkSpeed) { diff --git a/core/hdd/src/wlan_hdd_tdls.c b/core/hdd/src/wlan_hdd_tdls.c index 77a560d04979..6204e72aee8b 100644 --- a/core/hdd/src/wlan_hdd_tdls.c +++ b/core/hdd/src/wlan_hdd_tdls.c @@ -4499,7 +4499,7 @@ static int __wlan_hdd_cfg80211_tdls_oper(struct wiphy *wiphy, pAdapter, peer, pTdlsPeer->staId, pTdlsPeer->signature, - tdlsLinkEstablishParams.qos); + pTdlsPeer->qos); if (QDF_STATUS_SUCCESS == status) { uint8_t i; diff --git a/core/hdd/src/wlan_hdd_tx_rx.c b/core/hdd/src/wlan_hdd_tx_rx.c index 317f9939e76d..918973a91cee 100644 --- a/core/hdd/src/wlan_hdd_tx_rx.c +++ b/core/hdd/src/wlan_hdd_tx_rx.c @@ -62,14 +62,22 @@ #include "wlan_hdd_nan_datapath.h" #include "pld_common.h" -const uint8_t hdd_wmm_ac_to_highest_up[] = { - SME_QOS_WMM_UP_RESV, - SME_QOS_WMM_UP_EE, - SME_QOS_WMM_UP_VI, - SME_QOS_WMM_UP_NC +#ifdef QCA_LL_TX_FLOW_CONTROL_V2 +/* + * Mapping Linux AC interpretation to SME AC. + * Host has 5 tx queues, 4 flow-controlled queues for regular traffic and + * one non-flow-controlled queue for high priority control traffic(EOPOL, DHCP). + * The fifth queue is mapped to AC_VO to allow for proper prioritization. + */ +const uint8_t hdd_qdisc_ac_to_tl_ac[] = { + SME_AC_VO, + SME_AC_VI, + SME_AC_BE, + SME_AC_BK, + SME_AC_VO, }; -/* Mapping Linux AC interpretation to SME AC. */ +#else const uint8_t hdd_qdisc_ac_to_tl_ac[] = { SME_AC_VO, SME_AC_VI, @@ -77,6 +85,8 @@ const uint8_t hdd_qdisc_ac_to_tl_ac[] = { SME_AC_BK, }; +#endif + #ifdef QCA_LL_LEGACY_TX_FLOW_CONTROL /** * hdd_tx_resume_timer_expired_handler() - TX Q resume timer handler diff --git a/core/hdd/src/wlan_hdd_wext.c b/core/hdd/src/wlan_hdd_wext.c index 45b11d137e48..7074de2d6bd2 100644 --- a/core/hdd/src/wlan_hdd_wext.c +++ b/core/hdd/src/wlan_hdd_wext.c @@ -5075,7 +5075,7 @@ int wlan_hdd_update_phymode(struct net_device *net, tHalHandle hal, phddctx->config->nChannelBondingMode5GHz = smeconfig.csrConfig.channelBondingMode5GHz; phddctx->config->vhtChannelWidth = vhtchanwidth; - if (hdd_update_config_dat(phddctx) == false) { + if (hdd_update_config_cfg(phddctx) == false) { hdd_err("could not update config_dat"); return -EIO; } diff --git a/core/hdd/src/wlan_hdd_wmm.c b/core/hdd/src/wlan_hdd_wmm.c index f7beedff0de7..53e0086cca19 100644 --- a/core/hdd/src/wlan_hdd_wmm.c +++ b/core/hdd/src/wlan_hdd_wmm.c @@ -2270,7 +2270,8 @@ hdd_wlan_wmm_status_e hdd_wmm_delts(hdd_adapter_t *pAdapter, uint32_t handle) #ifndef WLAN_MDM_CODE_REDUCTION_OPT smeStatus = - sme_qos_release_req(WLAN_HDD_GET_HAL_CTX(pAdapter), qosFlowId); + sme_qos_release_req(WLAN_HDD_GET_HAL_CTX(pAdapter), + pAdapter->sessionId, qosFlowId); hdd_info("SME flow %d released, SME status %d", qosFlowId, smeStatus); diff --git a/core/mac/inc/qwlan_version.h b/core/mac/inc/qwlan_version.h index 4961be7d0034..7e897c074a79 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 "E" -#define QWLAN_VERSION_BUILD 28 +#define QWLAN_VERSION_EXTRA "J" +#define QWLAN_VERSION_BUILD 29 -#define QWLAN_VERSIONSTR "5.1.0.28E" +#define QWLAN_VERSIONSTR "5.1.0.29J" #endif /* QWLAN_VERSION_H */ diff --git a/core/mac/inc/sir_api.h b/core/mac/inc/sir_api.h index 26ce1d4dfcb3..362275c14bd3 100644 --- a/core/mac/inc/sir_api.h +++ b/core/mac/inc/sir_api.h @@ -193,14 +193,16 @@ typedef enum { * enum sir_roam_op_code - Operation to be done by the callback. * @SIR_ROAM_SYNCH_PROPAGATION: Propagate the new BSS info after roaming. * @SIR_ROAMING_DEREGISTER_STA: Deregister the old STA after roaming. - * @SIR_ROAMING_TX_QUEUE_DISABLE: Disable the network queues while roaming. - * @SIR_ROAMING_TX_QUEUE_ENABLE: Enable back the n/w queues in case roam fails. + * @SIR_ROAMING_START: Firmware started roaming operation + * @SIR_ROAMING_ABORT: Firmware aborted roaming operation, still connected. + * @SIR_ROAM_SYNCH_COMPLETE: Roam sync propagation is complete. */ enum sir_roam_op_code { SIR_ROAM_SYNCH_PROPAGATION = 1, SIR_ROAMING_DEREGISTER_STA, - SIR_ROAMING_TX_QUEUE_DISABLE, - SIR_ROAMING_TX_QUEUE_ENABLE, + SIR_ROAMING_START, + SIR_ROAMING_ABORT, + SIR_ROAM_SYNCH_COMPLETE, }; /** * Module ID definitions. @@ -2500,12 +2502,29 @@ typedef struct sSirUpdateAPWPSIEsReq { tSirAPWPSIEs APWPSIEs; } tSirUpdateAPWPSIEsReq, *tpSirUpdateAPWPSIEsReq; -typedef struct sSirUpdateParams { - uint16_t messageType; +/* + * enum sir_update_session_param_type - session param type + * @SIR_PARAM_SSID_HIDDEN: ssidHidden parameter + */ +enum sir_update_session_param_type { + SIR_PARAM_SSID_HIDDEN, +}; + +/* + * struct sir_update_session_param + * @message_type: SME message type + * @length: size of struct sir_update_session_param + * @session_id: Session ID + * @param_type: parameter to be updated + * @param_val: Parameter value to update + */ +struct sir_update_session_param { + uint16_t message_type; uint16_t length; - uint8_t sessionId; /* Session ID */ - uint8_t ssidHidden; /* Hide SSID */ -} tSirUpdateParams, *tpSirUpdateParams; + uint8_t session_id; + uint32_t param_type; + uint32_t param_val; +}; /** * struct sir_create_session - Used for creating session in monitor mode @@ -2989,6 +3008,8 @@ struct roam_ext_params { }; typedef struct sSirRoamOffloadScanReq { + uint16_t message_type; + uint16_t length; bool RoamScanOffloadEnabled; bool MAWCEnabled; int8_t LookupThreshold; @@ -3198,14 +3219,14 @@ typedef struct { * @name: Attribute which indicates the type of logging like per packet * statistics, connectivity etc. * @verbose_level: Verbose level which can be 0,1,2,3 - * @flag: Flag field for future use + * @is_iwpriv_command: Set 1 for iwpriv command * @ini_triggered: triggered using ini * @user_triggered: triggered by user */ struct sir_wifi_start_log { uint32_t ring_id; uint32_t verbose_level; - uint32_t flag; + uint32_t is_iwpriv_command; bool ini_triggered; uint8_t user_triggered; }; @@ -3556,6 +3577,7 @@ typedef struct sSirActiveModeSetBcnFilterReq { uint16_t messageType; uint16_t length; uint8_t seesionId; + struct qdf_mac_addr bssid; } tSirSetActiveModeSetBncFilterReq, *tpSirSetActiveModeSetBncFilterReq; /* Reset AP Caps Changed */ @@ -4153,6 +4175,7 @@ typedef struct sSirSmeRoamOffloadSynchInd { void *add_bss_params; tpSirSmeJoinRsp join_rsp; uint16_t aid; + struct sir_hw_mode_trans_ind hw_mode_trans_ind; } roam_offload_synch_ind; #ifdef WLAN_FEATURE_ROAM_OFFLOAD @@ -4795,6 +4818,20 @@ struct sir_ipa_offload_enable_disable { }; /** + * struct sir_set_vdev_ies_per_band + * @msg_type: message type + * @len: message length + * @vdev_id: vdev id + * + * Message wrapper structure for eWNI_SME_SET_VDEV_IES_PER_BAND. + */ +struct sir_set_vdev_ies_per_band { + uint16_t msg_type; + uint16_t len; + uint32_t vdev_id; +}; + +/** * struct sir_set_ht_vht_cfg - ht, vht IE config * @msg_type: message type * @len: message length @@ -5345,6 +5382,34 @@ struct fw_dump_rsp { }; /** + * DEFAULT_SCAN_IE_ID - Identifier for the collection of IE's added + * by default to the probe request + */ +#define DEFAULT_SCAN_IE_ID 256 + + /* MAX_DEFAULT_SCAN_IE_LEN - Maxmimum length of Default Scan IE's */ +#define MAX_DEFAULT_SCAN_IE_LEN 1024 + + /* Extended Capabilities IE header(IE Id + IE Length) length */ +#define EXT_CAP_IE_HDR_LEN 2 + +/** + * struct hdd_default_scan_ie - HDD default scan IE structure + * @message_type: message type to be set with eWNI_SME_DEFAULT_SCAN_IE + * @length: length of the struct hdd_default_scan_ie + * @session_id: Session Id + * @ie_len: Default scan IE length + * @ie_data: Pointer to default scan IE data + */ +struct hdd_default_scan_ie { + uint16_t message_type; + uint16_t length; + uint16_t session_id; + uint16_t ie_len; + uint8_t ie_data[MAX_DEFAULT_SCAN_IE_LEN]; +}; + +/** * struct vdev_ie_info - IE info * @vdev_id - vdev for which the IE is being sent * @ie_id - ID of the IE @@ -6472,4 +6537,18 @@ struct sme_update_access_policy_vendor_ie { uint8_t access_policy; }; +/** + * struct sir_encrypt_decrypt_rsp_params - encrypt/decrypt rsp params + * @vdev_id: vdev id + * @status: status + * @data_length: data length + * @data: data pointer + */ +struct sir_encrypt_decrypt_rsp_params { + uint32_t vdev_id; + int32_t status; + uint32_t data_length; + uint8_t *data; +}; + #endif /* __SIR_API_H */ diff --git a/core/mac/inc/wni_api.h b/core/mac/inc/wni_api.h index c46cb56a85f8..09f6cdb9a044 100644 --- a/core/mac/inc/wni_api.h +++ b/core/mac/inc/wni_api.h @@ -98,7 +98,7 @@ enum eWniMsgTypes { eWNI_SME_WPS_PBC_PROBE_REQ_IND, eWNI_SME_SET_APWPARSNIEs_REQ, eWNI_SME_UPPER_LAYER_ASSOC_CNF, - eWNI_SME_HIDE_SSID_REQ, + eWNI_SME_SESSION_UPDATE_PARAM, eWNI_SME_CHNG_MCC_BEACON_INTERVAL, eWNI_SME_REMAIN_ON_CHANNEL_REQ, eWNI_SME_REMAIN_ON_CHN_RSP, @@ -249,6 +249,7 @@ enum eWniMsgTypes { eWNI_SME_TSF_EVENT, eWNI_SME_MON_INIT_SESSION, eWNI_SME_PDEV_SET_HT_VHT_IE, + eWNI_SME_SET_VDEV_IES_PER_BAND, eWNI_SME_NDP_INITIATOR_REQ, eWNI_SME_NDP_INITIATOR_RSP, eWNI_SME_NDP_NEW_PEER_IND, @@ -263,6 +264,8 @@ enum eWniMsgTypes { eWNI_SME_REGISTER_P2P_ACK_CB, eWNI_SME_SEND_DISASSOC_FRAME, eWNI_SME_UPDATE_ACCESS_POLICY_VENDOR_IE, + eWNI_SME_DEFAULT_SCAN_IE, + eWNI_SME_ROAM_SCAN_OFFLOAD_REQ, eWNI_SME_MSG_TYPES_END }; diff --git a/core/mac/src/cfg/cfgUtil/dot11f.frms b/core/mac/src/cfg/cfgUtil/dot11f.frms index e204e7ff9731..80509932738c 100644 --- a/core/mac/src/cfg/cfgUtil/dot11f.frms +++ b/core/mac/src/cfg/cfgUtil/dot11f.frms @@ -1861,9 +1861,8 @@ IE Vendor3IE (EID_VENDOR_SPECIFIC) OUI (0x00, 0x16, 0x32) { } -IE hs20vendor_ie (EID_VENDOR_SPECIFIC) OUI (0x50, 0x6F, 0x9A) +IE hs20vendor_ie (EID_VENDOR_SPECIFIC) OUI (0x50, 0x6F, 0x9A, 0x10) { - type, 1; /* hotspot_configurations */ { dgaf_dis: 1; diff --git a/core/mac/src/include/dot11f.h b/core/mac/src/include/dot11f.h index 8e8c7ada1105..006fd880785d 100644 --- a/core/mac/src/include/dot11f.h +++ b/core/mac/src/include/dot11f.h @@ -35,7 +35,7 @@ * * * This file was automatically generated by 'framesc' - * Mon Aug 29 23:01:24 2016 from the following file(s): + * Mon Sep 19 14:42:34 2016 from the following file(s): * * dot11f.frms * @@ -7441,10 +7441,9 @@ uint32_t dot11f_get_packed_ie_ext_chan_switch_ann( }; /* End extern "C". */ #endif /* C++ */ -/* EID 221 (0xdd) {OUI 0x50, 0x6f, 0x9a} */ +/* EID 221 (0xdd) {OUI 0x50, 0x6f, 0x9a, 0x10} */ typedef struct sDot11fIEhs20vendor_ie { uint8_t present; - uint8_t type; uint8_t dgaf_dis:1; uint8_t hs_id_present:2; uint8_t reserved:1; diff --git a/core/mac/src/include/sir_params.h b/core/mac/src/include/sir_params.h index ad58fab5470b..2b71b5143209 100644 --- a/core/mac/src/include/sir_params.h +++ b/core/mac/src/include/sir_params.h @@ -630,8 +630,10 @@ typedef struct sSirMbMsgP2p { #define SIR_HAL_NDP_END_IND (SIR_HAL_ITC_MSG_TYPES_BEGIN + 357) #define SIR_HAL_UPDATE_WEP_DEFAULT_KEY (SIR_HAL_ITC_MSG_TYPES_BEGIN + 358) +#define SIR_HAL_SEND_FREQ_RANGE_CONTROL_IND (SIR_HAL_ITC_MSG_TYPES_BEGIN + 360) #define SIR_HAL_POWER_DBG_CMD (SIR_HAL_ITC_MSG_TYPES_BEGIN + 362) #define SIR_HAL_SET_DTIM_PERIOD (SIR_HAL_ITC_MSG_TYPES_BEGIN + 363) +#define SIR_HAL_ENCRYPT_DECRYPT_MSG (SIR_HAL_ITC_MSG_TYPES_BEGIN + 364) #define SIR_HAL_MSG_TYPES_END (SIR_HAL_MSG_TYPES_BEGIN + 0x1FF) diff --git a/core/mac/src/pe/include/lim_api.h b/core/mac/src/pe/include/lim_api.h index 68b5a8e85fe5..9e77bcc44fce 100644 --- a/core/mac/src/pe/include/lim_api.h +++ b/core/mac/src/pe/include/lim_api.h @@ -274,6 +274,7 @@ static inline void lim_fill_join_rsp_ht_caps(tpPESession session, tpSirSmeJoinRsp rsp) {} #endif - +QDF_STATUS lim_update_ext_cap_ie(tpAniSirGlobal mac_ctx, + uint8_t *ie_data, uint8_t *local_ie_buf, uint16_t *local_ie_len); /************************************************************/ #endif /* __LIM_API_H */ diff --git a/core/mac/src/pe/lim/lim_api.c b/core/mac/src/pe/lim/lim_api.c index c2d6f88c11d5..a1e05650a5c5 100644 --- a/core/mac/src/pe/lim/lim_api.c +++ b/core/mac/src/pe/lim/lim_api.c @@ -2184,3 +2184,58 @@ void lim_mon_init_session(tpAniSirGlobal mac_ptr, } psession_entry->vhtCapability = 1; } + +/** + * lim_update_ext_cap_ie() - Update Extended capabilities IE(if present) + * with capabilities of Fine Time measurements(FTM) if set in driver + * + * @mac_ctx: Pointer to Global MAC structure + * @ie_data: Default Scan IE data + * @local_ie_buf: Local Scan IE data + * @local_ie_len: Pointer to length of @ie_data + * + * Return: QDF_STATUS + */ +QDF_STATUS lim_update_ext_cap_ie(tpAniSirGlobal mac_ctx, + uint8_t *ie_data, uint8_t *local_ie_buf, uint16_t *local_ie_len) +{ + uint32_t dot11mode; + bool vht_enabled = false; + tDot11fIEExtCap default_scan_ext_cap = {0}, driver_ext_cap = {0}; + uint8_t ext_cap_ie_hdr[EXT_CAP_IE_HDR_LEN] = {0x7f, 0x9}; + tSirRetStatus status; + + status = lim_strip_extcap_update_struct(mac_ctx, ie_data, + local_ie_len, &default_scan_ext_cap); + if (eSIR_SUCCESS != status) { + lim_log(mac_ctx, LOGE, FL("Strip ext cap fails(%d)"), status); + return QDF_STATUS_E_FAILURE; + } + + qdf_mem_copy(local_ie_buf, ie_data, (*local_ie_len)); + qdf_mem_copy(local_ie_buf + (*local_ie_len), + ext_cap_ie_hdr, EXT_CAP_IE_HDR_LEN); + (*local_ie_len) += EXT_CAP_IE_HDR_LEN; + + wlan_cfg_get_int(mac_ctx, WNI_CFG_DOT11_MODE, &dot11mode); + if (IS_DOT11_MODE_VHT(dot11mode)) + vht_enabled = true; + + status = populate_dot11f_ext_cap(mac_ctx, vht_enabled, + &driver_ext_cap, NULL); + if (eSIR_SUCCESS != status) { + lim_log(mac_ctx, LOGE, FL("Failed(%d) to create ext cap IE. Use default value instead"), + status); + qdf_mem_copy(local_ie_buf + (*local_ie_len), + default_scan_ext_cap.bytes, + DOT11F_IE_EXTCAP_MAX_LEN); + (*local_ie_len) += DOT11F_IE_EXTCAP_MAX_LEN; + return QDF_STATUS_SUCCESS; + } + lim_merge_extcap_struct(&driver_ext_cap, &default_scan_ext_cap); + + qdf_mem_copy(local_ie_buf + (*local_ie_len), + driver_ext_cap.bytes, DOT11F_IE_EXTCAP_MAX_LEN); + (*local_ie_len) += DOT11F_IE_EXTCAP_MAX_LEN; + return QDF_STATUS_SUCCESS; +} diff --git a/core/mac/src/pe/lim/lim_link_monitoring_algo.c b/core/mac/src/pe/lim/lim_link_monitoring_algo.c index 923d9a2d4ffd..9d7b9fe9d936 100644 --- a/core/mac/src/pe/lim/lim_link_monitoring_algo.c +++ b/core/mac/src/pe/lim/lim_link_monitoring_algo.c @@ -457,7 +457,15 @@ void lim_handle_heart_beat_failure(tpAniSirGlobal mac_ctx, if (!mac_ctx->sys.gSysEnableLinkMonitorMode) return; - /* Beacon frame not received within heartbeat timeout. */ + /* Ignore HB if channel switch is in progress */ + if (session->gLimSpecMgmt.dot11hChanSwState == + eLIM_11H_CHANSW_RUNNING) { + lim_log(mac_ctx, LOGE, + FL("Ignore Heartbeat failure as Channel switch is in progress")); + session->pmmOffloadInfo.bcnmiss = false; + return; + } + /* Beacon frame not received within heartbeat timeout. */ lim_log(mac_ctx, LOGW, FL("Heartbeat Failure")); mac_ctx->lim.gLimHBfailureCntInLinkEstState++; diff --git a/core/mac/src/pe/lim/lim_process_action_frame.c b/core/mac/src/pe/lim/lim_process_action_frame.c index 7b8e00944635..df4b83cd9299 100644 --- a/core/mac/src/pe/lim/lim_process_action_frame.c +++ b/core/mac/src/pe/lim/lim_process_action_frame.c @@ -577,7 +577,8 @@ static void __lim_process_operating_mode_action_frame(tpAniSirGlobal mac_ctx, (operating_mode_frm->OperatingMode.rxNSS + 1)) { sta_ptr->vhtSupportedRxNss = operating_mode_frm->OperatingMode.rxNSS + 1; - lim_set_nss_change(mac_ctx, session, sta_ptr->vhtSupportedRxNss, + lim_set_nss_change(mac_ctx, session, + operating_mode_frm->OperatingMode.rxNSS, sta_ptr->staIndex, mac_hdr->sa); } 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 2f0c3f443371..37b326b6e863 100644 --- a/core/mac/src/pe/lim/lim_process_message_queue.c +++ b/core/mac/src/pe/lim/lim_process_message_queue.c @@ -242,6 +242,130 @@ static void lim_process_set_antenna_resp(tpAniSirGlobal mac, void *body) } /** + * lim_update_default_scan_ies() - Update Extended capabilities IE(if present) + * with capabilities of Fine Time measurements(FTM) if set in driver + * + * @mac_ctx: Pointer to Global MAC structure + * @ie_data: Default Scan IE data + * @local_ie_buf: Local Scan IE data + * @local_ie_len: Pointer to length of @ie_data + * + * Return: eSIR_SUCCESS on success, eSIR_FAILURE otherwise + */ +tSirRetStatus lim_update_default_scan_ies(tpAniSirGlobal mac_ctx, + uint8_t *ie_data, uint8_t *local_ie_buf, uint16_t *local_ie_len) +{ + uint32_t dot11mode; + bool vht_enabled = false; + tDot11fIEExtCap default_scan_ext_cap = {0}, driver_ext_cap = {0}; + uint8_t ext_cap_ie_hdr[EXT_CAP_IE_HDR_LEN] = { + DOT11F_EID_EXTCAP, DOT11F_IE_EXTCAP_MAX_LEN}; + tSirRetStatus status; + + status = lim_strip_extcap_update_struct(mac_ctx, ie_data, + local_ie_len, &default_scan_ext_cap); + if (eSIR_SUCCESS != status || + (((*local_ie_len) + EXT_CAP_IE_HDR_LEN + + DOT11F_IE_EXTCAP_MAX_LEN) > MAX_DEFAULT_SCAN_IE_LEN)) { + lim_log(mac_ctx, LOGE, FL("Strip ext cap fails(%d)"), status); + return eSIR_FAILURE; + } + + qdf_mem_copy(local_ie_buf, ie_data, (*local_ie_len)); + qdf_mem_copy(local_ie_buf + (*local_ie_len), + ext_cap_ie_hdr, EXT_CAP_IE_HDR_LEN); + (*local_ie_len) += EXT_CAP_IE_HDR_LEN; + + wlan_cfg_get_int(mac_ctx, WNI_CFG_DOT11_MODE, &dot11mode); + if (IS_DOT11_MODE_VHT(dot11mode)) + vht_enabled = true; + + status = populate_dot11f_ext_cap(mac_ctx, vht_enabled, + &driver_ext_cap, NULL); + if (eSIR_SUCCESS != status) { + lim_log(mac_ctx, LOGE, FL("Update ext cap fails")); + qdf_mem_copy(local_ie_buf + (*local_ie_len), + default_scan_ext_cap.bytes, + DOT11F_IE_EXTCAP_MAX_LEN); + (*local_ie_len) += DOT11F_IE_EXTCAP_MAX_LEN; + return eSIR_SUCCESS; + } + lim_merge_extcap_struct(&driver_ext_cap, &default_scan_ext_cap); + + qdf_mem_copy(local_ie_buf + (*local_ie_len), + driver_ext_cap.bytes, DOT11F_IE_EXTCAP_MAX_LEN); + (*local_ie_len) += DOT11F_IE_EXTCAP_MAX_LEN; + return eSIR_SUCCESS; +} + +/** + * lim_process_set_default_scan_ie_request() - Process the Set default + * Scan IE request from HDD. + * @mac_ctx: Pointer to Global MAC structure + * @msg_buf: Pointer to incoming data + * + * This function receives the default scan IEs and updates the ext cap IE + * (if present) with FTM capabilities and pass the Scan IEs to WMA. + * + * Return: None + */ +static void lim_process_set_default_scan_ie_request(tpAniSirGlobal mac_ctx, + uint32_t *msg_buf) +{ + struct hdd_default_scan_ie *set_ie_params; + struct vdev_ie_info *wma_ie_params; + uint8_t *local_ie_buf; + uint16_t local_ie_len; + tSirMsgQ msg_q; + tSirRetStatus ret_code; + + if (!msg_buf) { + lim_log(mac_ctx, LOGE, FL("msg_buf is NULL")); + return; + } + + set_ie_params = (struct hdd_default_scan_ie *) msg_buf; + local_ie_len = set_ie_params->ie_len; + + local_ie_buf = qdf_mem_malloc(MAX_DEFAULT_SCAN_IE_LEN); + if (!local_ie_buf) { + lim_log(mac_ctx, LOGE, + FL("Scan IE Update fails due to malloc failure")); + return; + } + + if (lim_update_ext_cap_ie(mac_ctx, + (uint8_t *)set_ie_params->ie_data, + local_ie_buf, &local_ie_len)) { + lim_log(mac_ctx, LOGE, FL("Update ext cap IEs fails")); + goto scan_ie_send_fail; + } + + wma_ie_params = qdf_mem_malloc(sizeof(*wma_ie_params) + local_ie_len); + if (!wma_ie_params) { + lim_log(mac_ctx, LOGE, FL("fail to alloc wma_ie_params")); + goto scan_ie_send_fail; + } + wma_ie_params->vdev_id = set_ie_params->session_id; + wma_ie_params->ie_id = DEFAULT_SCAN_IE_ID; + wma_ie_params->length = local_ie_len; + wma_ie_params->data = (uint8_t *)(wma_ie_params) + + sizeof(*wma_ie_params); + qdf_mem_copy(wma_ie_params->data, local_ie_buf, local_ie_len); + + msg_q.type = WMA_SET_IE_INFO; + msg_q.bodyptr = wma_ie_params; + msg_q.bodyval = 0; + ret_code = wma_post_ctrl_msg(mac_ctx, &msg_q); + if (eSIR_SUCCESS != ret_code) { + lim_log(mac_ctx, LOGE, FL("fail to send WMA_SET_IE_INFO")); + qdf_mem_free(wma_ie_params); + } +scan_ie_send_fail: + qdf_mem_free(local_ie_buf); +} + +/** * lim_process_hw_mode_trans_ind() - Process set HW mode transition indication * @mac: Global MAC pointer * @body: Set HW mode response in sir_hw_mode_trans_ind format @@ -1225,6 +1349,8 @@ void lim_process_messages(tpAniSirGlobal mac_ctx, tpSirMsgQ msg) tTdlsLinkEstablishParams *tdls_link_params = NULL; #endif tSirMbMsgP2p *p2p_msg = NULL; + tSirSetActiveModeSetBncFilterReq *bcn_filter_req = NULL; + if (ANI_DRIVER_TYPE(mac_ctx) == eDRIVER_TYPE_MFG) { qdf_mem_free(msg->bodyptr); msg->bodyptr = NULL; @@ -1381,6 +1507,7 @@ void lim_process_messages(tpAniSirGlobal mac_ctx, tpSirMsgQ msg) } break; case eWNI_SME_PDEV_SET_HT_VHT_IE: + case eWNI_SME_SET_VDEV_IES_PER_BAND: case eWNI_SME_SYS_READY_IND: case eWNI_SME_JOIN_REQ: case eWNI_SME_REASSOC_REQ: @@ -1396,7 +1523,7 @@ void lim_process_messages(tpAniSirGlobal mac_ctx, tpSirMsgQ msg) case eWNI_SME_GET_ASSOC_STAS_REQ: case eWNI_SME_TKIP_CNTR_MEAS_REQ: case eWNI_SME_UPDATE_APWPSIE_REQ: - case eWNI_SME_HIDE_SSID_REQ: + case eWNI_SME_SESSION_UPDATE_PARAM: case eWNI_SME_GET_WPSPBC_SESSION_REQ: case eWNI_SME_SET_APWPARSNIEs_REQ: case eWNI_SME_CHNG_MCC_BEACON_INTERVAL: @@ -1417,6 +1544,7 @@ void lim_process_messages(tpAniSirGlobal mac_ctx, tpSirMsgQ msg) #endif /* FEATURE_WLAN_ESE */ case eWNI_SME_REGISTER_MGMT_FRAME_CB: case eWNI_SME_EXT_CHANGE_CHANNEL: + case eWNI_SME_ROAM_SCAN_OFFLOAD_REQ: case eWNI_SME_NDP_INITIATOR_REQ: case eWNI_SME_NDP_RESPONDER_REQ: case eWNI_SME_NDP_END_REQ: @@ -1731,8 +1859,10 @@ void lim_process_messages(tpAniSirGlobal mac_ctx, tpSirMsgQ msg) msg->bodyptr = NULL; break; case eWNI_SME_SET_BCN_FILTER_REQ: - session_id = (uint8_t) msg->bodyval; - session_entry = &mac_ctx->lim.gpSession[session_id]; + bcn_filter_req = + (tSirSetActiveModeSetBncFilterReq *) msg->bodyptr; + session_entry = pe_find_session_by_bssid(mac_ctx, + bcn_filter_req->bssid.bytes, &session_id); if ((session_entry != NULL) && (lim_send_beacon_filter_info(mac_ctx, session_entry) != eSIR_SUCCESS)) @@ -1894,6 +2024,11 @@ void lim_process_messages(tpAniSirGlobal mac_ctx, tpSirMsgQ msg) qdf_mem_free((void *)msg->bodyptr); msg->bodyptr = NULL; break; + case eWNI_SME_DEFAULT_SCAN_IE: + lim_process_set_default_scan_ie_request(mac_ctx, msg->bodyptr); + qdf_mem_free((void *)msg->bodyptr); + msg->bodyptr = NULL; + break; default: qdf_mem_free((void *)msg->bodyptr); msg->bodyptr = NULL; 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 cdc49061fe9c..9082aecadb68 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 @@ -531,7 +531,7 @@ void lim_process_mlm_auth_cnf(tpAniSirGlobal mac_ctx, uint32_t *msg) return; } - if (((tLimMlmAuthCnf *) msg)->resultCode == eSIR_SME_SUCCESS) { + if (auth_cnf->resultCode == eSIR_SME_SUCCESS) { if (session_entry->limSmeState == eLIM_SME_WT_AUTH_STATE) { lim_send_mlm_assoc_req(mac_ctx, session_entry); } else { @@ -568,9 +568,10 @@ void lim_process_mlm_auth_cnf(tpAniSirGlobal mac_ctx, uint32_t *msg) } if ((auth_type == eSIR_AUTO_SWITCH) && - (((tLimMlmAuthCnf *) msg)->authType == eSIR_SHARED_KEY) - && (eSIR_MAC_AUTH_ALGO_NOT_SUPPORTED_STATUS == - ((tLimMlmAuthCnf *) msg)->protStatusCode)) { + (auth_cnf->authType == eSIR_SHARED_KEY) && + ((eSIR_MAC_AUTH_ALGO_NOT_SUPPORTED_STATUS == + auth_cnf->protStatusCode) || + (auth_cnf->resultCode == eSIR_SME_AUTH_TIMEOUT_RESULT_CODE))) { /* * When shared authentication fails with reason * code "13" and authType set to 'auto switch', @@ -634,8 +635,8 @@ void lim_process_mlm_auth_cnf(tpAniSirGlobal mac_ctx, uint32_t *msg) * auth failure to Host. */ lim_handle_sme_join_result(mac_ctx, - ((tLimMlmAuthCnf *)msg)->resultCode, - ((tLimMlmAuthCnf *)msg)->protStatusCode, + auth_cnf->resultCode, + auth_cnf->protStatusCode, session_entry); } else { /* @@ -2483,11 +2484,6 @@ lim_process_sta_mlm_add_bss_rsp(tpAniSirGlobal mac_ctx, goto end; } - if (lim_send_ht_vht_ie(mac_ctx, session_entry) != - QDF_STATUS_SUCCESS) - lim_log(mac_ctx, LOGE, - FL("Unable to send HT/VHT Cap to FW")); - /* Set MLME state */ session_entry->limMlmState = eLIM_MLM_WT_ADD_STA_RSP_STATE; MTRACE(mac_trace(mac_ctx, TRACE_CODE_MLM_STATE, 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 006aaba04ca6..347198956135 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 @@ -1934,16 +1934,12 @@ __lim_process_sme_join_req(tpAniSirGlobal mac_ctx, uint32_t *msg_buf) session->htConfig.ht_tx_stbc = 0; } -#ifdef FEATURE_WLAN_ESE session->maxTxPower = lim_get_max_tx_power(reg_max, local_power_constraint, mac_ctx->roam.configParam.nTxPowerCap); -#else - session->maxTxPower = - QDF_MIN(reg_max, (local_power_constraint)); -#endif + lim_log(mac_ctx, LOG1, - FL("Reg max = %d, local power con = %d, max tx = %d"), + FL("Reg max %d local power con %d max tx pwr %d"), reg_max, local_power_constraint, session->maxTxPower); if (session->gLimCurrentBssUapsd) { @@ -4144,46 +4140,125 @@ lim_send_vdev_restart(tpAniSirGlobal pMac, } } -static void __lim_process_sme_hide_ssid(tpAniSirGlobal pMac, uint32_t *pMsgBuf) +/** + * __lim_process_roam_scan_offload_req() - Process Roam scan offload from csr + * @mac_ctx: Pointer to Global MAC structure + * @msg_buf: Pointer to SME message buffer + * + * Return: None + */ +static void __lim_process_roam_scan_offload_req(tpAniSirGlobal mac_ctx, + uint32_t *msg_buf) { - tpSirUpdateParams pUpdateParams; - tpPESession psessionEntry; + tpPESession pe_session; + tSirMsgQ wma_msg; + tSirRetStatus status; + tSirRoamOffloadScanReq *req_buffer; + uint16_t local_ie_len; + uint8_t *local_ie_buf; - PELOG1(lim_log(pMac, LOG1, FL("received HIDE_SSID message"));); + req_buffer = (tSirRoamOffloadScanReq *)msg_buf; + pe_session = pe_find_session_by_sme_session_id(mac_ctx, + req_buffer->sessionId); - if (pMsgBuf == NULL) { - lim_log(pMac, LOGE, FL("Buffer is Pointing to NULL")); + local_ie_buf = qdf_mem_malloc(MAX_DEFAULT_SCAN_IE_LEN); + if (!local_ie_buf) { + lim_log(mac_ctx, LOGE, FL("Mem Alloc failed for local_ie_buf")); return; } - pUpdateParams = (tpSirUpdateParams) pMsgBuf; + local_ie_len = req_buffer->assoc_ie.length; + /* Update ext cap IE if present */ + if (local_ie_len && + !lim_update_ext_cap_ie(mac_ctx, req_buffer->assoc_ie.addIEdata, + local_ie_buf, &local_ie_len)) { + req_buffer->assoc_ie.length = local_ie_len; + qdf_mem_copy(req_buffer->assoc_ie.addIEdata, local_ie_buf, + local_ie_len); + } + qdf_mem_free(local_ie_buf); - psessionEntry = pe_find_session_by_sme_session_id(pMac, - pUpdateParams->sessionId); - if (psessionEntry == NULL) { - lim_log(pMac, LOGW, - "Session does not exist for given sessionId %d", - pUpdateParams->sessionId); - return; + wma_msg.type = WMA_ROAM_SCAN_OFFLOAD_REQ; + wma_msg.bodyptr = req_buffer; + + status = wma_post_ctrl_msg(mac_ctx, &wma_msg); + if (eSIR_SUCCESS != status) { + lim_log(mac_ctx, LOGE, + FL("Posting WMA_ROAM_SCAN_OFFLOAD_REQ failed")); + qdf_mem_free(req_buffer); } +} - if (psessionEntry->ssidHidden != pUpdateParams->ssidHidden) { - /* Update the session entry */ - psessionEntry->ssidHidden = pUpdateParams->ssidHidden; - } else { - lim_log(pMac, LOG1, FL("Same config already present!")); +/* + * lim_handle_update_ssid_hidden() - Processes SSID hidden update + * @mac_ctx: Pointer to global mac context + * @session: Pointer to PE session + * @ssid_hidden: SSID hidden value to set; 0 - Broadcast SSID, + * 1 - Disable broadcast SSID + * + * Return: None + */ +static void lim_handle_update_ssid_hidden(tpAniSirGlobal mac_ctx, + tpPESession session, uint8_t ssid_hidden) +{ + lim_log(mac_ctx, LOG1, FL("received HIDE_SSID message")); + if (ssid_hidden != session->ssidHidden) + session->ssidHidden = ssid_hidden; + else { + lim_log(mac_ctx, LOG1, FL("Same config already present!")); return; } /* Send vdev restart */ - lim_send_vdev_restart(pMac, psessionEntry, pUpdateParams->sessionId); + lim_send_vdev_restart(mac_ctx, session, session->smeSessionId); /* Update beacon */ - sch_set_fixed_beacon_fields(pMac, psessionEntry); - lim_send_beacon_ind(pMac, psessionEntry); + sch_set_fixed_beacon_fields(mac_ctx, session); + lim_send_beacon_ind(mac_ctx, session); return; -} /*** end __lim_process_sme_hide_ssid(tpAniSirGlobal pMac, uint32_t *pMsgBuf) ***/ +} + +/** + * __lim_process_sme_session_update - process SME session update msg + * + * @mac_ctx: Pointer to global mac context + * @msg_buf: Pointer to the received message buffer + * + * Return: None + */ +static void __lim_process_sme_session_update(tpAniSirGlobal mac_ctx, + uint32_t *msg_buf) +{ + struct sir_update_session_param *msg; + tpPESession session; + + if (!msg_buf) { + lim_log(mac_ctx, LOGE, FL("Buffer is Pointing to NULL")); + return; + } + + msg = (struct sir_update_session_param *) msg_buf; + + session = pe_find_session_by_sme_session_id(mac_ctx, msg->session_id); + if (!session) { + lim_log(mac_ctx, LOGW, + "Session does not exist for given sessionId %d", + msg->session_id); + return; + } + + lim_log(mac_ctx, LOG1, FL("received SME Session update for %d val %d"), + msg->param_type, msg->param_val); + switch (msg->param_type) { + case SIR_PARAM_SSID_HIDDEN: + lim_handle_update_ssid_hidden(mac_ctx, session, msg->param_val); + break; + default: + lim_log(mac_ctx, LOGE, FL("Unknown session param")); + break; + } +} static void __lim_process_sme_set_wparsni_es(tpAniSirGlobal pMac, uint32_t *pMsgBuf) { @@ -4962,6 +5037,35 @@ static void lim_set_pdev_vht_ie(tpAniSirGlobal mac_ctx, uint8_t pdev_id, } /** + * lim_process_set_vdev_ies_per_band() - process the set vdev IE req + * @mac_ctx: Pointer to Global MAC structure + * @msg_buf: Pointer to the SME message buffer + * + * This function is called by limProcessMessageQueue(). This function sets the + * VDEV IEs to the FW. + * + * Return: None + */ +static void lim_process_set_vdev_ies_per_band(tpAniSirGlobal mac_ctx, + uint32_t *msg_buf) +{ + struct sir_set_vdev_ies_per_band *p_msg = + (struct sir_set_vdev_ies_per_band *)msg_buf; + + if (NULL == p_msg) { + lim_log(mac_ctx, LOGE, FL("NULL p_msg")); + return; + } + + lim_log(mac_ctx, LOG1, FL("rcvd set vdev ie per band req vdev_id = %d"), + p_msg->vdev_id); + /* intentionally using NULL here so that self capabilty are sent */ + if (lim_send_ies_per_band(mac_ctx, NULL, p_msg->vdev_id) != + QDF_STATUS_SUCCESS) + lim_log(mac_ctx, LOGE, FL("Unable to send HT/VHT Cap to FW")); +} + +/** * lim_process_set_pdev_IEs() - process the set pdev IE req * @mac_ctx: Pointer to Global MAC structure * @msg_buf: Pointer to the SME message buffer @@ -5181,8 +5285,12 @@ bool lim_process_sme_req_messages(tpAniSirGlobal pMac, tpSirMsgQ pMsg) lim_process_tkip_counter_measures(pMac, pMsgBuf); break; - case eWNI_SME_HIDE_SSID_REQ: - __lim_process_sme_hide_ssid(pMac, pMsgBuf); + case eWNI_SME_SESSION_UPDATE_PARAM: + __lim_process_sme_session_update(pMac, pMsgBuf); + break; + case eWNI_SME_ROAM_SCAN_OFFLOAD_REQ: + __lim_process_roam_scan_offload_req(pMac, pMsgBuf); + bufConsumed = false; break; case eWNI_SME_UPDATE_APWPSIE_REQ: __lim_process_sme_update_apwpsi_es(pMac, pMsgBuf); @@ -5285,6 +5393,10 @@ bool lim_process_sme_req_messages(tpAniSirGlobal pMac, tpSirMsgQ pMsg) break; case eWNI_SME_PDEV_SET_HT_VHT_IE: lim_process_set_pdev_IEs(pMac, pMsgBuf); + break; + case eWNI_SME_SET_VDEV_IES_PER_BAND: + lim_process_set_vdev_ies_per_band(pMac, pMsgBuf); + break; case eWNI_SME_NDP_END_REQ: case eWNI_SME_NDP_INITIATOR_REQ: case eWNI_SME_NDP_RESPONDER_REQ: diff --git a/core/mac/src/pe/lim/lim_prop_exts_utils.c b/core/mac/src/pe/lim/lim_prop_exts_utils.c index b5a14336e07a..26aa7ca55e9f 100644 --- a/core/mac/src/pe/lim/lim_prop_exts_utils.c +++ b/core/mac/src/pe/lim/lim_prop_exts_utils.c @@ -56,6 +56,38 @@ #include "wma.h" #define LIM_GET_NOISE_MAX_TRY 5 + +/** + * get_local_power_constraint_probe_response() - extracts local constraint + * from probe response + * @beacon_struct: beacon structure + * @local_constraint: local constraint pointer + * @session: A pointer to session entry. + * + * Return: None + */ +#ifdef FEATURE_WLAN_ESE +static void get_local_power_constraint_probe_response( + tpSirProbeRespBeacon beacon_struct, + int8_t *local_constraint, + tpPESession session) +{ + if (beacon_struct->eseTxPwr.present) + *local_constraint = + beacon_struct->eseTxPwr.power_limit; + session->is_ese_version_ie_present = + beacon_struct->is_ese_ver_ie_present; +} +#else +static void get_local_power_constraint_probe_response( + tpSirProbeRespBeacon beacon_struct, + int8_t *local_constraint, + tpPESession session) +{ + +} +#endif + /** * lim_extract_ap_capability() - extract AP's HCF/WME/WSM capability * @mac_ctx: Pointer to Global MAC structure @@ -289,20 +321,16 @@ lim_extract_ap_capability(tpAniSirGlobal mac_ctx, uint8_t *p_ie, /* Extract the UAPSD flag from WMM Parameter element */ if (beacon_struct->wmeEdcaPresent) *uapsd = beacon_struct->edcaParams.qosInfo.uapsd; -#if defined FEATURE_WLAN_ESE - /* If there is Power Constraint Element specifically, - * adapt to it. Hence there is else condition check - * for this if statement. - */ - if (beacon_struct->eseTxPwr.present) - *local_constraint = beacon_struct->eseTxPwr.power_limit; - session->is_ese_version_ie_present = - beacon_struct->is_ese_ver_ie_present; -#endif - if (beacon_struct->powerConstraintPresent) { - *local_constraint -= - beacon_struct->localPowerConstraint. - localPowerConstraints; + + if (mac_ctx->roam.configParam.allow_tpc_from_ap) { + if (beacon_struct->powerConstraintPresent) { + *local_constraint -= + beacon_struct->localPowerConstraint. + localPowerConstraints; + } else { + get_local_power_constraint_probe_response( + beacon_struct, local_constraint, session); + } } session->country_info_present = false; /* Initializing before first use */ diff --git a/core/mac/src/pe/lim/lim_send_management_frames.c b/core/mac/src/pe/lim/lim_send_management_frames.c index 0643ddcd6463..93408fc9f590 100644 --- a/core/mac/src/pe/lim/lim_send_management_frames.c +++ b/core/mac/src/pe/lim/lim_send_management_frames.c @@ -1781,6 +1781,8 @@ lim_send_assoc_req_mgmt_frame(tpAniSirGlobal mac_ctx, mac_ctx->lim.htCapabilityPresentInBeacon) { lim_log(mac_ctx, LOG1, FL("Populate HT Caps in Assoc Request")); populate_dot11f_ht_caps(mac_ctx, pe_session, &frm->HTCaps); + QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG, + &frm->HTCaps, sizeof(frm->HTCaps)); } lim_log(mac_ctx, LOG1, FL("SupportedChnlWidth: %d, mimoPS: %d, GF: %d, short GI20:%d, shortGI40: %d, dsssCck: %d, AMPDU Param: %x"), @@ -1795,6 +1797,8 @@ lim_send_assoc_req_mgmt_frame(tpAniSirGlobal mac_ctx, pe_session->vhtCapabilityPresentInBeacon) { lim_log(mac_ctx, LOG1, FL("Populate VHT IEs in Assoc Request")); populate_dot11f_vht_caps(mac_ctx, pe_session, &frm->VHTCaps); + QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG, + &frm->VHTCaps, sizeof(frm->VHTCaps)); vht_enabled = true; if (pe_session->enableHtSmps && !pe_session->supported_nss_1x1) { diff --git a/core/mac/src/pe/lim/lim_utils.c b/core/mac/src/pe/lim/lim_utils.c index ad5c53a7d0e6..420f7c4e30aa 100644 --- a/core/mac/src/pe/lim/lim_utils.c +++ b/core/mac/src/pe/lim/lim_utils.c @@ -2013,17 +2013,23 @@ void lim_process_channel_switch_timeout(tpAniSirGlobal pMac) psessionEntry = pe_find_session_by_session_id(pMac, pMac->lim.limTimers.gLimChannelSwitchTimer.sessionId); if (psessionEntry == NULL) { - lim_log(pMac, LOGP, + lim_log(pMac, LOGE, FL("Session Does not exist for given sessionID")); return; } if (!LIM_IS_STA_ROLE(psessionEntry)) { - PELOGW(lim_log - (pMac, LOGW, + lim_log(pMac, LOGW, "Channel switch can be done only in STA role, Current Role = %d", GET_LIM_SYSTEM_ROLE(psessionEntry)); - ) + return; + } + + if (psessionEntry->gLimSpecMgmt.dot11hChanSwState != + eLIM_11H_CHANSW_RUNNING) { + lim_log(pMac, LOGW, + FL("Channel switch timer should not have been running in state %d"), + psessionEntry->gLimSpecMgmt.dot11hChanSwState); return; } @@ -2048,15 +2054,22 @@ void lim_process_channel_switch_timeout(tpAniSirGlobal pMac) return; } - /* If the channel-list that AP is asking us to switch is invalid, + /* + * If the channel-list that AP is asking us to switch is invalid * then we cannot switch the channel. Just disassociate from AP. * We will find a better AP !!! */ - lim_tear_down_link_with_ap(pMac, + if ((psessionEntry->limMlmState == + eLIM_MLM_LINK_ESTABLISHED_STATE) && + (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE) && + (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE)) { + lim_log(pMac, LOGE, FL("Invalid channel! Disconnect")); + lim_tear_down_link_with_ap(pMac, pMac->lim.limTimers. gLimChannelSwitchTimer.sessionId, eSIR_MAC_UNSPEC_FAILURE_REASON); - return; + return; + } } lim_covert_channel_scan_type(pMac, psessionEntry->currentOperChannel, false); @@ -6498,136 +6511,79 @@ QDF_STATUS lim_send_ie(tpAniSirGlobal mac_ctx, uint32_t sme_session_id, } /** - * lim_populate_ht_caps_from_hw_caps() - gets HTCAPs IE from session, then - * updates, HTCAPs 16 bit from hw caps - * @mac_ctx: global MAC context - * @session: pe session - * @ht_caps: HTCAPs struct to populate - * @hw_caps: hw caps - * - * This funciton sends the IE data to WMA. + * lim_get_rx_ldpc() - gets ldpc setting for given channel(band) + * @mac_ctx: global mac context + * @ch: channel for which ldpc setting is required * - * Return: status of operation + * Return: true if enabled and false otherwise */ -QDF_STATUS lim_populate_ht_caps_from_hw_caps(tpAniSirGlobal mac_ctx, - tpPESession session, - tDot11fIEHTCaps *ht_caps, - uint32_t hw_caps) +static inline bool lim_get_rx_ldpc(tpAniSirGlobal mac_ctx, uint8_t ch) { - tSirRetStatus status; - - if (!mac_ctx) { - QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_ERROR, - FL("mac_ctx is NULL")); - return QDF_STATUS_E_INVAL; - } - - /* following functions that use session can take NULL */ - status = populate_dot11f_ht_caps(mac_ctx, session, ht_caps); - if (eSIR_SUCCESS != status) { - lim_log(mac_ctx, LOGE, FL("Failed to populate ht cap IE")); - return QDF_STATUS_E_FAILURE; - } - - ht_caps->rxSTBC = !!(hw_caps & WMI_HT_CAP_RX_STBC); - ht_caps->txSTBC = !!(hw_caps & WMI_HT_CAP_TX_STBC); - ht_caps->advCodingCap = !!(hw_caps & WMI_HT_CAP_RX_LDPC); - ht_caps->shortGI20MHz = !!(hw_caps & WMI_HT_CAP_HT20_SGI); - ht_caps->shortGI40MHz = !!(hw_caps & WMI_HT_CAP_HT40_SGI); - return QDF_STATUS_SUCCESS; -} - -/** - * lim_populate_vht_caps_from_hw_caps() - gets VHTCAPs IE from session, then - * updates, HTCAPs 16 bit from hw caps - * @mac_ctx: global MAC context - * @session: pe session - * @vht_caps: VHTCAPs struct to populate - * @hw_caps: hw caps - * - * This funciton sends the IE data to WMA. - * - * Return: status of operation - */ -QDF_STATUS lim_populate_vht_caps_from_hw_caps(tpAniSirGlobal mac_ctx, - tpPESession session, - tDot11fIEVHTCaps *vht_caps, - uint32_t hw_caps) -{ - uint8_t *ie_buff = (uint8_t *)vht_caps; - tSirRetStatus status; - - if (!mac_ctx) { - QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_ERROR, - FL("mac_ctx is NULL")); - return QDF_STATUS_E_INVAL; - } - - /* following functions that use session can take NULL */ - status = populate_dot11f_vht_caps(mac_ctx, session, vht_caps); - if (eSIR_SUCCESS != status) { - lim_log(mac_ctx, LOGE, FL("Failed to populate vht cap IE")); - return QDF_STATUS_E_FAILURE; - } - - *((uint32_t *)(ie_buff + 1)) = hw_caps; - return QDF_STATUS_SUCCESS; + if (mac_ctx->roam.configParam.rxLdpcEnable && + wma_is_rx_ldpc_supported_for_channel(CDS_CHANNEL_NUM(ch))) + return true; + else + return false; } /** - * lim_send_ht_vht_ie() - gets ht and vht capability and send to firmware via + * lim_send_ies_per_band() - gets ht and vht capability and send to firmware via * wma - * updates, HTCAPs 16 bit from hw caps - * @session: pe session + * @mac_ctx: global mac context + * @session: pe session. This can be NULL. In that case self cap will be sent + * @vdev_id: vdev for which IE is targeted * * This funciton gets ht and vht capability and send to firmware via wma * * Return: status of operation */ -QDF_STATUS lim_send_ht_vht_ie(tpAniSirGlobal mac_ctx, tpPESession session) +QDF_STATUS lim_send_ies_per_band(tpAniSirGlobal mac_ctx, + tpPESession session, + uint8_t vdev_id) { - uint8_t *ie_buff; - tDot11fIEHTCaps ht_caps; - tDot11fIEVHTCaps vht_caps; - struct wma_caps_per_phy caps_2g; - struct wma_caps_per_phy caps_5g; - - if (wma_is_dbs_enable()) { - wma_get_caps_for_phyidx_hwmode(&caps_2g, HW_MODE_DBS, - CDS_BAND_2GHZ); - wma_get_caps_for_phyidx_hwmode(&caps_5g, HW_MODE_DBS, - CDS_BAND_5GHZ); - } else { - wma_get_caps_for_phyidx_hwmode(&caps_2g, HW_MODE_DBS_NONE, - CDS_BAND_2GHZ); - wma_get_caps_for_phyidx_hwmode(&caps_5g, HW_MODE_DBS_NONE, - CDS_BAND_5GHZ); - } - lim_log(mac_ctx, LOG1, - FL("HT Caps: 2G: 0x%X, 5G: 0x%X, VHT Caps: 2G: 0x%X, 5G: 0x%X"), - caps_2g.ht_2g, caps_5g.ht_5g, caps_2g.vht_2g, caps_5g.vht_5g); - - ie_buff = (uint8_t *)&ht_caps; - lim_populate_ht_caps_from_hw_caps(mac_ctx, session, - &ht_caps, caps_2g.ht_2g); - lim_send_ie(mac_ctx, session->smeSessionId, DOT11F_EID_HTCAPS, - CDS_BAND_2GHZ, ie_buff + 1, DOT11F_IE_HTCAPS_MIN_LEN); - - lim_populate_ht_caps_from_hw_caps(mac_ctx, session, - &ht_caps, caps_5g.ht_5g); - lim_send_ie(mac_ctx, session->smeSessionId, DOT11F_EID_HTCAPS, - CDS_BAND_5GHZ, ie_buff + 1, DOT11F_IE_HTCAPS_MIN_LEN); - - ie_buff = (uint8_t *)&vht_caps; - lim_populate_vht_caps_from_hw_caps(mac_ctx, session, - &vht_caps, caps_2g.vht_2g); - lim_send_ie(mac_ctx, session->smeSessionId, DOT11F_EID_VHTCAPS, - CDS_BAND_2GHZ, ie_buff + 1, DOT11F_IE_VHTCAPS_MAX_LEN); - - lim_populate_vht_caps_from_hw_caps(mac_ctx, session, - &vht_caps, caps_5g.vht_5g); - lim_send_ie(mac_ctx, session->smeSessionId, DOT11F_EID_VHTCAPS, - CDS_BAND_5GHZ, ie_buff + 1, DOT11F_IE_VHTCAPS_MAX_LEN); + uint8_t ht_caps[DOT11F_IE_HTCAPS_MIN_LEN + 2] = {0}; + uint8_t vht_caps[DOT11F_IE_VHTCAPS_MAX_LEN + 2] = {0}; + tHtCaps *p_ht_cap = (tHtCaps *)ht_caps; + tSirMacVHTCapabilityInfo *p_vht_cap = + (tSirMacVHTCapabilityInfo *)vht_caps; + + /* + * Note: Do not use Dot11f VHT structure, since 1 byte present flag in + * it is causing weird padding errors. Instead use Sir Mac VHT struct + * to send IE to wma. + */ + ht_caps[0] = DOT11F_EID_HTCAPS; + ht_caps[1] = DOT11F_IE_HTCAPS_MIN_LEN; + lim_set_ht_caps(mac_ctx, session, ht_caps, + DOT11F_IE_HTCAPS_MIN_LEN + 2); + /* Get LDPC and over write for 2G */ + p_ht_cap->advCodingCap = lim_get_rx_ldpc(mac_ctx, CHAN_ENUM_6); + lim_send_ie(mac_ctx, vdev_id, DOT11F_EID_HTCAPS, + CDS_BAND_2GHZ, &ht_caps[2], DOT11F_IE_HTCAPS_MIN_LEN); + /* + * Get LDPC and over write for 5G - using channel 64 because it + * is available in all reg domains. + */ + p_ht_cap->advCodingCap = lim_get_rx_ldpc(mac_ctx, CHAN_ENUM_64); + lim_send_ie(mac_ctx, vdev_id, DOT11F_EID_HTCAPS, + CDS_BAND_5GHZ, &ht_caps[2], DOT11F_IE_HTCAPS_MIN_LEN); + + vht_caps[0] = DOT11F_EID_VHTCAPS; + vht_caps[1] = DOT11F_IE_VHTCAPS_MAX_LEN; + /* Get LDPC and over write for 2G */ + lim_set_vht_caps(mac_ctx, session, vht_caps, + DOT11F_IE_VHTCAPS_MIN_LEN + 2); + p_vht_cap->ldpcCodingCap = lim_get_rx_ldpc(mac_ctx, CHAN_ENUM_6); + lim_send_ie(mac_ctx, vdev_id, DOT11F_EID_VHTCAPS, + CDS_BAND_2GHZ, &vht_caps[2], DOT11F_IE_VHTCAPS_MIN_LEN); + + /* + * Get LDPC and over write for 5G - using channel 64 because it + * is available in all reg domains. + */ + p_vht_cap->ldpcCodingCap = lim_get_rx_ldpc(mac_ctx, CHAN_ENUM_64); + lim_send_ie(mac_ctx, vdev_id, DOT11F_EID_VHTCAPS, + CDS_BAND_5GHZ, &vht_caps[2], DOT11F_IE_VHTCAPS_MIN_LEN); return QDF_STATUS_SUCCESS; } diff --git a/core/mac/src/pe/lim/lim_utils.h b/core/mac/src/pe/lim/lim_utils.h index 572d35b91ee6..6c26d923518f 100644 --- a/core/mac/src/pe/lim/lim_utils.h +++ b/core/mac/src/pe/lim/lim_utils.h @@ -574,17 +574,8 @@ void lim_check_and_reset_protection_params(tpAniSirGlobal mac_ctx); QDF_STATUS lim_send_ext_cap_ie(tpAniSirGlobal mac_ctx, uint32_t session_id, tDot11fIEExtCap *extracted_extcap, bool merge); -QDF_STATUS lim_populate_vht_caps_from_hw_caps(tpAniSirGlobal mac_ctx, - tpPESession session, - tDot11fIEVHTCaps *vht_caps, - uint32_t hw_caps); - -QDF_STATUS lim_populate_ht_caps_from_hw_caps(tpAniSirGlobal mac_ctx, - tpPESession session, - tDot11fIEHTCaps *ht_caps, - uint32_t hw_caps); - -QDF_STATUS lim_send_ht_vht_ie(tpAniSirGlobal mac_ctx, tpPESession session); +QDF_STATUS lim_send_ies_per_band(tpAniSirGlobal mac_ctx, + tpPESession session, uint8_t vdev_id); tSirRetStatus lim_strip_extcap_ie(tpAniSirGlobal mac_ctx, uint8_t *addn_ie, uint16_t *addn_ielen, uint8_t *extracted_extcap); diff --git a/core/mac/src/pe/sch/sch_beacon_process.c b/core/mac/src/pe/sch/sch_beacon_process.c index 7978ec11542a..9fa411a2be14 100644 --- a/core/mac/src/pe/sch/sch_beacon_process.c +++ b/core/mac/src/pe/sch/sch_beacon_process.c @@ -494,8 +494,7 @@ void update_nss(tpAniSirGlobal mac_ctx, tpDphHashNode sta_ds, tpSirMacMgmtHdr mgmt_hdr) { if (sta_ds->vhtSupportedRxNss != (beacon->OperatingMode.rxNSS + 1)) { - sta_ds->vhtSupportedRxNss = - beacon->OperatingMode.rxNSS + 1; + sta_ds->vhtSupportedRxNss = beacon->OperatingMode.rxNSS; lim_set_nss_change(mac_ctx, session_entry, sta_ds->vhtSupportedRxNss, sta_ds->staIndex, mgmt_hdr->sa); @@ -672,6 +671,31 @@ sch_bcn_process_sta_ibss(tpAniSirGlobal mac_ctx, return; } +/** + * get_local_power_constraint_beacon() - extracts local constraint + * from beacon + * @bcn: beacon structure + * @local_constraint: local constraint pointer + * + * Return: None + */ +#ifdef FEATURE_WLAN_ESE +static void get_local_power_constraint_beacon( + tpSchBeaconStruct bcn, + int8_t *local_constraint) +{ + if (bcn->eseTxPwr.present) + *local_constraint = bcn->eseTxPwr.power_limit; +} +#else +static void get_local_power_constraint_beacon( + tpSchBeaconStruct bcn, + int8_t *local_constraint) +{ + +} +#endif + /* * __sch_beacon_process_for_session() - Process the received beacon frame when * station is not scanning and corresponding session is found @@ -716,12 +740,11 @@ static void __sch_beacon_process_for_session(tpAniSirGlobal mac_ctx, uint8_t *rx_pkt_info, tpPESession session) { - int8_t localRRMConstraint = 0; uint8_t bssIdx = 0; tUpdateBeaconParams beaconParams; uint8_t sendProbeReq = false; tpSirMacMgmtHdr pMh = WMA_GET_RX_MAC_HEADER(rx_pkt_info); - int8_t regMax = 0, maxTxPower = 0; + int8_t regMax = 0, maxTxPower = 0, local_constraint; qdf_mem_zero(&beaconParams, sizeof(tUpdateBeaconParams)); beaconParams.paramChangeBitmap = 0; @@ -766,35 +789,35 @@ static void __sch_beacon_process_for_session(tpAniSirGlobal mac_ctx, regMax = cfg_get_regulatory_max_transmit_power(mac_ctx, session->currentOperChannel); - if (mac_ctx->rrm.rrmPEContext.rrmEnable - && bcn->powerConstraintPresent) - localRRMConstraint = - bcn->localPowerConstraint.localPowerConstraints; - else - localRRMConstraint = 0; - maxTxPower = lim_get_max_tx_power(regMax, regMax - localRRMConstraint, - mac_ctx->roam.configParam.nTxPowerCap); + local_constraint = regMax; -#if defined FEATURE_WLAN_ESE - if (session->isESEconnection) { - int8_t localESEConstraint = 0; - if (bcn->eseTxPwr.present) { - localESEConstraint = bcn->eseTxPwr.power_limit; - maxTxPower = lim_get_max_tx_power(maxTxPower, - localESEConstraint, - mac_ctx->roam.configParam.nTxPowerCap); - } - sch_log(mac_ctx, LOG1, - FL("RegMax = %d, localEseCons = %d, MaxTx = %d"), - regMax, localESEConstraint, maxTxPower); + if (mac_ctx->roam.configParam.allow_tpc_from_ap) { + get_local_power_constraint_beacon(bcn, &local_constraint); + sch_log(mac_ctx, LOG1, "ESE localPowerConstraint = %d,", + local_constraint); + + if (mac_ctx->rrm.rrmPEContext.rrmEnable && + bcn->powerConstraintPresent) { + local_constraint = regMax; + local_constraint -= + bcn->localPowerConstraint.localPowerConstraints; + sch_log(mac_ctx, LOG1, "localPowerConstraint = %d,", + local_constraint); + } } -#endif + + maxTxPower = lim_get_max_tx_power(regMax, local_constraint, + mac_ctx->roam.configParam.nTxPowerCap); + + sch_log(mac_ctx, LOG1, "RegMax = %d, MaxTx pwr = %d", + regMax, maxTxPower); + /* If maxTxPower is increased or decreased */ if (maxTxPower != session->maxTxPower) { sch_log(mac_ctx, LOG1, - FL("Local power constraint change..updating new maxTx power %d to HAL"), - maxTxPower); + FL("Local power constraint change, Updating new maxTx power %d from old pwr %d"), + maxTxPower, session->maxTxPower); if (lim_send_set_max_tx_power_req(mac_ctx, maxTxPower, session) == eSIR_SUCCESS) session->maxTxPower = maxTxPower; diff --git a/core/mac/src/sys/legacy/src/utils/src/dot11f.c b/core/mac/src/sys/legacy/src/utils/src/dot11f.c index 9b7206c3fe68..d5068aae9b91 100644 --- a/core/mac/src/sys/legacy/src/utils/src/dot11f.c +++ b/core/mac/src/sys/legacy/src/utils/src/dot11f.c @@ -25,7 +25,7 @@ * to the Linux Foundation. */ - /* +/* * \file dot11f.c * * \brief Structures, functions & definitions for @@ -33,7 +33,7 @@ * * * This file was automatically generated by 'framesc' - * Mon Aug 29 23:01:24 2016 from the following file(s): + * Mon Sep 19 14:42:34 2016 from the following file(s): * * dot11f.frms * @@ -5849,9 +5849,6 @@ uint32_t dot11f_unpack_ie_hs20vendor_ie(tpAniSirGlobal pCtx, if (pDst->present) status = DOT11F_DUPLICATE_IE; pDst->present = 1; - pDst->type = *pBuf; - pBuf += 1; - ielen -= (uint8_t)1; tmp68__ = *pBuf; pBuf += 1; ielen -= 1; @@ -6217,8 +6214,8 @@ static const tIEDefn IES_AssocRequest[] = { 3, DOT11F_EID_VENDOR2_IE, 0, }, { offsetof(tDot11fAssocRequest, hs20vendor_ie), offsetof(tDot11fIEhs20vendor_ie, present), 0, "hs20vendor_ie", - 0, 7, 9, SigIehs20vendor_ie, {80, 111, 154, 0, 0}, - 3, DOT11F_EID_HS20VENDOR_IE, 0, }, + 0, 7, 9, SigIehs20vendor_ie, {80, 111, 154, 16, 0}, + 4, DOT11F_EID_HS20VENDOR_IE, 0, }, {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },}; uint32_t dot11f_unpack_assoc_request(tpAniSirGlobal pCtx, @@ -6578,8 +6575,8 @@ static const tIEDefn IES_Beacon[] = { 3, DOT11F_EID_VENDOR3IE, 0, }, { offsetof(tDot11fBeacon, hs20vendor_ie), offsetof(tDot11fIEhs20vendor_ie, present), 0, "hs20vendor_ie", - 0, 7, 9, SigIehs20vendor_ie, {80, 111, 154, 0, 0}, - 3, DOT11F_EID_HS20VENDOR_IE, 0, }, + 0, 7, 9, SigIehs20vendor_ie, {80, 111, 154, 16, 0}, + 4, DOT11F_EID_HS20VENDOR_IE, 0, }, { offsetof(tDot11fBeacon, ChannelSwitchWrapper), offsetof(tDot11fIEChannelSwitchWrapper, present), 0, "ChannelSwitchWrapper", 0, 2, 14, SigIeChannelSwitchWrapper, @@ -6779,8 +6776,8 @@ static const tIEDefn IES_Beacon2[] = { 3, DOT11F_EID_VENDOR3IE, 0, }, { offsetof(tDot11fBeacon2, hs20vendor_ie), offsetof(tDot11fIEhs20vendor_ie, present), 0, "hs20vendor_ie", - 0, 7, 9, SigIehs20vendor_ie, {80, 111, 154, 0, 0}, - 3, DOT11F_EID_HS20VENDOR_IE, 0, }, + 0, 7, 9, SigIehs20vendor_ie, {80, 111, 154, 16, 0}, + 4, DOT11F_EID_HS20VENDOR_IE, 0, }, { offsetof(tDot11fBeacon2, ChannelSwitchWrapper), offsetof(tDot11fIEChannelSwitchWrapper, present), 0, "ChannelSwitchWrapper", 0, 2, 14, SigIeChannelSwitchWrapper, @@ -6976,8 +6973,8 @@ static const tIEDefn IES_BeaconIEs[] = { 3, DOT11F_EID_VENDOR3IE, 0, }, { offsetof(tDot11fBeaconIEs, hs20vendor_ie), offsetof(tDot11fIEhs20vendor_ie, present), 0, "hs20vendor_ie", - 0, 7, 9, SigIehs20vendor_ie, {80, 111, 154, 0, 0}, - 3, DOT11F_EID_HS20VENDOR_IE, 0, }, + 0, 7, 9, SigIehs20vendor_ie, {80, 111, 154, 16, 0}, + 4, DOT11F_EID_HS20VENDOR_IE, 0, }, { offsetof(tDot11fBeaconIEs, ChannelSwitchWrapper), offsetof(tDot11fIEChannelSwitchWrapper, present), 0, "ChannelSwitchWrapper", 0, 2, 14, SigIeChannelSwitchWrapper, @@ -7585,8 +7582,8 @@ static const tIEDefn IES_ProbeResponse[] = { 3, DOT11F_EID_VENDOR3IE, 0, }, { offsetof(tDot11fProbeResponse, hs20vendor_ie), offsetof(tDot11fIEhs20vendor_ie, present), 0, "hs20vendor_ie", - 0, 7, 9, SigIehs20vendor_ie, {80, 111, 154, 0, 0}, - 3, DOT11F_EID_HS20VENDOR_IE, 0, }, + 0, 7, 9, SigIehs20vendor_ie, {80, 111, 154, 16, 0}, + 4, DOT11F_EID_HS20VENDOR_IE, 0, }, { offsetof(tDot11fProbeResponse, ChannelSwitchWrapper), offsetof(tDot11fIEChannelSwitchWrapper, present), 0, "ChannelSwitchWrapper", 0, 2, 14, SigIeChannelSwitchWrapper, @@ -7840,8 +7837,8 @@ static const tIEDefn IES_ReAssocRequest[] = { 3, DOT11F_EID_VENDOR2_IE, 0, }, { offsetof(tDot11fReAssocRequest, hs20vendor_ie), offsetof(tDot11fIEhs20vendor_ie, present), 0, "hs20vendor_ie", - 0, 7, 9, SigIehs20vendor_ie, {80, 111, 154, 0, 0}, - 3, DOT11F_EID_HS20VENDOR_IE, 0, }, + 0, 7, 9, SigIehs20vendor_ie, {80, 111, 154, 16, 0}, + 4, DOT11F_EID_HS20VENDOR_IE, 0, }, {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },}; uint32_t dot11f_unpack_re_assoc_request(tpAniSirGlobal pCtx, @@ -11439,7 +11436,6 @@ uint32_t dot11f_get_packed_ie_hs20vendor_ie(tpAniSirGlobal pCtx, (void)pCtx; while (pIe->present) { *pnNeeded += 1; - *pnNeeded += 1; if (pIe->hs_id_present) { switch (pIe->hs_id_present) { case 1: @@ -20282,9 +20278,8 @@ uint32_t dot11f_pack_ie_hs20vendor_ie(tpAniSirGlobal pCtx, ++pBuf; ++(*pnConsumed); *pBuf = 0x9a; ++pBuf; ++(*pnConsumed); - *pBuf = pSrc->type; - *pnConsumed += 1; - pBuf += 1; + *pBuf = 0x10; + ++pBuf; ++(*pnConsumed); tmp138__ = 0U; tmp138__ |= (pSrc->dgaf_dis << 0); tmp138__ |= (pSrc->hs_id_present << 1); 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 bd6bf38e9f12..064b17423e52 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 @@ -275,7 +275,7 @@ uint8_t *mac_trace_get_sme_msg_string(uint16_t sme_msg) CASE_RETURN_STRING(eWNI_SME_WPS_PBC_PROBE_REQ_IND); CASE_RETURN_STRING(eWNI_SME_SET_APWPARSNIEs_REQ); CASE_RETURN_STRING(eWNI_SME_UPPER_LAYER_ASSOC_CNF); - CASE_RETURN_STRING(eWNI_SME_HIDE_SSID_REQ); + CASE_RETURN_STRING(eWNI_SME_SESSION_UPDATE_PARAM); CASE_RETURN_STRING(eWNI_SME_CHNG_MCC_BEACON_INTERVAL); CASE_RETURN_STRING(eWNI_SME_REMAIN_ON_CHANNEL_REQ); CASE_RETURN_STRING(eWNI_SME_REMAIN_ON_CHN_RSP); diff --git a/core/mac/src/sys/legacy/src/utils/src/parser_api.c b/core/mac/src/sys/legacy/src/utils/src/parser_api.c index fed09ba1a848..360c76a1df92 100644 --- a/core/mac/src/sys/legacy/src/utils/src/parser_api.c +++ b/core/mac/src/sys/legacy/src/utils/src/parser_api.c @@ -882,18 +882,18 @@ void lim_log_vht_cap(tpAniSirGlobal pMac, tDot11fIEVHTCaps *pDot11f) lim_log(pMac, LOG1, FL("vhtLinkAdaptCap (2): %d"), pDot11f->vhtLinkAdaptCap); lim_log(pMac, LOG1, FL("rxAntPattern (1): %d"), - pDot11f->vhtLinkAdaptCap); + pDot11f->rxAntPattern); lim_log(pMac, LOG1, FL("txAntPattern (1): %d"), - pDot11f->vhtLinkAdaptCap); + pDot11f->txAntPattern); lim_log(pMac, LOG1, FL("reserved1 (2): %d"), pDot11f->reserved1); lim_log(pMac, LOG1, FL("rxMCSMap (16): %d"), pDot11f->rxMCSMap); lim_log(pMac, LOG1, FL("rxHighSupDataRate (13): %d"), pDot11f->rxHighSupDataRate); - lim_log(pMac, LOG1, FL("reserve (3): %d"), pDot11f->reserved2); + lim_log(pMac, LOG1, FL("reserved2(3): %d"), pDot11f->reserved2); lim_log(pMac, LOG1, FL("txMCSMap (16): %d"), pDot11f->txMCSMap); lim_log(pMac, LOG1, FL("txSupDataRate (13): %d"), pDot11f->txSupDataRate); - lim_log(pMac, LOG1, FL("reserv (3): %d"), pDot11f->reserved3); + lim_log(pMac, LOG1, FL("reserved3 (3): %d"), pDot11f->reserved3); #endif /* DUMP_MGMT_CNTNTS */ } diff --git a/core/pld/inc/pld_common.h b/core/pld/inc/pld_common.h index 28760ff459f8..bcf647b0b1a4 100644 --- a/core/pld/inc/pld_common.h +++ b/core/pld/inc/pld_common.h @@ -378,4 +378,5 @@ int pld_athdiag_write(struct device *dev, uint32_t offset, uint32_t memtype, void *pld_smmu_get_mapping(struct device *dev); int pld_smmu_map(struct device *dev, phys_addr_t paddr, uint32_t *iova_addr, size_t size); +unsigned int pld_socinfo_get_serial_number(struct device *dev); #endif diff --git a/core/pld/src/pld_common.c b/core/pld/src/pld_common.c index b5db8a502006..737cc389c600 100644 --- a/core/pld/src/pld_common.c +++ b/core/pld/src/pld_common.c @@ -1518,3 +1518,29 @@ int pld_smmu_map(struct device *dev, phys_addr_t paddr, return ret; } + +/** + * pld_socinfo_get_serial_number() - Get SOC serial number + * @dev: device + * + * Return: SOC serial number + */ +unsigned int pld_socinfo_get_serial_number(struct device *dev) +{ + unsigned int ret = 0; + enum pld_bus_type type = pld_get_bus_type(dev); + + switch (type) { + case PLD_BUS_TYPE_SNOC: + ret = pld_snoc_socinfo_get_serial_number(dev); + break; + case PLD_BUS_TYPE_PCIE: + pr_err("Not supported on type %d\n", type); + break; + default: + pr_err("Invalid device type %d\n", type); + break; + } + + return ret; +} diff --git a/core/pld/src/pld_snoc.h b/core/pld/src/pld_snoc.h index 07a60e69cf12..9c8a53b8a889 100644 --- a/core/pld/src/pld_snoc.h +++ b/core/pld/src/pld_snoc.h @@ -130,6 +130,11 @@ static inline int pld_snoc_smmu_map(struct device *dev, phys_addr_t paddr, { return 0; } +static inline +unsigned int pld_snoc_socinfo_get_serial_number(struct device *dev) +{ + return 0; +} #else int pld_snoc_register_driver(void); void pld_snoc_unregister_driver(void); @@ -213,5 +218,10 @@ static inline int pld_snoc_smmu_map(struct device *dev, phys_addr_t paddr, { return icnss_smmu_map(dev, paddr, iova_addr, size); } +static inline +unsigned int pld_snoc_socinfo_get_serial_number(struct device *dev) +{ + return icnss_socinfo_get_serial_number(dev); +} #endif #endif diff --git a/core/sap/inc/sap_api.h b/core/sap/inc/sap_api.h index 60b97cca6da2..d9f06b8bf7c3 100644 --- a/core/sap/inc/sap_api.h +++ b/core/sap/inc/sap_api.h @@ -508,6 +508,20 @@ enum vendor_ie_access_policy { ACCESS_POLICY_DONOT_RESPOND_IF_IE_IS_PRESENT, }; +/* + * enum sap_acs_dfs_mode- state of DFS mode + * @ACS_DFS_MODE_NONE: DFS mode attribute is not valid + * @ACS_DFS_MODE_ENABLE: DFS mode is enabled + * @ACS_DFS_MODE_DISABLE: DFS mode is disabled + * @ACS_DFS_MODE_DEPRIORITIZE: Deprioritize DFS channels in scanning + */ +enum sap_acs_dfs_mode { + ACS_DFS_MODE_NONE, + ACS_DFS_MODE_ENABLE, + ACS_DFS_MODE_DISABLE, + ACS_DFS_MODE_DEPRIORITIZE +}; + typedef struct sap_Config { tSap_SSIDInfo_t SSIDinfo; eCsrPhyMode SapHw_mode; /* Wireless Mode */ @@ -577,6 +591,7 @@ typedef struct sap_Config { uint8_t ampdu_size; tSirMacRateSet supp_rate_set; tSirMacRateSet extended_rate_set; + enum sap_acs_dfs_mode acs_dfs_mode; } tsap_Config_t; #ifdef FEATURE_WLAN_AP_AP_ACS_OPTIMIZE diff --git a/core/sap/src/sap_api_link_cntl.c b/core/sap/src/sap_api_link_cntl.c index bf694c2ed6db..2447879bcab7 100644 --- a/core/sap/src/sap_api_link_cntl.c +++ b/core/sap/src/sap_api_link_cntl.c @@ -325,14 +325,9 @@ wlansap_pre_start_bss_acs_scan_callback(tHalHandle hal_handle, void *pcontext, QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR, FL("CSR scan_status = eCSR_SCAN_ABORT/FAILURE (%d), choose default channel"), scan_status); -#ifdef SOFTAP_CHANNEL_RANGE - if (sap_ctx->acs_cfg->hw_mode == eCSR_DOT11_MODE_11a) - sap_ctx->channel = SAP_DEFAULT_5GHZ_CHANNEL; - else - sap_ctx->channel = SAP_DEFAULT_24GHZ_CHANNEL; -#else - sap_ctx->channel = SAP_DEFAULT_24GHZ_CHANNEL; -#endif + sap_ctx->channel = + sap_select_default_oper_chan(hal_handle, + sap_ctx->acs_cfg->hw_mode); sap_ctx->sap_state = eSAP_ACS_CHANNEL_SELECTED; sap_ctx->sap_status = eSAP_STATUS_SUCCESS; goto close_session; @@ -396,7 +391,9 @@ wlansap_pre_start_bss_acs_scan_callback(tHalHandle hal_handle, void *pcontext, goto close_session; } else { #else - sap_ctx->channel = SAP_DEFAULT_24GHZ_CHANNEL; + sap_ctx->channel = + sap_select_default_oper_chan(hal_handle, + sap_ctx->acs_cfg->hw_mode); } else { #endif /* Valid Channel Found from scan results. */ diff --git a/core/sap/src/sap_ch_select.c b/core/sap/src/sap_ch_select.c index 0f488b99bdfa..b4a54dd5adab 100644 --- a/core/sap/src/sap_ch_select.c +++ b/core/sap/src/sap_ch_select.c @@ -586,7 +586,8 @@ bool sap_chan_sel_init(tHalHandle halHandle, #endif sme_cfg_get_int(halHandle, WNI_CFG_DFS_MASTER_ENABLED, &dfs_master_cap_enabled); - if (dfs_master_cap_enabled == 0) + if (dfs_master_cap_enabled == 0 || + ACS_DFS_MODE_DISABLE == pSapCtx->dfs_mode) include_dfs_ch = false; /* Fill the channel number in the spectrum in the operating freq band */ @@ -1949,7 +1950,6 @@ static uint8_t sap_select_channel_no_scan_result(tHalHandle hal, if ((ch_type == CHANNEL_STATE_DISABLE) || (ch_type == CHANNEL_STATE_INVALID)) continue; - if ((!dfs_master_cap_enabled) && (CHANNEL_STATE_DFS == ch_type)) { QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH, @@ -1957,6 +1957,9 @@ static uint8_t sap_select_channel_no_scan_result(tHalHandle hal, __func__, safe_channels[i].channelNumber); continue; } + if ((sap_ctx->dfs_mode == ACS_DFS_MODE_DISABLE) && + (CHANNEL_STATE_DFS == ch_type)) + continue; if (safe_channels[i].isSafe == true) { QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH, diff --git a/core/sap/src/sap_fsm.c b/core/sap/src/sap_fsm.c index 32fca747bc2e..8eef7af80814 100644 --- a/core/sap/src/sap_fsm.c +++ b/core/sap/src/sap_fsm.c @@ -2090,6 +2090,28 @@ sap_dfs_is_channel_in_nol_list(ptSapContext sap_context, } /** + * sap_select_default_oper_chan() - Select operating channel based on acs hwmode + * @hal: pointer to HAL + * @acs_hwmode: HW mode of ACS + * + * Return: selected operating channel + */ +uint8_t sap_select_default_oper_chan(tHalHandle hal, uint32_t acs_hwmode) +{ + uint8_t channel; + + if ((acs_hwmode == QCA_ACS_MODE_IEEE80211A) || + (acs_hwmode == QCA_ACS_MODE_IEEE80211AD)) + channel = SAP_DEFAULT_5GHZ_CHANNEL; + else + channel = SAP_DEFAULT_24GHZ_CHANNEL; + + QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO, + FL("channel selected to start bss %d"), channel); + return channel; +} + +/** * sap_goto_channel_sel - Function for initiating scan request for SME * @sap_context: Sap Context value. * @sap_event: State machine event @@ -2297,8 +2319,9 @@ QDF_STATUS sap_goto_channel_sel(ptSapContext sap_context, QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH, FL("SAP Configuring default channel, Ch=%d"), sap_context->channel); - /* In case of error, switch to default channel */ - sap_context->channel = SAP_DEFAULT_24GHZ_CHANNEL; + sap_context->channel = + sap_select_default_oper_chan(h_hal, + sap_context->acs_cfg->hw_mode); #ifdef SOFTAP_CHANNEL_RANGE if (sap_context->channelList != NULL) { diff --git a/core/sap/src/sap_internal.h b/core/sap/src/sap_internal.h index e8e50f6350ed..22608eff91cc 100644 --- a/core/sap/src/sap_internal.h +++ b/core/sap/src/sap_internal.h @@ -270,6 +270,7 @@ typedef struct sSapContext { uint8_t beacon_tx_rate; tSirMacRateSet supp_rate_set; tSirMacRateSet extended_rate_set; + enum sap_acs_dfs_mode dfs_mode; } *ptSapContext; /*---------------------------------------------------------------------------- @@ -434,4 +435,5 @@ QDF_STATUS sap_close_session(tHalHandle hHal, #ifdef __cplusplus } #endif +uint8_t sap_select_default_oper_chan(tHalHandle hal, uint32_t acs_hwmode); #endif diff --git a/core/sap/src/sap_module.c b/core/sap/src/sap_module.c index 653871ecacf8..457fcf9ecf47 100644 --- a/core/sap/src/sap_module.c +++ b/core/sap/src/sap_module.c @@ -647,6 +647,7 @@ wlansap_set_scan_acs_channel_params(tsap_Config_t *pconfig, /* Channel selection is auto or configured */ psap_ctx->channel = pconfig->channel; + psap_ctx->dfs_mode = pconfig->acs_dfs_mode; #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH psap_ctx->cc_switch_mode = pconfig->cc_switch_mode; #endif @@ -810,6 +811,7 @@ QDF_STATUS wlansap_start_bss(void *pCtx, /* pwextCtx */ /* Channel selection is auto or configured */ pSapCtx->channel = pConfig->channel; + pSapCtx->dfs_mode = pConfig->acs_dfs_mode; pSapCtx->ch_params.ch_width = pConfig->ch_params.ch_width; pSapCtx->ch_params.center_freq_seg0 = pConfig->ch_params.center_freq_seg0; diff --git a/core/sme/inc/csr_api.h b/core/sme/inc/csr_api.h index c68f20546ab7..07e9874784d9 100644 --- a/core/sme/inc/csr_api.h +++ b/core/sme/inc/csr_api.h @@ -505,11 +505,11 @@ typedef enum { /* Channel sw update notification */ eCSR_ROAM_DFS_CHAN_SW_NOTIFY, eCSR_ROAM_EXT_CHG_CHNL_IND, - eCSR_ROAM_DISABLE_QUEUES, - eCSR_ROAM_ENABLE_QUEUES, eCSR_ROAM_STA_CHANNEL_SWITCH, eCSR_ROAM_NDP_STATUS_UPDATE, eCSR_ROAM_UPDATE_SCAN_RESULT, + eCSR_ROAM_START, + eCSR_ROAM_ABORT, } eRoamCmdStatus; /* comment inside indicates what roaming callback gets */ @@ -1060,6 +1060,30 @@ typedef struct tagCsrNeighborRoamConfigParams { int32_t nhi_rssi_scan_rssi_ub; } tCsrNeighborRoamConfigParams; +/** + * enum sta_roam_policy_dfs_mode - state of DFS mode for STA ROME policy + * @CSR_STA_ROAM_POLICY_NONE: DFS mode attribute is not valid + * @CSR_STA_ROAM_POLICY_DFS_ENABLED: DFS mode is enabled + * @CSR_STA_ROAM_POLICY_DFS_DISABLED: DFS mode is disabled + * @CSR_STA_ROAM_POLICY_DFS_DEPRIORITIZE: Deprioritize DFS channels in scanning + */ +enum sta_roam_policy_dfs_mode { + CSR_STA_ROAM_POLICY_NONE, + CSR_STA_ROAM_POLICY_DFS_ENABLED, + CSR_STA_ROAM_POLICY_DFS_DISABLED, + CSR_STA_ROAM_POLICY_DFS_DEPRIORITIZE +}; + +/** + * struct csr_sta_roam_policy_params - sta roam policy params for station + * @dfs_mode: tell is DFS channels needs to be skipped while scanning + * @skip_unsafe_channels: tells if unsafe channels needs to be skip in scanning + */ +struct csr_sta_roam_policy_params { + enum sta_roam_policy_dfs_mode dfs_mode; + bool skip_unsafe_channels; +}; + typedef struct tagCsrConfigParam { uint32_t FragmentationThreshold; /* keep this uint32_t. This gets converted to ePhyChannelBondState */ @@ -1095,8 +1119,6 @@ typedef struct tagCsrConfigParam { uint32_t scanAgeTimeCNPS; /* scan res aging time threshold when Connect-Power-Save, in sec */ uint32_t scanAgeTimeCPS; - /* In sec, CSR'll try this long before gives up. 0 means no roaming */ - uint32_t nRoamingTime; /* to set the RSSI difference for each category */ uint8_t bCatRssiOffset; /* to set MCC Enable/Disable mode */ @@ -1144,6 +1166,7 @@ typedef struct tagCsrConfigParam { * default setting. */ uint8_t nTxPowerCap; + bool allow_tpc_from_ap; /* stats request frequency from PE while in full power */ uint32_t statsReqPeriodicity; /* stats request frequency from PE while in power save */ @@ -1280,6 +1303,7 @@ typedef struct tagCsrConfigParam { bool enable_fatal_event; enum wmi_dwelltime_adaptive_mode scan_adaptive_dwell_mode; enum wmi_dwelltime_adaptive_mode roamscan_adaptive_dwell_mode; + struct csr_sta_roam_policy_params sta_roam_policy_params; } tCsrConfigParam; /* Tush */ diff --git a/core/sme/inc/csr_internal.h b/core/sme/inc/csr_internal.h index 909d7802c3eb..dd9dffafea2c 100644 --- a/core/sme/inc/csr_internal.h +++ b/core/sme/inc/csr_internal.h @@ -525,8 +525,6 @@ typedef struct tagCsrConfig { uint32_t BssPreferValue[CSR_NUM_RSSI_CAT]; int RSSICat[CSR_NUM_RSSI_CAT]; uint8_t bCatRssiOffset; /* to set RSSI difference for each category */ - /* In secs, CSR'll try this long before gives up, 0 means no roaming */ - uint32_t nRoamingTime; /* * Whether to limit the channels to the ones set in Csr11dInfo. * If true, the opertaional channels are limited to the default channel @@ -567,6 +565,7 @@ typedef struct tagCsrConfig { * value & 11d. If 11d is disable, the lesser of this & default setting. */ uint8_t nTxPowerCap; + bool allow_tpc_from_ap; uint32_t statsReqPeriodicity; /* stats req freq while in fullpower */ uint32_t statsReqPeriodicityInPS;/* stats req freq while in powersave */ uint32_t dtimPeriod; @@ -666,6 +665,7 @@ typedef struct tagCsrConfig { bool enable_fatal_event; enum wmi_dwelltime_adaptive_mode scan_adaptive_dwell_mode; enum wmi_dwelltime_adaptive_mode roamscan_adaptive_dwell_mode; + struct csr_sta_roam_policy_params sta_roam_policy; } tCsrConfig; typedef struct tagCsrChannelPowerInfo { @@ -946,7 +946,6 @@ typedef struct tagCsrRoamSession { uint8_t *pAddIEScan; uint32_t nAddIEAssocLength; /* the byte count for pAddIeAssocIE */ uint8_t *pAddIEAssoc; - uint32_t roamingStartTime; /* in units of 10ms */ tCsrTimerInfo roamingTimerInfo; eCsrRoamingReason roamingReason; bool fCancelRoaming; diff --git a/core/sme/inc/csr_neighbor_roam.h b/core/sme/inc/csr_neighbor_roam.h index 582d0572e13b..59564a17c86d 100644 --- a/core/sme/inc/csr_neighbor_roam.h +++ b/core/sme/inc/csr_neighbor_roam.h @@ -322,6 +322,8 @@ void csr_roam_reset_roam_params(tpAniSirGlobal mac_ptr); #define REASON_ROAM_SCAN_HI_RSSI_DELAY_CHANGED 32 #define REASON_ROAM_SCAN_HI_RSSI_UB_CHANGED 33 #define REASON_CONNECT_IES_CHANGED 34 +#define REASON_ROAM_SCAN_STA_ROAM_POLICY_CHANGED 35 + #if defined(WLAN_FEATURE_HOST_ROAM) || defined(WLAN_FEATURE_ROAM_OFFLOAD) QDF_STATUS csr_roam_offload_scan(tpAniSirGlobal pMac, uint8_t sessionId, diff --git a/core/sme/inc/sme_api.h b/core/sme/inc/sme_api.h index 7b915abd7f8e..15f845510ef9 100644 --- a/core/sme/inc/sme_api.h +++ b/core/sme/inc/sme_api.h @@ -1226,6 +1226,8 @@ uint32_t sme_get_wni_dot11_mode(tHalHandle hal); QDF_STATUS sme_create_mon_session(tHalHandle hal_handle, uint8_t *bssid); QDF_STATUS sme_set_adaptive_dwelltime_config(tHalHandle hal, struct adaptive_dwelltime_params *dwelltime_params); + +void sme_set_vdev_ies_per_band(tHalHandle hal, uint8_t vdev_id); void sme_set_pdev_ht_vht_ies(tHalHandle hHal, bool enable2x2); void sme_update_vdev_type_nss(tHalHandle hal, uint8_t max_supp_nss, @@ -1253,4 +1255,65 @@ QDF_STATUS sme_update_access_policy_vendor_ie(tHalHandle hal, uint8_t session_id, uint8_t *vendor_ie, int access_policy); +QDF_STATUS sme_update_sta_roam_policy(tHalHandle hal, + enum sta_roam_policy_dfs_mode dfs_mode, + bool skip_unsafe_channels, + uint8_t session_id); +QDF_STATUS sme_enable_disable_chanavoidind_event(tHalHandle hal, + uint8_t set_value); +QDF_STATUS sme_set_default_scan_ie(tHalHandle hal, uint16_t session_id, + uint8_t *ie_data, uint16_t ie_len); +/** + * sme_update_session_param() - API to update PE session param + * @hal: HAL handle for device + * @session_id: Session ID + * @param_type: Param type to be updated + * @param_val: Param value to be update + * + * Note: this setting will not persist over reboots. + * + * Return: QDF_STATUS + */ +QDF_STATUS sme_update_session_param(tHalHandle hal, uint8_t session_id, + uint32_t param_type, uint32_t param_val); + +/** + * sme_encrypt_decrypt_msg_register_callback() - Registers + * encrypt/decrypt message callback + * + * @hal - MAC global handle + * @callback_routine - callback routine from HDD + * + * This API is invoked by HDD to register its callback in SME + * + * Return: QDF_STATUS + */ +QDF_STATUS sme_encrypt_decrypt_msg_register_callback(tHalHandle hal, + void (*encrypt_decrypt_cb)(void *hdd_context, + struct sir_encrypt_decrypt_rsp_params + *encrypt_decrypt_rsp_params)); + +/** + * sme_encrypt_decrypt_msg_deregister_callback() - Registers + * encrypt/decrypt message callback + * + * @h_hal - MAC global handle + * @callback_routine - callback routine from HDD + * + * This API is invoked by HDD to de-register its callback in SME + * + * Return: QDF_STATUS Enumeration + */ +QDF_STATUS sme_encrypt_decrypt_msg_deregister_callback(tHalHandle h_hal); + +/** + * sme_encrypt_decrypt_msg() - handles encrypt/decrypt mesaage + * @hal: HAL handle + * @encrypt_decrypt_params: struct to set encryption/decryption params. + * + * Return: QDF_STATUS enumeration. + */ +QDF_STATUS sme_encrypt_decrypt_msg(tHalHandle hal, + struct encrypt_decrypt_req_params *encrypt_decrypt_params); + #endif /* #if !defined( __SME_API_H ) */ diff --git a/core/sme/inc/sme_internal.h b/core/sme/inc/sme_internal.h index 51c135ec235c..0afada7cdf73 100644 --- a/core/sme/inc/sme_internal.h +++ b/core/sme/inc/sme_internal.h @@ -244,6 +244,8 @@ typedef struct tagSmeStruct { p2p_lo_callback p2p_lo_event_callback; void *p2p_lo_event_context; sme_send_oem_data_rsp_msg oem_data_rsp_callback; + void (*encrypt_decrypt_cb)(void *, + struct sir_encrypt_decrypt_rsp_params *); } tSmeStruct, *tpSmeStruct; #endif /* #if !defined( __SMEINTERNAL_H ) */ diff --git a/core/sme/inc/sme_power_save_api.h b/core/sme/inc/sme_power_save_api.h index 77e2934e8a52..9cfd859bcd9f 100644 --- a/core/sme/inc/sme_power_save_api.h +++ b/core/sme/inc/sme_power_save_api.h @@ -96,7 +96,7 @@ static inline void sme_set_pno_channel_prediction(void *request_buf, {} #endif -QDF_STATUS sme_is_auto_ps_timer_running(tHalHandle hal_ctx, +bool sme_is_auto_ps_timer_running(tHalHandle hal_ctx, uint32_t session_id); #endif /* #if !defined(__SME_POWER_SAVE_API_H) */ diff --git a/core/sme/inc/sme_qos_api.h b/core/sme/inc/sme_qos_api.h index 7b98504b5e81..9ffb46053a96 100644 --- a/core/sme/inc/sme_qos_api.h +++ b/core/sme/inc/sme_qos_api.h @@ -240,7 +240,8 @@ sme_QosStatusType sme_qos_setup_req(tHalHandle hHal, uint32_t sessionId, sme_QosWmmUpType UPType, uint32_t *pQosFlowID); sme_QosStatusType sme_qos_modify_req(tHalHandle hHal, sme_QosWmmTspecInfo *pQoSInfo, uint32_t QosFlowID); -sme_QosStatusType sme_qos_release_req(tHalHandle hHal, uint32_t QosFlowID); +sme_QosStatusType sme_qos_release_req(tHalHandle hHal, uint8_t session_id, + uint32_t QosFlowID); bool sme_qos_is_ts_info_ack_policy_valid(tpAniSirGlobal pMac, sme_QosWmmTspecInfo *pQoSInfo, uint8_t sessionId); void sme_qos_update_hand_off(uint8_t sessionId, bool updateHandOff); diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c index 4c087976da68..57c167a44b1f 100644 --- a/core/sme/src/common/sme_api.c +++ b/core/sme/src/common/sme_api.c @@ -60,6 +60,7 @@ #include "wma.h" #include "sch_api.h" #include "sme_nan_datapath.h" +#include "csr_api.h" extern tSirRetStatus u_mac_post_ctrl_msg(void *pSirGlobal, tSirMbMsg *pMb); @@ -8360,55 +8361,41 @@ QDF_STATUS sme_set_tx_power(tHalHandle hHal, uint8_t sessionId, return QDF_STATUS_SUCCESS; } -/* --------------------------------------------------------------------------- - - \fn sme_hide_ssid - - \brief hide/show SSID dynamically. Note: this setting will - not persist over reboots. - - \param hHal - \param sessionId - \param ssidHidden 0 - Broadcast SSID, 1 - Disable broadcast SSID - \- return QDF_STATUS - - -------------------------------------------------------------------------------*/ -QDF_STATUS sme_hide_ssid(tHalHandle hHal, uint8_t sessionId, uint8_t ssidHidden) +QDF_STATUS sme_update_session_param(tHalHandle hal, uint8_t session_id, + uint32_t param_type, uint32_t param_val) { QDF_STATUS status = QDF_STATUS_SUCCESS; - tpAniSirGlobal pMac = PMAC_STRUCT(hHal); + tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); uint16_t len; - status = sme_acquire_global_lock(&pMac->sme); + status = sme_acquire_global_lock(&mac_ctx->sme); if (QDF_IS_STATUS_SUCCESS(status)) { - tpSirUpdateParams pMsg; - tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); + struct sir_update_session_param *msg; + tCsrRoamSession *session = CSR_GET_SESSION(mac_ctx, session_id); - if (!pSession) { - sms_log(pMac, LOGE, FL(" session %d not found "), - sessionId); - sme_release_global_lock(&pMac->sme); - return QDF_STATUS_E_FAILURE; + if (!session) { + sms_log(mac_ctx, LOGE, FL("session %d not found"), + session_id); + sme_release_global_lock(&mac_ctx->sme); + return status; } - if (!pSession->sessionActive) + if (!session->sessionActive) QDF_ASSERT(0); - /* Create the message and send to lim */ - len = sizeof(tSirUpdateParams); - pMsg = qdf_mem_malloc(len); - if (NULL == pMsg) + len = sizeof(*msg); + msg = qdf_mem_malloc(len); + if (!msg) status = QDF_STATUS_E_NOMEM; else { - qdf_mem_set(pMsg, sizeof(tSirUpdateParams), 0); - pMsg->messageType = eWNI_SME_HIDE_SSID_REQ; - pMsg->length = len; - /* Data starts from here */ - pMsg->sessionId = sessionId; - pMsg->ssidHidden = ssidHidden; - status = cds_send_mb_message_to_mac(pMsg); + msg->message_type = eWNI_SME_SESSION_UPDATE_PARAM; + msg->length = len; + msg->session_id = session_id; + msg->param_type = param_type; + msg->param_val = param_val; + status = cds_send_mb_message_to_mac(msg); } - sme_release_global_lock(&pMac->sme); + sme_release_global_lock(&mac_ctx->sme); } return status; } @@ -14685,7 +14672,7 @@ QDF_STATUS sme_wifi_start_logger(tHalHandle hal, qdf_mem_zero(req_msg, len); req_msg->verbose_level = start_log.verbose_level; - req_msg->flag = start_log.flag; + req_msg->is_iwpriv_command = start_log.is_iwpriv_command; req_msg->ring_id = start_log.ring_id; req_msg->ini_triggered = start_log.ini_triggered; req_msg->user_triggered = start_log.user_triggered; @@ -16077,7 +16064,8 @@ QDF_STATUS sme_set_bpf_instructions(tHalHandle hal, cds_msg_t cds_msg; struct sir_bpf_set_offload *set_offload; - set_offload = qdf_mem_malloc(sizeof(*set_offload)); + set_offload = qdf_mem_malloc(sizeof(*set_offload) + + req->current_length); if (NULL == set_offload) { QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, @@ -16091,14 +16079,8 @@ QDF_STATUS sme_set_bpf_instructions(tHalHandle hal, set_offload->total_length = req->total_length; set_offload->current_length = req->current_length; if (set_offload->total_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; - } + set_offload->program = ((uint8_t *)set_offload) + + sizeof(*set_offload); qdf_mem_copy(set_offload->program, req->program, set_offload->current_length); } @@ -16113,16 +16095,12 @@ QDF_STATUS sme_set_bpf_instructions(tHalHandle hal, QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, FL("Post BPF set offload msg fail")); status = QDF_STATUS_E_FAILURE; - if (set_offload->total_length) - qdf_mem_free(set_offload->program); qdf_mem_free(set_offload); } sme_release_global_lock(&mac_ctx->sme); } else { QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, FL("sme_acquire_global_lock failed")); - if (set_offload->total_length) - qdf_mem_free(set_offload->program); qdf_mem_free(set_offload); } return status; @@ -16267,6 +16245,38 @@ QDF_STATUS sme_set_adaptive_dwelltime_config(tHalHandle hal, } return status; } + +/** + * sme_set_vdev_ies_per_band() - sends the per band IEs to vdev + * @hal: Pointer to HAL + * @vdev_id: vdev_id for which IE is targeted + * + * Return: None + */ +void sme_set_vdev_ies_per_band(tHalHandle hal, uint8_t vdev_id) +{ + tpAniSirGlobal p_mac = PMAC_STRUCT(hal); + struct sir_set_vdev_ies_per_band *p_msg; + QDF_STATUS status = QDF_STATUS_E_FAILURE; + + p_msg = qdf_mem_malloc(sizeof(*p_msg)); + if (NULL == p_msg) { + sms_log(p_mac, LOGE, FL("mem alloc failed for sme msg")); + return; + } + + p_msg->vdev_id = vdev_id; + p_msg->msg_type = eWNI_SME_SET_VDEV_IES_PER_BAND; + p_msg->len = sizeof(*p_msg); + sms_log(p_mac, LOG1, + FL("sending eWNI_SME_SET_VDEV_IES_PER_BAND: vdev_id: %d "), + vdev_id); + status = cds_send_mb_message_to_mac(p_msg); + if (QDF_STATUS_SUCCESS != status) + sms_log(p_mac, LOGE, + FL("Send eWNI_SME_SET_VDEV_IES_PER_BAND fail")); +} + /** * sme_set_pdev_ht_vht_ies() - sends the set pdev IE req * @hal: Pointer to HAL @@ -16324,7 +16334,6 @@ void sme_set_pdev_ht_vht_ies(tHalHandle hal, bool enable2x2) if (QDF_STATUS_SUCCESS != status) { sms_log(mac_ctx, LOGE, FL( "Send SME_PDEV_SET_HT_VHT_IE fail")); - qdf_mem_free(ht_vht_cfg); } sme_release_global_lock(&mac_ctx->sme); } @@ -16459,3 +16468,250 @@ void sme_get_vdev_type_nss(tHalHandle hal, enum tQDF_ADAPTER_MODE dev_mode, tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); csr_get_vdev_type_nss(mac_ctx, dev_mode, nss_2g, nss_5g); } + +/** + * sme_update_sta_roam_policy() - update sta roam policy for + * unsafe and DFS channels. + * @hal_handle: hal handle for getting global mac struct + * @dfs_mode: dfs mode which tell if dfs channel needs to be + * skipped or not + * @skip_unsafe_channels: Param to tell if driver needs to + * skip unsafe channels or not. + * @param session_id: sme_session_id + * + * sme_update_sta_roam_policy update sta rome policies to csr + * this function will call csrUpdateChannelList as well + * to include/exclude DFS channels and unsafe channels. + * + * Return: eHAL_STATUS_SUCCESS or non-zero on failure. + */ +QDF_STATUS sme_update_sta_roam_policy(tHalHandle hal_handle, + enum sta_roam_policy_dfs_mode dfs_mode, + bool skip_unsafe_channels, + uint8_t session_id) +{ + tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal_handle); + QDF_STATUS status = QDF_STATUS_SUCCESS; + tSmeConfigParams sme_config; + + if (!mac_ctx) { + QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_FATAL, + "%s: mac_ctx is null", __func__); + return QDF_STATUS_E_FAILURE; + } + qdf_mem_zero(&sme_config, sizeof(sme_config)); + sme_get_config_param(hal_handle, &sme_config); + + sme_config.csrConfig.sta_roam_policy_params.dfs_mode = + dfs_mode; + sme_config.csrConfig.sta_roam_policy_params.skip_unsafe_channels = + skip_unsafe_channels; + + sme_update_config(hal_handle, &sme_config); + + status = csr_update_channel_list(mac_ctx); + if (QDF_STATUS_SUCCESS != status) { + QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, + FL("failed to update the supported channel list")); + } + if (mac_ctx->roam.configParam.isRoamOffloadScanEnabled) + csr_roam_offload_scan(mac_ctx, session_id, + ROAM_SCAN_OFFLOAD_UPDATE_CFG, + REASON_ROAM_SCAN_STA_ROAM_POLICY_CHANGED); + return status; +} + +/** + * sme_enable_disable_chanavoidind_event - configure ca event ind + * @hal: handler to hal + * @set_value: enable/disable + * + * function to enable/disable chan avoidance indication + * + * Return: QDF_STATUS + */ +QDF_STATUS sme_enable_disable_chanavoidind_event(tHalHandle hal, + uint8_t set_value) +{ + QDF_STATUS status; + tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); + cds_msg_t msg; + + sms_log(mac_ctx, LOG1, FL("set_value: %d"), set_value); + status = sme_acquire_global_lock(&mac_ctx->sme); + if (QDF_STATUS_SUCCESS == status) { + qdf_mem_zero(&msg, sizeof(cds_msg_t)); + msg.type = WMA_SEND_FREQ_RANGE_CONTROL_IND; + msg.bodyval = set_value; + status = cds_mq_post_message(QDF_MODULE_ID_WMA, &msg); + sme_release_global_lock(&mac_ctx->sme); + return status; + } + return status; +} + +/* + * sme_set_default_scan_ie() - API to send default scan IE to LIM + * @hal: reference to the HAL + * @session_id: current session ID + * @ie_data: Pointer to Scan IE data + * @ie_len: Length of @ie_data + * + * Return: QDF_STATUS + */ +QDF_STATUS sme_set_default_scan_ie(tHalHandle hal, uint16_t session_id, + uint8_t *ie_data, uint16_t ie_len) +{ + QDF_STATUS status; + tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); + struct hdd_default_scan_ie *set_ie_params; + + status = sme_acquire_global_lock(&mac_ctx->sme); + if (QDF_IS_STATUS_SUCCESS(status)) { + set_ie_params = qdf_mem_malloc(sizeof(*set_ie_params)); + if (!set_ie_params) + status = QDF_STATUS_E_NOMEM; + else { + set_ie_params->message_type = eWNI_SME_DEFAULT_SCAN_IE; + set_ie_params->length = sizeof(*set_ie_params); + set_ie_params->session_id = session_id; + set_ie_params->ie_len = ie_len; + qdf_mem_copy(set_ie_params->ie_data, ie_data, ie_len); + status = cds_send_mb_message_to_mac(set_ie_params); + } + sme_release_global_lock(&mac_ctx->sme); + } + sms_log(mac_ctx, LOG1, FL("Set default scan IE status %d"), status); + return status; +} + +/** + * sme_encrypt_decrypt_msg() - handles encrypt/decrypt mesaage + * @hal: HAL handle + * @encrypt_decrypt_params: struct to set encryption/decryption params. + * + * Return: QDF_STATUS enumeration. + */ +QDF_STATUS sme_encrypt_decrypt_msg(tHalHandle hal, + struct encrypt_decrypt_req_params *encrypt_decrypt_params) +{ + QDF_STATUS status = QDF_STATUS_SUCCESS; + tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); + cds_msg_t cds_msg; + struct encrypt_decrypt_req_params *params; + uint8_t *ptr; + + ptr = qdf_mem_malloc(sizeof(*params) + + encrypt_decrypt_params->data_len); + if (ptr == NULL) { + QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, + FL("Failed to alloc memory for encrypt/decrypt params")); + return QDF_STATUS_E_NOMEM; + } + + params = (struct encrypt_decrypt_req_params *)ptr; + + *params = *encrypt_decrypt_params; + + if (params->data_len) { + params->data = ptr + sizeof(*params); + + qdf_mem_copy(params->data, encrypt_decrypt_params->data, + params->data_len); + } + + status = sme_acquire_global_lock(&mac_ctx->sme); + if (status == QDF_STATUS_SUCCESS) { + /* Serialize the req through MC thread */ + cds_msg.bodyptr = params; + cds_msg.type = WMA_ENCRYPT_DECRYPT_MSG; + status = cds_mq_post_message(QDF_MODULE_ID_WMA, &cds_msg); + + if (!QDF_IS_STATUS_SUCCESS(status)) { + QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, + FL("Post encrypt/decrypt msg fail")); + status = QDF_STATUS_E_FAILURE; + qdf_mem_free(params); + } + sme_release_global_lock(&mac_ctx->sme); + } else { + QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, + FL("sme_acquire_global_lock failed")); + qdf_mem_free(params); + } + return status; + +} + +/** + * sme_encrypt_decrypt_msg_register_callback() - Registers + * encrypt/decrypt message callback + * + * @hal - MAC global handle + * @callback_routine - callback routine from HDD + * + * This API is invoked by HDD to register its callback in SME + * + * Return: QDF_STATUS + */ +QDF_STATUS sme_encrypt_decrypt_msg_register_callback(tHalHandle hal, + void (*encrypt_decrypt_cb)(void *hdd_context, + struct sir_encrypt_decrypt_rsp_params + *encrypt_decrypt_rsp_params)) +{ + QDF_STATUS status = QDF_STATUS_SUCCESS; + tpAniSirGlobal mac; + + if (!hal) { + QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, + FL("hHal is not valid")); + return QDF_STATUS_E_INVAL; + } + + mac = PMAC_STRUCT(hal); + + status = sme_acquire_global_lock(&mac->sme); + if (QDF_IS_STATUS_SUCCESS(status)) { + mac->sme.encrypt_decrypt_cb = encrypt_decrypt_cb; + sme_release_global_lock(&mac->sme); + } else { + QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, + FL("sme_acquire_global_lock failed")); + } + return status; +} + +/** + * sme_encrypt_decrypt_msg_deregister_callback() - Registers + * encrypt/decrypt message callback + * + * @h_hal - MAC global handle + * @callback_routine - callback routine from HDD + * + * This API is invoked by HDD to de-register its callback in SME + * + * Return: QDF_STATUS Enumeration + */ +QDF_STATUS sme_encrypt_decrypt_msg_deregister_callback(tHalHandle h_hal) +{ + QDF_STATUS status = QDF_STATUS_SUCCESS; + tpAniSirGlobal mac; + + if (!h_hal) { + QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, + FL("hHal is not valid")); + return QDF_STATUS_E_INVAL; + } + + mac = PMAC_STRUCT(h_hal); + + status = sme_acquire_global_lock(&mac->sme); + if (QDF_IS_STATUS_SUCCESS(status)) { + mac->sme.encrypt_decrypt_cb = NULL; + sme_release_global_lock(&mac->sme); + } else { + QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, + FL("sme_acquire_global_lock failed")); + } + return status; +} diff --git a/core/sme/src/common/sme_power_save.c b/core/sme/src/common/sme_power_save.c index db484af101cc..8de99d434323 100644 --- a/core/sme/src/common/sme_power_save.c +++ b/core/sme/src/common/sme_power_save.c @@ -1136,7 +1136,7 @@ QDF_STATUS sme_ps_close_per_session(tHalHandle hal_ctx, uint32_t session_id) return qdf_status; } -QDF_STATUS sme_is_auto_ps_timer_running(tHalHandle hal_ctx, +bool sme_is_auto_ps_timer_running(tHalHandle hal_ctx, uint32_t session_id) { tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal_ctx); diff --git a/core/sme/src/csr/csr_api_roam.c b/core/sme/src/csr/csr_api_roam.c index 9b9207374642..ad3768c3b13e 100644 --- a/core/sme/src/csr/csr_api_roam.c +++ b/core/sme/src/csr/csr_api_roam.c @@ -56,6 +56,7 @@ #include "wma.h" #include "cds_concurrency.h" #include "sme_nan_datapath.h" +#include "pld_common.h" #define MAX_PWR_FCC_CHAN_12 8 #define MAX_PWR_FCC_CHAN_13 2 @@ -658,6 +659,21 @@ QDF_STATUS csr_update_channel_list(tpAniSirGlobal pMac) cds_msg_t msg; uint8_t i, j, social_channel[MAX_SOCIAL_CHANNELS] = { 1, 6, 11 }; uint8_t channel_state; + uint16_t unsafe_chan[NUM_CHANNELS]; + uint16_t unsafe_chan_cnt = 0; + uint16_t cnt = 0; + uint8_t channel; + bool is_unsafe_chan; + qdf_device_t qdf_ctx = cds_get_context(QDF_MODULE_ID_QDF_DEVICE); + + if (!qdf_ctx) { + cds_err("qdf_ctx is NULL"); + return QDF_STATUS_E_FAILURE; + } + + pld_get_wlan_unsafe_channel(qdf_ctx->dev, unsafe_chan, + &unsafe_chan_cnt, + sizeof(unsafe_chan)); if (CSR_IS_5G_BAND_ONLY(pMac)) { for (i = 0; i < MAX_SOCIAL_CHANNELS; i++) { @@ -683,17 +699,45 @@ QDF_STATUS csr_update_channel_list(tpAniSirGlobal pMac) /* Scan is not performed on DSRC channels*/ if (pScan->base_channels.channelList[i] >= CDS_MIN_11P_CHANNEL) continue; + channel = pScan->base_channels.channelList[i]; channel_state = cds_get_channel_state( pScan->base_channels.channelList[i]); if ((CHANNEL_STATE_ENABLE == channel_state) || pMac->scan.fEnableDFSChnlScan) { + if ((pMac->roam.configParam.sta_roam_policy.dfs_mode == + CSR_STA_ROAM_POLICY_DFS_DISABLED) && + (channel_state == CHANNEL_STATE_DFS)) { + QDF_TRACE(QDF_MODULE_ID_SME, + QDF_TRACE_LEVEL_INFO, + FL("skip dfs channel %d"), + channel); + continue; + } + if (pMac->roam.configParam.sta_roam_policy. + skip_unsafe_channels && + unsafe_chan_cnt) { + is_unsafe_chan = false; + for (cnt = 0; cnt < unsafe_chan_cnt; cnt++) { + if (unsafe_chan[cnt] == channel) { + is_unsafe_chan = true; + break; + } + } + if (is_unsafe_chan) { + QDF_TRACE(QDF_MODULE_ID_SME, + QDF_TRACE_LEVEL_INFO, + FL("ignoring unsafe channel %d"), + channel); + continue; + } + } pChanList->chanParam[num_channel].chanId = pScan->base_channels.channelList[i]; pChanList->chanParam[num_channel].pwr = csr_find_channel_pwr(pScan->defaultPowerTable, - pChanList->chanParam[num_channel].chanId); + pChanList->chanParam[num_channel].chanId); if (pScan->fcc_constraint) { if (12 == pChanList->chanParam[num_channel].chanId) { @@ -1328,7 +1372,6 @@ static void init_config_param(tpAniSirGlobal pMac) } csr_assign_rssi_for_category(pMac, CSR_BEST_RSSI_VALUE, CSR_DEFAULT_RSSI_DB_GAP); - pMac->roam.configParam.nRoamingTime = CSR_DEFAULT_ROAMING_TIME; pMac->roam.configParam.fSupplicantCountryCodeHasPriority = false; pMac->roam.configParam.nActiveMaxChnTime = CSR_ACTIVE_MAX_CHANNEL_TIME; pMac->roam.configParam.nActiveMinChnTime = CSR_ACTIVE_MIN_CHANNEL_TIME; @@ -1354,6 +1397,7 @@ static void init_config_param(tpAniSirGlobal pMac) CSR_NUM_P2P_CHAN_COMBINED_CONC; #endif pMac->roam.configParam.nTxPowerCap = CSR_MAX_TX_POWER; + pMac->roam.configParam.allow_tpc_from_ap = true; pMac->roam.configParam.statsReqPeriodicity = CSR_MIN_GLOBAL_STAT_QUERY_PERIOD; pMac->roam.configParam.statsReqPeriodicityInPS = @@ -1756,18 +1800,56 @@ csr_fetch_ch_lst_from_received_list(tpAniSirGlobal mac_ctx, uint8_t i = 0; uint8_t num_channels = 0; uint8_t *ch_lst = NULL; + uint16_t unsafe_chan[NUM_CHANNELS]; + uint16_t unsafe_chan_cnt = 0; + uint16_t cnt = 0; + bool is_unsafe_chan; + qdf_device_t qdf_ctx = cds_get_context(QDF_MODULE_ID_QDF_DEVICE); + + if (!qdf_ctx) { + cds_err("qdf_ctx is NULL"); + return; + } + pld_get_wlan_unsafe_channel(qdf_ctx->dev, unsafe_chan, + &unsafe_chan_cnt, + sizeof(unsafe_chan)); if (curr_ch_lst_info->numOfChannels == 0) return; ch_lst = curr_ch_lst_info->ChannelList; for (i = 0; i < curr_ch_lst_info->numOfChannels; i++) { - if (((mac_ctx->roam.configParam.allowDFSChannelRoam - != CSR_ROAMING_DFS_CHANNEL_DISABLED) || - (!CDS_IS_DFS_CH(*ch_lst))) && *ch_lst) { - req_buf->ConnectedNetwork.ChannelCache[num_channels++] = - *ch_lst; + if ((!mac_ctx->roam.configParam.allowDFSChannelRoam || + (mac_ctx->roam.configParam.sta_roam_policy.dfs_mode == + CSR_STA_ROAM_POLICY_DFS_DISABLED)) && + (CDS_IS_DFS_CH(*ch_lst))) { + QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, + FL("ignoring dfs channel %d"), *ch_lst); + ch_lst++; + continue; } + + if (mac_ctx->roam.configParam.sta_roam_policy. + skip_unsafe_channels && + unsafe_chan_cnt) { + is_unsafe_chan = false; + for (cnt = 0; cnt < unsafe_chan_cnt; cnt++) { + if (unsafe_chan[cnt] == *ch_lst) { + is_unsafe_chan = true; + break; + } + } + if (is_unsafe_chan) { + QDF_TRACE(QDF_MODULE_ID_SME, + QDF_TRACE_LEVEL_INFO, + FL("ignoring unsafe channel %d"), + *ch_lst); + ch_lst++; + continue; + } + } + req_buf->ConnectedNetwork.ChannelCache[num_channels++] = + *ch_lst; ch_lst++; } req_buf->ConnectedNetwork.ChannelCount = num_channels; @@ -2182,7 +2264,6 @@ QDF_STATUS csr_change_default_config_param(tpAniSirGlobal pMac, csr_assign_rssi_for_category(pMac, pMac->first_scan_bucket_threshold, pParam->bCatRssiOffset); - pMac->roam.configParam.nRoamingTime = pParam->nRoamingTime; pMac->roam.configParam.fSupplicantCountryCodeHasPriority = pParam->fSupplicantCountryCodeHasPriority; pMac->roam.configParam.vccRssiThreshold = @@ -2195,6 +2276,8 @@ QDF_STATUS csr_change_default_config_param(tpAniSirGlobal pMac, pParam->statsReqPeriodicityInPS; /* Assign this before calling csr_init11d_info */ pMac->roam.configParam.nTxPowerCap = pParam->nTxPowerCap; + pMac->roam.configParam.allow_tpc_from_ap = + pParam->allow_tpc_from_ap; if (csr_is11d_supported(pMac)) { status = csr_init11d_info(pMac, &pParam->Csr11dinfo); } else { @@ -2430,6 +2513,10 @@ QDF_STATUS csr_change_default_config_param(tpAniSirGlobal pMac, pMac->roam.configParam.enable_fatal_event = pParam->enable_fatal_event; + pMac->roam.configParam.sta_roam_policy.dfs_mode = + pParam->sta_roam_policy_params.dfs_mode; + pMac->roam.configParam.sta_roam_policy.skip_unsafe_channels = + pParam->sta_roam_policy_params.skip_unsafe_channels; } return status; @@ -2487,12 +2574,12 @@ QDF_STATUS csr_get_config_param(tpAniSirGlobal pMac, tCsrConfigParam *pParam) pParam->scanAgeTimeCNPS = cfg_params->scanAgeTimeCNPS; pParam->scanAgeTimeCPS = cfg_params->scanAgeTimeCPS; pParam->bCatRssiOffset = cfg_params->bCatRssiOffset; - pParam->nRoamingTime = cfg_params->nRoamingTime; pParam->fSupplicantCountryCodeHasPriority = cfg_params->fSupplicantCountryCodeHasPriority; pParam->vccRssiThreshold = cfg_params->vccRssiThreshold; pParam->vccUlMacLossThreshold = cfg_params->vccUlMacLossThreshold; pParam->nTxPowerCap = cfg_params->nTxPowerCap; + pParam->allow_tpc_from_ap = cfg_params->allow_tpc_from_ap; pParam->statsReqPeriodicity = cfg_params->statsReqPeriodicity; pParam->statsReqPeriodicityInPS = cfg_params->statsReqPeriodicityInPS; pParam->addTSWhenACMIsOff = cfg_params->addTSWhenACMIsOff; @@ -2635,6 +2722,10 @@ QDF_STATUS csr_get_config_param(tpAniSirGlobal pMac, tCsrConfigParam *pParam) pParam->edca_be_aifs = pMac->roam.configParam.edca_be_aifs; pParam->enable_fatal_event = pMac->roam.configParam.enable_fatal_event; + pParam->sta_roam_policy_params.dfs_mode = + pMac->roam.configParam.sta_roam_policy.dfs_mode; + pParam->sta_roam_policy_params.skip_unsafe_channels = + pMac->roam.configParam.sta_roam_policy.skip_unsafe_channels; return QDF_STATUS_SUCCESS; } @@ -11092,8 +11183,11 @@ csr_roam_chk_lnk_set_ctx_rsp(tpAniSirGlobal mac_ctx, tSirSmeRsp *msg_ptr) pMsg = qdf_mem_malloc( sizeof(tSirSetActiveModeSetBncFilterReq)); pMsg->messageType = eWNI_SME_SET_BCN_FILTER_REQ; - pMsg->length = sizeof(uint8_t); + pMsg->length = sizeof(tSirSetActiveModeSetBncFilterReq); pMsg->seesionId = sessionId; + qdf_copy_macaddr(&pMsg->bssid, + &session->connectedProfile.bssid); + status = cds_send_mb_message_to_mac(pMsg); /* * OBSS SCAN Indication will be sent to Firmware @@ -11299,10 +11393,6 @@ bool csr_roam_complete_roaming(tpAniSirGlobal pMac, uint32_t sessionId, bool fForce, eCsrRoamResult roamResult) { bool fCompleted = true; - uint32_t roamTime = - (uint32_t) (pMac->roam.configParam.nRoamingTime * - QDF_TICKS_PER_SECOND); - uint32_t curTime = (uint32_t) qdf_mc_timer_get_system_ticks(); tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); if (!pSession) { sms_log(pMac, LOGE, FL(" session %d not found "), sessionId); @@ -11310,7 +11400,6 @@ bool csr_roam_complete_roaming(tpAniSirGlobal pMac, uint32_t sessionId, } /* Check whether time is up */ if (pSession->fCancelRoaming || fForce || - ((curTime - pSession->roamingStartTime) > roamTime) || eCsrReassocRoaming == pSession->roamingReason || eCsrDynamicRoaming == pSession->roamingReason) { sms_log(pMac, LOGW, FL(" indicates roaming completion")); @@ -11588,7 +11677,6 @@ QDF_STATUS csr_roam_lost_link(tpAniSirGlobal pMac, uint32_t sessionId, tSirSmeDeauthInd *pDeauthIndMsg = NULL; tSirSmeDisassocInd *pDisassocIndMsg = NULL; eCsrRoamResult result = eCSR_ROAM_RESULT_LOSTLINK; - tCsrRoamInfo *pRoamInfo = NULL; tCsrRoamInfo roamInfo; bool fToRoam; tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); @@ -11680,50 +11768,7 @@ QDF_STATUS csr_roam_lost_link(tpAniSirGlobal pMac, uint32_t sessionId, (eWNI_SME_DEAUTH_IND == type) ? eCsrLostlinkRoamingDeauth : eCsrLostlinkRoamingDisassoc); - if (pMac->roam.configParam.nRoamingTime) { - status = csr_roam_start_roaming(pMac, sessionId, - (eWNI_SME_DEAUTH_IND == type) ? - eCsrLostlinkRoamingDeauth : - eCsrLostlinkRoamingDisassoc); - if (QDF_IS_STATUS_SUCCESS(status)) { - qdf_mem_set(&roamInfo, sizeof(tCsrRoamInfo), 0); - /* For IBSS, we need to give some more info to HDD */ - if (csr_is_bss_type_ibss - (pSession->connectedProfile.BSSType)) { - roamInfo.u.pConnectedProfile = - &pSession->connectedProfile; - roamInfo.statusCode = - (tSirResultCodes) pSession-> - roamingStatusCode; - roamInfo.reasonCode = - pSession->joinFailStatusCode. - reasonCode; - } else { - roamInfo.reasonCode = - eCsrRoamReasonSmeIssuedForLostLink; - } - pRoamInfo = &roamInfo; - pSession->roamingReason = - (eWNI_SME_DEAUTH_IND == - type) ? eCsrLostlinkRoamingDeauth : - eCsrLostlinkRoamingDisassoc; - pSession->roamingStartTime = - (uint32_t) qdf_mc_timer_get_system_ticks(); - csr_roam_call_callback(pMac, sessionId, pRoamInfo, - 0, eCSR_ROAM_ROAMING_START, - eCSR_ROAM_RESULT_LOSTLINK); - } else { - sms_log(pMac, LOGW, - " %s Fail to start roaming, status = %d", - __func__, status); - fToRoam = false; - } - } else { - /* We are told not to roam, indicate lostlink */ - fToRoam = false; - } - } - if (!fToRoam) { + /* Tell HDD about the lost link */ if (!CSR_IS_INFRA_AP(&pSession->connectedProfile)) { /* Don't call csr_roam_call_callback for GO/SoftAp case as this indication @@ -11739,58 +11784,6 @@ QDF_STATUS csr_roam_lost_link(tpAniSirGlobal pMac, uint32_t sessionId, return status; } -QDF_STATUS csr_roam_lost_link_afterhandoff_failure(tpAniSirGlobal pMac, - uint32_t sessionId) -{ - QDF_STATUS status = QDF_STATUS_SUCCESS; - tListElem *pEntry = NULL; - tSmeCmd *pCommand = NULL; - tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); - - if (!pSession) { - sms_log(pMac, LOGE, FL(" session %d not found "), sessionId); - return QDF_STATUS_E_FAILURE; - } - - pSession->fCancelRoaming = false; - /* Only remove the connected BSS in infrastructure mode */ - csr_roam_remove_connected_bss_from_scan_cache(pMac, - &pSession->connectedProfile); - if (pMac->roam.configParam.nRoamingTime) { - status = csr_roam_start_roaming(pMac, sessionId, - pSession->roamingReason); - if (QDF_IS_STATUS_SUCCESS(status)) { - /* - * before starting the lost link logic release - * the roam command for handoff - */ - pEntry = - csr_ll_peek_head(&pMac->sme.smeCmdActiveList, - LL_ACCESS_LOCK); - if (pEntry) { - pCommand = GET_BASE_ADDR(pEntry, tSmeCmd, Link); - } - if (pCommand) { - if ((eSmeCommandRoam == pCommand->command) && - (eCsrSmeIssuedAssocToSimilarAP == - pCommand->u.roamCmd.roamReason)) { - if (csr_ll_remove_entry - (&pMac->sme.smeCmdActiveList, - pEntry, LL_ACCESS_LOCK)) { - csr_release_command_roam(pMac, - pCommand); - } - } - } - sms_log(pMac, LOGW, "Lost link roaming started ..."); - } - } else { - /* We are told not to roam, indicate lostlink */ - status = QDF_STATUS_E_FAILURE; - } - - return status; -} void csr_roam_wm_status_change_complete(tpAniSirGlobal pMac) { @@ -16802,6 +16795,21 @@ csr_fetch_ch_lst_from_ini(tpAniSirGlobal mac_ctx, uint8_t i = 0; uint8_t num_channels = 0; uint8_t *ch_lst = roam_info->cfgParams.channelInfo.ChannelList; + uint16_t unsafe_chan[NUM_CHANNELS]; + uint16_t unsafe_chan_cnt = 0; + uint16_t cnt = 0; + bool is_unsafe_chan; + qdf_device_t qdf_ctx = cds_get_context(QDF_MODULE_ID_QDF_DEVICE); + + if (!qdf_ctx) { + cds_err("qdf_ctx is NULL"); + return QDF_STATUS_E_FAILURE; + } + + pld_get_wlan_unsafe_channel(qdf_ctx->dev, unsafe_chan, + &unsafe_chan_cnt, + sizeof(unsafe_chan)); + /* * The INI channels need to be filtered with respect to the current band * that is supported. @@ -16819,15 +16827,39 @@ csr_fetch_ch_lst_from_ini(tpAniSirGlobal mac_ctx, if (!csr_check_band_channel_match(band, *ch_lst)) continue; /* Allow DFS channels only if the DFS roaming is enabled */ - if (((mac_ctx->roam.configParam.allowDFSChannelRoam != - CSR_ROAMING_DFS_CHANNEL_DISABLED) - || (!CDS_IS_DFS_CH(*ch_lst))) - && csr_roam_is_channel_valid(mac_ctx, *ch_lst) - && *ch_lst && (num_channels < SIR_ROAM_MAX_CHANNELS)) { - req_buf->ConnectedNetwork.ChannelCache[num_channels++] = - *ch_lst; + if ((!mac_ctx->roam.configParam.allowDFSChannelRoam || + (mac_ctx->roam.configParam.sta_roam_policy.dfs_mode == + CSR_STA_ROAM_POLICY_DFS_DISABLED)) && + (CDS_IS_DFS_CH(*ch_lst))) { + QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, + FL("ignoring dfs channel %d"), *ch_lst); + ch_lst++; + continue; + } + + if (mac_ctx->roam.configParam.sta_roam_policy. + skip_unsafe_channels && + unsafe_chan_cnt) { + is_unsafe_chan = false; + for (cnt = 0; cnt < unsafe_chan_cnt; cnt++) { + if (unsafe_chan[cnt] == *ch_lst) { + is_unsafe_chan = true; + break; + } + } + if (is_unsafe_chan) { + QDF_TRACE(QDF_MODULE_ID_SME, + QDF_TRACE_LEVEL_INFO, + FL("ignoring unsafe channel %d"), + *ch_lst); + ch_lst++; + continue; + } } + req_buf->ConnectedNetwork.ChannelCache[num_channels++] = + *ch_lst; ch_lst++; + } req_buf->ConnectedNetwork.ChannelCount = num_channels; req_buf->ChannelCacheType = CHANNEL_LIST_STATIC; @@ -16857,18 +16889,56 @@ csr_fetch_ch_lst_from_occupied_lst(tpAniSirGlobal mac_ctx, uint8_t num_channels = 0; uint8_t *ch_lst = mac_ctx->scan.occupiedChannels[session_id].channelList; + uint16_t unsafe_chan[NUM_CHANNELS]; + uint16_t unsafe_chan_cnt = 0; + uint16_t cnt = 0; + bool is_unsafe_chan; + qdf_device_t qdf_ctx = cds_get_context(QDF_MODULE_ID_QDF_DEVICE); + + if (!qdf_ctx) { + cds_err("qdf_ctx is NULL"); + return; + } + QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, "Num of channels before filtering=%d", mac_ctx->scan.occupiedChannels[session_id].numChannels); + pld_get_wlan_unsafe_channel(qdf_ctx->dev, unsafe_chan, + &unsafe_chan_cnt, + sizeof(unsafe_chan)); for (i = 0; i < mac_ctx->scan.occupiedChannels[session_id].numChannels; i++) { - if (((mac_ctx->roam.configParam.allowDFSChannelRoam != - CSR_ROAMING_DFS_CHANNEL_DISABLED) - || (!CDS_IS_DFS_CH(*ch_lst))) - && *ch_lst && (num_channels < SIR_ROAM_MAX_CHANNELS)) { - req_buf->ConnectedNetwork.ChannelCache[num_channels++] = - *ch_lst; + if ((!mac_ctx->roam.configParam.allowDFSChannelRoam || + (mac_ctx->roam.configParam.sta_roam_policy.dfs_mode == + CSR_STA_ROAM_POLICY_DFS_DISABLED)) && + (CDS_IS_DFS_CH(*ch_lst))) { + QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, + FL("ignoring dfs channel %d"), *ch_lst); + ch_lst++; + continue; + } + + if (mac_ctx->roam.configParam.sta_roam_policy. + skip_unsafe_channels && + unsafe_chan_cnt) { + is_unsafe_chan = false; + for (cnt = 0; cnt < unsafe_chan_cnt; cnt++) { + if (unsafe_chan[cnt] == *ch_lst) { + is_unsafe_chan = true; + break; + } + } + if (is_unsafe_chan) { + QDF_TRACE(QDF_MODULE_ID_SME, + QDF_TRACE_LEVEL_INFO, + FL("ignoring unsafe channel %d"), + *ch_lst); + ch_lst++; + continue; + } } + req_buf->ConnectedNetwork.ChannelCache[num_channels++] = + *ch_lst; if (*ch_lst) QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, "DFSRoam=%d, ChnlState=%d, Chnl=%d, num_ch=%d", @@ -16912,6 +16982,20 @@ csr_fetch_valid_ch_lst(tpAniSirGlobal mac_ctx, uint32_t host_channels = 0; uint8_t *ch_lst = NULL; uint8_t i = 0, num_channels = 0; + uint16_t unsafe_chan[NUM_CHANNELS]; + uint16_t unsafe_chan_cnt = 0; + uint16_t cnt = 0; + bool is_unsafe_chan; + qdf_device_t qdf_ctx = cds_get_context(QDF_MODULE_ID_QDF_DEVICE); + + if (!qdf_ctx) { + cds_err("qdf_ctx is NULL"); + return QDF_STATUS_E_FAILURE; + } + + pld_get_wlan_unsafe_channel(qdf_ctx->dev, unsafe_chan, + &unsafe_chan_cnt, + sizeof(unsafe_chan)); host_channels = sizeof(mac_ctx->roam.validChannelList); status = csr_get_cfg_valid_channels(mac_ctx, @@ -16925,11 +17009,38 @@ csr_fetch_valid_ch_lst(tpAniSirGlobal mac_ctx, ch_lst = mac_ctx->roam.validChannelList; mac_ctx->roam.numValidChannels = host_channels; for (i = 0; i < mac_ctx->roam.numValidChannels; i++) { - if (((mac_ctx->roam.configParam.allowDFSChannelRoam - != CSR_ROAMING_DFS_CHANNEL_DISABLED) || - (!CDS_IS_DFS_CH(*ch_lst))) && *ch_lst) { - req_buf->ValidChannelList[num_channels++] = *ch_lst; + ch_lst++; + if ((!mac_ctx->roam.configParam.allowDFSChannelRoam || + (mac_ctx->roam.configParam.sta_roam_policy.dfs_mode == + CSR_STA_ROAM_POLICY_DFS_DISABLED)) && + (CDS_IS_DFS_CH(*ch_lst))) { + QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO, + FL("ignoring dfs channel %d"), *ch_lst); + ch_lst++; + continue; + } + + if (mac_ctx->roam.configParam. + sta_roam_policy.skip_unsafe_channels && + unsafe_chan_cnt) { + is_unsafe_chan = false; + for (cnt = 0; cnt < unsafe_chan_cnt; cnt++) { + if (unsafe_chan[cnt] == *ch_lst) { + is_unsafe_chan = true; + break; + } + } + if (is_unsafe_chan) { + QDF_TRACE(QDF_MODULE_ID_SME, + QDF_TRACE_LEVEL_INFO, + FL("ignoring unsafe channel %d"), + *ch_lst); + ch_lst++; + continue; + } } + req_buf->ConnectedNetwork.ChannelCache[num_channels++] = + *ch_lst; ch_lst++; } req_buf->ValidChannelCount = num_channels; @@ -17279,6 +17390,29 @@ bool csr_is_RSO_cmd_allowed(tpAniSirGlobal mac_ctx, uint8_t command, return ret_val; } +/* + * csr_roam_send_rso_cmd() - API to send RSO command to PE + * @mac_ctx: Pointer to global MAC structure + * @session_id: Session ID + * @request_buf: Pointer to tSirRoamOffloadScanReq + * + * Return: QDF_STATUS + */ +QDF_STATUS csr_roam_send_rso_cmd(tpAniSirGlobal mac_ctx, uint8_t session_id, + tSirRoamOffloadScanReq *request_buf) +{ + QDF_STATUS status; + request_buf->message_type = eWNI_SME_ROAM_SCAN_OFFLOAD_REQ; + request_buf->length = sizeof(*request_buf); + + status = cds_send_mb_message_to_mac(request_buf); + if (QDF_STATUS_SUCCESS != status) { + sms_log(mac_ctx, LOGE, FL("Send RSO from CSR failed")); + return status; + } + return QDF_STATUS_SUCCESS; +} + /** * csr_append_assoc_ies() - Append specific IE to assoc IE's buffer * @mac_ctx: Pointer to global mac context @@ -17391,7 +17525,6 @@ csr_roam_offload_scan(tpAniSirGlobal mac_ctx, uint8_t session_id, uint8_t command, uint8_t reason) { uint8_t *state = NULL; - cds_msg_t msg; tSirRoamOffloadScanReq *req_buf; QDF_STATUS status = QDF_STATUS_SUCCESS; tCsrRoamSession *session = CSR_GET_SESSION(mac_ctx, session_id); @@ -17582,17 +17715,11 @@ csr_roam_offload_scan(tpAniSirGlobal mac_ctx, uint8_t session_id, csr_update_driver_assoc_ies(mac_ctx, session, req_buf); } - msg.type = WMA_ROAM_SCAN_OFFLOAD_REQ; - msg.reserved = 0; - msg.bodyptr = req_buf; - MTRACE(qdf_trace(QDF_MODULE_ID_SME, TRACE_CODE_SME_TX_WMA_MSG, - session_id, msg.type)); - if (!QDF_IS_STATUS_SUCCESS - (cds_mq_post_message(QDF_MODULE_ID_WMA, &msg))) { + if (!QDF_IS_STATUS_SUCCESS( + csr_roam_send_rso_cmd(mac_ctx, session_id, req_buf))) { QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, - "%s: Not able to post message to WMA", + "%s: Not able to post message to PE", __func__); - qdf_mem_free(req_buf); return QDF_STATUS_E_FAILURE; } else { if (ROAM_SCAN_OFFLOAD_START == command) @@ -18570,6 +18697,7 @@ void csr_process_ho_fail_ind(tpAniSirGlobal pMac, void *pMsgBuf) sessionId); return; } + cds_set_connection_in_progress(false); csr_roam_synch_clean_up(pMac, sessionId); csr_roaming_report_diag_event(pMac, NULL, eCSR_REASON_ROAM_HO_FAIL); @@ -19293,18 +19421,41 @@ void csr_roam_synch_callback(tpAniSirGlobal mac_ctx, eCSR_ROAM_FT_START, eSIR_SME_SUCCESS); sme_release_global_lock(&mac_ctx->sme); return; - case SIR_ROAMING_TX_QUEUE_DISABLE: + case SIR_ROAMING_START: csr_roam_call_callback(mac_ctx, session_id, NULL, 0, - eCSR_ROAM_DISABLE_QUEUES, eSIR_SME_SUCCESS); + eCSR_ROAM_START, eSIR_SME_SUCCESS); sme_release_global_lock(&mac_ctx->sme); return; - case SIR_ROAMING_TX_QUEUE_ENABLE: + case SIR_ROAMING_ABORT: csr_roam_call_callback(mac_ctx, session_id, NULL, 0, - eCSR_ROAM_ENABLE_QUEUES, eSIR_SME_SUCCESS); + eCSR_ROAM_ABORT, eSIR_SME_SUCCESS); sme_release_global_lock(&mac_ctx->sme); return; case SIR_ROAM_SYNCH_PROPAGATION: break; + case SIR_ROAM_SYNCH_COMPLETE: + /* + * Following operations need to be done once roam sync + * completion is sent to FW, hence called here: + * 1) Firmware has already updated DBS policy. Update connection + * table in the host driver. + * 2) Force SCC switch if needed + * 3) Set connection in progress = false + */ + /* first update connection info from wma interface */ + cds_update_connection_info(session_id); + /* then update remaining parameters from roam sync ctx */ + sms_log(mac_ctx, LOGE, FL("Update DBS hw mode")); + cds_hw_mode_transition_cb( + roam_synch_data->hw_mode_trans_ind.old_hw_mode_index, + roam_synch_data->hw_mode_trans_ind.new_hw_mode_index, + roam_synch_data->hw_mode_trans_ind.num_vdev_mac_entries, + roam_synch_data->hw_mode_trans_ind.vdev_mac_map); + cds_set_connection_in_progress(false); + session->roam_synch_in_progress = false; + cds_check_concurrent_intf_and_restart_sap(session->pContext); + sme_release_global_lock(&mac_ctx->sme); + return; default: sms_log(mac_ctx, LOGE, FL("LFR3: callback reason %d"), reason); sme_release_global_lock(&mac_ctx->sme); @@ -19529,6 +19680,7 @@ void csr_roam_synch_callback(tpAniSirGlobal mac_ctx, ("NO CSR_IS_WAIT_FOR_KEY -> csr_roam_link_up")); csr_roam_link_up(mac_ctx, conn_profile->bssid); } + session->fRoaming = false; session->roam_synch_in_progress = false; qdf_mem_free(roam_info->pbFrames); diff --git a/core/sme/src/csr/csr_api_scan.c b/core/sme/src/csr/csr_api_scan.c index b33ccace5a31..a0f7a7efdc96 100644 --- a/core/sme/src/csr/csr_api_scan.c +++ b/core/sme/src/csr/csr_api_scan.c @@ -53,6 +53,7 @@ #include "cds_concurrency.h" #include "wlan_hdd_main.h" +#include "pld_common.h" #define MIN_CHN_TIME_TO_FIND_GO 100 #define MAX_CHN_TIME_TO_FIND_GO 100 @@ -5363,6 +5364,23 @@ static void csr_scan_copy_request_valid_channels_only(tpAniSirGlobal mac_ctx, { uint32_t index = 0; uint32_t new_index = 0; + uint16_t unsafe_chan[NUM_CHANNELS]; + uint16_t unsafe_chan_cnt = 0; + uint16_t cnt = 0; + bool is_unsafe_chan; + qdf_device_t qdf_ctx = cds_get_context(QDF_MODULE_ID_QDF_DEVICE); + + if (!qdf_ctx) { + cds_err("qdf_ctx is NULL"); + return; + } + pld_get_wlan_unsafe_channel(qdf_ctx->dev, unsafe_chan, + &unsafe_chan_cnt, + sizeof(unsafe_chan)); + + if (mac_ctx->roam.configParam.sta_roam_policy.dfs_mode == + CSR_STA_ROAM_POLICY_DFS_DISABLED) + skip_dfs_chnl = true; for (index = 0; index < src_req->ChannelInfo.numOfChannels; index++) { /* Allow scan on valid channels only. @@ -5395,6 +5413,27 @@ static void csr_scan_copy_request_valid_channels_only(tpAniSirGlobal mac_ctx, [index]); continue; } + if (mac_ctx->roam.configParam. + sta_roam_policy.skip_unsafe_channels && + unsafe_chan_cnt) { + is_unsafe_chan = false; + for (cnt = 0; cnt < unsafe_chan_cnt; cnt++) { + if (unsafe_chan[cnt] == + src_req->ChannelInfo. + ChannelList[index]) { + is_unsafe_chan = true; + break; + } + } + if (is_unsafe_chan) { + QDF_TRACE(QDF_MODULE_ID_SME, + QDF_TRACE_LEVEL_INFO, + FL("ignoring unsafe channel %d"), + src_req->ChannelInfo. + ChannelList[index]); + continue; + } + } dst_req->ChannelInfo.ChannelList[new_index] = src_req->ChannelInfo.ChannelList[index]; @@ -6815,7 +6854,6 @@ static void csr_send_scan_abort(tpAniSirGlobal mac_ctx, scan_id, session_id); status = cds_send_mb_message_to_mac(msg); if (!QDF_IS_STATUS_SUCCESS(status)) { - qdf_mem_free(msg); sms_log(mac_ctx, LOGE, FL("Failed to send abort scan.scan_id %d session %d"), scan_id, session_id); @@ -7339,7 +7377,6 @@ void csr_scan_active_list_timeout_handle(void *userData) if (!QDF_IS_STATUS_SUCCESS(status)) { sms_log(mac_ctx, LOGE, FL(" Failed to post message to LIM")); - qdf_mem_free(msg); } csr_save_scan_results(mac_ctx, scan_cmd->u.scanCmd.reason, scan_cmd->sessionId); diff --git a/core/sme/src/csr/csr_host_scan_roam.c b/core/sme/src/csr/csr_host_scan_roam.c index 9f56f7c303fe..fcbd0400ac49 100644 --- a/core/sme/src/csr/csr_host_scan_roam.c +++ b/core/sme/src/csr/csr_host_scan_roam.c @@ -203,6 +203,25 @@ void csr_neighbor_roam_process_scan_results(tpAniSirGlobal mac_ctx, "SKIP-currently associated AP"); continue; } + + /* + * Continue if MCC is disabled in INI and if AP + * will create MCC + */ + if (cds_concurrent_open_sessions_running() && + !mac_ctx->roam.configParam.fenableMCCMode) { + uint8_t conc_channel; + + conc_channel = + csr_get_concurrent_operation_channel(mac_ctx); + if (conc_channel && + (conc_channel != + scan_result->BssDescriptor.channelId)) { + sms_log(mac_ctx, LOG1, FL("MCC not supported so Ignore AP on channel %d"), + scan_result->BssDescriptor.channelId); + continue; + } + } /* * In case of reassoc requested by upper layer, look * for exact match of bssid & channel. csr cache might diff --git a/core/sme/src/csr/csr_inside_api.h b/core/sme/src/csr/csr_inside_api.h index 0593c7c83214..b8ee71bc58f5 100644 --- a/core/sme/src/csr/csr_inside_api.h +++ b/core/sme/src/csr/csr_inside_api.h @@ -90,7 +90,6 @@ #define CSR_BSS_CAP_VALUE_WMM 1 #define CSR_BSS_CAP_VALUE_UAPSD 1 #define CSR_BSS_CAP_VALUE_5GHZ 2 -#define CSR_DEFAULT_ROAMING_TIME 10 /* 10 seconds */ #define CSR_ROAMING_DFS_CHANNEL_DISABLED (0) #define CSR_ROAMING_DFS_CHANNEL_ENABLED_NORMAL (1) diff --git a/core/sme/src/csr/csr_neighbor_roam.c b/core/sme/src/csr/csr_neighbor_roam.c index 5a04fcedb69c..535171b7f3f6 100644 --- a/core/sme/src/csr/csr_neighbor_roam.c +++ b/core/sme/src/csr/csr_neighbor_roam.c @@ -1133,8 +1133,10 @@ QDF_STATUS csr_neighbor_roam_indicate_connect( return QDF_STATUS_E_NOMEM; } msg->messageType = eWNI_SME_SET_BCN_FILTER_REQ; - msg->length = sizeof(uint8_t); + msg->length = sizeof(tSirSetActiveModeSetBncFilterReq); msg->seesionId = session_id; + qdf_copy_macaddr(&msg->bssid, + &session->connectedProfile.bssid); status = cds_send_mb_message_to_mac(msg); qdf_copy_macaddr(&roamInfo.peerMac, &session->connectedProfile.bssid); @@ -1743,8 +1745,9 @@ QDF_STATUS csr_neighbor_roam_proceed_with_handoff_req(tpAniSirGlobal pMac, pNeighborRoamInfo->neighborRoamState) || (!pNeighborRoamInfo->uOsRequestedHandoff)) { sms_log(pMac, LOGE, - FL - ("Received in not CONNECTED state or uOsRequestedHandoff is not set. Ignore it")); + FL("Received in not CONNECTED state(%d) or uOsRequestedHandoff(%d) is not set. Ignore it"), + pNeighborRoamInfo->neighborRoamState, + pNeighborRoamInfo->uOsRequestedHandoff); status = QDF_STATUS_E_FAILURE; } else { /* Let's go ahead with handoff */ diff --git a/core/sme/src/qos/sme_qos.c b/core/sme/src/qos/sme_qos.c index 641943e38f76..5eaa248c031a 100644 --- a/core/sme/src/qos/sme_qos.c +++ b/core/sme/src/qos/sme_qos.c @@ -379,6 +379,7 @@ sme_QosStatusType sme_qos_internal_modify_req(tpAniSirGlobal pMac, uint32_t QosFlowID, bool buffered_cmd); sme_QosStatusType sme_qos_internal_release_req(tpAniSirGlobal pMac, + uint8_t session_id, uint32_t QosFlowID, bool buffered_cmd); sme_QosStatusType sme_qos_setup(tpAniSirGlobal pMac, @@ -745,6 +746,7 @@ sme_QosStatusType sme_qos_modify_req(tHalHandle hHal, * releasing a QoS flow running on a particular AC. * * @hHal: The handle returned by mac_open. + * @session_id: session_id returned by sme_open_session. * @QosFlowID: Identification per flow running on each AC generated by SME * It is only meaningful if the QoS setup for the flow is successful * @@ -754,7 +756,8 @@ sme_QosStatusType sme_qos_modify_req(tHalHandle hHal, * * Return: QDF_STATUS_SUCCESS - Release is successful. */ -sme_QosStatusType sme_qos_release_req(tHalHandle hHal, uint32_t QosFlowID) +sme_QosStatusType sme_qos_release_req(tHalHandle hHal, uint8_t session_id, + uint32_t QosFlowID) { QDF_STATUS lock_status = QDF_STATUS_E_FAILURE; tpAniSirGlobal pMac = PMAC_STRUCT(hHal); @@ -769,7 +772,8 @@ sme_QosStatusType sme_qos_release_req(tHalHandle hHal, uint32_t QosFlowID) return SME_QOS_STATUS_RELEASE_FAILURE_RSP; } /* Call the internal function for QoS release, adding a layer of abstraction */ - status = sme_qos_internal_release_req(pMac, QosFlowID, false); + status = sme_qos_internal_release_req(pMac, session_id, QosFlowID, + false); sme_release_global_lock(&pMac->sme); QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO_HIGH, "%s: %d: QoS Release return status on Flow %d is %d", @@ -1997,6 +2001,7 @@ sme_QosStatusType sme_qos_internal_modify_req(tpAniSirGlobal pMac, /** * sme_qos_internal_release_req() - release QOS flow on a particular AC * @pMac: Pointer to the global MAC parameter structure. + * @sessionId: sessionId returned by sme_open_session. * @QosFlowID: Identification per flow running on each AC generated by SME * It is only meaningful if the QoS setup for the flow is successful * @@ -2006,6 +2011,7 @@ sme_QosStatusType sme_qos_internal_modify_req(tpAniSirGlobal pMac, * Return: QDF_STATUS_SUCCESS - Release is successful. */ sme_QosStatusType sme_qos_internal_release_req(tpAniSirGlobal pMac, + uint8_t sessionId, uint32_t QosFlowID, bool buffered_cmd) { @@ -2022,7 +2028,6 @@ sme_QosStatusType sme_qos_internal_release_req(tpAniSirGlobal pMac, sme_QosCmdInfo cmd; tCsrRoamModifyProfileFields modifyProfileFields; bool deltsIssued = false; - uint8_t sessionId; QDF_STATUS hstatus; bool biDirectionalFlowsPresent = false; bool uplinkFlowsPresent = false; @@ -2044,6 +2049,23 @@ sme_QosStatusType sme_qos_internal_release_req(tpAniSirGlobal pMac, QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, "%s: %d: no match found for flowID = %d", __func__, __LINE__, QosFlowID); + + pSession = &sme_qos_cb.sessionInfo[sessionId]; + if (!buffered_cmd && + !csr_ll_is_list_empty(&pSession->bufferedCommandList, + false)) { + cmd.command = SME_QOS_RELEASE_REQ; + cmd.pMac = pMac; + cmd.sessionId = sessionId; + cmd.u.releaseCmdInfo.QosFlowID = QosFlowID; + hstatus = sme_qos_buffer_cmd(&cmd, buffered_cmd); + if (QDF_IS_STATUS_SUCCESS(hstatus)) { + QDF_TRACE(QDF_MODULE_ID_SME, + QDF_TRACE_LEVEL_INFO_HIGH, + "%s:%d: Buffered release request for flow = %d", + __func__, __LINE__, QosFlowID); + } + } return SME_QOS_STATUS_RELEASE_INVALID_PARAMS_RSP; } /* find the AC */ @@ -6409,6 +6431,7 @@ static QDF_STATUS sme_qos_process_buffered_cmd(uint8_t session_id) break; case SME_QOS_RELEASE_REQ: hdd_status = sme_qos_internal_release_req(qos_cmd->pMac, + qos_cmd->sessionId, qos_cmd->u.releaseCmdInfo.QosFlowID, true); if (SME_QOS_STATUS_RELEASE_FAILURE_RSP == hdd_status) { @@ -6721,7 +6744,8 @@ QDF_STATUS sme_qos_del_ts_ind_fnp(tpAniSirGlobal pMac, tListElem *pEntry) } /* Call the internal function for QoS release, adding a layer of abstraction */ status = - sme_qos_internal_release_req(pMac, flow_info->QosFlowID, false); + sme_qos_internal_release_req(pMac, flow_info->sessionId, + flow_info->QosFlowID, false); sme_release_global_lock(&pMac->sme); QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_INFO_HIGH, "%s: %d: QoS Release return status on Flow %d is %d", diff --git a/core/utils/pktlog/include/pktlog_ac.h b/core/utils/pktlog/include/pktlog_ac.h index cd45f6987aae..a7fcf493a98b 100644 --- a/core/utils/pktlog/include/pktlog_ac.h +++ b/core/utils/pktlog/include/pktlog_ac.h @@ -72,7 +72,8 @@ wdi_pktlog_unsubscribe(struct ol_txrx_pdev_t *txrx_pdev, uint32_t log_state); struct ol_pl_arch_dep_funcs { void (*pktlog_init)(struct hif_opaque_softc *scn); int (*pktlog_enable)(struct hif_opaque_softc *scn, int32_t log_state, - bool ini, uint8_t user); + bool ini, uint8_t user, + uint32_t is_iwpriv_command); int (*pktlog_setsize)(struct hif_opaque_softc *scn, int32_t log_state); int (*pktlog_disable)(struct hif_opaque_softc *scn); }; @@ -104,7 +105,7 @@ struct ol_pktlog_dev_t { uint32_t htc_err_cnt; uint8_t htc_endpoint; void *htc_pdev; - bool enable_flag; + bool vendor_cmd_send; }; #define PKTLOG_SYSCTL_SIZE 14 @@ -132,7 +133,7 @@ void pktlog_callback(void *pdev, enum WDI_EVENT event, void *log_data); void pktlog_init(struct hif_opaque_softc *scn); int pktlog_enable(struct hif_opaque_softc *scn, int32_t log_state, - bool, uint8_t); + bool, uint8_t, uint32_t); int pktlog_setsize(struct hif_opaque_softc *scn, int32_t log_state); int pktlog_disable(struct hif_opaque_softc *scn); int pktlogmod_init(void *context); @@ -162,7 +163,7 @@ static inline void pktlog_init(struct hif_opaque_softc *scn) return; } static int pktlog_enable(struct hif_opaque_softc *scn, int32_t log_state, - bool ini, uint8_t user) + bool ini, uint8_t user, uint32_t is_iwpriv_command) { return 0; } diff --git a/core/utils/pktlog/include/pktlog_ac_i.h b/core/utils/pktlog/include/pktlog_ac_i.h index 78fd0ebd26f3..15b83d35ce8b 100644 --- a/core/utils/pktlog/include/pktlog_ac_i.h +++ b/core/utils/pktlog/include/pktlog_ac_i.h @@ -32,7 +32,11 @@ #include <ol_txrx_internal.h> #include <pktlog_ac.h> -#define PKTLOG_DEFAULT_BUFSIZE (1024 * 1024) +#ifdef FEATURE_PKTLOG +#define PKTLOG_DEFAULT_BUFSIZE (10 * 1024 * 1024) /* 10MB */ +#else +#define PKTLOG_DEFAULT_BUFSIZE (1 * 1024 * 1024) /* 1MB */ +#endif #define PKTLOG_DEFAULT_SACK_THR 3 #define PKTLOG_DEFAULT_TAIL_LENGTH 100 #define PKTLOG_DEFAULT_THRUPUT_THRESH (64 * 1024) diff --git a/core/utils/pktlog/linux_ac.c b/core/utils/pktlog/linux_ac.c index c312b5903487..f885d6672038 100644 --- a/core/utils/pktlog/linux_ac.c +++ b/core/utils/pktlog/linux_ac.c @@ -230,13 +230,9 @@ qdf_sysctl_decl(ath_sysctl_pktlog_enable, ctl, write, filp, buffer, lenp, ppos) ret = QDF_SYSCTL_PROC_DOINTVEC(ctl, write, filp, buffer, lenp, ppos); if (ret == 0) - /* - * enable/disable pktlog through sysfs should be counted - * as user_triggered = 1. - */ ret = pl_dev->pl_funcs->pktlog_enable( (struct hif_opaque_softc *)scn, enable, - cds_is_packet_log_enabled(), 1); + cds_is_packet_log_enabled(), 0, 1); else printk(PKTLOG_TAG "%s:proc_dointvec failed\n", __func__); @@ -444,7 +440,7 @@ static int pktlog_attach(struct hif_opaque_softc *scn) * might be good to move to pktlog_init */ /* pl_dev->tgt_pktlog_alloced = false; */ - pl_dev->enable_flag = false; + pl_dev->vendor_cmd_send = false; pl_info_lnx->proc_entry = NULL; pl_info_lnx->sysctl_header = NULL; @@ -514,7 +510,7 @@ static void pktlog_detach(struct hif_opaque_softc *scn) ASSERT(0); return; } - pl_dev->enable_flag = false; + pl_info = pl_dev->pl_info; remove_proc_entry(WLANDEV_BASENAME, g_pktlog_pde); pktlog_sysctl_unregister(pl_dev); @@ -853,6 +849,14 @@ pktlog_read(struct file *file, char *buf, size_t nbytes, loff_t *ppos) if (log_buf == NULL) return 0; + if (pl_info->log_state) { + /* Read is not allowed when write is going on + * When issuing cat command, ensure to send + * pktlog disable command first. + */ + return -EINVAL; + } + if (*ppos == 0 && pl_info->log_state) { pl_info->saved_state = pl_info->log_state; pl_info->log_state = 0; diff --git a/core/utils/pktlog/pktlog_ac.c b/core/utils/pktlog/pktlog_ac.c index d3055e134485..dc7d0927fcb6 100644 --- a/core/utils/pktlog/pktlog_ac.c +++ b/core/utils/pktlog/pktlog_ac.c @@ -311,7 +311,6 @@ int pktlog_disable(struct hif_opaque_softc *scn) return -EFAULT; pl_dev = txrx_pdev->pl_dev; - pl_dev->enable_flag = false; pl_info = pl_dev->pl_info; if (pktlog_wma_post_msg(0, WMI_PDEV_PKTLOG_DISABLE_CMDID, 0, 0)) { @@ -356,7 +355,7 @@ void pktlog_init(struct hif_opaque_softc *scn) pl_info->pktlen = 0; pl_info->start_time_thruput = 0; pl_info->start_time_per = 0; - pdev_txrx_handle->pl_dev->enable_flag = false; + pdev_txrx_handle->pl_dev->vendor_cmd_send = false; PKTLOG_TX_SUBSCRIBER.callback = pktlog_callback; PKTLOG_RX_SUBSCRIBER.callback = pktlog_callback; @@ -367,7 +366,8 @@ void pktlog_init(struct hif_opaque_softc *scn) } int pktlog_enable(struct hif_opaque_softc *scn, int32_t log_state, - bool ini_triggered, uint8_t user_triggered) + bool ini_triggered, uint8_t user_triggered, + uint32_t is_iwpriv_command) { struct ol_pktlog_dev_t *pl_dev; struct ath_pktlog_info *pl_info; @@ -398,17 +398,15 @@ int pktlog_enable(struct hif_opaque_softc *scn, int32_t log_state, if (!pl_info) return 0; - /* - * Do not send the pktlog disable command in case when pktlog - * is enabled from INI during init, SO make enable_flag as false. - * send the pktlog disable command only after when user will triggere - * iwpriv pktlog enable command or enable through pktlog conf tool or - * vendor will send pktlog enable command. + + /* is_iwpriv_command : 0 indicates its a vendor command + * log_state: 0 indicates pktlog disable command + * vendor_cmd_send flag; false means no vendor pktlog enable + * command was sent previously */ - if (ini_triggered == 1 && user_triggered == 0 && log_state != 0) - pl_dev->enable_flag = false; - else if (log_state != 0) - pl_dev->enable_flag = true; + if (is_iwpriv_command == 0 && log_state == 0 && + pl_dev->vendor_cmd_send == false) + return 0; if (!pl_dev->tgt_pktlog_alloced) { if (pl_info->buf == NULL) { @@ -455,8 +453,13 @@ int pktlog_enable(struct hif_opaque_softc *scn, int32_t log_state, printk("Device cannot be enabled, %s\n", __func__); return -1; } - } else if (pl_dev->enable_flag) { + + if (is_iwpriv_command == 0) + pl_dev->vendor_cmd_send = true; + } else { pl_dev->pl_funcs->pktlog_disable(scn); + if (is_iwpriv_command == 0) + pl_dev->vendor_cmd_send = false; } pl_info->log_state = log_state; diff --git a/core/wma/inc/wma.h b/core/wma/inc/wma.h index b82ba1f1738d..f22aea6dac5d 100644 --- a/core/wma/inc/wma.h +++ b/core/wma/inc/wma.h @@ -415,6 +415,9 @@ static const t_probeTime_dwellTime }; typedef void (*txFailIndCallback)(uint8_t *peer_mac, uint8_t seqNo); +typedef void (*encrypt_decrypt_cb)(struct sir_encrypt_decrypt_rsp_params + *encrypt_decrypt_rsp_params); + /** * enum t_wma_drv_type - wma driver type @@ -2213,3 +2216,6 @@ WLAN_PHY_MODE wma_chan_phy_mode(u8 chan, enum phy_ch_width chan_width, QDF_STATUS wma_start_oem_data_req(tp_wma_handle wma_handle, struct oem_data_req *oem_req); #endif + +QDF_STATUS wma_enable_disable_caevent_ind(tp_wma_handle wma_handle, + uint8_t val); diff --git a/core/wma/inc/wma_api.h b/core/wma/inc/wma_api.h index a63db28d3d8e..dcd121e37fdb 100644 --- a/core/wma/inc/wma_api.h +++ b/core/wma/inc/wma_api.h @@ -296,4 +296,11 @@ bool wma_is_p2p_lo_capable(void); QDF_STATUS wma_p2p_lo_start(struct sir_p2p_lo_start *params); QDF_STATUS wma_p2p_lo_stop(u_int32_t vdev_id); QDF_STATUS wma_get_wakelock_stats(struct sir_wake_lock_stats *wake_lock_stats); +void wma_process_pdev_hw_mode_trans_ind(void *wma, + wmi_pdev_hw_mode_transition_event_fixed_param *fixed_param, + wmi_pdev_set_hw_mode_response_vdev_mac_entry *vdev_mac_entry, + struct sir_hw_mode_trans_ind *hw_mode_trans_ind); +QDF_STATUS wma_set_powersave_config(uint8_t val); +QDF_STATUS wma_encrypt_decrypt_msg(WMA_HANDLE wma, + struct encrypt_decrypt_req_params *encrypt_decrypt_params); #endif diff --git a/core/wma/inc/wma_internal.h b/core/wma/inc/wma_internal.h index dadac756d645..f35044e57d4a 100644 --- a/core/wma/inc/wma_internal.h +++ b/core/wma/inc/wma_internal.h @@ -1214,4 +1214,7 @@ QDF_STATUS wma_process_hal_pwr_dbg_cmd(WMA_HANDLE handle, struct sir_mac_pwr_dbg_cmd * sir_pwr_dbg_params); +int wma_encrypt_decrypt_msg_handler(void *handle, uint8_t *data, + uint32_t data_len); + #endif diff --git a/core/wma/inc/wma_tgt_cfg.h b/core/wma/inc/wma_tgt_cfg.h index b49e69cd5955..7e9b68837142 100644 --- a/core/wma/inc/wma_tgt_cfg.h +++ b/core/wma/inc/wma_tgt_cfg.h @@ -175,5 +175,6 @@ struct wma_tgt_cfg { bool nan_datapath_enabled; #endif bool sub_20_support; + uint16_t wmi_max_len; }; #endif /* WMA_TGT_CFG_H */ diff --git a/core/wma/inc/wma_types.h b/core/wma/inc/wma_types.h index 247744e10fb2..89f06c9db0b5 100644 --- a/core/wma/inc/wma_types.h +++ b/core/wma/inc/wma_types.h @@ -473,6 +473,9 @@ #define WMA_SET_PDEV_IE_REQ SIR_HAL_SET_PDEV_IE_REQ #define WMA_UPDATE_WEP_DEFAULT_KEY SIR_HAL_UPDATE_WEP_DEFAULT_KEY +#define WMA_SEND_FREQ_RANGE_CONTROL_IND SIR_HAL_SEND_FREQ_RANGE_CONTROL_IND +#define WMA_ENCRYPT_DECRYPT_MSG SIR_HAL_ENCRYPT_DECRYPT_MSG + /* Bit 6 will be used to control BD rate for Management frames */ #define HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME 0x40 diff --git a/core/wma/src/wma_dev_if.c b/core/wma/src/wma_dev_if.c index 4a9426bf692d..d3d479e8f427 100644 --- a/core/wma/src/wma_dev_if.c +++ b/core/wma/src/wma_dev_if.c @@ -424,6 +424,7 @@ void wma_vdev_detach_callback(void *ctx) return; } param = (struct del_sta_self_params *) iface->del_staself_req; + iface->del_staself_req = NULL; WMA_LOGE("%s: sending eWNI_SME_DEL_STA_SELF_RSP for vdev %d", __func__, param->session_id); if (!WMI_SERVICE_IS_ENABLED(wma->wmi_service_bitmap, @@ -1483,7 +1484,9 @@ int wma_vdev_stop_resp_handler(void *handle, uint8_t *cmd_param_info, 0); } - if (iface->del_staself_req) { + if ((iface->del_staself_req != NULL) && + (iface->type == WMI_VDEV_TYPE_AP) && + (iface->sub_type == WMI_UNIFIED_VDEV_SUBTYPE_P2P_GO)) { WMA_LOGA("scheduling defered deletion (vdev id %x)", resp_event->vdev_id); wma_vdev_detach(wma, iface->del_staself_req, 1); @@ -2520,60 +2523,14 @@ void wma_vdev_resp_timer(void *data) qdf_mem_zero(iface, sizeof(*iface)); } else if (tgt_req->msg_type == WMA_ADD_BSS_REQ) { tpAddBssParams params = (tpAddBssParams) tgt_req->user_data; - tDeleteBssParams *del_bss_params = - qdf_mem_malloc(sizeof(tDeleteBssParams)); - if (NULL == del_bss_params) { - WMA_LOGE("Failed to allocate memory for del_bss_params"); - peer = ol_txrx_find_peer_by_addr(pdev, params->bssId, - &peer_id); - goto error0; - } - - del_bss_params->status = params->status = - QDF_STATUS_FW_MSG_TIMEDOUT; - del_bss_params->sessionId = params->sessionId; - del_bss_params->bssIdx = params->bssIdx; - qdf_mem_copy(del_bss_params->bssid, params->bssId, - sizeof(tSirMacAddr)); WMA_LOGA("%s: WMA_ADD_BSS_REQ timedout", __func__); - peer = ol_txrx_find_peer_by_addr(pdev, params->bssId, &peer_id); - if (!peer) { - WMA_LOGP("%s: Failed to find peer %pM", __func__, - params->bssId); - } - msg = wma_fill_vdev_req(wma, tgt_req->vdev_id, WMA_DELETE_BSS_REQ, - WMA_TARGET_REQ_TYPE_VDEV_STOP, - del_bss_params, - WMA_VDEV_STOP_REQUEST_TIMEOUT); - if (!msg) { - WMA_LOGP("%s: Failed to fill vdev request for vdev_id %d", - __func__, tgt_req->vdev_id); - goto error0; - } - WMA_LOGD("%s, vdev_id: %d, pausing tx_ll_queue for VDEV_STOP (WDA_ADD_BSS_REQ timedout)", - __func__, tgt_req->vdev_id); - ol_txrx_vdev_pause(wma->interfaces[tgt_req->vdev_id].handle, - OL_TXQ_PAUSE_REASON_VDEV_STOP); - wma->interfaces[tgt_req->vdev_id].pause_bitmap |= - (1 << PAUSE_TYPE_HOST); - if (wmi_unified_vdev_stop_send - (wma->wmi_handle, tgt_req->vdev_id)) { - WMA_LOGP("%s: %d Failed to send vdev stop", __func__, - __LINE__); - wma_remove_vdev_req(wma, tgt_req->vdev_id, - WMA_TARGET_REQ_TYPE_VDEV_STOP); - goto error0; - } WMA_LOGI("%s: bssid %pM vdev_id %d", __func__, params->bssId, tgt_req->vdev_id); wma_send_msg(wma, WMA_ADD_BSS_RSP, (void *)params, 0); + QDF_ASSERT(0); goto free_tgt_req; -error0: - if (peer) - wma_remove_peer(wma, params->bssId, - tgt_req->vdev_id, peer, false); - wma_send_msg(wma, WMA_ADD_BSS_RSP, (void *)params, 0); + } else if (tgt_req->msg_type == WMA_OCB_SET_CONFIG_CMD) { struct wma_txrx_node *iface; @@ -2704,6 +2661,9 @@ wma_vdev_set_bss_params(tp_wma_handle wma, int vdev_id, WMA_LOGW("Setting Tx power limit to 0"); } + WMA_LOGI("Set maxTx pwr [WMI_VDEV_PARAM_TX_PWRLIMIT] to %d", + maxTxPower); + ret = wma_vdev_set_param(wma->wmi_handle, vdev_id, WMI_VDEV_PARAM_TX_PWRLIMIT, maxTxPower); diff --git a/core/wma/src/wma_features.c b/core/wma/src/wma_features.c index 53b7762ddef0..567ed6e7abe4 100644 --- a/core/wma/src/wma_features.c +++ b/core/wma/src/wma_features.c @@ -90,7 +90,8 @@ (1 << WOW_RA_MATCH_EVENT) |\ (1 << WOW_NLO_DETECTED_EVENT) |\ (1 << WOW_EXTSCAN_EVENT)) |\ - (1 << WOW_OEM_RESPONSE_EVENT)\ + (1 << WOW_OEM_RESPONSE_EVENT)|\ + (1 << WOW_TDLS_CONN_TRACKER_EVENT)\ #define WMA_WOW_SAP_WAKE_UP_EVENTS ((1 << WOW_PROBE_REQ_WPS_IE_EVENT) |\ (1 << WOW_PATTERN_MATCH_EVENT) |\ @@ -100,6 +101,13 @@ (1 << WOW_DISASSOC_RECVD_EVENT) |\ (1 << WOW_HTT_EVENT))\ +/** + * WMA_SET_VDEV_IE_SOURCE_HOST - Flag to identify the source of VDEV SET IE + * command. The value is 0x0 for the VDEV SET IE WMI commands from mobile + * MCL platform. + */ +#define WMA_SET_VDEV_IE_SOURCE_HOST 0x0 + static const uint8_t arp_ptrn[] = {0x08, 0x06}; static const uint8_t arp_mask[] = {0xff, 0xff}; static const uint8_t ns_ptrn[] = {0x86, 0xDD}; @@ -1124,7 +1132,6 @@ QDF_STATUS wma_add_beacon_filter(WMA_HANDLE handle, wmi_buf_free(wmi_buf); return QDF_STATUS_E_FAILURE; } - WMA_LOGD("added beacon filter = %d", ret); return QDF_STATUS_SUCCESS; } @@ -1172,7 +1179,6 @@ QDF_STATUS wma_remove_beacon_filter(WMA_HANDLE handle, wmi_buf_free(buf); return QDF_STATUS_E_FAILURE; } - WMA_LOGD("removed beacon filter = %d", ret); return QDF_STATUS_SUCCESS; } @@ -7534,12 +7540,6 @@ int wma_dfs_indicate_radar(struct ieee80211com *ic, WMA_LOGE("%s:DFS- Invalid WMA handle", __func__); return -ENOENT; } - radar_event = (struct wma_dfs_radar_indication *) - qdf_mem_malloc(sizeof(struct wma_dfs_radar_indication)); - if (radar_event == NULL) { - WMA_LOGE("%s:DFS- Invalid radar_event", __func__); - return -ENOMEM; - } /* * Do not post multiple Radar events on the same channel. @@ -7552,6 +7552,12 @@ int wma_dfs_indicate_radar(struct ieee80211com *ic, if ((ichan->ic_ieee != (wma->dfs_ic->last_radar_found_chan)) || (pmac->sap.SapDfsInfo.disable_dfs_ch_switch == true)) { + radar_event = (struct wma_dfs_radar_indication *) + qdf_mem_malloc(sizeof(struct wma_dfs_radar_indication)); + if (radar_event == NULL) { + WMA_LOGE(FL("Failed to allocate memory for radar_event")); + return -ENOMEM; + } wma->dfs_ic->last_radar_found_chan = ichan->ic_ieee; /* Indicate the radar event to HDD to stop the netif Tx queues */ wma_radar_event.chan_freq = ichan->ic_freq; @@ -7730,6 +7736,7 @@ QDF_STATUS wma_process_set_ie_info(tp_wma_handle wma, cmd.length = ie_info->length; cmd.band = ie_info->band; cmd.data = ie_info->data; + cmd.ie_source = WMA_SET_VDEV_IE_SOURCE_HOST; WMA_LOGD(FL("ie_id: %d, band: %d, len: %d"), ie_info->ie_id, ie_info->band, ie_info->length); @@ -7739,7 +7746,6 @@ QDF_STATUS wma_process_set_ie_info(tp_wma_handle wma, ret = wmi_unified_process_set_ie_info_cmd(wma->wmi_handle, &cmd); - return ret; } @@ -7901,7 +7907,6 @@ QDF_STATUS wma_set_bpf_instructions(tp_wma_handle wma, buf_ptr += WMI_TLV_HDR_SIZE; qdf_mem_copy(buf_ptr, bpf_set_offload->program, bpf_set_offload->current_length); - qdf_mem_free(bpf_set_offload->program); } if (wmi_unified_cmd_send(wma->wmi_handle, wmi_buf, len, @@ -8175,3 +8180,151 @@ void wma_process_fw_test_cmd(WMA_HANDLE handle, return; } } + +/** + * wma_enable_disable_caevent_ind() - Issue WMI command to enable or + * disable ca event indication + * @wma: wma handler + * @val: boolean value true or false + * + * Return: QDF_STATUS + */ +QDF_STATUS wma_enable_disable_caevent_ind(tp_wma_handle wma, uint8_t val) +{ + WMI_CHAN_AVOID_RPT_ALLOW_CMD_fixed_param *cmd; + wmi_buf_t wmi_buf; + uint8_t *buf_ptr; + uint32_t len; + + if (!wma || !wma->wmi_handle) { + WMA_LOGE(FL("WMA is closed, can not issue set/clear CA")); + return QDF_STATUS_E_INVAL; + } + + len = sizeof(*cmd); + wmi_buf = wmi_buf_alloc(wma->wmi_handle, len); + if (!wmi_buf) { + WMA_LOGE(FL("wmi_buf_alloc failed")); + return QDF_STATUS_E_NOMEM; + } + buf_ptr = (uint8_t *) wmi_buf_data(wmi_buf); + cmd = (WMI_CHAN_AVOID_RPT_ALLOW_CMD_fixed_param *) buf_ptr; + WMITLV_SET_HDR(&cmd->tlv_header, + WMITLV_TAG_STRUC_WMI_CHAN_AVOID_RPT_ALLOW_CMD_fixed_param, + WMITLV_GET_STRUCT_TLVLEN( + WMI_CHAN_AVOID_RPT_ALLOW_CMD_fixed_param)); + cmd->rpt_allow = val; + if (wmi_unified_cmd_send(wma->wmi_handle, wmi_buf, len, + WMI_CHAN_AVOID_RPT_ALLOW_CMDID)) { + WMA_LOGE(FL("Failed to send enable/disable CA event command")); + wmi_buf_free(wmi_buf); + return QDF_STATUS_E_FAILURE; + } + + return QDF_STATUS_SUCCESS; +} + +/** + * wma_encrypt_decrypt_msg() - + * @encrypt_decrypt_params: encryption/decryption params + * @data_len: data length + * @encrypt_decrypt_cb: encrypt/decrypt callback + * + * This function sends WMI command to check encryption/decryption engine. + * + * Return: QDF_STATUS enumeration + */ +QDF_STATUS wma_encrypt_decrypt_msg(WMA_HANDLE handle, + struct encrypt_decrypt_req_params *encrypt_decrypt_params) +{ + int ret; + tp_wma_handle wma = (tp_wma_handle) handle; + + if (!wma || !wma->wmi_handle) { + WMA_LOGE("%s: WMA is closed, can not issue encrypt/decrypt msg", + __func__); + return QDF_STATUS_E_INVAL; + } + + if (encrypt_decrypt_params == NULL) { + WMA_LOGE("%s: encrypt/decrypt ptr NULL", + __func__); + return QDF_STATUS_E_INVAL; + } + + ret = wmi_unified_encrypt_decrypt_send_cmd(wma->wmi_handle, + encrypt_decrypt_params); + + return ret; +} + +/** + * wma_encrypt_decrypt_msg_handler() - handle encrypt/decrypt data + * indicated by FW + * @handle: wma context + * @data: event buffer + * @data len: length of event buffer + * + * Return: 0 on success + */ +int wma_encrypt_decrypt_msg_handler(void *handle, uint8_t *data, + uint32_t data_len) +{ + WMI_VDEV_ENCRYPT_DECRYPT_DATA_RESP_EVENTID_param_tlvs *param_buf; + wmi_vdev_encrypt_decrypt_data_resp_event_fixed_param *data_event; + struct sir_encrypt_decrypt_rsp_params encrypt_decrypt_rsp_params; + tp_wma_handle wma = handle; + u_int8_t *buf_ptr; + tpAniSirGlobal pmac; + + if (data == NULL) { + WMA_LOGE("%s: invalid pointer", __func__); + return -EINVAL; + } + + if (wma == NULL) { + WMA_LOGE("%s: wma context is NULL", __func__); + return -EINVAL; + } + + WMA_LOGE("%s: received WMI_VDEV_ENCRYPT_DECRYPT_DATA_RESP_EVENTID ", + __func__); + + pmac = (tpAniSirGlobal)cds_get_context(QDF_MODULE_ID_PE); + + if (!pmac) { + WMA_LOGE("%s: Invalid pmac", __func__); + return -EINVAL; + } + if (!pmac->sme.encrypt_decrypt_cb) { + WMA_LOGE("%s: Callback not registered", __func__); + return -EINVAL; + } + + param_buf = + (WMI_VDEV_ENCRYPT_DECRYPT_DATA_RESP_EVENTID_param_tlvs *)data; + if (!param_buf) { + WMA_LOGE("%s: Invalid response data buf", __func__); + return -EINVAL; + } + + data_event = param_buf->fixed_param; + + encrypt_decrypt_rsp_params.vdev_id = data_event->vdev_id; + encrypt_decrypt_rsp_params.status = data_event->status; + encrypt_decrypt_rsp_params.data_length = data_event->data_length; + + if (encrypt_decrypt_rsp_params.data_length) { + buf_ptr = + (uint8_t *)data_event + + sizeof( + wmi_vdev_encrypt_decrypt_data_resp_event_fixed_param) + + WMI_TLV_HDR_SIZE; + + encrypt_decrypt_rsp_params.data = buf_ptr; + } + + pmac->sme.encrypt_decrypt_cb(pmac->hHdd, &encrypt_decrypt_rsp_params); + + return 0; +} diff --git a/core/wma/src/wma_main.c b/core/wma/src/wma_main.c index 7c74c570e82a..00f1735cc44e 100644 --- a/core/wma/src/wma_main.c +++ b/core/wma/src/wma_main.c @@ -82,6 +82,8 @@ #define WMA_LOG_COMPLETION_TIMER 10000 /* 10 seconds */ +#define WMI_TLV_HEADROOM 128 + static uint32_t g_fw_wlan_feat_caps; /** @@ -2145,6 +2147,10 @@ QDF_STATUS wma_open(void *cds_context, WMI_BPF_CAPABILIY_INFO_EVENTID, wma_get_bpf_caps_event_handler, WMA_RX_SERIALIZER_CTX); + wmi_unified_register_event_handler(wma_handle->wmi_handle, + WMI_VDEV_ENCRYPT_DECRYPT_DATA_RESP_EVENTID, + wma_encrypt_decrypt_msg_handler, + WMA_RX_SERIALIZER_CTX); wma_ndp_register_all_event_handlers(wma_handle); return QDF_STATUS_SUCCESS; @@ -2489,6 +2495,66 @@ fail: } /** + * wma_process_pdev_hw_mode_trans_ind() - Process HW mode transition info + * + * @handle: WMA handle + * @fixed_param: Event fixed parameters + * @vdev_mac_entry - vdev mac entry + * @hw_mode_trans_ind - Buffer to store parsed information + * + * Parses fixed_param, vdev_mac_entry and fills in the information into + * hw_mode_trans_ind and wma + * + * Return: None + */ +void wma_process_pdev_hw_mode_trans_ind(void *handle, + wmi_pdev_hw_mode_transition_event_fixed_param *fixed_param, + wmi_pdev_set_hw_mode_response_vdev_mac_entry *vdev_mac_entry, + struct sir_hw_mode_trans_ind *hw_mode_trans_ind) +{ + uint32_t i; + tp_wma_handle wma = (tp_wma_handle) handle; + + hw_mode_trans_ind->old_hw_mode_index = fixed_param->old_hw_mode_index; + hw_mode_trans_ind->new_hw_mode_index = fixed_param->new_hw_mode_index; + hw_mode_trans_ind->num_vdev_mac_entries = + fixed_param->num_vdev_mac_entries; + WMA_LOGI("%s: old_hw_mode_index:%d new_hw_mode_index:%d entries=%d", + __func__, fixed_param->old_hw_mode_index, + fixed_param->new_hw_mode_index, + fixed_param->num_vdev_mac_entries); + + /* Store the vdev-mac map in WMA and send to policy manager */ + for (i = 0; i < fixed_param->num_vdev_mac_entries; i++) { + uint32_t vdev_id, mac_id, pdev_id; + vdev_id = vdev_mac_entry[i].vdev_id; + pdev_id = vdev_mac_entry[i].pdev_id; + + if (pdev_id == WMI_PDEV_ID_SOC) { + WMA_LOGE("%s: soc level id received for mac id)", + __func__); + QDF_BUG(0); + return; + } + + mac_id = WMA_PDEV_TO_MAC_MAP(vdev_mac_entry[i].pdev_id); + + WMA_LOGI("%s: vdev_id:%d mac_id:%d", + __func__, vdev_id, mac_id); + + hw_mode_trans_ind->vdev_mac_map[i].vdev_id = vdev_id; + hw_mode_trans_ind->vdev_mac_map[i].mac_id = mac_id; + wma_update_intf_hw_mode_params(vdev_id, mac_id, + fixed_param->new_hw_mode_index); + } + wma->old_hw_mode_index = fixed_param->old_hw_mode_index; + wma->new_hw_mode_index = fixed_param->new_hw_mode_index; + + WMA_LOGI("%s: Updated: old_hw_mode_index:%d new_hw_mode_index:%d", + __func__, wma->old_hw_mode_index, wma->new_hw_mode_index); +} + +/** * wma_pdev_hw_mode_transition_evt_handler() - HW mode transition evt handler * @handle: WMI handle * @event: Event recevied from FW @@ -2505,7 +2571,6 @@ static int wma_pdev_hw_mode_transition_evt_handler(void *handle, uint8_t *event, uint32_t len) { - uint32_t i; WMI_PDEV_HW_MODE_TRANSITION_EVENTID_param_tlvs *param_buf; wmi_pdev_hw_mode_transition_event_fixed_param *wmi_event; wmi_pdev_set_hw_mode_response_vdev_mac_entry *vdev_mac_entry; @@ -2532,46 +2597,10 @@ static int wma_pdev_hw_mode_transition_evt_handler(void *handle, } wmi_event = param_buf->fixed_param; - hw_mode_trans_ind->old_hw_mode_index = wmi_event->old_hw_mode_index; - hw_mode_trans_ind->new_hw_mode_index = wmi_event->new_hw_mode_index; - hw_mode_trans_ind->num_vdev_mac_entries = - wmi_event->num_vdev_mac_entries; - WMA_LOGI("%s: old_hw_mode_index:%d new_hw_mode_index:%d entries=%d", - __func__, wmi_event->old_hw_mode_index, - wmi_event->new_hw_mode_index, wmi_event->num_vdev_mac_entries); - vdev_mac_entry = param_buf->wmi_pdev_set_hw_mode_response_vdev_mac_mapping; - - /* Store the vdev-mac map in WMA and prepare to send to HDD */ - for (i = 0; i < wmi_event->num_vdev_mac_entries; i++) { - uint32_t vdev_id, mac_id, pdev_id; - vdev_id = vdev_mac_entry[i].vdev_id; - pdev_id = vdev_mac_entry[i].pdev_id; - - if (pdev_id == WMI_PDEV_ID_SOC) { - WMA_LOGE("%s: soc level id received for mac id)", - __func__); - QDF_BUG(0); - return QDF_STATUS_E_FAILURE; - } - - mac_id = WMA_PDEV_TO_MAC_MAP(vdev_mac_entry[i].pdev_id); - - WMA_LOGI("%s: vdev_id:%d mac_id:%d", - __func__, vdev_id, mac_id); - - hw_mode_trans_ind->vdev_mac_map[i].vdev_id = vdev_id; - hw_mode_trans_ind->vdev_mac_map[i].mac_id = mac_id; - wma_update_intf_hw_mode_params(vdev_id, mac_id, - wmi_event->new_hw_mode_index); - } - wma->old_hw_mode_index = wmi_event->old_hw_mode_index; - wma->new_hw_mode_index = wmi_event->new_hw_mode_index; - - WMA_LOGI("%s: Updated: old_hw_mode_index:%d new_hw_mode_index:%d", - __func__, wma->old_hw_mode_index, wma->new_hw_mode_index); - + wma_process_pdev_hw_mode_trans_ind(wma, wmi_event, vdev_mac_entry, + hw_mode_trans_ind); /* Pass the message to PE */ wma_send_msg(wma, SIR_HAL_PDEV_HW_MODE_TRANS_IND, (void *) hw_mode_trans_ind, 0); @@ -4020,6 +4049,8 @@ static void wma_update_hdd_cfg(tp_wma_handle wma_handle) wma_update_ra_rate_limit(wma_handle, &tgt_cfg); tgt_cfg.fine_time_measurement_cap = wma_handle->fine_time_measurement_cap; + tgt_cfg.wmi_max_len = wmi_get_max_msg_len(wma_handle->wmi_handle) + - WMI_TLV_HEADROOM; wma_setup_egap_support(&tgt_cfg, wma_handle); wma_update_hdd_cfg_ndp(wma_handle, &tgt_cfg); @@ -5414,11 +5445,13 @@ void wma_set_wifi_start_packet_stats(void *wma_handle, if (start_log->verbose_level == WLAN_LOG_LEVEL_ACTIVE) { pktlog_enable(scn, log_state, start_log->ini_triggered, - start_log->user_triggered); + start_log->user_triggered, + start_log->is_iwpriv_command); WMA_LOGI("%s: Enabling per packet stats", __func__); } else { pktlog_enable(scn, 0, start_log->ini_triggered, - start_log->user_triggered); + start_log->user_triggered, + start_log->is_iwpriv_command); WMA_LOGI("%s: Disabling per packet stats", __func__); } } @@ -6271,6 +6304,13 @@ QDF_STATUS wma_mc_process_msg(void *cds_context, cds_msg_t *msg) (struct wep_update_default_key_idx *)msg->bodyptr); qdf_mem_free(msg->bodyptr); break; + case WMA_SEND_FREQ_RANGE_CONTROL_IND: + wma_enable_disable_caevent_ind(wma_handle, msg->bodyval); + break; + case WMA_ENCRYPT_DECRYPT_MSG: + wma_encrypt_decrypt_msg(wma_handle, msg->bodyptr); + qdf_mem_free(msg->bodyptr); + break; default: WMA_LOGD("unknow msg type %x", msg->type); /* Do Nothing? MSG Body should be freed at here */ diff --git a/core/wma/src/wma_power.c b/core/wma/src/wma_power.c index afda4ddbfd13..db0ba9243088 100644 --- a/core/wma/src/wma_power.c +++ b/core/wma/src/wma_power.c @@ -397,7 +397,7 @@ void wma_set_tx_power(WMA_HANDLE handle, if (wma_handle->interfaces[vdev_id].tx_power != tx_pwr_params->power) { /* tx_power changed, Push the tx_power to FW */ - WMA_LOGW("%s: Set TX power limit [WMI_VDEV_PARAM_TX_PWRLIMIT] to %d", + WMA_LOGI("%s: Set TX pwr limit [WMI_VDEV_PARAM_TX_PWRLIMIT] to %d", __func__, tx_pwr_params->power); ret = wma_vdev_set_param(wma_handle->wmi_handle, vdev_id, @@ -464,7 +464,7 @@ void wma_set_max_tx_power(WMA_HANDLE handle, ret = QDF_STATUS_SUCCESS; goto end; } - WMA_LOGW("Set MAX TX power limit [WMI_VDEV_PARAM_TX_PWRLIMIT] to %d", + WMA_LOGI("Set MAX TX pwr limit [WMI_VDEV_PARAM_TX_PWRLIMIT] to %d", wma_handle->interfaces[vdev_id].max_tx_power); ret = wma_vdev_set_param(wma_handle->wmi_handle, vdev_id, WMI_VDEV_PARAM_TX_PWRLIMIT, @@ -970,6 +970,29 @@ void wma_disable_sta_ps_mode(tp_wma_handle wma, tpDisablePsParams ps_req) } /** + * wma_set_powersave_config() - update power save config in wma + * @val: new power save value + * + * This function update qpower value in wma layer + * + * Return: QDF_STATUS_SUCCESS on success, error number otherwise + */ +QDF_STATUS wma_set_powersave_config(uint8_t val) +{ + tp_wma_handle wma_handle; + + wma_handle = cds_get_context(QDF_MODULE_ID_WMA); + + if (!wma_handle) { + WMA_LOGE("%s: WMA context is invald!", __func__); + return QDF_STATUS_E_INVAL; + } + wma_handle->powersave_mode = val; + + return QDF_STATUS_SUCCESS; +} + +/** * wma_enable_uapsd_mode() - enable uapsd mode in fw * @wma: wma handle * @ps_req: power save request diff --git a/core/wma/src/wma_scan_roam.c b/core/wma/src/wma_scan_roam.c index 9bca3f3ce651..1bba4b8718dd 100644 --- a/core/wma/src/wma_scan_roam.c +++ b/core/wma/src/wma_scan_roam.c @@ -100,6 +100,35 @@ enum extscan_report_events_type { #endif /** + * wma_set_scan_info() - set scan info in wma handle + * @wma_handle: wma handle + * @scan_id: scan id + * @vdev_id: vdev id + * + * Return: none + */ +static inline void wma_set_scan_info(tp_wma_handle wma_handle, + uint32_t scan_id, + uint32_t vdev_id) +{ + wma_handle->interfaces[vdev_id].scan_info.scan_id = scan_id; +} + +/** + * wma_reset_scan_info() - reset scan info from wma handle + * @wma_handle: wma handle + * @vdev_id: vdev id + * + * Return: none + */ +static inline void wma_reset_scan_info(tp_wma_handle wma_handle, + uint8_t vdev_id) +{ + qdf_mem_zero((void *)&(wma_handle->interfaces[vdev_id].scan_info), + sizeof(wma_handle->interfaces[vdev_id].scan_info)); +} + +/** * wma_set_p2p_scan_info() - set p2p scan info in wma handle * @wma_handle: wma handle * @scan_id: scan id @@ -415,14 +444,19 @@ QDF_STATUS wma_get_buf_start_scan_cmd(tp_wma_handle wma_handle, if (wma_is_sap_active(wma_handle)) { /* P2P/STA scan while SoftAP is sending beacons. * Max duration of CTS2self is 32 ms, which limits the - * dwell time. + * dwell time. If DBS is supported and if SAP is on 2G channel + * then keep passive dwell time default. */ cmd->dwell_time_active = QDF_MIN(scan_req->maxChannelTime, (WMA_CTS_DURATION_MS_MAX - WMA_ROAM_SCAN_CHANNEL_SWITCH_TIME)); - cmd->dwell_time_passive = - cmd->dwell_time_active; + if (!wma_is_hw_dbs_capable() || + (wma_is_hw_dbs_capable() && + CDS_IS_CHANNEL_5GHZ( + cds_get_channel(CDS_SAP_MODE, NULL)))) { + cmd->dwell_time_passive = cmd->dwell_time_active; + } cmd->burst_duration = 0; } @@ -525,11 +559,16 @@ QDF_STATUS wma_start_scan(tp_wma_handle wma_handle, goto error1; } + wma_set_scan_info(wma_handle, cmd.scan_id, cmd.vdev_id); + if (scan_req->p2pScanType == P2P_SCAN_TYPE_LISTEN) wma_set_p2p_scan_info(wma_handle, cmd.scan_id, cmd.vdev_id, P2P_SCAN_TYPE_LISTEN); WMA_LOGI("scan_id 0x%x, vdev_id %d, p2pScanType %d, msg_type 0x%x", cmd.scan_id, cmd.vdev_id, scan_req->p2pScanType, msg_type); + + if (scan_req->p2pScanType) + cmd.scan_priority = WMI_SCAN_PRIORITY_MEDIUM; /* * Cache vdev_id and scan_id because cmd is freed after calling * wmi_unified_cmd_send cmd. WMI internally frees cmd buffer after @@ -704,7 +743,7 @@ QDF_STATUS wma_update_channel_list(WMA_HANDLE handle, WMI_SET_CHANNEL_REG_POWER(tchan_info, chan_list->chanParam[i].pwr); - WMA_LOGD("Channel TX power[%d] = %u: %d", i, tchan_info->mhz, + WMA_LOGI("Channel TX power[%d] = %u: %d", i, tchan_info->mhz, chan_list->chanParam[i].pwr); /*TODO: Set WMI_SET_CHANNEL_MIN_POWER */ /*TODO: Set WMI_SET_CHANNEL_ANTENNA_MAX */ @@ -2150,6 +2189,13 @@ void wma_fill_roam_synch_buffer(tp_wma_handle wma, QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_WMA, QDF_TRACE_LEVEL_DEBUG, key->replay_counter, SIR_REPLAY_CTR_LEN); } + if (param_buf->hw_mode_transition_fixed_param) + wma_process_pdev_hw_mode_trans_ind(wma, + param_buf->hw_mode_transition_fixed_param, + param_buf->wmi_pdev_set_hw_mode_response_vdev_mac_mapping, + &roam_synch_ind_ptr->hw_mode_trans_ind); + else + WMA_LOGD(FL("hw_mode transition fixed param is NULL")); } /** @@ -2279,8 +2325,7 @@ int wma_roam_synch_event_handler(void *handle, uint8_t *event, } qdf_mem_zero(roam_synch_ind_ptr, len); wma_fill_roam_synch_buffer(wma, roam_synch_ind_ptr, param_buf); - - /* 24 byte MAC header and 12 byte to ssid IE */ + /* 24 byte MAC header and 12 byte to ssid IE */ if (roam_synch_ind_ptr->beaconProbeRespLength > (SIR_MAC_HDR_LEN_3A + SIR_MAC_B_PR_SSID_OFFSET)) { ie_len = roam_synch_ind_ptr->beaconProbeRespLength - @@ -2303,6 +2348,16 @@ int wma_roam_synch_event_handler(void *handle, uint8_t *event, wma->csr_roam_synch_cb((tpAniSirGlobal)wma->mac_context, roam_synch_ind_ptr, bss_desc_ptr, SIR_ROAM_SYNCH_PROPAGATION); wma_process_roam_synch_complete(wma, synch_event->vdev_id); + + /* update freq and channel width */ + wma->interfaces[synch_event->vdev_id].mhz = + roam_synch_ind_ptr->chan_freq; + if (roam_synch_ind_ptr->join_rsp) + wma->interfaces[synch_event->vdev_id].chan_width = + roam_synch_ind_ptr->join_rsp->vht_channel_width; + + wma->csr_roam_synch_cb((tpAniSirGlobal)wma->mac_context, + roam_synch_ind_ptr, bss_desc_ptr, SIR_ROAM_SYNCH_COMPLETE); wma->interfaces[synch_event->vdev_id].roam_synch_delay = qdf_get_system_timestamp() - roam_synch_received; WMA_LOGD("LFR3: roam_synch_delay:%d", @@ -5618,6 +5673,12 @@ int wma_scan_event_callback(WMA_HANDLE handle, uint8_t *data, scan_event->chanFreq = wmi_event->channel_freq; if (scan_event->scanId == + wma_handle->interfaces[vdev_id].scan_info.scan_id) { + if (scan_event->event == SIR_SCAN_EVENT_COMPLETED) + wma_reset_scan_info(wma_handle, vdev_id); + } + + if (scan_event->scanId == wma_handle->interfaces[vdev_id].p2p_scan_info.scan_id) { scan_event->p2pScanType = P2P_SCAN_TYPE_LISTEN; if (scan_event->event == SIR_SCAN_EVENT_COMPLETED) @@ -5784,9 +5845,9 @@ int wma_roam_event_callback(WMA_HANDLE handle, uint8_t *event_buf, return -ENOMEM; } if (wmi_event->notif == WMI_ROAM_NOTIF_ROAM_START) - op_code = SIR_ROAMING_TX_QUEUE_DISABLE; + op_code = SIR_ROAMING_START; if (wmi_event->notif == WMI_ROAM_NOTIF_ROAM_ABORT) - op_code = SIR_ROAMING_TX_QUEUE_ENABLE; + op_code = SIR_ROAMING_ABORT; roam_synch_data->roamedVdevId = wmi_event->vdev_id; wma_handle->csr_roam_synch_cb( (tpAniSirGlobal)wma_handle->mac_context, diff --git a/target/inc/wmi_unified.h b/target/inc/wmi_unified.h index c6bc385515d8..56b618431784 100644 --- a/target/inc/wmi_unified.h +++ b/target/inc/wmi_unified.h @@ -3519,11 +3519,40 @@ typedef struct { A_UINT32 enable_cmd; } wmi_vdev_spectral_enable_cmd_fixed_param; +/* information sub element id for QSBW, expected value is 0x02 */ +#define WMI_CSA_EVENT_QSBW_ISE_ID_MASK 0x000000FF +/* length of QSBW ISE data, expected value is 0x02 */ +#define WMI_CSA_EVENT_QSBW_ISE_LEN_MASK 0x0000FF00 +/* capabilities, 0x01 for 5MHz, 0x02 for 10MHz, 0x01|0x2 for both + * (see WMI_CSA_EVENT_QSBW_ISE bitmask defs) + */ +#define WMI_CSA_EVENT_QSBW_ISE_CAP_MASK 0x00FF0000 +/* notification from AP, 0x01 for 5MHz, 0x02 for 10MHz + * (see WMI_CSA_EVENT_QSBW_ISE bitmask defs) + */ +#define WMI_CSA_EVENT_QSBW_ISE_NOTIF_MASK 0xFF000000 + +#define WMI_CSA_EVENT_QSBW_ISE_ID 0x02 +#define WMI_CSA_EVENT_QSBW_ISE_LEN 0x02 + +#define WMI_CSA_EVENT_QSBW_ISE_5M_BITMASK 0x01 +#define WMI_CSA_EVENT_QSBW_ISE_10M_BITMASK 0x02 + +#define WMI_CSA_EVENT_QSBW_ISE_CAP_5M(qsbw_ise) \ + (((qsbw_ise) >> 16) & WMI_CSA_EVENT_QSBW_ISE_5M_BITMASK) +#define WMI_CSA_EVENT_QSBW_ISE_CAP_10M(qsbw_ise) \ + (((qsbw_ise) >> 16) & WMI_CSA_EVENT_QSBW_ISE_10M_BITMASK) +#define WMI_CSA_EVENT_QSBW_ISE_NOTIF_5M(qsbw_ise) \ + (((qsbw_ise) >> 24) & WMI_CSA_EVENT_QSBW_ISE_5M_BITMASK) +#define WMI_CSA_EVENT_QSBW_ISE_NOTIF_10M(qsbw_ise) \ + (((qsbw_ise) >> 24) & WMI_CSA_EVENT_QSBW_ISE_10M_BITMASK) + typedef enum { WMI_CSA_IE_PRESENT = 0x00000001, WMI_XCSA_IE_PRESENT = 0x00000002, WMI_WBW_IE_PRESENT = 0x00000004, WMI_CSWARP_IE_PRESENT = 0x00000008, + WMI_QSBW_ISE_PRESENT = 0x00000010, } WMI_CSA_EVENT_IES_PRESENT_FLAG; /* wmi CSA receive event from beacon frame */ @@ -3541,6 +3570,7 @@ typedef struct { A_UINT32 wb_ie[2]; A_UINT32 cswarp_ie; A_UINT32 ies_present_flag; /* WMI_CSA_EVENT_IES_PRESENT_FLAG */ + A_UINT32 qsbw_ise; } wmi_csa_event_fixed_param; typedef enum { @@ -4636,6 +4666,17 @@ typedef enum { WMI_MESH_STATS = 6, } wmi_link_iface_type; +/* channel operating width */ +typedef enum { + WMI_CHAN_WIDTH_20 = 0, + WMI_CHAN_WIDTH_40 = 1, + WMI_CHAN_WIDTH_80 = 2, + WMI_CHAN_WIDTH_160 = 3, + WMI_CHAN_WIDTH_80P80 = 4, + WMI_CHAN_WIDTH_5 = 5, + WMI_CHAN_WIDTH_10 = 6, +} wmi_channel_width; + /*Clear stats*/ typedef struct { A_UINT32 tlv_header; @@ -16886,17 +16927,33 @@ typedef struct { typedef enum wmi_coex_config_type { /* config interval (arg1 BT, arg2 WLAN) for P2P + PAGE */ - WMI_COEX_CONFIG_PAGE_P2P_TDM = 1, + WMI_COEX_CONFIG_PAGE_P2P_TDM = 1, /* config interval (arg1 BT, arg2 WLAN) for STA + PAGE */ - WMI_COEX_CONFIG_PAGE_STA_TDM = 2, + WMI_COEX_CONFIG_PAGE_STA_TDM = 2, /* config interval (arg1 BT, arg2 WLAN) for SAP + PAGE */ - WMI_COEX_CONFIG_PAGE_SAP_TDM = 3, + WMI_COEX_CONFIG_PAGE_SAP_TDM = 3, /* config during WLAN connection */ - WMI_COEX_CONFIG_DURING_WLAN_CONN = 4, + WMI_COEX_CONFIG_DURING_WLAN_CONN = 4, /* config to enable/disable BTC */ - WMI_COEX_CONFIG_BTC_ENABLE = 5, + WMI_COEX_CONFIG_BTC_ENABLE = 5, /* config of COEX debug setting */ - WMI_COEX_CONFIG_COEX_DBG = 6, + WMI_COEX_CONFIG_COEX_DBG = 6, + /* + * config interval (ms units) (arg1 BT, arg2 WLAN) + * for P2P + STA + PAGE + */ + WMI_COEX_CONFIG_PAGE_P2P_STA_TDM = 7, + /* config interval (ms units) (arg1 BT, arg2 WLAN) for P2P + INQUIRY */ + WMI_COEX_CONFIG_INQUIRY_P2P_TDM = 8, + /* config interval (ms units) (arg1 BT, arg2 WLAN) for STA + INQUIRY */ + WMI_COEX_CONFIG_INQUIRY_STA_TDM = 9, + /* config interval (ms units) (arg1 BT, arg2 WLAN) for SAP + INQUIRY */ + WMI_COEX_CONFIG_INQUIRY_SAP_TDM = 10, + /* + * config interval (ms units) (arg1 BT, arg2 WLAN) for P2P + STA + + * INQUIRY + */ + WMI_COEX_CONFIG_INQUIRY_P2P_STA_TDM = 11, } WMI_COEX_CONFIG_TYPE; typedef struct { diff --git a/target/inc/wmi_version.h b/target/inc/wmi_version.h index 4146ab4e0bcb..f0d6a194305d 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_ 298 +#define __WMI_REVISION_ 300 /** The Version Namespace should not be normally changed. Only * host and firmware of the same WMI namespace will work |
