From a33fdd8376c2210d37e10e95c877a04fe6fcee6a Mon Sep 17 00:00:00 2001 From: Srinivas Dasari Date: Wed, 21 Aug 2019 16:15:22 +0530 Subject: [PATCH] qcacld-3.0: Send full roam scan period to userspace upon querying Userspace may query for current configured full roam scan period through the vendor cmd QCA_WLAN_VENDOR_ROAMING_SUBCMD_CONTROL_GET and the attribute QCA_ATTR_ROAM_CONTROL_FULL_SCAN_PERIOD. Fill the full scan period in the same attribute and send as reply Change-Id: I0ab8b3d7b469515244ce27accc852c6d93514b2d CRs-Fixed: 2508804 --- core/hdd/src/wlan_hdd_cfg80211.c | 21 ++++++++++++++++++++- core/sme/inc/sme_api.h | 15 +++++++++++++++ core/sme/src/common/sme_api.c | 26 ++++++++++++++++++++++++++ 3 files changed, 61 insertions(+), 1 deletion(-) diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 4caabac9f195..99e63ed2d9eb 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -4457,6 +4457,9 @@ hdd_roam_control_config_buf_size(struct hdd_context *hdd_ctx, if (tb[QCA_ATTR_ROAM_CONTROL_STATUS]) skb_len += NLA_HDRLEN + sizeof(uint8_t); + if (tb[QCA_ATTR_ROAM_CONTROL_FULL_SCAN_PERIOD]) + skb_len += NLA_HDRLEN + sizeof(uint32_t); + return skb_len; } @@ -4479,6 +4482,7 @@ hdd_roam_control_config_fill_data(struct hdd_context *hdd_ctx, uint8_t vdev_id, QDF_STATUS status = QDF_STATUS_SUCCESS; uint8_t roam_control; struct nlattr *config; + uint32_t full_roam_scan_period; config = nla_nest_start(skb, PARAM_ROAM_CONTROL_CONFIG); if (!config) @@ -4498,8 +4502,23 @@ hdd_roam_control_config_fill_data(struct hdd_context *hdd_ctx, uint8_t vdev_id, return -ENOMEM; } } - nla_nest_end(skb, config); + if (tb[QCA_ATTR_ROAM_CONTROL_FULL_SCAN_PERIOD]) { + status = sme_get_full_roam_scan_period(hdd_ctx->mac_handle, + vdev_id, + &full_roam_scan_period); + if (QDF_IS_STATUS_ERROR(status)) + goto out; + hdd_debug("full_roam_scan_period: %u", full_roam_scan_period); + + if (nla_put_u32(skb, QCA_ATTR_ROAM_CONTROL_FULL_SCAN_PERIOD, + full_roam_scan_period)) { + hdd_info("failed to put full_roam_scan_period"); + return -EINVAL; + } + } + + nla_nest_end(skb, config); out: return qdf_status_to_os_return(status); } diff --git a/core/sme/inc/sme_api.h b/core/sme/inc/sme_api.h index 7f230d7020a1..f58a7b9c275b 100644 --- a/core/sme/inc/sme_api.h +++ b/core/sme/inc/sme_api.h @@ -3710,4 +3710,19 @@ QDF_STATUS sme_set_roam_config_enable(mac_handle_t mac_handle, */ QDF_STATUS sme_get_roam_config_status(mac_handle_t mac_handle, uint8_t vdev_id, uint8_t *config_status); + +/** + * sme_get_full_roam_scan_period() - Get full roam scan period + * @mac_handle: Opaque handle to the MAC context + * @vdev_id: vdev id + * @full_roam_scan_period: Pointer of a buffer to fill the full roam scan period + * + * Get the full scan period cached in neighborRoamInfo and fill in the given + * buffer full_roam_scan_period. + * + * Return: QDF_STATUS + */ +QDF_STATUS sme_get_full_roam_scan_period(mac_handle_t mac_handle, + uint8_t vdev_id, + uint32_t *full_roam_scan_period); #endif /* #if !defined( __SME_API_H ) */ diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c index 59eb066da297..f6d225473e99 100644 --- a/core/sme/src/common/sme_api.c +++ b/core/sme/src/common/sme_api.c @@ -16161,3 +16161,29 @@ QDF_STATUS sme_get_roam_config_status(mac_handle_t mac_handle, return status; } + +QDF_STATUS +sme_get_full_roam_scan_period(mac_handle_t mac_handle, uint8_t vdev_id, + uint32_t *full_roam_scan_period) +{ + struct mac_context *mac = MAC_CONTEXT(mac_handle); + QDF_STATUS status; + tpCsrNeighborRoamControlInfo neighbor_roam_info; + + if (vdev_id >= WLAN_MAX_VDEVS) { + sme_err("Invalid vdev_id: %d", vdev_id); + return QDF_STATUS_E_INVAL; + } + + status = sme_acquire_global_lock(&mac->sme); + if (QDF_IS_STATUS_ERROR(status)) { + sme_err("Failed to acquire sme lock; status: %d", status); + return status; + } + neighbor_roam_info = &mac->roam.neighborRoamInfo[vdev_id]; + *full_roam_scan_period = + neighbor_roam_info->cfgParams.full_roam_scan_period; + sme_release_global_lock(&mac->sme); + + return status; +}