From 391692d2da282544bcc7c8a9a4a871fbcd8315df Mon Sep 17 00:00:00 2001 From: Srinivas Dasari Date: Wed, 21 Aug 2019 08:40:53 +0530 Subject: [PATCH] qcacld-3.0: Cache the status of roam control enable/disable in CSR Userspace enables the roam control config and may query for it later. In order to indicate the current status to userspace, cache the same in struct sCsrNeighborRoamControlInfo Change-Id: Ib535d6940df48305bda74a624604217d1f968861 CRs-Fixed: 2508777 --- core/hdd/src/wlan_hdd_cfg80211.c | 11 +++++++++++ core/sme/inc/csr_neighbor_roam.h | 11 ++++++++++- core/sme/inc/sme_api.h | 16 ++++++++++++++++ core/sme/src/common/sme_api.c | 24 ++++++++++++++++++++++++ 4 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 e8e69e819667..c880bb303db8 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -4110,6 +4110,7 @@ hdd_send_roam_scan_channel_freq_list_to_sme(struct hdd_context *hdd_ctx, static const struct nla_policy roam_control_policy[QCA_ATTR_ROAM_CONTROL_MAX + 1] = { + [QCA_ATTR_ROAM_CONTROL_ENABLE] = {.type = NLA_U8}, [PARAM_FREQ_LIST_SCHEME] = {.type = NLA_NESTED}, [QCA_ATTR_ROAM_CONTROL_FULL_SCAN_PERIOD] = {.type = NLA_U32}, [QCA_ATTR_ROAM_CONTROL_TRIGGERS] = {.type = NLA_U32}, @@ -4240,6 +4241,16 @@ hdd_set_roam_with_control_config(struct hdd_context *hdd_ctx, hdd_err("failed to config roam triggers"); } + attr = tb2[QCA_ATTR_ROAM_CONTROL_ENABLE]; + if (attr) { + hdd_debug("Parse and send roam control enable/disable"); + status = sme_set_roam_config_enable(hdd_ctx->mac_handle, + vdev_id, + nla_get_u8(attr)); + if (QDF_IS_STATUS_ERROR(status)) + hdd_err("failed to enable/disable roam control config"); + } + return qdf_status_to_os_return(status); } diff --git a/core/sme/inc/csr_neighbor_roam.h b/core/sme/inc/csr_neighbor_roam.h index a2459a4c10c5..d4c9656647a9 100644 --- a/core/sme/inc/csr_neighbor_roam.h +++ b/core/sme/inc/csr_neighbor_roam.h @@ -110,7 +110,15 @@ typedef struct sCsr11rAssocNeighborInfo { tDblLinkList preAuthDoneList; /* llist which consists/preauth nodes */ } tCsr11rAssocNeighborInfo, *tpCsr11rAssocNeighborInfo; -/* Complete control information for neighbor roam algorithm */ +/** + * struct sCsr11rAssocNeighborInfo - Control info for neighbor roam algorithm + * @roam_control_enable: Flag used to cache the status of roam control + * configuration. This will be set only if the + * corresponding vendor command data is configured to + * driver/firmware successfully. The same shall be + * returned to userspace whenever queried for roam + * control config status. + */ typedef struct sCsrNeighborRoamControlInfo { eCsrNeighborRoamState neighborRoamState; eCsrNeighborRoamState prevNeighborRoamState; @@ -146,6 +154,7 @@ typedef struct sCsrNeighborRoamControlInfo { uint8_t last_sent_cmd; bool b_roam_scan_offload_started; struct scan_result_list *scan_res_lfr2_roam_ap; + bool roam_control_enable; } tCsrNeighborRoamControlInfo, *tpCsrNeighborRoamControlInfo; /* All the necessary Function declarations are here */ diff --git a/core/sme/inc/sme_api.h b/core/sme/inc/sme_api.h index 185cdc851ca2..98ec8c126c61 100644 --- a/core/sme/inc/sme_api.h +++ b/core/sme/inc/sme_api.h @@ -3648,4 +3648,20 @@ void sme_chan_to_freq_list( */ QDF_STATUS sme_set_roam_triggers(mac_handle_t mac_handle, struct roam_triggers *triggers); + +/** + * sme_set_roam_config_enable() - Cache roam config status in SME + * @mac_handle: Opaque handle to the MAC context + * @vdev_id: vdev id + * @roam_control_enable: Carries a non-zero value if the current set request is + * for enable, otherwise carries a 0. + * + * Cache control roam config enable/disable status in SME so that the + * userspace can query for the status based on a vdev/session at any time. + * + * Return: QDF_STATUS + */ +QDF_STATUS sme_set_roam_config_enable(mac_handle_t mac_handle, + uint8_t vdev_id, + uint8_t roam_control_enable); #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 c077a5e42b89..09a6c3c06947 100644 --- a/core/sme/src/common/sme_api.c +++ b/core/sme/src/common/sme_api.c @@ -16030,3 +16030,27 @@ QDF_STATUS sme_set_roam_triggers(mac_handle_t mac_handle, return status; } + +QDF_STATUS sme_set_roam_config_enable(mac_handle_t mac_handle, + uint8_t vdev_id, + uint8_t roam_control_enable) +{ + struct mac_context *mac = MAC_CONTEXT(mac_handle); + QDF_STATUS status; + + 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; + } + mac->roam.neighborRoamInfo[vdev_id].roam_control_enable = + !!roam_control_enable; + sme_release_global_lock(&mac->sme); + + return status; +}