From 7c037e6d50c8a75b1ea01b4046c6e018f665e96e Mon Sep 17 00:00:00 2001 From: Krupali Dhanvijay Date: Wed, 16 Nov 2022 14:53:22 +0530 Subject: [PATCH] qcacld-3.0: Clean up code for sme apis Clean up code for sme_get_wes_mode(), sme_get_is_lfr_feature_enabled() and sme_get_is_ft_feature_enabled() apis and replace it with ucfg api. Change-Id: I7715ba361264fcb2c0c93d8d073813538347dd31 CRs-Fixed: 3335898 --- .../dispatcher/inc/wlan_cm_roam_ucfg_api.h | 34 ++++++++++++++- .../dispatcher/src/wlan_cm_roam_ucfg_api.c | 37 +++++++++++++++- core/hdd/src/wlan_hdd_ioctl.c | 20 ++++----- core/sme/inc/sme_api.h | 3 -- core/sme/src/common/sme_api.c | 43 ------------------- 5 files changed, 75 insertions(+), 62 deletions(-) diff --git a/components/umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_roam_ucfg_api.h b/components/umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_roam_ucfg_api.h index 22fb2ef31a..7b14e0e5be 100644 --- a/components/umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_roam_ucfg_api.h +++ b/components/umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_roam_ucfg_api.h @@ -486,13 +486,13 @@ ucfg_cm_get_empty_scan_refresh_period(struct wlan_objmgr_psoc *psoc, * ucfg_cm_get_neighbor_scan_min_chan_time() - * get neighbor scan min channel time * @psoc: pointer to psoc object - * @session_id: session_id + * @vdev_id: vdev_id * * Return: channel min time value */ uint16_t ucfg_cm_get_neighbor_scan_min_chan_time(struct wlan_objmgr_psoc *psoc, - uint8_t session_id); + uint8_t vdev_id); /** * ucfg_cm_get_roam_rssi_diff() - Get Roam rssi diff @@ -548,4 +548,34 @@ ucfg_cm_get_neighbor_scan_max_chan_time(struct wlan_objmgr_psoc *psoc, uint16_t ucfg_cm_get_neighbor_scan_period(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id); + +/** + * ucfg_cm_get_wes_mode() - Get WES Mode + * This is a synchronous call + * @psoc: pointer to psoc object + * + * Return: WES Mode Enabled(1)/Disabled(0) + */ +bool ucfg_cm_get_wes_mode(struct wlan_objmgr_psoc *psoc); + +/** + * ucfg_cm_get_is_lfr_feature_enabled() - Get LFR feature enabled or not + * This is a synchronous call + * @psoc: pointer to psoc object + * + * Return: true (1) - if the feature is enabled + * false (0) - if feature is disabled (compile or runtime) + */ +bool ucfg_cm_get_is_lfr_feature_enabled(struct wlan_objmgr_psoc *psoc); + +/** + * ucfg_cm_get_is_ft_feature_enabled() - Get FT feature enabled or not + * This is a synchronous call + * @psoc: pointer to psoc object + * + * Return: true (1) - if the feature is enabled + * false (0) - if feature is disabled (compile or runtime) + */ +bool ucfg_cm_get_is_ft_feature_enabled(struct wlan_objmgr_psoc *psoc); + #endif /* _WLAN_CM_ROAM_UCFG_API_H_ */ diff --git a/components/umac/mlme/connection_mgr/dispatcher/src/wlan_cm_roam_ucfg_api.c b/components/umac/mlme/connection_mgr/dispatcher/src/wlan_cm_roam_ucfg_api.c index 7bfbfeeda0..888885ecdf 100644 --- a/components/umac/mlme/connection_mgr/dispatcher/src/wlan_cm_roam_ucfg_api.c +++ b/components/umac/mlme/connection_mgr/dispatcher/src/wlan_cm_roam_ucfg_api.c @@ -574,11 +574,11 @@ ucfg_cm_get_empty_scan_refresh_period(struct wlan_objmgr_psoc *psoc, uint16_t ucfg_cm_get_neighbor_scan_min_chan_time(struct wlan_objmgr_psoc *psoc, - uint8_t session_id) + uint8_t vdev_id) { struct cm_roam_values_copy temp; - wlan_cm_roam_cfg_get_value(psoc, session_id, + wlan_cm_roam_cfg_get_value(psoc, vdev_id, SCAN_MIN_CHAN_TIME, &temp); return temp.uint_value; @@ -632,3 +632,36 @@ ucfg_cm_get_neighbor_scan_period(struct wlan_objmgr_psoc *psoc, NEIGHBOR_SCAN_PERIOD, &temp); return temp.uint_value; } + +bool ucfg_cm_get_wes_mode(struct wlan_objmgr_psoc *psoc) +{ + struct wlan_mlme_psoc_ext_obj *mlme_obj; + + mlme_obj = mlme_get_psoc_ext_obj(psoc); + if (!mlme_obj) + return false; + + return mlme_obj->cfg.lfr.wes_mode_enabled; +} + +bool ucfg_cm_get_is_lfr_feature_enabled(struct wlan_objmgr_psoc *psoc) +{ + struct wlan_mlme_psoc_ext_obj *mlme_obj; + + mlme_obj = mlme_get_psoc_ext_obj(psoc); + if (!mlme_obj) + return false; + + return mlme_obj->cfg.lfr.lfr_enabled; +} + +bool ucfg_cm_get_is_ft_feature_enabled(struct wlan_objmgr_psoc *psoc) +{ + struct wlan_mlme_psoc_ext_obj *mlme_obj; + + mlme_obj = mlme_get_psoc_ext_obj(psoc); + if (!mlme_obj) + return false; + + return mlme_obj->cfg.lfr.fast_transition_enabled; +} diff --git a/core/hdd/src/wlan_hdd_ioctl.c b/core/hdd/src/wlan_hdd_ioctl.c index de52c6757a..5cdb3807e9 100644 --- a/core/hdd/src/wlan_hdd_ioctl.c +++ b/core/hdd/src/wlan_hdd_ioctl.c @@ -3102,7 +3102,7 @@ static int drv_cmd_get_roam_mode(struct hdd_adapter *adapter, struct hdd_priv_data *priv_data) { int ret = 0; - bool roam_mode = sme_get_is_lfr_feature_enabled(hdd_ctx->mac_handle); + bool roam_mode = ucfg_cm_get_is_lfr_feature_enabled(hdd_ctx->psoc); char extra[32]; uint8_t len; @@ -3454,7 +3454,6 @@ static int drv_cmd_get_ccx_mode(struct hdd_adapter *adapter, struct hdd_priv_data *priv_data) { int ret = 0; - mac_handle_t mac_handle = hdd_ctx->mac_handle; bool ese_mode = ucfg_cm_get_is_ese_feature_enabled(hdd_ctx->psoc); char extra[32]; uint8_t len = 0; @@ -3467,7 +3466,7 @@ static int drv_cmd_get_ccx_mode(struct hdd_adapter *adapter, */ if (ese_mode && (pmkid_modes.fw_okc || pmkid_modes.fw_pmksa_cache) && - sme_get_is_ft_feature_enabled(mac_handle)) { + ucfg_cm_get_is_ft_feature_enabled(hdd_ctx->psoc)) { hdd_warn("PMKID/ESE/11R are supported simultaneously hence this operation is not permitted!"); ret = -EPERM; goto exit; @@ -3496,7 +3495,6 @@ static int drv_cmd_get_okc_mode(struct hdd_adapter *adapter, struct pmkid_mode_bits pmkid_modes; char extra[32]; uint8_t len = 0; - mac_handle_t mac_handle = hdd_ctx->mac_handle; hdd_get_pmkid_modes(hdd_ctx, &pmkid_modes); /* @@ -3505,7 +3503,7 @@ static int drv_cmd_get_okc_mode(struct hdd_adapter *adapter, */ if (pmkid_modes.fw_okc && ucfg_cm_get_is_ese_feature_enabled(hdd_ctx->psoc) && - sme_get_is_ft_feature_enabled(mac_handle)) { + ucfg_cm_get_is_ft_feature_enabled(hdd_ctx->psoc)) { hdd_warn("PMKID/ESE/11R are supported simultaneously hence this operation is not permitted!"); ret = -EPERM; goto exit; @@ -3532,7 +3530,7 @@ static int drv_cmd_get_fast_roam(struct hdd_adapter *adapter, struct hdd_priv_data *priv_data) { int ret = 0; - bool lfr_mode = sme_get_is_lfr_feature_enabled(hdd_ctx->mac_handle); + bool lfr_mode = ucfg_cm_get_is_lfr_feature_enabled(hdd_ctx->psoc); char extra[32]; uint8_t len = 0; @@ -3555,7 +3553,7 @@ static int drv_cmd_get_fast_transition(struct hdd_adapter *adapter, struct hdd_priv_data *priv_data) { int ret = 0; - bool ft = sme_get_is_ft_feature_enabled(hdd_ctx->mac_handle); + bool ft = ucfg_cm_get_is_ft_feature_enabled(hdd_ctx->psoc); char extra[32]; uint8_t len = 0; @@ -4093,7 +4091,7 @@ static int drv_cmd_get_wes_mode(struct hdd_adapter *adapter, struct hdd_priv_data *priv_data) { int ret = 0; - bool wes_mode = sme_get_wes_mode(hdd_ctx->mac_handle); + bool wes_mode = ucfg_cm_get_wes_mode(hdd_ctx->psoc); char extra[32]; uint8_t len = 0; @@ -4351,7 +4349,6 @@ static int drv_cmd_set_okc_mode(struct hdd_adapter *adapter, uint8_t *value = command; uint32_t okc_mode; struct pmkid_mode_bits pmkid_modes; - mac_handle_t mac_handle; uint32_t cur_pmkid_modes; QDF_STATUS status; @@ -4361,10 +4358,9 @@ static int drv_cmd_set_okc_mode(struct hdd_adapter *adapter, * Check if the features PMKID/ESE/11R are supported simultaneously, * then this operation is not permitted (return FAILURE) */ - mac_handle = hdd_ctx->mac_handle; if (ucfg_cm_get_is_ese_feature_enabled(hdd_ctx->psoc) && pmkid_modes.fw_okc && - sme_get_is_ft_feature_enabled(mac_handle)) { + ucfg_cm_get_is_ft_feature_enabled(hdd_ctx->psoc)) { hdd_warn("PMKID/ESE/11R are supported simultaneously hence this operation is not permitted!"); ret = -EPERM; goto exit; @@ -4925,7 +4921,7 @@ static int drv_cmd_set_ccx_mode(struct hdd_adapter *adapter, */ if (ucfg_cm_get_is_ese_feature_enabled(hdd_ctx->psoc) && pmkid_modes.fw_okc && - sme_get_is_ft_feature_enabled(mac_handle)) { + ucfg_cm_get_is_ft_feature_enabled(hdd_ctx->psoc)) { hdd_warn("OKC/ESE/11R are supported simultaneously hence this operation is not permitted!"); ret = -EPERM; goto exit; diff --git a/core/sme/inc/sme_api.h b/core/sme/inc/sme_api.h index e85b64c6de..65e06d843a 100644 --- a/core/sme/inc/sme_api.h +++ b/core/sme/inc/sme_api.h @@ -1174,9 +1174,6 @@ QDF_STATUS sme_get_roam_scan_channel_list(mac_handle_t mac_handle, uint8_t *pNumChannels, uint8_t sessionId); -bool sme_get_wes_mode(mac_handle_t mac_handle); -bool sme_get_is_lfr_feature_enabled(mac_handle_t mac_handle); -bool sme_get_is_ft_feature_enabled(mac_handle_t mac_handle); bool sme_is_feature_supported_by_fw(enum cap_bitmap feature); QDF_STATUS sme_set_phy_mode(mac_handle_t mac_handle, eCsrPhyMode phyMode); diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c index 1986ecd8c1..4186746896 100644 --- a/core/sme/src/common/sme_api.c +++ b/core/sme/src/common/sme_api.c @@ -7069,49 +7069,6 @@ QDF_STATUS sme_get_roam_scan_channel_list(mac_handle_t mac_handle, return status; } -/* - * sme_get_wes_mode() - get WES Mode - * This is a synchronous call - * - * mac_handle - The handle returned by mac_open - * Return uint8_t - WES Mode Enabled(1)/Disabled(0) - */ -bool sme_get_wes_mode(mac_handle_t mac_handle) -{ - struct mac_context *mac = MAC_CONTEXT(mac_handle); - - return mac->mlme_cfg->lfr.wes_mode_enabled; -} - -/* - * sme_get_is_lfr_feature_enabled() - get LFR feature enabled or not - * This is a synchronous call - * mac_handle - The handle returned by mac_open. - * Return true (1) - if the feature is enabled - * false (0) - if feature is disabled (compile or runtime) - */ -bool sme_get_is_lfr_feature_enabled(mac_handle_t mac_handle) -{ - struct mac_context *mac = MAC_CONTEXT(mac_handle); - - return mac->mlme_cfg->lfr.lfr_enabled; -} - -/* - * sme_get_is_ft_feature_enabled() - get FT feature enabled or not - * This is a synchronous call - * - * mac_handle - The handle returned by mac_open. - * Return true (1) - if the feature is enabled - * false (0) - if feature is disabled (compile or runtime) - */ -bool sme_get_is_ft_feature_enabled(mac_handle_t mac_handle) -{ - struct mac_context *mac = MAC_CONTEXT(mac_handle); - - return mac->mlme_cfg->lfr.fast_transition_enabled; -} - /** * sme_is_feature_supported_by_fw() - check if feature is supported by FW * @feature: enum value of requested feature.