From c457ae6f18247acda4d22ca5f6bbce55d3bf0d3d Mon Sep 17 00:00:00 2001 From: Sourav Mohapatra Date: Thu, 6 Dec 2018 15:19:41 +0530 Subject: [PATCH] qcacld-3.0: Feature flag for Wlan Latency Manager support WLAN Latency Manager support is one of the capabilities that is sent along with the service bits by firmware. Currently, driver is not exposing this feature to the user space. Create and add support for a feature flag to expose this feature to the userspace. Change-Id: Ica8213bdaeb32c7be01b6a71a7d8b7a32dc8611b CRs-Fixed: 2363704 --- .../mlme/dispatcher/inc/wlan_mlme_ucfg_api.h | 11 ++++++++ .../mlme/dispatcher/src/wlan_mlme_ucfg_api.c | 15 +++++++++++ core/hdd/src/wlan_hdd_cfg80211.c | 26 +++++++++++++++++++ core/hdd/src/wlan_hdd_cfg80211.h | 2 ++ core/mac/src/include/sir_params.h | 1 + core/wma/src/wma_main.c | 3 +++ 6 files changed, 58 insertions(+) diff --git a/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h b/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h index 27d45e86ca40..4c40f589ac3d 100644 --- a/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h +++ b/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h @@ -3208,4 +3208,15 @@ QDF_STATUS ucfg_wlan_mlme_get_rrm_enabled(struct wlan_objmgr_psoc *psoc, { return wlan_mlme_get_rrm_enabled(psoc, value); } + +/** + * ucfg_mlme_get_latency_enable() - Get the latency_enable + * @psoc: pointer to psoc object + * @value: Value that needs to be get from the caller + * + * Return: QDF Status + */ +QDF_STATUS +ucfg_mlme_get_latency_enable(struct wlan_objmgr_psoc *psoc, bool *value); + #endif /* _WLAN_MLME_UCFG_API_H_ */ diff --git a/components/mlme/dispatcher/src/wlan_mlme_ucfg_api.c b/components/mlme/dispatcher/src/wlan_mlme_ucfg_api.c index e0b7b207a6b0..1cd3de9605a2 100644 --- a/components/mlme/dispatcher/src/wlan_mlme_ucfg_api.c +++ b/components/mlme/dispatcher/src/wlan_mlme_ucfg_api.c @@ -1195,3 +1195,18 @@ ucfg_mlme_get_ap_random_bssid_enable(struct wlan_objmgr_psoc *psoc, *value = mlme_obj->cfg.sap_cfg.ap_random_bssid_enable; return QDF_STATUS_SUCCESS; } + +QDF_STATUS +ucfg_mlme_get_latency_enable(struct wlan_objmgr_psoc *psoc, bool *value) +{ + struct wlan_mlme_psoc_obj *mlme_obj; + + mlme_obj = mlme_get_psoc_obj(psoc); + if (!mlme_obj) { + mlme_err("mlme obj null"); + return QDF_STATUS_E_INVAL; + } + + *value = mlme_obj->cfg.wlm_config.latency_enable; + return QDF_STATUS_SUCCESS; +} diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 265a29f357b0..b5d96e2dfd8a 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -3082,6 +3082,29 @@ void wlan_hdd_cfg80211_acs_ch_select_evt(struct hdd_adapter *adapter) } } +/** + * hdd_is_wlm_latency_manager_supported - Checks if WLM Latency manager is + * supported + * @hdd_ctx: The HDD context + * + * Return: True if supported, false otherwise + */ +static inline +bool hdd_is_wlm_latency_manager_supported(struct hdd_context *hdd_ctx) +{ + bool latency_enable; + + if (QDF_IS_STATUS_ERROR(ucfg_mlme_get_latency_enable + (hdd_ctx->psoc, &latency_enable))) + return false; + + if (latency_enable && + sme_is_feature_supported_by_fw(VDEV_LATENCY_CONFIG)) + return true; + else + return false; +} + static int __wlan_hdd_cfg80211_get_supported_features(struct wiphy *wiphy, struct wireless_dev *wdev, @@ -3178,6 +3201,9 @@ __wlan_hdd_cfg80211_get_supported_features(struct wiphy *wiphy, if (hdd_scan_random_mac_addr_supported()) fset |= WIFI_FEATURE_SCAN_RAND; + if (hdd_is_wlm_latency_manager_supported(hdd_ctx)) + fset |= WIFI_FEATURE_SET_LATENCY_MODE; + skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(fset) + NLMSG_HDRLEN); if (!skb) { diff --git a/core/hdd/src/wlan_hdd_cfg80211.h b/core/hdd/src/wlan_hdd_cfg80211.h index 0ab948b63aa2..2c19badede33 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.h +++ b/core/hdd/src/wlan_hdd_cfg80211.h @@ -192,6 +192,8 @@ typedef enum { #define WIFI_FEATURE_CONTROL_ROAMING 0x800000 /* Enable/Disable roaming */ #define WIFI_FEATURE_IE_WHITELIST 0x1000000 /* Support Probe IE white listing */ #define WIFI_FEATURE_SCAN_RAND 0x2000000 /* Support MAC & Probe Sequence Number randomization */ +#define WIFI_FEATURE_SET_LATENCY_MODE 0x40000000 /* Set latency mode */ + /* Support Tx Power Limit setting */ #define WIFI_FEATURE_SET_TX_POWER_LIMIT 0x4000000 diff --git a/core/mac/src/include/sir_params.h b/core/mac/src/include/sir_params.h index 139355068e1e..cb1449954bb3 100644 --- a/core/mac/src/include/sir_params.h +++ b/core/mac/src/include/sir_params.h @@ -132,6 +132,7 @@ enum cap_bitmap { ADVANCE_TDLS = 29, TDLS_OFF_CHANNEL = 30, #endif + VDEV_LATENCY_CONFIG = 31, /* MAX_FEATURE_SUPPORTED = 32 */ }; diff --git a/core/wma/src/wma_main.c b/core/wma/src/wma_main.c index b506248ba3da..095cc5121874 100644 --- a/core/wma/src/wma_main.c +++ b/core/wma/src/wma_main.c @@ -4996,6 +4996,9 @@ static inline void wma_update_target_services(struct wmi_unified *wmi_handle, cfg->obss_scan_offload = true; if (wmi_service_enabled(wmi_handle, wmi_service_beacon_reception_stats)) cfg->bcn_reception_stats = true; + + if (wmi_service_enabled(wmi_handle, wmi_service_vdev_latency_config)) + g_fw_wlan_feat_caps |= (1 << VDEV_LATENCY_CONFIG); } /**