From fab026a99ae23234f4eaed4f681add9ed50f3087 Mon Sep 17 00:00:00 2001 From: Sourav Mohapatra Date: Wed, 20 Nov 2019 14:22:28 +0530 Subject: [PATCH] qcacld-3.0: Send RTT capability for STA mode Based on the ini gfine_time_meas_cap, send enable/disable value to the firmware for STA INITIATOR/RESPONDER mode using VDEV set param. Change-Id: Idd4142e13061cd1af992bda88d0a0b81edc42fef CRs-Fixed: 2574050 --- .../mlme/dispatcher/inc/cfg_mlme_wifi_pos.h | 16 ++++++------ components/nan/core/inc/nan_public_structs.h | 2 ++ core/hdd/inc/hdd_config.h | 24 ----------------- core/hdd/inc/wlan_hdd_cfg.h | 1 - core/hdd/src/wlan_hdd_cfg80211.c | 19 ++++++++++++-- core/hdd/src/wlan_hdd_main.c | 26 ++++++++++++++++--- os_if/nan/src/os_if_nan.c | 5 ++++ 7 files changed, 55 insertions(+), 38 deletions(-) diff --git a/components/mlme/dispatcher/inc/cfg_mlme_wifi_pos.h b/components/mlme/dispatcher/inc/cfg_mlme_wifi_pos.h index befc593dfa..c93ca73c9e 100644 --- a/components/mlme/dispatcher/inc/cfg_mlme_wifi_pos.h +++ b/components/mlme/dispatcher/inc/cfg_mlme_wifi_pos.h @@ -33,12 +33,12 @@ * fine timing measurement capability information * * <----- fine_time_meas_cap (in bits) -----> - * +----------+-----+-----+------+------+-------+-------+-----+-----+ - * | 8-31 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | - * +----------+-----+-----+------+------+-------+-------+-----+-----+ - * | reserved | SAP | SAP |P2P-GO|P2P-GO|P2P-CLI|P2P-CLI| STA | STA | - * | |resp |init |resp |init |resp |init |resp |init | - * +----------+-----+-----+------+------+-------+-------+-----+-----+ + * +---------+-----+-----+-----+-----+------+------+-------+-------+-----+-----+ + * | 10-31 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | + * +---------+-----+-----+-----+-----+------+------+-------+-------+-----+-----+ + * | reserved| NAN | NAN | SAP | SAP |P2P-GO|P2P-GO|P2P-CLI|P2P-CLI| STA | STA | + * | | resp|init |resp |init |resp |init |resp |init |resp |init | + * +---------+-----+-----+-----+-----+------+------+-------+-------+-----+-----+ * * resp - responder role; init- initiator role * @@ -63,8 +63,8 @@ #define CFG_FINE_TIME_MEAS_CAPABILITY CFG_INI_UINT( \ "gfine_time_meas_cap", \ 0x0000, \ - 0x00BD, \ - 0x000D, \ + 0x003BD, \ + 0x0030D, \ CFG_VALUE_OR_DEFAULT, \ "fine timing measurement capability") diff --git a/components/nan/core/inc/nan_public_structs.h b/components/nan/core/inc/nan_public_structs.h index 04ccfe88ac..feabeb8650 100644 --- a/components/nan/core/inc/nan_public_structs.h +++ b/components/nan/core/inc/nan_public_structs.h @@ -532,9 +532,11 @@ struct nan_event_params { * struct nan_msg_params - NAN request params * @request_data_len: request data length * @request_data: request data + * @rtt_cap: indicate if responder/initiator role is supported */ struct nan_msg_params { uint16_t request_data_len; + uint32_t rtt_cap; /* Variable length, do not add anything after this */ uint8_t request_data[]; }; diff --git a/core/hdd/inc/hdd_config.h b/core/hdd/inc/hdd_config.h index e93405ca9f..f65626cf15 100644 --- a/core/hdd/inc/hdd_config.h +++ b/core/hdd/inc/hdd_config.h @@ -1230,29 +1230,6 @@ struct dhcp_server { #define CFG_ENABLE_MTRACE_ALL #endif -/* - * - * gEnableRTTsupport - * - * @Min: 0 - Disabled - * @Max: 1 - Enabled - * @Default: 1 - Enabled - * - * The param is used to enable/disable support for RTT - * - * Related: None. - * - * Supported Feature: RTT - * - * Usage: Internal/External - * - * - */ -#define CFG_ENABLE_RTT_SUPPORT CFG_INI_BOOL( \ - "gEnableRTTSupport", \ - 1, \ - "The param is used to enable/disable support for RTT") - /* * * gAdvertiseConcurrentOperation - Iface combination advertising @@ -1499,7 +1476,6 @@ enum host_log_level { CFG(CFG_ENABLE_MAC_PROVISION) \ CFG_ENABLE_MTRACE_ALL \ CFG(CFG_ENABLE_RAMDUMP_COLLECTION) \ - CFG(CFG_ENABLE_RTT_SUPPORT) \ CFG(CFG_ENABLE_UNIT_TEST_FRAMEWORK) \ CFG(CFG_INTERFACE_CHANGE_WAIT) \ CFG(CFG_INFORM_BSS_RSSI_RAW) \ diff --git a/core/hdd/inc/wlan_hdd_cfg.h b/core/hdd/inc/wlan_hdd_cfg.h index 1a9deb378d..8059bb9925 100644 --- a/core/hdd/inc/wlan_hdd_cfg.h +++ b/core/hdd/inc/wlan_hdd_cfg.h @@ -219,7 +219,6 @@ struct hdd_config { bool mac_provision; uint32_t provisioned_intf_pool; uint32_t derived_intf_pool; - uint8_t enable_rtt_support; uint32_t cfg_wmi_credit_cnt; uint32_t sar_version; bool is_wow_disabled; diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index be6b6b9621..4ad3038782 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -148,6 +148,16 @@ #define g_mode_rates_size (12) #define a_mode_rates_size (8) +/** + * rtt_is_initiator - Macro to check if the bitmap has any RTT roles set + * @bitmap: The bitmap to be checked + */ +#define rtt_is_enabled(bitmap) \ + ((bitmap) & (WMI_FW_STA_RTT_INITR | \ + WMI_FW_STA_RTT_RESPR | \ + WMI_FW_AP_RTT_INITR | \ + WMI_FW_AP_RTT_RESPR)) + /* * Android CTS verifier needs atleast this much wait time (in msec) */ @@ -3438,6 +3448,7 @@ __wlan_hdd_cfg80211_get_supported_features(struct wiphy *wiphy, #ifdef FEATURE_WLAN_TDLS bool bvalue; #endif + uint32_t fine_time_meas_cap; /* ENTER_DEV() intentionally not used in a frequently invoked API */ @@ -3479,9 +3490,13 @@ __wlan_hdd_cfg80211_get_supported_features(struct wiphy *wiphy, hdd_debug("NAN is supported by firmware"); fset |= WIFI_FEATURE_NAN; } + + ucfg_mlme_get_fine_time_meas_cap(hdd_ctx->psoc, &fine_time_meas_cap); + if (sme_is_feature_supported_by_fw(RTT) && - hdd_ctx->config->enable_rtt_support) { - hdd_debug("RTT is supported by firmware and framework"); + rtt_is_enabled(fine_time_meas_cap)) { + hdd_debug("RTT is supported by firmware and driver: %x", + fine_time_meas_cap); fset |= WIFI_FEATURE_D2D_RTT; fset |= WIFI_FEATURE_D2AP_RTT; } diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 84c4182708..0261a4038e 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -4643,6 +4643,7 @@ QDF_STATUS hdd_init_station_mode(struct hdd_adapter *adapter) mac_handle_t mac_handle; bool bval = false; uint8_t enable_sifs_burst = 0; + uint32_t fine_time_meas_cap = 0; hdd_ctx = WLAN_HDD_GET_CTX(adapter); mac_handle = hdd_ctx->mac_handle; @@ -4717,10 +4718,24 @@ QDF_STATUS hdd_init_station_mode(struct hdd_adapter *adapter) /* rcpi info initialization */ qdf_mem_zero(&adapter->rcpi, sizeof(adapter->rcpi)); - if (adapter->device_mode == QDF_STA_MODE) + if (adapter->device_mode == QDF_STA_MODE) { mlme_set_roam_trigger_bitmap(hdd_ctx->psoc, adapter->vdev_id, DEFAULT_ROAM_TRIGGER_BITMAP); + ucfg_mlme_get_fine_time_meas_cap(hdd_ctx->psoc, + &fine_time_meas_cap); + sme_cli_set_command( + adapter->vdev_id, + WMI_VDEV_PARAM_ENABLE_DISABLE_RTT_RESPONDER_ROLE, + (bool)(fine_time_meas_cap & WMI_FW_STA_RTT_RESPR), + VDEV_CMD); + sme_cli_set_command( + adapter->vdev_id, + WMI_VDEV_PARAM_ENABLE_DISABLE_RTT_INITIATOR_ROLE, + (bool)(fine_time_meas_cap & WMI_FW_STA_RTT_INITR), + VDEV_CMD); + } + return QDF_STATUS_SUCCESS; error_wmm_init: @@ -10304,7 +10319,6 @@ static void hdd_cfg_params_init(struct hdd_context *hdd_ctx) cfg_get(psoc, CFG_ACTION_OUI_DISABLE_AGGRESSIVE_EDCA), ACTION_OUI_MAX_STR_LEN); - config->enable_rtt_support = cfg_get(psoc, CFG_ENABLE_RTT_SUPPORT); config->is_unit_test_framework_enabled = cfg_get(psoc, CFG_ENABLE_UNIT_TEST_FRAMEWORK); config->disable_channel = cfg_get(psoc, CFG_ENABLE_DISABLE_CHANNEL); @@ -10524,10 +10538,16 @@ int hdd_start_ap_adapter(struct hdd_adapter *adapter) if (adapter->device_mode == QDF_SAP_MODE) { ucfg_mlme_get_fine_time_meas_cap(hdd_ctx->psoc, &fine_time_meas_cap); - sme_cli_set_command(adapter->vdev_id, + sme_cli_set_command( + adapter->vdev_id, WMI_VDEV_PARAM_ENABLE_DISABLE_RTT_RESPONDER_ROLE, (bool)(fine_time_meas_cap & WMI_FW_AP_RTT_RESPR), VDEV_CMD); + sme_cli_set_command( + adapter->vdev_id, + WMI_VDEV_PARAM_ENABLE_DISABLE_RTT_INITIATOR_ROLE, + (bool)(fine_time_meas_cap & WMI_FW_AP_RTT_INITR), + VDEV_CMD); } status = hdd_init_ap_mode(adapter, is_ssr); diff --git a/os_if/nan/src/os_if_nan.c b/os_if/nan/src/os_if_nan.c index 2adb5d7e2b..a686d69d5b 100644 --- a/os_if/nan/src/os_if_nan.c +++ b/os_if/nan/src/os_if_nan.c @@ -35,6 +35,7 @@ #include "wlan_objmgr_vdev_obj.h" #include "wlan_utility.h" #include "wlan_osif_request_manager.h" +#include "wlan_mlme_ucfg_api.h" #define NAN_CMD_MAX_SIZE 2048 @@ -2634,6 +2635,7 @@ static int os_if_process_nan_enable_req(struct wlan_objmgr_psoc *psoc, uint32_t chan_freq_2g, chan_freq_5g = 0; uint32_t buf_len; QDF_STATUS status; + uint32_t fine_time_meas_cap; struct nan_enable_req *nan_req; if (!tb[QCA_WLAN_VENDOR_ATTR_NAN_DISC_24GHZ_BAND_FREQ]) { @@ -2668,6 +2670,9 @@ static int os_if_process_nan_enable_req(struct wlan_objmgr_psoc *psoc, nan_req->psoc = psoc; nan_req->params.request_data_len = buf_len; + ucfg_mlme_get_fine_time_meas_cap(psoc, &fine_time_meas_cap); + nan_req->params.rtt_cap = fine_time_meas_cap; + nla_memcpy(nan_req->params.request_data, tb[QCA_WLAN_VENDOR_ATTR_NAN_CMD_DATA], buf_len);